Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1203103
| From | Shawn Lin <shawn.lin@rock-chips.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH v4 1/9] mmc: dw_mmc: Add external dma interface support |
| Date | 2015-08-08 02:00 +0200 |
| Message-ID | <pUZIm-6OQ-11@gated-at.bofh.it> (permalink) |
| References | <pUna2-10Y-3@gated-at.bofh.it> <pUna2-10Y-15@gated-at.bofh.it> <pUXwT-3x2-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
在 2015/8/8 5:32, Joachim Eastwood 写道:
> Hi Shawn,
>
> On 6 August 2015 at 08:44, Shawn Lin <shawn.lin@rock-chips.com> wrote:
>> 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 <shawn.lin@rock-chips.com>
>
>> @@ -2256,26 +2373,30 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
>>
>> }
>>
>> -#ifdef CONFIG_MMC_DW_IDMAC
>> - /* Handle DMA interrupts */
>> - if (host->dma_64bit_address == 1) {
>> - pending = mci_readl(host, IDSTS64);
>> - if (pending & (SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI)) {
>> - mci_writel(host, IDSTS64, SDMMC_IDMAC_INT_TI |
>> - SDMMC_IDMAC_INT_RI);
>> - mci_writel(host, IDSTS64, SDMMC_IDMAC_INT_NI);
>> - host->dma_ops->complete(host);
>> - }
>> - } else {
>> - pending = mci_readl(host, IDSTS);
>> - if (pending & (SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI)) {
>> - mci_writel(host, IDSTS, SDMMC_IDMAC_INT_TI |
>> - SDMMC_IDMAC_INT_RI);
>> - mci_writel(host, IDSTS, SDMMC_IDMAC_INT_NI);
>> - host->dma_ops->complete(host);
>> + if (host->use_dma == TRANS_MODE_IDMAC) {
>
> Doing:
> if (host->use_dma != TRANS_MODE_IDMAC)
> return IRQ_HANDLED;
>
Okay.
> Could save you the extra level of identation you add below.
>
>> + /* Handle DMA interrupts */
>> + if (host->dma_64bit_address == 1) {
>> + pending = mci_readl(host, IDSTS64);
>> + if (pending & (SDMMC_IDMAC_INT_TI |
>> + SDMMC_IDMAC_INT_RI)) {
>> + mci_writel(host, IDSTS64,
>> + SDMMC_IDMAC_INT_TI |
>> + SDMMC_IDMAC_INT_RI);
>> + mci_writel(host, IDSTS64, SDMMC_IDMAC_INT_NI);
>> + host->dma_ops->complete((void *)host);
>> + }
>> + } else {
>> + pending = mci_readl(host, IDSTS);
>> + if (pending & (SDMMC_IDMAC_INT_TI |
>> + SDMMC_IDMAC_INT_RI)) {
>> + mci_writel(host, IDSTS,
>> + SDMMC_IDMAC_INT_TI |
>> + SDMMC_IDMAC_INT_RI);
>> + mci_writel(host, IDSTS, SDMMC_IDMAC_INT_NI);
>> + host->dma_ops->complete((void *)host);
>> + }
>> }
>> }
>> -#endif
>>
>> return IRQ_HANDLED;
>> }
>
>
>> @@ -2437,6 +2567,21 @@ static void dw_mci_cleanup_slot(struct dw_mci_slot *slot, unsigned int id)
>> static void dw_mci_init_dma(struct dw_mci *host)
>> {
>> int addr_config;
>> + int trans_mode;
>> + struct device *dev = host->dev;
>> + struct device_node *np = dev->of_node;
>> +
>> + /* Check tansfer mode */
>> + trans_mode = (mci_readl(host, HCON) >> 16) & 0x3;
>
> I think it would be nice if you could add some defines for 16 and 0x03
> or add a macro like SDMMC_GET_FCNT() that is in dw_mmc.h.
>
yes, it's better to avoid magic number for register operation to make
others understand w/o checking databook for details. And might more than
one (e.g "Check ADDR_CONFIG bit in HCON to find IDMAC address bus
width") should be modified.
Although one patch only do one thing, I will drop by to make it in v5.
>> + if (trans_mode == 0) {
>> + trans_mode = TRANS_MODE_IDMAC;
>> + } else if (trans_mode == 1 || trans_mode == 2) {
>> + trans_mode = TRANS_MODE_EDMAC;
>> + } else {
>> + trans_mode = TRANS_MODE_PIO;
>> + goto no_dma;
>> + }
>> +
>> /* Check ADDR_CONFIG bit in HCON to find IDMAC address bus width */
>> addr_config = (mci_readl(host, HCON) >> 27) & 0x01;
>
> I'll try to get this patch tested on my lpc18xx platform soon.
> btw, the HCON reg on lpc18xx reads as 0x00e42cc1 (address 0x40004070).
>
yes, HCON[17:16] is 2b'00 means your lpc18xx use IDMAC.
>
> regard,
> Joachim Eastwood
>
>
>
--
Shawn Lin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH v4 0/9] Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-06 08:50 +0200
[RFC PATCH v4 2/9] Documentation: synopsys-dw-mshc: add bindings for idmac and edmac Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-06 08:50 +0200
[RFC PATCH v4 5/9] arm: exynos_defconfig: remove CONFIG_MMC_DW_IDMAC Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-06 08:50 +0200
Re: [RFC PATCH v4 5/9] arm: exynos_defconfig: remove CONFIG_MMC_DW_IDMAC Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-08-06 09:10 +0200
[RFC PATCH v4 6/9] arm: hisi_defconfig: remove CONFIG_MMC_DW_IDMAC Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-06 08:50 +0200
Re: [RFC PATCH v4 6/9] arm: hisi_defconfig: remove CONFIG_MMC_DW_IDMAC Wei Xu <xuwei5@hisilicon.com> - 2015-08-13 12:30 +0200
[RFC PATCH v4 3/9] mips: pistachio_defconfig: remove CONFIG_MMC_DW_IDMAC Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-06 08:50 +0200
RE: [RFC PATCH v4 3/9] mips: pistachio_defconfig: remove CONFIG_MMC_DW_IDMAC Govindraj Raja <Govindraj.Raja@imgtec.com> - 2015-08-06 11:10 +0200
Re: [RFC PATCH v4 3/9] mips: pistachio_defconfig: remove CONFIG_MMC_DW_IDMAC Ralf Baechle <ralf@linux-mips.org> - 2015-08-06 15:20 +0200
Re: [RFC PATCH v4 3/9] mips: pistachio_defconfig: remove CONFIG_MMC_DW_IDMAC Ralf Baechle <ralf@linux-mips.org> - 2015-08-13 00:10 +0200
Re: [RFC PATCH v4 3/9] mips: pistachio_defconfig: remove CONFIG_MMC_DW_IDMAC Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-13 02:10 +0200
[RFC PATCH v4 1/9] mmc: dw_mmc: Add external dma interface support Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-06 08:50 +0200
Re: [RFC PATCH v4 1/9] mmc: dw_mmc: Add external dma interface support Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-08-06 09:10 +0200
Re: [RFC PATCH v4 1/9] mmc: dw_mmc: Add external dma interface support Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-06 09:30 +0200
Re: [RFC PATCH v4 1/9] mmc: dw_mmc: Add external dma interface support Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-08-06 09:40 +0200
Re: [RFC PATCH v4 1/9] mmc: dw_mmc: Add external dma interface support Joachim Eastwood <manabian@gmail.com> - 2015-08-07 23:40 +0200
Re: [RFC PATCH v4 1/9] mmc: dw_mmc: Add external dma interface support Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-08 02:00 +0200
Re: [RFC PATCH v4 1/9] mmc: dw_mmc: Add external dma interface support Alim Akhtar <alim.akhtar@gmail.com> - 2015-08-10 20:10 +0200
Re: [RFC PATCH v4 1/9] mmc: dw_mmc: Add external dma interface support Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-11 01:40 +0200
[RFC PATCH v4 4/9] arc: axs10x_defconfig: remove CONFIG_MMC_DW_IDMAC Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-06 08:50 +0200
Re: [RFC PATCH v4 4/9] arc: axs10x_defconfig: remove CONFIG_MMC_DW_IDMAC Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2015-08-07 07:50 +0200
[RFC PATCH v4 9/9] arm: zx_defconfig: remove CONFIG_MMC_DW_IDMAC Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-06 09:00 +0200
[RFC PATCH v4 7/9] arm: lpc18xx_defconfig: remove CONFIG_MMC_DW_IDMAC Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-06 09:00 +0200
Re: [RFC PATCH v4 7/9] arm: lpc18xx_defconfig: remove CONFIG_MMC_DW_IDMAC Joachim Eastwood <manabian@gmail.com> - 2015-08-07 23:40 +0200
[RFC PATCH v4 8/9] arm: multi_v7_defconfig: remove CONFIG_MMC_DW_IDMAC Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-06 09:00 +0200
Re: [RFC PATCH v4 0/9] Jaehoon Chung <jh80.chung@samsung.com> - 2015-08-06 09:10 +0200
Re: [RFC PATCH v4 0/9] Jaehoon Chung <jh80.chung@samsung.com> - 2015-08-06 09:40 +0200
Re: [RFC PATCH v4 0/9] Shawn Lin <shawn.lin@rock-chips.com> - 2015-08-06 09:40 +0200
csiph-web