1 // SPDX-License-Identifier: GPL-2.0-only
3 * arch/arm/mach-mv78xx0/buffalo-wxl-setup.c
5 * Buffalo WXL (Terastation Duo) Setup routines
7 * sebastien requiem <sebastien@requiem.fr>
10 #include <linux/kernel.h>
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
13 #include <linux/ata_platform.h>
14 #include <linux/mv643xx_eth.h>
15 #include <linux/ethtool.h>
16 #include <linux/i2c.h>
17 #include <linux/gpio.h>
18 #include <linux/gpio_keys.h>
19 #include <linux/input.h>
20 #include <asm/mach-types.h>
21 #include <asm/mach/arch.h>
27 #define TSWXL_AUTO_SWITCH 15
28 #define TSWXL_USB_POWER1 30
29 #define TSWXL_USB_POWER2 31
32 /* This arch has 2 Giga Ethernet */
34 static struct mv643xx_eth_platform_data db78x00_ge00_data = {
35 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
38 static struct mv643xx_eth_platform_data db78x00_ge01_data = {
39 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
43 /* 2 SATA controller supporting HotPlug */
45 static struct mv_sata_platform_data db78x00_sata_data = {
49 static struct i2c_board_info __initdata db78x00_i2c_rtc = {
50 I2C_BOARD_INFO("rs5c372a", 0x32),
54 static unsigned int wxl_mpp_config[] __initdata = {
108 static struct gpio_keys_button tswxl_buttons[] = {
111 .gpio = TSWXL_AUTO_SWITCH,
112 .desc = "Power-auto Switch",
117 static struct gpio_keys_platform_data tswxl_button_data = {
118 .buttons = tswxl_buttons,
119 .nbuttons = ARRAY_SIZE(tswxl_buttons),
122 static struct platform_device tswxl_button_device = {
127 .platform_data = &tswxl_button_data,
131 static void __init wxl_init(void)
134 * Basic MV78xx0 setup. Needs to be called early.
137 mv78xx0_mpp_conf(wxl_mpp_config);
140 * Partition on-chip peripherals between the two CPU cores.
142 mv78xx0_ehci0_init();
143 mv78xx0_ehci1_init();
144 mv78xx0_ge00_init(&db78x00_ge00_data);
145 mv78xx0_ge01_init(&db78x00_ge01_data);
146 mv78xx0_sata_init(&db78x00_sata_data);
147 mv78xx0_uart0_init();
148 mv78xx0_uart1_init();
149 mv78xx0_uart2_init();
150 mv78xx0_uart3_init();
152 mv78xx0_crypto_init();
154 i2c_register_board_info(0, &db78x00_i2c_rtc, 1);
156 //enable both usb ports
157 gpio_direction_output(TSWXL_USB_POWER1, 1);
158 gpio_direction_output(TSWXL_USB_POWER2, 1);
161 platform_device_register(&tswxl_button_device);
164 static int __init wxl_pci_init(void)
166 if (machine_is_terastation_wxl() && mv78xx0_core_index() == 0)
167 mv78xx0_pcie_init(1, 1);
171 subsys_initcall(wxl_pci_init);
173 MACHINE_START(TERASTATION_WXL, "Buffalo Nas WXL")
174 /* Maintainer: Sebastien Requiem <sebastien@requiem.fr> */
175 .atag_offset = 0x100,
176 .nr_irqs = MV78XX0_NR_IRQS,
177 .init_machine = wxl_init,
178 .map_io = mv78xx0_map_io,
179 .init_early = mv78xx0_init_early,
180 .init_irq = mv78xx0_init_irq,
181 .init_time = mv78xx0_timer_init,
182 .restart = mv78xx0_restart,