device model bringup of nand on am335x gp evm and am437x gp evm
Subsystems (2)
cover device model bringup of nand on am335x gp evm and am437x gp evm
This patch seires adds nand uclass driver and enables omap_gpmc to adopt driver model. This has been tested on AM335x GP EVM and AM437x GP EVM (logs [1]).
Also pushed a branch for testing [2]
[1]: http://pastebin.ubuntu.com/15575957/
[2]: git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-nand
Mugunthan V N (9):
include: nand: move endif to end of file
cmd: nand: abstract global variable usage for dm conversion
drivers: nand: Kconfig: add NAND as Kconfig option
drivers: nand: implement a NAND uclass
drivers: nand: omap_gpmc: convert driver to adopt driver model
am43xx_evm: nand: do not define DM_NAND for spl
defconfig: am437x_gp_evm: enable NAND driver model
am335x_evm: nand: do not define DM_NAND for spl
defconfig: am335x_gp_evm: enable NAND driver model
cmd/nand.c | 72 +++++++------- configs/am335x_gp_evm_defconfig | 2 + configs/am437x_gp_evm_defconfig | 2 + drivers/mtd/nand/Kconfig | 22 ++++- drivers/mtd/nand/Makefile | 2 + drivers/mtd/nand/nand-uclass.c | 62 ++++++++++++ drivers/mtd/nand/nand.c | 14 ++- drivers/mtd/nand/omap_gpmc.c | 205 ++++++++++++++++++++++++++++++++++++++++ include/configs/am335x_evm.h | 1 + include/configs/am43xx_evm.h | 1 + include/dm/uclass-id.h | 1 + include/nand.h | 27 +++++- 12 files changed, 370 insertions(+), 41 deletions(-) create mode 100644 drivers/mtd/nand/nand-uclass.c
Signature · 1 line
2.8.0.rc3.9.g44915db
PATCH 1/9 include: nand: move endif to end of file
The terminator endif of ifdef _NAND_H_ should be at the end of file as a fail safe.
--- include/nand.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/nand.h +2 -2
@@ -127,8 +127,6 @@ void board_nand_select_device(struct nand_chip *nand, int chip); __attribute__((noreturn))void nand_boot (void ); -#endif -#ifdef CONFIG_ENV_OFFSET_OOB #define ENV_OOB_MARKER 0x30425645/*"EVB0" in little-endian -- offset is stored as block number*/
@@ -138,3 +136,5 @@ __attribute__((noreturn)) void nand_boot(void);int get_nand_env_oob (nand_info_t *nand,unsigned long *result);#endif int spl_nand_erase_one (int block,int page); + +#endif /* _NAND_H_ */
Signature · 1 line
2.8.0.rc3.9.g44915db
PATCH 1/9 include: nand: move endif to end of file
Quoted 4 lines · Mugunthan V N
The terminator endif of ifdef _NAND_H_ should be at the end of file as a fail safe.
Signed-off-by Mugunthan V N <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160401/a5cf5e7b/attachment.sig>
PATCH 1/9 include: nand: move endif to end of file
In reply to Mugunthan V NQuoted 7 lines · Mugunthan V N
The terminator endif of ifdef _NAND_H_ should be at the end of file as a fail safe.
Signed-off-by Mugunthan V N <[email protected]>--- include/nand.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
PATCH 2/9 cmd: nand: abstract global variable usage for dm conversion
In reply to Mugunthan V Nnand_info is used all over the file so abstract it with get_nand_dev_by_index() which will help for DM conversion.
--- cmd/nand.c | 72 ++++++++++++++++++++++++++----------------------- drivers/mtd/nand/nand.c | 8 ++++-- include/nand.h | 18 +++++++++++++ 3 files changed, 62 insertions(+), 36 deletions(-)
cmd/nand.c +38 -34
@@ -114,21 +114,20 @@ free_dat:static int set_dev (int dev) { -if (dev <0 || dev >=CONFIG_SYS_MAX_NAND_DEVICE || - !nand_info[dev].name) { -puts ("No such device\n" ); -return -1 ; - } +nand_info_t *nand =get_nand_dev_by_index (dev); + +if (!nand) +return -ENODEV ;if (nand_curr_device == dev)return 0 ; -printf ("Device %d: %s" , dev, nand_info[dev].name); +printf ("Device %d: %s" , dev, nand->name);puts ("... is now current device\n" ); nand_curr_device = dev;#ifdef CONFIG_SYS_NAND_SELECT_DEVICE -board_nand_select_device (nand_info[dev].priv, dev); +board_nand_select_device (nand->priv, dev);#endif return 0 ;
@@ -188,7 +187,7 @@ int do_nand_env_oob(cmd_tbl_t *cmdtp, int argc, char *const argv[]) {int ret;uint32_t oob_buf[ENV_OFFSET_SIZE /sizeof (uint32_t )]; -nand_info_t *nand = &nand_info[0 ]; +nand_info_t *nand =get_nand_dev_by_index (0 );char *cmd = argv[1 ];if (CONFIG_SYS_MAX_NAND_DEVICE ==0 || !nand->name) {
@@ -213,9 +212,10 @@ int do_nand_env_oob(cmd_tbl_t *cmdtp, int argc, char *const argv[])if (argc <3 ) goto usage; + nand =get_nand_dev_by_index (idx);/* We don't care about size, or maxsize. */ if (mtd_arg_off (argv[2 ], &idx, &addr, &maxsize, &maxsize, -MTD_DEV_TYPE_NAND , nand_info[idx].size)) { +MTD_DEV_TYPE_NAND , nand->size)) {puts ("Offset or partition name expected\n" );return 1 ; }
@@ -283,9 +283,14 @@ usage:static void nand_print_and_set_info (int idx) { -nand_info_t *nand = &nand_info[idx]; -struct nand_chip *chip = nand->priv; +nand_info_t *nand; +struct nand_chip *chip; + nand =get_nand_dev_by_index (idx); +if (!nand) +return ; + + chip = nand->priv;printf ("Device %d: " , idx);if (chip->numchips >1 )printf ("%dx " , chip->numchips);
@@ -348,7 +353,7 @@ static void adjust_size_for_badblocks(loff_t *size, loff_t offset, int dev)/* We grab the nand info object here fresh because this is usually * called after arg_off_size() which can change the value of dev. */ -nand_info_t *nand = &nand_info[dev]; +nand_info_t *nand =get_nand_dev_by_index (dev);loff_t maxoffset = offset + *size;int badblocks =0 ;
@@ -397,10 +402,8 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])if (strcmp (cmd,"info" ) ==0 ) {putc ('\n' ); -for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) { -if (nand_info[i].name) -nand_print_and_set_info (i); - } +for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) +nand_print_and_set_info (i);return 0 ; }
@@ -432,12 +435,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])* one before these commands can run, even if a partition specifier * for another device is to be used. */ -if (dev <0 || dev >=CONFIG_SYS_MAX_NAND_DEVICE || - !nand_info[dev].name) { -puts ("\nno devices available\n" ); -return 1 ; - } - nand = &nand_info[dev]; + nand =get_nand_dev_by_index (dev);if (strcmp (cmd,"bad" ) ==0 ) {printf ("\nDevice %d bad blocks:\n" , dev);
@@ -496,13 +494,13 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])/* skip first two or three arguments, look for offset and size */ if (mtd_arg_off_size (argc - o, argv + o, &dev, &off, &size, &maxsize,MTD_DEV_TYPE_NAND , - nand_info[dev].size) !=0 ) + nand->size) !=0 )return 1 ;if (set_dev (dev))return 1 ; - nand = &nand_info[dev]; + nand =get_nand_dev_by_index (dev);memset (&opts,0 ,sizeof (opts)); opts.offset = off;
@@ -561,13 +559,13 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])if (mtd_arg_off (argv[3 ], &dev, &off, &size, &maxsize,MTD_DEV_TYPE_NAND , - nand_info[dev].size)) + nand->size))return 1 ;if (set_dev (dev))return 1 ; - nand = &nand_info[dev]; + nand =get_nand_dev_by_index (dev);if (argc >4 && !str2long (argv[4 ], &pagecount)) {printf ("'%s' is not a number\n" , argv[4 ]);
@@ -584,7 +582,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])if (mtd_arg_off_size (argc -3 , argv +3 , &dev, &off, &size, &maxsize,MTD_DEV_TYPE_NAND , - nand_info[dev].size) !=0 ) + nand->size) !=0 )return 1 ;if (set_dev (dev))
@@ -596,7 +594,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) rwsize = size; } - nand = &nand_info[dev]; + nand =get_nand_dev_by_index (dev);if (!s || !strcmp (s,".jffs2" ) || !strcmp (s,".e" ) || !strcmp (s,".i" )) {
@@ -727,13 +725,15 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])if (mtd_arg_off_size (argc -2 , argv +2 , &dev, &off, &size, &maxsize,MTD_DEV_TYPE_NAND , - nand_info[dev].size) <0 ) + nand->size) <0 )return 1 ;if (set_dev (dev))return 1 ; -if (!nand_unlock (&nand_info[dev], off, size, allexcept)) { + nand =get_nand_dev_by_index (dev); + +if (!nand_unlock (nand, off, size, allexcept)) {puts ("NAND flash successfully unlocked\n" ); }else { puts("Error unlocking NAND flash, "
@@ -899,6 +899,7 @@ static int do_nandboot(cmd_tbl_t *cmdtp, int flag, int argc,struct mtd_device *dev;struct part_info *part;u8 pnum; +nand_info_t *nand;if (argc >=2 ) {char *p = (argc ==2 ) ? argv[1 ] : argv[2 ];
@@ -914,8 +915,10 @@ static int do_nandboot(cmd_tbl_t *cmdtp, int flag, int argc, addr =simple_strtoul (argv[1 ],NULL ,16 ); else addr =CONFIG_SYS_LOAD_ADDR ; -return nand_load_image (cmdtp, &nand_info[dev->id->num], - part->offset, addr, argv[0]); + + nand =get_nand_dev_by_index (dev->id->num); +return nand_load_image (cmdtp, nand, part->offset, + addr, argv[0]); } }#endif
@@ -957,14 +960,15 @@ usage: idx =simple_strtoul (boot_device,NULL ,16 ); -if (idx <0 || idx >=CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[idx].name) { + nand =get_nand_dev_by_index (idx); +if (!nand) {printf ("\n** Device %d not available\n" , idx);bootstage_error (BOOTSTAGE_ID_NAND_AVAILABLE );return 1 ; }bootstage_mark (BOOTSTAGE_ID_NAND_AVAILABLE ); -return nand_load_image (cmdtp, &nand_info[idx], offset, addr, argv[0 ]); +return nand_load_image (cmdtp, nand, offset, addr, argv[0 ]); } U_BOOT_CMD(nboot, 4, 1, do_nandboot,
drivers/mtd/nand/nand.c +6 -2
@@ -38,7 +38,7 @@ int nand_register(int devnum)if (devnum >=CONFIG_SYS_MAX_NAND_DEVICE )return -EINVAL ; - mtd = &nand_info[devnum]; + mtd =get_nand_dev_by_index (devnum);sprintf (dev_name[devnum],"nand%d" , devnum); mtd->name = dev_name[devnum];
@@ -62,7 +62,7 @@ int nand_register(int devnum)#ifndef CONFIG_SYS_NAND_SELF_INIT static void nand_init_chip (int i) { -struct mtd_info *mtd = &nand_info[i]; +struct mtd_info *mtd;struct nand_chip *nand = &nand_chip[i];ulong base_addr = base_address[i];int maxchips =CONFIG_SYS_NAND_MAX_CHIPS ;
@@ -70,6 +70,10 @@ static void nand_init_chip(int i)if (maxchips <1 ) maxchips =1 ; + mtd =get_nand_dev_by_index (i); +if (!mtd) +return ; + mtd->priv = nand; nand->IO_ADDR_R = nand->IO_ADDR_W = (void __iomem *)base_addr;
include/nand.h +18 -0
@@ -137,4 +137,22 @@ int get_nand_env_oob(nand_info_t *nand, unsigned long *result);#endif int spl_nand_erase_one (int block,int page); +/* +* get_nand_dev_by_index - Get the nand info based in index. +* +* @dev - index to the nand device. +* +* returns pointer to the nand device info structure or NULL on failure. +*/ +static inline nand_info_t *get_nand_dev_by_index (int dev) +{ +if (dev <0 || dev >=CONFIG_SYS_MAX_NAND_DEVICE || + !nand_info[dev].name) { +puts ("No such device\n" ); +return NULL ; + } + +return &nand_info[dev]; +} +#endif /* _NAND_H_ */
Signature · 1 line
2.8.0.rc3.9.g44915db
PATCH 2/9 cmd: nand: abstract global variable usage for dm conversion
Quoted 4 lines · Mugunthan V N
nand_infois used all over the file so abstract it withget_nand_dev_by_index()which will help for DM conversion.Signed-off-by Mugunthan V N <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160401/df037655/attachment.sig>
PATCH 2/9 cmd: nand: abstract global variable usage for dm conversion
In reply to Mugunthan V N[Please CC me at this address rather than my NXP address]
Quoted 4 lines · Mugunthan V N
cmd/nand.c +0
-0@@ -432,12 +435,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) * one before these commands can run, even if a partition specifier * for another device is to be used.
cmd/nand.c static int do_nand(cmd_tbl_t *cmdtp, int flag, int · line 441
Quoted 10 lines
cmd/nand.c +1
-6*/ -if (dev <0 || dev >=CONFIG_SYS_MAX_NAND_DEVICE || - !nand_info[dev].name) { -puts ("\nno devices available\n" ); -return 1 ; - } - nand = &nand_info[dev]; + nand =get_nand_dev_by_index (dev);if (strcmp (cmd,"bad" ) ==0 ) {
You eliminated the error check -- now a NULL deref is likely if a bad dev is requested. Even if it's checked elsewhere when setting nand_curr_device, it's possible that the initial default is bad (no NAND devices present, or device 0 failed).
Quoted 6 lines
cmd/nand.c +0
-0printf ("\nDevice %d bad blocks:\n" , dev);@@ -496,13 +494,13 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])/* skip first two or three arguments, look for offset and size */
cmd/nand.c +0
-0if (mtd_arg_off_size(argc - o, argv + o, &dev, &off, &size,
cmd/nand.c static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 503
Quoted 10 lines
cmd/nand.c +2
-2&maxsize, MTD_DEV_TYPE_NAND, - nand_info[dev].size) != 0) + nand->size) != 0)return 1 ;if (set_dev (dev))return 1 ; - nand = &nand_info[dev]; + nand =get_nand_dev_by_index (dev);
Maybe have set_dev return the dev pointer?
Or have a global for the pointer rather than just the index, saving a bunch of these calls.
-Scott
PATCH 2/9 cmd: nand: abstract global variable usage for dm conversion
Quoted 16 lines · Scott Wood
[Please CC me at this address rather than my NXP address]
Quoted 13 lines · Mugunthan V N
cmd/nand.c +1
-6@@ -432,12 +435,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, intargc, char * const argv[]) * one before these commands can run, even if a partition specifier * for another device is to be used. */ -if (dev <0 || dev >=CONFIG_SYS_MAX_NAND_DEVICE || - !nand_info[dev].name) { -puts ("\nno devices available\n" ); -return 1 ; - } - nand = &nand_info[dev]; + nand =get_nand_dev_by_index (dev);
Quoted 6 lines
cmd/nand.c static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) · line 440
Quoted 1 line
cmd/nand.c +0
-0if (strcmp (cmd,"bad" ) ==0 ) {You eliminated the error check -- now a NULL deref is likely if a bad dev is requested. Even if it's checked elsewhere when setting
nand_curr_device, it's possible that the initial default is bad (no NAND devices present, or device 0 failed).
Will fix this in my v2.
Quoted 15 lines
Quoted 15 lines
cmd/nand.c +0
-0printf ("\nDevice %d bad blocks:\n" , dev);@@ -496,13 +494,13 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])/* skip first two or three arguments, look for offset and size */
cmd/nand.c +1
-1if (mtd_arg_off_size (argc - o, argv + o, &dev, &off, &size, &maxsize,MTD_DEV_TYPE_NAND , - nand_info[dev].size) !=0 ) + nand->size) !=0 )return 1 ;if (set_dev (dev))return 1 ;
Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +1
-1- nand = &nand_info[dev]; + nand = get_nand_dev_by_index(dev);Maybe have
set_devreturn the dev pointer?Or have a global for the pointer rather than just the index, saving a bunch of these calls.
Taking the same to global pointer can be done as a separate patch.
Regards
Mugunthan V N
PATCH 2/9 cmd: nand: abstract global variable usage for dm conversion
In reply to Mugunthan V NQuoted 246 lines · Mugunthan V N
nand_infois used all over the file so abstract it withget_nand_dev_by_index()which will help for DM conversion.Signed-off-by Mugunthan V N <[email protected]>--- cmd/nand.c | 72 ++++++++++++++++++++++++++----------------------- drivers/mtd/nand/nand.c | 8 ++++-- include/nand.h | 18 +++++++++++++ 3 files changed, 62 insertions(+), 36 deletions(-)cmd/nand.c +38
-34@@ -114,21 +114,20 @@ free_dat:static int set_dev (int dev) { -if (dev <0 || dev >=CONFIG_SYS_MAX_NAND_DEVICE || - !nand_info[dev].name) { -puts ("No such device\n" ); -return -1 ; - } +nand_info_t *nand =get_nand_dev_by_index (dev); + +if (!nand) +return -ENODEV ;if (nand_curr_device == dev)return 0 ; -printf ("Device %d: %s" , dev, nand_info[dev].name); +printf ("Device %d: %s" , dev, nand->name);puts ("... is now current device\n" ); nand_curr_device = dev;#ifdef CONFIG_SYS_NAND_SELECT_DEVICE -board_nand_select_device (nand_info[dev].priv, dev); +board_nand_select_device (nand->priv, dev);#endif return 0 ;@@ -188,7 +187,7 @@ int do_nand_env_oob(cmd_tbl_t *cmdtp, int argc, char *const argv[]) {int ret;uint32_t oob_buf[ENV_OFFSET_SIZE /sizeof (uint32_t )]; -nand_info_t *nand = &nand_info[0 ]; +nand_info_t *nand =get_nand_dev_by_index (0 );char *cmd = argv[1 ];if (CONFIG_SYS_MAX_NAND_DEVICE ==0 || !nand->name) {@@ -213,9 +212,10 @@ int do_nand_env_oob(cmd_tbl_t *cmdtp, int argc, char *const argv[])if (argc <3 ) goto usage; + nand =get_nand_dev_by_index (idx);/* We don't care about size, or maxsize. */ if (mtd_arg_off (argv[2 ], &idx, &addr, &maxsize, &maxsize, -MTD_DEV_TYPE_NAND , nand_info[idx].size)) { +MTD_DEV_TYPE_NAND , nand->size)) {puts ("Offset or partition name expected\n" );return 1 ; }@@ -283,9 +283,14 @@ usage:static void nand_print_and_set_info (int idx) { -nand_info_t *nand = &nand_info[idx]; -struct nand_chip *chip = nand->priv; +nand_info_t *nand; +struct nand_chip *chip; + nand =get_nand_dev_by_index (idx); +if (!nand) +return ; + + chip = nand->priv;printf ("Device %d: " , idx);if (chip->numchips >1 )printf ("%dx " , chip->numchips);@@ -348,7 +353,7 @@ static void adjust_size_for_badblocks(loff_t *size, loff_t offset, int dev)/* We grab the nand info object here fresh because this is usually * called after arg_off_size() which can change the value of dev. */ -nand_info_t *nand = &nand_info[dev]; +nand_info_t *nand =get_nand_dev_by_index (dev);loff_t maxoffset = offset + *size;int badblocks =0 ;@@ -397,10 +402,8 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])if (strcmp (cmd,"info" ) ==0 ) {putc ('\n' ); -for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) { -if (nand_info[i].name) -nand_print_and_set_info (i); - } +for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) +nand_print_and_set_info (i);return 0 ; }@@ -432,12 +435,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])* one before these commands can run, even if a partition specifier * for another device is to be used. */ -if (dev <0 || dev >=CONFIG_SYS_MAX_NAND_DEVICE || - !nand_info[dev].name) { -puts ("\nno devices available\n" ); -return 1 ; - } - nand = &nand_info[dev]; + nand =get_nand_dev_by_index (dev);if (strcmp (cmd,"bad" ) ==0 ) {printf ("\nDevice %d bad blocks:\n" , dev);@@ -496,13 +494,13 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])/* skip first two or three arguments, look for offset and size */ if (mtd_arg_off_size (argc - o, argv + o, &dev, &off, &size, &maxsize,MTD_DEV_TYPE_NAND , - nand_info[dev].size) !=0 ) + nand->size) !=0 )return 1 ;if (set_dev (dev))return 1 ; - nand = &nand_info[dev]; + nand =get_nand_dev_by_index (dev);memset (&opts,0 ,sizeof (opts)); opts.offset = off;@@ -561,13 +559,13 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])if (mtd_arg_off (argv[3 ], &dev, &off, &size, &maxsize,MTD_DEV_TYPE_NAND , - nand_info[dev].size)) + nand->size))return 1 ;if (set_dev (dev))return 1 ; - nand = &nand_info[dev]; + nand =get_nand_dev_by_index (dev);if (argc >4 && !str2long (argv[4 ], &pagecount)) {printf ("'%s' is not a number\n" , argv[4 ]);@@ -584,7 +582,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])if (mtd_arg_off_size (argc -3 , argv +3 , &dev, &off, &size, &maxsize,MTD_DEV_TYPE_NAND , - nand_info[dev].size) !=0 ) + nand->size) !=0 )return 1 ;if (set_dev (dev))@@ -596,7 +594,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) rwsize = size; } - nand = &nand_info[dev]; + nand =get_nand_dev_by_index (dev);if (!s || !strcmp (s,".jffs2" ) || !strcmp (s,".e" ) || !strcmp (s,".i" )) {@@ -727,13 +725,15 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])if (mtd_arg_off_size (argc -2 , argv +2 , &dev, &off, &size, &maxsize,MTD_DEV_TYPE_NAND , - nand_info[dev].size) <0 ) + nand->size) <0 )return 1 ;if (set_dev (dev))return 1 ; -if (!nand_unlock (&nand_info[dev], off, size, allexcept)) { + nand =get_nand_dev_by_index (dev); + +if (!nand_unlock (nand, off, size, allexcept)) {puts ("NAND flash successfully unlocked\n" ); }else { puts("Error unlocking NAND flash, "@@ -899,6 +899,7 @@ static int do_nandboot(cmd_tbl_t *cmdtp, int flag, int argc,struct mtd_device *dev;struct part_info *part;u8 pnum; +nand_info_t *nand;if (argc >=2 ) {char *p = (argc ==2 ) ? argv[1 ] : argv[2 ];@@ -914,8 +915,10 @@ static int do_nandboot(cmd_tbl_t *cmdtp, int flag, int argc, addr =simple_strtoul (argv[1 ],NULL ,16 ); else addr =CONFIG_SYS_LOAD_ADDR ; -return nand_load_image (cmdtp, &nand_info[dev->id->num], - part->offset, addr, argv[0]); + + nand =get_nand_dev_by_index (dev->id->num); +return nand_load_image (cmdtp, nand, part->offset, + addr, argv[0]); } }#endif @@ -957,14 +960,15 @@ usage: idx =simple_strtoul (boot_device,NULL ,16 ); -if (idx <0 || idx >=CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[idx].name) { + nand =get_nand_dev_by_index (idx); +if (!nand) {printf ("\n** Device %d not available\n" , idx);bootstage_error (BOOTSTAGE_ID_NAND_AVAILABLE );return 1 ; }bootstage_mark (BOOTSTAGE_ID_NAND_AVAILABLE ); -return nand_load_image (cmdtp, &nand_info[idx], offset, addr, argv[0 ]); +return nand_load_image (cmdtp, nand, offset, addr, argv[0 ]); } U_BOOT_CMD(nboot, 4, 1, do_nandboot,drivers/mtd/nand/nand.c +2
-2@@ -38,7 +38,7 @@ int nand_register(int devnum)if (devnum >=CONFIG_SYS_MAX_NAND_DEVICE )return -EINVAL ; - mtd = &nand_info[devnum]; + mtd =get_nand_dev_by_index (devnum);sprintf (dev_name[devnum],"nand%d" , devnum); mtd->name = dev_name[devnum];@@ -62,7 +62,7 @@ int nand_register(int devnum)#ifndef CONFIG_SYS_NAND_SELF_INIT static void nand_init_chip (int i) { -struct mtd_info *mtd = &nand_info[i]; +struct mtd_info *mtd;struct nand_chip *nand = &nand_chip[i];ulong base_addr = base_address[i];int maxchips =CONFIG_SYS_NAND_MAX_CHIPS ;
drivers/mtd/nand/nand.c static void nand_init_chip(int i) · line 75
Quoted 6 lines
drivers/mtd/nand/nand.c +3
-0@@ -70,6 +70,10 @@ static void nand_init_chip(int i)if (maxchips <1 ) maxchips =1 ; + mtd =get_nand_dev_by_index (i); +if (!mtd) +return ;
Found an issue here, in non-dm case get_nand_dev_by_index() will return NULL as this is the first access and none of the nand_info[] is initialized. below is the fix. Will include this in with v2 series
+#ifdef CONFIG_DM_NAND
+ mtd = get_nand_dev_by_index(i);
+ if (!mtd)
+ return;
+#else
+ mtd = &nand_info[i];
+#endif
+
Regards
Mugunthan V N
Quoted 32 lines
drivers/mtd/nand/nand.c +1
-0+ mtd->priv = nand; nand->IO_ADDR_R = nand->IO_ADDR_W = (void __iomem *)base_addr;include/nand.h +18
-0@@ -137,4 +137,22 @@ int get_nand_env_oob(nand_info_t *nand, unsigned long *result);#endif int spl_nand_erase_one (int block,int page); +/* +* get_nand_dev_by_index - Get the nand info based in index. +* +* @dev - index to the nand device. +* +* returns pointer to the nand device info structure or NULL on failure. +*/ +static inline nand_info_t *get_nand_dev_by_index (int dev) +{ +if (dev <0 || dev >=CONFIG_SYS_MAX_NAND_DEVICE || + !nand_info[dev].name) { +puts ("No such device\n" ); +return NULL ; + } + +return &nand_info[dev]; +} +#endif /* _NAND_H_ */
PATCH 3/9 drivers: nand: Kconfig: add NAND as Kconfig option
In reply to Mugunthan V NAdd CONFIG_NAND as a Kconfig option so that it can be selected using menuconfig or defconfig.
--- drivers/mtd/nand/Kconfig | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/mtd/nand/Kconfig +10 -2
@@ -1,4 +1,12 @@ -menu "NAND Device Support" +menuconfig NAND + bool "NAND device support" + help + You must select Y to enable any NAND device support + Generally if you have any NAND devices this is a given + + If unsure, say Y + +if NAND config SYS_NAND_SELF_INIT bool
@@ -118,4 +126,4 @@ config SPL_NAND_DENALI endif -endmenu +endif
Signature · 1 line
2.8.0.rc3.9.g44915db
PATCH 3/9 drivers: nand: Kconfig: add NAND as Kconfig option
Quoted 4 lines · Mugunthan V N
Add
CONFIG_NANDas aKconfigoption so that it can be selected using menuconfig or defconfig.Signed-off-by Mugunthan V N <[email protected]>
Good but you need to update configs/ to remove NAND from CONFIG_SYS_EXTRA_OPTIONS and add CONFIG_NAND=y
Doing:
$ for F in `git grep -lE SYS_EXTRA.*NAND configs/`;do sed -i -e \
's/,NAND//' $F && echo CONFIG_NAND=y >> $F;done
will get you most of the way there, then just a:
$ for C in `git status configs/ | grep modified: | cut -d / -f 2`;do \
make O=$C $C savedefconfig && cp $C/defconfig configs/$C;doneTo get it in the right spot, git add -p only the bits you really wanted, done. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160401/4e1a88cf/attachment.sig>
PATCH 3/9 drivers: nand: Kconfig: add NAND as Kconfig option
Quoted 11 lines · Tom Rini
Quoted 4 lines · Mugunthan V N
Add
CONFIG_NANDas aKconfigoption so that it can be selected using menuconfig or defconfig.Signed-off-by Mugunthan V N <[email protected]>Good but you need to update configs/ to remove NAND from
CONFIG_SYS_EXTRA_OPTIONSand addCONFIG_NAND=yDoing:
Quoted 9 lines
$ for F in `git grep -lE SYS_EXTRA.*NAND configs/`;do sed -i -e \ 's/,NAND//' $F && echo CONFIG_NAND=y >> $F;done will get you most of the way there, then just a: $ for C in `git status configs/ | grep modified: | cut -d / -f 2`;do \ make O=$C $C savedefconfig && cp $C/defconfig configs/$C;doneTo get it in the right spot, git add -p only the bits you really wanted, done. Thanks!
Will fix it in v2
Regards
Mugunthan V N
Scott Wood
NAKPATCH 3/9 drivers: nand: Kconfig: add NAND as Kconfig option
In reply to Tom RiniQuoted 9 lines · Tom Rini
Quoted 4 lines · Mugunthan V N
Add
CONFIG_NANDas aKconfigoption so that it can be selected using menuconfig or defconfig.Signed-off-by Mugunthan V N <[email protected]>Good but you need to update configs/ to remove NAND from
CONFIG_SYS_EXTRA_OPTIONSand addCONFIG_NAND=y
NACK
That CONFIG_NAND is a target-local option used by some boards to indicate boot source. It is not equivalent to CONFIG_CMD_NAND which is what enables the NAND subsystem.
-Scott
PATCH 3/9 drivers: nand: Kconfig: add NAND as Kconfig option
Quoted 8 lines · Scott Wood
Quoted 7 lines · Tom Rini
Quoted 4 lines · Mugunthan V N
Add
CONFIG_NANDas aKconfigoption so that it can be selected using menuconfig or defconfig.Signed-off-by Mugunthan V N <[email protected]>
Quoted 8 lines
Quoted 2 lines
Good but you need to update configs/ to remove NAND from
CONFIG_SYS_EXTRA_OPTIONSand addCONFIG_NAND=yNACK
That
CONFIG_NANDis a target-local option used by some boards to indicate boot source. It is not equivalent toCONFIG_CMD_NANDwhich is what enables the NAND subsystem.
Exactly! We need to have 'NAND' moved from CONFIG_SYS_EXTRA_OPTIONS and into a real Kconfig entry. That said, I think this might have forgotten to enable it in other places too but just 'NAND' needs to migrate out of where it is.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160401/0ba70567/attachment.sig>
PATCH 3/9 drivers: nand: Kconfig: add NAND as Kconfig option
Quoted 20 lines · Tom Rini
Quoted 11 lines · Scott Wood
Quoted 9 lines · Tom Rini
Quoted 4 lines · Mugunthan V N
Add
CONFIG_NANDas aKconfigoption so that it can be selected using menuconfig or defconfig.Signed-off-by Mugunthan V N <[email protected]>Good but you need to update configs/ to remove NAND from
CONFIG_SYS_EXTRA_OPTIONSand addCONFIG_NAND=yQuoted 6 lines
NACK
That
CONFIG_NANDis a target-local option used by some boards to indicate boot
source. It is not equivalent toCONFIG_CMD_NANDwhich is what enables the NAND subsystem.
Quoted 4 lines
Exactly! We need to have 'NAND' moved from
CONFIG_SYS_EXTRA_OPTIONSand into a realKconfigentry. That said, I think this might have forgotten to enable it in other places too but just 'NAND' needs to migrate out of where it is.
If we must start using NAND rather than CMD_NAND to enable the NAND subsystem (which is what this patch does), then a lot more than that needs to change.
We'll need a new name for the boot source selection, and we'll need to
kconfigize all the boards that enable CONFIG_CMD_NAND via the board config header.
-Scott
PATCH 3/9 drivers: nand: Kconfig: add NAND as Kconfig option
Quoted 26 lines · Scott Wood
Quoted 20 lines · Tom Rini
Quoted 11 lines · Scott Wood
Quoted 9 lines · Tom Rini
Quoted 4 lines · Mugunthan V N
Add
CONFIG_NANDas aKconfigoption so that it can be selected using menuconfig or defconfig.Signed-off-by Mugunthan V N <[email protected]>Good but you need to update configs/ to remove NAND from
CONFIG_SYS_EXTRA_OPTIONSand addCONFIG_NAND=yQuoted 6 lines
NACK
That
CONFIG_NANDis a target-local option used by some boards to indicate boot
source. It is not equivalent toCONFIG_CMD_NANDwhich is what enables the NAND subsystem.Quoted 4 lines
Exactly! We need to have 'NAND' moved from
CONFIG_SYS_EXTRA_OPTIONSand into a realKconfigentry. That said, I think this might have forgotten to enable it in other places too but just 'NAND' needs to migrate out of where it is.
Quoted 5 lines
If we must start using NAND rather than
CMD_NANDto enable the NAND subsystem (which is what this patch does), then a lot more than that needs to change.
We'll need a new name for the boot source selection, and we'll need to
kconfigize all the boards that enableCONFIG_CMD_NANDvia the board config header.
OK, I see your point now too. Yes, we need to tackle NAND/CMD_NAND Kconfig stuff (including the tangled web of CMD_NAND being how we toggle NAND the functionality) as a pre-patch series to this. But it needs doing :)
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160401/e9337838/attachment.sig>
PATCH 3/9 drivers: nand: Kconfig: add NAND as Kconfig option
Scott/Tom
Quoted 33 lines · Tom Rini
Quoted 26 lines · Scott Wood
Quoted 20 lines · Tom Rini
Quoted 11 lines · Scott Wood
Quoted 9 lines · Tom Rini
Quoted 4 lines · Mugunthan V N
Add
CONFIG_NANDas aKconfigoption so that it can be selected using menuconfig or defconfig.Signed-off-by Mugunthan V N <[email protected]>Good but you need to update configs/ to remove NAND from
CONFIG_SYS_EXTRA_OPTIONSand addCONFIG_NAND=yQuoted 6 lines
NACK
That
CONFIG_NANDis a target-local option used by some boards to indicate boot
source. It is not equivalent toCONFIG_CMD_NANDwhich is what enables the NAND subsystem.Quoted 4 lines
Exactly! We need to have 'NAND' moved from
CONFIG_SYS_EXTRA_OPTIONSand into a realKconfigentry. That said, I think this might have forgotten to enable it in other places too but just 'NAND' needs to migrate out of where it is.Quoted 5 lines
If we must start using NAND rather than
CMD_NANDto enable the NAND subsystem (which is what this patch does), then a lot more than that needs to change.
We'll need a new name for the boot source selection, and we'll need to
kconfigize all the boards that enableCONFIG_CMD_NANDvia the board config header.
Quoted 4 lines
OK, I see your point now too. Yes, we need to tackle NAND/CMD_NAND
Kconfigstuff (including the tangled web ofCMD_NANDbeing how we toggle NAND the functionality) as a pre-patch series to this. But it needs doing :)
Should I be moving back NAND to "CONFIG_SYS_EXTRA_OPTIONS"?
Since CONFIG_CMD_NAND is used to enable NAND subsystem, so move CONFIG_CMD_NAND to drivers/mtd/nand/Kconfig?
or am I missing something?
Regards
Mugunthan V N
PATCH 3/9 drivers: nand: Kconfig: add NAND as Kconfig option
Quoted 41 lines · Mugunthan V N
Scott/Tom
Quoted 33 lines · Tom Rini
Quoted 26 lines · Scott Wood
Quoted 20 lines · Tom Rini
Quoted 11 lines · Scott Wood
Quoted 9 lines · Tom Rini
Quoted 4 lines · Mugunthan V N
Add
CONFIG_NANDas aKconfigoption so that it can be selected using menuconfig or defconfig.Signed-off-by Mugunthan V N <[email protected]>Good but you need to update configs/ to remove NAND from
CONFIG_SYS_EXTRA_OPTIONSand addCONFIG_NAND=yQuoted 6 lines
NACK
That
CONFIG_NANDis a target-local option used by some boards to indicate boot
source. It is not equivalent toCONFIG_CMD_NANDwhich is what enables the NAND subsystem.Quoted 4 lines
Exactly! We need to have 'NAND' moved from
CONFIG_SYS_EXTRA_OPTIONSand into a realKconfigentry. That said, I think this might have forgotten to enable it in other places too but just 'NAND' needs to migrate out of where it is.Quoted 5 lines
If we must start using NAND rather than
CMD_NANDto enable the NAND subsystem (which is what this patch does), then a lot more than that needs to change.
We'll need a new name for the boot source selection, and we'll need to
kconfigize all the boards that enableCONFIG_CMD_NANDvia the board config header.Quoted 4 lines
OK, I see your point now too. Yes, we need to tackle NAND/CMD_NAND
Kconfigstuff (including the tangled web ofCMD_NANDbeing how we toggle NAND the functionality) as a pre-patch series to this. But it needs doing :)
Quoted 6 lines
Should I be moving back NAND to "
CONFIG_SYS_EXTRA_OPTIONS"?Since
CONFIG_CMD_NANDis used to enable NAND subsystem, so moveCONFIG_CMD_NANDtodrivers/mtd/nand/Kconfig?or am I missing something?
I would like to see, but I want to hear Scott's opinion, move to CONFIG_NAND is what enables NAND support for everyone (so yes, lots of defconfigs will need an update) so that we can move it all over to Kconfig.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160408/a5b56fad/attachment.sig>
PATCH 3/9 drivers: nand: Kconfig: add NAND as Kconfig option
Quoted 56 lines · Tom Rini
Quoted 55 lines · Mugunthan V N
Scott/Tom
Quoted 42 lines · Tom Rini
Quoted 31 lines · Scott Wood
Quoted 22 lines · Tom Rini
Quoted 11 lines · Scott Wood
Quoted 9 lines · Tom Rini
Quoted 4 lines · Mugunthan V N
Add
CONFIG_NANDas aKconfigoption so that it can be selected using menuconfig or defconfig.Signed-off-by Mugunthan V N <[email protected]>Good but you need to update configs/ to remove NAND from
CONFIG_SYS_EXTRA_OPTIONSand addCONFIG_NAND=yQuoted 8 lines
NACK
That
CONFIG_NANDis a target-local option used by some boards to indicate
boot
source. It is not equivalent toCONFIG_CMD_NANDwhich is what enables the
NAND subsystem.Quoted 7 lines
Exactly! We need to have 'NAND' moved from
CONFIG_SYS_EXTRA_OPTIONSand
into a realKconfigentry. That said, I think this might have forgotten
to enable it in other places too but just 'NAND' needs to migrate out of
where it is.Quoted 9 lines
If we must start using NAND rather than
CMD_NANDto enable the NAND subsystem
(which is what this patch does), then a lot more than that needs to change.
We'll need a new name for the boot source selection, and we'll need
to
kconfigize all the boards that enableCONFIG_CMD_NANDvia the board config
header.Quoted 4 lines
OK, I see your point now too. Yes, we need to tackle NAND/CMD_NAND
Kconfigstuff (including the tangled web ofCMD_NANDbeing how we toggle NAND the functionality) as a pre-patch series to this. But it needs doing :)Should I be moving back NAND to "
CONFIG_SYS_EXTRA_OPTIONS"?Since
CONFIG_CMD_NANDis used to enable NAND subsystem, so moveCONFIG_CMD_NANDtodrivers/mtd/nand/Kconfig?
Quoted 6 lines
Quoted 1 line
or am I missing something?
I would like to see, but I want to hear Scott's opinion, move to
CONFIG_NANDis what enables NAND support for everyone (so yes, lots of defconfigs will need an update) so that we can move it all over toKconfig.
I'm fine with changing the names as long as everything gets updated properly.
The boards which use CONFIG_NAND to mean NAND boot (which is a relic of an
old and dead config mechanism that parsed extra words added to a target name) can be changed to CONFIG_NAND_BOOT.
-Scott
PATCH 4/9 drivers: nand: implement a NAND uclass
In reply to Mugunthan V NImplement a NAND uclass so that the NAND devices can be accessed via the DM framework.
--- drivers/mtd/nand/Kconfig | 10 +++++++ drivers/mtd/nand/Makefile | 2 ++ drivers/mtd/nand/nand-uclass.c | 62 ++++++++++++++++++++++++++++++++++++++++++ drivers/mtd/nand/nand.c | 6 +++- include/dm/uclass-id.h | 1 + include/nand.h | 5 ++++ 6 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 drivers/mtd/nand/nand-uclass.c
drivers/mtd/nand/Kconfig +10 -0
@@ -8,6 +8,16 @@ menuconfig NAND if NAND +config DM_NAND + bool "Enable driver model for NAND" + depends on NAND && DM + help + Enable driver model for NAND. The NAND interface is then + implemented by the NAND uclass. Multiple NAND devices can + be attached and used. The 'nand' command works as normal. + + If the NAND drivers doesn't support DM, say N. + config SYS_NAND_SELF_INIT bool help
drivers/mtd/nand/Makefile +2 -0
@@ -39,6 +39,8 @@ endif # not spl ifdef NORMAL_DRIVERS +obj-$(CONFIG_DM_NAND) += nand-uclass.o + obj-$(CONFIG_NAND_ECC_BCH) += nand_bch.o obj-$(CONFIG_NAND_ATMEL) += atmel_nand.o
drivers/mtd/nand/nand-uclass.c new file +62 -0
62 lines not on this page · raw message
drivers/mtd/nand/nand.c +5 -1
@@ -21,7 +21,7 @@ int nand_curr_device = -1;nand_info_t nand_info[CONFIG_SYS_MAX_NAND_DEVICE ]; -#ifndef CONFIG_SYS_NAND_SELF_INIT +#if !defined(CONFIG_SYS_NAND_SELF_INIT ) && !defined(CONFIG_DM_NAND )static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE ];static ulong base_address[CONFIG_SYS_MAX_NAND_DEVICE ] =CONFIG_SYS_NAND_BASE_LIST ;#endif
@@ -63,8 +63,10 @@ int nand_register(int devnum)static void nand_init_chip (int i) {struct mtd_info *mtd; +#ifndef CONFIG_DM_NAND struct nand_chip *nand = &nand_chip[i];ulong base_addr = base_address[i]; +#endif int maxchips =CONFIG_SYS_NAND_MAX_CHIPS ;if (maxchips <1 )
@@ -74,11 +76,13 @@ static void nand_init_chip(int i)if (!mtd)return ; +#ifndef CONFIG_DM_NAND mtd->priv = nand; nand->IO_ADDR_R = nand->IO_ADDR_W = (void __iomem *)base_addr;if (board_nand_init (nand))return ; +#endif if (nand_scan (mtd, maxchips))return ;
include/dm/uclass-id.h +1 -0
@@ -49,6 +49,7 @@ enum uclass_id {UCLASS_MMC ,/* SD / MMC card or chip */ UCLASS_MOD_EXP ,/* RSA Mod Exp device */ UCLASS_MTD ,/* Memory Technology Device (MTD) device */ +UCLASS_NAND ,/* NAND bus */ UCLASS_NORTHBRIDGE ,/* Intel Northbridge / SDRAM controller */ UCLASS_PANEL ,/* Display panel, such as an LCD */ UCLASS_PANEL_BACKLIGHT, /* Backlight controller for panel */
include/nand.h +5 -0
@@ -10,6 +10,7 @@#define _NAND_H_#include <config.h> +#include <dm.h> /* * All boards using a given driver must convert to self-init
@@ -144,6 +145,7 @@ int spl_nand_erase_one(int block, int page);* * returns pointer to the nand device info structure or NULL on failure. */ +#ifndef CONFIG_DM_NAND static inline nand_info_t *get_nand_dev_by_index (int dev) { if (dev < 0 || dev >= CONFIG_SYS_MAX_NAND_DEVICE ||
@@ -154,5 +156,8 @@ static inline nand_info_t *get_nand_dev_by_index(int dev)return &nand_info[dev]; } +#else +nand_info_t *get_nand_dev_by_index (int idx); +#endif #endif /* _NAND_H_ */
Signature · 1 line
2.8.0.rc3.9.g44915db
PATCH 4/9 drivers: nand: implement a NAND uclass
Quoted 4 lines · Mugunthan V N
Implement a NAND uclass so that the NAND devices can be accessed via the DM framework.
Signed-off-by Mugunthan V N <[email protected]>
Minor:
drivers/mtd/nand/nand-uclass.c line 5
Quoted 6 lines
drivers/mtd/nand/nand-uclass.c new file +5
-0@@ -0,0 +1,62 @@ +/* +* NAND uclass driver for NAND bus. +* +* (C) Copyright 2012-2016 +* Texas Instruments Incorporated, <www.ti.com>
The code isn't that old.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160401/0f7a2a42/attachment.sig>
PATCH 4/9 drivers: nand: implement a NAND uclass
Quoted 9 lines · Tom Rini
Quoted 4 lines · Mugunthan V N
Implement a NAND uclass so that the NAND devices can be accessed via the DM framework.
Signed-off-by Mugunthan V N <[email protected]>Minor:
Quoted 9 lines
drivers/mtd/nand/nand-uclass.c line 5
Quoted 6 lines
drivers/mtd/nand/nand-uclass.c new file +5
-0@@ -0,0 +1,62 @@ +/* +* NAND uclass driver for NAND bus. +* +* (C) Copyright 2012-2016 +* Texas Instruments Incorporated, <www.ti.com> The code isn't that old.
Copy paste, will fix in v2
Regards
Mugunthan V N
PATCH 4/9 drivers: nand: implement a NAND uclass
In reply to Mugunthan V Ndrivers/mtd/nand/nand-uclass.c line 49
Quoted 10 lines · Mugunthan V N
drivers/mtd/nand/nand-uclass.c new file +10
-0+static int nand_child_pre_probe (struct udevice *dev) +{ +nand_info_t *nand =dev_get_uclass_priv (dev); +void *priv =dev_get_priv (dev); + +/* +* Store nand device priv pointer in nand_info so that +* it can be used by nand command +*/ + nand->priv = priv;
Wouldn't it make more sense to have a pointer to the device in the NAND struct, and let the driver manage both privs as it chooses?
drivers/mtd/nand/nand-uclass.c line 60
Quoted 11 lines
drivers/mtd/nand/nand-uclass.c new file +11
-0+ +return 0 ; +} + +UCLASS_DRIVER (nand) = { + .id =UCLASS_NAND , + .name ="nand" , + .flags =DM_UC_FLAG_SEQ_ALIAS , + .post_probe = nand_child_pre_probe, + .per_device_auto_alloc_size =sizeof (nand_info_t), +};
Post probe = pre probe?
Quoted 15 lines
drivers/mtd/nand/nand.c +2
-0@@ -63,8 +63,10 @@ int nand_register(int devnum)static void nand_init_chip (int i) {struct mtd_info *mtd; +#ifndef CONFIG_DM_NAND struct nand_chip *nand = &nand_chip[i];ulong base_addr = base_address[i]; +#endif int maxchips =CONFIG_SYS_NAND_MAX_CHIPS ;if (maxchips <1 )@@ -74,11 +76,13 @@ static void nand_init_chip(int i)if (!mtd)return ;
drivers/mtd/nand/nand.c static void nand_init_chip(int i) · line 88
Quoted 10 lines
drivers/mtd/nand/nand.c +2
-0+#ifndef CONFIG_DM_NAND mtd->priv = nand; nand->IO_ADDR_R = nand->IO_ADDR_W = (void __iomem *)base_addr;if (board_nand_init (nand))return ; +#endif if (nand_scan (mtd, maxchips))return ;
Please do not use this code for DM. Have drivers' probe functions call nand_scan (split into ident and tail if necessary) as is done with
CONFIG_SYS_NAND_SELF_INIT.
include/dm/uclass-id.h enum uclass_id { · line 53
Quoted 10 lines
include/dm/uclass-id.h +1
-0@@ -49,6 +49,7 @@ enum uclass_id {UCLASS_MMC ,/* SD / MMC card or chip */ UCLASS_MOD_EXP ,/* RSA Mod Exp device */ UCLASS_MTD ,/* Memory Technology Device (MTD) device */ + UCLASS_NAND, /* NAND bus */
NAND is not a bus.
include/dm/uclass-id.h static inline nand_info_t *get_nand_dev_by_index(int · line 162
Quoted 12 lines
include/dm/uclass-id.h +4
-0+#ifndef CONFIG_DM_NAND static inline nand_info_t *get_nand_dev_by_index (int dev) { if (dev < 0 || dev >= CONFIG_SYS_MAX_NAND_DEVICE ||@@ -154,5 +156,8 @@ static inline nand_info_t *get_nand_dev_by_index(int dev) return &nand_info[dev]; } +#else +nand_info_t *get_nand_dev_by_index (int idx); +#endif
Please use "if X/else", not "if !X/else".
-Scott
PATCH 4/9 drivers: nand: implement a NAND uclass
Quoted 14 lines · Scott Wood
drivers/mtd/nand/nand-uclass.c line 49
Quoted 10 lines · Mugunthan V N
drivers/mtd/nand/nand-uclass.c new file +10
-0+static int nand_child_pre_probe (struct udevice *dev) +{ +nand_info_t *nand =dev_get_uclass_priv (dev); +void *priv =dev_get_priv (dev); + +/* +* Store nand device priv pointer in nand_info so that +* it can be used by nand command +*/ + nand->priv = priv;Wouldn't it make more sense to have a pointer to the device in the NAND struct, and let the driver manage both privs as it chooses?
This makes even less sense after seeing patch 5/9, which assumes dev priv is nand_info_t, and stores its own data in nand->priv. Won't this overwrite that?
-Scott
PATCH 4/9 drivers: nand: implement a NAND uclass
Hi Scott
Quoted 16 lines · Scott Wood
Quoted 14 lines · Scott Wood
drivers/mtd/nand/nand-uclass.c line 49
Quoted 10 lines · Mugunthan V N
drivers/mtd/nand/nand-uclass.c new file +10
-0+static int nand_child_pre_probe (struct udevice *dev) +{ +nand_info_t *nand =dev_get_uclass_priv (dev); +void *priv =dev_get_priv (dev); + +/* +* Store nand device priv pointer in nand_info so that +* it can be used by nand command +*/ + nand->priv = priv;Wouldn't it make more sense to have a pointer to the device in the NAND struct, and let the driver manage both privs as it chooses?
Quoted 3 lines
This makes even less sense after seeing patch 5/9, which assumes dev priv is
nand_info_t, and stores its own data innand->priv. Won't this overwrite that?
This nand is not the same as in omap_gpmc driver priv nand, here nand specifies nand_info_t which is "struct mtd_info" and in omap_gpmc driver it is "struct nand_chip".
In class:
(nand_info_t) nand->priv = driver priv, ie nand_chip
In driver:
(nand_chip) nand->priv = struct omap_nand_info * (internal to driver)
So both are different and used for different purposes.
Regards
Mugunthan V N
PATCH 4/9 drivers: nand: implement a NAND uclass
In reply to Mugunthan V NHi Mugunthan,
Quoted 71 lines · Mugunthan V N
Implement a NAND uclass so that the NAND devices can be accessed via the DM framework.
Signed-off-by Mugunthan V N <[email protected]>--- drivers/mtd/nand/Kconfig | 10 +++++++ drivers/mtd/nand/Makefile | 2 ++ drivers/mtd/nand/nand-uclass.c | 62 ++++++++++++++++++++++++++++++++++++++++++ drivers/mtd/nand/nand.c | 6 +++- include/dm/uclass-id.h | 1 + include/nand.h | 5 ++++ 6 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 drivers/mtd/nand/nand-uclass.cdrivers/mtd/nand/Kconfig +10
-0@@ -8,6 +8,16 @@ menuconfig NAND if NAND +config DM_NAND + bool "Enable driver model for NAND" + depends on NAND && DM + help + Enable driver model for NAND. The NAND interface is then + implemented by the NAND uclass. Multiple NAND devices can + be attached and used. The 'nand' command works as normal. + + If the NAND drivers doesn't support DM, say N. + config SYS_NAND_SELF_INIT bool helpdrivers/mtd/nand/Makefile +2
-0@@ -39,6 +39,8 @@ endif # not spl ifdef NORMAL_DRIVERS +obj-$(CONFIG_DM_NAND) += nand-uclass.o + obj-$(CONFIG_NAND_ECC_BCH) += nand_bch.o obj-$(CONFIG_NAND_ATMEL) += atmel_nand.odrivers/mtd/nand/nand-uclass.c new file +17
-0@@ -0,0 +1,62 @@ +/* +* NAND uclass driver for NAND bus. +* +* (C) Copyright 2012-2016 +* Texas Instruments Incorporated, <www.ti.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <errno.h> +#include <nand.h> + +DECLARE_GLOBAL_DATA_PTR ; + +#ifdef CONFIG_DM_NAND
drivers/mtd/nand/nand-uclass.c line 27
Quoted 10 lines
drivers/mtd/nand/nand-uclass.c new file +10
-0+ +nand_info_t *get_nand_dev_by_index (int idx) +{ +nand_info_t *nand; +struct udevice *dev; +int ret; + + ret =uclass_get_device (UCLASS_NAND , idx, &dev); +if (ret) { +error ("NAND device (%d) not found\n" , idx);
This should return -ENODEV. Also please avoid printf() in drivers. The caller can report the error.
drivers/mtd/nand/nand-uclass.c line 35
Quoted 8 lines
drivers/mtd/nand/nand-uclass.c new file +8
-0+return NULL ; + } + + nand = (nand_info_t *)dev_get_uclass_priv (dev); +if (!nand) { +error ("Nand device not ready\n" ); +return NULL ; + }
But if the device has been probed ((with uclass_get_device()) then this cannot be NULL.
drivers/mtd/nand/nand-uclass.c line 43
Quoted 8 lines
drivers/mtd/nand/nand-uclass.c new file +8
-0+ +return nand; +} + +static int nand_child_pre_probe (struct udevice *dev) +{ +nand_info_t *nand =dev_get_uclass_priv (dev); +void *priv =dev_get_priv (dev);
Please use the actual struct here, not void.
drivers/mtd/nand/nand-uclass.c line 49
Quoted 6 lines
drivers/mtd/nand/nand-uclass.c new file +6
-0+ +/* +* Store nand device priv pointer in nand_info so that +* it can be used by nand command +*/ + nand->priv = priv;
()> +
Quoted 55 lines
drivers/mtd/nand/nand-uclass.c new file +12
-0+ return 0; +} + +UCLASS_DRIVER (nand) = { + .id =UCLASS_NAND , + .name ="nand" , + .flags =DM_UC_FLAG_SEQ_ALIAS , + .post_probe = nand_child_pre_probe, + .per_device_auto_alloc_size =sizeof (nand_info_t), +}; + +#endif drivers/mtd/nand/nand.c +5
-1@@ -21,7 +21,7 @@ int nand_curr_device = -1;nand_info_t nand_info[CONFIG_SYS_MAX_NAND_DEVICE ]; -#ifndef CONFIG_SYS_NAND_SELF_INIT +#if !defined(CONFIG_SYS_NAND_SELF_INIT ) && !defined(CONFIG_DM_NAND )static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE ];static ulong base_address[CONFIG_SYS_MAX_NAND_DEVICE ] =CONFIG_SYS_NAND_BASE_LIST ;#endif @@ -63,8 +63,10 @@ int nand_register(int devnum)static void nand_init_chip (int i) {struct mtd_info *mtd; +#ifndef CONFIG_DM_NAND struct nand_chip *nand = &nand_chip[i];ulong base_addr = base_address[i]; +#endif int maxchips =CONFIG_SYS_NAND_MAX_CHIPS ;if (maxchips <1 )@@ -74,11 +76,13 @@ static void nand_init_chip(int i)if (!mtd)return ; +#ifndef CONFIG_DM_NAND mtd->priv = nand; nand->IO_ADDR_R = nand->IO_ADDR_W = (void __iomem *)base_addr;if (board_nand_init (nand))return ; +#endif if (nand_scan (mtd, maxchips))return ;include/dm/uclass-id.h +0
-0
include/dm/uclass-id.h enum uclass_id { · line 52
Quoted 4 lines
include/dm/uclass-id.h +1
-0@@ -49,6 +49,7 @@ enum uclass_id {UCLASS_MMC ,/* SD / MMC card or chip */ UCLASS_MOD_EXP ,/* RSA Mod Exp device */ UCLASS_MTD ,/* Memory Technology Device (MTD) device */ + UCLASS_NAND, /* NAND bus */
Is 'bus' the right word? Perhaps 'device'?
Quoted 24 lines
include/dm/uclass-id.h +0
-0UCLASS_NORTHBRIDGE ,/* Intel Northbridge / SDRAM controller */ UCLASS_PANEL ,/* Display panel, such as an LCD */ UCLASS_PANEL_BACKLIGHT, /* Backlight controller for panel */include/nand.h +2
-0@@ -10,6 +10,7 @@#define _NAND_H_#include <config.h> +#include <dm.h> /* * All boards using a given driver must convert to self-init @@ -144,6 +145,7 @@ int spl_nand_erase_one(int block, int page);* * returns pointer to the nand device info structure or NULL on failure. */ +#ifndef CONFIG_DM_NAND static inline nand_info_t *get_nand_dev_by_index (int dev) { if (dev < 0 || dev >= CONFIG_SYS_MAX_NAND_DEVICE ||
include/nand.h static inline nand_info_t *get_nand_dev_by_index(int dev) · line 161
Quoted 6 lines
include/nand.h +3
-0@@ -154,5 +156,8 @@ static inline nand_info_t *get_nand_dev_by_index(int dev) return &nand_info[dev]; } +#else +nand_info_t *get_nand_dev_by_index (int idx); +#endif
Can you please document in this header file what dev_get_priv() holds for a NAND device, and dev_get_uclass_priv().
Quoted 5 lines
include/nand.h +0
-1#endif /* _NAND_H_ */ --2.8.0.rc3.9.g44915db
Regards,
Simon
PATCH 4/9 drivers: nand: implement a NAND uclass
Quoted 79 lines · Simon Glass
Hi Mugunthan,
Quoted 76 lines · Mugunthan V N
Implement a NAND uclass so that the NAND devices can be accessed via the DM framework.
Signed-off-by Mugunthan V N <[email protected]>--- drivers/mtd/nand/Kconfig | 10 +++++++ drivers/mtd/nand/Makefile | 2 ++ drivers/mtd/nand/nand-uclass.c | 62 ++++++++++++++++++++++++++++++++++++++++++ drivers/mtd/nand/nand.c | 6 +++- include/dm/uclass-id.h | 1 + include/nand.h | 5 ++++ 6 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 drivers/mtd/nand/nand-uclass.cdrivers/mtd/nand/Kconfig +10
-0@@ -8,6 +8,16 @@ menuconfig NAND if NAND +config DM_NAND + bool "Enable driver model for NAND" + depends on NAND && DM + help + Enable driver model for NAND. The NAND interface is then + implemented by the NAND uclass. Multiple NAND devices can + be attached and used. The 'nand' command works as normal. + + If the NAND drivers doesn't support DM, say N. + config SYS_NAND_SELF_INIT bool helpdrivers/mtd/nand/Makefile +2
-0@@ -39,6 +39,8 @@ endif # not spl ifdef NORMAL_DRIVERS +obj-$(CONFIG_DM_NAND) += nand-uclass.o + obj-$(CONFIG_NAND_ECC_BCH) += nand_bch.o obj-$(CONFIG_NAND_ATMEL) += atmel_nand.odrivers/mtd/nand/nand-uclass.c new file +22
-0@@ -0,0 +1,62 @@ +/* +* NAND uclass driver for NAND bus. +* +* (C) Copyright 2012-2016 +* Texas Instruments Incorporated, <www.ti.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <errno.h> +#include <nand.h> + +DECLARE_GLOBAL_DATA_PTR ; + +#ifdef CONFIG_DM_NAND + +nand_info_t *get_nand_dev_by_index (int idx) +{ +nand_info_t *nand; +struct udevice *dev;
Quoted 9 lines
drivers/mtd/nand/nand-uclass.c line 27
Quoted 5 lines
drivers/mtd/nand/nand-uclass.c new file +5
-0+int ret; + + ret =uclass_get_device (UCLASS_NAND , idx, &dev); +if (ret) { +error ("NAND device (%d) not found\n" , idx);This should return
-ENODEV. Also please avoidprintf()in drivers. The caller can report the error.
Return type is pointer so returned NULL and NULL denotes no dev. Will change this error to debug in v2.
Quoted 11 lines
drivers/mtd/nand/nand-uclass.c line 35
Quoted 8 lines
drivers/mtd/nand/nand-uclass.c new file +8
-0+return NULL ; + } + + nand = (nand_info_t *)dev_get_uclass_priv (dev); +if (!nand) { +error ("Nand device not ready\n" ); +return NULL ; + }But if the device has been probed ((with
uclass_get_device()) then this cannot be NULL.
This check is just a failsafe. ideally it should not fail here.
Quoted 11 lines
drivers/mtd/nand/nand-uclass.c line 43
Quoted 9 lines
drivers/mtd/nand/nand-uclass.c new file +8
-0+ +return nand; +} + +static int nand_child_pre_probe (struct udevice *dev) +{ +nand_info_t *nand =dev_get_uclass_priv (dev); +void *priv =dev_get_priv (dev);Please use the actual struct here, not void.
nand->priv is a void *, so used void *
Quoted 56 lines
drivers/mtd/nand/nand-uclass.c line 49
Quoted 7 lines
drivers/mtd/nand/nand-uclass.c new file +6
-0+ +/* +* Store nand device priv pointer in nand_info so that +* it can be used by nand command +*/ + nand->priv = priv;()> +
Quoted 48 lines
drivers/mtd/nand/nand-uclass.c new file +12
-0+ return 0; +} + +UCLASS_DRIVER (nand) = { + .id =UCLASS_NAND , + .name ="nand" , + .flags =DM_UC_FLAG_SEQ_ALIAS , + .post_probe = nand_child_pre_probe, + .per_device_auto_alloc_size =sizeof (nand_info_t), +}; + +#endif drivers/mtd/nand/nand.c +5
-1@@ -21,7 +21,7 @@ int nand_curr_device = -1;nand_info_t nand_info[CONFIG_SYS_MAX_NAND_DEVICE ]; -#ifndef CONFIG_SYS_NAND_SELF_INIT +#if !defined(CONFIG_SYS_NAND_SELF_INIT ) && !defined(CONFIG_DM_NAND )static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE ];static ulong base_address[CONFIG_SYS_MAX_NAND_DEVICE ] =CONFIG_SYS_NAND_BASE_LIST ;#endif @@ -63,8 +63,10 @@ int nand_register(int devnum)static void nand_init_chip (int i) {struct mtd_info *mtd; +#ifndef CONFIG_DM_NAND struct nand_chip *nand = &nand_chip[i];ulong base_addr = base_address[i]; +#endif int maxchips =CONFIG_SYS_NAND_MAX_CHIPS ;if (maxchips <1 )@@ -74,11 +76,13 @@ static void nand_init_chip(int i)if (!mtd)return ; +#ifndef CONFIG_DM_NAND mtd->priv = nand; nand->IO_ADDR_R = nand->IO_ADDR_W = (void __iomem *)base_addr;if (board_nand_init (nand))return ; +#endif
Quoted 13 lines
include/dm/uclass-id.h enum uclass_id { · line 52
Quoted 11 lines
drivers/mtd/nand/nand.c +0
-0if (nand_scan (mtd, maxchips))return ;include/dm/uclass-id.h +1
-0@@ -49,6 +49,7 @@ enum uclass_id {UCLASS_MMC ,/* SD / MMC card or chip */ UCLASS_MOD_EXP ,/* RSA Mod Exp device */ UCLASS_MTD ,/* Memory Technology Device (MTD) device */ + UCLASS_NAND, /* NAND bus */Is 'bus' the right word? Perhaps 'device'?
Yeah, will fix this in v2
Quoted 26 lines
Quoted 26 lines
include/dm/uclass-id.h +0
-0UCLASS_NORTHBRIDGE ,/* Intel Northbridge / SDRAM controller */ UCLASS_PANEL ,/* Display panel, such as an LCD */ UCLASS_PANEL_BACKLIGHT, /* Backlight controller for panel */include/nand.h +2
-0@@ -10,6 +10,7 @@#define _NAND_H_#include <config.h> +#include <dm.h> /* * All boards using a given driver must convert to self-init @@ -144,6 +145,7 @@ int spl_nand_erase_one(int block, int page);* * returns pointer to the nand device info structure or NULL on failure. */ +#ifndef CONFIG_DM_NAND static inline nand_info_t *get_nand_dev_by_index (int dev) { if (dev < 0 || dev >= CONFIG_SYS_MAX_NAND_DEVICE ||@@ -154,5 +156,8 @@ static inline nand_info_t *get_nand_dev_by_index(int dev)
Quoted 8 lines
include/nand.h static inline nand_info_t *get_nand_dev_by_index(int dev) · line 161
Quoted 5 lines
include/nand.h +3
-0return &nand_info[dev]; } +#else +nand_info_t *get_nand_dev_by_index (int idx); +#endif Can you please document in this header file what
dev_get_priv()holds for a NAND device, anddev_get_uclass_priv().
Will document this in v2
Regards
Mugunthan V N
PATCH 4/9 drivers: nand: implement a NAND uclass
Hi Mugunthan,
Quoted 90 lines · Mugunthan V N
Quoted 79 lines · Simon Glass
Hi Mugunthan,
Quoted 76 lines · Mugunthan V N
Implement a NAND uclass so that the NAND devices can be accessed via the DM framework.
Signed-off-by Mugunthan V N <[email protected]>--- drivers/mtd/nand/Kconfig | 10 +++++++ drivers/mtd/nand/Makefile | 2 ++ drivers/mtd/nand/nand-uclass.c | 62 ++++++++++++++++++++++++++++++++++++++++++ drivers/mtd/nand/nand.c | 6 +++- include/dm/uclass-id.h | 1 + include/nand.h | 5 ++++ 6 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 drivers/mtd/nand/nand-uclass.cdrivers/mtd/nand/Kconfig +10
-0@@ -8,6 +8,16 @@ menuconfig NAND if NAND +config DM_NAND + bool "Enable driver model for NAND" + depends on NAND && DM + help + Enable driver model for NAND. The NAND interface is then + implemented by the NAND uclass. Multiple NAND devices can + be attached and used. The 'nand' command works as normal. + + If the NAND drivers doesn't support DM, say N. + config SYS_NAND_SELF_INIT bool helpdrivers/mtd/nand/Makefile +2
-0@@ -39,6 +39,8 @@ endif # not spl ifdef NORMAL_DRIVERS +obj-$(CONFIG_DM_NAND) += nand-uclass.o + obj-$(CONFIG_NAND_ECC_BCH) += nand_bch.o obj-$(CONFIG_NAND_ATMEL) += atmel_nand.odrivers/mtd/nand/nand-uclass.c new file +22
-0@@ -0,0 +1,62 @@ +/* +* NAND uclass driver for NAND bus. +* +* (C) Copyright 2012-2016 +* Texas Instruments Incorporated, <www.ti.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <errno.h> +#include <nand.h> + +DECLARE_GLOBAL_DATA_PTR ; + +#ifdef CONFIG_DM_NAND + +nand_info_t *get_nand_dev_by_index (int idx) +{ +nand_info_t *nand; +struct udevice *dev;Quoted 9 lines
drivers/mtd/nand/nand-uclass.c line 27
Quoted 5 lines
drivers/mtd/nand/nand-uclass.c new file +5
-0+int ret; + + ret =uclass_get_device (UCLASS_NAND , idx, &dev); +if (ret) { +error ("NAND device (%d) not found\n" , idx);This should return
-ENODEV. Also please avoidprintf()in drivers. The caller can report the error.
Quoted 2 lines
Return type is pointer so returned NULL and NULL denotes no dev. Will change this error to debug in v2.
OK, I see that this is the existing API.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
drivers/mtd/nand/nand-uclass.c new file +8
-0+return NULL ; + } + + nand = (nand_info_t *)dev_get_uclass_priv (dev); +if (!nand) { +error ("Nand device not ready\n" ); +return NULL ; + }
Quoted 4 lines
Quoted 2 lines
But if the device has been probed ((with
uclass_get_device()) then this cannot be NULL.This check is just a failsafe. ideally it should not fail here.
I cannot get to probe the device without this data, since this would be a bug in DM. So the check has no value.
[snip]
Regards,
Simon
PATCH 4/9 drivers: nand: implement a NAND uclass
Quoted 108 lines · Simon Glass
Hi Mugunthan,
Quoted 90 lines · Mugunthan V N
Quoted 79 lines · Simon Glass
Hi Mugunthan,
Quoted 76 lines · Mugunthan V N
Implement a NAND uclass so that the NAND devices can be accessed via the DM framework.
Signed-off-by Mugunthan V N <[email protected]>--- drivers/mtd/nand/Kconfig | 10 +++++++ drivers/mtd/nand/Makefile | 2 ++ drivers/mtd/nand/nand-uclass.c | 62 ++++++++++++++++++++++++++++++++++++++++++ drivers/mtd/nand/nand.c | 6 +++- include/dm/uclass-id.h | 1 + include/nand.h | 5 ++++ 6 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 drivers/mtd/nand/nand-uclass.cdrivers/mtd/nand/Kconfig +10
-0@@ -8,6 +8,16 @@ menuconfig NAND if NAND +config DM_NAND + bool "Enable driver model for NAND" + depends on NAND && DM + help + Enable driver model for NAND. The NAND interface is then + implemented by the NAND uclass. Multiple NAND devices can + be attached and used. The 'nand' command works as normal. + + If the NAND drivers doesn't support DM, say N. + config SYS_NAND_SELF_INIT bool helpdrivers/mtd/nand/Makefile +2
-0@@ -39,6 +39,8 @@ endif # not spl ifdef NORMAL_DRIVERS +obj-$(CONFIG_DM_NAND) += nand-uclass.o + obj-$(CONFIG_NAND_ECC_BCH) += nand_bch.o obj-$(CONFIG_NAND_ATMEL) += atmel_nand.odrivers/mtd/nand/nand-uclass.c new file +22
-0@@ -0,0 +1,62 @@ +/* +* NAND uclass driver for NAND bus. +* +* (C) Copyright 2012-2016 +* Texas Instruments Incorporated, <www.ti.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <errno.h> +#include <nand.h> + +DECLARE_GLOBAL_DATA_PTR ; + +#ifdef CONFIG_DM_NAND + +nand_info_t *get_nand_dev_by_index (int idx) +{ +nand_info_t *nand; +struct udevice *dev;Quoted 9 lines
drivers/mtd/nand/nand-uclass.c line 27
Quoted 5 lines
drivers/mtd/nand/nand-uclass.c new file +5
-0+int ret; + + ret =uclass_get_device (UCLASS_NAND , idx, &dev); +if (ret) { +error ("NAND device (%d) not found\n" , idx);This should return
-ENODEV. Also please avoidprintf()in drivers. The caller can report the error.Quoted 2 lines
Return type is pointer so returned NULL and NULL denotes no dev. Will change this error to debug in v2.
OK, I see that this is the existing API.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
drivers/mtd/nand/nand-uclass.c new file +8
-0+return NULL ; + } + + nand = (nand_info_t *)dev_get_uclass_priv (dev); +if (!nand) { +error ("Nand device not ready\n" ); +return NULL ; + }
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
But if the device has been probed ((with
uclass_get_device()) then this cannot be NULL.This check is just a failsafe. ideally it should not fail here.
I cannot get to probe the device without this data, since this would be a bug in DM. So the check has no value.
Okay then I will remove this check as it doesn't add value.
Regards
Mugunthan V N
PATCH 5/9 drivers: nand: omap_gpmc: convert driver to adopt driver model
In reply to Mugunthan V Nadopt omap_gpmc driver to driver model.
--- drivers/mtd/nand/omap_gpmc.c | 205 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 205 insertions(+)
drivers/mtd/nand/omap_gpmc.c +205 -0
@@ -16,6 +16,10 @@#include <nand.h> #include <linux/mtd/omap_elm.h> +#include <dm.h> + +DECLARE_GLOBAL_DATA_PTR ; +#define BADBLOCK_MARKER_LENGTH 2#define SECTOR_BYTES 512#define ECCCLEAR (0x1 << 8)
@@ -46,11 +50,22 @@ struct omap_nand_info {enum omap_ecc ecc_scheme;uint8_t cs;uint8_t ws;/* wait status pin (0,1) */ +uint8_t bus_width;/* Bus width of NAND device */ }; +#ifndef CONFIG_DM_NAND /* We are wasting a bit of memory but al least we are safe */ static struct omap_nand_info omap_nand_info[GPMC_MAX_CS ]; +#else + +struct omap_gpmc_platdata { +struct omap_nand_info *omap_nand_info; +struct gpmc *gpmc_cfg; +int max_cs; +}; +#endif +/* * omap_nand_hwcontrol - Set the address pointers corretly for the * following address/data/command operation
@@ -943,6 +958,8 @@ int __maybe_unused omap_nand_switch_ecc(uint32_t hardware, uint32_t eccstrength) }#endif /* CONFIG_SPL_BUILD */ +#ifndef CONFIG_DM_NAND +/* * Board-specific NAND initialization. The following members of the * argument are board-specific:
@@ -1034,3 +1051,191 @@ int board_nand_init(struct nand_chip *nand)return 0 ; } + +#else /* CONFIG_DM_NAND */ + +static int omap_gpmc_probe (struct udevice *dev) +{ +struct nand_chip *nand =dev_get_priv (dev); +struct omap_gpmc_platdata *pdata =dev_get_platdata (dev); +struct gpmc *gpmc_cfg = pdata->gpmc_cfg; +int32_t gpmc_config =0 ; +int ecc_opt; +int cs = cs_next++; +int err =0 ; + +while (cs < pdata->max_cs) { +/* Check if NAND type is set */ +if ((readl (&gpmc_cfg->cs[cs].config1) &0xC00 ) ==0x800 ) { +/* Found it!! */ +break ; + } + cs++; + } + +if (cs >= pdata->max_cs) { +printf ("nand: error: Unable to find NAND settings in GPMC Configuration - quitting\n" ); +return -ENODEV ; + } + + gpmc_config =readl (&gpmc_cfg->config); +/* Disable Write protect */ + gpmc_config |=0x10 ; +writel (gpmc_config, &gpmc_cfg->config); + + nand->IO_ADDR_R = (void __iomem *)&gpmc_cfg->cs[cs].nand_dat; + nand->IO_ADDR_W = (void __iomem *)&gpmc_cfg->cs[cs].nand_cmd; + nand->priv = &pdata->omap_nand_info[cs]; + nand->cmd_ctrl = omap_nand_hwcontrol; + nand->options |=NAND_NO_PADDING |NAND_CACHEPRG ; + nand->chip_delay =100 ; + nand->ecc.layout = &omap_ecclayout; + +/* configure driver and controller based on NAND device bus-width */ + gpmc_config =readl (&gpmc_cfg->cs[cs].config1); +if (pdata->omap_nand_info[cs].bus_width ==16 ) { + nand->options |=NAND_BUSWIDTH_16 ; +writel (gpmc_config | (0x1 <<12 ), &gpmc_cfg->cs[cs].config1); + }else { + nand->options &= ~NAND_BUSWIDTH_16 ; +writel (gpmc_config & ~(0x1 <<12 ), &gpmc_cfg->cs[cs].config1); + } + + ecc_opt = pdata->omap_nand_info[cs].ecc_scheme; +/* select ECC scheme */ +if (ecc_opt !=OMAP_ECC_HAM1_CODE_SW ) { + err =omap_select_ecc_scheme (nand, ecc_opt, +CONFIG_SYS_NAND_PAGE_SIZE , +CONFIG_SYS_NAND_OOBSIZE ); + }else { +/* +* pagesize and oobsize are not required to +* configure sw ecc-scheme +*/ + err =omap_select_ecc_scheme (nand, ecc_opt,0 ,0 ); + } +if (err) +return err; + +#ifdef CONFIG_NAND_OMAP_GPMC_PREFETCH + nand->read_buf = omap_nand_read_prefetch; +#else +if (nand->options &NAND_BUSWIDTH_16 ) + nand->read_buf = nand_read_buf16; +else + nand->read_buf = nand_read_buf; +#endif + + nand->dev_ready = omap_dev_ready; + +return 0 ; +} + +static int omap_gpmc_get_ecc_opt (int node,int elm_node) +{ +const void *fdt = gd->fdt_blob; +const char *ecc_str; +int ecc_opt = -ENOENT ; + + ecc_str =fdt_getprop (fdt, node,"ti,nand-ecc-opt" ,NULL ); +if (!ecc_str) { +error ("DT entry for ti,nand-ecc-opt not found\n" ); +return -ENOENT ; + } + +if (!strcmp (ecc_str,"sw" )) { + ecc_opt =OMAP_ECC_HAM1_CODE_SW ; + }else if (!strcmp (ecc_str,"ham1" ) || + !strcmp (ecc_str,"hw" ) || + !strcmp (ecc_str,"hw-romcode" )) { + ecc_opt =OMAP_ECC_HAM1_CODE_HW ; + }else if (!strcmp (ecc_str,"bch4" )) { +if (elm_node >0 ) + ecc_opt =OMAP_ECC_BCH4_CODE_HW ; +else + ecc_opt =OMAP_ECC_BCH4_CODE_HW_DETECTION_SW ; + }else if (!strcmp (ecc_str,"bch8" )) { +if (elm_node >0 ) + ecc_opt =OMAP_ECC_BCH8_CODE_HW ; +else + ecc_opt =OMAP_ECC_BCH8_CODE_HW_DETECTION_SW ; + }else if (!strcmp (ecc_str,"bch16" )) { +if (elm_node >0 ) + ecc_opt =OMAP_ECC_BCH16_CODE_HW ; +else +error ("BCH16 requires ELM support\n" ); + }else { +error ("ti,nand-ecc-opt invalid value\n" ); +return -EINVAL ; + } + +return ecc_opt; +} + +static int omap_gpmc_ofdata_to_platdata (struct udevice *dev) +{ +struct omap_gpmc_platdata *pdata =dev_get_platdata (dev); +const void *fdt = gd->fdt_blob; +int node = dev->of_offset; +int subnode; + + pdata->gpmc_cfg = (struct gpmc *)dev_get_addr (dev); + pdata->max_cs =fdtdec_get_int (fdt, node,"gpmc,num-cs" ,-1 ); +if (pdata->max_cs <0 ) { +error ("max chip select not found in DT\n" ); +return -ENOENT ; + } + + pdata->omap_nand_info =calloc (pdata->max_cs, +sizeof (struct omap_nand_info )); +if (!pdata->omap_nand_info) +return -ENOMEM ; + +fdt_for_each_subnode (fdt, subnode, node) { +int cs; +int len; +int elm_node; +const char *name; +struct omap_nand_info *nand_info; + + name =fdt_get_name (fdt, subnode, &len); +if (strncmp (name,"nand" ,4 )) +continue ; + + cs =fdtdec_get_int (fdt, subnode,"reg" ,-1 ); +if (cs <0 || cs >= pdata->max_cs) { +error ("Invalid cs for nand device\n" ); +return -EINVAL ; + } + nand_info = &pdata->omap_nand_info[cs]; + +/* get bus width 8 or 16, if not present 8 */ + nand_info->bus_width =fdtdec_get_int (fdt, subnode, +"nand-bus-width" ,8 ); + + elm_node =fdtdec_lookup_phandle (fdt, subnode,"ti,elm-id" ); + + nand_info->ecc_scheme =omap_gpmc_get_ecc_opt (subnode, + elm_node); +if (nand_info->ecc_scheme <0 ) +return nand_info->ecc_scheme; + } +return 0 ; +} + +static const struct udevice_id omap_gpmc_ids[] = { + { .compatible ="ti,am3352-gpmc" }, + { } +}; + +U_BOOT_DRIVER (omap_gpmc) = { + .name ="omap_gpmc" , + .id =UCLASS_NAND , + .of_match = omap_gpmc_ids, + .ofdata_to_platdata = omap_gpmc_ofdata_to_platdata, + .probe = omap_gpmc_probe, + .priv_auto_alloc_size =sizeof (struct nand_chip ), + .platdata_auto_alloc_size =sizeof (struct omap_gpmc_platdata ), + .flags =DM_FLAG_ALLOC_PRIV_DMA , +}; +#endif /* CONFIG_DM_NAND */
Signature · 1 line
2.8.0.rc3.9.g44915db
PATCH 5/9 drivers: nand: omap_gpmc: convert driver to adopt driver model
Quoted 3 lines · Mugunthan V N
adopt
omap_gpmcdriver to driver model.Signed-off-by Mugunthan V N <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160401/081528d7/attachment.sig>
PATCH 5/9 drivers: nand: omap_gpmc: convert driver to adopt driver model
In reply to Mugunthan V NQuoted 134 lines · Mugunthan V N
adopt
omap_gpmcdriver to driver model.Signed-off-by Mugunthan V N <[email protected]>--- drivers/mtd/nand/omap_gpmc.c | 205 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 205 insertions(+)drivers/mtd/nand/omap_gpmc.c +17
-0@@ -16,6 +16,10 @@#include <nand.h> #include <linux/mtd/omap_elm.h> +#include <dm.h> + +DECLARE_GLOBAL_DATA_PTR ; +#define BADBLOCK_MARKER_LENGTH 2#define SECTOR_BYTES 512#define ECCCLEAR (0x1 << 8)@@ -46,11 +50,22 @@ struct omap_nand_info {enum omap_ecc ecc_scheme;uint8_t cs;uint8_t ws;/* wait status pin (0,1) */ +uint8_t bus_width;/* Bus width of NAND device */ }; +#ifndef CONFIG_DM_NAND /* We are wasting a bit of memory but al least we are safe */ static struct omap_nand_info omap_nand_info[GPMC_MAX_CS ]; +#else + +struct omap_gpmc_platdata { +struct omap_nand_info *omap_nand_info; +struct gpmc *gpmc_cfg; +int max_cs; +}; +#endif +/* * omap_nand_hwcontrol - Set the address pointers corretly for the * following address/data/command operation @@ -943,6 +958,8 @@ int __maybe_unused omap_nand_switch_ecc(uint32_t hardware, uint32_t eccstrength) }#endif /* CONFIG_SPL_BUILD */ +#ifndef CONFIG_DM_NAND +/* * Board-specific NAND initialization. The following members of the * argument are board-specific:
drivers/mtd/nand/omap_gpmc.c +24
-0@@ -1034,3 +1051,191 @@ int board_nand_init(struct nand_chip *nand)return 0 ; } + +#else /* CONFIG_DM_NAND */ + +static int omap_gpmc_probe (struct udevice *dev) +{ +struct nand_chip *nand =dev_get_priv (dev); +struct omap_gpmc_platdata *pdata =dev_get_platdata (dev); +struct gpmc *gpmc_cfg = pdata->gpmc_cfg; +int32_t gpmc_config =0 ; +int ecc_opt; +int cs = cs_next++; +int err =0 ; + +while (cs < pdata->max_cs) { +/* Check if NAND type is set */ +if ((readl (&gpmc_cfg->cs[cs].config1) &0xC00 ) ==0x800 ) { +/* Found it!! */ +break ; + } + cs++; + } + +if (cs >= pdata->max_cs) { + printf("nand: error: Unable to find NAND settings in GPMCConfiguration - quitting\n");
drivers/mtd/nand/omap_gpmc.c +17
-0+return -ENODEV ; + } + + gpmc_config =readl (&gpmc_cfg->config); +/* Disable Write protect */ + gpmc_config |=0x10 ; +writel (gpmc_config, &gpmc_cfg->config); + + nand->IO_ADDR_R = (void __iomem *)&gpmc_cfg->cs[cs].nand_dat; + nand->IO_ADDR_W = (void __iomem *)&gpmc_cfg->cs[cs].nand_cmd; + nand->priv = &pdata->omap_nand_info[cs]; + nand->cmd_ctrl = omap_nand_hwcontrol; + nand->options |=NAND_NO_PADDING |NAND_CACHEPRG ; + nand->chip_delay =100 ; + nand->ecc.layout = &omap_ecclayout; + +/* configure driver and controller based on NAND device bus-width */
drivers/mtd/nand/omap_gpmc.c +28
-2+ gpmc_config =readl (&gpmc_cfg->cs[cs].config1); + if (pdata->omap_nand_info[cs].bus_width == 16) { + nand->options |= NAND_BUSWIDTH_16; + writel(gpmc_config | (0x1 << 12), &gpmc_cfg ->cs[cs].config1); + } else { + nand->options &= ~NAND_BUSWIDTH_16; + writel(gpmc_config & ~(0x1 << 12), &gpmc_cfg ->cs[cs].config1); + } + + ecc_opt = pdata->omap_nand_info[cs].ecc_scheme; + /* select ECC scheme */ + if (ecc_opt != OMAP_ECC_HAM1_CODE_SW) { + err = omap_select_ecc_scheme(nand, ecc_opt, + CONFIG_SYS_NAND_PAGE_SIZE, + CONFIG_SYS_NAND_OOBSIZE); + } else { + /* + * pagesize and oobsize are not required to + * configure sw ecc-scheme + */ + err = omap_select_ecc_scheme(nand, ecc_opt, 0, 0); + } + if (err) + return err; + +#ifdef CONFIG_NAND_OMAP_GPMC_PREFETCH + nand->read_buf = omap_nand_read_prefetch; +#else
drivers/mtd/nand/omap_gpmc.c int board_nand_init(struct nand_chip *nand) · line 1132
Quoted 10 lines
drivers/mtd/nand/omap_gpmc.c +10
-0+if (nand->options &NAND_BUSWIDTH_16 ) + nand->read_buf = nand_read_buf16; +else + nand->read_buf = nand_read_buf; +#endif + + nand->dev_ready = omap_dev_ready; + +return 0 ; +}
Is it really necessary to duplicate the entire probe func based on DM?
-Scott
PATCH 5/9 drivers: nand: omap_gpmc: convert driver to adopt driver model
Quoted 139 lines · Scott Wood
Quoted 138 lines · Mugunthan V N
adopt
omap_gpmcdriver to driver model.Signed-off-by Mugunthan V N <[email protected]>--- drivers/mtd/nand/omap_gpmc.c | 205 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 205 insertions(+)drivers/mtd/nand/omap_gpmc.c +17
-0@@ -16,6 +16,10 @@#include <nand.h> #include <linux/mtd/omap_elm.h> +#include <dm.h> + +DECLARE_GLOBAL_DATA_PTR ; +#define BADBLOCK_MARKER_LENGTH 2#define SECTOR_BYTES 512#define ECCCLEAR (0x1 << 8)@@ -46,11 +50,22 @@ struct omap_nand_info {enum omap_ecc ecc_scheme;uint8_t cs;uint8_t ws;/* wait status pin (0,1) */ +uint8_t bus_width;/* Bus width of NAND device */ }; +#ifndef CONFIG_DM_NAND /* We are wasting a bit of memory but al least we are safe */ static struct omap_nand_info omap_nand_info[GPMC_MAX_CS ]; +#else + +struct omap_gpmc_platdata { +struct omap_nand_info *omap_nand_info; +struct gpmc *gpmc_cfg; +int max_cs; +}; +#endif +/* * omap_nand_hwcontrol - Set the address pointers corretly for the * following address/data/command operation @@ -943,6 +958,8 @@ int __maybe_unused omap_nand_switch_ecc(uint32_t hardware, uint32_t eccstrength) }#endif /* CONFIG_SPL_BUILD */ +#ifndef CONFIG_DM_NAND +/* * Board-specific NAND initialization. The following members of the * argument are board-specific:
drivers/mtd/nand/omap_gpmc.c +24
-0@@ -1034,3 +1051,191 @@ int board_nand_init(struct nand_chip *nand)return 0 ; } + +#else /* CONFIG_DM_NAND */ + +static int omap_gpmc_probe (struct udevice *dev) +{ +struct nand_chip *nand =dev_get_priv (dev); +struct omap_gpmc_platdata *pdata =dev_get_platdata (dev); +struct gpmc *gpmc_cfg = pdata->gpmc_cfg; +int32_t gpmc_config =0 ; +int ecc_opt; +int cs = cs_next++; +int err =0 ; + +while (cs < pdata->max_cs) { +/* Check if NAND type is set */ +if ((readl (&gpmc_cfg->cs[cs].config1) &0xC00 ) ==0x800 ) { +/* Found it!! */ +break ; + } + cs++; + } + +if (cs >= pdata->max_cs) { + printf("nand: error: Unable to find NAND settings in GPMCConfiguration - quitting\n");
drivers/mtd/nand/omap_gpmc.c +17
-0+return -ENODEV ; + } + + gpmc_config =readl (&gpmc_cfg->config); +/* Disable Write protect */ + gpmc_config |=0x10 ; +writel (gpmc_config, &gpmc_cfg->config); + + nand->IO_ADDR_R = (void __iomem *)&gpmc_cfg->cs[cs].nand_dat; + nand->IO_ADDR_W = (void __iomem *)&gpmc_cfg->cs[cs].nand_cmd; + nand->priv = &pdata->omap_nand_info[cs]; + nand->cmd_ctrl = omap_nand_hwcontrol; + nand->options |=NAND_NO_PADDING |NAND_CACHEPRG ; + nand->chip_delay =100 ; + nand->ecc.layout = &omap_ecclayout; + +/* configure driver and controller based on NAND device bus-width */
drivers/mtd/nand/omap_gpmc.c +32
-2+ gpmc_config =readl (&gpmc_cfg->cs[cs].config1); + if (pdata->omap_nand_info[cs].bus_width == 16) { + nand->options |= NAND_BUSWIDTH_16; + writel(gpmc_config | (0x1 << 12), &gpmc_cfg ->cs[cs].config1); + } else { + nand->options &= ~NAND_BUSWIDTH_16; + writel(gpmc_config & ~(0x1 << 12), &gpmc_cfg ->cs[cs].config1); + } + + ecc_opt = pdata->omap_nand_info[cs].ecc_scheme; + /* select ECC scheme */ + if (ecc_opt != OMAP_ECC_HAM1_CODE_SW) { + err = omap_select_ecc_scheme(nand, ecc_opt, + CONFIG_SYS_NAND_PAGE_SIZE, + CONFIG_SYS_NAND_OOBSIZE); + } else { + /* + * pagesize and oobsize are not required to + * configure sw ecc-scheme + */ + err = omap_select_ecc_scheme(nand, ecc_opt, 0, 0); + } + if (err) + return err; + +#ifdef CONFIG_NAND_OMAP_GPMC_PREFETCH + nand->read_buf = omap_nand_read_prefetch; +#else + if (nand->options & NAND_BUSWIDTH_16) + nand->read_buf = nand_read_buf16; + else + nand->read_buf = nand_read_buf;
Quoted 9 lines
drivers/mtd/nand/omap_gpmc.c int board_nand_init(struct nand_chip *nand) · line 1132
Quoted 6 lines
drivers/mtd/nand/omap_gpmc.c +6
-0+#endif + + nand->dev_ready = omap_dev_ready; + +return 0 ; +}Is it really necessary to duplicate the entire probe func based on DM?
It is not duplicated directly, if it is duplicate I would had a fuction defined and call it in both DM and non-DM case. Removed some of the #if/else. Only TODO I left is I have not remove nand driver callbacks and move it to DM ops structure, which will be done soon.
Regards
Mugunthan V N
PATCH 6/9 am43xx_evm: nand: do not define DM_NAND for spl
In reply to Mugunthan V NSince OMAP's spl doesn't support DM currently, do not define DM_NAND for spl build.
--- include/configs/am43xx_evm.h | 1 + 1 file changed, 1 insertion(+)
include/configs/am43xx_evm.h +1 -0
@@ -146,6 +146,7 @@#undef CONFIG_DM_SPI#undef CONFIG_DM_SPI_FLASH#undef CONFIG_TIMER +#undef CONFIG_DM_NAND#endif #ifndef CONFIG_SPL_BUILD
Signature · 1 line
2.8.0.rc3.9.g44915db
PATCH 6/9 am43xx_evm: nand: do not define DM_NAND for spl
Quoted 4 lines · Mugunthan V N
Since OMAP's spl doesn't support DM currently, do not define
DM_NANDfor spl build.Signed-off-by Mugunthan V N <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160401/67e68715/attachment.sig>
PATCH 6/9 am43xx_evm: nand: do not define DM_NAND for spl
In reply to Mugunthan V NQuoted 7 lines · Mugunthan V N
Since OMAP's spl doesn't support DM currently, do not define
DM_NANDfor spl build.Signed-off-by Mugunthan V N <[email protected]>--- include/configs/am43xx_evm.h | 1 + 1 file changed, 1 insertion(+)
PATCH 7/9 defconfig: am437x_gp_evm: enable NAND driver model
In reply to Mugunthan V NEnable NAND driver model for am437x_gp_evm as omap_gpmc supports driver model.
--- configs/am437x_gp_evm_defconfig | 2 ++ 1 file changed, 2 insertions(+)
configs/am437x_gp_evm_defconfig +2 -0
@@ -22,3 +22,5 @@ CONFIG_TIMER=y CONFIG_OMAP_TIMER=y CONFIG_USB=y CONFIG_USB_GADGET=y +CONFIG_NAND=y +CONFIG_DM_NAND=y
Signature · 1 line
2.8.0.rc3.9.g44915db
PATCH 7/9 defconfig: am437x_gp_evm: enable NAND driver model
Quoted 4 lines · Mugunthan V N
Enable NAND driver model for
am437x_gp_evmasomap_gpmcsupports driver model.Signed-off-by Mugunthan V N <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160401/22e9fb96/attachment.sig>
PATCH 7/9 defconfig: am437x_gp_evm: enable NAND driver model
Quoted 8 lines · Tom Rini
Quoted 4 lines · Mugunthan V N
Enable NAND driver model for
am437x_gp_evmasomap_gpmcsupports driver model.Signed-off-by Mugunthan V N <[email protected]>Reviewed-by Tom Rini <[email protected]>
PATCH 8/9 am335x_evm: nand: do not define DM_NAND for spl
In reply to Mugunthan V NSince OMAP's spl doesn't support DM currently, do not define DM_NAND for spl build.
--- include/configs/am335x_evm.h | 1 + 1 file changed, 1 insertion(+)
include/configs/am335x_evm.h +1 -0
@@ -336,6 +336,7 @@#ifdef CONFIG_SPL_BUILD #undef CONFIG_DM_MMC#undef CONFIG_TIMER +#undef CONFIG_DM_NAND#endif #if defined(CONFIG_SPL_BUILD ) && defined(CONFIG_SPL_USBETH_SUPPORT )
Signature · 1 line
2.8.0.rc3.9.g44915db
PATCH 8/9 am335x_evm: nand: do not define DM_NAND for spl
Quoted 4 lines · Mugunthan V N
Since OMAP's spl doesn't support DM currently, do not define
DM_NANDfor spl build.Signed-off-by Mugunthan V N <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160401/72680e7b/attachment.sig>
PATCH 8/9 am335x_evm: nand: do not define DM_NAND for spl
Quoted 8 lines · Tom Rini
Quoted 4 lines · Mugunthan V N
Since OMAP's spl doesn't support DM currently, do not define
DM_NANDfor spl build.Signed-off-by Mugunthan V N <[email protected]>Reviewed-by Tom Rini <[email protected]>
PATCH 9/9 defconfig: am335x_gp_evm: enable NAND driver model
In reply to Mugunthan V NEnable NAND driver model for am335x_gp_evm as omap_gpmc supports driver model.
--- configs/am335x_gp_evm_defconfig | 2 ++ 1 file changed, 2 insertions(+)
configs/am335x_gp_evm_defconfig +2 -0
@@ -21,3 +21,5 @@ CONFIG_OMAP_TIMER=y CONFIG_USB=y CONFIG_USB_GADGET=y CONFIG_RSA=y +CONFIG_NAND=y +CONFIG_DM_NAND=y
Signature · 1 line
2.8.0.rc3.9.g44915db
PATCH 9/9 defconfig: am335x_gp_evm: enable NAND driver model
Quoted 7 lines · Mugunthan V N
Enable NAND driver model for
am335x_gp_evmasomap_gpmcsupports driver model.Signed-off-by Mugunthan V N <[email protected]>--- configs/am335x_gp_evm_defconfig | 2 ++ 1 file changed, 2 insertions(+)