1 From be495ba9c365a31cf6a9fa0f67df9a9a9e0f1a1f Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sat, 23 Jul 2011 23:57:06 +0200
4 Subject: [PATCH 14/26] ssb: move flash to chipcommon
7 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
9 arch/mips/bcm47xx/nvram.c | 8 +++---
10 arch/mips/bcm47xx/wgt634u.c | 8 +++---
11 drivers/ssb/driver_mipscore.c | 31 +++++++++++++++++++---------
12 include/linux/ssb/ssb_driver_chipcommon.h | 18 ++++++++++++++++
13 include/linux/ssb/ssb_driver_mips.h | 4 ---
14 5 files changed, 47 insertions(+), 22 deletions(-)
16 --- a/arch/mips/bcm47xx/nvram.c
17 +++ b/arch/mips/bcm47xx/nvram.c
18 @@ -27,7 +27,7 @@ static char nvram_buf[NVRAM_SPACE];
19 static void early_nvram_init(void)
21 #ifdef CONFIG_BCM47XX_SSB
22 - struct ssb_mipscore *mcore_ssb;
23 + struct ssb_chipcommon *ssb_cc;
25 #ifdef CONFIG_BCM47XX_BCMA
26 struct bcma_drv_cc *bcma_cc;
27 @@ -42,9 +42,9 @@ static void early_nvram_init(void)
28 switch (bcm47xx_bus_type) {
29 #ifdef CONFIG_BCM47XX_SSB
30 case BCM47XX_BUS_TYPE_SSB:
31 - mcore_ssb = &bcm47xx_bus.ssb.mipscore;
32 - base = mcore_ssb->flash_window;
33 - lim = mcore_ssb->flash_window_size;
34 + ssb_cc = &bcm47xx_bus.ssb.chipco;
35 + base = ssb_cc->pflash.window;
36 + lim = ssb_cc->pflash.window_size;
39 #ifdef CONFIG_BCM47XX_BCMA
40 --- a/arch/mips/bcm47xx/wgt634u.c
41 +++ b/arch/mips/bcm47xx/wgt634u.c
42 @@ -156,10 +156,10 @@ static int __init wgt634u_init(void)
46 - wgt634u_flash_data.width = mcore->flash_buswidth;
47 - wgt634u_flash_resource.start = mcore->flash_window;
48 - wgt634u_flash_resource.end = mcore->flash_window
49 - + mcore->flash_window_size
50 + wgt634u_flash_data.width = mcore->pflash.buswidth;
51 + wgt634u_flash_resource.start = mcore->pflash.window;
52 + wgt634u_flash_resource.end = mcore->pflash.window
53 + + mcore->pflash.window_size
55 return platform_add_devices(wgt634u_devices,
56 ARRAY_SIZE(wgt634u_devices));
57 --- a/drivers/ssb/driver_mipscore.c
58 +++ b/drivers/ssb/driver_mipscore.c
59 @@ -190,16 +190,27 @@ static void ssb_mips_flash_detect(struct
61 struct ssb_bus *bus = mcore->dev->bus;
63 - mcore->flash_buswidth = 2;
64 - if (bus->chipco.dev) {
65 - mcore->flash_window = 0x1c000000;
66 - mcore->flash_window_size = 0x02000000;
67 - if ((ssb_read32(bus->chipco.dev, SSB_CHIPCO_FLASH_CFG)
68 - & SSB_CHIPCO_CFG_DS16) == 0)
69 - mcore->flash_buswidth = 1;
71 - mcore->flash_window = 0x1fc00000;
72 - mcore->flash_window_size = 0x00400000;
73 + switch (bus->chipco.capabilities & SSB_CHIPCO_CAP_FLASHT) {
74 + case SSB_CHIPCO_FLASHT_STSER:
75 + case SSB_CHIPCO_FLASHT_ATSER:
76 + pr_info("serial flash not supported.\n");
78 + case SSB_CHIPCO_FLASHT_PARA:
79 + pr_info("found parallel flash.\n");
80 + bus->chipco.flash_type = SSB_PFLASH;
81 + bus->chipco.pflash.buswidth = 2;
82 + if (bus->chipco.dev) {
83 + bus->chipco.pflash.window = 0x1c000000;
84 + bus->chipco.pflash.window_size = 0x02000000;
85 + if ((ssb_read32(bus->chipco.dev, SSB_CHIPCO_FLASH_CFG)
86 + & SSB_CHIPCO_CFG_DS16) == 0)
87 + bus->chipco.pflash.buswidth = 1;
89 + bus->chipco.pflash.window = 0x1fc00000;
90 + bus->chipco.pflash.window_size = 0x00400000;
93 + pr_err("flash not supported.\n");
97 --- a/include/linux/ssb/ssb_driver_chipcommon.h
98 +++ b/include/linux/ssb/ssb_driver_chipcommon.h
99 @@ -582,6 +582,18 @@ struct ssb_chipcommon_pmu {
100 u32 crystalfreq; /* The active crystal frequency (in kHz) */
103 +#ifdef CONFIG_SSB_DRIVER_MIPS
104 +enum ssb_flash_type {
113 +#endif /* CONFIG_SSB_DRIVER_MIPS */
115 struct ssb_chipcommon {
116 struct ssb_device *dev;
118 @@ -589,6 +601,12 @@ struct ssb_chipcommon {
119 /* Fast Powerup Delay constant */
120 u16 fast_pwrup_delay;
121 struct ssb_chipcommon_pmu pmu;
122 +#ifdef CONFIG_SSB_DRIVER_MIPS
123 + enum ssb_flash_type flash_type;
125 + struct ssb_pflash pflash;
127 +#endif /* CONFIG_SSB_DRIVER_MIPS */
130 static inline bool ssb_chipco_available(struct ssb_chipcommon *cc)
131 --- a/include/linux/ssb/ssb_driver_mips.h
132 +++ b/include/linux/ssb/ssb_driver_mips.h
133 @@ -19,10 +19,6 @@ struct ssb_mipscore {
136 struct ssb_serial_port serial_ports[4];
140 - u32 flash_window_size;
143 extern void ssb_mipscore_init(struct ssb_mipscore *mcore);