aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm47xx/patches-3.2/0020-bcm47xx-register-flash-drivers.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2012-01-15 21:18:34 +0000
committerHauke Mehrtens <hauke@hauke-m.de>2012-01-15 21:18:34 +0000
commit034cf5643f7e0c2e2466e8e9ff1d4e9fad7fe6ec (patch)
tree87503a64bc69e384733b723ff3679349e1f4a00c /target/linux/brcm47xx/patches-3.2/0020-bcm47xx-register-flash-drivers.patch
parentc3d134af127ff4666447fc798b0c4ebe52f571bf (diff)
downloadupstream-034cf5643f7e0c2e2466e8e9ff1d4e9fad7fe6ec.tar.gz
upstream-034cf5643f7e0c2e2466e8e9ff1d4e9fad7fe6ec.tar.bz2
upstream-034cf5643f7e0c2e2466e8e9ff1d4e9fad7fe6ec.zip
brcm47xx: add support for kernel 3.2
SVN-Revision: 29756
Diffstat (limited to 'target/linux/brcm47xx/patches-3.2/0020-bcm47xx-register-flash-drivers.patch')
-rw-r--r--target/linux/brcm47xx/patches-3.2/0020-bcm47xx-register-flash-drivers.patch100
1 files changed, 100 insertions, 0 deletions
diff --git a/target/linux/brcm47xx/patches-3.2/0020-bcm47xx-register-flash-drivers.patch b/target/linux/brcm47xx/patches-3.2/0020-bcm47xx-register-flash-drivers.patch
new file mode 100644
index 0000000000..f8978b0b8f
--- /dev/null
+++ b/target/linux/brcm47xx/patches-3.2/0020-bcm47xx-register-flash-drivers.patch
@@ -0,0 +1,100 @@
+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/setup.c
++++ b/arch/mips/bcm47xx/setup.c
+@@ -31,10 +31,12 @@
+ #include <linux/ssb/ssb.h>
+ #include <linux/ssb/ssb_embedded.h>
+ #include <linux/bcma/bcma_soc.h>
++#include <linux/platform_device.h>
+ #include <asm/bootinfo.h>
+ #include <asm/reboot.h>
+ #include <asm/time.h>
+ #include <bcm47xx.h>
++#include <bus.h>
+ #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);
++
++static struct resource bcm47xx_pflash_resource = {
++ .name = "bcm47xx_pflash",
++ .start = 0,
++ .end = 0,
++ .flags = 0,
++};
++
++static struct platform_device bcm47xx_pflash_dev = {
++ .name = "bcm47xx_pflash",
++ .resource = &bcm47xx_pflash_resource,
++ .num_resources = 1,
++};
++
++static struct resource bcm47xx_sflash_resource = {
++ .name = "bcm47xx_sflash",
++ .start = 0,
++ .end = 0,
++ .flags = 0,
++};
++
++static struct platform_device bcm47xx_sflash_dev = {
++ .name = "bcm47xx_sflash",
++ .resource = &bcm47xx_sflash_resource,
++ .num_resources = 1,
++};
++
++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;
++ }
++#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;
++ }
++#endif
++ }
++ return -1;
++}
++fs_initcall(bcm47xx_register_flash);