From: Alan Stern <stern@rowland.harvard.edu>
To: "Enrico Weigelt, metux IT consult" <info@metux.net>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
linux-arch@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: RFC: arch: shall we have generic readl_be()/writel_be()/... or in_be32()/out_be32() ?
Date: Wed, 9 Dec 2020 15:20:24 -0500 [thread overview]
Message-ID: <20201209202024.GA1355417@rowland.harvard.edu> (raw)
In-Reply-To: <da9cb964-18a7-bff1-1249-b0df24daa05e@metux.net>
On Wed, Dec 09, 2020 at 12:08:51PM +0100, Enrico Weigelt, metux IT consult wrote:
> Hello folks,
>
>
> while trying to make some more drivers compile-test'able, i've
> discovered some arch specific calls in here, eg.:
>
>
> In file included from
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/drivers/usb/host/ehci-spear.c:23:
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/drivers/usb/host/ehci.h:
> In function 'ehci_readl':
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/drivers/usb/host/ehci.h:743:3:
> error: implicit declaration of function 'readl_be'; did you mean
> 'readsb'? [-Werror=implicit-function-declaration]
> 743 | readl_be(regs) :
> | ^~~~~~~~
> | readsb
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/drivers/usb/host/ehci.h:
> In function 'ehci_writel':
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/drivers/usb/host/ehci.h:767:3:
> error: implicit declaration of function 'writel_be'; did you mean
> 'writesb'? [-Werror=implicit-function-declaration]
> 767 | writel_be(val, regs) :
> | ^~~~~~~~~
> | writesb
> In file included from
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/drivers/usb/host/ehci-hcd.c:97:
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/drivers/usb/host/ehci.h:
> In function 'ehci_readl':
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/drivers/usb/host/ehci.h:743:3:
> error: implicit declaration of function 'readl_be'; did you mean
> 'readsb'? [-Werror=implicit-function-declaration]
> 743 | readl_be(regs) :
> | ^~~~~~~~
> | readsb
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/drivers/usb/host/ehci.h:
> In function 'ehci_writel':
> /home/nekrad/src/apu2-dev/pkg/kernel.apu2.git/drivers/usb/host/ehci.h:767:3:
> error: implicit declaration of function 'writel_be'; did you mean
> 'writesb'? [-Werror=implicit-function-declaration]
> 767 | writel_be(val, regs) :
> | ^~~~~~~~~
> | writesb
>
>
> It seems that only few archs (microblaze, ppc, sparc) define them.
>
> Also drivers/usb/host/ehci.h defines them, but only for one particular
> arch/subarch.
>
> IIRC, these funcs are for accessing hw registers that are in BEs, so
> BE cpus can do direct access, while LE cpus need to do a conversion.
>
> OTOH, we also have in_be32() / out_be32. They seem to do quite the same
> thing, referenced much more often, but also just defined on a few archs.
>
>
> I believe we should have generic functions, that all archs implement
> (possibly doing automatic conversion, if necessary), which are used
> by everybody else.
>
> What's your oppionion on that ?
It certainly seems reasonable. Another possibility, less stringent, is
to require that definitions exist on all architectures that can have
big-endian MMIO (or port-based IO). For example, any architecture
which might select CONFIG_EHCI_BIG_ENDIAN_MMIO, as used in ehci.h.
Otherwise we're left in the unfortunate position of having to provide
definitions for these functions, but _only_ on architectures that don't
already make their own definitions -- basically an impossible task.
Alan Stern
next prev parent reply other threads:[~2020-12-09 20:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-09 11:08 RFC: arch: shall we have generic readl_be()/writel_be()/... or in_be32()/out_be32() ? Enrico Weigelt, metux IT consult
2020-12-09 20:20 ` Alan Stern [this message]
2020-12-11 13:20 ` Maciej W. Rozycki
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=20201209202024.GA1355417@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=info@metux.net \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@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;
as well as URLs for NNTP newsgroup(s).