Lines Matching +full:dp +full:- +full:controller
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * pata_atp867x.c - ARTOP 867X 64bit 4-channel UDMA133 ATA controller driver
5 * (C) 2009 Google Inc. John(Jung-Ik) Lee <jilee@google.com>
9 * 2003-2004 by Eric Uhrhane, Google, Inc.
69 #define ATP867X_IOBASE(ap) ((ap)->host->iomap[0])
109 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in atp867x_set_dmamode()
110 struct atp867x_priv *dp = ap->private_data; in atp867x_set_dmamode() local
111 u8 speed = adev->dma_mode; in atp867x_set_dmamode()
113 u8 mode = speed - XFER_UDMA_0 + 1; in atp867x_set_dmamode()
118 * rev-A: UDMA_1~4 (5, 6 no change) in atp867x_set_dmamode()
119 * rev-B: all UDMA modes in atp867x_set_dmamode()
122 if (dp->pci66mhz && mode > ATP867X_IO_DMAMODE_UDMA_0 && in atp867x_set_dmamode()
123 (pdev->device == PCI_DEVICE_ID_ARTOP_ATP867B || in atp867x_set_dmamode()
125 mode--; in atp867x_set_dmamode()
127 b = ioread8(dp->dma_mode); in atp867x_set_dmamode()
128 if (adev->devno & 1) { in atp867x_set_dmamode()
135 iowrite8(b, dp->dma_mode); in atp867x_set_dmamode()
141 struct atp867x_priv *dp = ap->private_data; in atp867x_get_active_clocks_shifted() local
148 if (dp->pci66mhz) in atp867x_get_active_clocks_shifted()
187 --clocks; /* by the spec */ in atp867x_get_recover_clocks_shifted()
206 struct atp867x_priv *dp = ap->private_data; in atp867x_set_piomode() local
207 u8 speed = adev->pio_mode; in atp867x_set_piomode()
216 if (peer && peer->pio_mode) { in atp867x_set_piomode()
217 ata_timing_compute(peer, peer->pio_mode, &p, T, UT); in atp867x_set_piomode()
221 b = ioread8(dp->dma_mode); in atp867x_set_piomode()
222 if (adev->devno & 1) in atp867x_set_piomode()
226 iowrite8(b, dp->dma_mode); in atp867x_set_piomode()
231 if (adev->devno & 1) in atp867x_set_piomode()
232 iowrite8(b, dp->slave_piospd); in atp867x_set_piomode()
234 iowrite8(b, dp->mstr_piospd); in atp867x_set_piomode()
239 iowrite8(b, dp->eightb_piospd); in atp867x_set_piomode()
244 if (pdev->subsystem_vendor == PCI_VENDOR_ID_ARTOP && in atp867x_cable_override()
245 (pdev->subsystem_device == PCI_DEVICE_ID_ARTOP_ATP867A || in atp867x_cable_override()
246 pdev->subsystem_device == PCI_DEVICE_ID_ARTOP_ATP867B)) { in atp867x_cable_override()
254 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in atp867x_cable_detect()
283 dev_dbg(&pdev->dev, "ATP867X: resource start:len=%lx:%lx\n", in atp867x_check_res()
290 struct ata_ioports *ioaddr = &ap->ioaddr; in atp867x_check_ports()
291 struct atp867x_priv *dp = ap->private_data; in atp867x_check_ports() local
307 " dp->dma_mode =0x%lx\n" in atp867x_check_ports()
308 " dp->mstr_piospd =0x%lx\n" in atp867x_check_ports()
309 " dp->slave_piospd =0x%lx\n" in atp867x_check_ports()
310 " dp->eightb_piospd =0x%lx\n" in atp867x_check_ports()
311 " dp->pci66mhz =0x%lx\n", in atp867x_check_ports()
313 (unsigned long)ioaddr->cmd_addr, in atp867x_check_ports()
315 (unsigned long)ioaddr->ctl_addr, in atp867x_check_ports()
317 (unsigned long)ioaddr->bmdma_addr, in atp867x_check_ports()
319 (unsigned long)ioaddr->data_addr, in atp867x_check_ports()
320 (unsigned long)ioaddr->error_addr, in atp867x_check_ports()
321 (unsigned long)ioaddr->feature_addr, in atp867x_check_ports()
322 (unsigned long)ioaddr->nsect_addr, in atp867x_check_ports()
323 (unsigned long)ioaddr->lbal_addr, in atp867x_check_ports()
324 (unsigned long)ioaddr->lbam_addr, in atp867x_check_ports()
325 (unsigned long)ioaddr->lbah_addr, in atp867x_check_ports()
326 (unsigned long)ioaddr->device_addr, in atp867x_check_ports()
327 (unsigned long)ioaddr->status_addr, in atp867x_check_ports()
328 (unsigned long)ioaddr->command_addr, in atp867x_check_ports()
329 (unsigned long)dp->dma_mode, in atp867x_check_ports()
330 (unsigned long)dp->mstr_piospd, in atp867x_check_ports()
331 (unsigned long)dp->slave_piospd, in atp867x_check_ports()
332 (unsigned long)dp->eightb_piospd, in atp867x_check_ports()
333 (unsigned long)dp->pci66mhz); in atp867x_check_ports()
338 struct pci_dev *pdev = to_pci_dev(ap->host->dev); in atp867x_set_priv()
339 struct atp867x_priv *dp; in atp867x_set_priv() local
340 int port = ap->port_no; in atp867x_set_priv()
342 dp = ap->private_data = in atp867x_set_priv()
343 devm_kzalloc(&pdev->dev, sizeof(*dp), GFP_KERNEL); in atp867x_set_priv()
344 if (dp == NULL) in atp867x_set_priv()
345 return -ENOMEM; in atp867x_set_priv()
347 dp->dma_mode = ATP867X_IO_DMAMODE(ap, port); in atp867x_set_priv()
348 dp->mstr_piospd = ATP867X_IO_MSTRPIOSPD(ap, port); in atp867x_set_priv()
349 dp->slave_piospd = ATP867X_IO_SLAVPIOSPD(ap, port); in atp867x_set_priv()
350 dp->eightb_piospd = ATP867X_IO_8BPIOSPD(ap, port); in atp867x_set_priv()
352 dp->pci66mhz = in atp867x_set_priv()
360 struct pci_dev *pdev = to_pci_dev(host->dev); in atp867x_fixup()
361 struct ata_port *ap = host->ports[0]; in atp867x_fixup()
372 dev_dbg(&pdev->dev, "ATP867X: set latency timer to %d\n", v); in atp867x_fixup()
394 * Turn off the over clocked udma5 mode, only for Rev-B in atp867x_fixup()
398 if (pdev->device == PCI_DEVICE_ID_ARTOP_ATP867B) in atp867x_fixup()
405 struct device *gdev = host->dev; in atp867x_ata_pci_sff_init_host()
414 if (rc == -EBUSY) in atp867x_ata_pci_sff_init_host()
418 host->iomap = pcim_iomap_table(pdev); in atp867x_ata_pci_sff_init_host()
424 host->iomap[i]); in atp867x_ata_pci_sff_init_host()
429 for (i = 0; i < host->n_ports; i++) { in atp867x_ata_pci_sff_init_host()
430 struct ata_port *ap = host->ports[i]; in atp867x_ata_pci_sff_init_host()
431 struct ata_ioports *ioaddr = &ap->ioaddr; in atp867x_ata_pci_sff_init_host()
433 ioaddr->cmd_addr = ATP867X_IO_PORTBASE(ap, i); in atp867x_ata_pci_sff_init_host()
434 ioaddr->ctl_addr = ioaddr->altstatus_addr in atp867x_ata_pci_sff_init_host()
436 ioaddr->bmdma_addr = ATP867X_IO_DMABASE(ap, i); in atp867x_ata_pci_sff_init_host()
446 (unsigned long)ioaddr->cmd_addr, in atp867x_ata_pci_sff_init_host()
447 (unsigned long)ioaddr->ctl_addr); in atp867x_ata_pci_sff_init_host()
449 (unsigned long)ioaddr->bmdma_addr); in atp867x_ata_pci_sff_init_host()
456 return -ENODEV; in atp867x_ata_pci_sff_init_host()
461 return dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK); in atp867x_ata_pci_sff_init_host()
478 ata_print_version_once(&pdev->dev, DRV_VERSION); in atp867x_init_one()
484 dev_info(&pdev->dev, "ATP867X: ATP867 ATA UDMA133 controller (rev %02X)", in atp867x_init_one()
485 pdev->device); in atp867x_init_one()
487 host = ata_host_alloc_pinfo(&pdev->dev, ppi, ATP867X_NUM_PORTS); in atp867x_init_one()
489 dev_err(&pdev->dev, "failed to allocate ATA host\n"); in atp867x_init_one()
490 rc = -ENOMEM; in atp867x_init_one()
496 dev_err(&pdev->dev, "failed to init host\n"); in atp867x_init_one()
502 rc = ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, in atp867x_init_one()
505 dev_err(&pdev->dev, "failed to activate host\n"); in atp867x_init_one()
547 MODULE_AUTHOR("John(Jung-Ik) Lee, Google Inc.");
548 MODULE_DESCRIPTION("low level driver for Artop/Acard 867x ATA controller");