1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2022 Tony Dinh <mibodhi@gmail.com>
4 * Copyright (C) 2010 Eric C. Cooper <ecc@cmu.edu>
6 * Based on sheevaplug.c originally written by
7 * Prafulla Wadaskar <prafulla@marvell.com>
9 * Marvell Semiconductor <www.marvell.com>
13 #include <bootstage.h>
16 #include <asm/arch/soc.h>
17 #include <asm/arch/mpp.h>
18 #include <asm/arch/cpu.h>
19 #include <asm/global_data.h>
21 #include <asm/mach-types.h>
22 #include <linux/bitops.h>
24 DECLARE_GLOBAL_DATA_PTR;
26 #define DOCKSTAR_OE_LOW (~(0))
27 #define DOCKSTAR_OE_HIGH (~(0))
28 #define DOCKSTAR_OE_VAL_LOW BIT(29) /* USB_PWEN low */
29 #define DOCKSTAR_OE_VAL_HIGH BIT(17) /* LED pin high */
31 int board_early_init_f(void)
34 * default gpio configuration
35 * There are maximum 64 gpios controlled through 2 sets of registers
36 * the below configuration configures mainly initial LED status
38 mvebu_config_gpio(DOCKSTAR_OE_VAL_LOW,
40 DOCKSTAR_OE_LOW, DOCKSTAR_OE_HIGH);
42 /* Multi-Purpose Pins Functionality configuration */
43 static const u32 kwmpp_config[] = {
96 kirkwood_mpp_conf(kwmpp_config, NULL);
100 int board_eth_init(struct bd_info *bis)
102 return cpu_eth_init(bis);
108 * arch number of board
110 gd->bd->bi_arch_number = MACH_TYPE_DOCKSTAR;
112 /* address of boot parameters */
113 gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
118 #if CONFIG_IS_ENABLED(BOOTSTAGE)
119 #define GREEN_LED BIT(14)
120 #define ORANGE_LED BIT(15)
121 #define BOTH_LEDS (GREEN_LED | ORANGE_LED)
122 #define NEITHER_LED 0
124 static void set_leds(u32 leds, u32 blinking)
126 struct kwgpio_registers *r = (struct kwgpio_registers *)MVEBU_GPIO1_BASE;
130 oe = readl(&r->oe) | BOTH_LEDS;
131 writel(oe & ~leds, &r->oe); /* active low */
132 bl = readl(&r->blink_en) & ~BOTH_LEDS;
133 writel(bl | blinking, &r->blink_en);
136 void show_boot_progress(int val)
139 case BOOTSTAGE_ID_RUN_OS: /* booting Linux */
140 set_leds(BOTH_LEDS, NEITHER_LED);
142 case BOOTSTAGE_ID_NET_ETH_START: /* Ethernet initialization */
143 set_leds(GREEN_LED, GREEN_LED);
146 if (val < 0) /* error */
147 set_leds(ORANGE_LED, ORANGE_LED);