blob: 6c68ea2f0184e7d5f3da11bac7a62372197c4d42 [file] [log] [blame]
Dave Liu0ff7cba2008-03-27 18:50:41 +08001#ifndef __ATA_PIIX_H__
2#define __ATA_PIIX_H__
mushtaq khan66d9dbe2007-04-20 14:23:02 +05303
mushtaq khan66d9dbe2007-04-20 14:23:02 +05304struct 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
22struct sata_port {
Wolfgang Denk3162eb82007-05-15 23:38:05 +020023 unsigned char port_no; /* primary=0, secondary=1 */
24 struct sata_ioports ioaddr; /* ATA cmd/ctl/dma reg blks */
mushtaq khan66d9dbe2007-04-20 14:23:02 +053025 unsigned char ctl_reg;
26 unsigned char last_ctl;
Mushtaq Khan1f2a0582007-06-30 18:50:48 +020027 unsigned char port_state; /* 1-port is available and */
28 /* 0-port is not available */
mushtaq khan66d9dbe2007-04-20 14:23:02 +053029 unsigned char dev_mask;
30};
31
32/***********SATA LIBRARY SPECIFIC DEFINITIONS AND DECLARATIONS**************/
Tom Rini879a57a2012-09-29 07:35:12 -070033#ifdef SATA_DECL /* SATA library specific declarations */
34inline void ata_dump_id(u16 *id)
mushtaq khan66d9dbe2007-04-20 14:23:02 +053035{
Tom Rini879a57a2012-09-29 07:35:12 -070036 debug("49 = 0x%04x "
Dave Liu0ff7cba2008-03-27 18:50:41 +080037 "53 = 0x%04x "
38 "63 = 0x%04x "
39 "64 = 0x%04x "
Tom Rini879a57a2012-09-29 07:35:12 -070040 "75 = 0x%04x\n", id[49], id[53], id[63], id[64], id[75]);
41 debug("80 = 0x%04x "
Dave Liu0ff7cba2008-03-27 18:50:41 +080042 "81 = 0x%04x "
43 "82 = 0x%04x "
44 "83 = 0x%04x "
Tom Rini879a57a2012-09-29 07:35:12 -070045 "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 khan66d9dbe2007-04-20 14:23:02 +053047}
48#endif
49
50#ifdef SATA_DECL /*SATA library specific declarations */
Tom Rini879a57a2012-09-29 07:35:12 -070051int sata_bus_softreset(int num);
52void sata_identify(int num, int dev);
53void sata_port(struct sata_ioports *ioport);
54void set_Feature_cmd(int num, int dev);
55int sata_devchk(struct sata_ioports *ioaddr, int dev);
56void dev_select(struct sata_ioports *ioaddr, int dev);
57u8 sata_busy_wait(struct sata_ioports *ioaddr, int bits, unsigned int max);
58u8 sata_chk_status(struct sata_ioports *ioaddr);
mushtaq khan66d9dbe2007-04-20 14:23:02 +053059#endif
60
61/************DRIVER SPECIFIC DEFINITIONS AND DECLARATIONS**************/
62
Tom Rini879a57a2012-09-29 07:35:12 -070063#ifdef DRV_DECL /* Driver specific declaration */
64int init_sata(int dev);
mushtaq khan66d9dbe2007-04-20 14:23:02 +053065#endif
66
Tom Rini879a57a2012-09-29 07:35:12 -070067#ifdef DRV_DECL /* Defines Driver Specific variables */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020068struct sata_port port[CONFIG_SYS_SATA_MAXBUS];
mushtaq khan66d9dbe2007-04-20 14:23:02 +053069#endif
Dave Liu0ff7cba2008-03-27 18:50:41 +080070
71#endif /* __ATA_PIIX_H__ */