Skip to contentSkip to conversation

driver/ifc: define nand_spl_load_image() for SPL

PATCH Superseded Prabhakar Kushwaha 2 participants 4 messages Mar 31, 2014 – Apr 2, 2014

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 6/10 driver/ifc: define nand_spl_load_image() for SPL

nand_spl_load_image() can also be used for non TPL framework.

---
 drivers/mtd/nand/fsl_ifc_spl.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/fsl_ifc_spl.c +2 -2
index 2f82f7c..8a7a3a3 100644
@@ -88,7 +88,7 @@ static inline int bad_block(uchar *marker, int port_size)
 		return __raw_readw((u16 *)marker) != 0xffff;
 }
 
-#ifdef CONFIG_TPL_BUILD
+#if defined(CONFIG_TPL_BUILD) || defined(CONFIG_SPL_BUILD)
 int nand_spl_load_image(uint32_t offs, unsigned int uboot_size, void *vdst)
 #else
 static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst)
@@ -221,7 +221,7 @@ static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst)
  * Defines a static function nand_load_image() here, because non-static makes
  * the code too large for certain SPLs(minimal SPL, maximum size <= 4Kbytes)
  */
-#ifndef CONFIG_TPL_BUILD
+#if !defined(CONFIG_TPL_BUILD) && !defined(CONFIG_SPL_BUILD)
 #define nand_spl_load_image(offs, uboot_size, vdst) \
 	nand_load(offs, uboot_size, vdst)
 #endif
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 6/10 driver/ifc: define nand_spl_load_image() for SPL

Quoted 21 lines · Prabhakar Kushwaha

nand_spl_load_image() can also be used for non TPL framework.

---
 drivers/mtd/nand/fsl_ifc_spl.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/fsl_ifc_spl.c +1 -1
index 2f82f7c..8a7a3a3 100644
@@ -88,7 +88,7 @@ static inline int bad_block(uchar *marker, int port_size)
 		return __raw_readw((u16 *)marker) != 0xffff;
 }
 
-#ifdef CONFIG_TPL_BUILD
+#if defined(CONFIG_TPL_BUILD) || defined(CONFIG_SPL_BUILD)
 int nand_spl_load_image(uint32_t offs, unsigned int uboot_size, void *vdst)
 #else
 static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst)

drivers/mtd/nand/fsl_ifc_spl.c static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst) · line 227

Quoted 8 lines
drivers/mtd/nand/fsl_ifc_spl.c +1 -1
@@ -221,7 +221,7 @@ static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst)
  * Defines a static function nand_load_image() here, because non-static makes
  * the code too large for certain SPLs(minimal SPL, maximum size <= 4Kbytes)
  */
-#ifndef CONFIG_TPL_BUILD
+#if !defined(CONFIG_TPL_BUILD) && !defined(CONFIG_SPL_BUILD)
 #define nand_spl_load_image(offs, uboot_size, vdst) \
 	nand_load(offs, uboot_size, vdst)
 #endif

When would you ever use this file without having CONFIG_SPL_BUILD defined?

-Scott

#2 lore raw

PATCH 6/10 driver/ifc: define nand_spl_load_image() for SPL

Quoted 16 lines · Scott Wood
Quoted 15 lines · Prabhakar Kushwaha

nand_spl_load_image() can also be used for non TPL framework.

---
  drivers/mtd/nand/fsl_ifc_spl.c |    4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/fsl_ifc_spl.c +0 -0
index 2f82f7c..8a7a3a3 100644
@@ -88,7 +88,7 @@ static inline int bad_block(uchar *marker, int port_size)
  		return __raw_readw((u16 *)marker) != 0xffff;
  }
 
Quoted 16 lines
Quoted 6 lines
drivers/mtd/nand/fsl_ifc_spl.c +1 -1
-#ifdef CONFIG_TPL_BUILD
+#if defined(CONFIG_TPL_BUILD) || defined(CONFIG_SPL_BUILD)
  int nand_spl_load_image(uint32_t offs, unsigned int uboot_size, void *vdst)
  #else
  static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst)

drivers/mtd/nand/fsl_ifc_spl.c static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst) · line 227

Quoted 8 lines
drivers/mtd/nand/fsl_ifc_spl.c +1 -1
@@ -221,7 +221,7 @@ static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst)
   * Defines a static function nand_load_image() here, because non-static makes
   * the code too large for certain SPLs(minimal SPL, maximum size <= 4Kbytes)
   */
-#ifndef CONFIG_TPL_BUILD
+#if !defined(CONFIG_TPL_BUILD) && !defined(CONFIG_SPL_BUILD)
  #define nand_spl_load_image(offs, uboot_size, vdst) \
  	nand_load(offs, uboot_size, vdst)
  #endif

When would you ever use this file without having CONFIG_SPL_BUILD defined?

I want to use nand_spl_load_image in spl.c as it is defined in include/nand.h

Unfortunately, it is only defined for CONFIG_TPL_BUILD. If i remove !CONFIG_SPL_BUILD from second place. this will enable nand_load() which i don't want to use.

will it be possible to change all nand_load to nand_spl_load_image() permanently. the only impact I see of "static". nand_load is static and nand_spl_load_image is not static function declaration.

Regards,
Prabhakar

#3 lore raw

PATCH 6/10 driver/ifc: define nand_spl_load_image() for SPL

Quoted 34 lines · Prabhakar Kushwaha
Quoted 16 lines · Scott Wood
Quoted 15 lines · Prabhakar Kushwaha

nand_spl_load_image() can also be used for non TPL framework.

---
  drivers/mtd/nand/fsl_ifc_spl.c |    4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/fsl_ifc_spl.c +0 -0
index 2f82f7c..8a7a3a3 100644
@@ -88,7 +88,7 @@ static inline int bad_block(uchar *marker, int port_size)
  		return __raw_readw((u16 *)marker) != 0xffff;
  }
 
Quoted 16 lines
Quoted 6 lines
drivers/mtd/nand/fsl_ifc_spl.c +1 -1
-#ifdef CONFIG_TPL_BUILD
+#if defined(CONFIG_TPL_BUILD) || defined(CONFIG_SPL_BUILD)
  int nand_spl_load_image(uint32_t offs, unsigned int uboot_size, void *vdst)
  #else
  static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst)

drivers/mtd/nand/fsl_ifc_spl.c static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst) · line 227

Quoted 8 lines
drivers/mtd/nand/fsl_ifc_spl.c +1 -1
@@ -221,7 +221,7 @@ static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst)
   * Defines a static function nand_load_image() here, because non-static makes
   * the code too large for certain SPLs(minimal SPL, maximum size <= 4Kbytes)
   */
-#ifndef CONFIG_TPL_BUILD
+#if !defined(CONFIG_TPL_BUILD) && !defined(CONFIG_SPL_BUILD)
  #define nand_spl_load_image(offs, uboot_size, vdst) \
  	nand_load(offs, uboot_size, vdst)
  #endif

When would you ever use this file without having CONFIG_SPL_BUILD defined?

Quoted 6 lines

I want to use nand_spl_load_image in spl.c as it is defined in include/nand.h

Unfortunately, it is only defined for CONFIG_TPL_BUILD. If i remove !CONFIG_SPL_BUILD from second place. this will enable nand_load() which i don't want to use.

I'm not saying to remove !CONFIG_SPL_BUILD. I'm saying to remove the ifdef (and all the nand_load stuff) entirely.

Quoted 4 lines

will it be possible to change all nand_load to nand_spl_load_image() permanently. the only impact I see of "static". nand_load is static and nand_spl_load_image is not static function declaration.

Yes. It was done on eLBC because using a static function saved a few critical bytes. IFC has more breathing room due to the 8K SPL, so apparently it doesn't need this.

-Scott