summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2016-03-22 15:37:36 +0100
committerDaniel Hellstrom <daniel@gaisler.com>2017-03-06 07:54:55 +0100
commit49cf776e7fca09e75ff3385989dc38067393899f (patch)
tree9872b568d73d6d3f6b89d1c3ab43a6774ab8bf2b
parentleon, grspw_pkt: added grspw_link_status_clr() to API (diff)
downloadrtems-49cf776e7fca09e75ff3385989dc38067393899f.tar.bz2
leon, grspw_pkt: added link_ctrl options
Improved the link error handling options. Its now possible to disable the link on individual link errors/warnings instead of always on all or none. Changed name of LINKOPTS_IRQ to LINKOPTS_EIRQ to match Linux and VxWorks SpW driver.
-rw-r--r--c/src/lib/libbsp/sparc/shared/include/grspw_pkt.h25
-rw-r--r--c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c17
2 files changed, 33 insertions, 9 deletions
diff --git a/c/src/lib/libbsp/sparc/shared/include/grspw_pkt.h b/c/src/lib/libbsp/sparc/shared/include/grspw_pkt.h
index f16ec20072..ea0ae9ae40 100644
--- a/c/src/lib/libbsp/sparc/shared/include/grspw_pkt.h
+++ b/c/src/lib/libbsp/sparc/shared/include/grspw_pkt.h
@@ -193,10 +193,29 @@ struct grspw_core_stats {
#define LINKOPTS_DISABLE 0x0001
#define LINKOPTS_START 0x0002
#define LINKOPTS_AUTOSTART 0x0004
-#define LINKOPTS_DIS_ONERR 0x0008
+#define LINKOPTS_DIS_ONERR 0x0008 /* Disable DMA transmitter on link error
+ * Controls LE bit in DMACTRL register.
+ */
+#define LINKOPTS_DIS_ON_CE 0x0020000/* Disable Link on Credit error */
+#define LINKOPTS_DIS_ON_ER 0x0040000/* Disable Link on Escape error */
+#define LINKOPTS_DIS_ON_DE 0x0080000/* Disable Link on Disconnect error */
+#define LINKOPTS_DIS_ON_PE 0x0100000/* Disable Link on Parity error */
+#define LINKOPTS_DIS_ON_WE 0x0400000/* Disable Link on write synchonization
+ * error (GRSPW1 only)
+ */
+#define LINKOPTS_DIS_ON_EE 0x1000000/* Disable Link on Early EOP/EEP error*/
+
/*#define LINKOPTS_TICK_OUT_IRQ 0x0100*//* Enable Tick-out IRQ */
-#define LINKOPTS_IRQ 0x0200 /* Enable Error Link IRQ */
-#define LINKOPTS_MASK 0x020f /* All above options */
+#define LINKOPTS_EIRQ 0x0200 /* Enable Error Link IRQ */
+
+#define LINKOPTS_MASK 0x15e020f/* All above options */
+#define LINKOPTS_MASK_DIS_ON 0x15e0000/* All disable link on error options
+ * On a certain error the link disable
+ * bit will be written and the work
+ * task will call dma_stop() for all
+ * channels.
+ */
+
/* grspw_tc_ctrl() options */
#define TCOPTS_EN_RXIRQ 0x0001 /* Tick-Out IRQ */
diff --git a/c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c b/c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c
index cee6dccd8b..1827fbd744 100644
--- a/c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c
+++ b/c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c
@@ -469,8 +469,8 @@ struct grspw_priv {
spwpkt_ic_isr_t icisr;
void *icisr_arg;
- /* Disable Link on SpW Link error */
- int dis_link_on_err;
+ /* Bit mask representing events which shall cause link disable. */
+ unsigned int dis_link_on_err;
/* "Core Global" Statistics gathered, not dependent on DMA channel */
struct grspw_core_stats stats;
@@ -772,10 +772,15 @@ void grspw_link_ctrl(void *d, int *options, int *clkdiv)
ctrl &= ~GRSPW_CTRL_IE;
REG_WRITE(&regs->ctrl, ctrl);
- priv->dis_link_on_err = (*options & LINKOPTS_DIS_ONERR) >> 3;
+ /* Store the link disable events for use in
+ ISR. The LINKOPTS_DIS_ON_* options are actually the
+ corresponding bits in the status register, shifted
+ by 16. */
+ priv->dis_link_on_err = *options &
+ (LINKOPTS_MASK_DIS_ON | LINKOPTS_DIS_ONERR);
}
SPIN_UNLOCK_IRQ(&priv->devlock, irqflags);
- *options = (ctrl & GRSPW_LINK_CFG)|(priv->dis_link_on_err << 3);
+ *options = (ctrl & GRSPW_LINK_CFG) | priv->dis_link_on_err;
}
}
@@ -2268,7 +2273,7 @@ int grspw_dma_start(void *c)
ctrl = GRSPW_DMACTRL_AI | GRSPW_DMACTRL_PS | GRSPW_DMACTRL_PR |
GRSPW_DMACTRL_TA | GRSPW_DMACTRL_RA | GRSPW_DMACTRL_RE |
(dma->cfg.flags & DMAFLAG_MASK) << GRSPW_DMACTRL_NS_BIT;
- if (dma->core->dis_link_on_err)
+ if (dma->core->dis_link_on_err & LINKOPTS_DIS_ONERR)
ctrl |= GRSPW_DMACTRL_LE;
if (dma->cfg.rx_irq_en_cnt != 0)
ctrl |= GRSPW_DMACTRL_RI;
@@ -2554,7 +2559,7 @@ STATIC void grspw_isr(void *data)
if (stat & GRSPW_STS_WE)
priv->stats.err_wsync++;
- if (priv->dis_link_on_err) {
+ if ((priv->dis_link_on_err >> 16) & stat) {
/* Disable the link, no more transfers are expected
* on any DMA channel.
*/