Skip to content

Commit 4f4bc0a

Browse files
andy-shevVinod Koul
authored andcommitted
dmaengine: hsu: correct use of channel status register
There is a typo in documentation regarding to descriptor empty bit (DESCE) which is set to 1 when descriptor is empty. Thus, status register at the end of a transfer usually returns all DESCE bits set and thus it will never be zero. Moreover, there are 2 bits (CDESC) that encode current descriptor, on which interrupt has been asserted. In case when we have few descriptors programmed we might have non-zero value. Remove DESCE and CDESC bits from DMA channel status register (HSU_CH_SR) when reading it. Fixes: 2b49e0c ("dmaengine: append hsu DMA driver") Cc: stable@vger.kernel.org Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
1 parent a197f3c commit 4f4bc0a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

drivers/dma/hsu/hsu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static u32 hsu_dma_chan_get_sr(struct hsu_dma_chan *hsuc)
135135
sr = hsu_chan_readl(hsuc, HSU_CH_SR);
136136
spin_unlock_irqrestore(&hsuc->vchan.lock, flags);
137137

138-
return sr;
138+
return sr & ~(HSU_CH_SR_DESCE_ANY | HSU_CH_SR_CDESC_ANY);
139139
}
140140

141141
irqreturn_t hsu_dma_irq(struct hsu_dma_chip *chip, unsigned short nr)

drivers/dma/hsu/hsu.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
#define HSU_CH_SR_DESCTO(x) BIT(8 + (x))
4242
#define HSU_CH_SR_DESCTO_ANY (BIT(11) | BIT(10) | BIT(9) | BIT(8))
4343
#define HSU_CH_SR_CHE BIT(15)
44+
#define HSU_CH_SR_DESCE(x) BIT(16 + (x))
45+
#define HSU_CH_SR_DESCE_ANY (BIT(19) | BIT(18) | BIT(17) | BIT(16))
46+
#define HSU_CH_SR_CDESC_ANY (BIT(31) | BIT(30))
4447

4548
/* Bits in HSU_CH_CR */
4649
#define HSU_CH_CR_CHA BIT(0)

0 commit comments

Comments
 (0)