[PATCH 09/24] mtd: rawnand: sunxi: cosmetic: move USER_DATA register offset in SoC caps

Andre Przywara andre.przywara at arm.com
Sat Oct 18 01:10:50 CEST 2025


Hi,

On 16/10/2025 15:27, Richard Genoud wrote:
> USER_DATA register offset moved in H616, so let's make it a SoC cap
> 
> Signed-off-by: Richard Genoud <richard.genoud at bootlin.com>

The pattern looks familiar by now ;-)

Reviewed-by: Andre Przywara <andre.przywara at arm.com>

Cheers,
Andre

> ---
>   drivers/mtd/nand/raw/sunxi_nand.c | 7 ++++---
>   drivers/mtd/nand/raw/sunxi_nand.h | 5 ++++-
>   2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
> index 359f6cdda08a..64a0db37f3f0 100644
> --- a/drivers/mtd/nand/raw/sunxi_nand.c
> +++ b/drivers/mtd/nand/raw/sunxi_nand.c
> @@ -767,7 +767,7 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct mtd_info *mtd,
>   		 * Retrieve the corrected OOB bytes.
>   		 */
>   		sunxi_nfc_user_data_to_buf(readl(nfc->regs +
> -						 NFC_REG_USER_DATA(0)),
> +						 NFC_REG_USER_DATA(nfc, 0)),
>   					   oob);
>   
>   		/* De-randomize the Bad Block Marker. */
> @@ -838,10 +838,10 @@ static int sunxi_nfc_hw_ecc_write_chunk(struct mtd_info *mtd,
>   		memcpy(user_data, oob, 4);
>   		sunxi_nfc_randomize_bbm(mtd, page, user_data);
>   		writel(sunxi_nfc_buf_to_user_data(user_data),
> -		       nfc->regs + NFC_REG_USER_DATA(0));
> +		       nfc->regs + NFC_REG_USER_DATA(nfc, 0));
>   	} else {
>   		writel(sunxi_nfc_buf_to_user_data(oob),
> -		       nfc->regs + NFC_REG_USER_DATA(0));
> +		       nfc->regs + NFC_REG_USER_DATA(nfc, 0));
>   	}
>   
>   	if (data_off + ecc->size != oob_off)
> @@ -1714,6 +1714,7 @@ static int sunxi_nand_probe(struct udevice *dev)
>   static const struct sunxi_nfc_caps sunxi_nfc_a10_caps = {
>   	.nstrengths = 9,
>   	.reg_ecc_err_cnt = NFC_REG_A10_ECC_ERR_CNT,
> +	.reg_user_data = NFC_REG_A10_USER_DATA,
>   };
>   
>   static const struct udevice_id sunxi_nand_ids[] = {
> diff --git a/drivers/mtd/nand/raw/sunxi_nand.h b/drivers/mtd/nand/raw/sunxi_nand.h
> index b961f2ef3bf2..1977d1bd8eaf 100644
> --- a/drivers/mtd/nand/raw/sunxi_nand.h
> +++ b/drivers/mtd/nand/raw/sunxi_nand.h
> @@ -43,7 +43,8 @@
>   #define NFC_REG_DEBUG		0x003C
>   #define NFC_REG_A10_ECC_ERR_CNT	0x0040
>   #define NFC_REG_ECC_ERR_CNT(nfc, x)	(((nfc)->caps->reg_ecc_err_cnt + (x)) & ~0x3)
> -#define NFC_REG_USER_DATA(x)	(0x0050 + ((x) * 4))
> +#define NFC_REG_A10_USER_DATA	0x0050
> +#define NFC_REG_USER_DATA(nfc, x)	((nfc)->caps->reg_user_data + ((x) * 4))
>   #define NFC_REG_SPARE_AREA	0x00A0
>   #define NFC_REG_PAT_ID		0x00A4
>   #define NFC_RAM0_BASE		0x0400
> @@ -160,10 +161,12 @@
>    *
>    * @nstrengths:		Number of element of ECC strengths array
>    * @reg_ecc_err_cnt:	ECC error counter register
> + * @reg_user_data:	User data register
>    */
>   struct sunxi_nfc_caps {
>   	unsigned int nstrengths;
>   	unsigned int reg_ecc_err_cnt;
> +	unsigned int reg_user_data;
>   };
>   
>   #endif



More information about the U-Boot mailing list