status_led.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. /*
  2. * (C) Copyright 2000-2004
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. /*
  24. * The purpose of this code is to signal the operational status of a
  25. * target which usually boots over the network; while running in
  26. * PCBoot, a status LED is blinking. As soon as a valid BOOTP reply
  27. * message has been received, the LED is turned off. The Linux
  28. * kernel, once it is running, will start blinking the LED again,
  29. * with another frequency.
  30. */
  31. #ifndef _STATUS_LED_H_
  32. #define _STATUS_LED_H_
  33. #ifdef CONFIG_STATUS_LED
  34. #define STATUS_LED_OFF 0
  35. #define STATUS_LED_BLINKING 1
  36. #define STATUS_LED_ON 2
  37. void status_led_tick (unsigned long timestamp);
  38. void status_led_set (int led, int state);
  39. /***** TQM8xxL ********************************************************/
  40. #if defined(CONFIG_TQM8xxL) && !defined(CONFIG_HMI10)
  41. # define STATUS_LED_PAR im_cpm.cp_pbpar
  42. # define STATUS_LED_DIR im_cpm.cp_pbdir
  43. # define STATUS_LED_ODR im_cpm.cp_pbodr
  44. # define STATUS_LED_DAT im_cpm.cp_pbdat
  45. # define STATUS_LED_BIT 0x00000001
  46. # define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2)
  47. # define STATUS_LED_STATE STATUS_LED_BLINKING
  48. # define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */
  49. # define STATUS_LED_BOOT 0 /* LED 0 used for boot status */
  50. /***** MVS v1 **********************************************************/
  51. #elif (defined(CONFIG_MVS) && CONFIG_MVS < 2)
  52. # define STATUS_LED_PAR im_ioport.iop_pdpar
  53. # define STATUS_LED_DIR im_ioport.iop_pddir
  54. # undef STATUS_LED_ODR
  55. # define STATUS_LED_DAT im_ioport.iop_pddat
  56. # define STATUS_LED_BIT 0x00000001
  57. # define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2)
  58. # define STATUS_LED_STATE STATUS_LED_BLINKING
  59. # define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */
  60. # define STATUS_LED_BOOT 0 /* LED 0 used for boot status */
  61. /***** ETX_094 ********************************************************/
  62. #elif defined(CONFIG_ETX094)
  63. # define STATUS_LED_PAR im_ioport.iop_pdpar
  64. # define STATUS_LED_DIR im_ioport.iop_pddir
  65. # undef STATUS_LED_ODR
  66. # define STATUS_LED_DAT im_ioport.iop_pddat
  67. # define STATUS_LED_BIT 0x00000001
  68. # define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2)
  69. # define STATUS_LED_STATE STATUS_LED_BLINKING
  70. # define STATUS_LED_ACTIVE 0 /* LED on for bit == 0 */
  71. # define STATUS_LED_BOOT 0 /* LED 0 used for boot status */
  72. /***** GEN860T *********************************************************/
  73. #elif defined(CONFIG_GEN860T)
  74. # define STATUS_LED_PAR im_ioport.iop_papar
  75. # define STATUS_LED_DIR im_ioport.iop_padir
  76. # define STATUS_LED_ODR im_ioport.iop_paodr
  77. # define STATUS_LED_DAT im_ioport.iop_padat
  78. # define STATUS_LED_BIT 0x0800 /* Red LED 0 is on PA.4 */
  79. # define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 4)
  80. # define STATUS_LED_STATE STATUS_LED_OFF
  81. # define STATUS_LED_BIT1 0x0400 /* Grn LED 1 is on PA.5 */
  82. # define STATUS_LED_PERIOD1 (CONFIG_SYS_HZ / 8)
  83. # define STATUS_LED_STATE1 STATUS_LED_BLINKING
  84. # define STATUS_LED_BIT2 0x0080 /* Red LED 2 is on PA.8 */
  85. # define STATUS_LED_PERIOD2 (CONFIG_SYS_HZ / 4)
  86. # define STATUS_LED_STATE2 STATUS_LED_OFF
  87. # define STATUS_LED_BIT3 0x0040 /* Grn LED 3 is on PA.9 */
  88. # define STATUS_LED_PERIOD3 (CONFIG_SYS_HZ / 4)
  89. # define STATUS_LED_STATE3 STATUS_LED_OFF
  90. # define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */
  91. # define STATUS_LED_BOOT 1 /* Boot status on LED 1 */
  92. /***** IVMS8 **********************************************************/
  93. #elif defined(CONFIG_IVMS8)
  94. # define STATUS_LED_PAR im_cpm.cp_pbpar
  95. # define STATUS_LED_DIR im_cpm.cp_pbdir
  96. # define STATUS_LED_ODR im_cpm.cp_pbodr
  97. # define STATUS_LED_DAT im_cpm.cp_pbdat
  98. # define STATUS_LED_BIT 0x00000010 /* LED 0 is on PB.27 */
  99. # define STATUS_LED_PERIOD (1 * CONFIG_SYS_HZ)
  100. # define STATUS_LED_STATE STATUS_LED_OFF
  101. # define STATUS_LED_BIT1 0x00000020 /* LED 1 is on PB.26 */
  102. # define STATUS_LED_PERIOD1 (1 * CONFIG_SYS_HZ)
  103. # define STATUS_LED_STATE1 STATUS_LED_OFF
  104. /* IDE LED usable for other purposes, too */
  105. # define STATUS_LED_BIT2 0x00000008 /* LED 2 is on PB.28 */
  106. # define STATUS_LED_PERIOD2 (1 * CONFIG_SYS_HZ)
  107. # define STATUS_LED_STATE2 STATUS_LED_OFF
  108. # define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */
  109. # define STATUS_ILOCK_SWITCH 0x00800000 /* ILOCK switch in IRQ4 */
  110. # define STATUS_ILOCK_PERIOD (CONFIG_SYS_HZ / 10) /* about every 100 ms */
  111. # define STATUS_LED_YELLOW 0
  112. # define STATUS_LED_GREEN 1
  113. # define STATUS_LED_BOOT 2 /* IDE LED used for boot status */
  114. /***** IVML24 *********************************************************/
  115. #elif defined(CONFIG_IVML24)
  116. # define STATUS_LED_PAR im_cpm.cp_pbpar
  117. # define STATUS_LED_DIR im_cpm.cp_pbdir
  118. # define STATUS_LED_ODR im_cpm.cp_pbodr
  119. # define STATUS_LED_DAT im_cpm.cp_pbdat
  120. # define STATUS_LED_BIT 0x00000010 /* LED 0 is on PB.27 */
  121. # define STATUS_LED_PERIOD (1 * CONFIG_SYS_HZ)
  122. # define STATUS_LED_STATE STATUS_LED_OFF
  123. # define STATUS_LED_BIT1 0x00000020 /* LED 1 is on PB.26 */
  124. # define STATUS_LED_PERIOD1 (1 * CONFIG_SYS_HZ)
  125. # define STATUS_LED_STATE1 STATUS_LED_OFF
  126. /* IDE LED usable for other purposes, too */
  127. # define STATUS_LED_BIT2 0x00000008 /* LED 2 is on PB.28 */
  128. # define STATUS_LED_PERIOD2 (1 * CONFIG_SYS_HZ)
  129. # define STATUS_LED_STATE2 STATUS_LED_OFF
  130. # define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */
  131. # define STATUS_ILOCK_SWITCH 0x00004000 /* ILOCK is on PB.17 */
  132. # define STATUS_ILOCK_PERIOD (CONFIG_SYS_HZ / 10) /* about every 100 ms */
  133. # define STATUS_LED_YELLOW 0
  134. # define STATUS_LED_GREEN 1
  135. # define STATUS_LED_BOOT 2 /* IDE LED used for boot status */
  136. /***** LANTEC *********************************************************/
  137. #elif defined(CONFIG_LANTEC)
  138. # define STATUS_LED_PAR im_ioport.iop_pdpar
  139. # define STATUS_LED_DIR im_ioport.iop_pddir
  140. # undef STATUS_LED_ODR
  141. # define STATUS_LED_DAT im_ioport.iop_pddat
  142. # if CONFIG_LATEC < 2
  143. # define STATUS_LED_BIT 0x1000
  144. # else
  145. # define STATUS_LED_BIT 0x0800
  146. # endif
  147. # define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2)
  148. # define STATUS_LED_STATE STATUS_LED_BLINKING
  149. # define STATUS_LED_ACTIVE 0 /* LED on for bit == 0 */
  150. # define STATUS_LED_BOOT 0 /* LED 0 used for boot status */
  151. /***** PCU E and CCM ************************************************/
  152. #elif (defined(CONFIG_PCU_E) || defined(CONFIG_CCM))
  153. # define STATUS_LED_PAR im_cpm.cp_pbpar
  154. # define STATUS_LED_DIR im_cpm.cp_pbdir
  155. # define STATUS_LED_ODR im_cpm.cp_pbodr
  156. # define STATUS_LED_DAT im_cpm.cp_pbdat
  157. # define STATUS_LED_BIT 0x00010000 /* green LED is on PB.15 */
  158. # define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2)
  159. # define STATUS_LED_STATE STATUS_LED_BLINKING
  160. # define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */
  161. # define STATUS_LED_BOOT 0 /* LED 0 used for boot status */
  162. /***** ICU862 ********************************************************/
  163. #elif defined(CONFIG_ICU862)
  164. # define STATUS_LED_PAR im_ioport.iop_papar
  165. # define STATUS_LED_DIR im_ioport.iop_padir
  166. # define STATUS_LED_ODR im_ioport.iop_paodr
  167. # define STATUS_LED_DAT im_ioport.iop_padat
  168. # define STATUS_LED_BIT 0x4000 /* LED 0 is on PA.1 */
  169. # define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2)
  170. # define STATUS_LED_STATE STATUS_LED_BLINKING
  171. # define STATUS_LED_BIT1 0x1000 /* LED 1 is on PA.3 */
  172. # define STATUS_LED_PERIOD1 (CONFIG_SYS_HZ)
  173. # define STATUS_LED_STATE1 STATUS_LED_OFF
  174. # define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */
  175. # define STATUS_LED_BOOT 0 /* LED 0 used for boot status */
  176. /***** Someone else defines these *************************************/
  177. #elif defined(STATUS_LED_PAR)
  178. /*
  179. * ADVICE: Define in your board configuration file rather than
  180. * filling this file up with lots of custom board stuff.
  181. */
  182. /***** NetVia ********************************************************/
  183. #elif defined(CONFIG_NETVIA)
  184. #if !defined(CONFIG_NETVIA_VERSION) || CONFIG_NETVIA_VERSION == 1
  185. #define STATUS_LED_PAR im_ioport.iop_pdpar
  186. #define STATUS_LED_DIR im_ioport.iop_pddir
  187. #undef STATUS_LED_ODR
  188. #define STATUS_LED_DAT im_ioport.iop_pddat
  189. # define STATUS_LED_BIT 0x0080 /* PD.8 */
  190. # define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2)
  191. # define STATUS_LED_STATE STATUS_LED_BLINKING
  192. # define STATUS_LED_BIT1 0x0040 /* PD.9 */
  193. # define STATUS_LED_PERIOD1 (CONFIG_SYS_HZ / 2)
  194. # define STATUS_LED_STATE1 STATUS_LED_OFF
  195. # define STATUS_LED_ACTIVE 0 /* LED on for bit == 0 */
  196. # define STATUS_LED_BOOT 0 /* LED 0 used for boot status */
  197. #endif
  198. /***** CMI ********************************************************/
  199. #elif defined(CONFIG_CMI)
  200. # define STATUS_LED_DIR im_mios.mios_mpiosm32ddr
  201. # define STATUS_LED_DAT im_mios.mios_mpiosm32dr
  202. # define STATUS_LED_BIT 0x2000 /* Select one of the 16 possible*/
  203. /* MIOS outputs */
  204. # define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2) /* Blinking periode is 500 ms */
  205. # define STATUS_LED_STATE STATUS_LED_BLINKING
  206. # define STATUS_LED_ACTIVE 1 /* LED on for bit == 0 */
  207. # define STATUS_LED_BOOT 0 /* LED 0 used for boot status */
  208. /***** KUP4K, KUP4X ****************************************************/
  209. #elif defined(CONFIG_KUP4K) || defined(CONFIG_KUP4X) || defined(CONFIG_CCM)
  210. # define STATUS_LED_PAR im_ioport.iop_papar
  211. # define STATUS_LED_DIR im_ioport.iop_padir
  212. # define STATUS_LED_ODR im_ioport.iop_paodr
  213. # define STATUS_LED_DAT im_ioport.iop_padat
  214. # define STATUS_LED_BIT 0x00000300 /* green + red PA[8]=yellow, PA[7]=red, PA[6]=green */
  215. # define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2)
  216. # define STATUS_LED_STATE STATUS_LED_BLINKING
  217. # define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */
  218. # define STATUS_LED_BOOT 0 /* LED 0 used for boot status */
  219. #elif defined(CONFIG_SVM_SC8xx)
  220. # define STATUS_LED_PAR im_cpm.cp_pbpar
  221. # define STATUS_LED_DIR im_cpm.cp_pbdir
  222. # define STATUS_LED_ODR im_cpm.cp_pbodr
  223. # define STATUS_LED_DAT im_cpm.cp_pbdat
  224. # define STATUS_LED_BIT 0x00000001
  225. # define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2)
  226. # define STATUS_LED_STATE STATUS_LED_BLINKING
  227. # define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */
  228. # define STATUS_LED_BOOT 0 /* LED 0 used for boot status */
  229. /***** RBC823 ********************************************************/
  230. #elif defined(CONFIG_RBC823)
  231. # define STATUS_LED_PAR im_ioport.iop_pcpar
  232. # define STATUS_LED_DIR im_ioport.iop_pcdir
  233. # undef STATUS_LED_ODR
  234. # define STATUS_LED_DAT im_ioport.iop_pcdat
  235. # define STATUS_LED_BIT 0x0002 /* LED 0 is on PC.14 */
  236. # define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2)
  237. # define STATUS_LED_STATE STATUS_LED_BLINKING
  238. # define STATUS_LED_BIT1 0x0004 /* LED 1 is on PC.13 */
  239. # define STATUS_LED_PERIOD1 (CONFIG_SYS_HZ)
  240. # define STATUS_LED_STATE1 STATUS_LED_OFF
  241. # define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */
  242. # define STATUS_LED_BOOT 0 /* LED 0 used for boot status */
  243. /***** HMI10 **********************************************************/
  244. #elif defined(CONFIG_HMI10)
  245. # define STATUS_LED_PAR im_ioport.iop_papar
  246. # define STATUS_LED_DIR im_ioport.iop_padir
  247. # define STATUS_LED_ODR im_ioport.iop_paodr
  248. # define STATUS_LED_DAT im_ioport.iop_padat
  249. # define STATUS_LED_BIT 0x00000001 /* LED is on PA15 */
  250. # define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2)
  251. # define STATUS_LED_STATE STATUS_LED_BLINKING
  252. # define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */
  253. # define STATUS_LED_BOOT 0 /* LED 0 used for boot status */
  254. /***** NetPhone ********************************************************/
  255. #elif defined(CONFIG_NETPHONE) || defined(CONFIG_NETTA2)
  256. /* XXX empty just to avoid the error */
  257. /***** STx XTc ********************************************************/
  258. #elif defined(CONFIG_STXXTC)
  259. /* XXX empty just to avoid the error */
  260. /***** sbc8240 ********************************************************/
  261. #elif defined(CONFIG_WRSBC8240)
  262. /* XXX empty just to avoid the error */
  263. /************************************************************************/
  264. #elif defined(CONFIG_NIOS2)
  265. /* XXX empty just to avoid the error */
  266. /************************************************************************/
  267. #elif defined(CONFIG_BLACKFIN)
  268. /* XXX empty just to avoid the error */
  269. /************************************************************************/
  270. #elif defined(CONFIG_V38B)
  271. # define STATUS_LED_BIT 0x0010 /* Timer7 GPIO */
  272. # define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2)
  273. # define STATUS_LED_STATE STATUS_LED_BLINKING
  274. # define STATUS_LED_ACTIVE 0 /* LED on for bit == 0 */
  275. # define STATUS_LED_BOOT 0 /* LED 0 used for boot status */
  276. #elif defined(CONFIG_MOTIONPRO)
  277. #define STATUS_LED_BIT ((vu_long *) MPC5XXX_GPT6_ENABLE)
  278. #define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 10)
  279. #define STATUS_LED_STATE STATUS_LED_BLINKING
  280. #define STATUS_LED_BIT1 ((vu_long *) MPC5XXX_GPT7_ENABLE)
  281. #define STATUS_LED_PERIOD1 (CONFIG_SYS_HZ / 10)
  282. #define STATUS_LED_STATE1 STATUS_LED_OFF
  283. #define STATUS_LED_BOOT 0 /* LED 0 used for boot status */
  284. #elif defined(CONFIG_BOARD_SPECIFIC_LED)
  285. /* led_id_t is unsigned long mask */
  286. typedef unsigned long led_id_t;
  287. extern void __led_toggle (led_id_t mask);
  288. extern void __led_init (led_id_t mask, int state);
  289. extern void __led_set (led_id_t mask, int state);
  290. #else
  291. # error Status LED configuration missing
  292. #endif
  293. /************************************************************************/
  294. #ifndef CONFIG_BOARD_SPECIFIC_LED
  295. # include <asm/status_led.h>
  296. #endif
  297. /*
  298. * Coloured LEDs API
  299. */
  300. #ifndef __ASSEMBLY__
  301. extern void coloured_LED_init (void);
  302. extern void red_LED_on(void);
  303. extern void red_LED_off(void);
  304. extern void green_LED_on(void);
  305. extern void green_LED_off(void);
  306. extern void yellow_LED_on(void);
  307. extern void yellow_LED_off(void);
  308. extern void blue_LED_on(void);
  309. extern void blue_LED_off(void);
  310. #else
  311. .extern LED_init
  312. .extern red_LED_on
  313. .extern red_LED_off
  314. .extern yellow_LED_on
  315. .extern yellow_LED_off
  316. .extern green_LED_on
  317. .extern green_LED_off
  318. .extern blue_LED_on
  319. .extern blue_LED_off
  320. #endif
  321. #endif /* CONFIG_STATUS_LED */
  322. #endif /* _STATUS_LED_H_ */