linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Archit Taneja <architt@codeaurora.org>
To: Abhishek Sahu <absahu@codeaurora.org>,
	dwmw2@infradead.org, computersforpeace@gmail.com,
	boris.brezillon@free-electrons.com, marek.vasut@gmail.com,
	richard@nod.at, cyrille.pitchen@wedev4u.fr, robh+dt@kernel.org,
	mark.rutland@arm.com
Cc: linux-mtd@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	andy.gross@linaro.org, sricharan@codeaurora.org
Subject: Re: [PATCH v2 14/25] mtd: nand: qcom: add and initialize QPIC DMA resources
Date: Wed, 2 Aug 2017 14:11:03 +0530	[thread overview]
Message-ID: <e84110af-c33a-72aa-0ee6-ec3458124167@codeaurora.org> (raw)
In-Reply-To: <1500464893-11352-15-git-send-email-absahu@codeaurora.org>



On 07/19/2017 05:18 PM, Abhishek Sahu wrote:
> 1. QPIC NAND uses 3 BAM channels: command, data tx and data
>     rx while EBI2 NAND uses only single ADM channel.
> 2. CRCI is only required for ADM DMA and its not required for

s/its/it's

>     QPIC NAND.
> 
> Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
> ---
>   drivers/mtd/nand/qcom_nandc.c | 83 +++++++++++++++++++++++++++++++++----------
>   1 file changed, 65 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/mtd/nand/qcom_nandc.c b/drivers/mtd/nand/qcom_nandc.c
> index 6d24630..cb2b245 100644
> --- a/drivers/mtd/nand/qcom_nandc.c
> +++ b/drivers/mtd/nand/qcom_nandc.c
> @@ -250,9 +250,19 @@ struct qcom_nand_controller {
>   	struct clk *core_clk;
>   	struct clk *aon_clk;
>   
> -	struct dma_chan *chan;
> -	unsigned int cmd_crci;
> -	unsigned int data_crci;
> +	union {
> +		struct {
> +			struct dma_chan *tx_chan;
> +			struct dma_chan *rx_chan;
> +			struct dma_chan *cmd_chan;
> +		};
> +		struct {
> +			struct dma_chan *chan;
> +			unsigned int cmd_crci;
> +			unsigned int data_crci;
> +		};
> +	};

Could you put comments here explaining one is for EBI2/ADM
and other is for QPIC/BAM? It'll improve the readability a
bit. Otherwise:

Reviewed-by: Archit Taneja <architt@codeaurora.org>

Thanks,
Archit

> +
>   	struct list_head desc_list;
>   
>   	u8		*data_buffer;
> @@ -1985,10 +1995,31 @@ static int qcom_nandc_alloc(struct qcom_nand_controller *nandc)
>   	if (!nandc->reg_read_buf)
>   		return -ENOMEM;
>   
> -	nandc->chan = dma_request_slave_channel(nandc->dev, "rxtx");
> -	if (!nandc->chan) {
> -		dev_err(nandc->dev, "failed to request slave channel\n");
> -		return -ENODEV;
> +	if (nandc->props->is_bam) {
> +		nandc->tx_chan = dma_request_slave_channel(nandc->dev, "tx");
> +		if (!nandc->tx_chan) {
> +			dev_err(nandc->dev, "failed to request tx channel\n");
> +			return -ENODEV;
> +		}
> +
> +		nandc->rx_chan = dma_request_slave_channel(nandc->dev, "rx");
> +		if (!nandc->rx_chan) {
> +			dev_err(nandc->dev, "failed to request rx channel\n");
> +			return -ENODEV;
> +		}
> +
> +		nandc->cmd_chan = dma_request_slave_channel(nandc->dev, "cmd");
> +		if (!nandc->cmd_chan) {
> +			dev_err(nandc->dev, "failed to request cmd channel\n");
> +			return -ENODEV;
> +		}
> +	} else {
> +		nandc->chan = dma_request_slave_channel(nandc->dev, "rxtx");
> +		if (!nandc->chan) {
> +			dev_err(nandc->dev,
> +				"failed to request slave channel\n");
> +			return -ENODEV;
> +		}
>   	}
>   
>   	INIT_LIST_HEAD(&nandc->desc_list);
> @@ -2001,7 +2032,19 @@ static int qcom_nandc_alloc(struct qcom_nand_controller *nandc)
>   
>   static void qcom_nandc_unalloc(struct qcom_nand_controller *nandc)
>   {
> -	dma_release_channel(nandc->chan);
> +	if (nandc->props->is_bam) {
> +		if (nandc->tx_chan)
> +			dma_release_channel(nandc->tx_chan);
> +
> +		if (nandc->rx_chan)
> +			dma_release_channel(nandc->rx_chan);
> +
> +		if (nandc->cmd_chan)
> +			dma_release_channel(nandc->cmd_chan);
> +	} else {
> +		if (nandc->chan)
> +			dma_release_channel(nandc->chan);
> +	}
>   }
>   
>   /* one time setup of a few nand controller registers */
> @@ -2140,16 +2183,20 @@ static int qcom_nandc_parse_dt(struct platform_device *pdev)
>   	struct device_node *np = nandc->dev->of_node;
>   	int ret;
>   
> -	ret = of_property_read_u32(np, "qcom,cmd-crci", &nandc->cmd_crci);
> -	if (ret) {
> -		dev_err(nandc->dev, "command CRCI unspecified\n");
> -		return ret;
> -	}
> +	if (!nandc->props->is_bam) {
> +		ret = of_property_read_u32(np, "qcom,cmd-crci",
> +					   &nandc->cmd_crci);
> +		if (ret) {
> +			dev_err(nandc->dev, "command CRCI unspecified\n");
> +			return ret;
> +		}
>   
> -	ret = of_property_read_u32(np, "qcom,data-crci", &nandc->data_crci);
> -	if (ret) {
> -		dev_err(nandc->dev, "data CRCI unspecified\n");
> -		return ret;
> +		ret = of_property_read_u32(np, "qcom,data-crci",
> +					   &nandc->data_crci);
> +		if (ret) {
> +			dev_err(nandc->dev, "data CRCI unspecified\n");
> +			return ret;
> +		}
>   	}
>   
>   	return 0;
> @@ -2199,7 +2246,7 @@ static int qcom_nandc_probe(struct platform_device *pdev)
>   
>   	ret = qcom_nandc_alloc(nandc);
>   	if (ret)
> -		return ret;
> +		goto err_core_clk;
>   
>   	ret = clk_prepare_enable(nandc->core_clk);
>   	if (ret)
> 

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply	other threads:[~2017-08-02  8:41 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-19 11:47 [PATCH v2 00/25] Add QCOM QPIC NAND support Abhishek Sahu
2017-07-19 11:47 ` [PATCH v2 01/25] mtd: nand: qcom: fix config error for BCH Abhishek Sahu
2017-08-02  5:47   ` Archit Taneja
2017-08-03 15:56   ` Boris Brezillon
2017-08-03 17:52     ` Abhishek Sahu
2017-08-03 18:47       ` Boris Brezillon
2017-08-03 19:02         ` Abhishek Sahu
2017-08-04  7:46   ` Boris Brezillon
2017-07-19 11:47 ` [PATCH v2 02/25] mtd: nand: qcom: program NAND_DEV_CMD_VLD register Abhishek Sahu
2017-08-02  5:49   ` Archit Taneja
2017-08-03 15:47   ` Boris Brezillon
2017-08-03 17:59     ` Abhishek Sahu
2017-08-03 15:48   ` Boris Brezillon
2017-08-03 17:54     ` Abhishek Sahu
2017-07-19 11:47 ` [PATCH v2 03/25] mtd: nand: qcom: change compatible string for EBI2 NANDC Abhishek Sahu
2017-07-19 11:47 ` [PATCH v2 04/25] dt-bindings: qcom_nandc: " Abhishek Sahu
2017-07-24 19:13   ` Rob Herring
2017-07-19 11:47 ` [PATCH v2 05/25] mtd: nand: qcom: remove redundant chip select compatible string Abhishek Sahu
2017-08-02  5:51   ` Archit Taneja
2017-08-04  7:47   ` Boris Brezillon
2017-07-19 11:47 ` [PATCH v2 06/25] dt-bindings: qcom_nandc: remove " Abhishek Sahu
2017-07-24 19:14   ` Rob Herring
2017-08-04  7:47   ` Boris Brezillon
2017-07-19 11:47 ` [PATCH v2 07/25] mtd: nand: qcom: reorganize nand page read Abhishek Sahu
2017-08-02  5:56   ` Archit Taneja
2017-08-04  7:48   ` Boris Brezillon
2017-07-19 11:47 ` [PATCH v2 08/25] mtd: nand: qcom: reorganize nand page write Abhishek Sahu
2017-08-02  6:01   ` Archit Taneja
2017-08-02 13:54     ` Abhishek Sahu
2017-08-04  7:48   ` Boris Brezillon
2017-07-19 11:47 ` [PATCH v2 09/25] mtd: nand: qcom: remove memset for clearing read register buffer Abhishek Sahu
2017-08-02  6:06   ` Archit Taneja
2017-08-04  7:48   ` Boris Brezillon
2017-07-19 11:47 ` [PATCH v2 10/25] mtd: nand: qcom: reorganize nand devices probing Abhishek Sahu
2017-08-02  8:21   ` Archit Taneja
2017-08-02 13:56     ` Abhishek Sahu
2017-08-04  7:49     ` Boris Brezillon
2017-07-19 11:47 ` [PATCH v2 11/25] mtd: nand: qcom: support for NAND controller properties Abhishek Sahu
2017-08-02  8:31   ` Archit Taneja
2017-08-04  7:49   ` Boris Brezillon
2017-08-04  7:56     ` Boris Brezillon
2017-08-04 12:39   ` Boris Brezillon
2017-07-19 11:48 ` [PATCH v2 12/25] dt-bindings: qcom_nandc: QPIC NAND documentation Abhishek Sahu
2017-07-19 19:39   ` Boris Brezillon
2017-07-20  5:33     ` Abhishek Sahu
2017-07-24 19:17   ` Rob Herring
2017-07-25 18:43     ` Abhishek Sahu
2017-07-31 16:05       ` Abhishek Sahu
2017-08-04 12:45         ` Boris Brezillon
2017-08-04 13:11           ` Abhishek Sahu
2017-08-04 13:22             ` Boris Brezillon
2017-07-19 11:48 ` [PATCH v2 13/25] mtd: nand: qcom: add QPIC NAND compatible string Abhishek Sahu
2017-08-02  8:36   ` Archit Taneja
2017-07-19 11:48 ` [PATCH v2 14/25] mtd: nand: qcom: add and initialize QPIC DMA resources Abhishek Sahu
2017-08-02  8:41   ` Archit Taneja [this message]
2017-08-02 13:59     ` Abhishek Sahu
2017-07-19 11:48 ` [PATCH v2 15/25] mtd: nand: qcom: DMA mapping support for register read buffer Abhishek Sahu
2017-08-04  5:26   ` Archit Taneja
2017-07-19 11:48 ` [PATCH v2 16/25] mtd: nand: qcom: allocate BAM transaction Abhishek Sahu
2017-07-21 20:28   ` kbuild test robot
2017-08-04  5:43   ` Archit Taneja
2017-07-19 11:48 ` [PATCH v2 17/25] mtd: nand: qcom: add BAM DMA descriptor handling Abhishek Sahu
2017-08-04  5:54   ` Archit Taneja
2017-07-19 11:48 ` [PATCH v2 18/25] mtd: nand: qcom: support for passing flags in transfer functions Abhishek Sahu
2017-07-19 11:48 ` [PATCH v2 19/25] mtd: nand: qcom: support for read location registers Abhishek Sahu
2017-07-19 11:48 ` [PATCH v2 20/25] mtd: nand: qcom: erased codeword detection configuration Abhishek Sahu
2017-07-19 11:48 ` [PATCH v2 21/25] mtd: nand: qcom: support for QPIC page read/write Abhishek Sahu
2017-07-19 11:48 ` [PATCH v2 22/25] mtd: nand: qcom: QPIC raw write support Abhishek Sahu
2017-07-19 11:48 ` [PATCH v2 23/25] mtd: nand: qcom: change register offset defines with enums Abhishek Sahu
2017-07-19 11:48 ` [PATCH v2 24/25] dt-bindings: qcom_nandc: compatible string for version 1.5.0 Abhishek Sahu
2017-07-19 11:48 ` [PATCH v2 25/25] mtd: nand: qcom: support for QPIC " Abhishek Sahu
2017-08-04  7:53 ` [PATCH v2 00/25] Add QCOM QPIC NAND support Boris Brezillon
2017-08-04  7:55   ` Boris Brezillon
2017-08-04  8:47     ` Abhishek Sahu

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=e84110af-c33a-72aa-0ee6-ec3458124167@codeaurora.org \
    --to=architt@codeaurora.org \
    --cc=absahu@codeaurora.org \
    --cc=andy.gross@linaro.org \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=richard@nod.at \
    --cc=robh+dt@kernel.org \
    --cc=sricharan@codeaurora.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).