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