1 From 64f3d068654589d6114048ac5933cd4498706cfc Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sun, 17 Jul 2011 15:02:10 +0200
4 Subject: [PATCH 20/26] bcm47xx: register flash drivers
7 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
9 arch/mips/bcm47xx/setup.c | 72 +++++++++++++++++++++++++++++++++++++++++++++
10 1 files changed, 72 insertions(+), 0 deletions(-)
12 --- a/arch/mips/bcm47xx/setup.c
13 +++ b/arch/mips/bcm47xx/setup.c
15 #include <linux/ssb/ssb.h>
16 #include <linux/ssb/ssb_embedded.h>
17 #include <linux/bcma/bcma_soc.h>
18 +#include <linux/platform_device.h>
19 #include <asm/bootinfo.h>
20 #include <asm/reboot.h>
24 #include <asm/mach-bcm47xx/nvram.h>
26 union bcm47xx_bus bcm47xx_bus;
27 @@ -366,3 +368,73 @@ static int __init bcm47xx_register_bus_c
30 device_initcall(bcm47xx_register_bus_complete);
32 +static struct resource bcm47xx_pflash_resource = {
33 + .name = "bcm47xx_pflash",
39 +static struct platform_device bcm47xx_pflash_dev = {
40 + .name = "bcm47xx_pflash",
41 + .resource = &bcm47xx_pflash_resource,
45 +static struct resource bcm47xx_sflash_resource = {
46 + .name = "bcm47xx_sflash",
52 +static struct platform_device bcm47xx_sflash_dev = {
53 + .name = "bcm47xx_sflash",
54 + .resource = &bcm47xx_sflash_resource,
58 +static int __init bcm47xx_register_flash(void)
60 +#ifdef CONFIG_BCM47XX_SSB
61 + struct ssb_chipcommon *chipco;
63 +#ifdef CONFIG_BCM47XX_BCMA
64 + struct bcma_drv_cc *drv_cc;
66 + switch (bcm47xx_bus_type) {
67 +#ifdef CONFIG_BCM47XX_SSB
68 + case BCM47XX_BUS_TYPE_SSB:
69 + chipco = &bcm47xx_bus.ssb.chipco;
70 + if (chipco->flash_type == SSB_PFLASH) {
71 + bcm47xx_pflash_resource.start = chipco->pflash.window;
72 + bcm47xx_pflash_resource.end = chipco->pflash.window + chipco->pflash.window_size;
73 + return platform_device_register(&bcm47xx_pflash_dev);
74 + } else if (chipco->flash_type == SSB_SFLASH) {
75 + bcm47xx_sflash_dev.dev.platform_data = &bcm47xx_sflash;
76 + return platform_device_register(&bcm47xx_sflash_dev);
78 + printk(KERN_ERR "No flash device found\n");
82 +#ifdef CONFIG_BCM47XX_BCMA
83 + case BCM47XX_BUS_TYPE_BCMA:
84 + drv_cc = &bcm47xx_bus.bcma.bus.drv_cc;
85 + if (drv_cc->flash_type == BCMA_PFLASH) {
86 + bcm47xx_pflash_resource.start = drv_cc->pflash.window;
87 + bcm47xx_pflash_resource.end = drv_cc->pflash.window + drv_cc->pflash.window_size;
88 + return platform_device_register(&bcm47xx_pflash_dev);
89 + } else if (drv_cc->flash_type == BCMA_SFLASH) {
90 + bcm47xx_sflash_dev.dev.platform_data = &bcm47xx_sflash;
91 + return platform_device_register(&bcm47xx_sflash_dev);
93 + printk(KERN_ERR "No flash device found\n");
100 +fs_initcall(bcm47xx_register_flash);