Skip to contentSkip to conversation

Add support for Freescale MX53

PATCH Superseded Jason Liu 7 participants 28 messages Dec 16, 2010 – Dec 27, 2010

Subsystems (5)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Jason Liu

author
#0 lore raw

cover Add support for Freescale MX53

The following patch set add support for Freescale MX53

Jason Liu (5):
MX5: Add initial support for MX53
serial_mxc: add support for MX53 processor
fec_mxc: add support for MX53 processor
mxc_i2c: add support for MX53 processor
MX5:MX53: add initial support for MX53EVK board

 MAINTAINERS                                 |    3 +
 arch/arm/cpu/armv7/mx5/iomux.c              |   30 ++-
 arch/arm/cpu/armv7/mx5/lowlevel_init.S      |   92 ++++---
 arch/arm/cpu/armv7/mx5/soc.c                |   14 +-
 arch/arm/cpu/armv7/u-boot.lds               |    1 +
 arch/arm/include/asm/arch-mx5/asm-offsets.h |    5 +
 arch/arm/include/asm/arch-mx5/imx-regs.h    |   78 ++---
 arch/arm/include/asm/arch-mx5/iomux.h       |  102 ------
 arch/arm/include/asm/arch-mx5/mx5x_pins.h   |  469 ++++++++++++++++++++++++++-
 board/freescale/mx53evk/Makefile            |   49 +++
 board/freescale/mx53evk/config.mk           |   23 ++
 board/freescale/mx53evk/ivt.S               |  289 +++++++++++++++++
 board/freescale/mx53evk/mx53evk.c           |  412 +++++++++++++++++++++++
 boards.cfg                                  |    1 +
 drivers/i2c/mxc_i2c.c                       |   18 +-
 drivers/net/fec_mxc.c                       |    2 +-
 drivers/net/fec_mxc.h                       |    4 +-
 drivers/serial/serial_mxc.c                 |    6 +
 include/configs/mx51evk.h                   |    3 +-
 include/configs/mx53evk.h                   |  213 ++++++++++++
 20 files changed, 1607 insertions(+), 207 deletions(-)
 mode change 100644 => 100755 arch/arm/cpu/armv7/mx5/iomux.c
 mode change 100644 => 100755 arch/arm/cpu/armv7/mx5/lowlevel_init.S
 mode change 100644 => 100755 arch/arm/include/asm/arch-mx5/imx-regs.h
 mode change 100644 => 100755 arch/arm/include/asm/arch-mx5/mx5x_pins.h
 create mode 100755 board/freescale/mx53evk/Makefile
 create mode 100755 board/freescale/mx53evk/config.mk
 create mode 100755 board/freescale/mx53evk/ivt.S
 create mode 100755 board/freescale/mx53evk/mx53evk.c
 mode change 100644 => 100755 drivers/i2c/mxc_i2c.c
 mode change 100644 => 100755 include/configs/mx51evk.h
 create mode 100755 include/configs/mx53evk.h
author
#1 lore raw

PATCH 1/5 MX5: Add initial support for MX53

Add initial support for Freescale MX53 processor,

- Add the iomux support and the pin definition,
- Add the regs definition, clean up some unused def from mx51,
- Add the low level init support, make use the freq input of setup_pll macro

---
Changes for v2:
--address some comments of Stefano Babic,

---
 arch/arm/cpu/armv7/mx5/iomux.c              |   30 ++-
 arch/arm/cpu/armv7/mx5/lowlevel_init.S      |   92 ++++---
 arch/arm/cpu/armv7/mx5/soc.c                |   14 +-
 arch/arm/include/asm/arch-mx5/asm-offsets.h |    5 +
 arch/arm/include/asm/arch-mx5/imx-regs.h    |   78 ++---
 arch/arm/include/asm/arch-mx5/iomux.h       |  102 ------
 arch/arm/include/asm/arch-mx5/mx5x_pins.h   |  469 ++++++++++++++++++++++++++-
 include/configs/mx51evk.h                   |    3 +-
 8 files changed, 594 insertions(+), 199 deletions(-)
 mode change 100644 => 100755 arch/arm/cpu/armv7/mx5/iomux.c
 mode change 100644 => 100755 arch/arm/cpu/armv7/mx5/lowlevel_init.S
 mode change 100644 => 100755 arch/arm/include/asm/arch-mx5/imx-regs.h
 mode change 100644 => 100755 arch/arm/include/asm/arch-mx5/mx5x_pins.h
 mode change 100644 => 100755 include/configs/mx51evk.h
arch/arm/cpu/armv7/mx5/iomux.c +25 -5
old mode 100644
new mode 100755
index e8928d5..d4e3bbb
@@ -34,7 +34,7 @@ enum iomux_reg_addr {
 	IOMUXSW_MUX_CTL = IOMUXC_BASE_ADDR,
 	IOMUXSW_MUX_END = IOMUXC_BASE_ADDR + MUX_I_END,
 	IOMUXSW_PAD_CTL = IOMUXC_BASE_ADDR + PAD_I_START,
-	IOMUXSW_INPUT_CTL = IOMUXC_BASE_ADDR,
+	IOMUXSW_INPUT_CTL = IOMUXC_BASE_ADDR + INPUT_CTL_START,
 };
 
 #define MUX_PIN_NUM_MAX (((MUX_I_END - MUX_I_START) >> 2) + 1)
@@ -44,11 +44,12 @@ static inline u32 get_mux_reg(iomux_pin_name_t pin)
 {
 	u32 mux_reg = PIN_TO_IOMUX_MUX(pin);
 
+#if defined(CONFIG_MX51)
 	if (is_soc_rev(CHIP_REV_2_0) < 0) {
 		/*
 		 * Fixup register address:
-		 *	i.MX51 TO1 has offset with the register
-		 * 	which is define as TO2.
+		 * i.MX51 TO1 has offset with the register
+		 * which is define as TO2.
 		 */
 		if ((pin == MX51_PIN_NANDF_RB5) ||
 			(pin == MX51_PIN_NANDF_RB6) ||
@@ -59,6 +60,7 @@ static inline u32 get_mux_reg(iomux_pin_name_t pin)
 		else if (mux_reg >= 0x130)
 			mux_reg += 0xC;
 	}
+#endif
 	mux_reg += IOMUXSW_MUX_CTL;
 	return mux_reg;
 }
@@ -68,11 +70,12 @@ static inline u32 get_pad_reg(iomux_pin_name_t pin)
 {
 	u32 pad_reg = PIN_TO_IOMUX_PAD(pin);
 
+#if defined(CONFIG_MX51)
 	if (is_soc_rev(CHIP_REV_2_0) < 0) {
 		/*
 		 * Fixup register address:
-		 *	i.MX51 TO1 has offset with the register
-		 * 	which is define as TO2.
+		 * i.MX51 TO1 has offset with the register
+		 * which is define as TO2.
 		 */
 		if ((pin == MX51_PIN_NANDF_RB5) ||
 			(pin == MX51_PIN_NANDF_RB6) ||
@@ -91,6 +94,7 @@ static inline u32 get_pad_reg(iomux_pin_name_t pin)
 		else
 			pad_reg += 8;
 	}
+#endif
 	pad_reg += IOMUXSW_PAD_CTL;
 	return pad_reg;
 }
@@ -98,10 +102,13 @@ static inline u32 get_pad_reg(iomux_pin_name_t pin)
 /* Get the last iomux register address */
 static inline u32 get_mux_end(void)
 {
+#if defined(CONFIG_MX51)
 	if (is_soc_rev(CHIP_REV_2_0) < 0)
 		return IOMUXC_BASE_ADDR + (0x3F8 - 4);
 	else
 		return IOMUXC_BASE_ADDR + (0x3F0 - 4);
+#endif
+	return IOMUXSW_MUX_END;
 }
 
 /*
@@ -164,3 +171,16 @@ unsigned int mxc_iomux_get_pad(iomux_pin_name_t pin)
 	u32 pad_reg = get_pad_reg(pin);
 	return readl(pad_reg);
 }
+
+/*
+ * This function configures daisy-chain
+ *
+ * @param input    index of input select register
+ * @param config   the binary value of elements
+ */
+void mxc_iomux_set_input(iomux_input_select_t input, u32 config)
+{
+	u32 reg = IOMUXSW_INPUT_CTL + (input << 2);
+
+	writel(config, reg);
+}
arch/arm/cpu/armv7/mx5/lowlevel_init.S +55 -37

193 lines not on this page · raw message

arch/arm/cpu/armv7/mx5/soc.c +13 -1
index 2900119..f5e0283 100644
@@ -35,6 +35,8 @@
 
 #if defined(CONFIG_MX51)
 #define CPU_TYPE 0x51000
+#elif defined(CONFIG_MX53)
+#define CPU_TYPE 0x53000
 #else
 #error "CPU_TYPE not defined"
 #endif
@@ -44,6 +46,7 @@ u32 get_cpu_rev(void)
 	int system_rev = CPU_TYPE;
 	int reg = __raw_readl(ROM_SI_REV);
 
+#if defined(CONFIG_MX51)
 	switch (reg) {
 	case 0x02:
 		system_rev |= CHIP_REV_1_1;
@@ -57,11 +60,20 @@ u32 get_cpu_rev(void)
 	case 0x20:
 		system_rev |= CHIP_REV_3_0;
 		break;
-	return system_rev;
 	default:
 		system_rev |= CHIP_REV_1_0;
 		break;
 	}
+#else
+	switch (reg) {
+	case 0x20:
+		system_rev |= CHIP_REV_2_0;
+		break;
+	default:
+		system_rev |= CHIP_REV_1_0;
+		break;
+	}
+#endif
 	return system_rev;
 }
 
arch/arm/include/asm/arch-mx5/asm-offsets.h +5 -0
index afd2728..2258f2f 100644
@@ -37,7 +37,12 @@
 #define CLKCTL_CCGR4            0x78
 #define CLKCTL_CCGR5            0x7C
 #define CLKCTL_CCGR6            0x80
+#if defined(CONFIG_MX53)
+#define CLKCTL_CCGR7            0x84
 #define CLKCTL_CMEOR            0x84
+#elif defined(CONFIG_MX51)
+#define CLKCTL_CMEOR            0x84
+#endif
 
 /* DPLL */
 #define PLL_DP_CTL	0x00
arch/arm/include/asm/arch-mx5/imx-regs.h +29 -49

116 lines not on this page · raw message

arch/arm/include/asm/arch-mx5/iomux.h +0 -102

108 lines not on this page · raw message

arch/arm/include/asm/arch-mx5/mx5x_pins.h +466 -3

490 lines not on this page · raw message

include/configs/mx51evk.h +1 -2
old mode 100644
new mode 100755
index b4e5738..3d6d390
@@ -24,8 +24,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-#include <asm/arch/imx-regs.h>
-
  /* High Level Configuration Options */
 
 #define CONFIG_MX51	/* in a mx51 */
@@ -37,6 +35,7 @@
 
 #define CONFIG_L2_OFF
 
+#include <asm/arch/imx-regs.h>
 /*
  * Disabled for now due to build problems under Debian and a significant
  * increase in the final file size: 144260 vs. 109536 Bytes.
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 1/5 MX5: Add initial support for MX53

Dear Jason Liu,

Quoted 9 lines · In message <[email protected]> you wrote:

Add initial support for Freescale MX53 processor,

- Add the iomux support and the pin definition,
- Add the regs definition, clean up some unused def from mx51,
- Add the low level init support, make use the freq input of setup_pll macro

---
Changes for v2:
--address some comments of Stefano Babic,

Damn. What are we supposed to make of that?

So you addresses some of his comments, but not all of them?

And what exactly did you change? Or what did you not change?

Do you think we have time and resources to compare all your patch versions?

Please provide a detailed explanation of changes for the whole patch series!

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
How many Unix hacks does it take to change a light bulb?  Let's  see,
   can you use a shell script for that or does it need a C program?
#3 lore raw

PATCH 1/5 MX5: Add initial support for MX53

Hi, Wolfgang,

2010/12/16 Wolfgang Denk <[email protected]>:

Quoted 17 lines

Dear Jason Liu,

Quoted 9 lines · In message <[email protected]> you wrote:

Add initial support for Freescale MX53 processor,

- Add the iomux support and the pin definition,
- Add the regs definition, clean up some unused def from mx51,
- Add the low level init support, make use the freq input of setup_pll macro

---
Changes for v2:
--address some comments of Stefano Babic,

Damn. What are we supposed to make of that?

So you addresses some of his comments, but not all of them?

Quoted 8 lines

And what exactly did you change? ?Or what did you not change?

Do you think we have time and resources to compare all your patch versions?

Please provide a detailed explanation of changes for the whole patch series!

U are right. I will take care later.

Quoted 16 lines

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de How many Unix hacks does it take to change a light bulb? ?Let's ?see, ? can you use a shell script for that or does it need a C program?
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#4 lore raw

PATCH 1/5 MX5: Add initial support for MX53

In reply to Jason Liu
Quoted 9 lines · Jason Liu

Add initial support for Freescale MX53 processor,

- Add the iomux support and the pin definition,
- Add the regs definition, clean up some unused def from mx51,
- Add the low level init support, make use the freq input of setup_pll macro

---
Changes for v2:
--address some comments of Stefano Babic,

Please add always the version number in the e-mail subject, if it is a resubmission, so we can know there is a previous version. Please add a small list with all changes, as I cannot know which of them you implemented.

arch/arm/cpu/armv7/mx5/soc.c line 42

Quoted 13 lines
arch/arm/cpu/armv7/mx5/soc.c +2 -0
index 2900119..f5e0283 100644
@@ -35,6 +35,8 @@
 
 #if defined(CONFIG_MX51)
 #define CPU_TYPE 0x51000
+#elif defined(CONFIG_MX53)
+#define CPU_TYPE 0x53000
 #else
 #error "CPU_TYPE not defined"
 #endif

In the previous discussion on first submit it seemd to me you agreed to change this part, as we have already CONFIG_MX51 and CONFIG_MX53 and additional defines are not needed. However, you resubmit the same code.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#5 lore raw

PATCH 1/5 MX5: Add initial support for MX53

Hi, Stefano,

2010/12/16 Stefano Babic <[email protected]>:

Quoted 7 lines · Jason Liu
Quoted 6 lines

Add initial support for Freescale MX53 processor,

- Add the iomux support and the pin definition,
- Add the regs definition, clean up some unused def from mx51,
- Add the low level init support, make use the freq input of setup_pll macro

Quoted 7 lines
Quoted 3 lines

---
Changes for v2:
--address some comments of Stefano Babic,

Please add always the version number in the e-mail subject, if it is a resubmission, so we can know there is a previous version. Please add a small list with all changes, as I cannot know which of them you implemented.

OK, I will take care of it later.

Quoted 7 lines
Quoted 7 lines
arch/arm/cpu/armv7/mx5/soc.c +0 -0
index 2900119..f5e0283 100644
@@ -35,6 +35,8 @@
 
Quoted 11 lines
Quoted 7 lines
arch/arm/cpu/armv7/mx5/soc.c +0 -0
 ?#if defined(CONFIG_MX51)

?#define CPU_TYPE 0x51000

arch/arm/cpu/armv7/mx5/soc.c +2 -0
+#elif defined(CONFIG_MX53)
+#define CPU_TYPE 0x53000

?#else
?#error "CPU_TYPE not defined"
?#endif

In the previous discussion on first submit it seemd to me you agreed to change this part, as we have already CONFIG_MX51 and CONFIG_MX53 and additional defines are not needed. However, you resubmit the same code.

This code is just adding MX53 based on MX51 code base. I don't think there are some issues.
But if you insist on changing the original MX51 code and use another way to do it, I will do it
in the coming patch set.

Thanks,

BR,
Jason

Quoted 15 lines

Best regards,
Stefano Babic

--
=====================================================================
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 ?Email: office at denx.de
=====================================================================
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

author
#6 lore raw

PATCH 2/5 serial_mxc: add support for MX53 processor

In reply to Jason Liu

This patch add UART support for Freescale MX53 processor

---
 drivers/serial/serial_mxc.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/serial/serial_mxc.c +6 -0
index f96b21f..805f4c5 100644
@@ -56,6 +56,12 @@
 #define UART_PHYS UART2_BASE_ADDR
 #elif defined(CONFIG_SYS_MX51_UART3)
 #define UART_PHYS UART3_BASE_ADDR
+#elif defined(CONFIG_SYS_MX53_UART1)
+#define UART_PHYS UART1_BASE_ADDR
+#elif defined(CONFIG_SYS_MX53_UART2)
+#define UART_PHYS UART2_BASE_ADDR
+#elif defined(CONFIG_SYS_MX53_UART3)
+#define UART_PHYS UART3_BASE_ADDR
 #else
 #error "define CONFIG_SYS_MXxx_UARTx to use the MXC UART driver"
 #endif
Signature · 1 line
1.7.0.4
author
#7 lore raw

PATCH 3/5 fec_mxc: add support for MX53 processor

In reply to Jason Liu

This patch add FEC support for Freescale MX53 processor

---
 drivers/net/fec_mxc.c |    2 +-
 drivers/net/fec_mxc.h |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/fec_mxc.c +1 -1
index 0d0f392..652ced4 100644
@@ -354,7 +354,7 @@ static int fec_open(struct eth_device *edev)
 	 */
 	writel(readl(&fec->eth->ecntrl) | FEC_ECNTRL_ETHER_EN,
 		&fec->eth->ecntrl);
-#ifdef CONFIG_MX25
+#if defined(CONFIG_MX25) || defined(CONFIG_MX53)
 	udelay(100);
 	/*
 	 * setup the MII gasket for RMII mode
drivers/net/fec_mxc.h +2 -2
index 5d0d69d..1ba5161 100644
@@ -147,7 +147,7 @@ struct ethernet_regs {
 
 	uint32_t res14[7];		/* MBAR_ETH + 0x2E4-2FC */
 
-#ifdef CONFIG_MX25
+#if defined(CONFIG_MX25) || defined(CONFIG_MX53)
 	uint16_t miigsk_cfgr;		/* MBAR_ETH + 0x300 */
 	uint16_t res15[3];		/* MBAR_ETH + 0x302-306 */
 	uint16_t miigsk_enr;		/* MBAR_ETH + 0x308 */
@@ -204,7 +204,7 @@ struct ethernet_regs {
 #define FEC_ECNTRL_RESET		0x00000001	/* reset the FEC */
 #define FEC_ECNTRL_ETHER_EN		0x00000002	/* enable the FEC */
 
-#ifdef CONFIG_MX25
+#if defined(CONFIG_MX25) || defined(CONFIG_MX53)
 /* defines for MIIGSK */
 /* RMII frequency control: 0=50MHz, 1=5MHz */
 #define MIIGSK_CFGR_FRCONT		(1 << 6)
Signature · 1 line
1.7.0.4
author
#8 lore raw

PATCH 4/5 mxc_i2c: add support for MX53 processor

In reply to Jason Liu

This patch add I2C support for Freescale MX53 processor

---
 drivers/i2c/mxc_i2c.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)
 mode change 100644 => 100755 drivers/i2c/mxc_i2c.c
drivers/i2c/mxc_i2c.c +13 -5
old mode 100644
new mode 100755
index 8e10fbb..f9f32cc
@@ -24,10 +24,11 @@
 
 #include <common.h>
 
-#if defined(CONFIG_HARD_I2C)
+#if defined(CONFIG_MX53)
+#include <asm/arch/clock.h>
+#endif
 
-#include <asm/arch/mx31.h>
-#include <asm/arch/mx31-regs.h>
+#if defined(CONFIG_HARD_I2C)
 
 #define IADR	0x00
 #define IFDR	0x04
@@ -56,8 +57,10 @@
 #elif defined (CONFIG_SYS_I2C_MX31_PORT3)
 #define I2C_BASE	0x43f84000
 #define I2C_CLK_OFFSET	30
+#elif defined(CONFIG_SYS_I2C_PORT)
+#define I2C_BASE CONFIG_SYS_I2C_PORT
 #else
-#error "define CONFIG_SYS_I2C_MX31_PORTx to use the mx31 I2C driver"
+#error "define CONFIG_SYS_I2C_PORT to use the I2C driver"
 #endif
 
 #ifdef DEBUG
@@ -72,11 +75,16 @@ static u16 div[] = { 30, 32, 36, 42, 48, 52, 60, 72, 80, 88, 104, 128, 144,
 
 void i2c_init(int speed, int unused)
 {
-	int freq = mx31_get_ipg_clk();
+	int freq;
 	int i;
 
+#ifdef CONFIG_MX31
+	freq = mx31_get_ipg_clk();
 	/* start the required I2C clock */
 	__REG(CCM_CGR0) = __REG(CCM_CGR0) | (3 << I2C_CLK_OFFSET);
+#else
+	freq = mxc_get_clock(MXC_IPG_PERCLK);
+#endif
 
 	for (i = 0; i < 0x1f; i++)
 		if (freq / div[i] <= speed)
Signature · 1 line
1.7.0.4
#9 lore raw

PATCH 4/5 mxc_i2c: add support for MX53 processor

Hello Jason,

Quoted 15 lines · Jason Liu

This patch add I2C support for Freescale MX53 processor

---
 drivers/i2c/mxc_i2c.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)
 mode change 100644 => 100755 drivers/i2c/mxc_i2c.c
drivers/i2c/mxc_i2c.c +0 -0
old mode 100644
new mode 100755
index 8e10fbb..f9f32cc

drivers/i2c/mxc_i2c.c line 30

Quoted 10 lines
drivers/i2c/mxc_i2c.c +3 -3
@@ -24,10 +24,11 @@
 
 #include <common.h>
 
-#if defined(CONFIG_HARD_I2C)
+#if defined(CONFIG_MX53)
+#include <asm/arch/clock.h>
+#endif
 
-#include <asm/arch/mx31.h>
-#include <asm/arch/mx31-regs.h>

Why do you delete this includes? That will break mx31 boards. Please add instead a

#if defined(CONFIG_MX31) around it

drivers/i2c/mxc_i2c.c line 31

Quoted 1 line
drivers/i2c/mxc_i2c.c +1 -0
+#if defined(CONFIG_HARD_I2C)

Why you move this define here?

drivers/i2c/mxc_i2c.c line 63

Quoted 11 lines
drivers/i2c/mxc_i2c.c +3 -1
 #define IADR	0x00
 #define IFDR	0x04
@@ -56,8 +57,10 @@
 #elif defined (CONFIG_SYS_I2C_MX31_PORT3)
 #define I2C_BASE	0x43f84000
 #define I2C_CLK_OFFSET	30
+#elif defined(CONFIG_SYS_I2C_PORT)
+#define I2C_BASE CONFIG_SYS_I2C_PORT
 #else
-#error "define CONFIG_SYS_I2C_MX31_PORTx to use the mx31 I2C driver"
+#error "define CONFIG_SYS_I2C_PORT to use the I2C driver"

This error message will be not correct on mx31 based boards, as they have to define CONFIG_SYS_I2C_MX31_PORTx, please correct.

Quoted 11 lines
drivers/i2c/mxc_i2c.c +1 -1
 #endif
 
 #ifdef DEBUG
@@ -72,11 +75,16 @@ static u16 div[] = { 30, 32, 36, 42, 48, 52, 60, 72, 80, 88, 104, 128, 144,
 
 void i2c_init(int speed, int unused)
 {
-	int freq = mx31_get_ipg_clk();
+	int freq;
 	int i;
 

drivers/i2c/mxc_i2c.c static u16 div[] = { 30, 32, 36, 42, 48, 52, 60, 72, 80, 88, 104, 128, 144, · line 90

Quoted 10 lines
drivers/i2c/mxc_i2c.c +5 -0
+#ifdef CONFIG_MX31
+	freq = mx31_get_ipg_clk();
 	/* start the required I2C clock */
 	__REG(CCM_CGR0) = __REG(CCM_CGR0) | (3 << I2C_CLK_OFFSET);
+#else
+	freq = mxc_get_clock(MXC_IPG_PERCLK);
+#endif
 
 	for (i = 0; i < 0x1f; i++)
 		if (freq / div[i] <= speed)

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#10 lore raw

PATCH 4/5 mxc_i2c: add support for MX53 processor

Hi, Heiko

2010/12/16 Heiko Schocher <[email protected]>:

Quoted 26 lines

Hello Jason,

Quoted 23 lines · Jason Liu

This patch add I2C support for Freescale MX53 processor

---
?drivers/i2c/mxc_i2c.c | ? 18 +++++++++++++----- ?1 files changed, 13 insertions(+), 5 deletions(-) ?mode change 100644 => 100755 drivers/i2c/mxc_i2c.c

drivers/i2c/mxc_i2c.c +0 -0
old mode 100644
new mode 100755
index 8e10fbb..f9f32cc
@@ -24,10 +24,11 @@
 

?#include <common.h>

drivers/i2c/mxc_i2c.c +3 -1
-#if defined(CONFIG_HARD_I2C)
+#if defined(CONFIG_MX53)
+#include <asm/arch/clock.h>
+#endif
Quoted 5 lines

drivers/i2c/mxc_i2c.c line 30

Quoted 2 lines
drivers/i2c/mxc_i2c.c +0 -2
-#include <asm/arch/mx31.h>
-#include <asm/arch/mx31-regs.h>

Why do you delete this includes? That will break mx31 boards. Please add instead a

As I think there is no need to include it? Am I wrong?
I see the only one board to use MXC_I2C is phycore, but it will build error,

board.c: In function '__dram_init_banksize':
board.c:233: error: 'CONFIG_SYS_SDRAM_BASE' undeclared (first use in this function)
board.c:233: error: (Each undeclared identifier is reported only once board.c:233: error: for each function it appears in.) board.c: In function 'board_init_f':
board.c:279: error: 'CONFIG_SYS_INIT_SP_ADDR' undeclared (first use in this function)
board.c:312: error: 'CONFIG_SYS_SDRAM_BASE' undeclared (first use in this function)
make[1]: *** [board.o] Error 1
make[1]: Leaving directory `/home/r64343/work_space/u-boot-upstream/u-boot/arch/arm/lib'
make: *** [arch/arm/lib/libarm.o] Error 2

Quoted 54 lines

#if defined(CONFIG_MX31) around it

Quoted 1 line

+#if defined(CONFIG_HARD_I2C)

Why you move this define here?

drivers/i2c/mxc_i2c.c line 63

Quoted 11 lines

?#define IADR 0x00
?#define IFDR 0x04

drivers/i2c/mxc_i2c.c +0 -0
@@ -56,8 +57,10 @@
 ?#elif defined (CONFIG_SYS_I2C_MX31_PORT3)

?#define I2C_BASE ? ? 0x43f84000
?#define I2C_CLK_OFFSET ? ? ? 30

drivers/i2c/mxc_i2c.c +2 -0
+#elif defined(CONFIG_SYS_I2C_PORT)
+#define I2C_BASE CONFIG_SYS_I2C_PORT

?#else

drivers/i2c/mxc_i2c.c +1 -1
-#error "define CONFIG_SYS_I2C_MX31_PORTx to use the mx31 I2C driver"
+#error "define CONFIG_SYS_I2C_PORT to use the I2C driver"

This error message will be not correct on mx31 based boards, as they have to define CONFIG_SYS_I2C_MX31_PORTx, please correct.

Quoted 19 lines

?#endif

?#ifdef DEBUG

drivers/i2c/mxc_i2c.c +3 -1
@@ -72,11 +75,16 @@ static u16 div[] = { 30, 32, 36, 42, 48, 52, 60, 72, 80, 88, 104, 128, 144,
 
 ?void i2c_init(int speed, int unused)
 ?{
- ? ? int freq = mx31_get_ipg_clk();
+ ? ? int freq;
 ? ? ? int i;
 
+#ifdef CONFIG_MX31
+ ? ? freq = mx31_get_ipg_clk();

? ? ? /* start the required I2C clock */
? ? ? __REG(CCM_CGR0) = __REG(CCM_CGR0) | (3 << I2C_CLK_OFFSET);

drivers/i2c/mxc_i2c.c +3 -0
+#else
+ ? ? freq = mxc_get_clock(MXC_IPG_PERCLK);
+#endif
Quoted 2 lines

? ? ? for (i = 0; i < 0x1f; i++)
? ? ? ? ? ? ? if (freq / div[i] <= speed)

bye,
Heiko
--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

author
#11 lore raw

PATCH 5/5 MX5:MX53: add initial support for MX53EVK board

In reply to Jason Liu

Add initial support for MX53EVK board support.
FEC, SD/MMC, UART, I2C, have been support.

---
 MAINTAINERS                       |    3 +
 arch/arm/cpu/armv7/u-boot.lds     |    1 +
 board/freescale/mx53evk/Makefile  |   49 +++++
 board/freescale/mx53evk/config.mk |   23 ++
 board/freescale/mx53evk/ivt.S     |  289 ++++++++++++++++++++++++++
 board/freescale/mx53evk/mx53evk.c |  412 +++++++++++++++++++++++++++++++++++++
 boards.cfg                        |    1 +
 include/configs/mx53evk.h         |  213 +++++++++++++++++++
 8 files changed, 991 insertions(+), 0 deletions(-)
 create mode 100755 board/freescale/mx53evk/Makefile
 create mode 100755 board/freescale/mx53evk/config.mk
 create mode 100755 board/freescale/mx53evk/ivt.S
 create mode 100755 board/freescale/mx53evk/mx53evk.c
 create mode 100755 include/configs/mx53evk.h
MAINTAINERS +3 -0
index 0590ad9..c87ca56 100644
@@ -1085,6 +1085,9 @@ Peter Meerwald <[email protected]>
 
 	bct-brettl2	BF536
 
+Jason Liu <[email protected]>
+
+	MX53evk         i.MX53
 #########################################################################
 # End of MAINTAINERS list						#
 #########################################################################
arch/arm/cpu/armv7/u-boot.lds +1 -0
index 5725c30..7b6ab66 100644
@@ -34,6 +34,7 @@ SECTIONS
 	. = ALIGN(4);
 	.text	:
 	{
+		*(.ivt)
 		arch/arm/cpu/armv7/start.o	(.text)
 		*(.text)
 	}
board/freescale/mx53evk/Makefile new file +49 -0

49 lines not on this page · raw message

board/freescale/mx53evk/config.mk new file +23 -0
new file mode 100755
index 0000000..2b21a08
@@ -0,0 +1,23 @@
+#
+# Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved.
+#
+# 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
+#
+
+CONFIG_SYS_TEXT_BASE = 0x77800000
board/freescale/mx53evk/ivt.S new file +289 -0

289 lines not on this page · raw message

board/freescale/mx53evk/mx53evk.c new file +412 -0

412 lines not on this page · raw message

boards.cfg +1 -0
index dcd5a12..736e88e 100644
@@ -101,6 +101,7 @@ omap5912osk                  arm         arm926ejs   -                   ti
 edminiv2                     arm         arm926ejs   -                   LaCie          orion5x
 ca9x4_ct_vxp                 arm         armv7       vexpress            armltd
 mx51evk                      arm         armv7       mx51evk             freescale      mx5
+mx53evk                      arm         armv7       mx53evk             freescale      mx5
 vision2                      arm         armv7       vision2             ttcontrol      mx5
 omap3_overo                  arm         armv7       overo               -              omap3
 omap3_pandora                arm         armv7       pandora             -              omap3
include/configs/mx53evk.h new file +213 -0

213 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#12 lore raw

PATCH 5/5 MX5:MX53: add initial support for MX53EVK board

Le 16/12/2010 11:17, Jason Liu a ?crit :

arch/arm/cpu/armv7/u-boot.lds SECTIONS · line 37

Quoted 9 lines
arch/arm/cpu/armv7/u-boot.lds +1 -0
index 5725c30..7b6ab66 100644
@@ -34,6 +34,7 @@ SECTIONS
  	. = ALIGN(4);
  	.text	:
  	{
+		*(.ivt)

NAK. This IVT looks suspiciously like an IPL or header for some bootloader to me. It should not be part of u-boot, but should be built separately then glued to u-boot.bin like is done for NAND bootings. U-boot LDS files for ARM should always start with the reset and exception vectors, i.e. start.o.

Quoted 52 lines
arch/arm/cpu/armv7/u-boot.lds +0 -0
  		arch/arm/cpu/armv7/start.o	(.text)
  		*(.text)
  	}
board/freescale/mx53evk/ivt.S new file +42 -0
new file mode 100755
index 0000000..f7a176f
@@ -0,0 +1,289 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * 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
+ * .word with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include<config.h>
+
+.section ".ivt"
+
+ivt_header:         .word 0x402000D1    /* Tag=0xD1, Len=0x0020, Ver=0x40 */
+app_code_jump_v:    .word (0xF8006400 + (plugin_start - CONFIG_SYS_TEXT_BASE))
+reserv1:            .word 0x0
+dcd_ptr:            .word 0x0
+boot_data_ptr:      .word (0xF8006400 + (boot_data - CONFIG_SYS_TEXT_BASE))
+self_ptr:           .word (0xF8006400 + (ivt_header - CONFIG_SYS_TEXT_BASE))
+app_code_csf:       .word 0x0
+reserv2:            .word 0x0
+boot_data:          .word 0xF8006000
+image_len:          .word 2*1024
+plugin:             .word 0x1
+
+/* Second IVT to give entry point into the bootloader copied to DDR */
+ivt2_header:        .word 0x402000D1    /*Tag=0xD1, Len=0x0020, Ver=0x40 */
+app2_code_jump_v:   .word _start        /*Entry point for the bootloader */
+reserv3:            .word 0x0
+dcd2_ptr:           .word 0x0
+boot_data2_ptr:     .word boot_data2
+self_ptr2:          .word ivt2_header

board/freescale/mx53evk/ivt.S line 52

Quoted 10 lines
board/freescale/mx53evk/ivt.S new file +10 -0
+app_code_csf2:      .word 0x0
+reserv4:            .word 0x0
+boot_data2:         .word (CONFIG_SYS_TEXT_BASE - 0x400)
+image_len2:         .word (_end - CONFIG_SYS_TEXT_BASE)
+plugin2:            .word 0x0
+
+
+/* Here starts the plugin code */
+plugin_start:
+	/* Save the return address and the function arguments */

The entry point of u-boot should be the reset vector. Obviously this is not a reset vector, and looks more like a hook that some ROM code expects to call as a subroutine. In any case, it should not be the entry code of u-boot.

Please consider refactoring this into two different binaries as NAND boot does.

Amicalement,

Signature · 1 line
Albert.
#13 lore raw

PATCH 5/5 MX5:MX53: add initial support for MX53EVK board

Dear Albert ARIBAUD,

Quoted 14 lines · In message <[email protected]> you wrote:

arch/arm/cpu/armv7/u-boot.lds SECTIONS · line 37

Quoted 10 lines
arch/arm/cpu/armv7/u-boot.lds +1 -0
index 5725c30..7b6ab66 100644
@@ -34,6 +34,7 @@ SECTIONS
  	. = ALIGN(4);
  	.text	:
  	{
+		*(.ivt)

NAK. This IVT looks suspiciously like an IPL or header for some bootloader to me. It should not be part of u-boot, but should be built separately then glued to u-boot.bin like is done for NAND bootings.

... or like the u-boot.kwb or u-boot.imx images we already build for other architectures.

Actually this should probably be added to u-boot.imx support?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Anarchy may not be the best form of government, but it's better  than
no government at all.
#14 lore raw

PATCH 5/5 MX5:MX53: add initial support for MX53EVK board

In reply to Jason Liu
Quoted 8 lines · Jason Liu

Add initial support for MX53EVK board support.
FEC, SD/MMC, UART, I2C, have been support.

arch/arm/cpu/armv7/u-boot.lds +0 -0
index 5725c30..7b6ab66 100644

arch/arm/cpu/armv7/u-boot.lds SECTIONS · line 40

Quoted 7 lines
arch/arm/cpu/armv7/u-boot.lds +1 -0
@@ -34,6 +34,7 @@ SECTIONS
 	. = ALIGN(4);
 	.text	:
 	{
+		*(.ivt)
 		arch/arm/cpu/armv7/start.o	(.text)
 		*(.text)
 	}

We have already discussed this point, see my previous answer here:

	http://marc.info/?l=u-boot&m=127793013695282&w=2

The solution in u-boot is *not* to link statically the IMX header to the u-boot.bin, but to generate a u-boot.imx image with a configuration file. This solution is already provided for the i.MX51 processor (same family), and you should go on this way, modifying tools/imximage.c for your needs, if required. This solution was previously discussed and accepted on the ML and it is compatible with other processors from different manufactures (kirchwood, see also u-boot.kwb).

As already answered by Albert and Wolfgang, the header must not be part of u-boot.bin.

Quoted 1 line

+SOBJS := ivt.o

This should be removed, and a imximage.cfg file should be written.

Quoted 179 lines
arch/arm/cpu/armv7/u-boot.lds +179 -0
+plugin_start:
+	/* Save the return address and the function arguments */
+	push {r0-r3, lr}
+
+	ldr r0, =ROM_SI_REV
+	ldr r1, [r0]
+
+	cmp r1, #0x20
+
+	/* IOMUX Setup */
+	ldr r0, =0x53fa8500
+	moveq r1, #0x00180000
+	movne r1, #0x00380000
+	mov r2, #0x00380000
+	add r2, r2, #0x40
+	add r3, r1, #0x40
+	mov r4, #0x00200000
+
+	str r1, [r0, #0x54]
+	str r2, [r0, #0x58]
+	str r1, [r0, #0x60]
+	str r3, [r0, #0x64]
+	str r2, [r0, #0x68]
+
+	streq r1, [r0, #0x70]
+	strne r4, [r0, #0x70]
+	str r1, [r0, #0x74]
+	streq r1, [r0, #0x78]
+	strne r4, [r0, #0x78]
+	str r2, [r0, #0x7c]
+	str r3, [r0, #0x80]
+	str r1, [r0, #0x84]
+	str r1, [r0, #0x88]
+	str r2, [r0, #0x90]
+	str r1, [r0, #0x94]
+
+	ldr r0, =0x53fa86f0
+	str r1, [r0, #0x0]
+	mov r2, #0x00000200
+	str r2, [r0, #0x4]
+	mov r2, #0x00000000
+	str r2, [r0, #0xc]
+
+	ldr r0, =0x53fa8700
+	str r2, [r0, #0x14]
+	str r1, [r0, #0x18]
+	str r1, [r0, #0x1c]
+	str r1, [r0, #0x20]
+
+	moveq r2, #0x02000000
+	movne r2, #0x06000000
+
+	str r2, [r0, #0x24]
+	str r1, [r0, #0x28]
+	str r1, [r0, #0x2c]
+
+	/* Initialize DDR2 memory - Hynix H5PS2G83AFR */
+	ldr r0, =ESDCTL_BASE_ADDR
+
+	ldreq r1, =0x31333530
+	ldrne r1, =0x2b2f3031
+	str r1, [r0, #0x088]
+
+	ldreq r1, =0x4a474a44
+	ldrne r1, =0x40363333
+	str r1, [r0, #0x090]
+
+	/* add 3 logic unit of delay to sdclk  */
+	ldr r1, =0x00000f00
+	str r1, [r0, #0x098]
+
+	ldr r1, =0x00000800
+	str r1, [r0, #0x0F8]
+
+	ldreq r1, =0x02490241
+	ldrne r1, =0x01310132
+	str r1, [r0, #0x07c]
+
+	ldreq r1, =0x01710171
+	ldrne r1, =0x0133014b
+	str r1, [r0, #0x080]
+
+	/* Enable bank interleaving, RALAT = 0x4, DDR2_EN = 1 */
+	ldr r1, =0x00001710
+	str r1, [r0, #0x018]
+
+	ldr r1, =0xc4110000
+	str r1, [r0, #0x00]
+
+	ldr r1, =0x4d5122d2
+	str r1, [r0, #0x0C]
+
+	ldr r1, =0x92d18a22
+	str r1, [r0, #0x10]
+
+	ldr r1, =0x00c70092
+	str r1, [r0, #0x14]
+
+	ldr r1, =0x000026d2
+	str r1, [r0, #0x2C]
+
+	ldr r1, =0x009f000e
+	str r1, [r0, #0x30]
+
+	ldr r1, =0x12272000
+	str r1, [r0, #0x08]
+
+	ldr r1, =0x00030012
+	str r1, [r0, #0x04]
+
+	ldr r1, =0x04008010
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x00008032
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x00008033
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x00008031
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x0b5280b0
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x04008010
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x00008020
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x00008020
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x0a528030
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x03c68031
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x00468031
+	str r1, [r0, #0x1C]
+
+	/* Even though Rev B does not have DDR on CSD1, keep these
+	 * mode register initialization sequences for future uses since
+	 * it does not hurt to keep them
+	 */
+	ldr r1, =0x04008018
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x0000803a
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x0000803b
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x00008039
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x0b528138
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x04008018
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x00008028
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x00008028
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x0a528038
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x03c68039
+	str r1, [r0, #0x1C]
+
+	ldr r1, =0x00468039
+	str r1, [r0, #0x1C]

arch/arm/cpu/armv7/u-boot.lds

Quoted 10 lines
arch/arm/cpu/armv7/u-boot.lds +10 -0
+
+	ldr r1, =0x00005800
+	str r1, [r0, #0x20]
+
+	ldr r1, =0x00033337
+	str r1, [r0, #0x58]
+
+	ldr r1, =0x00000000
+	str r1, [r0, #0x1C]
+

Why do we need to write these registers in assembly ? Why cannot we move them into board_init or board_early_init_f ? And again, should these values described better in imximage.cfg ?

board/freescale/mx53evk/mx53evk.c line 7

Quoted 13 lines
board/freescale/mx53evk/mx53evk.c new file +7 -0
new file mode 100755
index 0000000..ff6bfb2
@@ -0,0 +1,412 @@
+/*
+ * Copyright (C) 2007, Guennadi Liakhovetski <[email protected]>
+ *
+ * (C) Copyright 2009-2010 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.

It seems to me that you derived this file from mx51evk.c, but you copied the header with copyrights from another (MX31, maybe) file.

board/freescale/mx53evk/mx53evk.c line 76

Quoted 2 lines
board/freescale/mx53evk/mx53evk.c new file +2 -0
+#ifdef CONFIG_I2C_MXC
+static void setup_i2c(unsigned int module_base)

I think it is better to enumerate the i2c controller as done in manual as with the physical address. Anyway, I do not see yet any released manual for this processor on Freescale's site, so I cannot be more precise.

board/freescale/mx53evk/mx53evk.c line 137

Quoted 11 lines
board/freescale/mx53evk/mx53evk.c new file +11 -0
+void power_init(void)
+{
+	unsigned char buf[4] = { 0 };
+	struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE;
+
+	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+
+	/* Set core voltage VDDGP to 1.05V for 800MHZ */
+	buf[0] = 0x45;
+	buf[1] = 0x4a;
+	buf[2] = 0x52;

Please remove all fixed constants in the file and replaced them with named constants, defined in a header file. Check vision2.c as reference. This board uses the MC13892 PMIC controller, and ./include/mc13892.h contains all required defines.

board/freescale/mx53evk/mx53evk.c line 22

Quoted 2 lines
board/freescale/mx53evk/mx53evk.c new file +2 -0
+	if (i2c_write(0x8, 24, 1, buf, 3))
+		return;

Ditto. The same globally.

board/freescale/mx53evk/mx53evk.c line 148

Quoted 1 line
board/freescale/mx53evk/mx53evk.c new file +1 -0
+	if (is_soc_rev(CHIP_REV_2_0) == 0) {

Please add some comments describing why depending on the processor revision we should to manage the pmic in a different way.

board/freescale/mx53evk/mx53evk.c line 235

Quoted 6 lines
board/freescale/mx53evk/mx53evk.c new file +6 -0
+int board_mmc_getcd(u8 *cd, struct mmc *mmc)
+{
+	struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
+
+	if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
+		*cd = readl(GPIO3_BASE_ADDR) & 0x2000;

Please change this. There is mxc_get_gpio() and mxc_set_gpio() accessors.

board/freescale/mx53evk/mx53evk.c line 369

Quoted 3 lines
board/freescale/mx53evk/mx53evk.c new file +3 -0
+int board_init(void)
+{
+	system_rev = get_cpu_rev();

I think we can get rid of system_rev. It is not used in this function and you can call get_cpu_rev() directly in checkboard() when the value is really needed.

board/freescale/mx53evk/mx53evk.c line 384

Quoted 4 lines
board/freescale/mx53evk/mx53evk.c new file +4 -0
+#ifdef BOARD_LATE_INIT
+int board_late_init(void)
+{
+#ifdef CONFIG_I2C_MXC

Is it the board working if the pmic is not configured ? As I remember from mx51evk, the network did not work if the PMIC via SPI was not configured. If this is the case even for mx53evk, setting CONFIG_I2C_MXC is a must, else a lot of thing cannot work. Then I would prefer to remove these #ifdef and producing an error if it is not set at the beginning of the file.

board/freescale/mx53evk/mx53evk.c line 396

Quoted 5 lines
board/freescale/mx53evk/mx53evk.c new file +5 -0
+int checkboard(void)
+{
+	puts("Board: MX53EVK [");
+
+	switch (__REG(SRC_BASE_ADDR + 0x8)) {

Again, there is a "src" structure for i.MX51. If it is not correct for i.MX53, you have to adapt it in imx-regs.h, but you cannot access directly to registers. Please use always the correct structure or define newer ones if they do not exist.

board/freescale/mx53evk/mx53evk.c line 45

Quoted 4 lines
board/freescale/mx53evk/mx53evk.c new file +4 -0
+/*
+ * Disabled for now due to build problems under Debian and a significant
+ * increase in the final file size: 144260 vs. 109536 Bytes.
+ */

I see the same comment in mx51evk.h, but does it make sense ?

board/freescale/mx53evk/mx53evk.c line 52

Quoted 7 lines
board/freescale/mx53evk/mx53evk.c new file +7 -0
+/*
+ * I2C Configs
+ */
+#define CONFIG_CMD_I2C          1
+#define CONFIG_HARD_I2C         1
+#define CONFIG_I2C_MXC          1
+#define CONFIG_SYS_I2C_PORT             I2C2_BASE_ADDR

As stated before: port means an enumeration value (0,1,..N), and it is set to a physical address.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#15 lore raw

PATCH 5/5 MX5:MX53: add initial support for MX53EVK board

Hi, Stefano,

2010/12/16 Stefano Babic <[email protected]>:

Quoted 29 lines · Jason Liu
Quoted 9 lines

Add initial support for MX53EVK board support.
FEC, SD/MMC, UART, I2C, have been support.

arch/arm/cpu/armv7/u-boot.lds +0 -0
index 5725c30..7b6ab66 100644
@@ -34,6 +34,7 @@ SECTIONS
 ? ? ? . = ALIGN(4);
Quoted 6 lines

? ? ? .text ? :
? ? ? {
+ ? ? ? ? ? ? *(.ivt)
? ? ? ? ? ? ? arch/arm/cpu/armv7/start.o ? ? ?(.text) ? ? ? ? ? ? ? *(.text)
? ? ? }

We have already discussed this point, see my previous answer here:

? ? ? ?http://marc.info/?l=u-boot&m=127793013695282&w=2

The solution in u-boot is *not* to link statically the IMX header to the u-boot.bin, but to generate a u-boot.imx image with a configuration file. This solution is already provided for the i.MX51 processor (same family), and you should go on this way, modifying tools/imximage.c for your needs, if required. This solution was previously discussed and accepted on the ML and it is compatible with other processors from different manufactures (kirchwood, see also u-boot.kwb).

Quoted 2 lines

As already answered by Albert and Wolfgang, the header must not be part of u-boot.bin.

There is pretty much different with I.MX51 ROM, we will not use DCD data file to config the
DDR script since ROM has the DCD size limitation and use the advance feature of what we
called plug-in, the plug-in code must be in the first 2K of MMC card from 0x400 offset, that's
why we need put this code section before start.S. The plug-in code will be called by boot ROM
to do DDR init first and copy u-boot to DDR and jump to _start to run it.

I know that you add the .imx format support, that's is simple to add one flash header which can be
calculated staticly and glue it to u-boot.bin but it's impossible for plug-in feature support of ROM by
using the same way.

Does anyone of expert like you and Albert and Wolfgang tell me how to do it? It's very important for FSL
coming many SOCs support, since we will use plug-in feature of boot ROM.

Quoted 189 lines
Quoted 1 line

+SOBJS ? ? ? ?:= ivt.o

This should be removed, and a imximage.cfg file should be written.

Quoted 185 lines
arch/arm/cpu/armv7/u-boot.lds +185 -0
+plugin_start:
+ ? ? /* Save the return address and the function arguments */
+ ? ? push {r0-r3, lr}
+
+ ? ? ldr r0, =ROM_SI_REV
+ ? ? ldr r1, [r0]
+
+ ? ? cmp r1, #0x20
+
+ ? ? /* IOMUX Setup */
+ ? ? ldr r0, =0x53fa8500
+ ? ? moveq r1, #0x00180000
+ ? ? movne r1, #0x00380000
+ ? ? mov r2, #0x00380000
+ ? ? add r2, r2, #0x40
+ ? ? add r3, r1, #0x40
+ ? ? mov r4, #0x00200000
+
+ ? ? str r1, [r0, #0x54]
+ ? ? str r2, [r0, #0x58]
+ ? ? str r1, [r0, #0x60]
+ ? ? str r3, [r0, #0x64]
+ ? ? str r2, [r0, #0x68]
+
+ ? ? streq r1, [r0, #0x70]
+ ? ? strne r4, [r0, #0x70]
+ ? ? str r1, [r0, #0x74]
+ ? ? streq r1, [r0, #0x78]
+ ? ? strne r4, [r0, #0x78]
+ ? ? str r2, [r0, #0x7c]
+ ? ? str r3, [r0, #0x80]
+ ? ? str r1, [r0, #0x84]
+ ? ? str r1, [r0, #0x88]
+ ? ? str r2, [r0, #0x90]
+ ? ? str r1, [r0, #0x94]
+
+ ? ? ldr r0, =0x53fa86f0
+ ? ? str r1, [r0, #0x0]
+ ? ? mov r2, #0x00000200
+ ? ? str r2, [r0, #0x4]
+ ? ? mov r2, #0x00000000
+ ? ? str r2, [r0, #0xc]
+
+ ? ? ldr r0, =0x53fa8700
+ ? ? str r2, [r0, #0x14]
+ ? ? str r1, [r0, #0x18]
+ ? ? str r1, [r0, #0x1c]
+ ? ? str r1, [r0, #0x20]
+
+ ? ? moveq r2, #0x02000000
+ ? ? movne r2, #0x06000000
+
+ ? ? str r2, [r0, #0x24]
+ ? ? str r1, [r0, #0x28]
+ ? ? str r1, [r0, #0x2c]
+
+ ? ? /* Initialize DDR2 memory - Hynix H5PS2G83AFR */
+ ? ? ldr r0, =ESDCTL_BASE_ADDR
+
+ ? ? ldreq r1, =0x31333530
+ ? ? ldrne r1, =0x2b2f3031
+ ? ? str r1, [r0, #0x088]
+
+ ? ? ldreq r1, =0x4a474a44
+ ? ? ldrne r1, =0x40363333
+ ? ? str r1, [r0, #0x090]
+
+ ? ? /* add 3 logic unit of delay to sdclk ?*/
+ ? ? ldr r1, =0x00000f00
+ ? ? str r1, [r0, #0x098]
+
+ ? ? ldr r1, =0x00000800
+ ? ? str r1, [r0, #0x0F8]
+
+ ? ? ldreq r1, =0x02490241
+ ? ? ldrne r1, =0x01310132
+ ? ? str r1, [r0, #0x07c]
+
+ ? ? ldreq r1, =0x01710171
+ ? ? ldrne r1, =0x0133014b
+ ? ? str r1, [r0, #0x080]
+
+ ? ? /* Enable bank interleaving, RALAT = 0x4, DDR2_EN = 1 */
+ ? ? ldr r1, =0x00001710
+ ? ? str r1, [r0, #0x018]
+
+ ? ? ldr r1, =0xc4110000
+ ? ? str r1, [r0, #0x00]
+
+ ? ? ldr r1, =0x4d5122d2
+ ? ? str r1, [r0, #0x0C]
+
+ ? ? ldr r1, =0x92d18a22
+ ? ? str r1, [r0, #0x10]
+
+ ? ? ldr r1, =0x00c70092
+ ? ? str r1, [r0, #0x14]
+
+ ? ? ldr r1, =0x000026d2
+ ? ? str r1, [r0, #0x2C]
+
+ ? ? ldr r1, =0x009f000e
+ ? ? str r1, [r0, #0x30]
+
+ ? ? ldr r1, =0x12272000
+ ? ? str r1, [r0, #0x08]
+
+ ? ? ldr r1, =0x00030012
+ ? ? str r1, [r0, #0x04]
+
+ ? ? ldr r1, =0x04008010
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x00008032
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x00008033
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x00008031
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x0b5280b0
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x04008010
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x00008020
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x00008020
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x0a528030
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x03c68031
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x00468031
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? /* Even though Rev B does not have DDR on CSD1, keep these
+ ? ? ?* mode register initialization sequences for future uses since
+ ? ? ?* it does not hurt to keep them
+ ? ? ?*/
+ ? ? ldr r1, =0x04008018
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x0000803a
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x0000803b
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x00008039
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x0b528138
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x04008018
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x00008028
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x00008028
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x0a528038
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x03c68039
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x00468039
+ ? ? str r1, [r0, #0x1C]
+
+ ? ? ldr r1, =0x00005800
+ ? ? str r1, [r0, #0x20]
+
+ ? ? ldr r1, =0x00033337
+ ? ? str r1, [r0, #0x58]
Quoted 8 lines

arch/arm/cpu/armv7/u-boot.lds

Quoted 4 lines
arch/arm/cpu/armv7/u-boot.lds +4 -0
+
+ ? ? ldr r1, =0x00000000
+ ? ? str r1, [r0, #0x1C]
+

Why do we need to write these registers in assembly ? Why cannot we move them into board_init or board_early_init_f ? And again, should these values described better in imximage.cfg ?

Yes, we need write it in assembly. Please see the comments above. We can't put it into board_init or board_early_init_f, because it does DDR init.
It *must* run in IRAM which load by ROM first.

Quoted 17 lines
Quoted 7 lines
board/freescale/mx53evk/mx53evk.c new file +0 -0
new file mode 100755
index 0000000..ff6bfb2

board/freescale/mx53evk/mx53evk.c line 7

Quoted 7 lines
board/freescale/mx53evk/mx53evk.c new file +7 -0
@@ -0,0 +1,412 @@
+/*
+ * Copyright (C) 2007, Guennadi Liakhovetski <[email protected]>
+ *
+ * (C) Copyright 2009-2010 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.

It seems to me that you derived this file from mx51evk.c, but you copied the header with copyrights from another (MX31, maybe) file.

The file from FSL uboot.

Quoted 7 lines

board/freescale/mx53evk/mx53evk.c line 76

Quoted 3 lines
board/freescale/mx53evk/mx53evk.c new file +2 -0
+#ifdef CONFIG_I2C_MXC
+static void setup_i2c(unsigned int module_base)

I think it is better to enumerate the i2c controller as done in manual as with the physical address. Anyway, I do not see yet any released manual for this processor on Freescale's site, so I cannot be more precise.

I can't catch your mean. The function just do i2c iomux setup, anything wrong?

Quoted 17 lines

board/freescale/mx53evk/mx53evk.c line 20

Quoted 12 lines
board/freescale/mx53evk/mx53evk.c new file +11 -0
+void power_init(void)
+{
+ ? ? unsigned char buf[4] = { 0 };
+ ? ? struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE;
+
+ ? ? i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+
+ ? ? /* Set core voltage VDDGP to 1.05V for 800MHZ */
+ ? ? buf[0] = 0x45;
+ ? ? buf[1] = 0x4a;
+ ? ? buf[2] = 0x52;

Please remove all fixed constants in the file and replaced them with named constants, defined in a header file. Check vision2.c as reference. This board uses the MC13892 PMIC controller, and ./include/mc13892.h contains all required defines.

OK,

Quoted 10 lines

board/freescale/mx53evk/mx53evk.c line 22

Quoted 3 lines
board/freescale/mx53evk/mx53evk.c new file +2 -0
+ ? ? if (i2c_write(0x8, 24, 1, buf, 3))
+ ? ? ? ? ? ? return;

Ditto. The same globally.

board/freescale/mx53evk/mx53evk.c line 23

Quoted 1 line
board/freescale/mx53evk/mx53evk.c new file +1 -0
+ ? ? if (is_soc_rev(CHIP_REV_2_0) == 0) {

Please add some comments describing why depending on the processor revision we should to manage the pmic in a different way.

OK,

Quoted 9 lines

board/freescale/mx53evk/mx53evk.c

Quoted 7 lines
board/freescale/mx53evk/mx53evk.c new file +6 -0
+int board_mmc_getcd(u8 *cd, struct mmc *mmc)
+{
+ ? ? struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
+
+ ? ? if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
+ ? ? ? ? ? ? *cd = readl(GPIO3_BASE_ADDR) & 0x2000;

Please change this. There is mxc_get_gpio() and mxc_set_gpio() accessors.

OK,

Quoted 8 lines

board/freescale/mx53evk/mx53evk.c

Quoted 4 lines
board/freescale/mx53evk/mx53evk.c new file +3 -0
+int board_init(void)
+{
+ ? ? system_rev = get_cpu_rev();

I think we can get rid of system_rev. It is not used in this function and you can call get_cpu_rev() directly in checkboard() when the value is really needed.

OK, currently, it's not used.

Quoted 12 lines

board/freescale/mx53evk/mx53evk.c line 384

Quoted 5 lines
board/freescale/mx53evk/mx53evk.c new file +4 -0
+#ifdef BOARD_LATE_INIT
+int board_late_init(void)
+{
+#ifdef CONFIG_I2C_MXC

Is it the board working if the pmic is not configured ? As I remember from mx51evk, the network did not work if the PMIC via SPI was not configured. If this is the case even for mx53evk, setting CONFIG_I2C_MXC is a must, else a lot of thing cannot work. Then I would prefer to remove these #ifdef and producing an error if it is not set at the beginning of the file.

No, this is not the case like MX53. The power of FEC is default on of this board.
We need change power before we can run CPU at full speed.

Quoted 11 lines

board/freescale/mx53evk/mx53evk.c

Quoted 6 lines
board/freescale/mx53evk/mx53evk.c new file +5 -0
+int checkboard(void)
+{
+ ? ? puts("Board: MX53EVK [");
+
+ ? ? switch (__REG(SRC_BASE_ADDR + 0x8)) {

Again, there is a "src" structure for i.MX51. If it is not correct for i.MX53, you have to adapt it in imx-regs.h, but you cannot access directly to registers. Please use always the correct structure or define newer ones if they do not exist.

Yes, OK,

Quoted 7 lines

board/freescale/mx53evk/mx53evk.c line 45

Quoted 5 lines
board/freescale/mx53evk/mx53evk.c new file +4 -0
+/*
+ * Disabled for now due to build problems under Debian and a significant
+ * increase in the final file size: 144260 vs. 109536 Bytes.
+ */

I see the same comment in mx51evk.h, but does it make sense ?

No, I think. We need remove it from mx51 too.

Quoted 11 lines

board/freescale/mx53evk/mx53evk.c line 52

Quoted 8 lines
board/freescale/mx53evk/mx53evk.c new file +7 -0
+/*
+ * I2C Configs
+ */
+#define CONFIG_CMD_I2C ? ? ? ? ?1
+#define CONFIG_HARD_I2C ? ? ? ? 1
+#define CONFIG_I2C_MXC ? ? ? ? ?1
+#define CONFIG_SYS_I2C_PORT ? ? ? ? ? ? I2C2_BASE_ADDR

As stated before: port means an enumeration value (0,1,..N), and it is set to a physical address.

Yes, I will fix it.

Thanks,

BR,
Jason

Quoted 15 lines

Best regards,
Stefano Babic

--
=====================================================================
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 ?Email: office at denx.de
=====================================================================
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#16 lore raw

PATCH 5/5 MX5:MX53: add initial support for MX53EVK board

Dear Jason Liu,

Quoted 10 lines · In message <[email protected]> you…

There is pretty much different with I.MX51 ROM, we will not use DCD data file to config the
DDR script since ROM has the DCD size limitation and use the advance feature of what we
called plug-in, the plug-in code must be in the first 2K of MMC card from 0x400 offset, that's
why we need put this code section before start.S. The plug-in code will be called by boot ROM
to do DDR init first and copy u-boot to DDR and jump to _start to run it.

It seems you did not try to think what it would actually mean to change your code as requested.

Actually nne of the above is reason that it must be done in your way. All this can be acchieved in the way Stefano suggested as well.

Quoted 5 lines

I know that you add the .imx format support, that's is simple to add one flash header which can be
calculated staticly and glue it to u-boot.bin but it's impossible for plug-in feature support of ROM by
using the same way.

Please explain why is should be impossible? I cannot follow that.

Quoted 2 lines

Does anyone of expert like you and Albert and Wolfgang tell me how to do it? It's very important for FSL

Um.. this statement is not very friendly. Do you mean you consider Stefano to be no expert? He is the iMX custodian, and there is reason for that.

Quoted 1 line

coming many SOCs support, since we will use plug-in feature of boot ROM.

You have received a clear NAK from three persons on that: from Stefano (iMX custodian), Albert (ARM custodian), and me.

Is this not clear enough?

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Don't have a battle of wits with an unarmed opponent.
#17 lore raw

PATCH 5/5 MX5:MX53: add initial support for MX53EVK board

In reply to Jason Liu

Le 17/12/2010 04:05, Jason Liu a ?crit :

Quoted 7 lines

There is pretty much different with I.MX51 ROM, we will not use DCD data file to config the
DDR script since ROM has the DCD size limitation and use the advance feature of what we
called plug-in, the plug-in code must be in the first 2K of MMC card from 0x400 offset, that's
why we need put this code section before start.S.

This implication is simply not true, as far as I can tell. You do need to have this "plug-in" (will you explain in the end what it is exactly?) in the first 2K of MMC; but that does not mean it has to be put in u-boot and u-boot stored at start of MMC. You could just as well put the "plug-in" alone in the first 2K and u-boot from the second 2K onward, for all I understand:

Quoted 3 lines

The plug-in code
will be called by boot ROM
to do DDR init first and copy u-boot to DDR and jump to _start to run it.

If it has to copy u-boot to DDR, then it should ne be part of u-boot.

Quoted 3 lines

Does anyone of expert like you and Albert and Wolfgang tell me how to do it? It's very important for FSL
coming many SOCs support, since we will use plug-in feature of boot ROM.

The first thing, I think, would be to get back to gathering your exact requirements, and only those, as per your SoC specs. From what you say of these, the requirements are not "have u-boot start in the first 2K of MMC with the "plug-in' coming first", but "have some routine in the first 2K of MMC, said routine assumed to do DDR init and payload copy"; and then, start from these reqs *only*.

Amicalement,

Signature · 1 line
Albert.
#18 lore raw

PATCH 5/5 MX5:MX53: add initial support for MX53EVK board

In reply to Jason Liu
Quoted 9 lines · Jason Liu

There is pretty much different with I.MX51 ROM, we will not use DCD data file to config the
DDR script since ROM has the DCD size limitation and use the advance feature of what we
called plug-in, the plug-in code must be in the first 2K of MMC card from 0x400 offset, that's
why we need put this code section before start.S. The plug-in code will be called by boot ROM
to do DDR init first and copy u-boot to DDR and jump to _start to run it.

As I am not understanding what you mean as "plugin", it seems to me you need some code able to set-up RAM and copy the u-boot code. This method looks like very similar to other SoCs, where a first stage boot loader is needed or when we boot from NAND.

I do not find any reasonable argument to follow the methods you are proposing and to link statically this code to u-boot. In U-Boot we have already two mechanisms for do this initial setup, one using special images (with .kwb and .imx images when the RBL of the SoC is able to do the whole job), the second one with a first stage bootloader as nand_spl does and as Albert has already suggested.

Quoted 3 lines

Does anyone of expert like you and Albert and Wolfgang tell me how to do it? It's very important for FSL
coming many SOCs support, since we will use plug-in feature of boot ROM.

I am really not understanding if this "plugin" feature is really different as what we have with other SoCs or when we boot from NAND on other SOCs. As I can up now understand, it is similar to other approaches we have support already and I do not see a reason to implement a new one.

Is there some released Freescale's documentation to allow to me to better understand what you are meaning ?

Quoted 4 lines

Yes, we need write it in assembly. Please see the comments above. We can't put it into board_init or board_early_init_f, because it does DDR init.
It *must* run in IRAM which load by ROM first.

Running in IRAM is not a sufficient reason to do in this way. If I am not wrong, we could reach the same behavior on a i.MX51, too, if we set the app_code_jump in the header to point to an IRAM address. Then even the i.MX51 RBL should copy the code from storage to IRAM and then jump to this address, isnt it ?

Quoted 1 line

I can't catch your mean. The function just do i2c iomux setup, anything wrong?

My concern is related to the fact that the controllers are normally enumerated as "port numbers" and you make the selection based on the base address, that could be confusing. I see an approach of the type:

static void setup_i2c(unsigned int port_number)
{

	switch (port_number) {
		0:
			.....
			break;
		1:

	.........
}

more intuitive to understand.

Quoted 11 lines
Quoted 9 lines

board/freescale/mx53evk/mx53evk.c line 137

Quoted 4 lines
board/freescale/mx53evk/mx53evk.c new file +4 -0
+     /* Set core voltage VDDGP to 1.05V for 800MHZ */
+     buf[0] = 0x45;
+     buf[1] = 0x4a;
+     buf[2] = 0x52;

Please remove all fixed constants in the file and replaced them with named constants, defined in a header file. Check vision2.c as reference. This board uses the MC13892 PMIC controller, and ./include/mc13892.h contains all required defines.

OK,

As further comment: there is already a pmic driver in u-boot (fsl_pmic.c), that hides the underlying communication between processor and pmic itself. At the moment, only spi is implemented. It is better to expand the fsl_pmic code to support i2c, too, and to use the accessors pmic_reg_read() and pmic_reg_write() to access to the pmic internal registers in the board related code.

Quoted 3 lines

No, this is not the case like MX53. The power of FEC is default on of this board.
We need change power before we can run CPU at full speed.

Ok, understood.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

+#define CONFIG_SYS_I2C_PORT I2C2_BASE_ADDR

As stated before: port means an enumeration value (0,1,..N), and it is set to a physical address.

Yes, I will fix it.

This comment is related to the previous one for the setup_i2c() function. Sorry if I was not clear enough. As you describe the define CONFIG_SYS_I2C_PORT, this should be a port number (0,1,..N) and the setup_i2() should accept as parameter this enumeration value, not a base address.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#19 lore raw

PATCH 5/5 MX5:MX53: add initial support for MX53EVK board

Hi, Stefano,

2010/12/17 Stefano Babic <[email protected]>:

Quoted 11 lines · Jason Liu
Quoted 9 lines

There is pretty much different with I.MX51 ROM, ?we will not use DCD data file to config the
DDR script since ROM has the DCD size limitation and use the advance feature of what we
called plug-in, ?the plug-in code must be in the first 2K of MMC card from 0x400 offset, that's
why we need put this code section before start.S. The plug-in code will be called by boot ROM
to do DDR init first and copy u-boot to DDR and jump to _start ?to run it.

Quoted 4 lines

As I am not understanding what you mean as "plugin", it seems to me you need some code able to set-up RAM and copy the u-boot code. This method looks like very similar to other SoCs, where a first stage boot loader is needed or when we boot from NAND.

Forget about the case about boot From NAND, we are talking about boot from SD/MMC card here.
Why I call it here"plug-in", it due to it use the plugin feature of ROM.

This section of code is for ROM to load and run, thus it should meet the ROM boot structure requirement.
The plugin feature of ROM can give more flexibility and it can overcome some shortcomings of DCD(used on mx51).

By using this plugin we can get around the following issues:
1. DCD size limitation issue, plugin can be the size of OCRAM free space region.
2. Safe environment to re-configure PLL1 (without impacting SDRAM) as
the plugin runs from OCRAM.

Quoted 7 lines

I do not find any reasonable argument to follow the methods you are proposing and to link statically this code to u-boot. In U-Boot we have already two mechanisms for do this initial setup, one using special images (with .kwb and .imx images when the RBL of the SoC is able to do the whole job), the second one with a first stage bootloader as nand_spl does and as Albert has already suggested.

I don't know .kwb format, but know .imx format. Here the .imx use the DCD table to do DDR init
but with plugin, it need run the binary code not the DCD configure table. So, We need use assembly
code to run the DDR init script.

Quoted 10 lines
Quoted 4 lines

Does anyone of expert like you and Albert and Wolfgang tell me how to do it? It's very important for FSL
coming many SOCs support, since we will use plug-in feature of boot ROM.

I am really not understanding if this "plugin" feature is really different as what we have with other SoCs or when we boot from NAND on other SOCs. As I can up now understand, it is similar to other approaches we have support already and I do not see a reason to implement a new one.

Here, We can talking about SD/MMC boot. It's some different with NAND boot. It's different with MX51 DCD approach.

Quoted 9 lines

Is there some released Freescale's documentation to allow to me to better understand what you are meaning ?

Quoted 4 lines

Yes, we need write it in assembly. Please see the comments above. We can't put it into board_init or board_early_init_f, because it does DDR init.
It *must* run in IRAM which load by ROM first.

Quoted 5 lines

Running in IRAM is not a sufficient reason to do in this way. If I am not wrong, we could reach the same behavior on a i.MX51, too, if we set the app_code_jump in the header to point to an IRAM address. Then even the i.MX51 RBL should copy the code from storage to IRAM and then jump to this address, isnt it ?

ROM will only load 2KB data from the beginning of SD/MMC card. The first 1KB is not used, it means
that only 1KB data is used. We need put ivt table and ddr init assembly code into this
1KB section. So, we can't put the assembly code into board_init or board_early_init_f.

Quoted 16 lines
Quoted 2 lines

I can't catch your mean. The function just do i2c iomux setup, anything wrong?

My concern is related to the fact that the controllers are normally enumerated as "port numbers" and you make the selection based on the base address, that could be confusing. I see an approach of the type:

static void setup_i2c(unsigned int port_number)
{

? ? ? ?switch (port_number) {
? ? ? ? ? ? ? ?0:
? ? ? ? ? ? ? ? ? ? ? ?.....
? ? ? ? ? ? ? ? ? ? ? ?break;
? ? ? ? ? ? ? ?1:

Quoted 5 lines

? ? ? ?.........
}

more intuitive to understand.

Yes, agree.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 5 lines

+ ? ? /* Set core voltage VDDGP to 1.05V for 800MHZ */
+ ? ? buf[0] = 0x45;
+ ? ? buf[1] = 0x4a;
+ ? ? buf[2] = 0x52;

Please remove all fixed constants in the file and replaced them with named constants, defined in a header file. Check vision2.c as reference. This board uses the MC13892 PMIC controller, and ./include/mc13892.h contains all required defines.

Quoted 8 lines
Quoted 1 line

OK,

As further comment: there is already a pmic driver in u-boot (fsl_pmic.c), that hides the underlying communication between processor and pmic itself. At the moment, only spi is implemented. It is better to expand the fsl_pmic code to support i2c, too, and to use the accessors pmic_reg_read() and pmic_reg_write() to access to the pmic internal registers in the board related code.

OK, I will check that code and see how hard to expand fsl_pmic to support i2c, which depends on the code scalability.

Quoted 12 lines
Quoted 4 lines

No, this is not the case like MX53. The power of FEC is default on of this board.
We need change power before we can run CPU at full speed.

Ok, understood.

Quoted 5 lines
Quoted 4 lines
Quoted 1 line

+#define CONFIG_SYS_I2C_PORT ? ? ? ? ? ? I2C2_BASE_ADDR

As stated before: port means an enumeration value (0,1,..N), and it is set to a physical address.

Quoted 7 lines
Quoted 1 line

Yes, I will fix it.

This comment is related to the previous one for the setup_i2c() function. Sorry if I was not clear enough. As you describe the define CONFIG_SYS_I2C_PORT, this should be a port number (0,1,..N) and the setup_i2() should accept as parameter this enumeration value, not a base address.

OK, I get it. Thanks,

Quoted 12 lines

Best regards,
Stefano Babic

--
=====================================================================
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 ?Email: office at denx.de
=====================================================================

#20 lore raw

PATCH 5/5 MX5:MX53: add initial support for MX53EVK board

Quoted 28 lines · Jason Liu

Hi, Stefano,

2010/12/17 Stefano Babic <[email protected]>:

Quoted 11 lines · Jason Liu
Quoted 9 lines

There is pretty much different with I.MX51 ROM, ?we will not use DCD data file to config the
DDR script since ROM has the DCD size limitation and use the advance feature of what we
called plug-in, ?the plug-in code must be in the first 2K of MMC card from 0x400 offset, that's
why we need put this code section before start.S. The plug-in code will be called by boot ROM
to do DDR init first and copy u-boot to DDR and jump to _start ?to run it.

Quoted 4 lines

As I am not understanding what you mean as "plugin", it seems to me you need some code able to set-up RAM and copy the u-boot code. This method looks like very similar to other SoCs, where a first stage boot loader is needed or when we boot from NAND.

Forget about the case about boot From NAND, we are talking about boot from SD/MMC card here.
Why I call it here"plug-in", it due to it use the plugin feature of ROM.

This section of code is for ROM to load and run, thus it should meet the ROM boot structure requirement.
The plugin feature of ROM can give more flexibility and it can overcome some shortcomings of DCD(used on mx51).

Quoted 6 lines

By using this plugin we can get around the following issues:
1. ? ? ?DCD size limitation issue, plugin can be the size of OCRAM free space region.
2. ? ? ?Safe environment to re-configure PLL1 (without impacting SDRAM) as the plugin runs from OCRAM.

Jason:
No one is arguing about the use the plugin feature. The objection is to how you are getting the plugin bits into the u-boot image. You should use a tool to prepend the plugins to the u-boot.bin file in a similar way to how mkimage is used for i.mx51 and others.

Stefano:
I know Freescale has a binary to do this but I don't believe the source is available. The binary is included as a package in the i.mx28 BSP as well as some sample plugins.

You can find your way to the i.mx28 page by googling "site:freescale.com i.mx28 BSP" and following the top most hit. You have to register to download the BSP.

Once you download the BSP you will find a source archive called L2.6.31_10.08.01_SDK_source.tar.gz.

The sample plugin package is in the archive in a file called L2.6.31_10.08.01_SDK_source/pkgs/imx-bootlets-src-10.08.01.tar.gz. I guess bootlets are another name for plugins.

The binary utility for creating bootlets from elf files is called elftosb-0.4.tar.bz2 in the same archive. The utility appears to be a typical over engineered c++ pile of stuff. One would think that you could accomplish the same thing with objdump, and a patch to mkimage.

Chapter 12 of the i.mx28 Technical Reference Manual describes this, I have not seen a doc for i.mx53 yet and am just assuming that it is the same as i.mx28.
http://cache.freescale.com/files/dsp/doc/ref_manual/MCIMX28RM.pdf

br,

John

#21 lore raw

PATCH 5/5 MX5:MX53: add initial support for MX53EVK board

Hi, Stefano, Wolfgang, Albert, John

2010/12/20 John Rigby <[email protected]>:

Quoted 7 lines · Jason Liu

Jason:
No one is arguing about the use the plugin feature. ?The objection is to how you are getting the plugin bits into the u-boot image. ?You should use a tool to prepend the plugins to the u-boot.bin file in a similar way to how mkimage is used for i.mx51 and others.

I will change back to follow i.mx51 imximage format. Patch has been sent out.

Thanks for your comments on this issue.

BR,
Jason

Quoted 5 lines

br,

John

#22 lore raw

PATCH 5/5 MX5:MX53: add initial support for MX53EVK board

In reply to John Rigby
Quoted 5 lines · John Rigby

Jason:
No one is arguing about the use the plugin feature. The objection is to how you are getting the plugin bits into the u-boot image. You should use a tool to prepend the plugins to the u-boot.bin file in a similar way to how mkimage is used for i.mx51 and others.

Exactly.

Quoted 5 lines

Stefano:
I know Freescale has a binary to do this but I don't believe the source is available. The binary is included as a package in the i.mx28 BSP as well as some sample plugins.

Thanks for hints !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#23 lore raw

PATCH 5/5 MX5:MX53: add initial support for MX53EVK board

In reply to Jason Liu

Hi Jason,

(cutting to essential parts of the discussion)

Le 20/12/2010 06:19, Jason Liu a ?crit :

Quoted 2 lines

Forget about the case about boot From NAND, we are talking about boot from SD/MMC card here.

Which is exactly the same: usually the ROM code is just sophisticated enough to do a single, small, read from the lowest address and execute what was read. How this small piece of code is called varies, but basically it does a first-stage bootstrap and loads the next piece, usually a (more) full-fledged bootloader.

Quoted 11 lines

Why I call it here"plug-in", it due to it use the plugin feature of ROM.

This section of code is for ROM to load and run, thus it should meet the ROM boot structure requirement.
The plugin feature of ROM can give more flexibility and it can overcome some shortcomings of DCD(used on mx51).

By using this plugin we can get around the following issues:
1. DCD size limitation issue, plugin can be the size of OCRAM free space region.
2. Safe environment to re-configure PLL1 (without impacting SDRAM) as
the plugin runs from OCRAM.

This is certainly good, although I'm not familiar enough with the mx series to appreciate the improvements. What I can appreciate, though, is that you're decribing a first-stage bootloader of sorts, and that nothing in your description forces this "plug-in" to be linked with u-boot, and even less, to be linked instead of u(boot's start code.

Quoted 5 lines

I don't know .kwb format, but know .imx format. Here the .imx use the DCD table to do DDR init
but with plugin, it need run the binary code not the DCD configure table. So, We need use assembly
code to run the DDR init script.

Right! But you don't need to tack this code inside the u-boot binary.

Quoted 2 lines

Here, We can talking about SD/MMC boot. It's some different with NAND boot.

Not really. for this "plug-in" boot, the ROM loads a small "plug-in" from some fixed location in SD/MMC and executes it, hoping that it'll contribute to some initializations and to loading the next payload. Ditto for NAND boot.

Quoted 1 line

It's different with MX51 DCD approach.

AIUI, for mx51 providing added inits and payload info are is done by a pure-data header; that is indeed different from NAND and SD/MMC boot where doing inits and putting payload in RAM are done by code. But your approach, from what I see, is not a third way; it seems to be a combination of both the data and code approaches.

Quoted 6 lines

ROM will only load 2KB data from the beginning of SD/MMC card. The first 1KB is not used, it means
that only 1KB data is used. We need put ivt table and ddr init assembly code into this
1KB section. So, we can't put the assembly code into board_init or board_early_init_f.

I don't get this. Why can you only use 1 KB of IRAM? If your plugin is supposed to setup DDR, how come it cannot fit in the IRAM which is the only place where it can go? When the plug-in feature was designed, surely people knew about that 1 KB constraint, right?

Please, check your requirements and actual hardware constraints and come back with a simpler design where first stage bootloader will not "bleed over" the payload.

Amicalement,

Signature · 1 line
Albert.
#24 lore raw

PATCH 5/5 MX5:MX53: add initial support for MX53EVK board

In reply to Jason Liu

Dear Jason Liu,

Quoted 4 lines · In message <[email protected]> you wrote:

Add initial support for MX53EVK board support.
FEC, SD/MMC, UART, I2C, have been support.

The following is in addition to previously made comments:

board/freescale/mx53evk/config.mk

Quoted 2 lines
board/freescale/mx53evk/config.mk new file +0 -0

Drop that file.

Quoted 1 line

+CONFIG_SYS_TEXT_BASE = 0x77800000

This goes to the board config file instead.

board/freescale/mx53evk/config.mk

Quoted 2 lines
board/freescale/mx53evk/config.mk new file +2 -0
+/* size in bytes reserved for initial data */
+#define BOARD_LATE_INIT

Seems to be a bogus comment?

Quoted 3 lines

+/*
+ * Hardware drivers
+ */

What exactly are "Hardware drivers" ?

board/freescale/mx53evk/config.mk

Quoted 2 lines
board/freescale/mx53evk/config.mk new file +2 -0
+#define CONFIG_SYS_MEMTEST_START       0x70000000
+#define CONFIG_SYS_MEMTEST_END         0x10000

Please say - has this ever been tested?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Put your Nose to the Grindstone!
                 -- Amalgamated Plastic Surgeons and Toolmakers, Ltd.
#25 lore raw

PATCH 5/5 MX5:MX53: add initial support for MX53EVK board

Hi, Wolfgang,

2010/12/17 Wolfgang Denk <[email protected]>:

Quoted 10 lines

Dear Jason Liu,

Quoted 4 lines · In message <[email protected]> you wrote:

Add initial support for MX53EVK board support.
FEC, SD/MMC, UART, I2C, have been support.

The following is in addition to previously made comments:

Quoted 8 lines

board/freescale/mx53evk/config.mk

Quoted 2 lines
board/freescale/mx53evk/config.mk new file +0 -0

Drop that file.

Quoted 1 line

+CONFIG_SYS_TEXT_BASE = 0x77800000

This goes to the board config file instead.

A lot of board support has this file as following,

./board/freescale/m5373evb/config.mk
CONFIG_SYS_TEXT_BASE = 0xFF800000
./board/freescale/m547xevb/config.mk
CONFIG_SYS_TEXT_BASE = 0xffe00000
./board/freescale/m5275evb/config.mk
CONFIG_SYS_TEXT_BASE = 0xFFE00000
./board/freescale/m5282evb/config.mk
CONFIG_SYS_TEXT_BASE = 0xffe00000
./board/freescale/m5249evb/config.mk
CONFIG_SYS_TEXT_BASE = 0xFF800000
./board/freescale/m548xevb/config.mk
./board/freescale/mx31ads/config.mk
CONFIG_SYS_TEXT_BASE = 0xffe00000
./board/freescale/m5271evb/config.mk
CONFIG_SYS_TEXT_BASE = 0x87ec0000
CONFIG_SYS_TEXT_BASE = 0x87f00000
./board/freescale/mx31pdk/config.mk
CONFIG_SYS_TEXT_BASE = 0x97800000
./board/freescale/mx51evk/config.mk

Do you mean that all the new added boards support need drop config.mk in the future?

Quoted 6 lines

board/freescale/mx53evk/config.mk

Quoted 4 lines
board/freescale/mx53evk/config.mk new file +2 -0
+/* size in bytes reserved for initial data */
+#define BOARD_LATE_INIT

Seems to be a bogus comment?

Yes, will remove it.

Quoted 6 lines
Quoted 4 lines

+/*
+ * Hardware drivers
+ */

What exactly are "Hardware drivers" ?

Means uart driver, I will change it.

Quoted 5 lines

board/freescale/mx53evk/config.mk

Quoted 3 lines
board/freescale/mx53evk/config.mk new file +2 -0
+#define CONFIG_SYS_MEMTEST_START ? ? ? 0x70000000
+#define CONFIG_SYS_MEMTEST_END ? ? ? ? 0x10000

Please say - has this ever been tested?

Yes, tested.

Thanks,

BR,
Jason

Quoted 17 lines

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Put your Nose to the Grindstone!
? ? ? ? ? ? ? ? -- Amalgamated Plastic Surgeons and Toolmakers, Ltd.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#26 lore raw

PATCH 5/5 MX5:MX53: add initial support for MX53EVK board

Dear Jason Liu,

Quoted 14 lines · In message <[email protected]> you…

A lot of board support has this file as following,

./board/freescale/m5373evb/config.mk
CONFIG_SYS_TEXT_BASE =3D 0xFF800000
./board/freescale/m547xevb/config.mk
CONFIG_SYS_TEXT_BASE =3D 0xffe00000
./board/freescale/m5275evb/config.mk
CONFIG_SYS_TEXT_BASE =3D 0xFFE00000
./board/freescale/m5282evb/config.mk
CONFIG_SYS_TEXT_BASE =3D 0xffe00000
./board/freescale/m5249evb/config.mk
CONFIG_SYS_TEXT_BASE =3D 0xFF800000
./board/freescale/m548xevb/config.mk

Quoted 8 lines

./board/freescale/mx31ads/config.mk
CONFIG_SYS_TEXT_BASE =3D 0xffe00000
./board/freescale/m5271evb/config.mk
CONFIG_SYS_TEXT_BASE =3D 0x87ec0000
CONFIG_SYS_TEXT_BASE =3D 0x87f00000
./board/freescale/mx31pdk/config.mk
CONFIG_SYS_TEXT_BASE =3D 0x97800000
./board/freescale/mx51evk/config.mk

Yes, these all need to be cleaned up. Patches welcome.

Quoted 2 lines

Do you mean that all the new added boards support need drop config.mk in the future?

Yes. At least to the extend possible - we want to concentrate all configuration information in a single location (the board config file) and not scatter it around over several places like Makefiles and config.mk

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
An age is called Dark not because  the  light  fails  to  shine,  but
because people refuse to see it.           -- James Michener, "Space"
#27 lore raw

cover Add support for Freescale MX53

In reply to Jason Liu

Dear Jason Liu,

Quoted 8 lines · In message <[email protected]> you wrote:

The following patch set add support for Freescale MX53

Jason Liu (5):
MX5: Add initial support for MX53
serial_mxc: add support for MX53 processor
fec_mxc: add support for MX53 processor
mxc_i2c: add support for MX53 processor
MX5:MX53: add initial support for MX53EVK board

Why do you not indictae in the Subject that this is a resubmission? See
http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Witch!  Witch!  They'll burn ya!
	-- Hag, "Tomorrow is Yesterday", stardate unknown