Re: [PATCH 3/5] spi: spi-qpic: Add qpic spi nand driver support

From: Md Sadre Alam
Date: Wed Feb 21 2024 - 05:36:58 EST




On 2/20/2024 9:34 PM, Mark Brown wrote:
On Tue, Feb 20, 2024 at 05:24:43PM +0530, Md Sadre Alam wrote:
On 2/15/2024 7:44 PM, Mark Brown wrote:
On Thu, Feb 15, 2024 at 07:18:54PM +0530, Md Sadre Alam wrote:

+ if (op->cmd.opcode == SPINAND_READID) {
+ snandc->buf_count = 4;
+ read_reg_dma(snandc, NAND_READ_ID, 1, NAND_BAM_NEXT_SGL);
+
+ ret = submit_descs(snandc);
+ if (ret)
+ dev_err(snandc->dev, "failure in submitting descriptor for readid\n");
+
+ nandc_read_buffer_sync(snandc, true);
+ memcpy(op->data.buf.in, snandc->reg_read_buf, snandc->buf_count);

These memcpy()s don't seem great, why aren't we just reading directly
into the output buffer?

This reg_read_buf is being used in common API so that it will be used by both
serial nand as well raw nand, so I can't directly use the output buffer since
internally CW mechanism I have to maintain in common API.

We have control over all the source code in the kernel so if there's
problems with the internal interfaces we can improve them.

Ok , will try to maintain CW mechanism uniform and remove from common API
and move to corresponding driver. Will try to fix in next patch.