Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
wdenk | 0f9cfa0 | 2002-08-27 10:38:37 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2000 |
| 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
wdenk | 0f9cfa0 | 2002-08-27 10:38:37 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef _IDE_H |
| 8 | #define _IDE_H |
| 9 | |
Simon Glass | 1a73661 | 2016-02-29 15:25:39 -0700 | [diff] [blame] | 10 | #include <blk.h> |
| 11 | |
Luka Perkov | 8a10180 | 2012-05-14 09:29:10 +0000 | [diff] [blame] | 12 | #define IDE_BUS(dev) (dev / (CONFIG_SYS_IDE_MAXDEVICE / CONFIG_SYS_IDE_MAXBUS)) |
wdenk | 0f9cfa0 | 2002-08-27 10:38:37 +0000 | [diff] [blame] | 13 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 14 | #define ATA_CURR_BASE(dev) (CONFIG_SYS_ATA_BASE_ADDR+ide_bus_offset[IDE_BUS(dev)]) |
Pavel Herrmann | f5b82c0 | 2012-10-09 07:04:39 +0000 | [diff] [blame] | 15 | extern ulong ide_bus_offset[]; |
Heiko Schocher | f98984c | 2007-08-28 17:39:14 +0200 | [diff] [blame] | 16 | |
wdenk | 0f9cfa0 | 2002-08-27 10:38:37 +0000 | [diff] [blame] | 17 | /* |
| 18 | * Function Prototypes |
| 19 | */ |
| 20 | |
Grant Likely | 735dd97 | 2007-02-20 09:04:34 +0100 | [diff] [blame] | 21 | void ide_init(void); |
Simon Glass | 4101f68 | 2016-02-29 15:25:34 -0700 | [diff] [blame] | 22 | struct blk_desc; |
Simon Glass | 145df84 | 2016-05-01 11:36:22 -0600 | [diff] [blame] | 23 | struct udevice; |
| 24 | #ifdef CONFIG_BLK |
| 25 | ulong ide_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, |
| 26 | void *buffer); |
| 27 | ulong ide_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, |
| 28 | const void *buffer); |
| 29 | #else |
Simon Glass | 4101f68 | 2016-02-29 15:25:34 -0700 | [diff] [blame] | 30 | ulong ide_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt, |
Stephen Warren | 7c4213f | 2015-12-07 11:38:48 -0700 | [diff] [blame] | 31 | void *buffer); |
Simon Glass | 4101f68 | 2016-02-29 15:25:34 -0700 | [diff] [blame] | 32 | ulong ide_write(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt, |
Sascha Silbe | ff8fef5 | 2013-06-14 13:07:25 +0200 | [diff] [blame] | 33 | const void *buffer); |
Simon Glass | 145df84 | 2016-05-01 11:36:22 -0600 | [diff] [blame] | 34 | #endif |
wdenk | 0f9cfa0 | 2002-08-27 10:38:37 +0000 | [diff] [blame] | 35 | |
Pavel Herrmann | 8d1165e11a | 2012-10-09 07:01:56 +0000 | [diff] [blame] | 36 | #ifdef CONFIG_IDE_PREINIT |
| 37 | int ide_preinit(void); |
| 38 | #endif |
| 39 | |
Heiko Schocher | 3887c3f | 2009-09-23 07:56:08 +0200 | [diff] [blame] | 40 | #if defined(CONFIG_OF_IDE_FIXUP) |
| 41 | int ide_device_present(int dev); |
| 42 | #endif |
Macpaul Lin | 0abddf8 | 2011-04-11 20:45:32 +0000 | [diff] [blame] | 43 | |
Pavel Herrmann | f5b82c0 | 2012-10-09 07:04:39 +0000 | [diff] [blame] | 44 | /* |
| 45 | * I/O function overrides |
| 46 | */ |
Jeroen Hofstee | 288afdc | 2014-07-12 15:07:19 +0200 | [diff] [blame] | 47 | unsigned char ide_inb(int dev, int port); |
| 48 | void ide_outb(int dev, int port, unsigned char val); |
Pavel Herrmann | f5b82c0 | 2012-10-09 07:04:39 +0000 | [diff] [blame] | 49 | void ide_input_swap_data(int dev, ulong *sect_buf, int words); |
| 50 | void ide_input_data(int dev, ulong *sect_buf, int words); |
| 51 | void ide_output_data(int dev, const ulong *sect_buf, int words); |
| 52 | void ide_input_data_shorts(int dev, ushort *sect_buf, int shorts); |
| 53 | void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts); |
| 54 | |
Jeroen Hofstee | 288afdc | 2014-07-12 15:07:19 +0200 | [diff] [blame] | 55 | void ide_led(uchar led, uchar status); |
| 56 | |
Simon Glass | c2240d4 | 2013-03-14 07:20:12 +0000 | [diff] [blame] | 57 | /** |
| 58 | * board_start_ide() - Start up the board IDE interfac |
| 59 | * |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 60 | * Return: 0 if ok |
Simon Glass | c2240d4 | 2013-03-14 07:20:12 +0000 | [diff] [blame] | 61 | */ |
| 62 | int board_start_ide(void); |
| 63 | |
wdenk | 0f9cfa0 | 2002-08-27 10:38:37 +0000 | [diff] [blame] | 64 | #endif /* _IDE_H */ |