brcm47xx: various fixes and code cleanups for irq code
[openwrt.git] / target / linux / brcm47xx / patches-3.6 / 072-bcma-register-parallel-flash-device.patch
1 --- a/drivers/bcma/bcma_private.h
2 +++ b/drivers/bcma/bcma_private.h
3 @@ -45,6 +45,7 @@ int bcma_sprom_get(struct bcma_bus *bus)
4  /* driver_chipcommon.c */
5  #ifdef CONFIG_BCMA_DRIVER_MIPS
6  void bcma_chipco_serial_init(struct bcma_drv_cc *cc);
7 +extern struct platform_device bcma_pflash_dev;
8  #endif /* CONFIG_BCMA_DRIVER_MIPS */
9  
10  /* driver_chipcommon_pmu.c */
11 --- a/drivers/bcma/driver_mips.c
12 +++ b/drivers/bcma/driver_mips.c
13 @@ -18,6 +18,7 @@
14  #include <linux/serial_core.h>
15  #include <linux/serial_reg.h>
16  #include <linux/time.h>
17 +#include <linux/platform_device.h>
18  
19  /* The 47162a0 hangs when reading MIPS DMP registers registers */
20  static inline bool bcma_core_mips_bcm47162a0_quirk(struct bcma_device *dev)
21 @@ -178,6 +179,19 @@ u32 bcma_cpu_clock(struct bcma_drv_mips
22  }
23  EXPORT_SYMBOL(bcma_cpu_clock);
24  
25 +static struct resource bcma_pflash_resource = {
26 +       .name   = "bcma_pflash",
27 +       .start  = 0,
28 +       .end    = 0,
29 +       .flags  = 0,
30 +};
31 +
32 +struct platform_device bcma_pflash_dev = {
33 +       .name           = "bcm47xx-pflash",
34 +       .resource       = &bcma_pflash_resource,
35 +       .num_resources  = 1,
36 +};
37 +
38  static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore)
39  {
40         struct bcma_bus *bus = mcore->core->bus;
41 @@ -200,6 +214,9 @@ static void bcma_core_mips_flash_detect(
42                         cc->pflash.buswidth = 1;
43                 else
44                         cc->pflash.buswidth = 2;
45 +
46 +               bcma_pflash_resource.start = cc->pflash.window;
47 +               bcma_pflash_resource.end = cc->pflash.window + cc->pflash.window_size;
48                 break;
49         default:
50                 bcma_err(bus, "Flash type not supported\n");
51 --- a/drivers/bcma/main.c
52 +++ b/drivers/bcma/main.c
53 @@ -149,6 +149,14 @@ static int bcma_register_cores(struct bc
54                 dev_id++;
55         }
56  
57 +#ifdef CONFIG_BCMA_DRIVER_MIPS
58 +       if (bus->drv_cc.pflash.present) {
59 +               err = platform_device_register(&bcma_pflash_dev);
60 +               if (err)
61 +                       bcma_err(bus, "Error registering parallel flash\n");
62 +       }
63 +#endif
64 +
65  #ifdef CONFIG_BCMA_SFLASH
66         if (bus->drv_cc.sflash.present) {
67                 err = platform_device_register(&bcma_sflash_dev);