nand: remove direct acces to nand_info array
Subsystems (9)
v4 cover nand: remove direct acces to nand_info array
This is a preparation required for adding Nand DM support. This series introduces new API get_nand_dev_by_index() to avoid direct acces to nand_info array and updates u-boot to use it. As result, nand_info array is made static in the last patch.
Changes in v4:
- rebased on top of git://git.denx.de/u-boot.git/master
- added patch for arch/arm/cpu/armv8/fsl-layerscape/ppa.c
- added "Reviewed-by" tags
Changes in v3:
- preparation patches separated from original series.
- fixed BeagleBoard-xM boot failure which has Nand enabled, but no Nand devices are presented on board physically.
- all current direct users were converted to use get_nand_dev_by_index() and nand_info array was made static finally.
link on v3:
- https://www.mail-archive.com/u-boot at lists.denx.de/msg238797.html link on v2:
- https://www.mail-archive.com/u-boot at lists.denx.de/msg237747.html
Grygorii Strashko (17):
common: env_nand: use get_nand_dev_by_index()
dfu: dfu_nand: use get_nand_dev_by_index()
cmd: bootm: use get_nand_dev_by_index()
cmd: jffs2: use get_nand_dev_by_index()
common: use get_nand_dev_by_index()
fs: use get_nand_dev_by_index()
cmd: nand: remove direct access to struct mtd_info->priv
net: phy: cortina: use get_nand_dev_by_index()
net: fm: use get_nand_dev_by_index()
mtd: nand: drv: use get_nand_dev_by_index()
cmd: mvebu: bubt: use get_nand_dev_by_index()
board: atmel: use get_nand_dev_by_index()
board: ronetix: use get_nand_dev_by_index()
board: BuR: use get_nand_dev_by_index()
board: toradex: use get_nand_dev_by_index()
armv8: fsl-layerscape: use get_nand_dev_by_index()
mtd: nand: make nand_info array static
Mugunthan V N (1):
cmd: nand: abstract global variable usage for dm conversion
arch/arm/cpu/armv8/fsl-layerscape/ppa.c | 15 +++--- board/BuR/common/common.c | 3 +- board/atmel/at91sam9261ek/at91sam9261ek.c | 2 +- board/atmel/at91sam9263ek/at91sam9263ek.c | 2 +- board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 2 +- board/atmel/at91sam9n12ek/at91sam9n12ek.c | 2 +- board/atmel/at91sam9rlek/at91sam9rlek.c | 2 +- board/atmel/at91sam9x5ek/at91sam9x5ek.c | 2 +- board/atmel/sama5d3xek/sama5d3xek.c | 2 +- board/atmel/sama5d4_xplained/sama5d4_xplained.c | 2 +- board/atmel/sama5d4ek/sama5d4ek.c | 2 +- board/ronetix/pm9261/pm9261.c | 2 +- board/ronetix/pm9263/pm9263.c | 2 +- board/toradex/colibri_t20/colibri_t20.c | 2 +- board/toradex/common/tdx-cfg-block.c | 12 +++-- cmd/bootm.c | 2 +- cmd/jffs2.c | 7 +-- cmd/mvebu/bubt.c | 14 +++-- cmd/nand.c | 69 ++++++++++++++----------- common/env_nand.c | 33 +++++++----- common/fb_nand.c | 2 +- common/splash_source.c | 5 +- drivers/dfu/dfu_nand.c | 12 ++--- drivers/mtd/nand/fsmc_nand.c | 2 +- drivers/mtd/nand/nand.c | 23 ++++++--- drivers/mtd/nand/omap_gpmc.c | 7 +-- drivers/mtd/nand/zynq_nand.c | 2 +- drivers/net/fm/fm.c | 3 +- drivers/net/phy/cortina.c | 3 +- fs/jffs2/jffs2_1pass.c | 9 +++- fs/jffs2/jffs2_nand_1pass.c | 6 ++- fs/yaffs2/yaffs_uboot_glue.c | 8 ++- include/nand.h | 10 +++- 33 files changed, 162 insertions(+), 109 deletions(-)
Signature · 1 line
2.10.1
PATCH v4 1/18 cmd: nand: abstract global variable usage for dm conversion
From: Mugunthan V N <[email protected]>
nand_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 | 69 +++++++++++++++++++++++++------------------- drivers/mtd/nand/nand.c | 21 ++++++++++---- drivers/mtd/nand/omap_gpmc.c | 7 ++--- include/nand.h | 9 ++++++ 4 files changed, 65 insertions(+), 41 deletions(-)
cmd/nand.c +39 -30
@@ -115,20 +115,20 @@ free_dat:static int set_dev (int dev) { -if (dev <0 || dev >=CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[dev]) { -puts ("No such device\n" ); -return -1 ; - } +struct mtd_info *mtd =get_nand_dev_by_index (dev); + +if (!mtd) +return -ENODEV ;if (nand_curr_device == dev)return 0 ; -printf ("Device %d: %s" , dev, nand_info[dev]->name); +printf ("Device %d: %s" , dev, mtd->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 (mtd->priv, dev);#endif return 0 ;
@@ -188,7 +188,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 )]; -struct mtd_info *mtd = nand_info[0 ]; +struct mtd_info *mtd =get_nand_dev_by_index (0 );char *cmd = argv[1 ];if (CONFIG_SYS_MAX_NAND_DEVICE ==0 || !mtd) {
@@ -213,9 +213,10 @@ int do_nand_env_oob(cmd_tbl_t *cmdtp, int argc, char *const argv[])if (argc <3 ) goto usage; + mtd =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 , mtd->size)) {puts ("Offset or partition name expected\n" );return 1 ; }
@@ -283,9 +284,14 @@ usage:static void nand_print_and_set_info (int idx) { -struct mtd_info *mtd = nand_info[idx]; -struct nand_chip *chip =mtd_to_nand (mtd); +struct mtd_info *mtd; +struct nand_chip *chip; + + mtd =get_nand_dev_by_index (idx); +if (!mtd) +return ; + chip =mtd_to_nand (mtd);printf ("Device %d: " , idx);if (chip->numchips >1 )printf ("%dx " , chip->numchips);
@@ -348,7 +354,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. */ -struct mtd_info *mtd = nand_info[dev]; +struct mtd_info *mtd =get_nand_dev_by_index (dev);loff_t maxoffset = offset + *size;int badblocks =0 ;
@@ -397,10 +403,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]) -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 +436,11 @@ 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]) { + mtd =get_nand_dev_by_index (dev); +if (!mtd) {puts ("\nno devices available\n" );return 1 ; } - mtd = nand_info[dev];if (strcmp (cmd,"bad" ) ==0 ) {printf ("\nDevice %d bad blocks:\n" , dev);
@@ -496,13 +499,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 ) + mtd->size) !=0 )return 1 ;if (set_dev (dev))return 1 ; - mtd = nand_info[dev]; + mtd =get_nand_dev_by_index (dev);memset (&opts,0 ,sizeof (opts)); opts.offset = off;
@@ -565,13 +568,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)) + mtd->size))return 1 ;if (set_dev (dev))return 1 ; - mtd = nand_info[dev]; + mtd =get_nand_dev_by_index (dev);if (argc >4 && !str2long (argv[4 ], &pagecount)) {printf ("'%s' is not a number\n" , argv[4 ]);
@@ -588,7 +591,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 ) + mtd->size) !=0 )return 1 ;if (set_dev (dev))
@@ -600,7 +603,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) rwsize = size; } - mtd = nand_info[dev]; + mtd =get_nand_dev_by_index (dev);if (!s || !strcmp (s,".jffs2" ) || !strcmp (s,".e" ) || !strcmp (s,".i" )) {
@@ -760,13 +763,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 ) + mtd->size) <0 )return 1 ;if (set_dev (dev))return 1 ; -if (!nand_unlock (nand_info[dev], off, size, allexcept)) { + mtd =get_nand_dev_by_index (dev); + +if (!nand_unlock (mtd, off, size, allexcept)) {puts ("NAND flash successfully unlocked\n" ); }else { puts("Error unlocking NAND flash, "
@@ -929,6 +934,7 @@ static int do_nandboot(cmd_tbl_t *cmdtp, int flag, int argc,char *boot_device =NULL ;int idx;ulong addr, offset =0 ; +struct mtd_info *mtd;#if defined(CONFIG_CMD_MTDPARTS )struct mtd_device *dev;struct part_info *part;
@@ -948,8 +954,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]); + + mtd =get_nand_dev_by_index (dev->id->num); +return nand_load_image (cmdtp, mtd, part->offset, + addr, argv[0]); } }#endif
@@ -991,14 +999,15 @@ usage: idx =simple_strtoul (boot_device,NULL ,16 ); -if (idx <0 || idx >=CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[idx]) { + mtd =get_nand_dev_by_index (idx); +if (!mtd) {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, mtd, offset, addr, argv[0 ]); } U_BOOT_CMD(nboot, 4, 1, do_nandboot,
drivers/mtd/nand/nand.c +15 -6
@@ -19,7 +19,6 @@ DECLARE_GLOBAL_DATA_PTR;int nand_curr_device =-1 ; -struct mtd_info *nand_info[CONFIG_SYS_MAX_NAND_DEVICE ];#ifndef CONFIG_SYS_NAND_SELF_INIT
@@ -31,12 +30,21 @@ static char dev_name[CONFIG_SYS_MAX_NAND_DEVICE][8];static unsigned long total_nand_size;/* in kiB */ +struct mtd_info *get_nand_dev_by_index (int dev) +{ +if (dev <0 || dev >=CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[dev] || + !nand_info[dev]->name) +return NULL ; + +return nand_info[dev]; +} +int nand_mtd_to_devnum (struct mtd_info *mtd) {int i; -for (i =0 ; i <ARRAY_SIZE (nand_info); i++) { -if (mtd && nand_info[i] == mtd) +for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) { +if (mtd &&get_nand_dev_by_index (i) == mtd)return i; }
@@ -101,8 +109,9 @@ static void create_mtd_concat(void)int i;for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) { -if (nand_info[i] !=NULL ) { - nand_info_list[nand_devices_found] = nand_info[i]; +struct mtd_info *mtd =get_nand_dev_by_index (i); +if (mtd !=NULL ) { + nand_info_list[nand_devices_found] = mtd; nand_devices_found++; } }
@@ -161,7 +170,7 @@ void nand_init(void)/* * Select the chip in the board/cpu specific driver */ -board_nand_select_device (mtd_to_nand (nand_info[nand_curr_device]), +board_nand_select_device (mtd_to_nand (get_nand_dev_by_index (nand_curr_device)), nand_curr_device);#endif
drivers/mtd/nand/omap_gpmc.c +2 -5
@@ -894,17 +894,14 @@ static int omap_select_ecc_scheme(struct nand_chip *nand,int __maybe_unused omap_nand_switch_ecc (uint32_t hardware,uint32_t eccstrength) {struct nand_chip *nand; -struct mtd_info *mtd; +struct mtd_info *mtd =get_nand_dev_by_index (nand_curr_device);int err =0 ; -if (nand_curr_device <0 || - nand_curr_device >=CONFIG_SYS_MAX_NAND_DEVICE || - !nand_info[nand_curr_device]) { +if (!mtd) {printf ("nand: error: no NAND devices found\n" );return -ENODEV ; } - mtd = nand_info[nand_curr_device]; nand =mtd_to_nand (mtd); nand->options |=NAND_OWN_BUFFERS ; nand->options &= ~NAND_SUBPAGE_READ ;
include/nand.h +9 -0
@@ -145,4 +145,13 @@ int spl_nand_erase_one(int block, int page);/* platform specific init functions */ void sunxi_nand_init (void ); +/* +* 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. +*/ +struct mtd_info *get_nand_dev_by_index (int dev); +#endif /* _NAND_H_ */
Signature · 1 line
2.10.1
PATCH v4 1/18 cmd: nand: abstract global variable usage for dm conversion
Hi,
Quoted 5 lines · Grygorii Strashko
From: Mugunthan V N <[email protected]>
nand_infois used all over the file so abstract it withget_nand_dev_by_index()which will help for DM conversion.
Quoted 8 lines
Signed-off-by Mugunthan V N <[email protected]>Signed-off-by Grygorii Strashko <[email protected]>--- cmd/nand.c | 69 +++++++++++++++++++++++++------------------- drivers/mtd/nand/nand.c | 21 ++++++++++---- drivers/mtd/nand/omap_gpmc.c | 7 ++--- include/nand.h | 9 ++++++ 4 files changed, 65 insertions(+), 41 deletions(-)
Is there a cover letter for this series please? I'm not sure what it does overall, or what your approach is.
Regards,
Simon
PATCH v4 1/18 cmd: nand: abstract global variable usage for dm conversion
Quoted 17 lines · Simon Glass
Hi,
Quoted 5 lines · Grygorii Strashko
From: Mugunthan V N <[email protected]>
nand_infois used all over the file so abstract it withget_nand_dev_by_index()which will help for DM conversion.Quoted 8 lines
Signed-off-by Mugunthan V N <[email protected]>Signed-off-by Grygorii Strashko <[email protected]>--- cmd/nand.c | 69 +++++++++++++++++++++++++------------------- drivers/mtd/nand/nand.c | 21 ++++++++++---- drivers/mtd/nand/omap_gpmc.c | 7 ++--- include/nand.h | 9 ++++++ 4 files changed, 65 insertions(+), 41 deletions(-)
Quoted 3 lines
Is there a cover letter for this series please? I'm not sure what it does overall, or what your approach is.
It should be and you are in cc, here is the link for your reference:
https://www.mail-archive.com/u-boot at lists.denx.de/msg254409.html
Signature · 2 lines
regards, -grygorii
PATCH v4 1/18 cmd: nand: abstract global variable usage for dm conversion
Hi,
Quoted 25 lines · Grygorii Strashko
Quoted 22 lines · Simon Glass
Hi,
Quoted 15 lines · Grygorii Strashko
From: Mugunthan V N <[email protected]>
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]>Signed-off-by Grygorii Strashko <[email protected]>--- cmd/nand.c | 69 +++++++++++++++++++++++++------------------- drivers/mtd/nand/nand.c | 21 ++++++++++---- drivers/mtd/nand/omap_gpmc.c | 7 ++--- include/nand.h | 9 ++++++ 4 files changed, 65 insertions(+), 41 deletions(-)
Quoted 6 lines
Quoted 3 lines
Is there a cover letter for this series please? I'm not sure what it does overall, or what your approach is.
It should be and you are in cc, here is the link for your reference:
https://www.mail-archive.com/u-boot at lists.denx.de/msg254409.html
OK, thank you. In a future series do you plan to remove nand_info[] ?
Regards,
Simon
PATCH v4 1/18 cmd: nand: abstract global variable usage for dm conversion
Quoted 28 lines · Simon Glass
Hi,
Quoted 25 lines · Grygorii Strashko
Quoted 22 lines · Simon Glass
Hi,
Quoted 15 lines · Grygorii Strashko
From: Mugunthan V N <[email protected]>
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]>Signed-off-by Grygorii Strashko <[email protected]>--- cmd/nand.c | 69 +++++++++++++++++++++++++------------------- drivers/mtd/nand/nand.c | 21 ++++++++++---- drivers/mtd/nand/omap_gpmc.c | 7 ++--- include/nand.h | 9 ++++++ 4 files changed, 65 insertions(+), 41 deletions(-)
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Is there a cover letter for this series please? I'm not sure what it does overall, or what your approach is.
It should be and you are in cc, here is the link for your reference:
https://www.mail-archive.com/u-boot at lists.denx.de/msg254409.htmlOK, thank you. In a future series do you plan to remove nand_info[] ?
Its usage expected to be limited to non-DM case only - after full conversation of all platforms to DM it can be removed.
Ref:
- last: https://patchwork.ozlabs.org/patch/722282/
- old: https://patchwork.ozlabs.org/patch/604739/
Signature · 2 lines
regards, -grygorii
PATCH v4 1/18 cmd: nand: abstract global variable usage for dm conversion
In reply to Grygorii StrashkoQuoted 7 lines · Grygorii Strashko
From: Mugunthan V N <[email protected]>
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]>Signed-off-by Grygorii Strashko <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/603a038a/attachment.sig>
PATCH v4 2/18 common: env_nand: use get_nand_dev_by_index()
In reply to Grygorii StrashkoAs part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly.
--- common/env_nand.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-)
common/env_nand.c +21 -12
@@ -130,17 +130,22 @@ static int writeenv(size_t offset, u_char *buf)size_t end = offset +CONFIG_ENV_RANGE ;size_t amount_saved =0 ;size_t blocksize, len; +struct mtd_info *mtd;u_char *char_ptr; - blocksize = nand_info[0 ]->erasesize; + mtd =get_nand_dev_by_index (0 ); +if (!mtd) +return 1 ; + + blocksize = mtd->erasesize; len =min (blocksize, (size_t )CONFIG_ENV_SIZE );while (amount_saved <CONFIG_ENV_SIZE && offset < end) { -if (nand_block_isbad (nand_info[0 ], offset)) { +if (nand_block_isbad (mtd, offset)) { offset += blocksize; }else { char_ptr = &buf[amount_saved]; -if (nand_write (nand_info[0 ], offset, &len, char_ptr)) +if (nand_write (mtd, offset, &len, char_ptr))return 1 ; offset += blocksize;
@@ -161,13 +166,15 @@ struct env_location {static int erase_and_write_env (const struct env_location *location,u_char *env_new) { +struct mtd_info *mtd;int ret =0 ; -if (!nand_info[0 ]) + mtd =get_nand_dev_by_index (0 ); +if (!mtd)return 1 ;printf ("Erasing %s...\n" , location->name); -if (nand_erase_opts (nand_info[0 ], &location->erase_opts)) +if (nand_erase_opts (mtd, &location->erase_opts))return 1 ;printf ("Writing to %s... " , location->name);
@@ -248,22 +255,24 @@ static int readenv(size_t offset, u_char *buf)size_t end = offset +CONFIG_ENV_RANGE ;size_t amount_loaded =0 ;size_t blocksize, len; +struct mtd_info *mtd;u_char *char_ptr; -if (!nand_info[0 ]) + mtd =get_nand_dev_by_index (0 ); +if (!mtd)return 1 ; - blocksize = nand_info[0 ]->erasesize; + blocksize = mtd->erasesize; len =min (blocksize, (size_t )CONFIG_ENV_SIZE );while (amount_loaded <CONFIG_ENV_SIZE && offset < end) { -if (nand_block_isbad (nand_info[0 ], offset)) { +if (nand_block_isbad (mtd, offset)) { offset += blocksize; }else { char_ptr = &buf[amount_loaded]; -if (nand_read_skip_bad (nand_info[0 ], offset, +if (nand_read_skip_bad (mtd, offset, &len,NULL , - nand_info[0 ]->size, char_ptr)) + mtd->size, char_ptr))return 1 ; offset += blocksize;
@@ -390,12 +399,12 @@ void env_relocate_spec(void)ALLOC_CACHE_ALIGN_BUFFER (char, buf,CONFIG_ENV_SIZE );#if defined(CONFIG_ENV_OFFSET_OOB ) +struct mtd_info *mtd =get_nand_dev_by_index (0 );/* * If unable to read environment offset from NAND OOB then fall through * to the normal environment reading code below */ -if (nand_info[0 ] && !get_nand_env_oob (nand_info[0 ], - &nand_env_oob_offset)) { +if (mtd && !get_nand_env_oob (mtd, &nand_env_oob_offset)) {printf ("Found Environment offset in OOB..\n" ); }else {set_default_env ("!no env offset in OOB" );
Signature · 1 line
2.10.1
PATCH v4 2/18 common: env_nand: use get_nand_dev_by_index()
Quoted 5 lines · Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to
nand_infoarray. So, use it here instead of accessing tonand_infoarray directly.Signed-off-by Grygorii Strashko <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/b423d6e8/attachment.sig>
PATCH v4 3/18 dfu: dfu_nand: use get_nand_dev_by_index()
In reply to Grygorii StrashkoAs part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly.
--- drivers/dfu/dfu_nand.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/dfu/dfu_nand.c +5 -7
@@ -37,15 +37,15 @@ static int nand_block_op(enum dfu_op op, struct dfu_entity *dfu, lim = dfu->data.nand.start + dfu->data.nand.size - start; count = *len; + mtd =get_nand_dev_by_index (nand_curr_device); +if (nand_curr_device <0 || nand_curr_device >=CONFIG_SYS_MAX_NAND_DEVICE || - !nand_info[nand_curr_device]) { + !mtd) {printf ("%s: invalid nand device\n" , __func__);return -1 ; } - mtd = nand_info[nand_curr_device]; -if (op ==DFU_OP_READ ) { ret =nand_read_skip_bad (mtd, start, &count, &actual, lim, buf);
@@ -143,18 +143,16 @@ static int dfu_flush_medium_nand(struct dfu_entity *dfu)/* in case of ubi partition, erase rest of the partition */ if (dfu->data.nand.ubi) { -struct mtd_info *mtd; +struct mtd_info *mtd =get_nand_dev_by_index (nand_curr_device);nand_erase_options_t opts;if (nand_curr_device <0 || nand_curr_device >=CONFIG_SYS_MAX_NAND_DEVICE || - !nand_info[nand_curr_device]) { + !mtd) {printf ("%s: invalid nand device\n" , __func__);return -1 ; } - mtd = nand_info[nand_curr_device]; -memset (&opts,0 ,sizeof (opts)); off = dfu->offset;if ((off & (mtd->erasesize -1 )) !=0 ) {
Signature · 1 line
2.10.1
PATCH v4 3/18 dfu: dfu_nand: use get_nand_dev_by_index()
Quoted 5 lines · Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to
nand_infoarray. So, use it here instead of accessing tonand_infoarray directly.Signed-off-by Grygorii Strashko <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/55322788/attachment.sig>
PATCH v4 4/18 cmd: bootm: use get_nand_dev_by_index()
In reply to Grygorii StrashkoAs part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly.
--- cmd/bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/bootm.c +1 -1
@@ -465,7 +465,7 @@ static int do_imls_nand(void)printf ("\n" );for (nand_dev =0 ; nand_dev <CONFIG_SYS_MAX_NAND_DEVICE ; nand_dev++) { - mtd = nand_info[nand_dev]; + mtd =get_nand_dev_by_index (nand_dev);if (!mtd->name || !mtd->size)continue ;
Signature · 1 line
2.10.1
PATCH v4 4/18 cmd: bootm: use get_nand_dev_by_index()
Quoted 5 lines · Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to
nand_infoarray. So, use it here instead of accessing tonand_infoarray directly.Signed-off-by Grygorii Strashko <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/89aa998d/attachment.sig>
PATCH v4 5/18 cmd: jffs2: use get_nand_dev_by_index()
In reply to Grygorii StrashkoAs part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly.
--- cmd/jffs2.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
cmd/jffs2.c +4 -3
@@ -166,8 +166,9 @@ static int mtd_device_validate(u8 type, u8 num, u32 *size)#endif }else if (type ==MTD_DEV_TYPE_NAND ) {#if defined(CONFIG_JFFS2_NAND ) && defined(CONFIG_CMD_NAND ) -if (num <CONFIG_SYS_MAX_NAND_DEVICE ) { - *size = nand_info[num]->size; +struct mtd_info *mtd =get_nand_dev_by_index (num); +if (mtd) { + *size = mtd->size;return 0 ; }
@@ -244,7 +245,7 @@ static inline u32 get_part_sector_size_nand(struct mtdids *id)#if defined(CONFIG_JFFS2_NAND ) && defined(CONFIG_CMD_NAND )struct mtd_info *mtd; - mtd = nand_info[id->num]; + mtd =get_nand_dev_by_index (id->num);return mtd->erasesize;#else
Signature · 1 line
2.10.1
PATCH v4 5/18 cmd: jffs2: use get_nand_dev_by_index()
Quoted 5 lines · Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to
nand_infoarray. So, use it here instead of accessing tonand_infoarray directly.Signed-off-by Grygorii Strashko <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/c31071a0/attachment.sig>
PATCH v4 6/18 common: use get_nand_dev_by_index()
In reply to Grygorii StrashkoAs part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly.
--- common/fb_nand.c | 2 +- common/splash_source.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
common/fb_nand.c +1 -1
@@ -59,7 +59,7 @@ static int fb_nand_lookup(const char *partname,return -EINVAL ; } - *mtd = nand_info[dev->id->num]; + *mtd =get_nand_dev_by_index (dev->id->num);return 0 ; }
common/splash_source.c +3 -2
@@ -47,9 +47,10 @@ static int splash_sf_read_raw(u32 bmp_load_addr, int offset, size_t read_size)#ifdef CONFIG_CMD_NAND static int splash_nand_read_raw (u32 bmp_load_addr,int offset,size_t read_size) { -return nand_read_skip_bad (nand_info[nand_curr_device], offset, +struct mtd_info *mtd =get_nand_dev_by_index (nand_curr_device); +return nand_read_skip_bad (mtd, offset, &read_size,NULL , - nand_info[nand_curr_device]->size, + mtd->size, (u_char *)bmp_load_addr); }#else
Signature · 1 line
2.10.1
PATCH v4 6/18 common: use get_nand_dev_by_index()
Quoted 5 lines · Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to
nand_infoarray. So, use it here instead of accessing tonand_infoarray directly.Signed-off-by Grygorii Strashko <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/2288d6dd/attachment.sig>
PATCH v4 7/18 fs: use get_nand_dev_by_index()
In reply to Grygorii StrashkoAs part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly.
--- fs/jffs2/jffs2_1pass.c | 9 +++++++-- fs/jffs2/jffs2_nand_1pass.c | 6 +++++- fs/yaffs2/yaffs_uboot_glue.c | 8 ++++++-- 3 files changed, 18 insertions(+), 5 deletions(-)
fs/jffs2/jffs2_1pass.c +7 -2
@@ -175,10 +175,15 @@ static u32 nand_cache_off = (u32)-1;static int read_nand_cached (u32 off,u32 size,u_char *buf) {struct mtdids *id = current_part->dev->id; +struct mtd_info *mtd;u32 bytes_read =0 ;size_t retlen;int cpy_bytes; + mtd =get_nand_dev_by_index (id->num); +if (!mtd) +return -1 ; +while (bytes_read < size) {if ((off + bytes_read < nand_cache_off) || (off + bytes_read >= nand_cache_off+NAND_CACHE_SIZE )) {
@@ -195,8 +200,8 @@ static int read_nand_cached(u32 off, u32 size, u_char *buf) } retlen =NAND_CACHE_SIZE ; -if (nand_read (nand_info[id->num], nand_cache_off, - &retlen, nand_cache) !=0 || +if (nand_read (mtd, nand_cache_off, + &retlen, nand_cache) !=0 || retlen !=NAND_CACHE_SIZE ) {printf ("read_nand_cached: error reading nand off %#x size %d bytes\n" , nand_cache_off,NAND_CACHE_SIZE );
fs/jffs2/jffs2_nand_1pass.c +5 -1
@@ -796,7 +796,11 @@ jffs2_1pass_build_lists(struct part_info * part)u32 counterN =0 ;struct mtdids *id = part->dev->id; - mtd = nand_info[id->num]; + mtd =get_nand_dev_by_index (id->num); +if (!mtd) { +error ("\nno NAND devices available\n" ); +return 0 ; + }/* if we are building a list we need to refresh the cache. */ jffs_init_1pass_list (part);
fs/yaffs2/yaffs_uboot_glue.c +6 -2
@@ -166,11 +166,15 @@ void cmd_yaffs_devconfig(char *_mp, int flash_dev,char *mp =NULL ;struct nand_chip *chip; + mtd =get_nand_dev_by_index (flash_dev); +if (!mtd) { +error ("\nno NAND devices available\n" ); +return ; + } + dev =calloc (1 ,sizeof (*dev)); mp =strdup (_mp); - mtd = nand_info[flash_dev]; -if (!dev || !mp) {/* Alloc error */ printf ("Failed to allocate memory\n" );
Signature · 1 line
2.10.1
PATCH v4 7/18 fs: use get_nand_dev_by_index()
Quoted 5 lines · Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to
nand_infoarray. So, use it here instead of accessing tonand_infoarray directly.Signed-off-by Grygorii Strashko <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/7dc5b40e/attachment.sig>
PATCH v4 8/18 cmd: nand: remove direct access to struct mtd_info->priv
In reply to Grygorii StrashkoReplace direct access to struct mtd_info->priv with proper accessor mtd_to_nand().
--- cmd/nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/nand.c +1 -1
@@ -128,7 +128,7 @@ static int set_dev(int dev) nand_curr_device = dev;#ifdef CONFIG_SYS_NAND_SELECT_DEVICE -board_nand_select_device (mtd->priv, dev); +board_nand_select_device (mtd_to_nand (mtd), dev);#endif return 0 ;
Signature · 1 line
2.10.1
PATCH v4 8/18 cmd: nand: remove direct access to struct mtd_info->priv
Quoted 4 lines · Grygorii Strashko
Replace direct access to struct
mtd_info->privwith proper accessormtd_to_nand().Signed-off-by Grygorii Strashko <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/80645cd2/attachment.sig>
PATCH v4 9/18 net: phy: cortina: use get_nand_dev_by_index()
In reply to Grygorii StrashkoAs part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly
--- drivers/net/phy/cortina.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/cortina.c +2 -1
@@ -139,7 +139,8 @@ void cs4340_upload_firmware(struct phy_device *phydev)size_t fw_length =CONFIG_CORTINA_FW_LENGTH ; addr =malloc (CONFIG_CORTINA_FW_LENGTH ); - ret =nand_read (nand_info[0 ], (loff_t )CONFIG_CORTINA_FW_ADDR , + ret =nand_read (get_nand_dev_by_index (0 ), + (loff_t )CONFIG_CORTINA_FW_ADDR , &fw_length, (u_char *)addr);if (ret == -EUCLEAN ) { printf("NAND read of Cortina firmware at 0x%x failed %d\n",
Signature · 1 line
2.10.1
PATCH v4 9/18 net: phy: cortina: use get_nand_dev_by_index()
Quoted 6 lines · Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to
nand_infoarray. So, use it here instead of accessing tonand_infoarray directlySigned-off-by Grygorii Strashko <[email protected]>Reviewed-by Joe Hershberger <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/c18d6761/attachment.sig>
PATCH v4 10/18 net: fm: use get_nand_dev_by_index()
In reply to Grygorii StrashkoAs part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly.
--- drivers/net/fm/fm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/fm/fm.c +2 -1
@@ -357,7 +357,8 @@ int fm_init_common(int index, struct ccsr_fman *reg)size_t fw_length =CONFIG_SYS_QE_FMAN_FW_LENGTH ;void *addr =malloc (CONFIG_SYS_QE_FMAN_FW_LENGTH ); - rc =nand_read (nand_info[0 ], (loff_t )CONFIG_SYS_FMAN_FW_ADDR , + rc =nand_read (get_nand_dev_by_index (0 ), + (loff_t )CONFIG_SYS_FMAN_FW_ADDR , &fw_length, (u_char *)addr);if (rc == -EUCLEAN ) { printf("NAND read of FMAN firmware at offset 0x%x failed %d\n",
Signature · 1 line
2.10.1
PATCH v4 10/18 net: fm: use get_nand_dev_by_index()
Quoted 6 lines · Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to
nand_infoarray. So, use it here instead of accessing tonand_infoarray directly.Signed-off-by Grygorii Strashko <[email protected]>Reviewed-by Joe Hershberger <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/cf7d9b7b/attachment.sig>
PATCH v4 11/18 mtd: nand: drv: use get_nand_dev_by_index()
In reply to Grygorii StrashkoAs part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly
--- drivers/mtd/nand/fsmc_nand.c | 2 +- drivers/mtd/nand/zynq_nand.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/fsmc_nand.c +1 -1
@@ -409,7 +409,7 @@ int fsmc_nand_switch_ecc(uint32_t eccstrength)* Nomadik SoC is currently supporting this fsmc_nand_switch_ecc() * function, as it doesn't need to switch to a different ECC layout. */ - mtd = nand_info[nand_curr_device]; + mtd =get_nand_dev_by_index (nand_curr_device); nand =mtd_to_nand (mtd);/* Setup the ecc configurations again */
drivers/mtd/nand/zynq_nand.c +1 -1
@@ -1008,7 +1008,7 @@ static int zynq_nand_init(struct nand_chip *nand_chip, int devnum) } xnand->nand_base = (void __iomem *)ZYNQ_NAND_BASEADDR ; - mtd = (struct mtd_info *)&nand_info[0 ]; + mtd =get_nand_dev_by_index (0 ); nand_chip->priv = xnand; mtd->priv = nand_chip;
Signature · 1 line
2.10.1
PATCH v4 11/18 mtd: nand: drv: use get_nand_dev_by_index()
Quoted 5 lines · Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to
nand_infoarray. So, use it here instead of accessing tonand_infoarray directlySigned-off-by Grygorii Strashko <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/986a026a/attachment.sig>
PATCH v4 12/18 cmd: mvebu: bubt: use get_nand_dev_by_index()
In reply to Grygorii StrashkoAs part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly.
--- cmd/mvebu/bubt.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
cmd/mvebu/bubt.c +6 -8
@@ -311,23 +311,21 @@ static int nand_burn_image(size_t image_size) {int ret;uint32_t block_size; -struct mtd_info *nand; -int dev = nand_curr_device; +struct mtd_info *mtd; -if ((dev <0 ) || (dev >=CONFIG_SYS_MAX_NAND_DEVICE ) || - (!nand_info[dev]->name)) { + mtd =get_nand_dev_by_index (nand_curr_device); +if (!mtd) {puts ("\nno devices available\n" );return -ENOMEDIUM ; } - nand = nand_info[dev]; - block_size = nand->erasesize; + block_size = mtd->erasesize;/* Align U-Boot size to currently used blocksize */ image_size = ((image_size + (block_size -1 )) & (~(block_size -1 )));/* Erase the U-BOOT image space */ printf ("Erasing 0x%x - 0x%x:..." ,0 , (int )image_size); - ret =nand_erase (nand,0 , image_size); + ret =nand_erase (mtd,0 , image_size);if (ret) {printf ("Error!\n" ); goto error;
@@ -337,7 +335,7 @@ static int nand_burn_image(size_t image_size)/* Write the image to flash */ printf ("Writing %d bytes from 0x%lx to offset 0 ... " , (int )image_size,get_load_addr ()); - ret =nand_write (nand,0 , &image_size, (void *)get_load_addr ()); + ret =nand_write (mtd,0 , &image_size, (void *)get_load_addr ());if (ret)printf ("Error!\n" );else
Signature · 1 line
2.10.1
PATCH v4 12/18 cmd: mvebu: bubt: use get_nand_dev_by_index()
Quoted 5 lines · Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to
nand_infoarray. So, use it here instead of accessing tonand_infoarray directly.Signed-off-by Grygorii Strashko <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/489c4d7e/attachment.sig>
PATCH v4 13/18 board: atmel: use get_nand_dev_by_index()
In reply to Grygorii StrashkoAs part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly.
--- board/atmel/at91sam9261ek/at91sam9261ek.c | 2 +- board/atmel/at91sam9263ek/at91sam9263ek.c | 2 +- board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c | 2 +- board/atmel/at91sam9n12ek/at91sam9n12ek.c | 2 +- board/atmel/at91sam9rlek/at91sam9rlek.c | 2 +- board/atmel/at91sam9x5ek/at91sam9x5ek.c | 2 +- board/atmel/sama5d3xek/sama5d3xek.c | 2 +- board/atmel/sama5d4_xplained/sama5d4_xplained.c | 2 +- board/atmel/sama5d4ek/sama5d4ek.c | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-)
board/atmel/at91sam9261ek/at91sam9261ek.c +1 -1
@@ -213,7 +213,7 @@ void lcd_show_board_info(void) dram_size += gd->bd->bi_dram[i].size; nand_size =0 ;for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) - nand_size += nand_info[i]->size; + nand_size +=get_nand_dev_by_index (i)->size;lcd_printf (" %ld MB SDRAM, %ld MB NAND\n" , dram_size >>20 , nand_size >>20 );
board/atmel/at91sam9263ek/at91sam9263ek.c +1 -1
@@ -160,7 +160,7 @@ void lcd_show_board_info(void) dram_size += gd->bd->bi_dram[i].size; nand_size =0 ;for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) - nand_size += nand_info[i]->size; + nand_size +=get_nand_dev_by_index (i)->size;#ifdef CONFIG_MTD_NOR_FLASH flash_size =0 ;for (i =0 ; i <CONFIG_SYS_MAX_FLASH_BANKS ; i++)
board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c +1 -1
@@ -236,7 +236,7 @@ void lcd_show_board_info(void) dram_size += gd->bd->bi_dram[i].size; nand_size =0 ;for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) - nand_size += nand_info[i]->size; + nand_size +=get_nand_dev_by_index (i)->size;lcd_printf (" %ld MB SDRAM, %ld MB NAND\n" , dram_size >>20 , nand_size >>20 );
board/atmel/at91sam9n12ek/at91sam9n12ek.c +1 -1
@@ -124,7 +124,7 @@ void lcd_show_board_info(void) dram_size += gd->bd->bi_dram[i].size; nand_size =0 ;for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) - nand_size += nand_info[i]->size; + nand_size +=get_nand_dev_by_index (i)->size;lcd_printf (" %ld MB SDRAM, %ld MB NAND\n" , dram_size >>20 , nand_size >>20 );
board/atmel/at91sam9rlek/at91sam9rlek.c +1 -1
@@ -149,7 +149,7 @@ void lcd_show_board_info(void) dram_size += gd->bd->bi_dram[i].size; nand_size =0 ;for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) - nand_size += nand_info[i]->size; + nand_size +=get_nand_dev_by_index (i)->size;lcd_printf (" %ld MB SDRAM, %ld MB NAND\n" , dram_size >>20 , nand_size >>20 );
board/atmel/at91sam9x5ek/at91sam9x5ek.c +1 -1
@@ -175,7 +175,7 @@ void lcd_show_board_info(void) dram_size += gd->bd->bi_dram[i].size; nand_size =0 ;for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) - nand_size += nand_info[i]->size; + nand_size +=get_nand_dev_by_index (i)->size;lcd_printf (" %ld MB SDRAM, %ld MB NAND\n" , dram_size >>20 , nand_size >>20 );
board/atmel/sama5d3xek/sama5d3xek.c +1 -1
@@ -198,7 +198,7 @@ void lcd_show_board_info(void) nand_size =0 ;#ifdef CONFIG_NAND_ATMEL for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) - nand_size += nand_info[i]->size; + nand_size +=get_nand_dev_by_index (i)->size;#endif lcd_printf ("%ld MB SDRAM, %lld MB NAND\n" , dram_size >>20 , nand_size >>20 );
board/atmel/sama5d4_xplained/sama5d4_xplained.c +1 -1
@@ -157,7 +157,7 @@ void lcd_show_board_info(void) nand_size =0 ;#ifdef CONFIG_NAND_ATMEL for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) - nand_size += nand_info[i]->size; + nand_size +=get_nand_dev_by_index (i)->size;#endif lcd_printf ("%ld MB SDRAM, %ld MB NAND\n" , dram_size >>20 , nand_size >>20 );
board/atmel/sama5d4ek/sama5d4ek.c +1 -1
@@ -153,7 +153,7 @@ void lcd_show_board_info(void) nand_size =0 ;#ifdef CONFIG_NAND_ATMEL for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) - nand_size += nand_info[i]->size; + nand_size +=get_nand_dev_by_index (i)->size;#endif lcd_printf ("%ld MB SDRAM, %ld MB NAND\n" , dram_size >>20 , nand_size >>20 );
Signature · 1 line
2.10.1
PATCH v4 13/18 board: atmel: use get_nand_dev_by_index()
Quoted 5 lines · Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to
nand_infoarray. So, use it here instead of accessing tonand_infoarray directly.Signed-off-by Grygorii Strashko <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/ced01e6c/attachment.sig>
PATCH v4 14/18 board: ronetix: use get_nand_dev_by_index()
In reply to Grygorii StrashkoAs part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly.
--- board/ronetix/pm9261/pm9261.c | 2 +- board/ronetix/pm9263/pm9263.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
board/ronetix/pm9261/pm9261.c +1 -1
@@ -195,7 +195,7 @@ void lcd_show_board_info(void) nand_size =0 ;for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) - nand_size += nand_info[i]->size; + nand_size +=get_nand_dev_by_index (i)->size; flash_size =0 ;for (i =0 ; i <CONFIG_SYS_MAX_FLASH_BANKS ; i++)
board/ronetix/pm9263/pm9263.c +1 -1
@@ -294,7 +294,7 @@ void lcd_show_board_info(void) nand_size =0 ;for (i =0 ; i <CONFIG_SYS_MAX_NAND_DEVICE ; i++) - nand_size += nand_info[i]->size; + nand_size +=get_nand_dev_by_index (i)->size; flash_size =0 ;for (i =0 ; i <CONFIG_SYS_MAX_FLASH_BANKS ; i++)
Signature · 1 line
2.10.1
PATCH v4 14/18 board: ronetix: use get_nand_dev_by_index()
Quoted 5 lines · Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to
nand_infoarray. So, use it here instead of accessing tonand_infoarray directly.Signed-off-by Grygorii Strashko <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/2e47cd75/attachment.sig>
PATCH v4 15/18 board: BuR: use get_nand_dev_by_index()
In reply to Grygorii StrashkoAs part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly.
--- board/BuR/common/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
board/BuR/common/common.c +2 -1
@@ -259,7 +259,8 @@ static int load_devicetree(void) }#ifdef CONFIG_NAND dtbsize =0x20000 ; - rc =nand_read_skip_bad (nand_info[0 ],0x40000 , (size_t *)&dtbsize, + rc =nand_read_skip_bad (get_nand_dev_by_index (0 ),0x40000 , + (size_t *)&dtbsize,NULL ,0x20000 , (u_char *)dtbaddr);#else char *dtbname =getenv ("dtb" );
Signature · 1 line
2.10.1
PATCH v4 15/18 board: BuR: use get_nand_dev_by_index()
Quoted 7 lines · Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to
nand_infoarray. So, use it here instead of accessing tonand_infoarray directly.Signed-off-by Grygorii Strashko <[email protected]>Reviewed-by Hannes Schmelzer <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/4f3201ba/attachment.sig>
PATCH v4 16/18 board: toradex: use get_nand_dev_by_index()
In reply to Grygorii StrashkoAs part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly.
--- board/toradex/colibri_t20/colibri_t20.c | 2 +- board/toradex/common/tdx-cfg-block.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-)
board/toradex/colibri_t20/colibri_t20.c +1 -1
@@ -69,7 +69,7 @@ int checkboard(void) {printf ("Model: Toradex Colibri T20 %dMB V%s\n" , (gd->ram_size ==0x10000000 ) ?256 :512 , - (nand_info[0 ]->erasesize >>10 ==512 ) ? + (get_nand_dev_by_index (0 )->erasesize >>10 ==512 ) ? ((gd->ram_size ==0x10000000 ) ?"1.1B" :"1.1C" ) :"1.2A" );return 0 ;
board/toradex/common/tdx-cfg-block.c +8 -4
@@ -154,8 +154,10 @@ static int read_tdx_cfg_block_from_nand(unsigned char *config_block)size_t size =TDX_CFG_BLOCK_MAX_SIZE ;/* Read production parameter config block from NAND page */ -return nand_read_skip_bad (nand_info[0 ],CONFIG_TDX_CFG_BLOCK_OFFSET , - &size,NULL ,TDX_CFG_BLOCK_MAX_SIZE , config_block); +return nand_read_skip_bad (get_nand_dev_by_index (0 ), +CONFIG_TDX_CFG_BLOCK_OFFSET , + &size,NULL ,TDX_CFG_BLOCK_MAX_SIZE , + config_block); }static int write_tdx_cfg_block_to_nand (unsigned char *config_block)
@@ -163,7 +165,8 @@ static int write_tdx_cfg_block_to_nand(unsigned char *config_block)size_t size =TDX_CFG_BLOCK_MAX_SIZE ;/* Write production parameter config block to NAND page */ -return nand_write_skip_bad (nand_info[0 ],CONFIG_TDX_CFG_BLOCK_OFFSET , +return nand_write_skip_bad (get_nand_dev_by_index (0 ), +CONFIG_TDX_CFG_BLOCK_OFFSET , &size,NULL ,TDX_CFG_BLOCK_MAX_SIZE , config_block,WITH_WR_VERIFY ); }
@@ -426,7 +429,8 @@ static int do_cfgblock_create(cmd_tbl_t *cmdtp, int flag, int argc,* empty (config block invalid...) */ printf ("NAND erase block %d need to be erased before creating a Toradex config block\n" , -CONFIG_TDX_CFG_BLOCK_OFFSET / nand_info[0 ]->erasesize); +CONFIG_TDX_CFG_BLOCK_OFFSET / +get_nand_dev_by_index (0 )->erasesize); goto out;#elif defined(CONFIG_TDX_CFG_BLOCK_IS_IN_NOR )/*
Signature · 1 line
2.10.1
PATCH v4 16/18 board: toradex: use get_nand_dev_by_index()
Quoted 6 lines · Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to
nand_infoarray. So, use it here instead of accessing tonand_infoarray directly.Reviewed-by Marcel Ziswiler <[email protected]>Signed-off-by Grygorii Strashko <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/9df8dc2a/attachment.sig>
PATCH v4 17/18 armv8: fsl-layerscape: use get_nand_dev_by_index()
In reply to Grygorii StrashkoAs part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly.
--- arch/arm/cpu/armv8/fsl-layerscape/ppa.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
arch/arm/cpu/armv8/fsl-layerscape/ppa.c +9 -6
@@ -173,8 +173,9 @@ int ppa_init(void)debug ("%s: PPA image load from NAND\n" , __func__);nand_init (); - ret =nand_read (nand_info[0 ], (loff_t )CONFIG_SYS_LS_PPA_FW_ADDR , - &fdt_header_len, (u_char *)&fit); + ret =nand_read (get_nand_dev_by_index (0 ), + (loff_t )CONFIG_SYS_LS_PPA_FW_ADDR , + &fdt_header_len, (u_char *)&fit);if (ret == -EUCLEAN ) {printf ("NAND read of PPA FIT header at offset 0x%x failed\n" ,CONFIG_SYS_LS_PPA_FW_ADDR );
@@ -196,8 +197,9 @@ int ppa_init(void) fw_length =CONFIG_LS_PPA_ESBC_HDR_SIZE ; - ret =nand_read (nand_info[0 ], (loff_t )CONFIG_SYS_LS_PPA_ESBC_ADDR , - &fw_length, (u_char *)ppa_hdr_ddr); + ret =nand_read (get_nand_dev_by_index (0 ), + (loff_t )CONFIG_SYS_LS_PPA_ESBC_ADDR , + &fw_length, (u_char *)ppa_hdr_ddr);if (ret == -EUCLEAN ) {free (ppa_hdr_ddr); printf("NAND read of PPA firmware at offset 0x%x failed\n",
@@ -221,8 +223,9 @@ int ppa_init(void)return -ENOMEM ; } - ret =nand_read (nand_info[0 ], (loff_t )CONFIG_SYS_LS_PPA_FW_ADDR , - &fw_length, (u_char *)ppa_fit_addr); + ret =nand_read (get_nand_dev_by_index (0 ), + (loff_t )CONFIG_SYS_LS_PPA_FW_ADDR , + &fw_length, (u_char *)ppa_fit_addr);if (ret == -EUCLEAN ) {free (ppa_fit_addr); printf("NAND read of PPA firmware at offset 0x%x failed\n",
Signature · 1 line
2.10.1
PATCH v4 17/18 armv8: fsl-layerscape: use get_nand_dev_by_index()
Quoted 7 lines · Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to
nand_infoarray. So, use it here instead of accessing tonand_infoarray directly.Cc Albert Aribaud <[email protected]>Cc York Sun <[email protected]>Signed-off-by Grygorii Strashko <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/a64d68d3/attachment.sig>
PATCH v4 18/18 mtd: nand: make nand_info array static
In reply to Grygorii StrashkoMake make nand_info array static, since all direct users of nand_info array have been converted to use get_nand_dev_by_index() API.
--- drivers/mtd/nand/nand.c | 2 +- include/nand.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nand/nand.c +1 -1
@@ -19,7 +19,7 @@ DECLARE_GLOBAL_DATA_PTR;int nand_curr_device =-1 ; -struct mtd_info *nand_info[CONFIG_SYS_MAX_NAND_DEVICE ]; +static struct mtd_info *nand_info[CONFIG_SYS_MAX_NAND_DEVICE ];#ifndef CONFIG_SYS_NAND_SELF_INIT static struct nand_chip nand_chip[CONFIG_SYS_MAX_NAND_DEVICE ];
include/nand.h +0 -1
@@ -44,7 +44,6 @@ extern int board_nand_init(struct nand_chip *nand);#endif extern int nand_curr_device; -extern struct mtd_info *nand_info[];static inline int nand_read (struct mtd_info *info,loff_t ofs,size_t *len,u_char *buf)
Signature · 1 line
2.10.1
PATCH v4 18/18 mtd: nand: make nand_info array static
Quoted 4 lines · Grygorii Strashko
Make make
nand_infoarray static, since all direct users ofnand_infoarray have been converted to useget_nand_dev_by_index()API.Signed-off-by Grygorii Strashko <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/7cd45060/attachment.sig>
v4 cover nand: remove direct acces to nand_info array
In reply to Grygorii StrashkoQuoted 9 lines · Grygorii Strashko
This is a preparation required for adding Nand DM support. This series introduces new API
get_nand_dev_by_index()to avoid direct acces tonand_infoarray and updates u-boot to use it. As result,nand_infoarray is made static in the last patch.Changes in v4:
- rebased on top ofgit://git.denx.de/u-boot.git/master
- added patch forarch/arm/cpu/armv8/fsl-layerscape/ppa.c
- added "Reviewed-by" tags
Can you push all of this into a travis-ci build and send back a link to it all passing? Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170702/7da7613a/attachment.sig>
v4 cover nand: remove direct acces to nand_info array
Quoted 7 lines · Tom Rini
Quoted 5 lines · Grygorii Strashko
This is a preparation required for adding Nand DM support. This series introduces new API
get_nand_dev_by_index()to avoid direct acces tonand_infoarray and updates u-boot to use it. As result,nand_infoarray is made static in the last patch.
Quoted 7 lines
Quoted 4 lines
Changes in v4:
- rebased on top ofgit://git.denx.de/u-boot.git/master
- added patch forarch/arm/cpu/armv8/fsl-layerscape/ppa.c
- added "Reviewed-by" tagsCan you push all of this into a travis-ci build and send back a link to it all passing? Thanks!
Here is the travis-ci link.
https://travis-ci.org/lokeshvutla/u-boot/builds/249477022. Everything build successfully except am33xx and xtensa. But these failures has nothing to do with these patches as it is failure while downloading toolchain:
The command "if [[ "${TOOLCHAIN}" == "" ]]; then wget
http://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz
&& wget
http://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/arm-linux-gnueabihf/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf.tar.xz
&& tar -C /tmp -xf gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz && tar -C /tmp -xf gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf.tar.xz; fi" failed and exited with 8 during .
Thanks and regards,
Lokesh
v4 cover nand: remove direct acces to nand_info array
Quoted 15 lines · Lokesh Vutla
Quoted 12 lines · Tom Rini
Quoted 9 lines · Grygorii Strashko
This is a preparation required for adding Nand DM support. This series introduces new API
get_nand_dev_by_index()to avoid direct acces tonand_infoarray and updates u-boot to use it. As result,nand_infoarray is made static in the last patch.Changes in v4:
- rebased on top ofgit://git.denx.de/u-boot.git/master
- added patch forarch/arm/cpu/armv8/fsl-layerscape/ppa.c
- added "Reviewed-by" tags
Quoted 8 lines
Quoted 2 lines
Can you push all of this into a travis-ci build and send back a link to it all passing? Thanks!
Here is the travis-ci link.
https://travis-ci.org/lokeshvutla/u-boot/builds/249477022. Everything build successfully except am33xx and xtensa. But these failures has nothing to do with these patches as it is failure while downloading toolchain:
When that happens just hit the restart job button, btw.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170703/5ef98561/attachment.sig>
v4 cover nand: remove direct acces to nand_info array
Quoted 19 lines · Tom Rini
Quoted 18 lines · Lokesh Vutla
Quoted 14 lines · Tom Rini
Quoted 9 lines · Grygorii Strashko
This is a preparation required for adding Nand DM support. This series introduces new API
get_nand_dev_by_index()to avoid direct acces tonand_infoarray and updates u-boot to use it. As result,nand_infoarray is made static in the last patch.Changes in v4:
- rebased on top ofgit://git.denx.de/u-boot.git/master
- added patch forarch/arm/cpu/armv8/fsl-layerscape/ppa.c
- added "Reviewed-by" tagsCan you push all of this into a travis-ci build and send back a link to it all passing? Thanks!
Quoted 8 lines
Quoted 5 lines
Here is the travis-ci link.
https://travis-ci.org/lokeshvutla/u-boot/builds/249477022. Everything build successfully except am33xx and xtensa. But these failures has nothing to do with these patches as it is failure while downloading toolchain:When that happens just hit the restart job button, btw.
After restarting the job, everything passes now.
https://travis-ci.org/lokeshvutla/u-boot/builds/249477022
Thanks and regards,
Lokesh