Re: [PATCH 0/1] m68k: Handle HAS_IOPORT dependencies
From: Arnd Bergmann
Date: Fri Apr 05 2024 - 16:14:12 EST
On Fri, Apr 5, 2024, at 20:36, Michael Schmitz wrote:
> Am 05.04.2024 um 23:16 schrieb Geert Uytterhoeven:
>> On Wed, Apr 3, 2024 at 8:35 PM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
>>> On Wed, Apr 3, 2024, at 20:11, Michael Schmitz wrote:
>>>> how do you propose we handle legacy drivers that do depend on
>>>> inb()/outb() functions (_not_ actual ISA I/O) on architectures that map
>>>> inb()/outb() to MMIO functions?
>>>>
>>>> (In my case, that's at least ne.c - Geert ought to have a better
>>>> overview what else does use inb()/outb() on m68k)
>>>
>>> If a machine provides an inb()/outb() set of operations that
>>> is actually used, it should set HAS_IOPORT.
>>>
>>> For the Q40, it may be better in the long run to change the
>>> drivers to just use MMIO directly though.
>>
>> Q40 uses ISA.
>>
>> Michael is worried about non-ISA drivers using inb() and friends.
>> At some point in time (i.e. eons ago), we were told it was better to
>> use in[bwl]()/read[bwl]() instead of directly dereferencing volatile
>> pointers...
>>
>> Anyway, I don't think we have many users of inb() and friends left, and
>> I assume the bots should have detected any/most remaining users in Niklas'
>> branch...
>
> All the 8390 based ethernet drivers still use inb() and friends.
>
> That is the main reason for the terrible hacks in
> arch/m68k/include/asm/io_mm.h ...
>
> The last time I tried to add support for a different PCMCIA ethernet
> adapter to apne.c _without_ adding to the hacks in io_mm.h, I wasn't
> getting anywhere with the netdev crowd. That was ages ago, and I doubt
> their enthusiasm for a rewrite of the 8390 code base to avoid using
> inb() on MMIO architectures will be any better now.
>From what I can see, there is already an abstraction layer in
these drivers that is used by all m68k drivers except apne:
$ git grep -w 'define\sei_inb'
drivers/net/ethernet/8390/8390.h:#define ei_inb(_p) inb(_p)
drivers/net/ethernet/8390/8390p.c:#define ei_inb(_p) inb(_p)
drivers/net/ethernet/8390/ax88796.c:#define ei_inb(_a) readb(ax_convert_addr(_a))
drivers/net/ethernet/8390/etherh.c:#define ei_inb(_p) readb((void __iomem *)_p)
drivers/net/ethernet/8390/hydra.c:#define ei_inb(port) in_8(port)
drivers/net/ethernet/8390/mac8390.c:#define ei_inb(port) in_8(port)
drivers/net/ethernet/8390/mcf8390.c:#define ei_inb ei_inb
drivers/net/ethernet/8390/xsurf100.c:#define ei_inb(_a) z_readb(ax_convert_addr(_a))
drivers/net/ethernet/8390/zorro8390.c:#define ei_inb(port) in_8(port)
Can't apne.c just do the same here? The patch below didn't
take that long to come up with, but I may be missing something
here of course.
Arnd
8<---