diff options
Diffstat (limited to 'arch/arm/mach-kirkwood/ts219-setup.c')
-rw-r--r-- | arch/arm/mach-kirkwood/ts219-setup.c | 105 |
1 files changed, 3 insertions, 102 deletions
diff --git a/arch/arm/mach-kirkwood/ts219-setup.c b/arch/arm/mach-kirkwood/ts219-setup.c index a7c209d599e8..2830f0fe80e0 100644 --- a/arch/arm/mach-kirkwood/ts219-setup.c +++ b/arch/arm/mach-kirkwood/ts219-setup.c | |||
@@ -14,87 +14,17 @@ | |||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/mtd/physmap.h> | ||
18 | #include <linux/spi/flash.h> | ||
19 | #include <linux/spi/spi.h> | ||
20 | #include <linux/spi/orion_spi.h> | ||
21 | #include <linux/i2c.h> | 17 | #include <linux/i2c.h> |
22 | #include <linux/mv643xx_eth.h> | 18 | #include <linux/mv643xx_eth.h> |
23 | #include <linux/ata_platform.h> | 19 | #include <linux/ata_platform.h> |
24 | #include <linux/gpio_keys.h> | 20 | #include <linux/gpio_keys.h> |
25 | #include <linux/input.h> | 21 | #include <linux/input.h> |
26 | #include <linux/timex.h> | ||
27 | #include <linux/serial_reg.h> | ||
28 | #include <linux/pci.h> | ||
29 | #include <asm/mach-types.h> | 22 | #include <asm/mach-types.h> |
30 | #include <asm/mach/arch.h> | 23 | #include <asm/mach/arch.h> |
31 | #include <mach/kirkwood.h> | 24 | #include <mach/kirkwood.h> |
32 | #include "common.h" | 25 | #include "common.h" |
33 | #include "mpp.h" | 26 | #include "mpp.h" |
34 | 27 | #include "tsx1x-common.h" | |
35 | /**************************************************************************** | ||
36 | * 16 MiB NOR flash. The struct mtd_partition is not in the same order as the | ||
37 | * partitions on the device because we want to keep compatability with | ||
38 | * the QNAP firmware. | ||
39 | * Layout as used by QNAP: | ||
40 | * 0x00000000-0x00080000 : "U-Boot" | ||
41 | * 0x00200000-0x00400000 : "Kernel" | ||
42 | * 0x00400000-0x00d00000 : "RootFS" | ||
43 | * 0x00d00000-0x01000000 : "RootFS2" | ||
44 | * 0x00080000-0x000c0000 : "U-Boot Config" | ||
45 | * 0x000c0000-0x00200000 : "NAS Config" | ||
46 | * | ||
47 | * We'll use "RootFS1" instead of "RootFS" to stay compatible with the layout | ||
48 | * used by the QNAP TS-109/TS-209. | ||
49 | * | ||
50 | ***************************************************************************/ | ||
51 | |||
52 | static struct mtd_partition qnap_ts219_partitions[] = { | ||
53 | { | ||
54 | .name = "U-Boot", | ||
55 | .size = 0x00080000, | ||
56 | .offset = 0, | ||
57 | .mask_flags = MTD_WRITEABLE, | ||
58 | }, { | ||
59 | .name = "Kernel", | ||
60 | .size = 0x00200000, | ||
61 | .offset = 0x00200000, | ||
62 | }, { | ||
63 | .name = "RootFS1", | ||
64 | .size = 0x00900000, | ||
65 | .offset = 0x00400000, | ||
66 | }, { | ||
67 | .name = "RootFS2", | ||
68 | .size = 0x00300000, | ||
69 | .offset = 0x00d00000, | ||
70 | }, { | ||
71 | .name = "U-Boot Config", | ||
72 | .size = 0x00040000, | ||
73 | .offset = 0x00080000, | ||
74 | }, { | ||
75 | .name = "NAS Config", | ||
76 | .size = 0x00140000, | ||
77 | .offset = 0x000c0000, | ||
78 | }, | ||
79 | }; | ||
80 | |||
81 | static const struct flash_platform_data qnap_ts219_flash = { | ||
82 | .type = "m25p128", | ||
83 | .name = "spi_flash", | ||
84 | .parts = qnap_ts219_partitions, | ||
85 | .nr_parts = ARRAY_SIZE(qnap_ts219_partitions), | ||
86 | }; | ||
87 | |||
88 | static struct spi_board_info __initdata qnap_ts219_spi_slave_info[] = { | ||
89 | { | ||
90 | .modalias = "m25p80", | ||
91 | .platform_data = &qnap_ts219_flash, | ||
92 | .irq = -1, | ||
93 | .max_speed_hz = 20000000, | ||
94 | .bus_num = 0, | ||
95 | .chip_select = 0, | ||
96 | }, | ||
97 | }; | ||
98 | 28 | ||
99 | static struct i2c_board_info __initdata qnap_ts219_i2c_rtc = { | 29 | static struct i2c_board_info __initdata qnap_ts219_i2c_rtc = { |
100 | I2C_BOARD_INFO("s35390a", 0x30), | 30 | I2C_BOARD_INFO("s35390a", 0x30), |
@@ -156,33 +86,6 @@ static unsigned int qnap_ts219_mpp_config[] __initdata = { | |||
156 | 0 | 86 | 0 |
157 | }; | 87 | }; |
158 | 88 | ||
159 | |||
160 | /***************************************************************************** | ||
161 | * QNAP TS-x19 specific power off method via UART1-attached PIC | ||
162 | ****************************************************************************/ | ||
163 | |||
164 | #define UART1_REG(x) (UART1_VIRT_BASE + ((UART_##x) << 2)) | ||
165 | |||
166 | void qnap_ts219_power_off(void) | ||
167 | { | ||
168 | /* 19200 baud divisor */ | ||
169 | const unsigned divisor = ((kirkwood_tclk + (8 * 19200)) / (16 * 19200)); | ||
170 | |||
171 | pr_info("%s: triggering power-off...\n", __func__); | ||
172 | |||
173 | /* hijack UART1 and reset into sane state (19200,8n1) */ | ||
174 | writel(0x83, UART1_REG(LCR)); | ||
175 | writel(divisor & 0xff, UART1_REG(DLL)); | ||
176 | writel((divisor >> 8) & 0xff, UART1_REG(DLM)); | ||
177 | writel(0x03, UART1_REG(LCR)); | ||
178 | writel(0x00, UART1_REG(IER)); | ||
179 | writel(0x00, UART1_REG(FCR)); | ||
180 | writel(0x00, UART1_REG(MCR)); | ||
181 | |||
182 | /* send the power-off command 'A' to PIC */ | ||
183 | writel('A', UART1_REG(TX)); | ||
184 | } | ||
185 | |||
186 | static void __init qnap_ts219_init(void) | 89 | static void __init qnap_ts219_init(void) |
187 | { | 90 | { |
188 | /* | 91 | /* |
@@ -193,9 +96,7 @@ static void __init qnap_ts219_init(void) | |||
193 | 96 | ||
194 | kirkwood_uart0_init(); | 97 | kirkwood_uart0_init(); |
195 | kirkwood_uart1_init(); /* A PIC controller is connected here. */ | 98 | kirkwood_uart1_init(); /* A PIC controller is connected here. */ |
196 | spi_register_board_info(qnap_ts219_spi_slave_info, | 99 | qnap_tsx1x_register_flash(); |
197 | ARRAY_SIZE(qnap_ts219_spi_slave_info)); | ||
198 | kirkwood_spi_init(); | ||
199 | kirkwood_i2c_init(); | 100 | kirkwood_i2c_init(); |
200 | i2c_register_board_info(0, &qnap_ts219_i2c_rtc, 1); | 101 | i2c_register_board_info(0, &qnap_ts219_i2c_rtc, 1); |
201 | kirkwood_ge00_init(&qnap_ts219_ge00_data); | 102 | kirkwood_ge00_init(&qnap_ts219_ge00_data); |
@@ -203,7 +104,7 @@ static void __init qnap_ts219_init(void) | |||
203 | kirkwood_ehci_init(); | 104 | kirkwood_ehci_init(); |
204 | platform_device_register(&qnap_ts219_button_device); | 105 | platform_device_register(&qnap_ts219_button_device); |
205 | 106 | ||
206 | pm_power_off = qnap_ts219_power_off; | 107 | pm_power_off = qnap_tsx1x_power_off; |
207 | 108 | ||
208 | } | 109 | } |
209 | 110 | ||