ide.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2000-2011
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. */
  6. /*
  7. * IDE support
  8. */
  9. #include <common.h>
  10. #include <blk.h>
  11. #include <config.h>
  12. #include <watchdog.h>
  13. #include <command.h>
  14. #include <image.h>
  15. #include <asm/byteorder.h>
  16. #include <asm/io.h>
  17. #include <ide.h>
  18. #include <ata.h>
  19. #ifdef CONFIG_LED_STATUS
  20. # include <status_led.h>
  21. #endif
  22. /* Current I/O Device */
  23. static int curr_device;
  24. int do_ide(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
  25. {
  26. if (argc == 2) {
  27. if (strncmp(argv[1], "res", 3) == 0) {
  28. puts("\nReset IDE: ");
  29. ide_init();
  30. return 0;
  31. }
  32. }
  33. return blk_common_cmd(argc, argv, IF_TYPE_IDE, &curr_device);
  34. }
  35. int do_diskboot(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
  36. {
  37. return common_diskboot(cmdtp, "ide", argc, argv);
  38. }
  39. U_BOOT_CMD(ide, 5, 1, do_ide,
  40. "IDE sub-system",
  41. "reset - reset IDE controller\n"
  42. "ide info - show available IDE devices\n"
  43. "ide device [dev] - show or set current device\n"
  44. "ide part [dev] - print partition table of one or all IDE devices\n"
  45. "ide read addr blk# cnt\n"
  46. "ide write addr blk# cnt - read/write `cnt'"
  47. " blocks starting at block `blk#'\n"
  48. " to/from memory address `addr'");
  49. U_BOOT_CMD(diskboot, 3, 1, do_diskboot,
  50. "boot from IDE device", "loadAddr dev:part");