mmc: sdio: Move SDIO IDs from ath10k driver to common include file
authorPali Rohár <pali@kernel.org>
Fri, 22 May 2020 14:44:09 +0000 (16:44 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Fri, 29 May 2020 10:37:59 +0000 (12:37 +0200)
Also replace generic MANUFACTURER macros by proper SDIO IDs macros.

Checks for device IDs are slightly modified to use SDIO device IDs.
This allows removal of all custom MANUFACTURER macros from ath10k.

Signed-off-by: Pali Rohár <pali@kernel.org>
Link: https://lore.kernel.org/r/20200522144412.19712-9-pali@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/net/wireless/ath/ath10k/sdio.c
drivers/net/wireless/ath/ath10k/sdio.h
include/linux/mmc/sdio_ids.h

index 1f709b65c29b2bd40d5c3b8553728a4fedd014b3..59e7255150418612a5721c59103937eca1b43f21 100644 (file)
@@ -1083,10 +1083,10 @@ static void ath10k_sdio_set_mbox_info(struct ath10k *ar)
 
        mbox_info->ext_info[0].htc_ext_addr = ATH10K_HIF_MBOX0_EXT_BASE_ADDR;
 
-       dev_id_base = FIELD_GET(QCA_MANUFACTURER_ID_BASE, device);
-       dev_id_chiprev = FIELD_GET(QCA_MANUFACTURER_ID_REV_MASK, device);
+       dev_id_base = (device & 0x0F00);
+       dev_id_chiprev = (device & 0x00FF);
        switch (dev_id_base) {
-       case QCA_MANUFACTURER_ID_AR6005_BASE:
+       case (SDIO_DEVICE_ID_ATHEROS_AR6005 & 0x0F00):
                if (dev_id_chiprev < 4)
                        mbox_info->ext_info[0].htc_ext_sz =
                                ATH10K_HIF_MBOX0_EXT_WIDTH;
@@ -1097,7 +1097,7 @@ static void ath10k_sdio_set_mbox_info(struct ath10k *ar)
                        mbox_info->ext_info[0].htc_ext_sz =
                                ATH10K_HIF_MBOX0_EXT_WIDTH_ROME_2_0;
                break;
-       case QCA_MANUFACTURER_ID_QCA9377_BASE:
+       case (SDIO_DEVICE_ID_ATHEROS_QCA9377 & 0x0F00):
                mbox_info->ext_info[0].htc_ext_sz =
                        ATH10K_HIF_MBOX0_EXT_WIDTH_ROME_2_0;
                break;
@@ -2185,19 +2185,16 @@ static int ath10k_sdio_probe(struct sdio_func *func,
        skb_queue_head_init(&ar_sdio->rx_head);
        INIT_WORK(&ar_sdio->async_work_rx, ath10k_rx_indication_async_work);
 
-       dev_id_base = FIELD_GET(QCA_MANUFACTURER_ID_BASE, id->device);
-       switch (dev_id_base) {
-       case QCA_MANUFACTURER_ID_AR6005_BASE:
-       case QCA_MANUFACTURER_ID_QCA9377_BASE:
-               ar->dev_id = QCA9377_1_0_DEVICE_ID;
-               break;
-       default:
+       dev_id_base = (id->device & 0x0F00);
+       if (dev_id_base != (SDIO_DEVICE_ID_ATHEROS_AR6005 & 0x0F00) &&
+           dev_id_base != (SDIO_DEVICE_ID_ATHEROS_QCA9377 & 0x0F00)) {
                ret = -ENODEV;
                ath10k_err(ar, "unsupported device id %u (0x%x)\n",
                           dev_id_base, id->device);
                goto err_free_wq;
        }
 
+       ar->dev_id = QCA9377_1_0_DEVICE_ID;
        ar->id.vendor = id->vendor;
        ar->id.device = id->device;
 
@@ -2246,10 +2243,8 @@ static void ath10k_sdio_remove(struct sdio_func *func)
 }
 
 static const struct sdio_device_id ath10k_sdio_devices[] = {
-       {SDIO_DEVICE(QCA_MANUFACTURER_CODE,
-                    (QCA_SDIO_ID_AR6005_BASE | 0xA))},
-       {SDIO_DEVICE(QCA_MANUFACTURER_CODE,
-                    (QCA_SDIO_ID_QCA9377_BASE | 0x1))},
+       {SDIO_DEVICE(SDIO_VENDOR_ID_ATHEROS, SDIO_DEVICE_ID_ATHEROS_AR6005)},
+       {SDIO_DEVICE(SDIO_VENDOR_ID_ATHEROS, SDIO_DEVICE_ID_ATHEROS_QCA9377)},
        {},
 };
 
index 33195f49acabc478088026c96802428e8a93b414..e8951f9cdb5f3948cd137422e6edf33d757578e6 100644 (file)
 
 #define ATH10K_HIF_MBOX_BLOCK_SIZE              256
 
-#define QCA_MANUFACTURER_ID_BASE                GENMASK(11, 8)
-#define QCA_MANUFACTURER_ID_AR6005_BASE         0x5
-#define QCA_MANUFACTURER_ID_QCA9377_BASE        0x7
-#define QCA_SDIO_ID_AR6005_BASE                 0x500
-#define QCA_SDIO_ID_QCA9377_BASE                0x700
-#define QCA_MANUFACTURER_ID_REV_MASK            0x00FF
-#define QCA_MANUFACTURER_CODE                   0x271 /* Qualcomm/Atheros */
-
 #define ATH10K_SDIO_MAX_BUFFER_SIZE             4096 /*Unsure of this constant*/
 
 /* Mailbox address in SDIO address space */
index 95b67ab7d06a6b4fccb5f696881a9969696c6b50..2894f7739accf5de1b75644ccfa0d336a5e18447 100644 (file)
@@ -33,6 +33,8 @@
 #define SDIO_DEVICE_ID_ATHEROS_AR6004_02       0x0402
 #define SDIO_DEVICE_ID_ATHEROS_AR6004_18       0x0418
 #define SDIO_DEVICE_ID_ATHEROS_AR6004_19       0x0419
+#define SDIO_DEVICE_ID_ATHEROS_AR6005          0x050A
+#define SDIO_DEVICE_ID_ATHEROS_QCA9377         0x0701
 
 #define SDIO_VENDOR_ID_BROADCOM                        0x02d0
 #define SDIO_DEVICE_ID_BROADCOM_43143          0xa887