tg3: Reformat SSID to phy ID table
Matt Carlson [Wed, 17 Feb 2010 15:17:02 +0000 (15:17 +0000)]
This patch reformats the SSID to phy ID table, replacing constants with
preprocessor definitions.  This patch is also prep work for the
following patch, which will push line lengths beyond 80 chars.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

drivers/net/tg3.c
drivers/net/tg3.h

index 3a62cc5..b545ea7 100644 (file)
@@ -12112,45 +12112,71 @@ struct subsys_tbl_ent {
        u32 phy_id;
 };
 
-static struct subsys_tbl_ent subsys_id_to_phy_id[] = {
+static struct subsys_tbl_ent subsys_id_to_phy_id[] __devinitdata = {
        /* Broadcom boards. */
-       { PCI_VENDOR_ID_BROADCOM, 0x1644, PHY_ID_BCM5401 }, /* BCM95700A6 */
-       { PCI_VENDOR_ID_BROADCOM, 0x0001, PHY_ID_BCM5701 }, /* BCM95701A5 */
-       { PCI_VENDOR_ID_BROADCOM, 0x0002, PHY_ID_BCM8002 }, /* BCM95700T6 */
-       { PCI_VENDOR_ID_BROADCOM, 0x0003, 0 },              /* BCM95700A9 */
-       { PCI_VENDOR_ID_BROADCOM, 0x0005, PHY_ID_BCM5701 }, /* BCM95701T1 */
-       { PCI_VENDOR_ID_BROADCOM, 0x0006, PHY_ID_BCM5701 }, /* BCM95701T8 */
-       { PCI_VENDOR_ID_BROADCOM, 0x0007, 0 },              /* BCM95701A7 */
-       { PCI_VENDOR_ID_BROADCOM, 0x0008, PHY_ID_BCM5701 }, /* BCM95701A10 */
-       { PCI_VENDOR_ID_BROADCOM, 0x8008, PHY_ID_BCM5701 }, /* BCM95701A12 */
-       { PCI_VENDOR_ID_BROADCOM, 0x0009, PHY_ID_BCM5703 }, /* BCM95703Ax1 */
-       { PCI_VENDOR_ID_BROADCOM, 0x8009, PHY_ID_BCM5703 }, /* BCM95703Ax2 */
+       { TG3PCI_SUBVENDOR_ID_BROADCOM,
+         TG3PCI_SUBDEVICE_ID_BROADCOM_95700A6, PHY_ID_BCM5401 },
+       { TG3PCI_SUBVENDOR_ID_BROADCOM,
+         TG3PCI_SUBDEVICE_ID_BROADCOM_95701A5, PHY_ID_BCM5701 },
+       { TG3PCI_SUBVENDOR_ID_BROADCOM,
+         TG3PCI_SUBDEVICE_ID_BROADCOM_95700T6, PHY_ID_BCM8002 },
+       { TG3PCI_SUBVENDOR_ID_BROADCOM,
+         TG3PCI_SUBDEVICE_ID_BROADCOM_95700A9, 0 },
+       { TG3PCI_SUBVENDOR_ID_BROADCOM,
+         TG3PCI_SUBDEVICE_ID_BROADCOM_95701T1, PHY_ID_BCM5701 },
+       { TG3PCI_SUBVENDOR_ID_BROADCOM,
+         TG3PCI_SUBDEVICE_ID_BROADCOM_95701T8, PHY_ID_BCM5701 },
+       { TG3PCI_SUBVENDOR_ID_BROADCOM,
+         TG3PCI_SUBDEVICE_ID_BROADCOM_95701A7, 0 },
+       { TG3PCI_SUBVENDOR_ID_BROADCOM,
+         TG3PCI_SUBDEVICE_ID_BROADCOM_95701A10, PHY_ID_BCM5701 },
+       { TG3PCI_SUBVENDOR_ID_BROADCOM,
+         TG3PCI_SUBDEVICE_ID_BROADCOM_95701A12, PHY_ID_BCM5701 },
+       { TG3PCI_SUBVENDOR_ID_BROADCOM,
+         TG3PCI_SUBDEVICE_ID_BROADCOM_95703AX1, PHY_ID_BCM5703 },
+       { TG3PCI_SUBVENDOR_ID_BROADCOM,
+         TG3PCI_SUBDEVICE_ID_BROADCOM_95703AX2, PHY_ID_BCM5703 },
 
        /* 3com boards. */
-       { PCI_VENDOR_ID_3COM, 0x1000, PHY_ID_BCM5401 }, /* 3C996T */
-       { PCI_VENDOR_ID_3COM, 0x1006, PHY_ID_BCM5701 }, /* 3C996BT */
-       { PCI_VENDOR_ID_3COM, 0x1004, 0 },              /* 3C996SX */
-       { PCI_VENDOR_ID_3COM, 0x1007, PHY_ID_BCM5701 }, /* 3C1000T */
-       { PCI_VENDOR_ID_3COM, 0x1008, PHY_ID_BCM5701 }, /* 3C940BR01 */
+       { TG3PCI_SUBVENDOR_ID_3COM,
+         TG3PCI_SUBDEVICE_ID_3COM_3C996T, PHY_ID_BCM5401 },
+       { TG3PCI_SUBVENDOR_ID_3COM,
+         TG3PCI_SUBDEVICE_ID_3COM_3C996BT, PHY_ID_BCM5701 },
+       { TG3PCI_SUBVENDOR_ID_3COM,
+         TG3PCI_SUBDEVICE_ID_3COM_3C996SX, 0 },
+       { TG3PCI_SUBVENDOR_ID_3COM,
+         TG3PCI_SUBDEVICE_ID_3COM_3C1000T, PHY_ID_BCM5701 },
+       { TG3PCI_SUBVENDOR_ID_3COM,
+         TG3PCI_SUBDEVICE_ID_3COM_3C940BR01, PHY_ID_BCM5701 },
 
        /* DELL boards. */
-       { PCI_VENDOR_ID_DELL, 0x00d1, PHY_ID_BCM5401 }, /* VIPER */
-       { PCI_VENDOR_ID_DELL, 0x0106, PHY_ID_BCM5401 }, /* JAGUAR */
-       { PCI_VENDOR_ID_DELL, 0x0109, PHY_ID_BCM5411 }, /* MERLOT */
-       { PCI_VENDOR_ID_DELL, 0x010a, PHY_ID_BCM5411 }, /* SLIM_MERLOT */
+       { TG3PCI_SUBVENDOR_ID_DELL,
+         TG3PCI_SUBDEVICE_ID_DELL_VIPER, PHY_ID_BCM5401 },
+       { TG3PCI_SUBVENDOR_ID_DELL,
+         TG3PCI_SUBDEVICE_ID_DELL_JAGUAR, PHY_ID_BCM5401 },
+       { TG3PCI_SUBVENDOR_ID_DELL,
+         TG3PCI_SUBDEVICE_ID_DELL_MERLOT, PHY_ID_BCM5411 },
+       { TG3PCI_SUBVENDOR_ID_DELL,
+         TG3PCI_SUBDEVICE_ID_DELL_SLIM_MERLOT, PHY_ID_BCM5411 },
 
        /* Compaq boards. */
-       { PCI_VENDOR_ID_COMPAQ, 0x007c, PHY_ID_BCM5701 }, /* BANSHEE */
-       { PCI_VENDOR_ID_COMPAQ, 0x009a, PHY_ID_BCM5701 }, /* BANSHEE_2 */
-       { PCI_VENDOR_ID_COMPAQ, 0x007d, 0 },              /* CHANGELING */
-       { PCI_VENDOR_ID_COMPAQ, 0x0085, PHY_ID_BCM5701 }, /* NC7780 */
-       { PCI_VENDOR_ID_COMPAQ, 0x0099, PHY_ID_BCM5701 }, /* NC7780_2 */
+       { TG3PCI_SUBVENDOR_ID_COMPAQ,
+         TG3PCI_SUBDEVICE_ID_COMPAQ_BANSHEE, PHY_ID_BCM5701 },
+       { TG3PCI_SUBVENDOR_ID_COMPAQ,
+         TG3PCI_SUBDEVICE_ID_COMPAQ_BANSHEE_2, PHY_ID_BCM5701 },
+       { TG3PCI_SUBVENDOR_ID_COMPAQ,
+         TG3PCI_SUBDEVICE_ID_COMPAQ_CHANGELING, 0 },
+       { TG3PCI_SUBVENDOR_ID_COMPAQ,
+         TG3PCI_SUBDEVICE_ID_COMPAQ_NC7780, PHY_ID_BCM5701 },
+       { TG3PCI_SUBVENDOR_ID_COMPAQ,
+         TG3PCI_SUBDEVICE_ID_COMPAQ_NC7780_2, PHY_ID_BCM5701 },
 
        /* IBM boards. */
-       { PCI_VENDOR_ID_IBM, 0x0281, 0 } /* IBM??? */
+       { TG3PCI_SUBVENDOR_ID_IBM,
+         TG3PCI_SUBDEVICE_ID_IBM_5703SAX2, 0 }
 };
 
-static inline struct subsys_tbl_ent *lookup_by_subsys(struct tg3 *tp)
+static struct subsys_tbl_ent * __devinit tg3_lookup_by_subsys(struct tg3 *tp)
 {
        int i;
 
@@ -12476,7 +12502,7 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
                        /* No eeprom signature?  Try the hardcoded
                         * subsys device table.
                         */
-                       p = lookup_by_subsys(tp);
+                       p = tg3_lookup_by_subsys(tp);
                        if (!p)
                                return -ENODEV;
 
index d2712c5..12ce226 100644 (file)
 #define  TG3PCI_DEVICE_TIGON3_57765     0x16b4
 #define  TG3PCI_DEVICE_TIGON3_57791     0x16b2
 #define  TG3PCI_DEVICE_TIGON3_57795     0x16b6
-/* 0x04 --> 0x64 unused */
+/* 0x04 --> 0x2c unused */
+#define TG3PCI_SUBVENDOR_ID_BROADCOM           PCI_VENDOR_ID_BROADCOM
+#define TG3PCI_SUBDEVICE_ID_BROADCOM_95700A6   0x1644
+#define TG3PCI_SUBDEVICE_ID_BROADCOM_95701A5   0x0001
+#define TG3PCI_SUBDEVICE_ID_BROADCOM_95700T6   0x0002
+#define TG3PCI_SUBDEVICE_ID_BROADCOM_95700A9   0x0003
+#define TG3PCI_SUBDEVICE_ID_BROADCOM_95701T1   0x0005
+#define TG3PCI_SUBDEVICE_ID_BROADCOM_95701T8   0x0006
+#define TG3PCI_SUBDEVICE_ID_BROADCOM_95701A7   0x0007
+#define TG3PCI_SUBDEVICE_ID_BROADCOM_95701A10  0x0008
+#define TG3PCI_SUBDEVICE_ID_BROADCOM_95701A12  0x8008
+#define TG3PCI_SUBDEVICE_ID_BROADCOM_95703AX1  0x0009
+#define TG3PCI_SUBDEVICE_ID_BROADCOM_95703AX2  0x8009
+#define TG3PCI_SUBVENDOR_ID_3COM               PCI_VENDOR_ID_3COM
+#define TG3PCI_SUBDEVICE_ID_3COM_3C996T                0x1000
+#define TG3PCI_SUBDEVICE_ID_3COM_3C996BT       0x1006
+#define TG3PCI_SUBDEVICE_ID_3COM_3C996SX       0x1004
+#define TG3PCI_SUBDEVICE_ID_3COM_3C1000T       0x1007
+#define TG3PCI_SUBDEVICE_ID_3COM_3C940BR01     0x1008
+#define TG3PCI_SUBVENDOR_ID_DELL               PCI_VENDOR_ID_DELL
+#define TG3PCI_SUBDEVICE_ID_DELL_VIPER         0x00d1
+#define TG3PCI_SUBDEVICE_ID_DELL_JAGUAR                0x0106
+#define TG3PCI_SUBDEVICE_ID_DELL_MERLOT                0x0109
+#define TG3PCI_SUBDEVICE_ID_DELL_SLIM_MERLOT   0x010a
+#define TG3PCI_SUBVENDOR_ID_COMPAQ             PCI_VENDOR_ID_COMPAQ
+#define TG3PCI_SUBDEVICE_ID_COMPAQ_BANSHEE     0x007c
+#define TG3PCI_SUBDEVICE_ID_COMPAQ_BANSHEE_2   0x009a
+#define TG3PCI_SUBDEVICE_ID_COMPAQ_CHANGELING  0x007d
+#define TG3PCI_SUBDEVICE_ID_COMPAQ_NC7780      0x0085
+#define TG3PCI_SUBDEVICE_ID_COMPAQ_NC7780_2    0x0099
+#define TG3PCI_SUBVENDOR_ID_IBM                        PCI_VENDOR_ID_IBM
+#define TG3PCI_SUBDEVICE_ID_IBM_5703SAX2       0x0281
+/* 0x30 --> 0x64 unused */
 #define TG3PCI_MSI_DATA                        0x00000064
 /* 0x66 --> 0x68 unused */
 #define TG3PCI_MISC_HOST_CTRL          0x00000068