ar71xx: support for D-LINK DIR-615 rev. E4
[openwrt.git] / target / linux / brcm47xx / patches-3.0 / 0020-bcm47xx-register-flash-drivers.patch
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
5
6
7 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
8 ---
9 arch/mips/bcm47xx/setup.c | 72 +++++++++++++++++++++++++++++++++++++++++++++
10 1 files changed, 72 insertions(+), 0 deletions(-)
11
12 --- a/arch/mips/bcm47xx/setup.c
13 +++ b/arch/mips/bcm47xx/setup.c
14 @@ -30,10 +30,12 @@
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>
21 #include <asm/time.h>
22 #include <bcm47xx.h>
23 +#include <bus.h>
24 #include <asm/mach-bcm47xx/nvram.h>
25
26 union bcm47xx_bus bcm47xx_bus;
27 @@ -365,3 +367,73 @@ static int __init bcm47xx_register_bus_c
28 return 0;
29 }
30 device_initcall(bcm47xx_register_bus_complete);
31 +
32 +static struct resource bcm47xx_pflash_resource = {
33 + .name = "bcm47xx_pflash",
34 + .start = 0,
35 + .end = 0,
36 + .flags = 0,
37 +};
38 +
39 +static struct platform_device bcm47xx_pflash_dev = {
40 + .name = "bcm47xx_pflash",
41 + .resource = &bcm47xx_pflash_resource,
42 + .num_resources = 1,
43 +};
44 +
45 +static struct resource bcm47xx_sflash_resource = {
46 + .name = "bcm47xx_sflash",
47 + .start = 0,
48 + .end = 0,
49 + .flags = 0,
50 +};
51 +
52 +static struct platform_device bcm47xx_sflash_dev = {
53 + .name = "bcm47xx_sflash",
54 + .resource = &bcm47xx_sflash_resource,
55 + .num_resources = 1,
56 +};
57 +
58 +static int __init bcm47xx_register_flash(void)
59 +{
60 +#ifdef CONFIG_BCM47XX_SSB
61 + struct ssb_chipcommon *chipco;
62 +#endif
63 +#ifdef CONFIG_BCM47XX_BCMA
64 + struct bcma_drv_cc *drv_cc;
65 +#endif
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);
77 + } else {
78 + printk(KERN_ERR "No flash device found\n");
79 + return -1;
80 + }
81 +#endif
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);
92 + } else {
93 + printk(KERN_ERR "No flash device found\n");
94 + return -1;
95 + }
96 +#endif
97 + }
98 + return -1;
99 +}
100 +fs_initcall(bcm47xx_register_flash);
This page took 0.074059 seconds and 5 git commands to generate.