diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2010-02-03 09:44:12 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-02-07 19:40:24 -0500 |
commit | 623b4ac4bf9e767991c66e29b47dd4b19458fb42 (patch) | |
tree | 9cf9c5ef8ac1ab714a35db1baf627fb701a98287 /drivers/dma/shdma.c | |
parent | fc4618575f79eea062cdc51715040e40cd35b71c (diff) |
sh: fix Transfer Size calculation in both DMA drivers
Both the original arch/sh/drivers/dma/dma-sh.c and the new SH dmaengine drivers
do not take into account bits 3:2 of the Transfer Size field in the CHCR
register, besides, bit-field defines set bit 2, but the mask only passes bits
1:0 through. TS_16BLK and TS_32BLK macros are bogus too. This patch fixes all
these issues for sh7722 and sh7724, other CPUs stay unchanged and might need to
be fixed too.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/dma/shdma.c')
-rw-r--r-- | drivers/dma/shdma.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index 427c3effc432..3e1037c5ebd1 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c | |||
@@ -105,10 +105,14 @@ static bool dmae_is_busy(struct sh_dmae_chan *sh_chan) | |||
105 | return false; /* waiting */ | 105 | return false; /* waiting */ |
106 | } | 106 | } |
107 | 107 | ||
108 | static unsigned int ts_shift[] = TS_SHIFT; | ||
108 | static inline unsigned int calc_xmit_shift(struct sh_dmae_chan *sh_chan) | 109 | static inline unsigned int calc_xmit_shift(struct sh_dmae_chan *sh_chan) |
109 | { | 110 | { |
110 | u32 chcr = sh_dmae_readl(sh_chan, CHCR); | 111 | u32 chcr = sh_dmae_readl(sh_chan, CHCR); |
111 | return ts_shift[(chcr & CHCR_TS_MASK) >> CHCR_TS_SHIFT]; | 112 | int cnt = ((chcr & CHCR_TS_LOW_MASK) >> CHCR_TS_LOW_SHIFT) | |
113 | ((chcr & CHCR_TS_HIGH_MASK) >> CHCR_TS_HIGH_SHIFT); | ||
114 | |||
115 | return ts_shift[cnt]; | ||
112 | } | 116 | } |
113 | 117 | ||
114 | static void dmae_set_reg(struct sh_dmae_chan *sh_chan, struct sh_dmae_regs *hw) | 118 | static void dmae_set_reg(struct sh_dmae_chan *sh_chan, struct sh_dmae_regs *hw) |