hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/ata/pata_platform.c
....@@ -47,13 +47,6 @@
4747 ATA_PIO_SHT(DRV_NAME),
4848 };
4949
50
-static struct ata_port_operations pata_platform_port_ops = {
51
- .inherits = &ata_sff_port_ops,
52
- .sff_data_xfer = ata_sff_data_xfer32,
53
- .cable_detect = ata_cable_unknown,
54
- .set_mode = pata_platform_set_mode,
55
-};
56
-
5750 static void pata_platform_setup_port(struct ata_ioports *ioaddr,
5851 unsigned int shift)
5952 {
....@@ -79,6 +72,7 @@
7972 * @ioport_shift: I/O port shift
8073 * @__pio_mask: PIO mask
8174 * @sht: scsi_host_template to use when registering
75
+ * @use16bit: Flag to indicate 16-bit IO instead of 32-bit
8276 *
8377 * Register a platform bus IDE interface. Such interfaces are PIO and we
8478 * assume do not support IRQ sharing.
....@@ -101,7 +95,7 @@
10195 int __pata_platform_probe(struct device *dev, struct resource *io_res,
10296 struct resource *ctl_res, struct resource *irq_res,
10397 unsigned int ioport_shift, int __pio_mask,
104
- struct scsi_host_template *sht)
98
+ struct scsi_host_template *sht, bool use16bit)
10599 {
106100 struct ata_host *host;
107101 struct ata_port *ap;
....@@ -120,7 +114,7 @@
120114 */
121115 if (irq_res && irq_res->start > 0) {
122116 irq = irq_res->start;
123
- irq_flags = irq_res->flags & IRQF_TRIGGER_MASK;
117
+ irq_flags = (irq_res->flags & IRQF_TRIGGER_MASK) | IRQF_SHARED;
124118 }
125119
126120 /*
....@@ -131,7 +125,15 @@
131125 return -ENOMEM;
132126 ap = host->ports[0];
133127
134
- ap->ops = &pata_platform_port_ops;
128
+ ap->ops = devm_kzalloc(dev, sizeof(*ap->ops), GFP_KERNEL);
129
+ ap->ops->inherits = &ata_sff_port_ops;
130
+ ap->ops->cable_detect = ata_cable_unknown;
131
+ ap->ops->set_mode = pata_platform_set_mode;
132
+ if (use16bit)
133
+ ap->ops->sff_data_xfer = ata_sff_data_xfer;
134
+ else
135
+ ap->ops->sff_data_xfer = ata_sff_data_xfer32;
136
+
135137 ap->pio_mask = __pio_mask;
136138 ap->flags |= ATA_FLAG_SLAVE_POSS;
137139
....@@ -218,7 +220,7 @@
218220
219221 return __pata_platform_probe(&pdev->dev, io_res, ctl_res, irq_res,
220222 pp_info ? pp_info->ioport_shift : 0,
221
- pio_mask, &pata_platform_sht);
223
+ pio_mask, &pata_platform_sht, false);
222224 }
223225
224226 static struct platform_driver pata_platform_driver = {