aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-kirkwood/ts41x-setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-kirkwood/ts41x-setup.c')
-rw-r--r--arch/arm/mach-kirkwood/ts41x-setup.c154
1 files changed, 154 insertions, 0 deletions
diff --git a/arch/arm/mach-kirkwood/ts41x-setup.c b/arch/arm/mach-kirkwood/ts41x-setup.c
new file mode 100644
index 000000000000..de49c2d9e74b
--- /dev/null
+++ b/arch/arm/mach-kirkwood/ts41x-setup.c
@@ -0,0 +1,154 @@
1/*
2 *
3 * QNAP TS-410, TS-410U, TS-419P and TS-419U Turbo NAS Board Setup
4 *
5 * Copyright (C) 2009 Martin Michlmayr <tbm@cyrius.com>
6 * Copyright (C) 2008 Byron Bradley <byron.bbradley@gmail.com>
7 *
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.
12 */
13
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_keys.h>
21#include <linux/input.h>
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24#include <mach/kirkwood.h>
25#include "common.h"
26#include "mpp.h"
27#include "tsx1x-common.h"
28
29static struct i2c_board_info __initdata qnap_ts41x_i2c_rtc = {
30 I2C_BOARD_INFO("s35390a", 0x30),
31};
32
33static struct mv643xx_eth_platform_data qnap_ts41x_ge00_data = {
34 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
35};
36
37static struct mv643xx_eth_platform_data qnap_ts41x_ge01_data = {
38 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
39};
40
41static struct mv_sata_platform_data qnap_ts41x_sata_data = {
42 .n_ports = 2,
43};
44
45static struct gpio_keys_button qnap_ts41x_buttons[] = {
46 {
47 .code = KEY_COPY,
48 .gpio = 43,
49 .desc = "USB Copy",
50 .active_low = 1,
51 },
52 {
53 .code = KEY_RESTART,
54 .gpio = 37,
55 .desc = "Reset",
56 .active_low = 1,
57 },
58};
59
60static struct gpio_keys_platform_data qnap_ts41x_button_data = {
61 .buttons = qnap_ts41x_buttons,
62 .nbuttons = ARRAY_SIZE(qnap_ts41x_buttons),
63};
64
65static struct platform_device qnap_ts41x_button_device = {
66 .name = "gpio-keys",
67 .id = -1,
68 .num_resources = 0,
69 .dev = {
70 .platform_data = &qnap_ts41x_button_data,
71 }
72};
73
74static unsigned int qnap_ts41x_mpp_config[] __initdata = {
75 MPP0_SPI_SCn,
76 MPP1_SPI_MOSI,
77 MPP2_SPI_SCK,
78 MPP3_SPI_MISO,
79 MPP6_SYSRST_OUTn,
80 MPP7_PEX_RST_OUTn,
81 MPP8_TW_SDA,
82 MPP9_TW_SCK,
83 MPP10_UART0_TXD,
84 MPP11_UART0_RXD,
85 MPP13_UART1_TXD, /* PIC controller */
86 MPP14_UART1_RXD, /* PIC controller */
87 MPP15_SATA0_ACTn,
88 MPP16_SATA1_ACTn,
89 MPP20_GE1_0,
90 MPP21_GE1_1,
91 MPP22_GE1_2,
92 MPP23_GE1_3,
93 MPP24_GE1_4,
94 MPP25_GE1_5,
95 MPP26_GE1_6,
96 MPP27_GE1_7,
97 MPP30_GE1_10,
98 MPP31_GE1_11,
99 MPP32_GE1_12,
100 MPP33_GE1_13,
101 MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */
102 MPP37_GPIO, /* Reset button */
103 MPP43_GPIO, /* USB Copy button */
104 MPP44_GPIO, /* Board ID: 0: TS-419U, 1: TS-419 */
105 MPP45_GPIO, /* JP1: 0: console, 1: LCD */
106 MPP46_GPIO, /* External SATA HDD1 error indicator */
107 MPP47_GPIO, /* External SATA HDD2 error indicator */
108 MPP48_GPIO, /* External SATA HDD3 error indicator */
109 MPP49_GPIO, /* External SATA HDD4 error indicator */
110 0
111};
112
113static void __init qnap_ts41x_init(void)
114{
115 /*
116 * Basic setup. Needs to be called early.
117 */
118 kirkwood_init();
119 kirkwood_mpp_conf(qnap_ts41x_mpp_config);
120
121 kirkwood_uart0_init();
122 kirkwood_uart1_init(); /* A PIC controller is connected here. */
123 qnap_tsx1x_register_flash();
124 kirkwood_i2c_init();
125 i2c_register_board_info(0, &qnap_ts41x_i2c_rtc, 1);
126 kirkwood_ge00_init(&qnap_ts41x_ge00_data);
127 kirkwood_ge01_init(&qnap_ts41x_ge01_data);
128 kirkwood_sata_init(&qnap_ts41x_sata_data);
129 kirkwood_ehci_init();
130 platform_device_register(&qnap_ts41x_button_device);
131
132 pm_power_off = qnap_tsx1x_power_off;
133
134}
135
136static int __init ts41x_pci_init(void)
137{
138 if (machine_is_ts41x())
139 kirkwood_pcie_init();
140
141 return 0;
142}
143subsys_initcall(ts41x_pci_init);
144
145MACHINE_START(TS41X, "QNAP TS-41x")
146 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
147 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
148 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
149 .boot_params = 0x00000100,
150 .init_machine = qnap_ts41x_init,
151 .map_io = kirkwood_map_io,
152 .init_irq = kirkwood_init_irq,
153 .timer = &kirkwood_timer,
154MACHINE_END