From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] smc91x: remove ARM hack for unaligned 16-bit writes
Date: Fri, 26 Aug 2016 11:41:21 +0200 [thread overview]
Message-ID: <1899384.M1jdqOztqi@wuerfel> (raw)
In-Reply-To: <20160825223743.GK1041@n2100.armlinux.org.uk>
On Thursday, August 25, 2016 11:37:43 PM CEST Russell King - ARM Linux wrote:
> On Thu, Aug 25, 2016 at 08:02:35PM +0200, Robert Jarzmik wrote:
> > Arnd Bergmann <arnd@arndb.de> writes:
> /*
> + * Any 16-bit access is performed with two 8-bit accesses if the hardware
> + * can't do it directly. Most registers are 16-bit so those are mandatory.
> + */
> +#define SMC_outw_b(x, a, r) \
> + do { \
> + unsigned int __val16 = (x); \
> + unsigned int __reg = (r); \
> + SMC_outb(__val16, a, __reg); \
> + SMC_outb(__val16 >> 8, a, __reg + (1 << SMC_IO_SHIFT)); \
> + } while (0)
> +
> +#define SMC_inw_b(a, r) \
> + ({ \
> + unsigned int __val16; \
> + unsigned int __reg = r; \
> + __val16 = SMC_inb(a, __reg); \
> + __val16 |= SMC_inb(a, __reg + (1 << SMC_IO_SHIFT)) << 8; \
> + __val16; \
> + })
> +
> +/*
> * Define your architecture specific bus configuration parameters here.
> */
>
> @@ -55,10 +76,30 @@
> #define SMC_IO_SHIFT (lp->io_shift)
>
> #define SMC_inb(a, r) readb((a) + (r))
> -#define SMC_inw(a, r) readw((a) + (r))
> +#define SMC_inw(a, r) \
> + ({ \
> + unsigned int __smc_r = r; \
> + SMC_16BIT(lp) ? readw((a) + __smc_r) : \
> + SMC_8BIT(lp) ? SMC_inw_b(a, __smc_r) : \
> + ({ BUG(); 0; }); \
> + })
> +
I think this breaks machines that declare a device that just lists
SMC91X_USE_32BIT but not SMC91X_USE_16BIT. Right now, the way this
is interpreted is to use 32-bit accessors for most things, but
not avoiding 16-bit reads.
That is a bit fishy though, and we could instead change the platform
data to always set both SMC91X_USE_32BIT and SMC91X_USE_16BIT.
The affected platforms are DT based machines with 32-bit I/O and
these board files:
arch/arm/mach-pxa/idp.c: .flags = SMC91X_USE_32BIT | SMC91X_USE_DMA | SMC91X_NOWAIT,
arch/arm/mach-pxa/xcep.c: .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT | SMC91X_USE_DMA,
arch/arm/mach-realview/core.c: .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT,
arch/blackfin/mach-bf561/boards/cm_bf561.c: .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT,
arch/blackfin/mach-bf561/boards/ezkit.c: .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT,
Arnd
next prev parent reply other threads:[~2016-08-26 9:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-25 14:43 [PATCH] smc91x: remove ARM hack for unaligned 16-bit writes Arnd Bergmann
2016-08-25 14:45 ` Arnd Bergmann
2016-08-25 18:02 ` Robert Jarzmik
2016-08-25 22:37 ` Russell King - ARM Linux
2016-08-26 9:41 ` Arnd Bergmann [this message]
2016-08-26 9:56 ` Arnd Bergmann
2016-08-26 11:38 ` Russell King - ARM Linux
2016-08-26 12:29 ` Russell King - ARM Linux
2016-08-27 15:30 ` Robert Jarzmik
2016-08-27 15:38 ` Russell King - ARM Linux
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=1899384.M1jdqOztqi@wuerfel \
--to=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.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