1
2
3
4
5
6
7
8
9
10
11
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_ts219_i2c_rtc = {
30 I2C_BOARD_INFO("s35390a", 0x30),
31};
32
33static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = {
34 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
35};
36
37static struct mv_sata_platform_data qnap_ts219_sata_data = {
38 .n_ports = 2,
39};
40
41static struct gpio_keys_button qnap_ts219_buttons[] = {
42 {
43 .code = KEY_COPY,
44 .gpio = 15,
45 .desc = "USB Copy",
46 .active_low = 1,
47 },
48 {
49 .code = KEY_RESTART,
50 .gpio = 16,
51 .desc = "Reset",
52 .active_low = 1,
53 },
54};
55
56static struct gpio_keys_platform_data qnap_ts219_button_data = {
57 .buttons = qnap_ts219_buttons,
58 .nbuttons = ARRAY_SIZE(qnap_ts219_buttons),
59};
60
61static struct platform_device qnap_ts219_button_device = {
62 .name = "gpio-keys",
63 .id = -1,
64 .num_resources = 0,
65 .dev = {
66 .platform_data = &qnap_ts219_button_data,
67 }
68};
69
70static unsigned int qnap_ts219_mpp_config[] __initdata = {
71 MPP0_SPI_SCn,
72 MPP1_SPI_MOSI,
73 MPP2_SPI_SCK,
74 MPP3_SPI_MISO,
75 MPP4_SATA1_ACTn,
76 MPP5_SATA0_ACTn,
77 MPP8_TW0_SDA,
78 MPP9_TW0_SCK,
79 MPP10_UART0_TXD,
80 MPP11_UART0_RXD,
81 MPP13_UART1_TXD,
82 MPP14_UART1_RXD,
83 MPP15_GPIO,
84 MPP16_GPIO,
85 MPP36_GPIO,
86 MPP37_GPIO,
87 MPP43_GPIO,
88 MPP44_GPIO,
89 0
90};
91
92static void __init qnap_ts219_init(void)
93{
94 u32 dev, rev;
95
96
97
98
99 kirkwood_init();
100 kirkwood_mpp_conf(qnap_ts219_mpp_config);
101
102 kirkwood_uart0_init();
103 kirkwood_uart1_init();
104 qnap_tsx1x_register_flash();
105 kirkwood_i2c_init();
106 i2c_register_board_info(0, &qnap_ts219_i2c_rtc, 1);
107
108 kirkwood_pcie_id(&dev, &rev);
109 if (dev == MV88F6282_DEV_ID) {
110 qnap_ts219_buttons[0].gpio = 43;
111 qnap_ts219_buttons[1].gpio = 37;
112 qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
113 }
114
115 kirkwood_ge00_init(&qnap_ts219_ge00_data);
116 kirkwood_sata_init(&qnap_ts219_sata_data);
117 kirkwood_ehci_init();
118 platform_device_register(&qnap_ts219_button_device);
119
120 pm_power_off = qnap_tsx1x_power_off;
121
122}
123
124static int __init ts219_pci_init(void)
125{
126 if (machine_is_ts219())
127 kirkwood_pcie_init(KW_PCIE0);
128
129 return 0;
130}
131subsys_initcall(ts219_pci_init);
132
133MACHINE_START(TS219, "QNAP TS-119/TS-219")
134
135 .boot_params = 0x00000100,
136 .init_machine = qnap_ts219_init,
137 .map_io = kirkwood_map_io,
138 .init_irq = kirkwood_init_irq,
139 .timer = &kirkwood_timer,
140MACHINE_END
141