Attached is an updated patch for comment.

1) Does adding the common section even make sense, if not, I will delete it?
2) I moved the entries that were obviously ARM or MIPS, are these correct
and are there others that should be moved?

I initially created another version that simply added the manufacturer ID's
as another element in the device_names table, but then tumbled to this
(smaller footprint/more efficient).  

Thanks,

Nathan

On Thu, 2012-03-01 at 21:17 -0800, Nathan Hintz wrote:
> Support recognition of MIPS 74K CPU, etc.
> 
> [    0.000000] bcma: Core 3 found: MIPS 74K (manuf 0x4A7, id 0x82C, rev 0x01, 
> class 0x0)
> 
> Signed-off-by: Nathan Hintz <nlhi...@hotmail.com>
> 
> --- /dev/null 2012-02-21 01:00:44.969496803 -0800
> +++ target/linux/brcm47xx/patches-3.2/0050-bcma-find-name-for-non-brcm.patch  
> 2011-07-02 16:50:16.000000000 -0700
> @@ -0,0 +1,17 @@
> +--- a/drivers/bcma/scan.c
> ++++ b/drivers/bcma/scan.c
> +@@ -83,11 +83,9 @@
> + {
> +     int i;
> + 
> +-    if (id->manuf == BCMA_MANUF_BCM) {
> +-            for (i = 0; i < ARRAY_SIZE(bcma_device_names); i++) {
> +-                    if (bcma_device_names[i].id == id->id)
> +-                            return bcma_device_names[i].name;
> +-            }
> ++    for (i = 0; i < ARRAY_SIZE(bcma_device_names); i++) {
> ++            if (bcma_device_names[i].id == id->id)
> ++                    return bcma_device_names[i].name;
> +     }
> +     return "UNKNOWN";
> + }

--- /dev/null
+++ target/linux/brcm47xx/patches-3.2/0050-bcma-find-name-for-non-brcm.patch
@@ -0,0 +1,128 @@
+--- a/drivers/bcma/scan.c
++++ b/drivers/bcma/scan.c
+@@ -19,7 +19,14 @@ struct bcma_device_id_name {
+       u16 id;
+       const char *name;
+ };
+-struct bcma_device_id_name bcma_device_names[] = {
++
++const struct bcma_device_id_name bcma_arm_device_names[] = {
++      { BCMA_CORE_ARM_1176, "ARM 1176" },
++      { BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" },
++      { BCMA_CORE_ARM_CM3, "ARM CM3" },
++};
++
++const struct bcma_device_id_name bcma_bcm_device_names[] = {
+       { BCMA_CORE_OOB_ROUTER, "OOB Router" },
+       { BCMA_CORE_INVALID, "Invalid" },
+       { BCMA_CORE_CHIPCOMMON, "ChipCommon" },
+@@ -27,7 +34,6 @@ struct bcma_device_id_name bcma_device_n
+       { BCMA_CORE_SRAM, "SRAM" },
+       { BCMA_CORE_SDRAM, "SDRAM" },
+       { BCMA_CORE_PCI, "PCI" },
+-      { BCMA_CORE_MIPS, "MIPS" },
+       { BCMA_CORE_ETHERNET, "Fast Ethernet" },
+       { BCMA_CORE_V90, "V90" },
+       { BCMA_CORE_USB11_HOSTDEV, "USB 1.1 Hostdev" },
+@@ -44,7 +50,6 @@ struct bcma_device_id_name bcma_device_n
+       { BCMA_CORE_PHY_A, "PHY A" },
+       { BCMA_CORE_PHY_B, "PHY B" },
+       { BCMA_CORE_PHY_G, "PHY G" },
+-      { BCMA_CORE_MIPS_3302, "MIPS 3302" },
+       { BCMA_CORE_USB11_HOST, "USB 1.1 Host" },
+       { BCMA_CORE_USB11_DEV, "USB 1.1 Device" },
+       { BCMA_CORE_USB20_HOST, "USB 2.0 Host" },
+@@ -58,15 +63,11 @@ struct bcma_device_id_name bcma_device_n
+       { BCMA_CORE_PHY_N, "PHY N" },
+       { BCMA_CORE_SRAM_CTL, "SRAM Controller" },
+       { BCMA_CORE_MINI_MACPHY, "Mini MACPHY" },
+-      { BCMA_CORE_ARM_1176, "ARM 1176" },
+-      { BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" },
+       { BCMA_CORE_PHY_LP, "PHY LP" },
+       { BCMA_CORE_PMU, "PMU" },
+       { BCMA_CORE_PHY_SSN, "PHY SSN" },
+       { BCMA_CORE_SDIO_DEV, "SDIO Device" },
+-      { BCMA_CORE_ARM_CM3, "ARM CM3" },
+       { BCMA_CORE_PHY_HT, "PHY HT" },
+-      { BCMA_CORE_MIPS_74K, "MIPS 74K" },
+       { BCMA_CORE_MAC_GBIT, "GBit MAC" },
+       { BCMA_CORE_DDR12_MEM_CTL, "DDR1/DDR2 Memory Controller" },
+       { BCMA_CORE_PCIE_RC, "PCIe Root Complex" },
+@@ -79,16 +80,71 @@ struct bcma_device_id_name bcma_device_n
+       { BCMA_CORE_SHIM, "SHIM" },
+       { BCMA_CORE_DEFAULT, "Default" },
+ };
+-const char *bcma_device_name(struct bcma_device_id *id)
++
++const struct bcma_device_id_name bcma_mips_device_names[] = {
++      { BCMA_CORE_MIPS, "MIPS" },
++      { BCMA_CORE_MIPS_3302, "MIPS 3302" },
++      { BCMA_CORE_MIPS_74K, "MIPS 74K" },
++};
++
++#if 0
++const struct bcma_device_id_name bcma_common_device_names[] = {
++};
++#endif
++
++const char *bcma_scan_device_names(const struct bcma_device_id *id,
++                                 const struct bcma_device_id_name 
*device_names,
++                                 int array_size)
+ {
+       int i;
+ 
+-      if (id->manuf == BCMA_MANUF_BCM) {
+-              for (i = 0; i < ARRAY_SIZE(bcma_device_names); i++) {
+-                      if (bcma_device_names[i].id == id->id)
+-                              return bcma_device_names[i].name;
+-              }
++      for (i = 0; i < array_size; i++) {
++              if (device_names[i].id == id->id)
++                      return device_names[i].name;
+       }
++      return NULL;
++}
++
++const char *bcma_device_name(const struct bcma_device_id *id)
++{
++      const char *name;
++      const struct bcma_device_id_name *names;
++      int size;
++
++      /* search manufacturer specific names */
++      switch (id->manuf) {
++      case BCMA_MANUF_ARM:
++              names = bcma_arm_device_names;
++              size = ARRAY_SIZE(bcma_arm_device_names);
++              break;
++      case BCMA_MANUF_BCM:
++              names = bcma_bcm_device_names;
++              size = ARRAY_SIZE(bcma_bcm_device_names);
++              break;
++      case BCMA_MANUF_MIPS:
++              names = bcma_mips_device_names;
++              size = ARRAY_SIZE(bcma_mips_device_names);
++              break;
++      default:
++              names = NULL;
++              break;
++      }
++
++      if (names) {
++              name = bcma_scan_device_names(id, names, size);
++              if (name)
++                      return name;
++      }
++
++#if 0
++      /* search common names */
++      names = bcma_common_device_names;
++      size = ARRAY_SIZE(bcma_common_device_names);
++      name = bcma_scan_device_names(id, names, size);
++      if (name)
++              return name;
++#endif
++
+       return "UNKNOWN";
+ }
+ 

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to