mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
Blackfin: bf533-stamp: rewrite startup LED notifications
Again, don't clobber pins that we aren't actually using, and use the common LED framework rather than our own hob-job-but-not-really-working. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
cf6f469e27
commit
23fd959eea
2 changed files with 73 additions and 14 deletions
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* U-boot - stamp.c STAMP board specific routines
|
||||
* U-boot - main board file
|
||||
*
|
||||
* Copyright (c) 2005-2007 Analog Devices Inc.
|
||||
* Copyright (c) 2005-2008 Analog Devices Inc.
|
||||
*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
|
@ -31,15 +31,6 @@
|
|||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#define STATUS_LED_OFF 0
|
||||
#define STATUS_LED_ON 1
|
||||
|
||||
#ifdef CONFIG_SHOW_BOOT_PROGRESS
|
||||
# define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg)
|
||||
#else
|
||||
# define SHOW_BOOT_PROGRESS(arg)
|
||||
#endif
|
||||
|
||||
int checkboard(void)
|
||||
{
|
||||
printf("Board: ADI BF533 Stamp board\n");
|
||||
|
@ -192,10 +183,15 @@ void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words)
|
|||
}
|
||||
#endif
|
||||
|
||||
void stamp_led_set(int LED1, int LED2, int LED3)
|
||||
#ifdef CONFIG_SHOW_BOOT_PROGRESS
|
||||
|
||||
#define STATUS_LED_OFF 0
|
||||
#define STATUS_LED_ON 1
|
||||
|
||||
static void stamp_led_set(int LED1, int LED2, int LED3)
|
||||
{
|
||||
*pFIO_INEN &= ~(PF2 | PF3 | PF4);
|
||||
*pFIO_DIR |= (PF2 | PF3 | PF4);
|
||||
bfin_write_FIO_INEN(bfin_read_FIO_INEN() & ~(PF2 | PF3 | PF4));
|
||||
bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (PF2 | PF3 | PF4));
|
||||
|
||||
if (LED1 == STATUS_LED_OFF)
|
||||
*pFIO_FLAG_S = PF2;
|
||||
|
@ -249,3 +245,41 @@ void show_boot_progress(int status)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STATUS_LED
|
||||
#include <status_led.h>
|
||||
|
||||
static void set_led(int pf, int state)
|
||||
{
|
||||
switch (state) {
|
||||
case STATUS_LED_OFF: bfin_write_FIO_FLAG_S(pf); break;
|
||||
case STATUS_LED_BLINKING: bfin_write_FIO_FLAG_T(pf); break;
|
||||
case STATUS_LED_ON: bfin_write_FIO_FLAG_C(pf); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void set_leds(led_id_t mask, int state)
|
||||
{
|
||||
if (mask & 0x1) set_led(PF2, state);
|
||||
if (mask & 0x2) set_led(PF3, state);
|
||||
if (mask & 0x4) set_led(PF4, state);
|
||||
}
|
||||
|
||||
void __led_init(led_id_t mask, int state)
|
||||
{
|
||||
bfin_write_FIO_INEN(bfin_read_FIO_INEN() & ~(PF2 | PF3 | PF4));
|
||||
bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (PF2 | PF3 | PF4));
|
||||
}
|
||||
|
||||
void __led_set(led_id_t mask, int state)
|
||||
{
|
||||
set_leds(mask, state);
|
||||
}
|
||||
|
||||
void __led_toggle(led_id_t mask)
|
||||
{
|
||||
set_leds(mask, STATUS_LED_BLINKING);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -207,6 +207,31 @@
|
|||
/* FLASH/ETHERNET uses the same async bank */
|
||||
#define SHARED_RESOURCES 1
|
||||
|
||||
/* define to enable boot progress via leds */
|
||||
/* #define CONFIG_SHOW_BOOT_PROGRESS */
|
||||
|
||||
/* define to enable run status via led */
|
||||
/* #define CONFIG_STATUS_LED */
|
||||
#ifdef CONFIG_STATUS_LED
|
||||
#define CONFIG_BOARD_SPECIFIC_LED
|
||||
#ifndef __ASSEMBLY__
|
||||
typedef unsigned int led_id_t;
|
||||
void __led_init(led_id_t mask, int state);
|
||||
void __led_set(led_id_t mask, int state);
|
||||
void __led_toggle(led_id_t mask);
|
||||
#endif
|
||||
/* use LED1 to indicate booting/alive */
|
||||
#define STATUS_LED_BOOT 0
|
||||
#define STATUS_LED_BIT 1
|
||||
#define STATUS_LED_STATE STATUS_LED_ON
|
||||
#define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 4)
|
||||
/* use LED2 to indicate crash */
|
||||
#define STATUS_LED_CRASH 1
|
||||
#define STATUS_LED_BIT1 2
|
||||
#define STATUS_LED_STATE1 STATUS_LED_ON
|
||||
#define STATUS_LED_PERIOD1 (CONFIG_SYS_HZ / 2)
|
||||
#endif
|
||||
|
||||
/* define to enable splash screen support */
|
||||
/* #define CONFIG_VIDEO */
|
||||
|
||||
|
|
Loading…
Reference in a new issue