nand: remove direct acces to nand_info array
Subsystems (8)
v3 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 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 v2 [1]:
- https://www.mail-archive.com/u-boot at lists.denx.de/msg237747.html
Grygorii Strashko (16):
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()
mtd: nand: make nand_info array static
Mugunthan V N (1):
cmd: nand: abstract global variable usage for dm conversion
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 +++- 32 files changed, 153 insertions(+), 103 deletions(-)
Signature · 1 line
2.10.1.dirty
PATCH v3 1/17 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++; } }
@@ -148,7 +157,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,3 +145,12 @@ 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);
Signature · 1 line
2.10.1.dirty
PATCH v3 2/17 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.dirty
PATCH v3 3/17 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.dirty
PATCH v3 4/17 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.dirty
PATCH v3 5/17 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.dirty
PATCH v3 6/17 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.dirty
PATCH v3 7/17 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.dirty
PATCH v3 8/17 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.dirty
PATCH v3 9/17 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.dirty
PATCH v3 9/17 net: phy: cortina: 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]>
PATCH v3 10/17 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.dirty
PATCH v3 10/17 net: fm: 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]>
PATCH v3 11/17 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.dirty
PATCH v3 12/17 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
@@ -309,24 +309,22 @@ static int is_spi_active(void)#ifdef CONFIG_CMD_NAND static int nand_burn_image (size_t image_size) { +struct mtd_info *mtd;int ret, block_size; -nand_info_t *nand; -int dev = nand_curr_device; -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;
@@ -336,7 +334,7 @@ static int nand_burn_image(size_t image_size)/* Write the image to flash */ printf ("Writing image:..." );printf ("&image_size = 0x%p\n" , (void *)&image_size); - 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.dirty
PATCH v3 13/17 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
@@ -212,7 +212,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
@@ -191,7 +191,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;#ifndef CONFIG_SYS_NO_FLASH flash_size =0 ;for (i =0 ; i <CONFIG_SYS_MAX_FLASH_BANKS ; i++)
board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c +1 -1
@@ -272,7 +272,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
@@ -151,7 +151,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
@@ -196,7 +196,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
@@ -207,7 +207,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
@@ -191,7 +191,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
@@ -187,7 +187,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.dirty
PATCH v3 14/17 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
@@ -194,7 +194,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
@@ -293,7 +293,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.dirty
PATCH v3 15/17 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.dirty
PATCH v3 15/17 board: BuR: use get_nand_dev_by_index()
Quoted 26 lines
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 Hannes Schmelzer <[email protected]>Signed-off-by Grygorii Strashko <[email protected]>--- 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.dirty
PATCH v3 15/17 board: BuR: use get_nand_dev_by_index()
Quoted 9 lines · Hannes Schmelzer
Quoted 9 lines
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 Hannes Schmelzer <[email protected]>Signed-off-by Grygorii Strashko <[email protected]>--- board/BuR/common/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
PATCH v3 16/17 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
@@ -153,8 +153,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)
@@ -162,7 +164,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 ); }
@@ -425,7 +428,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.dirty
PATCH v3 16/17 board: toradex: use get_nand_dev_by_index()
Quoted 8 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 Lucas Stach <[email protected]>Cc Marcel Ziswiler <[email protected]>Signed-off-by Grygorii Strashko <[email protected]>
Looks reasonable to me.
Quoted 68 lines
---
?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 +0
-0@@ -153,8 +153,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 */board/toradex/common/tdx-cfg-block.c +0
-1- return nand_read_skip_bad(nand_info[0],
CONFIG_TDX_CFG_BLOCK_OFFSET,board/toradex/common/tdx-cfg-block.c +0
-1- ?&size, NULL, TDX_CFG_BLOCK_MAX_SIZE,
config_block);board/toradex/common/tdx-cfg-block.c +3
-0+ return nand_read_skip_bad(get_nand_dev_by_index(0), + ??CONFIG_TDX_CFG_BLOCK_OFFSET, + ??&size, NULL,
TDX_CFG_BLOCK_MAX_SIZE,board/toradex/common/tdx-cfg-block.c +1
-0+ ??config_block);?}
?
?static intwrite_tdx_cfg_block_to_nand(unsigned char *config_block)board/toradex/common/tdx-cfg-block.c +0
-0@@ -162,7 +164,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 */board/toradex/common/tdx-cfg-block.c +0
-1- return nand_write_skip_bad(nand_info[0],
CONFIG_TDX_CFG_BLOCK_OFFSET,board/toradex/common/tdx-cfg-block.c +2
-0+ 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);
?}board/toradex/common/tdx-cfg-block.c +0
-0@@ -425,7 +428,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",board/toradex/common/tdx-cfg-block.c +0
-1- ???????CONFIG_TDX_CFG_BLOCK_OFFSET / nand_info[0]-Quoted 1 line
erasesize);
board/toradex/common/tdx-cfg-block.c +2
-0+ ???????CONFIG_TDX_CFG_BLOCK_OFFSET / + ???????get_nand_dev_by_index(0)->erasesize);? goto out;
?#elifdefined(CONFIG_TDX_CFG_BLOCK_IS_IN_NOR)
? /*
PATCH v3 17/17 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
@@ -43,7 +43,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.dirty