nand: davinci: enable driver model for NAND
Subsystems (3)
cover nand: davinci: enable driver model for NAND
From: Bartosz Golaszewski <[email protected]>
This series enables the driver model for NAND on davinci da850 boards.
The first patch is a simple tweak for an unnecessarily exported function.
The second patch extends the NAND driver to support both legacy and driver-model users. For now we don't parse the device-tree as it's a bit complicated on da850, namely: the nand node is a child of the aemif node for which we don't have a driver in u-boot (unlike on linux where the aemif driver populates all its subnodes). In order for the nand device to be probed, we're adding a dummy node to the u-boot dts extensions with an appropriate compatible.
Two last patches enable driver model for NAND on da850-lcdk and da850-evm. We don't enable the driver model in SPL as first: the patches enabling CONFIG_SPL_DM are still waiting to be merged, and second: the nand_spl_simple driver used by davinci SPL doesn't support driver model users. This is planned for future series once some basic support is merged.
Bartosz Golaszewski (4):
nand: davinci: make davinci_nand_init() static
nand: davinci: add support for driver model
davinci: omapl138-lcdk: enable driver model for NAND
davinci: da850-evm: enable driver model for NAND
arch/arm/dts/da850-evm-u-boot.dtsi | 4 ++ arch/arm/dts/da850-lcdk-u-boot.dtsi | 4 ++ arch/arm/include/asm/ti-common/davinci_nand.h | 2 - configs/da850evm_defconfig | 1 + configs/da850evm_direct_nor_defconfig | 1 + configs/da850evm_nand_defconfig | 1 + configs/omapl138_lcdk_defconfig | 1 + drivers/mtd/nand/raw/davinci_nand.c | 48 ++++++++++++++++++- include/configs/da850evm.h | 4 ++ include/configs/omapl138_lcdk.h | 4 ++ 10 files changed, 66 insertions(+), 4 deletions(-)
Signature · 1 line
2.21.0
PATCH 1/4 nand: davinci: make davinci_nand_init() static
From: Bartosz Golaszewski <[email protected]>
This function is only used within the driver itself. No need to export it.
--- arch/arm/include/asm/ti-common/davinci_nand.h | 2 -- drivers/mtd/nand/raw/davinci_nand.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-)
arch/arm/include/asm/ti-common/davinci_nand.h +0 -2
@@ -95,6 +95,4 @@ struct davinci_emif_regs {#define DAVINCI_ABCR_ASIZE_16BIT 1#define DAVINCI_ABCR_ASIZE_8BIT 0 -void davinci_nand_init (struct nand_chip *nand); -#endif
drivers/mtd/nand/raw/davinci_nand.c +1 -1
@@ -730,7 +730,7 @@ static int nand_davinci_dev_ready(struct mtd_info *mtd)return __raw_readl (&davinci_emif_regs->nandfsr) &0x1 ; } -void davinci_nand_init (struct nand_chip *nand) +static void davinci_nand_init (struct nand_chip *nand) {#if definedCONFIG_KEYSTONE_RBL_NAND int i;
Signature · 1 line
2.21.0
PATCH 2/4 nand: davinci: add support for driver model
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Extend the davinci NAND driver to support the driver model. For now this doesn't add any device-tree parsing due to the fact that we can't access the actual nand node on the device-tree - it's a subnode of the aemif device and we don't have an aemif driver on davinci at the moment.
--- drivers/mtd/nand/raw/davinci_nand.c | 46 ++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/davinci_nand.c +45 -1
@@ -31,6 +31,7 @@#include <common.h> #include <asm/io.h> #include <nand.h> +#include <dm/uclass.h> #include <asm/ti-common/davinci_nand.h> /* Definitions for 4-bit hardware ECC */
@@ -785,10 +786,53 @@ static void davinci_nand_init(struct nand_chip *nand) nand->dev_ready = nand_davinci_dev_ready; } -int board_nand_init (struct nand_chip *chip) __attribute__((weak)); +#ifdef CONFIG_SYS_NAND_SELF_INIT +static int davinci_nand_probe (struct udevice *dev) +{ +struct nand_chip *nand =dev_get_priv (dev); +struct mtd_info *mtd =nand_to_mtd (nand); +int ret; + + nand->IO_ADDR_R = (void __iomem *)CONFIG_SYS_NAND_BASE ; + nand->IO_ADDR_W = (void __iomem *)CONFIG_SYS_NAND_BASE ; + +davinci_nand_init (nand); + + ret =nand_scan (mtd,CONFIG_SYS_NAND_MAX_CHIPS ); +if (ret) +return ret; + +return nand_register (0 , mtd); +} + +static const struct udevice_id davinci_nand_ids[] = { + { .compatible ="ti,davinci-nand" }, + { } +}; + +U_BOOT_DRIVER (davinci_nand) = { + .name ="davinci-nand" , + .id =UCLASS_MTD , + .of_match = davinci_nand_ids, + .probe = davinci_nand_probe, + .priv_auto_alloc_size =sizeof (struct nand_chip ), +}; + +void board_nand_init (void ) +{ +struct udevice *dev; +int ret; + ret =uclass_get_device_by_driver (UCLASS_MTD , +DM_GET_DRIVER (davinci_nand), &dev); +if (ret && ret != -ENODEV ) +pr_err ("Failed to initialize %s: %d\n" , dev->name, ret); +} +#else +int board_nand_init (struct nand_chip *chip) __attribute__((weak));int board_nand_init (struct nand_chip *chip) {davinci_nand_init (chip);return 0 ; } +#endif /* CONFIG_SYS_NAND_SELF_INIT */
Signature · 1 line
2.21.0
PATCH 3/4 davinci: omapl138-lcdk: enable driver model for NAND
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Enable the driver-model on da850-lcdk. We need to add a dummy nand node to the device tree, as the real nand node is a sub-node of the aemif device.
On linux the aemif driver populates all its child nodes, but we can't do it in u-boot currently.
--- arch/arm/dts/da850-lcdk-u-boot.dtsi | 4 ++++ configs/omapl138_lcdk_defconfig | 1 + include/configs/omapl138_lcdk.h | 4 ++++ 3 files changed, 9 insertions(+)
arch/arm/dts/da850-lcdk-u-boot.dtsi +4 -0
@@ -9,4 +9,8 @@ aliases { i2c0 = &i2c0; }; + + nand { + compatible = "ti,davinci-nand"; + }; };
configs/omapl138_lcdk_defconfig +1 -0
@@ -39,6 +39,7 @@ CONFIG_DM_I2C=y CONFIG_DM_I2C_COMPAT=y CONFIG_SYS_I2C_DAVINCI=y CONFIG_DM_MMC=y +CONFIG_MTD=y CONFIG_NAND=y CONFIG_NAND_DAVINCI=y CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
include/configs/omapl138_lcdk.h +4 -0
@@ -176,6 +176,10 @@#define CONFIG_SPL_NAND_DRIVERS #define CONFIG_SPL_NAND_ECC #define CONFIG_SPL_NAND_LOAD + +#ifndef CONFIG_SPL_BUILD +#define CONFIG_SYS_NAND_SELF_INIT +#endif #endif #ifdef CONFIG_SYS_USE_NOR
Signature · 1 line
2.21.0
PATCH 4/4 davinci: da850-evm: enable driver model for NAND
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Enable the driver-model on da850-evm. We need to add a dummy nand node to the device tree, as the real nand node is a sub-node of the aemif device.
On linux the aemif driver populates all its child nodes, but we can't do it in u-boot currently.
--- arch/arm/dts/da850-evm-u-boot.dtsi | 4 ++++ configs/da850evm_defconfig | 1 + configs/da850evm_direct_nor_defconfig | 1 + configs/da850evm_nand_defconfig | 1 + include/configs/da850evm.h | 4 ++++ 5 files changed, 11 insertions(+)
arch/arm/dts/da850-evm-u-boot.dtsi +4 -0
@@ -10,6 +10,10 @@ soc at 1c00000 { u-boot,dm-spl; }; + + nand { + compatible = "ti,davinci-nand"; + }; }; &flash {
configs/da850evm_defconfig +1 -0
@@ -52,6 +52,7 @@ CONFIG_DA8XX_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_DAVINCI=y CONFIG_DM_MMC=y +CONFIG_MTD=y CONFIG_MTD_DEVICE=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y
configs/da850evm_direct_nor_defconfig +1 -0
@@ -42,6 +42,7 @@ CONFIG_DA8XX_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_DAVINCI=y # CONFIG_MMC is not set +CONFIG_MTD=y CONFIG_MTD_NOR_FLASH=y CONFIG_FLASH_CFI_DRIVER=y CONFIG_SYS_FLASH_PROTECTION=y
configs/da850evm_nand_defconfig +1 -0
@@ -49,6 +49,7 @@ CONFIG_DM_GPIO=y CONFIG_DA8XX_GPIO=y CONFIG_DM_I2C=y CONFIG_DM_MMC=y +CONFIG_MTD=y CONFIG_NAND=y CONFIG_NAND_DAVINCI=y CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
include/configs/da850evm.h +4 -0
@@ -182,6 +182,10 @@#define CONFIG_SPL_NAND_DRIVERS #define CONFIG_SPL_NAND_ECC #define CONFIG_SPL_NAND_LOAD + +#ifndef CONFIG_SPL_BUILD +#define CONFIG_SYS_NAND_SELF_INIT +#endif #endif /*
Signature · 1 line
2.21.0
PATCH 4/4 davinci: da850-evm: enable driver model for NAND
Quoted 11 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Enable the driver-model on da850-evm. We need to add a dummy nand node to the device tree, as the real nand node is a sub-node of the aemif device.
On linux the aemif driver populates all its child nodes, but we can't do it in u-boot currently.
Signed-off-by Bartosz Golaszewski <[email protected]>
For the whole series...
Quoted 77 lines
--- arch/arm/dts/da850-evm-u-boot.dtsi | 4 ++++ configs/da850evm_defconfig | 1 + configs/da850evm_direct_nor_defconfig | 1 + configs/da850evm_nand_defconfig | 1 + include/configs/da850evm.h | 4 ++++ 5 files changed, 11 insertions(+)arch/arm/dts/da850-evm-u-boot.dtsi +4
-0@@ -10,6 +10,10 @@ soc at 1c00000 { u-boot,dm-spl; }; + + nand { + compatible = "ti,davinci-nand"; + }; }; &flash {configs/da850evm_defconfig +1
-0@@ -52,6 +52,7 @@ CONFIG_DA8XX_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_DAVINCI=y CONFIG_DM_MMC=y +CONFIG_MTD=y CONFIG_MTD_DEVICE=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=yconfigs/da850evm_direct_nor_defconfig +1
-0@@ -42,6 +42,7 @@ CONFIG_DA8XX_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_DAVINCI=y # CONFIG_MMC is not set +CONFIG_MTD=y CONFIG_MTD_NOR_FLASH=y CONFIG_FLASH_CFI_DRIVER=y CONFIG_SYS_FLASH_PROTECTION=yconfigs/da850evm_nand_defconfig +1
-0@@ -49,6 +49,7 @@ CONFIG_DM_GPIO=y CONFIG_DA8XX_GPIO=y CONFIG_DM_I2C=y CONFIG_DM_MMC=y +CONFIG_MTD=y CONFIG_NAND=y CONFIG_NAND_DAVINCI=y CONFIG_SYS_NAND_U_BOOT_LOCATIONS=yinclude/configs/da850evm.h +4
-1@@ -182,6 +182,10 @@#define CONFIG_SPL_NAND_DRIVERS #define CONFIG_SPL_NAND_ECC #define CONFIG_SPL_NAND_LOAD + +#ifndef CONFIG_SPL_BUILD +#define CONFIG_SYS_NAND_SELF_INIT +#endif #endif /* -- 2.21.0
cover nand: davinci: enable driver model for NAND
In reply to Bartosz GolaszewskiQuoted 15 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
This series enables the driver model for NAND on davinci da850 boards.
The first patch is a simple tweak for an unnecessarily exported function.
The second patch extends the NAND driver to support both legacy and driver-model users. For now we don't parse the device-tree as it's a bit complicated on da850, namely: the nand node is a child of the aemif node for which we don't have a driver in u-boot (unlike on linux where the aemif driver populates all its subnodes). In order for the nand device to be probed, we're adding a dummy node to the u-boot dts extensions with an appropriate compatible.
Quoted 6 lines
Two last patches enable driver model for NAND on da850-lcdk and da850-evm. We don't enable the driver model in SPL as first: the patches enabling
CONFIG_SPL_DMare still waiting to be merged, and second: thenand_spl_simpledriver used by davinci SPL doesn't support driver model users. This is planned for future series once some basic support is merged.
What happens when the board is booting SPL from NAND? Will it still work as expected? I know the da850-evm has at least one configuration which this is intended to boot from NAND instead of the default SPI flash.
adam
Quoted 22 lines
Bartosz Golaszewski (4):
nand: davinci: makedavinci_nand_init()static
nand: davinci: add support for driver model
davinci: omapl138-lcdk: enable driver model for NAND
davinci: da850-evm: enable driver model for NANDarch/arm/dts/da850-evm-u-boot.dtsi | 4 ++ arch/arm/dts/da850-lcdk-u-boot.dtsi | 4 ++ arch/arm/include/asm/ti-common/davinci_nand.h | 2 - configs/da850evm_defconfig | 1 + configs/da850evm_direct_nor_defconfig | 1 + configs/da850evm_nand_defconfig | 1 + configs/omapl138_lcdk_defconfig | 1 + drivers/mtd/nand/raw/davinci_nand.c | 48 ++++++++++++++++++- include/configs/da850evm.h | 4 ++ include/configs/omapl138_lcdk.h | 4 ++ 10 files changed, 66 insertions(+), 4 deletions(-)--
2.21.0
cover nand: davinci: enable driver model for NAND
czw., 6 cze 2019 o 17:58 Adam Ford <[email protected]> napisał(a):
Quoted 24 lines · Bartosz Golaszewski
Quoted 15 lines
From: Bartosz Golaszewski <[email protected]>
This series enables the driver model for NAND on davinci da850 boards.
The first patch is a simple tweak for an unnecessarily exported function.
The second patch extends the NAND driver to support both legacy and driver-model users. For now we don't parse the device-tree as it's a bit complicated on da850, namely: the nand node is a child of the aemif node for which we don't have a driver in u-boot (unlike on linux where the aemif driver populates all its subnodes). In order for the nand device to be probed, we're adding a dummy node to the u-boot dts extensions with an appropriate compatible.
Quoted 6 lines
Two last patches enable driver model for NAND on da850-lcdk and da850-evm. We don't enable the driver model in SPL as first: the patches enabling
CONFIG_SPL_DMare still waiting to be merged, and second: thenand_spl_simpledriver used by davinci SPL doesn't support driver model users. This is planned for future series once some basic support is merged.
Quoted 5 lines
What happens when the board is booting SPL from NAND? Will it still work as expected? I know the da850-evm has at least one configuration which this is intended to boot from NAND instead of the default SPI flash.
The driver works just like before in SPL. The support for the driver model is added incrementally. In fact I tested it on da850-lcdk with SPL loading u-boot from NAND.
On da850-evm we could probably enable driver-model in SPL as well for NAND, but I prefer to do it at once for both boards.
Bart
Quoted 24 lines
adam
Quoted 22 lines
Bartosz Golaszewski (4):
nand: davinci: makedavinci_nand_init()static
nand: davinci: add support for driver model
davinci: omapl138-lcdk: enable driver model for NAND
davinci: da850-evm: enable driver model for NANDarch/arm/dts/da850-evm-u-boot.dtsi | 4 ++ arch/arm/dts/da850-lcdk-u-boot.dtsi | 4 ++ arch/arm/include/asm/ti-common/davinci_nand.h | 2 - configs/da850evm_defconfig | 1 + configs/da850evm_direct_nor_defconfig | 1 + configs/da850evm_nand_defconfig | 1 + configs/omapl138_lcdk_defconfig | 1 + drivers/mtd/nand/raw/davinci_nand.c | 48 ++++++++++++++++++- include/configs/da850evm.h | 4 ++ include/configs/omapl138_lcdk.h | 4 ++ 10 files changed, 66 insertions(+), 4 deletions(-)--
2.21.0
cover nand: davinci: enable driver model for NAND
pt., 7 cze 2019 o 10:16 Bartosz Golaszewski <[email protected]> napisał(a):
Quoted 32 lines
czw., 6 cze 2019 o 17:58 Adam Ford <[email protected]> napisał(a):
Quoted 24 lines · Bartosz Golaszewski
Quoted 15 lines
From: Bartosz Golaszewski <[email protected]>
This series enables the driver model for NAND on davinci da850 boards.
The first patch is a simple tweak for an unnecessarily exported function.
The second patch extends the NAND driver to support both legacy and driver-model users. For now we don't parse the device-tree as it's a bit complicated on da850, namely: the nand node is a child of the aemif node for which we don't have a driver in u-boot (unlike on linux where the aemif driver populates all its subnodes). In order for the nand device to be probed, we're adding a dummy node to the u-boot dts extensions with an appropriate compatible.
Quoted 6 lines
Two last patches enable driver model for NAND on da850-lcdk and da850-evm. We don't enable the driver model in SPL as first: the patches enabling
CONFIG_SPL_DMare still waiting to be merged, and second: thenand_spl_simpledriver used by davinci SPL doesn't support driver model users. This is planned for future series once some basic support is merged.Quoted 5 lines
What happens when the board is booting SPL from NAND? Will it still work as expected? I know the da850-evm has at least one configuration which this is intended to boot from NAND instead of the default SPI flash.
Quoted 33 lines
The driver works just like before in SPL. The support for the driver model is added incrementally. In fact I tested it on da850-lcdk with SPL loading u-boot from NAND.
On da850-evm we could probably enable driver-model in SPL as well for NAND, but I prefer to do it at once for both boards.
Bart
Quoted 24 lines
adam
Quoted 22 lines
Bartosz Golaszewski (4):
nand: davinci: makedavinci_nand_init()static
nand: davinci: add support for driver model
davinci: omapl138-lcdk: enable driver model for NAND
davinci: da850-evm: enable driver model for NANDarch/arm/dts/da850-evm-u-boot.dtsi | 4 ++ arch/arm/dts/da850-lcdk-u-boot.dtsi | 4 ++ arch/arm/include/asm/ti-common/davinci_nand.h | 2 - configs/da850evm_defconfig | 1 + configs/da850evm_direct_nor_defconfig | 1 + configs/da850evm_nand_defconfig | 1 + configs/omapl138_lcdk_defconfig | 1 + drivers/mtd/nand/raw/davinci_nand.c | 48 ++++++++++++++++++- include/configs/da850evm.h | 4 ++ include/configs/omapl138_lcdk.h | 4 ++ 10 files changed, 66 insertions(+), 4 deletions(-)--
2.21.0
Hi Tom,
can you pick up this series?
Bart
cover nand: davinci: enable driver model for NAND
Quoted 63 lines · Bartosz Golaszewski
pt., 7 cze 2019 o 10:16 Bartosz Golaszewski <[email protected]> napisał(a):
Quoted 62 lines
czw., 6 cze 2019 o 17:58 Adam Ford <[email protected]> napisał(a):
Quoted 24 lines · Bartosz Golaszewski
Quoted 15 lines
From: Bartosz Golaszewski <[email protected]>
This series enables the driver model for NAND on davinci da850 boards.
The first patch is a simple tweak for an unnecessarily exported function.
The second patch extends the NAND driver to support both legacy and driver-model users. For now we don't parse the device-tree as it's a bit complicated on da850, namely: the nand node is a child of the aemif node for which we don't have a driver in u-boot (unlike on linux where the aemif driver populates all its subnodes). In order for the nand device to be probed, we're adding a dummy node to the u-boot dts extensions with an appropriate compatible.
Quoted 6 lines
Two last patches enable driver model for NAND on da850-lcdk and da850-evm. We don't enable the driver model in SPL as first: the patches enabling
CONFIG_SPL_DMare still waiting to be merged, and second: thenand_spl_simpledriver used by davinci SPL doesn't support driver model users. This is planned for future series once some basic support is merged.Quoted 5 lines
What happens when the board is booting SPL from NAND? Will it still work as expected? I know the da850-evm has at least one configuration which this is intended to boot from NAND instead of the default SPI flash.
The driver works just like before in SPL. The support for the driver model is added incrementally. In fact I tested it on da850-lcdk with SPL loading u-boot from NAND.
On da850-evm we could probably enable driver-model in SPL as well for NAND, but I prefer to do it at once for both boards.
Bart
Quoted 21 lines
adam
Quoted 19 lines
Bartosz Golaszewski (4):
nand: davinci: makedavinci_nand_init()static
nand: davinci: add support for driver model
davinci: omapl138-lcdk: enable driver model for NAND
davinci: da850-evm: enable driver model for NANDarch/arm/dts/da850-evm-u-boot.dtsi | 4 ++ arch/arm/dts/da850-lcdk-u-boot.dtsi | 4 ++ arch/arm/include/asm/ti-common/davinci_nand.h | 2 - configs/da850evm_defconfig | 1 + configs/da850evm_direct_nor_defconfig | 1 + configs/da850evm_nand_defconfig | 1 + configs/omapl138_lcdk_defconfig | 1 + drivers/mtd/nand/raw/davinci_nand.c | 48 ++++++++++++++++++- include/configs/da850evm.h | 4 ++ include/configs/omapl138_lcdk.h | 4 ++ 10 files changed, 66 insertions(+), 4 deletions(-)
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
--
2.21.0Hi Tom,
can you pick up this series?
Post-release, yes, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190703/440bc541/attachment.sig>