ide.c 1.4 KB

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