diff options
Diffstat (limited to 'arch/arm/mach-lpc32xx/common.c')
-rw-r--r-- | arch/arm/mach-lpc32xx/common.c | 188 |
1 files changed, 13 insertions, 175 deletions
diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c index bbbf063a74c2..5c96057b6d78 100644 --- a/arch/arm/mach-lpc32xx/common.c +++ b/arch/arm/mach-lpc32xx/common.c | |||
@@ -27,186 +27,11 @@ | |||
27 | 27 | ||
28 | #include <asm/mach/map.h> | 28 | #include <asm/mach/map.h> |
29 | 29 | ||
30 | #include <mach/i2c.h> | ||
31 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
32 | #include <mach/platform.h> | 31 | #include <mach/platform.h> |
33 | #include "common.h" | 32 | #include "common.h" |
34 | 33 | ||
35 | /* | 34 | /* |
36 | * Watchdog timer | ||
37 | */ | ||
38 | static struct resource watchdog_resources[] = { | ||
39 | [0] = { | ||
40 | .start = LPC32XX_WDTIM_BASE, | ||
41 | .end = LPC32XX_WDTIM_BASE + SZ_4K - 1, | ||
42 | .flags = IORESOURCE_MEM, | ||
43 | }, | ||
44 | }; | ||
45 | |||
46 | struct platform_device lpc32xx_watchdog_device = { | ||
47 | .name = "pnx4008-watchdog", | ||
48 | .id = -1, | ||
49 | .num_resources = ARRAY_SIZE(watchdog_resources), | ||
50 | .resource = watchdog_resources, | ||
51 | }; | ||
52 | |||
53 | /* | ||
54 | * I2C busses | ||
55 | */ | ||
56 | static struct i2c_pnx_data i2c0_data = { | ||
57 | .name = I2C_CHIP_NAME "1", | ||
58 | .base = LPC32XX_I2C1_BASE, | ||
59 | .irq = IRQ_LPC32XX_I2C_1, | ||
60 | }; | ||
61 | |||
62 | static struct i2c_pnx_data i2c1_data = { | ||
63 | .name = I2C_CHIP_NAME "2", | ||
64 | .base = LPC32XX_I2C2_BASE, | ||
65 | .irq = IRQ_LPC32XX_I2C_2, | ||
66 | }; | ||
67 | |||
68 | static struct i2c_pnx_data i2c2_data = { | ||
69 | .name = "USB-I2C", | ||
70 | .base = LPC32XX_OTG_I2C_BASE, | ||
71 | .irq = IRQ_LPC32XX_USB_I2C, | ||
72 | }; | ||
73 | |||
74 | struct platform_device lpc32xx_i2c0_device = { | ||
75 | .name = "pnx-i2c", | ||
76 | .id = 0, | ||
77 | .dev = { | ||
78 | .platform_data = &i2c0_data, | ||
79 | }, | ||
80 | }; | ||
81 | |||
82 | struct platform_device lpc32xx_i2c1_device = { | ||
83 | .name = "pnx-i2c", | ||
84 | .id = 1, | ||
85 | .dev = { | ||
86 | .platform_data = &i2c1_data, | ||
87 | }, | ||
88 | }; | ||
89 | |||
90 | struct platform_device lpc32xx_i2c2_device = { | ||
91 | .name = "pnx-i2c", | ||
92 | .id = 2, | ||
93 | .dev = { | ||
94 | .platform_data = &i2c2_data, | ||
95 | }, | ||
96 | }; | ||
97 | |||
98 | /* TSC (Touch Screen Controller) */ | ||
99 | |||
100 | static struct resource lpc32xx_tsc_resources[] = { | ||
101 | { | ||
102 | .start = LPC32XX_ADC_BASE, | ||
103 | .end = LPC32XX_ADC_BASE + SZ_4K - 1, | ||
104 | .flags = IORESOURCE_MEM, | ||
105 | }, { | ||
106 | .start = IRQ_LPC32XX_TS_IRQ, | ||
107 | .end = IRQ_LPC32XX_TS_IRQ, | ||
108 | .flags = IORESOURCE_IRQ, | ||
109 | }, | ||
110 | }; | ||
111 | |||
112 | struct platform_device lpc32xx_tsc_device = { | ||
113 | .name = "ts-lpc32xx", | ||
114 | .id = -1, | ||
115 | .num_resources = ARRAY_SIZE(lpc32xx_tsc_resources), | ||
116 | .resource = lpc32xx_tsc_resources, | ||
117 | }; | ||
118 | |||
119 | /* RTC */ | ||
120 | |||
121 | static struct resource lpc32xx_rtc_resources[] = { | ||
122 | { | ||
123 | .start = LPC32XX_RTC_BASE, | ||
124 | .end = LPC32XX_RTC_BASE + SZ_4K - 1, | ||
125 | .flags = IORESOURCE_MEM, | ||
126 | },{ | ||
127 | .start = IRQ_LPC32XX_RTC, | ||
128 | .end = IRQ_LPC32XX_RTC, | ||
129 | .flags = IORESOURCE_IRQ, | ||
130 | }, | ||
131 | }; | ||
132 | |||
133 | struct platform_device lpc32xx_rtc_device = { | ||
134 | .name = "rtc-lpc32xx", | ||
135 | .id = -1, | ||
136 | .num_resources = ARRAY_SIZE(lpc32xx_rtc_resources), | ||
137 | .resource = lpc32xx_rtc_resources, | ||
138 | }; | ||
139 | |||
140 | /* | ||
141 | * ADC support | ||
142 | */ | ||
143 | static struct resource adc_resources[] = { | ||
144 | { | ||
145 | .start = LPC32XX_ADC_BASE, | ||
146 | .end = LPC32XX_ADC_BASE + SZ_4K - 1, | ||
147 | .flags = IORESOURCE_MEM, | ||
148 | }, { | ||
149 | .start = IRQ_LPC32XX_TS_IRQ, | ||
150 | .end = IRQ_LPC32XX_TS_IRQ, | ||
151 | .flags = IORESOURCE_IRQ, | ||
152 | }, | ||
153 | }; | ||
154 | |||
155 | struct platform_device lpc32xx_adc_device = { | ||
156 | .name = "lpc32xx-adc", | ||
157 | .id = -1, | ||
158 | .num_resources = ARRAY_SIZE(adc_resources), | ||
159 | .resource = adc_resources, | ||
160 | }; | ||
161 | |||
162 | /* | ||
163 | * USB support | ||
164 | */ | ||
165 | /* The dmamask must be set for OHCI to work */ | ||
166 | static u64 ohci_dmamask = ~(u32) 0; | ||
167 | static struct resource ohci_resources[] = { | ||
168 | { | ||
169 | .start = IO_ADDRESS(LPC32XX_USB_BASE), | ||
170 | .end = IO_ADDRESS(LPC32XX_USB_BASE + 0x100 - 1), | ||
171 | .flags = IORESOURCE_MEM, | ||
172 | }, { | ||
173 | .start = IRQ_LPC32XX_USB_HOST, | ||
174 | .flags = IORESOURCE_IRQ, | ||
175 | }, | ||
176 | }; | ||
177 | struct platform_device lpc32xx_ohci_device = { | ||
178 | .name = "usb-ohci", | ||
179 | .id = -1, | ||
180 | .dev = { | ||
181 | .dma_mask = &ohci_dmamask, | ||
182 | .coherent_dma_mask = 0xFFFFFFFF, | ||
183 | }, | ||
184 | .num_resources = ARRAY_SIZE(ohci_resources), | ||
185 | .resource = ohci_resources, | ||
186 | }; | ||
187 | |||
188 | /* | ||
189 | * Network Support | ||
190 | */ | ||
191 | static struct resource net_resources[] = { | ||
192 | [0] = DEFINE_RES_MEM(LPC32XX_ETHERNET_BASE, SZ_4K), | ||
193 | [1] = DEFINE_RES_MEM(LPC32XX_IRAM_BASE, SZ_128K), | ||
194 | [2] = DEFINE_RES_IRQ(IRQ_LPC32XX_ETHERNET), | ||
195 | }; | ||
196 | |||
197 | static u64 lpc32xx_mac_dma_mask = 0xffffffffUL; | ||
198 | struct platform_device lpc32xx_net_device = { | ||
199 | .name = "lpc-eth", | ||
200 | .id = 0, | ||
201 | .dev = { | ||
202 | .dma_mask = &lpc32xx_mac_dma_mask, | ||
203 | .coherent_dma_mask = 0xffffffffUL, | ||
204 | }, | ||
205 | .num_resources = ARRAY_SIZE(net_resources), | ||
206 | .resource = net_resources, | ||
207 | }; | ||
208 | |||
209 | /* | ||
210 | * Returns the unique ID for the device | 35 | * Returns the unique ID for the device |
211 | */ | 36 | */ |
212 | void lpc32xx_get_uid(u32 devid[4]) | 37 | void lpc32xx_get_uid(u32 devid[4]) |
@@ -398,3 +223,16 @@ void lpc23xx_restart(char mode, const char *cmd) | |||
398 | while (1) | 223 | while (1) |
399 | ; | 224 | ; |
400 | } | 225 | } |
226 | |||
227 | static int __init lpc32xx_display_uid(void) | ||
228 | { | ||
229 | u32 uid[4]; | ||
230 | |||
231 | lpc32xx_get_uid(uid); | ||
232 | |||
233 | printk(KERN_INFO "LPC32XX unique ID: %08x%08x%08x%08x\n", | ||
234 | uid[3], uid[2], uid[1], uid[0]); | ||
235 | |||
236 | return 1; | ||
237 | } | ||
238 | arch_initcall(lpc32xx_display_uid); | ||