Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * arch/arm/mach-mv78xx0/buffalo-wxl-setup.c
0004  *
0005  * Buffalo WXL (Terastation Duo) Setup routines
0006  *
0007  * sebastien requiem <sebastien@requiem.fr>
0008  */
0009 
0010 #include <linux/kernel.h>
0011 #include <linux/init.h>
0012 #include <linux/platform_device.h>
0013 #include <linux/ata_platform.h>
0014 #include <linux/mv643xx_eth.h>
0015 #include <linux/ethtool.h>
0016 #include <linux/i2c.h>
0017 #include <asm/mach-types.h>
0018 #include <asm/mach/arch.h>
0019 #include "mv78xx0.h"
0020 #include "common.h"
0021 #include "mpp.h"
0022 
0023 
0024 /* This arch has 2 Giga Ethernet */
0025 
0026 static struct mv643xx_eth_platform_data db78x00_ge00_data = {
0027     .phy_addr   = MV643XX_ETH_PHY_ADDR(0),
0028 };
0029 
0030 static struct mv643xx_eth_platform_data db78x00_ge01_data = {
0031     .phy_addr   = MV643XX_ETH_PHY_ADDR(8),
0032 };
0033 
0034 
0035 /* 2 SATA controller supporting HotPlug */
0036 
0037 static struct mv_sata_platform_data db78x00_sata_data = {
0038     .n_ports    = 2,
0039 };
0040 
0041 static struct i2c_board_info __initdata db78x00_i2c_rtc = {
0042     I2C_BOARD_INFO("ds1338", 0x68),
0043 };
0044 
0045 
0046 static unsigned int wxl_mpp_config[] __initdata = {
0047     MPP0_GE1_TXCLK,
0048     MPP1_GE1_TXCTL,
0049     MPP2_GE1_RXCTL,
0050     MPP3_GE1_RXCLK,
0051     MPP4_GE1_TXD0,
0052     MPP5_GE1_TXD1,
0053     MPP6_GE1_TXD2,
0054     MPP7_GE1_TXD3,
0055     MPP8_GE1_RXD0,
0056     MPP9_GE1_RXD1,
0057     MPP10_GE1_RXD2,
0058     MPP11_GE1_RXD3,
0059     MPP12_GPIO,
0060     MPP13_SYSRST_OUTn,
0061     MPP14_SATA1_ACTn,
0062     MPP15_SATA0_ACTn,
0063     MPP16_GPIO,
0064     MPP17_GPIO,
0065     MPP18_GPIO,
0066     MPP19_GPIO,
0067     MPP20_GPIO,
0068     MPP21_GPIO,
0069     MPP22_GPIO,
0070     MPP23_GPIO,
0071     MPP24_UA2_TXD,
0072     MPP25_UA2_RXD,
0073     MPP26_UA2_CTSn,
0074     MPP27_UA2_RTSn,
0075     MPP28_GPIO,
0076     MPP29_SYSRST_OUTn,
0077     MPP30_GPIO,
0078     MPP31_GPIO,
0079     MPP32_GPIO,
0080     MPP33_GPIO,
0081     MPP34_GPIO,
0082     MPP35_GPIO,
0083     MPP36_GPIO,
0084     MPP37_GPIO,
0085     MPP38_GPIO,
0086     MPP39_GPIO,
0087     MPP40_UNUSED,
0088     MPP41_UNUSED,
0089     MPP42_UNUSED,
0090     MPP43_UNUSED,
0091     MPP44_UNUSED,
0092     MPP45_UNUSED,
0093     MPP46_UNUSED,
0094     MPP47_UNUSED,
0095     MPP48_SATA1_ACTn,
0096     MPP49_SATA0_ACTn,
0097     0
0098 };
0099 
0100 
0101 static void __init wxl_init(void)
0102 {
0103     /*
0104      * Basic MV78xx0 setup. Needs to be called early.
0105      */
0106     mv78xx0_init();
0107     mv78xx0_mpp_conf(wxl_mpp_config);
0108 
0109     /*
0110      * Partition on-chip peripherals between the two CPU cores.
0111      */
0112     mv78xx0_ehci0_init();
0113     mv78xx0_ehci1_init();
0114     mv78xx0_ehci2_init();
0115     mv78xx0_ge00_init(&db78x00_ge00_data);
0116     mv78xx0_ge01_init(&db78x00_ge01_data);
0117     mv78xx0_sata_init(&db78x00_sata_data);
0118     mv78xx0_uart0_init();
0119     mv78xx0_uart1_init();
0120     mv78xx0_uart2_init();
0121     mv78xx0_uart3_init();
0122     mv78xx0_i2c_init();
0123     i2c_register_board_info(0, &db78x00_i2c_rtc, 1);
0124 }
0125 
0126 static int __init wxl_pci_init(void)
0127 {
0128     if (machine_is_terastation_wxl()) {
0129         /*
0130          * Assign the x16 PCIe slot on the board to CPU core
0131          * #0, and let CPU core #1 have the four x1 slots.
0132          */
0133         if (mv78xx0_core_index() == 0)
0134             mv78xx0_pcie_init(0, 1);
0135         else
0136             mv78xx0_pcie_init(1, 0);
0137     }
0138 
0139     return 0;
0140 }
0141 subsys_initcall(wxl_pci_init);
0142 
0143 MACHINE_START(TERASTATION_WXL, "Buffalo Nas WXL")
0144     /* Maintainer: Sebastien Requiem <sebastien@requiem.fr> */
0145     .atag_offset    = 0x100,
0146     .nr_irqs    = MV78XX0_NR_IRQS,
0147     .init_machine   = wxl_init,
0148     .map_io     = mv78xx0_map_io,
0149     .init_early = mv78xx0_init_early,
0150     .init_irq   = mv78xx0_init_irq,
0151     .init_time  = mv78xx0_timer_init,
0152     .restart    = mv78xx0_restart,
0153 MACHINE_END