ide.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #if defined(CONFIG_IDE_PCMCIA)
  18. # include <pcmcia.h>
  19. #endif
  20. #include <ide.h>
  21. #include <ata.h>
  22. #ifdef CONFIG_LED_STATUS
  23. # include <status_led.h>
  24. #endif
  25. /* Current I/O Device */
  26. static int curr_device;
  27. int do_ide(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
  28. {
  29. if (argc == 2) {
  30. if (strncmp(argv[1], "res", 3) == 0) {
  31. puts("\nReset IDE: ");
  32. ide_init();
  33. return 0;
  34. }
  35. }
  36. return blk_common_cmd(argc, argv, IF_TYPE_IDE, &curr_device);
  37. }
  38. int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
  39. {
  40. return common_diskboot(cmdtp, "ide", argc, argv);
  41. }
  42. U_BOOT_CMD(ide, 5, 1, do_ide,
  43. "IDE sub-system",
  44. "reset - reset IDE controller\n"
  45. "ide info - show available IDE devices\n"
  46. "ide device [dev] - show or set current device\n"
  47. "ide part [dev] - print partition table of one or all IDE devices\n"
  48. "ide read addr blk# cnt\n"
  49. "ide write addr blk# cnt - read/write `cnt'"
  50. " blocks starting at block `blk#'\n"
  51. " to/from memory address `addr'");
  52. U_BOOT_CMD(diskboot, 3, 1, do_diskboot,
  53. "boot from IDE device", "loadAddr dev:part");