在 2015/8/17 5:10, Doug Anderson 写道: > Heiko, > > On Fri, Aug 14, 2015 at 3:13 PM, Heiko Stübner wrote: >> Hi Shawn, >> >> Am Freitag, 14. August 2015, 16:34:35 schrieb Shawn Lin: >>> DesignWare MMC Controller can supports two types of DMA >>> mode: external dma and internal dma. We get a RK312x platform >>> integrated dw_mmc and ARM pl330 dma controller. This patch add >>> edmac ops to support these platforms. I've tested it on RK312x >>> platform with edmac mode and RK3288 platform with idmac mode. >>> >>> Signed-off-by: Shawn Lin >> >> judging by your "from", I guess you're running this on some older Rockchip soc >> without the idma? Because I tried testing this on a Radxa Rock, but only got >> failures, from the start (failed to read card status register). In PIO mode >> everything works again. >> >> >> I guess I overlooked just some tiny detail, but to me the dma channel ids seem >> correct after all. Maybe you have any hints what I'm doing wrong? > > If I were a guessing man (which I'm not), I'd guess that perhaps > you're running into troubles with our friend the PL330. > > There appear to be strange issues with the PL330 on Rockchip SoCs. I > was only peripherally involved with them, but I know at least about > some of the patches in our tree, like: > Thanks, Doug, that's the root cause. PL330 on Rockchip Socs need your patches, and we might need another patch to limit pl330 burst_len to 16(Hmm...seems another quirks for rockchip but not on your tree); Hi Heiko, I just get a Radxa Rock luckily and test my patch based on http://radxa.com/Rock/Linux_Mainline. Yes, it can't work. If you test my patchset on Rockchip platform, pls apply pl330 patch from my tree based on kernel 4.2-RC3. AND, temporary hack dw_mmc to limit pl330 burst_len to 16. This is a dmaengine or pl330 problem(I guest it should be upstreamed later?), but my patchset is for *generic* dw_mmc to support emdac, so other platforms should never need the hack of pl330. pl330.patch is for pl330 changes r3xxx.patch is for pl330 quirks AND pls limit burst_len to 16 for BROKRN pl330 of rockchips. static int dw_mci_edmac_start_dma( ... + u32 burst_limit = 0; + u32 mburst; + u32 idx, rx_wmark, tx_wmark; ... /* Match burst msize with external dma config */ fifoth_val = mci_readl(host, FIFOTH); - cfg.dst_maxburst = mszs[(fifoth_val >> 28) & 0x7]; - cfg.src_maxburst = cfg.dst_maxburst; + /* HACK for BROKEN pl330 */ + mburst = mszs[(fifoth_val >> 28) & 0x7]; + burst_limit = 16; + if (mburst > burst_limit) { + mburst = burst_limit; + idx = (ilog2(mburst) > 0) ? (ilog2(mburst) - 1) : 0; + rx_wmark = mszs[idx] - 1; + tx_wmark = (host->fifo_depth) / 2; + fifoth_val = SDMMC_SET_FIFOTH(idx, rx_wmark, tx_wmark); + mci_writel(host, FIFOTH, fifoth_val); + } + cfg.dst_maxburst = mburst; + cfg.src_maxburst = cfg.dst_maxburst; > https://chromium-review.googlesource.com/237607 > FROMLIST: DMA: pl330: support burst mode for dev-to-mem and mem-to-dev transmit > > https://chromium-review.googlesource.com/237393 > CHROMIUM: dmaengine: pl330: support quirks for some broken > > https://chromium-review.googlesource.com/237396 > CHROMIUM: dmaengine: pl330: add quirk for broken no flushp > > https://chromium-review.googlesource.com/237394 > CHROMIUM: ARM: dts: rockchip: Add broken-no-flushp into rk3288.dtsi > > https://chromium-review.googlesource.com/242063 > CHROMIUM: ASoC: rockchip_i2s: modify DMA max burst to 1 > > > -- Shawn Lin