aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_cs5520.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-08-18 00:14:55 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-12 14:55:37 -0400
commitcbcdd87593a1d85c5c4b259945a3a09eee12814d (patch)
treeee03df963a12ec7f30f6c3a8742421daf2c34f50 /drivers/ata/pata_cs5520.c
parente923090ddd9fef1d4e06dc6c5295e29baced19f3 (diff)
libata: implement and use ata_port_desc() to report port configuration
Currently, port configuration reporting has the following problems. * iomapped address is reported instead of raw address * report contains irrelevant fields or lacks necessary fields for non-SFF controllers. * host->irq/irq2 are there just for reporting and hacky. This patch implements and uses ata_port_desc() and ata_port_pbar_desc(). ata_port_desc() is almost identical to ata_ehi_push_desc() except that it takes @ap instead of @ehi, has no locking requirement, can only be used during host initialization and " " is used as separator instead of ", ". ata_port_pbar_desc() is a helper to ease reporting of a PCI BAR or an offsetted address into it. LLD pushes whatever description it wants using the above two functions. The accumulated description is printed on host registration after "[S/P]ATA max MAX_XFERMODE ". SFF init helpers and ata_host_activate() automatically add descriptions for addresses and irq respectively, so only LLDs which isn't standard SFF need to add custom descriptions. In many cases, such controllers need to report different things anyway. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_cs5520.c')
-rw-r--r--drivers/ata/pata_cs5520.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index 1ae6b6bd8564..ff1eb84c7d22 100644
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -189,6 +189,8 @@ static struct ata_port_operations cs5520_port_ops = {
189 189
190static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_device_id *id) 190static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
191{ 191{
192 static const unsigned int cmd_port[] = { 0x1F0, 0x170 };
193 static const unsigned int ctl_port[] = { 0x3F6, 0x376 };
192 struct ata_port_info pi = { 194 struct ata_port_info pi = {
193 .flags = ATA_FLAG_SLAVE_POSS, 195 .flags = ATA_FLAG_SLAVE_POSS,
194 .pio_mask = 0x1f, 196 .pio_mask = 0x1f,
@@ -242,10 +244,10 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
242 } 244 }
243 245
244 /* Map IO ports and initialize host accordingly */ 246 /* Map IO ports and initialize host accordingly */
245 iomap[0] = devm_ioport_map(&pdev->dev, 0x1F0, 8); 247 iomap[0] = devm_ioport_map(&pdev->dev, cmd_port[0], 8);
246 iomap[1] = devm_ioport_map(&pdev->dev, 0x3F6, 1); 248 iomap[1] = devm_ioport_map(&pdev->dev, ctl_port[0], 1);
247 iomap[2] = devm_ioport_map(&pdev->dev, 0x170, 8); 249 iomap[2] = devm_ioport_map(&pdev->dev, cmd_port[1], 8);
248 iomap[3] = devm_ioport_map(&pdev->dev, 0x376, 1); 250 iomap[3] = devm_ioport_map(&pdev->dev, ctl_port[1], 1);
249 iomap[4] = pcim_iomap(pdev, 2, 0); 251 iomap[4] = pcim_iomap(pdev, 2, 0);
250 252
251 if (!iomap[0] || !iomap[1] || !iomap[2] || !iomap[3] || !iomap[4]) 253 if (!iomap[0] || !iomap[1] || !iomap[2] || !iomap[3] || !iomap[4])
@@ -258,6 +260,10 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
258 ioaddr->bmdma_addr = iomap[4]; 260 ioaddr->bmdma_addr = iomap[4];
259 ata_std_ports(ioaddr); 261 ata_std_ports(ioaddr);
260 262
263 ata_port_desc(host->ports[0],
264 "cmd 0x%x ctl 0x%x", cmd_port[0], ctl_port[0]);
265 ata_port_pbar_desc(host->ports[0], 4, 0, "bmdma");
266
261 ioaddr = &host->ports[1]->ioaddr; 267 ioaddr = &host->ports[1]->ioaddr;
262 ioaddr->cmd_addr = iomap[2]; 268 ioaddr->cmd_addr = iomap[2];
263 ioaddr->ctl_addr = iomap[3]; 269 ioaddr->ctl_addr = iomap[3];
@@ -265,6 +271,10 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
265 ioaddr->bmdma_addr = iomap[4] + 8; 271 ioaddr->bmdma_addr = iomap[4] + 8;
266 ata_std_ports(ioaddr); 272 ata_std_ports(ioaddr);
267 273
274 ata_port_desc(host->ports[1],
275 "cmd 0x%x ctl 0x%x", cmd_port[1], ctl_port[1]);
276 ata_port_pbar_desc(host->ports[1], 4, 8, "bmdma");
277
268 /* activate the host */ 278 /* activate the host */
269 pci_set_master(pdev); 279 pci_set_master(pdev);
270 rc = ata_host_start(host); 280 rc = ata_host_start(host);
@@ -283,10 +293,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
283 if (rc) 293 if (rc)
284 return rc; 294 return rc;
285 295
286 if (i == 0) 296 ata_port_desc(ap, "irq %d", irq[i]);
287 host->irq = irq[0];
288 else
289 host->irq2 = irq[1];
290 } 297 }
291 298
292 return ata_host_register(host, &cs5520_sht); 299 return ata_host_register(host, &cs5520_sht);