From patchwork Sun Jun 3 18:20:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10445529 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 81C2B601BC for ; Sun, 3 Jun 2018 18:22:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7164328A4D for ; Sun, 3 Jun 2018 18:22:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5EBB128B24; Sun, 3 Jun 2018 18:22:49 +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 DE43C28A4D for ; Sun, 3 Jun 2018 18:22:48 +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=d5U9ZTHof9FAqvtHlrXE9khtr8nUVhfP8YrRCdj3Hr0=; b=rCrOAeQ/h2QyHRJ/uJdkMsEUqy /cOpAnDxrynOLMjK9k4HNfWLa1WrXFzi0PZf+wZA94o/8jpVB2xgGPcxD7G86Y3Xze7wmJWk9VnRw AkSPwPtJUtdXYwm8FgWPl+KQ1zuosBFK36pbGeTVMgmKPIxVDXD8rQ7SZ/uSVG6UYnVhxWfWNho6Q cVxhzRvs5cZJ/fFre3QPVjcDZiwlBR8A2fJqUw2TjQyEIDRKbhOw002YBZMJkzXCL+pOd3jIA+Dox J8yCY3hFidFqg0WN1wdv6tMjcnCiOcOA3orxmh+NmrAfltDp5DvNYlQxC1O/yju+XnRfTGFZMB0kn R3F2+fEQ==; 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 1fPXe5-0006ZG-3m; Sun, 03 Jun 2018 18:22:25 +0000 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fPXe0-0006VS-Sf for ath10k@lists.infradead.org; Sun, 03 Jun 2018 18:22:22 +0000 Received: by mail-lf0-x242.google.com with SMTP id n3-v6so21785710lfe.12 for ; Sun, 03 Jun 2018 11:22:12 -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=6SNnJMWMEbirQTbrePI7nEC8tfevYgg/mcRgVQa/OSA=; b=ngiETv2YSKQ+59S5LhGBGXUihWbCzlsNIqDTvHDP2rm37Zc1iqvQYCHZergF69coUk Ky/qxrqphgSH2x7yWh4HZMkNofQqjKq334b58u6WKj5CsygZzrYbcgfrllQ/9IN4zJRb m36Xu/N/Jy7BeQqsdcefMbtax5URPI21rbSHweuNIL3yTodmVBBOfFojeCXbs3VNWWb6 DPWM/9QUV2Z6gXQnhv+OnSE9jRTsZoxJig9UqLjjgLvkD1lPWa2vGT4gJB0eD0DkUfXi C8YQcxiDXAhmZbbQBim2syZSufGFatMvNLC3Q499+/rI1YEuKCUT4qayo4Oz+PE8fBDZ 7zPQ== 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=6SNnJMWMEbirQTbrePI7nEC8tfevYgg/mcRgVQa/OSA=; b=n0aOh/HUhY+VC2XOpvrUEyh/1KbGMA6C7trTs9reAsOj2bMUZ9uMqq2AEi3m3tk4c0 0YzjBJMQ+0dD4H10NiBQQHa+KZM0Emm3plL8vmttHCTkV9wQJ2tjMn8ZCyz1MuFeGIBZ TVHzn8TUmRvyLkWHmCSuuuKME+xYPYy8SF5oc4hr5PaD15KDrOdnyQC4bb8HV8vwFNxB pKchz80j0xAxHwqb6Ra8LfNTGwBq3xsZ0fY/zMcEL9uszcje91gagPUmxz3/a63AgcYt utFvcuFaOrXC3cLWzoiqWns/FHkcLxBYMJ5TuXB3xW6LtuFK9zJsnc9adk2/MkFwF5j3 Xerg== X-Gm-Message-State: ALKqPwe7DF3Unw4+oDkrQKJIPWjucw+z+93FCorgTm9qlFxS2iFWPkAa jJ7yR7TUB4i4FInpc6QTnIg= X-Google-Smtp-Source: ADUXVKLBAsUNKs8Q06FlCKbr4u+BW5GAZ/dEicpwijbyhDBkb7OxiAffU+53ylojhX4pqwEzKoe6hA== X-Received: by 2002:a2e:5442:: with SMTP id y2-v6mr12495843ljd.11.1528050131298; Sun, 03 Jun 2018 11:22:11 -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.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Jun 2018 11:22:10 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: [RFC v5 03/12] ath10k: add bus type check in ath10k_init_hw_params Date: Sun, 3 Jun 2018 20:20:20 +0200 Message-Id: <20180603182029.8914-4-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_112220_941098_76800A29 X-CRM114-Status: GOOD ( 12.50 ) 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 The bus type is used together with the other hw parameters to find a matching entry in ath10k_hw_params_list for the device. This is necessary since HL devices can have the same dev_id and target_version as a corresponding LL device (same chipset) and yet use a totally different configuration. Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/core.c | 16 +++++++++++++++- drivers/net/wireless/ath/ath10k/core.h | 8 -------- drivers/net/wireless/ath/ath10k/hw.h | 9 +++++++++ 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index ebc8ea7cfd40..a146c83d6ff9 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -65,6 +65,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { { .id = QCA988X_HW_2_0_VERSION, .dev_id = QCA988X_2_0_DEVICE_ID, + .bus = ATH10K_BUS_PCI, .name = "qca988x hw2.0", .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -128,6 +129,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { { .id = QCA9887_HW_1_0_VERSION, .dev_id = QCA9887_1_0_DEVICE_ID, + .bus = ATH10K_BUS_PCI, .name = "qca9887 hw1.0", .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -160,6 +162,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { { .id = QCA6174_HW_2_1_VERSION, .dev_id = QCA6164_2_1_DEVICE_ID, + .bus = ATH10K_BUS_PCI, .name = "qca6164 hw2.1", .patch_load_addr = QCA6174_HW_2_1_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -191,6 +194,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { { .id = QCA6174_HW_2_1_VERSION, .dev_id = QCA6174_2_1_DEVICE_ID, + .bus = ATH10K_BUS_PCI, .name = "qca6174 hw2.1", .patch_load_addr = QCA6174_HW_2_1_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -222,6 +226,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { { .id = QCA6174_HW_3_0_VERSION, .dev_id = QCA6174_2_1_DEVICE_ID, + .bus = ATH10K_BUS_PCI, .name = "qca6174 hw3.0", .patch_load_addr = QCA6174_HW_3_0_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -253,6 +258,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { { .id = QCA6174_HW_3_2_VERSION, .dev_id = QCA6174_2_1_DEVICE_ID, + .bus = ATH10K_BUS_PCI, .name = "qca6174 hw3.2", .patch_load_addr = QCA6174_HW_3_0_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -287,6 +293,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { { .id = QCA99X0_HW_2_0_DEV_VERSION, .dev_id = QCA99X0_2_0_DEVICE_ID, + .bus = ATH10K_BUS_PCI, .name = "qca99x0 hw2.0", .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -324,6 +331,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { { .id = QCA9984_HW_1_0_DEV_VERSION, .dev_id = QCA9984_1_0_DEVICE_ID, + .bus = ATH10K_BUS_PCI, .name = "qca9984/qca9994 hw1.0", .patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -366,6 +374,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { { .id = QCA9888_HW_2_0_DEV_VERSION, .dev_id = QCA9888_2_0_DEVICE_ID, + .bus = ATH10K_BUS_PCI, .name = "qca9888 hw2.0", .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -407,6 +416,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { { .id = QCA9377_HW_1_0_DEV_VERSION, .dev_id = QCA9377_1_0_DEVICE_ID, + .bus = ATH10K_BUS_PCI, .name = "qca9377 hw1.0", .patch_load_addr = QCA9377_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -438,6 +448,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { { .id = QCA9377_HW_1_1_DEV_VERSION, .dev_id = QCA9377_1_0_DEVICE_ID, + .bus = ATH10K_BUS_PCI, .name = "qca9377 hw1.1", .patch_load_addr = QCA9377_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -471,6 +482,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { { .id = QCA4019_HW_1_0_DEV_VERSION, .dev_id = 0, + .bus = ATH10K_BUS_AHB, .name = "qca4019 hw1.0", .patch_load_addr = QCA4019_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -509,6 +521,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { { .id = WCN3990_HW_1_0_DEV_VERSION, .dev_id = 0, + .bus = ATH10K_BUS_PCI, .name = "wcn3990 hw1.0", .continuous_frag_desc = true, .tx_chain_mask = 0x7, @@ -1871,7 +1884,8 @@ static int ath10k_init_hw_params(struct ath10k *ar) for (i = 0; i < ARRAY_SIZE(ath10k_hw_params_list); i++) { hw_params = &ath10k_hw_params_list[i]; - if (hw_params->id == ar->target_version && + if (hw_params->bus == ar->hif.bus && + hw_params->id == ar->target_version && hw_params->dev_id == ar->dev_id) break; } diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index f3e94531bbee..d0c7b821a13e 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -91,14 +91,6 @@ struct ath10k; -enum ath10k_bus { - ATH10K_BUS_PCI, - ATH10K_BUS_AHB, - ATH10K_BUS_SDIO, - ATH10K_BUS_USB, - ATH10K_BUS_SNOC, -}; - static inline const char *ath10k_bus_str(enum ath10k_bus bus) { switch (bus) { diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h index 23467e9fefeb..53a7778c63a9 100644 --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h @@ -21,6 +21,14 @@ #include "targaddrs.h" +enum ath10k_bus { + ATH10K_BUS_PCI, + ATH10K_BUS_AHB, + ATH10K_BUS_SDIO, + ATH10K_BUS_USB, + ATH10K_BUS_SNOC, +}; + #define ATH10K_FW_DIR "ath10k" #define QCA988X_2_0_DEVICE_ID_UBNT (0x11ac) @@ -501,6 +509,7 @@ struct ath10k_hw_clk_params { struct ath10k_hw_params { u32 id; u16 dev_id; + enum ath10k_bus bus; const char *name; u32 patch_load_addr; int uart_pin;