10f9cfa09Swdenk /* 20f9cfa09Swdenk * (C) Copyright 2000 30f9cfa09Swdenk * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 40f9cfa09Swdenk * 50f9cfa09Swdenk * See file CREDITS for list of people who contributed to this 60f9cfa09Swdenk * project. 70f9cfa09Swdenk * 80f9cfa09Swdenk * This program is free software; you can redistribute it and/or 90f9cfa09Swdenk * modify it under the terms of the GNU General Public License as 100f9cfa09Swdenk * published by the Free Software Foundation; either version 2 of 110f9cfa09Swdenk * the License, or (at your option) any later version. 120f9cfa09Swdenk * 130f9cfa09Swdenk * This program is distributed in the hope that it will be useful, 140f9cfa09Swdenk * but WITHOUT ANY WARRANTY; without even the implied warranty of 150f9cfa09Swdenk * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 160f9cfa09Swdenk * GNU General Public License for more details. 170f9cfa09Swdenk * 180f9cfa09Swdenk * You should have received a copy of the GNU General Public License 190f9cfa09Swdenk * along with this program; if not, write to the Free Software 200f9cfa09Swdenk * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 210f9cfa09Swdenk * MA 02111-1307 USA 220f9cfa09Swdenk */ 230f9cfa09Swdenk 240f9cfa09Swdenk #ifndef _IDE_H 250f9cfa09Swdenk #define _IDE_H 260f9cfa09Swdenk 278a10180dSLuka Perkov #define IDE_BUS(dev) (dev / (CONFIG_SYS_IDE_MAXDEVICE / CONFIG_SYS_IDE_MAXBUS)) 280f9cfa09Swdenk 296d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #define ATA_CURR_BASE(dev) (CONFIG_SYS_ATA_BASE_ADDR+ide_bus_offset[IDE_BUS(dev)]) 30f98984cbSHeiko Schocher 310f9cfa09Swdenk #ifdef CONFIG_IDE_LED 320f9cfa09Swdenk 330f9cfa09Swdenk /* 340f9cfa09Swdenk * LED Port 350f9cfa09Swdenk */ 360f9cfa09Swdenk #define LED_PORT ((uchar *)(PER8_BASE + 0x3000)) 370f9cfa09Swdenk #define LED_IDE1 0x01 380f9cfa09Swdenk #define LED_IDE2 0x02 390f9cfa09Swdenk #define DEVICE_LED(d) ((d & 2) | ((d & 2) == 0)) /* depends on bit positions! */ 400f9cfa09Swdenk 410f9cfa09Swdenk #endif /* CONFIG_IDE_LED */ 420f9cfa09Swdenk 436d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #ifdef CONFIG_SYS_64BIT_LBA 44c40b2956Swdenk typedef uint64_t lbaint_t; 45c40b2956Swdenk #else 46c40b2956Swdenk typedef ulong lbaint_t; 47c40b2956Swdenk #endif 48c40b2956Swdenk 490f9cfa09Swdenk /* 500f9cfa09Swdenk * Function Prototypes 510f9cfa09Swdenk */ 520f9cfa09Swdenk 530f9cfa09Swdenk void ide_init(void); 544ac8f8e0STom Rini ulong ide_read(int device, ulong blknr, lbaint_t blkcnt, void *buffer); 554ac8f8e0STom Rini ulong ide_write(int device, ulong blknr, lbaint_t blkcnt, const void *buffer); 560f9cfa09Swdenk 57*8d1165e1SPavel Herrmann #ifdef CONFIG_IDE_PREINIT 58*8d1165e1SPavel Herrmann int ide_preinit(void); 59*8d1165e1SPavel Herrmann #endif 60*8d1165e1SPavel Herrmann 61*8d1165e1SPavel Herrmann #ifdef CONFIG_IDE_INIT_POSTRESET 62*8d1165e1SPavel Herrmann int ide_init_postreset(void); 63*8d1165e1SPavel Herrmann #endif 64*8d1165e1SPavel Herrmann 653887c3fbSHeiko Schocher #if defined(CONFIG_OF_IDE_FIXUP) 663887c3fbSHeiko Schocher int ide_device_present(int dev); 673887c3fbSHeiko Schocher #endif 680abddf82SMacpaul Lin 690abddf82SMacpaul Lin #if defined(CONFIG_IDE_AHB) 700abddf82SMacpaul Lin unsigned char ide_read_register(int dev, unsigned int port); 710abddf82SMacpaul Lin void ide_write_register(int dev, unsigned int port, unsigned char val); 720abddf82SMacpaul Lin void ide_read_data(int dev, ulong *sect_buf, int words); 730abddf82SMacpaul Lin void ide_write_data(int dev, ulong *sect_buf, int words); 740abddf82SMacpaul Lin #endif 750f9cfa09Swdenk #endif /* _IDE_H */ 76