hwmon: coretemp: documentation update and cleanup
[linux-2.6/kvm.git] / arch / arm / mach-shmobile / board-ap4evb.c
blob1c2ec96ce2610c88a9292b7edcf6adc1f390b808
1 /*
2 * AP4EVB board support
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2008 Yoshihiro Shimoda
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
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.
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
20 #include <linux/kernel.h>
21 #include <linux/init.h>
22 #include <linux/interrupt.h>
23 #include <linux/irq.h>
24 #include <linux/platform_device.h>
25 #include <linux/delay.h>
26 #include <linux/mtd/mtd.h>
27 #include <linux/mtd/partitions.h>
28 #include <linux/mtd/physmap.h>
29 #include <linux/io.h>
30 #include <linux/smsc911x.h>
31 #include <linux/gpio.h>
32 #include <linux/input.h>
33 #include <linux/input/sh_keysc.h>
34 #include <mach/common.h>
35 #include <mach/sh7372.h>
36 #include <asm/mach-types.h>
37 #include <asm/mach/arch.h>
38 #include <asm/mach/map.h>
41 * Address Interface BusWidth note
42 * ------------------------------------------------------------------
43 * 0x0000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = ON
44 * 0x0800_0000 user area -
45 * 0x1000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = OFF
46 * 0x1400_0000 Ether (LAN9220) 16bit
47 * 0x1600_0000 user area - cannot use with NAND
48 * 0x1800_0000 user area -
49 * 0x1A00_0000 -
50 * 0x4000_0000 LPDDR2-SDRAM (POP) 32bit
54 * NOR Flash ROM
56 * SW1 | SW2 | SW7 | NOR Flash ROM
57 * bit1 | bit1 bit2 | bit1 | Memory allocation
58 * ------+------------+------+------------------
59 * OFF | ON OFF | ON | Area 0
60 * OFF | ON OFF | OFF | Area 4
64 * NAND Flash ROM
66 * SW1 | SW2 | SW7 | NAND Flash ROM
67 * bit1 | bit1 bit2 | bit2 | Memory allocation
68 * ------+------------+------+------------------
69 * OFF | ON OFF | ON | FCE 0
70 * OFF | ON OFF | OFF | FCE 1
74 * SMSC 9220
76 * SW1 SMSC 9220
77 * -----------------------
78 * ON access disable
79 * OFF access enable
83 * KEYSC
85 * SW43 KEYSC
86 * -------------------------
87 * ON enable
88 * OFF disable
91 /* MTD */
92 static struct mtd_partition nor_flash_partitions[] = {
94 .name = "loader",
95 .offset = 0x00000000,
96 .size = 512 * 1024,
99 .name = "bootenv",
100 .offset = MTDPART_OFS_APPEND,
101 .size = 512 * 1024,
104 .name = "kernel_ro",
105 .offset = MTDPART_OFS_APPEND,
106 .size = 8 * 1024 * 1024,
107 .mask_flags = MTD_WRITEABLE,
110 .name = "kernel",
111 .offset = MTDPART_OFS_APPEND,
112 .size = 8 * 1024 * 1024,
115 .name = "data",
116 .offset = MTDPART_OFS_APPEND,
117 .size = MTDPART_SIZ_FULL,
121 static struct physmap_flash_data nor_flash_data = {
122 .width = 2,
123 .parts = nor_flash_partitions,
124 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
127 static struct resource nor_flash_resources[] = {
128 [0] = {
129 .start = 0x00000000,
130 .end = 0x08000000 - 1,
131 .flags = IORESOURCE_MEM,
135 static struct platform_device nor_flash_device = {
136 .name = "physmap-flash",
137 .dev = {
138 .platform_data = &nor_flash_data,
140 .num_resources = ARRAY_SIZE(nor_flash_resources),
141 .resource = nor_flash_resources,
144 /* SMSC 9220 */
145 static struct resource smc911x_resources[] = {
147 .start = 0x14000000,
148 .end = 0x16000000 - 1,
149 .flags = IORESOURCE_MEM,
150 }, {
151 .start = 6,
152 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
156 static struct smsc911x_platform_config smsc911x_info = {
157 .flags = SMSC911X_USE_16BIT | SMSC911X_SAVE_MAC_ADDRESS,
158 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
159 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
162 static struct platform_device smc911x_device = {
163 .name = "smsc911x",
164 .id = -1,
165 .num_resources = ARRAY_SIZE(smc911x_resources),
166 .resource = smc911x_resources,
167 .dev = {
168 .platform_data = &smsc911x_info,
172 /* KEYSC (Needs SW43 set to ON) */
173 static struct sh_keysc_info keysc_info = {
174 .mode = SH_KEYSC_MODE_1,
175 .scan_timing = 3,
176 .delay = 2500,
177 .keycodes = {
178 KEY_0, KEY_1, KEY_2, KEY_3, KEY_4,
179 KEY_5, KEY_6, KEY_7, KEY_8, KEY_9,
180 KEY_A, KEY_B, KEY_C, KEY_D, KEY_E,
181 KEY_F, KEY_G, KEY_H, KEY_I, KEY_J,
182 KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
186 static struct resource keysc_resources[] = {
187 [0] = {
188 .name = "KEYSC",
189 .start = 0xe61b0000,
190 .end = 0xe61b0063,
191 .flags = IORESOURCE_MEM,
193 [1] = {
194 .start = 79,
195 .flags = IORESOURCE_IRQ,
199 static struct platform_device keysc_device = {
200 .name = "sh_keysc",
201 .id = 0, /* "keysc0" clock */
202 .num_resources = ARRAY_SIZE(keysc_resources),
203 .resource = keysc_resources,
204 .dev = {
205 .platform_data = &keysc_info,
209 /* SDHI0 */
210 static struct resource sdhi0_resources[] = {
211 [0] = {
212 .name = "SDHI0",
213 .start = 0xe6850000,
214 .end = 0xe68501ff,
215 .flags = IORESOURCE_MEM,
217 [1] = {
218 .start = 96,
219 .flags = IORESOURCE_IRQ,
223 static struct platform_device sdhi0_device = {
224 .name = "sh_mobile_sdhi",
225 .num_resources = ARRAY_SIZE(sdhi0_resources),
226 .resource = sdhi0_resources,
227 .id = 0,
230 static struct platform_device *ap4evb_devices[] __initdata = {
231 &nor_flash_device,
232 &smc911x_device,
233 &keysc_device,
234 &sdhi0_device,
237 static struct map_desc ap4evb_io_desc[] __initdata = {
238 /* create a 1:1 entity map for 0xe6xxxxxx
239 * used by CPGA, INTC and PFC.
242 .virtual = 0xe6000000,
243 .pfn = __phys_to_pfn(0xe6000000),
244 .length = 256 << 20,
245 .type = MT_DEVICE_NONSHARED
249 static void __init ap4evb_map_io(void)
251 iotable_init(ap4evb_io_desc, ARRAY_SIZE(ap4evb_io_desc));
253 /* setup early devices, clocks and console here as well */
254 sh7372_add_early_devices();
255 sh7367_clock_init(); /* use g3 clocks for now */
256 shmobile_setup_console();
259 static void __init ap4evb_init(void)
261 sh7372_pinmux_init();
263 /* enable SCIFA0 */
264 gpio_request(GPIO_FN_SCIFA0_TXD, NULL);
265 gpio_request(GPIO_FN_SCIFA0_RXD, NULL);
267 /* enable SMSC911X */
268 gpio_request(GPIO_FN_CS5A, NULL);
269 gpio_request(GPIO_FN_IRQ6_39, NULL);
271 /* enable LED 1 - 4 */
272 gpio_request(GPIO_PORT185, NULL);
273 gpio_request(GPIO_PORT186, NULL);
274 gpio_request(GPIO_PORT187, NULL);
275 gpio_request(GPIO_PORT188, NULL);
276 gpio_direction_output(GPIO_PORT185, 1);
277 gpio_direction_output(GPIO_PORT186, 1);
278 gpio_direction_output(GPIO_PORT187, 1);
279 gpio_direction_output(GPIO_PORT188, 1);
280 gpio_export(GPIO_PORT185, 0);
281 gpio_export(GPIO_PORT186, 0);
282 gpio_export(GPIO_PORT187, 0);
283 gpio_export(GPIO_PORT188, 0);
285 /* enable Debug switch (S6) */
286 gpio_request(GPIO_PORT32, NULL);
287 gpio_request(GPIO_PORT33, NULL);
288 gpio_request(GPIO_PORT34, NULL);
289 gpio_request(GPIO_PORT35, NULL);
290 gpio_direction_input(GPIO_PORT32);
291 gpio_direction_input(GPIO_PORT33);
292 gpio_direction_input(GPIO_PORT34);
293 gpio_direction_input(GPIO_PORT35);
294 gpio_export(GPIO_PORT32, 0);
295 gpio_export(GPIO_PORT33, 0);
296 gpio_export(GPIO_PORT34, 0);
297 gpio_export(GPIO_PORT35, 0);
299 /* enable KEYSC */
300 gpio_request(GPIO_FN_KEYOUT0, NULL);
301 gpio_request(GPIO_FN_KEYOUT1, NULL);
302 gpio_request(GPIO_FN_KEYOUT2, NULL);
303 gpio_request(GPIO_FN_KEYOUT3, NULL);
304 gpio_request(GPIO_FN_KEYOUT4, NULL);
305 gpio_request(GPIO_FN_KEYIN0_136, NULL);
306 gpio_request(GPIO_FN_KEYIN1_135, NULL);
307 gpio_request(GPIO_FN_KEYIN2_134, NULL);
308 gpio_request(GPIO_FN_KEYIN3_133, NULL);
309 gpio_request(GPIO_FN_KEYIN4, NULL);
311 /* SDHI0 */
312 gpio_request(GPIO_FN_SDHICD0, NULL);
313 gpio_request(GPIO_FN_SDHIWP0, NULL);
314 gpio_request(GPIO_FN_SDHICMD0, NULL);
315 gpio_request(GPIO_FN_SDHICLK0, NULL);
316 gpio_request(GPIO_FN_SDHID0_3, NULL);
317 gpio_request(GPIO_FN_SDHID0_2, NULL);
318 gpio_request(GPIO_FN_SDHID0_1, NULL);
319 gpio_request(GPIO_FN_SDHID0_0, NULL);
321 sh7372_add_standard_devices();
323 platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));
326 MACHINE_START(AP4EVB, "ap4evb")
327 .phys_io = 0xe6000000,
328 .io_pg_offst = ((0xe6000000) >> 18) & 0xfffc,
329 .map_io = ap4evb_map_io,
330 .init_irq = sh7372_init_irq,
331 .init_machine = ap4evb_init,
332 .timer = &shmobile_timer,
333 MACHINE_END