public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Cc: Ray Liu <ray.liu@airoha.com>, Mark Brown <broonie@kernel.org>,
	Jyothi Kumar Seerapu <quic_jseerapu@quicinc.com>,
	linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 07/13] spi: airoha: fix reading/writing of flashes with more than one plane per lun
Date: Sat, 23 Aug 2025 10:36:20 +0200	[thread overview]
Message-ID: <aKl9hOx2hcZUfg-k@lore-rh-laptop> (raw)
In-Reply-To: <20250823001626.3641935-8-mikhail.kshevetskiy@iopsys.eu>

[-- Attachment #1: Type: text/plain, Size: 3279 bytes --]

> Reading UBI on the flash with more than one plane per lun will lead to
> the following error:
> 
> ubi0: default fastmap WL pool size: 50
> ubi0: attaching mtd2
> ubi0 error: ubi_add_to_av: two LEBs with same sequence number 403
> eraseblock attaching information dump:
>         ec       1
>         pnum     538
>         lnum     0
>         scrub    0
>         sqnum    403
> Volume identifier header dump:
>         magic     55424921
>         version   1
>         vol_type  1
>         copy_flag 0
>         compat    0
>         vol_id    1
>         lnum      0
>         data_size 0
>         used_ebs  0
>         data_pad  0
>         sqnum     403
>         hdr_crc   c8418a31
> Volume identifier header hexdump:
> 00000000: 55 42 49 21 01 01 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  UBI!............................
> 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 93 00 00 00 00 00 00 00 00 00 00 00 00 c8 41 8a 31  .............................A.1
> ubi0 error: ubi_attach_mtd_dev: failed to attach mtd2, error -22
> UBI error: cannot attach mtd2
> UBI error: cannot initialize UBI, error -22
> UBI init error 22
> 
> looking to spi_mem_no_dirmap_read() code we'll see:
> 
> 	static ssize_t spi_mem_no_dirmap_read(struct spi_mem_dirmap_desc *desc,
> 					      u64 offs, size_t len, void *buf)
> 	{
> 		struct spi_mem_op op = desc->info.op_tmpl;
> 		int ret;
> 
> // --- see here ---
> 		op.addr.val = desc->info.offset + offs;
> //-----------------
> 		op.data.buf.in = buf;
> 		op.data.nbytes = len;
> 		ret = spi_mem_adjust_op_size(desc->mem, &op);
> 		if (ret)
> 		return ret;
> 
> 		ret = spi_mem_exec_op(desc->mem, &op);
> 		if (ret)
> 			return ret;
> 
> 		return op.data.nbytes;
> 	}
> 
> The similar happens for spi_mem_no_dirmap_write(). Thus spi read address should
> take in the account the desc->info.offset.
> 
> Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>

Missing Fixes tag.

Regards,
Lorenzo

> ---
>  drivers/spi/spi-airoha-snfi.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/spi-airoha-snfi.c b/drivers/spi/spi-airoha-snfi.c
> index 3431a9c84679..df2d3d717c00 100644
> --- a/drivers/spi/spi-airoha-snfi.c
> +++ b/drivers/spi/spi-airoha-snfi.c
> @@ -727,8 +727,9 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc,
>  	if (err)
>  		goto error_dma_unmap;
>  
> -	/* set read addr */
> -	err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_RD_CTL3, 0x0);
> +	/* set read addr: zero page offset + descriptor read offset */
> +	err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_RD_CTL3,
> +			   desc->info.offset);
>  	if (err)
>  		goto error_dma_unmap;
>  
> @@ -872,7 +873,9 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
>  	if (err)
>  		goto error_dma_unmap;
>  
> -	err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_PG_CTL2, 0x0);
> +	/* set write addr: zero page offset + descriptor write offset */
> +	err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_PG_CTL2,
> +			   desc->info.offset);
>  	if (err)
>  		goto error_dma_unmap;
>  
> -- 
> 2.50.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2025-08-23 10:19 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20 12:33 [PATCH v3 00/14] spi: airoha: driver fixes & improvements Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 01/14] spi: airoha: return an error for continuous mode dirmap creation cases Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 02/14] spi: airoha: remove unnecessary restriction length Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 03/14] spi: airoha: add support of dual/quad wires spi modes Mikhail Kshevetskiy
2025-08-20 12:48   ` Jyothi Kumar Seerapu
2025-08-20 12:33 ` [PATCH v3 04/14] spi: airoha: remove unnecessary switch to non-dma mode Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 05/14] spi: airoha: unify dirmap read/write code Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 06/14] spi: airoha: switch back to non-dma mode in the case of error Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 07/14] spi: airoha: fix reading/writing of flashes with more than one plane per lun Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 08/14] spi: airoha: support of dualio/quadio flash reading commands Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 09/14] spi: airoha: allow reading/writing of oob area Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 10/14] spi: airoha: buffer must be 0xff-ed before writing Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 11/14] spi: airoha: avoid setting of page/oob sizes in REG_SPI_NFI_PAGEFMT Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 12/14] spi: airoha: reduce the number of modification of REG_SPI_NFI_CNFG and REG_SPI_NFI_SECCUS_SIZE registers Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 13/14] spi: airoha: set custom sector size equal to flash page size Mikhail Kshevetskiy
2025-08-20 12:33 ` [PATCH v3 14/14] spi: airoha: avoid reading flash page settings from SNFI registers during driver startup Mikhail Kshevetskiy
2025-08-21  6:58 ` [PATCH v3 00/14] spi: airoha: driver fixes & improvements Lorenzo Bianconi
2025-08-21 11:13   ` Mikhail Kshevetskiy
2025-08-21 11:34     ` Lorenzo Bianconi
2025-08-21 12:24       ` Mikhail Kshevetskiy
2025-08-22  3:31       ` Mikhail Kshevetskiy
2025-08-22  6:46         ` Lorenzo Bianconi
2025-08-22 11:22           ` Mikhail Kshevetskiy
2025-08-22 13:14             ` Lorenzo Bianconi
2025-08-22 14:36               ` Mikhail Kshevetskiy
2025-08-22 20:00               ` Mikhail Kshevetskiy
2025-08-22 11:27           ` Mikhail Kshevetskiy
2025-08-23  0:16           ` [PATCH v4 00/13] " Mikhail Kshevetskiy
2025-08-23  0:16             ` [PATCH v4 01/13] spi: airoha: return an error for continuous mode dirmap creation cases Mikhail Kshevetskiy
2025-08-23  8:04               ` Lorenzo Bianconi
2025-08-23 13:52                 ` Mikhail Kshevetskiy
2025-08-23  0:16             ` [PATCH v4 02/13] spi: airoha: remove unnecessary restriction length Mikhail Kshevetskiy
2025-08-23  0:16             ` [PATCH v4 03/13] spi: airoha: add support of dual/quad wires spi modes Mikhail Kshevetskiy
2025-08-23  8:16               ` Lorenzo Bianconi
2025-08-23 13:54                 ` Mikhail Kshevetskiy
2025-08-23 14:42                   ` Lorenzo Bianconi
2025-08-23  0:16             ` [PATCH v4 04/13] spi: airoha: remove unnecessary switch to non-dma mode Mikhail Kshevetskiy
2025-08-23  8:29               ` Lorenzo Bianconi
2025-08-23  0:16             ` [PATCH v4 05/13] spi: airoha: unify dirmap read/write code Mikhail Kshevetskiy
2025-08-23  0:16             ` [PATCH v4 06/13] spi: airoha: switch back to non-dma mode in the case of error Mikhail Kshevetskiy
2025-08-23  8:34               ` Lorenzo Bianconi
2025-08-23  0:16             ` [PATCH v4 07/13] spi: airoha: fix reading/writing of flashes with more than one plane per lun Mikhail Kshevetskiy
2025-08-23  8:36               ` Lorenzo Bianconi [this message]
2025-08-23  0:16             ` [PATCH v4 08/13] spi: airoha: support of dualio/quadio flash reading commands Mikhail Kshevetskiy
2025-08-23  0:16             ` [PATCH v4 09/13] spi: airoha: avoid setting of page/oob sizes in REG_SPI_NFI_PAGEFMT Mikhail Kshevetskiy
2025-08-23  0:16             ` [PATCH v4 10/13] spi: airoha: reduce the number of modification of REG_SPI_NFI_CNFG and REG_SPI_NFI_SECCUS_SIZE registers Mikhail Kshevetskiy
2025-08-23  0:16             ` [PATCH v4 11/13] spi: airoha: set custom sector size equal to flash page size Mikhail Kshevetskiy
2025-08-23  0:16             ` [PATCH v4 12/13] spi: airoha: avoid reading flash page settings from SNFI registers during driver startup Mikhail Kshevetskiy
2025-08-23  0:16             ` [PATCH v4 13/13] spi: airoha: buffer must be 0xff-ed before writing Mikhail Kshevetskiy
2025-08-23 16:01             ` [PATCH v5 00/13] spi: airoha: driver fixes & improvements Mikhail Kshevetskiy
2025-08-23 16:01               ` [PATCH v5 01/13] spi: airoha: return an error for continuous mode dirmap creation cases Mikhail Kshevetskiy
2025-08-23 16:01               ` [PATCH v5 02/13] spi: airoha: remove unnecessary restriction length Mikhail Kshevetskiy
2025-08-23 16:01               ` [PATCH v5 03/13] spi: airoha: add support of dual/quad wires spi modes to exec_op() handler Mikhail Kshevetskiy
2025-08-23 16:01               ` [PATCH v5 04/13] spi: airoha: remove unnecessary switch to non-dma mode Mikhail Kshevetskiy
2025-08-23 16:01               ` [PATCH v5 05/13] spi: airoha: switch back to non-dma mode in the case of error Mikhail Kshevetskiy
2025-08-23 16:01               ` [PATCH v5 06/13] spi: airoha: fix reading/writing of flashes with more than one plane per lun Mikhail Kshevetskiy
2025-08-23 16:01               ` [PATCH v5 07/13] spi: airoha: unify dirmap read/write code Mikhail Kshevetskiy
2025-08-23 16:01               ` [PATCH v5 08/13] spi: airoha: support of dualio/quadio flash reading commands Mikhail Kshevetskiy
2025-08-23 16:01               ` [PATCH v5 09/13] spi: airoha: avoid setting of page/oob sizes in REG_SPI_NFI_PAGEFMT Mikhail Kshevetskiy
2025-08-23 16:01               ` [PATCH v5 10/13] spi: airoha: reduce the number of modification of REG_SPI_NFI_CNFG and REG_SPI_NFI_SECCUS_SIZE registers Mikhail Kshevetskiy
2025-08-23 16:01               ` [PATCH v5 11/13] spi: airoha: set custom sector size equal to flash page size Mikhail Kshevetskiy
2025-08-23 16:01               ` [PATCH v5 12/13] spi: airoha: avoid reading flash page settings from SNFI registers during driver startup Mikhail Kshevetskiy
2025-08-23 16:01               ` [PATCH v5 13/13] spi: airoha: buffer must be 0xff-ed before writing Mikhail Kshevetskiy
2025-08-29  7:14               ` [PATCH v5 00/13] spi: airoha: driver fixes & improvements Mikhail Kshevetskiy
2025-08-29  8:45                 ` Mark Brown

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=aKl9hOx2hcZUfg-k@lore-rh-laptop \
    --to=lorenzo@kernel.org \
    --cc=broonie@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mikhail.kshevetskiy@iopsys.eu \
    --cc=quic_jseerapu@quicinc.com \
    --cc=ray.liu@airoha.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