On 8/23/23 1:13 AM, Michael Schmitz wrote: > Some users of pata_falcon on Q40 have IDE disks in default > IDE little endian byte order, whereas legacy disks use > host-native big-endian byte order as on the Atari Falcon. > > Add module parameter 'data_swab' to allow connecting drives > with non-native data byte order. Drives selected by the > data_swap bit mask will have their user data byte-swapped to > host byte order, i.e. 'pata_falcon.data_swab=2' will byte-swap > all user data on drive B, leaving data on drive A in native > byte order. On Q40, drives on a second IDE interface may be > added to the bit mask as bits 2 and 3. > > Default setting is no byte swapping, i.e. compatibility with > the native Falcon or Q40 operating system disk format. > > Cc: William R Sowerbutts <will@xxxxxxxxxxxxxx> > Cc: Finn Thain <fthain@xxxxxxxxxxxxxx> > Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> > Tested-by: William R Sowerbutts <will@xxxxxxxxxxxxxx> > Signed-off-by: Michael Schmitz <schmitzmic@xxxxxxxxx> Reviewed-by: Sergey Shtylyov <s.shtylyov@xxxxxx> [...] > diff --git a/drivers/ata/pata_falcon.c b/drivers/ata/pata_falcon.c > index 3841ea200bcb..7cf15bd9764a 100644 > --- a/drivers/ata/pata_falcon.c > +++ b/drivers/ata/pata_falcon.c [...] > @@ -194,6 +199,9 @@ static int __init pata_falcon_init_one(struct platform_device *pdev) > ata_port_desc(ap, "cmd %px ctl %px data %pa", > base, ctl_base, &ap->ioaddr.data_addr); > > + ap->private_data = (void *)(uintptr_t)(pdev->id > 0 ? > + pata_falcon_swap_mask >> 2 : pata_falcon_swap_mask); How about: ap->private_data = (void *)(uintptr_t)(pata_falcon_swap_mask >> (pdev->id > 0 ? 2 : 0)); [...] MBR, Sergey