mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 1/3] net: smc1111: add 16 bits accessors, allow address shift
@ 2015-01-31 13:10 Robert Jarzmik
  2015-01-31 13:10 ` [PATCH v2 2/3] net: smc1111: extend the driver for 91c94 and 91c96 support Robert Jarzmik
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Robert Jarzmik @ 2015-01-31 13:10 UTC (permalink / raw)
  To: barebox

Smc network IPs can be wired up in different funny ways. For example the
lubbock pxa25x development platform wires all address lines shifted by
2, ie. bus A2 is smc91c96 A0, bus A3 is smc91c96 A1 etc ...

In order to cope with the different possible combination, add a shift
parameter for addresses.

By default, the old behaviour using the 32 bit accesses is kept.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/net/smc91111.c | 133 ++++++++++++++++++++++++++++++++-----------------
 include/net/smc91111.h |  14 ++++++
 2 files changed, 100 insertions(+), 47 deletions(-)

diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
index 100688c..f6d0aed 100644
--- a/drivers/net/smc91111.c
+++ b/drivers/net/smc91111.c
@@ -434,22 +434,12 @@
 */
 #define MEMORY_WAIT_TIME 16
 
-struct accessors {
-	void (*ob)(unsigned, void __iomem *);
-	void (*ow)(unsigned, void __iomem *);
-	void (*ol)(unsigned long, void __iomem *);
-	void (*osl)(void __iomem *, const void  *, int);
-	unsigned (*ib)(void __iomem *);
-	unsigned (*iw)(void __iomem *);
-	unsigned long (*il)(void __iomem *);
-	void (*isl)(void __iomem *, void*, int);
-};
-
 struct smc91c111_priv {
 	struct mii_bus miibus;
-	struct accessors a;
+	struct smc91111_accessors a;
 	void __iomem *base;
 	int qemu_fixup;
+	unsigned shift;
 };
 
 #if (SMC_DEBUG > 2 )
@@ -479,56 +469,103 @@ struct smc91c111_priv {
 
 #define ETH_ZLEN 60
 
-static void a_outb(unsigned value, void __iomem *offset)
+static void a8_outb(unsigned value, void __iomem *base, unsigned int offset,
+		    unsigned shift)
 {
-	writeb(value, offset);
+	writeb(value, base + (offset << shift));
 }
 
-static void a_outw(unsigned value, void __iomem *offset)
+static void a16_outw(unsigned value, void __iomem *base, unsigned int offset,
+		     unsigned shift)
 {
-	writew(value, offset);
+	writew(value, base + (offset << shift));
 }
 
-static void a_outl(unsigned long value, void __iomem *offset)
+static void a32_outl(unsigned long value, void __iomem *base,
+		     unsigned int offset, unsigned shift)
 {
-	writel(value, offset);
+	writel(value, base + (offset << shift));
 }
 
-static void a_outsl(void __iomem *offset, const void *data, int count)
+static void a16_outsl(void __iomem *base, unsigned int offset,
+		      const void *data, int count, unsigned shift)
 {
-	writesl(offset, data, count);
+	writesw(base + (offset << shift), data, count * 2);
 }
 
-static unsigned a_inb(void __iomem *offset)
+static void a16_outl(unsigned long value, void __iomem *base,
+		     unsigned int offset, unsigned shift)
 {
-	return readb(offset);
+	writew(value & 0xffff, base + (offset << shift));
+	writew(value >> 16, base + ((offset + 2) << shift));
 }
 
-static unsigned a_inw(void __iomem *offset)
+static void a32_outsl(void __iomem *base, unsigned int offset,
+		      const void *data, int count, unsigned shift)
 {
-	return readw(offset);
+	writesw(base + (offset << shift), data, count * 2);
 }
 
-static unsigned long a_inl(void __iomem *offset)
+static unsigned a8_inb(void __iomem *base, unsigned int offset, unsigned shift)
 {
-	return readl(offset);
+	return readb(base + (offset << shift));
 }
 
-static inline void a_insl(void __iomem *offset, void *data, int count)
+static unsigned a16_inw(void __iomem *base, unsigned int offset, unsigned shift)
 {
-	readsl(offset, data, count);
+	return readw(base + (offset << shift));
 }
 
+static unsigned long a16_inl(void __iomem *base, unsigned int offset,
+			     unsigned shift)
+{
+	u32 value;
+
+	value = readw(base + (offset << shift));
+	value |= readw(base + (offset << shift)) << 16;
+
+	return value;
+}
+
+static inline void a16_insl(void __iomem *base, unsigned int offset, void *data,
+			    int count, unsigned shift)
+{
+	readsw(base + (offset << shift), data, count * 2);
+}
+
+static unsigned long a32_inl(void __iomem *base, unsigned int offset,
+			     unsigned shift)
+{
+	return readl(base + (offset << shift));
+}
+
+static inline void a32_insl(void __iomem *base, unsigned int offset, void *data,
+			    int count, unsigned shift)
+{
+	readsl(base + (offset << shift), data, count);
+}
+
+static const struct smc91111_accessors access_via_16bit = {
+	.ob = a8_outb,
+	.ow = a16_outw,
+	.ol = a16_outl,
+	.osl = a16_outsl,
+	.ib = a8_inb,
+	.iw = a16_inw,
+	.il = a16_inl,
+	.isl = a16_insl,
+};
+
 /* access happens via a 32 bit bus */
-static const struct accessors access_via_32bit = {
-	.ob = a_outb,
-	.ow = a_outw,
-	.ol = a_outl,
-	.osl = a_outsl,
-	.ib = a_inb,
-	.iw = a_inw,
-	.il = a_inl,
-	.isl = a_insl,
+static const struct smc91111_accessors access_via_32bit = {
+	.ob = a8_outb,
+	.ow = a16_outw,
+	.ol = a32_outl,
+	.osl = a32_outsl,
+	.ib = a8_inb,
+	.iw = a16_inw,
+	.il = a32_inl,
+	.isl = a32_insl,
 };
 
 /* ------------------------------------------------------------------------ */
@@ -536,46 +573,46 @@ static const struct accessors access_via_32bit = {
 static inline void SMC_outb(struct smc91c111_priv *p, unsigned value,
 				unsigned offset)
 {
-	(p->a.ob)(value, p->base + offset);
+	(p->a.ob)(value, p->base, offset, p->shift);
 }
 
 static inline void SMC_outw(struct smc91c111_priv *p, unsigned value,
 				unsigned offset)
 {
-	(p->a.ow)(value, p->base + offset);
+	(p->a.ow)(value, p->base, offset, p->shift);
 }
 
 static inline void SMC_outl(struct smc91c111_priv *p, unsigned long value,
 				unsigned offset)
 {
-	(p->a.ol)(value, p->base + offset);
+	(p->a.ol)(value, p->base, offset, p->shift);
 }
 
 static inline void SMC_outsl(struct smc91c111_priv *p, unsigned offset,
 				const void *data, int count)
 {
-	(p->a.osl)(p->base + offset, data, count);
+	(p->a.osl)(p->base, offset, data, count, p->shift);
 }
 
 static inline unsigned SMC_inb(struct smc91c111_priv *p, unsigned offset)
 {
-	return (p->a.ib)(p->base + offset);
+	return (p->a.ib)(p->base, offset, p->shift);
 }
 
 static inline unsigned SMC_inw(struct smc91c111_priv *p, unsigned offset)
 {
-	return (p->a.iw)(p->base + offset);
+	return (p->a.iw)(p->base, offset, p->shift);
 }
 
 static inline unsigned long SMC_inl(struct smc91c111_priv *p, unsigned offset)
 {
-	return (p->a.il)(p->base + offset);
+	return (p->a.il)(p->base, offset, p->shift);
 }
 
 static inline void SMC_insl(struct smc91c111_priv *p, unsigned offset,
 				void *data, int count)
 {
-	(p->a.isl)(p->base + offset, data, count);
+	(p->a.isl)(p->base, offset, data, count, p->shift);
 }
 
 static inline void SMC_SELECT_BANK(struct smc91c111_priv *p, int bank)
@@ -1333,15 +1370,17 @@ static int smc91c111_probe(struct device_d *dev)
 	edev->priv = (struct smc91c111_priv *)(edev + 1);
 
 	priv = edev->priv;
+	priv->a = access_via_32bit;
 
 	if (dev->platform_data) {
 		struct smc91c111_pdata *pdata = dev->platform_data;
 
 		priv->qemu_fixup = pdata->qemu_fixup;
+		priv->shift = pdata->addr_shift;
+		if (pdata->bus_width == 16)
+			priv->a = access_via_16bit;
 	}
 
-	priv->a = access_via_32bit;
-
 	edev->init = smc91c111_init_dev;
 	edev->open = smc91c111_eth_open;
 	edev->send = smc91c111_eth_send;
diff --git a/include/net/smc91111.h b/include/net/smc91111.h
index 0b2d49b..fa904ea 100644
--- a/include/net/smc91111.h
+++ b/include/net/smc91111.h
@@ -7,8 +7,22 @@
 #ifndef __SMC91111_H__
 #define __SMC91111_H__
 
+struct smc91111_accessors {
+	void (*ob)(unsigned, void __iomem *, unsigned, unsigned);
+	void (*ow)(unsigned, void __iomem *, unsigned, unsigned);
+	void (*ol)(unsigned long, void __iomem *, unsigned, unsigned);
+	void (*osl)(void __iomem *, unsigned, const void  *, int, unsigned);
+	unsigned (*ib)(void __iomem *, unsigned, unsigned);
+	unsigned (*iw)(void __iomem *, unsigned, unsigned);
+	unsigned long (*il)(void __iomem *, unsigned, unsigned);
+	void (*isl)(void __iomem *, unsigned, void*, int, unsigned);
+	void *private;
+};
+
 struct smc91c111_pdata {
 	int qemu_fixup;
+	int addr_shift;
+	int bus_width;
 };
 
 #endif /* __SMC91111_H__ */
-- 
2.1.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 2/3] net: smc1111: extend the driver for 91c94 and 91c96 support
  2015-01-31 13:10 [PATCH v2 1/3] net: smc1111: add 16 bits accessors, allow address shift Robert Jarzmik
@ 2015-01-31 13:10 ` Robert Jarzmik
  2015-01-31 13:10 ` [PATCH v2 3/3] net: smc1111: improve debug capability Robert Jarzmik
  2015-02-02  9:17 ` [PATCH v2 1/3] net: smc1111: add 16 bits accessors, allow address shift Sascha Hauer
  2 siblings, 0 replies; 8+ messages in thread
From: Robert Jarzmik @ 2015-01-31 13:10 UTC (permalink / raw)
  To: barebox

All the smcs family chips 91c94, 91c96, 91c100, 91c111 share almost the
same behavior and register sets. The noticeable exceptions are coped
with in this patch, ie :
 - 91c94 and 91c96 only have an internal 10 Mbps phy
   The registers used for phy discovery on later chips will corrupt the
   91c96 state.
 - 91c94 and 91c96 have a control and config register quite different
   from their 91c1xx conterparts
   A platform data user defined couple of registers is introduced. If
   these values are 0, 91c1xx legacy behavior is assumed.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/net/smc91111.c | 38 +++++++++++++++++++++++++++++++++-----
 include/net/smc91111.h |  2 ++
 2 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
index f6d0aed..ef7c0dc 100644
--- a/drivers/net/smc91111.c
+++ b/drivers/net/smc91111.c
@@ -440,6 +440,10 @@ struct smc91c111_priv {
 	void __iomem *base;
 	int qemu_fixup;
 	unsigned shift;
+	int version;
+	int revision;
+	unsigned int control_setup;
+	unsigned int config_setup;
 };
 
 #if (SMC_DEBUG > 2 )
@@ -900,6 +904,7 @@ static int smc91c111_phy_read(struct mii_bus *bus, int phyaddr, int phyreg)
 static void smc91c111_reset(struct eth_device *edev)
 {
 	struct smc91c111_priv *priv = (struct smc91c111_priv *)edev->priv;
+	int rev_vers;
 
 	/* This resets the registers mostly to defaults, but doesn't
 	   affect EEPROM.  That seems unnecessary */
@@ -915,8 +920,11 @@ static void smc91c111_reset(struct eth_device *edev)
 
 	/* Release from possible power-down state */
 	/* Configuration register is not affected by Soft Reset */
-	SMC_outw(priv, SMC_inw(priv, CONFIG_REG) | CONFIG_EPH_POWER_EN,
-			CONFIG_REG);
+	if (priv->config_setup)
+		SMC_outw(priv, priv->config_setup, CONFIG_REG);
+	else
+		SMC_outw(priv, SMC_inw(priv, CONFIG_REG) | CONFIG_EPH_POWER_EN,
+			 CONFIG_REG);
 
 	SMC_SELECT_BANK(priv, 0);
 
@@ -929,7 +937,10 @@ static void smc91c111_reset(struct eth_device *edev)
 
 	/* set the control register */
 	SMC_SELECT_BANK(priv, 1);
-	SMC_outw(priv, CTL_DEFAULT, CTL_REG);
+	if (priv->control_setup)
+		SMC_outw(priv, priv->control_setup, CTL_REG);
+	else
+		SMC_outw(priv, CTL_DEFAULT, CTL_REG);
 
 	/* Reset the MMU */
 	SMC_SELECT_BANK(priv, 2);
@@ -945,6 +956,14 @@ static void smc91c111_reset(struct eth_device *edev)
 
 	/* Disable all interrupts */
 	SMC_outb(priv, 0, IM_REG);
+
+	/* Check chip revision (91c94, 91c96, 91c100, ...) */
+	SMC_SELECT_BANK(priv, 3);
+	rev_vers = SMC_inb(priv, REV_REG);
+	priv->revision = (rev_vers >> 4) & 0xf;
+	priv->version = rev_vers & 0xf;
+	dev_info(edev->parent, "chip is revision=%2d, version=%2d\n",
+		 priv->revision, priv->version);
 }
 
 static void smc91c111_enable(struct eth_device *edev)
@@ -964,10 +983,16 @@ static int smc91c111_eth_open(struct eth_device *edev)
 
 	/* Configure the Receive/Phy Control register */
 	SMC_SELECT_BANK(priv, 0);
-	SMC_outw(priv, RPC_DEFAULT, RPC_REG);
+	if (priv->revision > 4)
+		SMC_outw(priv, RPC_DEFAULT, RPC_REG);
 
 	smc91c111_enable(edev);
 
+	if (priv->revision <= 4) {
+		dev_info(edev->parent, "force link at 10Mpbs on internal phy\n");
+		return 0;
+	}
+
 	ret = phy_device_connect(edev, &priv->miibus, 0, NULL,
 				 0, PHY_INTERFACE_MODE_NA);
 
@@ -1379,6 +1404,8 @@ 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;
 	}
 
 	edev->init = smc91c111_init_dev;
@@ -1400,7 +1427,8 @@ static int smc91c111_probe(struct device_d *dev)
 
 	smc91c111_reset(edev);
 
-	mdiobus_register(&priv->miibus);
+	if (priv->revision > 4)
+		mdiobus_register(&priv->miibus);
 	eth_register(edev);
 
 	return 0;
diff --git a/include/net/smc91111.h b/include/net/smc91111.h
index fa904ea..0ed65e7 100644
--- a/include/net/smc91111.h
+++ b/include/net/smc91111.h
@@ -23,6 +23,8 @@ struct smc91c111_pdata {
 	int qemu_fixup;
 	int addr_shift;
 	int bus_width;
+	int config_setup;
+	int control_setup;
 };
 
 #endif /* __SMC91111_H__ */
-- 
2.1.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 3/3] net: smc1111: improve debug capability
  2015-01-31 13:10 [PATCH v2 1/3] net: smc1111: add 16 bits accessors, allow address shift Robert Jarzmik
  2015-01-31 13:10 ` [PATCH v2 2/3] net: smc1111: extend the driver for 91c94 and 91c96 support Robert Jarzmik
@ 2015-01-31 13:10 ` Robert Jarzmik
  2015-02-02  9:17 ` [PATCH v2 1/3] net: smc1111: add 16 bits accessors, allow address shift Sascha Hauer
  2 siblings, 0 replies; 8+ messages in thread
From: Robert Jarzmik @ 2015-01-31 13:10 UTC (permalink / raw)
  To: barebox

Improve smc1111 driver debug messages by printing the register accessed,
the current bank, and the values.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/net/smc91111.c | 118 +++++++++++++++++++++++++++++--------------------
 1 file changed, 69 insertions(+), 49 deletions(-)

diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
index ef7c0dc..79a094d 100644
--- a/drivers/net/smc91111.c
+++ b/drivers/net/smc91111.c
@@ -574,55 +574,75 @@ static const struct smc91111_accessors access_via_32bit = {
 
 /* ------------------------------------------------------------------------ */
 
-static inline void SMC_outb(struct smc91c111_priv *p, unsigned value,
-				unsigned offset)
-{
-	(p->a.ob)(value, p->base, offset, p->shift);
-}
-
-static inline void SMC_outw(struct smc91c111_priv *p, unsigned value,
-				unsigned offset)
-{
-	(p->a.ow)(value, p->base, offset, p->shift);
-}
-
-static inline void SMC_outl(struct smc91c111_priv *p, unsigned long value,
-				unsigned offset)
-{
-	(p->a.ol)(value, p->base, offset, p->shift);
-}
-
-static inline void SMC_outsl(struct smc91c111_priv *p, unsigned offset,
-				const void *data, int count)
-{
-	(p->a.osl)(p->base, offset, data, count, p->shift);
-}
-
-static inline unsigned SMC_inb(struct smc91c111_priv *p, unsigned offset)
-{
-	return (p->a.ib)(p->base, offset, p->shift);
-}
-
-static inline unsigned SMC_inw(struct smc91c111_priv *p, unsigned offset)
-{
-	return (p->a.iw)(p->base, offset, p->shift);
-}
-
-static inline unsigned long SMC_inl(struct smc91c111_priv *p, unsigned offset)
-{
-	return (p->a.il)(p->base, offset, p->shift);
-}
-
-static inline void SMC_insl(struct smc91c111_priv *p, unsigned offset,
-				void *data, int count)
-{
-	(p->a.isl)(p->base, offset, data, count, p->shift);
-}
-
-static inline void SMC_SELECT_BANK(struct smc91c111_priv *p, int bank)
-{
-	SMC_outw(p, bank, BANK_SELECT);
-}
+static unsigned last_bank;
+#define SMC_outb(p, value, offset) \
+	do {								\
+		PRINTK3("\t%s:%d outb: %s[%1d:0x%04x] = 0x%02x\n",	\
+			__func__, __LINE__, #offset, last_bank,		\
+			(offset), (value));				\
+		((p)->a.ob)((value), (p)->base, (offset), (p)->shift);	\
+	} while (0)
+
+#define SMC_outw(p, value, offset)					\
+	do {								\
+		PRINTK3("\t%s:%d outw: %s[%1d:0x%04x] = 0x%04x\n",	\
+			__func__, __LINE__, #offset, last_bank,		\
+			(offset), (value));				\
+		((p)->a.ow)((value), (p)->base, (offset), (p)->shift);	\
+	} while (0)
+
+#define SMC_outl(p, value, offset)					\
+	do {								\
+		PRINTK3("\t%s:%d outl: %s[%1d:0x%04x] = 0x%08lx\n",	\
+			__func__, __LINE__, #offset, last_bank,		\
+			(offset), (unsigned long)(value));		\
+		((p)->a.ol)((value), (p)->base, (offset), (p)->shift);	\
+	} while (0)
+
+#define SMC_outsl(p, offset, data, count)\
+	do {								\
+		PRINTK3("\t%s:%d outsl: %5d@%p -> [%1d:0x%04x]\n",	\
+			__func__, __LINE__, (count) * 4, data,		\
+			last_bank, (offset));				\
+		((p)->a.osl)((p)->base, (offset), data, (count),	\
+			     (p)->shift);				\
+	} while (0)
+
+#define SMC_inb(p, offset)						\
+	({								\
+		unsigned _v = ((p)->a.ib)((p)->base, (offset),		\
+					  (p)->shift);			\
+		PRINTK3("\t%s:%d inb: %s[%1d:0x%04x] -> 0x%02x\n",	\
+			__func__, __LINE__, #offset, last_bank,		\
+			(offset), _v);					\
+		_v; })
+
+#define SMC_inw(p, offset)						\
+	({								\
+		unsigned _v = ((p)->a.iw)((p)->base, (offset),		\
+					  (p)->shift);			\
+		PRINTK3("\t%s:%d inw: %s[%1d:0x%04x] -> 0x%04x\n",	\
+			__func__, __LINE__, #offset, last_bank,		\
+			(offset), _v);					\
+		_v; })
+
+#define SMC_inl(p, offset)						\
+	({								\
+		unsigned long _v = ((p)->a.il)((p)->base, (offset),	\
+			(p)->shift);					\
+		PRINTK3("\t%s:%d inl: %s[%1d:0x%04x] -> 0x%08lx\n",	\
+			__func__, __LINE__, #offset, last_bank,		\
+			(offset), _v);					\
+		_v; })
+
+#define SMC_insl(p, offset, data, count)				\
+	((p)->a.isl)((p)->base, (offset), data, (count), (p)->shift)
+
+#define SMC_SELECT_BANK(p, bank)			\
+	do {						\
+		SMC_outw(p, bank & 0xf, BANK_SELECT);	\
+		last_bank = bank & 0xf;			\
+	} while (0)
 
 #if SMC_DEBUG > 2
 static void print_packet( unsigned char * buf, int length )
-- 
2.1.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/3] net: smc1111: add 16 bits accessors, allow address shift
  2015-01-31 13:10 [PATCH v2 1/3] net: smc1111: add 16 bits accessors, allow address shift Robert Jarzmik
  2015-01-31 13:10 ` [PATCH v2 2/3] net: smc1111: extend the driver for 91c94 and 91c96 support Robert Jarzmik
  2015-01-31 13:10 ` [PATCH v2 3/3] net: smc1111: improve debug capability Robert Jarzmik
@ 2015-02-02  9:17 ` Sascha Hauer
  2015-02-02 18:56   ` Robert Jarzmik
  2 siblings, 1 reply; 8+ messages in thread
From: Sascha Hauer @ 2015-02-02  9:17 UTC (permalink / raw)
  To: Robert Jarzmik; +Cc: barebox

On Sat, Jan 31, 2015 at 02:10:08PM +0100, Robert Jarzmik wrote:
> Smc network IPs can be wired up in different funny ways. For example the
> lubbock pxa25x development platform wires all address lines shifted by
> 2, ie. bus A2 is smc91c96 A0, bus A3 is smc91c96 A1 etc ...
> 
> In order to cope with the different possible combination, add a shift
> parameter for addresses.
> 
> By default, the old behaviour using the 32 bit accesses is kept.
> 
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>

Applied all, thanks

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] 8+ messages in thread

* Re: [PATCH v2 1/3] net: smc1111: add 16 bits accessors, allow address shift
  2015-02-02  9:17 ` [PATCH v2 1/3] net: smc1111: add 16 bits accessors, allow address shift Sascha Hauer
@ 2015-02-02 18:56   ` Robert Jarzmik
  2015-02-03  8:35     ` Sascha Hauer
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Jarzmik @ 2015-02-02 18:56 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Sascha Hauer <s.hauer@pengutronix.de> writes:

> Applied all, thanks
>
> Sascha
Thanks Sascha,

I noticed that in my patchset I moved the "struct smc91111_accessors {...}" from
smc9111.c to include/net/smc91111.h.

This was when I thought the accessors would be settable from platform code. Do
you want me to send an incremental patch to reverse this ?

Cheers.

-- 
Robert

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/3] net: smc1111: add 16 bits accessors, allow address shift
  2015-02-02 18:56   ` Robert Jarzmik
@ 2015-02-03  8:35     ` Sascha Hauer
  2015-02-03 19:25       ` [PATCH] fixup! " Robert Jarzmik
  0 siblings, 1 reply; 8+ messages in thread
From: Sascha Hauer @ 2015-02-03  8:35 UTC (permalink / raw)
  To: Robert Jarzmik; +Cc: barebox

On Mon, Feb 02, 2015 at 07:56:33PM +0100, Robert Jarzmik wrote:
> Sascha Hauer <s.hauer@pengutronix.de> writes:
> 
> > Applied all, thanks
> >
> > Sascha
> Thanks Sascha,
> 
> I noticed that in my patchset I moved the "struct smc91111_accessors {...}" from
> smc9111.c to include/net/smc91111.h.
> 
> This was when I thought the accessors would be settable from platform code. Do
> you want me to send an incremental patch to reverse this ?

That would be great, yes. You can commit the patch with --fixup=commitish
which makes it easy for me to fixup the correct patch.

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] 8+ messages in thread

* [PATCH] fixup! net: smc1111: add 16 bits accessors, allow address shift
  2015-02-03  8:35     ` Sascha Hauer
@ 2015-02-03 19:25       ` Robert Jarzmik
  2015-02-04 11:53         ` Sascha Hauer
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Jarzmik @ 2015-02-03 19:25 UTC (permalink / raw)
  To: barebox

---
 drivers/net/smc91111.c | 17 ++++++++++++++---
 include/net/smc91111.h | 12 ------------
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
index 79a094d..698c74a 100644
--- a/drivers/net/smc91111.c
+++ b/drivers/net/smc91111.c
@@ -434,9 +434,20 @@
 */
 #define MEMORY_WAIT_TIME 16
 
+struct accessors {
+	void (*ob)(unsigned, void __iomem *, unsigned, unsigned);
+	void (*ow)(unsigned, void __iomem *, unsigned, unsigned);
+	void (*ol)(unsigned long, void __iomem *, unsigned, unsigned);
+	void (*osl)(void __iomem *, unsigned, const void  *, int, unsigned);
+	unsigned (*ib)(void __iomem *, unsigned, unsigned);
+	unsigned (*iw)(void __iomem *, unsigned, unsigned);
+	unsigned long (*il)(void __iomem *, unsigned, unsigned);
+	void (*isl)(void __iomem *, unsigned, void*, int, unsigned);
+};
+
 struct smc91c111_priv {
 	struct mii_bus miibus;
-	struct smc91111_accessors a;
+	struct accessors a;
 	void __iomem *base;
 	int qemu_fixup;
 	unsigned shift;
@@ -549,7 +560,7 @@ static inline void a32_insl(void __iomem *base, unsigned int offset, void *data,
 	readsl(base + (offset << shift), data, count);
 }
 
-static const struct smc91111_accessors access_via_16bit = {
+static const struct accessors access_via_16bit = {
 	.ob = a8_outb,
 	.ow = a16_outw,
 	.ol = a16_outl,
@@ -561,7 +572,7 @@ static const struct smc91111_accessors access_via_16bit = {
 };
 
 /* access happens via a 32 bit bus */
-static const struct smc91111_accessors access_via_32bit = {
+static const struct accessors access_via_32bit = {
 	.ob = a8_outb,
 	.ow = a16_outw,
 	.ol = a32_outl,
diff --git a/include/net/smc91111.h b/include/net/smc91111.h
index 0ed65e7..ba9da0b 100644
--- a/include/net/smc91111.h
+++ b/include/net/smc91111.h
@@ -7,18 +7,6 @@
 #ifndef __SMC91111_H__
 #define __SMC91111_H__
 
-struct smc91111_accessors {
-	void (*ob)(unsigned, void __iomem *, unsigned, unsigned);
-	void (*ow)(unsigned, void __iomem *, unsigned, unsigned);
-	void (*ol)(unsigned long, void __iomem *, unsigned, unsigned);
-	void (*osl)(void __iomem *, unsigned, const void  *, int, unsigned);
-	unsigned (*ib)(void __iomem *, unsigned, unsigned);
-	unsigned (*iw)(void __iomem *, unsigned, unsigned);
-	unsigned long (*il)(void __iomem *, unsigned, unsigned);
-	void (*isl)(void __iomem *, unsigned, void*, int, unsigned);
-	void *private;
-};
-
 struct smc91c111_pdata {
 	int qemu_fixup;
 	int addr_shift;
-- 
2.1.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] fixup! net: smc1111: add 16 bits accessors, allow address shift
  2015-02-03 19:25       ` [PATCH] fixup! " Robert Jarzmik
@ 2015-02-04 11:53         ` Sascha Hauer
  0 siblings, 0 replies; 8+ messages in thread
From: Sascha Hauer @ 2015-02-04 11:53 UTC (permalink / raw)
  To: Robert Jarzmik; +Cc: barebox

On Tue, Feb 03, 2015 at 08:25:50PM +0100, Robert Jarzmik wrote:
> ---
>  drivers/net/smc91111.c | 17 ++++++++++++++---
>  include/net/smc91111.h | 12 ------------
>  2 files changed, 14 insertions(+), 15 deletions(-)

Applied, thanks

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] 8+ messages in thread

end of thread, other threads:[~2015-02-04 11:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-31 13:10 [PATCH v2 1/3] net: smc1111: add 16 bits accessors, allow address shift Robert Jarzmik
2015-01-31 13:10 ` [PATCH v2 2/3] net: smc1111: extend the driver for 91c94 and 91c96 support Robert Jarzmik
2015-01-31 13:10 ` [PATCH v2 3/3] net: smc1111: improve debug capability Robert Jarzmik
2015-02-02  9:17 ` [PATCH v2 1/3] net: smc1111: add 16 bits accessors, allow address shift Sascha Hauer
2015-02-02 18:56   ` Robert Jarzmik
2015-02-03  8:35     ` Sascha Hauer
2015-02-03 19:25       ` [PATCH] fixup! " Robert Jarzmik
2015-02-04 11:53         ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox