arch/arm/samv7: fix issue when AFEC1 driver failed to open second time
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
parent
5f55290e41
commit
be10056702
@ -638,22 +638,19 @@ static int sam_afec_trigger(struct samv7_dev_s *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* AFEC_MR registr still needs to select corresponding channels with
|
||||
* 1, 2, 3 values (see TRGSEL bitfield description) even if channels
|
||||
* 3, 4 and 5 are selected for AFEC1
|
||||
/* Set trigger for AFECn driver
|
||||
*
|
||||
* Note: AFEC_MR register still needs to select corresponding channels
|
||||
* with 1, 2, 3 values (see TRGSEL bitfield description) even if
|
||||
* channels 3, 4 and 5 are selected for AFEC1
|
||||
*/
|
||||
|
||||
if (priv->intf == 1)
|
||||
{
|
||||
priv->timer_channel -= 3;
|
||||
}
|
||||
|
||||
/* Set trigger for AFECn driver */
|
||||
|
||||
regval = afec_getreg(priv, SAM_AFEC_MR_OFFSET);
|
||||
regval &= ~AFEC_MR_TRGSEL_MASK;
|
||||
|
||||
regval |= ((priv->timer_channel + 1) << AFEC_MR_TRGSEL_SHIFT) | \
|
||||
regval |= (((priv->timer_channel % 3) + 1) << AFEC_MR_TRGSEL_SHIFT) |
|
||||
AFEC_MR_TRGEN;
|
||||
|
||||
afec_putreg(priv, SAM_AFEC_MR_OFFSET, regval);
|
||||
@ -753,7 +750,7 @@ static void afec_reset(struct adc_dev_s *dev)
|
||||
|
||||
/* Configure Extended Mode register */
|
||||
|
||||
uint32_t afec_emr = AFEC_EMR_TAG | AFEC_EMR_STM | \
|
||||
uint32_t afec_emr = AFEC_EMR_TAG | AFEC_EMR_STM |
|
||||
AFEC_EMR_RES(priv->resolution);
|
||||
afec_putreg(priv, SAM_AFEC_EMR_OFFSET, afec_emr);
|
||||
|
||||
@ -1022,7 +1019,7 @@ static int afec_interrupt(int irq, void *context, void *arg)
|
||||
struct samv7_dev_s *priv = (struct samv7_dev_s *)dev->ad_priv;
|
||||
int32_t data;
|
||||
|
||||
if ((afec_getreg(priv, SAM_AFEC_ISR_OFFSET) & \
|
||||
if ((afec_getreg(priv, SAM_AFEC_ISR_OFFSET) &
|
||||
AFEC_CH(priv->chanlist[priv->current])) != 0)
|
||||
{
|
||||
/* Read data */
|
||||
@ -1120,7 +1117,7 @@ struct adc_dev_s *sam_afec_initialize(int intf,
|
||||
|
||||
#ifdef CONFIG_SAMV7_AFEC_DMA
|
||||
priv->nsamples = priv->nchannels * CONFIG_SAMV7_AFEC_DMASAMPLES;
|
||||
priv->dma = sam_dmachannel(0, DMA_FLAGS | \
|
||||
priv->dma = sam_dmachannel(0, DMA_FLAGS |
|
||||
DMACH_FLAG_PERIPHPID(priv->pid));
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user