blob: 578a50910c0a88819c510ca96e2634704330087e [file] [log] [blame]
wanzongshun7ec80dd2008-12-03 03:55:38 +01001/*
2 * linux/arch/arm/mach-w90x900/mach-w90p910evb.c
3 *
4 * Based on mach-s3c2410/mach-smdk2410.c by Jonas Dietsche
5 *
wanzongshun177dd6b2009-05-01 16:11:46 +01006 * Copyright (C) 2008 Nuvoton technology corporation.
wanzongshun7ec80dd2008-12-03 03:55:38 +01007 *
8 * Wan ZongShun <mcuos.com@gmail.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
wanzongshun177dd6b2009-05-01 16:11:46 +010012 * published by the Free Software Foundation;version 2 of the License.
wanzongshun7ec80dd2008-12-03 03:55:38 +010013 *
14 */
15
16#include <linux/kernel.h>
17#include <linux/types.h>
18#include <linux/interrupt.h>
19#include <linux/list.h>
20#include <linux/timer.h>
21#include <linux/init.h>
22#include <linux/platform_device.h>
wanzongshuna12370f2009-02-12 02:57:21 +010023#include <linux/mtd/physmap.h>
wanzongshun7ec80dd2008-12-03 03:55:38 +010024
25#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27#include <asm/mach/irq.h>
28#include <asm/mach-types.h>
29
30#include <mach/regs-serial.h>
Russell Kingd672d2f2009-01-10 11:34:39 +000031#include <mach/map.h>
wanzongshun7ec80dd2008-12-03 03:55:38 +010032
33#include "cpu.h"
wanzongshuna12370f2009-02-12 02:57:21 +010034/*w90p910 evb norflash driver data */
35
36#define W90P910_FLASH_BASE 0xA0000000
37#define W90P910_FLASH_SIZE 0x400000
38
39static struct mtd_partition w90p910_flash_partitions[] = {
40 {
41 .name = "NOR Partition 1 for kernel (960K)",
42 .size = 0xF0000,
43 .offset = 0x10000,
44 },
45 {
46 .name = "NOR Partition 2 for image (1M)",
47 .size = 0x100000,
48 .offset = 0x100000,
49 },
50 {
51 .name = "NOR Partition 3 for user (2M)",
52 .size = 0x200000,
53 .offset = 0x00200000,
54 }
55};
56
57static struct physmap_flash_data w90p910_flash_data = {
58 .width = 2,
59 .parts = w90p910_flash_partitions,
60 .nr_parts = ARRAY_SIZE(w90p910_flash_partitions),
61};
62
63static struct resource w90p910_flash_resources[] = {
64 {
65 .start = W90P910_FLASH_BASE,
66 .end = W90P910_FLASH_BASE + W90P910_FLASH_SIZE - 1,
67 .flags = IORESOURCE_MEM,
68 }
69};
70
71static struct platform_device w90p910_flash_device = {
72 .name = "physmap-flash",
73 .id = 0,
74 .dev = {
75 .platform_data = &w90p910_flash_data,
76 },
77 .resource = w90p910_flash_resources,
78 .num_resources = ARRAY_SIZE(w90p910_flash_resources),
79};
wanzongshun7ec80dd2008-12-03 03:55:38 +010080
wanzongshun177dd6b2009-05-01 16:11:46 +010081/* USB EHCI Host Controller */
82
83static struct resource w90x900_usb_ehci_resource[] = {
84 [0] = {
85 .start = W90X900_PA_USBEHCIHOST,
86 .end = W90X900_PA_USBEHCIHOST + W90X900_SZ_USBEHCIHOST - 1,
87 .flags = IORESOURCE_MEM,
88 },
89 [1] = {
90 .start = IRQ_USBH,
91 .end = IRQ_USBH,
92 .flags = IORESOURCE_IRQ,
93 }
94};
95
96static u64 w90x900_device_usb_ehci_dmamask = 0xffffffffUL;
97
98struct platform_device w90x900_device_usb_ehci = {
99 .name = "w90x900-ehci",
100 .id = -1,
101 .num_resources = ARRAY_SIZE(w90x900_usb_ehci_resource),
102 .resource = w90x900_usb_ehci_resource,
103 .dev = {
104 .dma_mask = &w90x900_device_usb_ehci_dmamask,
105 .coherent_dma_mask = 0xffffffffUL
106 }
107};
108EXPORT_SYMBOL(w90x900_device_usb_ehci);
109
110/* USB OHCI Host Controller */
111
112static struct resource w90x900_usb_ohci_resource[] = {
113 [0] = {
114 .start = W90X900_PA_USBOHCIHOST,
115 .end = W90X900_PA_USBOHCIHOST + W90X900_SZ_USBOHCIHOST - 1,
116 .flags = IORESOURCE_MEM,
117 },
118 [1] = {
119 .start = IRQ_USBH,
120 .end = IRQ_USBH,
121 .flags = IORESOURCE_IRQ,
122 }
123};
124
125static u64 w90x900_device_usb_ohci_dmamask = 0xffffffffUL;
126struct platform_device w90x900_device_usb_ohci = {
127 .name = "w90x900-ohci",
128 .id = -1,
129 .num_resources = ARRAY_SIZE(w90x900_usb_ohci_resource),
130 .resource = w90x900_usb_ohci_resource,
131 .dev = {
132 .dma_mask = &w90x900_device_usb_ohci_dmamask,
133 .coherent_dma_mask = 0xffffffffUL
134 }
135};
136EXPORT_SYMBOL(w90x900_device_usb_ohci);
137
wanzongshun7ec80dd2008-12-03 03:55:38 +0100138static struct map_desc w90p910_iodesc[] __initdata = {
139};
140
wanzongshun7ec80dd2008-12-03 03:55:38 +0100141/*Here should be your evb resourse,such as LCD*/
142
143static struct platform_device *w90p910evb_dev[] __initdata = {
wanzongshun17198f22009-02-04 05:01:38 +0100144 &w90p910_serial_device,
wanzongshuna12370f2009-02-12 02:57:21 +0100145 &w90p910_flash_device,
wanzongshun177dd6b2009-05-01 16:11:46 +0100146 &w90x900_device_usb_ehci,
147 &w90x900_device_usb_ohci,
wanzongshun7ec80dd2008-12-03 03:55:38 +0100148};
149
150static void __init w90p910evb_map_io(void)
151{
152 w90p910_map_io(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc));
153 w90p910_init_clocks(0);
wanzongshun7ec80dd2008-12-03 03:55:38 +0100154}
155
156static void __init w90p910evb_init(void)
157{
158 platform_add_devices(w90p910evb_dev, ARRAY_SIZE(w90p910evb_dev));
159}
160
161MACHINE_START(W90P910EVB, "W90P910EVB")
162 /* Maintainer: Wan ZongShun */
163 .phys_io = W90X900_PA_UART,
164 .io_pg_offst = (((u32)W90X900_VA_UART) >> 18) & 0xfffc,
165 .boot_params = 0,
166 .map_io = w90p910evb_map_io,
167 .init_irq = w90x900_init_irq,
168 .init_machine = w90p910evb_init,
169 .timer = &w90x900_timer,
170MACHINE_END