Path: blob/master/arch/arm/mach-mv78xx0/buffalo-wxl-setup.c
26292 views
// SPDX-License-Identifier: GPL-2.0-only1/*2* arch/arm/mach-mv78xx0/buffalo-wxl-setup.c3*4* Buffalo WXL (Terastation Duo) Setup routines5*6* sebastien requiem <[email protected]>7*/89#include <linux/kernel.h>10#include <linux/init.h>11#include <linux/platform_device.h>12#include <linux/ata_platform.h>13#include <linux/mv643xx_eth.h>14#include <linux/ethtool.h>15#include <linux/i2c.h>16#include <linux/gpio.h>17#include <linux/gpio_keys.h>18#include <linux/input.h>19#include <asm/mach-types.h>20#include <asm/mach/arch.h>21#include "mv78xx0.h"22#include "common.h"23#include "mpp.h"242526#define TSWXL_AUTO_SWITCH 1527#define TSWXL_USB_POWER1 3028#define TSWXL_USB_POWER2 31293031/* This arch has 2 Giga Ethernet */3233static struct mv643xx_eth_platform_data db78x00_ge00_data = {34.phy_addr = MV643XX_ETH_PHY_ADDR(0),35};3637static struct mv643xx_eth_platform_data db78x00_ge01_data = {38.phy_addr = MV643XX_ETH_PHY_ADDR(8),39};404142/* 2 SATA controller supporting HotPlug */4344static struct mv_sata_platform_data db78x00_sata_data = {45.n_ports = 2,46};4748static struct i2c_board_info __initdata db78x00_i2c_rtc = {49I2C_BOARD_INFO("rs5c372a", 0x32),50};515253static unsigned int wxl_mpp_config[] __initdata = {54MPP0_GE1_TXCLK,55MPP1_GE1_TXCTL,56MPP2_GE1_RXCTL,57MPP3_GE1_RXCLK,58MPP4_GE1_TXD0,59MPP5_GE1_TXD1,60MPP6_GE1_TXD2,61MPP7_GE1_TXD3,62MPP8_GE1_RXD0,63MPP9_GE1_RXD1,64MPP10_GE1_RXD2,65MPP11_GE1_RXD3,66MPP12_GPIO,67MPP13_GPIO,68MPP14_GPIO,69MPP15_GPIO,70MPP16_GPIO,71MPP17_GPIO,72MPP18_GPIO,73MPP19_GPIO,74MPP20_GPIO,75MPP21_GPIO,76MPP22_GPIO,77MPP23_GPIO,78MPP24_UA2_TXD,79MPP25_UA2_RXD,80MPP26_UA2_CTSn,81MPP27_UA2_RTSn,82MPP28_GPIO,83MPP29_GPIO,84MPP30_GPIO,85MPP31_GPIO,86MPP32_GPIO,87MPP33_GPIO,88MPP34_GPIO,89MPP35_GPIO,90MPP36_GPIO,91MPP37_GPIO,92MPP38_GPIO,93MPP39_GPIO,94MPP40_GPIO,95MPP41_GPIO,96MPP42_GPIO,97MPP43_GPIO,98MPP44_GPIO,99MPP45_GPIO,100MPP46_GPIO,101MPP47_GPIO,102MPP48_GPIO,103MPP49_GPIO,1040105};106107static struct gpio_keys_button tswxl_buttons[] = {108{109.code = KEY_OPTION,110.gpio = TSWXL_AUTO_SWITCH,111.desc = "Power-auto Switch",112.active_low = 1,113}114};115116static struct gpio_keys_platform_data tswxl_button_data = {117.buttons = tswxl_buttons,118.nbuttons = ARRAY_SIZE(tswxl_buttons),119};120121static struct platform_device tswxl_button_device = {122.name = "gpio-keys",123.id = -1,124.num_resources = 0,125.dev = {126.platform_data = &tswxl_button_data,127},128};129130static void __init wxl_init(void)131{132/*133* Basic MV78xx0 setup. Needs to be called early.134*/135mv78xx0_init();136mv78xx0_mpp_conf(wxl_mpp_config);137138/*139* Partition on-chip peripherals between the two CPU cores.140*/141mv78xx0_ehci0_init();142mv78xx0_ehci1_init();143mv78xx0_ge00_init(&db78x00_ge00_data);144mv78xx0_ge01_init(&db78x00_ge01_data);145mv78xx0_sata_init(&db78x00_sata_data);146mv78xx0_uart0_init();147mv78xx0_uart1_init();148mv78xx0_uart2_init();149mv78xx0_uart3_init();150mv78xx0_xor_init();151mv78xx0_crypto_init();152mv78xx0_i2c_init();153i2c_register_board_info(0, &db78x00_i2c_rtc, 1);154155//enable both usb ports156gpio_direction_output(TSWXL_USB_POWER1, 1);157gpio_direction_output(TSWXL_USB_POWER2, 1);158159//enable rear switch160platform_device_register(&tswxl_button_device);161}162163static int __init wxl_pci_init(void)164{165if (machine_is_terastation_wxl() && mv78xx0_core_index() == 0)166mv78xx0_pcie_init(1, 1);167168return 0;169}170subsys_initcall(wxl_pci_init);171172MACHINE_START(TERASTATION_WXL, "Buffalo Nas WXL")173/* Maintainer: Sebastien Requiem <[email protected]> */174.atag_offset = 0x100,175.nr_irqs = MV78XX0_NR_IRQS,176.init_machine = wxl_init,177.map_io = mv78xx0_map_io,178.init_early = mv78xx0_init_early,179.init_irq = mv78xx0_init_irq,180.init_time = mv78xx0_timer_init,181.restart = mv78xx0_restart,182MACHINE_END183184185