1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */ 2c609719bSwdenk /* 304a85b3bSwdenk * (C) Copyright 2000-2004 4c609719bSwdenk * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 5c609719bSwdenk */ 6c609719bSwdenk 7c609719bSwdenk /* 8c609719bSwdenk * The purpose of this code is to signal the operational status of a 9c609719bSwdenk * target which usually boots over the network; while running in 10c609719bSwdenk * PCBoot, a status LED is blinking. As soon as a valid BOOTP reply 11c609719bSwdenk * message has been received, the LED is turned off. The Linux 12c609719bSwdenk * kernel, once it is running, will start blinking the LED again, 13c609719bSwdenk * with another frequency. 14c609719bSwdenk */ 15c609719bSwdenk 16c609719bSwdenk #ifndef _STATUS_LED_H_ 17c609719bSwdenk #define _STATUS_LED_H_ 18c609719bSwdenk 192d8d190cSUri Mashiach #ifdef CONFIG_LED_STATUS 20c609719bSwdenk 212d8d190cSUri Mashiach #define LED_STATUS_PERIOD (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ) 222d8d190cSUri Mashiach #ifdef CONFIG_LED_STATUS1 232d8d190cSUri Mashiach #define LED_STATUS_PERIOD1 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ1) 242d8d190cSUri Mashiach #endif /* CONFIG_LED_STATUS1 */ 252d8d190cSUri Mashiach #ifdef CONFIG_LED_STATUS2 262d8d190cSUri Mashiach #define LED_STATUS_PERIOD2 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ2) 272d8d190cSUri Mashiach #endif /* CONFIG_LED_STATUS2 */ 282d8d190cSUri Mashiach #ifdef CONFIG_LED_STATUS3 292d8d190cSUri Mashiach #define LED_STATUS_PERIOD3 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ3) 302d8d190cSUri Mashiach #endif /* CONFIG_LED_STATUS3 */ 312d8d190cSUri Mashiach #ifdef CONFIG_LED_STATUS4 322d8d190cSUri Mashiach #define LED_STATUS_PERIOD4 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ4) 332d8d190cSUri Mashiach #endif /* CONFIG_LED_STATUS4 */ 342d8d190cSUri Mashiach #ifdef CONFIG_LED_STATUS5 352d8d190cSUri Mashiach #define LED_STATUS_PERIOD5 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ5) 362d8d190cSUri Mashiach #endif /* CONFIG_LED_STATUS5 */ 37c609719bSwdenk 3813cfbe51SBernhard Nortmann void status_led_init(void); 39c609719bSwdenk void status_led_tick (unsigned long timestamp); 40c609719bSwdenk void status_led_set (int led, int state); 41c609719bSwdenk 42c609719bSwdenk /***** MVS v1 **********************************************************/ 435b8e76c3SHeiko Schocher #if (defined(CONFIG_MVS) && CONFIG_MVS < 2) 44c609719bSwdenk # define STATUS_LED_PAR im_ioport.iop_pdpar 45c609719bSwdenk # define STATUS_LED_DIR im_ioport.iop_pddir 46c609719bSwdenk # undef STATUS_LED_ODR 47c609719bSwdenk # define STATUS_LED_DAT im_ioport.iop_pddat 48c609719bSwdenk 49c609719bSwdenk # define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */ 50c609719bSwdenk 51c609719bSwdenk /***** Someone else defines these *************************************/ 52c609719bSwdenk #elif defined(STATUS_LED_PAR) 53c609719bSwdenk /* 54c609719bSwdenk * ADVICE: Define in your board configuration file rather than 55c609719bSwdenk * filling this file up with lots of custom board stuff. 56c609719bSwdenk */ 57c609719bSwdenk 582d8d190cSUri Mashiach #elif defined(CONFIG_LED_STATUS_BOARD_SPECIFIC) 59566a494fSHeiko Schocher /* led_id_t is unsigned long mask */ 60566a494fSHeiko Schocher typedef unsigned long led_id_t; 61566a494fSHeiko Schocher 62566a494fSHeiko Schocher extern void __led_toggle (led_id_t mask); 63566a494fSHeiko Schocher extern void __led_init (led_id_t mask, int state); 64566a494fSHeiko Schocher extern void __led_set (led_id_t mask, int state); 65a8eeaf2fSStefan Roese void __led_blink(led_id_t mask, int freq); 66c609719bSwdenk #else 67c609719bSwdenk # error Status LED configuration missing 68c609719bSwdenk #endif 69c609719bSwdenk /************************************************************************/ 70c609719bSwdenk 712d8d190cSUri Mashiach #ifndef CONFIG_LED_STATUS_BOARD_SPECIFIC 7248b42616Swdenk # include <asm/status_led.h> 7348b42616Swdenk #endif 7448b42616Swdenk 752d8d190cSUri Mashiach #endif /* CONFIG_LED_STATUS */ 76c5d4001aSJeroen Hofstee 77bd86220fSPeter Pearse /* 78bd86220fSPeter Pearse * Coloured LEDs API 79bd86220fSPeter Pearse */ 80bd86220fSPeter Pearse #ifndef __ASSEMBLY__ 81c5d4001aSJeroen Hofstee void coloured_LED_init(void); 82c5d4001aSJeroen Hofstee void red_led_on(void); 83c5d4001aSJeroen Hofstee void red_led_off(void); 84c5d4001aSJeroen Hofstee void green_led_on(void); 85c5d4001aSJeroen Hofstee void green_led_off(void); 86c5d4001aSJeroen Hofstee void yellow_led_on(void); 87c5d4001aSJeroen Hofstee void yellow_led_off(void); 88c5d4001aSJeroen Hofstee void blue_led_on(void); 89c5d4001aSJeroen Hofstee void blue_led_off(void); 90bd86220fSPeter Pearse #else 91bd86220fSPeter Pearse .extern LED_init 922d3be7c4SJason Kridner .extern red_led_on 932d3be7c4SJason Kridner .extern red_led_off 942d3be7c4SJason Kridner .extern yellow_led_on 952d3be7c4SJason Kridner .extern yellow_led_off 962d3be7c4SJason Kridner .extern green_led_on 972d3be7c4SJason Kridner .extern green_led_off 982d3be7c4SJason Kridner .extern blue_led_on 992d3be7c4SJason Kridner .extern blue_led_off 100bd86220fSPeter Pearse #endif 101bd86220fSPeter Pearse 102c609719bSwdenk #endif /* _STATUS_LED_H_ */ 103