Enable BCMA on BCM63XX.
Add bcma_fallback_sprom field to BCM63XX board structure.
Register BCMA fallback sprom depeding on board.

Signed-off-by: Álvaro Fernández Rojas <nolt...@gmail.com>

Index: target/linux/brcm63xx/config-3.3
===================================================================
--- target/linux/brcm63xx/config-3.3    (revisión: 32704)
+++ target/linux/brcm63xx/config-3.3    (copia de trabajo)
@@ -15,6 +15,12 @@
 CONFIG_BCM63XX_ENET=y
 CONFIG_BCM63XX_PHY=y
 CONFIG_BCM63XX_WDT=y
+CONFIG_BCMA=y
+CONFIG_BCMA_DEBUG=y
+CONFIG_BCMA_DRIVER_MIPS=y
+CONFIG_BCMA_DRIVER_PCI_HOSTMODE=y
+CONFIG_BCMA_HOST_PCI=y
+CONFIG_BCMA_HOST_PCI_POSSIBLE=y
 CONFIG_BCMA_POSSIBLE=y
 CONFIG_BOARD_BCM963XX=y
 # CONFIG_BOARD_LIVEBOX is not set
Index: target/linux/brcm63xx/patches-3.3/432-bcm63xx_bcma_fallback_sprom.patch
===================================================================
--- target/linux/brcm63xx/patches-3.3/432-bcm63xx_bcma_fallback_sprom.patch     
(revisión: 0)
+++ target/linux/brcm63xx/patches-3.3/432-bcm63xx_bcma_fallback_sprom.patch     
(revisión: 0)
@@ -0,0 +1,226 @@
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -12,6 +12,10 @@
+ #include <linux/string.h>
+ #include <linux/platform_device.h>
+ #include <linux/ssb/ssb.h>
++#ifdef CONFIG_BCMA
++#include <linux/bcma/bcma.h>
++#include <bcm63xx_bcma_sprom.h>
++#endif
+ #include <linux/gpio_keys.h>
+ #include <linux/input.h>
+ #include <linux/spi/spi.h>
+@@ -682,7 +686,23 @@ int bcm63xx_get_fallback_sprom(struct ss
+               memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
+               return 0;
+       } else {
+-              printk(KERN_ERR PFX "unable to fill SPROM for given 
bustype.\n");
++              printk(KERN_ERR PFX "unable to fill SSB SPROM for given 
bustype.\n");
++              return -EINVAL;
++      }
++}
++#endif
++
++#ifdef CONFIG_BCMA
++struct ssb_sprom* bcm63xx_bcma_sprom;
++EXPORT_SYMBOL(bcm63xx_bcma_sprom);
++int bcm63xx_get_bcma_fallback_sprom(struct bcma_bus *bus, struct ssb_sprom 
*out)
++{
++      if (bus->hosttype == BCMA_HOSTTYPE_PCI) {
++              memcpy(out, bcm63xx_bcma_sprom, sizeof(struct ssb_sprom));
++              return 0;
++      }
++      else {
++              printk(KERN_ERR PFX "unable to fill BCMA SPROM for given 
bustype.\n");
+               return -EINVAL;
+       }
+ }
+@@ -899,9 +919,29 @@ int __init board_register_devices(void)
+               memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
+               if (ssb_arch_register_fallback_sprom(
+                               &bcm63xx_get_fallback_sprom) < 0)
+-                      pr_err(PFX "failed to register fallback SPROM\n");
++                      pr_err(PFX "failed to register fallback SSB SPROM\n");
+       }
+ #endif
++
++#ifdef CONFIG_BCMA
++      switch (board.bcma_fallback_sprom) {
++              case 43225:
++                      bcm63xx_bcma_sprom = (struct ssb_sprom*) 
&bcm43225_bcma_sprom;
++                      break;
++              default:
++                      break;
++      }
++      if (bcm63xx_bcma_sprom &&
++              !board.has_caldata &&
++              !bcm63xx_nvram_get_mac_address(bcm63xx_bcma_sprom->il0mac)) {
++              memcpy(bcm63xx_bcma_sprom->et0mac, bcm63xx_bcma_sprom->il0mac, 
ETH_ALEN);
++              memcpy(bcm63xx_bcma_sprom->et1mac, bcm63xx_bcma_sprom->il0mac, 
ETH_ALEN);
++              if (bcma_arch_register_fallback_sprom(
++                      &bcm63xx_get_bcma_fallback_sprom) < 0)
++                      pr_err(PFX "failed to register BCMA fallback SPROM\n");
++      }
++#endif
++
+       bcm63xx_hsspi_register();
+ 
+       bcm63xx_spi_register();
+--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
++++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
+@@ -26,6 +26,7 @@ struct ath9k_caldata {
+ struct board_info {
+       u8              name[16];
+       unsigned int    expected_cpu_id;
++      u16     bcma_fallback_sprom;
+ 
+       /* enabled feature/device */
+       unsigned int    has_enet0:1;
+--- /dev/null
++++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_bcma_sprom.h
+@@ -0,0 +1,144 @@
++#ifndef BCM63XX_BCMA_H_
++#define BCM63XX_BCMA_H_
++
++static struct ssb_sprom bcm43225_bcma_sprom = {
++      .revision                                               = 0x8,
++      .board_rev                                              = 0x1230,
++      .txpid2g                                                = 
{0x0,0x80,0x2,0x0},
++      .txpid5gl                                               = 
{0x0,0x18,0x0,0x0},
++      .txpid5g                                                = 
{0x0,0x0,0x30,0x1f},
++      .txpid5gh                                               = 
{0x0,0x0,0xff,0xff},
++      .boardflags_lo                                  = 0x200,
++      .boardflags_hi                                  = 0x0,
++      .boardflags2_lo                                 = 0x1000,
++      .boardflags2_hi                                 = 0x0,
++      .alpha2[0]                                              = 0x0,
++      .alpha2[1]                                              = 0x0,
++      .core_pwr_info[0].itssi_2g              = 0x20,
++      .core_pwr_info[0].maxpwr_2g             = 0x4e,
++      .core_pwr_info[0].pa_2g                 = {0xfeb9,0x16be,0xfa97,0x0},
++      .core_pwr_info[0].itssi_5g              = 0xff,
++      .core_pwr_info[0].maxpwr_5g             = 0xff,
++      .core_pwr_info[0].maxpwr_5gh    = 0xff,
++      .core_pwr_info[0].maxpwr_5gl    = 0xff,
++      .core_pwr_info[0].pa_5gl                = {0xffff,0xffff,0xffff,0x0},
++      .core_pwr_info[0].pa_5g                 = {0xffff,0xffff,0xffff,0x0},
++      .core_pwr_info[0].pa_5gh                = {0xffff,0xffff,0xffff,0x0},
++      .core_pwr_info[1].itssi_2g              = 0x20,
++      .core_pwr_info[1].maxpwr_2g             = 0x4e,
++      .core_pwr_info[1].pa_2g                 = {0xfe9b,0x1632,0xfa9b,0x0},
++      .core_pwr_info[1].itssi_5g              = 0xff,
++      .core_pwr_info[1].maxpwr_5g             = 0xff,
++      .core_pwr_info[1].maxpwr_5gh    = 0xff,
++      .core_pwr_info[1].maxpwr_5gl    = 0xff,
++      .core_pwr_info[1].pa_5gl                = {0xffff,0xffff,0xffff,0x0},
++      .core_pwr_info[1].pa_5g                 = {0xffff,0xffff,0xffff,0x0},
++      .core_pwr_info[1].pa_5gh                = {0xffff,0xffff,0xffff,0x0},
++      .core_pwr_info[2].itssi_2g              = 0xff,
++      .core_pwr_info[2].maxpwr_2g             = 0xff,
++      .core_pwr_info[2].pa_2g                 = {0xffff,0xffff,0xffff,0x0},
++      .core_pwr_info[2].itssi_5g              = 0xff,
++      .core_pwr_info[2].maxpwr_5g             = 0xff,
++      .core_pwr_info[2].maxpwr_5gh    = 0xff,
++      .core_pwr_info[2].maxpwr_5gl    = 0xff,
++      .core_pwr_info[2].pa_5gl                = {0xffff,0xffff,0xffff,0x0},
++      .core_pwr_info[2].pa_5g                 = {0xffff,0xffff,0xffff,0x0},
++      .core_pwr_info[2].pa_5gh                = {0xffff,0xffff,0xffff,0x0},
++      .core_pwr_info[3].itssi_2g              = 0xff,
++      .core_pwr_info[3].maxpwr_2g             = 0xff,
++      .core_pwr_info[3].pa_2g                 = {0xffff,0xffff,0xffff,0x0},
++      .core_pwr_info[3].itssi_5g              = 0xff,
++      .core_pwr_info[3].maxpwr_5g             = 0xff,
++      .core_pwr_info[3].maxpwr_5gh    = 0xff,
++      .core_pwr_info[3].maxpwr_5gl    = 0xff,
++      .core_pwr_info[3].pa_5gl                = {0xffff,0xffff,0xffff,0x0},
++      .core_pwr_info[3].pa_5g                 = {0xffff,0xffff,0xffff,0x0},
++      .core_pwr_info[3].pa_5gh                = {0xffff,0xffff,0xffff,0x0},
++      .fem.ghz2.tssipos                               = 0x1,
++      .fem.ghz2.extpa_gain                    = 0x2,
++      .fem.ghz2.pdet_range                    = 0x4,
++      .fem.ghz2.tr_iso                                = 0x3,
++      .fem.ghz2.antswlut                              = 0x0,
++      .fem.ghz5.tssipos                               = 0x1,
++      .fem.ghz5.extpa_gain                    = 0x3,
++      .fem.ghz5.pdet_range                    = 0x1f,
++      .fem.ghz5.tr_iso                                = 0x7,
++      .fem.ghz5.antswlut                              = 0x1f,
++      .ant_available_a                                = 0x3,
++      .ant_available_bg                               = 0x3,
++      .maxpwr_bg                                              = 0x4e,
++      .itssi_bg                                               = 0x20,
++      .maxpwr_a                                               = 0xff,
++      .itssi_a                                                = 0xff,
++      .maxpwr_ah                                              = 0xff,
++      .maxpwr_al                                              = 0xff,
++      .gpio0                                                  = 0xff,
++      .gpio1                                                  = 0xff,
++      .gpio2                                                  = 0xff,
++      .gpio3                                                  = 0xff,
++      .tri2g                                                  = 0xff,
++      .tri5g                                                  = 0xff,
++      .tri5gl                                                 = 0xff,
++      .tri5gh                                                 = 0xff,
++      .rxpo2g                                                 = 0xff,
++      .rxpo5g                                                 = 0xff,
++      .rssismf2g                                              = 0xf,
++      .rssismc2g                                              = 0xf,
++      .rssisav2g                                              = 0x7,
++      .bxa2g                                                  = 0x3,
++      .rssismf5g                                              = 0xf,
++      .rssismc5g                                              = 0xf,
++      .rssisav5g                                              = 0x7,
++      .bxa5g                                                  = 0x3,
++      .pa0b0                                                  = 0xfeb9,
++      .pa0b1                                                  = 0x16be,
++      .pa0b2                                                  = 0xfa97,
++      .pa1b0                                                  = 0xffff,
++      .pa1b1                                                  = 0xffff,
++      .pa1b2                                                  = 0xffff,
++      .pa1lob0                                                = 0xffff,
++      .pa1lob1                                                = 0xffff,
++      .pa1lob2                                                = 0xffff,
++      .pa1hib0                                                = 0xffff,
++      .pa1hib1                                                = 0xffff,
++      .pa1hib2                                                = 0xffff,
++      .cck2gpo                                                = 0x0,
++      .ofdm2gpo                                               = 0x3333,
++      .ofdm5glpo                                              = 0x0,
++      .ofdm5gpo                                               = 0x0,
++      .ofdm5ghpo                                              = 0x0,
++      .antenna_gain.a0                                = 0x2,
++      .antenna_gain.a1                                = 0x2,
++      .antenna_gain.a2                                = 0xff,
++      .antenna_gain.a3                                = 0xff,
++      .leddc_on_time                                  = 0xff,
++      .leddc_off_time                                 = 0xff,
++      .txchain                                                = 0x3,
++      .rxchain                                                = 0x3,
++      .antswitch                                              = 0x0,
++      .opo                                                    = 0x33,
++      .mcs2gpo                                                = 
{0x5555,0x5555,0x5555,0x5555,0x5555,0x5555,0x5555,0x3333},
++      .mcs5gpo                                                = 
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
++      .mcs5glpo                                               = 
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
++      .mcs5ghpo                                               = 
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0},
++      .rawtempsense                                   = 0x1ff,
++      .measpower                                              = 0x7f,
++      .tempsense_slope                                = 0xff,
++      .tempcorrx                                              = 0x3f,
++      .tempsense_option                               = 0x3,
++      .freqoffset_corr                                = 0xf,
++      .iqcal_swp_dis                                  = 0x1,
++      .hw_iqcal_en                                    = 0x1,
++      .bw40po                                                 = 0x2,
++      .cddpo                                                  = 0x0,
++      .stbcpo                                                 = 0x0,
++      .bwduppo                                                = 0x0,
++      .tempthresh                                             = 0x78,
++      .tempoffset                                             = 0x0,
++      .phycal_tempdelta                               = 0xff,
++      .temps_period                                   = 0xf,
++      .temps_hysteresis                               = 0xf,
++};
++
++#endif /* ! BCM63XX_BCMA_H_ */
++
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to