diff options
author | Tejun Heo <tj@kernel.org> | 2008-07-31 04:02:40 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-09-29 00:22:28 -0400 |
commit | 82ef04fb4c82542b3eda81cca461f0594ce9cd0b (patch) | |
tree | e513df5ad8dc9f7400830bfc8786afb6bec90fb6 /drivers/ata/sata_via.c | |
parent | 6ef190cc92e33565accff6a320f0e7d90480bfe7 (diff) |
libata: make SCR access ops per-link
Logically, SCR access ops should take @link; however, there was no
compelling reason to convert all SCR access ops when adding @link
abstraction as there's one-to-one mapping between a port and a non-PMP
link. However, that assumption won't hold anymore with the scheduled
addition of slave link.
Make SCR access ops per-link.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/sata_via.c')
-rw-r--r-- | drivers/ata/sata_via.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index 96deeb354e16..1cfa74535d91 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -68,8 +68,8 @@ enum { | |||
68 | }; | 68 | }; |
69 | 69 | ||
70 | static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); | 70 | static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
71 | static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); | 71 | static int svia_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); |
72 | static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); | 72 | static int svia_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); |
73 | static void svia_noop_freeze(struct ata_port *ap); | 73 | static void svia_noop_freeze(struct ata_port *ap); |
74 | static int vt6420_prereset(struct ata_link *link, unsigned long deadline); | 74 | static int vt6420_prereset(struct ata_link *link, unsigned long deadline); |
75 | static int vt6421_pata_cable_detect(struct ata_port *ap); | 75 | static int vt6421_pata_cable_detect(struct ata_port *ap); |
@@ -152,19 +152,19 @@ MODULE_LICENSE("GPL"); | |||
152 | MODULE_DEVICE_TABLE(pci, svia_pci_tbl); | 152 | MODULE_DEVICE_TABLE(pci, svia_pci_tbl); |
153 | MODULE_VERSION(DRV_VERSION); | 153 | MODULE_VERSION(DRV_VERSION); |
154 | 154 | ||
155 | static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) | 155 | static int svia_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val) |
156 | { | 156 | { |
157 | if (sc_reg > SCR_CONTROL) | 157 | if (sc_reg > SCR_CONTROL) |
158 | return -EINVAL; | 158 | return -EINVAL; |
159 | *val = ioread32(ap->ioaddr.scr_addr + (4 * sc_reg)); | 159 | *val = ioread32(link->ap->ioaddr.scr_addr + (4 * sc_reg)); |
160 | return 0; | 160 | return 0; |
161 | } | 161 | } |
162 | 162 | ||
163 | static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) | 163 | static int svia_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) |
164 | { | 164 | { |
165 | if (sc_reg > SCR_CONTROL) | 165 | if (sc_reg > SCR_CONTROL) |
166 | return -EINVAL; | 166 | return -EINVAL; |
167 | iowrite32(val, ap->ioaddr.scr_addr + (4 * sc_reg)); | 167 | iowrite32(val, link->ap->ioaddr.scr_addr + (4 * sc_reg)); |
168 | return 0; | 168 | return 0; |
169 | } | 169 | } |
170 | 170 | ||
@@ -210,20 +210,20 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline) | |||
210 | goto skip_scr; | 210 | goto skip_scr; |
211 | 211 | ||
212 | /* Resume phy. This is the old SATA resume sequence */ | 212 | /* Resume phy. This is the old SATA resume sequence */ |
213 | svia_scr_write(ap, SCR_CONTROL, 0x300); | 213 | svia_scr_write(link, SCR_CONTROL, 0x300); |
214 | svia_scr_read(ap, SCR_CONTROL, &scontrol); /* flush */ | 214 | svia_scr_read(link, SCR_CONTROL, &scontrol); /* flush */ |
215 | 215 | ||
216 | /* wait for phy to become ready, if necessary */ | 216 | /* wait for phy to become ready, if necessary */ |
217 | do { | 217 | do { |
218 | msleep(200); | 218 | msleep(200); |
219 | svia_scr_read(ap, SCR_STATUS, &sstatus); | 219 | svia_scr_read(link, SCR_STATUS, &sstatus); |
220 | if ((sstatus & 0xf) != 1) | 220 | if ((sstatus & 0xf) != 1) |
221 | break; | 221 | break; |
222 | } while (time_before(jiffies, timeout)); | 222 | } while (time_before(jiffies, timeout)); |
223 | 223 | ||
224 | /* open code sata_print_link_status() */ | 224 | /* open code sata_print_link_status() */ |
225 | svia_scr_read(ap, SCR_STATUS, &sstatus); | 225 | svia_scr_read(link, SCR_STATUS, &sstatus); |
226 | svia_scr_read(ap, SCR_CONTROL, &scontrol); | 226 | svia_scr_read(link, SCR_CONTROL, &scontrol); |
227 | 227 | ||
228 | online = (sstatus & 0xf) == 0x3; | 228 | online = (sstatus & 0xf) == 0x3; |
229 | 229 | ||
@@ -232,7 +232,7 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline) | |||
232 | online ? "up" : "down", sstatus, scontrol); | 232 | online ? "up" : "down", sstatus, scontrol); |
233 | 233 | ||
234 | /* SStatus is read one more time */ | 234 | /* SStatus is read one more time */ |
235 | svia_scr_read(ap, SCR_STATUS, &sstatus); | 235 | svia_scr_read(link, SCR_STATUS, &sstatus); |
236 | 236 | ||
237 | if (!online) { | 237 | if (!online) { |
238 | /* tell EH to bail */ | 238 | /* tell EH to bail */ |