1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2010, 2018
4 * Allied Telesis <www.alliedtelesis.com>
13 #include <status_led.h>
14 #include <asm/arch/cpu.h>
15 #include <asm/arch/soc.h>
16 #include <asm/arch/mpp.h>
17 #include <asm/arch/gpio.h>
19 /* Note: GPIO differences between specific boards
21 * We're trying to avoid having multiple build targets for all the Kirkwood
22 * based boards one area where things tend to differ is GPIO usage. For the
23 * most part the GPIOs driven by the bootloader are similar enough in function
24 * that there is no harm in driving them.
26 * XZ4 XS6 XS16 GS24A GT40 GP24A GT24A
27 * GPIO39 - INT(<) NC MUX_RST_N(>) NC POE_DIS_N(>) NC
30 #define SBX81LIFKW_OE_LOW ~(BIT(31) | BIT(30) | BIT(28) | BIT(27) | \
31 BIT(18) | BIT(17) | BIT(13) | BIT(12) | \
33 #define SBX81LIFKW_OE_HIGH ~(BIT(0) | BIT(1) | BIT(7))
34 #define SBX81LIFKW_OE_VAL_LOW (BIT(31) | BIT(30) | BIT(28) | BIT(27))
35 #define SBX81LIFKW_OE_VAL_HIGH (BIT(0) | BIT(1))
37 #define MV88E6097_RESET 27
39 DECLARE_GLOBAL_DATA_PTR;
47 struct led amber_solid = {
53 struct led green_solid = {
59 struct led amber_flash = {
65 struct led green_flash = {
71 static void status_led_set(struct led *led)
73 clrsetbits_le32(led->reg, led->mask, led->value);
76 int board_early_init_f(void)
79 * default gpio configuration
80 * There are maximum 64 gpios controlled through 2 sets of registers
81 * the below configuration configures mainly initial LED status
83 mvebu_config_gpio(SBX81LIFKW_OE_VAL_LOW,
84 SBX81LIFKW_OE_VAL_HIGH,
85 SBX81LIFKW_OE_LOW, SBX81LIFKW_OE_HIGH);
87 /* Multi-Purpose Pins Functionality configuration */
88 static const u32 kwmpp_config[] = {
142 kirkwood_mpp_conf(kwmpp_config, NULL);
148 /* Power-down unused subsystems. The required
158 writel((BIT(0) | BIT(1) | BIT(2) |
159 BIT(5) | BIT(6) | BIT(7)),
160 KW_CPU_REG_BASE + 0x1c);
162 /* address of boot parameters */
163 gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
165 status_led_set(&amber_solid);
170 #ifdef CONFIG_RESET_PHY_R
171 /* automatically defined by kirkwood config.h */
177 #ifdef CONFIG_MV88E61XX_SWITCH
178 int mv88e61xx_hw_reset(struct phy_device *phydev)
180 /* Ensure the 88e6097 gets at least 10ms Reset
182 kw_gpio_set_value(MV88E6097_RESET, 0);
184 kw_gpio_set_value(MV88E6097_RESET, 1);
187 phydev->advertising = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full;
193 #ifdef CONFIG_MISC_INIT_R
194 int misc_init_r(void)
196 status_led_set(&green_flash);