mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] net: fec_imx: use dev_err and dev_warn instead of printf
@ 2013-02-21 16:13 Hubert Feurstein
  2013-02-21 16:13 ` [PATCH 2/2] net: fec_imx: ensure constant timeout in fec_halt Hubert Feurstein
  2013-02-22  8:24 ` [PATCH 1/2] net: fec_imx: use dev_err and dev_warn instead of printf Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Hubert Feurstein @ 2013-02-21 16:13 UTC (permalink / raw)
  To: barebox

Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
---
 drivers/net/fec_imx.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 2cf5008..44a3112 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -86,7 +86,7 @@ static int fec_miibus_read(struct mii_bus *bus, int phyAddr, int regAddr)
 	start = get_time_ns();
 	while (!(readl(fec->regs + FEC_IEVENT) & FEC_IEVENT_MII)) {
 		if (is_timeout(start, MSECOND)) {
-			printf("Read MDIO failed...\n");
+			dev_err(&fec->edev.dev, "Read MDIO failed...\n");
 			return -1;
 		}
 	}
@@ -126,7 +126,7 @@ static int fec_miibus_write(struct mii_bus *bus, int phyAddr,
 	start = get_time_ns();
 	while (!(readl(fec->regs + FEC_IEVENT) & FEC_IEVENT_MII)) {
 		if (is_timeout(start, MSECOND)) {
-			printf("Write MDIO failed...\n");
+			dev_err(&fec->edev.dev, "Write MDIO failed...\n");
 			return -1;
 		}
 	}
@@ -468,12 +468,12 @@ static int fec_send(struct eth_device *dev, void *eth_data, int data_length)
 
 	/* Check for valid length of data. */
 	if ((data_length > 1500) || (data_length <= 0)) {
-		printf("Payload (%d) to large!\n", data_length);
+		dev_err(&dev->dev, "Payload (%d) to large!\n", data_length);
 		return -1;
 	}
 
 	if ((uint32_t)eth_data & (DB_DATA_ALIGNMENT-1))
-		printf("%s: Warning: Transmit data not aligned: %p!\n", __FUNCTION__, eth_data);
+		dev_warn(&dev->dev, "Transmit data not aligned: %p!\n", eth_data);
 
 	/*
 	 * Setup the transmit buffer
@@ -506,7 +506,7 @@ static int fec_send(struct eth_device *dev, void *eth_data, int data_length)
 	tmo = get_time_ns();
 	while (readw(&fec->tbd_base[fec->tbd_index].status) & FEC_TBD_READY) {
 		if (is_timeout(tmo, 1 * SECOND)) {
-			printf("transmission timeout\n");
+			dev_err(&dev->dev, "transmission timeout\n");
 			break;
 		}
 	}
@@ -544,7 +544,7 @@ static int fec_recv(struct eth_device *dev)
 		/* BABT, Rx/Tx FIFO errors */
 		fec_halt(dev);
 		fec_init(dev);
-		printf("some error: 0x%08x\n", ievent);
+		dev_err(&dev->dev, "some error: 0x%08x\n", ievent);
 		return 0;
 	}
 	if (!fec_is_imx28(fec)) {
@@ -587,7 +587,7 @@ static int fec_recv(struct eth_device *dev)
 			len = frame_length;
 		} else {
 			if (bd_status & FEC_RBD_ERR) {
-				printf("error frame: 0x%p 0x%08x\n", rbd, bd_status);
+				dev_warn(&dev->dev, "error frame: 0x%p 0x%08x\n", rbd, bd_status);
 			}
 		}
 		/*
-- 
1.8.1.3


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

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

* [PATCH 2/2] net: fec_imx: ensure constant timeout in fec_halt
  2013-02-21 16:13 [PATCH 1/2] net: fec_imx: use dev_err and dev_warn instead of printf Hubert Feurstein
@ 2013-02-21 16:13 ` Hubert Feurstein
  2013-02-22  8:24 ` [PATCH 1/2] net: fec_imx: use dev_err and dev_warn instead of printf Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Hubert Feurstein @ 2013-02-21 16:13 UTC (permalink / raw)
  To: barebox

Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
---
 drivers/net/fec_imx.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 44a3112..14889d3 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -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)) {
+			dev_err(&dev->dev, "graceful stop timeout\n");
+			break;
+		}
+	}
 
 	/* Disable SmartDMA tasks */
 	fec_tx_task_disable(fec);
-- 
1.8.1.3


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

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

* Re: [PATCH 1/2] net: fec_imx: use dev_err and dev_warn instead of printf
  2013-02-21 16:13 [PATCH 1/2] net: fec_imx: use dev_err and dev_warn instead of printf Hubert Feurstein
  2013-02-21 16:13 ` [PATCH 2/2] net: fec_imx: ensure constant timeout in fec_halt Hubert Feurstein
@ 2013-02-22  8:24 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2013-02-22  8:24 UTC (permalink / raw)
  To: Hubert Feurstein; +Cc: barebox

On Thu, Feb 21, 2013 at 05:13:39PM +0100, Hubert Feurstein wrote:
> Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>

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

end of thread, other threads:[~2013-02-22  8:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-21 16:13 [PATCH 1/2] net: fec_imx: use dev_err and dev_warn instead of printf Hubert Feurstein
2013-02-21 16:13 ` [PATCH 2/2] net: fec_imx: ensure constant timeout in fec_halt Hubert Feurstein
2013-02-22  8:24 ` [PATCH 1/2] net: fec_imx: use dev_err and dev_warn instead of printf Sascha Hauer

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