1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2000-2011
18 #include <asm/byteorder.h>
20 #include <dm/device-internal.h>
21 #include <dm/uclass-internal.h>
26 #ifdef CONFIG_LED_STATUS
27 # include <status_led.h>
30 /* Current I/O Device */
31 static int curr_device;
33 int do_ide(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
36 if (strncmp(argv[1], "res", 3) == 0) {
40 puts("\nReset IDE: ");
41 ret = uclass_find_first_device(UCLASS_IDE, &dev);
42 ret = device_remove(dev, DM_REMOVE_NORMAL);
44 ret = device_chld_unbind(dev, NULL);
46 printf("Cannot remove IDE (err=%dE)\n", ret);
47 return CMD_RET_FAILURE;
50 ret = uclass_first_device_err(UCLASS_IDE, &dev);
52 printf("Init failed (err=%dE)\n", ret);
53 return CMD_RET_FAILURE;
60 return blk_common_cmd(argc, argv, UCLASS_IDE, &curr_device);
63 int do_diskboot(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
65 return common_diskboot(cmdtp, "ide", argc, argv);
68 U_BOOT_CMD(ide, 5, 1, do_ide,
70 "reset - reset IDE controller\n"
71 "ide info - show available IDE devices\n"
72 "ide device [dev] - show or set current device\n"
73 "ide part [dev] - print partition table of one or all IDE devices\n"
74 "ide read addr blk# cnt\n"
75 "ide write addr blk# cnt - read/write `cnt'"
76 " blocks starting at block `blk#'\n"
77 " to/from memory address `addr'");
79 U_BOOT_CMD(diskboot, 3, 1, do_diskboot,
80 "boot from IDE device", "loadAddr dev:part");