Dave Liu | 095f5aa | 2008-03-27 18:50:41 +0800 | [diff] [blame] | 1 | #ifndef __ATA_PIIX_H__ |
| 2 | #define __ATA_PIIX_H__ |
mushtaq khan | 5651b34 | 2007-04-20 14:23:02 +0530 | [diff] [blame] | 3 | |
mushtaq khan | 5651b34 | 2007-04-20 14:23:02 +0530 | [diff] [blame] | 4 | struct sata_ioports { |
| 5 | unsigned long cmd_addr; |
| 6 | unsigned long data_addr; |
| 7 | unsigned long error_addr; |
| 8 | unsigned long feature_addr; |
| 9 | unsigned long nsect_addr; |
| 10 | unsigned long lbal_addr; |
| 11 | unsigned long lbam_addr; |
| 12 | unsigned long lbah_addr; |
| 13 | unsigned long device_addr; |
| 14 | unsigned long status_addr; |
| 15 | unsigned long command_addr; |
| 16 | unsigned long altstatus_addr; |
| 17 | unsigned long ctl_addr; |
| 18 | unsigned long bmdma_addr; |
| 19 | unsigned long scr_addr; |
| 20 | }; |
| 21 | |
| 22 | struct sata_port { |
Wolfgang Denk | 142bdbe | 2007-05-15 23:38:05 +0200 | [diff] [blame] | 23 | unsigned char port_no; /* primary=0, secondary=1 */ |
| 24 | struct sata_ioports ioaddr; /* ATA cmd/ctl/dma reg blks */ |
mushtaq khan | 5651b34 | 2007-04-20 14:23:02 +0530 | [diff] [blame] | 25 | unsigned char ctl_reg; |
| 26 | unsigned char last_ctl; |
Mushtaq Khan | 277be2c | 2007-06-30 18:50:48 +0200 | [diff] [blame] | 27 | unsigned char port_state; /* 1-port is available and */ |
| 28 | /* 0-port is not available */ |
mushtaq khan | 5651b34 | 2007-04-20 14:23:02 +0530 | [diff] [blame] | 29 | unsigned char dev_mask; |
| 30 | }; |
| 31 | |
| 32 | /***********SATA LIBRARY SPECIFIC DEFINITIONS AND DECLARATIONS**************/ |
Tom Rini | 953f90f | 2012-09-29 07:35:12 -0700 | [diff] [blame^] | 33 | #ifdef SATA_DECL /* SATA library specific declarations */ |
| 34 | inline void ata_dump_id(u16 *id) |
mushtaq khan | 5651b34 | 2007-04-20 14:23:02 +0530 | [diff] [blame] | 35 | { |
Tom Rini | 953f90f | 2012-09-29 07:35:12 -0700 | [diff] [blame^] | 36 | debug("49 = 0x%04x " |
Dave Liu | 095f5aa | 2008-03-27 18:50:41 +0800 | [diff] [blame] | 37 | "53 = 0x%04x " |
| 38 | "63 = 0x%04x " |
| 39 | "64 = 0x%04x " |
Tom Rini | 953f90f | 2012-09-29 07:35:12 -0700 | [diff] [blame^] | 40 | "75 = 0x%04x\n", id[49], id[53], id[63], id[64], id[75]); |
| 41 | debug("80 = 0x%04x " |
Dave Liu | 095f5aa | 2008-03-27 18:50:41 +0800 | [diff] [blame] | 42 | "81 = 0x%04x " |
| 43 | "82 = 0x%04x " |
| 44 | "83 = 0x%04x " |
Tom Rini | 953f90f | 2012-09-29 07:35:12 -0700 | [diff] [blame^] | 45 | "84 = 0x%04x\n", id[80], id[81], id[82], id[83], id[84]); |
| 46 | debug("88 = 0x%04x " "93 = 0x%04x\n", id[88], id[93]); |
mushtaq khan | 5651b34 | 2007-04-20 14:23:02 +0530 | [diff] [blame] | 47 | } |
| 48 | #endif |
| 49 | |
| 50 | #ifdef SATA_DECL /*SATA library specific declarations */ |
Tom Rini | 953f90f | 2012-09-29 07:35:12 -0700 | [diff] [blame^] | 51 | int sata_bus_softreset(int num); |
| 52 | void sata_identify(int num, int dev); |
| 53 | void sata_port(struct sata_ioports *ioport); |
| 54 | void set_Feature_cmd(int num, int dev); |
| 55 | int sata_devchk(struct sata_ioports *ioaddr, int dev); |
| 56 | void dev_select(struct sata_ioports *ioaddr, int dev); |
| 57 | u8 sata_busy_wait(struct sata_ioports *ioaddr, int bits, unsigned int max); |
| 58 | u8 sata_chk_status(struct sata_ioports *ioaddr); |
| 59 | ulong sata_read(int device, ulong blknr,lbaint_t blkcnt, void *buffer); |
| 60 | ulong sata_write(int device,ulong blknr, lbaint_t blkcnt, void *buffer); |
mushtaq khan | 5651b34 | 2007-04-20 14:23:02 +0530 | [diff] [blame] | 61 | #endif |
| 62 | |
| 63 | /************DRIVER SPECIFIC DEFINITIONS AND DECLARATIONS**************/ |
| 64 | |
Tom Rini | 953f90f | 2012-09-29 07:35:12 -0700 | [diff] [blame^] | 65 | #ifdef DRV_DECL /* Driver specific declaration */ |
| 66 | int init_sata(int dev); |
mushtaq khan | 5651b34 | 2007-04-20 14:23:02 +0530 | [diff] [blame] | 67 | #endif |
| 68 | |
Tom Rini | 953f90f | 2012-09-29 07:35:12 -0700 | [diff] [blame^] | 69 | #ifdef DRV_DECL /* Defines Driver Specific variables */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 70 | struct sata_port port[CONFIG_SYS_SATA_MAXBUS]; |
mushtaq khan | 5651b34 | 2007-04-20 14:23:02 +0530 | [diff] [blame] | 71 | #endif |
Dave Liu | 095f5aa | 2008-03-27 18:50:41 +0800 | [diff] [blame] | 72 | |
| 73 | #endif /* __ATA_PIIX_H__ */ |