x86/efi: Enforce CONFIG_RELOCATABLE for EFI boot stub
[linux/fpc-iii.git] / arch / arm / mach-orion5x / edmini_v2-setup.c
blobf66c1b2ee8c1fe8b0f3b6e6eb2c026975bd27bbc
1 /*
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/mbus.h>
27 #include <linux/mtd/physmap.h>
28 #include <linux/leds.h>
29 #include <linux/gpio_keys.h>
30 #include <linux/input.h>
31 #include <linux/i2c.h>
32 #include <linux/ata_platform.h>
33 #include <linux/gpio.h>
34 #include <asm/mach-types.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/pci.h>
37 #include <mach/orion5x.h>
38 #include "common.h"
39 #include "mpp.h"
41 /*****************************************************************************
42 * EDMINI_V2 Info
43 ****************************************************************************/
46 * 512KB NOR flash Device bus boot chip select
49 #define EDMINI_V2_NOR_BOOT_BASE 0xfff80000
50 #define EDMINI_V2_NOR_BOOT_SIZE SZ_512K
52 /*****************************************************************************
53 * 512KB NOR Flash on BOOT Device
54 ****************************************************************************/
57 * Currently the MTD code does not recognize the MX29LV400CBCT as a bottom
58 * -type device. This could cause risks of accidentally erasing critical
59 * flash sectors. We thus define a single, write-protected partition covering
60 * the whole flash.
61 * TODO: once the flash part TOP/BOTTOM detection issue is sorted out in the MTD
62 * code, break this into at least three partitions: 'u-boot code', 'u-boot
63 * environment' and 'whatever is left'.
66 static struct mtd_partition edmini_v2_partitions[] = {
68 .name = "Full512kb",
69 .size = 0x00080000,
70 .offset = 0x00000000,
71 .mask_flags = MTD_WRITEABLE,
75 static struct physmap_flash_data edmini_v2_nor_flash_data = {
76 .width = 1,
77 .parts = edmini_v2_partitions,
78 .nr_parts = ARRAY_SIZE(edmini_v2_partitions),
81 static struct resource edmini_v2_nor_flash_resource = {
82 .flags = IORESOURCE_MEM,
83 .start = EDMINI_V2_NOR_BOOT_BASE,
84 .end = EDMINI_V2_NOR_BOOT_BASE
85 + EDMINI_V2_NOR_BOOT_SIZE - 1,
88 static struct platform_device edmini_v2_nor_flash = {
89 .name = "physmap-flash",
90 .id = 0,
91 .dev = {
92 .platform_data = &edmini_v2_nor_flash_data,
94 .num_resources = 1,
95 .resource = &edmini_v2_nor_flash_resource,
98 /*****************************************************************************
99 * RTC 5C372a on I2C bus
100 ****************************************************************************/
102 #define EDMINIV2_RTC_GPIO 3
104 static struct i2c_board_info __initdata edmini_v2_i2c_rtc = {
105 I2C_BOARD_INFO("rs5c372a", 0x32),
106 .irq = 0,
109 /*****************************************************************************
110 * General Setup
111 ****************************************************************************/
112 static unsigned int edminiv2_mpp_modes[] __initdata = {
113 MPP0_UNUSED,
114 MPP1_UNUSED,
115 MPP2_UNUSED,
116 MPP3_GPIO, /* RTC interrupt */
117 MPP4_UNUSED,
118 MPP5_UNUSED,
119 MPP6_UNUSED,
120 MPP7_UNUSED,
121 MPP8_UNUSED,
122 MPP9_UNUSED,
123 MPP10_UNUSED,
124 MPP11_UNUSED,
125 MPP12_SATA_LED, /* SATA 0 presence */
126 MPP13_SATA_LED, /* SATA 1 presence */
127 MPP14_SATA_LED, /* SATA 0 active */
128 MPP15_SATA_LED, /* SATA 1 active */
129 /* 16: Power LED control (0 = On, 1 = Off) */
130 MPP16_GPIO,
131 /* 17: Power LED control select (0 = CPLD, 1 = GPIO16) */
132 MPP17_GPIO,
133 /* 18: Power button status (0 = Released, 1 = Pressed) */
134 MPP18_GPIO,
135 MPP19_UNUSED,
139 void __init edmini_v2_init(void)
141 orion5x_mpp_conf(edminiv2_mpp_modes);
144 * Configure peripherals.
146 orion5x_ehci0_init();
148 mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,
149 ORION_MBUS_DEVBUS_BOOT_ATTR,
150 EDMINI_V2_NOR_BOOT_BASE,
151 EDMINI_V2_NOR_BOOT_SIZE);
152 platform_device_register(&edmini_v2_nor_flash);
154 pr_notice("edmini_v2: USB device port, flash write and power-off "
155 "are not yet supported.\n");
157 /* Get RTC IRQ and register the chip */
158 if (gpio_request(EDMINIV2_RTC_GPIO, "rtc") == 0) {
159 if (gpio_direction_input(EDMINIV2_RTC_GPIO) == 0)
160 edmini_v2_i2c_rtc.irq = gpio_to_irq(EDMINIV2_RTC_GPIO);
161 else
162 gpio_free(EDMINIV2_RTC_GPIO);
165 if (edmini_v2_i2c_rtc.irq == 0)
166 pr_warning("edmini_v2: failed to get RTC IRQ\n");
168 i2c_register_board_info(0, &edmini_v2_i2c_rtc, 1);