aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-kirkwood
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2012-09-04 09:01:37 -0400
committerArnd Bergmann <arnd@arndb.de>2012-09-04 09:01:37 -0400
commit863e99a8c1ea2b0391491904297f57a0f6a1fdd6 (patch)
tree0e7789f83c0ba3a1bc3c19d3ccf5ea6f84f19db6 /arch/arm/mach-kirkwood
parentdd9bf78040fa0da4cecc228e1682b9682b8cb180 (diff)
parenta849088aa1552b1a28eea3daff599ee22a734ae3 (diff)
Merge commit 'a849088aa1' from rmk/fixes into cleanup/io-pci
As Stephen Rothwell reports, a849088aa155 ("ARM: Fix ioremap() of address zero") from the arm-current tree and commit c2794437091a ("ARM: Add fixed PCI i/o mapping") from the arm-soc tree conflict in a nontrivial way in arch/arm/mm/mmu.c. Rob Herring explains: The PCI i/o reserved area has a dummy physical address of 0 and needs to be skipped by ioremap searches. So we don't set VM_ARM_STATIC_MAPPING to prevent matches by ioremap. The vm_struct settings don't really matter when we do the real mapping of the i/o space. Since commit a849088aa155 is at the start of the fixes branch in the arm tree, we can merge it into the branch that contains the other ioremap changes. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Rob Herring <rob.herring@calxeda.com> Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-kirkwood')
-rw-r--r--arch/arm/mach-kirkwood/Kconfig29
-rw-r--r--arch/arm/mach-kirkwood/Makefile3
-rw-r--r--arch/arm/mach-kirkwood/Makefile.boot4
-rw-r--r--arch/arm/mach-kirkwood/board-dnskw.c143
-rw-r--r--arch/arm/mach-kirkwood/board-dreamplug.c80
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c29
-rw-r--r--arch/arm/mach-kirkwood/board-goflexnet.c71
-rw-r--r--arch/arm/mach-kirkwood/board-ib62x0.c72
-rw-r--r--arch/arm/mach-kirkwood/board-iconnect.c56
-rw-r--r--arch/arm/mach-kirkwood/board-lsxl.c135
-rw-r--r--arch/arm/mach-kirkwood/board-ts219.c82
-rw-r--r--arch/arm/mach-kirkwood/common.c72
-rw-r--r--arch/arm/mach-kirkwood/common.h17
-rw-r--r--arch/arm/mach-kirkwood/irq.c38
14 files changed, 440 insertions, 391 deletions
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 199764fe0fb0..ca5c15a4e626 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -80,6 +80,35 @@ config MACH_IB62X0_DT
80 RaidSonic IB-NAS6210 & IB-NAS6220 devices, using 80 RaidSonic IB-NAS6210 & IB-NAS6220 devices, using
81 Flattened Device Tree. 81 Flattened Device Tree.
82 82
83config MACH_TS219_DT
84 bool "Device Tree for QNAP TS-11X, TS-21X NAS"
85 select ARCH_KIRKWOOD_DT
86 select ARM_APPENDED_DTB
87 select ARM_ATAG_DTB_COMPAT
88 help
89 Say 'Y' here if you want your kernel to support the QNAP
90 TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
91 TS-219P+ Turbo NAS devices using Fattened Device Tree.
92 There are two different Device Tree descriptions, depending
93 on if the device is based on an if the board uses the MV6281
94 or MV6282. If you have the wrong one, the buttons will not
95 work.
96
97config MACH_GOFLEXNET_DT
98 bool "Seagate GoFlex Net (Flattened Device Tree)"
99 select ARCH_KIRKWOOD_DT
100 help
101 Say 'Y' here if you want your kernel to support the
102 Seagate GoFlex Net (Flattened Device Tree).
103
104config MACH_LSXL_DT
105 bool "Buffalo Linkstation LS-XHL, LS-CHLv2 (Flattened Device Tree)"
106 select ARCH_KIRKWOOD_DT
107 help
108 Say 'Y' here if you want your kernel to support the
109 Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using
110 Flattened Device Tree.
111
83config MACH_TS219 112config MACH_TS219
84 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" 113 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
85 help 114 help
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index d2b05907b10e..055c85a1cc46 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -25,3 +25,6 @@ obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
25obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o 25obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
26obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o 26obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o
27obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o 27obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o
28obj-$(CONFIG_MACH_TS219_DT) += board-ts219.o tsx1x-common.o
29obj-$(CONFIG_MACH_GOFLEXNET_DT) += board-goflexnet.o
30obj-$(CONFIG_MACH_LSXL_DT) += board-lsxl.o
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
index 02edbdf5b065..a5717558ee89 100644
--- a/arch/arm/mach-kirkwood/Makefile.boot
+++ b/arch/arm/mach-kirkwood/Makefile.boot
@@ -7,3 +7,7 @@ dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns320.dtb
7dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb 7dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb
8dtb-$(CONFIG_MACH_ICONNECT_DT) += kirkwood-iconnect.dtb 8dtb-$(CONFIG_MACH_ICONNECT_DT) += kirkwood-iconnect.dtb
9dtb-$(CONFIG_MACH_IB62X0_DT) += kirkwood-ib62x0.dtb 9dtb-$(CONFIG_MACH_IB62X0_DT) += kirkwood-ib62x0.dtb
10dtb-$(CONFIG_MACH_TS219_DT) += kirkwood-qnap-ts219.dtb
11dtb-$(CONFIG_MACH_GOFLEXNET_DT) += kirkwood-goflexnet.dtb
12dtb-$(CONFIG_MACH_LSXL_DT) += kirkwood-lschlv2.dtb
13dtb-$(CONFIG_MACH_LSXL_DT) += kirkwood-lsxhl.dtb
diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
index 58c2d68f9443..4ab35065a144 100644
--- a/arch/arm/mach-kirkwood/board-dnskw.c
+++ b/arch/arm/mach-kirkwood/board-dnskw.c
@@ -14,13 +14,11 @@
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/i2c.h>
18#include <linux/ata_platform.h> 17#include <linux/ata_platform.h>
19#include <linux/mv643xx_eth.h> 18#include <linux/mv643xx_eth.h>
20#include <linux/of.h> 19#include <linux/of.h>
21#include <linux/gpio.h> 20#include <linux/gpio.h>
22#include <linux/input.h> 21#include <linux/input.h>
23#include <linux/gpio_keys.h>
24#include <linux/gpio-fan.h> 22#include <linux/gpio-fan.h>
25#include <linux/leds.h> 23#include <linux/leds.h>
26#include <asm/mach-types.h> 24#include <asm/mach-types.h>
@@ -35,10 +33,6 @@ static struct mv643xx_eth_platform_data dnskw_ge00_data = {
35 .phy_addr = MV643XX_ETH_PHY_ADDR(8), 33 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
36}; 34};
37 35
38static struct mv_sata_platform_data dnskw_sata_data = {
39 .n_ports = 2,
40};
41
42static unsigned int dnskw_mpp_config[] __initdata = { 36static unsigned int dnskw_mpp_config[] __initdata = {
43 MPP13_UART1_TXD, /* Custom ... */ 37 MPP13_UART1_TXD, /* Custom ... */
44 MPP14_UART1_RXD, /* ... Controller (DNS-320 only) */ 38 MPP14_UART1_RXD, /* ... Controller (DNS-320 only) */
@@ -73,132 +67,6 @@ static unsigned int dnskw_mpp_config[] __initdata = {
73 0 67 0
74}; 68};
75 69
76static struct gpio_led dns325_led_pins[] = {
77 {
78 .name = "dns325:white:power",
79 .gpio = 26,
80 .active_low = 1,
81 .default_trigger = "default-on",
82 },
83 {
84 .name = "dns325:white:usb",
85 .gpio = 43,
86 .active_low = 1,
87 },
88 {
89 .name = "dns325:red:l_hdd",
90 .gpio = 28,
91 .active_low = 1,
92 },
93 {
94 .name = "dns325:red:r_hdd",
95 .gpio = 27,
96 .active_low = 1,
97 },
98 {
99 .name = "dns325:red:usb",
100 .gpio = 29,
101 .active_low = 1,
102 },
103};
104
105static struct gpio_led_platform_data dns325_led_data = {
106 .num_leds = ARRAY_SIZE(dns325_led_pins),
107 .leds = dns325_led_pins,
108};
109
110static struct platform_device dns325_led_device = {
111 .name = "leds-gpio",
112 .id = -1,
113 .dev = {
114 .platform_data = &dns325_led_data,
115 },
116};
117
118static struct gpio_led dns320_led_pins[] = {
119 {
120 .name = "dns320:blue:power",
121 .gpio = 26,
122 .active_low = 1,
123 .default_trigger = "default-on",
124 },
125 {
126 .name = "dns320:blue:usb",
127 .gpio = 43,
128 .active_low = 1,
129 },
130 {
131 .name = "dns320:orange:l_hdd",
132 .gpio = 28,
133 .active_low = 1,
134 },
135 {
136 .name = "dns320:orange:r_hdd",
137 .gpio = 27,
138 .active_low = 1,
139 },
140 {
141 .name = "dns320:orange:usb",
142 .gpio = 35,
143 .active_low = 1,
144 },
145};
146
147static struct gpio_led_platform_data dns320_led_data = {
148 .num_leds = ARRAY_SIZE(dns320_led_pins),
149 .leds = dns320_led_pins,
150};
151
152static struct platform_device dns320_led_device = {
153 .name = "leds-gpio",
154 .id = -1,
155 .dev = {
156 .platform_data = &dns320_led_data,
157 },
158};
159
160static struct i2c_board_info dns325_i2c_board_info[] __initdata = {
161 {
162 I2C_BOARD_INFO("lm75", 0x48),
163 },
164 /* Something at 0x0c also */
165};
166
167static struct gpio_keys_button dnskw_button_pins[] = {
168 {
169 .code = KEY_POWER,
170 .gpio = 34,
171 .desc = "Power button",
172 .active_low = 1,
173 },
174 {
175 .code = KEY_EJECTCD,
176 .gpio = 47,
177 .desc = "USB unmount button",
178 .active_low = 1,
179 },
180 {
181 .code = KEY_RESTART,
182 .gpio = 48,
183 .desc = "Reset button",
184 .active_low = 1,
185 },
186};
187
188static struct gpio_keys_platform_data dnskw_button_data = {
189 .buttons = dnskw_button_pins,
190 .nbuttons = ARRAY_SIZE(dnskw_button_pins),
191};
192
193static struct platform_device dnskw_button_device = {
194 .name = "gpio-keys",
195 .id = -1,
196 .num_resources = 0,
197 .dev = {
198 .platform_data = &dnskw_button_data,
199 }
200};
201
202/* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */ 70/* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */
203static struct gpio_fan_speed dnskw_fan_speed[] = { 71static struct gpio_fan_speed dnskw_fan_speed[] = {
204 { 0, 0 }, 72 { 0, 0 },
@@ -245,20 +113,9 @@ void __init dnskw_init(void)
245 113
246 kirkwood_ehci_init(); 114 kirkwood_ehci_init();
247 kirkwood_ge00_init(&dnskw_ge00_data); 115 kirkwood_ge00_init(&dnskw_ge00_data);
248 kirkwood_sata_init(&dnskw_sata_data);
249 kirkwood_i2c_init();
250 116
251 platform_device_register(&dnskw_button_device);
252 platform_device_register(&dnskw_fan_device); 117 platform_device_register(&dnskw_fan_device);
253 118
254 if (of_machine_is_compatible("dlink,dns-325")) {
255 i2c_register_board_info(0, dns325_i2c_board_info,
256 ARRAY_SIZE(dns325_i2c_board_info));
257 platform_device_register(&dns325_led_device);
258
259 } else if (of_machine_is_compatible("dlink,dns-320"))
260 platform_device_register(&dns320_led_device);
261
262 /* Register power-off GPIO. */ 119 /* Register power-off GPIO. */
263 if (gpio_request(36, "dnskw:power:off") == 0 120 if (gpio_request(36, "dnskw:power:off") == 0
264 && gpio_direction_output(36, 0) == 0) 121 && gpio_direction_output(36, 0) == 0)
diff --git a/arch/arm/mach-kirkwood/board-dreamplug.c b/arch/arm/mach-kirkwood/board-dreamplug.c
index 55e357ab2923..aeb234d0d0e3 100644
--- a/arch/arm/mach-kirkwood/board-dreamplug.c
+++ b/arch/arm/mach-kirkwood/board-dreamplug.c
@@ -14,7 +14,6 @@
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/partitions.h>
18#include <linux/ata_platform.h> 17#include <linux/ata_platform.h>
19#include <linux/mv643xx_eth.h> 18#include <linux/mv643xx_eth.h>
20#include <linux/of.h> 19#include <linux/of.h>
@@ -23,7 +22,6 @@
23#include <linux/of_irq.h> 22#include <linux/of_irq.h>
24#include <linux/of_platform.h> 23#include <linux/of_platform.h>
25#include <linux/gpio.h> 24#include <linux/gpio.h>
26#include <linux/leds.h>
27#include <linux/mtd/physmap.h> 25#include <linux/mtd/physmap.h>
28#include <linux/spi/flash.h> 26#include <linux/spi/flash.h>
29#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
@@ -36,42 +34,6 @@
36#include "common.h" 34#include "common.h"
37#include "mpp.h" 35#include "mpp.h"
38 36
39struct mtd_partition dreamplug_partitions[] = {
40 {
41 .name = "u-boot",
42 .size = SZ_512K,
43 .offset = 0,
44 },
45 {
46 .name = "u-boot env",
47 .size = SZ_64K,
48 .offset = SZ_512K + SZ_512K,
49 },
50 {
51 .name = "dtb",
52 .size = SZ_64K,
53 .offset = SZ_512K + SZ_512K + SZ_512K,
54 },
55};
56
57static const struct flash_platform_data dreamplug_spi_slave_data = {
58 .type = "mx25l1606e",
59 .name = "spi_flash",
60 .parts = dreamplug_partitions,
61 .nr_parts = ARRAY_SIZE(dreamplug_partitions),
62};
63
64static struct spi_board_info __initdata dreamplug_spi_slave_info[] = {
65 {
66 .modalias = "m25p80",
67 .platform_data = &dreamplug_spi_slave_data,
68 .irq = -1,
69 .max_speed_hz = 50000000,
70 .bus_num = 0,
71 .chip_select = 0,
72 },
73};
74
75static struct mv643xx_eth_platform_data dreamplug_ge00_data = { 37static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
76 .phy_addr = MV643XX_ETH_PHY_ADDR(0), 38 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
77}; 39};
@@ -80,45 +42,10 @@ static struct mv643xx_eth_platform_data dreamplug_ge01_data = {
80 .phy_addr = MV643XX_ETH_PHY_ADDR(1), 42 .phy_addr = MV643XX_ETH_PHY_ADDR(1),
81}; 43};
82 44
83static struct mv_sata_platform_data dreamplug_sata_data = {
84 .n_ports = 1,
85};
86
87static struct mvsdio_platform_data dreamplug_mvsdio_data = { 45static struct mvsdio_platform_data dreamplug_mvsdio_data = {
88 /* unfortunately the CD signal has not been connected */ 46 /* unfortunately the CD signal has not been connected */
89}; 47};
90 48
91static struct gpio_led dreamplug_led_pins[] = {
92 {
93 .name = "dreamplug:blue:bluetooth",
94 .gpio = 47,
95 .active_low = 1,
96 },
97 {
98 .name = "dreamplug:green:wifi",
99 .gpio = 48,
100 .active_low = 1,
101 },
102 {
103 .name = "dreamplug:green:wifi_ap",
104 .gpio = 49,
105 .active_low = 1,
106 },
107};
108
109static struct gpio_led_platform_data dreamplug_led_data = {
110 .leds = dreamplug_led_pins,
111 .num_leds = ARRAY_SIZE(dreamplug_led_pins),
112};
113
114static struct platform_device dreamplug_leds = {
115 .name = "leds-gpio",
116 .id = -1,
117 .dev = {
118 .platform_data = &dreamplug_led_data,
119 }
120};
121
122static unsigned int dreamplug_mpp_config[] __initdata = { 49static unsigned int dreamplug_mpp_config[] __initdata = {
123 MPP0_SPI_SCn, 50 MPP0_SPI_SCn,
124 MPP1_SPI_MOSI, 51 MPP1_SPI_MOSI,
@@ -137,15 +64,8 @@ void __init dreamplug_init(void)
137 */ 64 */
138 kirkwood_mpp_conf(dreamplug_mpp_config); 65 kirkwood_mpp_conf(dreamplug_mpp_config);
139 66
140 spi_register_board_info(dreamplug_spi_slave_info,
141 ARRAY_SIZE(dreamplug_spi_slave_info));
142 kirkwood_spi_init();
143
144 kirkwood_ehci_init(); 67 kirkwood_ehci_init();
145 kirkwood_ge00_init(&dreamplug_ge00_data); 68 kirkwood_ge00_init(&dreamplug_ge00_data);
146 kirkwood_ge01_init(&dreamplug_ge01_data); 69 kirkwood_ge01_init(&dreamplug_ge01_data);
147 kirkwood_sata_init(&dreamplug_sata_data);
148 kirkwood_sdio_init(&dreamplug_mvsdio_data); 70 kirkwood_sdio_init(&dreamplug_mvsdio_data);
149
150 platform_device_register(&dreamplug_leds);
151} 71}
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index edc3f8a9d45e..e4eb450de301 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -18,6 +18,7 @@
18#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
19#include <asm/mach/map.h> 19#include <asm/mach/map.h>
20#include <mach/bridge-regs.h> 20#include <mach/bridge-regs.h>
21#include <plat/irq.h>
21#include "common.h" 22#include "common.h"
22 23
23static struct of_device_id kirkwood_dt_match_table[] __initdata = { 24static struct of_device_id kirkwood_dt_match_table[] __initdata = {
@@ -25,6 +26,16 @@ static struct of_device_id kirkwood_dt_match_table[] __initdata = {
25 { } 26 { }
26}; 27};
27 28
29struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = {
30 OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL),
31 OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0",
32 NULL),
33 OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL),
34 OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL),
35 OF_DEV_AUXDATA("marvell,orion-nand", 0xf4000000, "orion_nand", NULL),
36 {},
37};
38
28static void __init kirkwood_dt_init(void) 39static void __init kirkwood_dt_init(void)
29{ 40{
30 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk); 41 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
@@ -47,7 +58,6 @@ static void __init kirkwood_dt_init(void)
47 kirkwood_clk_init(); 58 kirkwood_clk_init();
48 59
49 /* internal devices that every board has */ 60 /* internal devices that every board has */
50 kirkwood_wdt_init();
51 kirkwood_xor0_init(); 61 kirkwood_xor0_init();
52 kirkwood_xor1_init(); 62 kirkwood_xor1_init();
53 kirkwood_crypto_init(); 63 kirkwood_crypto_init();
@@ -68,7 +78,17 @@ static void __init kirkwood_dt_init(void)
68 if (of_machine_is_compatible("raidsonic,ib-nas62x0")) 78 if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
69 ib62x0_init(); 79 ib62x0_init();
70 80
71 of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL); 81 if (of_machine_is_compatible("qnap,ts219"))
82 qnap_dt_ts219_init();
83
84 if (of_machine_is_compatible("seagate,goflexnet"))
85 goflexnet_init();
86
87 if (of_machine_is_compatible("buffalo,lsxl"))
88 lsxl_init();
89
90 of_platform_populate(NULL, kirkwood_dt_match_table,
91 kirkwood_auxdata_lookup, NULL);
72} 92}
73 93
74static const char *kirkwood_dt_board_compat[] = { 94static const char *kirkwood_dt_board_compat[] = {
@@ -77,6 +97,9 @@ static const char *kirkwood_dt_board_compat[] = {
77 "dlink,dns-325", 97 "dlink,dns-325",
78 "iom,iconnect", 98 "iom,iconnect",
79 "raidsonic,ib-nas62x0", 99 "raidsonic,ib-nas62x0",
100 "qnap,ts219",
101 "seagate,goflexnet",
102 "buffalo,lsxl",
80 NULL 103 NULL
81}; 104};
82 105
@@ -84,7 +107,7 @@ DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
84 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */ 107 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
85 .map_io = kirkwood_map_io, 108 .map_io = kirkwood_map_io,
86 .init_early = kirkwood_init_early, 109 .init_early = kirkwood_init_early,
87 .init_irq = kirkwood_init_irq, 110 .init_irq = orion_dt_init_irq,
88 .timer = &kirkwood_timer, 111 .timer = &kirkwood_timer,
89 .init_machine = kirkwood_dt_init, 112 .init_machine = kirkwood_dt_init,
90 .restart = kirkwood_restart, 113 .restart = kirkwood_restart,
diff --git a/arch/arm/mach-kirkwood/board-goflexnet.c b/arch/arm/mach-kirkwood/board-goflexnet.c
new file mode 100644
index 000000000000..413e2c8ef5fe
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-goflexnet.c
@@ -0,0 +1,71 @@
1/*
2 * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
3 *
4 * arch/arm/mach-kirkwood/board-goflexnet.c
5 *
6 * Seagate GoFlext Net Board Init for drivers not converted to
7 * flattened device tree yet.
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 *
13 * Copied and modified for Seagate GoFlex Net support by
14 * Joshua Coombs <josh.coombs@gmail.com> based on ArchLinux ARM's
15 * GoFlex kernel patches.
16 *
17 */
18
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/platform_device.h>
22#include <linux/ata_platform.h>
23#include <linux/mv643xx_eth.h>
24#include <linux/of.h>
25#include <linux/of_address.h>
26#include <linux/of_fdt.h>
27#include <linux/of_irq.h>
28#include <linux/of_platform.h>
29#include <linux/gpio.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33#include <mach/kirkwood.h>
34#include <mach/bridge-regs.h>
35#include <plat/mvsdio.h>
36#include "common.h"
37#include "mpp.h"
38
39static struct mv643xx_eth_platform_data goflexnet_ge00_data = {
40 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
41};
42
43static unsigned int goflexnet_mpp_config[] __initdata = {
44 MPP29_GPIO, /* USB Power Enable */
45 MPP47_GPIO, /* LED Orange */
46 MPP46_GPIO, /* LED Green */
47 MPP45_GPIO, /* LED Left Capacity 3 */
48 MPP44_GPIO, /* LED Left Capacity 2 */
49 MPP43_GPIO, /* LED Left Capacity 1 */
50 MPP42_GPIO, /* LED Left Capacity 0 */
51 MPP41_GPIO, /* LED Right Capacity 3 */
52 MPP40_GPIO, /* LED Right Capacity 2 */
53 MPP39_GPIO, /* LED Right Capacity 1 */
54 MPP38_GPIO, /* LED Right Capacity 0 */
55 0
56};
57
58void __init goflexnet_init(void)
59{
60 /*
61 * Basic setup. Needs to be called early.
62 */
63 kirkwood_mpp_conf(goflexnet_mpp_config);
64
65 if (gpio_request(29, "USB Power Enable") != 0 ||
66 gpio_direction_output(29, 1) != 0)
67 pr_err("can't setup GPIO 29 (USB Power Enable)\n");
68 kirkwood_ehci_init();
69
70 kirkwood_ge00_init(&goflexnet_ge00_data);
71}
diff --git a/arch/arm/mach-kirkwood/board-ib62x0.c b/arch/arm/mach-kirkwood/board-ib62x0.c
index eddf1df8891f..cfc47f80e734 100644
--- a/arch/arm/mach-kirkwood/board-ib62x0.c
+++ b/arch/arm/mach-kirkwood/board-ib62x0.c
@@ -18,9 +18,7 @@
18#include <linux/ata_platform.h> 18#include <linux/ata_platform.h>
19#include <linux/mv643xx_eth.h> 19#include <linux/mv643xx_eth.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <linux/gpio_keys.h>
22#include <linux/input.h> 21#include <linux/input.h>
23#include <linux/leds.h>
24#include <asm/mach-types.h> 22#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
26#include <mach/kirkwood.h> 24#include <mach/kirkwood.h>
@@ -33,10 +31,6 @@ static struct mv643xx_eth_platform_data ib62x0_ge00_data = {
33 .phy_addr = MV643XX_ETH_PHY_ADDR(8), 31 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
34}; 32};
35 33
36static struct mv_sata_platform_data ib62x0_sata_data = {
37 .n_ports = 2,
38};
39
40static unsigned int ib62x0_mpp_config[] __initdata = { 34static unsigned int ib62x0_mpp_config[] __initdata = {
41 MPP0_NF_IO2, 35 MPP0_NF_IO2,
42 MPP1_NF_IO3, 36 MPP1_NF_IO3,
@@ -55,69 +49,6 @@ static unsigned int ib62x0_mpp_config[] __initdata = {
55 0 49 0
56}; 50};
57 51
58static struct gpio_led ib62x0_led_pins[] = {
59 {
60 .name = "ib62x0:green:os",
61 .default_trigger = "default-on",
62 .gpio = 25,
63 .active_low = 0,
64 },
65 {
66 .name = "ib62x0:red:os",
67 .default_trigger = "none",
68 .gpio = 22,
69 .active_low = 0,
70 },
71 {
72 .name = "ib62x0:red:usb_copy",
73 .default_trigger = "none",
74 .gpio = 27,
75 .active_low = 0,
76 },
77};
78
79static struct gpio_led_platform_data ib62x0_led_data = {
80 .leds = ib62x0_led_pins,
81 .num_leds = ARRAY_SIZE(ib62x0_led_pins),
82};
83
84static struct platform_device ib62x0_led_device = {
85 .name = "leds-gpio",
86 .id = -1,
87 .dev = {
88 .platform_data = &ib62x0_led_data,
89 }
90};
91
92static struct gpio_keys_button ib62x0_button_pins[] = {
93 {
94 .code = KEY_COPY,
95 .gpio = 29,
96 .desc = "USB Copy",
97 .active_low = 1,
98 },
99 {
100 .code = KEY_RESTART,
101 .gpio = 28,
102 .desc = "Reset",
103 .active_low = 1,
104 },
105};
106
107static struct gpio_keys_platform_data ib62x0_button_data = {
108 .buttons = ib62x0_button_pins,
109 .nbuttons = ARRAY_SIZE(ib62x0_button_pins),
110};
111
112static struct platform_device ib62x0_button_device = {
113 .name = "gpio-keys",
114 .id = -1,
115 .num_resources = 0,
116 .dev = {
117 .platform_data = &ib62x0_button_data,
118 }
119};
120
121static void ib62x0_power_off(void) 52static void ib62x0_power_off(void)
122{ 53{
123 gpio_set_value(IB62X0_GPIO_POWER_OFF, 1); 54 gpio_set_value(IB62X0_GPIO_POWER_OFF, 1);
@@ -132,9 +63,6 @@ void __init ib62x0_init(void)
132 63
133 kirkwood_ehci_init(); 64 kirkwood_ehci_init();
134 kirkwood_ge00_init(&ib62x0_ge00_data); 65 kirkwood_ge00_init(&ib62x0_ge00_data);
135 kirkwood_sata_init(&ib62x0_sata_data);
136 platform_device_register(&ib62x0_led_device);
137 platform_device_register(&ib62x0_button_device);
138 if (gpio_request(IB62X0_GPIO_POWER_OFF, "ib62x0:power:off") == 0 && 66 if (gpio_request(IB62X0_GPIO_POWER_OFF, "ib62x0:power:off") == 0 &&
139 gpio_direction_output(IB62X0_GPIO_POWER_OFF, 0) == 0) 67 gpio_direction_output(IB62X0_GPIO_POWER_OFF, 0) == 0)
140 pm_power_off = ib62x0_power_off; 68 pm_power_off = ib62x0_power_off;
diff --git a/arch/arm/mach-kirkwood/board-iconnect.c b/arch/arm/mach-kirkwood/board-iconnect.c
index b0d3cc49269d..d7a9198ed300 100644
--- a/arch/arm/mach-kirkwood/board-iconnect.c
+++ b/arch/arm/mach-kirkwood/board-iconnect.c
@@ -19,8 +19,6 @@
19#include <linux/mtd/partitions.h> 19#include <linux/mtd/partitions.h>
20#include <linux/mv643xx_eth.h> 20#include <linux/mv643xx_eth.h>
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <linux/leds.h>
23#include <linux/i2c.h>
24#include <linux/input.h> 22#include <linux/input.h>
25#include <linux/gpio_keys.h> 23#include <linux/gpio_keys.h>
26#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
@@ -32,50 +30,6 @@ static struct mv643xx_eth_platform_data iconnect_ge00_data = {
32 .phy_addr = MV643XX_ETH_PHY_ADDR(11), 30 .phy_addr = MV643XX_ETH_PHY_ADDR(11),
33}; 31};
34 32
35static struct gpio_led iconnect_led_pins[] = {
36 {
37 .name = "led_level",
38 .gpio = 41,
39 .default_trigger = "default-on",
40 }, {
41 .name = "power:blue",
42 .gpio = 42,
43 .default_trigger = "timer",
44 }, {
45 .name = "power:red",
46 .gpio = 43,
47 }, {
48 .name = "usb1:blue",
49 .gpio = 44,
50 }, {
51 .name = "usb2:blue",
52 .gpio = 45,
53 }, {
54 .name = "usb3:blue",
55 .gpio = 46,
56 }, {
57 .name = "usb4:blue",
58 .gpio = 47,
59 }, {
60 .name = "otb:blue",
61 .gpio = 48,
62 },
63};
64
65static struct gpio_led_platform_data iconnect_led_data = {
66 .leds = iconnect_led_pins,
67 .num_leds = ARRAY_SIZE(iconnect_led_pins),
68 .gpio_blink_set = orion_gpio_led_blink_set,
69};
70
71static struct platform_device iconnect_leds = {
72 .name = "leds-gpio",
73 .id = -1,
74 .dev = {
75 .platform_data = &iconnect_led_data,
76 }
77};
78
79static unsigned int iconnect_mpp_config[] __initdata = { 33static unsigned int iconnect_mpp_config[] __initdata = {
80 MPP12_GPIO, 34 MPP12_GPIO,
81 MPP35_GPIO, 35 MPP35_GPIO,
@@ -90,12 +44,6 @@ static unsigned int iconnect_mpp_config[] __initdata = {
90 0 44 0
91}; 45};
92 46
93static struct i2c_board_info __initdata iconnect_board_info[] = {
94 {
95 I2C_BOARD_INFO("lm63", 0x4c),
96 },
97};
98
99static struct mtd_partition iconnect_nand_parts[] = { 47static struct mtd_partition iconnect_nand_parts[] = {
100 { 48 {
101 .name = "flash", 49 .name = "flash",
@@ -142,15 +90,11 @@ void __init iconnect_init(void)
142{ 90{
143 kirkwood_mpp_conf(iconnect_mpp_config); 91 kirkwood_mpp_conf(iconnect_mpp_config);
144 kirkwood_nand_init(ARRAY_AND_SIZE(iconnect_nand_parts), 25); 92 kirkwood_nand_init(ARRAY_AND_SIZE(iconnect_nand_parts), 25);
145 kirkwood_i2c_init();
146 i2c_register_board_info(0, iconnect_board_info,
147 ARRAY_SIZE(iconnect_board_info));
148 93
149 kirkwood_ehci_init(); 94 kirkwood_ehci_init();
150 kirkwood_ge00_init(&iconnect_ge00_data); 95 kirkwood_ge00_init(&iconnect_ge00_data);
151 96
152 platform_device_register(&iconnect_button_device); 97 platform_device_register(&iconnect_button_device);
153 platform_device_register(&iconnect_leds);
154} 98}
155 99
156static int __init iconnect_pci_init(void) 100static int __init iconnect_pci_init(void)
diff --git a/arch/arm/mach-kirkwood/board-lsxl.c b/arch/arm/mach-kirkwood/board-lsxl.c
new file mode 100644
index 000000000000..83d8975592f8
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-lsxl.c
@@ -0,0 +1,135 @@
1/*
2 * Copyright 2012 (C), Michael Walle <michael@walle.cc>
3 *
4 * arch/arm/mach-kirkwood/board-lsxl.c
5 *
6 * Buffalo Linkstation LS-XHL and LS-CHLv2 init for drivers not
7 * converted to flattened device tree yet.
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/mtd/partitions.h>
18#include <linux/ata_platform.h>
19#include <linux/spi/flash.h>
20#include <linux/spi/spi.h>
21#include <linux/mv643xx_eth.h>
22#include <linux/gpio.h>
23#include <linux/gpio-fan.h>
24#include <linux/input.h>
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27#include <mach/kirkwood.h>
28#include "common.h"
29#include "mpp.h"
30
31static struct mv643xx_eth_platform_data lsxl_ge00_data = {
32 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
33};
34
35static struct mv643xx_eth_platform_data lsxl_ge01_data = {
36 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
37};
38
39static unsigned int lsxl_mpp_config[] __initdata = {
40 MPP10_GPO, /* HDD Power Enable */
41 MPP11_GPIO, /* USB Vbus Enable */
42 MPP18_GPO, /* FAN High Enable# */
43 MPP19_GPO, /* FAN Low Enable# */
44 MPP36_GPIO, /* Function Blue LED */
45 MPP37_GPIO, /* Alarm LED */
46 MPP38_GPIO, /* Info LED */
47 MPP39_GPIO, /* Power LED */
48 MPP40_GPIO, /* Fan Lock */
49 MPP41_GPIO, /* Function Button */
50 MPP42_GPIO, /* Power Switch */
51 MPP43_GPIO, /* Power Auto Switch */
52 MPP48_GPIO, /* Function Red LED */
53 0
54};
55
56#define LSXL_GPIO_FAN_HIGH 18
57#define LSXL_GPIO_FAN_LOW 19
58#define LSXL_GPIO_FAN_LOCK 40
59
60static struct gpio_fan_alarm lsxl_alarm = {
61 .gpio = LSXL_GPIO_FAN_LOCK,
62};
63
64static struct gpio_fan_speed lsxl_speeds[] = {
65 {
66 .rpm = 0,
67 .ctrl_val = 3,
68 }, {
69 .rpm = 1500,
70 .ctrl_val = 1,
71 }, {
72 .rpm = 3250,
73 .ctrl_val = 2,
74 }, {
75 .rpm = 5000,
76 .ctrl_val = 0,
77 }
78};
79
80static int lsxl_gpio_list[] = {
81 LSXL_GPIO_FAN_HIGH, LSXL_GPIO_FAN_LOW,
82};
83
84static struct gpio_fan_platform_data lsxl_fan_data = {
85 .num_ctrl = ARRAY_SIZE(lsxl_gpio_list),
86 .ctrl = lsxl_gpio_list,
87 .alarm = &lsxl_alarm,
88 .num_speed = ARRAY_SIZE(lsxl_speeds),
89 .speed = lsxl_speeds,
90};
91
92static struct platform_device lsxl_fan_device = {
93 .name = "gpio-fan",
94 .id = -1,
95 .num_resources = 0,
96 .dev = {
97 .platform_data = &lsxl_fan_data,
98 },
99};
100
101/*
102 * On the LS-XHL/LS-CHLv2, the shutdown process is following:
103 * - Userland monitors key events until the power switch goes to off position
104 * - The board reboots
105 * - U-boot starts and goes into an idle mode waiting for the user
106 * to move the switch to ON position
107 *
108 */
109static void lsxl_power_off(void)
110{
111 kirkwood_restart('h', NULL);
112}
113
114#define LSXL_GPIO_HDD_POWER 10
115#define LSXL_GPIO_USB_POWER 11
116
117void __init lsxl_init(void)
118{
119 /*
120 * Basic setup. Needs to be called early.
121 */
122 kirkwood_mpp_conf(lsxl_mpp_config);
123
124 /* usb and sata power on */
125 gpio_set_value(LSXL_GPIO_USB_POWER, 1);
126 gpio_set_value(LSXL_GPIO_HDD_POWER, 1);
127
128 kirkwood_ehci_init();
129 kirkwood_ge00_init(&lsxl_ge00_data);
130 kirkwood_ge01_init(&lsxl_ge01_data);
131 platform_device_register(&lsxl_fan_device);
132
133 /* register power-off method */
134 pm_power_off = lsxl_power_off;
135}
diff --git a/arch/arm/mach-kirkwood/board-ts219.c b/arch/arm/mach-kirkwood/board-ts219.c
new file mode 100644
index 000000000000..1750e68506c1
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-ts219.c
@@ -0,0 +1,82 @@
1/*
2 *
3 * QNAP TS-11x/TS-21x Turbo NAS Board Setup via DT
4 *
5 * Copyright (C) 2012 Andrew Lunn <andrew@lunn.ch>
6 *
7 * Based on the board file ts219-setup.c:
8 *
9 * Copyright (C) 2009 Martin Michlmayr <tbm@cyrius.com>
10 * Copyright (C) 2008 Byron Bradley <byron.bbradley@gmail.com>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/platform_device.h>
21#include <linux/mv643xx_eth.h>
22#include <linux/ata_platform.h>
23#include <linux/gpio_keys.h>
24#include <linux/input.h>
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27#include <mach/kirkwood.h>
28#include "common.h"
29#include "mpp.h"
30#include "tsx1x-common.h"
31
32static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = {
33 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
34};
35
36static unsigned int qnap_ts219_mpp_config[] __initdata = {
37 MPP0_SPI_SCn,
38 MPP1_SPI_MOSI,
39 MPP2_SPI_SCK,
40 MPP3_SPI_MISO,
41 MPP4_SATA1_ACTn,
42 MPP5_SATA0_ACTn,
43 MPP8_TW0_SDA,
44 MPP9_TW0_SCK,
45 MPP10_UART0_TXD,
46 MPP11_UART0_RXD,
47 MPP13_UART1_TXD, /* PIC controller */
48 MPP14_UART1_RXD, /* PIC controller */
49 MPP15_GPIO, /* USB Copy button (on devices with 88F6281) */
50 MPP16_GPIO, /* Reset button (on devices with 88F6281) */
51 MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */
52 MPP37_GPIO, /* Reset button (on devices with 88F6282) */
53 MPP43_GPIO, /* USB Copy button (on devices with 88F6282) */
54 MPP44_GPIO, /* Board ID: 0: TS-11x, 1: TS-21x */
55 0
56};
57
58void __init qnap_dt_ts219_init(void)
59{
60 u32 dev, rev;
61
62 kirkwood_mpp_conf(qnap_ts219_mpp_config);
63
64 kirkwood_pcie_id(&dev, &rev);
65 if (dev == MV88F6282_DEV_ID)
66 qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
67
68 kirkwood_ge00_init(&qnap_ts219_ge00_data);
69 kirkwood_ehci_init();
70
71 pm_power_off = qnap_tsx1x_power_off;
72}
73
74/* FIXME: Will not work with DT. Maybe use MPP40_GPIO? */
75static int __init ts219_pci_init(void)
76{
77 if (machine_is_ts219())
78 kirkwood_pcie_init(KW_PCIE0);
79
80 return 0;
81}
82subsys_initcall(ts219_pci_init);
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 55e4d7937964..31d9f400ed82 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -17,6 +17,7 @@
17#include <linux/dma-mapping.h> 17#include <linux/dma-mapping.h>
18#include <linux/clk-provider.h> 18#include <linux/clk-provider.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/mv643xx_i2c.h>
20#include <net/dsa.h> 21#include <net/dsa.h>
21#include <asm/page.h> 22#include <asm/page.h>
22#include <asm/timex.h> 23#include <asm/timex.h>
@@ -57,6 +58,14 @@ void __init kirkwood_map_io(void)
57 * CLK tree 58 * CLK tree
58 ****************************************************************************/ 59 ****************************************************************************/
59 60
61static void enable_sata0(void)
62{
63 /* Enable PLL and IVREF */
64 writel(readl(SATA0_PHY_MODE_2) | 0xf, SATA0_PHY_MODE_2);
65 /* Enable PHY */
66 writel(readl(SATA0_IF_CTRL) & ~0x200, SATA0_IF_CTRL);
67}
68
60static void disable_sata0(void) 69static void disable_sata0(void)
61{ 70{
62 /* Disable PLL and IVREF */ 71 /* Disable PLL and IVREF */
@@ -65,6 +74,14 @@ static void disable_sata0(void)
65 writel(readl(SATA0_IF_CTRL) | 0x200, SATA0_IF_CTRL); 74 writel(readl(SATA0_IF_CTRL) | 0x200, SATA0_IF_CTRL);
66} 75}
67 76
77static void enable_sata1(void)
78{
79 /* Enable PLL and IVREF */
80 writel(readl(SATA1_PHY_MODE_2) | 0xf, SATA1_PHY_MODE_2);
81 /* Enable PHY */
82 writel(readl(SATA1_IF_CTRL) & ~0x200, SATA1_IF_CTRL);
83}
84
68static void disable_sata1(void) 85static void disable_sata1(void)
69{ 86{
70 /* Disable PLL and IVREF */ 87 /* Disable PLL and IVREF */
@@ -97,23 +114,38 @@ static void disable_pcie1(void)
97 } 114 }
98} 115}
99 116
100/* An extended version of the gated clk. This calls fn() before 117/* An extended version of the gated clk. This calls fn_en()/fn_dis
101 * disabling the clock. We use this to turn off PHYs etc. */ 118 * before enabling/disabling the clock. We use this to turn on/off
119 * PHYs etc. */
102struct clk_gate_fn { 120struct clk_gate_fn {
103 struct clk_gate gate; 121 struct clk_gate gate;
104 void (*fn)(void); 122 void (*fn_en)(void);
123 void (*fn_dis)(void);
105}; 124};
106 125
107#define to_clk_gate_fn(_gate) container_of(_gate, struct clk_gate_fn, gate) 126#define to_clk_gate_fn(_gate) container_of(_gate, struct clk_gate_fn, gate)
108#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw) 127#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw)
109 128
129static int clk_gate_fn_enable(struct clk_hw *hw)
130{
131 struct clk_gate *gate = to_clk_gate(hw);
132 struct clk_gate_fn *gate_fn = to_clk_gate_fn(gate);
133 int ret;
134
135 ret = clk_gate_ops.enable(hw);
136 if (!ret && gate_fn->fn_en)
137 gate_fn->fn_en();
138
139 return ret;
140}
141
110static void clk_gate_fn_disable(struct clk_hw *hw) 142static void clk_gate_fn_disable(struct clk_hw *hw)
111{ 143{
112 struct clk_gate *gate = to_clk_gate(hw); 144 struct clk_gate *gate = to_clk_gate(hw);
113 struct clk_gate_fn *gate_fn = to_clk_gate_fn(gate); 145 struct clk_gate_fn *gate_fn = to_clk_gate_fn(gate);
114 146
115 if (gate_fn->fn) 147 if (gate_fn->fn_dis)
116 gate_fn->fn(); 148 gate_fn->fn_dis();
117 149
118 clk_gate_ops.disable(hw); 150 clk_gate_ops.disable(hw);
119} 151}
@@ -125,7 +157,7 @@ static struct clk __init *clk_register_gate_fn(struct device *dev,
125 const char *parent_name, unsigned long flags, 157 const char *parent_name, unsigned long flags,
126 void __iomem *reg, u8 bit_idx, 158 void __iomem *reg, u8 bit_idx,
127 u8 clk_gate_flags, spinlock_t *lock, 159 u8 clk_gate_flags, spinlock_t *lock,
128 void (*fn)(void)) 160 void (*fn_en)(void), void (*fn_dis)(void))
129{ 161{
130 struct clk_gate_fn *gate_fn; 162 struct clk_gate_fn *gate_fn;
131 struct clk *clk; 163 struct clk *clk;
@@ -149,11 +181,14 @@ static struct clk __init *clk_register_gate_fn(struct device *dev,
149 gate_fn->gate.flags = clk_gate_flags; 181 gate_fn->gate.flags = clk_gate_flags;
150 gate_fn->gate.lock = lock; 182 gate_fn->gate.lock = lock;
151 gate_fn->gate.hw.init = &init; 183 gate_fn->gate.hw.init = &init;
152 gate_fn->fn = fn; 184 gate_fn->fn_en = fn_en;
185 gate_fn->fn_dis = fn_dis;
153 186
154 /* ops is the gate ops, but with our disable function */ 187 /* ops is the gate ops, but with our enable/disable functions */
155 if (clk_gate_fn_ops.disable != clk_gate_fn_disable) { 188 if (clk_gate_fn_ops.enable != clk_gate_fn_enable ||
189 clk_gate_fn_ops.disable != clk_gate_fn_disable) {
156 clk_gate_fn_ops = clk_gate_ops; 190 clk_gate_fn_ops = clk_gate_ops;
191 clk_gate_fn_ops.enable = clk_gate_fn_enable;
157 clk_gate_fn_ops.disable = clk_gate_fn_disable; 192 clk_gate_fn_ops.disable = clk_gate_fn_disable;
158 } 193 }
159 194
@@ -177,11 +212,12 @@ static struct clk __init *kirkwood_register_gate(const char *name, u8 bit_idx)
177 212
178static struct clk __init *kirkwood_register_gate_fn(const char *name, 213static struct clk __init *kirkwood_register_gate_fn(const char *name,
179 u8 bit_idx, 214 u8 bit_idx,
180 void (*fn)(void)) 215 void (*fn_en)(void),
216 void (*fn_dis)(void))
181{ 217{
182 return clk_register_gate_fn(NULL, name, "tclk", 0, 218 return clk_register_gate_fn(NULL, name, "tclk", 0,
183 (void __iomem *)CLOCK_GATING_CTRL, 219 (void __iomem *)CLOCK_GATING_CTRL,
184 bit_idx, 0, &gating_lock, fn); 220 bit_idx, 0, &gating_lock, fn_en, fn_dis);
185} 221}
186 222
187static struct clk *ge0, *ge1; 223static struct clk *ge0, *ge1;
@@ -198,18 +234,18 @@ void __init kirkwood_clk_init(void)
198 ge0 = kirkwood_register_gate("ge0", CGC_BIT_GE0); 234 ge0 = kirkwood_register_gate("ge0", CGC_BIT_GE0);
199 ge1 = kirkwood_register_gate("ge1", CGC_BIT_GE1); 235 ge1 = kirkwood_register_gate("ge1", CGC_BIT_GE1);
200 sata0 = kirkwood_register_gate_fn("sata0", CGC_BIT_SATA0, 236 sata0 = kirkwood_register_gate_fn("sata0", CGC_BIT_SATA0,
201 disable_sata0); 237 enable_sata0, disable_sata0);
202 sata1 = kirkwood_register_gate_fn("sata1", CGC_BIT_SATA1, 238 sata1 = kirkwood_register_gate_fn("sata1", CGC_BIT_SATA1,
203 disable_sata1); 239 enable_sata1, disable_sata1);
204 usb0 = kirkwood_register_gate("usb0", CGC_BIT_USB0); 240 usb0 = kirkwood_register_gate("usb0", CGC_BIT_USB0);
205 sdio = kirkwood_register_gate("sdio", CGC_BIT_SDIO); 241 sdio = kirkwood_register_gate("sdio", CGC_BIT_SDIO);
206 crypto = kirkwood_register_gate("crypto", CGC_BIT_CRYPTO); 242 crypto = kirkwood_register_gate("crypto", CGC_BIT_CRYPTO);
207 xor0 = kirkwood_register_gate("xor0", CGC_BIT_XOR0); 243 xor0 = kirkwood_register_gate("xor0", CGC_BIT_XOR0);
208 xor1 = kirkwood_register_gate("xor1", CGC_BIT_XOR1); 244 xor1 = kirkwood_register_gate("xor1", CGC_BIT_XOR1);
209 pex0 = kirkwood_register_gate_fn("pex0", CGC_BIT_PEX0, 245 pex0 = kirkwood_register_gate_fn("pex0", CGC_BIT_PEX0,
210 disable_pcie0); 246 NULL, disable_pcie0);
211 pex1 = kirkwood_register_gate_fn("pex1", CGC_BIT_PEX1, 247 pex1 = kirkwood_register_gate_fn("pex1", CGC_BIT_PEX1,
212 disable_pcie1); 248 NULL, disable_pcie1);
213 audio = kirkwood_register_gate("audio", CGC_BIT_AUDIO); 249 audio = kirkwood_register_gate("audio", CGC_BIT_AUDIO);
214 kirkwood_register_gate("tdm", CGC_BIT_TDM); 250 kirkwood_register_gate("tdm", CGC_BIT_TDM);
215 kirkwood_register_gate("tsu", CGC_BIT_TSU); 251 kirkwood_register_gate("tsu", CGC_BIT_TSU);
@@ -231,6 +267,12 @@ void __init kirkwood_clk_init(void)
231 orion_clkdev_add("0", "pcie", pex0); 267 orion_clkdev_add("0", "pcie", pex0);
232 orion_clkdev_add("1", "pcie", pex1); 268 orion_clkdev_add("1", "pcie", pex1);
233 orion_clkdev_add(NULL, "kirkwood-i2s", audio); 269 orion_clkdev_add(NULL, "kirkwood-i2s", audio);
270 orion_clkdev_add(NULL, MV64XXX_I2C_CTLR_NAME ".0", runit);
271
272 /* Marvell says runit is used by SPI, UART, NAND, TWSI, ...,
273 * so should never be gated.
274 */
275 clk_prepare_enable(runit);
234} 276}
235 277
236/***************************************************************************** 278/*****************************************************************************
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 9248fa2c165b..304dd1abfdca 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -58,6 +58,11 @@ void dreamplug_init(void);
58#else 58#else
59static inline void dreamplug_init(void) {}; 59static inline void dreamplug_init(void) {};
60#endif 60#endif
61#ifdef CONFIG_MACH_TS219_DT
62void qnap_dt_ts219_init(void);
63#else
64static inline void qnap_dt_ts219_init(void) {};
65#endif
61 66
62#ifdef CONFIG_MACH_DLINK_KIRKWOOD_DT 67#ifdef CONFIG_MACH_DLINK_KIRKWOOD_DT
63void dnskw_init(void); 68void dnskw_init(void);
@@ -77,6 +82,18 @@ void ib62x0_init(void);
77static inline void ib62x0_init(void) {}; 82static inline void ib62x0_init(void) {};
78#endif 83#endif
79 84
85#ifdef CONFIG_MACH_GOFLEXNET_DT
86void goflexnet_init(void);
87#else
88static inline void goflexnet_init(void) {};
89#endif
90
91#ifdef CONFIG_MACH_LSXL_DT
92void lsxl_init(void);
93#else
94static inline void lsxl_init(void) {};
95#endif
96
80/* early init functions not converted to fdt yet */ 97/* early init functions not converted to fdt yet */
81char *kirkwood_id(void); 98char *kirkwood_id(void);
82void kirkwood_l2_init(void); 99void kirkwood_l2_init(void);
diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c
index c4c68e5b94f1..720063ffa19d 100644
--- a/arch/arm/mach-kirkwood/irq.c
+++ b/arch/arm/mach-kirkwood/irq.c
@@ -9,20 +9,23 @@
9 */ 9 */
10#include <linux/gpio.h> 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/irq.h> 12#include <linux/irq.h>
14#include <linux/io.h>
15#include <mach/bridge-regs.h> 13#include <mach/bridge-regs.h>
16#include <plat/irq.h> 14#include <plat/irq.h>
17#include "common.h"
18 15
19static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) 16static int __initdata gpio0_irqs[4] = {
20{ 17 IRQ_KIRKWOOD_GPIO_LOW_0_7,
21 BUG_ON(irq < IRQ_KIRKWOOD_GPIO_LOW_0_7); 18 IRQ_KIRKWOOD_GPIO_LOW_8_15,
22 BUG_ON(irq > IRQ_KIRKWOOD_GPIO_HIGH_16_23); 19 IRQ_KIRKWOOD_GPIO_LOW_16_23,
20 IRQ_KIRKWOOD_GPIO_LOW_24_31,
21};
23 22
24 orion_gpio_irq_handler((irq - IRQ_KIRKWOOD_GPIO_LOW_0_7) << 3); 23static int __initdata gpio1_irqs[4] = {
25} 24 IRQ_KIRKWOOD_GPIO_HIGH_0_7,
25 IRQ_KIRKWOOD_GPIO_HIGH_8_15,
26 IRQ_KIRKWOOD_GPIO_HIGH_16_23,
27 0,
28};
26 29
27void __init kirkwood_init_irq(void) 30void __init kirkwood_init_irq(void)
28{ 31{
@@ -32,17 +35,8 @@ void __init kirkwood_init_irq(void)
32 /* 35 /*
33 * Initialize gpiolib for GPIOs 0-49. 36 * Initialize gpiolib for GPIOs 0-49.
34 */ 37 */
35 orion_gpio_init(0, 32, GPIO_LOW_VIRT_BASE, 0, 38 orion_gpio_init(NULL, 0, 32, (void __iomem *)GPIO_LOW_VIRT_BASE, 0,
36 IRQ_KIRKWOOD_GPIO_START); 39 IRQ_KIRKWOOD_GPIO_START, gpio0_irqs);
37 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_0_7, gpio_irq_handler); 40 orion_gpio_init(NULL, 32, 18, (void __iomem *)GPIO_HIGH_VIRT_BASE, 0,
38 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_8_15, gpio_irq_handler); 41 IRQ_KIRKWOOD_GPIO_START + 32, gpio1_irqs);
39 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_16_23, gpio_irq_handler);
40 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_24_31, gpio_irq_handler);
41
42 orion_gpio_init(32, 18, GPIO_HIGH_VIRT_BASE, 0,
43 IRQ_KIRKWOOD_GPIO_START + 32);
44 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_0_7, gpio_irq_handler);
45 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_8_15, gpio_irq_handler);
46 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_16_23,
47 gpio_irq_handler);
48} 42}