1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2010, 2018
4 * Allied Telesis <www.alliedtelesis.com>
11 #include <asm/arch/cpu.h>
12 #include <asm/arch/soc.h>
13 #include <asm/arch/mpp.h>
14 #include <asm/arch/gpio.h>
16 /* Note: GPIO differences between specific boards
18 * We're trying to avoid having multiple build targets for all the Kirkwood
19 * based boards one area where things tend to differ is GPIO usage. For the
20 * most part the GPIOs driven by the bootloader are similar enough in function
21 * that there is no harm in driving them.
23 * XZ4 XS6 XS16 GS24A GT40 GP24A GT24A
24 * GPIO39 - INT(<) NC MUX_RST_N(>) NC POE_DIS_N(>) NC
27 #define SBX81LIFKW_OE_LOW ~(BIT(31) | BIT(30) | BIT(28) | BIT(27) | \
28 BIT(18) | BIT(17) | BIT(13) | BIT(12) | \
30 #define SBX81LIFKW_OE_HIGH ~(BIT(0) | BIT(1) | BIT(7))
31 #define SBX81LIFKW_OE_VAL_LOW (BIT(31) | BIT(30) | BIT(28) | BIT(27))
32 #define SBX81LIFKW_OE_VAL_HIGH (BIT(0) | BIT(1))
34 #define MV88E6097_RESET 27
36 DECLARE_GLOBAL_DATA_PTR;
44 struct led amber_solid = {
50 struct led green_solid = {
56 struct led amber_flash = {
62 struct led green_flash = {
68 static void status_led_set(struct led *led)
70 clrsetbits_le32(led->reg, led->mask, led->value);
73 int board_early_init_f(void)
76 * default gpio configuration
77 * There are maximum 64 gpios controlled through 2 sets of registers
78 * the below configuration configures mainly initial LED status
80 mvebu_config_gpio(SBX81LIFKW_OE_VAL_LOW,
81 SBX81LIFKW_OE_VAL_HIGH,
82 SBX81LIFKW_OE_LOW, SBX81LIFKW_OE_HIGH);
84 /* Multi-Purpose Pins Functionality configuration */
85 static const u32 kwmpp_config[] = {
139 kirkwood_mpp_conf(kwmpp_config, NULL);
145 /* Power-down unused subsystems. The required
155 writel((BIT(0) | BIT(1) | BIT(2) |
156 BIT(5) | BIT(6) | BIT(7)),
157 KW_CPU_REG_BASE + 0x1c);
159 /* address of boot parameters */
160 gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
162 status_led_set(&amber_solid);
167 #ifdef CONFIG_MV88E61XX_SWITCH
168 /* Configure and enable Switch and PHY */
171 /* Ensure the 88e6097 gets at least 10ms Reset
173 kw_gpio_set_value(MV88E6097_RESET, 0);
175 kw_gpio_set_value(MV88E6097_RESET, 1);
180 #ifdef CONFIG_MISC_INIT_R
181 int misc_init_r(void)
183 status_led_set(&green_flash);