From patchwork Sun Jun 3 18:20:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10445545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B74FA60234 for ; Sun, 3 Jun 2018 18:23:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A61D4286B3 for ; Sun, 3 Jun 2018 18:23:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AA412886D; Sun, 3 Jun 2018 18:23:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0CE32286B3 for ; Sun, 3 Jun 2018 18:23:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=sE0QGSnXT3Tl5EF/J88ZtHsA7ah23okp4H37Rp8JPC8=; b=K+HpRkxi9DX2zXoJNLHZi0eibg kSAF6uR8uYYxPJS5/6qeITZWVDEmbvNQfJJVSIJJli7IDTSnpTCsogH7M5zo0Oj0UhfnPk2DYbGzl 6pGGdQ07J3QNGjmWAuQE/tEFZKw3fLEugs8qmunFhRCqThOnyru1aIa9TkohAdMvn4hCbWBS+5+SN rsCFIzMrbZ7voWXeDjZCceWZ1PIoCOzJL4H9DGF8WMKEvlzTvJDIwBj+W3O7YiG4+ytQS/eYlZwdj BvCrDE9kuREGC2pXdBgZ9NgnMcMje/k9UTZk2zsfUmhfGXMhTBigWXOKPYGRK+A62Hz9SMzCgzu1r T0iMPrUw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fPXfN-0007Iz-5g; Sun, 03 Jun 2018 18:23:45 +0000 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fPXe2-0006V2-1U for ath10k@lists.infradead.org; Sun, 03 Jun 2018 18:22:36 +0000 Received: by mail-lf0-x241.google.com with SMTP id n3-v6so21785656lfe.12 for ; Sun, 03 Jun 2018 11:22:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=x90iaOBYlsQqbQixq2t7PEm3FTWvm9GPSzzEayBRmBg=; b=EM7mbK3B1P23160HJFP1j62tKI3tR0YI1BpTE6jX/UA3pKIvi3ODcKFQpmDjY+YBhn mrRWZt0C0PngqYE8eM4Lzcnr8gjz9lp6hb+VKt2BD2TEIpQQ4pT0Gbr/B3ok4QaKK44R UyhuP5VSflhMCtYe3V03s/LJo+iZXTJyzSIw0X8KNQvbEqAB7nzLwxdXqpwsw0oYw6JL JNS0OA6rSJSGwb1xQ3FKZhA39Awe0z6uItEPb16YOoQNdk4oKhyonzDgLu+njY/JDRfL 0RK3U/R9Qp5kZfIZo//83vWPkrXotWfNfvOvbhuO71Joqk1JuvzofPIevMYAhc8TVgh/ sLDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=x90iaOBYlsQqbQixq2t7PEm3FTWvm9GPSzzEayBRmBg=; b=dzPfYKscurpsMqhR/MhyObx0B1nt/fSWxEHG8kUsA/DrSlf6vMqmRcML7qVl7ydH0I kAuFdSqyBXFun/yOvjid7pzU5aEQu0ukcwJhBSTApfLRSB5d8fM7tH9tbcPOYTauFNVw gQ8UrJySVvUZw9bfhy4IedPkTfcxXAF1VlVGEtNcpx6MKE29BNo6Cb3XyOAURGnMYlhj 6F12i7BdNWekh3ZME3mWgVqaO3qolVgNkrSdefceNCKqeLd6jzOmL8PMHQI9KDAo0fZx OBBIAGAg+mFDkcayEh8XtS7DntNJu+7RZlo6mjNfLzvnK6qsJlm3hrHsiVly3HA3khMO WZ1Q== X-Gm-Message-State: ALKqPwd8nrCn0cWttcUHtKw65H7c9kNYZMfX7kEkM+Q1lsagUxhLoABi F50be8+xhFMMC6lec8HYs1Q= X-Google-Smtp-Source: ADUXVKIwEWUKCPVOiLu9P7QwTh34x08Ygj5PY7HB8HQuYHDlnKEgV5JHOV0by9XX2HD/rdJ0IkAyNQ== X-Received: by 2002:a19:8e01:: with SMTP id q1-v6mr9959415lfd.35.1528050129487; Sun, 03 Jun 2018 11:22:09 -0700 (PDT) Received: from localhost.localdomain (90-227-62-61-no75.tbcn.telia.com. [90.227.62.61]) by smtp.gmail.com with ESMTPSA id l200-v6sm4980562lfe.77.2018.06.03.11.22.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Jun 2018 11:22:08 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [RFC v5 01/12] ath10k: add struct ath10k_bus_params Date: Sun, 3 Jun 2018 20:20:18 +0200 Message-Id: <20180603182029.8914-2-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180603182029.8914-1-erik.stromdahl@gmail.com> References: <20180603182029.8914-1-erik.stromdahl@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180603_112222_102380_B932D5D3 X-CRM114-Status: GOOD ( 15.63 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Erik Stromdahl MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This struct is used as argument to ath10k_core_register in order to make it easier to add more bus parameters in the future. Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/ahb.c | 8 ++++---- drivers/net/wireless/ath/ath10k/core.c | 5 +++-- drivers/net/wireless/ath/ath10k/core.h | 7 ++++++- drivers/net/wireless/ath/ath10k/pci.c | 12 ++++++------ drivers/net/wireless/ath/ath10k/sdio.c | 7 ++++--- drivers/net/wireless/ath/ath10k/snoc.c | 4 +++- drivers/net/wireless/ath/ath10k/usb.c | 6 +++--- 7 files changed, 29 insertions(+), 20 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/ahb.c b/drivers/net/wireless/ath/ath10k/ahb.c index fa39ffffd34d..5e272e940efd 100644 --- a/drivers/net/wireless/ath/ath10k/ahb.c +++ b/drivers/net/wireless/ath/ath10k/ahb.c @@ -755,7 +755,7 @@ static int ath10k_ahb_probe(struct platform_device *pdev) enum ath10k_hw_rev hw_rev; size_t size; int ret; - u32 chip_id; + struct ath10k_bus_params bus_params; of_id = of_match_device(ath10k_ahb_of_match, &pdev->dev); if (!of_id) { @@ -811,14 +811,14 @@ static int ath10k_ahb_probe(struct platform_device *pdev) ath10k_pci_ce_deinit(ar); - chip_id = ath10k_ahb_soc_read32(ar, SOC_CHIP_ID_ADDRESS); - if (chip_id == 0xffffffff) { + bus_params.chip_id = ath10k_ahb_soc_read32(ar, SOC_CHIP_ID_ADDRESS); + if (bus_params.chip_id == 0xffffffff) { ath10k_err(ar, "failed to get chip id\n"); ret = -ENODEV; goto err_halt_device; } - ret = ath10k_core_register(ar, chip_id); + ret = ath10k_core_register(ar, &bus_params); if (ret) { ath10k_err(ar, "failed to register driver core: %d\n", ret); goto err_halt_device; diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 4cf54a7ef09a..eee6e39e4e99 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -2702,9 +2702,10 @@ static void ath10k_core_register_work(struct work_struct *work) return; } -int ath10k_core_register(struct ath10k *ar, u32 chip_id) +int ath10k_core_register(struct ath10k *ar, + const struct ath10k_bus_params *bus_params) { - ar->chip_id = chip_id; + ar->chip_id = bus_params->chip_id; queue_work(ar->workqueue, &ar->register_work); return 0; diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 951dbdd1c9eb..6dd68df104e4 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -874,6 +874,10 @@ struct ath10k_per_peer_tx_stats { u32 reserved2; }; +struct ath10k_bus_params { + u32 chip_id; +}; + struct ath10k { struct ath_common ath_common; struct ieee80211_hw *hw; @@ -1161,7 +1165,8 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode, const struct ath10k_fw_components *fw_components); int ath10k_wait_for_suspend(struct ath10k *ar, u32 suspend_opt); void ath10k_core_stop(struct ath10k *ar); -int ath10k_core_register(struct ath10k *ar, u32 chip_id); +int ath10k_core_register(struct ath10k *ar, + const struct ath10k_bus_params *bus_params); void ath10k_core_unregister(struct ath10k *ar); #endif /* _CORE_H_ */ diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index af2cf55c4c1e..7b5b93f48ba2 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -3482,7 +3482,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev, struct ath10k *ar; struct ath10k_pci *ar_pci; enum ath10k_hw_rev hw_rev; - u32 chip_id; + struct ath10k_bus_params bus_params; bool pci_ps; int (*pci_soft_reset)(struct ath10k *ar); int (*pci_hard_reset)(struct ath10k *ar); @@ -3618,19 +3618,19 @@ static int ath10k_pci_probe(struct pci_dev *pdev, goto err_free_irq; } - chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS); - if (chip_id == 0xffffffff) { + bus_params.chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS); + if (bus_params.chip_id == 0xffffffff) { ath10k_err(ar, "failed to get chip id\n"); goto err_free_irq; } - if (!ath10k_pci_chip_is_supported(pdev->device, chip_id)) { + if (!ath10k_pci_chip_is_supported(pdev->device, bus_params.chip_id)) { ath10k_err(ar, "device %04x with chip_id %08x isn't supported\n", - pdev->device, chip_id); + pdev->device, bus_params.chip_id); goto err_free_irq; } - ret = ath10k_core_register(ar, chip_id); + ret = ath10k_core_register(ar, &bus_params); if (ret) { ath10k_err(ar, "failed to register driver core: %d\n", ret); goto err_free_irq; diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index d612ce8c9cff..be61d868edcf 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -1931,7 +1931,8 @@ static int ath10k_sdio_probe(struct sdio_func *func, struct ath10k_sdio *ar_sdio; struct ath10k *ar; enum ath10k_hw_rev hw_rev; - u32 chip_id, dev_id_base; + u32 dev_id_base; + struct ath10k_bus_params bus_params; int ret, i; /* Assumption: All SDIO based chipsets (so far) are QCA6174 based. @@ -2026,8 +2027,8 @@ static int ath10k_sdio_probe(struct sdio_func *func, } /* TODO: don't know yet how to get chip_id with SDIO */ - chip_id = 0; - ret = ath10k_core_register(ar, chip_id); + bus_params.chip_id = 0; + ret = ath10k_core_register(ar, &bus_params); if (ret) { ath10k_err(ar, "failed to register driver core: %d\n", ret); goto err_free_wq; diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index a3a7042fe13a..46d2a7a21efb 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -1273,6 +1273,7 @@ static int ath10k_snoc_probe(struct platform_device *pdev) struct ath10k *ar; int ret; u32 i; + struct ath10k_bus_params bus_params; of_id = of_match_device(ath10k_snoc_dt_match, &pdev->dev); if (!of_id) { @@ -1340,7 +1341,8 @@ static int ath10k_snoc_probe(struct platform_device *pdev) goto err_free_irq; } - ret = ath10k_core_register(ar, drv_data->hw_rev); + bus_params.chip_id = drv_data->hw_rev; + ret = ath10k_core_register(ar, &bus_params); if (ret) { ath10k_err(ar, "failed to register driver core: %d\n", ret); goto err_hw_power_off; diff --git a/drivers/net/wireless/ath/ath10k/usb.c b/drivers/net/wireless/ath/ath10k/usb.c index d4803ff5a78a..275e00bafcb1 100644 --- a/drivers/net/wireless/ath/ath10k/usb.c +++ b/drivers/net/wireless/ath/ath10k/usb.c @@ -983,7 +983,7 @@ static int ath10k_usb_probe(struct usb_interface *interface, struct usb_device *dev = interface_to_usbdev(interface); int ret, vendor_id, product_id; enum ath10k_hw_rev hw_rev; - u32 chip_id; + struct ath10k_bus_params bus_params; /* Assumption: All USB based chipsets (so far) are QCA9377 based. * If there will be newer chipsets that does not use the hw reg @@ -1017,8 +1017,8 @@ static int ath10k_usb_probe(struct usb_interface *interface, ar->id.device = product_id; /* TODO: don't know yet how to get chip_id with USB */ - chip_id = 0; - ret = ath10k_core_register(ar, chip_id); + bus_params.chip_id = 0; + ret = ath10k_core_register(ar, &bus_params); if (ret) { ath10k_warn(ar, "failed to register driver core: %d\n", ret); goto err;