* [PATCH 2/2] net: smc1111: add a quirk for pxa pxa27x platforms
2015-04-11 21:42 [PATCH 1/2] net: smc1111: fix platform data initializations Robert Jarzmik
@ 2015-04-11 21:42 ` Robert Jarzmik
2015-04-13 7:21 ` [PATCH 1/2] net: smc1111: fix platform data initializations Sascha Hauer
1 sibling, 0 replies; 4+ messages in thread
From: Robert Jarzmik @ 2015-04-11 21:42 UTC (permalink / raw)
To: barebox
As hinted in the linux kernel driver, pxa platforms such as mainstone,
stargate and idp have a broken design, where half-word writes not
aligned to a word address are not working.
This patch is a taking back the half-word write accessor for this
specific case from the linux kernel.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
drivers/net/smc91111.c | 31 +++++++++++++++++++++++++++++--
include/net/smc91111.h | 1 +
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
index bcb470c..c0cf42a 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,8 +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;
- pdata->config_setup = pdata->config_setup;
- pdata->control_setup = pdata->control_setup;
+ 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;
}
diff --git a/include/net/smc91111.h b/include/net/smc91111.h
index ba9da0b..72193bf 100644
--- a/include/net/smc91111.h
+++ b/include/net/smc91111.h
@@ -11,6 +11,7 @@ struct smc91c111_pdata {
int qemu_fixup;
int addr_shift;
int bus_width;
+ bool word_aligned_short_writes;
int config_setup;
int control_setup;
};
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] net: smc1111: fix platform data initializations
2015-04-11 21:42 [PATCH 1/2] net: smc1111: fix platform data initializations Robert Jarzmik
2015-04-11 21:42 ` [PATCH 2/2] net: smc1111: add a quirk for pxa pxa27x platforms Robert Jarzmik
@ 2015-04-13 7:21 ` Sascha Hauer
2015-04-13 17:53 ` Robert Jarzmik
1 sibling, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2015-04-13 7:21 UTC (permalink / raw)
To: Robert Jarzmik; +Cc: barebox
On Sat, Apr 11, 2015 at 11:42:41PM +0200, Robert Jarzmik wrote:
> The configuration and control setup introduced in commit "extend the
> driver for 91c94 and 91c96 support" suffers from a typo defect, which
> makes the commit broken.
>
> The typo happens to be in barebox tree, while it's not in the tested
> patches I had, and there was a mismatch in my former submission, which
> is fixed by this patch.
>
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
> ---
> drivers/net/smc91111.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
> index 698c74a..bcb470c 100644
> --- a/drivers/net/smc91111.c
> +++ b/drivers/net/smc91111.c
> @@ -1437,6 +1437,8 @@ static int smc91c111_probe(struct device_d *dev)
> priv->a = access_via_16bit;
> pdata->config_setup = pdata->config_setup;
> pdata->control_setup = pdata->control_setup;
> + priv->config_setup = pdata->config_setup;
> + priv->control_setup = pdata->control_setup;
This should be:
if (pdata->bus_width == 16)
priv->a = access_via_16bit;
- pdata->config_setup = pdata->config_setup;
- pdata->control_setup = pdata->control_setup;
+ priv->config_setup = pdata->config_setup;
+ priv->control_setup = pdata->control_setup;
}
Fixed this while applying because this is master material and I want to
make a release today.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread