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