diff options
Diffstat (limited to 'drivers/ata/sata_via.c')
-rw-r--r-- | drivers/ata/sata_via.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index c4124475f754..86b7bfc17324 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -72,8 +72,8 @@ enum { | |||
72 | }; | 72 | }; |
73 | 73 | ||
74 | static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 74 | static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); |
75 | static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg); | 75 | static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); |
76 | static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | 76 | static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); |
77 | static void svia_noop_freeze(struct ata_port *ap); | 77 | static void svia_noop_freeze(struct ata_port *ap); |
78 | static void vt6420_error_handler(struct ata_port *ap); | 78 | static void vt6420_error_handler(struct ata_port *ap); |
79 | static int vt6421_pata_cable_detect(struct ata_port *ap); | 79 | static int vt6421_pata_cable_detect(struct ata_port *ap); |
@@ -249,18 +249,20 @@ MODULE_LICENSE("GPL"); | |||
249 | MODULE_DEVICE_TABLE(pci, svia_pci_tbl); | 249 | MODULE_DEVICE_TABLE(pci, svia_pci_tbl); |
250 | MODULE_VERSION(DRV_VERSION); | 250 | MODULE_VERSION(DRV_VERSION); |
251 | 251 | ||
252 | static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg) | 252 | static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) |
253 | { | 253 | { |
254 | if (sc_reg > SCR_CONTROL) | 254 | if (sc_reg > SCR_CONTROL) |
255 | return 0xffffffffU; | 255 | return -EINVAL; |
256 | return ioread32(ap->ioaddr.scr_addr + (4 * sc_reg)); | 256 | *val = ioread32(ap->ioaddr.scr_addr + (4 * sc_reg)); |
257 | return 0; | ||
257 | } | 258 | } |
258 | 259 | ||
259 | static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) | 260 | static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) |
260 | { | 261 | { |
261 | if (sc_reg > SCR_CONTROL) | 262 | if (sc_reg > SCR_CONTROL) |
262 | return; | 263 | return -EINVAL; |
263 | iowrite32(val, ap->ioaddr.scr_addr + (4 * sc_reg)); | 264 | iowrite32(val, ap->ioaddr.scr_addr + (4 * sc_reg)); |
265 | return 0; | ||
264 | } | 266 | } |
265 | 267 | ||
266 | static void svia_noop_freeze(struct ata_port *ap) | 268 | static void svia_noop_freeze(struct ata_port *ap) |
@@ -305,18 +307,19 @@ static int vt6420_prereset(struct ata_port *ap, unsigned long deadline) | |||
305 | 307 | ||
306 | /* Resume phy. This is the old SATA resume sequence */ | 308 | /* Resume phy. This is the old SATA resume sequence */ |
307 | svia_scr_write(ap, SCR_CONTROL, 0x300); | 309 | svia_scr_write(ap, SCR_CONTROL, 0x300); |
308 | svia_scr_read(ap, SCR_CONTROL); /* flush */ | 310 | svia_scr_read(ap, SCR_CONTROL, &scontrol); /* flush */ |
309 | 311 | ||
310 | /* wait for phy to become ready, if necessary */ | 312 | /* wait for phy to become ready, if necessary */ |
311 | do { | 313 | do { |
312 | msleep(200); | 314 | msleep(200); |
313 | if ((svia_scr_read(ap, SCR_STATUS) & 0xf) != 1) | 315 | svia_scr_read(ap, SCR_STATUS, &sstatus); |
316 | if ((sstatus & 0xf) != 1) | ||
314 | break; | 317 | break; |
315 | } while (time_before(jiffies, timeout)); | 318 | } while (time_before(jiffies, timeout)); |
316 | 319 | ||
317 | /* open code sata_print_link_status() */ | 320 | /* open code sata_print_link_status() */ |
318 | sstatus = svia_scr_read(ap, SCR_STATUS); | 321 | svia_scr_read(ap, SCR_STATUS, &sstatus); |
319 | scontrol = svia_scr_read(ap, SCR_CONTROL); | 322 | svia_scr_read(ap, SCR_CONTROL, &scontrol); |
320 | 323 | ||
321 | online = (sstatus & 0xf) == 0x3; | 324 | online = (sstatus & 0xf) == 0x3; |
322 | 325 | ||
@@ -325,7 +328,7 @@ static int vt6420_prereset(struct ata_port *ap, unsigned long deadline) | |||
325 | online ? "up" : "down", sstatus, scontrol); | 328 | online ? "up" : "down", sstatus, scontrol); |
326 | 329 | ||
327 | /* SStatus is read one more time */ | 330 | /* SStatus is read one more time */ |
328 | svia_scr_read(ap, SCR_STATUS); | 331 | svia_scr_read(ap, SCR_STATUS, &sstatus); |
329 | 332 | ||
330 | if (!online) { | 333 | if (!online) { |
331 | /* tell EH to bail */ | 334 | /* tell EH to bail */ |