aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_it8213.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_it8213.c')
-rw-r--r--drivers/ata/pata_it8213.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/ata/pata_it8213.c b/drivers/ata/pata_it8213.c
index f156da8076f7..8f3325adceb3 100644
--- a/drivers/ata/pata_it8213.c
+++ b/drivers/ata/pata_it8213.c
@@ -22,7 +22,7 @@
22#define DRV_VERSION "0.0.3" 22#define DRV_VERSION "0.0.3"
23 23
24/** 24/**
25 * it8213_pre_reset - check for 40/80 pin 25 * it8213_pre_reset - probe begin
26 * @link: link 26 * @link: link
27 * @deadline: deadline jiffies for the operation 27 * @deadline: deadline jiffies for the operation
28 * 28 *
@@ -92,18 +92,17 @@ static void it8213_set_piomode (struct ata_port *ap, struct ata_device *adev)
92 { 2, 1 }, 92 { 2, 1 },
93 { 2, 3 }, }; 93 { 2, 3 }, };
94 94
95 if (pio > 2) 95 if (pio > 1)
96 control |= 1; /* TIME1 enable */ 96 control |= 1; /* TIME */
97 if (ata_pio_need_iordy(adev)) /* PIO 3/4 require IORDY */ 97 if (ata_pio_need_iordy(adev)) /* PIO 3/4 require IORDY */
98 control |= 2; /* IORDY enable */ 98 control |= 2; /* IE */
99 /* Bit 2 is set for ATAPI on the IT8213 - reverse of ICH/PIIX */ 99 /* Bit 2 is set for ATAPI on the IT8213 - reverse of ICH/PIIX */
100 if (adev->class != ATA_DEV_ATA) 100 if (adev->class != ATA_DEV_ATA)
101 control |= 4; 101 control |= 4; /* PPE */
102 102
103 pci_read_config_word(dev, idetm_port, &idetm_data); 103 pci_read_config_word(dev, idetm_port, &idetm_data);
104 104
105 /* Enable PPE, IE and TIME as appropriate */ 105 /* Set PPE, IE, and TIME as appropriate */
106
107 if (adev->devno == 0) { 106 if (adev->devno == 0) {
108 idetm_data &= 0xCCF0; 107 idetm_data &= 0xCCF0;
109 idetm_data |= control; 108 idetm_data |= control;
@@ -112,17 +111,17 @@ static void it8213_set_piomode (struct ata_port *ap, struct ata_device *adev)
112 } else { 111 } else {
113 u8 slave_data; 112 u8 slave_data;
114 113
115 idetm_data &= 0xCC0F; 114 idetm_data &= 0xFF0F;
116 idetm_data |= (control << 4); 115 idetm_data |= (control << 4);
117 116
118 /* Slave timing in separate register */ 117 /* Slave timing in separate register */
119 pci_read_config_byte(dev, 0x44, &slave_data); 118 pci_read_config_byte(dev, 0x44, &slave_data);
120 slave_data &= 0xF0; 119 slave_data &= 0xF0;
121 slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << 4; 120 slave_data |= (timings[pio][0] << 2) | timings[pio][1];
122 pci_write_config_byte(dev, 0x44, slave_data); 121 pci_write_config_byte(dev, 0x44, slave_data);
123 } 122 }
124 123
125 idetm_data |= 0x4000; /* Ensure SITRE is enabled */ 124 idetm_data |= 0x4000; /* Ensure SITRE is set */
126 pci_write_config_word(dev, idetm_port, idetm_data); 125 pci_write_config_word(dev, idetm_port, idetm_data);
127} 126}
128 127
@@ -173,10 +172,10 @@ static void it8213_set_dmamode (struct ata_port *ap, struct ata_device *adev)
173 172
174 udma_enable |= (1 << devid); 173 udma_enable |= (1 << devid);
175 174
176 /* Load the UDMA mode number */ 175 /* Load the UDMA cycle time */
177 pci_read_config_word(dev, 0x4A, &udma_timing); 176 pci_read_config_word(dev, 0x4A, &udma_timing);
178 udma_timing &= ~(3 << (4 * devid)); 177 udma_timing &= ~(3 << (4 * devid));
179 udma_timing |= (udma & 3) << (4 * devid); 178 udma_timing |= u_speed << (4 * devid);
180 pci_write_config_word(dev, 0x4A, udma_timing); 179 pci_write_config_word(dev, 0x4A, udma_timing);
181 180
182 /* Load the clock selection */ 181 /* Load the clock selection */
@@ -211,7 +210,7 @@ static void it8213_set_dmamode (struct ata_port *ap, struct ata_device *adev)
211 master_data &= 0xFF4F; /* Mask out IORDY|TIME1|DMAONLY */ 210 master_data &= 0xFF4F; /* Mask out IORDY|TIME1|DMAONLY */
212 master_data |= control << 4; 211 master_data |= control << 4;
213 pci_read_config_byte(dev, 0x44, &slave_data); 212 pci_read_config_byte(dev, 0x44, &slave_data);
214 slave_data &= (0x0F + 0xE1 * ap->port_no); 213 slave_data &= 0xF0;
215 /* Load the matching timing */ 214 /* Load the matching timing */
216 slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << (ap->port_no ? 4 : 0); 215 slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << (ap->port_no ? 4 : 0);
217 pci_write_config_byte(dev, 0x44, slave_data); 216 pci_write_config_byte(dev, 0x44, slave_data);
@@ -263,7 +262,7 @@ static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *en
263 static const struct ata_port_info info = { 262 static const struct ata_port_info info = {
264 .flags = ATA_FLAG_SLAVE_POSS, 263 .flags = ATA_FLAG_SLAVE_POSS,
265 .pio_mask = ATA_PIO4, 264 .pio_mask = ATA_PIO4,
266 .mwdma_mask = ATA_MWDMA2, 265 .mwdma_mask = ATA_MWDMA12_ONLY,
267 .udma_mask = ATA_UDMA4, /* FIXME: want UDMA 100? */ 266 .udma_mask = ATA_UDMA4, /* FIXME: want UDMA 100? */
268 .port_ops = &it8213_ops, 267 .port_ops = &it8213_ops,
269 }; 268 };