1*0fdebc5eSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
29dd0b194SLennert Buytenhek /*
39dd0b194SLennert Buytenhek * arch/arm/mach-orion5x/common.c
49dd0b194SLennert Buytenhek *
59dd0b194SLennert Buytenhek * Core functions for Marvell Orion 5x SoCs
69dd0b194SLennert Buytenhek *
79dd0b194SLennert Buytenhek * Maintainer: Tzachi Perelstein <tzachi@marvell.com>
89dd0b194SLennert Buytenhek */
99dd0b194SLennert Buytenhek
109dd0b194SLennert Buytenhek #include <linux/kernel.h>
119dd0b194SLennert Buytenhek #include <linux/init.h>
1262e59c4eSStephen Boyd #include <linux/io.h>
139dd0b194SLennert Buytenhek #include <linux/platform_device.h>
14ee962723SAndrew Lunn #include <linux/dma-mapping.h>
159dd0b194SLennert Buytenhek #include <linux/serial_8250.h>
169dd0b194SLennert Buytenhek #include <linux/mv643xx_i2c.h>
179dd0b194SLennert Buytenhek #include <linux/ata_platform.h>
18764cbcc2SRussell King #include <linux/delay.h>
192f129bf4SAndrew Lunn #include <linux/clk-provider.h>
207b2fea1cSArnd Bergmann #include <linux/cpu.h>
219dd0b194SLennert Buytenhek #include <asm/page.h>
229dd0b194SLennert Buytenhek #include <asm/setup.h>
239f97da78SDavid Howells #include <asm/system_misc.h>
249dd0b194SLennert Buytenhek #include <asm/mach/arch.h>
259dd0b194SLennert Buytenhek #include <asm/mach/map.h>
269dd0b194SLennert Buytenhek #include <asm/mach/time.h>
27c02cecb9SArnd Bergmann #include <linux/platform_data/mtd-orion_nand.h>
28c02cecb9SArnd Bergmann #include <linux/platform_data/usb-ehci-orion.h>
296f088f1dSLennert Buytenhek #include <plat/time.h>
3028a2b450SAndrew Lunn #include <plat/common.h>
31c22c2c60SArnd Bergmann
32c22c2c60SArnd Bergmann #include "bridge-regs.h"
339dd0b194SLennert Buytenhek #include "common.h"
34c22c2c60SArnd Bergmann #include "orion5x.h"
359dd0b194SLennert Buytenhek
369dd0b194SLennert Buytenhek /*****************************************************************************
379dd0b194SLennert Buytenhek * I/O Address Mapping
389dd0b194SLennert Buytenhek ****************************************************************************/
399dd0b194SLennert Buytenhek static struct map_desc orion5x_io_desc[] __initdata = {
409dd0b194SLennert Buytenhek {
413904a393SThomas Petazzoni .virtual = (unsigned long) ORION5X_REGS_VIRT_BASE,
429dd0b194SLennert Buytenhek .pfn = __phys_to_pfn(ORION5X_REGS_PHYS_BASE),
439dd0b194SLennert Buytenhek .length = ORION5X_REGS_SIZE,
44e7068ad3SLennert Buytenhek .type = MT_DEVICE,
45e7068ad3SLennert Buytenhek }, {
463904a393SThomas Petazzoni .virtual = (unsigned long) ORION5X_PCIE_WA_VIRT_BASE,
479dd0b194SLennert Buytenhek .pfn = __phys_to_pfn(ORION5X_PCIE_WA_PHYS_BASE),
489dd0b194SLennert Buytenhek .length = ORION5X_PCIE_WA_SIZE,
49e7068ad3SLennert Buytenhek .type = MT_DEVICE,
509dd0b194SLennert Buytenhek },
519dd0b194SLennert Buytenhek };
529dd0b194SLennert Buytenhek
orion5x_map_io(void)539dd0b194SLennert Buytenhek void __init orion5x_map_io(void)
549dd0b194SLennert Buytenhek {
559dd0b194SLennert Buytenhek iotable_init(orion5x_io_desc, ARRAY_SIZE(orion5x_io_desc));
569dd0b194SLennert Buytenhek }
579dd0b194SLennert Buytenhek
58044f6c7cSLennert Buytenhek
599dd0b194SLennert Buytenhek /*****************************************************************************
602f129bf4SAndrew Lunn * CLK tree
612f129bf4SAndrew Lunn ****************************************************************************/
622f129bf4SAndrew Lunn static struct clk *tclk;
632f129bf4SAndrew Lunn
clk_init(void)641bffb4a8SThomas Petazzoni void __init clk_init(void)
652f129bf4SAndrew Lunn {
66cc1e1896SStephen Boyd tclk = clk_register_fixed_rate(NULL, "tclk", NULL, 0, orion5x_tclk);
674574b886SAndrew Lunn
684574b886SAndrew Lunn orion_clkdev_init(tclk);
692f129bf4SAndrew Lunn }
702f129bf4SAndrew Lunn
712f129bf4SAndrew Lunn /*****************************************************************************
72044f6c7cSLennert Buytenhek * EHCI0
73044f6c7cSLennert Buytenhek ****************************************************************************/
orion5x_ehci0_init(void)74044f6c7cSLennert Buytenhek void __init orion5x_ehci0_init(void)
75044f6c7cSLennert Buytenhek {
7672053353SAndrew Lunn orion_ehci_init(ORION5X_USB0_PHYS_BASE, IRQ_ORION5X_USB0_CTRL,
7772053353SAndrew Lunn EHCI_PHY_ORION);
78044f6c7cSLennert Buytenhek }
79044f6c7cSLennert Buytenhek
80044f6c7cSLennert Buytenhek
81044f6c7cSLennert Buytenhek /*****************************************************************************
82044f6c7cSLennert Buytenhek * EHCI1
83044f6c7cSLennert Buytenhek ****************************************************************************/
orion5x_ehci1_init(void)84044f6c7cSLennert Buytenhek void __init orion5x_ehci1_init(void)
85044f6c7cSLennert Buytenhek {
86db33f4deSAndrew Lunn orion_ehci_1_init(ORION5X_USB1_PHYS_BASE, IRQ_ORION5X_USB1_CTRL);
87044f6c7cSLennert Buytenhek }
889dd0b194SLennert Buytenhek
89044f6c7cSLennert Buytenhek
90044f6c7cSLennert Buytenhek /*****************************************************************************
915c602551SAndrew Lunn * GE00
92044f6c7cSLennert Buytenhek ****************************************************************************/
orion5x_eth_init(struct mv643xx_eth_platform_data * eth_data)939dd0b194SLennert Buytenhek void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
949dd0b194SLennert Buytenhek {
95db33f4deSAndrew Lunn orion_ge00_init(eth_data,
967e3819d8SAndrew Lunn ORION5X_ETH_PHYS_BASE, IRQ_ORION5X_ETH_SUM,
9758569aeeSArnaud Patard (Rtp) IRQ_ORION5X_ETH_ERR,
9858569aeeSArnaud Patard (Rtp) MV643XX_TX_CSUM_DEFAULT_LIMIT);
999dd0b194SLennert Buytenhek }
1009dd0b194SLennert Buytenhek
1019dd0b194SLennert Buytenhek
102044f6c7cSLennert Buytenhek /*****************************************************************************
103044f6c7cSLennert Buytenhek * I2C
104044f6c7cSLennert Buytenhek ****************************************************************************/
orion5x_i2c_init(void)105044f6c7cSLennert Buytenhek void __init orion5x_i2c_init(void)
106044f6c7cSLennert Buytenhek {
107aac7ffa3SAndrew Lunn orion_i2c_init(I2C_PHYS_BASE, IRQ_ORION5X_I2C, 8);
108aac7ffa3SAndrew Lunn
109044f6c7cSLennert Buytenhek }
110044f6c7cSLennert Buytenhek
111044f6c7cSLennert Buytenhek
1129dd0b194SLennert Buytenhek /*****************************************************************************
113044f6c7cSLennert Buytenhek * SATA
1149dd0b194SLennert Buytenhek ****************************************************************************/
orion5x_sata_init(struct mv_sata_platform_data * sata_data)1159dd0b194SLennert Buytenhek void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data)
1169dd0b194SLennert Buytenhek {
117db33f4deSAndrew Lunn orion_sata_init(sata_data, ORION5X_SATA_PHYS_BASE, IRQ_ORION5X_SATA);
1189dd0b194SLennert Buytenhek }
1199dd0b194SLennert Buytenhek
120044f6c7cSLennert Buytenhek
121044f6c7cSLennert Buytenhek /*****************************************************************************
122d323ade1SLennert Buytenhek * SPI
123d323ade1SLennert Buytenhek ****************************************************************************/
orion5x_spi_init(void)12442366666SAndrew Lunn void __init orion5x_spi_init(void)
125d323ade1SLennert Buytenhek {
1264574b886SAndrew Lunn orion_spi_init(SPI_PHYS_BASE);
127d323ade1SLennert Buytenhek }
128d323ade1SLennert Buytenhek
129d323ade1SLennert Buytenhek
130d323ade1SLennert Buytenhek /*****************************************************************************
131044f6c7cSLennert Buytenhek * UART0
132044f6c7cSLennert Buytenhek ****************************************************************************/
orion5x_uart0_init(void)133044f6c7cSLennert Buytenhek void __init orion5x_uart0_init(void)
134044f6c7cSLennert Buytenhek {
13528a2b450SAndrew Lunn orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
13674c33576SAndrew Lunn IRQ_ORION5X_UART0, tclk);
137044f6c7cSLennert Buytenhek }
138044f6c7cSLennert Buytenhek
139044f6c7cSLennert Buytenhek /*****************************************************************************
140044f6c7cSLennert Buytenhek * UART1
141044f6c7cSLennert Buytenhek ****************************************************************************/
orion5x_uart1_init(void)142044f6c7cSLennert Buytenhek void __init orion5x_uart1_init(void)
143044f6c7cSLennert Buytenhek {
14428a2b450SAndrew Lunn orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
14574c33576SAndrew Lunn IRQ_ORION5X_UART1, tclk);
146044f6c7cSLennert Buytenhek }
147044f6c7cSLennert Buytenhek
1489dd0b194SLennert Buytenhek /*****************************************************************************
1491d5a1a6eSSaeed Bishara * XOR engine
1501d5a1a6eSSaeed Bishara ****************************************************************************/
orion5x_xor_init(void)1511d5a1a6eSSaeed Bishara void __init orion5x_xor_init(void)
1521d5a1a6eSSaeed Bishara {
153db33f4deSAndrew Lunn orion_xor0_init(ORION5X_XOR_PHYS_BASE,
154ee962723SAndrew Lunn ORION5X_XOR_PHYS_BASE + 0x200,
155ee962723SAndrew Lunn IRQ_ORION5X_XOR0, IRQ_ORION5X_XOR1);
1561d5a1a6eSSaeed Bishara }
1571d5a1a6eSSaeed Bishara
15844350061SAndrew Lunn /*****************************************************************************
15944350061SAndrew Lunn * Cryptographic Engines and Security Accelerator (CESA)
16044350061SAndrew Lunn ****************************************************************************/
orion5x_crypto_init(void)16144350061SAndrew Lunn static void __init orion5x_crypto_init(void)
1623a8f7441SSebastian Andrzej Siewior {
1634ca2c040SThomas Petazzoni mvebu_mbus_add_window_by_id(ORION_MBUS_SRAM_TARGET,
1644ca2c040SThomas Petazzoni ORION_MBUS_SRAM_ATTR,
1654ca2c040SThomas Petazzoni ORION5X_SRAM_PHYS_BASE,
1665d1190eaSThomas Petazzoni ORION5X_SRAM_SIZE);
16744350061SAndrew Lunn orion_crypto_init(ORION5X_CRYPTO_PHYS_BASE, ORION5X_SRAM_PHYS_BASE,
16844350061SAndrew Lunn SZ_8K, IRQ_ORION5X_CESA);
1693a8f7441SSebastian Andrzej Siewior }
1701d5a1a6eSSaeed Bishara
1711d5a1a6eSSaeed Bishara /*****************************************************************************
1729e058d4fSThomas Reitmayr * Watchdog
1739e058d4fSThomas Reitmayr ****************************************************************************/
17406f3008aSArnd Bergmann static struct resource orion_wdt_resource[] = {
17506f3008aSArnd Bergmann DEFINE_RES_MEM(TIMER_PHYS_BASE, 0x04),
17606f3008aSArnd Bergmann DEFINE_RES_MEM(RSTOUTn_MASK_PHYS, 0x04),
17706f3008aSArnd Bergmann };
17806f3008aSArnd Bergmann
17906f3008aSArnd Bergmann static struct platform_device orion_wdt_device = {
18006f3008aSArnd Bergmann .name = "orion_wdt",
18106f3008aSArnd Bergmann .id = -1,
18206f3008aSArnd Bergmann .num_resources = ARRAY_SIZE(orion_wdt_resource),
18306f3008aSArnd Bergmann .resource = orion_wdt_resource,
18406f3008aSArnd Bergmann };
18506f3008aSArnd Bergmann
orion5x_wdt_init(void)18642366666SAndrew Lunn static void __init orion5x_wdt_init(void)
1879e058d4fSThomas Reitmayr {
18806f3008aSArnd Bergmann platform_device_register(&orion_wdt_device);
1899e058d4fSThomas Reitmayr }
1909e058d4fSThomas Reitmayr
1919e058d4fSThomas Reitmayr
1929e058d4fSThomas Reitmayr /*****************************************************************************
1939dd0b194SLennert Buytenhek * Time handling
1949dd0b194SLennert Buytenhek ****************************************************************************/
orion5x_init_early(void)1954ee1f6b5SLennert Buytenhek void __init orion5x_init_early(void)
1964ee1f6b5SLennert Buytenhek {
1975d1190eaSThomas Petazzoni u32 rev, dev;
1985d1190eaSThomas Petazzoni const char *mbus_soc_name;
1995d1190eaSThomas Petazzoni
2004ee1f6b5SLennert Buytenhek orion_time_set_base(TIMER_VIRT_BASE);
20184d5dfbfSAndrew Lunn
2025d1190eaSThomas Petazzoni /* Initialize the MBUS driver */
2035d1190eaSThomas Petazzoni orion5x_pcie_id(&dev, &rev);
2045d1190eaSThomas Petazzoni if (dev == MV88F5281_DEV_ID)
2055d1190eaSThomas Petazzoni mbus_soc_name = "marvell,orion5x-88f5281-mbus";
2065d1190eaSThomas Petazzoni else if (dev == MV88F5182_DEV_ID)
2075d1190eaSThomas Petazzoni mbus_soc_name = "marvell,orion5x-88f5182-mbus";
2085d1190eaSThomas Petazzoni else if (dev == MV88F5181_DEV_ID)
2095d1190eaSThomas Petazzoni mbus_soc_name = "marvell,orion5x-88f5181-mbus";
2105d1190eaSThomas Petazzoni else if (dev == MV88F6183_DEV_ID)
2115d1190eaSThomas Petazzoni mbus_soc_name = "marvell,orion5x-88f6183-mbus";
2125d1190eaSThomas Petazzoni else
2135d1190eaSThomas Petazzoni mbus_soc_name = NULL;
2145d1190eaSThomas Petazzoni mvebu_mbus_init(mbus_soc_name, ORION5X_BRIDGE_WINS_BASE,
2155d1190eaSThomas Petazzoni ORION5X_BRIDGE_WINS_SZ,
2165d1190eaSThomas Petazzoni ORION5X_DDR_WINS_BASE, ORION5X_DDR_WINS_SZ);
2175d1190eaSThomas Petazzoni }
2185d1190eaSThomas Petazzoni
orion5x_setup_wins(void)2195d1190eaSThomas Petazzoni void orion5x_setup_wins(void)
2205d1190eaSThomas Petazzoni {
2215d1190eaSThomas Petazzoni /*
2225d1190eaSThomas Petazzoni * The PCIe windows will no longer be statically allocated
2235d1190eaSThomas Petazzoni * here once Orion5x is migrated to the pci-mvebu driver.
2245d1190eaSThomas Petazzoni */
2254ca2c040SThomas Petazzoni mvebu_mbus_add_window_remap_by_id(ORION_MBUS_PCIE_IO_TARGET,
2264ca2c040SThomas Petazzoni ORION_MBUS_PCIE_IO_ATTR,
2274ca2c040SThomas Petazzoni ORION5X_PCIE_IO_PHYS_BASE,
2285d1190eaSThomas Petazzoni ORION5X_PCIE_IO_SIZE,
2294ca2c040SThomas Petazzoni ORION5X_PCIE_IO_BUS_BASE);
2304ca2c040SThomas Petazzoni mvebu_mbus_add_window_by_id(ORION_MBUS_PCIE_MEM_TARGET,
2314ca2c040SThomas Petazzoni ORION_MBUS_PCIE_MEM_ATTR,
2324ca2c040SThomas Petazzoni ORION5X_PCIE_MEM_PHYS_BASE,
2334ca2c040SThomas Petazzoni ORION5X_PCIE_MEM_SIZE);
2344ca2c040SThomas Petazzoni mvebu_mbus_add_window_remap_by_id(ORION_MBUS_PCI_IO_TARGET,
2354ca2c040SThomas Petazzoni ORION_MBUS_PCI_IO_ATTR,
2364ca2c040SThomas Petazzoni ORION5X_PCI_IO_PHYS_BASE,
2375d1190eaSThomas Petazzoni ORION5X_PCI_IO_SIZE,
2384ca2c040SThomas Petazzoni ORION5X_PCI_IO_BUS_BASE);
2394ca2c040SThomas Petazzoni mvebu_mbus_add_window_by_id(ORION_MBUS_PCI_MEM_TARGET,
2404ca2c040SThomas Petazzoni ORION_MBUS_PCI_MEM_ATTR,
2414ca2c040SThomas Petazzoni ORION5X_PCI_MEM_PHYS_BASE,
2424ca2c040SThomas Petazzoni ORION5X_PCI_MEM_SIZE);
2434ee1f6b5SLennert Buytenhek }
2444ee1f6b5SLennert Buytenhek
245ebe35affSLennert Buytenhek int orion5x_tclk;
246ebe35affSLennert Buytenhek
orion5x_find_tclk(void)24742366666SAndrew Lunn static int __init orion5x_find_tclk(void)
248ebe35affSLennert Buytenhek {
249d323ade1SLennert Buytenhek u32 dev, rev;
250d323ade1SLennert Buytenhek
251d323ade1SLennert Buytenhek orion5x_pcie_id(&dev, &rev);
252d323ade1SLennert Buytenhek if (dev == MV88F6183_DEV_ID &&
253d323ade1SLennert Buytenhek (readl(MPP_RESET_SAMPLE) & 0x00000200) == 0)
254d323ade1SLennert Buytenhek return 133333333;
255d323ade1SLennert Buytenhek
256ebe35affSLennert Buytenhek return 166666667;
257ebe35affSLennert Buytenhek }
258ebe35affSLennert Buytenhek
orion5x_timer_init(void)2596bb27d73SStephen Warren void __init orion5x_timer_init(void)
2609dd0b194SLennert Buytenhek {
261ebe35affSLennert Buytenhek orion5x_tclk = orion5x_find_tclk();
2624ee1f6b5SLennert Buytenhek
2634ee1f6b5SLennert Buytenhek orion_time_init(ORION5X_BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
2644ee1f6b5SLennert Buytenhek IRQ_ORION5X_BRIDGE, orion5x_tclk);
2659dd0b194SLennert Buytenhek }
2669dd0b194SLennert Buytenhek
267044f6c7cSLennert Buytenhek
2689dd0b194SLennert Buytenhek /*****************************************************************************
2699dd0b194SLennert Buytenhek * General
2709dd0b194SLennert Buytenhek ****************************************************************************/
2719dd0b194SLennert Buytenhek /*
272b46926bbSLennert Buytenhek * Identify device ID and rev from PCIe configuration header space '0'.
2739dd0b194SLennert Buytenhek */
orion5x_id(u32 * dev,u32 * rev,char ** dev_name)2741bffb4a8SThomas Petazzoni void __init orion5x_id(u32 *dev, u32 *rev, char **dev_name)
2759dd0b194SLennert Buytenhek {
2769dd0b194SLennert Buytenhek orion5x_pcie_id(dev, rev);
2779dd0b194SLennert Buytenhek
2789dd0b194SLennert Buytenhek if (*dev == MV88F5281_DEV_ID) {
2799dd0b194SLennert Buytenhek if (*rev == MV88F5281_REV_D2) {
2809dd0b194SLennert Buytenhek *dev_name = "MV88F5281-D2";
2819dd0b194SLennert Buytenhek } else if (*rev == MV88F5281_REV_D1) {
2829dd0b194SLennert Buytenhek *dev_name = "MV88F5281-D1";
283ce72e36eSLennert Buytenhek } else if (*rev == MV88F5281_REV_D0) {
284ce72e36eSLennert Buytenhek *dev_name = "MV88F5281-D0";
2859dd0b194SLennert Buytenhek } else {
2869dd0b194SLennert Buytenhek *dev_name = "MV88F5281-Rev-Unsupported";
2879dd0b194SLennert Buytenhek }
2889dd0b194SLennert Buytenhek } else if (*dev == MV88F5182_DEV_ID) {
2899dd0b194SLennert Buytenhek if (*rev == MV88F5182_REV_A2) {
2909dd0b194SLennert Buytenhek *dev_name = "MV88F5182-A2";
2919dd0b194SLennert Buytenhek } else {
2929dd0b194SLennert Buytenhek *dev_name = "MV88F5182-Rev-Unsupported";
2939dd0b194SLennert Buytenhek }
2949dd0b194SLennert Buytenhek } else if (*dev == MV88F5181_DEV_ID) {
2959dd0b194SLennert Buytenhek if (*rev == MV88F5181_REV_B1) {
2969dd0b194SLennert Buytenhek *dev_name = "MV88F5181-Rev-B1";
297d2b2a6bbSLennert Buytenhek } else if (*rev == MV88F5181L_REV_A1) {
298d2b2a6bbSLennert Buytenhek *dev_name = "MV88F5181L-Rev-A1";
2999dd0b194SLennert Buytenhek } else {
300d2b2a6bbSLennert Buytenhek *dev_name = "MV88F5181(L)-Rev-Unsupported";
3019dd0b194SLennert Buytenhek }
302d323ade1SLennert Buytenhek } else if (*dev == MV88F6183_DEV_ID) {
303d323ade1SLennert Buytenhek if (*rev == MV88F6183_REV_B0) {
304d323ade1SLennert Buytenhek *dev_name = "MV88F6183-Rev-B0";
305d323ade1SLennert Buytenhek } else {
306d323ade1SLennert Buytenhek *dev_name = "MV88F6183-Rev-Unsupported";
307d323ade1SLennert Buytenhek }
3089dd0b194SLennert Buytenhek } else {
3099dd0b194SLennert Buytenhek *dev_name = "Device-Unknown";
3109dd0b194SLennert Buytenhek }
3119dd0b194SLennert Buytenhek }
3129dd0b194SLennert Buytenhek
orion5x_init(void)3139dd0b194SLennert Buytenhek void __init orion5x_init(void)
3149dd0b194SLennert Buytenhek {
3159dd0b194SLennert Buytenhek char *dev_name;
3169dd0b194SLennert Buytenhek u32 dev, rev;
3179dd0b194SLennert Buytenhek
3189dd0b194SLennert Buytenhek orion5x_id(&dev, &rev, &dev_name);
319ebe35affSLennert Buytenhek printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk);
320ebe35affSLennert Buytenhek
3219dd0b194SLennert Buytenhek /*
3229dd0b194SLennert Buytenhek * Setup Orion address map
3239dd0b194SLennert Buytenhek */
3245d1190eaSThomas Petazzoni orion5x_setup_wins();
325ce72e36eSLennert Buytenhek
3262f129bf4SAndrew Lunn /* Setup root of clk tree */
3272f129bf4SAndrew Lunn clk_init();
3282f129bf4SAndrew Lunn
329ce72e36eSLennert Buytenhek /*
330ce72e36eSLennert Buytenhek * Don't issue "Wait for Interrupt" instruction if we are
331ce72e36eSLennert Buytenhek * running on D0 5281 silicon.
332ce72e36eSLennert Buytenhek */
333ce72e36eSLennert Buytenhek if (dev == MV88F5281_DEV_ID && rev == MV88F5281_REV_D0) {
334ce72e36eSLennert Buytenhek printk(KERN_INFO "Orion: Applying 5281 D0 WFI workaround.\n");
335f7b861b7SThomas Gleixner cpu_idle_poll_ctrl(true);
336ce72e36eSLennert Buytenhek }
3379e058d4fSThomas Reitmayr
3389e058d4fSThomas Reitmayr /*
3393fade49bSNicolas Pitre * The 5082/5181l/5182/6082/6082l/6183 have crypto
3403fade49bSNicolas Pitre * while 5180n/5181/5281 don't have crypto.
3413fade49bSNicolas Pitre */
3423fade49bSNicolas Pitre if ((dev == MV88F5181_DEV_ID && rev >= MV88F5181L_REV_A0) ||
3433fade49bSNicolas Pitre dev == MV88F5182_DEV_ID || dev == MV88F6183_DEV_ID)
3443fade49bSNicolas Pitre orion5x_crypto_init();
3453fade49bSNicolas Pitre
3463fade49bSNicolas Pitre /*
3479e058d4fSThomas Reitmayr * Register watchdog driver
3489e058d4fSThomas Reitmayr */
3499e058d4fSThomas Reitmayr orion5x_wdt_init();
3509dd0b194SLennert Buytenhek }
3519dd0b194SLennert Buytenhek
orion5x_restart(enum reboot_mode mode,const char * cmd)3527b6d864bSRobin Holt void orion5x_restart(enum reboot_mode mode, const char *cmd)
353764cbcc2SRussell King {
354764cbcc2SRussell King /*
355764cbcc2SRussell King * Enable and issue soft reset
356764cbcc2SRussell King */
357764cbcc2SRussell King orion5x_setbits(RSTOUTn_MASK, (1 << 2));
358764cbcc2SRussell King orion5x_setbits(CPU_SOFT_RESET, 1);
359764cbcc2SRussell King mdelay(200);
360764cbcc2SRussell King orion5x_clrbits(CPU_SOFT_RESET, 1);
361764cbcc2SRussell King }
362764cbcc2SRussell King
3639dd0b194SLennert Buytenhek /*
3649dd0b194SLennert Buytenhek * Many orion-based systems have buggy bootloader implementations.
3659dd0b194SLennert Buytenhek * This is a common fixup for bogus memory tags.
3669dd0b194SLennert Buytenhek */
tag_fixup_mem32(struct tag * t,char ** from)3671c2f87c2SLaura Abbott void __init tag_fixup_mem32(struct tag *t, char **from)
3689dd0b194SLennert Buytenhek {
3699dd0b194SLennert Buytenhek for (; t->hdr.size; t = tag_next(t))
3709dd0b194SLennert Buytenhek if (t->hdr.tag == ATAG_MEM &&
3719dd0b194SLennert Buytenhek (!t->u.mem.size || t->u.mem.size & ~PAGE_MASK ||
3729dd0b194SLennert Buytenhek t->u.mem.start & ~PAGE_MASK)) {
3739dd0b194SLennert Buytenhek printk(KERN_WARNING
3749dd0b194SLennert Buytenhek "Clearing invalid memory bank %dKB@0x%08x\n",
3759dd0b194SLennert Buytenhek t->u.mem.size / 1024, t->u.mem.start);
3769dd0b194SLennert Buytenhek t->hdr.tag = 0;
3779dd0b194SLennert Buytenhek }
3789dd0b194SLennert Buytenhek }
379