2 * arch/arm/mach-orion5x/edmini_v2-setup.c
4 * LaCie Ethernet Disk mini V2 Setup
6 * Copyright (C) 2008 Christopher Moore <moore@free.fr>
7 * Copyright (C) 2008 Albert Aribaud <albert.aribaud@free.fr>
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
15 * TODO: add Orion USB device port init when kernel.org support is added.
16 * TODO: add flash write support: see below.
17 * TODO: add power-off support.
18 * TODO: add I2C EEPROM support.
21 #include <linux/kernel.h>
22 #include <linux/init.h>
23 #include <linux/platform_device.h>
24 #include <linux/pci.h>
25 #include <linux/irq.h>
26 #include <linux/mtd/physmap.h>
27 #include <linux/mv643xx_eth.h>
28 #include <linux/i2c.h>
29 #include <linux/ata_platform.h>
30 #include <linux/gpio.h>
31 #include <asm/mach-types.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/pci.h>
34 #include <mach/orion5x.h>
38 /*****************************************************************************
40 ****************************************************************************/
43 * 512KB NOR flash Device bus boot chip select
46 #define EDMINI_V2_NOR_BOOT_BASE 0xfff80000
47 #define EDMINI_V2_NOR_BOOT_SIZE SZ_512K
49 /*****************************************************************************
50 * 512KB NOR Flash on BOOT Device
51 ****************************************************************************/
54 * Currently the MTD code does not recognize the MX29LV400CBCT as a bottom
55 * -type device. This could cause risks of accidentally erasing critical
56 * flash sectors. We thus define a single, write-protected partition covering
58 * TODO: once the flash part TOP/BOTTOM detection issue is sorted out in the MTD
59 * code, break this into at least three partitions: 'u-boot code', 'u-boot
60 * environment' and 'whatever is left'.
63 static struct mtd_partition edmini_v2_partitions[] = {
68 .mask_flags = MTD_WRITEABLE,
72 static struct physmap_flash_data edmini_v2_nor_flash_data = {
74 .parts = edmini_v2_partitions,
75 .nr_parts = ARRAY_SIZE(edmini_v2_partitions),
78 static struct resource edmini_v2_nor_flash_resource = {
79 .flags = IORESOURCE_MEM,
80 .start = EDMINI_V2_NOR_BOOT_BASE,
81 .end = EDMINI_V2_NOR_BOOT_BASE
82 + EDMINI_V2_NOR_BOOT_SIZE - 1,
85 static struct platform_device edmini_v2_nor_flash = {
86 .name = "physmap-flash",
89 .platform_data = &edmini_v2_nor_flash_data,
92 .resource = &edmini_v2_nor_flash_resource,
95 /*****************************************************************************
97 ****************************************************************************/
99 static struct mv643xx_eth_platform_data edmini_v2_eth_data = {
103 /*****************************************************************************
104 * RTC 5C372a on I2C bus
105 ****************************************************************************/
107 #define EDMINIV2_RTC_GPIO 3
109 static struct i2c_board_info __initdata edmini_v2_i2c_rtc = {
110 I2C_BOARD_INFO("rs5c372a", 0x32),
114 /*****************************************************************************
116 ****************************************************************************/
118 static struct mv_sata_platform_data edmini_v2_sata_data = {
122 /*****************************************************************************
124 ****************************************************************************/
125 static struct orion5x_mpp_mode edminiv2_mpp_modes[] __initdata = {
129 { 3, MPP_GPIO }, /* RTC interrupt */
138 { 12, MPP_SATA_LED }, /* SATA 0 presence */
139 { 13, MPP_SATA_LED }, /* SATA 1 presence */
140 { 14, MPP_SATA_LED }, /* SATA 0 active */
141 { 15, MPP_SATA_LED }, /* SATA 1 active */
142 /* 16: Power LED control (0 = On, 1 = Off) */
144 /* 17: Power LED control select (0 = CPLD, 1 = GPIO16) */
146 /* 18: Power button status (0 = Released, 1 = Pressed) */
152 static void __init edmini_v2_init(void)
155 * Setup basic Orion functions. Need to be called early.
159 orion5x_mpp_conf(edminiv2_mpp_modes);
162 * Configure peripherals.
164 orion5x_ehci0_init();
165 orion5x_eth_init(&edmini_v2_eth_data);
167 orion5x_sata_init(&edmini_v2_sata_data);
168 orion5x_uart0_init();
170 orion5x_setup_dev_boot_win(EDMINI_V2_NOR_BOOT_BASE,
171 EDMINI_V2_NOR_BOOT_SIZE);
172 platform_device_register(&edmini_v2_nor_flash);
174 pr_notice("edmini_v2: USB device port, flash write and power-off "
175 "are not yet supported.\n");
177 /* Get RTC IRQ and register the chip */
178 if (gpio_request(EDMINIV2_RTC_GPIO, "rtc") == 0) {
179 if (gpio_direction_input(EDMINIV2_RTC_GPIO) == 0)
180 edmini_v2_i2c_rtc.irq = gpio_to_irq(EDMINIV2_RTC_GPIO);
182 gpio_free(EDMINIV2_RTC_GPIO);
185 if (edmini_v2_i2c_rtc.irq == 0)
186 pr_warning("edmini_v2: failed to get RTC IRQ\n");
188 i2c_register_board_info(0, &edmini_v2_i2c_rtc, 1);
191 /* Warning: LaCie use a wrong mach-type (0x20e=526) in their bootloader. */
192 MACHINE_START(EDMINI_V2, "LaCie Ethernet Disk mini V2")
193 /* Maintainer: Christopher Moore <moore@free.fr> */
194 .phys_io = ORION5X_REGS_PHYS_BASE,
195 .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
196 .boot_params = 0x00000100,
197 .init_machine = edmini_v2_init,
198 .map_io = orion5x_map_io,
199 .init_irq = orion5x_init_irq,
200 .timer = &orion5x_timer,
201 .fixup = tag_fixup_mem32,