forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -193,10 +193,29 @@ struct grspw_core_stats {
|
|||||||
#define LINKOPTS_DISABLE 0x0001
|
#define LINKOPTS_DISABLE 0x0001
|
||||||
#define LINKOPTS_START 0x0002
|
#define LINKOPTS_START 0x0002
|
||||||
#define LINKOPTS_AUTOSTART 0x0004
|
#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_TICK_OUT_IRQ 0x0100*//* Enable Tick-out IRQ */
|
||||||
#define LINKOPTS_IRQ 0x0200 /* Enable Error Link IRQ */
|
#define LINKOPTS_EIRQ 0x0200 /* Enable Error Link IRQ */
|
||||||
#define LINKOPTS_MASK 0x020f /* All above options */
|
|
||||||
|
#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 */
|
/* grspw_tc_ctrl() options */
|
||||||
#define TCOPTS_EN_RXIRQ 0x0001 /* Tick-Out IRQ */
|
#define TCOPTS_EN_RXIRQ 0x0001 /* Tick-Out IRQ */
|
||||||
|
|||||||
@@ -469,8 +469,8 @@ struct grspw_priv {
|
|||||||
spwpkt_ic_isr_t icisr;
|
spwpkt_ic_isr_t icisr;
|
||||||
void *icisr_arg;
|
void *icisr_arg;
|
||||||
|
|
||||||
/* Disable Link on SpW Link error */
|
/* Bit mask representing events which shall cause link disable. */
|
||||||
int dis_link_on_err;
|
unsigned int dis_link_on_err;
|
||||||
|
|
||||||
/* "Core Global" Statistics gathered, not dependent on DMA channel */
|
/* "Core Global" Statistics gathered, not dependent on DMA channel */
|
||||||
struct grspw_core_stats stats;
|
struct grspw_core_stats stats;
|
||||||
@@ -772,10 +772,15 @@ void grspw_link_ctrl(void *d, int *options, int *clkdiv)
|
|||||||
ctrl &= ~GRSPW_CTRL_IE;
|
ctrl &= ~GRSPW_CTRL_IE;
|
||||||
|
|
||||||
REG_WRITE(®s->ctrl, ctrl);
|
REG_WRITE(®s->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);
|
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 |
|
ctrl = GRSPW_DMACTRL_AI | GRSPW_DMACTRL_PS | GRSPW_DMACTRL_PR |
|
||||||
GRSPW_DMACTRL_TA | GRSPW_DMACTRL_RA | GRSPW_DMACTRL_RE |
|
GRSPW_DMACTRL_TA | GRSPW_DMACTRL_RA | GRSPW_DMACTRL_RE |
|
||||||
(dma->cfg.flags & DMAFLAG_MASK) << GRSPW_DMACTRL_NS_BIT;
|
(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;
|
ctrl |= GRSPW_DMACTRL_LE;
|
||||||
if (dma->cfg.rx_irq_en_cnt != 0)
|
if (dma->cfg.rx_irq_en_cnt != 0)
|
||||||
ctrl |= GRSPW_DMACTRL_RI;
|
ctrl |= GRSPW_DMACTRL_RI;
|
||||||
@@ -2554,7 +2559,7 @@ STATIC void grspw_isr(void *data)
|
|||||||
if (stat & GRSPW_STS_WE)
|
if (stat & GRSPW_STS_WE)
|
||||||
priv->stats.err_wsync++;
|
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
|
/* Disable the link, no more transfers are expected
|
||||||
* on any DMA channel.
|
* on any DMA channel.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user