LED BOOT support added for Cubieboard2.
PATCH 1/1 LED BOOT support added for Cubieboard2.
PH20 and PH21 are two LED on the board which users can select to be turn on at boot time.
Signed-off-by Javad Rahimi <[email protected]>
---
board/sunxi/board.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
board/sunxi/board.c +42 -0
@@ -1002,3 +1002,45 @@ int board_fit_config_name_match(const char *name)return ret; }#endif + +#if defined(CONFIG_LED_STATUS ) && defined(CONFIG_LED_STATUS_BOOT ) && defined(CONFIG_LED_STATUS_BOARD_SPECIFIC ) + +#define CUBIE2_LED_BOOT_GPIO "PH20" +static int gpio_boot_led; + +void __led_init (led_id_t mask,int state) +{ +int ret; + +if (CONFIG_LED_STATUS_BOOT != mask) +return ; + + ret =gpio_lookup_name (CUBIE2_LED_BOOT_GPIO ,NULL ,NULL , &gpio_boot_led); + +if (ret) +debug ("[gpio_lookup_name]LED Err: %d" , ret); +return ; + +gpio_request (gpio_boot_led,"boot_led" ); +gpio_direction_output (gpio_boot_led,1 ); +__led_set (mask, state); +} + +void __led_set (led_id_t mask,int state) +{ +if (CONFIG_LED_STATUS_BOOT != mask) +return ; + +debug ("[__led_set]LED Mask:%ld, STATE:%d\n" , mask, state); +gpio_set_value (gpio_boot_led, state); +} + +void __led_toggle (led_id_t mask) +{ +if (CONFIG_LED_STATUS_BOOT != mask) +return ; + +gpio_set_value (gpio_boot_led, ~gpio_get_value (gpio_boot_led)); +} + +#endif
Signature · 1 line
2.25.1