diff options
Diffstat (limited to 'arch/mips/alchemy/devboards/pb1200/platform.c')
-rw-r--r-- | arch/mips/alchemy/devboards/pb1200/platform.c | 339 |
1 files changed, 0 insertions, 339 deletions
diff --git a/arch/mips/alchemy/devboards/pb1200/platform.c b/arch/mips/alchemy/devboards/pb1200/platform.c deleted file mode 100644 index 54f7f7b0676e..000000000000 --- a/arch/mips/alchemy/devboards/pb1200/platform.c +++ /dev/null | |||
@@ -1,339 +0,0 @@ | |||
1 | /* | ||
2 | * Pb1200/DBAu1200 board platform device registration | ||
3 | * | ||
4 | * Copyright (C) 2008 MontaVista Software Inc. <source@mvista.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/dma-mapping.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/leds.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <linux/smc91x.h> | ||
26 | |||
27 | #include <asm/mach-au1x00/au1000.h> | ||
28 | #include <asm/mach-au1x00/au1100_mmc.h> | ||
29 | #include <asm/mach-au1x00/au1xxx_dbdma.h> | ||
30 | #include <asm/mach-db1x00/bcsr.h> | ||
31 | #include <asm/mach-pb1x00/pb1200.h> | ||
32 | |||
33 | #include "../platform.h" | ||
34 | |||
35 | static int mmc_activity; | ||
36 | |||
37 | static void pb1200mmc0_set_power(void *mmc_host, int state) | ||
38 | { | ||
39 | if (state) | ||
40 | bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD0PWR); | ||
41 | else | ||
42 | bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD0PWR, 0); | ||
43 | |||
44 | msleep(1); | ||
45 | } | ||
46 | |||
47 | static int pb1200mmc0_card_readonly(void *mmc_host) | ||
48 | { | ||
49 | return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD0WP) ? 1 : 0; | ||
50 | } | ||
51 | |||
52 | static int pb1200mmc0_card_inserted(void *mmc_host) | ||
53 | { | ||
54 | return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD0INSERT) ? 1 : 0; | ||
55 | } | ||
56 | |||
57 | static void pb1200_mmcled_set(struct led_classdev *led, | ||
58 | enum led_brightness brightness) | ||
59 | { | ||
60 | if (brightness != LED_OFF) { | ||
61 | if (++mmc_activity == 1) | ||
62 | bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED0, 0); | ||
63 | } else { | ||
64 | if (--mmc_activity == 0) | ||
65 | bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED0); | ||
66 | } | ||
67 | } | ||
68 | |||
69 | static struct led_classdev pb1200mmc_led = { | ||
70 | .brightness_set = pb1200_mmcled_set, | ||
71 | }; | ||
72 | |||
73 | static void pb1200mmc1_set_power(void *mmc_host, int state) | ||
74 | { | ||
75 | if (state) | ||
76 | bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD1PWR); | ||
77 | else | ||
78 | bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD1PWR, 0); | ||
79 | |||
80 | msleep(1); | ||
81 | } | ||
82 | |||
83 | static int pb1200mmc1_card_readonly(void *mmc_host) | ||
84 | { | ||
85 | return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD1WP) ? 1 : 0; | ||
86 | } | ||
87 | |||
88 | static int pb1200mmc1_card_inserted(void *mmc_host) | ||
89 | { | ||
90 | return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD1INSERT) ? 1 : 0; | ||
91 | } | ||
92 | |||
93 | static struct au1xmmc_platform_data pb1200mmc_platdata[2] = { | ||
94 | [0] = { | ||
95 | .set_power = pb1200mmc0_set_power, | ||
96 | .card_inserted = pb1200mmc0_card_inserted, | ||
97 | .card_readonly = pb1200mmc0_card_readonly, | ||
98 | .cd_setup = NULL, /* use poll-timer in driver */ | ||
99 | .led = &pb1200mmc_led, | ||
100 | }, | ||
101 | [1] = { | ||
102 | .set_power = pb1200mmc1_set_power, | ||
103 | .card_inserted = pb1200mmc1_card_inserted, | ||
104 | .card_readonly = pb1200mmc1_card_readonly, | ||
105 | .cd_setup = NULL, /* use poll-timer in driver */ | ||
106 | .led = &pb1200mmc_led, | ||
107 | }, | ||
108 | }; | ||
109 | |||
110 | static u64 au1xxx_mmc_dmamask = DMA_BIT_MASK(32); | ||
111 | |||
112 | static struct resource au1200_mmc0_res[] = { | ||
113 | [0] = { | ||
114 | .start = AU1100_SD0_PHYS_ADDR, | ||
115 | .end = AU1100_SD0_PHYS_ADDR + 0xfff, | ||
116 | .flags = IORESOURCE_MEM, | ||
117 | }, | ||
118 | [1] = { | ||
119 | .start = AU1200_SD_INT, | ||
120 | .end = AU1200_SD_INT, | ||
121 | .flags = IORESOURCE_IRQ, | ||
122 | }, | ||
123 | [2] = { | ||
124 | .start = AU1200_DSCR_CMD0_SDMS_TX0, | ||
125 | .end = AU1200_DSCR_CMD0_SDMS_TX0, | ||
126 | .flags = IORESOURCE_DMA, | ||
127 | }, | ||
128 | [3] = { | ||
129 | .start = AU1200_DSCR_CMD0_SDMS_RX0, | ||
130 | .end = AU1200_DSCR_CMD0_SDMS_RX0, | ||
131 | .flags = IORESOURCE_DMA, | ||
132 | } | ||
133 | }; | ||
134 | |||
135 | static struct platform_device pb1200_mmc0_dev = { | ||
136 | .name = "au1xxx-mmc", | ||
137 | .id = 0, | ||
138 | .dev = { | ||
139 | .dma_mask = &au1xxx_mmc_dmamask, | ||
140 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
141 | .platform_data = &pb1200mmc_platdata[0], | ||
142 | }, | ||
143 | .num_resources = ARRAY_SIZE(au1200_mmc0_res), | ||
144 | .resource = au1200_mmc0_res, | ||
145 | }; | ||
146 | |||
147 | static struct resource au1200_mmc1_res[] = { | ||
148 | [0] = { | ||
149 | .start = AU1100_SD1_PHYS_ADDR, | ||
150 | .end = AU1100_SD1_PHYS_ADDR + 0xfff, | ||
151 | .flags = IORESOURCE_MEM, | ||
152 | }, | ||
153 | [1] = { | ||
154 | .start = AU1200_SD_INT, | ||
155 | .end = AU1200_SD_INT, | ||
156 | .flags = IORESOURCE_IRQ, | ||
157 | }, | ||
158 | [2] = { | ||
159 | .start = AU1200_DSCR_CMD0_SDMS_TX1, | ||
160 | .end = AU1200_DSCR_CMD0_SDMS_TX1, | ||
161 | .flags = IORESOURCE_DMA, | ||
162 | }, | ||
163 | [3] = { | ||
164 | .start = AU1200_DSCR_CMD0_SDMS_RX1, | ||
165 | .end = AU1200_DSCR_CMD0_SDMS_RX1, | ||
166 | .flags = IORESOURCE_DMA, | ||
167 | } | ||
168 | }; | ||
169 | |||
170 | static struct platform_device pb1200_mmc1_dev = { | ||
171 | .name = "au1xxx-mmc", | ||
172 | .id = 1, | ||
173 | .dev = { | ||
174 | .dma_mask = &au1xxx_mmc_dmamask, | ||
175 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
176 | .platform_data = &pb1200mmc_platdata[1], | ||
177 | }, | ||
178 | .num_resources = ARRAY_SIZE(au1200_mmc1_res), | ||
179 | .resource = au1200_mmc1_res, | ||
180 | }; | ||
181 | |||
182 | |||
183 | static struct resource ide_resources[] = { | ||
184 | [0] = { | ||
185 | .start = IDE_PHYS_ADDR, | ||
186 | .end = IDE_PHYS_ADDR + IDE_PHYS_LEN - 1, | ||
187 | .flags = IORESOURCE_MEM | ||
188 | }, | ||
189 | [1] = { | ||
190 | .start = IDE_INT, | ||
191 | .end = IDE_INT, | ||
192 | .flags = IORESOURCE_IRQ | ||
193 | }, | ||
194 | [2] = { | ||
195 | .start = AU1200_DSCR_CMD0_DMA_REQ1, | ||
196 | .end = AU1200_DSCR_CMD0_DMA_REQ1, | ||
197 | .flags = IORESOURCE_DMA, | ||
198 | }, | ||
199 | }; | ||
200 | |||
201 | static u64 ide_dmamask = DMA_BIT_MASK(32); | ||
202 | |||
203 | static struct platform_device ide_device = { | ||
204 | .name = "au1200-ide", | ||
205 | .id = 0, | ||
206 | .dev = { | ||
207 | .dma_mask = &ide_dmamask, | ||
208 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
209 | }, | ||
210 | .num_resources = ARRAY_SIZE(ide_resources), | ||
211 | .resource = ide_resources | ||
212 | }; | ||
213 | |||
214 | static struct smc91x_platdata smc_data = { | ||
215 | .flags = SMC91X_NOWAIT | SMC91X_USE_16BIT, | ||
216 | .leda = RPC_LED_100_10, | ||
217 | .ledb = RPC_LED_TX_RX, | ||
218 | }; | ||
219 | |||
220 | static struct resource smc91c111_resources[] = { | ||
221 | [0] = { | ||
222 | .name = "smc91x-regs", | ||
223 | .start = SMC91C111_PHYS_ADDR, | ||
224 | .end = SMC91C111_PHYS_ADDR + 0xf, | ||
225 | .flags = IORESOURCE_MEM | ||
226 | }, | ||
227 | [1] = { | ||
228 | .start = SMC91C111_INT, | ||
229 | .end = SMC91C111_INT, | ||
230 | .flags = IORESOURCE_IRQ | ||
231 | }, | ||
232 | }; | ||
233 | |||
234 | static struct platform_device smc91c111_device = { | ||
235 | .dev = { | ||
236 | .platform_data = &smc_data, | ||
237 | }, | ||
238 | .name = "smc91x", | ||
239 | .id = -1, | ||
240 | .num_resources = ARRAY_SIZE(smc91c111_resources), | ||
241 | .resource = smc91c111_resources | ||
242 | }; | ||
243 | |||
244 | static struct resource au1200_psc0_res[] = { | ||
245 | [0] = { | ||
246 | .start = AU1550_PSC0_PHYS_ADDR, | ||
247 | .end = AU1550_PSC0_PHYS_ADDR + 0xfff, | ||
248 | .flags = IORESOURCE_MEM, | ||
249 | }, | ||
250 | [1] = { | ||
251 | .start = AU1200_PSC0_INT, | ||
252 | .end = AU1200_PSC0_INT, | ||
253 | .flags = IORESOURCE_IRQ, | ||
254 | }, | ||
255 | [2] = { | ||
256 | .start = AU1200_DSCR_CMD0_PSC0_TX, | ||
257 | .end = AU1200_DSCR_CMD0_PSC0_TX, | ||
258 | .flags = IORESOURCE_DMA, | ||
259 | }, | ||
260 | [3] = { | ||
261 | .start = AU1200_DSCR_CMD0_PSC0_RX, | ||
262 | .end = AU1200_DSCR_CMD0_PSC0_RX, | ||
263 | .flags = IORESOURCE_DMA, | ||
264 | }, | ||
265 | }; | ||
266 | |||
267 | static struct platform_device pb1200_i2c_dev = { | ||
268 | .name = "au1xpsc_smbus", | ||
269 | .id = 0, /* bus number */ | ||
270 | .num_resources = ARRAY_SIZE(au1200_psc0_res), | ||
271 | .resource = au1200_psc0_res, | ||
272 | }; | ||
273 | |||
274 | static struct resource au1200_lcd_res[] = { | ||
275 | [0] = { | ||
276 | .start = AU1200_LCD_PHYS_ADDR, | ||
277 | .end = AU1200_LCD_PHYS_ADDR + 0x800 - 1, | ||
278 | .flags = IORESOURCE_MEM, | ||
279 | }, | ||
280 | [1] = { | ||
281 | .start = AU1200_LCD_INT, | ||
282 | .end = AU1200_LCD_INT, | ||
283 | .flags = IORESOURCE_IRQ, | ||
284 | } | ||
285 | }; | ||
286 | |||
287 | static u64 au1200_lcd_dmamask = DMA_BIT_MASK(32); | ||
288 | |||
289 | static struct platform_device au1200_lcd_dev = { | ||
290 | .name = "au1200-lcd", | ||
291 | .id = 0, | ||
292 | .dev = { | ||
293 | .dma_mask = &au1200_lcd_dmamask, | ||
294 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
295 | }, | ||
296 | .num_resources = ARRAY_SIZE(au1200_lcd_res), | ||
297 | .resource = au1200_lcd_res, | ||
298 | }; | ||
299 | |||
300 | static struct platform_device *board_platform_devices[] __initdata = { | ||
301 | &ide_device, | ||
302 | &smc91c111_device, | ||
303 | &pb1200_i2c_dev, | ||
304 | &pb1200_mmc0_dev, | ||
305 | &pb1200_mmc1_dev, | ||
306 | &au1200_lcd_dev, | ||
307 | }; | ||
308 | |||
309 | static int __init board_register_devices(void) | ||
310 | { | ||
311 | int swapped; | ||
312 | |||
313 | db1x_register_pcmcia_socket( | ||
314 | AU1000_PCMCIA_ATTR_PHYS_ADDR, | ||
315 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, | ||
316 | AU1000_PCMCIA_MEM_PHYS_ADDR, | ||
317 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, | ||
318 | AU1000_PCMCIA_IO_PHYS_ADDR, | ||
319 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, | ||
320 | PB1200_PC0_INT, PB1200_PC0_INSERT_INT, | ||
321 | /*PB1200_PC0_STSCHG_INT*/0, PB1200_PC0_EJECT_INT, 0); | ||
322 | |||
323 | db1x_register_pcmcia_socket( | ||
324 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x008000000, | ||
325 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x008400000 - 1, | ||
326 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x008000000, | ||
327 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x008400000 - 1, | ||
328 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x008000000, | ||
329 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x008010000 - 1, | ||
330 | PB1200_PC1_INT, PB1200_PC1_INSERT_INT, | ||
331 | /*PB1200_PC1_STSCHG_INT*/0, PB1200_PC1_EJECT_INT, 1); | ||
332 | |||
333 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT; | ||
334 | db1x_register_norflash(128 * 1024 * 1024, 2, swapped); | ||
335 | |||
336 | return platform_add_devices(board_platform_devices, | ||
337 | ARRAY_SIZE(board_platform_devices)); | ||
338 | } | ||
339 | device_initcall(board_register_devices); | ||