summaryrefslogtreecommitdiff
path: root/drivers/ata/pata_platform.c
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2019-01-19 07:52:01 +0300
committerJens Axboe <axboe@kernel.dk>2019-02-08 16:42:53 +0300
commitf3d5e4f18dba18d7c2303dda68b9dbcf5ccc05cd (patch)
tree325d873caee753bca9ee40555d84a5afcb64686c /drivers/ata/pata_platform.c
parent740c68a0cd42aab21ad9aaae092ff8a2215966b1 (diff)
downloadlinux-f3d5e4f18dba18d7c2303dda68b9dbcf5ccc05cd.tar.xz
ata: pata_of_platform: Allow to use 16-bit wide data transfer
In some cases, the system bus can be configured for 16-bit mode, in this case using read/write functions for 32-bit values results in two cycles of 16 bits each, which is wrong. This patch adds the devicetree flag to switch the driver to use 16-bit mode for I/O transfers. Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/ata/pata_platform.c')
-rw-r--r--drivers/ata/pata_platform.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index d6f8f5406442..31cd0f39b0a7 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -47,13 +47,6 @@ static struct scsi_host_template pata_platform_sht = {
ATA_PIO_SHT(DRV_NAME),
};
-static struct ata_port_operations pata_platform_port_ops = {
- .inherits = &ata_sff_port_ops,
- .sff_data_xfer = ata_sff_data_xfer32,
- .cable_detect = ata_cable_unknown,
- .set_mode = pata_platform_set_mode,
-};
-
static void pata_platform_setup_port(struct ata_ioports *ioaddr,
unsigned int shift)
{
@@ -79,6 +72,7 @@ static void pata_platform_setup_port(struct ata_ioports *ioaddr,
* @ioport_shift: I/O port shift
* @__pio_mask: PIO mask
* @sht: scsi_host_template to use when registering
+ * @use16bit: Flag to indicate 16-bit IO instead of 32-bit
*
* Register a platform bus IDE interface. Such interfaces are PIO and we
* assume do not support IRQ sharing.
@@ -101,7 +95,7 @@ static void pata_platform_setup_port(struct ata_ioports *ioaddr,
int __pata_platform_probe(struct device *dev, struct resource *io_res,
struct resource *ctl_res, struct resource *irq_res,
unsigned int ioport_shift, int __pio_mask,
- struct scsi_host_template *sht)
+ struct scsi_host_template *sht, bool use16bit)
{
struct ata_host *host;
struct ata_port *ap;
@@ -131,7 +125,15 @@ int __pata_platform_probe(struct device *dev, struct resource *io_res,
return -ENOMEM;
ap = host->ports[0];
- ap->ops = &pata_platform_port_ops;
+ ap->ops = devm_kzalloc(dev, sizeof(*ap->ops), GFP_KERNEL);
+ ap->ops->inherits = &ata_sff_port_ops;
+ ap->ops->cable_detect = ata_cable_unknown;
+ ap->ops->set_mode = pata_platform_set_mode;
+ if (use16bit)
+ ap->ops->sff_data_xfer = ata_sff_data_xfer;
+ else
+ ap->ops->sff_data_xfer = ata_sff_data_xfer32;
+
ap->pio_mask = __pio_mask;
ap->flags |= ATA_FLAG_SLAVE_POSS;
@@ -218,7 +220,7 @@ static int pata_platform_probe(struct platform_device *pdev)
return __pata_platform_probe(&pdev->dev, io_res, ctl_res, irq_res,
pp_info ? pp_info->ioport_shift : 0,
- pio_mask, &pata_platform_sht);
+ pio_mask, &pata_platform_sht, false);
}
static struct platform_driver pata_platform_driver = {