Lines Matching +full:ixp4xx +full:- +full:compact +full:- +full:flash

1 // SPDX-License-Identifier: GPL-2.0-only
3 * ixp4xx PATA/Compact Flash driver
4 * Copyright (C) 2006-07 Tower Technologies
7 * An ATA driver to handle a Compact Flash connected
8 * to the ixp4xx expansion bus in TrueIDE mode. The CF
10 * on the ixp4xx. In the irq is not available, you might
49 #define IXP4XX_EXP_BYTE_RD16 BIT(6) /* Byte reads on half-word devices */
56 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_8bit_timing()
60 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_8bit_timing()
64 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_8bit_timing()
68 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_8bit_timing()
72 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_8bit_timing()
78 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_8bit_timing()
86 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_16bit_timing()
90 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_16bit_timing()
94 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_16bit_timing()
98 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_16bit_timing()
102 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_16bit_timing()
108 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_16bit_timing()
115 struct ixp4xx_pata *ixpp = ap->host->private_data; in ixp4xx_set_piomode()
118 adev->pio_mode - XFER_PIO_0); in ixp4xx_set_piomode()
119 ixp4xx_set_8bit_timing(ixpp, adev->pio_mode); in ixp4xx_set_piomode()
129 struct ata_device *adev = qc->dev; in ixp4xx_mmio_data_xfer()
130 struct ata_port *ap = qc->dev->link->ap; in ixp4xx_mmio_data_xfer()
131 void __iomem *mmio = ap->ioaddr.data_addr; in ixp4xx_mmio_data_xfer()
132 struct ixp4xx_pata *ixpp = ap->host->private_data; in ixp4xx_mmio_data_xfer()
137 spin_lock_irqsave(ap->lock, flags); in ixp4xx_mmio_data_xfer()
142 ixp4xx_set_16bit_timing(ixpp, adev->pio_mode); in ixp4xx_mmio_data_xfer()
156 unsigned char *trailing_buf = buf + buflen - 1; in ixp4xx_mmio_data_xfer()
168 ixp4xx_set_8bit_timing(ixpp, adev->pio_mode); in ixp4xx_mmio_data_xfer()
171 spin_unlock_irqrestore(ap->lock, flags); in ixp4xx_mmio_data_xfer()
197 struct ata_ioports *ioaddr = &ap->ioaddr; in ixp4xx_setup_port()
200 ioaddr->cmd_addr = ixpp->cmd; in ixp4xx_setup_port()
201 ioaddr->altstatus_addr = ixpp->ctl + 0x06; in ixp4xx_setup_port()
202 ioaddr->ctl_addr = ixpp->ctl + 0x06; in ixp4xx_setup_port()
208 * ixp4xx in little endian mode. in ixp4xx_setup_port()
211 *(unsigned long *)&ioaddr->data_addr ^= 0x02; in ixp4xx_setup_port()
212 *(unsigned long *)&ioaddr->cmd_addr ^= 0x03; in ixp4xx_setup_port()
213 *(unsigned long *)&ioaddr->altstatus_addr ^= 0x03; in ixp4xx_setup_port()
214 *(unsigned long *)&ioaddr->ctl_addr ^= 0x03; in ixp4xx_setup_port()
215 *(unsigned long *)&ioaddr->error_addr ^= 0x03; in ixp4xx_setup_port()
216 *(unsigned long *)&ioaddr->feature_addr ^= 0x03; in ixp4xx_setup_port()
217 *(unsigned long *)&ioaddr->nsect_addr ^= 0x03; in ixp4xx_setup_port()
218 *(unsigned long *)&ioaddr->lbal_addr ^= 0x03; in ixp4xx_setup_port()
219 *(unsigned long *)&ioaddr->lbam_addr ^= 0x03; in ixp4xx_setup_port()
220 *(unsigned long *)&ioaddr->lbah_addr ^= 0x03; in ixp4xx_setup_port()
221 *(unsigned long *)&ioaddr->device_addr ^= 0x03; in ixp4xx_setup_port()
222 *(unsigned long *)&ioaddr->status_addr ^= 0x03; in ixp4xx_setup_port()
223 *(unsigned long *)&ioaddr->command_addr ^= 0x03; in ixp4xx_setup_port()
237 struct device *dev = &pdev->dev; in ixp4xx_pata_probe()
238 struct device_node *np = dev->of_node; in ixp4xx_pata_probe()
248 return -EINVAL; in ixp4xx_pata_probe()
252 return -ENOMEM; in ixp4xx_pata_probe()
254 ixpp->rmap = syscon_node_to_regmap(np->parent); in ixp4xx_pata_probe()
255 if (IS_ERR(ixpp->rmap)) in ixp4xx_pata_probe()
256 return dev_err_probe(dev, PTR_ERR(ixpp->rmap), "no regmap\n"); in ixp4xx_pata_probe()
262 ixpp->cmd_csreg = csindex * IXP4XX_EXP_TIMING_STRIDE; in ixp4xx_pata_probe()
264 ixpp->host = ata_host_alloc_pinfo(dev, ppi, 1); in ixp4xx_pata_probe()
265 if (!ixpp->host) in ixp4xx_pata_probe()
266 return -ENOMEM; in ixp4xx_pata_probe()
267 ixpp->host->private_data = ixpp; in ixp4xx_pata_probe()
273 ixpp->cmd = devm_ioremap_resource(dev, cmd); in ixp4xx_pata_probe()
274 ixpp->ctl = devm_ioremap_resource(dev, ctl); in ixp4xx_pata_probe()
275 if (IS_ERR(ixpp->cmd) || IS_ERR(ixpp->ctl)) in ixp4xx_pata_probe()
276 return -ENOMEM; in ixp4xx_pata_probe()
284 return -EINVAL; in ixp4xx_pata_probe()
287 ixp4xx_setup_port(ixpp->host->ports[0], ixpp, cmd->start, ctl->start); in ixp4xx_pata_probe()
291 return ata_host_activate(ixpp->host, irq, ata_sff_interrupt, 0, &ixp4xx_sht); in ixp4xx_pata_probe()
295 { .compatible = "intel,ixp4xx-compact-flash", },
311 MODULE_DESCRIPTION("low-level driver for ixp4xx Compact Flash PATA");