[U-Boot] [PATCH 5/5] DockStar: LED support

Sergei Shtylyov sshtylyov at mvista.com
Wed Sep 8 12:24:47 CEST 2010


Hello.

On 07-09-2010 18:28, Eric Cooper wrote:

> derived from patches posted by Jeff Doozan
> in the uBoot forum at http://forum.doozan.com

> Signed-off-by: Eric Cooper<ecc at cmu.edu>
[...]
> diff --git a/board/Marvell/dockstar/dockstar.c b/board/Marvell/dockstar/dockstar.c
> index 13cd347..7788837 100644
> --- a/board/Marvell/dockstar/dockstar.c
> +++ b/board/Marvell/dockstar/dockstar.c
> @@ -153,3 +153,33 @@ void reset_phy(void)
>   	printf("88E1116 Initialized on %s\n", name);
>   }
>   #endif /* CONFIG_RESET_PHY_R */
> +
> +#define GREEN_LED	(1<<  14)
> +#define ORANGE_LED	(1<<  15)
> +#define BOTH_LEDS	(GREEN_LED | ORANGE_LED)
> +#define NEITHER_LED	0
> +
> +static void set_leds(u32 leds, u32 blinking)
> +{
> +	struct kwgpio_registers *r = (struct kwgpio_registers *)KW_GPIO1_BASE;
> +	u32 oe = readl(&r->oe) | BOTH_LEDS;
> +	writel(oe&  ~leds,&r->oe);	/* active low */
> +	u32 bl = readl(&r->blink_en)&  ~BOTH_LEDS;
> +	writel(bl | blinking,&r->blink_en);
> +}
> +
> +void show_boot_progress(int val)
> +{
> +	switch (val) {
> +	    case 15:	/* booting Linux */

    *case* should be aligned with *switch*. Don't align using spaces.

> +		set_leds(BOTH_LEDS, NEITHER_LED);
> +		break;
> +	    case 64:	/* Ethernet initialization */
> +		set_leds(GREEN_LED, GREEN_LED);
> +		break;
> +	    default:
> +		if (val < 0)	/* error */
> +			set_leds(ORANGE_LED, ORANGE_LED);
> +		break;
> +	}
> +}

WBR, Sergei


More information about the U-Boot mailing list