1c609719bSwdenk /* 204a85b3bSwdenk * (C) Copyright 2000-2004 3c609719bSwdenk * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 4c609719bSwdenk * 51a459660SWolfgang Denk * SPDX-License-Identifier: GPL-2.0+ 6c609719bSwdenk */ 7c609719bSwdenk 8c609719bSwdenk /* 9c609719bSwdenk * The purpose of this code is to signal the operational status of a 10c609719bSwdenk * target which usually boots over the network; while running in 11c609719bSwdenk * PCBoot, a status LED is blinking. As soon as a valid BOOTP reply 12c609719bSwdenk * message has been received, the LED is turned off. The Linux 13c609719bSwdenk * kernel, once it is running, will start blinking the LED again, 14c609719bSwdenk * with another frequency. 15c609719bSwdenk */ 16c609719bSwdenk 17c609719bSwdenk #ifndef _STATUS_LED_H_ 18c609719bSwdenk #define _STATUS_LED_H_ 19c609719bSwdenk 20*2d8d190cSUri Mashiach #ifdef CONFIG_LED_STATUS 21c609719bSwdenk 22*2d8d190cSUri Mashiach #define LED_STATUS_PERIOD (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ) 23*2d8d190cSUri Mashiach #ifdef CONFIG_LED_STATUS1 24*2d8d190cSUri Mashiach #define LED_STATUS_PERIOD1 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ1) 25*2d8d190cSUri Mashiach #endif /* CONFIG_LED_STATUS1 */ 26*2d8d190cSUri Mashiach #ifdef CONFIG_LED_STATUS2 27*2d8d190cSUri Mashiach #define LED_STATUS_PERIOD2 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ2) 28*2d8d190cSUri Mashiach #endif /* CONFIG_LED_STATUS2 */ 29*2d8d190cSUri Mashiach #ifdef CONFIG_LED_STATUS3 30*2d8d190cSUri Mashiach #define LED_STATUS_PERIOD3 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ3) 31*2d8d190cSUri Mashiach #endif /* CONFIG_LED_STATUS3 */ 32*2d8d190cSUri Mashiach #ifdef CONFIG_LED_STATUS4 33*2d8d190cSUri Mashiach #define LED_STATUS_PERIOD4 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ4) 34*2d8d190cSUri Mashiach #endif /* CONFIG_LED_STATUS4 */ 35*2d8d190cSUri Mashiach #ifdef CONFIG_LED_STATUS5 36*2d8d190cSUri Mashiach #define LED_STATUS_PERIOD5 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ5) 37*2d8d190cSUri Mashiach #endif /* CONFIG_LED_STATUS5 */ 38c609719bSwdenk 3913cfbe51SBernhard Nortmann void status_led_init(void); 40c609719bSwdenk void status_led_tick (unsigned long timestamp); 41c609719bSwdenk void status_led_set (int led, int state); 42c609719bSwdenk 43c609719bSwdenk /***** TQM8xxL ********************************************************/ 4477efe35fSWolfgang Denk #if defined(CONFIG_TQM8xxL) 45c609719bSwdenk # define STATUS_LED_PAR im_cpm.cp_pbpar 46c609719bSwdenk # define STATUS_LED_DIR im_cpm.cp_pbdir 47c609719bSwdenk # define STATUS_LED_ODR im_cpm.cp_pbodr 48c609719bSwdenk # define STATUS_LED_DAT im_cpm.cp_pbdat 49c609719bSwdenk 50c609719bSwdenk # define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */ 51c609719bSwdenk 52c609719bSwdenk /***** MVS v1 **********************************************************/ 53c609719bSwdenk #elif (defined(CONFIG_MVS) && CONFIG_MVS < 2) 54c609719bSwdenk # define STATUS_LED_PAR im_ioport.iop_pdpar 55c609719bSwdenk # define STATUS_LED_DIR im_ioport.iop_pddir 56c609719bSwdenk # undef STATUS_LED_ODR 57c609719bSwdenk # define STATUS_LED_DAT im_ioport.iop_pddat 58c609719bSwdenk 59c609719bSwdenk # define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */ 60c609719bSwdenk 61c609719bSwdenk /***** Someone else defines these *************************************/ 62c609719bSwdenk #elif defined(STATUS_LED_PAR) 63c609719bSwdenk /* 64c609719bSwdenk * ADVICE: Define in your board configuration file rather than 65c609719bSwdenk * filling this file up with lots of custom board stuff. 66c609719bSwdenk */ 67c609719bSwdenk 684707fb50SBartlomiej Sieka #elif defined(CONFIG_V38B) 694707fb50SBartlomiej Sieka 704707fb50SBartlomiej Sieka # define STATUS_LED_ACTIVE 0 /* LED on for bit == 0 */ 714707fb50SBartlomiej Sieka 72*2d8d190cSUri Mashiach #elif defined(CONFIG_LED_STATUS_BOARD_SPECIFIC) 73566a494fSHeiko Schocher /* led_id_t is unsigned long mask */ 74566a494fSHeiko Schocher typedef unsigned long led_id_t; 75566a494fSHeiko Schocher 76566a494fSHeiko Schocher extern void __led_toggle (led_id_t mask); 77566a494fSHeiko Schocher extern void __led_init (led_id_t mask, int state); 78566a494fSHeiko Schocher extern void __led_set (led_id_t mask, int state); 79a8eeaf2fSStefan Roese void __led_blink(led_id_t mask, int freq); 80c609719bSwdenk #else 81c609719bSwdenk # error Status LED configuration missing 82c609719bSwdenk #endif 83c609719bSwdenk /************************************************************************/ 84c609719bSwdenk 85*2d8d190cSUri Mashiach #ifndef CONFIG_LED_STATUS_BOARD_SPECIFIC 8648b42616Swdenk # include <asm/status_led.h> 8748b42616Swdenk #endif 8848b42616Swdenk 89*2d8d190cSUri Mashiach #endif /* CONFIG_LED_STATUS */ 90c5d4001aSJeroen Hofstee 91bd86220fSPeter Pearse /* 92bd86220fSPeter Pearse * Coloured LEDs API 93bd86220fSPeter Pearse */ 94bd86220fSPeter Pearse #ifndef __ASSEMBLY__ 95c5d4001aSJeroen Hofstee void coloured_LED_init(void); 96c5d4001aSJeroen Hofstee void red_led_on(void); 97c5d4001aSJeroen Hofstee void red_led_off(void); 98c5d4001aSJeroen Hofstee void green_led_on(void); 99c5d4001aSJeroen Hofstee void green_led_off(void); 100c5d4001aSJeroen Hofstee void yellow_led_on(void); 101c5d4001aSJeroen Hofstee void yellow_led_off(void); 102c5d4001aSJeroen Hofstee void blue_led_on(void); 103c5d4001aSJeroen Hofstee void blue_led_off(void); 104bd86220fSPeter Pearse #else 105bd86220fSPeter Pearse .extern LED_init 1062d3be7c4SJason Kridner .extern red_led_on 1072d3be7c4SJason Kridner .extern red_led_off 1082d3be7c4SJason Kridner .extern yellow_led_on 1092d3be7c4SJason Kridner .extern yellow_led_off 1102d3be7c4SJason Kridner .extern green_led_on 1112d3be7c4SJason Kridner .extern green_led_off 1122d3be7c4SJason Kridner .extern blue_led_on 1132d3be7c4SJason Kridner .extern blue_led_off 114bd86220fSPeter Pearse #endif 115bd86220fSPeter Pearse 116c609719bSwdenk #endif /* _STATUS_LED_H_ */ 117