2 * (C) Copyright 2005 - 2006
3 * Martin Krause, TQ-Systems GmbH, martin.krause@tqs.de.
5 * See file CREDITS for list of people who contributed to this
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.
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.
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,
25 * TB5200 specific functions
32 #if defined(CONFIG_CMD_BSP)
33 #if defined (CONFIG_TB5200)
35 #define SM501_PANEL_DISPLAY_CONTROL 0x00080000UL
37 static void led_init(void)
39 struct mpc5xxx_gpt_0_7
*gpt
= (struct mpc5xxx_gpt_0_7
*)MPC5XXX_GPT
;
41 /* configure timer 4 for simple GPIO output */
42 gpt
->gpt4
.emsr
|= 0x00000024;
45 int cmd_led(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
47 struct mpc5xxx_gpt_0_7
*gpt
= (struct mpc5xxx_gpt_0_7
*)MPC5XXX_GPT
;
51 if (strcmp (argv
[1], "on") == 0) {
52 debug ("switch status LED on\n");
53 gpt
->gpt4
.emsr
|= (1 << 4);
54 } else if (strcmp (argv
[1], "off") == 0) {
55 debug ("switch status LED off\n");
56 gpt
->gpt4
.emsr
&= ~(1 << 4);
58 printf ("Usage:\nled on/off\n");
65 static void sm501_backlight (unsigned int state
)
68 *(vu_long
*)(SM501_MMIO_BASE
+SM501_PANEL_DISPLAY_CONTROL
) |=
69 (1 << 26) | (1 << 27);
70 } else if (state
== 0)
71 *(vu_long
*)(SM501_MMIO_BASE
+SM501_PANEL_DISPLAY_CONTROL
) &=
72 ~((1 << 26) | (1 << 27));
75 int cmd_backlight(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[])
77 if (strcmp (argv
[1], "on") == 0) {
78 debug ("switch backlight on\n");
80 } else if (strcmp (argv
[1], "off") == 0) {
81 debug ("switch backlight off\n");
84 printf ("Usage:\nbacklight on/off\n");
93 "led - switch status LED on or off\n",
98 backlight
, 2, 1, cmd_backlight
,
99 "backlight - switch backlight on or off\n",
103 #endif /* CONFIG_STK52XX */