diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-04-13 12:57:13 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-04-13 12:57:13 +0200 |
commit | a76a6bc8fd62bc26140d421d09e71624ee13aa47 (patch) | |
tree | 694f7cf71cf74397e48cd72a5060cd8c0c1e473f /drivers | |
parent | 9c4cf7d3b6b4ca24b3ebd6e003d3032a90af44b0 (diff) | |
parent | 5bd7c689a0723813cf7b1bc18db9e956b2d8c0d4 (diff) | |
download | barebox-a76a6bc8fd62bc26140d421d09e71624ee13aa47.tar.gz barebox-a76a6bc8fd62bc26140d421d09e71624ee13aa47.tar.xz |
Merge branch 'for-next/pxa'
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/smc91111.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c index 709a7402e4..c0cf42ad82 100644 --- a/drivers/net/smc91111.c +++ b/drivers/net/smc91111.c @@ -560,6 +560,20 @@ static inline void a32_insl(void __iomem *base, unsigned int offset, void *data, readsl(base + (offset << shift), data, count); } +static void a16_outw_algn4(unsigned value, void __iomem *base, + unsigned int offset, unsigned shift) +{ + u32 v; + + if ((offset << shift) & 2) { + v = value << 16; + v |= (a32_inl(base, offset & ~2, shift) & 0xffff); + a32_outl(v, base, offset & ~2, shift); + } else { + writew(value, base + (offset << shift)); + } +} + static const struct accessors access_via_16bit = { .ob = a8_outb, .ow = a16_outw, @@ -583,6 +597,18 @@ static const struct accessors access_via_32bit = { .isl = a32_insl, }; +/* access happens via a 32 bit bus, writes must by word aligned */ +static const struct accessors access_via_32bit_aligned_short_writes = { + .ob = a8_outb, + .ow = a16_outw_algn4, + .ol = a32_outl, + .osl = a32_outsl, + .ib = a8_inb, + .iw = a16_inw, + .il = a32_inl, + .isl = a32_insl, +}; + /* ------------------------------------------------------------------------ */ static unsigned last_bank; @@ -1435,6 +1461,9 @@ static int smc91c111_probe(struct device_d *dev) priv->shift = pdata->addr_shift; if (pdata->bus_width == 16) priv->a = access_via_16bit; + if (((pdata->bus_width == 0) || (pdata->bus_width == 32)) && + (pdata->word_aligned_short_writes)) + priv->a = access_via_32bit_aligned_short_writes; priv->config_setup = pdata->config_setup; priv->control_setup = pdata->control_setup; } |