2 * Maxtor Shared Storage II Board Setup
4 * Maintainer: Sylver Bruneau <sylver.bruneau@googlemail.com>
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.
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 <mach/orion5x.h>
29 #include <mach/bridge-regs.h>
33 #define MSS2_NOR_BOOT_BASE 0xff800000
34 #define MSS2_NOR_BOOT_SIZE SZ_256K
36 /*****************************************************************************
37 * Maxtor Shared Storage II Info
38 ****************************************************************************/
41 * Maxtor Shared Storage II hardware :
42 * - Marvell 88F5182-A2 C500
43 * - Marvell 88E1111 Gigabit Ethernet PHY
44 * - RTC M41T81 (@0x68) on I2C bus
49 /*****************************************************************************
50 * 256KB NOR Flash on BOOT Device
51 ****************************************************************************/
53 static struct physmap_flash_data mss2_nor_flash_data
= {
57 static struct resource mss2_nor_flash_resource
= {
58 .flags
= IORESOURCE_MEM
,
59 .start
= MSS2_NOR_BOOT_BASE
,
60 .end
= MSS2_NOR_BOOT_BASE
+ MSS2_NOR_BOOT_SIZE
- 1,
63 static struct platform_device mss2_nor_flash
= {
64 .name
= "physmap-flash",
67 .platform_data
= &mss2_nor_flash_data
,
69 .resource
= &mss2_nor_flash_resource
,
73 /****************************************************************************
75 ****************************************************************************/
76 static int __init
mss2_pci_map_irq(const struct pci_dev
*dev
, u8 slot
, u8 pin
)
81 * Check for devices with hard-wired IRQs.
83 irq
= orion5x_pci_map_irq(dev
, slot
, pin
);
90 static struct hw_pci mss2_pci __initdata
= {
92 .setup
= orion5x_pci_sys_setup
,
93 .scan
= orion5x_pci_sys_scan_bus
,
94 .map_irq
= mss2_pci_map_irq
,
97 static int __init
mss2_pci_init(void)
99 if (machine_is_mss2())
100 pci_common_init(&mss2_pci
);
104 subsys_initcall(mss2_pci_init
);
107 /*****************************************************************************
109 ****************************************************************************/
111 static struct mv643xx_eth_platform_data mss2_eth_data
= {
112 .phy_addr
= MV643XX_ETH_PHY_ADDR(8),
115 /*****************************************************************************
117 ****************************************************************************/
119 static struct mv_sata_platform_data mss2_sata_data
= {
123 /*****************************************************************************
125 ****************************************************************************/
127 #define MSS2_GPIO_KEY_RESET 12
128 #define MSS2_GPIO_KEY_POWER 11
130 static struct gpio_keys_button mss2_buttons
[] = {
133 .gpio
= MSS2_GPIO_KEY_POWER
,
138 .gpio
= MSS2_GPIO_KEY_RESET
,
144 static struct gpio_keys_platform_data mss2_button_data
= {
145 .buttons
= mss2_buttons
,
146 .nbuttons
= ARRAY_SIZE(mss2_buttons
),
149 static struct platform_device mss2_button_device
= {
153 .platform_data
= &mss2_button_data
,
157 /*****************************************************************************
158 * RTC m41t81 on I2C bus
159 ****************************************************************************/
161 #define MSS2_GPIO_RTC_IRQ 3
163 static struct i2c_board_info __initdata mss2_i2c_rtc
= {
164 I2C_BOARD_INFO("m41t81", 0x68),
167 /*****************************************************************************
168 * MSS2 power off method
169 ****************************************************************************/
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"
176 static void mss2_power_off(void)
181 * Enable and issue soft reset
183 reg
= readl(RSTOUTn_MASK
);
185 writel(reg
, RSTOUTn_MASK
);
187 reg
= readl(CPU_SOFT_RESET
);
189 writel(reg
, CPU_SOFT_RESET
);
192 /****************************************************************************
194 ****************************************************************************/
195 static unsigned int mss2_mpp_modes
[] __initdata
= {
196 MPP0_GPIO
, /* Power LED */
197 MPP1_GPIO
, /* Error LED */
199 MPP3_GPIO
, /* RTC interrupt */
200 MPP4_GPIO
, /* HDD ind. (Single/Dual)*/
201 MPP5_GPIO
, /* HD0 5V control */
202 MPP6_GPIO
, /* HD0 12V control */
203 MPP7_GPIO
, /* HD1 5V control */
204 MPP8_GPIO
, /* HD1 12V control */
206 MPP10_GPIO
, /* Fan control */
207 MPP11_GPIO
, /* Power button */
208 MPP12_GPIO
, /* Reset button */
210 MPP14_SATA_LED
, /* SATA 0 active */
211 MPP15_SATA_LED
, /* SATA 1 active */
219 static void __init
mss2_init(void)
221 /* Setup basic Orion functions. Need to be called early. */
224 orion5x_mpp_conf(mss2_mpp_modes
);
229 * MPP[22] USB 0 over current
230 * MPP[23] USB 1 over current
234 * Configure peripherals.
236 orion5x_ehci0_init();
237 orion5x_ehci1_init();
238 orion5x_eth_init(&mss2_eth_data
);
240 orion5x_sata_init(&mss2_sata_data
);
241 orion5x_uart0_init();
244 mvebu_mbus_add_window("devbus-boot", MSS2_NOR_BOOT_BASE
,
246 platform_device_register(&mss2_nor_flash
);
248 platform_device_register(&mss2_button_device
);
250 if (gpio_request(MSS2_GPIO_RTC_IRQ
, "rtc") == 0) {
251 if (gpio_direction_input(MSS2_GPIO_RTC_IRQ
) == 0)
252 mss2_i2c_rtc
.irq
= gpio_to_irq(MSS2_GPIO_RTC_IRQ
);
254 gpio_free(MSS2_GPIO_RTC_IRQ
);
256 i2c_register_board_info(0, &mss2_i2c_rtc
, 1);
258 /* register mss2 specific power-off method */
259 pm_power_off
= mss2_power_off
;
262 MACHINE_START(MSS2
, "Maxtor Shared Storage II")
263 /* Maintainer: Sylver Bruneau <sylver.bruneau@googlemail.com> */
264 .atag_offset
= 0x100,
265 .init_machine
= mss2_init
,
266 .map_io
= orion5x_map_io
,
267 .init_early
= orion5x_init_early
,
268 .init_irq
= orion5x_init_irq
,
269 .init_time
= orion5x_timer_init
,
270 .fixup
= tag_fixup_mem32
,
271 .restart
= orion5x_restart
,