cmd_disp.c 919 B

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