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