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