Hi Geert,
On 18/08/23 07:21, Michael Schmitz wrote:
+ priv->swap_mask = pata_falcon_swap_mask;
priv->swap_mask = pata_falcon_swap_mask >> (2 * pdev->id);
The Atari platform driver data is registered with pdev->id=-1. That'll
break here.
Confirmed.
(Not sure why that choice of pdev->id, and whether it can be changed
to 0 easily)
Seems to work OK with ID set to 0, so I'll simplify that as you suggest.
Cheers,
Michael
Cheers,
Michael
--- a/drivers/ata/pata_falcon.c
+++ b/drivers/ata/pata_falcon.c
@@ -33,6 +33,11 @@
#define DRV_NAME "pata_falcon"
#define DRV_VERSION "0.1.0"
+static int pata_falcon_data_swab;
+
+module_param_named(data_swab, pata_falcon_data_swab, int, 0444);
+MODULE_PARM_DESC(data_swab, "Data byte swap enable/disable bitmap
(0x1==drive1, 0x2==drive2, 0x4==drive3, 0x8==drive4, default: 0)");
+
static const struct scsi_host_template pata_falcon_sht = {
ATA_PIO_SHT(DRV_NAME),
};
@@ -50,7 +55,7 @@ static unsigned int pata_falcon_data_xfer(struct
ata_queued_cmd *qc,
if (dev->class == ATA_DEV_ATA && cmd &&
!blk_rq_is_passthrough(scsi_cmd_to_rq(cmd)))
- swap = 0;
+ swap = (int)ap->private_data & BIT(dev->devno);
"(uintptr_t)", to make it 64-bit clean.
Yeah, we don't support COMPILE_TEST=y yet for PATA_FALCON.
BTW, looks like we don't need any of the following anymore:
#include <asm/setup.h>
#include <asm/atarihw.h>
#include <asm/atariints.h>
#include <asm/atari_stdma.h>
That leaves us with <asm/ide.h>, (which does not exist on most
architectures, and seems to be mostly obsolete), for the (indirectly
included) definitions of raw_{in,out}sw_{,swapw}()....
/* Transfer multiple of 2 bytes */
if (rw == READ) {
@@ -199,6 +204,8 @@ static int __init pata_falcon_init_one(struct
platform_device *pdev)
ap->ioaddr.altstatus_addr = ctl_base + io_offset;
ap->ioaddr.ctl_addr = ctl_base + io_offset;
+ ap->private_data = (void *)((pata_falcon_data_swab >> (2 *
pdev->id)) & 3);
"(void *)(uintptr_t)", to make it 64-bit clean.
+
irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (irq_res && irq_res->start > 0) {
irq = irq_res->start;
Gr{oetje,eeting}s,
Geert