mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-16 17:58:23 +00:00
2d8d190c83
Move all of the status LED feature to drivers/led/Kconfig. The LED status definitions were moved from the board configuration files to the defconfig files. TBD: Move all of the definitions in the include/status_led.h to the relevant board's defconfig files. Tested boards: CL-SOM-AM57x, CM-T335 Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
77 lines
1.5 KiB
C
77 lines
1.5 KiB
C
/*
|
|
* asm/status_led.h
|
|
*
|
|
* MPC8xx/MPC8260/MPC5xx based status led support functions
|
|
*/
|
|
|
|
#ifndef __ASM_STATUS_LED_H__
|
|
#define __ASM_STATUS_LED_H__
|
|
|
|
/* if not overridden */
|
|
#ifndef CONFIG_LED_STATUS_BOARD_SPECIFIC
|
|
# if defined(CONFIG_8xx)
|
|
# include <mpc8xx.h>
|
|
# elif defined(CONFIG_MPC8260)
|
|
# include <mpc8260.h>
|
|
# elif defined(CONFIG_5xx)
|
|
# include <mpc5xx.h>
|
|
# else
|
|
# error CPU specific Status LED header file missing.
|
|
#endif
|
|
|
|
/* led_id_t is unsigned long mask */
|
|
typedef unsigned long led_id_t;
|
|
|
|
static inline void __led_init (led_id_t mask, int state)
|
|
{
|
|
volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
|
|
|
|
#ifdef STATUS_LED_PAR
|
|
immr->STATUS_LED_PAR &= ~mask;
|
|
#endif
|
|
#ifdef STATUS_LED_ODR
|
|
immr->STATUS_LED_ODR &= ~mask;
|
|
#endif
|
|
|
|
#if (STATUS_LED_ACTIVE == 0)
|
|
if (state == CONFIG_LED_STATUS_ON)
|
|
immr->STATUS_LED_DAT &= ~mask;
|
|
else
|
|
immr->STATUS_LED_DAT |= mask;
|
|
#else
|
|
if (state == CONFIG_LED_STATUS_ON)
|
|
immr->STATUS_LED_DAT |= mask;
|
|
else
|
|
immr->STATUS_LED_DAT &= ~mask;
|
|
#endif
|
|
#ifdef STATUS_LED_DIR
|
|
immr->STATUS_LED_DIR |= mask;
|
|
#endif
|
|
}
|
|
|
|
static inline void __led_toggle (led_id_t mask)
|
|
{
|
|
((immap_t *) CONFIG_SYS_IMMR)->STATUS_LED_DAT ^= mask;
|
|
}
|
|
|
|
static inline void __led_set (led_id_t mask, int state)
|
|
{
|
|
volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
|
|
|
|
#if (STATUS_LED_ACTIVE == 0)
|
|
if (state == CONFIG_LED_STATUS_ON)
|
|
immr->STATUS_LED_DAT &= ~mask;
|
|
else
|
|
immr->STATUS_LED_DAT |= mask;
|
|
#else
|
|
if (state == CONFIG_LED_STATUS_ON)
|
|
immr->STATUS_LED_DAT |= mask;
|
|
else
|
|
immr->STATUS_LED_DAT &= ~mask;
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* __ASM_STATUS_LED_H__ */
|