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