• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/arch/arm/mach-kirkwood/
1/*
2 *
3 * QNAP TS-410, TS-410U, TS-419P and TS-419U Turbo NAS Board Setup
4 *
5 * Copyright (C) 2009-2010  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.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>
26#include "common.h"
27#include "mpp.h"
28#include "tsx1x-common.h"
29
30#define QNAP_TS41X_JUMPER_JP1	45
31
32static struct i2c_board_info __initdata qnap_ts41x_i2c_rtc = {
33	I2C_BOARD_INFO("s35390a", 0x30),
34};
35
36static struct mv643xx_eth_platform_data qnap_ts41x_ge00_data = {
37	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
38};
39
40static struct mv643xx_eth_platform_data qnap_ts41x_ge01_data = {
41	.phy_addr	= MV643XX_ETH_PHY_ADDR(0),
42};
43
44static struct mv_sata_platform_data qnap_ts41x_sata_data = {
45	.n_ports	= 2,
46};
47
48static struct gpio_keys_button qnap_ts41x_buttons[] = {
49	{
50		.code		= KEY_COPY,
51		.gpio		= 43,
52		.desc		= "USB Copy",
53		.active_low	= 1,
54	},
55	{
56		.code		= KEY_RESTART,
57		.gpio		= 37,
58		.desc		= "Reset",
59		.active_low	= 1,
60	},
61};
62
63static struct gpio_keys_platform_data qnap_ts41x_button_data = {
64	.buttons	= qnap_ts41x_buttons,
65	.nbuttons	= ARRAY_SIZE(qnap_ts41x_buttons),
66};
67
68static struct platform_device qnap_ts41x_button_device = {
69	.name		= "gpio-keys",
70	.id		= -1,
71	.num_resources	= 0,
72	.dev		= {
73		.platform_data	= &qnap_ts41x_button_data,
74	}
75};
76
77static unsigned int qnap_ts41x_mpp_config[] __initdata = {
78	MPP0_SPI_SCn,
79	MPP1_SPI_MOSI,
80	MPP2_SPI_SCK,
81	MPP3_SPI_MISO,
82	MPP6_SYSRST_OUTn,
83	MPP7_PEX_RST_OUTn,
84	MPP8_TW0_SDA,
85	MPP9_TW0_SCK,
86	MPP10_UART0_TXD,
87	MPP11_UART0_RXD,
88	MPP13_UART1_TXD,	/* PIC controller */
89	MPP14_UART1_RXD,	/* PIC controller */
90	MPP15_SATA0_ACTn,
91	MPP16_SATA1_ACTn,
92	MPP20_GE1_TXD0,
93	MPP21_GE1_TXD1,
94	MPP22_GE1_TXD2,
95	MPP23_GE1_TXD3,
96	MPP24_GE1_RXD0,
97	MPP25_GE1_RXD1,
98	MPP26_GE1_RXD2,
99	MPP27_GE1_RXD3,
100	MPP30_GE1_RXCTL,
101	MPP31_GE1_RXCLK,
102	MPP32_GE1_TCLKOUT,
103	MPP33_GE1_TXCTL,
104	MPP36_GPIO,		/* RAM: 0: 256 MB, 1: 512 MB */
105	MPP37_GPIO,		/* Reset button */
106	MPP43_GPIO,		/* USB Copy button */
107	MPP44_GPIO,		/* Board ID: 0: TS-419U, 1: TS-419 */
108	MPP45_GPIO,		/* JP1: 0: LCD, 1: serial console */
109	MPP46_GPIO,		/* External SATA HDD1 error indicator */
110	MPP47_GPIO,		/* External SATA HDD2 error indicator */
111	MPP48_GPIO,		/* External SATA HDD3 error indicator */
112	MPP49_GPIO,		/* External SATA HDD4 error indicator */
113	0
114};
115
116static void __init qnap_ts41x_init(void)
117{
118	/*
119	 * Basic setup. Needs to be called early.
120	 */
121	kirkwood_init();
122	kirkwood_mpp_conf(qnap_ts41x_mpp_config);
123
124	kirkwood_uart0_init();
125	kirkwood_uart1_init(); /* A PIC controller is connected here. */
126	qnap_tsx1x_register_flash();
127	kirkwood_i2c_init();
128	i2c_register_board_info(0, &qnap_ts41x_i2c_rtc, 1);
129	kirkwood_ge00_init(&qnap_ts41x_ge00_data);
130	kirkwood_ge01_init(&qnap_ts41x_ge01_data);
131	kirkwood_sata_init(&qnap_ts41x_sata_data);
132	kirkwood_ehci_init();
133	platform_device_register(&qnap_ts41x_button_device);
134
135	pm_power_off = qnap_tsx1x_power_off;
136
137	if (gpio_request(QNAP_TS41X_JUMPER_JP1, "JP1") == 0)
138		gpio_export(QNAP_TS41X_JUMPER_JP1, 0);
139}
140
141static int __init ts41x_pci_init(void)
142{
143	if (machine_is_ts41x())
144		kirkwood_pcie_init(KW_PCIE0);
145
146   return 0;
147}
148subsys_initcall(ts41x_pci_init);
149
150MACHINE_START(TS41X, "QNAP TS-41x")
151	/* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
152	.phys_io	= KIRKWOOD_REGS_PHYS_BASE,
153	.io_pg_offst	= ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
154	.boot_params	= 0x00000100,
155	.init_machine	= qnap_ts41x_init,
156	.map_io		= kirkwood_map_io,
157	.init_irq	= kirkwood_init_irq,
158	.timer		= &kirkwood_timer,
159MACHINE_END
160