3 * QNAP TS-410, TS-410U, TS-419P and TS-419U Turbo NAS Board Setup
5 * Copyright (C) 2009-2010 Martin Michlmayr <tbm@cyrius.com>
6 * Copyright (C) 2008 Byron Bradley <byron.bbradley@gmail.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/platform_device.h>
17 #include <linux/i2c.h>
18 #include <linux/mv643xx_eth.h>
19 #include <linux/ata_platform.h>
20 #include <linux/gpio.h>
21 #include <linux/gpio_keys.h>
22 #include <linux/input.h>
23 #include <asm/mach-types.h>
24 #include <asm/mach/arch.h>
25 #include <mach/kirkwood.h>
28 #include "tsx1x-common.h"
30 /* for the PCIe reset workaround */
31 #include <plat/pcie.h>
34 #define QNAP_TS41X_JUMPER_JP1 45
36 static struct i2c_board_info __initdata qnap_ts41x_i2c_rtc
= {
37 I2C_BOARD_INFO("s35390a", 0x30),
40 static struct mv643xx_eth_platform_data qnap_ts41x_ge00_data
= {
41 .phy_addr
= MV643XX_ETH_PHY_ADDR(8),
44 static struct mv643xx_eth_platform_data qnap_ts41x_ge01_data
= {
45 .phy_addr
= MV643XX_ETH_PHY_ADDR(0),
48 static struct mv_sata_platform_data qnap_ts41x_sata_data
= {
52 static struct gpio_keys_button qnap_ts41x_buttons
[] = {
67 static struct gpio_keys_platform_data qnap_ts41x_button_data
= {
68 .buttons
= qnap_ts41x_buttons
,
69 .nbuttons
= ARRAY_SIZE(qnap_ts41x_buttons
),
72 static struct platform_device qnap_ts41x_button_device
= {
77 .platform_data
= &qnap_ts41x_button_data
,
81 static unsigned int qnap_ts41x_mpp_config
[] __initdata
= {
92 MPP13_UART1_TXD
, /* PIC controller */
93 MPP14_UART1_RXD
, /* PIC controller */
108 MPP36_GPIO
, /* RAM: 0: 256 MB, 1: 512 MB */
109 MPP37_GPIO
, /* Reset button */
110 MPP43_GPIO
, /* USB Copy button */
111 MPP44_GPIO
, /* Board ID: 0: TS-419U, 1: TS-419 */
112 MPP45_GPIO
, /* JP1: 0: LCD, 1: serial console */
113 MPP46_GPIO
, /* External SATA HDD1 error indicator */
114 MPP47_GPIO
, /* External SATA HDD2 error indicator */
115 MPP48_GPIO
, /* External SATA HDD3 error indicator */
116 MPP49_GPIO
, /* External SATA HDD4 error indicator */
120 static void __init
qnap_ts41x_init(void)
123 * Basic setup. Needs to be called early.
126 kirkwood_mpp_conf(qnap_ts41x_mpp_config
);
128 kirkwood_uart0_init();
129 kirkwood_uart1_init(); /* A PIC controller is connected here. */
130 qnap_tsx1x_register_flash();
132 i2c_register_board_info(0, &qnap_ts41x_i2c_rtc
, 1);
133 kirkwood_ge00_init(&qnap_ts41x_ge00_data
);
134 kirkwood_ge01_init(&qnap_ts41x_ge01_data
);
135 kirkwood_sata_init(&qnap_ts41x_sata_data
);
136 kirkwood_ehci_init();
137 platform_device_register(&qnap_ts41x_button_device
);
139 pm_power_off
= qnap_tsx1x_power_off
;
141 if (gpio_request(QNAP_TS41X_JUMPER_JP1
, "JP1") == 0)
142 gpio_export(QNAP_TS41X_JUMPER_JP1
, 0);
145 static int __init
ts41x_pci_init(void)
147 if (machine_is_ts41x()) {
149 * Without this explicit reset, the PCIe SATA controller
150 * (Marvell 88sx7042/sata_mv) is known to stop working
151 * after a few minutes.
153 orion_pcie_reset((void __iomem
*)PCIE_VIRT_BASE
);
155 kirkwood_pcie_init(KW_PCIE0
);
160 subsys_initcall(ts41x_pci_init
);
162 MACHINE_START(TS41X
, "QNAP TS-41x")
163 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
164 .boot_params
= 0x00000100,
165 .init_machine
= qnap_ts41x_init
,
166 .map_io
= kirkwood_map_io
,
167 .init_irq
= kirkwood_init_irq
,
168 .timer
= &kirkwood_timer
,