diff mbox series

[v1,1/3] mtd: nand: raw: rockchip_nfc: add NAND_SKIP_BBTSCAN option

Message ID 58111810-f29d-ee4b-dbc3-3b30864f2a95@gmail.com
State Superseded
Delegated to: Dario Binacchi
Headers show
Series Add rockmtd command | expand

Commit Message

Johan Jonker Aug. 24, 2023, 1:28 p.m. UTC
On Rockchip SoCs the first boot stages are written on NAND
with help of manufacturer software that uses a different format
then the MTD framework. Skip the automatic BBT scan with the
NAND_SKIP_BBTSCAN option to be able to pass the driver probe
function and to let the original data unchanged.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---
 drivers/mtd/nand/raw/Kconfig        | 9 +++++++++
 drivers/mtd/nand/raw/rockchip_nfc.c | 3 +++
 2 files changed, 12 insertions(+)

--
2.30.2

Comments

Kever Yang Sept. 28, 2023, 3:04 a.m. UTC | #1
On 2023/8/24 21:28, Johan Jonker wrote:
> On Rockchip SoCs the first boot stages are written on NAND
> with help of manufacturer software that uses a different format
> then the MTD framework. Skip the automatic BBT scan with the
> NAND_SKIP_BBTSCAN option to be able to pass the driver probe
> function and to let the original data unchanged.
>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>   drivers/mtd/nand/raw/Kconfig        | 9 +++++++++
>   drivers/mtd/nand/raw/rockchip_nfc.c | 3 +++
>   2 files changed, 12 insertions(+)
>
> diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
> index d624589a892b..72547f00fbec 100644
> --- a/drivers/mtd/nand/raw/Kconfig
> +++ b/drivers/mtd/nand/raw/Kconfig
> @@ -611,6 +611,15 @@ config ROCKCHIP_NAND
>   	    NFC v800: RK3308, RV1108
>   	    NFC v900: PX30, RK3326
>
> +config ROCKCHIP_NAND_SKIP_BBTSCAN
> +	bool "Skip the automatic BBT scan with Rockchip NAND controllers"
> +	depends on ROCKCHIP_NAND
> +	default n
> +	help
> +	  Skip the automatic BBT scan with the NAND_SKIP_BBTSCAN
> +	  option when data content is not in MTD format or
> +	  must remain unchanged.
> +
>   config TEGRA_NAND
>   	bool "Support for NAND controller on Tegra SoCs"
>   	depends on ARCH_TEGRA
> diff --git a/drivers/mtd/nand/raw/rockchip_nfc.c b/drivers/mtd/nand/raw/rockchip_nfc.c
> index 6ad51df4acff..df6742c2f9bb 100644
> --- a/drivers/mtd/nand/raw/rockchip_nfc.c
> +++ b/drivers/mtd/nand/raw/rockchip_nfc.c
> @@ -981,6 +981,9 @@ static int rk_nfc_nand_chip_init(ofnode node, struct rk_nfc *nfc, int devnum)
>   	chip->bbt_options = NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB;
>   	chip->options |= NAND_NO_SUBPAGE_WRITE | NAND_USE_BOUNCE_BUFFER;
>
> +	if (IS_ENABLED(CONFIG_ROCKCHIP_NAND_SKIP_BBTSCAN))
> +		chip->options |= NAND_SKIP_BBTSCAN;
> +
>   	rk_nfc_hw_init(nfc);
>   	ret = nand_scan_ident(mtd, nsels, NULL);
>   	if (ret)
> --
> 2.30.2
>
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index d624589a892b..72547f00fbec 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -611,6 +611,15 @@  config ROCKCHIP_NAND
 	    NFC v800: RK3308, RV1108
 	    NFC v900: PX30, RK3326

+config ROCKCHIP_NAND_SKIP_BBTSCAN
+	bool "Skip the automatic BBT scan with Rockchip NAND controllers"
+	depends on ROCKCHIP_NAND
+	default n
+	help
+	  Skip the automatic BBT scan with the NAND_SKIP_BBTSCAN
+	  option when data content is not in MTD format or
+	  must remain unchanged.
+
 config TEGRA_NAND
 	bool "Support for NAND controller on Tegra SoCs"
 	depends on ARCH_TEGRA
diff --git a/drivers/mtd/nand/raw/rockchip_nfc.c b/drivers/mtd/nand/raw/rockchip_nfc.c
index 6ad51df4acff..df6742c2f9bb 100644
--- a/drivers/mtd/nand/raw/rockchip_nfc.c
+++ b/drivers/mtd/nand/raw/rockchip_nfc.c
@@ -981,6 +981,9 @@  static int rk_nfc_nand_chip_init(ofnode node, struct rk_nfc *nfc, int devnum)
 	chip->bbt_options = NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB;
 	chip->options |= NAND_NO_SUBPAGE_WRITE | NAND_USE_BOUNCE_BUFFER;

+	if (IS_ENABLED(CONFIG_ROCKCHIP_NAND_SKIP_BBTSCAN))
+		chip->options |= NAND_SKIP_BBTSCAN;
+
 	rk_nfc_hw_init(nfc);
 	ret = nand_scan_ident(mtd, nsels, NULL);
 	if (ret)