Skip to contentSkip to conversation

mtd: nand: Introduce CONFIG_SYS_NAND_BUSWIDTH_16BIT

PATCH Superseded Benoît Thébaudeau 5 participants 52 messages Mar 1, 2013 – Mar 3, 2013

Subsystems (9)

v8 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

PATCH v8 1/31 mtd: nand: Introduce CONFIG_SYS_NAND_BUSWIDTH_16BIT

From: Fabio Estevam <[email protected]>

Introduce CONFIG_SYS_NAND_BUSWIDTH_16BIT option so that other NAND controller drivers could use it when a 16-bit NAND is deployed.

drivers/mtd/nand/ndfc has CONFIG_SYS_NDFC_16BIT, so just rename it, so that other NAND drivers could reuse the same symbol.

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 README                  |    9 ++++++---
 drivers/mtd/nand/ndfc.c |    4 ++--
 2 files changed, 8 insertions(+), 5 deletions(-)
README +6 -3
index d8cb394..830c45e 100644
@@ -3713,9 +3713,12 @@ Low Level (hardware related) configuration options:
 - CONFIG_SYS_SRIOn_MEM_SIZE:
 		Size of SRIO port 'n' memory region
 
-- CONFIG_SYS_NDFC_16
-		Defined to tell the NDFC that the NAND chip is using a
-		16 bit bus.
+- CONFIG_SYS_NAND_BUSWIDTH_16BIT
+		Defined to tell the NAND controller that the NAND chip is using
+		a 16 bit bus.
+		Not all NAND drivers use this symbol.
+		Example of driver that uses it:
+		- drivers/mtd/nand/ndfc.c
 
 - CONFIG_SYS_NDFC_EBC0_CFG
 		Sets the EBC0_CFG register for the NDFC. If not defined
drivers/mtd/nand/ndfc.c +2 -2
index 6ebbb5e..213d2c9 100644
@@ -156,7 +156,7 @@ static uint8_t ndfc_read_byte(struct mtd_info *mtd)
 
 	struct nand_chip *chip = mtd->priv;
 
-#ifdef CONFIG_SYS_NDFC_16BIT
+#ifdef CONFIG_SYS_NAND_BUSWIDTH_16BIT
 	return (uint8_t) readw(chip->IO_ADDR_R);
 #else
 	return readb(chip->IO_ADDR_R);
@@ -218,7 +218,7 @@ int board_nand_init(struct nand_chip *nand)
 	nand->ecc.bytes = 3;
 	nand->select_chip = ndfc_select_chip;
 
-#ifdef CONFIG_SYS_NDFC_16BIT
+#ifdef CONFIG_SYS_NAND_BUSWIDTH_16BIT
 	nand->options |= NAND_BUSWIDTH_16;
 #endif
 
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v8 1/31 mtd: nand: Introduce CONFIG_SYS_NAND_BUSWIDTH_16BIT

Hi Fabio,

Quoted 32 lines · Beno?t Th?baudeau

From: Fabio Estevam <[email protected]>

Introduce CONFIG_SYS_NAND_BUSWIDTH_16BIT option so that other NAND controller drivers could use it when a 16-bit NAND is deployed.

drivers/mtd/nand/ndfc has CONFIG_SYS_NDFC_16BIT, so just rename it, so that other NAND drivers could reuse the same symbol.

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 README                  |    9 ++++++---
 drivers/mtd/nand/ndfc.c |    4 ++--
 2 files changed, 8 insertions(+), 5 deletions(-)
README +0 -0
index d8cb394..830c45e 100644
@@ -3713,9 +3713,12 @@ Low Level (hardware related) configuration options:
 - CONFIG_SYS_SRIOn_MEM_SIZE:
 		Size of SRIO port 'n' memory region

README Low Level (hardware related) configuration options: · line 3721

Quoted 10 lines
README +6 -3
 
-- CONFIG_SYS_NDFC_16
-		Defined to tell the NDFC that the NAND chip is using a
-		16 bit bus.
+- CONFIG_SYS_NAND_BUSWIDTH_16BIT
+		Defined to tell the NAND controller that the NAND chip is using
+		a 16 bit bus.
+		Not all NAND drivers use this symbol.
+		Example of driver that uses it:
+		- drivers/mtd/nand/ndfc.c

FYI, I've just fixed a space damage (space before tab warning) here when applying.

Best regards,
Beno?t

reviewer
#2 lore raw

PATCH v8 1/31 mtd: nand: Introduce CONFIG_SYS_NAND_BUSWIDTH_16BIT

Quoted 2 lines · Beno?t Th?baudeau

FYI, I've just fixed a space damage (space before tab warning) here when applying.

Ok, thanks for fixing it.

#3 lore raw

PATCH v8 2/31 mtd: nand: mxc_nand: Fix is_16bit_nand()

In reply to Benoît Thébaudeau

From: Fabio Estevam <[email protected]>

Currently is_16bit_nand() is a per SoC function and it decides the bus nand width by reading some boot related registers.

This method works when NAND is the boot medium, but does not work if another boot medium is used. For example: booting from a SD card and then using NAND to store the environment variables, would lead to the following error:

NAND bus width 16 instead 8 bit
No NAND device found!!!
0 MiB

Use CONFIG_SYS_NAND_BUSWIDTH_16BIT symbol to decide the bus width.

If it is defined in the board file, then consider 16-bit NAND bus-width, otherwise assume 8-bit NAND is used.

This also aligns with Documentation/devicetree/bindings/mtd/nand.txt, which states:

nand-bus-width : 8 or 16 bus width if not present 8

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 README                      |    3 ++-
 drivers/mtd/nand/mxc_nand.c |   37 +++----------------------------------
 2 files changed, 5 insertions(+), 35 deletions(-)
README +2 -1
index 830c45e..11ffa71 100644
@@ -3717,8 +3717,9 @@ Low Level (hardware related) configuration options:
 		Defined to tell the NAND controller that the NAND chip is using
 		a 16 bit bus.
 		Not all NAND drivers use this symbol.
-		Example of driver that uses it:
+		Example of drivers that use it:
 		- drivers/mtd/nand/ndfc.c
+		- drivers/mtd/nand/mxc_nand.c
 
 - CONFIG_SYS_NDFC_EBC0_CFG
 		Sets the EBC0_CFG register for the NDFC. If not defined
drivers/mtd/nand/mxc_nand.c +3 -34
index d0ded48..bb475f2 100644
@@ -98,45 +98,14 @@ static struct nand_ecclayout nand_hw_eccoob2k = {
 #endif
 #endif
 
-#ifdef CONFIG_MX27
 static int is_16bit_nand(void)
 {
-	struct system_control_regs *sc_regs =
-		(struct system_control_regs *)IMX_SYSTEM_CTL_BASE;
-
-	if (readl(&sc_regs->fmcr) & NF_16BIT_SEL)
-		return 1;
-	else
-		return 0;
-}
-#elif defined(CONFIG_MX31)
-static int is_16bit_nand(void)
-{
-	struct clock_control_regs *sc_regs =
-		(struct clock_control_regs *)CCM_BASE;
-
-	if (readl(&sc_regs->rcsr) & CCM_RCSR_NF16B)
-		return 1;
-	else
-		return 0;
-}
-#elif defined(CONFIG_MX25) || defined(CONFIG_MX35)
-static int is_16bit_nand(void)
-{
-	struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE;
-
-	if (readl(&ccm->rcsr) & CCM_RCSR_NF_16BIT_SEL)
-		return 1;
-	else
-		return 0;
-}
+#if defined(CONFIG_SYS_NAND_BUSWIDTH_16BIT)
+	return 1;
 #else
-#warning "8/16 bit NAND autodetection not supported"
-static int is_16bit_nand(void)
-{
 	return 0;
-}
 #endif
+}
 
 static uint32_t *mxc_nand_memcpy32(uint32_t *dest, uint32_t *source, size_t size)
 {
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH v8 3/31 nand: mxc: Prepare to add support for i.MX5

In reply to Benoît Thébaudeau

Add some abstraction to NFC definitions so that some parts of the current code can also be used for future i.MX5 code.

Clean up a few things by the way.

---
Changes in v8: None
Changes in v7:
- Fix typo in patch description.

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3:
- Separate code reformatting from behavioral changes.

Changes in v2:
- Fix warning for unused tmp variable in board_nand_init() for NFC V1.

 drivers/mtd/nand/mxc_nand.c  |   92 +++++++++++++++++++++---------------------
 include/fsl_nfc.h            |   72 ++++++++++++---------------------
 nand_spl/nand_boot_fsl_nfc.c |   47 +++++++++++----------
 3 files changed, 97 insertions(+), 114 deletions(-)
drivers/mtd/nand/mxc_nand.c +46 -46
index bb475f2..6ae95d6 100644
@@ -119,7 +119,7 @@ static uint32_t *mxc_nand_memcpy32(uint32_t *dest, uint32_t *source, size_t size
 
 /*
  * This function polls the NANDFC to wait for the basic operation to
- * complete by checking the INT bit of config2 register.
+ * complete by checking the INT bit.
  */
 static void wait_op_done(struct mxc_nand_host *host, int max_retries,
 				uint16_t param)
@@ -127,10 +127,10 @@ static void wait_op_done(struct mxc_nand_host *host, int max_retries,
 	uint32_t tmp;
 
 	while (max_retries-- > 0) {
-		if (readw(&host->regs->config2) & NFC_INT) {
-			tmp = readw(&host->regs->config2);
-			tmp  &= ~NFC_INT;
-			writew(tmp, &host->regs->config2);
+		tmp = readnfc(&host->regs->config2);
+		if (tmp & NFC_V1_V2_CONFIG2_INT) {
+			tmp &= ~NFC_V1_V2_CONFIG2_INT;
+			writenfc(tmp, &host->regs->config2);
 			break;
 		}
 		udelay(1);
@@ -149,8 +149,8 @@ static void send_cmd(struct mxc_nand_host *host, uint16_t cmd)
 {
 	MTDDEBUG(MTD_DEBUG_LEVEL3, "send_cmd(host, 0x%x)\n", cmd);
 
-	writew(cmd, &host->regs->flash_cmd);
-	writew(NFC_CMD, &host->regs->config2);
+	writenfc(cmd, &host->regs->flash_cmd);
+	writenfc(NFC_CMD, &host->regs->operation);
 
 	/* Wait for operation to complete */
 	wait_op_done(host, TROP_US_DELAY, cmd);
@@ -165,8 +165,8 @@ static void send_addr(struct mxc_nand_host *host, uint16_t addr)
 {
 	MTDDEBUG(MTD_DEBUG_LEVEL3, "send_addr(host, 0x%x)\n", addr);
 
-	writew(addr, &host->regs->flash_addr);
-	writew(NFC_ADDR, &host->regs->config2);
+	writenfc(addr, &host->regs->flash_addr);
+	writenfc(NFC_ADDR, &host->regs->operation);
 
 	/* Wait for operation to complete */
 	wait_op_done(host, TROP_US_DELAY, addr);
@@ -198,19 +198,19 @@ static void send_prog_page(struct mxc_nand_host *host, uint8_t buf_id,
 		}
 	}
 
-	writew(buf_id, &host->regs->buf_addr);
+	writenfc(buf_id, &host->regs->buf_addr);
 
 	/* Configure spare or page+spare access */
 	if (!host->pagesize_2k) {
-		uint16_t config1 = readw(&host->regs->config1);
+		uint16_t config1 = readnfc(&host->regs->config1);
 		if (spare_only)
-			config1 |= NFC_SP_EN;
+			config1 |= NFC_CONFIG1_SP_EN;
 		else
-			config1 &= ~NFC_SP_EN;
-		writew(config1, &host->regs->config1);
+			config1 &= ~NFC_CONFIG1_SP_EN;
+		writenfc(config1, &host->regs->config1);
 	}
 
-	writew(NFC_INPUT, &host->regs->config2);
+	writenfc(NFC_INPUT, &host->regs->operation);
 
 	/* Wait for operation to complete */
 	wait_op_done(host, TROP_US_DELAY, spare_only);
@@ -225,19 +225,19 @@ static void send_read_page(struct mxc_nand_host *host, uint8_t buf_id,
 {
 	MTDDEBUG(MTD_DEBUG_LEVEL3, "send_read_page (%d)\n", spare_only);
 
-	writew(buf_id, &host->regs->buf_addr);
+	writenfc(buf_id, &host->regs->buf_addr);
 
 	/* Configure spare or page+spare access */
 	if (!host->pagesize_2k) {
-		uint32_t config1 = readw(&host->regs->config1);
+		uint32_t config1 = readnfc(&host->regs->config1);
 		if (spare_only)
-			config1 |= NFC_SP_EN;
+			config1 |= NFC_CONFIG1_SP_EN;
 		else
-			config1 &= ~NFC_SP_EN;
-		writew(config1, &host->regs->config1);
+			config1 &= ~NFC_CONFIG1_SP_EN;
+		writenfc(config1, &host->regs->config1);
 	}
 
-	writew(NFC_OUTPUT, &host->regs->config2);
+	writenfc(NFC_OUTPUT, &host->regs->operation);
 
 	/* Wait for operation to complete */
 	wait_op_done(host, TROP_US_DELAY, spare_only);
@@ -265,14 +265,14 @@ static void send_read_id(struct mxc_nand_host *host)
 	uint16_t tmp;
 
 	/* NANDFC buffer 0 is used for device ID output */
-	writew(0x0, &host->regs->buf_addr);
+	writenfc(0x0, &host->regs->buf_addr);
 
 	/* Read ID into main buffer */
-	tmp = readw(&host->regs->config1);
-	tmp &= ~NFC_SP_EN;
-	writew(tmp, &host->regs->config1);
+	tmp = readnfc(&host->regs->config1);
+	tmp &= ~NFC_CONFIG1_SP_EN;
+	writenfc(tmp, &host->regs->config1);
 
-	writew(NFC_ID, &host->regs->config2);
+	writenfc(NFC_ID, &host->regs->operation);
 
 	/* Wait for operation to complete */
 	wait_op_done(host, TROP_US_DELAY, 0);
@@ -292,14 +292,14 @@ static uint16_t get_dev_status(struct mxc_nand_host *host)
 	/* store the main area1 first word, later do recovery */
 	store = readl(main_buf);
 	/* NANDFC buffer 1 is used for device status */
-	writew(1, &host->regs->buf_addr);
+	writenfc(1, &host->regs->buf_addr);
 
 	/* Read status into main buffer */
-	tmp = readw(&host->regs->config1);
-	tmp &= ~NFC_SP_EN;
-	writew(tmp, &host->regs->config1);
+	tmp = readnfc(&host->regs->config1);
+	tmp &= ~NFC_CONFIG1_SP_EN;
+	writenfc(tmp, &host->regs->config1);
 
-	writew(NFC_STATUS, &host->regs->config2);
+	writenfc(NFC_STATUS, &host->regs->operation);
 
 	/* Wait for operation to complete */
 	wait_op_done(host, TROP_US_DELAY, 0);
@@ -328,13 +328,13 @@ static void _mxc_nand_enable_hwecc(struct mtd_info *mtd, int on)
 {
 	struct nand_chip *nand_chip = mtd->priv;
 	struct mxc_nand_host *host = nand_chip->priv;
-	uint16_t tmp = readw(&host->regs->config1);
+	uint16_t tmp = readnfc(&host->regs->config1);
 
 	if (on)
-		tmp |= NFC_ECC_EN;
+		tmp |= NFC_V1_V2_CONFIG1_ECC_EN;
 	else
-		tmp &= ~NFC_ECC_EN;
-	writew(tmp, &host->regs->config1);
+		tmp &= ~NFC_V1_V2_CONFIG1_ECC_EN;
+	writenfc(tmp, &host->regs->config1);
 }
 
 #ifdef CONFIG_MXC_NAND_HWECC
@@ -667,7 +667,7 @@ static int mxc_nand_correct_data(struct mtd_info *mtd, u_char *dat,
 	 * additional correction.  2-Bit errors cannot be corrected by
 	 * HW ECC, so we need to return failure
 	 */
-	uint16_t ecc_status = readw(&host->regs->ecc_status_result);
+	uint16_t ecc_status = readnfc(&host->regs->ecc_status_result);
 
 	if (((ecc_status & 0x3) == 2) || ((ecc_status >> 2) == 2)) {
 		MTDDEBUG(MTD_DEBUG_LEVEL0,
@@ -1210,24 +1210,24 @@ int board_nand_init(struct nand_chip *this)
 #endif
 
 #ifdef MXC_NFC_V2_1
-	tmp = readw(&host->regs->config1);
-	tmp |= NFC_ONE_CYCLE;
-	tmp |= NFC_4_8N_ECC;
-	writew(tmp, &host->regs->config1);
+	tmp = readnfc(&host->regs->config1);
+	tmp |= NFC_V2_CONFIG1_ONE_CYCLE;
+	tmp |= NFC_V2_CONFIG1_ECC_MODE_4;
+	writenfc(tmp, &host->regs->config1);
 	if (host->pagesize_2k)
-		writew(64/2, &host->regs->spare_area_size);
+		writenfc(64/2, &host->regs->spare_area_size);
 	else
-		writew(16/2, &host->regs->spare_area_size);
+		writenfc(16/2, &host->regs->spare_area_size);
 #endif
 
 	/*
 	 * preset operation
 	 * Unlock the internal RAM Buffer
 	 */
-	writew(0x2, &host->regs->config);
+	writenfc(0x2, &host->regs->config);
 
 	/* Blocks to be unlocked */
-	writew(0x0, &host->regs->unlockstart_blkaddr);
+	writenfc(0x0, &host->regs->unlockstart_blkaddr);
 	/* Originally (Freescale LTIB 2.6.21) 0x4000 was written to the
 	 * unlockend_blkaddr, but the magic 0x4000 does not always work
 	 * when writing more than some 32 megabytes (on 2k page nands)
@@ -1239,10 +1239,10 @@ int board_nand_init(struct nand_chip *this)
 	 * This might be NAND chip specific and the i.MX31 datasheet is
 	 * extremely vague about the semantics of this register.
 	 */
-	writew(0xFFFF, &host->regs->unlockend_blkaddr);
+	writenfc(0xFFFF, &host->regs->unlockend_blkaddr);
 
 	/* Unlock Block Command for given address range */
-	writew(0x4, &host->regs->wrprot);
+	writenfc(0x4, &host->regs->wrprot);
 
 	return 0;
 }
include/fsl_nfc.h +26 -46

84 lines not on this page · raw message

nand_spl/nand_boot_fsl_nfc.c +25 -22

104 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#5 lore raw

PATCH v8 4/31 nand: mxc: Add support for i.MX5

In reply to Benoît Thébaudeau

---
Changes in v8:
- Rebase on Fabio's patches using CONFIG_SYS_NAND_BUSWIDTH_16BIT instead of NAND Flash boot config pins to determine NAND Flash bus width.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3:
- Separate code reformatting from behavioral changes.

Changes in v2: None

 arch/arm/include/asm/arch-mx5/imx-regs.h |    9 +++
 drivers/mtd/nand/mxc_nand.c              |  119 +++++++++++++++++++++++++++---
 include/fsl_nfc.h                        |   79 +++++++++++++++++++-
 nand_spl/nand_boot_fsl_nfc.c             |   67 ++++++++++++++++-
 4 files changed, 259 insertions(+), 15 deletions(-)
arch/arm/include/asm/arch-mx5/imx-regs.h +9 -0
index 249d15a..9aa0c6a 100644
@@ -224,6 +224,15 @@
 #define CS0_32M_CS1_32M_CS2_32M_CS3_32M		3
 
 /*
+ * SRC register definitions
+ */
+#if defined(CONFIG_MX51)
+#define SRC_SBMR_NF16B		(1 << 2)
+#elif defined(CONFIG_MX53)
+#define SRC_SBMR_NF16B		(1 << 13)
+#endif
+
+/*
  * CSPI register definitions
  */
 #define MXC_ECSPI
drivers/mtd/nand/mxc_nand.c +108 -11

259 lines not on this page · raw message

include/fsl_nfc.h +77 -2

133 lines not on this page · raw message

nand_spl/nand_boot_fsl_nfc.c +65 -2

109 lines not on this page · raw message

Signature · 1 line
1.7.10.4
reviewer
#6 lore raw

PATCH v8 4/31 nand: mxc: Add support for i.MX5

Hi Beno?t,

arch/arm/include/asm/arch-mx5/imx-regs.h line 233

Quoted 5 lines · Beno?t Th?baudeau
arch/arm/include/asm/arch-mx5/imx-regs.h +5 -0
+#if defined(CONFIG_MX51)
+#define SRC_SBMR_NF16B         (1 << 2)
+#elif defined(CONFIG_MX53)
+#define SRC_SBMR_NF16B         (1 << 13)
+#endif

These definitions are not used anymore and could be removed, right?

#7 lore raw

PATCH v8 4/31 nand: mxc: Add support for i.MX5

Hi Fabio,

Quoted 5 lines · Fabio Estevam

Hi Beno?t,

On Fri, Mar 1, 2013 at 9:10 AM, Beno?t Th?baudeau
<[email protected]> wrote:

Quoted 7 lines

arch/arm/include/asm/arch-mx5/imx-regs.h line 233

Quoted 5 lines
arch/arm/include/asm/arch-mx5/imx-regs.h +5 -0
+#if defined(CONFIG_MX51)
+#define SRC_SBMR_NF16B         (1 << 2)
+#elif defined(CONFIG_MX53)
+#define SRC_SBMR_NF16B         (1 << 13)
+#endif

These definitions are not used anymore and could be removed, right?

Correct. I'll do that in v9.

Best regards,
Beno?t

#8 lore raw

PATCH v8 5/31 imx: mx5: lowlevel_init: Simplify code

In reply to Benoît Thébaudeau

Don't use several instructions to build constant values.

---
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3:
- New patch.

Changes in v2: None

 arch/arm/cpu/armv7/mx5/lowlevel_init.S |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
arch/arm/cpu/armv7/mx5/lowlevel_init.S +2 -6
index 6d9396a..dfce0ca 100644
@@ -309,8 +309,7 @@ setup_pll_func:
         ldr r0, =CCM_BASE_ADDR
         ldr r1, =0x00015154
         str r1, [r0, #CLKCTL_CBCMR]
-        ldr r1, =0x02888945
-        orr r1, r1, #(1 << 16)
+        ldr r1, =0x02898945
         str r1, [r0, #CLKCTL_CBCDR]
         /* make sure change is effective */
 1:      ldr r1, [r0, #CLKCTL_CDHIPR]
@@ -321,10 +320,7 @@ setup_pll_func:
 
 	/* Switch peripheral to PLL2 */
 	ldr r0, =CCM_BASE_ADDR
-	ldr r1, =0x00808145
-	orr r1, r1, #(2 << 10)
-	orr r1, r1, #(0 << 16)
-	orr r1, r1, #(1 << 19)
+	ldr r1, =0x00888945
 	str r1, [r0, #CLKCTL_CBCDR]
 
 	ldr r1, =0x00016154
Signature · 1 line
1.7.10.4
#9 lore raw

PATCH v8 6/31 imx: mx53ard: Add support for NAND Flash

In reply to Benoît Thébaudeau

Add support for the Samsung K9LAG08U0M NAND Flash (2-GiB MLC NAND Flash, 2-kiB pages, 256-kiB blocks, 30-ns R/W cycles, 1 CS) on mx53ard.

eNFC_CLK_ROOT is set up with a cycle time of 37.5 ns (400 MHz / 3 / 5) for this board, which satisfies the 30-ns NF R/W cycle requirement.

---
Changes in v8:
- Fix NFC pad setup using Freescale's.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3:
- New patch.

Changes in v2: None

 board/freescale/mx53ard/mx53ard.c |   66 +++++++++++++++++++++++++++++++++++++
 include/configs/mx53ard.h         |   10 ++++++
 2 files changed, 76 insertions(+)
board/freescale/mx53ard/mx53ard.c +66 -0
index 2fc8570..8d433a3 100644
@@ -58,6 +58,71 @@ void dram_init_banksize(void)
 	gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
 }
 
+#ifdef CONFIG_NAND_MXC
+static void setup_iomux_nand(void)
+{
+	u32 i, reg;
+	#define M4IF_GENP_WEIM_MM_MASK		0x00000001
+	#define WEIM_GCR2_MUX16_BYP_GRANT_MASK	0x00001000
+
+	reg = __raw_readl(M4IF_BASE_ADDR + 0xc);
+	reg &= ~M4IF_GENP_WEIM_MM_MASK;
+	__raw_writel(reg, M4IF_BASE_ADDR + 0xc);
+	for (i = 0x4; i < 0x94; i += 0x18) {
+		reg = __raw_readl(WEIM_BASE_ADDR + i);
+		reg &= ~WEIM_GCR2_MUX16_BYP_GRANT_MASK;
+		__raw_writel(reg, WEIM_BASE_ADDR + i);
+	}
+
+	mxc_request_iomux(MX53_PIN_NANDF_CS0, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX53_PIN_NANDF_CS0, PAD_CTL_DRV_HIGH);
+	mxc_request_iomux(MX53_PIN_NANDF_CS1, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX53_PIN_NANDF_CS1, PAD_CTL_DRV_HIGH);
+	mxc_request_iomux(MX53_PIN_NANDF_RB0, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX53_PIN_NANDF_RB0, PAD_CTL_PKE_ENABLE |
+					PAD_CTL_PUE_PULL | PAD_CTL_100K_PU);
+	mxc_request_iomux(MX53_PIN_NANDF_CLE, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX53_PIN_NANDF_CLE, PAD_CTL_DRV_HIGH);
+	mxc_request_iomux(MX53_PIN_NANDF_ALE, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX53_PIN_NANDF_ALE, PAD_CTL_DRV_HIGH);
+	mxc_request_iomux(MX53_PIN_NANDF_WP_B, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX53_PIN_NANDF_WP_B, PAD_CTL_PKE_ENABLE |
+					PAD_CTL_PUE_PULL | PAD_CTL_100K_PU);
+	mxc_request_iomux(MX53_PIN_NANDF_RE_B, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX53_PIN_NANDF_RE_B, PAD_CTL_DRV_HIGH);
+	mxc_request_iomux(MX53_PIN_NANDF_WE_B, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX53_PIN_NANDF_WE_B, PAD_CTL_DRV_HIGH);
+	mxc_request_iomux(MX53_PIN_EIM_DA0, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX53_PIN_EIM_DA0, PAD_CTL_PKE_ENABLE |
+					PAD_CTL_100K_PU | PAD_CTL_DRV_HIGH);
+	mxc_request_iomux(MX53_PIN_EIM_DA1, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX53_PIN_EIM_DA1, PAD_CTL_PKE_ENABLE |
+					PAD_CTL_100K_PU | PAD_CTL_DRV_HIGH);
+	mxc_request_iomux(MX53_PIN_EIM_DA2, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX53_PIN_EIM_DA2, PAD_CTL_PKE_ENABLE |
+					PAD_CTL_100K_PU | PAD_CTL_DRV_HIGH);
+	mxc_request_iomux(MX53_PIN_EIM_DA3, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX53_PIN_EIM_DA3, PAD_CTL_PKE_ENABLE |
+					PAD_CTL_100K_PU | PAD_CTL_DRV_HIGH);
+	mxc_request_iomux(MX53_PIN_EIM_DA4, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX53_PIN_EIM_DA4, PAD_CTL_PKE_ENABLE |
+					PAD_CTL_100K_PU | PAD_CTL_DRV_HIGH);
+	mxc_request_iomux(MX53_PIN_EIM_DA5, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX53_PIN_EIM_DA5, PAD_CTL_PKE_ENABLE |
+					PAD_CTL_100K_PU | PAD_CTL_DRV_HIGH);
+	mxc_request_iomux(MX53_PIN_EIM_DA6, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX53_PIN_EIM_DA6, PAD_CTL_PKE_ENABLE |
+					PAD_CTL_100K_PU | PAD_CTL_DRV_HIGH);
+	mxc_request_iomux(MX53_PIN_EIM_DA7, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX53_PIN_EIM_DA7, PAD_CTL_PKE_ENABLE |
+					PAD_CTL_100K_PU | PAD_CTL_DRV_HIGH);
+}
+#else
+static void setup_iomux_nand(void)
+{
+}
+#endif
+
 static void setup_iomux_uart(void)
 {
 	/* UART1 RXD */
@@ -277,6 +342,7 @@ static void weim_cs1_settings(void)
 
 int board_early_init_f(void)
 {
+	setup_iomux_nand();
 	setup_iomux_uart();
 	return 0;
 }
include/configs/mx53ard.h +10 -0
index 62cb42b..148f7a2 100644
@@ -41,6 +41,16 @@
 #define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_MXC_GPIO
 
+#define CONFIG_SYS_MAX_NAND_DEVICE	1
+#define CONFIG_SYS_NAND_BASE		NFC_BASE_ADDR_AXI
+#define CONFIG_NAND_MXC
+#define CONFIG_MXC_NAND_REGS_BASE	NFC_BASE_ADDR_AXI
+#define CONFIG_MXC_NAND_IP_REGS_BASE	NFC_BASE_ADDR
+#define CONFIG_SYS_NAND_LARGEPAGE
+#define CONFIG_MXC_NAND_HWECC
+#define CONFIG_SYS_NAND_USE_FLASH_BBT
+#define CONFIG_CMD_NAND
+
 #define CONFIG_MXC_UART
 #define CONFIG_MXC_UART_BASE	UART1_BASE
 
Signature · 1 line
1.7.10.4
#10 lore raw

PATCH v8 7/31 nand: mxc: Fix debug trace in mxc_nand_read_oob_syndrome()

In reply to Benoît Thébaudeau

The page number indicated in the debug trace of mxc_nand_read_oob_syndrome() did not match the page being worked on.

By the way, replace the GCC-specific __FUNCTION__ with __func__.

---
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5:
- Replace __FUNCTION__ with __func__.

Changes in v4:
- New patch.

Changes in v3: None
Changes in v2: None

 drivers/mtd/nand/mxc_nand.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/mxc_nand.c +1 -1
index db72cdc..62d6965 100644
@@ -409,7 +409,7 @@ static int mxc_nand_read_oob_syndrome(struct mtd_info *mtd,
 
 	MTDDEBUG(MTD_DEBUG_LEVEL0,
 			"%s: Reading OOB area of page %u to oob %p\n",
-			 __FUNCTION__, host->page_addr, buf);
+			 __func__, page, buf);
 
 	chip->cmdfunc(mtd, NAND_CMD_READOOB, mtd->writesize, page);
 	for (i = 0; i < chip->ecc.steps; i++) {
Signature · 1 line
1.7.10.4
#11 lore raw

PATCH v8 8/31 nand: mxc: Use appropriate page number in syndrome functions

In reply to Benoît Thébaudeau

The syndrome functions should use the page number passed as argument instead of the page number saved upon NAND_CMD_READ0.

This does not make any difference if the NAND_NO_AUTOINCR option is set, but otherwise this fixes accesses to the wrong pages.

---
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4:
- New patch.

Changes in v3: None
Changes in v2: None

 drivers/mtd/nand/mxc_nand.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/nand/mxc_nand.c +3 -3
index 62d6965..29ceab3 100644
@@ -463,7 +463,7 @@ static int mxc_nand_read_page_raw_syndrome(struct mtd_info *mtd,
 	int n;
 
 	_mxc_nand_enable_hwecc(mtd, 0);
-	chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, host->page_addr);
+	chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
 
 	for (n = 0, steps = chip->ecc.steps; steps > 0; n++, steps--) {
 		host->col_addr = n * eccsize;
@@ -507,7 +507,7 @@ static int mxc_nand_read_page_syndrome(struct mtd_info *mtd,
 	uint8_t *oob = chip->oob_poi;
 
 	MTDDEBUG(MTD_DEBUG_LEVEL1, "Reading page %u to buf %p oob %p\n",
-	      host->page_addr, buf, oob);
+	      page, buf, oob);
 
 	/* first read the data area and the available portion of OOB */
 	for (n = 0; eccsteps; n++, eccsteps--, p += eccsize) {
@@ -545,7 +545,7 @@ static int mxc_nand_read_page_syndrome(struct mtd_info *mtd,
 
 	/* Then switch ECC off and read the OOB area to get the ECC code */
 	_mxc_nand_enable_hwecc(mtd, 0);
-	chip->cmdfunc(mtd, NAND_CMD_READOOB, mtd->writesize, host->page_addr);
+	chip->cmdfunc(mtd, NAND_CMD_READOOB, mtd->writesize, page);
 	eccsteps = chip->ecc.steps;
 	oob = chip->oob_poi + chip->ecc.prepad;
 	for (n = 0; eccsteps; n++, eccsteps--, p += eccsize) {
Signature · 1 line
1.7.10.4
#12 lore raw

PATCH v8 9/31 arm: start.S: Fix _TEXT_BASE for SPL

In reply to Benoît Thébaudeau

_TEXT_BASE must be set to CONFIG_SPL_TEXT_BASE for generic SPL, and to CONFIG_SYS_TEXT_BASE for non-SPL builds.

---
Changes in v8:
- Apply to mxs SPL too.

Changes in v7: None
Changes in v6:
- New patch.

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/cpu/arm1136/start.S       |    4 ++++
 arch/arm/cpu/arm1176/start.S       |    8 ++++++++
 arch/arm/cpu/arm720t/start.S       |    2 +-
 arch/arm/cpu/arm920t/start.S       |    4 ++++
 arch/arm/cpu/arm925t/start.S       |    4 ++++
 arch/arm/cpu/arm926ejs/mxs/start.S |    4 ++++
 arch/arm/cpu/arm926ejs/start.S     |    2 +-
 arch/arm/cpu/arm946es/start.S      |    4 ++++
 arch/arm/cpu/arm_intcm/start.S     |    6 +++++-
 arch/arm/cpu/armv7/start.S         |    4 ++++
 arch/arm/cpu/ixp/start.S           |    4 ++++
 arch/arm/cpu/pxa/start.S           |    2 +-
 arch/arm/cpu/s3c44b0/start.S       |    4 ++++
 arch/arm/cpu/sa1100/start.S        |    4 ++++
 14 files changed, 52 insertions(+), 4 deletions(-)
arch/arm/cpu/arm1136/start.S +4 -0
index a067b8a..4053e86 100644
@@ -88,7 +88,11 @@ _end_vect:
 
 .globl _TEXT_BASE
 _TEXT_BASE:
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
+	.word	CONFIG_SPL_TEXT_BASE
+#else
 	.word	CONFIG_SYS_TEXT_BASE
+#endif
 
 /*
  * These are defined in the board-specific linker script.
arch/arm/cpu/arm1176/start.S +8 -0
index 40df4b1..d11386a 100644
@@ -98,7 +98,15 @@ _end_vect:
 
 .globl _TEXT_BASE
 _TEXT_BASE:
+#ifdef CONFIG_NAND_SPL /* deprecated, use instead CONFIG_SPL_BUILD */
 	.word	CONFIG_SYS_TEXT_BASE
+#else
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
+	.word	CONFIG_SPL_TEXT_BASE
+#else
+	.word	CONFIG_SYS_TEXT_BASE
+#endif
+#endif
 
 /*
  * Below variable is very important because we use MMU in U-Boot.
arch/arm/cpu/arm720t/start.S +1 -1
index 771d386..83722aa 100644
@@ -85,7 +85,7 @@ _pad:			.word 0x12345678 /* now 16*4=64 */
 
 .globl _TEXT_BASE
 _TEXT_BASE:
-#ifdef CONFIG_SPL_BUILD
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
 	.word	CONFIG_SPL_TEXT_BASE
 #else
 	.word	CONFIG_SYS_TEXT_BASE
arch/arm/cpu/arm920t/start.S +4 -0
index 511d21d..f4f14e1 100644
@@ -73,7 +73,11 @@ _fiq:			.word fiq
 
 .globl _TEXT_BASE
 _TEXT_BASE:
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
+	.word	CONFIG_SPL_TEXT_BASE
+#else
 	.word	CONFIG_SYS_TEXT_BASE
+#endif
 
 /*
  * These are defined in the board-specific linker script.
arch/arm/cpu/arm925t/start.S +4 -0
index e8d6d71..95a0de7 100644
@@ -79,7 +79,11 @@ _fiq:			.word fiq
 
 .globl _TEXT_BASE
 _TEXT_BASE:
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
+	.word	CONFIG_SPL_TEXT_BASE
+#else
 	.word	CONFIG_SYS_TEXT_BASE
+#endif
 
 /*
  * These are defined in the board-specific linker script.
arch/arm/cpu/arm926ejs/mxs/start.S +4 -0
index 7ccd337..94da398 100644
@@ -119,7 +119,11 @@ fiq:
 
 .globl _TEXT_BASE
 _TEXT_BASE:
+#ifdef CONFIG_SPL_TEXT_BASE
+	.word	CONFIG_SPL_TEXT_BASE
+#else
 	.word	CONFIG_SYS_TEXT_BASE
+#endif
 
 /*
  * These are defined in the board-specific linker script.
arch/arm/cpu/arm926ejs/start.S +1 -1
index 66a8b65..39f9a2e 100644
@@ -123,7 +123,7 @@ _TEXT_BASE:
 #ifdef CONFIG_NAND_SPL /* deprecated, use instead CONFIG_SPL_BUILD */
 	.word	CONFIG_SYS_TEXT_BASE
 #else
-#ifdef CONFIG_SPL_BUILD
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
 	.word	CONFIG_SPL_TEXT_BASE
 #else
 	.word	CONFIG_SYS_TEXT_BASE
arch/arm/cpu/arm946es/start.S +4 -0
index a7a98a4..0d57294 100644
@@ -89,7 +89,11 @@ _vectors_end:
 
 .globl _TEXT_BASE
 _TEXT_BASE:
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
+	.word	CONFIG_SPL_TEXT_BASE
+#else
 	.word	CONFIG_SYS_TEXT_BASE
+#endif
 
 /*
  * These are defined in the board-specific linker script.
arch/arm/cpu/arm_intcm/start.S +5 -1
index c189849..f5e5381 100644
@@ -85,7 +85,11 @@ _fiq:
 
 .globl _TEXT_BASE
 _TEXT_BASE:
-	.word	CONFIG_SYS_TEXT_BASE /* address of _start in the linked image */
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
+	.word	CONFIG_SPL_TEXT_BASE
+#else
+	.word	CONFIG_SYS_TEXT_BASE
+#endif
 
 /*
  * These are defined in the board-specific linker script.
arch/arm/cpu/armv7/start.S +4 -0
index 6b59529d..9bb42ae 100644
@@ -81,7 +81,11 @@ _end_vect:
 
 .globl _TEXT_BASE
 _TEXT_BASE:
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
+	.word	CONFIG_SPL_TEXT_BASE
+#else
 	.word	CONFIG_SYS_TEXT_BASE
+#endif
 
 /*
  * These are defined in the board-specific linker script.
arch/arm/cpu/ixp/start.S +4 -0
index efb5a40..11e3efa 100644
@@ -98,7 +98,11 @@ _fiq:			.word fiq
 
 .globl _TEXT_BASE
 _TEXT_BASE:
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
+	.word	CONFIG_SPL_TEXT_BASE
+#else
 	.word	CONFIG_SYS_TEXT_BASE
+#endif
 
 /*
  * These are defined in the board-specific linker script.
arch/arm/cpu/pxa/start.S +1 -1
index e71803e..a276ee0 100644
@@ -102,7 +102,7 @@ _end_vect:
 
 .globl _TEXT_BASE
 _TEXT_BASE:
-#ifdef	CONFIG_SPL_BUILD
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
 	.word	CONFIG_SPL_TEXT_BASE
 #else
 	.word	CONFIG_SYS_TEXT_BASE
arch/arm/cpu/s3c44b0/start.S +4 -0
index 4528c91..974ca1b 100644
@@ -64,7 +64,11 @@ _start:	b       reset
 
 .globl _TEXT_BASE
 _TEXT_BASE:
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
+	.word	CONFIG_SPL_TEXT_BASE
+#else
 	.word	CONFIG_SYS_TEXT_BASE
+#endif
 
 /*
  * These are defined in the board-specific linker script.
arch/arm/cpu/sa1100/start.S +4 -0
index 3144299..88769e3 100644
@@ -74,7 +74,11 @@ _fiq:			.word fiq
 
 .globl _TEXT_BASE
 _TEXT_BASE:
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
+	.word	CONFIG_SPL_TEXT_BASE
+#else
 	.word	CONFIG_SYS_TEXT_BASE
+#endif
 
 /*
  * These are defined in the board-specific linker script.
Signature · 1 line
1.7.10.4
#13 lore raw

PATCH v8 9/31 arm: start.S: Fix _TEXT_BASE for SPL

Quoted 4 lines · Beno??t Th??baudeau

_TEXT_BASE must be set to CONFIG_SPL_TEXT_BASE for generic SPL, and to CONFIG_SYS_TEXT_BASE for non-SPL builds.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130301/728d035b/attachment.pgp>
#14 lore raw

PATCH v8 10/31 arm: relocate_code() is no longer noreturn

In reply to Benoît Thébaudeau

Commit e05e5de7fae5bec79617e113916dac6631251156 made ARM's relocate_code() return to its caller, but it did not update its declaration accordingly.

Fixing this function declaration fixes dropped C code following calls to relocate_code().

---
Changes in v8:
- Update relocate_code() description in ARM start.S comments.

Changes in v7: None
Changes in v6:
- New patch, extracted from "nand: mxc: Switch NAND SPL to generic SPL".

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/cpu/arm1136/start.S   |    4 +---
 arch/arm/cpu/arm1176/start.S   |    4 +---
 arch/arm/cpu/arm720t/start.S   |    4 +---
 arch/arm/cpu/arm920t/start.S   |    4 +---
 arch/arm/cpu/arm925t/start.S   |    4 +---
 arch/arm/cpu/arm926ejs/start.S |    4 +---
 arch/arm/cpu/arm946es/start.S  |    4 +---
 arch/arm/cpu/arm_intcm/start.S |    4 +---
 arch/arm/cpu/armv7/start.S     |    4 +---
 arch/arm/cpu/ixp/start.S       |    4 +---
 arch/arm/cpu/pxa/start.S       |    4 +---
 arch/arm/cpu/s3c44b0/start.S   |    4 +---
 arch/arm/cpu/sa1100/start.S    |    4 +---
 include/common.h               |    6 +++++-
 14 files changed, 18 insertions(+), 40 deletions(-)
arch/arm/cpu/arm1136/start.S +1 -3
index 4053e86..f1cb1d5 100644
@@ -176,9 +176,7 @@ next:
 /*
  * void relocate_code (addr_sp, gd, addr_moni)
  *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
+ * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
arch/arm/cpu/arm1176/start.S +1 -3
index d11386a..fe947cc 100644
@@ -239,9 +239,7 @@ skip_tcmdisable:
 /*
  * void relocate_code (addr_sp, gd, addr_moni)
  *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
+ * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
arch/arm/cpu/arm720t/start.S +1 -3
index 83722aa..a3d06ce 100644
@@ -154,9 +154,7 @@ reset:
 /*
  * void relocate_code (addr_sp, gd, addr_moni)
  *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
+ * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
arch/arm/cpu/arm920t/start.S +1 -3
index f4f14e1..e11460c 100644
@@ -193,9 +193,7 @@ copyex:
 /*
  * void relocate_code (addr_sp, gd, addr_moni)
  *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
+ * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
arch/arm/cpu/arm925t/start.S +1 -3
index 95a0de7..4030d49 100644
@@ -183,9 +183,7 @@ poll1:
 /*
  * void relocate_code (addr_sp, gd, addr_moni)
  *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
+ * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
arch/arm/cpu/arm926ejs/start.S +1 -3
index 39f9a2e..5600599 100644
@@ -200,9 +200,7 @@ reset:
 /*
  * void relocate_code (addr_sp, gd, addr_moni)
  *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
+ * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
arch/arm/cpu/arm946es/start.S +1 -3
index 0d57294..79ba8e3 100644
@@ -158,9 +158,7 @@ reset:
 /*
  * void relocate_code (addr_sp, gd, addr_moni)
  *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
+ * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
arch/arm/cpu/arm_intcm/start.S +1 -3
index f5e5381..039677e 100644
@@ -154,9 +154,7 @@ reset:
 /*
  * void relocate_code (addr_sp, gd, addr_moni)
  *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
+ * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
arch/arm/cpu/armv7/start.S +1 -3
index 9bb42ae..18dad12 100644
@@ -167,9 +167,7 @@ reset:
 /*
  * void relocate_code (addr_sp, gd, addr_moni)
  *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
+ * This function relocates the monitor code.
  */
 ENTRY(relocate_code)
 	mov	r4, r0	/* save addr_sp */
arch/arm/cpu/ixp/start.S +1 -3
index 11e3efa..83823a6 100644
@@ -256,9 +256,7 @@ reset:
 /*
  * void relocate_code (addr_sp, gd, addr_moni)
  *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
+ * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
arch/arm/cpu/pxa/start.S +1 -3
index a276ee0..6325e5f 100644
@@ -171,9 +171,7 @@ reset:
 /*
  * void relocate_code (addr_sp, gd, addr_moni)
  *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
+ * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
arch/arm/cpu/s3c44b0/start.S +1 -3
index 974ca1b..0224898 100644
@@ -139,9 +139,7 @@ reset:
 /*
  * void relocate_code (addr_sp, gd, addr_moni)
  *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
+ * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
arch/arm/cpu/sa1100/start.S +1 -3
index 88769e3..dc79556 100644
@@ -143,9 +143,7 @@ reset:
 /*
  * void relocate_code (addr_sp, gd, addr_moni)
  *
- * This "function" does not return, instead it continues in RAM
- * after relocating the monitor code.
- *
+ * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
include/common.h +5 -1
index 4ad17ea..691e279 100644
@@ -515,7 +515,11 @@ int	dcache_status (void);
 void	dcache_enable (void);
 void	dcache_disable(void);
 void	mmu_disable(void);
-void	relocate_code (ulong, gd_t *, ulong) __attribute__ ((noreturn));
+void	relocate_code(ulong, gd_t *, ulong)
+#if !defined(CONFIG_ARM)
+__attribute__ ((noreturn))
+#endif
+;
 ulong	get_endaddr   (void);
 void	trap_init     (ulong);
 #if defined (CONFIG_4xx)	|| \
Signature · 1 line
1.7.10.4
#15 lore raw

PATCH v8 11/31 arm1136: Remove redundant relocate_code() return

In reply to Benoît Thébaudeau

---
Changes in v8: None
Changes in v7: None
Changes in v6:
- New patch, extracted from "nand: mxc: Switch NAND SPL to generic SPL".

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/cpu/arm1136/start.S |    2 --
 1 file changed, 2 deletions(-)
arch/arm/cpu/arm1136/start.S +0 -2
index f1cb1d5..889fd53 100644
@@ -237,8 +237,6 @@ fixnext:
 	add	r2, r2, #8		/* each rel.dyn entry is 8 bytes */
 	cmp	r2, r3
 	blo	fixloop
-	bx	lr
-
 #endif
 
 relocate_done:
Signature · 1 line
1.7.10.4
#16 lore raw

PATCH v8 12/31 arm: relocate_code(): Remove useless relocation offset computation

In reply to Benoît Thébaudeau

---
Changes in v8:
- Make sure that r9 is initialized in all cases because it may be used after relocate_code().

Changes in v7: None
Changes in v6:
- New patch.

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/cpu/arm1136/start.S   |    8 +++-----
 arch/arm/cpu/arm1176/start.S   |    8 +++-----
 arch/arm/cpu/arm720t/start.S   |    8 +++-----
 arch/arm/cpu/arm920t/start.S   |    8 +++-----
 arch/arm/cpu/arm925t/start.S   |    8 +++-----
 arch/arm/cpu/arm926ejs/start.S |    9 +++------
 arch/arm/cpu/arm946es/start.S  |    8 +++-----
 arch/arm/cpu/arm_intcm/start.S |    8 +++-----
 arch/arm/cpu/armv7/start.S     |    8 +++-----
 arch/arm/cpu/ixp/start.S       |    8 +++-----
 arch/arm/cpu/pxa/start.S       |    8 +++-----
 arch/arm/cpu/s3c44b0/start.S   |    8 +++-----
 arch/arm/cpu/sa1100/start.S    |    8 +++-----
 13 files changed, 39 insertions(+), 66 deletions(-)
arch/arm/cpu/arm1136/start.S +3 -5
index 889fd53..131fd99 100644
@@ -185,16 +185,15 @@ relocate_code:
 	mov	r6, r2	/* save addr of destination */
 
 	adr	r0, _start
-	cmp	r0, r6
-	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
+	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _image_copy_end_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
-	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
-	stmia	r1!, {r9-r10}		/* copy to   target address [r1]    */
+	ldmia	r0!, {r10-r11}		/* copy from source address [r0]    */
+	stmia	r1!, {r10-r11}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end address [r2]    */
 	blo	copy_loop
 
@@ -203,7 +202,6 @@ copy_loop:
 	 * fix .rel.dyn relocations
 	 */
 	ldr	r0, _TEXT_BASE		/* r0 <- Text base */
-	sub	r9, r6, r0		/* r9 <- relocation offset */
 	ldr	r10, _dynsym_start_ofs	/* r10 <- sym table ofs */
 	add	r10, r10, r0		/* r10 <- sym table in FLASH */
 	ldr	r2, _rel_dyn_start_ofs	/* r2 <- rel dyn start ofs */
arch/arm/cpu/arm1176/start.S +3 -5
index fe947cc..7be4e43 100644
@@ -248,16 +248,15 @@ relocate_code:
 	mov	r6, r2	/* save addr of destination */
 
 	adr	r0, _start
-	cmp	r0, r6
-	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
+	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
-	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
-	stmia	r1!, {r9-r10}		/* copy to   target address [r1]    */
+	ldmia	r0!, {r10-r11}		/* copy from source address [r0]    */
+	stmia	r1!, {r10-r11}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end address [r2]    */
 	blo	copy_loop
 
@@ -266,7 +265,6 @@ copy_loop:
 	 * fix .rel.dyn relocations
 	 */
 	ldr	r0, _TEXT_BASE		/* r0 <- Text base */
-	sub	r9, r6, r0		/* r9 <- relocation offset */
 	ldr	r10, _dynsym_start_ofs	/* r10 <- sym table ofs */
 	add	r10, r10, r0		/* r10 <- sym table in FLASH */
 	ldr	r2, _rel_dyn_start_ofs	/* r2 <- rel dyn start ofs */
arch/arm/cpu/arm720t/start.S +3 -5
index a3d06ce..74c0664 100644
@@ -163,16 +163,15 @@ relocate_code:
 	mov	r6, r2	/* save addr of destination */
 
 	adr	r0, _start
-	cmp	r0, r6
-	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
+	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
-	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
-	stmia	r1!, {r9-r10}		/* copy to   target address [r1]    */
+	ldmia	r0!, {r10-r11}		/* copy from source address [r0]    */
+	stmia	r1!, {r10-r11}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end address [r2]    */
 	blo	copy_loop
 
@@ -181,7 +180,6 @@ copy_loop:
 	 * fix .rel.dyn relocations
 	 */
 	ldr	r0, _TEXT_BASE		/* r0 <- Text base */
-	sub	r9, r6, r0		/* r9 <- relocation offset */
 	ldr	r10, _dynsym_start_ofs	/* r10 <- sym table ofs */
 	add	r10, r10, r0		/* r10 <- sym table in FLASH */
 	ldr	r2, _rel_dyn_start_ofs	/* r2 <- rel dyn start ofs */
arch/arm/cpu/arm920t/start.S +3 -5
index e11460c..ba4dd85 100644
@@ -202,16 +202,15 @@ relocate_code:
 	mov	r6, r2	/* save addr of destination */
 
 	adr	r0, _start
-	cmp	r0, r6
-	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
+	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
-	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
-	stmia	r1!, {r9-r10}		/* copy to   target address [r1]    */
+	ldmia	r0!, {r10-r11}		/* copy from source address [r0]    */
+	stmia	r1!, {r10-r11}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end address [r2]    */
 	blo	copy_loop
 
@@ -220,7 +219,6 @@ copy_loop:
 	 * fix .rel.dyn relocations
 	 */
 	ldr	r0, _TEXT_BASE		/* r0 <- Text base */
-	sub	r9, r6, r0		/* r9 <- relocation offset */
 	ldr	r10, _dynsym_start_ofs	/* r10 <- sym table ofs */
 	add	r10, r10, r0		/* r10 <- sym table in FLASH */
 	ldr	r2, _rel_dyn_start_ofs	/* r2 <- rel dyn start ofs */
arch/arm/cpu/arm925t/start.S +3 -5
index 4030d49..e3b84ef 100644
@@ -192,16 +192,15 @@ relocate_code:
 	mov	r6, r2	/* save addr of destination */
 
 	adr	r0, _start
-	cmp	r0, r6
-	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
+	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
-	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
-	stmia	r1!, {r9-r10}		/* copy to   target address [r1]    */
+	ldmia	r0!, {r10-r11}		/* copy from source address [r0]    */
+	stmia	r1!, {r10-r11}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end address [r2]    */
 	blo	copy_loop
 
@@ -210,7 +209,6 @@ copy_loop:
 	 * fix .rel.dyn relocations
 	 */
 	ldr	r0, _TEXT_BASE		/* r0 <- Text base */
-	sub	r9, r6, r0		/* r9 <- relocation offset */
 	ldr	r10, _dynsym_start_ofs	/* r10 <- sym table ofs */
 	add	r10, r10, r0		/* r10 <- sym table in FLASH */
 	ldr	r2, _rel_dyn_start_ofs	/* r2 <- rel dyn start ofs */
arch/arm/cpu/arm926ejs/start.S +3 -6
index 5600599..25111f6 100644
@@ -209,17 +209,15 @@ relocate_code:
 	mov	r6, r2	/* save addr of destination */
 
 	adr	r0, _start
-	sub	r9, r6, r0		/* r9 <- relocation offset */
-	cmp	r0, r6
-	moveq	r9, #0			/* no relocation. offset(r9) = 0 */
+	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy loop */
 	ldr	r3, _bss_start_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
-	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
-	stmia	r1!, {r9-r10}		/* copy to   target address [r1]    */
+	ldmia	r0!, {r10-r11}		/* copy from source address [r0]    */
+	stmia	r1!, {r10-r11}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end address [r2]    */
 	blo	copy_loop
 
@@ -228,7 +226,6 @@ copy_loop:
 	 * fix .rel.dyn relocations
 	 */
 	ldr	r0, _TEXT_BASE		/* r0 <- Text base */
-	sub	r9, r6, r0		/* r9 <- relocation offset */
 	ldr	r10, _dynsym_start_ofs	/* r10 <- sym table ofs */
 	add	r10, r10, r0		/* r10 <- sym table in FLASH */
 	ldr	r2, _rel_dyn_start_ofs	/* r2 <- rel dyn start ofs */
arch/arm/cpu/arm946es/start.S +3 -5
index 79ba8e3..24b8b1d 100644
@@ -167,16 +167,15 @@ relocate_code:
 	mov	r6, r2	/* save addr of destination */
 
 	adr	r0, _start
-	cmp	r0, r6
-	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
+	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
-	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
-	stmia	r1!, {r9-r10}		/* copy to   target address [r1]    */
+	ldmia	r0!, {r10-r11}		/* copy from source address [r0]    */
+	stmia	r1!, {r10-r11}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end address [r2]    */
 	blo	copy_loop
 
@@ -185,7 +184,6 @@ copy_loop:
 	 * fix .rel.dyn relocations
 	 */
 	ldr	r0, _TEXT_BASE		/* r0 <- Text base */
-	sub	r9, r6, r0		/* r9 <- relocation offset */
 	ldr	r10, _dynsym_start_ofs	/* r10 <- sym table ofs */
 	add	r10, r10, r0		/* r10 <- sym table in FLASH */
 	ldr	r2, _rel_dyn_start_ofs	/* r2 <- rel dyn start ofs */
arch/arm/cpu/arm_intcm/start.S +3 -5
index 039677e..f6934f0 100644
@@ -163,16 +163,15 @@ relocate_code:
 	mov	r6, r2	/* save addr of destination */
 
 	adr	r0, _start
-	cmp	r0, r6
-	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
+	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
-	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
-	stmia	r1!, {r9-r10}		/* copy to   target address [r1]    */
+	ldmia	r0!, {r10-r11}		/* copy from source address [r0]    */
+	stmia	r1!, {r10-r11}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end address [r2]    */
 	blo	copy_loop
 
@@ -181,7 +180,6 @@ copy_loop:
 	 * fix .rel.dyn relocations
 	 */
 	ldr	r0, _TEXT_BASE		/* r0 <- Text base */
-	sub	r9, r6, r0		/* r9 <- relocation offset */
 	ldr	r10, _dynsym_start_ofs	/* r10 <- sym table ofs */
 	add	r10, r10, r0		/* r10 <- sym table in FLASH */
 	ldr	r2, _rel_dyn_start_ofs	/* r2 <- rel dyn start ofs */
arch/arm/cpu/armv7/start.S +3 -5
index 18dad12..0975896 100644
@@ -175,16 +175,15 @@ ENTRY(relocate_code)
 	mov	r6, r2	/* save addr of destination */
 
 	adr	r0, _start
-	cmp	r0, r6
-	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
+	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _image_copy_end_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
-	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
-	stmia	r1!, {r9-r10}		/* copy to   target address [r1]    */
+	ldmia	r0!, {r10-r11}		/* copy from source address [r0]    */
+	stmia	r1!, {r10-r11}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end address [r2]    */
 	blo	copy_loop
 
@@ -192,7 +191,6 @@ copy_loop:
 	 * fix .rel.dyn relocations
 	 */
 	ldr	r0, _TEXT_BASE		/* r0 <- Text base */
-	sub	r9, r6, r0		/* r9 <- relocation offset */
 	ldr	r10, _dynsym_start_ofs	/* r10 <- sym table ofs */
 	add	r10, r10, r0		/* r10 <- sym table in FLASH */
 	ldr	r2, _rel_dyn_start_ofs	/* r2 <- rel dyn start ofs */
arch/arm/cpu/ixp/start.S +3 -5
index 83823a6..397c660 100644
@@ -265,16 +265,15 @@ relocate_code:
 	mov	r6, r2	/* save addr of destination */
 
 	adr	r0, _start
-	cmp	r0, r6
-	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
+	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
-	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
-	stmia	r1!, {r9-r10}		/* copy to   target address [r1]    */
+	ldmia	r0!, {r10-r11}		/* copy from source address [r0]    */
+	stmia	r1!, {r10-r11}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end address [r2]    */
 	blo	copy_loop
 
@@ -283,7 +282,6 @@ copy_loop:
 	 * fix .rel.dyn relocations
 	 */
 	ldr	r0, _TEXT_BASE		/* r0 <- Text base */
-	sub	r9, r6, r0		/* r9 <- relocation offset */
 	ldr	r10, _dynsym_start_ofs	/* r10 <- sym table ofs */
 	add	r10, r10, r0		/* r10 <- sym table in FLASH */
 	ldr	r2, _rel_dyn_start_ofs	/* r2 <- rel dyn start ofs */
arch/arm/cpu/pxa/start.S +3 -5
index 6325e5f..51dd210 100644
@@ -187,16 +187,15 @@ relocate_code:
 #endif
 
 	adr	r0, _start
-	cmp	r0, r6
-	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
+	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
-	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
-	stmia	r1!, {r9-r10}		/* copy to   target address [r1]    */
+	ldmia	r0!, {r10-r11}		/* copy from source address [r0]    */
+	stmia	r1!, {r10-r11}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end address [r2]    */
 	blo	copy_loop
 
@@ -205,7 +204,6 @@ copy_loop:
 	 * fix .rel.dyn relocations
 	 */
 	ldr	r0, _TEXT_BASE		/* r0 <- Text base */
-	sub	r9, r6, r0		/* r9 <- relocation offset */
 	ldr	r10, _dynsym_start_ofs	/* r10 <- sym table ofs */
 	add	r10, r10, r0		/* r10 <- sym table in FLASH */
 	ldr	r2, _rel_dyn_start_ofs	/* r2 <- rel dyn start ofs */
arch/arm/cpu/s3c44b0/start.S +3 -5
index 0224898..f037079 100644
@@ -148,16 +148,15 @@ relocate_code:
 	mov	r6, r2	/* save addr of destination */
 
 	adr	r0, _start
-	cmp	r0, r6
-	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
+	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
-	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
-	stmia	r1!, {r9-r10}		/* copy to   target address [r1]    */
+	ldmia	r0!, {r10-r11}		/* copy from source address [r0]    */
+	stmia	r1!, {r10-r11}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end address [r2]    */
 	blo	copy_loop
 
@@ -166,7 +165,6 @@ copy_loop:
 	 * fix .rel.dyn relocations
 	 */
 	ldr	r0, _TEXT_BASE		/* r0 <- Text base */
-	sub	r9, r6, r0		/* r9 <- relocation offset */
 	ldr	r10, _dynsym_start_ofs	/* r10 <- sym table ofs */
 	add	r10, r10, r0		/* r10 <- sym table in FLASH */
 	ldr	r2, _rel_dyn_start_ofs	/* r2 <- rel dyn start ofs */
arch/arm/cpu/sa1100/start.S +3 -5
index dc79556..03d8a02 100644
@@ -152,16 +152,15 @@ relocate_code:
 	mov	r6, r2	/* save addr of destination */
 
 	adr	r0, _start
-	cmp	r0, r6
-	moveq	r9, #0		/* no relocation. relocation offset(r9) = 0 */
+	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
 	ldr	r3, _bss_start_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
-	ldmia	r0!, {r9-r10}		/* copy from source address [r0]    */
-	stmia	r1!, {r9-r10}		/* copy to   target address [r1]    */
+	ldmia	r0!, {r10-r11}		/* copy from source address [r0]    */
+	stmia	r1!, {r10-r11}		/* copy to   target address [r1]    */
 	cmp	r0, r2			/* until source end address [r2]    */
 	blo	copy_loop
 
@@ -170,7 +169,6 @@ copy_loop:
 	 * fix .rel.dyn relocations
 	 */
 	ldr	r0, _TEXT_BASE		/* r0 <- Text base */
-	sub	r9, r6, r0		/* r9 <- relocation offset */
 	ldr	r10, _dynsym_start_ofs	/* r10 <- sym table ofs */
 	add	r10, r10, r0		/* r10 <- sym table in FLASH */
 	ldr	r2, _rel_dyn_start_ofs	/* r2 <- rel dyn start ofs */
Signature · 1 line
1.7.10.4
#17 lore raw

PATCH v8 13/31 arm: relocate_code(): Use __image_copy_end for end of relocation

In reply to Benoît Thébaudeau

Use __image_copy_end instead of __bss_start for the end of the image to relocate. This is the same as commit 033ca72, but applied to all ARM start.S.

This is a more appropriate symbol naming for an image copy & relocate feature, and this also saves a useless copy of data put between __image_copy_end and __bss_start in linker scripts (e.g. relocation information, or MMU initialization tables used only before jumping to the relocated image).

---
Changes in v8:
- Fix "space before tab" warning.
- Give more details in patch description.

Changes in v7: None
Changes in v6:
- New patch.

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/cpu/arm1136/start.S               |    4 ++--
 arch/arm/cpu/arm1176/start.S               |    6 +++++-
 arch/arm/cpu/arm720t/start.S               |    6 +++++-
 arch/arm/cpu/arm920t/ep93xx/u-boot.lds     |    3 +++
 arch/arm/cpu/arm920t/start.S               |    6 +++++-
 arch/arm/cpu/arm925t/start.S               |    6 +++++-
 arch/arm/cpu/arm926ejs/start.S             |    6 +++++-
 arch/arm/cpu/arm946es/start.S              |    6 +++++-
 arch/arm/cpu/arm_intcm/start.S             |    6 +++++-
 arch/arm/cpu/armv7/start.S                 |    4 ++--
 arch/arm/cpu/ixp/start.S                   |    6 +++++-
 arch/arm/cpu/ixp/u-boot.lds                |    2 ++
 arch/arm/cpu/pxa/start.S                   |    6 +++++-
 arch/arm/cpu/s3c44b0/start.S               |    6 +++++-
 arch/arm/cpu/sa1100/start.S                |    6 +++++-
 board/actux1/u-boot.lds                    |    3 +++
 board/actux2/u-boot.lds                    |    3 +++
 board/actux3/u-boot.lds                    |    3 +++
 board/davinci/da8xxevm/u-boot-spl-hawk.lds |    1 +
 board/dvlhost/u-boot.lds                   |    3 +++
 board/samsung/smdk6400/u-boot-nand.lds     |    4 ++++
 board/vpac270/u-boot-spl.lds               |    2 ++
 nand_spl/board/karo/tx25/u-boot.lds        |    2 ++
 nand_spl/board/samsung/smdk6400/u-boot.lds |    2 ++
 24 files changed, 87 insertions(+), 15 deletions(-)
arch/arm/cpu/arm1136/start.S +2 -2
index 131fd99..b3e3e37 100644
@@ -104,9 +104,9 @@ _TEXT_BASE:
 _bss_start_ofs:
 	.word __bss_start - _start
 
-.global	_image_copy_end_ofs
+.globl _image_copy_end_ofs
 _image_copy_end_ofs:
-	.word 	__image_copy_end - _start
+	.word __image_copy_end - _start
 
 .globl _bss_end_ofs
 _bss_end_ofs:
arch/arm/cpu/arm1176/start.S +5 -1
index 7be4e43..4f98f8b 100644
@@ -127,6 +127,10 @@ _TEXT_PHY_BASE:
 _bss_start_ofs:
 	.word __bss_start - _start
 
+.globl _image_copy_end_ofs
+_image_copy_end_ofs:
+	.word __image_copy_end - _start
+
 .globl _bss_end_ofs
 _bss_end_ofs:
 	.word __bss_end__ - _start
@@ -251,7 +255,7 @@ relocate_code:
 	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
-	ldr	r3, _bss_start_ofs
+	ldr	r3, _image_copy_end_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
arch/arm/cpu/arm720t/start.S +5 -1
index 74c0664..850fce0 100644
@@ -101,6 +101,10 @@ _TEXT_BASE:
 _bss_start_ofs:
 	.word __bss_start - _start
 
+.globl _image_copy_end_ofs
+_image_copy_end_ofs:
+	.word __image_copy_end - _start
+
 .globl _bss_end_ofs
 _bss_end_ofs:
 	.word __bss_end__ - _start
@@ -166,7 +170,7 @@ relocate_code:
 	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
-	ldr	r3, _bss_start_ofs
+	ldr	r3, _image_copy_end_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
arch/arm/cpu/arm920t/ep93xx/u-boot.lds +3 -0
index 008ae89..62315de 100644
@@ -55,6 +55,9 @@ SECTIONS
 	}
 
 	. = ALIGN(4);
+
+	__image_copy_end = .;
+
 	__bss_start = .;
 	.bss : { *(.bss) }
 	__bss_end__ = .;
arch/arm/cpu/arm920t/start.S +5 -1
index ba4dd85..e2958d3 100644
@@ -89,6 +89,10 @@ _TEXT_BASE:
 _bss_start_ofs:
 	.word __bss_start - _start
 
+.globl _image_copy_end_ofs
+_image_copy_end_ofs:
+	.word __image_copy_end - _start
+
 .globl _bss_end_ofs
 _bss_end_ofs:
 	.word __bss_end__ - _start
@@ -205,7 +209,7 @@ relocate_code:
 	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
-	ldr	r3, _bss_start_ofs
+	ldr	r3, _image_copy_end_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
arch/arm/cpu/arm925t/start.S +5 -1
index e3b84ef..4b64122 100644
@@ -95,6 +95,10 @@ _TEXT_BASE:
 _bss_start_ofs:
 	.word __bss_start - _start
 
+.globl _image_copy_end_ofs
+_image_copy_end_ofs:
+	.word __image_copy_end - _start
+
 .globl _bss_end_ofs
 _bss_end_ofs:
 	.word __bss_end__ - _start
@@ -195,7 +199,7 @@ relocate_code:
 	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
-	ldr	r3, _bss_start_ofs
+	ldr	r3, _image_copy_end_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
arch/arm/cpu/arm926ejs/start.S +5 -1
index 25111f6..edff38a 100644
@@ -140,6 +140,10 @@ _TEXT_BASE:
 _bss_start_ofs:
 	.word __bss_start - _start
 
+.globl _image_copy_end_ofs
+_image_copy_end_ofs:
+	.word __image_copy_end - _start
+
 .globl _bss_end_ofs
 _bss_end_ofs:
 	.word __bss_end__ - _start
@@ -212,7 +216,7 @@ relocate_code:
 	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy loop */
-	ldr	r3, _bss_start_ofs
+	ldr	r3, _image_copy_end_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
arch/arm/cpu/arm946es/start.S +5 -1
index 24b8b1d..48b7b62 100644
@@ -105,6 +105,10 @@ _TEXT_BASE:
 _bss_start_ofs:
 	.word __bss_start - _start
 
+.globl _image_copy_end_ofs
+_image_copy_end_ofs:
+	.word __image_copy_end - _start
+
 .globl _bss_end_ofs
 _bss_end_ofs:
 	.word __bss_end__ - _start
@@ -170,7 +174,7 @@ relocate_code:
 	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
-	ldr	r3, _bss_start_ofs
+	ldr	r3, _image_copy_end_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
arch/arm/cpu/arm_intcm/start.S +5 -1
index f6934f0..5016c3c 100644
@@ -101,6 +101,10 @@ _TEXT_BASE:
 _bss_start_ofs:
 	.word __bss_start - _start
 
+.globl _image_copy_end_ofs
+_image_copy_end_ofs:
+	.word __image_copy_end - _start
+
 .globl _bss_end_ofs
 _bss_end_ofs:
 	.word __bss_end__ - _start
@@ -166,7 +170,7 @@ relocate_code:
 	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
-	ldr	r3, _bss_start_ofs
+	ldr	r3, _image_copy_end_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
arch/arm/cpu/armv7/start.S +2 -2
index 0975896..cc68347 100644
@@ -94,9 +94,9 @@ _TEXT_BASE:
 _bss_start_ofs:
 	.word __bss_start - _start
 
-.global	_image_copy_end_ofs
+.globl _image_copy_end_ofs
 _image_copy_end_ofs:
-	.word 	__image_copy_end - _start
+	.word __image_copy_end - _start
 
 .globl _bss_end_ofs
 _bss_end_ofs:
arch/arm/cpu/ixp/start.S +5 -1
index 397c660..f6bec3b 100644
@@ -114,6 +114,10 @@ _TEXT_BASE:
 _bss_start_ofs:
 	.word __bss_start - _start
 
+.globl _image_copy_end_ofs
+_image_copy_end_ofs:
+	.word __image_copy_end - _start
+
 .globl _bss_end_ofs
 _bss_end_ofs:
 	.word __bss_end__ - _start
@@ -268,7 +272,7 @@ relocate_code:
 	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
-	ldr	r3, _bss_start_ofs
+	ldr	r3, _image_copy_end_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
arch/arm/cpu/ixp/u-boot.lds +2 -0
index 81d954f..d9bb5da 100644
@@ -54,6 +54,8 @@ SECTIONS
 
 	. = ALIGN(4);
 
+	__image_copy_end = .;
+
 	.rel.dyn : {
 		__rel_dyn_start = .;
 		*(.rel*)
arch/arm/cpu/pxa/start.S +5 -1
index 51dd210..8c64411 100644
@@ -118,6 +118,10 @@ _TEXT_BASE:
 _bss_start_ofs:
 	.word __bss_start - _start
 
+.globl _image_copy_end_ofs
+_image_copy_end_ofs:
+	.word __image_copy_end - _start
+
 .globl _bss_end_ofs
 _bss_end_ofs:
 	.word __bss_end__ - _start
@@ -190,7 +194,7 @@ relocate_code:
 	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
-	ldr	r3, _bss_start_ofs
+	ldr	r3, _image_copy_end_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
arch/arm/cpu/s3c44b0/start.S +5 -1
index f037079..0924925 100644
@@ -80,6 +80,10 @@ _TEXT_BASE:
 _bss_start_ofs:
 	.word __bss_start - _start
 
+.globl _image_copy_end_ofs
+_image_copy_end_ofs:
+	.word __image_copy_end - _start
+
 .globl _bss_end_ofs
 _bss_end_ofs:
 	.word __bss_end__ - _start
@@ -151,7 +155,7 @@ relocate_code:
 	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
-	ldr	r3, _bss_start_ofs
+	ldr	r3, _image_copy_end_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
arch/arm/cpu/sa1100/start.S +5 -1
index 03d8a02..fe6c429 100644
@@ -90,6 +90,10 @@ _TEXT_BASE:
 _bss_start_ofs:
 	.word __bss_start - _start
 
+.globl _image_copy_end_ofs
+_image_copy_end_ofs:
+	.word __image_copy_end - _start
+
 .globl _bss_end_ofs
 _bss_end_ofs:
 	.word __bss_end__ - _start
@@ -155,7 +159,7 @@ relocate_code:
 	subs	r9, r6, r0		/* r9 <- relocation offset */
 	beq	relocate_done		/* skip relocation */
 	mov	r1, r6			/* r1 <- scratch for copy_loop */
-	ldr	r3, _bss_start_ofs
+	ldr	r3, _image_copy_end_ofs
 	add	r2, r0, r3		/* r2 <- source end address	    */
 
 copy_loop:
board/actux1/u-boot.lds +3 -0
index c41eed0..34ed90d 100644
@@ -61,6 +61,9 @@ SECTIONS
 	}
 
 	. = ALIGN (4);
+
+	__image_copy_end = .;
+
 	.rel.dyn : {
 		__rel_dyn_start = .;
 		*(.rel*)
board/actux2/u-boot.lds +3 -0
index 8409984..8337457 100644
@@ -61,6 +61,9 @@ SECTIONS
 	}
 
 	. = ALIGN (4);
+
+	__image_copy_end = .;
+
 	.rel.dyn : {
 		__rel_dyn_start = .;
 		*(.rel*)
board/actux3/u-boot.lds +3 -0
index a3bd02b..a72a666 100644
@@ -61,6 +61,9 @@ SECTIONS
 	}
 
 	. = ALIGN (4);
+
+	__image_copy_end = .;
+
 	.rel.dyn : {
 		__rel_dyn_start = .;
 		*(.rel*)
board/davinci/da8xxevm/u-boot-spl-hawk.lds +1 -0
index 86dc172..174955e 100644
@@ -63,6 +63,7 @@ SECTIONS
 	}
 
 	. = ALIGN(4);
+	__image_copy_end = .;
 	__rel_dyn_start = .;
 	__rel_dyn_end = .;
 	__dynsym_start = .;
board/dvlhost/u-boot.lds +3 -0
index 1bd1700..9c14daa 100644
@@ -61,6 +61,9 @@ SECTIONS
 	}
 
 	. = ALIGN (4);
+
+	__image_copy_end = .;
+
 	.rel.dyn : {
 		__rel_dyn_start = .;
 		*(.rel*)
board/samsung/smdk6400/u-boot-nand.lds +4 -0
index fbb442a..2c3a60b 100644
@@ -53,6 +53,10 @@ SECTIONS
 		#include <u-boot.lst>
 	}
 
+	. = ALIGN(4);
+
+	__image_copy_end = .;
+
 	. = align(4);
 	.mmudata : { *(.mmudata) }
 
board/vpac270/u-boot-spl.lds +2 -0
index 20161a4..e344436 100644
@@ -63,6 +63,8 @@ SECTIONS
 
 	. = ALIGN(4);
 
+	__image_copy_end = .;
+
 	.rel.dyn : {
 		__rel_dyn_start = .;
 		*(.rel*)
nand_spl/board/karo/tx25/u-boot.lds +2 -0
index ee36131..95ea8ac 100644
@@ -54,6 +54,8 @@ SECTIONS
 
 	. = ALIGN(4);
 
+	__image_copy_end = .;
+
 	.rel.dyn : {
 		__rel_dyn_start = .;
 		*(.rel*)
nand_spl/board/samsung/smdk6400/u-boot.lds +2 -0
index 2ed6466..293ae02 100644
@@ -58,6 +58,8 @@ SECTIONS
 
 	. = ALIGN(4);
 
+	__image_copy_end = .;
+
 	.rel.dyn : {
 	__rel_dyn_start = .;
 	*(.rel*)
Signature · 1 line
1.7.10.4
#18 lore raw

PATCH v8 14/31 arm: crt0.S: Remove bogus .globl

In reply to Benoît Thébaudeau

The purpose of .globl is to export symbols for ld, not to declare external symbols.

By the way, use the ENTRY() and ENDPROC() macros to define functions rather than using .global directly.

---
Changes in v8:
- Use ENTRY() and ENDPROC() to define functions.

Changes in v7: None
Changes in v6:
- New patch.

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/lib/crt0.S |   28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)
arch/arm/lib/crt0.S +4 -24
index 4f60958..56b433e 100644
@@ -24,6 +24,7 @@
 
 #include <config.h>
 #include <asm-offsets.h>
+#include <linux/linkage.h>
 
 /*
  * This file handles the target-independent stages of the U-Boot
@@ -67,33 +68,10 @@
  */
 
 /*
- * declare nand_boot() or board_init_r() to jump to at end of crt0
- */
-
-#if defined(CONFIG_NAND_SPL)
-
-.globl nand_boot
-
-#elif ! defined(CONFIG_SPL_BUILD)
-
-.globl board_init_r
-
-#endif
-
-/*
- * start and end of BSS
- */
-
-.globl __bss_start
-.globl __bss_end__
-
-/*
  * entry point of crt0 sequence
  */
 
-.global _main
-
-_main:
+ENTRY(_main)
 
 /*
  * Set up initial C runtime environment and call board_init_f(0).
@@ -171,3 +149,5 @@ clbss_l:cmp	r0, r1			/* while not at end of BSS */
 	/* we should not return here. */
 
 #endif
+
+ENDPROC(_main)
Signature · 1 line
1.7.10.4
#19 lore raw

PATCH v8 15/31 autoconfig.mk: Make it possible to define configs from other configs

In reply to Benoît Thébaudeau

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 tools/scripts/define2mk.sed |    2 ++
 1 file changed, 2 insertions(+)
tools/scripts/define2mk.sed +2 -0
index 13e2845..c641edf 100644
@@ -24,6 +24,8 @@
 	s/="\([0-9][0-9]*\)"/=\1/;
 	# ... and from hex numbers
 	s/="\(0[Xx][0-9a-fA-F][0-9a-fA-F]*\)"/=\1/;
+	# ... and from configs defined from other configs
+	s/="\(CONFIG_[A-Za-z0-9_][A-Za-z0-9_]*\)"/=$(\1)/;
 	# Change '1' and empty values to "y" (not perfect, but
 	# supports conditional compilation in the makefiles
 	s/=$/=y/;
Signature · 1 line
1.7.10.4
#20 lore raw

PATCH v8 15/31 autoconfig.mk: Make it possible to define configs from other configs

Quoted 20 lines · Beno??t Th??baudeau

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 tools/scripts/define2mk.sed |    2 ++
 1 file changed, 2 insertions(+)
tools/scripts/define2mk.sed +0 -0
index 13e2845..c641edf 100644

tools/scripts/define2mk.sed line 31

Quoted 8 lines
tools/scripts/define2mk.sed +2 -0
@@ -24,6 +24,8 @@
 	s/="\([0-9][0-9]*\)"/=\1/;
 	# ... and from hex numbers
 	s/="\(0[Xx][0-9a-fA-F][0-9a-fA-F]*\)"/=\1/;
+	# ... and from configs defined from other configs
+	s/="\(CONFIG_[A-Za-z0-9_][A-Za-z0-9_]*\)"/=$(\1)/;
 	# Change '1' and empty values to "y" (not perfect, but
 	# supports conditional compilation in the makefiles
 	s/=$/=y/;

OK, please add a little more to the commit message, such as an example of how this works or gives us now? Thanks.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130301/790563d3/attachment.pgp>
#21 lore raw

PATCH v8 15/31 autoconfig.mk: Make it possible to define configs from other configs

Hi Tom,

Quoted 17 lines · Tom Rini
Quoted 15 lines · Beno??t Th??baudeau

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 tools/scripts/define2mk.sed |    2 ++
 1 file changed, 2 insertions(+)
Quoted 16 lines

tools/scripts/define2mk.sed line 31

Quoted 13 lines
tools/scripts/define2mk.sed +2 -0
index 13e2845..c641edf 100644
@@ -24,6 +24,8 @@
 	s/="\([0-9][0-9]*\)"/=\1/;
 	# ... and from hex numbers
 	s/="\(0[Xx][0-9a-fA-F][0-9a-fA-F]*\)"/=\1/;
+	# ... and from configs defined from other configs
+	s/="\(CONFIG_[A-Za-z0-9_][A-Za-z0-9_]*\)"/=$(\1)/;
 	# Change '1' and empty values to "y" (not perfect, but
 	# supports conditional compilation in the makefiles
 	s/=$/=y/;

OK, please add a little more to the commit message, such as an example of how this works or gives us now? Thanks.

OK, I'll do that in v9.

Thanks for the reviews.

Best regards,
Beno?t

#22 lore raw

PATCH v8 16/31 Makefile: Change CONFIG_SPL_PAD_TO to image offset

In reply to Benoît Thébaudeau

Change CONFIG_SPL_PAD_TO from a link address to an image offset since this is more handy and closer to the purpose of this config.

Automatically define CONFIG_SPL_PAD_TO to CONFIG_SPL_MAX_SIZE (or 0 without CONFIG_SPL_MAX_SIZE).

Test that CONFIG_SPL_PAD_TO >= CONFIG_SPL_MAX_SIZE if CONFIG_SPL_PAD_TO is non-zero.

---
Changes in v8:
- Rebase on latest u-boot-imx/master.
- Use CONFIG_SPL_PAD_TO instead of CONFIG_SPL_MAX_SIZE for u-boot-with-spl.bin padding.

Changes in v7:
- Use u-boot-spl.bin instead of u-boot-spl in order to avoid having to use --change-addresses.

Changes in v6:
- Fix size passed to --pad-to thanks to --change-addresses.

Changes in v5: None
Changes in v4:
- New patch.

Changes in v3: None
Changes in v2: None

 Makefile                      |    5 ++---
 README                        |    7 +++++--
 include/config_fallbacks.h    |   16 ++++++++++++++++
 include/configs/MPC8313ERDB.h |    2 +-
 4 files changed, 24 insertions(+), 6 deletions(-)
Makefile +2 -3
index 33d4253..5bcc914 100644
@@ -484,9 +484,8 @@ $(obj)u-boot.dis:	$(obj)u-boot
 
 
 $(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
-		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(or $(CONFIG_SPL_PAD_TO),0) \
-			-O binary $(obj)spl/u-boot-spl \
-			$(obj)spl/u-boot-spl-pad.bin
+		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SPL_PAD_TO) \
+			-I binary -O binary $< $(obj)spl/u-boot-spl-pad.bin
 		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@
 		rm $(obj)spl/u-boot-spl-pad.bin
 
README +5 -2
index 11ffa71..938c38a 100644
@@ -2883,8 +2883,11 @@ FIT uImage format:
 		Support for lib/libgeneric.o in SPL binary
 
 		CONFIG_SPL_PAD_TO
-		Linker address to which the SPL should be padded before
-		appending the SPL payload.
+		Image offset to which the SPL should be padded before appending
+		the SPL payload. By default, this is defined as
+		CONFIG_SPL_MAX_SIZE, or 0 if CONFIG_SPL_MAX_SIZE is undefined.
+		CONFIG_SPL_PAD_TO must be either 0, meaning to append the SPL
+		payload without any padding, or >= CONFIG_SPL_MAX_SIZE.
 
 		CONFIG_SPL_TARGET
 		Final target image containing SPL and payload.  Some SPLs
include/config_fallbacks.h +16 -0
index bfb9680..457c99e 100644
@@ -9,6 +9,22 @@
 #ifndef __CONFIG_FALLBACKS_H
 #define __CONFIG_FALLBACKS_H
 
+#ifdef CONFIG_SPL
+#ifdef CONFIG_SPL_PAD_TO
+#ifdef CONFIG_SPL_MAX_SIZE
+#if CONFIG_SPL_PAD_TO && CONFIG_SPL_PAD_TO < CONFIG_SPL_MAX_SIZE
+#error CONFIG_SPL_PAD_TO < CONFIG_SPL_MAX_SIZE
+#endif
+#endif
+#else
+#ifdef CONFIG_SPL_MAX_SIZE
+#define CONFIG_SPL_PAD_TO	CONFIG_SPL_MAX_SIZE
+#else
+#define CONFIG_SPL_PAD_TO	0
+#endif
+#endif
+#endif
+
 #ifndef CONFIG_SYS_BAUDRATE_TABLE
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
 #endif
include/configs/MPC8313ERDB.h +1 -1
index 275d4f2..c28dfe0 100644
@@ -52,7 +52,7 @@
 #define CONFIG_SYS_TEXT_BASE	0x00100000 /* CONFIG_SYS_NAND_U_BOOT_DST */
 #define CONFIG_SYS_TEXT_BASE_SPL 0xfff00000
 #define CONFIG_SPL_MAX_SIZE	(4 * 1024)
-#define CONFIG_SPL_PAD_TO	0xfff04000
+#define CONFIG_SPL_PAD_TO	0x4000
 
 #define CONFIG_SYS_NAND_U_BOOT_SIZE  (512 << 10)
 #define CONFIG_SYS_NAND_U_BOOT_DST   0x00100000
Signature · 1 line
1.7.10.4
#23 lore raw

PATCH v8 17/31 imx: Fix automatic make targets for imx images

In reply to Benoît Thébaudeau

Automatically build the 'u-boot.imx' (i.e. imx header + u-boot.bin) and 'SPL' (i.e. imx header + u-boot-spl.bin) make targets for all imx processors supporting this header, so for arm926ejs, arm1136 and armv7. Some combinations were missing.

At the same time, fix the build of SPL targets not supporting the imx header on arm1136. For arm1136, the 'SPL' make target was forced to build in all cases if CONFIG_SPL_BUILD was defined, even for non-imx platforms or imx setups without an imx header.

---
Changes in v8: None
Changes in v7: None
Changes in v6:
- New patch, extracted from "nand: mxc: Switch NAND SPL to generic SPL".

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/cpu/arm1136/config.mk   |    7 +++++++
 arch/arm/cpu/arm926ejs/config.mk |    8 ++++++--
 arch/arm/cpu/armv7/config.mk     |    6 ++++++
 3 files changed, 19 insertions(+), 2 deletions(-)
arch/arm/cpu/arm1136/config.mk +7 -0
index 9092d91..797d122 100644
@@ -31,6 +31,13 @@ PLATFORM_CPPFLAGS += -march=armv5
 # =========================================================================
 PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
 PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
+
+ifneq ($(CONFIG_IMX_CONFIG),)
+ifdef CONFIG_SPL
 ifdef CONFIG_SPL_BUILD
 ALL-y	+= $(OBJTREE)/SPL
 endif
+else
+ALL-y	+= $(obj)u-boot.imx
+endif
+endif
arch/arm/cpu/arm926ejs/config.mk +6 -2
index 6a3a1bb..f0e31d1 100644
@@ -33,7 +33,11 @@ PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,$(call cc-option,-mali
 PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
 
 ifneq ($(CONFIG_IMX_CONFIG),)
-
+ifdef CONFIG_SPL
+ifdef CONFIG_SPL_BUILD
+ALL-y	+= $(OBJTREE)/SPL
+endif
+else
 ALL-y	+= $(obj)u-boot.imx
-
+endif
 endif
arch/arm/cpu/armv7/config.mk +6 -0
index 9c3e2f3..56b8053 100644
@@ -40,5 +40,11 @@ PF_NO_UNALIGNED := $(call cc-option, -mno-unaligned-access,)
 PLATFORM_NO_UNALIGNED := $(PF_NO_UNALIGNED)
 
 ifneq ($(CONFIG_IMX_CONFIG),)
+ifdef CONFIG_SPL
+ifdef CONFIG_SPL_BUILD
+ALL-y	+= $(OBJTREE)/SPL
+endif
+else
 ALL-y	+= $(obj)u-boot.imx
 endif
+endif
Signature · 1 line
1.7.10.4
#24 lore raw

PATCH v8 18/31 nand: mxc: Switch NAND SPL to generic SPL

In reply to Benoît Thébaudeau

This also fixes support for mx31pdk and tx25, which had been broken by commit e05e5de7fae5bec79617e113916dac6631251156.

---
Changes in v8:
- Update doc/README.arm-relocation.
- Drop useless line feed at end of inline asm.
- Set CONFIG_SYS_NAND_U_BOOT_OFFS to CONFIG_SPL_PAD_TO instead of CONFIG_SPL_MAX_SIZE (this is a cosmetic change since they now have the same value).
- Enlarge CONFIG_SYS_NAND_U_BOOT_SIZE from 0x30000 to 0x32000 to let u-boot.bin fit in.

Changes in v7: None
Changes in v6:
- Automate 'u-boot.imx' and 'SPL' make targets for all imx processors.
- Move board_init_f() to <board>.c.
- Get rid of board SPL linker scripts.
- Define CONFIG_SYS_NAND_U_BOOT_OFFS as CONFIG_SPL_MAX_SIZE rather than duplicating the constant value.
- Define CONFIG_SYS_NAND_U_BOOT_DST as CONFIG_SYS_TEXT_BASE rather than duplicating the constant value.
- Pass 0 as the 1st argument to relocate_code() since it's unused.
- Fix stack pointers.
- Rebase on latest u-boot-imx/master.
- Move unrelated changes to separate patches.

Changes in v5:
- Remove spaces between function name and open parenthesis.
- Fix mx31pdk and tx25 Makefile-s and SPL linker scripts.
- Remove the useless definition of CONFIG_SPL_LDSCRIPT.
- Fix the call to nand_boot().

Changes in v4:
- New patch.

Changes in v3: None
Changes in v2: None

 arch/arm/cpu/arm926ejs/start.S                     |    3 +-
 board/freescale/mx31pdk/Makefile                   |    3 +
 board/freescale/mx31pdk/config.mk                  |    5 --
 board/freescale/mx31pdk/mx31pdk.c                  |    8 ++
 board/karo/tx25/Makefile                           |    4 +-
 board/karo/tx25/config.mk                          |    5 --
 board/karo/tx25/tx25.c                             |    8 ++
 boards.cfg                                         |    2 +-
 doc/README.arm-relocation                          |   14 +--
 drivers/mtd/nand/Makefile                          |    1 +
 drivers/mtd/nand/mxc_nand.c                        |   10 +--
 include/fsl_nfc.h => drivers/mtd/nand/mxc_nand.h   |   10 +--
 .../mtd/nand/mxc_nand_spl.c                        |   26 ++----
 include/configs/mx31pdk.h                          |   19 +++--
 include/configs/tx25.h                             |   22 +++--
 nand_spl/board/freescale/mx31pdk/Makefile          |   68 ---------------
 nand_spl/board/freescale/mx31pdk/u-boot.lds        |   87 -------------------
 nand_spl/board/karo/tx25/Makefile                  |   89 --------------------
 nand_spl/board/karo/tx25/config.mk                 |    1 -
 nand_spl/board/karo/tx25/u-boot.lds                |   87 -------------------
 20 files changed, 80 insertions(+), 392 deletions(-)
 delete mode 100644 board/freescale/mx31pdk/config.mk
 delete mode 100644 board/karo/tx25/config.mk
 rename include/fsl_nfc.h => drivers/mtd/nand/mxc_nand.h (98%)
 rename nand_spl/nand_boot_fsl_nfc.c => drivers/mtd/nand/mxc_nand_spl.c (92%)
 delete mode 100644 nand_spl/board/freescale/mx31pdk/Makefile
 delete mode 100644 nand_spl/board/freescale/mx31pdk/u-boot.lds
 delete mode 100644 nand_spl/board/karo/tx25/Makefile
 delete mode 100644 nand_spl/board/karo/tx25/config.mk
 delete mode 100644 nand_spl/board/karo/tx25/u-boot.lds
arch/arm/cpu/arm926ejs/start.S +2 -1
index edff38a..9121af2 100644
@@ -200,7 +200,6 @@ reset:
 
 /*------------------------------------------------------------------------------*/
 
-#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_NAND_SPL)
 /*
  * void relocate_code (addr_sp, gd, addr_moni)
  *
@@ -269,6 +268,8 @@ relocate_done:
 
 	bx	lr
 
+#ifndef CONFIG_SPL_BUILD
+
 _rel_dyn_start_ofs:
 	.word __rel_dyn_start - _start
 _rel_dyn_end_ofs:
board/freescale/mx31pdk/Makefile +3 -0
index 5b7cafd..b910722 100644
@@ -27,6 +27,9 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
+ifdef CONFIG_SPL_BUILD
+SOBJS	:= lowlevel_init.o
+endif
 COBJS	:= mx31pdk.o
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
board/freescale/mx31pdk/config.mk deleted +0 -5
deleted file mode 100644
index de2c642..0000000
@@ -1,5 +0,0 @@
-ifdef CONFIG_NAND_SPL
-CONFIG_SYS_TEXT_BASE = 0x87ec0000
-else
-CONFIG_SYS_TEXT_BASE = 0x87f00000
-endif
board/freescale/mx31pdk/mx31pdk.c +8 -0
index 895396c..3d0d419 100644
@@ -36,6 +36,14 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifdef CONFIG_SPL_BUILD
+void board_init_f(ulong bootflag)
+{
+	relocate_code(0, NULL, CONFIG_SPL_TEXT_BASE);
+	asm volatile("ldr pc, =nand_boot");
+}
+#endif
+
 int dram_init(void)
 {
 	/* dram_init must store complete ramsize in gd->ram_size */
board/karo/tx25/Makefile +3 -1
index 9617fa5..c26bf36 100644
@@ -25,8 +25,10 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
-COBJS	:= tx25.o
+ifdef CONFIG_SPL_BUILD
 SOBJS	:= lowlevel_init.o
+endif
+COBJS	:= tx25.o
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/karo/tx25/config.mk deleted +0 -5
deleted file mode 100644
index 18b2883..0000000
@@ -1,5 +0,0 @@
-ifdef CONFIG_NAND_SPL
-CONFIG_SYS_TEXT_BASE = 0x810c0000
-else
-CONFIG_SYS_TEXT_BASE = 0x81200000
-endif
board/karo/tx25/tx25.c +8 -0
index 362f00a..69ee590 100644
@@ -33,6 +33,14 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifdef CONFIG_SPL_BUILD
+void board_init_f(ulong bootflag)
+{
+	relocate_code(0, NULL, CONFIG_SPL_TEXT_BASE);
+	asm volatile("ldr pc, =nand_boot");
+}
+#endif
+
 #ifdef CONFIG_FEC_MXC
 #define GPIO_FEC_RESET_B	IMX_GPIO_NR(4, 7)
 #define GPIO_FEC_ENABLE_B	IMX_GPIO_NR(4, 9)
boards.cfg +1 -1
index 7a0b79d..8b4c6b8 100644
@@ -45,7 +45,7 @@ imx31_phycore                arm         arm1136     -                   -
 imx31_phycore_eet            arm         arm1136     imx31_phycore       -              mx31         imx31_phycore:IMX31_PHYCORE_EET
 qong                         arm         arm1136     -                   davedenx       mx31
 mx31ads                      arm         arm1136     -                   freescale      mx31
-mx31pdk                      arm         arm1136     -                   freescale      mx31         mx31pdk:NAND_U_BOOT
+mx31pdk                      arm         arm1136     -                   freescale      mx31
 tt01                         arm         arm1136     -                   hale           mx31
 imx31_litekit                arm         arm1136     -                   logicpd        mx31
 flea3                        arm         arm1136     -                   CarMediaLab    mx35
doc/README.arm-relocation +7 -7
index 5a9a2fb..645b374 100644
@@ -40,15 +40,15 @@ Boards which are not fixed to support relocation will be REMOVED!
 
 -----------------------------------------------------------------------------
 
-For boards which boot from nand_spl, it is possible to save one copy
+For boards which boot from spl, it is possible to save one copy
 if CONFIG_SYS_TEXT_BASE == relocation address! This prevents that uboot code
 is copied again in relocate_code().
 
-example for the tx25 board:
+example for the tx25 board booting from NAND Flash:
 
 a) cpu starts
 b) it copies the first page in nand to internal ram
-   (nand_spl_code)
+   (spl code)
 c) end executes this code
 d) this initialize CPU, RAM, ... and copy itself to RAM
    (this bin must fit in one page, so board_init_f()
@@ -79,20 +79,20 @@ TODO
 
 -----------------------------------------------------------------------------
 
-Relocation with NAND_SPL (example for the tx25):
+Relocation with SPL (example for the tx25 booting from NAND Flash):
 
 - cpu copies the first page from NAND to 0xbb000000 (IMX_NFC_BASE)
   and start with code execution on this address.
 
-- The First page contains u-boot code from u-boot:nand_spl/nand_boot_fsl_nfc.c
-  which inits the dram, cpu registers, reloacte itself to CONFIG_SYS_TEXT_BASE	and loads
+- The First page contains u-boot code from drivers/mtd/nand/mxc_nand_spl.c
+  which inits the dram, cpu registers, reloacte itself to CONFIG_SPL_TEXT_BASE	and loads
   the "real" u-boot to CONFIG_SYS_NAND_U_BOOT_DST and starts execution
   @CONFIG_SYS_NAND_U_BOOT_START
 
 - This u-boot does no RAM init, nor CPU register setup. Just look
   where it has to copy and relocate itself to this address. If
   relocate address = CONFIG_SYS_TEXT_BASE (not the same, as the
-  CONFIG_SYS_TEXT_BASE from the nand_spl code), then there is no need
+  CONFIG_SPL_TEXT_BASE from the spl code), then there is no need
   to copy, just go on with bss clear and jump to board_init_r.
 
 -----------------------------------------------------------------------------
drivers/mtd/nand/Makefile +1 -0
index c77c0c4..bcb7161 100644
@@ -82,6 +82,7 @@ COBJS-$(CONFIG_NAND_PLAT) += nand_plat.o
 else  # minimal SPL drivers
 
 COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_spl.o
+COBJS-$(CONFIG_NAND_MXC) += mxc_nand_spl.o
 
 endif # drivers
 endif # nand
drivers/mtd/nand/mxc_nand.c +5 -5
index 29ceab3..507bbc2 100644
@@ -26,7 +26,7 @@
 	defined(CONFIG_MX51) || defined(CONFIG_MX53)
 #include <asm/arch/imx-regs.h>
 #endif
-#include <fsl_nfc.h>
+#include "mxc_nand.h"
 
 #define DRIVER_NAME "mxc_nand"
 
@@ -36,9 +36,9 @@ struct mxc_nand_host {
 	struct mtd_info			mtd;
 	struct nand_chip		*nand;
 
-	struct fsl_nfc_regs __iomem	*regs;
+	struct mxc_nand_regs __iomem	*regs;
 #ifdef MXC_NFC_V3_2
-	struct fsl_nfc_ip_regs __iomem	*ip_regs;
+	struct mxc_nand_ip_regs __iomem	*ip_regs;
 #endif
 	int				spare_only;
 	int				status_request;
@@ -1213,10 +1213,10 @@ int board_nand_init(struct nand_chip *this)
 	this->read_buf = mxc_nand_read_buf;
 	this->verify_buf = mxc_nand_verify_buf;
 
-	host->regs = (struct fsl_nfc_regs __iomem *)CONFIG_MXC_NAND_REGS_BASE;
+	host->regs = (struct mxc_nand_regs __iomem *)CONFIG_MXC_NAND_REGS_BASE;
 #ifdef MXC_NFC_V3_2
 	host->ip_regs =
-		(struct fsl_nfc_ip_regs __iomem *)CONFIG_MXC_NAND_IP_REGS_BASE;
+		(struct mxc_nand_ip_regs __iomem *)CONFIG_MXC_NAND_IP_REGS_BASE;
 #endif
 	host->clk_act = 1;
 
drivers/mtd/nand/mxc_nand.h renamed from include/fsl_nfc.h +5 -5
similarity index 98%
rename from include/fsl_nfc.h
rename to drivers/mtd/nand/mxc_nand.h
index 48a6448..308ff8d 100644
@@ -20,8 +20,8 @@
  * MA 02111-1307 USA
  */
 
-#ifndef __FSL_NFC_H
-#define __FSL_NFC_H
+#ifndef __MXC_NAND_H
+#define __MXC_NAND_H
 
 /*
  * Register map and bit definitions for the Freescale NAND Flash Controller
@@ -73,7 +73,7 @@
 #define NAND_MXC_REG_OFFSET		0x1e00
 #endif
 
-struct fsl_nfc_regs {
+struct mxc_nand_regs {
 	u8 main_area[NAND_MXC_NR_BUFS][0x200];
 	u8 spare_area[NAND_MXC_NR_BUFS][NAND_MXC_SPARE_BUF_SIZE];
 	/*
@@ -131,7 +131,7 @@ struct fsl_nfc_regs {
 };
 
 #ifdef MXC_NFC_V3_2
-struct fsl_nfc_ip_regs {
+struct mxc_nand_ip_regs {
 	u32 wrprot;
 	u32 wrprot_unlock_blkaddr[8];
 	u32 config2;
@@ -222,4 +222,4 @@ struct fsl_nfc_ip_regs {
 #define writenfc	writel
 #endif
 
-#endif /* __FSL_NFC_H */
+#endif /* __MXC_NAND_H */
drivers/mtd/nand/mxc_nand_spl.c renamed from nand_spl/nand_boot_fsl_nfc.c +9 -17
similarity index 92%
rename from nand_spl/nand_boot_fsl_nfc.c
rename to drivers/mtd/nand/mxc_nand_spl.c
index 1096727..09f23c3 100644
@@ -28,13 +28,13 @@
 #include <nand.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/io.h>
-#include <fsl_nfc.h>
+#include "mxc_nand.h"
 
 #if defined(MXC_NFC_V1) || defined(MXC_NFC_V2_1)
-static struct fsl_nfc_regs *const nfc = (void *)NFC_BASE_ADDR;
+static struct mxc_nand_regs *const nfc = (void *)NFC_BASE_ADDR;
 #elif defined(MXC_NFC_V3_2)
-static struct fsl_nfc_regs *const nfc = (void *)NFC_BASE_ADDR_AXI;
-static struct fsl_nfc_ip_regs *const nfc_ip = (void *)NFC_BASE_ADDR;
+static struct mxc_nand_regs *const nfc = (void *)NFC_BASE_ADDR_AXI;
+static struct mxc_nand_ip_regs *const nfc_ip = (void *)NFC_BASE_ADDR;
 #endif
 
 static void nfc_wait_ready(void)
@@ -68,7 +68,7 @@ static void nfc_nand_init(void)
 
 	tmp = (readnfc(&nfc_ip->config2) & ~(NFC_V3_CONFIG2_SPAS_MASK |
 			NFC_V3_CONFIG2_EDC_MASK | NFC_V3_CONFIG2_PS_MASK)) |
-		NFC_V3_CONFIG2_SPAS(CONFIG_SYS_NAND_SPARE_SIZE / 2) |
+		NFC_V3_CONFIG2_SPAS(CONFIG_SYS_NAND_OOBSIZE / 2) |
 		NFC_V3_CONFIG2_INT_MSK | NFC_V3_CONFIG2_ECC_EN |
 		NFC_V3_CONFIG2_ONE_CYCLE;
 	if (CONFIG_SYS_NAND_PAGE_SIZE == 4096)
@@ -81,7 +81,7 @@ static void nfc_nand_init(void)
 	 * if spare size is larger that 16 bytes per 512 byte hunk
 	 * then use 8 symbol correction instead of 4
 	 */
-	if (CONFIG_SYS_NAND_SPARE_SIZE / ecc_per_page > 16)
+	if (CONFIG_SYS_NAND_OOBSIZE / ecc_per_page > 16)
 		tmp |= NFC_V3_CONFIG2_ECC_MODE_8;
 	else
 		tmp &= ~NFC_V3_CONFIG2_ECC_MODE_8;
@@ -102,7 +102,7 @@ static void nfc_nand_init(void)
 	int ecc_per_page = CONFIG_SYS_NAND_PAGE_SIZE / 512;
 	int config1;
 
-	writenfc(CONFIG_SYS_NAND_SPARE_SIZE / 2, &nfc->spare_area_size);
+	writenfc(CONFIG_SYS_NAND_OOBSIZE / 2, &nfc->spare_area_size);
 
 	/* unlocking RAM Buff */
 	writenfc(0x2, &nfc->config);
@@ -115,7 +115,7 @@ static void nfc_nand_init(void)
 	 * if spare size is larger that 16 bytes per 512 byte hunk
 	 * then use 8 symbol correction instead of 4
 	 */
-	if (CONFIG_SYS_NAND_SPARE_SIZE / ecc_per_page > 16)
+	if (CONFIG_SYS_NAND_OOBSIZE / ecc_per_page > 16)
 		config1 &= ~NFC_V2_CONFIG1_ECC_MODE_4;
 	else
 		config1 |= NFC_V2_CONFIG1_ECC_MODE_4;
@@ -204,7 +204,7 @@ static int nfc_nand_check_ecc(void)
 #elif defined(MXC_NFC_V2_1) || defined(MXC_NFC_V3_2)
 	u32 ecc_status = readl(&nfc->ecc_status_result);
 	int ecc_per_page = CONFIG_SYS_NAND_PAGE_SIZE / 512;
-	int err_limit = CONFIG_SYS_NAND_SPARE_SIZE / ecc_per_page > 16 ? 8 : 4;
+	int err_limit = CONFIG_SYS_NAND_OOBSIZE / ecc_per_page > 16 ? 8 : 4;
 	int subpages = CONFIG_SYS_NAND_PAGE_SIZE / 512;
 
 	do {
@@ -332,14 +332,6 @@ static int nand_load(unsigned int from, unsigned int size, unsigned char *buf)
 	return 0;
 }
 
-#if defined(CONFIG_ARM)
-void board_init_f (ulong bootflag)
-{
-	relocate_code (CONFIG_SYS_TEXT_BASE - TOTAL_MALLOC_LEN, NULL,
-		       CONFIG_SYS_TEXT_BASE);
-}
-#endif
-
 /*
  * The main entry for NAND booting. It's necessary that SDRAM is already
  * configured and available since this code loads the main U-Boot image
include/configs/mx31pdk.h +14 -5
index 34e4295..4447c64 100644
@@ -45,7 +45,16 @@
 
 #define CONFIG_MACH_TYPE	MACH_TYPE_MX31_3DS
 
-#if defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
+#define CONFIG_SPL
+#define CONFIG_SPL_TARGET	"u-boot-with-spl.bin"
+#define CONFIG_SPL_LDSCRIPT	"arch/$(ARCH)/cpu/u-boot.lds"
+#define CONFIG_SPL_MAX_SIZE	2048
+#define CONFIG_SPL_NAND_SUPPORT
+
+#define CONFIG_SPL_TEXT_BASE	0x87ec0000
+#define CONFIG_SYS_TEXT_BASE	0x87f00000
+
+#ifndef CONFIG_SPL_BUILD
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #endif
 
@@ -163,7 +172,7 @@
 #define CONFIG_SYS_GBL_DATA_OFFSET	(CONFIG_SYS_INIT_RAM_SIZE - \
 						GENERATED_GBL_DATA_SIZE)
 #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_INIT_RAM_ADDR + \
-						CONFIG_SYS_GBL_DATA_OFFSET)
+						CONFIG_SYS_INIT_RAM_SIZE)
 
 /*-----------------------------------------------------------------------
  * FLASH and environment organization
@@ -189,10 +198,10 @@
 /* NAND configuration for the NAND_SPL */
 
 /* Start copying real U-boot from the second page */
-#define CONFIG_SYS_NAND_U_BOOT_OFFS	0x800
-#define CONFIG_SYS_NAND_U_BOOT_SIZE	0x30000
+#define CONFIG_SYS_NAND_U_BOOT_OFFS	CONFIG_SPL_PAD_TO
+#define CONFIG_SYS_NAND_U_BOOT_SIZE	0x32000
 /* Load U-Boot to this address */
-#define CONFIG_SYS_NAND_U_BOOT_DST	0x87f00000
+#define CONFIG_SYS_NAND_U_BOOT_DST	CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_NAND_U_BOOT_DST
 
 #define CONFIG_SYS_NAND_PAGE_SIZE	0x800
include/configs/tx25.h +14 -8
index 80194d8..bdfa3e5 100644
@@ -21,6 +21,7 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <asm/arch/imx-regs.h>
 
 /*
  * KARO TX25 board - SoC Configuration
@@ -31,8 +32,14 @@
 
 #define	CONFIG_SYS_MONITOR_LEN		(256 << 10)	/* 256 kB for U-Boot */
 
-/* NAND BOOT is the only boot method */
-#define CONFIG_NAND_U_BOOT
+#define CONFIG_SPL
+#define CONFIG_SPL_TARGET		"u-boot-with-spl.bin"
+#define CONFIG_SPL_LDSCRIPT		"arch/$(ARCH)/cpu/u-boot.lds"
+#define CONFIG_SPL_MAX_SIZE		2048
+#define CONFIG_SPL_NAND_SUPPORT
+
+#define CONFIG_SPL_TEXT_BASE		0x810c0000
+#define CONFIG_SYS_TEXT_BASE		0x81200000
 
 #ifndef MACH_TYPE_TX25
 #define MACH_TYPE_TX25	2177
@@ -40,16 +47,16 @@
 
 #define CONFIG_MACH_TYPE MACH_TYPE_TX25
 
-#ifdef CONFIG_NAND_SPL
+#ifdef CONFIG_SPL_BUILD
 /* Start copying real U-boot from the second page */
-#define CONFIG_SYS_NAND_U_BOOT_OFFS	0x800
+#define CONFIG_SYS_NAND_U_BOOT_OFFS	CONFIG_SPL_PAD_TO
 #define CONFIG_SYS_NAND_U_BOOT_SIZE	0x30000
 
-#define CONFIG_SYS_NAND_U_BOOT_DST      (0x81200000)
+#define CONFIG_SYS_NAND_U_BOOT_DST      CONFIG_SYS_TEXT_BASE
 #define CONFIG_SYS_NAND_U_BOOT_START    CONFIG_SYS_NAND_U_BOOT_DST
 
 #define CONFIG_SYS_NAND_PAGE_SIZE	2048
-#define CONFIG_SYS_NAND_SPARE_SIZE	64
+#define CONFIG_SYS_NAND_OOBSIZE		64
 #define CONFIG_SYS_NAND_BLOCK_SIZE	(128 * 1024)
 #define CONFIG_SYS_NAND_PAGE_COUNT	64
 #define CONFIG_SYS_NAND_SIZE		(128 * 1024 * 1024)
@@ -173,7 +180,6 @@
 
 /* additions for new relocation code, must be added to all boards */
 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
-#define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \
-					GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_INIT_SP_ADDR		(IMX_RAM_BASE + IMX_RAM_SIZE)
 
 #endif /* __CONFIG_H */
nand_spl/board/freescale/mx31pdk/Makefile deleted +0 -68

68 lines not on this page · raw message

nand_spl/board/freescale/mx31pdk/u-boot.lds deleted +0 -87

87 lines not on this page · raw message

nand_spl/board/karo/tx25/Makefile deleted +0 -89

89 lines not on this page · raw message

nand_spl/board/karo/tx25/config.mk deleted +0 -1
deleted file mode 100644
index 68afbf1..0000000
@@ -1 +0,0 @@
-PAD_TO	:= 2048
nand_spl/board/karo/tx25/u-boot.lds deleted +0 -87

87 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#25 lore raw

PATCH v8 19/31 arm926ejs: Remove deprecated and now unused NAND SPL

In reply to Benoît Thébaudeau

---
Changes in v8: None
Changes in v7: None
Changes in v6:
- New patch.

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/cpu/arm926ejs/start.S |   10 ----------
 1 file changed, 10 deletions(-)
arch/arm/cpu/arm926ejs/start.S +0 -10
index 9121af2..fd2803e 100644
@@ -120,15 +120,11 @@ _fiq:
 
 .globl _TEXT_BASE
 _TEXT_BASE:
-#ifdef CONFIG_NAND_SPL /* deprecated, use instead CONFIG_SPL_BUILD */
-	.word	CONFIG_SYS_TEXT_BASE
-#else
 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
 	.word	CONFIG_SPL_TEXT_BASE
 #else
 	.word	CONFIG_SYS_TEXT_BASE
 #endif
-#endif
 
 /*
  * These are defined in the board-specific linker script.
@@ -152,12 +148,6 @@ _bss_end_ofs:
 _end_ofs:
 	.word _end - _start
 
-#ifdef CONFIG_NAND_U_BOOT
-.globl _end
-_end:
-	.word __bss_end__
-#endif
-
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
Signature · 1 line
1.7.10.4
#26 lore raw

PATCH v8 20/31 arm: Remove unused relocate_code() parameters

In reply to Benoît Thébaudeau

Commit e05e5de7fae5bec79617e113916dac6631251156 made the 2 1st parameters of ARM's relocate_code() useless since it moved the code handling them to crt0.S. So, drop these parameters.

---
Changes in v8:
- Update the function prototype in start.S comments.

Changes in v7: None
Changes in v6:
- New patch.

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/cpu/arm1136/start.S               |    6 ++----
 arch/arm/cpu/arm1176/start.S               |    6 ++----
 arch/arm/cpu/arm720t/start.S               |    6 ++----
 arch/arm/cpu/arm920t/start.S               |    6 ++----
 arch/arm/cpu/arm925t/start.S               |    6 ++----
 arch/arm/cpu/arm926ejs/start.S             |    6 ++----
 arch/arm/cpu/arm946es/start.S              |    6 ++----
 arch/arm/cpu/arm_intcm/start.S             |    6 ++----
 arch/arm/cpu/armv7/start.S                 |    6 ++----
 arch/arm/cpu/ixp/start.S                   |    6 ++----
 arch/arm/cpu/pxa/start.S                   |    6 ++----
 arch/arm/cpu/s3c44b0/start.S               |    6 ++----
 arch/arm/cpu/sa1100/start.S                |    6 ++----
 arch/arm/lib/crt0.S                        |    8 +++-----
 board/freescale/mx31pdk/mx31pdk.c          |    2 +-
 board/karo/tx25/tx25.c                     |    2 +-
 board/samsung/smdk6400/smdk6400_nand_spl.c |    3 +--
 include/common.h                           |    8 ++++----
 18 files changed, 36 insertions(+), 65 deletions(-)
arch/arm/cpu/arm1136/start.S +2 -4
index b3e3e37..eb11b69 100644
@@ -174,15 +174,13 @@ next:
 /*------------------------------------------------------------------------------*/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_moni)
  *
  * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
-	mov	r4, r0	/* save addr_sp */
-	mov	r5, r1	/* save addr of gd */
-	mov	r6, r2	/* save addr of destination */
+	mov	r6, r0	/* save addr of destination */
 
 	adr	r0, _start
 	subs	r9, r6, r0		/* r9 <- relocation offset */
arch/arm/cpu/arm1176/start.S +2 -4
index 4f98f8b..97d347c 100644
@@ -241,15 +241,13 @@ skip_tcmdisable:
 /*------------------------------------------------------------------------------*/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_moni)
  *
  * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
-	mov	r4, r0	/* save addr_sp */
-	mov	r5, r1	/* save addr of gd */
-	mov	r6, r2	/* save addr of destination */
+	mov	r6, r0	/* save addr of destination */
 
 	adr	r0, _start
 	subs	r9, r6, r0		/* r9 <- relocation offset */
arch/arm/cpu/arm720t/start.S +2 -4
index 850fce0..d455793 100644
@@ -156,15 +156,13 @@ reset:
 /*------------------------------------------------------------------------------*/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_moni)
  *
  * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
-	mov	r4, r0	/* save addr_sp */
-	mov	r5, r1	/* save addr of gd */
-	mov	r6, r2	/* save addr of destination */
+	mov	r6, r0	/* save addr of destination */
 
 	adr	r0, _start
 	subs	r9, r6, r0		/* r9 <- relocation offset */
arch/arm/cpu/arm920t/start.S +2 -4
index e2958d3..a6cb33f 100644
@@ -195,15 +195,13 @@ copyex:
 /*------------------------------------------------------------------------------*/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_moni)
  *
  * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
-	mov	r4, r0	/* save addr_sp */
-	mov	r5, r1	/* save addr of gd */
-	mov	r6, r2	/* save addr of destination */
+	mov	r6, r0	/* save addr of destination */
 
 	adr	r0, _start
 	subs	r9, r6, r0		/* r9 <- relocation offset */
arch/arm/cpu/arm925t/start.S +2 -4
index 4b64122..78d5ab4 100644
@@ -185,15 +185,13 @@ poll1:
 /*------------------------------------------------------------------------------*/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_moni)
  *
  * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
-	mov	r4, r0	/* save addr_sp */
-	mov	r5, r1	/* save addr of gd */
-	mov	r6, r2	/* save addr of destination */
+	mov	r6, r0	/* save addr of destination */
 
 	adr	r0, _start
 	subs	r9, r6, r0		/* r9 <- relocation offset */
arch/arm/cpu/arm926ejs/start.S +2 -4
index fd2803e..863eb8e 100644
@@ -191,15 +191,13 @@ reset:
 /*------------------------------------------------------------------------------*/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_moni)
  *
  * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
-	mov	r4, r0	/* save addr_sp */
-	mov	r5, r1	/* save addr of gd */
-	mov	r6, r2	/* save addr of destination */
+	mov	r6, r0	/* save addr of destination */
 
 	adr	r0, _start
 	subs	r9, r6, r0		/* r9 <- relocation offset */
arch/arm/cpu/arm946es/start.S +2 -4
index 48b7b62..cc8158d 100644
@@ -160,15 +160,13 @@ reset:
 /*------------------------------------------------------------------------------*/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_moni)
  *
  * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
-	mov	r4, r0	/* save addr_sp */
-	mov	r5, r1	/* save addr of gd */
-	mov	r6, r2	/* save addr of destination */
+	mov	r6, r0	/* save addr of destination */
 
 	adr	r0, _start
 	subs	r9, r6, r0		/* r9 <- relocation offset */
arch/arm/cpu/arm_intcm/start.S +2 -4
index 5016c3c..8965d5f 100644
@@ -156,15 +156,13 @@ reset:
 /*------------------------------------------------------------------------------*/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_moni)
  *
  * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
-	mov	r4, r0	/* save addr_sp */
-	mov	r5, r1	/* save addr of gd */
-	mov	r6, r2	/* save addr of destination */
+	mov	r6, r0	/* save addr of destination */
 
 	adr	r0, _start
 	subs	r9, r6, r0		/* r9 <- relocation offset */
arch/arm/cpu/armv7/start.S +2 -4
index cc68347..d1b7d33 100644
@@ -165,14 +165,12 @@ reset:
 
 #ifndef CONFIG_SPL_BUILD
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_moni)
  *
  * This function relocates the monitor code.
  */
 ENTRY(relocate_code)
-	mov	r4, r0	/* save addr_sp */
-	mov	r5, r1	/* save addr of gd */
-	mov	r6, r2	/* save addr of destination */
+	mov	r6, r0	/* save addr of destination */
 
 	adr	r0, _start
 	subs	r9, r6, r0		/* r9 <- relocation offset */
arch/arm/cpu/ixp/start.S +2 -4
index f6bec3b..d986c31 100644
@@ -258,15 +258,13 @@ reset:
 /*------------------------------------------------------------------------------*/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_moni)
  *
  * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
-	mov	r4, r0	/* save addr_sp */
-	mov	r5, r1	/* save addr of gd */
-	mov	r6, r2	/* save addr of destination */
+	mov	r6, r0	/* save addr of destination */
 
 	adr	r0, _start
 	subs	r9, r6, r0		/* r9 <- relocation offset */
arch/arm/cpu/pxa/start.S +2 -4
index 8c64411..3523331 100644
@@ -173,15 +173,13 @@ reset:
 /*------------------------------------------------------------------------------*/
 #ifndef CONFIG_SPL_BUILD
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_moni)
  *
  * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
-	mov	r4, r0	/* save addr_sp */
-	mov	r5, r1	/* save addr of gd */
-	mov	r6, r2	/* save addr of destination */
+	mov	r6, r0	/* save addr of destination */
 
 /* Disable the Dcache RAM lock for stack now */
 #ifdef	CONFIG_CPU_PXA25X
arch/arm/cpu/s3c44b0/start.S +2 -4
index 0924925..62093ed 100644
@@ -141,15 +141,13 @@ reset:
 /*------------------------------------------------------------------------------*/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_moni)
  *
  * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
-	mov	r4, r0	/* save addr_sp */
-	mov	r5, r1	/* save addr of gd */
-	mov	r6, r2	/* save addr of destination */
+	mov	r6, r0	/* save addr of destination */
 
 	adr	r0, _start
 	subs	r9, r6, r0		/* r9 <- relocation offset */
arch/arm/cpu/sa1100/start.S +2 -4
index fe6c429..207c190 100644
@@ -145,15 +145,13 @@ reset:
 /*------------------------------------------------------------------------------*/
 
 /*
- * void relocate_code (addr_sp, gd, addr_moni)
+ * void relocate_code(addr_moni)
  *
  * This function relocates the monitor code.
  */
 	.globl	relocate_code
 relocate_code:
-	mov	r4, r0	/* save addr_sp */
-	mov	r5, r1	/* save addr of gd */
-	mov	r6, r2	/* save addr of destination */
+	mov	r6, r0	/* save addr of destination */
 
 	adr	r0, _start
 	subs	r9, r6, r0		/* r9 <- relocation offset */
arch/arm/lib/crt0.S +3 -5
index 56b433e..7950469 100644
@@ -96,8 +96,8 @@ ENTRY(_main)
 
 /*
  * Set up intermediate environment (new sp and gd) and call
- * relocate_code(addr_sp, gd, addr_moni). Trick here is that
- * we'll return 'here' but relocated.
+ * relocate_code(addr_moni). Trick here is that we'll return
+ * 'here' but relocated.
  */
 
 	ldr	sp, [r8, #GD_START_ADDR_SP]	/* r8 = gd->start_addr_sp */
@@ -108,9 +108,7 @@ ENTRY(_main)
 	adr	lr, here
 	ldr	r0, [r8, #GD_RELOC_OFF]		/* lr = gd->start_addr_sp */
 	add	lr, lr, r0
-	ldr	r0, [r8, #GD_START_ADDR_SP]	/* r0 = gd->start_addr_sp */
-	mov	r1, r8				/* r1 = gd */
-	ldr	r2, [r8, #GD_RELOCADDR]		/* r2 = gd->relocaddr */
+	ldr	r0, [r8, #GD_RELOCADDR]		/* r0 = gd->relocaddr */
 	b	relocate_code
 here:
 
board/freescale/mx31pdk/mx31pdk.c +1 -1
index 3d0d419..49158bd 100644
@@ -39,7 +39,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #ifdef CONFIG_SPL_BUILD
 void board_init_f(ulong bootflag)
 {
-	relocate_code(0, NULL, CONFIG_SPL_TEXT_BASE);
+	relocate_code(CONFIG_SPL_TEXT_BASE);
 	asm volatile("ldr pc, =nand_boot");
 }
 #endif
board/karo/tx25/tx25.c +1 -1
index 69ee590..85719a0 100644
@@ -36,7 +36,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #ifdef CONFIG_SPL_BUILD
 void board_init_f(ulong bootflag)
 {
-	relocate_code(0, NULL, CONFIG_SPL_TEXT_BASE);
+	relocate_code(CONFIG_SPL_TEXT_BASE);
 	asm volatile("ldr pc, =nand_boot");
 }
 #endif
board/samsung/smdk6400/smdk6400_nand_spl.c +1 -2
index a023284..26a6146 100644
@@ -32,6 +32,5 @@
 
 void board_init_f(unsigned long bootflag)
 {
-	relocate_code(CONFIG_SYS_TEXT_BASE - TOTAL_MALLOC_LEN, NULL,
-			CONFIG_SYS_TEXT_BASE);
+	relocate_code(CONFIG_SYS_TEXT_BASE);
 }
include/common.h +4 -4
index 691e279..3d643a6 100644
@@ -515,11 +515,11 @@ int	dcache_status (void);
 void	dcache_enable (void);
 void	dcache_disable(void);
 void	mmu_disable(void);
-void	relocate_code(ulong, gd_t *, ulong)
-#if !defined(CONFIG_ARM)
-__attribute__ ((noreturn))
+#if defined(CONFIG_ARM)
+void	relocate_code(ulong);
+#else
+void	relocate_code(ulong, gd_t *, ulong) __attribute__ ((noreturn));
 #endif
-;
 ulong	get_endaddr   (void);
 void	trap_init     (ulong);
 #if defined (CONFIG_4xx)	|| \
Signature · 1 line
1.7.10.4
#27 lore raw

PATCH v8 21/31 Makefile: Move SHELL setup to config.mk

In reply to Benoît Thébaudeau

make never uses the SHELL variable from the environment. Instead, it uses /bin/sh, or the value assigned to the SHELL variable by the Makefile. This makes the export of the SHELL variable useless for sub-makes (but still useful for the environment of recipes). However, we want all makes to use the same shell.

This patch fixes this issue by moving the SHELL variable setup and export to the top config.mk, so that all Makefile-s including it use the same shell.

Since BASH is used by default, this makes it possible to use things like 'echo -e ...' in sub-makes, which would otherwise fail e.g. with /bin/sh symlinked to /bin/dash on Ubuntu.

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 Makefile  |    7 +------
 config.mk |    7 +++++++
 2 files changed, 8 insertions(+), 6 deletions(-)
Makefile +1 -6
index 5bcc914..b1f0ff0 100644
@@ -46,12 +46,7 @@ HOSTARCH := $(shell uname -m | \
 HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
 	    sed -e 's/\(cygwin\).*/cygwin/')
 
-# Set shell to bash if possible, otherwise fall back to sh
-SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
-	else if [ -x /bin/bash ]; then echo /bin/bash; \
-	else echo sh; fi; fi)
-
-export	HOSTARCH HOSTOS SHELL
+export	HOSTARCH HOSTOS
 
 # Deal with colliding definitions from tcsh etc.
 VENDOR=
config.mk +7 -0
index b7cd481..21c0844 100644
@@ -23,6 +23,13 @@
 
 #########################################################################
 
+# Set shell to bash if possible, otherwise fall back to sh
+SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
+	else if [ -x /bin/bash ]; then echo /bin/bash; \
+	else echo sh; fi; fi)
+
+export	SHELL
+
 include $(TOPDIR)/helper.mk
 
 ifeq ($(CURDIR),$(SRCTREE))
Signature · 1 line
1.7.10.4
#28 lore raw

PATCH v8 21/31 Makefile: Move SHELL setup to config.mk

Quoted 6 lines · Beno??t Th??baudeau

make never uses the SHELL variable from the environment. Instead, it uses /bin/sh, or the value assigned to the SHELL variable by the Makefile. This makes the export of the SHELL variable useless for sub-makes (but still useful for the environment of recipes). However, we want all makes to use the same shell.

Quoted 8 lines

This patch fixes this issue by moving the SHELL variable setup and export to the top config.mk, so that all Makefile-s including it use the same shell.

Since BASH is used by default, this makes it possible to use things like 'echo -e ...' in sub-makes, which would otherwise fail e.g. with /bin/sh symlinked to /bin/dash on Ubuntu.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130301/3081fc8a/attachment.pgp>
#29 lore raw

PATCH v8 22/31 .gitignore: Add /SPL

In reply to Benoît Thébaudeau

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 .gitignore |    1 +
 1 file changed, 1 insertion(+)
.gitignore +1 -0
index e40eb7b..a803651 100644
@@ -25,6 +25,7 @@
 #
 
 /MLO
+/SPL
 /System.map
 /u-boot
 /u-boot.hex
Signature · 1 line
1.7.10.4
#30 lore raw

PATCH v8 23/31 imx: Add u-boot-with-spl.imx make target

In reply to Benoît Thébaudeau

This image combines the SPL with the i.MX header and U-Boot. This is a convenient way of having a single image to program on some boot devices.

The i.MX header has to be added to the SPL before appending U-Boot, so that the boot ROM loads only the SPL.

---
Changes in v8:
- Use CONFIG_SPL_PAD_TO instead of CONFIG_SPL_MAX_SIZE for padding, which allows to pad the SPL after adding the i.MX header, which may save time when the boot ROM loads the SPL.
- Add /u-boot-with-spl.imx to .gitignore.

Changes in v7:
- New patch.

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 .gitignore                   |    1 +
 Makefile                     |    5 +++++
 arch/arm/imx-common/Makefile |    6 ++++++
 3 files changed, 12 insertions(+)
.gitignore +1 -0
index a803651..1d07fec 100644
@@ -30,6 +30,7 @@
 /u-boot
 /u-boot.hex
 /u-boot.imx
+/u-boot-with-spl.imx
 /u-boot.map
 /u-boot.srec
 /u-boot.ldr
Makefile +5 -0
index b1f0ff0..38f2ca5 100644
@@ -484,6 +484,10 @@ $(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@
 		rm $(obj)spl/u-boot-spl-pad.bin
 
+$(obj)u-boot-with-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+		$(MAKE) -C $(SRCTREE)/arch/arm/imx-common \
+			$(OBJTREE)/u-boot-with-spl.imx
+
 $(obj)u-boot.ubl:       $(obj)u-boot-with-spl.bin
 		$(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
 		-e $(CONFIG_SYS_TEXT_BASE) -d $< $(obj)u-boot.ubl
@@ -855,6 +859,7 @@ clobber:	tidy
 	@rm -f $(obj)u-boot.kwb
 	@rm -f $(obj)u-boot.pbl
 	@rm -f $(obj)u-boot.imx
+	@rm -f $(obj)u-boot-with-spl.imx
 	@rm -f $(obj)u-boot.ubl
 	@rm -f $(obj)u-boot.ais
 	@rm -f $(obj)u-boot.dtb
arch/arm/imx-common/Makefile +6 -0
index 6309fcd..2ce182d 100644
@@ -54,6 +54,12 @@ $(OBJTREE)/SPL: $(OBJTREE)/spl/u-boot-spl.bin $(OBJTREE)/$(patsubst "%",%,$(CONF
 	$(OBJTREE)/tools/mkimage -n $(filter-out %.bin,$^) -T imximage \
 	-e $(CONFIG_SPL_TEXT_BASE) -d $< $@
 
+$(OBJTREE)/u-boot-with-spl.imx: $(OBJTREE)/SPL $(OBJTREE)/u-boot.bin
+	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SPL_PAD_TO) \
+		-I binary -O binary $< $(OBJTREE)/spl/u-boot-spl-pad.imx
+	cat $(OBJTREE)/spl/u-boot-spl-pad.imx $(OBJTREE)/u-boot.bin > $@
+	rm $(OBJTREE)/spl/u-boot-spl-pad.imx
+
 
 #########################################################################
 
Signature · 1 line
1.7.10.4
#31 lore raw

PATCH v8 24/31 imx: Add u-boot-with-nand-spl.imx make target

In reply to Benoît Thébaudeau

This image combines the SPL with the i.MX header, the FCB and U-Boot.

For i.MX25/35/51, the FCB is ignored by the boot ROM, so this image is just useful because it can be programmed on a NAND Flash page boundary.

For i.MX53, the FCB is required by the boot ROM.

This does not support i.MX6 so far because its FCB is more complicated.

---
Changes in v8:
- Change the dummy 1024-byte header into a true FCB in order to add support for i.MX53.
- Use CONFIG_SPL_PAD_TO instead of CONFIG_SPL_MAX_SIZE for padding, which allows to pad the SPL after adding the i.MX header and the FCB, which may save time when the boot ROM loads the SPL.
- Add /u-boot-with-nand-spl.imx to .gitignore.

Changes in v7:
- New patch.

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 .gitignore                   |    1 +
 Makefile                     |    5 +++++
 arch/arm/imx-common/Makefile |   11 +++++++++++
 3 files changed, 17 insertions(+)
.gitignore +1 -0
index 1d07fec..c991631 100644
@@ -31,6 +31,7 @@
 /u-boot.hex
 /u-boot.imx
 /u-boot-with-spl.imx
+/u-boot-with-nand-spl.imx
 /u-boot.map
 /u-boot.srec
 /u-boot.ldr
Makefile +5 -0
index 38f2ca5..0069c86 100644
@@ -488,6 +488,10 @@ $(obj)u-boot-with-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 		$(MAKE) -C $(SRCTREE)/arch/arm/imx-common \
 			$(OBJTREE)/u-boot-with-spl.imx
 
+$(obj)u-boot-with-nand-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+		$(MAKE) -C $(SRCTREE)/arch/arm/imx-common \
+			$(OBJTREE)/u-boot-with-nand-spl.imx
+
 $(obj)u-boot.ubl:       $(obj)u-boot-with-spl.bin
 		$(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
 		-e $(CONFIG_SYS_TEXT_BASE) -d $< $(obj)u-boot.ubl
@@ -860,6 +864,7 @@ clobber:	tidy
 	@rm -f $(obj)u-boot.pbl
 	@rm -f $(obj)u-boot.imx
 	@rm -f $(obj)u-boot-with-spl.imx
+	@rm -f $(obj)u-boot-with-nand-spl.imx
 	@rm -f $(obj)u-boot.ubl
 	@rm -f $(obj)u-boot.ais
 	@rm -f $(obj)u-boot.dtb
arch/arm/imx-common/Makefile +11 -0
index 2ce182d..d54dbee 100644
@@ -60,6 +60,17 @@ $(OBJTREE)/u-boot-with-spl.imx: $(OBJTREE)/SPL $(OBJTREE)/u-boot.bin
 	cat $(OBJTREE)/spl/u-boot-spl-pad.imx $(OBJTREE)/u-boot.bin > $@
 	rm $(OBJTREE)/spl/u-boot-spl-pad.imx
 
+$(OBJTREE)/u-boot-with-nand-spl.imx: $(OBJTREE)/SPL $(OBJTREE)/u-boot.bin
+	(echo -ne '\x00\x00\x00\x00\x46\x43\x42\x20\x01' && \
+			dd bs=1015 count=1 if=/dev/zero 2>/dev/null) | \
+		cat - $< > $(OBJTREE)/spl/u-boot-nand-spl.imx
+	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SPL_PAD_TO) \
+		-I binary -O binary $(OBJTREE)/spl/u-boot-nand-spl.imx \
+		$(OBJTREE)/spl/u-boot-nand-spl-pad.imx
+	rm $(OBJTREE)/spl/u-boot-nand-spl.imx
+	cat $(OBJTREE)/spl/u-boot-nand-spl-pad.imx $(OBJTREE)/u-boot.bin > $@
+	rm $(OBJTREE)/spl/u-boot-nand-spl-pad.imx
+
 
 #########################################################################
 
Signature · 1 line
1.7.10.4
#32 lore raw

PATCH v8 25/31 arm: Remove support for smdk6400

In reply to Benoît Thébaudeau

The migration of boards from Makefile to boards.cfg was due for v2012.03, but smdk6400 did not follow, and it does not build, so move it to scrapyard. It will still be possible to restore it from the Git history before fixing it.

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 MAINTAINERS                                |    4 -
 Makefile                                   |   17 --
 arch/arm/include/asm/mach-types.h          |   13 --
 board/samsung/smdk6400/.gitignore          |    5 -
 board/samsung/smdk6400/Makefile            |   48 -----
 board/samsung/smdk6400/config.mk           |   30 ---
 board/samsung/smdk6400/lowlevel_init.S     |  323 ----------------------------
 board/samsung/smdk6400/smdk6400.c          |  134 ------------
 board/samsung/smdk6400/smdk6400_nand_spl.c |   36 ----
 board/samsung/smdk6400/u-boot-nand.lds     |   90 --------
 doc/README.scrapyard                       |    1 +
 include/configs/smdk6400.h                 |  296 -------------------------
 nand_spl/board/samsung/smdk6400/Makefile   |  117 ----------
 nand_spl/board/samsung/smdk6400/config.mk  |   40 ----
 nand_spl/board/samsung/smdk6400/u-boot.lds |   82 -------
 15 files changed, 1 insertion(+), 1235 deletions(-)
 delete mode 100644 board/samsung/smdk6400/.gitignore
 delete mode 100644 board/samsung/smdk6400/Makefile
 delete mode 100644 board/samsung/smdk6400/config.mk
 delete mode 100644 board/samsung/smdk6400/lowlevel_init.S
 delete mode 100644 board/samsung/smdk6400/smdk6400.c
 delete mode 100644 board/samsung/smdk6400/smdk6400_nand_spl.c
 delete mode 100644 board/samsung/smdk6400/u-boot-nand.lds
 delete mode 100644 include/configs/smdk6400.h
 delete mode 100644 nand_spl/board/samsung/smdk6400/Makefile
 delete mode 100644 nand_spl/board/samsung/smdk6400/config.mk
 delete mode 100644 nand_spl/board/samsung/smdk6400/u-boot.lds
MAINTAINERS +0 -4
index 175bbe2..b7b3f0f 100644
@@ -1020,10 +1020,6 @@ Vladimir Zapolskiy <[email protected]>
 
 	devkit3250	lpc32xx
 
-Zhong Hongbo <[email protected]>
-
-	SMDK6400	ARM1176 (S3C6400 SoC)
-
 Nobuhiro Iwamatsu <[email protected]>
 Tetsuyuki Kobayashi <[email protected]>
 
Makefile +0 -17
index 0069c86..f09021b 100644
@@ -788,23 +788,6 @@ lcname	= $(shell echo $(1) | sed -e 's/\(.*\)_config/\L\1/')
 ucname	= $(shell echo $(1) | sed -e 's/\(.*\)_config/\U\1/')
 
 #########################################################################
-## ARM1176 Systems
-#########################################################################
-smdk6400_noUSB_config	\
-smdk6400_config	:	unconfig
-	@mkdir -p $(obj)include $(obj)board/samsung/smdk6400
-	@mkdir -p $(obj)nand_spl/board/samsung/smdk6400
-	@echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h
-	@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
-	@if [ -z "$(findstring smdk6400_noUSB_config,$@)" ]; then			\
-		echo "RAM_TEXT = 0x57e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\
-	else										\
-		echo "RAM_TEXT = 0xc7e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\
-	fi
-	@$(MKCONFIG) smdk6400 arm arm1176 smdk6400 samsung s3c64xx
-	@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
-
-#########################################################################
 #########################################################################
 
 clean:
arch/arm/include/asm/mach-types.h +0 -13
index a676b6d..440b041 100644
@@ -223,7 +223,6 @@ extern unsigned int __machine_arch_type;
 #define MACH_TYPE_MIOA701              1257
 #define MACH_TYPE_ARMADILLO5X0         1260
 #define MACH_TYPE_CC9P9360JS           1264
-#define MACH_TYPE_SMDK6400             1270
 #define MACH_TYPE_NOKIA_N800           1271
 #define MACH_TYPE_EP80219              1281
 #define MACH_TYPE_GORAMO_MLR           1292
@@ -3640,18 +3639,6 @@ extern unsigned int __machine_arch_type;
 # define machine_is_cc9p9360js()	(0)
 #endif
 
-#ifdef CONFIG_MACH_SMDK6400
-# ifdef machine_arch_type
-#  undef machine_arch_type
-#  define machine_arch_type	__machine_arch_type
-# else
-#  define machine_arch_type	MACH_TYPE_SMDK6400
-# endif
-# define machine_is_smdk6400()	(machine_arch_type == MACH_TYPE_SMDK6400)
-#else
-# define machine_is_smdk6400()	(0)
-#endif
-
 #ifdef CONFIG_MACH_NOKIA_N800
 # ifdef machine_arch_type
 #  undef machine_arch_type
board/samsung/smdk6400/.gitignore deleted +0 -5
deleted file mode 100644
index 25ab492..0000000
@@ -1,5 +0,0 @@
-#
-# Generated files
-#
-
-/config.tmp
board/samsung/smdk6400/Makefile deleted +0 -48

48 lines not on this page · raw message

board/samsung/smdk6400/config.mk deleted +0 -30
deleted file mode 100644
index 6f04c2f..0000000
@@ -1,30 +0,0 @@
-#
-# (C) Copyright 2002
-# Gary Jennejohn, DENX Software Engineering, <[email protected]>
-# David Mueller, ELSOFT AG, <[email protected]>
-#
-# (C) Copyright 2008
-# Guennadi Liakhovetki, DENX Software Engineering, <[email protected]>
-#
-# SAMSUNG SMDK6400 board with mDirac3 (ARM1176) cpu
-#
-# see http://www.samsung.com/ for more information on SAMSUNG
-
-# On SMDK6400 we use the 64 MB SDRAM bank at
-#
-# 0x50000000 to 0x58000000
-#
-# Linux-Kernel is expected to be at 0x50008000, entry 0x50008000
-#
-# we load ourselves to 0x57e00000 without MMU
-# with MMU, load address is changed to 0xc7e00000
-#
-# download area is 0x5000c000
-
-sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
-
-ifndef CONFIG_NAND_SPL
-CONFIG_SYS_TEXT_BASE = $(RAM_TEXT)
-else
-CONFIG_SYS_TEXT_BASE = 0
-endif
board/samsung/smdk6400/lowlevel_init.S deleted +0 -323

323 lines not on this page · raw message

board/samsung/smdk6400/smdk6400.c deleted +0 -134

134 lines not on this page · raw message

board/samsung/smdk6400/smdk6400_nand_spl.c deleted +0 -36
deleted file mode 100644
index 26a6146..0000000
@@ -1,36 +0,0 @@
-/*
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <[email protected]>
- *
- * (C) Copyright 2002
- * David Mueller, ELSOFT AG, <[email protected]>
- *
- * (C) Copyright 2008
- * Guennadi Liakhovetki, DENX Software Engineering, <[email protected]>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-
-void board_init_f(unsigned long bootflag)
-{
-	relocate_code(CONFIG_SYS_TEXT_BASE);
-}
board/samsung/smdk6400/u-boot-nand.lds deleted +0 -90

90 lines not on this page · raw message

doc/README.scrapyard +1 -0
index 2b868e6..b3a445f 100644
@@ -11,6 +11,7 @@ easily if here is something they might want to dig for...
 
 Board	Arch	CPU	removed	    Commit	last known maintainer/contact
 =============================================================================
+smdk6400 arm	arm1176	-	  -		Zhong Hongbo <[email protected]>
 AMX860	powerpc	mpc860	-	  -		Wolfgang Denk <[email protected]>
 c2mon	powerpc	mpc855	-	  -		Wolfgang Denk <[email protected]>
 ETX094	powerpc	mpc850	-	  -		Wolfgang Denk <[email protected]>
include/configs/smdk6400.h deleted +0 -296

296 lines not on this page · raw message

nand_spl/board/samsung/smdk6400/Makefile deleted +0 -117

117 lines not on this page · raw message

nand_spl/board/samsung/smdk6400/config.mk deleted +0 -40
deleted file mode 100644
index 8bea498..0000000
@@ -1,40 +0,0 @@
-#
-# (C) Copyright 2006
-# Stefan Roese, DENX Software Engineering, sr at denx.de.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-#
-# Samsung S3C64xx Reference Platform (smdk6400) board
-
-# CONFIG_SYS_TEXT_BASE for SPL:
-#
-# On S3C64xx platforms the SPL is located in SRAM@0.
-#
-# CONFIG_SYS_TEXT_BASE = 0
-
-include $(TOPDIR)/board/$(BOARDDIR)/config.mk
-
-# PAD_TO used to generate a 4kByte binary needed for the combined image
-# -> PAD_TO = CONFIG_SYS_TEXT_BASE + 4096
-PAD_TO	:= $(shell expr $$[$(CONFIG_SYS_TEXT_BASE) + 4096])
-
-ifeq ($(debug),1)
-PLATFORM_CPPFLAGS += -DDEBUG
-endif
nand_spl/board/samsung/smdk6400/u-boot.lds deleted +0 -82

82 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#33 lore raw

PATCH v8 26/31 Revert "mkconfig: start deprecating Makefile config targets"

In reply to Benoît Thébaudeau

This reverts commit 1285a2808a254f3d1a809c1a541f0c0f746e03d7 since the migration of boards from Makefile to boards.cfg is now complete.

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 doc/feature-removal-schedule.txt |   16 ----------------
 mkconfig                         |    9 ---------
 2 files changed, 25 deletions(-)
doc/feature-removal-schedule.txt +0 -16
index e04ba2d..6abb7d1 100644
@@ -18,22 +18,6 @@ Who:	Andy Fleming <[email protected]> and driver maintainers
 
 ---------------------------
 
-What:	boards with xxx_config targets in top level Makefile
-When:	Release v2012.03
-
-Why:	We have a boards.cfg file which the vast majority of boards have
-	converted over to.  Boards that still manually run mkconfig in the
-	top level Makefile are either dead, or the maintainer doesn't care,
-	or they are doing something weird/wrong that should be fixed in a
-	different way, or they need to extend boards.cfg syntax (unlikely).
-
-	In any case, if no one cares about these boards to figure out how
-	to make boards.cfg work, then we'll just punt them.
-
-Who:	Mike Frysinger <[email protected]>
-
----------------------------
-
 What:	GPL cleanup
 When:	August 2009
 Why:	Over time, a couple of files have sneaked in into the U-Boot
mkconfig +0 -9
index 7c9aa74..73f852e 100755
@@ -29,15 +29,6 @@ if [ \( $# -eq 2 \) -a \( "$1" = "-A" \) ] ; then
 	set ${line}
 	# add default board name if needed
 	[ $# = 3 ] && set ${line} ${1}
-elif [ "${MAKEFLAGS+set}${MAKELEVEL+set}" = "setset" ] ; then
-	# only warn when using a config target in the Makefile
-	cat <<-EOF
-
-	warning: Please migrate to boards.cfg.  Failure to do so will
-	         mean removal of your board in the next release.
-
-	EOF
-	sleep 5
 fi
 
 while [ $# -gt 0 ] ; do
Signature · 1 line
1.7.10.4
#34 lore raw

PATCH v8 27/31 arm: Remove support for unused s3c64xx

In reply to Benoît Thébaudeau

Following the removal of the smdk6400 board, the s3c64xx SoC becomes unused, so move it to scrapyard. It will still be possible to restore it later from the Git history if necessary.

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/cpu/arm1176/s3c64xx/Makefile        |   50 --
 arch/arm/cpu/arm1176/s3c64xx/config.mk       |   34 -
 arch/arm/cpu/arm1176/s3c64xx/cpu_init.S      |  135 ----
 arch/arm/cpu/arm1176/s3c64xx/init.c          |   26 -
 arch/arm/cpu/arm1176/s3c64xx/reset.S         |   34 -
 arch/arm/cpu/arm1176/s3c64xx/speed.c         |  145 -----
 arch/arm/cpu/arm1176/s3c64xx/timer.c         |  160 -----
 arch/arm/include/asm/arch-s3c64xx/hardware.h |   63 --
 arch/arm/include/asm/arch-s3c64xx/s3c6400.h  |  895 --------------------------
 arch/arm/include/asm/arch-s3c64xx/s3c64x0.h  |   90 ---
 doc/driver-model/UDM-serial.txt              |   42 +-
 drivers/mtd/nand/Makefile                    |    1 -
 drivers/mtd/nand/s3c64xx.c                   |  295 ---------
 drivers/mtd/onenand/onenand_base.c           |    4 -
 drivers/mtd/onenand/samsung.c                |   60 +-
 drivers/serial/Makefile                      |    1 -
 drivers/serial/s3c64xx.c                     |  187 ------
 drivers/serial/serial.c                      |    2 -
 drivers/usb/host/Makefile                    |    1 -
 drivers/usb/host/ohci-hcd.c                  |    1 -
 drivers/usb/host/s3c64xx-hcd.c               |   45 --
 include/common.h                             |    1 -
 include/onenand_uboot.h                      |    4 -
 23 files changed, 23 insertions(+), 2253 deletions(-)
 delete mode 100644 arch/arm/cpu/arm1176/s3c64xx/Makefile
 delete mode 100644 arch/arm/cpu/arm1176/s3c64xx/config.mk
 delete mode 100644 arch/arm/cpu/arm1176/s3c64xx/cpu_init.S
 delete mode 100644 arch/arm/cpu/arm1176/s3c64xx/init.c
 delete mode 100644 arch/arm/cpu/arm1176/s3c64xx/reset.S
 delete mode 100644 arch/arm/cpu/arm1176/s3c64xx/speed.c
 delete mode 100644 arch/arm/cpu/arm1176/s3c64xx/timer.c
 delete mode 100644 arch/arm/include/asm/arch-s3c64xx/hardware.h
 delete mode 100644 arch/arm/include/asm/arch-s3c64xx/s3c6400.h
 delete mode 100644 arch/arm/include/asm/arch-s3c64xx/s3c64x0.h
 delete mode 100644 drivers/mtd/nand/s3c64xx.c
 delete mode 100644 drivers/serial/s3c64xx.c
 delete mode 100644 drivers/usb/host/s3c64xx-hcd.c
arch/arm/cpu/arm1176/s3c64xx/Makefile deleted +0 -50
deleted file mode 100644
index 266a073..0000000
@@ -1,50 +0,0 @@
-#
-# (C) Copyright 2000-2003
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-#
-# (C) Copyright 2008
-# Guennadi Liakhovetki, DENX Software Engineering, <[email protected]>
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-include $(TOPDIR)/config.mk
-
-LIB	= $(obj)lib$(SOC).o
-
-SOBJS	= reset.o
-
-COBJS-$(CONFIG_S3C6400)	+= cpu_init.o speed.o
-COBJS-y	+= timer.o init.o
-
-OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
-
-all:	$(obj).depend $(START) $(LIB)
-
-$(LIB):	$(OBJS)
-	$(call cmd_link_o_target, $(OBJS))
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
arch/arm/cpu/arm1176/s3c64xx/config.mk deleted +0 -34
deleted file mode 100644
index 222d352..0000000
@@ -1,34 +0,0 @@
-#
-# (C) Copyright 2002
-# Gary Jennejohn, DENX Software Engineering, <[email protected]>
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-PLATFORM_RELFLAGS += -fno-common -ffixed-r8 -msoft-float
-
-# Make ARMv5 to allow more compilers to work, even though its v6.
-PLATFORM_CPPFLAGS += -march=armv5t
-# =========================================================================
-#
-# Supply options according to compiler version
-#
-# =========================================================================
-PF_RELFLAGS_SLB_AT := $(call cc-option,-mshort-load-bytes,\
-			$(call cc-option,-malignment-traps,))
-PLATFORM_RELFLAGS += $(PF_RELFLAGS_SLB_AT)
arch/arm/cpu/arm1176/s3c64xx/cpu_init.S deleted +0 -135

135 lines not on this page · raw message

arch/arm/cpu/arm1176/s3c64xx/init.c deleted +0 -26
deleted file mode 100644
index f113d8e..0000000
@@ -1,26 +0,0 @@
-/*
- * (C) Copyright 2012 Ashok Kumar Reddy Kourla
- * ashokkourla2000 at gmail.com
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include<common.h>
-
-int arch_cpu_init(void)
-{
-	icache_enable();
-
-	return 0;
-}
arch/arm/cpu/arm1176/s3c64xx/reset.S deleted +0 -34
deleted file mode 100644
index eae572e..0000000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2009 Samsung Electronics.
- * Minkyu Kang <[email protected]>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <asm/arch/s3c6400.h>
-
-.globl reset_cpu
-reset_cpu:
-	ldr	r1, =ELFIN_CLOCK_POWER_BASE
-	ldr	r2, [r1, #SYS_ID_OFFSET]
-	ldr	r3, =0xffff
-	and	r2, r3, r2, lsr #12
-	str	r2, [r1, #SW_RST_OFFSET]
-_loop_forever:
-	b	_loop_forever
arch/arm/cpu/arm1176/s3c64xx/speed.c deleted +0 -145

145 lines not on this page · raw message

arch/arm/cpu/arm1176/s3c64xx/timer.c deleted +0 -160

160 lines not on this page · raw message

arch/arm/include/asm/arch-s3c64xx/hardware.h deleted +0 -63

63 lines not on this page · raw message

arch/arm/include/asm/arch-s3c64xx/s3c6400.h deleted +0 -895

895 lines not on this page · raw message

arch/arm/include/asm/arch-s3c64xx/s3c64x0.h deleted +0 -90

90 lines not on this page · raw message

doc/driver-model/UDM-serial.txt +19 -23

107 lines not on this page · raw message

drivers/mtd/nand/Makefile +0 -1
index bcb7161..35769c5 100644
@@ -73,7 +73,6 @@ COBJS-$(CONFIG_NAND_MXS) += mxs_nand.o
 COBJS-$(CONFIG_NAND_NDFC) += ndfc.o
 COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o
 COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o
-COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o
 COBJS-$(CONFIG_NAND_SPEAR) += spr_nand.o
 COBJS-$(CONFIG_TEGRA_NAND) += tegra_nand.o
 COBJS-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o
drivers/mtd/nand/s3c64xx.c deleted +0 -295

295 lines not on this page · raw message

drivers/mtd/onenand/onenand_base.c +0 -4
index 1a7b40e..858e322 100644
@@ -632,10 +632,6 @@ static int onenand_check_bufferram(struct mtd_info *mtd, loff_t addr)
 	int blockpage, found = 0;
 	unsigned int i;
 
-#ifdef CONFIG_S3C64XX
-	return 0;
-#endif
-
 	if (ONENAND_IS_2PLANE(this))
 		blockpage = onenand_get_2x_blockpage(mtd, addr);
 	else
drivers/mtd/onenand/samsung.c +4 -56

88 lines not on this page · raw message

drivers/serial/Makefile +0 -1
index 5e8b648..395ddc2 100644
@@ -36,7 +36,6 @@ COBJS-$(CONFIG_MCFUART) += mcfuart.o
 COBJS-$(CONFIG_NS9750_UART) += ns9750_serial.o
 COBJS-$(CONFIG_OPENCORES_YANU) += opencores_yanu.o
 COBJS-$(CONFIG_SYS_NS16550) += ns16550.o
-COBJS-$(CONFIG_S3C64XX) += s3c64xx.o
 COBJS-$(CONFIG_S5P) += serial_s5p.o
 COBJS-$(CONFIG_SYS_NS16550_SERIAL) += serial_ns16550.o
 COBJS-$(CONFIG_IMX_SERIAL) += serial_imx.o
drivers/serial/s3c64xx.c deleted +0 -187

187 lines not on this page · raw message

drivers/serial/serial.c +0 -2
index 1f8955a..f77a112 100644
@@ -166,7 +166,6 @@ serial_initfunc(lpc32xx_serial_initialize);
 serial_initfunc(mcf_serial_initialize);
 serial_initfunc(ns9750_serial_initialize);
 serial_initfunc(oc_serial_initialize);
-serial_initfunc(s3c64xx_serial_initialize);
 serial_initfunc(sandbox_serial_initialize);
 serial_initfunc(clps7111_serial_initialize);
 serial_initfunc(imx_serial_initialize);
@@ -261,7 +260,6 @@ void serial_initialize(void)
 	mcf_serial_initialize();
 	ns9750_serial_initialize();
 	oc_serial_initialize();
-	s3c64xx_serial_initialize();
 	sandbox_serial_initialize();
 	clps7111_serial_initialize();
 	imx_serial_initialize();
drivers/usb/host/Makefile +0 -1
index 6c94794..9405736 100644
@@ -31,7 +31,6 @@ COBJS-$(CONFIG_USB_ATMEL) += ohci-at91.o
 COBJS-$(CONFIG_USB_OHCI_DA8XX) += ohci-da8xx.o
 COBJS-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
 COBJS-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
-COBJS-$(CONFIG_USB_S3C64XX) += s3c64xx-hcd.o
 COBJS-$(CONFIG_USB_SL811HS) += sl811-hcd.o
 COBJS-$(CONFIG_USB_OHCI_S3C24XX) += ohci-s3c24xx.o
 
drivers/usb/host/ohci-hcd.c +0 -1
index bdbe250..bc17b85 100644
@@ -66,7 +66,6 @@
 
 #if defined(CONFIG_ARM920T) || \
     defined(CONFIG_S3C24X0) || \
-    defined(CONFIG_S3C6400) || \
     defined(CONFIG_440EP) || \
     defined(CONFIG_PCI_OHCI) || \
     defined(CONFIG_MPC5200) || \
drivers/usb/host/s3c64xx-hcd.c deleted +0 -45

45 lines not on this page · raw message

include/common.h +0 -1
index 3d643a6..eede07c 100644
@@ -632,7 +632,6 @@ ulong	get_PCI_freq (void);
 #endif
 #if defined(CONFIG_S3C24X0) || \
     defined(CONFIG_LH7A40X) || \
-    defined(CONFIG_S3C6400) || \
     defined(CONFIG_EP93XX)
 ulong	get_FCLK (void);
 ulong	get_HCLK (void);
include/onenand_uboot.h +0 -4
index f321d8a..fd01040 100644
@@ -48,10 +48,6 @@ extern int flexonenand_region(struct mtd_info *mtd, loff_t addr);
 extern int flexonenand_set_boundary(struct mtd_info *mtd, int die,
 					int boundary, int lock);
 
-/* S3C64xx */
-extern void s3c64xx_onenand_init(struct mtd_info *);
-extern void s3c64xx_set_width_regs(struct onenand_chip *);
-
 /* SPL */
 void onenand_spl_load_image(uint32_t offs, uint32_t size, void *dst);
 
Signature · 1 line
1.7.10.4
#35 lore raw

PATCH v8 28/31 arm: Remove deprecated and now unused NAND SPL

In reply to Benoît Thébaudeau

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/config.mk           |    2 --
 arch/arm/cpu/arm1176/start.S |   12 ++++--------
 arch/arm/lib/crt0.S          |   16 ++--------------
 3 files changed, 6 insertions(+), 24 deletions(-)
arch/arm/config.mk +0 -2
index 24b9d7c..83320cb 100644
@@ -84,9 +84,7 @@ endif
 endif
 
 # needed for relocation
-ifndef CONFIG_NAND_SPL
 LDFLAGS_u-boot += -pie
-endif
 
 #
 # FIXME: binutils versions < 2.22 have a bug in the assembler where
arch/arm/cpu/arm1176/start.S +4 -8
index 97d347c..b3c686a 100644
@@ -51,7 +51,7 @@
 
 .globl _start
 _start: b	reset
-#ifndef CONFIG_NAND_SPL
+#ifndef CONFIG_SPL_BUILD
 	ldr	pc, _undefined_instruction
 	ldr	pc, _software_interrupt
 	ldr	pc, _prefetch_abort
@@ -98,15 +98,11 @@ _end_vect:
 
 .globl _TEXT_BASE
 _TEXT_BASE:
-#ifdef CONFIG_NAND_SPL /* deprecated, use instead CONFIG_SPL_BUILD */
-	.word	CONFIG_SYS_TEXT_BASE
-#else
 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
 	.word	CONFIG_SPL_TEXT_BASE
 #else
 	.word	CONFIG_SYS_TEXT_BASE
 #endif
-#endif
 
 /*
  * Below variable is very important because we use MMU in U-Boot.
@@ -176,7 +172,7 @@ cpu_init_crit:
 	 * When booting from NAND - it has definitely been a reset, so, no need
 	 * to flush caches and disable the MMU
 	 */
-#ifndef CONFIG_NAND_SPL
+#ifndef CONFIG_SPL_BUILD
 	/*
 	 * flush v4 I/D caches
 	 */
@@ -361,7 +357,7 @@ c_runtime_cpu_setup:
 
 	mov	pc, lr
 
-#ifndef CONFIG_NAND_SPL
+#ifndef CONFIG_SPL_BUILD
 /*
  * we assume that cache operation is done before. (eg. cleanup_before_linux())
  * actually, we don't need to do anything about cache if not use d-cache in
@@ -539,4 +535,4 @@ fiq:
 	get_bad_stack
 	bad_save_user_regs
 	bl	do_fiq
-#endif /* CONFIG_NAND_SPL */
+#endif /* CONFIG_SPL_BUILD */
arch/arm/lib/crt0.S +2 -14
index 7950469..6fcb7d1 100644
@@ -64,7 +64,7 @@
  *    have some work left to do at this point regarding memory, so
  *    call c_runtime_cpu_setup.
  *
- * 6. Branch to either nand_boot() or board_init_r().
+ * 6. Branch to board_init_r().
  */
 
 /*
@@ -77,10 +77,7 @@ ENTRY(_main)
  * Set up initial C runtime environment and call board_init_f(0).
  */
 
-#if defined(CONFIG_NAND_SPL)
-	/* deprecated, use instead CONFIG_SPL_BUILD */
-	ldr	sp, =(CONFIG_SYS_INIT_SP_ADDR)
-#elif defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
 	ldr	sp, =(CONFIG_SPL_STACK)
 #else
 	ldr	sp, =(CONFIG_SYS_INIT_SP_ADDR)
@@ -129,21 +126,12 @@ clbss_l:cmp	r0, r1			/* while not@end of BSS */
 	bl coloured_LED_init
 	bl red_led_on
 
-#if defined(CONFIG_NAND_SPL)
-
-	/* call _nand_boot() */
-	ldr     pc, =nand_boot
-
-#else
-
 	/* call board_init_r(gd_t *id, ulong dest_addr) */
 	mov	r0, r8			/* gd_t */
 	ldr	r1, [r8, #GD_RELOCADDR]	/* dest_addr */
 	/* call board_init_r */
 	ldr	pc, =board_init_r	/* this is auto-relocated! */
 
-#endif
-
 	/* we should not return here. */
 
 #endif
Signature · 1 line
1.7.10.4
#36 lore raw

PATCH v8 29/31 arm1176: Remove unused MMU setup from start.S

In reply to Benoît Thébaudeau

Following the removal of the smdk6400 board, the MMU setup code in arm1176/start.S becomes unused, so move it to scrapyard. It will still be possible to restore it later from the Git history if necessary, in which case it should be moved out from the relocate_code() function.

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/cpu/arm1176/start.S |   91 +-----------------------------------------
 1 file changed, 1 insertion(+), 90 deletions(-)
arch/arm/cpu/arm1176/start.S +1 -90
index b3c686a..18ac8d5 100644
@@ -33,11 +33,8 @@
 #include <asm-offsets.h>
 #include <config.h>
 #include <version.h>
-#ifdef CONFIG_ENABLE_MMU
-#include <asm/proc/domain.h>
-#endif
 
-#if !defined(CONFIG_ENABLE_MMU) && !defined(CONFIG_SYS_PHY_UBOOT_BASE)
+#ifndef CONFIG_SYS_PHY_UBOOT_BASE
 #define CONFIG_SYS_PHY_UBOOT_BASE	CONFIG_SYS_UBOOT_BASE
 #endif
 
@@ -105,14 +102,6 @@ _TEXT_BASE:
 #endif
 
 /*
- * Below variable is very important because we use MMU in U-Boot.
- * Without it, we cannot run code correctly before MMU is ON.
- * by scsuh.
- */
-_TEXT_PHY_BASE:
-	.word	CONFIG_SYS_PHY_UBOOT_BASE
-
-/*
  * These are defined in the board-specific linker script.
  * Subtracting _start from them lets the linker put their
  * relative position in the executable instead of leaving
@@ -298,44 +287,6 @@ fixnext:
 	blo	fixloop
 #endif
 
-#ifdef CONFIG_ENABLE_MMU
-enable_mmu:
-	/* enable domain access */
-	ldr	r5, =0x0000ffff
-	mcr	p15, 0, r5, c3, c0, 0	/* load domain access register */
-
-	/* Set the TTB register */
-	ldr	r0, _mmu_table_base
-	ldr	r1, =CONFIG_SYS_PHY_UBOOT_BASE
-	ldr	r2, =0xfff00000
-	bic	r0, r0, r2
-	orr	r1, r0, r1
-	mcr	p15, 0, r1, c2, c0, 0
-
-	/* Enable the MMU */
-	mrc	p15, 0, r0, c1, c0, 0
-	orr	r0, r0, #1		/* Set CR_M to enable MMU */
-
-	/* Prepare to enable the MMU */
-	adr	r1, skip_hw_init
-	and	r1, r1, #0x3fc
-	ldr	r2, _TEXT_BASE
-	ldr	r3, =0xfff00000
-	and	r2, r2, r3
-	orr	r2, r2, r1
-	b	mmu_enable
-
-	.align 5
-	/* Run in a single cache-line */
-mmu_enable:
-
-	mcr	p15, 0, r0, c1, c0, 0
-	nop
-	nop
-	mov	pc, r2
-skip_hw_init:
-#endif
-
 relocate_done:
 
 	bx	lr
@@ -347,11 +298,6 @@ _rel_dyn_end_ofs:
 _dynsym_start_ofs:
 	.word __dynsym_start - _start
 
-#ifdef CONFIG_ENABLE_MMU
-_mmu_table_base:
-	.word mmu_table
-#endif
-
 	.globl	c_runtime_cpu_setup
 c_runtime_cpu_setup:
 
@@ -359,41 +305,6 @@ c_runtime_cpu_setup:
 
 #ifndef CONFIG_SPL_BUILD
 /*
- * we assume that cache operation is done before. (eg. cleanup_before_linux())
- * actually, we don't need to do anything about cache if not use d-cache in
- * U-Boot. So, in this function we clean only MMU. by scsuh
- *
- * void	theLastJump(void *kernel, int arch_num, uint boot_params);
- */
-#ifdef CONFIG_ENABLE_MMU
-	.globl theLastJump
-theLastJump:
-	mov	r9, r0
-	ldr	r3, =0xfff00000
-	ldr	r4, _TEXT_PHY_BASE
-	adr	r5, phy_last_jump
-	bic	r5, r5, r3
-	orr	r5, r5, r4
-	mov	pc, r5
-phy_last_jump:
-	/*
-	 * disable MMU stuff
-	 */
-	mrc	p15, 0, r0, c1, c0, 0
-	bic	r0, r0, #0x00002300	/* clear bits 13, 9:8 (--V- --RS) */
-	bic	r0, r0, #0x00000087	/* clear bits 7, 2:0 (B--- -CAM) */
-	orr	r0, r0, #0x00000002	/* set bit 2 (A) Align */
-	orr	r0, r0, #0x00001000	/* set bit 12 (I) I-Cache */
-	mcr	p15, 0, r0, c1, c0, 0
-
-	mcr	p15, 0, r0, c8, c7, 0	/* flush v4 TLB */
-
-	mov	r0, #0
-	mov	pc, r9
-#endif
-
-
-/*
  *************************************************************************
  *
  * Interrupt handling
Signature · 1 line
1.7.10.4
#37 lore raw

PATCH v8 29/31 arm1176: Remove unused MMU setup from start.S

Hi Beno?t,

Quoted 4 lines · Beno?t Th?baudeau

Following the removal of the smdk6400 board, the MMU setup code in arm1176/start.S becomes unused, so move it to scrapyard. It will still be possible to restore it later from the Git history if necessary, in which case it should be moved out from the relocate_code() function.

Avoid using "scrapyard" here, as 'scrapyard' is already being used for whole board support removal (see doc/README.scrapyard), and this patch is not about board support removal.

Amicalement,

Signature · 1 line
Albert.
#38 lore raw

PATCH v8 29/31 arm1176: Remove unused MMU setup from start.S

Hi Albert,

Quoted 11 lines · Albert ARIBAUD

Hi Beno?t,

Quoted 5 lines · Beno?t Th?baudeau

Following the removal of the smdk6400 board, the MMU setup code in arm1176/start.S becomes unused, so move it to scrapyard. It will still be possible to restore it later from the Git history if necessary, in which case it
should be moved out from the relocate_code() function.

Quoted 3 lines

Avoid using "scrapyard" here, as 'scrapyard' is already being used for whole board support removal (see doc/README.scrapyard), and this patch is not about board support removal.

OK, then I suppose that the same applies to 27/31.

I will reword in v9.

Best regards,
Beno?t

#39 lore raw

PATCH v8 30/31 arm: Make all linker scripts compatible with per-symbol sections

In reply to Benoît Thébaudeau

Let all ARM linker scripts handle properly -ffunction-sections and -fdata-sections. This will be useful for the following changes in order to create symbol-specific sections in the common crt0.S.

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/cpu/arm1136/u-boot-spl.lds            |    2 +-
 arch/arm/cpu/arm920t/ep93xx/u-boot.lds         |   10 +++++-----
 arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds      |    6 +++---
 arch/arm/cpu/arm926ejs/spear/u-boot-spl.lds    |    6 +++---
 arch/arm/cpu/armv7/omap-common/u-boot-spl.lds  |    2 +-
 arch/arm/cpu/armv7/socfpga/u-boot-spl.lds      |    2 +-
 board/ait/cam_enc_4xx/u-boot-spl.lds           |    2 +-
 board/davinci/da8xxevm/u-boot-spl-da850evm.lds |    2 +-
 board/davinci/da8xxevm/u-boot-spl-hawk.lds     |    8 ++++----
 board/freescale/mx31ads/u-boot.lds             |   20 ++++++++++----------
 board/samsung/smdk5250/smdk5250-uboot-spl.lds  |    2 +-
 board/vpac270/u-boot-spl.lds                   |    4 ++--
 12 files changed, 33 insertions(+), 33 deletions(-)
arch/arm/cpu/arm1136/u-boot-spl.lds +1 -1
index a0462ab..deae361 100644
@@ -38,7 +38,7 @@ SECTIONS
 	.text      :
 	{
 	__start = .;
-	  arch/arm/cpu/arm1136/start.o	(.text)
+	  arch/arm/cpu/arm1136/start.o	(.text*)
 	  *(.text*)
 	} >.sram
 
arch/arm/cpu/arm920t/ep93xx/u-boot.lds +5 -5
index 62315de..72912de 100644
@@ -31,18 +31,18 @@ SECTIONS
 	. = ALIGN(4);
 	.text      :
 	{
-	  arch/arm/cpu/arm920t/start.o	(.text)
+	  arch/arm/cpu/arm920t/start.o	(.text*)
 		/* the EP93xx expects to find the pattern 'CRUS' at 0x1000 */
 	  . = 0x1000;
 	  LONG(0x53555243)
-	  *(.text)
+	  *(.text*)
 	}
 
 	. = ALIGN(4);
-	.rodata : { *(.rodata) }
+	.rodata : { *(.rodata*) }
 
 	. = ALIGN(4);
-	.data : { *(.data) }
+	.data : { *(.data*) }
 
 	. = ALIGN(4);
 	.got : { *(.got) }
@@ -59,7 +59,7 @@ SECTIONS
 	__image_copy_end = .;
 
 	__bss_start = .;
-	.bss : { *(.bss) }
+	.bss : { *(.bss*) }
 	__bss_end__ = .;
 
 	_end = .;
arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds +3 -3
index 6dc681a..80693da 100644
@@ -37,8 +37,8 @@ SECTIONS
 	. = ALIGN(4);
 	.text	:
 	{
-		arch/arm/cpu/arm926ejs/mxs/start.o	(.text)
-		*(.text)
+		arch/arm/cpu/arm926ejs/mxs/start.o	(.text*)
+		*(.text*)
 	}
 
 	. = ALIGN(4);
@@ -46,7 +46,7 @@ SECTIONS
 
 	. = ALIGN(4);
 	.data : {
-		*(.data)
+		*(.data*)
 	}
 
 	. = ALIGN(4);
arch/arm/cpu/arm926ejs/spear/u-boot-spl.lds +3 -3
index f3bd5e7..3146f79 100644
@@ -37,8 +37,8 @@ SECTIONS
 	. = ALIGN(4);
 	.text	:
 	{
-		arch/arm/cpu/arm926ejs/spear/start.o	(.text)
-		*(.text)
+		arch/arm/cpu/arm926ejs/spear/start.o	(.text*)
+		*(.text*)
 	}
 
 	. = ALIGN(4);
@@ -46,7 +46,7 @@ SECTIONS
 
 	. = ALIGN(4);
 	.data : {
-		*(.data)
+		*(.data*)
 	}
 
 	. = ALIGN(4);
arch/arm/cpu/armv7/omap-common/u-boot-spl.lds +1 -1
index 9979c30..0b923f8 100644
@@ -38,7 +38,7 @@ SECTIONS
 	.text      :
 	{
 		__start = .;
-		arch/arm/cpu/armv7/start.o	(.text)
+		arch/arm/cpu/armv7/start.o	(.text*)
 		*(.text*)
 	} >.sram
 
arch/arm/cpu/armv7/socfpga/u-boot-spl.lds +1 -1
index 7cd409c..ff309b9 100644
@@ -27,7 +27,7 @@ SECTIONS
 	. = ALIGN(4);
 	.text	:
 	{
-		arch/arm/cpu/armv7/start.o	(.text)
+		arch/arm/cpu/armv7/start.o	(.text*)
 		*(.text*)
 	} >.sdram
 
board/ait/cam_enc_4xx/u-boot-spl.lds +1 -1
index 656b2fb..a9d797b 100644
@@ -38,7 +38,7 @@ SECTIONS
 	.text      :
 	{
 	__start = .;
-	  arch/arm/cpu/arm926ejs/start.o	(.text)
+	  arch/arm/cpu/arm926ejs/start.o	(.text*)
 	  *(.text*)
 	} >.sram
 
board/davinci/da8xxevm/u-boot-spl-da850evm.lds +1 -1
index c5fd93c..e5ebd82 100644
@@ -38,7 +38,7 @@ SECTIONS
 	.text      :
 	{
 	__start = .;
-	  arch/arm/cpu/arm926ejs/start.o	(.text)
+	  arch/arm/cpu/arm926ejs/start.o	(.text*)
 	  *(.text*)
 	} >.sram
 
board/davinci/da8xxevm/u-boot-spl-hawk.lds +4 -4
index 174955e..9b2f0dd 100644
@@ -34,15 +34,15 @@ SECTIONS
 	. = ALIGN(4);
 	.text      :
 	{
-	  arch/arm/cpu/arm926ejs/start.o		(.text)
-	  arch/arm/cpu/arm926ejs/davinci/libdavinci.o	(.text)
-	  drivers/mtd/nand/libnand.o			(.text)
+	  arch/arm/cpu/arm926ejs/start.o		(.text*)
+	  arch/arm/cpu/arm926ejs/davinci/libdavinci.o	(.text*)
+	  drivers/mtd/nand/libnand.o			(.text*)
 
 	  *(.text*)
 	}
 
 	. = ALIGN(4);
-	.rodata : { *(.rodata) }
+	.rodata : { *(.rodata*) }
 
 	. = ALIGN(4);
 	.data : {
board/freescale/mx31ads/u-boot.lds +10 -10
index 5267729..d011c7a 100644
@@ -37,23 +37,23 @@ SECTIONS
 	  /* WARNING - the following is hand-optimized to fit within	*/
 	  /* the sector layout of our flash chips!	XXX FIXME XXX	*/
 
-	  arch/arm/cpu/arm1136/start.o			(.text)
-	  board/freescale/mx31ads/libmx31ads.o	(.text)
-	  arch/arm/lib/libarm.o			(.text)
-	  net/libnet.o				(.text)
-	  drivers/mtd/libmtd.o			(.text)
+	  arch/arm/cpu/arm1136/start.o			(.text*)
+	  board/freescale/mx31ads/libmx31ads.o	(.text*)
+	  arch/arm/lib/libarm.o			(.text*)
+	  net/libnet.o				(.text*)
+	  drivers/mtd/libmtd.o			(.text*)
 
 	  . = DEFINED(env_offset) ? env_offset : .;
-	  common/env_embedded.o(.text)
+	  common/env_embedded.o(.text*)
 
-	  *(.text)
+	  *(.text*)
 	}
 	. = ALIGN(4);
-	.rodata : { *(.rodata) }
+	.rodata : { *(.rodata*) }
 
 	. = ALIGN(4);
 	.data : {
-		*(.data)
+		*(.data*)
 	}
 
 	. = ALIGN(4);
@@ -82,7 +82,7 @@ SECTIONS
 
 	.bss __rel_dyn_start (OVERLAY) : {
 		__bss_start = .;
-		*(.bss)
+		*(.bss*)
 		 . = ALIGN(4);
 		__bss_end__ = .;
 	}
board/samsung/smdk5250/smdk5250-uboot-spl.lds +1 -1
index 951d8ce..e662a35 100644
@@ -37,7 +37,7 @@ SECTIONS
 	.text :
 	{
 		__start = .;
-		arch/arm/cpu/armv7/start.o (.text)
+		arch/arm/cpu/armv7/start.o (.text*)
 		*(.text*)
 	} >.sram
 	. = ALIGN(4);
board/vpac270/u-boot-spl.lds +2 -2
index e344436..183ff8f 100644
@@ -54,7 +54,7 @@ SECTIONS
 
 	. = ALIGN(4);
 	.data : {
-		*(.data)
+		*(.data*)
 	}
 
 	.u_boot_list : {
@@ -82,7 +82,7 @@ SECTIONS
 
 	.bss __rel_dyn_start (OVERLAY) : {
 		__bss_start = .;
-		*(.bss)
+		*(.bss*)
 		 . = ALIGN(4);
 		__bss_end__ = .;
 	}
Signature · 1 line
1.7.10.4
#40 lore raw

PATCH v8 31/31 arm: Remove duplicated start.S code

In reply to Benoît Thébaudeau

Factorize start.S code as much as possible.

Functions that may need to be customized for some start.S are defined weak for that purpose.

relocate_code_prepare() and relocate_code_finish() are introduced as hooks to be executed at the beginning and at the end of relocate_code() if needed by some start.S, e.g. for special cache or MMU operations.

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/cpu/arm1136/start.S       |  130 +--------------------------
 arch/arm/cpu/arm1176/start.S       |  113 +----------------------
 arch/arm/cpu/arm720t/start.S       |  124 +-------------------------
 arch/arm/cpu/arm920t/start.S       |  125 +-------------------------
 arch/arm/cpu/arm925t/start.S       |  124 +-------------------------
 arch/arm/cpu/arm926ejs/mxs/start.S |   45 +---------
 arch/arm/cpu/arm926ejs/start.S     |  131 +--------------------------
 arch/arm/cpu/arm946es/start.S      |  124 +-------------------------
 arch/arm/cpu/arm_intcm/start.S     |  124 +-------------------------
 arch/arm/cpu/armv7/start.S         |  117 +-----------------------
 arch/arm/cpu/ixp/start.S           |  124 +-------------------------
 arch/arm/cpu/pxa/start.S           |  141 +++--------------------------
 arch/arm/cpu/s3c44b0/start.S       |  124 +-------------------------
 arch/arm/cpu/sa1100/start.S        |  124 +-------------------------
 arch/arm/include/asm/start_macro.S |  172 ++++++++++++++++++++++++++++++++++++
 arch/arm/lib/crt0.S                |   21 +++++
 16 files changed, 241 insertions(+), 1622 deletions(-)
 create mode 100644 arch/arm/include/asm/start_macro.S
arch/arm/cpu/arm1136/start.S +3 -127
index eb11b69..19081e8 100644
@@ -31,6 +31,7 @@
 #include <asm-offsets.h>
 #include <config.h>
 #include <version.h>
+#include <asm/start_macro.S>
 .globl _start
 _start: b	reset
 #ifdef CONFIG_SPL_BUILD
@@ -86,52 +87,7 @@ _end_vect:
  *************************************************************************
  */
 
-.globl _TEXT_BASE
-_TEXT_BASE:
-#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
-	.word	CONFIG_SPL_TEXT_BASE
-#else
-	.word	CONFIG_SYS_TEXT_BASE
-#endif
-
-/*
- * These are defined in the board-specific linker script.
- * Subtracting _start from them lets the linker put their
- * relative position in the executable instead of leaving
- * them null.
- */
-.globl _bss_start_ofs
-_bss_start_ofs:
-	.word __bss_start - _start
-
-.globl _image_copy_end_ofs
-_image_copy_end_ofs:
-	.word __image_copy_end - _start
-
-.globl _bss_end_ofs
-_bss_end_ofs:
-	.word __bss_end__ - _start
-
-.globl _end_ofs
-_end_ofs:
-	.word _end - _start
-
-#ifdef CONFIG_USE_IRQ
-/* IRQ stack memory (calculated at run-time) */
-.globl IRQ_STACK_START
-IRQ_STACK_START:
-	.word	0x0badc0de
-
-/* IRQ stack memory (calculated at run-time) */
-.globl FIQ_STACK_START
-FIQ_STACK_START:
-	.word 0x0badc0de
-#endif
-
-/* IRQ stack memory (calculated at run-time) + 8 bytes */
-.globl IRQ_STACK_START_IN
-IRQ_STACK_START_IN:
-	.word	0x0badc0de
+	define_start_symbols
 
 /*
  * the actual reset code
@@ -173,87 +129,7 @@ next:
 
 /*------------------------------------------------------------------------------*/
 
-/*
- * void relocate_code(addr_moni)
- *
- * This function relocates the monitor code.
- */
-	.globl	relocate_code
-relocate_code:
-	mov	r6, r0	/* save addr of destination */
-
-	adr	r0, _start
-	subs	r9, r6, r0		/* r9 <- relocation offset */
-	beq	relocate_done		/* skip relocation */
-	mov	r1, r6			/* r1 <- scratch for copy_loop */
-	ldr	r3, _image_copy_end_ofs
-	add	r2, r0, r3		/* r2 <- source end address	    */
-
-copy_loop:
-	ldmia	r0!, {r10-r11}		/* copy from source address [r0]    */
-	stmia	r1!, {r10-r11}		/* copy to   target address [r1]    */
-	cmp	r0, r2			/* until source end address [r2]    */
-	blo	copy_loop
-
-#ifndef CONFIG_SPL_BUILD
-	/*
-	 * fix .rel.dyn relocations
-	 */
-	ldr	r0, _TEXT_BASE		/* r0 <- Text base */
-	ldr	r10, _dynsym_start_ofs	/* r10 <- sym table ofs */
-	add	r10, r10, r0		/* r10 <- sym table in FLASH */
-	ldr	r2, _rel_dyn_start_ofs	/* r2 <- rel dyn start ofs */
-	add	r2, r2, r0		/* r2 <- rel dyn start in FLASH */
-	ldr	r3, _rel_dyn_end_ofs	/* r3 <- rel dyn end ofs */
-	add	r3, r3, r0		/* r3 <- rel dyn end in FLASH */
-fixloop:
-	ldr	r0, [r2]		/* r0 <- location to fix up, IN FLASH! */
-	add	r0, r0, r9		/* r0 <- location to fix up in RAM */
-	ldr	r1, [r2, #4]
-	and	r7, r1, #0xff
-	cmp	r7, #23			/* relative fixup? */
-	beq	fixrel
-	cmp	r7, #2			/* absolute fixup? */
-	beq	fixabs
-	/* ignore unknown type of fixup */
-	b	fixnext
-fixabs:
-	/* absolute fix: set location to (offset) symbol value */
-	mov	r1, r1, LSR #4		/* r1 <- symbol index in .dynsym */
-	add	r1, r10, r1		/* r1 <- address of symbol in table */
-	ldr	r1, [r1, #4]		/* r1 <- symbol value */
-	add	r1, r1, r9		/* r1 <- relocated sym addr */
-	b	fixnext
-fixrel:
-	/* relative fix: increase location by offset */
-	ldr	r1, [r0]
-	add	r1, r1, r9
-fixnext:
-	str	r1, [r0]
-	add	r2, r2, #8		/* each rel.dyn entry is 8 bytes */
-	cmp	r2, r3
-	blo	fixloop
-#endif
-
-relocate_done:
-
-	bx	lr
-
-#ifndef CONFIG_SPL_BUILD
-
-_rel_dyn_start_ofs:
-	.word __rel_dyn_start - _start
-_rel_dyn_end_ofs:
-	.word __rel_dyn_end - _start
-_dynsym_start_ofs:
-	.word __dynsym_start - _start
-
-#endif
-
-	.globl	c_runtime_cpu_setup
-c_runtime_cpu_setup:
-
-	bx	lr
+	define_relocate_code
 
 /*
  *************************************************************************
arch/arm/cpu/arm1176/start.S +3 -110

134 lines not on this page · raw message

arch/arm/cpu/arm720t/start.S +3 -121

145 lines not on this page · raw message

arch/arm/cpu/arm920t/start.S +3 -122

147 lines not on this page · raw message

arch/arm/cpu/arm925t/start.S +3 -121

145 lines not on this page · raw message

arch/arm/cpu/arm926ejs/mxs/start.S +2 -43

58 lines not on this page · raw message

arch/arm/cpu/arm926ejs/start.S +3 -128

150 lines not on this page · raw message

arch/arm/cpu/arm946es/start.S +3 -121

145 lines not on this page · raw message

arch/arm/cpu/arm_intcm/start.S +3 -121

145 lines not on this page · raw message

arch/arm/cpu/armv7/start.S +3 -114

135 lines not on this page · raw message

arch/arm/cpu/ixp/start.S +3 -121

145 lines not on this page · raw message

arch/arm/cpu/pxa/start.S +10 -131

176 lines not on this page · raw message

arch/arm/cpu/s3c44b0/start.S +3 -121

145 lines not on this page · raw message

arch/arm/cpu/sa1100/start.S +3 -121

145 lines not on this page · raw message

arch/arm/include/asm/start_macro.S new file +172 -0

172 lines not on this page · raw message

arch/arm/lib/crt0.S +21 -0
index 6fcb7d1..4559d40 100644
@@ -68,9 +68,30 @@
  */
 
 /*
+ * A section is created for each symbol in order to optimize section garbage
+ * collection@link time if --gc-sections is used, which is the case for SPL
+ * builds.
+ */
+
+	.section	.text.crt0_default_hooks,"ax",%progbits
+ENTRY(relocate_code_prepare)
+ENTRY(relocate_code_finish)
+ENTRY(c_runtime_cpu_setup)
+#ifdef __ARM_ARCH_4__
+	mov	pc, lr
+#else
+	bx	lr
+#endif
+ENDPROC(c_runtime_cpu_setup)
+ENDPROC(relocate_code_finish)
+ENDPROC(relocate_code_prepare)
+	.weak	relocate_code_prepare, relocate_code_finish, c_runtime_cpu_setup
+
+/*
  * entry point of crt0 sequence
  */
 
+	.section	.text._main,"ax",%progbits
 ENTRY(_main)
 
 /*
Signature · 1 line
1.7.10.4
#41 lore raw

PATCH v8 31/31 arm: Remove duplicated start.S code

Hi Beno?t,

Quoted 8 lines · Beno?t Th?baudeau

Factorize start.S code as much as possible.

Functions that may need to be customized for some start.S are defined weak for that purpose.

relocate_code_prepare() and relocate_code_finish() are introduced as hooks to be executed at the beginning and at the end of relocate_code() if needed by some start.S, e.g. for special cache or MMU operations.

NAK.

1. I don't like this idea of planting hooks inside relocate-code(). This function is about relocating code, not about MMU stuff. If there are any MMU steps to be performed between calls to board_init_f(), relocate_code() or board_init_r(), I want them laid out as calls of their own right in crt0.S.

2. If we're going to factorize out relocate_code() from the various start.S files, I want it moved not in crt0.S but in its own file. This way, i) people can easily create binaries which use crt0.S but do not relocate, ii) people who want to make relocate_code() a C function will have it easier, and iii) crt0.S keeps being the ugly ASM glue needed for flash inits, relocation and RAM inits to have a C proper run-time environment.

Incidentally, CC:ing Simon:

Quoted 11 lines

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

Is this produced by patman? If so, is there a way to avoid it? We *know* it's a new patch in v8, so any history pre-v8 here is meaningless.

Amicalement,

Signature · 1 line
Albert.
#42 lore raw

PATCH v8 31/31 arm: Remove duplicated start.S code

Hi Albert,

Quoted 17 lines · Albert ARIBAUD

Hi Beno?t,

Quoted 11 lines · Beno?t Th?baudeau

Factorize start.S code as much as possible.

Functions that may need to be customized for some start.S are defined weak for
that purpose.

relocate_code_prepare() and relocate_code_finish() are introduced as hooks to be
executed at the beginning and at the end of relocate_code() if needed by some
start.S, e.g. for special cache or MMU operations.

Quoted 7 lines

NAK.

1. I don't like this idea of planting hooks inside relocate-code(). This function is about relocating code, not about MMU stuff. If there are any MMU steps to be performed between calls to board_init_f(), relocate_code() or board_init_r(), I want them laid out as calls of their own right in crt0.S.

I also don't like it. The finish hook was used by SMDK6400 before it was removed, and the prepare hook is still used by pxa.

So is it OK for you if I just drop relocate_code_finish() and move and rename the call to relocate_code_prepare() to crt0.S?

Quoted 2 lines

2. If we're going to factorize out relocate_code() from the various start.S files, I want it moved not in crt0.S but in its own file.

It is not in crt0.S, but in arch/arm/include/asm/start_marco.S, which is almost its own file apart from another macro.

Quoted 6 lines

This
way, i) people can easily create binaries which use crt0.S but do not relocate, ii) people who want to make relocate_code() a C function will have it easier, and iii) crt0.S keeps being the ugly ASM glue needed for flash inits, relocation and RAM inits to have a C proper run-time environment.

Which is already the case with this implementation?

Quoted 7 lines

Incidentally, CC:ing Simon:

Quoted 5 lines

---
Changes in v8:
- New patch.

Quoted 8 lines
Quoted 6 lines

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

Is this produced by patman?

Yes.

Quoted 1 line

If so, is there a way to avoid it?

Not that I know of.

Quoted 3 lines

We
*know* it's a new patch in v8, so any history pre-v8 here is meaningless.

Sure.

Best regards,
Beno?t

#43 lore raw

PATCH v8 31/31 arm: Remove duplicated start.S code

Quoted 42 lines · Beno?t Th?baudeau

Hi Albert,

Quoted 19 lines · Albert ARIBAUD

Hi Beno?t,

Quoted 7 lines · Beno?t Th?baudeau

Factorize start.S code as much as possible.

Functions that may need to be customized for some start.S are defined weak
for
that purpose.

Quoted 6 lines

relocate_code_prepare() and relocate_code_finish() are introduced as hooks
to be
executed at the beginning and at the end of relocate_code() if needed by some
start.S, e.g. for special cache or MMU operations.

Quoted 7 lines

NAK.

1. I don't like this idea of planting hooks inside relocate-code(). This function is about relocating code, not about MMU stuff. If there are any MMU steps to be performed between calls to board_init_f(), relocate_code() or board_init_r(), I want them laid out as calls of their own right in crt0.S.

I also don't like it. The finish hook was used by SMDK6400 before it was removed, and the prepare hook is still used by pxa.

So is it OK for you if I just drop relocate_code_finish() and move and rename the call to relocate_code_prepare() to crt0.S?

Quoted 2 lines

2. If we're going to factorize out relocate_code() from the various start.S files, I want it moved not in crt0.S but in its own file.

It is not in crt0.S, but in arch/arm/include/asm/start_marco.S, which is almost its own file apart from another macro.

Quoted 8 lines
Quoted 6 lines

This
way, i) people can easily create binaries which use crt0.S but do not relocate, ii) people who want to make relocate_code() a C function will have it easier, and iii) crt0.S keeps being the ugly ASM glue needed for flash inits, relocation and RAM inits to have a C proper run-time environment.

Which is already the case with this implementation?

And in case you ask, with relocate_code() as a function in its own file instead of a macro called from start.S, it does not work because of the _start-relative word values that require relocate_code() to be in _start's section.

Best regards,
Beno?t

#44 lore raw

PATCH v8 31/31 arm: Remove duplicated start.S code

In reply to Benoît Thébaudeau

Hi Beno?t,

Quoted 28 lines · Beno?t Th?baudeau

Hi Albert,

Quoted 17 lines · Albert ARIBAUD

Hi Beno?t,

Quoted 11 lines · Beno?t Th?baudeau

Factorize start.S code as much as possible.

Functions that may need to be customized for some start.S are defined weak for
that purpose.

relocate_code_prepare() and relocate_code_finish() are introduced as hooks to be
executed at the beginning and at the end of relocate_code() if needed by some
start.S, e.g. for special cache or MMU operations.

Quoted 7 lines

NAK.

1. I don't like this idea of planting hooks inside relocate-code(). This function is about relocating code, not about MMU stuff. If there are any MMU steps to be performed between calls to board_init_f(), relocate_code() or board_init_r(), I want them laid out as calls of their own right in crt0.S.

Quoted 5 lines

I also don't like it. The finish hook was used by SMDK6400 before it was removed, and the prepare hook is still used by pxa.

So is it OK for you if I just drop relocate_code_finish() and move and rename the call to relocate_code_prepare() to crt0.S?

Fine, except for the name: "prepare for relocation" is what every instruction does from board_init_f() return to relocate_code() entry. This 'hook' does only a small part, if at all, of preparing for relocation, and this part must get a less improper name. If we are enabling the I-cache here, then let's name the function accordingly. Better yet, let us find out if we do need to enable the instruction cache here at all.

Quoted 5 lines
Quoted 2 lines

2. If we're going to factorize out relocate_code() from the various start.S files, I want it moved not in crt0.S but in its own file.

It is not in crt0.S, but in arch/arm/include/asm/start_marco.S, which is almost its own file apart from another macro.

I do not want it as a macro. It is and should stay a function. Regarding your added comment:

Actually, I'd stopped dead at the relocate_code() changes, but the other macros I don't like much either; I don't see the point of it.

To be faire, I don't see the point of the whole patch wrt the objective.

Quoted 4 lines

And in case you ask, with relocate_code() as a function in its own file instead of a macro called from start.S, it does not work because of the _start-relative word values that require relocate_code() to be in _start's section.

How does it "not work" exactly?

Quoted 8 lines
Quoted 6 lines

This
way, i) people can easily create binaries which use crt0.S but do not relocate, ii) people who want to make relocate_code() a C function will have it easier, and iii) crt0.S keeps being the ugly ASM glue needed for flash inits, relocation and RAM inits to have a C proper run-time environment.

Which is already the case with this implementation?

Not with relocate_code() as a macro, though.

This whole thing/way of "factorizing" start.S using macros feels wrong to me; this departs from what I have started with crt0.S, where code is actually really factorized in a single file which is actually a compilation unit, not a helper file.

Do you need patch 31/31 in your series?

Quoted 14 lines
Quoted 14 lines

Incidentally, CC:ing Simon:

Quoted 11 lines

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

Quoted 3 lines
Quoted 1 line

Is this produced by patman?

Yes [...]

Ok, then, don't bother to fix patman's behavior manually in your own patches -- I'll try and see if I can submit a patch to fix patman itself.

Quoted 2 lines

Best regards,
Beno?t

Amicalement,

Signature · 1 line
Albert.
#45 lore raw

PATCH v8 31/31 arm: Remove duplicated start.S code

Hi Albert,

Quoted 47 lines · Albert ARIBAUD

Hi Beno?t,

Quoted 28 lines · Beno?t Th?baudeau

Hi Albert,

Quoted 17 lines · Albert ARIBAUD

Hi Beno?t,

Quoted 11 lines · Beno?t Th?baudeau

Factorize start.S code as much as possible.

Functions that may need to be customized for some start.S are defined weak for
that purpose.

relocate_code_prepare() and relocate_code_finish() are introduced as hooks to be
executed at the beginning and at the end of relocate_code() if needed by some
start.S, e.g. for special cache or MMU operations.

Quoted 7 lines

NAK.

1. I don't like this idea of planting hooks inside relocate-code(). This function is about relocating code, not about MMU stuff. If there are any MMU steps to be performed between calls to board_init_f(), relocate_code() or board_init_r(), I want them laid out as calls of their own right in crt0.S.

Quoted 5 lines

I also don't like it. The finish hook was used by SMDK6400 before it was removed, and the prepare hook is still used by pxa.

So is it OK for you if I just drop relocate_code_finish() and move and rename the call to relocate_code_prepare() to crt0.S?

Fine, except for the name: "prepare for relocation" is what every instruction does from board_init_f() return to relocate_code() entry. This 'hook' does only a small part, if at all, of preparing for relocation, and this part must get a less improper name. If we are enabling the I-cache here, then let's name the function accordingly. Better yet, let us find out if we do need to enable the instruction cache here at all.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

2. If we're going to factorize out relocate_code() from the various start.S files, I want it moved not in crt0.S but in its own file.

It is not in crt0.S, but in arch/arm/include/asm/start_marco.S, which is almost its own file apart from another macro.

I do not want it as a macro. It is and should stay a function. Regarding your added comment:

Sorry for the mixup here. Drop the "Regarding..." just above...

Quoted 5 lines

Actually, I'd stopped dead at the relocate_code() changes, but the other macros I don't like much either; I don't see the point of it.

To be faire, I don't see the point of the whole patch wrt the objective.

... it should go here.

Quoted 43 lines
Quoted 4 lines

And in case you ask, with relocate_code() as a function in its own file instead of a macro called from start.S, it does not work because of the _start-relative word values that require relocate_code() to be in _start's section.

How does it "not work" exactly?

Quoted 8 lines
Quoted 6 lines

This
way, i) people can easily create binaries which use crt0.S but do not relocate, ii) people who want to make relocate_code() a C function will have it easier, and iii) crt0.S keeps being the ugly ASM glue needed for flash inits, relocation and RAM inits to have a C proper run-time environment.

Which is already the case with this implementation?

Not with relocate_code() as a macro, though.

This whole thing/way of "factorizing" start.S using macros feels wrong to me; this departs from what I have started with crt0.S, where code is actually really factorized in a single file which is actually a compilation unit, not a helper file.

Do you need patch 31/31 in your series?

Quoted 14 lines
Quoted 14 lines

Incidentally, CC:ing Simon:

Quoted 11 lines

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

Quoted 3 lines
Quoted 1 line

Is this produced by patman?

Yes [...]

Quoted 8 lines

Ok, then, don't bother to fix patman's behavior manually in your own patches -- I'll try and see if I can submit a patch to fix patman itself.

Quoted 2 lines

Best regards,
Beno?t

Amicalement,

Amicalement,

Signature · 1 line
Albert.
#46 lore raw

PATCH v8 31/31 arm: Remove duplicated start.S code

In reply to Albert ARIBAUD

Hi Albert,

Quoted 42 lines · Albert ARIBAUD

Hi Beno?t,

Quoted 31 lines · Beno?t Th?baudeau

Hi Albert,

Quoted 20 lines · Albert ARIBAUD

Hi Beno?t,

Quoted 7 lines · Beno?t Th?baudeau

Factorize start.S code as much as possible.

Functions that may need to be customized for some start.S are defined weak
for
that purpose.

Quoted 7 lines

relocate_code_prepare() and relocate_code_finish() are introduced as hooks
to be
executed at the beginning and at the end of relocate_code() if needed by
some
start.S, e.g. for special cache or MMU operations.

Quoted 7 lines

NAK.

1. I don't like this idea of planting hooks inside relocate-code(). This function is about relocating code, not about MMU stuff. If there are any MMU steps to be performed between calls to board_init_f(), relocate_code() or board_init_r(), I want them laid out as calls of their own right in crt0.S.

Quoted 5 lines

I also don't like it. The finish hook was used by SMDK6400 before it was removed, and the prepare hook is still used by pxa.

So is it OK for you if I just drop relocate_code_finish() and move and rename the call to relocate_code_prepare() to crt0.S?

Quoted 7 lines

Fine, except for the name: "prepare for relocation" is what every instruction does from board_init_f() return to relocate_code() entry. This 'hook' does only a small part, if at all, of preparing for relocation, and this part must get a less improper name. If we are enabling the I-cache here, then let's name the function accordingly. Better yet, let us find out if we do need to enable the instruction cache here at all.

Correct. For PXA25X, this cpu_init_crit() is paired with lock_cache_for_stack(), apparently for some hardware hack, but this is not very clear if this is required or if it could not be done otherwise. Do you know a PXA expert?

Marek, you introduced that in commit 7f4cfcf. Do you know the details about why?

If we could drop it or move it elsewhere, that would be great.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

2. If we're going to factorize out relocate_code() from the various start.S files, I want it moved not in crt0.S but in its own file.

It is not in crt0.S, but in arch/arm/include/asm/start_marco.S, which is almost its own file apart from another macro.

Quoted 8 lines

I do not want it as a macro. It is and should stay a function. Regarding your added comment:

Actually, I'd stopped dead at the relocate_code() changes, but the other macros I don't like much either; I don't see the point of it.

To be faire, I don't see the point of the whole patch wrt the objective.

This patch is just appended to the series because it depends on it, not because the series needs it.

This patch only aims at cleaning up code by removing copied/pasted code in order to simplify maintenance and to clarify things.

There have been many changes in this relocate_code(), and not always the same for all start.S, so from the outside, the purpose is unclear because one might wonder if those differences have been created on purpose or not.

Quoted 6 lines
Quoted 4 lines

And in case you ask, with relocate_code() as a function in its own file instead of a macro called from start.S, it does not work because of the _start-relative word values that require relocate_code() to be in _start's section.

How does it "not work" exactly?

The assembler issues an error (I don't remember the exact message) for all lines like ".word __rel_dyn_start - _start", complaining that this is not a kind of expression that it can prepare for the linker to resolve.

Though, it would still be possible to find a more complicated way of doing the same thing at runtime.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

This
way, i) people can easily create binaries which use crt0.S but do not relocate, ii) people who want to make relocate_code() a C function will have it easier, and iii) crt0.S keeps being the ugly ASM glue needed for flash inits, relocation and RAM inits to have a C proper run-time environment.

Quoted 8 lines
Quoted 1 line

Which is already the case with this implementation?

Not with relocate_code() as a macro, though.

This whole thing/way of "factorizing" start.S using macros feels wrong to me; this departs from what I have started with crt0.S, where code is actually really factorized in a single file which is actually a compilation unit, not a helper file.

Yes. Well, for this patch, I had first moved relocate_code() to crt0.S (could have been its own file), but I eventually switched to the macro solution because of the assembler errors.

Quoted 1 line

Do you need patch 31/31 in your series?

As explained above, no. But I really think that something should be done to stop relocate_code() duplication, one way or another, by me or someone else. I just wanted to help here.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

Incidentally, CC:ing Simon:

Quoted 11 lines

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Is this produced by patman?

Yes [...]

Ok, then, don't bother to fix patman's behavior manually in your own patches -- I'll try and see if I can submit a patch to fix patman itself.

OK.

patman had also removed some "Reviewed-by" that I had to restore manually before sending. This is a documented behavior, but not cool.

And contrary to what the documentation says, patman adds my SoB line even if I have forced another SoB in the commit message, which I also had to fix manually.

Best regards,
Beno?t

#47 lore raw

PATCH v8 31/31 arm: Remove duplicated start.S code

Hi,

Quoted 148 lines · Beno?t Th?baudeau

Hi Albert,

Quoted 42 lines · Albert ARIBAUD

Hi Beno?t,

Quoted 31 lines · Beno?t Th?baudeau

Hi Albert,

Quoted 20 lines · Albert ARIBAUD

Hi Beno?t,

Quoted 7 lines · Beno?t Th?baudeau

Factorize start.S code as much as possible.

Functions that may need to be customized for some start.S are defined weak
for
that purpose.

Quoted 7 lines

relocate_code_prepare() and relocate_code_finish() are introduced as hooks
to be
executed at the beginning and at the end of relocate_code() if needed by
some
start.S, e.g. for special cache or MMU operations.

Quoted 7 lines

NAK.

1. I don't like this idea of planting hooks inside relocate-code(). This function is about relocating code, not about MMU stuff. If there are any MMU steps to be performed between calls to board_init_f(), relocate_code() or board_init_r(), I want them laid out as calls of their own right in crt0.S.

Quoted 5 lines

I also don't like it. The finish hook was used by SMDK6400 before it was removed, and the prepare hook is still used by pxa.

So is it OK for you if I just drop relocate_code_finish() and move and rename the call to relocate_code_prepare() to crt0.S?

Quoted 7 lines

Fine, except for the name: "prepare for relocation" is what every instruction does from board_init_f() return to relocate_code() entry. This 'hook' does only a small part, if at all, of preparing for relocation, and this part must get a less improper name. If we are enabling the I-cache here, then let's name the function accordingly. Better yet, let us find out if we do need to enable the instruction cache here at all.

Correct. For PXA25X, this cpu_init_crit() is paired with lock_cache_for_stack(), apparently for some hardware hack, but this is not very clear if this is required or if it could not be done otherwise. Do you know a PXA expert?

Marek, you introduced that in commit 7f4cfcf. Do you know the details about why?

If we could drop it or move it elsewhere, that would be great.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

2. If we're going to factorize out relocate_code() from the various start.S files, I want it moved not in crt0.S but in its own file.

It is not in crt0.S, but in arch/arm/include/asm/start_marco.S, which is almost its own file apart from another macro.

Quoted 8 lines

I do not want it as a macro. It is and should stay a function. Regarding your added comment:

Actually, I'd stopped dead at the relocate_code() changes, but the other macros I don't like much either; I don't see the point of it.

To be faire, I don't see the point of the whole patch wrt the objective.

This patch is just appended to the series because it depends on it, not because the series needs it.

This patch only aims at cleaning up code by removing copied/pasted code in order to simplify maintenance and to clarify things.

There have been many changes in this relocate_code(), and not always the same for all start.S, so from the outside, the purpose is unclear because one might wonder if those differences have been created on purpose or not.

Quoted 6 lines
Quoted 4 lines

And in case you ask, with relocate_code() as a function in its own file instead of a macro called from start.S, it does not work because of the _start-relative word values that require relocate_code() to be in _start's section.

How does it "not work" exactly?

The assembler issues an error (I don't remember the exact message) for all lines like ".word __rel_dyn_start - _start", complaining that this is not a kind of expression that it can prepare for the linker to resolve.

Though, it would still be possible to find a more complicated way of doing the same thing at runtime.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

This
way, i) people can easily create binaries which use crt0.S but do not relocate, ii) people who want to make relocate_code() a C function will have it easier, and iii) crt0.S keeps being the ugly ASM glue needed for flash inits, relocation and RAM inits to have a C proper run-time environment.

Quoted 8 lines
Quoted 1 line

Which is already the case with this implementation?

Not with relocate_code() as a macro, though.

This whole thing/way of "factorizing" start.S using macros feels wrong to me; this departs from what I have started with crt0.S, where code is actually really factorized in a single file which is actually a compilation unit, not a helper file.

Yes. Well, for this patch, I had first moved relocate_code() to crt0.S (could have been its own file), but I eventually switched to the macro solution because of the assembler errors.

Quoted 1 line

Do you need patch 31/31 in your series?

As explained above, no. But I really think that something should be done to stop relocate_code() duplication, one way or another, by me or someone else. I just wanted to help here.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

Incidentally, CC:ing Simon:

Quoted 11 lines

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Is this produced by patman?

Yes [...]

Ok, then, don't bother to fix patman's behavior manually in your own patches -- I'll try and see if I can submit a patch to fix patman itself.

Quoted 7 lines

OK.

patman had also removed some "Reviewed-by" that I had to restore manually before sending. This is a documented behavior, but not cool.

And contrary to what the documentation says, patman adds my SoB line even if I have forced another SoB in the commit message, which I also had to fix manually.

Yes I have hit this myself. Someone should do a couple of patches to fix this. I will put it on my list in case someone else doesn't get to it first. Specifically:

- Don't touch/add Signed-off-by: but perhaps just want if there is not at least one in a patch
- Don't touch Reviewed-by: in the normal case - but perhaps provide a flag to remove this Geritt tag

Regards,
Simon

Quoted 3 lines

Best regards,
Beno?t

#48 lore raw

PATCH v8 31/31 arm: Remove duplicated start.S code

Hi Simon,

Quoted 41 lines · Simon Glass
Quoted 30 lines · Beno?t Th?baudeau
Quoted 19 lines · Albert ARIBAUD
Quoted 17 lines · Beno?t Th?baudeau
Quoted 16 lines · Albert ARIBAUD

On Fri, 1 Mar 2013 13:10:40 +0100, Beno?t Th?baudeau <[email protected]> wrote:
Incidentally, CC:ing Simon:

Quoted 11 lines

---
Changes in v8:
- New patch.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Is this produced by patman?

Yes [...]

Ok, then, don't bother to fix patman's behavior manually in your own patches -- I'll try and see if I can submit a patch to fix patman itself.

OK.

Quoted 8 lines

patman had also removed some "Reviewed-by" that I had to restore manually before
sending. This is a documented behavior, but not cool.

And contrary to what the documentation says, patman adds my SoB line even if I
have forced another SoB in the commit message, which I also had to fix manually.

Quoted 8 lines

Yes I have hit this myself. Someone should do a couple of patches to fix this. I will put it on my list in case someone else doesn't get to it first. Specifically:

- Don't touch/add Signed-off-by: but perhaps just want if there is not at least one in a patch
- Don't touch Reviewed-by: in the normal case - but perhaps provide a flag to remove this Geritt tag

Thanks, that'd be great. And also a 3rd one for what Albert said (which he might do himself):
- Do not report version changes before a patch has been introduced: if a patch has been introduced in version n, start reporting version changes for this patch from version n. This will probably require a new tag to tell patman in which version a patch has been created, e.g.:

Patch-creation: n

Best regards,
Beno?t

#49 lore raw

PATCH v8 31/31 arm: Remove duplicated start.S code

In reply to Benoît Thébaudeau

Hi Beno?t,

On Fri, 1 Mar 2013 23:54:26 +0100 (CET), Beno?t Th?baudeau <[email protected]> wrote:

Re: assembler error messages:

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

And in case you ask, with relocate_code() as a function in its own file instead of a macro called from start.S, it does not work because of the _start-relative word values that require relocate_code() to be in _start's section.

Quoted 8 lines
Quoted 1 line

How does it "not work" exactly?

The assembler issues an error (I don't remember the exact message) for all lines like ".word __rel_dyn_start - _start", complaining that this is not a kind of expression that it can prepare for the linker to resolve.

Though, it would still be possible to find a more complicated way of doing the same thing at runtime.

(later)

Quoted 8 lines
Quoted 4 lines

This whole thing/way of "factorizing" start.S using macros feels wrong to me; this departs from what I have started with crt0.S, where code is actually really factorized in a single file which is actually a compilation unit, not a helper file.

Yes. Well, for this patch, I had first moved relocate_code() to crt0.S (could have been its own file), but I eventually switched to the macro solution because of the assembler errors.

I've had issue in the past similar to this when I implemented the ELF relocation, the crt0.S factorization and more recently the R_ARM_ABS32 relocation record removal. These must be fixed with much attention, for instance in order to not produce R_ARM_ABS32 relocations, the removal of which I have just submitted a patch for. I think there is a way to factorize relocate_code() (and other parts) out of start.S files, built on what I did for crt0.S, and which should not cause these issues.

Re: patch 31/31 generally:

Quoted 9 lines

This patch is just appended to the series because it depends on it, not because the series needs it.

This patch only aims at cleaning up code by removing copied/pasted code in order to simplify maintenance and to clarify things.

There have been many changes in this relocate_code(), and not always the same for all start.S, so from the outside, the purpose is unclear because one might wonder if those differences have been created on purpose or not.

(picked up from later in the reply)

Quoted 5 lines
Quoted 1 line

Do you need patch 31/31 in your series?

As explained above, no. But I really think that something should be done to stop relocate_code() duplication, one way or another, by me or someone else. I just wanted to help here.

First, let me say that I appreciate the great help that you're giving us with this (30-patch!) series.

And I agree about the premise that ARM startup sequence, including but not limited to relocate_code(), is literally all over the place and that there is a need to fix this; I wrote so in the cover letter of my crt0.S patch series, which I consider a starting point and example of how I consider this should be done.

Also, we must keep in mind that part of the code in ARM should, and eventually will, be merged into a single U-Boot-wide version. ELF code relocation is not ARM specific except for the two (to be reduced soon to only one) ARM relocation record types. Thus, when we touch this code, we must keep it close, or make it closer, to the code in other U-Boot architectures; IIRC there are already patches out there to make relocate_code() a single project-wide true C function.

And I think that this newly added patch 31/31 in your series does not match either the way I want ARM startup simplification to go or the general goal of unifying relocate_code().

Thus, if you don't mind, I'd prefer patch 31/31 to move out of the series. And, since I want to avoid anyone the hassle of going through this again, I guess I will have to submit a patch for relocate_code() factorization -- quite probably above your series, since many fixes you make in it may be useful or even needed.

Quoted 2 lines

Best regards,
Beno?t

Amicalement,

Signature · 1 line
Albert.
#50 lore raw

PATCH v8 31/31 arm: Remove duplicated start.S code

Hi Albert,

Quoted 37 lines · Albert ARIBAUD

Hi Beno?t,

On Fri, 1 Mar 2013 23:54:26 +0100 (CET), Beno?t Th?baudeau <[email protected]> wrote:

Re: assembler error messages:

Quoted 13 lines
Quoted 6 lines
Quoted 4 lines

And in case you ask, with relocate_code() as a function in its own file instead of a macro called from start.S, it does not work because of the _start-relative word values that require relocate_code() to be in _start's section.

How does it "not work" exactly?

The assembler issues an error (I don't remember the exact message) for all lines
like ".word __rel_dyn_start - _start", complaining that this is not a kind of
expression that it can prepare for the linker to resolve.

Quoted 3 lines

Though, it would still be possible to find a more complicated way of doing the
same thing at runtime.

(later)

Quoted 10 lines
Quoted 4 lines

This whole thing/way of "factorizing" start.S using macros feels wrong to me; this departs from what I have started with crt0.S, where code is actually really factorized in a single file which is actually a compilation unit, not a helper file.

Yes. Well, for this patch, I had first moved relocate_code() to crt0.S (could
have been its own file), but I eventually switched to the macro solution because
of the assembler errors.

Quoted 7 lines

I've had issue in the past similar to this when I implemented the ELF relocation, the crt0.S factorization and more recently the R_ARM_ABS32 relocation record removal. These must be fixed with much attention, for instance in order to not produce R_ARM_ABS32 relocations, the removal of which I have just submitted a patch for. I think there is a way to factorize relocate_code() (and other parts) out of start.S files, built on what I did for crt0.S, and which should not cause these issues.

Yes, I think so. In the worst case, it should be possible to access out-of-range symbol relatively using adr or adrl extensively at runtime instead of pre-computed _start-relative offsets.

Quoted 47 lines

Re: patch 31/31 generally:

Quoted 8 lines

This patch is just appended to the series because it depends on it, not because
the series needs it.

This patch only aims at cleaning up code by removing copied/pasted code in order
to simplify maintenance and to clarify things.

Quoted 5 lines

There have been many changes in this relocate_code(), and not always the same
for all start.S, so from the outside, the purpose is unclear because one might
wonder if those differences have been created on purpose or not.

(picked up from later in the reply)

Quoted 7 lines
Quoted 1 line

Do you need patch 31/31 in your series?

As explained above, no. But I really think that something should be done to stop
relocate_code() duplication, one way or another, by me or someone else. I just
wanted to help here.

First, let me say that I appreciate the great help that you're giving us with this (30-patch!) series.

And I agree about the premise that ARM startup sequence, including but not limited to relocate_code(), is literally all over the place and that there is a need to fix this; I wrote so in the cover letter of my crt0.S patch series, which I consider a starting point and example of how I consider this should be done.

Also, we must keep in mind that part of the code in ARM should, and eventually will, be merged into a single U-Boot-wide version. ELF code relocation is not ARM specific except for the two (to be reduced soon to only one) ARM relocation record types. Thus, when we touch this code, we must keep it close, or make it closer, to the code in other U-Boot architectures; IIRC there are already patches out there to make relocate_code() a single project-wide true C function.

And I think that this newly added patch 31/31 in your series does not match either the way I want ARM startup simplification to go or the general goal of unifying relocate_code().

Quoted 5 lines

Thus, if you don't mind, I'd prefer patch 31/31 to move out of the series. And, since I want to avoid anyone the hassle of going through this again, I guess I will have to submit a patch for relocate_code() factorization -- quite probably above your series, since many fixes you make in it may be useful or even needed.

OK, let's do this. It will also help to stop postponing the application of this series because of more new versions.

Please just Cc me when you will post these patches so that I review them.

Best regards,
Beno?t

#51 lore raw

PATCH v8 31/31 arm: Remove duplicated start.S code

Hi Beno?t,

Quoted 8 lines · Beno?t Th?baudeau
Quoted 5 lines

Thus, if you don't mind, I'd prefer patch 31/31 to move out of the series. And, since I want to avoid anyone the hassle of going through this again, I guess I will have to submit a patch for relocate_code() factorization -- quite probably above your series, since many fixes you make in it may be useful or even needed.

OK, let's do this. It will also help to stop postponing the application of this series because of more new versions.

Also, yes.

One minor request re your upcoming v9: beside posting the series as you do on the mailing list, can you provide a git repo and a branch which could be pulled, even if it contains patman annotations? This way, the review process continues unchanged on the list, and I can begin the relocate_code() work without having to wait for your series to be applied or to apply every patch in your series manualy myself.

Quoted 1 line

Please just Cc me when you will post these patches so that I review them.

I will.

Quoted 2 lines

Best regards,
Beno?t

Amicalement,

Signature · 1 line
Albert.