aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm47xx/patches-3.2/028-bcm47xx-register-flash-drivers.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/brcm47xx/patches-3.2/028-bcm47xx-register-flash-drivers.patch')
-rw-r--r--target/linux/brcm47xx/patches-3.2/028-bcm47xx-register-flash-drivers.patch128
1 files changed, 82 insertions, 46 deletions
diff --git a/target/linux/brcm47xx/patches-3.2/028-bcm47xx-register-flash-drivers.patch b/target/linux/brcm47xx/patches-3.2/028-bcm47xx-register-flash-drivers.patch
index f8978b0b8f..5fc568fc04 100644
--- a/target/linux/brcm47xx/patches-3.2/028-bcm47xx-register-flash-drivers.patch
+++ b/target/linux/brcm47xx/patches-3.2/028-bcm47xx-register-flash-drivers.patch
@@ -1,14 +1,21 @@
-From 64f3d068654589d6114048ac5933cd4498706cfc Mon Sep 17 00:00:00 2001
-From: Hauke Mehrtens <hauke@hauke-m.de>
-Date: Sun, 17 Jul 2011 15:02:10 +0200
-Subject: [PATCH 20/26] bcm47xx: register flash drivers
-
-
-Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
----
- arch/mips/bcm47xx/setup.c | 72 +++++++++++++++++++++++++++++++++++++++++++++
- 1 files changed, 72 insertions(+), 0 deletions(-)
-
+--- a/arch/mips/bcm47xx/Kconfig
++++ b/arch/mips/bcm47xx/Kconfig
+@@ -9,6 +9,7 @@ config BCM47XX_SSB
+ select SSB_EMBEDDED
+ select SSB_B43_PCI_BRIDGE if PCI
+ select SSB_PCICORE_HOSTMODE if PCI
++ select SSB_SFLASH
+ default y
+ help
+ Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.
+@@ -22,6 +23,7 @@ config BCM47XX_BCMA
+ select BCMA_HOST_SOC
+ select BCMA_DRIVER_MIPS
+ select BCMA_DRIVER_PCI_HOSTMODE if PCI
++ select BCMA_SFLASH
+ default y
+ help
+ Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus.
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -31,10 +31,12 @@
@@ -24,11 +31,10 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
#include <asm/mach-bcm47xx/nvram.h>
union bcm47xx_bus bcm47xx_bus;
-@@ -366,3 +368,73 @@ static int __init bcm47xx_register_bus_c
- return 0;
- }
- device_initcall(bcm47xx_register_bus_complete);
-+
+@@ -45,6 +47,32 @@ EXPORT_SYMBOL(bcm47xx_bus_type);
+
+ struct bcm47xx_sflash bcm47xx_sflash;
+
+static struct resource bcm47xx_pflash_resource = {
+ .name = "bcm47xx_pflash",
+ .start = 0,
@@ -55,44 +61,74 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ .num_resources = 1,
+};
+
+ static void bcm47xx_machine_restart(char *command)
+ {
+ printk(KERN_ALERT "Please stand by while rebooting the system...\n");
+@@ -310,6 +338,24 @@ static void __init bcm47xx_register_ssb(
+ }
+ }
+ }
++
++static int __init bcm47xx_register_flash_ssb(void)
++{
++ struct ssb_chipcommon *chipco = &bcm47xx_bus.ssb.chipco;
++
++ switch (chipco->flash_type) {
++ case SSB_PFLASH:
++ bcm47xx_pflash_resource.start = chipco->pflash.window;
++ bcm47xx_pflash_resource.end = chipco->pflash.window + chipco->pflash.window_size;
++ return platform_device_register(&bcm47xx_pflash_dev);
++ case SSB_SFLASH:
++ bcm47xx_sflash_dev.dev.platform_data = &bcm47xx_sflash;
++ return platform_device_register(&bcm47xx_sflash_dev);
++ default:
++ printk(KERN_ERR "No flash device found\n");
++ return -1;
++ }
++}
+ #endif
+
+ #ifdef CONFIG_BCM47XX_BCMA
+@@ -324,6 +370,24 @@ static void __init bcm47xx_register_bcma
+ if (bcm47xx_bus.bcma.bus.drv_cc.flash_type == BCMA_SFLASH)
+ bcm47xx_sflash_struct_bcma_init(&bcm47xx_sflash, &bcm47xx_bus.bcma.bus.drv_cc);
+ }
++
++static int __init bcm47xx_register_flash_bcma(void)
++{
++ struct bcma_drv_cc *drv_cc = &bcm47xx_bus.bcma.bus.drv_cc;
++
++ switch (drv_cc->flash_type) {
++ case BCMA_PFLASH:
++ bcm47xx_pflash_resource.start = drv_cc->pflash.window;
++ bcm47xx_pflash_resource.end = drv_cc->pflash.window + drv_cc->pflash.window_size;
++ return platform_device_register(&bcm47xx_pflash_dev);
++ case BCMA_SFLASH:
++ bcm47xx_sflash_dev.dev.platform_data = &bcm47xx_sflash;
++ return platform_device_register(&bcm47xx_sflash_dev);
++ default:
++ printk(KERN_ERR "No flash device found\n");
++ return -1;
++ }
++}
+ #endif
+
+ void __init plat_mem_setup(void)
+@@ -366,3 +430,19 @@ static int __init bcm47xx_register_bus_c
+ return 0;
+ }
+ device_initcall(bcm47xx_register_bus_complete);
++
+static int __init bcm47xx_register_flash(void)
+{
-+#ifdef CONFIG_BCM47XX_SSB
-+ struct ssb_chipcommon *chipco;
-+#endif
-+#ifdef CONFIG_BCM47XX_BCMA
-+ struct bcma_drv_cc *drv_cc;
-+#endif
+ switch (bcm47xx_bus_type) {
+#ifdef CONFIG_BCM47XX_SSB
+ case BCM47XX_BUS_TYPE_SSB:
-+ chipco = &bcm47xx_bus.ssb.chipco;
-+ if (chipco->flash_type == SSB_PFLASH) {
-+ bcm47xx_pflash_resource.start = chipco->pflash.window;
-+ bcm47xx_pflash_resource.end = chipco->pflash.window + chipco->pflash.window_size;
-+ return platform_device_register(&bcm47xx_pflash_dev);
-+ } else if (chipco->flash_type == SSB_SFLASH) {
-+ bcm47xx_sflash_dev.dev.platform_data = &bcm47xx_sflash;
-+ return platform_device_register(&bcm47xx_sflash_dev);
-+ } else {
-+ printk(KERN_ERR "No flash device found\n");
-+ return -1;
-+ }
++ return bcm47xx_register_flash_ssb();
+#endif
+#ifdef CONFIG_BCM47XX_BCMA
+ case BCM47XX_BUS_TYPE_BCMA:
-+ drv_cc = &bcm47xx_bus.bcma.bus.drv_cc;
-+ if (drv_cc->flash_type == BCMA_PFLASH) {
-+ bcm47xx_pflash_resource.start = drv_cc->pflash.window;
-+ bcm47xx_pflash_resource.end = drv_cc->pflash.window + drv_cc->pflash.window_size;
-+ return platform_device_register(&bcm47xx_pflash_dev);
-+ } else if (drv_cc->flash_type == BCMA_SFLASH) {
-+ bcm47xx_sflash_dev.dev.platform_data = &bcm47xx_sflash;
-+ return platform_device_register(&bcm47xx_sflash_dev);
-+ } else {
-+ printk(KERN_ERR "No flash device found\n");
-+ return -1;
-+ }
++ return bcm47xx_register_flash_bcma();
+#endif
+ }
+ return -1;