From: Michael Schmitz <schmitzmic@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: s.shtylyov@omp.ru, dlemoal@kernel.org, linux-ide@vger.kernel.org,
linux-m68k@vger.kernel.org, will@sowerbutts.com,
rz@linux-m68k.org, Finn Thain <fthain@linux-m68k.org>
Subject: Re: [PATCH v5 2/2] ata: pata_falcon: add data_swab option to byte-swap disk data
Date: Sat, 26 Aug 2023 12:44:44 +1200 [thread overview]
Message-ID: <f02aeddc-eb6e-9de3-5c92-959271b1b6c5@gmail.com> (raw)
In-Reply-To: <CAMuHMdUhw-mvGXRRimfp1SAMaRzOfQuO=k81LaZbXuNPV0igQQ@mail.gmail.com>
Hi Geert,
Am 25.08.23 um 19:46 schrieb Geert Uytterhoeven:
> Hi Michael,
>
> On Fri, Aug 25, 2023 at 3:13 AM Michael Schmitz <schmitzmic@gmail.com> 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@sowerbutts.com>
>> Cc: Finn Thain <fthain@linux-m68k.org>
>> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
>> Tested-by: William R Sowerbutts <will@sowerbutts.com>
>> Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
>> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
>>
>> ---
>>
>> Changes since v4:
>>
>> Damien Le Moal:
>> - spell out bitmask shift calculation
> Thanks for the update!
>
> Sorry to bother you again...
>
>> --- a/drivers/ata/pata_falcon.c
>> +++ b/drivers/ata/pata_falcon.c
>> @@ -124,7 +129,7 @@ static int __init pata_falcon_init_one(struct platform_device *pdev)
>> struct ata_host *host;
>> struct ata_port *ap;
>> void __iomem *base, *ctl_base;
>> - int irq = 0, io_offset = 1, reg_shift = 2; /* Falcon defaults */
>> + int irq = 0, io_offset = 1, reg_shift = 2, mask_shift; /* Falcon defaults */
> The comment does not apply to the mask_shift variable, unless you
> pre-initialize it to 0...
It does not apply to mask_shift even then - '0' is the default for the
first Q40 ISA adapter also, not just for Falcon.
I'll move mask_shift to its own line so the comment can be correct.
>
>> dev_info(&pdev->dev, "Atari Falcon and Q40/Q60 PATA controller\n");
>>
>> @@ -194,6 +199,12 @@ static int __init pata_falcon_init_one(struct platform_device *pdev)
>> ata_port_desc(ap, "cmd %px ctl %px data %px",
>> base, ctl_base, ap->ioaddr.data_addr);
>>
>> + if (pdev->id > 0)
>> + mask_shift = 2;
>> + else
>> + mask_shift = 0;
> ... and drop the else.
Damien did seem quite partial to that one, so I'll leave it.
Cheers,
Michael
>
>> + ap->private_data = (void *)(uintptr_t)(pata_falcon_swap_mask >> mask_shift);
>> +
>> 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
>
next prev parent reply other threads:[~2023-08-26 0:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-25 1:13 [PATCH v5 0/2] Q40 IDE fixes Michael Schmitz
2023-08-25 1:13 ` [PATCH v5 1/2] ata: pata_falcon: fix IO base selection for Q40 Michael Schmitz
2023-08-25 1:13 ` [PATCH v5 2/2] ata: pata_falcon: add data_swab option to byte-swap disk data Michael Schmitz
2023-08-25 7:46 ` Geert Uytterhoeven
2023-08-26 0:44 ` Michael Schmitz [this message]
2023-08-26 1:55 ` Damien Le Moal
2023-08-26 11:12 ` [PATCH v5 0/2] Q40 IDE fixes William R Sowerbutts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f02aeddc-eb6e-9de3-5c92-959271b1b6c5@gmail.com \
--to=schmitzmic@gmail.com \
--cc=dlemoal@kernel.org \
--cc=fthain@linux-m68k.org \
--cc=geert@linux-m68k.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
--cc=rz@linux-m68k.org \
--cc=s.shtylyov@omp.ru \
--cc=will@sowerbutts.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox