From: Joachim Eastwood <manabian@gmail.com>
To: Shawn Lin <shawn.lin@rock-chips.com>
Cc: jh80.chung@samsung.com, "Ulf Hansson" <ulf.hansson@linaro.org>,
"Heiko Stübner" <heiko@sntech.de>,
"Doug Anderson" <dianders@chromium.org>,
Vineet.Gupta1@synopsys.com, "Wei Xu" <xuwei5@hisilicon.com>,
"Alexey Brodkin" <abrodkin@synopsys.com>,
"Kukjin Kim" <kgene@kernel.org>,
"Krzysztof Kozlowski" <k.kozlowski@samsung.com>,
"Russell King" <linux@arm.linux.org.uk>,
"Jun Nie" <jun.nie@linaro.org>,
"Ralf Baechle" <ralf@linux-mips.org>,
"Govindraj Raja" <govindraj.raja@imgtec.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
linux-samsung-soc@vger.kernel.org, linux-mips@linux-mips.org,
linux-mmc@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org
Subject: Re: [RFC PATCH v4 1/9] mmc: dw_mmc: Add external dma interface support
Date: Fri, 7 Aug 2015 23:32:05 +0200 [thread overview]
Message-ID: <CAGhQ9VxUYvgGD=K3J3cQ0CNpCC-RfGE9cxhBHnTeAU2CmWkiKA@mail.gmail.com> (raw)
In-Reply-To: <1438843491-23853-1-git-send-email-shawn.lin@rock-chips.com>
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;
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.
> + 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).
regard,
Joachim Eastwood
next prev parent reply other threads:[~2015-08-07 21:32 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-06 6:44 [RFC PATCH v4 0/9] Shawn Lin
2015-08-06 6:44 ` [RFC PATCH v4 1/9] mmc: dw_mmc: Add external dma interface support Shawn Lin
2015-08-06 7:08 ` Krzysztof Kozlowski
2015-08-06 7:26 ` Shawn Lin
2015-08-06 7:37 ` Krzysztof Kozlowski
2015-08-07 21:32 ` Joachim Eastwood [this message]
2015-08-07 23:37 ` Shawn Lin
2015-08-10 18:03 ` Alim Akhtar
2015-08-10 23:35 ` Shawn Lin
2015-08-06 6:45 ` [RFC PATCH v4 2/9] Documentation: synopsys-dw-mshc: add bindings for idmac and edmac Shawn Lin
2015-08-06 6:45 ` [RFC PATCH v4 3/9] mips: pistachio_defconfig: remove CONFIG_MMC_DW_IDMAC Shawn Lin
2015-08-06 9:05 ` Govindraj Raja
2015-08-06 13:17 ` Ralf Baechle
2015-08-12 22:05 ` Ralf Baechle
2015-08-13 0:08 ` Shawn Lin
2015-08-06 6:45 ` [RFC PATCH v4 4/9] arc: axs10x_defconfig: " Shawn Lin
2015-08-07 5:48 ` Vineet Gupta
2015-08-06 6:45 ` [RFC PATCH v4 5/9] arm: exynos_defconfig: " Shawn Lin
2015-08-06 7:08 ` Krzysztof Kozlowski
2015-08-06 6:45 ` [RFC PATCH v4 6/9] arm: hisi_defconfig: " Shawn Lin
2015-08-13 10:18 ` Wei Xu
2015-08-06 6:46 ` [RFC PATCH v4 7/9] arm: lpc18xx_defconfig: " Shawn Lin
2015-08-07 21:34 ` Joachim Eastwood
2015-08-06 6:46 ` [RFC PATCH v4 8/9] arm: multi_v7_defconfig: " Shawn Lin
2015-08-06 6:46 ` [RFC PATCH v4 9/9] arm: zx_defconfig: " Shawn Lin
2015-08-06 7:08 ` [RFC PATCH v4 0/9] Jaehoon Chung
2015-08-06 7:31 ` Shawn Lin
2015-08-06 7:33 ` Jaehoon Chung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGhQ9VxUYvgGD=K3J3cQ0CNpCC-RfGE9cxhBHnTeAU2CmWkiKA@mail.gmail.com' \
--to=manabian@gmail.com \
--cc=Vineet.Gupta1@synopsys.com \
--cc=abrodkin@synopsys.com \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=govindraj.raja@imgtec.com \
--cc=heiko@sntech.de \
--cc=jh80.chung@samsung.com \
--cc=jun.nie@linaro.org \
--cc=k.kozlowski@samsung.com \
--cc=kgene@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=ralf@linux-mips.org \
--cc=shawn.lin@rock-chips.com \
--cc=ulf.hansson@linaro.org \
--cc=xuwei5@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).