public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Schmitz <schmitzmic@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
	Arnd Bergmann <arnd@kernel.org>
Cc: Linux/m68k <linux-m68k@vger.kernel.org>,
	linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH v1 3/4] scsi - convert mvme146_scsi.c to platform device
Date: Mon, 11 Jul 2022 19:57:17 +1200	[thread overview]
Message-ID: <fb5f0f5d-e144-3f5b-9e46-6e22d8a3ca60@gmail.com> (raw)
In-Reply-To: <CAMuHMdXapPSOBzSNTLy_RJV=RLq-6hcf-XFtvfSe-g=PrcAhEw@mail.gmail.com>

Hi Geert,

Am 11.07.2022 um 19:16 schrieb Geert Uytterhoeven:
> On Sun, Jul 10, 2022 at 6:12 PM Arnd Bergmann <arnd@kernel.org> wrote:
>> On Sat, Jul 9, 2022 at 2:10 AM Michael Schmitz <schmitzmic@gmail.com> wrote:
>>> Convert the mvme147_scsi driver to a platform device driver.
>>> This is required for conversion of the driver to the DMA API.
>>>
>>> CC: linux-scsi@vger.kernel.org
>>> Link: https://lore.kernel.org/r/6d1d88ee-1cf6-c735-1e6d-bafd2096e322@gmail.com
>>> Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
>>
>> The patch looks correct to me, but the type cast for the address doesn't
>> seem right:
>>
>>> -       regs.SASR = (volatile unsigned char *)0xfffe4000;
>>> -       regs.SCMD = (volatile unsigned char *)0xfffe4001;
>>>
>>> -       hdata = shost_priv(mvme147_shost);
>>> +       mvme147_inst->base = mres->start;
>>> +       mvme147_inst->irq = ires->start;
>>> +
>>> +       regs.SASR = (volatile unsigned char *)mres->start;
>>> +       regs.SCMD = (volatile unsigned char *)(mres->start)+0x1;
>>
>> A resource would pass a phys_addr_t token, but the driver expects a
>> virtual address that should be an __iomem pointer. The MMIO area
>> already gets mapped into virtual addresses in arch/m68k/kernel/head.S,
>> so it makes sense to skip the extra ioremap() and just use the address,
>> but then you can't pass it as an IORESOUCRE_MEM token and should
>> use platform_data with the pointer instead.

OK, got it now (I had missed the physical/virtual mismatch entirely).

>>
>> The alternative is to do it the normal way and pass the physical address
>> as a resource, that you can pass into devm_platform_ioremap_resource()
>> or a similar helper.
>
> I would prefer the latter.  While head.S sets up the mapping,
> __ioremap() does not have support for this on the mvme platform,
> so this has to be added first. Look at the amiga and virt platforms
> for examples.

I see - doesn't look too hard to do, and should not affect any other 
existing code.
Is it worth adding the same support for Atari as well?

> If you do want to pass the virtual address as platform data (for now
> ;-), please provide the physical memory resource too, so we don't
> have to go through another synchronization step with the m68k and
> scsi trees later.

That's what I had intended to do, but I'd rather get this sorted once 
and for all.

Cheers,

	Michael


>
> Thanks!
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
>

  reply	other threads:[~2022-07-11  7:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-09  0:10 [PATCH v1 0/4] Convert m68k MVME147 WD33C93 SCSI driver to DMA API Michael Schmitz
2022-07-09  0:10 ` [PATCH v1 1/4] m68k - add MVME147 SCSI base address to mvme147hw.h Michael Schmitz
2022-07-10 16:06   ` Arnd Bergmann
2022-07-11  4:16     ` Michael Schmitz
2022-07-11  8:45       ` Arnd Bergmann
2022-07-11 20:04         ` Michael Schmitz
2022-07-09  0:10 ` [PATCH v1 2/4] m68k - set up platform device for mvme147_scsi Michael Schmitz
2022-07-09  5:29   ` kernel test robot
2022-07-10 15:56   ` Arnd Bergmann
2022-07-11  4:11     ` Michael Schmitz
2022-07-09  0:10 ` [PATCH v1 3/4] scsi - convert mvme146_scsi.c to platform device Michael Schmitz
2022-07-10 16:11   ` Arnd Bergmann
2022-07-11  7:16     ` Geert Uytterhoeven
2022-07-11  7:57       ` Michael Schmitz [this message]
2022-07-11  8:27         ` Geert Uytterhoeven
2022-07-11 20:02           ` Michael Schmitz
2022-07-12  3:27             ` Michael Schmitz
2022-07-12  6:57               ` Geert Uytterhoeven
2022-07-12  7:59                 ` Michael Schmitz
2022-07-09  0:10 ` [PATCH v1 4/4] scsi - convert mvme147_scsi driver to DMA API Michael Schmitz

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=fb5f0f5d-e144-3f5b-9e46-6e22d8a3ca60@gmail.com \
    --to=schmitzmic@gmail.com \
    --cc=arnd@kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /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