From: Shawn Lin <shawn.lin@rock-chips.com>
To: Jaehoon Chung <jh80.chung@samsung.com>, ulf.hansson@linaro.org
Cc: shawn.lin@rock-chips.com, linux-mips@linux-mips.org,
Krzysztof Kozlowski <k.kozlowski@samsung.com>,
heiko@sntech.de, linux-kernel@vger.kernel.org,
linux-samsung-soc@vger.kernel.org,
Russell King <linux@arm.linux.org.uk>,
Alexey Brodkin <abrodkin@synopsys.com>,
Wei Xu <xuwei5@hisilicon.com>,
linux-rockchip@lists.infradead.org, Kukjin Kim <kgene@kernel.org>,
CPGS <cpgs@samsung.com>, Zhangfei Gao <zhangfei.gao@linaro.org>,
Joachim Eastwood <manabian@gmail.com>,
devicetree@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
Vineet.Gupta1@synopsys.com,
Govindraj Raja <govindraj.raja@imgtec.com>,
linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org,
dianders@chromium.org, Ralf Baechle <ralf@linux-mips.org>,
Jun Nie <jun.nie@linaro.org>
Subject: Re: [RFC PATCH v6 1/9] mmc: dw_mmc: Add external dma interface support
Date: Fri, 21 Aug 2015 15:48:33 +0800 [thread overview]
Message-ID: <55D6D7D1.90105@rock-chips.com> (raw)
In-Reply-To: <55D6D581.3050509@samsung.com>
On 2015/8/21 15:38, Jaehoon Chung wrote:
> On 08/21/2015 04:27 PM, Shawn Lin wrote:
>> On 2015/8/21 14:35, Jaehoon Chung wrote:
>>> On 08/21/2015 03:30 PM, Shawn Lin wrote:
>>>> On 2015/8/21 14:27, Jaehoon Chung wrote:
>>>>> Hi, Shawn.
>>>>>
>>>>> Is this based on Ulf's repository?
>>>>
>>>>
>>>> no, it's based on "https://github.com/jh80chung/dw-mmc.git tags/dw-mmc-for-ulf-v4.2" :)
>>>
>>> Oh..I will rebase to Ulf's next branch on this weekend.
>>> Then could you rebase this patch? And i added more comments at below.. :)
>>>
>>
>> Okay, I will rebase to Ulf's next.
>>
>>> Best Regards,
>>> Jaehoon Chung
>>>
>>>>
>>
>> [...]
>>
>>>>>> index ec6dbcd..7e1d13b 100644
>>>>>> --- a/drivers/mmc/host/dw_mmc-pltfm.c
>>>>>> +++ b/drivers/mmc/host/dw_mmc-pltfm.c
>>>>>> @@ -59,6 +59,8 @@ int dw_mci_pltfm_register(struct platform_device *pdev,
>>>>>> host->pdata = pdev->dev.platform_data;
>>>>>>
>>>>>> regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>>>>> + /* Get registers' physical base address */
>>>>>> + host->phy_regs = (void *)(regs->start);
>>>>>> host->regs = devm_ioremap_resource(&pdev->dev, regs);
>>>>>> if (IS_ERR(host->regs))
>>>>>> return PTR_ERR(host->regs);
>>>>>
>>>>> Is this board specific code? If so, separate the patch.
>>
>> It's might not board specific code.
>> dmaengine need dw_mmc's *physical* fifo address for data transfer, so I get controller physical address here in order to calculate physical fifo address.
>>
>> regs is from dt-bindings, for instance:
>> dwmmc0@12200000 {
>> compatible = "snps,dw-mshc";
>> clocks = <&clock 351>, <&clock 132>;
>> clock-names = "biu", "ciu";
>> reg = <0x12200000 0x1000>;
>> interrupts = <0 75 0>;
>> #address-cells = <1>;
>> #size-cells = <0>;
>> };
>>
>> so, host->phy_regs will be 0x12200000 .
>>
>> [...]
>>
>>>>>> +static void dw_mci_dmac_complete_dma(void *arg)
>>>>>> {
>>>>>> + struct dw_mci *host = arg;
>>>>>> struct mmc_data *data = host->data;
>>>>>>
>>>>>> dev_vdbg(host->dev, "DMA complete\n");
>>>>>>
>>>>>> + if (host->use_dma == TRANS_MODE_EDMAC)
>>>>>> + if (data && (data->flags & MMC_DATA_READ))
>>>>>
>>>>> Combine one condition.
>>
>> okay.
>>
>> [...]
>>
>>>>>> + u32 fifo_offset = host->fifo_reg - host->regs;
>>>>>> + int ret = 0;
>>>>>> +
>>>>>> + /* Set external dma config: burst size, burst width */
>>>>>> + cfg.dst_addr = (dma_addr_t)(host->phy_regs + fifo_offset);
>>>>>
>>>>> host->phy_regs is not assigned?
>>
>> we got it at dw_mci_pltfm_register. See comments above. :)
>>
>> [...]
>>
>>>>>> mmc->max_blk_count = mmc->max_req_size / 512;
>>>>>> + } else if (host->use_dma == TRANS_MODE_EDMAC) {
>>>>>> + mmc->max_segs = 64;
>>>>>> + mmc->max_blk_size = 65536;
>>>>>> + mmc->max_blk_count = 65535;
>>>>>> + mmc->max_req_size =
>>>>>> + mmc->max_blk_size * mmc->max_blk_count;
>>>>>> + mmc->max_seg_size = mmc->max_req_size;
>>>>>
>>>>> Fix the indention
>>
>> Hmm..I check it attentively but can't find the indention . Might it's because you apply it against Ulf's repo?
>>
>>>>>
>>
>> [...]
>>
>>>>>>
>>>>>> - /* Alloc memory for sg translation */
>>>>>> - host->sg_cpu = dmam_alloc_coherent(host->dev, PAGE_SIZE,
>>>>>> - &host->sg_dma, GFP_KERNEL);
>>>>>> - if (!host->sg_cpu) {
>>>>>> - dev_err(host->dev, "%s: could not alloc DMA memory\n",
>>>>>> - __func__);
>>>>>> + /* Check tansfer mode */
>>>>>> + trans_mode = SDMMC_GET_TRANS_MODE(mci_readl(host, HCON));
>>>>>> + 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;
>>>>>
>>>>> what are trans_mode "0, 1, 2"?
>>>>> (00 - none) is NO-DMA interface, isn't? is it IDMAC mode?
>>>>>
>>
>> No, I guess the databook's ambiguous description confuse everybody.
>>
>> I got double comfirm from my ASCI team as well as Synoposys
>> 2b'00: NO-DMA interface --> It support IDMAC actually
>> 2b'01 & 2b'02: DW_DMA & GENERIC_DMA --> Support 2 types of external dma.
>> 2b'02: NON-DW-DMA --> only support PIO
>
> Then Could you add the comment about this?
> Use definition instead of "0, 1, 2". Developer don't know meaning that is 0, 1, 2.
>
Okay. :)))
> Best Regards,
> Jaehoon Chung
>
>>
>> refer to the description below:
>> Parameter Name: DMA_INTERFACE
>> Legal Values: 0-3
>> Default Value: 0
>> Description:
>> 0- No DMA Interface
>> 1- DesignWare DMA Interface
>> 2- Generic DMA Interface
>> 3- Non DW DMA Interface
>> In DesignWare DMA mode, request/acknowledge protocol meets DW_ahb_dmac
>> controller protocol. In this mode, host data bus is also used for DMA transfers.Generic DMA-type interface has simpler request/acknowledge handshake and has dedicated read/write data bus for DMA transfers. Non DW DMAC interface uses dw_dma_single interface in addition to the existing interface and uses host data bus for DMA transfers. This is configurable only if INTERNAL_DMAC=0.
>>
>>>>>> goto no_dma;
>>>>>> }
>>>
>>>>>> + dev_info(host->dev, "Using external DMA controller.\n");
>>>>>> + }
>>>>>>
>>>>>> if (!host->dma_ops)
>>>>>> goto no_dma;
>>>>>> @@ -2562,12 +2720,12 @@ static void dw_mci_init_dma(struct dw_mci *host)
>>>>>> goto no_dma;
>>>>>> }
>>>>>>
>>>>>> - host->use_dma = 1;
>>>>>> + host->use_dma = trans_mode;
>>>>>
>>>>> Also confuse, if trans_mode is assigned host->use_dma, can mode value be directly assigned to host->use_dma?
>>>>>
>>
>> Good idea, I will do it. :)
>>
>>>>> trans_mode = TRAMS_MODE_PIO;
>>>>> host->use_dma = trans_mode;
>>>>>
>>
>> [...]
>>
>>>>>>
>>>>>> @@ -2890,7 +3047,7 @@ int dw_mci_probe(struct dw_mci *host)
>>>>>> * Get the host data width - this assumes that HCON has been set with
>>>>>> * the correct values.
>>>>>> */
>>>>>> - i = (mci_readl(host, HCON) >> 7) & 0x7;
>>>>>> + i = SDMMC_GET_HDATA_WIDTH(mci_readl(host, HCON));
>>>>>
>>>>> This is not related with supporting external dma interface.
>>>>> Separate this.
>>>>>
>>
>> Okay, It will be split into another one.
>>
>>>>>> if (!i) {
>>>>>> host->push_data = dw_mci_push_data16;
>>>>>> host->pull_data = dw_mci_pull_data16;
>>
>>
>>
>
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
>
--
Best Regards
Shawn Lin
next prev parent reply other threads:[~2015-08-21 7:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-20 8:43 [RFC PATCH v6 0/9] Add external dma support for Synopsys MSHC Shawn Lin
2015-08-20 8:43 ` [RFC PATCH v6 1/9] mmc: dw_mmc: Add external dma interface support Shawn Lin
2015-08-21 6:27 ` Jaehoon Chung
2015-08-21 6:30 ` Shawn Lin
2015-08-21 6:35 ` Jaehoon Chung
2015-08-21 7:27 ` Shawn Lin
2015-08-21 7:38 ` Jaehoon Chung
2015-08-21 7:48 ` Shawn Lin [this message]
2015-08-20 8:44 ` [RFC PATCH v6 2/9] Documentation: synopsys-dw-mshc: add bindings for idmac and edmac Shawn Lin
2015-08-20 8:44 ` [RFC PATCH v6 3/9] mips: pistachio_defconfig: remove CONFIG_MMC_DW_IDMAC Shawn Lin
2015-08-20 8:44 ` [RFC PATCH v6 4/9] arc: axs10x_defconfig: " Shawn Lin
2015-08-20 8:45 ` [RFC PATCH v6 5/9] arm: exynos_defconfig: " Shawn Lin
2015-08-20 8:45 ` [RFC PATCH v6 6/9] arm: hisi_defconfig: " Shawn Lin
2015-08-20 8:45 ` [RFC PATCH v6 7/9] arm: lpc18xx_defconfig: " Shawn Lin
2015-08-20 8:45 ` [RFC PATCH v6 8/9] arm: multi_v7_defconfig: " Shawn Lin
2015-08-20 8:46 ` [RFC PATCH v6 9/9] arm: zx_defconfig: " Shawn Lin
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=55D6D7D1.90105@rock-chips.com \
--to=shawn.lin@rock-chips.com \
--cc=Vineet.Gupta1@synopsys.com \
--cc=abrodkin@synopsys.com \
--cc=arnd@arndb.de \
--cc=cpgs@samsung.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=manabian@gmail.com \
--cc=ralf@linux-mips.org \
--cc=ulf.hansson@linaro.org \
--cc=xuwei5@hisilicon.com \
--cc=zhangfei.gao@linaro.org \
/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).