[U-Boot] [PATCH 07/14] net: ti: icssg-prueth: Workaround to shutdown the prueth firmware

Keerthy j-keerthy at ti.com
Tue Aug 6 10:38:37 UTC 2019


Currently shutdown command is yet to be implemented. So work
around clearing the task manager of ICSSG.

Signed-off-by: Keerthy <j-keerthy at ti.com>
---
 drivers/net/ti/icssg-prueth.c |  8 ++++++++
 drivers/soc/ti/pruss.c        | 15 +++++++++++++++
 include/ti-pruss.h            |  1 +
 3 files changed, 24 insertions(+)

diff --git a/drivers/net/ti/icssg-prueth.c b/drivers/net/ti/icssg-prueth.c
index f8935ee087..980a1d9ee8 100644
--- a/drivers/net/ti/icssg-prueth.c
+++ b/drivers/net/ti/icssg-prueth.c
@@ -84,6 +84,7 @@ struct prueth {
 	struct regmap		*miig_rt;
 	fdt_addr_t		mdio_base;
 	phys_addr_t		pruss_shrdram2;
+	phys_addr_t		tmaddr;
 	struct mii_dev		*bus;
 	u32			port_id;
 	u32			sram_pa;
@@ -277,6 +278,9 @@ static void prueth_stop(struct udevice *dev)
 
 	dma_disable(&priv->dma_rx);
 	dma_free(&priv->dma_rx);
+
+	/* Workaround for shutdown command */
+	writel(0x0, priv->tmaddr + priv->slice * 0x200);
 }
 
 static const struct eth_ops prueth_ops = {
@@ -391,6 +395,10 @@ static int prueth_probe(struct udevice *dev)
 	if (ret)
 		return ret;
 
+	ret = pruss_request_tm_region(*prussdev, &prueth->tmaddr);
+	if (ret)
+		return ret;
+
 	node = dev_ofnode(dev);
 	eth0_node = ofnode_find_subnode(node, "ethernet-mii0");
 	eth1_node = ofnode_find_subnode(node, "ethernet-mii1");
diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index 03ddaaa539..0d53d0a26b 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -21,6 +21,8 @@
 #define PRUSS_CFG_IEPCLK	0x30
 #define ICSSG_CFG_CORE_SYNC	0x3c
 
+#define ICSSG_TASK_MGR_OFFSET	0x2a000
+
 /* PRUSS_IEPCLK register bits */
 #define PRUSS_IEPCLK_IEP_OCP_CLK_EN		BIT(0)
 
@@ -37,6 +39,19 @@ enum pruss_mem {
 	PRUSS_MEM_MAX,
 };
 
+int pruss_request_tm_region(struct udevice *dev, phys_addr_t *loc)
+{
+	struct pruss *priv;
+
+	priv = dev_get_priv(dev);
+	if (!priv || !priv->pruss_dram0)
+		return -EINVAL;
+
+	*loc = priv->pruss_dram0 + ICSSG_TASK_MGR_OFFSET;
+
+	return 0;
+}
+
 int pruss_request_shrmem_region(struct udevice *dev, phys_addr_t *loc)
 {
 	struct pruss *priv;
diff --git a/include/ti-pruss.h b/include/ti-pruss.h
index 547ec5ee33..9eadeef172 100644
--- a/include/ti-pruss.h
+++ b/include/ti-pruss.h
@@ -10,3 +10,4 @@ struct pruss {
 };
 
 int pruss_request_shrmem_region(struct udevice *dev, phys_addr_t *loc);
+int pruss_request_tm_region(struct udevice *dev, phys_addr_t *loc);
-- 
2.17.1



More information about the U-Boot mailing list