[PATCH 01/23] net: davinci-emac: fix buggy channel tear down

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Heinrich Toews <heinrich.toews@xxxxxxxx>

Druing a barebox_shutdown() already probed platform devices are being halted.
While trying to halt the davinci emac a channel tear down operation is triggered
which leads due to a missing DMA pointer configuration to a memory corruption
whithin the decompressed kernel memory. In this case the devices failed to boot
and are completely freezed.

In the davinci driver DMA initialisation is only done during the opening of the
device which is done only when the device is setup for communication.

The problem was solved by adding DMA init code to emacs_init() which is called
shortly after the probing of the device. In this case the tearing down of the
channels completes successfully.

Signed-off-by: Oleg Karfich <oleg.karfich@xxxxxxxx>
---
 drivers/net/davinci_emac.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 2fccd4681e..2f6091d155 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -173,6 +173,17 @@ static int davinci_emac_set_ethaddr(struct eth_device *edev, const unsigned char
 
 static int davinci_emac_init(struct eth_device *edev)
 {
+	struct davinci_emac_priv *priv = edev->priv;
+	uint32_t cnt;
+
+	/* Set DMA head and completion pointers to 0 */
+	for(cnt = 0; cnt < 8; cnt++) {
+		writel(0, (void *)priv->adap_emac + EMAC_TX0HDP + 4 * cnt);
+		writel(0, (void *)priv->adap_emac + EMAC_RX0HDP + 4 * cnt);
+		writel(0, (void *)priv->adap_emac + EMAC_TX0CP + 4 * cnt);
+		writel(0, (void *)priv->adap_emac + EMAC_RX0CP + 4 * cnt);
+	}
+
 	dev_dbg(&edev->dev, "* emac_init\n");
 	return 0;
 }
-- 
2.19.1


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



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux