brcm47xx: update bcma and ssb to master-2011-07-21
[librecmc/librecmc.git] / target / linux / brcm47xx / patches-3.0 / 0017-bcm47xx-register-flash-drivers.patch
1 From 89b904335338c86ef2c40e7cc51e19673feb62c1 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 17/22] bcm47xx: register flash drivers
5
6
7 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
8 ---
9  arch/mips/bcm47xx/setup.c |   50 +++++++++++++++++++++++++++++++++++++++++++++
10  1 files changed, 50 insertions(+), 0 deletions(-)
11
12 --- a/arch/mips/bcm47xx/setup.c
13 +++ b/arch/mips/bcm47xx/setup.c
14 @@ -30,6 +30,7 @@
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 @@ -357,3 +358,52 @@ static int __init bcm47xx_register_bus_c
23         return 0;
24  }
25  device_initcall(bcm47xx_register_bus_complete);
26 +
27 +static struct resource bcm47xx_pflash_resource = {
28 +       .name   = "para",
29 +       .start  = 0,
30 +       .end    = 0,
31 +       .flags  = 0,
32 +};
33 +
34 +static struct platform_device bcm47xx_pflash = {
35 +       .name           = "bcm47xx_pflash",
36 +       .resource       = &bcm47xx_pflash_resource,
37 +       .num_resources  = 1,
38 +};
39 +
40 +static struct resource bcm47xx_sflash_resource = {
41 +       .name   = "serial",
42 +       .start  = 0,
43 +       .end    = 0,
44 +       .flags  = 0,
45 +};
46 +
47 +static struct platform_device bcm47xx_sflash = {
48 +       .name           = "bcm47xx_sflash",
49 +       .resource       = &bcm47xx_sflash_resource,
50 +       .num_resources  = 1,
51 +};
52 +
53 +static int __init bcm47xx_register_flash(void)
54 +{
55 +       switch (bcm47xx_active_bus_type) {
56 +#ifdef CONFIG_BCM47XX_SSB
57 +       case BCM47XX_BUS_TYPE_SSB:
58 +               return platform_device_register(&bcm47xx_pflash);
59 +#endif
60 +#ifdef CONFIG_BCM47XX_BCMA
61 +       case BCM47XX_BUS_TYPE_BCMA:
62 +               if (bcm47xx_bus.bcma.bus.drv_cc.flash_type == BCMA_PFLASH) {
63 +                       return platform_device_register(&bcm47xx_pflash);
64 +               } else if (bcm47xx_bus.bcma.bus.drv_cc.flash_type == BCMA_SFLASH) {
65 +                       return platform_device_register(&bcm47xx_sflash);
66 +               } else {
67 +                       printk(KERN_ERR "No flash device found\n");
68 +                       return -1;
69 +               }
70 +#endif
71 +       }
72 +       return 0;
73 +}
74 +fs_initcall(bcm47xx_register_flash);