]> git.ipfire.org Git - people/ms/u-boot.git/blob - board/intercontrol/digsy_mtc/cmd_disp.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[people/ms/u-boot.git] / board / intercontrol / digsy_mtc / cmd_disp.c
1 /*
2 * (C) Copyright 2011 DENX Software Engineering,
3 * Anatolij Gustschin <agust@denx.de>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8 #include <common.h>
9 #include <command.h>
10 #include <mpc5xxx.h>
11 #include <asm/io.h>
12
13 #define GPIO_USB1_0 0x00010000
14
15 static int cmd_disp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
16 {
17 struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio *)MPC5XXX_GPIO;
18
19 if (argc < 2) {
20 printf("%s\n",
21 in_be32(&gpio->simple_dvo) & GPIO_USB1_0 ? "on" : "off");
22 return 0;
23 }
24
25 if (!strncmp(argv[1], "on", 2)) {
26 setbits_be32(&gpio->simple_dvo, GPIO_USB1_0);
27 } else if (!strncmp(argv[1], "off", 3)) {
28 clrbits_be32(&gpio->simple_dvo, GPIO_USB1_0);
29 } else {
30 cmd_usage(cmdtp);
31 return 1;
32 }
33 return 0;
34 }
35
36 U_BOOT_CMD(disp, 2, 1, cmd_disp,
37 "disp [on/off] - switch display on/off",
38 "\n - print display on/off status\n"
39 "on\n - turn on\n"
40 "off\n - turn off\n"
41 );