Skip to contentSkip to conversation

net: fec_imx: ensure constant timeout in fec_halt

PATCH In review Hubert Feurstein 2 participants 4 messages Feb 21, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net: fec_imx: ensure constant timeout in fec_halt

---
 drivers/net/fec_imx.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/fec_imx.c +8 -3
index 2378a19..6dfb093 100644
@@ -425,15 +425,20 @@ static int fec_open(struct eth_device *edev)
 static void fec_halt(struct eth_device *dev)
 {
 	struct fec_priv *fec = (struct fec_priv *)dev->priv;
-	int counter = 0xffff;
+	uint64_t tmo;
 
 	/* issue graceful stop command to the FEC transmitter if necessary */
 	writel(readl(fec->regs + FEC_X_CNTRL) | FEC_ECNTRL_RESET,
 			fec->regs + FEC_X_CNTRL);
 
 	/* wait for graceful stop to register */
-	while ((counter--) && (!(readl(fec->regs + FEC_IEVENT) & FEC_IEVENT_GRA)))
-		;	/* FIXME ensure time */
+	tmo = get_time_ns();
+	while (!(readl(fec->regs + FEC_IEVENT) & FEC_IEVENT_GRA)) {
+		if (is_timeout(tmo, 1 * SECOND)) {
+			printf("graceful stop timeout\n");
+			break;
+		}
+	}
 
 	/* Disable SmartDMA tasks */
 	fec_tx_task_disable(fec);
Signature · 7 lines
1.8.1.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 2/2 net: imx_fec: fix RMII support for i.MX6

---
 drivers/net/fec_imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/fec_imx.c +1 -1
index 6dfb093..80fb2ce 100644
@@ -309,7 +309,7 @@ static int fec_init(struct eth_device *dev)
 	}
 
 	if (fec->xcv_type == RMII) {
-		if (fec_is_imx28(fec)) {
+		if (fec_is_imx28(fec) || fec_is_imx6(fec)) {
 			rcntl |= FEC_R_CNTRL_RMII_MODE | FEC_R_CNTRL_FCE |
 				FEC_R_CNTRL_NO_LGTH_CHECK;
 		} else {
Signature · 7 lines
1.8.1.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#3 lore raw
In reply to Hubert Feurstein
Quoted 17 lines · Hubert Feurstein
---
 drivers/net/fec_imx.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/fec_imx.c +1 -1
index 2378a19..6dfb093 100644
@@ -425,15 +425,20 @@ static int fec_open(struct eth_device *edev)
 static void fec_halt(struct eth_device *dev)
 {
 	struct fec_priv *fec = (struct fec_priv *)dev->priv;
-	int counter = 0xffff;
+	uint64_t tmo;
 
 	/* issue graceful stop command to the FEC transmitter if necessary */

drivers/net/fec_imx.c static int fec_open(struct eth_device *edev) · line 438

Quoted 10 lines
drivers/net/fec_imx.c +4 -2
 	writel(readl(fec->regs + FEC_X_CNTRL) | FEC_ECNTRL_RESET,
 			fec->regs + FEC_X_CNTRL);
 
 	/* wait for graceful stop to register */
-	while ((counter--) && (!(readl(fec->regs + FEC_IEVENT) & FEC_IEVENT_GRA)))
-		;	/* FIXME ensure time */
+	tmo = get_time_ns();
+	while (!(readl(fec->regs + FEC_IEVENT) & FEC_IEVENT_GRA)) {
+		if (is_timeout(tmo, 1 * SECOND)) {
+			printf("graceful stop timeout\n");

dev_err please.

Sascha

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer
#2 lore raw

Re: [PATCH 2/2] net: imx_fec: fix RMII support for i.MX6

In reply to Hubert Feurstein
Quoted 1 line · Hubert Feurstein

Applied (only this one)

Sascha

Quoted 26 lines
---
 drivers/net/fec_imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/fec_imx.c +1 -1
index 6dfb093..80fb2ce 100644
@@ -309,7 +309,7 @@ static int fec_init(struct eth_device *dev)
 	}
 
 	if (fec->xcv_type == RMII) {
-		if (fec_is_imx28(fec)) {
+		if (fec_is_imx28(fec) || fec_is_imx6(fec)) {
 			rcntl |= FEC_R_CNTRL_RMII_MODE | FEC_R_CNTRL_FCE |
 				FEC_R_CNTRL_NO_LGTH_CHECK;
 		} else {
Signature · 7 lines
1.8.1.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox