summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0553d53)
raw | patch | inline | side by side (parent: 0553d53)
author | Roger Quadros <rogerq@ti.com> | |
Mon, 8 Oct 2018 12:58:05 +0000 (15:58 +0300) | ||
committer | Sekhar Nori <nsekhar@ti.com> | |
Mon, 15 Oct 2018 12:33:09 +0000 (18:03 +0530) |
We need to check if firmware read the command by checking the
BUSY bit, before checking if the command is done (i.e. DONE bit).
Use the common icss_hs_send_cmd() helper to issue CANCEL command
so it goes through the proper done check.
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
BUSY bit, before checking if the command is done (i.e. DONE bit).
Use the common icss_hs_send_cmd() helper to issue CANCEL command
so it goes through the proper done check.
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
drivers/net/ethernet/ti/icssg_hs.c | patch | blob | history | |
drivers/net/ethernet/ti/icssg_prueth.c | patch | blob | history |
index 72ece926cec5fe78517d6f28646c423ba9a2336a..bea9e914e8eeb1c3e485987fb7aaa7d284bb4643 100644 (file)
for (i = 0; i < ilen; i++)
writel_relaxed(cpu_to_le32(idata[i]), vax + i * 4);
- cmd &= 0xfffffff;
+ cmd &= 0x1fffffff;
hs->cmd = cpu_to_le32(cmd);
memcpy_toio(va + offsetof(struct icss_hs, cmd),
&hs->cmd, sizeof(hs->cmd));
return 0;
}
-/* send a cancel a command to firmware */
-void icss_hs_cmd_cancel(struct prueth *prueth, int slice)
-{
- void __iomem *va;
- struct icss_hs *hs = &prueth->hs[slice];
-
- va = prueth->shram.va + slice * ICSS_HS_OFFSET_SLICE1;
-
- icss_hs_get(prueth, slice, hs);
- hs->cmd |= cpu_to_le32(ICSS_HS_CMD_CANCEL);
-
- memcpy_toio(va + offsetof(struct icss_hs, cmd),
- &hs->cmd, sizeof(hs->cmd));
-}
-
/* check if command done */
bool icss_hs_is_cmd_done(struct prueth *prueth, int slice)
{
struct icss_hs *hs = &prueth->hs[slice];
u32 cmd;
-
- icss_hs_get(prueth, slice, hs);
- cmd = le32_to_cpu(hs->cmd);
+ int trys;
+
+ for (trys = 1; trys < 3; trys++) {
+ icss_hs_get(prueth, slice, hs);
+ cmd = le32_to_cpu(hs->cmd);
+ if (cmd & ICSS_HS_CMD_DONE)
+ break;
+
+ /* If firmware didn't see the command yet, wait and retry */
+ if (!(cmd & ICSS_HS_CMD_BUSY)) {
+ dev_err(prueth->dev,
+ "slice %d fw didn't see cmd 0x%x, try: %d\n",
+ slice, cmd, trys);
+ }
+
+ udelay(5);
+ }
return !!(cmd & ICSS_HS_CMD_DONE);
}
index 32cf5f0d7cfcd94544e8d8894f4f5513c3ae3f55..88910933919d7819402ea1ccf06f8f85644e1b86 100644 (file)
prueth_tx_cleanup);
k3_nav_udmax_disable_tx_chn(emac->tx_chns.tx_chn);
- icss_hs_cmd_cancel(prueth, slice);
- if (!icss_hs_is_cmd_done(prueth, slice))
- netdev_err(ndev, "CANCEL failed\n");
+ ret = icss_hs_send_cmd(prueth, slice, ICSS_HS_CMD_CANCEL, 0, 0);
+ if (ret)
+ netdev_err(ndev, "CANCEL failed: %d\n", ret);
k3_nav_udmax_tdown_rx_chn(emac->rx_chns.rx_chn, true);
k3_nav_udmax_reset_rx_chn(emac->rx_chns.rx_chn, 0, emac,