2 * (C) Copyright 2005 - 2006
3 * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.de.
5 * SPDX-License-Identifier: GPL-2.0+
9 * TB5200 specific functions
16 #if defined(CONFIG_CMD_BSP)
17 #if defined (CONFIG_TB5200)
19 #define SM501_PANEL_DISPLAY_CONTROL 0x00080000UL
21 static void led_init(void)
23 struct mpc5xxx_gpt_0_7 *gpt = (struct mpc5xxx_gpt_0_7 *)MPC5XXX_GPT;
25 /* configure timer 4 for simple GPIO output */
26 gpt->gpt4.emsr |= 0x00000024;
29 int cmd_led(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
31 struct mpc5xxx_gpt_0_7 *gpt = (struct mpc5xxx_gpt_0_7 *)MPC5XXX_GPT;
35 if (strcmp (argv[1], "on") == 0) {
36 debug ("switch status LED on\n");
37 gpt->gpt4.emsr |= (1 << 4);
38 } else if (strcmp (argv[1], "off") == 0) {
39 debug ("switch status LED off\n");
40 gpt->gpt4.emsr &= ~(1 << 4);
42 printf ("Usage:\nled on/off\n");
49 static void sm501_backlight (unsigned int state)
52 *(vu_long *)(SM501_MMIO_BASE+SM501_PANEL_DISPLAY_CONTROL) |=
53 (1 << 26) | (1 << 27);
54 } else if (state == 0)
55 *(vu_long *)(SM501_MMIO_BASE+SM501_PANEL_DISPLAY_CONTROL) &=
56 ~((1 << 26) | (1 << 27));
59 int cmd_backlight(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
61 if (strcmp (argv[1], "on") == 0) {
62 debug ("switch backlight on\n");
64 } else if (strcmp (argv[1], "off") == 0) {
65 debug ("switch backlight off\n");
68 printf ("Usage:\nbacklight on/off\n");
77 "switch status LED on or off",
82 backlight , 2, 1, cmd_backlight,
83 "switch backlight on or off",
87 #endif /* CONFIG_STK52XX */