Skip to contentSkip to conversation

fix: regression in SMDK6400

PATCH New Simon Schwarz 3 participants 21 messages Sep 29, 2011 – Nov 29, 2011 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover fix: regression in SMDK6400

This is a fix for a regression introduced by my patch 55f429bb39614a16b1bacc9a8bea9ac01a60bfc8 to u-boot-ti/next

The issue is described here:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/108873

Simon Schwarz (3):
nand: Remove static modifier from common functions
nand: Add common functions to nand.h
Fix regression in SMDK6400

 drivers/mtd/nand/nand_base.c             |    6 +++---
 drivers/mtd/nand/s3c64xx.c               |   26 --------------------------
 include/nand.h                           |   10 +++++++---
 nand_spl/board/samsung/smdk6400/Makefile |    9 ++++++---
 4 files changed, 16 insertions(+), 35 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/3 nand: Remove static modifier from common functions

Removed static modifiers from functions that were often duplicated in SPL implementations.

---
 drivers/mtd/nand/nand_base.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/nand/nand_base.c +3 -3
index e7dfcb1..109d2cf 100644
@@ -133,7 +133,7 @@ static void nand_release_device (struct mtd_info *mtd)
  *
  * Default read function for 8bit buswith
  */
-static uint8_t nand_read_byte(struct mtd_info *mtd)
+uint8_t nand_read_byte(struct mtd_info *mtd)
 {
 	struct nand_chip *chip = mtd->priv;
 	return readb(chip->IO_ADDR_R);
@@ -196,7 +196,7 @@ static void nand_select_chip(struct mtd_info *mtd, int chipnr)
  *
  * Default write function for 8bit buswith
  */
-static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
+void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
 {
 	int i;
 	struct nand_chip *chip = mtd->priv;
@@ -249,7 +249,7 @@ static int nand_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
  *
  * Default write function for 16bit buswith
  */
-static void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len)
+void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len)
 {
 	int i;
 	struct nand_chip *chip = mtd->priv;
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/3 nand: Add common functions to nand.h

In reply to Simon Schwarz

Functions often used in SPL are now part of nand.h.

---
 include/nand.h |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
include/nand.h +7 -3
index b4140794..980408a 100644
@@ -135,9 +135,6 @@ int nand_get_lock_status(nand_info_t *meminfo, loff_t offset);
 int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst);
 void nand_deselect(void);
 
-void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
-void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
-
 #ifdef CONFIG_SYS_NAND_SELECT_DEVICE
 void board_nand_select_device(struct nand_chip *nand, int chip);
 #endif
@@ -154,3 +151,10 @@ __attribute__((noreturn)) void nand_boot(void);
 #define ENV_OFFSET_SIZE 8
 int get_nand_env_oob(nand_info_t *nand, unsigned long *result);
 #endif
+
+/* Standard NAND functions from nand_base.c */
+void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len);
+void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len);
+void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
+void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
+uint8_t nand_read_byte(struct mtd_info *mtd);
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH 2/3 nand: Add common functions to nand.h

Quoted 22 lines · Simon Schwarz

Functions often used in SPL are now part of nand.h.

---
 include/nand.h |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
include/nand.h +0 -3
index b4140794..980408a 100644
@@ -135,9 +135,6 @@ int nand_get_lock_status(nand_info_t *meminfo, loff_t offset);
 int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst);
 void nand_deselect(void);
 
-void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
-void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
-
 #ifdef CONFIG_SYS_NAND_SELECT_DEVICE
 void board_nand_select_device(struct nand_chip *nand, int chip);
 #endif

include/nand.h __attribute__((noreturn)) void nand_boot(void); · line 160

Quoted 10 lines
include/nand.h +7 -0
@@ -154,3 +151,10 @@ __attribute__((noreturn)) void nand_boot(void);
 #define ENV_OFFSET_SIZE 8
 int get_nand_env_oob(nand_info_t *nand, unsigned long *result);
 #endif
+
+/* Standard NAND functions from nand_base.c */
+void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len);
+void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len);
+void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
+void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
+uint8_t nand_read_byte(struct mtd_info *mtd);

Sorry for not noticing this before, but these should go in include/linux/mtd/nand.h since that corresponds to drivers/mtd/nand/nand_base.c. include/nand.h is for U-Boot-specific things.

As it stands now, drivers/mtd/nand/nand_base.c does not include include/nand.h, so we won't get warned if the function signatures diverge.

-Scott

A message that is not in the archive (sent off-list or not yet received): CAA5zgp_P9LtYraPUPQSM1PPDg_eGHAJ0F-qXHwiF-B+69NS1oQ@mail.gmail.com

#5 lore raw

PATCH 2/3 nand: Add common functions to nand.h

Hi Scott,

ok. Will have a look - hopefully this weekend.

Regards
Simon

2011/10/14 Simon Schwarz <[email protected]>:

Quoted 53 lines

Hi Scott,

ok. Will have a look - hopefully this weekend.

Regards
Simon

2011/10/4 Scott Wood <[email protected]>:

Quoted 44 lines · Simon Schwarz
Quoted 25 lines

Functions often used in SPL are now part of nand.h.

---
?include/nand.h | ? 10 +++++++---
?1 files changed, 7 insertions(+), 3 deletions(-)

include/nand.h +0 -3
index b4140794..980408a 100644
@@ -135,9 +135,6 @@ int nand_get_lock_status(nand_info_t *meminfo, loff_t offset);
 ?int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst);
 ?void nand_deselect(void);
 
-void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
-void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
-

?#ifdef CONFIG_SYS_NAND_SELECT_DEVICE
?void board_nand_select_device(struct nand_chip *nand, int chip); ?#endif

include/nand.h +0 -0
@@ -154,3 +151,10 @@ __attribute__((noreturn)) void nand_boot(void);

?#define ENV_OFFSET_SIZE 8
?int get_nand_env_oob(nand_info_t *nand, unsigned long *result); ?#endif

include/nand.h __attribute__((noreturn)) void nand_boot(void); · line 160

Quoted 7 lines
include/nand.h +7 -0
+
+/* Standard NAND functions from nand_base.c */
+void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len);
+void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len);
+void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
+void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
+uint8_t nand_read_byte(struct mtd_info *mtd);

Sorry for not noticing this before, but these should go in include/linux/mtd/nand.h since that corresponds to drivers/mtd/nand/nand_base.c. ?include/nand.h is for U-Boot-specific things.

As it stands now, drivers/mtd/nand/nand_base.c does not include include/nand.h, so we won't get warned if the function signatures diverge.

-Scott

#6 lore raw

PATCH 3/3 Fix regression in SMDK6400

In reply to Simon Schwarz

s3c64xx.c implemented its own nand_read_byte, nand_write_buf and nand_read_buf functions. This provoked a regression when these functions were made public by patch 55f429bb39614a16b1bacc9a8bea9ac01a60bfc8.

This deletes these duplicated functions from s3c64xx.c and adds the generic implementations in nand_base.c to the spl Makefile. It also adds -ffcuntion-sections and -gc-sections to the compilation flags of the SPL to avoid errors originating from unused functions in nand_base.c.

Description of the regression:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/108873

---
 drivers/mtd/nand/s3c64xx.c               |   26 --------------------------
 nand_spl/board/samsung/smdk6400/Makefile |    9 ++++++---
 2 files changed, 6 insertions(+), 29 deletions(-)
drivers/mtd/nand/s3c64xx.c +0 -26
index 084e475..7260537 100644
@@ -60,32 +60,6 @@ static void print_oob(const char *header, struct mtd_info *mtd)
 }
 #endif /* S3C_NAND_DEBUG */
 
-#ifdef CONFIG_NAND_SPL
-static u_char nand_read_byte(struct mtd_info *mtd)
-{
-	struct nand_chip *this = mtd->priv;
-	return readb(this->IO_ADDR_R);
-}
-
-static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
-{
-	int i;
-	struct nand_chip *this = mtd->priv;
-
-	for (i = 0; i < len; i++)
-		writeb(buf[i], this->IO_ADDR_W);
-}
-
-static void nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
-{
-	int i;
-	struct nand_chip *this = mtd->priv;
-
-	for (i = 0; i < len; i++)
-		buf[i] = readb(this->IO_ADDR_R);
-}
-#endif
-
 static void s3c_nand_select_chip(struct mtd_info *mtd, int chip)
 {
 	int ctrl = readl(NFCONT);
nand_spl/board/samsung/smdk6400/Makefile +6 -3
index 2f9c307..c9e75ba 100644
@@ -33,12 +33,12 @@ nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
 LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
-	   $(LDFLAGS_FINAL)
+		$(LDFLAGS_FINAL) -gc-sections
 AFLAGS	+= -DCONFIG_NAND_SPL
-CFLAGS	+= -DCONFIG_NAND_SPL
+CFLAGS	+= -DCONFIG_NAND_SPL -ffunction-sections
 
 SOBJS	= start.o cpu_init.o lowlevel_init.o
-COBJS	= nand_boot.o nand_ecc.o s3c64xx.o smdk6400_nand_spl.o
+COBJS	= nand_boot.o nand_ecc.o s3c64xx.o smdk6400_nand_spl.o nand_base.o
 
 SRCS	:= $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
 OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
@@ -98,6 +98,9 @@ $(obj)smdk6400_nand_spl.c:
 	@rm -f $@
 	@ln -s $(TOPDIR)/board/samsung/smdk6400/smdk6400_nand_spl.c $@
 
+$(obj)nand_base.c:
+	@rm -f $@
+	@ln -s $(TOPDIR)/drivers/mtd/nand/nand_base.c $@
 #########################################################################
 
 $(obj)%.o:	$(obj)%.S
Signature · 1 line
1.7.4.1
#7 lore raw

cover fix: regression in SMDK6400

In reply to Simon Schwarz
Quoted 11 lines · Simon Schwarz

This is a fix for a regression introduced by my patch 55f429bb39614a16b1bacc9a8bea9ac01a60bfc8 to u-boot-ti/next

The issue is described here:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/108873

Simon Schwarz (3):
nand: Remove static modifier from common functions
nand: Add common functions to nand.h
Fix regression in SMDK6400

Quoted 6 lines
 drivers/mtd/nand/nand_base.c             |    6 +++---
 drivers/mtd/nand/s3c64xx.c               |   26 --------------------------
 include/nand.h                           |   10 +++++++---
 nand_spl/board/samsung/smdk6400/Makefile |    9 ++++++---
 4 files changed, 16 insertions(+), 35 deletions(-)

I guess this will be taken by the ti tree, since it fixes a problem there? I assume patch 3 won't apply to what's currently in mainline.

-Scott

#8 lore raw

cover fix: regression in SMDK6400

In reply to Simon Schwarz

This is a fix for a regression introduced by my patch 55f429bb39614a16b1bacc9a8bea9ac01a60bfc8 to u-boot-ti/next

The issue is described here:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/108873

Simon Schwarz (3):
nand: Remove static modifier from common functions
nand: Add common functions to linux/mtd/nand.h Fix regression in SMDK6400

 drivers/mtd/nand/nand_base.c             |    6 +++---
 drivers/mtd/nand/s3c64xx.c               |   28 ++--------------------------
 include/linux/mtd/nand.h                 |    7 +++++++
 include/nand.h                           |    3 ---
 nand_spl/board/samsung/smdk6400/Makefile |    9 ++++++---
 5 files changed, 18 insertions(+), 35 deletions(-)
Signature · 1 line
1.7.4.1
#9 lore raw

PATCH 1/3 nand: Remove static modifier from common functions

Removed static modifiers from functions that were often duplicated in SPL implementations.

Cc scottwood at freescale.com
Cc s-paulraj at ti.com
Cc albert.u.boot at aribaud.net

---
Changes V2:
nothing

---
 drivers/mtd/nand/nand_base.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/nand/nand_base.c +3 -3
index e7dfcb1..109d2cf 100644
@@ -133,7 +133,7 @@ static void nand_release_device (struct mtd_info *mtd)
  *
  * Default read function for 8bit buswith
  */
-static uint8_t nand_read_byte(struct mtd_info *mtd)
+uint8_t nand_read_byte(struct mtd_info *mtd)
 {
 	struct nand_chip *chip = mtd->priv;
 	return readb(chip->IO_ADDR_R);
@@ -196,7 +196,7 @@ static void nand_select_chip(struct mtd_info *mtd, int chipnr)
  *
  * Default write function for 8bit buswith
  */
-static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
+void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
 {
 	int i;
 	struct nand_chip *chip = mtd->priv;
@@ -249,7 +249,7 @@ static int nand_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
  *
  * Default write function for 16bit buswith
  */
-static void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len)
+void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len)
 {
 	int i;
 	struct nand_chip *chip = mtd->priv;
Signature · 1 line
1.7.4.1
#10 lore raw

PATCH 1/3 nand: Remove static modifier from common functions

Quoted 7 lines · Simon Schwarz

Removed static modifiers from functions that were often duplicated in SPL implementations.

Cc scottwood at freescale.com
Cc s-paulraj at ti.com
Cc albert.u.boot at aribaud.net
Quoted 6 lines

---
Changes V2:
nothing

---
 drivers/mtd/nand/nand_base.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Ideally the prototypes would be added in the same patch, but it's not worth respinning over, especially since U-Boot doesn't appear to enable -Wmissing-prototypes.

Will this be taken via an ARM tree due to patch 3/3?

-Scott

#11 lore raw

PATCH 2/3 nand: Add common functions to linux/mtd/nand.h

In reply to Simon Schwarz

Functions often used in SPL are now part of linux/mtd/nand.h.

Cc scottwood at freescale.com
Cc s-paulraj at ti.com
Cc albert.u.boot at aribaud.net

---
Changes V2:
CHG moved function definiton from nand.h to linux/mtd/nand.h because of:

	http://article.gmane.org/gmane.comp.boot-loaders.u-boot/110219
---
 include/linux/mtd/nand.h |    7 +++++++
 include/nand.h           |    3 ---
 2 files changed, 7 insertions(+), 3 deletions(-)
include/linux/mtd/nand.h +7 -0
index 987a2ec..2419c6c 100644
@@ -624,3 +624,10 @@ struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd)
 }
 
 #endif /* __LINUX_MTD_NAND_H */
+
+/* Standard NAND functions from nand_base.c */
+void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len);
+void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len);
+void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
+void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
+uint8_t nand_read_byte(struct mtd_info *mtd);
include/nand.h +0 -3
index b4140794..d444ddc 100644
@@ -135,9 +135,6 @@ int nand_get_lock_status(nand_info_t *meminfo, loff_t offset);
 int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst);
 void nand_deselect(void);
 
-void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
-void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
-
 #ifdef CONFIG_SYS_NAND_SELECT_DEVICE
 void board_nand_select_device(struct nand_chip *nand, int chip);
 #endif
Signature · 1 line
1.7.4.1
#12 lore raw

PATCH 2/3 nand: Add common functions to linux/mtd/nand.h

Quoted 20 lines · Simon Schwarz

Functions often used in SPL are now part of linux/mtd/nand.h.

Cc scottwood at freescale.com
Cc s-paulraj at ti.com
Cc albert.u.boot at aribaud.net

---
Changes V2:
CHG moved function definiton from nand.h to linux/mtd/nand.h because of:

	http://article.gmane.org/gmane.comp.boot-loaders.u-boot/110219
---
 include/linux/mtd/nand.h |    7 +++++++
 include/nand.h           |    3 ---
 2 files changed, 7 insertions(+), 3 deletions(-)
include/linux/mtd/nand.h +0 -0
index 987a2ec..2419c6c 100644

include/linux/mtd/nand.h struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd) · line 633

Quoted 10 lines
include/linux/mtd/nand.h +7 -0
@@ -624,3 +624,10 @@ struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd)
 }
 
 #endif /* __LINUX_MTD_NAND_H */
+
+/* Standard NAND functions from nand_base.c */
+void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len);
+void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len);
+void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
+void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
+uint8_t nand_read_byte(struct mtd_info *mtd);

These need to go before the #endif.

-Scott

#13 lore raw

PATCH 3/3 Fix regression in SMDK6400

In reply to Simon Schwarz

s3c64xx.c implemented its own nand_read_byte, nand_write_buf and nand_read_buf functions. This provoked a regression when these functions were made public by patch 55f429bb39614a16b1bacc9a8bea9ac01a60bfc8.

This deletes these duplicated functions from s3c64xx.c and adds the generic implementations in nand_base.c to the spl Makefile. It also adds -ffcuntion-sections and -gc-sections to the compilation flags of the SPL to avoid errors originating from unused functions in nand_base.c.

Description of the regression:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/108873

Cc scottwood at freescale.com
Cc s-paulraj at ti.com
Cc albert.u.boot at aribaud.net

---
Changes V2:
CHG include linux/mtd/nand.h because of:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/110219

---
 drivers/mtd/nand/s3c64xx.c               |   28 ++--------------------------
 nand_spl/board/samsung/smdk6400/Makefile |    9 ++++++---
 2 files changed, 8 insertions(+), 29 deletions(-)
drivers/mtd/nand/s3c64xx.c +2 -26
index 084e475..87f0341 100644
@@ -28,6 +28,8 @@
 #include <common.h>
 
 #include <nand.h>
+#include <linux/mtd/nand.h>
+
 #include <asm/arch/s3c6400.h>
 
 #include <asm/io.h>
@@ -60,32 +62,6 @@ static void print_oob(const char *header, struct mtd_info *mtd)
 }
 #endif /* S3C_NAND_DEBUG */
 
-#ifdef CONFIG_NAND_SPL
-static u_char nand_read_byte(struct mtd_info *mtd)
-{
-	struct nand_chip *this = mtd->priv;
-	return readb(this->IO_ADDR_R);
-}
-
-static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
-{
-	int i;
-	struct nand_chip *this = mtd->priv;
-
-	for (i = 0; i < len; i++)
-		writeb(buf[i], this->IO_ADDR_W);
-}
-
-static void nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
-{
-	int i;
-	struct nand_chip *this = mtd->priv;
-
-	for (i = 0; i < len; i++)
-		buf[i] = readb(this->IO_ADDR_R);
-}
-#endif
-
 static void s3c_nand_select_chip(struct mtd_info *mtd, int chip)
 {
 	int ctrl = readl(NFCONT);
nand_spl/board/samsung/smdk6400/Makefile +6 -3
index 2f9c307..c9e75ba 100644
@@ -33,12 +33,12 @@ nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
 LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
-	   $(LDFLAGS_FINAL)
+		$(LDFLAGS_FINAL) -gc-sections
 AFLAGS	+= -DCONFIG_NAND_SPL
-CFLAGS	+= -DCONFIG_NAND_SPL
+CFLAGS	+= -DCONFIG_NAND_SPL -ffunction-sections
 
 SOBJS	= start.o cpu_init.o lowlevel_init.o
-COBJS	= nand_boot.o nand_ecc.o s3c64xx.o smdk6400_nand_spl.o
+COBJS	= nand_boot.o nand_ecc.o s3c64xx.o smdk6400_nand_spl.o nand_base.o
 
 SRCS	:= $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
 OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
@@ -98,6 +98,9 @@ $(obj)smdk6400_nand_spl.c:
 	@rm -f $@
 	@ln -s $(TOPDIR)/board/samsung/smdk6400/smdk6400_nand_spl.c $@
 
+$(obj)nand_base.c:
+	@rm -f $@
+	@ln -s $(TOPDIR)/drivers/mtd/nand/nand_base.c $@
 #########################################################################
 
 $(obj)%.o:	$(obj)%.S
Signature · 1 line
1.7.4.1
#14 lore raw

v3 cover fix: regression in SMDK6400

In reply to Simon Schwarz

This is a fix for a regression introduced by my patch 55f429bb39614a16b1bacc9a8bea9ac01a60bfc8 to u-boot-ti/next

The issue is described here:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/108873

changes V3:
- fix for: http://article.gmane.org/gmane.comp.boot-loaders.u-boot/114559
- http://article.gmane.org/gmane.comp.boot-loaders.u-boot/114558

Simon Schwarz (2):
nand: Add common functions to linux/mtd/nand.h
Fix regression in SMDK6400

 drivers/mtd/nand/nand_base.c             |    6 +++---
 drivers/mtd/nand/s3c64xx.c               |   28 ++--------------------------
 include/linux/mtd/nand.h                 |    7 +++++++
 include/nand.h                           |    3 ---
 nand_spl/board/samsung/smdk6400/Makefile |    9 ++++++---
 5 files changed, 18 insertions(+), 35 deletions(-)
Signature · 1 line
1.7.4.1
#15 lore raw

PATCH v3 1/2 nand: Add common functions to linux/mtd/nand.h

Functions often used in SPL are now part of linux/mtd/nand.h. Static modifiers are removed from these functions in drivers/mtd/nand/nand_base.c.

Cc scottwood at freescale.com
Cc s-paulraj at ti.com
Cc albert.u.boot at aribaud.net

---
Changes V2:
CHG moved function definiton from nand.h to linux/mtd/nand.h because of:

	http://article.gmane.org/gmane.comp.boot-loaders.u-boot/110219

Changes V3:
CHG moved the definitions before double inculsion detection end CHG combined function definition and prototype in one patch as advised here:

	http://article.gmane.org/gmane.comp.boot-loaders.u-boot/114558
---
 drivers/mtd/nand/nand_base.c |    6 +++---
 include/linux/mtd/nand.h     |    7 +++++++
 include/nand.h               |    3 ---
 3 files changed, 10 insertions(+), 6 deletions(-)
drivers/mtd/nand/nand_base.c +3 -3
index e7dfcb1..109d2cf 100644
@@ -133,7 +133,7 @@ static void nand_release_device (struct mtd_info *mtd)
  *
  * Default read function for 8bit buswith
  */
-static uint8_t nand_read_byte(struct mtd_info *mtd)
+uint8_t nand_read_byte(struct mtd_info *mtd)
 {
 	struct nand_chip *chip = mtd->priv;
 	return readb(chip->IO_ADDR_R);
@@ -196,7 +196,7 @@ static void nand_select_chip(struct mtd_info *mtd, int chipnr)
  *
  * Default write function for 8bit buswith
  */
-static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
+void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
 {
 	int i;
 	struct nand_chip *chip = mtd->priv;
@@ -249,7 +249,7 @@ static int nand_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
  *
  * Default write function for 16bit buswith
  */
-static void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len)
+void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len)
 {
 	int i;
 	struct nand_chip *chip = mtd->priv;
include/linux/mtd/nand.h +7 -0
index 987a2ec..1cdc7ae 100644
@@ -623,4 +623,11 @@ struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd)
 	return chip->priv;
 }
 
+/* Standard NAND functions from nand_base.c */
+void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len);
+void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len);
+void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
+void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
+uint8_t nand_read_byte(struct mtd_info *mtd);
+
 #endif /* __LINUX_MTD_NAND_H */
include/nand.h +0 -3
index b4140794..d444ddc 100644
@@ -135,9 +135,6 @@ int nand_get_lock_status(nand_info_t *meminfo, loff_t offset);
 int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst);
 void nand_deselect(void);
 
-void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len);
-void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len);
-
 #ifdef CONFIG_SYS_NAND_SELECT_DEVICE
 void board_nand_select_device(struct nand_chip *nand, int chip);
 #endif
Signature · 1 line
1.7.4.1
#16 lore raw

PATCH v3 1/2 nand: Add common functions to linux/mtd/nand.h

Quoted 8 lines · Simon Schwarz

Functions often used in SPL are now part of linux/mtd/nand.h. Static modifiers are removed from these functions in drivers/mtd/nand/nand_base.c.

Cc scottwood at freescale.com
Cc s-paulraj at ti.com
Cc albert.u.boot at aribaud.net

-Scott

#17 lore raw

PATCH v3 1/2 nand: Add common functions to linux/mtd/nand.h

Hi Simon, Scott,

Le 31/10/2011 18:52, Scott Wood a ?crit :

Quoted 5 lines · Simon Schwarz
Quoted 4 lines

Functions often used in SPL are now part of linux/mtd/nand.h. Static modifiers are removed from these functions in drivers/mtd/nand/nand_base.c.

Quoted 8 lines
Quoted 4 lines
Cc scottwood at freescale.com
Cc s-paulraj at ti.com
Cc albert.u.boot at aribaud.net

-Scott

Uhm... Why was this delegated to me? It doesn't seem ARM related, does it?

Amicalement,

Signature · 1 line
Albert.
#18 lore raw

PATCH v3 1/2 nand: Add common functions to linux/mtd/nand.h

Le 25/11/2011 20:05, Albert ARIBAUD a ?crit :

Quoted 13 lines

Hi Simon, Scott,

Le 31/10/2011 18:52, Scott Wood a ?crit :

Quoted 10 lines · Simon Schwarz
Quoted 8 lines

Functions often used in SPL are now part of linux/mtd/nand.h. Static modifiers are removed from these functions in drivers/mtd/nand/nand_base.c.

Cc scottwood at freescale.com
Cc s-paulraj at ti.com
Cc albert.u.boot at aribaud.net
Quoted 5 lines
Quoted 3 lines

-Scott

Uhm... Why was this delegated to me? It doesn't seem ARM related, does it?

Never mind. Got it.

Quoted 1 line

Amicalement,

Amicalement,

Signature · 1 line
Albert.
#19 lore raw

PATCH v3 2/2 Fix regression in SMDK6400

In reply to Simon Schwarz

s3c64xx.c implemented its own nand_read_byte, nand_write_buf and nand_read_buf functions. This provoked a regression when these functions were made public by patch 55f429bb39614a16b1bacc9a8bea9ac01a60bfc8.

This deletes these duplicated functions from s3c64xx.c and adds the generic implementations in nand_base.c to the spl Makefile. It also adds -ffcuntion-sections and -gc-sections to the compilation flags of the SPL to avoid errors originating from unused functions in nand_base.c.

Description of the regression:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/108873

Cc scottwood at freescale.com
Cc s-paulraj at ti.com
Cc albert.u.boot at aribaud.net

---
Changes V2:
CHG include linux/mtd/nand.h because of:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/110219

Changes V3:
none

---
 drivers/mtd/nand/s3c64xx.c               |   28 ++--------------------------
 nand_spl/board/samsung/smdk6400/Makefile |    9 ++++++---
 2 files changed, 8 insertions(+), 29 deletions(-)
drivers/mtd/nand/s3c64xx.c +2 -26
index 084e475..87f0341 100644
@@ -28,6 +28,8 @@
 #include <common.h>
 
 #include <nand.h>
+#include <linux/mtd/nand.h>
+
 #include <asm/arch/s3c6400.h>
 
 #include <asm/io.h>
@@ -60,32 +62,6 @@ static void print_oob(const char *header, struct mtd_info *mtd)
 }
 #endif /* S3C_NAND_DEBUG */
 
-#ifdef CONFIG_NAND_SPL
-static u_char nand_read_byte(struct mtd_info *mtd)
-{
-	struct nand_chip *this = mtd->priv;
-	return readb(this->IO_ADDR_R);
-}
-
-static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
-{
-	int i;
-	struct nand_chip *this = mtd->priv;
-
-	for (i = 0; i < len; i++)
-		writeb(buf[i], this->IO_ADDR_W);
-}
-
-static void nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
-{
-	int i;
-	struct nand_chip *this = mtd->priv;
-
-	for (i = 0; i < len; i++)
-		buf[i] = readb(this->IO_ADDR_R);
-}
-#endif
-
 static void s3c_nand_select_chip(struct mtd_info *mtd, int chip)
 {
 	int ctrl = readl(NFCONT);
nand_spl/board/samsung/smdk6400/Makefile +6 -3
index 2f9c307..c9e75ba 100644
@@ -33,12 +33,12 @@ nandobj	:= $(OBJTREE)/nand_spl/
 
 LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
 LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
-	   $(LDFLAGS_FINAL)
+		$(LDFLAGS_FINAL) -gc-sections
 AFLAGS	+= -DCONFIG_NAND_SPL
-CFLAGS	+= -DCONFIG_NAND_SPL
+CFLAGS	+= -DCONFIG_NAND_SPL -ffunction-sections
 
 SOBJS	= start.o cpu_init.o lowlevel_init.o
-COBJS	= nand_boot.o nand_ecc.o s3c64xx.o smdk6400_nand_spl.o
+COBJS	= nand_boot.o nand_ecc.o s3c64xx.o smdk6400_nand_spl.o nand_base.o
 
 SRCS	:= $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
 OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
@@ -98,6 +98,9 @@ $(obj)smdk6400_nand_spl.c:
 	@rm -f $@
 	@ln -s $(TOPDIR)/board/samsung/smdk6400/smdk6400_nand_spl.c $@
 
+$(obj)nand_base.c:
+	@rm -f $@
+	@ln -s $(TOPDIR)/drivers/mtd/nand/nand_base.c $@
 #########################################################################
 
 $(obj)%.o:	$(obj)%.S
Signature · 1 line
1.7.4.1
#20 lore raw

v3 cover fix: regression in SMDK6400

In reply to Simon Schwarz

Hi Simon,

Le 31/10/2011 17:34, Simon Schwarz a ?crit :

Quoted 15 lines

This is a fix for a regression introduced by my patch 55f429bb39614a16b1bacc9a8bea9ac01a60bfc8 to u-boot-ti/next

The issue is described here:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/108873

changes V3:
- fix for: http://article.gmane.org/gmane.comp.boot-loaders.u-boot/114559
- http://article.gmane.org/gmane.comp.boot-loaders.u-boot/114558

Simon Schwarz (2):
nand: Add common functions to linux/mtd/nand.h
Fix regression in SMDK6400

Quoted 6 lines
  drivers/mtd/nand/nand_base.c             |    6 +++---
  drivers/mtd/nand/s3c64xx.c               |   28 ++--------------------------
  include/linux/mtd/nand.h                 |    7 +++++++
  include/nand.h                           |    3 ---
  nand_spl/board/samsung/smdk6400/Makefile |    9 ++++++---
  5 files changed, 18 insertions(+), 35 deletions(-)

Applied to u-boot-arm/master, under the assumption that you're taking up maintainer role for SMDK6400. If you do indeed, can you send a patch to MAINTAINERS to make it official? Thanks.

Amicalement,

Signature · 1 line
Albert.
#21 lore raw

v3 cover fix: regression in SMDK6400

Hi Albert,

Quoted 25 lines · Albert ARIBAUD

Hi Simon,

Le 31/10/2011 17:34, Simon Schwarz a ?crit :

Quoted 15 lines

This is a fix for a regression introduced by my patch 55f429bb39614a16b1bacc9a8bea9ac01a60bfc8 to u-boot-ti/next

The issue is described here:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/108873

changes V3:
- fix for: http://article.gmane.org/gmane.comp.boot-loaders.u-boot/114559
- http://article.gmane.org/gmane.comp.boot-loaders.u-boot/114558

Simon Schwarz (2):
nand: Add common functions to linux/mtd/nand.h
Fix regression in SMDK6400

Quoted 6 lines

drivers/mtd/nand/nand_base.c | 6 +++--- drivers/mtd/nand/s3c64xx.c | 28 ++-------------------------- include/linux/mtd/nand.h | 7 +++++++ include/nand.h | 3 --- nand_spl/board/samsung/smdk6400/Makefile | 9 ++++++---

5 files changed, 18 insertions(+), 35 deletions(-)
Quoted 4 lines

Applied to u-boot-arm/master, under the assumption that you're taking up maintainer role for SMDK6400. If you do indeed, can you send a patch to MAINTAINERS to make it official? Thanks.

I don't have an SMDK6400 board. So I think it does not make sense to be maintainer for it.

The fix was simple and not only related to SMDK6400 - SMDK6400 was just the board which made the problem come up.

Quoted 1 line

Amicalement,

Regards
Simon