Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Md Sadre Alam <quic_mdalam@quicinc.com>
To: Mark Brown <broonie@kernel.org>
Cc: <agross@kernel.org>, <andersson@kernel.org>,
	<konrad.dybcio@linaro.org>, <robh+dt@kernel.org>,
	<conor+dt@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>,
	<miquel.raynal@bootlin.com>, <richard@nod.at>, <vigneshr@ti.com>,
	<linux-arm-msm@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-mtd@lists.infradead.org>,
	<linux-spi@vger.kernel.org>, <quic_srichara@quicinc.com>,
	<qpic_varada@quicinc.com>
Subject: Re: [RFC PATCH 4/5] spi: qpic: Add support for qpic spi nand driver
Date: Fri, 3 Nov 2023 16:50:54 +0530	[thread overview]
Message-ID: <2b9e943a-198e-7999-b898-e7b2498a9ffa@quicinc.com> (raw)
In-Reply-To: <a1270a88-49a9-4bdb-89a9-ce6929f2294d@sirena.org.uk>



On 10/31/2023 7:53 PM, Mark Brown wrote:
> On Tue, Oct 31, 2023 at 05:33:06PM +0530, Md Sadre Alam wrote:
> 
>> +config SPI_QPIC_SNAND
>> +	tristate "QPIC SNAND controller"
>> +	default y
>> +	depends on ARCH_QCOM
>> +	help
>> +	  QPIC_SNAND(Quad SPI) driver for Qualcomm QPIC_SNAND controller.
>> +
> 
> I don't see any build dependencies on anything QC specific so please add
> an || COMPILE_TEST here, this makes it much easier to do generic changes
> without having to build some specific config.

Ok

> 
>> +++ b/drivers/spi/Makefile
>> @@ -153,6 +153,7 @@ obj-$(CONFIG_SPI_XTENSA_XTFPGA)		+= spi-xtensa-xtfpga.o
>>   obj-$(CONFIG_SPI_ZYNQ_QSPI)		+= spi-zynq-qspi.o
>>   obj-$(CONFIG_SPI_ZYNQMP_GQSPI)		+= spi-zynqmp-gqspi.o
>>   obj-$(CONFIG_SPI_AMD)			+= spi-amd.o
>> +obj-$(CONFIG_SPI_QPIC_SNAND)            += spi-qpic-snand.o
> 
> Please keep this alphabetically sorted (there are some mistakes there
> but no need to add to them).

Ok

> 
>> + * 	Sricharan R <quic_srichara@quicinc.com>
>> + */
>> +
>> +#include <linux/mtd/spinand.h>
>> +#include <linux/mtd/nand-qpic-common.h>
>> +
> 
> This should be including the SPI API, and other API headers that are
> used directly like the platform and clock APIs.
>

Ok

>> +static int qcom_snand_init(struct qcom_nand_controller *snandc)
>> +{
>> +	u32 snand_cfg_val = 0x0;
>> +	int ret;
> 
> ...
> 
>> +	ret = submit_descs(snandc);
>> +	if (ret)
>> +		dev_err(snandc->dev, "failure in sbumitting spiinit descriptor\n");
>> +
>> +	free_descs(snandc);
> 
> This seems to be doing a bit more than I would expect an init function
> to, and it's very surprising to see the descriptors freed immediately
> after something called a submit (which suggests that the descriptors are
> still in flight).
>

Our controller supports only bam mode , that means for writing/reading even
single register we have to use bam.
submit_descs() is synchronous so I/O is complete when it returns.
Hence freeing the descriptor after it.


>> +static int qpic_snand_read_page(struct qcom_nand_controller *snandc,
>> +				const struct spi_mem_op *op)
>> +{
>> +	return 0;
>> +}
>> +
>> +static int qpic_snand_write_page(struct qcom_nand_controller *snandc,
>> +				const struct spi_mem_op *op)
>> +{
>> +	return 0;
>> +}
> 
> ...
> 
>> +static int qpic_snand_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
>> +{
>> +	struct qcom_nand_controller *snandc = spi_controller_get_devdata(mem->spi->master);
>> +	dev_dbg(snandc->dev, "OP %02x ADDR %08llX@%d:%u DATA %d:%u", op->cmd.opcode,
>> +		op->addr.val, op->addr.buswidth, op->addr.nbytes,
>> +		op->data.buswidth, op->data.nbytes);
>> +
>> +	/*
>> +	 * Check for page ops or normal ops
>> +	 */
>> +	if (qpic_snand_is_page_op(op)) {
>> +		if (op->data.dir == SPI_MEM_DATA_IN)
>> +			return qpic_snand_read_page(snandc, op);
>> +		else
>> +			return qpic_snand_write_page(snandc, op);
> 
> So does the device actually support page operations?  The above looks
> like the driver will silently noop them.

Sorry It was to do item and I missed to mention that in commit log.
Will add in V1.

> 
>> +	snandc->base_phys = res->start;
>> +	snandc->base_dma = dma_map_resource(dev, res->start,
>> +					   resource_size(res),
>> +					   DMA_BIDIRECTIONAL, 0);
>> +	if (dma_mapping_error(dev, snandc->base_dma))
>> +		return -ENXIO;
>> +
>> +	ret = clk_prepare_enable(snandc->core_clk);
>> +	if (ret)
>> +		goto err_core_clk;
> 
> The DMA mapping and clock enables only get undone in error handling,
> they're not undone in the normal device release path.

Will fix in V1



  reply	other threads:[~2023-11-03 11:21 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31 12:03 [RFC PATCH 0/5] Add QPIC SPI NAND driver support Md Sadre Alam
2023-10-31 12:03 ` [RFC PATCH 1/5] mtd: nand: ecc-qcom: Add support for ECC Engine Driver Md Sadre Alam
2023-10-31 15:28   ` Miquel Raynal
2023-11-03 12:06     ` Md Sadre Alam
2023-11-03 12:08       ` Krzysztof Kozlowski
2023-11-03 12:11         ` Krzysztof Kozlowski
2023-10-31 17:11   ` Krzysztof Kozlowski
2023-11-03 12:24     ` Md Sadre Alam
2023-11-03 12:33       ` Dmitry Baryshkov
2023-11-03 13:23         ` Md Sadre Alam
2023-11-03 13:46           ` Miquel Raynal
2023-11-20  6:30             ` Md Sadre Alam
2023-11-03 13:54           ` Dmitry Baryshkov
2023-10-31 12:03 ` [RFC PATCH 2/5] arm64: dts: qcom: ipq9574: Add ecc engine support Md Sadre Alam
2023-10-31 15:23   ` Konrad Dybcio
2023-11-03 11:26     ` Md Sadre Alam
2023-10-31 17:12   ` Krzysztof Kozlowski
2023-11-03 12:09     ` Md Sadre Alam
2023-10-31 12:03 ` [RFC PATCH 3/5] mtd: nand: qpic_common: Add support for qpic common API Md Sadre Alam
2023-10-31 15:54   ` Miquel Raynal
2023-10-31 12:03 ` [RFC PATCH 4/5] spi: qpic: Add support for qpic spi nand driver Md Sadre Alam
2023-10-31 14:23   ` Mark Brown
2023-11-03 11:20     ` Md Sadre Alam [this message]
2023-11-03 12:47       ` Mark Brown
2023-11-20  6:34         ` Md Sadre Alam
2023-10-31 17:13   ` Krzysztof Kozlowski
2023-11-03 12:13     ` Md Sadre Alam
2023-11-03 12:18       ` Krzysztof Kozlowski
2023-11-03 12:15     ` Md Sadre Alam
2023-10-31 12:03 ` [RFC PATCH 5/5] arm64: dts: qcom: ipq9574: Add support for SPI nand Md Sadre Alam
2023-10-31 15:27   ` Konrad Dybcio
2023-11-03 11:31     ` Md Sadre Alam
2023-10-31 17:17   ` Krzysztof Kozlowski

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=2b9e943a-198e-7999-b898-e7b2498a9ffa@quicinc.com \
    --to=quic_mdalam@quicinc.com \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=qpic_varada@quicinc.com \
    --cc=quic_srichara@quicinc.com \
    --cc=richard@nod.at \
    --cc=robh+dt@kernel.org \
    --cc=vigneshr@ti.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