1 From: Martin Michlmayr <tbm@cyrius.com>
3 Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
5 arch/arm/mach-orion5x/Kconfig | 6 +
6 arch/arm/mach-orion5x/Makefile | 1 +
7 arch/arm/mach-orion5x/mv2120-setup.c | 228 ++++++++++++++++++++++++++++++++++
8 3 files changed, 235 insertions(+), 0 deletions(-)
9 create mode 100644 arch/arm/mach-orion5x/mv2120-setup.c
11 --- a/arch/arm/mach-orion5x/Kconfig
12 +++ b/arch/arm/mach-orion5x/Kconfig
14 Say 'Y' here if you want your kernel to support the
15 Linksys WRT350N v2 platform.
18 + bool "HP Media Vault mv2120"
20 + Say 'Y' here if you want your kernel to support the
21 + HP Media Vault mv2120 or mv5100.
26 --- a/arch/arm/mach-orion5x/Makefile
27 +++ b/arch/arm/mach-orion5x/Makefile
29 obj-$(CONFIG_MACH_TS209) += ts209-setup.o
30 obj-$(CONFIG_MACH_TS409) += ts409-setup.o
31 obj-$(CONFIG_MACH_WRT350N_V2) += wrt350n-v2-setup.o
32 +obj-$(CONFIG_MACH_MV2120) += mv2120-setup.o
34 +++ b/arch/arm/mach-orion5x/mv2120-setup.c
37 + * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org>
38 + * Copyright (C) 2008 Martin Michlmayr <tbm@cyrius.com>
40 + * This program is free software; you can redistribute it and/or modify
41 + * it under the terms of the GNU Lesser General Public License as
42 + * published by the Free Software Foundation; either version 2 of the
43 + * License, or (at your option) any later version.
46 +#include <linux/kernel.h>
47 +#include <linux/init.h>
48 +#include <linux/platform_device.h>
49 +#include <linux/pci.h>
50 +#include <linux/irq.h>
51 +#include <linux/mtd/physmap.h>
52 +#include <linux/mv643xx_eth.h>
53 +#include <linux/leds.h>
54 +#include <linux/gpio_keys.h>
55 +#include <linux/input.h>
56 +#include <linux/i2c.h>
57 +#include <linux/ata_platform.h>
58 +#include <asm/mach-types.h>
59 +#include <asm/gpio.h>
60 +#include <asm/mach/arch.h>
61 +#include <asm/mach/pci.h>
62 +#include <asm/arch/orion5x.h>
66 +#define MV2120_NOR_BOOT_BASE 0xf4000000
67 +#define MV2120_NOR_BOOT_SIZE SZ_512K
69 +#define MV2120_GPIO_RTC_IRQ 3
70 +#define MV2120_GPIO_KEY_RESET 17
71 +#define MV2120_GPIO_KEY_POWER 18
72 +#define MV2120_GPIO_POWER_OFF 19
75 +/****************************************************************************
77 + ****************************************************************************/
78 +static int __init mv2120_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
83 + * Check for devices with hard-wired IRQs.
85 + irq = orion5x_pci_map_irq(dev, slot, pin);
89 + pr_err("%s: requested mapping for unknown bus\n", __func__);
94 +static struct hw_pci mv2120_pci __initdata = {
95 + .nr_controllers = 2,
96 + .swizzle = pci_std_swizzle,
97 + .setup = orion5x_pci_sys_setup,
98 + .scan = orion5x_pci_sys_scan_bus,
99 + .map_irq = mv2120_pci_map_irq,
102 +static int __init mv2120_pci_init(void)
104 + if (machine_is_mv2120())
105 + pci_common_init(&mv2120_pci);
109 +subsys_initcall(mv2120_pci_init);
112 +/*****************************************************************************
114 + ****************************************************************************/
115 +static struct mv643xx_eth_platform_data mv2120_eth_data = {
119 +static struct mv_sata_platform_data mv2120_sata_data = {
123 +static struct mtd_partition mv2120_partitions[] = {
125 + .name = "firmware",
126 + .size = 0x00080000,
131 +static struct physmap_flash_data mv2120_nor_flash_data = {
133 + .parts = mv2120_partitions,
134 + .nr_parts = ARRAY_SIZE(mv2120_partitions)
137 +static struct resource mv2120_nor_flash_resource = {
138 + .flags = IORESOURCE_MEM,
139 + .start = MV2120_NOR_BOOT_BASE,
140 + .end = MV2120_NOR_BOOT_BASE + MV2120_NOR_BOOT_SIZE - 1,
143 +static struct platform_device mv2120_nor_flash = {
144 + .name = "physmap-flash",
147 + .platform_data = &mv2120_nor_flash_data,
149 + .resource = &mv2120_nor_flash_resource,
150 + .num_resources = 1,
153 +static struct gpio_keys_button mv2120_buttons[] = {
155 + .code = KEY_RESTART,
156 + .gpio = MV2120_GPIO_KEY_RESET,
157 + .desc = "Reset Button",
161 + .gpio = MV2120_GPIO_KEY_POWER,
162 + .desc = "Power Button",
167 +static struct gpio_keys_platform_data mv2120_button_data = {
168 + .buttons = mv2120_buttons,
169 + .nbuttons = ARRAY_SIZE(mv2120_buttons),
172 +static struct platform_device mv2120_button_device = {
173 + .name = "gpio-keys",
175 + .num_resources = 0,
177 + .platform_data = &mv2120_button_data,
182 +/****************************************************************************
184 + ****************************************************************************/
185 +static struct i2c_board_info __initdata mv2120_i2c_rtc = {
186 + I2C_BOARD_INFO("rtc-pcf8563", 0x51),
190 +static void mv2120_power_off(void)
192 + pr_info("%s: triggering power-off...\n", __func__);
193 + gpio_set_value(MV2120_GPIO_POWER_OFF, 0);
196 +static void __init mv2120_init(void)
198 + /* Setup basic Orion functions. Need to be called early. */
201 + orion5x_mpp_conf(0, MPP_GPIO); /* Sys status LED */
202 + orion5x_mpp_conf(1, MPP_GPIO); /* Sys error LED */
203 + orion5x_mpp_conf(2, MPP_GPIO); /* OverTemp interrupt */
204 + orion5x_mpp_conf(3, MPP_GPIO); /* RTC interrupt */
205 + orion5x_mpp_conf(4, MPP_GPIO); /* V_LED 5V */
206 + orion5x_mpp_conf(5, MPP_GPIO); /* V_LED 3.3V */
207 + orion5x_mpp_conf(6, MPP_UNUSED);
208 + orion5x_mpp_conf(7, MPP_UNUSED);
209 + orion5x_mpp_conf(8, MPP_GPIO); /* SATA 0 fail LED */
210 + orion5x_mpp_conf(9, MPP_GPIO); /* SATA 1 fail LED */
211 + orion5x_mpp_conf(10, MPP_UNUSED);
212 + orion5x_mpp_conf(11, MPP_UNUSED);
213 + orion5x_mpp_conf(12, MPP_SATA_LED); /* SATA 0 presence */
214 + orion5x_mpp_conf(13, MPP_SATA_LED); /* SATA 1 presence */
215 + orion5x_mpp_conf(14, MPP_SATA_LED); /* SATA 0 active */
216 + orion5x_mpp_conf(15, MPP_SATA_LED); /* SATA 1 active */
217 + orion5x_mpp_conf(16, MPP_UNUSED);
218 + orion5x_mpp_conf(17, MPP_GPIO); /* Reset button */
219 + orion5x_mpp_conf(18, MPP_GPIO); /* Power button */
220 + orion5x_mpp_conf(19, MPP_GPIO); /* Power off */
223 + * Configure peripherals.
225 + orion5x_ehci0_init();
226 + orion5x_ehci1_init();
227 + orion5x_eth_init(&mv2120_eth_data);
228 + orion5x_i2c_init();
229 + orion5x_sata_init(&mv2120_sata_data);
230 + orion5x_uart0_init();
232 + orion5x_setup_dev_boot_win(MV2120_NOR_BOOT_BASE, MV2120_NOR_BOOT_SIZE);
233 + platform_device_register(&mv2120_nor_flash);
235 + platform_device_register(&mv2120_button_device);
237 + if (gpio_request(MV2120_GPIO_RTC_IRQ, "rtc") == 0) {
238 + if (gpio_direction_input(MV2120_GPIO_RTC_IRQ) == 0)
239 + mv2120_i2c_rtc.irq = gpio_to_irq(MV2120_GPIO_RTC_IRQ);
241 + gpio_free(MV2120_GPIO_RTC_IRQ);
243 + i2c_register_board_info(0, &mv2120_i2c_rtc, 1);
245 + /* register mv2120 specific power-off method */
246 + if (gpio_request(MV2120_GPIO_POWER_OFF, "POWEROFF") != 0 ||
247 + gpio_direction_output(MV2120_GPIO_POWER_OFF, 1) != 0)
248 + pr_err("mv2120: failed to setup power-off GPIO\n");
249 + pm_power_off = mv2120_power_off;
252 +/* Warning: HP uses a wrong mach-type (=526) in their bootloader */
253 +MACHINE_START(MV2120, "HP Media Vault mv2120")
254 + /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
255 + .phys_io = ORION5X_REGS_PHYS_BASE,
256 + .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
257 + .boot_params = 0x00000100,
258 + .init_machine = mv2120_init,
259 + .map_io = orion5x_map_io,
260 + .init_irq = orion5x_init_irq,
261 + .timer = &orion5x_timer,
262 + .fixup = tag_fixup_mem32