1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2016 Marek Vasut <marex@denx.de>
9 #include <asm/addrspace.h>
10 #include <asm/types.h>
11 #include <linux/bitops.h>
12 #include <linux/delay.h>
13 #include <mach/ath79.h>
14 #include <mach/ar71xx_regs.h>
16 #include <debug_uart.h>
19 static void wdr4300_usb_start(void)
21 void __iomem *gpio_regs = map_physmem(AR71XX_GPIO_BASE,
22 AR71XX_GPIO_SIZE, MAP_NOCACHE);
26 /* Power up the USB HUB. */
27 clrbits_be32(gpio_regs + AR71XX_GPIO_REG_OE, BIT(21) | BIT(22));
28 writel(BIT(21) | BIT(22), gpio_regs + AR71XX_GPIO_REG_SET);
34 static inline void wdr4300_usb_start(void) {}
37 void wdr4300_pinmux_config(void)
41 regs = map_physmem(AR71XX_GPIO_BASE, AR71XX_GPIO_SIZE,
44 /* Assure JTAG is not disconnected. */
45 writel(0x40, regs + AR934X_GPIO_REG_FUNC);
47 /* Configure default GPIO input/output regs. */
48 writel(0x3031b, regs + AR71XX_GPIO_REG_OE);
49 writel(0x0f804, regs + AR71XX_GPIO_REG_OUT);
51 /* Configure pin multiplexing. */
52 writel(0x00000000, regs + AR934X_GPIO_REG_OUT_FUNC0);
53 writel(0x0b0a0980, regs + AR934X_GPIO_REG_OUT_FUNC1);
54 writel(0x00180000, regs + AR934X_GPIO_REG_OUT_FUNC2);
55 writel(0x00000000, regs + AR934X_GPIO_REG_OUT_FUNC3);
56 writel(0x0000004d, regs + AR934X_GPIO_REG_OUT_FUNC4);
57 writel(0x00000000, regs + AR934X_GPIO_REG_OUT_FUNC5);
60 #ifdef CONFIG_DEBUG_UART_BOARD_INIT
61 void board_debug_uart_init(void)
63 wdr4300_pinmux_config();
67 #ifdef CONFIG_BOARD_EARLY_INIT_F
68 int board_early_init_f(void)
70 #ifndef CONFIG_DEBUG_UART_BOARD_INIT
71 wdr4300_pinmux_config();
74 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
75 ar934x_pll_init(560, 480, 240);
76 ar934x_ddr_init(560, 480, 240);