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