diff options
author | Sylver Bruneau <sylver.bruneau@googlemail.com> | 2008-06-09 19:00:38 -0400 |
---|---|---|
committer | Lennert Buytenhek <buytenh@marvell.com> | 2008-06-22 16:44:55 -0400 |
commit | 7ec753ccc10ad552c8ec2d40e0edbe3a9c562f30 (patch) | |
tree | b66cd2024a0ea7d3d300484853743697520e32a3 /arch/arm/mach-orion5x/mss2-setup.c | |
parent | 7171d8672bb0bcb744935bd2c6108378b5c6c6ad (diff) |
[ARM] Orion: add Maxtor Shared Storage II support
This patch adds support for the Maxtor Shared Storage II hardware.
Signed-off-by: Sylver Bruneau <sylver.bruneau@googlemail.com>
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Diffstat (limited to 'arch/arm/mach-orion5x/mss2-setup.c')
-rw-r--r-- | arch/arm/mach-orion5x/mss2-setup.c | 270 |
1 files changed, 270 insertions, 0 deletions
diff --git a/arch/arm/mach-orion5x/mss2-setup.c b/arch/arm/mach-orion5x/mss2-setup.c new file mode 100644 index 000000000000..7ce9e407d9d1 --- /dev/null +++ b/arch/arm/mach-orion5x/mss2-setup.c | |||
@@ -0,0 +1,270 @@ | |||
1 | /* | ||
2 | * Maxtor Shared Storage II Board Setup | ||
3 | * | ||
4 | * Maintainer: Sylver Bruneau <sylver.bruneau@googlemail.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/pci.h> | ||
16 | #include <linux/irq.h> | ||
17 | #include <linux/mtd/physmap.h> | ||
18 | #include <linux/mv643xx_eth.h> | ||
19 | #include <linux/leds.h> | ||
20 | #include <linux/gpio_keys.h> | ||
21 | #include <linux/input.h> | ||
22 | #include <linux/i2c.h> | ||
23 | #include <linux/ata_platform.h> | ||
24 | #include <linux/gpio.h> | ||
25 | #include <asm/mach-types.h> | ||
26 | #include <asm/mach/arch.h> | ||
27 | #include <asm/mach/pci.h> | ||
28 | #include <asm/arch/orion5x.h> | ||
29 | #include "common.h" | ||
30 | #include "mpp.h" | ||
31 | |||
32 | #define MSS2_NOR_BOOT_BASE 0xff800000 | ||
33 | #define MSS2_NOR_BOOT_SIZE SZ_256K | ||
34 | |||
35 | /***************************************************************************** | ||
36 | * Maxtor Shared Storage II Info | ||
37 | ****************************************************************************/ | ||
38 | |||
39 | /* | ||
40 | * Maxtor Shared Storage II hardware : | ||
41 | * - Marvell 88F5182-A2 C500 | ||
42 | * - Marvell 88E1111 Gigabit Ethernet PHY | ||
43 | * - RTC M41T81 (@0x68) on I2C bus | ||
44 | * - 256KB NOR flash | ||
45 | * - 64MB of RAM | ||
46 | */ | ||
47 | |||
48 | /***************************************************************************** | ||
49 | * 256KB NOR Flash on BOOT Device | ||
50 | ****************************************************************************/ | ||
51 | |||
52 | static struct physmap_flash_data mss2_nor_flash_data = { | ||
53 | .width = 1, | ||
54 | }; | ||
55 | |||
56 | static struct resource mss2_nor_flash_resource = { | ||
57 | .flags = IORESOURCE_MEM, | ||
58 | .start = MSS2_NOR_BOOT_BASE, | ||
59 | .end = MSS2_NOR_BOOT_BASE + MSS2_NOR_BOOT_SIZE - 1, | ||
60 | }; | ||
61 | |||
62 | static struct platform_device mss2_nor_flash = { | ||
63 | .name = "physmap-flash", | ||
64 | .id = 0, | ||
65 | .dev = { | ||
66 | .platform_data = &mss2_nor_flash_data, | ||
67 | }, | ||
68 | .resource = &mss2_nor_flash_resource, | ||
69 | .num_resources = 1, | ||
70 | }; | ||
71 | |||
72 | /**************************************************************************** | ||
73 | * PCI setup | ||
74 | ****************************************************************************/ | ||
75 | static int __init mss2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | ||
76 | { | ||
77 | int irq; | ||
78 | |||
79 | /* | ||
80 | * Check for devices with hard-wired IRQs. | ||
81 | */ | ||
82 | irq = orion5x_pci_map_irq(dev, slot, pin); | ||
83 | if (irq != -1) | ||
84 | return irq; | ||
85 | |||
86 | return -1; | ||
87 | } | ||
88 | |||
89 | static struct hw_pci mss2_pci __initdata = { | ||
90 | .nr_controllers = 2, | ||
91 | .swizzle = pci_std_swizzle, | ||
92 | .setup = orion5x_pci_sys_setup, | ||
93 | .scan = orion5x_pci_sys_scan_bus, | ||
94 | .map_irq = mss2_pci_map_irq, | ||
95 | }; | ||
96 | |||
97 | static int __init mss2_pci_init(void) | ||
98 | { | ||
99 | if (machine_is_mss2()) | ||
100 | pci_common_init(&mss2_pci); | ||
101 | |||
102 | return 0; | ||
103 | } | ||
104 | subsys_initcall(mss2_pci_init); | ||
105 | |||
106 | |||
107 | /***************************************************************************** | ||
108 | * Ethernet | ||
109 | ****************************************************************************/ | ||
110 | |||
111 | static struct mv643xx_eth_platform_data mss2_eth_data = { | ||
112 | .phy_addr = 8, | ||
113 | }; | ||
114 | |||
115 | /***************************************************************************** | ||
116 | * SATA | ||
117 | ****************************************************************************/ | ||
118 | |||
119 | static struct mv_sata_platform_data mss2_sata_data = { | ||
120 | .n_ports = 2, | ||
121 | }; | ||
122 | |||
123 | /***************************************************************************** | ||
124 | * GPIO buttons | ||
125 | ****************************************************************************/ | ||
126 | |||
127 | #define MSS2_GPIO_KEY_RESET 12 | ||
128 | #define MSS2_GPIO_KEY_POWER 11 | ||
129 | |||
130 | static struct gpio_keys_button mss2_buttons[] = { | ||
131 | { | ||
132 | .code = KEY_POWER, | ||
133 | .gpio = MSS2_GPIO_KEY_POWER, | ||
134 | .desc = "Power", | ||
135 | .active_low = 1, | ||
136 | }, { | ||
137 | .code = KEY_RESTART, | ||
138 | .gpio = MSS2_GPIO_KEY_RESET, | ||
139 | .desc = "Reset", | ||
140 | .active_low = 1, | ||
141 | }, | ||
142 | }; | ||
143 | |||
144 | static struct gpio_keys_platform_data mss2_button_data = { | ||
145 | .buttons = mss2_buttons, | ||
146 | .nbuttons = ARRAY_SIZE(mss2_buttons), | ||
147 | }; | ||
148 | |||
149 | static struct platform_device mss2_button_device = { | ||
150 | .name = "gpio-keys", | ||
151 | .id = -1, | ||
152 | .dev = { | ||
153 | .platform_data = &mss2_button_data, | ||
154 | }, | ||
155 | }; | ||
156 | |||
157 | /***************************************************************************** | ||
158 | * RTC m41t81 on I2C bus | ||
159 | ****************************************************************************/ | ||
160 | |||
161 | #define MSS2_GPIO_RTC_IRQ 3 | ||
162 | |||
163 | static struct i2c_board_info __initdata mss2_i2c_rtc = { | ||
164 | I2C_BOARD_INFO("m41t81", 0x68), | ||
165 | }; | ||
166 | |||
167 | /***************************************************************************** | ||
168 | * MSS2 power off method | ||
169 | ****************************************************************************/ | ||
170 | /* | ||
171 | * On the Maxtor Shared Storage II, the shutdown process is the following : | ||
172 | * - Userland modifies U-boot env to tell U-boot to go idle at next boot | ||
173 | * - The board reboots | ||
174 | * - U-boot starts and go into an idle mode until the user press "power" | ||
175 | */ | ||
176 | static void mss2_power_off(void) | ||
177 | { | ||
178 | u32 reg; | ||
179 | |||
180 | /* | ||
181 | * Enable and issue soft reset | ||
182 | */ | ||
183 | reg = readl(CPU_RESET_MASK); | ||
184 | reg |= 1 << 2; | ||
185 | writel(reg, CPU_RESET_MASK); | ||
186 | |||
187 | reg = readl(CPU_SOFT_RESET); | ||
188 | reg |= 1; | ||
189 | writel(reg, CPU_SOFT_RESET); | ||
190 | } | ||
191 | |||
192 | /**************************************************************************** | ||
193 | * General Setup | ||
194 | ****************************************************************************/ | ||
195 | static struct orion5x_mpp_mode mss2_mpp_modes[] __initdata = { | ||
196 | { 0, MPP_GPIO }, /* Power LED */ | ||
197 | { 1, MPP_GPIO }, /* Error LED */ | ||
198 | { 2, MPP_UNUSED }, | ||
199 | { 3, MPP_GPIO }, /* RTC interrupt */ | ||
200 | { 4, MPP_GPIO }, /* HDD ind. (Single/Dual)*/ | ||
201 | { 5, MPP_GPIO }, /* HD0 5V control */ | ||
202 | { 6, MPP_GPIO }, /* HD0 12V control */ | ||
203 | { 7, MPP_GPIO }, /* HD1 5V control */ | ||
204 | { 8, MPP_GPIO }, /* HD1 12V control */ | ||
205 | { 9, MPP_UNUSED }, | ||
206 | { 10, MPP_GPIO }, /* Fan control */ | ||
207 | { 11, MPP_GPIO }, /* Power button */ | ||
208 | { 12, MPP_GPIO }, /* Reset button */ | ||
209 | { 13, MPP_UNUSED }, | ||
210 | { 14, MPP_SATA_LED }, /* SATA 0 active */ | ||
211 | { 15, MPP_SATA_LED }, /* SATA 1 active */ | ||
212 | { 16, MPP_UNUSED }, | ||
213 | { 17, MPP_UNUSED }, | ||
214 | { 18, MPP_UNUSED }, | ||
215 | { 19, MPP_UNUSED }, | ||
216 | { -1 }, | ||
217 | }; | ||
218 | |||
219 | static void __init mss2_init(void) | ||
220 | { | ||
221 | /* Setup basic Orion functions. Need to be called early. */ | ||
222 | orion5x_init(); | ||
223 | |||
224 | orion5x_mpp_conf(mss2_mpp_modes); | ||
225 | |||
226 | /* | ||
227 | * MPP[20] Unused | ||
228 | * MPP[21] PCI clock | ||
229 | * MPP[22] USB 0 over current | ||
230 | * MPP[23] USB 1 over current | ||
231 | */ | ||
232 | |||
233 | /* | ||
234 | * Configure peripherals. | ||
235 | */ | ||
236 | orion5x_ehci0_init(); | ||
237 | orion5x_ehci1_init(); | ||
238 | orion5x_eth_init(&mss2_eth_data); | ||
239 | orion5x_i2c_init(); | ||
240 | orion5x_sata_init(&mss2_sata_data); | ||
241 | orion5x_uart0_init(); | ||
242 | |||
243 | orion5x_setup_dev_boot_win(MSS2_NOR_BOOT_BASE, MSS2_NOR_BOOT_SIZE); | ||
244 | platform_device_register(&mss2_nor_flash); | ||
245 | |||
246 | platform_device_register(&mss2_button_device); | ||
247 | |||
248 | if (gpio_request(MSS2_GPIO_RTC_IRQ, "rtc") == 0) { | ||
249 | if (gpio_direction_input(MSS2_GPIO_RTC_IRQ) == 0) | ||
250 | mss2_i2c_rtc.irq = gpio_to_irq(MSS2_GPIO_RTC_IRQ); | ||
251 | else | ||
252 | gpio_free(MSS2_GPIO_RTC_IRQ); | ||
253 | } | ||
254 | i2c_register_board_info(0, &mss2_i2c_rtc, 1); | ||
255 | |||
256 | /* register mss2 specific power-off method */ | ||
257 | pm_power_off = mss2_power_off; | ||
258 | } | ||
259 | |||
260 | MACHINE_START(MSS2, "Maxtor Shared Storage II") | ||
261 | /* Maintainer: Sylver Bruneau <sylver.bruneau@googlemail.com> */ | ||
262 | .phys_io = ORION5X_REGS_PHYS_BASE, | ||
263 | .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC, | ||
264 | .boot_params = 0x00000100, | ||
265 | .init_machine = mss2_init, | ||
266 | .map_io = orion5x_map_io, | ||
267 | .init_irq = orion5x_init_irq, | ||
268 | .timer = &orion5x_timer, | ||
269 | .fixup = tag_fixup_mem32 | ||
270 | MACHINE_END | ||