Lines Matching +full:ixp4xx +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
50 #define IXP4XX_EXP_BYTE_RD16 BIT(6) /* Byte reads on half-word devices */
57 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_8bit_timing()
61 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_8bit_timing()
65 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_8bit_timing()
69 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_8bit_timing()
73 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_8bit_timing()
79 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_8bit_timing()
87 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_16bit_timing()
91 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_16bit_timing()
95 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_16bit_timing()
99 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_16bit_timing()
103 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_16bit_timing()
109 regmap_update_bits(ixpp->rmap, ixpp->cmd_csreg, in ixp4xx_set_16bit_timing()
116 struct ixp4xx_pata *ixpp = ap->host->private_data; in ixp4xx_set_piomode()
119 adev->pio_mode - XFER_PIO_0); in ixp4xx_set_piomode()
120 ixp4xx_set_8bit_timing(ixpp, adev->pio_mode); in ixp4xx_set_piomode()
130 struct ata_device *adev = qc->dev; in ixp4xx_mmio_data_xfer()
131 struct ata_port *ap = qc->dev->link->ap; in ixp4xx_mmio_data_xfer()
132 void __iomem *mmio = ap->ioaddr.data_addr; in ixp4xx_mmio_data_xfer()
133 struct ixp4xx_pata *ixpp = ap->host->private_data; in ixp4xx_mmio_data_xfer()
138 spin_lock_irqsave(ap->lock, flags); in ixp4xx_mmio_data_xfer()
143 ixp4xx_set_16bit_timing(ixpp, adev->pio_mode); in ixp4xx_mmio_data_xfer()
157 unsigned char *trailing_buf = buf + buflen - 1; in ixp4xx_mmio_data_xfer()
169 ixp4xx_set_8bit_timing(ixpp, adev->pio_mode); in ixp4xx_mmio_data_xfer()
172 spin_unlock_irqrestore(ap->lock, flags); in ixp4xx_mmio_data_xfer()
198 struct ata_ioports *ioaddr = &ap->ioaddr; in ixp4xx_setup_port()
201 ioaddr->cmd_addr = ixpp->cmd; in ixp4xx_setup_port()
202 ioaddr->altstatus_addr = ixpp->ctl + 0x06; in ixp4xx_setup_port()
203 ioaddr->ctl_addr = ixpp->ctl + 0x06; in ixp4xx_setup_port()
209 * ixp4xx in little endian mode. in ixp4xx_setup_port()
212 *(unsigned long *)&ioaddr->data_addr ^= 0x02; in ixp4xx_setup_port()
213 *(unsigned long *)&ioaddr->cmd_addr ^= 0x03; in ixp4xx_setup_port()
214 *(unsigned long *)&ioaddr->altstatus_addr ^= 0x03; in ixp4xx_setup_port()
215 *(unsigned long *)&ioaddr->ctl_addr ^= 0x03; in ixp4xx_setup_port()
216 *(unsigned long *)&ioaddr->error_addr ^= 0x03; in ixp4xx_setup_port()
217 *(unsigned long *)&ioaddr->feature_addr ^= 0x03; in ixp4xx_setup_port()
218 *(unsigned long *)&ioaddr->nsect_addr ^= 0x03; in ixp4xx_setup_port()
219 *(unsigned long *)&ioaddr->lbal_addr ^= 0x03; in ixp4xx_setup_port()
220 *(unsigned long *)&ioaddr->lbam_addr ^= 0x03; in ixp4xx_setup_port()
221 *(unsigned long *)&ioaddr->lbah_addr ^= 0x03; in ixp4xx_setup_port()
222 *(unsigned long *)&ioaddr->device_addr ^= 0x03; in ixp4xx_setup_port()
223 *(unsigned long *)&ioaddr->status_addr ^= 0x03; in ixp4xx_setup_port()
224 *(unsigned long *)&ioaddr->command_addr ^= 0x03; in ixp4xx_setup_port()
238 struct device *dev = &pdev->dev; in ixp4xx_pata_probe()
239 struct device_node *np = dev->of_node; in ixp4xx_pata_probe()
247 return -ENOMEM; in ixp4xx_pata_probe()
249 ixpp->rmap = syscon_node_to_regmap(np->parent); in ixp4xx_pata_probe()
250 if (IS_ERR(ixpp->rmap)) in ixp4xx_pata_probe()
251 return dev_err_probe(dev, PTR_ERR(ixpp->rmap), "no regmap\n"); in ixp4xx_pata_probe()
257 ixpp->cmd_csreg = csindex * IXP4XX_EXP_TIMING_STRIDE; in ixp4xx_pata_probe()
259 ixpp->host = ata_host_alloc_pinfo(dev, ppi, 1); in ixp4xx_pata_probe()
260 if (!ixpp->host) in ixp4xx_pata_probe()
261 return -ENOMEM; in ixp4xx_pata_probe()
262 ixpp->host->private_data = ixpp; in ixp4xx_pata_probe()
268 ixpp->cmd = devm_platform_get_and_ioremap_resource(pdev, 0, &cmd); in ixp4xx_pata_probe()
269 if (IS_ERR(ixpp->cmd)) in ixp4xx_pata_probe()
270 return PTR_ERR(ixpp->cmd); in ixp4xx_pata_probe()
272 ixpp->ctl = devm_platform_get_and_ioremap_resource(pdev, 1, &ctl); in ixp4xx_pata_probe()
273 if (IS_ERR(ixpp->ctl)) in ixp4xx_pata_probe()
274 return PTR_ERR(ixpp->ctl); in ixp4xx_pata_probe()
282 ixp4xx_setup_port(ixpp->host->ports[0], ixpp, cmd->start, ctl->start); in ixp4xx_pata_probe()
286 return ata_host_activate(ixpp->host, irq, ata_sff_interrupt, 0, &ixp4xx_sht); in ixp4xx_pata_probe()
290 { .compatible = "intel,ixp4xx-compact-flash", },
306 MODULE_DESCRIPTION("low-level driver for ixp4xx Compact Flash PATA");