OMAP3: SR: Reset voltage level on SR disable
[linux-ginger.git] / arch / arm / mach-w90x900 / dev.c
blob2a6f98de48d2510399b1b9d8b82b25e608ac9ec7
1 /*
2 * linux/arch/arm/mach-w90x900/dev.c
4 * Copyright (C) 2009 Nuvoton corporation.
6 * Wan ZongShun <mcuos.com@gmail.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation;version 2 of the License.
14 #include <linux/kernel.h>
15 #include <linux/types.h>
16 #include <linux/interrupt.h>
17 #include <linux/list.h>
18 #include <linux/timer.h>
19 #include <linux/init.h>
20 #include <linux/platform_device.h>
22 #include <linux/mtd/physmap.h>
23 #include <linux/mtd/mtd.h>
24 #include <linux/mtd/partitions.h>
26 #include <linux/spi/spi.h>
27 #include <linux/spi/flash.h>
29 #include <asm/mach/arch.h>
30 #include <asm/mach/map.h>
31 #include <asm/mach/irq.h>
32 #include <asm/mach-types.h>
34 #include <mach/regs-serial.h>
35 #include <mach/map.h>
37 #include "cpu.h"
39 /*NUC900 evb norflash driver data */
41 #define NUC900_FLASH_BASE 0xA0000000
42 #define NUC900_FLASH_SIZE 0x400000
43 #define SPIOFFSET 0x200
44 #define SPIOREG_SIZE 0x100
46 static struct mtd_partition nuc900_flash_partitions[] = {
48 .name = "NOR Partition 1 for kernel (960K)",
49 .size = 0xF0000,
50 .offset = 0x10000,
53 .name = "NOR Partition 2 for image (1M)",
54 .size = 0x100000,
55 .offset = 0x100000,
58 .name = "NOR Partition 3 for user (2M)",
59 .size = 0x200000,
60 .offset = 0x00200000,
64 static struct physmap_flash_data nuc900_flash_data = {
65 .width = 2,
66 .parts = nuc900_flash_partitions,
67 .nr_parts = ARRAY_SIZE(nuc900_flash_partitions),
70 static struct resource nuc900_flash_resources[] = {
72 .start = NUC900_FLASH_BASE,
73 .end = NUC900_FLASH_BASE + NUC900_FLASH_SIZE - 1,
74 .flags = IORESOURCE_MEM,
78 static struct platform_device nuc900_flash_device = {
79 .name = "physmap-flash",
80 .id = 0,
81 .dev = {
82 .platform_data = &nuc900_flash_data,
84 .resource = nuc900_flash_resources,
85 .num_resources = ARRAY_SIZE(nuc900_flash_resources),
88 /* USB EHCI Host Controller */
90 static struct resource nuc900_usb_ehci_resource[] = {
91 [0] = {
92 .start = W90X900_PA_USBEHCIHOST,
93 .end = W90X900_PA_USBEHCIHOST + W90X900_SZ_USBEHCIHOST - 1,
94 .flags = IORESOURCE_MEM,
96 [1] = {
97 .start = IRQ_USBH,
98 .end = IRQ_USBH,
99 .flags = IORESOURCE_IRQ,
103 static u64 nuc900_device_usb_ehci_dmamask = 0xffffffffUL;
105 static struct platform_device nuc900_device_usb_ehci = {
106 .name = "nuc900-ehci",
107 .id = -1,
108 .num_resources = ARRAY_SIZE(nuc900_usb_ehci_resource),
109 .resource = nuc900_usb_ehci_resource,
110 .dev = {
111 .dma_mask = &nuc900_device_usb_ehci_dmamask,
112 .coherent_dma_mask = 0xffffffffUL
116 /* USB OHCI Host Controller */
118 static struct resource nuc900_usb_ohci_resource[] = {
119 [0] = {
120 .start = W90X900_PA_USBOHCIHOST,
121 .end = W90X900_PA_USBOHCIHOST + W90X900_SZ_USBOHCIHOST - 1,
122 .flags = IORESOURCE_MEM,
124 [1] = {
125 .start = IRQ_USBH,
126 .end = IRQ_USBH,
127 .flags = IORESOURCE_IRQ,
131 static u64 nuc900_device_usb_ohci_dmamask = 0xffffffffUL;
132 static struct platform_device nuc900_device_usb_ohci = {
133 .name = "nuc900-ohci",
134 .id = -1,
135 .num_resources = ARRAY_SIZE(nuc900_usb_ohci_resource),
136 .resource = nuc900_usb_ohci_resource,
137 .dev = {
138 .dma_mask = &nuc900_device_usb_ohci_dmamask,
139 .coherent_dma_mask = 0xffffffffUL
143 /* USB Device (Gadget)*/
145 static struct resource nuc900_usbgadget_resource[] = {
146 [0] = {
147 .start = W90X900_PA_USBDEV,
148 .end = W90X900_PA_USBDEV + W90X900_SZ_USBDEV - 1,
149 .flags = IORESOURCE_MEM,
151 [1] = {
152 .start = IRQ_USBD,
153 .end = IRQ_USBD,
154 .flags = IORESOURCE_IRQ,
158 static struct platform_device nuc900_device_usbgadget = {
159 .name = "nuc900-usbgadget",
160 .id = -1,
161 .num_resources = ARRAY_SIZE(nuc900_usbgadget_resource),
162 .resource = nuc900_usbgadget_resource,
165 /* MAC device */
167 static struct resource nuc900_emc_resource[] = {
168 [0] = {
169 .start = W90X900_PA_EMC,
170 .end = W90X900_PA_EMC + W90X900_SZ_EMC - 1,
171 .flags = IORESOURCE_MEM,
173 [1] = {
174 .start = IRQ_EMCTX,
175 .end = IRQ_EMCTX,
176 .flags = IORESOURCE_IRQ,
178 [2] = {
179 .start = IRQ_EMCRX,
180 .end = IRQ_EMCRX,
181 .flags = IORESOURCE_IRQ,
185 static u64 nuc900_device_emc_dmamask = 0xffffffffUL;
186 static struct platform_device nuc900_device_emc = {
187 .name = "nuc900-emc",
188 .id = -1,
189 .num_resources = ARRAY_SIZE(nuc900_emc_resource),
190 .resource = nuc900_emc_resource,
191 .dev = {
192 .dma_mask = &nuc900_device_emc_dmamask,
193 .coherent_dma_mask = 0xffffffffUL
197 /* SPI device */
199 static struct resource nuc900_spi_resource[] = {
200 [0] = {
201 .start = W90X900_PA_I2C + SPIOFFSET,
202 .end = W90X900_PA_I2C + SPIOFFSET + SPIOREG_SIZE - 1,
203 .flags = IORESOURCE_MEM,
205 [1] = {
206 .start = IRQ_SSP,
207 .end = IRQ_SSP,
208 .flags = IORESOURCE_IRQ,
212 static struct platform_device nuc900_device_spi = {
213 .name = "nuc900-spi",
214 .id = -1,
215 .num_resources = ARRAY_SIZE(nuc900_spi_resource),
216 .resource = nuc900_spi_resource,
219 /* spi device, spi flash info */
221 static struct mtd_partition nuc900_spi_flash_partitions[] = {
223 .name = "bootloader(spi)",
224 .size = 0x0100000,
225 .offset = 0,
229 static struct flash_platform_data nuc900_spi_flash_data = {
230 .name = "m25p80",
231 .parts = nuc900_spi_flash_partitions,
232 .nr_parts = ARRAY_SIZE(nuc900_spi_flash_partitions),
233 .type = "w25x16",
236 static struct spi_board_info nuc900_spi_board_info[] __initdata = {
238 .modalias = "m25p80",
239 .max_speed_hz = 20000000,
240 .bus_num = 0,
241 .chip_select = 1,
242 .platform_data = &nuc900_spi_flash_data,
243 .mode = SPI_MODE_0,
247 /* WDT Device */
249 static struct resource nuc900_wdt_resource[] = {
250 [0] = {
251 .start = W90X900_PA_TIMER,
252 .end = W90X900_PA_TIMER + W90X900_SZ_TIMER - 1,
253 .flags = IORESOURCE_MEM,
255 [1] = {
256 .start = IRQ_WDT,
257 .end = IRQ_WDT,
258 .flags = IORESOURCE_IRQ,
262 static struct platform_device nuc900_device_wdt = {
263 .name = "nuc900-wdt",
264 .id = -1,
265 .num_resources = ARRAY_SIZE(nuc900_wdt_resource),
266 .resource = nuc900_wdt_resource,
270 * public device definition between 910 and 920, or 910
271 * and 950 or 950 and 960...,their dev platform register
272 * should be in specific file such as nuc950, nuc960 c
273 * files rather than the public dev.c file here. so the
274 * corresponding platform_device definition should not be
275 * static.
278 /* RTC controller*/
280 static struct resource nuc900_rtc_resource[] = {
281 [0] = {
282 .start = W90X900_PA_RTC,
283 .end = W90X900_PA_RTC + 0xff,
284 .flags = IORESOURCE_MEM,
286 [1] = {
287 .start = IRQ_RTC,
288 .end = IRQ_RTC,
289 .flags = IORESOURCE_IRQ,
293 struct platform_device nuc900_device_rtc = {
294 .name = "nuc900-rtc",
295 .id = -1,
296 .num_resources = ARRAY_SIZE(nuc900_rtc_resource),
297 .resource = nuc900_rtc_resource,
300 /*TouchScreen controller*/
302 static struct resource nuc900_ts_resource[] = {
303 [0] = {
304 .start = W90X900_PA_ADC,
305 .end = W90X900_PA_ADC + W90X900_SZ_ADC-1,
306 .flags = IORESOURCE_MEM,
308 [1] = {
309 .start = IRQ_ADC,
310 .end = IRQ_ADC,
311 .flags = IORESOURCE_IRQ,
315 struct platform_device nuc900_device_ts = {
316 .name = "nuc900-ts",
317 .id = -1,
318 .resource = nuc900_ts_resource,
319 .num_resources = ARRAY_SIZE(nuc900_ts_resource),
322 /* FMI Device */
324 static struct resource nuc900_fmi_resource[] = {
325 [0] = {
326 .start = W90X900_PA_FMI,
327 .end = W90X900_PA_FMI + W90X900_SZ_FMI - 1,
328 .flags = IORESOURCE_MEM,
330 [1] = {
331 .start = IRQ_FMI,
332 .end = IRQ_FMI,
333 .flags = IORESOURCE_IRQ,
337 struct platform_device nuc900_device_fmi = {
338 .name = "nuc900-fmi",
339 .id = -1,
340 .num_resources = ARRAY_SIZE(nuc900_fmi_resource),
341 .resource = nuc900_fmi_resource,
344 /* KPI controller*/
346 static struct resource nuc900_kpi_resource[] = {
347 [0] = {
348 .start = W90X900_PA_KPI,
349 .end = W90X900_PA_KPI + W90X900_SZ_KPI - 1,
350 .flags = IORESOURCE_MEM,
352 [1] = {
353 .start = IRQ_KPI,
354 .end = IRQ_KPI,
355 .flags = IORESOURCE_IRQ,
360 struct platform_device nuc900_device_kpi = {
361 .name = "nuc900-kpi",
362 .id = -1,
363 .num_resources = ARRAY_SIZE(nuc900_kpi_resource),
364 .resource = nuc900_kpi_resource,
367 /*Here should be your evb resourse,such as LCD*/
369 static struct platform_device *nuc900_public_dev[] __initdata = {
370 &nuc900_serial_device,
371 &nuc900_flash_device,
372 &nuc900_device_usb_ehci,
373 &nuc900_device_usb_ohci,
374 &nuc900_device_usbgadget,
375 &nuc900_device_emc,
376 &nuc900_device_spi,
377 &nuc900_device_wdt,
380 /* Provide adding specific CPU platform devices API */
382 void __init nuc900_board_init(struct platform_device **device, int size)
384 platform_add_devices(device, size);
385 platform_add_devices(nuc900_public_dev, ARRAY_SIZE(nuc900_public_dev));
386 spi_register_board_info(nuc900_spi_board_info,
387 ARRAY_SIZE(nuc900_spi_board_info));