diff options
Diffstat (limited to 'arch/arm/mach-kirkwood')
-rw-r--r-- | arch/arm/mach-kirkwood/Kconfig | 12 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/Makefile | 3 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/ts219-setup.c | 108 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/ts41x-setup.c | 154 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/tsx1x-common.c | 113 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/tsx1x-common.h | 7 |
6 files changed, 291 insertions, 106 deletions
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig index 0aca451b216d..8bf09ae5b347 100644 --- a/arch/arm/mach-kirkwood/Kconfig +++ b/arch/arm/mach-kirkwood/Kconfig | |||
@@ -33,10 +33,18 @@ config MACH_SHEEVAPLUG | |||
33 | Marvell SheevaPlug Reference Board. | 33 | Marvell SheevaPlug Reference Board. |
34 | 34 | ||
35 | config MACH_TS219 | 35 | config MACH_TS219 |
36 | bool "QNAP TS-119 and TS-219 Turbo NAS" | 36 | bool "QNAP TS-110, TS-119, TS-210, TS-219 and TS-219P Turbo NAS" |
37 | help | 37 | help |
38 | Say 'Y' here if you want your kernel to support the | 38 | Say 'Y' here if you want your kernel to support the |
39 | QNAP TS-119 and TS-219 Turbo NAS devices. | 39 | QNAP TS-110, TS-119, TS-210, TS-219 and TS-219P Turbo NAS |
40 | devices. | ||
41 | |||
42 | config MACH_TS41X | ||
43 | bool "QNAP TS-410, TS-410U, TS-419P and TS-419U Turbo NAS" | ||
44 | help | ||
45 | Say 'Y' here if you want your kernel to support the | ||
46 | QNAP TS-410, TS-410U, TS-419P and TS-419U Turbo NAS | ||
47 | devices. | ||
40 | 48 | ||
41 | config MACH_OPENRD_BASE | 49 | config MACH_OPENRD_BASE |
42 | bool "Marvell OpenRD Base Board" | 50 | bool "Marvell OpenRD Base Board" |
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile index 80ab0ec90ee1..9f2f67b2b63d 100644 --- a/arch/arm/mach-kirkwood/Makefile +++ b/arch/arm/mach-kirkwood/Makefile | |||
@@ -5,7 +5,8 @@ obj-$(CONFIG_MACH_RD88F6192_NAS) += rd88f6192-nas-setup.o | |||
5 | obj-$(CONFIG_MACH_RD88F6281) += rd88f6281-setup.o | 5 | obj-$(CONFIG_MACH_RD88F6281) += rd88f6281-setup.o |
6 | obj-$(CONFIG_MACH_MV88F6281GTW_GE) += mv88f6281gtw_ge-setup.o | 6 | obj-$(CONFIG_MACH_MV88F6281GTW_GE) += mv88f6281gtw_ge-setup.o |
7 | obj-$(CONFIG_MACH_SHEEVAPLUG) += sheevaplug-setup.o | 7 | obj-$(CONFIG_MACH_SHEEVAPLUG) += sheevaplug-setup.o |
8 | obj-$(CONFIG_MACH_TS219) += ts219-setup.o | 8 | obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o |
9 | obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o | ||
9 | obj-$(CONFIG_MACH_OPENRD_BASE) += openrd_base-setup.o | 10 | obj-$(CONFIG_MACH_OPENRD_BASE) += openrd_base-setup.o |
10 | 11 | ||
11 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | 12 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o |
diff --git a/arch/arm/mach-kirkwood/ts219-setup.c b/arch/arm/mach-kirkwood/ts219-setup.c index ec1a64f263d2..2830f0fe80e0 100644 --- a/arch/arm/mach-kirkwood/ts219-setup.c +++ b/arch/arm/mach-kirkwood/ts219-setup.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * QNAP TS-119/TS-219 Turbo NAS Board Setup | 3 | * QNAP TS-11x/TS-21x Turbo NAS Board Setup |
4 | * | 4 | * |
5 | * Copyright (C) 2009 Martin Michlmayr <tbm@cyrius.com> | 5 | * Copyright (C) 2009 Martin Michlmayr <tbm@cyrius.com> |
6 | * Copyright (C) 2008 Byron Bradley <byron.bbradley@gmail.com> | 6 | * Copyright (C) 2008 Byron Bradley <byron.bbradley@gmail.com> |
@@ -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), |
@@ -152,36 +82,10 @@ static unsigned int qnap_ts219_mpp_config[] __initdata = { | |||
152 | MPP14_UART1_RXD, /* PIC controller */ | 82 | MPP14_UART1_RXD, /* PIC controller */ |
153 | MPP15_GPIO, /* USB Copy button */ | 83 | MPP15_GPIO, /* USB Copy button */ |
154 | MPP16_GPIO, /* Reset button */ | 84 | MPP16_GPIO, /* Reset button */ |
85 | MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */ | ||
155 | 0 | 86 | 0 |
156 | }; | 87 | }; |
157 | 88 | ||
158 | |||
159 | /***************************************************************************** | ||
160 | * QNAP TS-x19 specific power off method via UART1-attached PIC | ||
161 | ****************************************************************************/ | ||
162 | |||
163 | #define UART1_REG(x) (UART1_VIRT_BASE + ((UART_##x) << 2)) | ||
164 | |||
165 | void qnap_ts219_power_off(void) | ||
166 | { | ||
167 | /* 19200 baud divisor */ | ||
168 | const unsigned divisor = ((kirkwood_tclk + (8 * 19200)) / (16 * 19200)); | ||
169 | |||
170 | pr_info("%s: triggering power-off...\n", __func__); | ||
171 | |||
172 | /* hijack UART1 and reset into sane state (19200,8n1) */ | ||
173 | writel(0x83, UART1_REG(LCR)); | ||
174 | writel(divisor & 0xff, UART1_REG(DLL)); | ||
175 | writel((divisor >> 8) & 0xff, UART1_REG(DLM)); | ||
176 | writel(0x03, UART1_REG(LCR)); | ||
177 | writel(0x00, UART1_REG(IER)); | ||
178 | writel(0x00, UART1_REG(FCR)); | ||
179 | writel(0x00, UART1_REG(MCR)); | ||
180 | |||
181 | /* send the power-off command 'A' to PIC */ | ||
182 | writel('A', UART1_REG(TX)); | ||
183 | } | ||
184 | |||
185 | static void __init qnap_ts219_init(void) | 89 | static void __init qnap_ts219_init(void) |
186 | { | 90 | { |
187 | /* | 91 | /* |
@@ -192,9 +96,7 @@ static void __init qnap_ts219_init(void) | |||
192 | 96 | ||
193 | kirkwood_uart0_init(); | 97 | kirkwood_uart0_init(); |
194 | kirkwood_uart1_init(); /* A PIC controller is connected here. */ | 98 | kirkwood_uart1_init(); /* A PIC controller is connected here. */ |
195 | spi_register_board_info(qnap_ts219_spi_slave_info, | 99 | qnap_tsx1x_register_flash(); |
196 | ARRAY_SIZE(qnap_ts219_spi_slave_info)); | ||
197 | kirkwood_spi_init(); | ||
198 | kirkwood_i2c_init(); | 100 | kirkwood_i2c_init(); |
199 | i2c_register_board_info(0, &qnap_ts219_i2c_rtc, 1); | 101 | i2c_register_board_info(0, &qnap_ts219_i2c_rtc, 1); |
200 | kirkwood_ge00_init(&qnap_ts219_ge00_data); | 102 | kirkwood_ge00_init(&qnap_ts219_ge00_data); |
@@ -202,7 +104,7 @@ static void __init qnap_ts219_init(void) | |||
202 | kirkwood_ehci_init(); | 104 | kirkwood_ehci_init(); |
203 | platform_device_register(&qnap_ts219_button_device); | 105 | platform_device_register(&qnap_ts219_button_device); |
204 | 106 | ||
205 | pm_power_off = qnap_ts219_power_off; | 107 | pm_power_off = qnap_tsx1x_power_off; |
206 | 108 | ||
207 | } | 109 | } |
208 | 110 | ||
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 | |||
29 | static struct i2c_board_info __initdata qnap_ts41x_i2c_rtc = { | ||
30 | I2C_BOARD_INFO("s35390a", 0x30), | ||
31 | }; | ||
32 | |||
33 | static struct mv643xx_eth_platform_data qnap_ts41x_ge00_data = { | ||
34 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), | ||
35 | }; | ||
36 | |||
37 | static struct mv643xx_eth_platform_data qnap_ts41x_ge01_data = { | ||
38 | .phy_addr = MV643XX_ETH_PHY_ADDR(0), | ||
39 | }; | ||
40 | |||
41 | static struct mv_sata_platform_data qnap_ts41x_sata_data = { | ||
42 | .n_ports = 2, | ||
43 | }; | ||
44 | |||
45 | static 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 | |||
60 | static struct gpio_keys_platform_data qnap_ts41x_button_data = { | ||
61 | .buttons = qnap_ts41x_buttons, | ||
62 | .nbuttons = ARRAY_SIZE(qnap_ts41x_buttons), | ||
63 | }; | ||
64 | |||
65 | static 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 | |||
74 | static 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 | |||
113 | static 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 | |||
136 | static int __init ts41x_pci_init(void) | ||
137 | { | ||
138 | if (machine_is_ts41x()) | ||
139 | kirkwood_pcie_init(); | ||
140 | |||
141 | return 0; | ||
142 | } | ||
143 | subsys_initcall(ts41x_pci_init); | ||
144 | |||
145 | MACHINE_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, | ||
154 | MACHINE_END | ||
diff --git a/arch/arm/mach-kirkwood/tsx1x-common.c b/arch/arm/mach-kirkwood/tsx1x-common.c new file mode 100644 index 000000000000..7221c20b2afa --- /dev/null +++ b/arch/arm/mach-kirkwood/tsx1x-common.c | |||
@@ -0,0 +1,113 @@ | |||
1 | #include <linux/kernel.h> | ||
2 | #include <linux/pci.h> | ||
3 | #include <linux/platform_device.h> | ||
4 | #include <linux/mtd/physmap.h> | ||
5 | #include <linux/spi/flash.h> | ||
6 | #include <linux/spi/spi.h> | ||
7 | #include <linux/spi/orion_spi.h> | ||
8 | #include <linux/serial_reg.h> | ||
9 | #include <mach/kirkwood.h> | ||
10 | #include "common.h" | ||
11 | |||
12 | /* | ||
13 | * QNAP TS-x1x Boards flash | ||
14 | */ | ||
15 | |||
16 | /**************************************************************************** | ||
17 | * 16 MiB NOR flash. The struct mtd_partition is not in the same order as the | ||
18 | * partitions on the device because we want to keep compatability with | ||
19 | * the QNAP firmware. | ||
20 | * Layout as used by QNAP: | ||
21 | * 0x00000000-0x00080000 : "U-Boot" | ||
22 | * 0x00200000-0x00400000 : "Kernel" | ||
23 | * 0x00400000-0x00d00000 : "RootFS" | ||
24 | * 0x00d00000-0x01000000 : "RootFS2" | ||
25 | * 0x00080000-0x000c0000 : "U-Boot Config" | ||
26 | * 0x000c0000-0x00200000 : "NAS Config" | ||
27 | * | ||
28 | * We'll use "RootFS1" instead of "RootFS" to stay compatible with the layout | ||
29 | * used by the QNAP TS-109/TS-209. | ||
30 | * | ||
31 | ***************************************************************************/ | ||
32 | |||
33 | struct mtd_partition qnap_tsx1x_partitions[] = { | ||
34 | { | ||
35 | .name = "U-Boot", | ||
36 | .size = 0x00080000, | ||
37 | .offset = 0, | ||
38 | .mask_flags = MTD_WRITEABLE, | ||
39 | }, { | ||
40 | .name = "Kernel", | ||
41 | .size = 0x00200000, | ||
42 | .offset = 0x00200000, | ||
43 | }, { | ||
44 | .name = "RootFS1", | ||
45 | .size = 0x00900000, | ||
46 | .offset = 0x00400000, | ||
47 | }, { | ||
48 | .name = "RootFS2", | ||
49 | .size = 0x00300000, | ||
50 | .offset = 0x00d00000, | ||
51 | }, { | ||
52 | .name = "U-Boot Config", | ||
53 | .size = 0x00040000, | ||
54 | .offset = 0x00080000, | ||
55 | }, { | ||
56 | .name = "NAS Config", | ||
57 | .size = 0x00140000, | ||
58 | .offset = 0x000c0000, | ||
59 | }, | ||
60 | }; | ||
61 | |||
62 | const struct flash_platform_data qnap_tsx1x_flash = { | ||
63 | .type = "m25p128", | ||
64 | .name = "spi_flash", | ||
65 | .parts = qnap_tsx1x_partitions, | ||
66 | .nr_parts = ARRAY_SIZE(qnap_tsx1x_partitions), | ||
67 | }; | ||
68 | |||
69 | struct spi_board_info __initdata qnap_tsx1x_spi_slave_info[] = { | ||
70 | { | ||
71 | .modalias = "m25p80", | ||
72 | .platform_data = &qnap_tsx1x_flash, | ||
73 | .irq = -1, | ||
74 | .max_speed_hz = 20000000, | ||
75 | .bus_num = 0, | ||
76 | .chip_select = 0, | ||
77 | }, | ||
78 | }; | ||
79 | |||
80 | void qnap_tsx1x_register_flash(void) | ||
81 | { | ||
82 | spi_register_board_info(qnap_tsx1x_spi_slave_info, | ||
83 | ARRAY_SIZE(qnap_tsx1x_spi_slave_info)); | ||
84 | kirkwood_spi_init(); | ||
85 | } | ||
86 | |||
87 | |||
88 | /***************************************************************************** | ||
89 | * QNAP TS-x1x specific power off method via UART1-attached PIC | ||
90 | ****************************************************************************/ | ||
91 | |||
92 | #define UART1_REG(x) (UART1_VIRT_BASE + ((UART_##x) << 2)) | ||
93 | |||
94 | void qnap_tsx1x_power_off(void) | ||
95 | { | ||
96 | /* 19200 baud divisor */ | ||
97 | const unsigned divisor = ((kirkwood_tclk + (8 * 19200)) / (16 * 19200)); | ||
98 | |||
99 | pr_info("%s: triggering power-off...\n", __func__); | ||
100 | |||
101 | /* hijack UART1 and reset into sane state (19200,8n1) */ | ||
102 | writel(0x83, UART1_REG(LCR)); | ||
103 | writel(divisor & 0xff, UART1_REG(DLL)); | ||
104 | writel((divisor >> 8) & 0xff, UART1_REG(DLM)); | ||
105 | writel(0x03, UART1_REG(LCR)); | ||
106 | writel(0x00, UART1_REG(IER)); | ||
107 | writel(0x00, UART1_REG(FCR)); | ||
108 | writel(0x00, UART1_REG(MCR)); | ||
109 | |||
110 | /* send the power-off command 'A' to PIC */ | ||
111 | writel('A', UART1_REG(TX)); | ||
112 | } | ||
113 | |||
diff --git a/arch/arm/mach-kirkwood/tsx1x-common.h b/arch/arm/mach-kirkwood/tsx1x-common.h new file mode 100644 index 000000000000..9a592962a6ea --- /dev/null +++ b/arch/arm/mach-kirkwood/tsx1x-common.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __ARCH_KIRKWOOD_TSX1X_COMMON_H | ||
2 | #define __ARCH_KIRKWOOD_TSX1X_COMMON_H | ||
3 | |||
4 | extern void qnap_tsx1x_register_flash(void); | ||
5 | extern void qnap_tsx1x_power_off(void); | ||
6 | |||
7 | #endif | ||