diff options
Diffstat (limited to 'drivers/ata/pata_winbond.c')
-rw-r--r-- | drivers/ata/pata_winbond.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c index 7116a9e7a8b2..7312e9182d69 100644 --- a/drivers/ata/pata_winbond.c +++ b/drivers/ata/pata_winbond.c | |||
@@ -92,29 +92,33 @@ static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
92 | } | 92 | } |
93 | 93 | ||
94 | 94 | ||
95 | static void winbond_data_xfer(struct ata_device *adev, unsigned char *buf, unsigned int buflen, int write_data) | 95 | static void winbond_data_xfer(struct ata_device *dev, unsigned char *buf, |
96 | unsigned int buflen, int rw) | ||
96 | { | 97 | { |
97 | struct ata_port *ap = adev->link->ap; | 98 | struct ata_port *ap = dev->link->ap; |
98 | int slop = buflen & 3; | 99 | int slop = buflen & 3; |
99 | 100 | ||
100 | if (ata_id_has_dword_io(adev->id)) { | 101 | if (ata_id_has_dword_io(dev->id)) { |
101 | if (write_data) | 102 | if (rw == READ) |
102 | iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); | ||
103 | else | ||
104 | ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); | 103 | ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); |
104 | else | ||
105 | iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); | ||
105 | 106 | ||
106 | if (unlikely(slop)) { | 107 | if (unlikely(slop)) { |
107 | __le32 pad = 0; | 108 | u32 pad; |
108 | if (write_data) { | 109 | if (rw == READ) { |
109 | memcpy(&pad, buf + buflen - slop, slop); | ||
110 | iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr); | ||
111 | } else { | ||
112 | pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr)); | 110 | pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr)); |
113 | memcpy(buf + buflen - slop, &pad, slop); | 111 | memcpy(buf + buflen - slop, &pad, slop); |
112 | } else { | ||
113 | memcpy(&pad, buf + buflen - slop, slop); | ||
114 | iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr); | ||
114 | } | 115 | } |
116 | buflen += 4 - slop; | ||
115 | } | 117 | } |
116 | } else | 118 | } else |
117 | ata_data_xfer(adev, buf, buflen, write_data); | 119 | buflen = ata_data_xfer(dev, buf, buflen, rw); |
120 | |||
121 | return buflen; | ||
118 | } | 122 | } |
119 | 123 | ||
120 | static struct scsi_host_template winbond_sht = { | 124 | static struct scsi_host_template winbond_sht = { |