]>
Commit | Line | Data |
---|---|---|
70f784ec MD |
1 | /* |
2 | * Renesas System Solutions Asia Pte. Ltd - Migo-R | |
3 | * | |
4 | * Copyright (C) 2008 Magnus Damm | |
5 | * | |
6 | * This file is subject to the terms and conditions of the GNU General Public | |
7 | * License. See the file "COPYING" in the main directory of this archive | |
8 | * for more details. | |
9 | */ | |
10 | #include <linux/init.h> | |
11 | #include <linux/platform_device.h> | |
12 | #include <linux/interrupt.h> | |
92cfeb61 | 13 | #include <linux/input.h> |
70f784ec MD |
14 | #include <asm/machvec.h> |
15 | #include <asm/io.h> | |
92cfeb61 | 16 | #include <asm/sh_keysc.h> |
9db913c3 | 17 | #include <asm/migor.h> |
70f784ec MD |
18 | |
19 | /* Address IRQ Size Bus Description | |
20 | * 0x00000000 64MB 16 NOR Flash (SP29PL256N) | |
21 | * 0x0c000000 64MB 64 SDRAM (2xK4M563233G) | |
22 | * 0x10000000 IRQ0 16 Ethernet (SMC91C111) | |
23 | * 0x14000000 IRQ4 16 USB 2.0 Host Controller (M66596) | |
24 | * 0x18000000 8GB 8 NAND Flash (K9K8G08U0A) | |
25 | */ | |
26 | ||
27 | static struct resource smc91x_eth_resources[] = { | |
28 | [0] = { | |
b026a23c MD |
29 | .name = "SMC91C111" , |
30 | .start = 0x10000300, | |
31 | .end = 0x1000030f, | |
70f784ec MD |
32 | .flags = IORESOURCE_MEM, |
33 | }, | |
34 | [1] = { | |
35 | .start = 32, /* IRQ0 */ | |
36 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH, | |
37 | }, | |
38 | }; | |
39 | ||
40 | static struct platform_device smc91x_eth_device = { | |
41 | .name = "smc91x", | |
42 | .num_resources = ARRAY_SIZE(smc91x_eth_resources), | |
43 | .resource = smc91x_eth_resources, | |
44 | }; | |
45 | ||
92cfeb61 MD |
46 | static struct sh_keysc_info sh_keysc_info = { |
47 | .mode = SH_KEYSC_MODE_2, /* KEYOUT0->4, KEYIN1->5 */ | |
48 | .scan_timing = 3, | |
49 | .delay = 5, | |
50 | .keycodes = { | |
51 | 0, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_ENTER, | |
52 | 0, KEY_F, KEY_C, KEY_D, KEY_H, KEY_1, | |
53 | 0, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, | |
54 | 0, KEY_7, KEY_8, KEY_9, KEY_S, KEY_0, | |
55 | 0, KEY_P, KEY_STOP, KEY_REWIND, KEY_PLAY, KEY_FASTFORWARD, | |
56 | }, | |
57 | }; | |
58 | ||
59 | static struct resource sh_keysc_resources[] = { | |
60 | [0] = { | |
61 | .start = 0x044b0000, | |
62 | .end = 0x044b000f, | |
63 | .flags = IORESOURCE_MEM, | |
64 | }, | |
65 | [1] = { | |
66 | .start = 79, | |
67 | .flags = IORESOURCE_IRQ, | |
68 | }, | |
69 | }; | |
70 | ||
71 | static struct platform_device sh_keysc_device = { | |
72 | .name = "sh_keysc", | |
73 | .num_resources = ARRAY_SIZE(sh_keysc_resources), | |
74 | .resource = sh_keysc_resources, | |
75 | .dev = { | |
76 | .platform_data = &sh_keysc_info, | |
77 | }, | |
78 | }; | |
79 | ||
70f784ec MD |
80 | static struct platform_device *migor_devices[] __initdata = { |
81 | &smc91x_eth_device, | |
92cfeb61 | 82 | &sh_keysc_device, |
70f784ec MD |
83 | }; |
84 | ||
85 | static int __init migor_devices_setup(void) | |
86 | { | |
87 | return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices)); | |
88 | } | |
89 | __initcall(migor_devices_setup); | |
90 | ||
91 | static void __init migor_setup(char **cmdline_p) | |
92 | { | |
92cfeb61 MD |
93 | /* SMC91C111 - Enable IRQ0 */ |
94 | ctrl_outw(ctrl_inw(PORT_PJCR) & ~0x0003, PORT_PJCR); | |
95 | ||
96 | /* KEYSC */ | |
97 | ctrl_outw(ctrl_inw(PORT_PYCR) & ~0x0fff, PORT_PYCR); | |
98 | ctrl_outw(ctrl_inw(PORT_PZCR) & ~0x0ff0, PORT_PZCR); | |
99 | ctrl_outw(ctrl_inw(PORT_PSELA) & ~0x4100, PORT_PSELA); | |
100 | ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA); | |
101 | ctrl_outw(ctrl_inw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC); | |
102 | ctrl_outl(ctrl_inl(MSTPCR2) & ~0x00004000, MSTPCR2); | |
70f784ec MD |
103 | } |
104 | ||
105 | static struct sh_machine_vector mv_migor __initmv = { | |
106 | .mv_name = "Migo-R", | |
107 | .mv_setup = migor_setup, | |
108 | }; |