/* * arch/arm/mach-orion5x/common.c * * Core functions for Marvell Orion 5x SoCs * * Maintainer: Tzachi Perelstein * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any * warranty of any kind, whether express or implied. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "common.h" /***************************************************************************** * I/O Address Mapping ****************************************************************************/ static struct map_desc orion5x_io_desc[] __initdata = { { .virtual = (unsigned long) ORION5X_REGS_VIRT_BASE, .pfn = __phys_to_pfn(ORION5X_REGS_PHYS_BASE), .length = ORION5X_REGS_SIZE, .type = MT_DEVICE, }, { .virtual = (unsigned long) ORION5X_PCIE_WA_VIRT_BASE, .pfn = __phys_to_pfn(ORION5X_PCIE_WA_PHYS_BASE), .length = ORION5X_PCIE_WA_SIZE, .type = MT_DEVICE, }, }; void __init orion5x_map_io(void) { iotable_init(orion5x_io_desc, ARRAY_SIZE(orion5x_io_desc)); } /***************************************************************************** * CLK tree ****************************************************************************/ static struct clk *tclk; void __init clk_init(void) { tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT, orion5x_tclk); orion_clkdev_init(tclk); } /***************************************************************************** * EHCI0 ****************************************************************************/ void __init orion5x_ehci0_init(void) { orion_ehci_init(ORION5X_USB0_PHYS_BASE, IRQ_ORION5X_USB0_CTRL, EHCI_PHY_ORION); } /***************************************************************************** * EHCI1 ****************************************************************************/ void __init orion5x_ehci1_init(void) { orion_ehci_1_init(ORION5X_USB1_PHYS_BASE, IRQ_ORION5X_USB1_CTRL); } /***************************************************************************** * GE00 ****************************************************************************/ void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data) { orion_ge00_init(eth_data, ORION5X_ETH_PHYS_BASE, IRQ_ORION5X_ETH_SUM, IRQ_ORION5X_ETH_ERR, MV643XX_TX_CSUM_DEFAULT_LIMIT); } /***************************************************************************** * Ethernet switch ****************************************************************************/ void __init orion5x_eth_switch_init(struct dsa_platform_data *d, int irq) { orion_ge00_switch_init(d, irq); } /***************************************************************************** * I2C ****************************************************************************/ void __init orion5x_i2c_init(void) { orion_i2c_init(I2C_PHYS_BASE, IRQ_ORION5X_I2C, 8); } /***************************************************************************** * SATA ****************************************************************************/ void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data) { orion_sata_init(sata_data, ORION5X_SATA_PHYS_BASE, IRQ_ORION5X_SATA); } /***************************************************************************** * SPI ****************************************************************************/ void __init orion5x_spi_init() { orion_spi_init(SPI_PHYS_BASE); } /***************************************************************************** * UART0 ****************************************************************************/ void __init orion5x_uart0_init(void) { orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE, IRQ_ORION5X_UART0, tclk); } /***************************************************************************** * UART1 ****************************************************************************/ void __init orion5x_uart1_init(void) { orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE, IRQ_ORION5X_UART1, tclk); } /***************************************************************************** * XOR engine ****************************************************************************/ void __init orion5x_xor_init(void) { orion_xor0_init(ORION5X_XOR_PHYS_BASE, ORION5X_XOR_PHYS_BASE + 0x200, IRQ_ORION5X_XOR0, IRQ_ORION5X_XOR1); } /***************************************************************************** * Cryptographic Engines and Security Accelerator (CESA) ****************************************************************************/ static void __init orion5x_crypto_init(void) { orion5x_setup_sram_win(); orion_crypto_init(ORION5X_CRYPTO_PHYS_BASE, ORION5X_SRAM_PHYS_BASE, SZ_8K, IRQ_ORION5X_CESA); } /***************************************************************************** * Watchdog ****************************************************************************/ void __init orion5x_wdt_init(void) { orion_wdt_init(); } /***************************************************************************** * Time handling ****************************************************************************/ void __init orion5x_init_early(void) { orion_time_set_base(TIMER_VIRT_BASE); /* * Some Orion5x devices allocate their coherent buffers from atomic * context. Increase size of atomic coherent pool to make sure such * the allocations won't fail. */ init_dma_coherent_pool_size(SZ_1M); } int orion5x_tclk; int __init orion5x_find_tclk(void) { u32 dev, rev; orion5x_pcie_id(&dev, &rev); if (dev == MV88F6183_DEV_ID && (readl(MPP_RESET_SAMPLE) & 0x00000200) == 0) return 133333333; return 166666667; } static void __init orion5x_timer_init(void) { orion5x_tclk = orion5x_find_tclk(); orion_time_init(ORION5X_BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR, IRQ_ORION5X_BRIDGE, orion5x_tclk); } struct sys_timer orion5x_timer = { .init = orion5x_timer_init, }; /***************************************************************************** * General ****************************************************************************/ /* * Identify device ID and rev from PCIe configuration header space '0'. */ void __init orion5x_id(u32 *dev, u32 *rev, char **dev_name) { orion5x_pcie_id(dev, rev);