From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergei Shtylyov Date: Wed, 08 Sep 2010 14:24:47 +0400 Subject: [U-Boot] [PATCH 5/5] DockStar: LED support In-Reply-To: <1283869696-10077-6-git-send-email-ecc@cmu.edu> References: <1283869696-10077-1-git-send-email-ecc@cmu.edu> <1283869696-10077-6-git-send-email-ecc@cmu.edu> Message-ID: <4C87646F.4020008@mvista.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 [...] > 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