2 * arch/arm/mach-kirkwood/openrd-setup.c
4 * Marvell OpenRD (Base|Client|Ultimate) Board Setup
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/mtd/nand.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/ata_platform.h>
17 #include <linux/mv643xx_eth.h>
18 #include <linux/i2c.h>
19 #include <linux/gpio.h>
20 #include <asm/mach-types.h>
21 #include <asm/mach/arch.h>
22 #include <mach/kirkwood.h>
23 #include <linux/platform_data/mmc-mvsdio.h>
27 static struct mtd_partition openrd_nand_parts
[] = {
32 .mask_flags
= MTD_WRITEABLE
35 .offset
= MTDPART_OFS_NXTBLK
,
39 .offset
= MTDPART_OFS_NXTBLK
,
40 .size
= MTDPART_SIZ_FULL
44 static struct mv643xx_eth_platform_data openrd_ge00_data
= {
45 .phy_addr
= MV643XX_ETH_PHY_ADDR(8),
48 static struct mv643xx_eth_platform_data openrd_ge01_data
= {
49 .phy_addr
= MV643XX_ETH_PHY_ADDR(24),
52 static struct mv_sata_platform_data openrd_sata_data
= {
56 static struct mvsdio_platform_data openrd_mvsdio_data
= {
57 .gpio_card_detect
= 29, /* MPP29 used as SD card detect */
58 .gpio_write_protect
= -1,
61 static unsigned int openrd_mpp_config
[] __initdata
= {
74 /* Configure MPP for UART1 */
75 static unsigned int openrd_uart1_mpp_config
[] __initdata
= {
81 static struct i2c_board_info i2c_board_info
[] __initdata
= {
83 I2C_BOARD_INFO("cs42l51", 0x4a),
87 static struct platform_device openrd_client_audio_device
= {
88 .name
= "openrd-client-audio",
92 static int __initdata uart1
;
94 static int __init
sd_uart_selection(char *str
)
98 /* Default is SD. Change if required, for UART */
102 if (!strncmp(str
, "232", 3)) {
104 } else if (!strncmp(str
, "485", 3)) {
105 /* OpenRD-Base doesn't have RS485. Treat is as an
106 * unknown argument & just have default setting -
108 if (machine_is_openrd_base()) {
117 /* Parse boot_command_line string kw_openrd_init_uart1=232/485 */
118 __setup("kw_openrd_init_uart1=", sd_uart_selection
);
120 static int __init
uart1_mpp_config(void)
122 kirkwood_mpp_conf(openrd_uart1_mpp_config
);
124 if (gpio_request(34, "SD_UART1_SEL")) {
125 pr_err("GPIO request 34 failed for SD/UART1 selection\n");
129 if (gpio_request(28, "RS232_RS485_SEL")) {
130 pr_err("GPIO request 28 failed for RS232/RS485 selection\n");
136 * Pin # 34: 0 => UART1, 1 => SD */
137 gpio_direction_output(34, 0);
139 /* Select RS232 OR RS485
140 * Pin # 28: 0 => RS232, 1 => RS485 */
142 gpio_direction_output(28, 0);
144 gpio_direction_output(28, 1);
152 static void __init
openrd_init(void)
155 * Basic setup. Needs to be called early.
158 kirkwood_mpp_conf(openrd_mpp_config
);
160 kirkwood_uart0_init();
161 kirkwood_nand_init(openrd_nand_parts
, ARRAY_SIZE(openrd_nand_parts
),
164 kirkwood_ehci_init();
166 if (machine_is_openrd_ultimate()) {
167 openrd_ge00_data
.phy_addr
= MV643XX_ETH_PHY_ADDR(0);
168 openrd_ge01_data
.phy_addr
= MV643XX_ETH_PHY_ADDR(1);
171 kirkwood_ge00_init(&openrd_ge00_data
);
172 if (!machine_is_openrd_base())
173 kirkwood_ge01_init(&openrd_ge01_data
);
175 kirkwood_sata_init(&openrd_sata_data
);
179 if (machine_is_openrd_client() || machine_is_openrd_ultimate()) {
180 platform_device_register(&openrd_client_audio_device
);
181 i2c_register_board_info(0, i2c_board_info
,
182 ARRAY_SIZE(i2c_board_info
));
183 kirkwood_audio_init();
188 pr_err("Invalid kernel parameter to select UART1. Defaulting to SD. ERROR CODE: %d\n",
192 * Pin # 34: 0 => UART1, 1 => SD */
193 if (gpio_request(34, "SD_UART1_SEL")) {
194 pr_err("GPIO request 34 failed for SD/UART1 selection\n");
197 gpio_direction_output(34, 1);
199 kirkwood_sdio_init(&openrd_mvsdio_data
);
202 if (!uart1_mpp_config())
203 kirkwood_uart1_init();
207 static int __init
openrd_pci_init(void)
209 if (machine_is_openrd_base() ||
210 machine_is_openrd_client() ||
211 machine_is_openrd_ultimate())
212 kirkwood_pcie_init(KW_PCIE0
);
216 subsys_initcall(openrd_pci_init
);
218 #ifdef CONFIG_MACH_OPENRD_BASE
219 MACHINE_START(OPENRD_BASE
, "Marvell OpenRD Base Board")
220 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
221 .atag_offset
= 0x100,
222 .init_machine
= openrd_init
,
223 .map_io
= kirkwood_map_io
,
224 .init_early
= kirkwood_init_early
,
225 .init_irq
= kirkwood_init_irq
,
226 .init_time
= kirkwood_timer_init
,
227 .restart
= kirkwood_restart
,
231 #ifdef CONFIG_MACH_OPENRD_CLIENT
232 MACHINE_START(OPENRD_CLIENT
, "Marvell OpenRD Client Board")
233 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
234 .atag_offset
= 0x100,
235 .init_machine
= openrd_init
,
236 .map_io
= kirkwood_map_io
,
237 .init_early
= kirkwood_init_early
,
238 .init_irq
= kirkwood_init_irq
,
239 .init_time
= kirkwood_timer_init
,
240 .restart
= kirkwood_restart
,
244 #ifdef CONFIG_MACH_OPENRD_ULTIMATE
245 MACHINE_START(OPENRD_ULTIMATE
, "Marvell OpenRD Ultimate Board")
246 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
247 .atag_offset
= 0x100,
248 .init_machine
= openrd_init
,
249 .map_io
= kirkwood_map_io
,
250 .init_early
= kirkwood_init_early
,
251 .init_irq
= kirkwood_init_irq
,
252 .init_time
= kirkwood_timer_init
,
253 .restart
= kirkwood_restart
,