mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] i.MX fec fixes
@ 2012-10-30 16:30 Sascha Hauer
  2012-10-30 16:30 ` [PATCH 1/2] net eth: make edev->init optional Sascha Hauer
  2012-10-30 16:30 ` [PATCH 2/2] net fec: call fec_init at probe time Sascha Hauer
  0 siblings, 2 replies; 5+ messages in thread
From: Sascha Hauer @ 2012-10-30 16:30 UTC (permalink / raw)
  To: barebox; +Cc: wsa

The i.MX fec driver is broken on some boards since the introduction
of phylib. This is not really a phylib problem, but the phylib triggered
it. Problem is that the fec mdio read depends on fec_init called during
eth_register time. The mdiobus though is accessed earlier, so a phy
cannot be detected.

Sascha

----------------------------------------------------------------
Sascha Hauer (2):
      net eth: make edev->init optional
      net fec: call fec_init at probe time

 drivers/net/fec_imx.c |    3 ++-
 net/eth.c             |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)


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

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

* [PATCH 1/2] net eth: make edev->init optional
  2012-10-30 16:30 [PATCH] i.MX fec fixes Sascha Hauer
@ 2012-10-30 16:30 ` Sascha Hauer
  2012-10-30 16:30 ` [PATCH 2/2] net fec: call fec_init at probe time Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2012-10-30 16:30 UTC (permalink / raw)
  To: barebox; +Cc: wsa

edev->init is called at eth_register time unconditionally and is supposed
to initialize the ethernet hardware. Since it's called unconditionally
this could be done by the driver without having an additional hook.
Some drivers need their initialization done earlier since they also register
a mdiobus which does hardware accesses on registration time.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 net/eth.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/eth.c b/net/eth.c
index f3d7bfe..2cfdb96 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -269,7 +269,8 @@ int eth_register(struct eth_device *edev)
 	dev_add_param(dev, "netmask", eth_set_ipaddr, NULL, 0);
 	dev_add_param(dev, "serverip", eth_set_ipaddr, NULL, 0);
 
-	edev->init(edev);
+	if (edev->init)
+		edev->init(edev);
 
 	list_add_tail(&edev->list, &netdev_list);
 
-- 
1.7.10.4


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

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

* [PATCH 2/2] net fec: call fec_init at probe time
  2012-10-30 16:30 [PATCH] i.MX fec fixes Sascha Hauer
  2012-10-30 16:30 ` [PATCH 1/2] net eth: make edev->init optional Sascha Hauer
@ 2012-10-30 16:30 ` Sascha Hauer
  2012-10-31  8:25   ` Wolfram Sang
  1 sibling, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2012-10-30 16:30 UTC (permalink / raw)
  To: barebox; +Cc: wsa

fec_init() initializes some bits important for phy access, so do
this before the mdiobus is registered. This fixes mdiobus support
on i.MX28 boards in RMII mode.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/fec_imx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index f6065aa..21ce38c 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -644,7 +644,6 @@ static int fec_probe(struct device_d *dev)
 	dev->priv = fec;
 	edev->priv = fec;
 	edev->open = fec_open;
-	edev->init = fec_init;
 	edev->send = fec_send;
 	edev->recv = fec_recv;
 	edev->halt = fec_halt;
@@ -685,6 +684,8 @@ static int fec_probe(struct device_d *dev)
 
 	fec->xcv_type = pdata->xcv_type;
 
+	fec_init(edev);
+
 	if (fec->xcv_type != SEVENWIRE) {
 		fec->phy_init = pdata->phy_init;
 		fec->miibus.read = fec_miibus_read;
-- 
1.7.10.4


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

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

* Re: [PATCH 2/2] net fec: call fec_init at probe time
  2012-10-30 16:30 ` [PATCH 2/2] net fec: call fec_init at probe time Sascha Hauer
@ 2012-10-31  8:25   ` Wolfram Sang
  2012-10-31 20:52     ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2012-10-31  8:25 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox


[-- Attachment #1.1: Type: text/plain, Size: 525 bytes --]

On Tue, Oct 30, 2012 at 05:30:06PM +0100, Sascha Hauer wrote:
> fec_init() initializes some bits important for phy access, so do
> this before the mdiobus is registered. This fixes mdiobus support
> on i.MX28 boards in RMII mode.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Extremly minor:

Reported-by: Wolfram Sang <w.sang@pengutronix.de>

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

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

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

* Re: [PATCH 2/2] net fec: call fec_init at probe time
  2012-10-31  8:25   ` Wolfram Sang
@ 2012-10-31 20:52     ` Sascha Hauer
  0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2012-10-31 20:52 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: barebox

On Wed, Oct 31, 2012 at 09:25:52AM +0100, Wolfram Sang wrote:
> On Tue, Oct 30, 2012 at 05:30:06PM +0100, Sascha Hauer wrote:
> > fec_init() initializes some bits important for phy access, so do
> > this before the mdiobus is registered. This fixes mdiobus support
> > on i.MX28 boards in RMII mode.
> > 
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> 
> Extremly minor:
> 
> Reported-by: Wolfram Sang <w.sang@pengutronix.de>

Added this while applying.

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

end of thread, other threads:[~2012-10-31 20:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-30 16:30 [PATCH] i.MX fec fixes Sascha Hauer
2012-10-30 16:30 ` [PATCH 1/2] net eth: make edev->init optional Sascha Hauer
2012-10-30 16:30 ` [PATCH 2/2] net fec: call fec_init at probe time Sascha Hauer
2012-10-31  8:25   ` Wolfram Sang
2012-10-31 20:52     ` Sascha Hauer

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