Skip to contentSkip to conversation

ARM: AM43xx: Update support for AM4372 SoC

PATCH Superseded Lokesh Vutla 4 participants 50 messages Nov 5, 2013 – Nov 14, 2013 Arm (32-bit)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover ARM: AM43xx: Update support for AM4372 SoC

This Patch series updates support for AM4372 EPOS and GP EVM boards. AM4372 is a low cost Cortex-A9 based application processor targeted at existing ARM9/ARM11 base of customers that need more processing capabilities. Currently there are two boards with AM4372 SoC: EPOS and GP EVM. Except for few differences like oscillator clock and SDRAM both EPOS and GP EVM boards are similar.
EPOS EVM:

	OSC clk	: 25MHz
	DDR	: LPDDR2 @ 266MHz (MT42L256M32D2LG-25 WT:A)
GP EVM:
	OSC clk	: 24MHz
	DDR	: DDR3 @ 400MHz(MT47H128M16RT-187E:C)

This patch series is applied on top of Mainline U-Boot Tree and two patches mentioned below:
git://git.denx.de/u-boot.git master
http://patchwork.ozlabs.org/patch/288175/
http://patchwork.ozlabs.org/patch/279755/

Testing:
-> Boot tested on AM4372 EPOS and GP EVMs, Beaglebone Black. -> verified MAKEALL -s am33xx.
-> Ran checkpatch on all patches.

Lokesh Vutla (12):
ARM: AM43xx: Update the base addresses of modules
ARM: AM43xx: Adapt to ti_armv7_common.h config file
ARM: AM43xx: Add L2 Support
ARM: AM43xx: Add extra ENV settings
ARM: AM43xx: Select clk source for Timer2
ARM: AM43xx: Update Current Booting devices list
ARM: AM43xx: mux: Update mux data
ARM: AM43xx: clocks: Update DPLL details for EPOS EVM
ARM: AM43xx: clocks: Add DPLL data for GP EVM
ARM: AM43xx: EPOS_EVM: Add support for LPDDR2
ARM: AM43xx: GP_EVM: Add support for DDR3
ARM: AM43xx: Add Maintainer

Sekhar Nori (2):
ARM: AM43XX: board: add support for reading onboard EEPROM
ARM: AM43XX: Add CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG support

 arch/arm/cpu/armv7/am33xx/Makefile                 |    8 +-
 arch/arm/cpu/armv7/am33xx/clock.c                  |   12 +-
 arch/arm/cpu/armv7/am33xx/clock_am33xx.c           |   15 ++
 arch/arm/cpu/armv7/am33xx/clock_am43xx.c           |   12 +-
 arch/arm/cpu/armv7/am33xx/emif4d5.c                |  185 ++++++++++++++
 arch/arm/include/asm/arch-am33xx/clock.h           |    7 +-
 arch/arm/include/asm/arch-am33xx/clocks_am33xx.h   |    3 +
 arch/arm/include/asm/arch-am33xx/cpu.h             |   22 +-
 arch/arm/include/asm/arch-am33xx/ddr_defs.h        |   34 +++
 arch/arm/include/asm/arch-am33xx/hardware.h        |    8 -
 arch/arm/include/asm/arch-am33xx/hardware_am33xx.h |    3 +
 arch/arm/include/asm/arch-am33xx/hardware_am43xx.h |    4 +
 arch/arm/include/asm/arch-am33xx/hardware_ti814x.h |    3 +
 arch/arm/include/asm/arch-am33xx/hardware_ti816x.h |    3 +
 arch/arm/include/asm/arch-am33xx/mux_am43xx.h      |    4 +-
 arch/arm/include/asm/arch-am33xx/omap.h            |    2 +
 arch/arm/include/asm/arch-am33xx/spl.h             |   12 +-
 arch/arm/include/asm/emif.h                        |   12 +
 board/ti/am43xx/board.c                            |  263 +++++++++++++++++++-
 board/ti/am43xx/board.h                            |   33 +++
 board/ti/am43xx/mux.c                              |   29 ++-
 boards.cfg                                         |    2 +-
 include/configs/am43xx_evm.h                       |  205 ++++++++-------
 23 files changed, 737 insertions(+), 144 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/am33xx/emif4d5.c
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/14 ARM: AM43xx: Update the base addresses of modules

PRCM, timer base addresses and offsets are different from AM33xx. Updating the same.

---
 arch/arm/include/asm/arch-am33xx/cpu.h             |   17 +++++++++++------
 arch/arm/include/asm/arch-am33xx/hardware.h        |    8 --------
 arch/arm/include/asm/arch-am33xx/hardware_am33xx.h |    3 +++
 arch/arm/include/asm/arch-am33xx/hardware_am43xx.h |    3 +++
 arch/arm/include/asm/arch-am33xx/hardware_ti814x.h |    3 +++
 arch/arm/include/asm/arch-am33xx/hardware_ti816x.h |    3 +++
 6 files changed, 23 insertions(+), 14 deletions(-)
arch/arm/include/asm/arch-am33xx/cpu.h +11 -6
index 52fa128..f463b27 100644
@@ -237,6 +237,14 @@ struct cm_perpll {
 	unsigned int cpswclkstctrl;	/* offset 0x144 */
 	unsigned int lcdcclkstctrl;	/* offset 0x148 */
 };
+
+/* Encapsulating Display pll registers */
+struct cm_dpll {
+	unsigned int resv1[2];
+	unsigned int clktimer2clk;	/* offset 0x08 */
+	unsigned int resv2[10];
+	unsigned int clklcdcpixelclk;	/* offset 0x34 */
+};
 #else
 /* Encapsulating core pll registers */
 struct cm_wkuppll {
@@ -392,15 +400,12 @@ struct cm_perpll {
 	unsigned int resv40[7];
 	unsigned int cpgmac0clkctrl;	/* offset 0xB20 */
 };
-#endif /* CONFIG_AM43XX */
 
-/* Encapsulating Display pll registers */
 struct cm_dpll {
-	unsigned int resv1[2];
-	unsigned int clktimer2clk;	/* offset 0x08 */
-	unsigned int resv2[10];
-	unsigned int clklcdcpixelclk;	/* offset 0x34 */
+	unsigned int resv1;
+	unsigned int clktimer2clk;	/* offset 0x04 */
 };
+#endif /* CONFIG_AM43XX */
 
 /* Control Module RTC registers */
 struct cm_rtc {
arch/arm/include/asm/arch-am33xx/hardware.h +0 -8
index ee5fce0..b6db731 100644
@@ -38,7 +38,6 @@
 #define DM_TIMER7_BASE			0x4804A000
 
 /* GPIO Base address */
-#define GPIO0_BASE			0x48032000
 #define GPIO1_BASE			0x4804C000
 
 /* BCH Error Location Module */
@@ -48,13 +47,6 @@
 #define EMIF4_0_CFG_BASE		0x4C000000
 #define EMIF4_1_CFG_BASE		0x4D000000
 
-/* PLL related registers */
-#define CM_DPLL				0x44E00500
-#define CM_DEVICE			0x44E00700
-#define CM_RTC				0x44E00800
-#define CM_CEFUSE			0x44E00A00
-#define PRM_DEVICE			0x44E00F00
-
 /* DDR Base address */
 #define DDR_CTRL_ADDR			0x44E10E04
 #define DDR_CONTROL_BASE_ADDR		0x44E11404
arch/arm/include/asm/arch-am33xx/hardware_am33xx.h +3 -0
index e4231c8..ad9d7dd 100644
@@ -17,6 +17,7 @@
 #define UART0_BASE			0x44E09000
 
 /* GPIO Base address */
+#define GPIO0_BASE			0x48032000
 #define GPIO2_BASE			0x481AC000
 
 /* Watchdog Timer */
@@ -30,6 +31,8 @@
 #define PRCM_BASE			0x44E00000
 #define CM_PER				0x44E00000
 #define CM_WKUP				0x44E00400
+#define CM_DPLL				0x44E00500
+#define CM_RTC				0x44E00800
 
 #define PRM_RSTCTRL			(PRCM_BASE + 0x0F00)
 #define PRM_RSTST			(PRM_RSTCTRL + 8)
arch/arm/include/asm/arch-am33xx/hardware_am43xx.h +3 -0
index 3b665e6..4dbc789 100644
@@ -17,6 +17,7 @@
 #define UART0_BASE			0x44E09000
 
 /* GPIO Base address */
+#define GPIO0_BASE			0x44E07000
 #define GPIO2_BASE			0x481AC000
 
 /* Watchdog Timer */
@@ -30,6 +31,8 @@
 #define PRCM_BASE			0x44DF0000
 #define	CM_WKUP				0x44DF2800
 #define	CM_PER				0x44DF8800
+#define CM_DPLL				0x44DF4200
+#define CM_RTC				0x44df8500
 
 #define PRM_RSTCTRL			(PRCM_BASE + 0x4000)
 #define PRM_RSTST			(PRM_RSTCTRL + 4)
arch/arm/include/asm/arch-am33xx/hardware_ti814x.h +3 -0
index 4509a23..2322bc4 100644
@@ -16,6 +16,7 @@
 /* UART Base Address */
 #define UART0_BASE			0x48020000
 
+#define GPIO0_BASE			0x48032000
 /* Watchdog Timer */
 #define WDT_BASE			0x481C7000
 
@@ -27,6 +28,8 @@
 #define PRCM_BASE			0x48180000
 #define CM_PER				0x44E00000
 #define CM_WKUP				0x44E00400
+#define CM_DPLL				0x44E00500
+#define CM_RTC				0x44E00800
 
 #define PRM_RSTCTRL			(PRCM_BASE + 0x00A0)
 #define PRM_RSTST			(PRM_RSTCTRL + 8)
arch/arm/include/asm/arch-am33xx/hardware_ti816x.h +3 -0
index 3c68064..b845203 100644
@@ -26,6 +26,7 @@
 #define UART1_BASE		0x48022000
 #define UART2_BASE		0x48024000
 
+#define GPIO0_BASE			0x48032000
 /* Watchdog Timer */
 #define WDT_BASE		0x480C2000
 
@@ -34,6 +35,8 @@
 
 /* PRCM Base Address */
 #define PRCM_BASE		0x48180000
+#define CM_DPLL				0x44E00500
+#define CM_RTC				0x44E00800
 
 #define PRM_RSTCTRL		(PRCM_BASE + 0x00A0)
 #define PRM_RSTST		(PRM_RSTCTRL + 8)
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/14 ARM: AM43xx: Update the base addresses of modules

HI Lokesh :)

Quoted 56 lines · Lokesh Vutla

PRCM, timer base addresses and offsets are different from AM33xx. Updating the same.

---
 arch/arm/include/asm/arch-am33xx/cpu.h             |   17 +++++++++++------
 arch/arm/include/asm/arch-am33xx/hardware.h        |    8 --------
 arch/arm/include/asm/arch-am33xx/hardware_am33xx.h |    3 +++
 arch/arm/include/asm/arch-am33xx/hardware_am43xx.h |    3 +++
 arch/arm/include/asm/arch-am33xx/hardware_ti814x.h |    3 +++
 arch/arm/include/asm/arch-am33xx/hardware_ti816x.h |    3 +++
 6 files changed, 23 insertions(+), 14 deletions(-)
arch/arm/include/asm/arch-am33xx/cpu.h +11 -6
index 52fa128..f463b27 100644
@@ -237,6 +237,14 @@ struct cm_perpll {
        unsigned int cpswclkstctrl;     /* offset 0x144 */
        unsigned int lcdcclkstctrl;     /* offset 0x148 */
 };
+
+/* Encapsulating Display pll registers */
+struct cm_dpll {
+       unsigned int resv1[2];
+       unsigned int clktimer2clk;      /* offset 0x08 */
+       unsigned int resv2[10];
+       unsigned int clklcdcpixelclk;   /* offset 0x34 */
+};
 #else
 /* Encapsulating core pll registers */
 struct cm_wkuppll {
@@ -392,15 +400,12 @@ struct cm_perpll {
        unsigned int resv40[7];
        unsigned int cpgmac0clkctrl;    /* offset 0xB20 */
 };
-#endif /* CONFIG_AM43XX */
 
-/* Encapsulating Display pll registers */
 struct cm_dpll {
-       unsigned int resv1[2];
-       unsigned int clktimer2clk;      /* offset 0x08 */
-       unsigned int resv2[10];
-       unsigned int clklcdcpixelclk;   /* offset 0x34 */
+       unsigned int resv1;
+       unsigned int clktimer2clk;      /* offset 0x04 */
 };
+#endif /* CONFIG_AM43XX */
 
 /* Control Module RTC registers */
 struct cm_rtc {
arch/arm/include/asm/arch-am33xx/hardware.h +0 -0
index ee5fce0..b6db731 100644

arch/arm/include/asm/arch-am33xx/hardware.h line 41

Quoted 4 lines
arch/arm/include/asm/arch-am33xx/hardware.h +0 -1
@@ -38,7 +38,6 @@
 #define DM_TIMER7_BASE                 0x4804A000
 
 /* GPIO Base address */
-#define GPIO0_BASE                     0x48032000

Going by the patch description this looks an unrelated change. Moreover, this base address looks wrong! GPIO0 is in wkup domain for both AM335x and AM437x. I wonder how the VTT control is working on AM335x. IIRC that was using a pin from GPIO0.

Quoted 43 lines
arch/arm/include/asm/arch-am33xx/hardware.h +0 -7
 #define GPIO1_BASE                     0x4804C000
 
 /* BCH Error Location Module */
@@ -48,13 +47,6 @@
 #define EMIF4_0_CFG_BASE               0x4C000000
 #define EMIF4_1_CFG_BASE               0x4D000000
 
-/* PLL related registers */
-#define CM_DPLL                                0x44E00500
-#define CM_DEVICE                      0x44E00700
-#define CM_RTC                         0x44E00800
-#define CM_CEFUSE                      0x44E00A00
-#define PRM_DEVICE                     0x44E00F00
-
 /* DDR Base address */
 #define DDR_CTRL_ADDR                  0x44E10E04
 #define DDR_CONTROL_BASE_ADDR          0x44E11404
arch/arm/include/asm/arch-am33xx/hardware_am33xx.h +3 -0
index e4231c8..ad9d7dd 100644
@@ -17,6 +17,7 @@
 #define UART0_BASE                     0x44E09000
 
 /* GPIO Base address */
+#define GPIO0_BASE                     0x48032000
 #define GPIO2_BASE                     0x481AC000
 
 /* Watchdog Timer */
@@ -30,6 +31,8 @@
 #define PRCM_BASE                      0x44E00000
 #define CM_PER                         0x44E00000
 #define CM_WKUP                                0x44E00400
+#define CM_DPLL                                0x44E00500
+#define CM_RTC                         0x44E00800
 
 #define PRM_RSTCTRL                    (PRCM_BASE + 0x0F00)
 #define PRM_RSTST                      (PRM_RSTCTRL + 8)
arch/arm/include/asm/arch-am33xx/hardware_am43xx.h +0 -0
index 3b665e6..4dbc789 100644

arch/arm/include/asm/arch-am33xx/hardware_am43xx.h line 20

Quoted 4 lines
arch/arm/include/asm/arch-am33xx/hardware_am43xx.h +1 -0
@@ -17,6 +17,7 @@
 #define UART0_BASE                     0x44E09000
 
 /* GPIO Base address */
+#define GPIO0_BASE                     0x44E07000

Looks like this address is same for AM335x (what the code has right now is incorrect) and AM437x. So you can move it back to hardware.h if that's the general convention.

Quoted 17 lines
arch/arm/include/asm/arch-am33xx/hardware_am43xx.h +2 -0
 #define GPIO2_BASE                     0x481AC000
 
 /* Watchdog Timer */
@@ -30,6 +31,8 @@
 #define PRCM_BASE                      0x44DF0000
 #define        CM_WKUP                         0x44DF2800
 #define        CM_PER                          0x44DF8800
+#define CM_DPLL                                0x44DF4200
+#define CM_RTC                         0x44df8500
 
 #define PRM_RSTCTRL                    (PRCM_BASE + 0x4000)
 #define PRM_RSTST                      (PRM_RSTCTRL + 4)
arch/arm/include/asm/arch-am33xx/hardware_ti814x.h +0 -0
index 4509a23..2322bc4 100644

arch/arm/include/asm/arch-am33xx/hardware_ti814x.h line 19

Quoted 4 lines
arch/arm/include/asm/arch-am33xx/hardware_ti814x.h +1 -0
@@ -16,6 +16,7 @@
 /* UART Base Address */
 #define UART0_BASE                     0x48020000
 
+#define GPIO0_BASE                     0x48032000

So that's where the current address came from. Still incorrect for AMxx.

Regards,
Vaibhav

#3 lore raw

PATCH 1/14 ARM: AM43xx: Update the base addresses of modules

Hi Vibhav,
Thanks for the review...:)

Quoted 61 lines · Vaibhav Bedia

HI Lokesh :)

Quoted 58 lines · Lokesh Vutla

PRCM, timer base addresses and offsets are different from AM33xx. Updating the same.

---
 arch/arm/include/asm/arch-am33xx/cpu.h             |   17 +++++++++++------
 arch/arm/include/asm/arch-am33xx/hardware.h        |    8 --------
 arch/arm/include/asm/arch-am33xx/hardware_am33xx.h |    3 +++
 arch/arm/include/asm/arch-am33xx/hardware_am43xx.h |    3 +++
 arch/arm/include/asm/arch-am33xx/hardware_ti814x.h |    3 +++
 arch/arm/include/asm/arch-am33xx/hardware_ti816x.h |    3 +++
 6 files changed, 23 insertions(+), 14 deletions(-)
arch/arm/include/asm/arch-am33xx/cpu.h +11 -6
index 52fa128..f463b27 100644
@@ -237,6 +237,14 @@ struct cm_perpll {
        unsigned int cpswclkstctrl;     /* offset 0x144 */
        unsigned int lcdcclkstctrl;     /* offset 0x148 */
 };
+
+/* Encapsulating Display pll registers */
+struct cm_dpll {
+       unsigned int resv1[2];
+       unsigned int clktimer2clk;      /* offset 0x08 */
+       unsigned int resv2[10];
+       unsigned int clklcdcpixelclk;   /* offset 0x34 */
+};
 #else
 /* Encapsulating core pll registers */
 struct cm_wkuppll {
@@ -392,15 +400,12 @@ struct cm_perpll {
        unsigned int resv40[7];
        unsigned int cpgmac0clkctrl;    /* offset 0xB20 */
 };
-#endif /* CONFIG_AM43XX */
 
-/* Encapsulating Display pll registers */
 struct cm_dpll {
-       unsigned int resv1[2];
-       unsigned int clktimer2clk;      /* offset 0x08 */
-       unsigned int resv2[10];
-       unsigned int clklcdcpixelclk;   /* offset 0x34 */
+       unsigned int resv1;
+       unsigned int clktimer2clk;      /* offset 0x04 */
 };
+#endif /* CONFIG_AM43XX */
 
 /* Control Module RTC registers */
 struct cm_rtc {
arch/arm/include/asm/arch-am33xx/hardware.h +0 -0
index ee5fce0..b6db731 100644
@@ -38,7 +38,6 @@
 #define DM_TIMER7_BASE                 0x4804A000
 
Quoted 8 lines

arch/arm/include/asm/arch-am33xx/hardware.h line 41

Quoted 2 lines
arch/arm/include/asm/arch-am33xx/hardware.h +0 -1
 /* GPIO Base address */
-#define GPIO0_BASE                     0x48032000

Going by the patch description this looks an unrelated change. Moreover, this base address looks wrong! GPIO0 is in wkup domain for both AM335x and AM437x. I wonder how the VTT control is working on AM335x. IIRC that was using a pin from GPIO0.

Should have added GPIO also in patch description.

Quoted 73 lines
Quoted 44 lines
arch/arm/include/asm/arch-am33xx/hardware.h +0 -7
 #define GPIO1_BASE                     0x4804C000
 
 /* BCH Error Location Module */
@@ -48,13 +47,6 @@
 #define EMIF4_0_CFG_BASE               0x4C000000
 #define EMIF4_1_CFG_BASE               0x4D000000
 
-/* PLL related registers */
-#define CM_DPLL                                0x44E00500
-#define CM_DEVICE                      0x44E00700
-#define CM_RTC                         0x44E00800
-#define CM_CEFUSE                      0x44E00A00
-#define PRM_DEVICE                     0x44E00F00
-
 /* DDR Base address */
 #define DDR_CTRL_ADDR                  0x44E10E04
 #define DDR_CONTROL_BASE_ADDR          0x44E11404
arch/arm/include/asm/arch-am33xx/hardware_am33xx.h +3 -0
index e4231c8..ad9d7dd 100644
@@ -17,6 +17,7 @@
 #define UART0_BASE                     0x44E09000
 
 /* GPIO Base address */
+#define GPIO0_BASE                     0x48032000
 #define GPIO2_BASE                     0x481AC000
 
 /* Watchdog Timer */
@@ -30,6 +31,8 @@
 #define PRCM_BASE                      0x44E00000
 #define CM_PER                         0x44E00000
 #define CM_WKUP                                0x44E00400
+#define CM_DPLL                                0x44E00500
+#define CM_RTC                         0x44E00800
 
 #define PRM_RSTCTRL                    (PRCM_BASE + 0x0F00)
 #define PRM_RSTST                      (PRM_RSTCTRL + 8)
arch/arm/include/asm/arch-am33xx/hardware_am43xx.h +0 -0
index 3b665e6..4dbc789 100644

arch/arm/include/asm/arch-am33xx/hardware_am43xx.h line 20

Quoted 4 lines
arch/arm/include/asm/arch-am33xx/hardware_am43xx.h +1 -0
@@ -17,6 +17,7 @@
 #define UART0_BASE                     0x44E09000
 
 /* GPIO Base address */
+#define GPIO0_BASE                     0x44E07000

Looks like this address is same for AM335x (what the code has right now is incorrect) and AM437x. So you can move it back to hardware.h if that's the general convention.

Quoted 20 lines
arch/arm/include/asm/arch-am33xx/hardware_am43xx.h +2 -0
 #define GPIO2_BASE                     0x481AC000
 
 /* Watchdog Timer */
@@ -30,6 +31,8 @@
 #define PRCM_BASE                      0x44DF0000
 #define        CM_WKUP                         0x44DF2800
 #define        CM_PER                          0x44DF8800
+#define CM_DPLL                                0x44DF4200
+#define CM_RTC                         0x44df8500
 
 #define PRM_RSTCTRL                    (PRCM_BASE + 0x4000)
 #define PRM_RSTST                      (PRM_RSTCTRL + 4)
arch/arm/include/asm/arch-am33xx/hardware_ti814x.h +0 -0
index 4509a23..2322bc4 100644
@@ -16,6 +16,7 @@
 /* UART Base Address */
 #define UART0_BASE                     0x48020000
 
Quoted 4 lines

arch/arm/include/asm/arch-am33xx/hardware_ti814x.h line 19

Quoted 1 line
arch/arm/include/asm/arch-am33xx/hardware_ti814x.h +1 -0
+#define GPIO0_BASE                     0x48032000

So that's where the current address came from. Still incorrect for AMxx.

Yes you are correct. Just now I verified that there is asm/arch-am33xx/gpio.h file in which AM33XX_GPIO0_BASE is defined. This is used by AM33xx.
I am not sure why GPIO_BASE is added again in hardware.h file.
Any way I can reuse the GPIO base address from the above file instead of adding in hardware.h file. Thanks for the pointer.

Thanks and regards,
Lokesh

Quoted 4 lines

Regards,
Vaibhav

#4 lore raw

PATCH 2/14 ARM: AM43xx: Adapt to ti_armv7_common.h config file

In reply to Lokesh Vutla

Use ti_armv7_common.h config file to inclde the common configs.

---
 board/ti/am43xx/board.c      |    2 +-
 include/configs/am43xx_evm.h |  130 +++++++++---------------------------------
 2 files changed, 28 insertions(+), 104 deletions(-)
board/ti/am43xx/board.c +1 -1
index 51b2576..dcd8cbb 100644
@@ -44,7 +44,7 @@ void sdram_init(void)
 
 int board_init(void)
 {
-	gd->bd->bi_boot_params = PHYS_DRAM_1 + 0x100;
+	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 
 	return 0;
 }
include/configs/am43xx_evm.h +27 -103

155 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 2/14 ARM: AM43xx: Adapt to ti_armv7_common.h config file

Quoted 2 lines · Lokesh Vutla

Use ti_armv7_common.h config file to inclde the common configs.

[...]

include/configs/am43xx_evm.h line 51

Quoted 3 lines
include/configs/am43xx_evm.h +3 -0
+/* Clock Defines */
+#define V_OSCK                         24000000  /* Clock output from T2 */
+#define V_SCLK                         (V_OSCK)

I know this is slightly unrelated but i don't think hardcoding the osc freq is a good idea. We should be reading the PRCM register to detect the sysboot settings and then use that similar to the kernel. Follow up patch?

include/configs/am43xx_evm.h line 54

Quoted 5 lines
include/configs/am43xx_evm.h +2 -2
-/* Unsupported features */
-#undef CONFIG_USE_IRQ
+/* NS16550 Configuration */
+#define CONFIG_SYS_NS16550_COM1                0x44e09000      /* Base EVM has UART0 */

I think the comment on base EVM is not applicable here ;)

Regards,
Vaibhav

#6 lore raw

PATCH 2/14 ARM: AM43xx: Adapt to ti_armv7_common.h config file

Hi Vaibhav,

Quoted 7 lines · Vaibhav Bedia
Quoted 2 lines · Lokesh Vutla

Use ti_armv7_common.h config file to inclde the common configs.

[...]

Quoted 7 lines

include/configs/am43xx_evm.h line 51

Quoted 3 lines
include/configs/am43xx_evm.h +3 -0
+/* Clock Defines */
+#define V_OSCK                         24000000  /* Clock output from T2 */
+#define V_SCLK                         (V_OSCK)

I know this is slightly unrelated but i don't think hardcoding the osc freq is a good idea. We should be reading the PRCM register to detect the sysboot settings and then use that similar to the kernel. Follow up patch?

This is how it is done in all other OMAPs and AMXX. But you are correct, it can be done from reading the register. Will discuss with Tom and update about a separate patch but not in this series..:)

Thanks and regards,
Lokesh

Quoted 12 lines

include/configs/am43xx_evm.h line 54

Quoted 6 lines
include/configs/am43xx_evm.h +2 -2
-/* Unsupported features */
-#undef CONFIG_USE_IRQ
+/* NS16550 Configuration */
+#define CONFIG_SYS_NS16550_COM1                0x44e09000      /* Base EVM has UART0 */

I think the comment on base EVM is not applicable here ;)

Regards,
Vaibhav

#7 lore raw

PATCH 3/14 ARM: AM43xx: Add L2 Support

In reply to Lokesh Vutla

AM4372 uses PL310 L2 Cache. Enable the configs for the same.

---
 include/configs/am43xx_evm.h |    5 +++++
 1 file changed, 5 insertions(+)
include/configs/am43xx_evm.h +5 -0
index 4815357..b0269a7 100644
@@ -30,6 +30,11 @@
 #define CONFIG_SPL_MAX_SIZE		(0x4030C000 - CONFIG_SPL_TEXT_BASE)
 #define CONFIG_SPL_YMODEM_SUPPORT
 
+/* Enabling L2 Cache */
+#define CONFIG_SYS_L2_PL310
+#define CONFIG_SYS_PL310_BASE	0x48242000
+#define CONFIG_SYS_CACHELINE_SIZE	32
+
 /*
  * Since SPL did pll and ddr initialization for us,
  * we don't need to do it twice.
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 4/14 ARM: AM43xx: Add extra ENV settings

In reply to Lokesh Vutla

Add Extra env settings.
This is derived from am335x Extra ENV settings.

---
 include/configs/am43xx_evm.h |   63 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
include/configs/am43xx_evm.h +63 -0
index b0269a7..6afb6b4 100644
@@ -72,4 +72,67 @@
 #define CONFIG_OMAP_USB_PHY
 #define CONFIG_AM437X_USB2PHY2_HOST
 
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"loadaddr=0x80200000\0" \
+	"fdtaddr=0x80F80000\0" \
+	"fdt_high=0xffffffff\0" \
+	"rdaddr=0x81000000\0" \
+	"fdtfile=undefined\0" \
+	"bootpart=0:2\0" \
+	"bootdir=/boot\0" \
+	"bootfile=zImage\0" \
+	"console=ttyO0,115200n8\0" \
+	"optargs=\0" \
+	"mmcdev=0\0" \
+	"mmcroot=/dev/mmcblk0p2 rw\0" \
+	"mmcrootfstype=ext4 rootwait\0" \
+	"ramroot=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M\0" \
+	"ramrootfstype=ext2\0" \
+	"mmcargs=setenv bootargs console=${console} " \
+		"${optargs} " \
+		"root=${mmcroot} " \
+		"rootfstype=${mmcrootfstype}\0" \
+	"bootenv=uEnv.txt\0" \
+	"loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
+	"importbootenv=echo Importing environment from mmc ...; " \
+		"env import -t $loadaddr $filesize\0" \
+	"ramargs=setenv bootargs console=${console} " \
+		"${optargs} " \
+		"root=${ramroot} " \
+		"rootfstype=${ramrootfstype}\0" \
+	"loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
+	"loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
+	"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
+	"mmcboot=mmc dev ${mmcdev}; " \
+		"if mmc rescan; then " \
+			"echo SD/MMC found on device ${mmcdev};" \
+			"if run loadbootenv; then " \
+				"echo Loaded environment from ${bootenv};" \
+				"run importbootenv;" \
+			"fi;" \
+			"if test -n $uenvcmd; then " \
+				"echo Running uenvcmd ...;" \
+				"run uenvcmd;" \
+			"fi;" \
+			"if run loadimage; then " \
+				"run loadfdt; " \
+				"echo Booting from mmc${mmcdev} ...; " \
+				"run mmcargs; " \
+				"bootz ${loadaddr} - ${fdtaddr}; " \
+			"fi;" \
+		"fi;\0" \
+	"findfdt="\
+		"if test $board_name = AM43EPOS; then " \
+			"setenv fdtfile am43x-epos-evm.dtb; fi; " \
+		"if test $board_name = AM43__GP; then " \
+			"setenv fdtfile am43x-gp-evm.dtb; fi; " \
+		"if test $fdtfile = undefined; then " \
+			"echo WARNING: Could not determine device tree; fi; \0"
+
+#define CONFIG_BOOTCOMMAND \
+	"run findfdt; " \
+	"run mmcboot;"
+
+#endif
 #endif	/* __CONFIG_AM43XX_EVM_H */
Signature · 1 line
1.7.9.5
#9 lore raw

PATCH 5/14 ARM: AM43XX: board: add support for reading onboard EEPROM

In reply to Lokesh Vutla

From: Sekhar Nori <[email protected]>

Add support for reading onboard EEPROM to enable
board detection.

---
 arch/arm/include/asm/arch-am33xx/omap.h |    2 ++
 board/ti/am43xx/board.c                 |   46 +++++++++++++++++++++++++++++++
 board/ti/am43xx/board.h                 |   32 +++++++++++++++++++++
 include/configs/am43xx_evm.h            |    7 +++++
 4 files changed, 87 insertions(+)
arch/arm/include/asm/arch-am33xx/omap.h +2 -0
index 2250721..10f05c9 100644
@@ -27,5 +27,7 @@
 #define NON_SECURE_SRAM_START	0x402F0400
 #define NON_SECURE_SRAM_END	0x40340000
 #define SRAM_SCRATCH_SPACE_ADDR	0x4033C000
+#define AM4372_BOARD_NAME_START	SRAM_SCRATCH_SPACE_ADDR
+#define AM4372_BOARD_NAME_END	SRAM_SCRATCH_SPACE_ADDR + 0xC
 #endif
 #endif
board/ti/am43xx/board.c +46 -0

58 lines not on this page · raw message

board/ti/am43xx/board.h +32 -0
index 8ca098b..9268895 100644
@@ -12,6 +12,38 @@
 #ifndef _BOARD_H_
 #define _BOARD_H_
 
+#include <asm/arch/omap.h>
+
+static char *const am43xx_board_name = (char *)AM4372_BOARD_NAME_START;
+
+/*
+ * TI AM437x EVMs define a system EEPROM that defines certain sub-fields.
+ * We use these fields to in turn see what board we are on, and what
+ * that might require us to set or not set.
+ */
+#define HDR_NO_OF_MAC_ADDR	3
+#define HDR_ETH_ALEN		6
+#define HDR_NAME_LEN		8
+
+struct am43xx_board_id {
+	unsigned int  magic;
+	char name[HDR_NAME_LEN];
+	char version[4];
+	char serial[12];
+	char config[32];
+	char mac_addr[HDR_NO_OF_MAC_ADDR][HDR_ETH_ALEN];
+};
+
+static inline int board_is_eposevm(void)
+{
+	return !strncmp(am43xx_board_name, "AM43EPOS", HDR_NAME_LEN);
+}
+
+static inline int board_is_gpevm(void)
+{
+	return !strncmp(am43xx_board_name, "AM43__GP", HDR_NAME_LEN);
+}
+
 void enable_uart0_pin_mux(void);
 void enable_board_pin_mux(void);
 #endif
include/configs/am43xx_evm.h +7 -0
index 6afb6b4..456dcaa 100644
@@ -25,6 +25,13 @@
 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
 #define CONFIG_SYS_NS16550_CLK		48000000
 
+/* I2C Configuration */
+#define CONFIG_CMD_EEPROM
+#define CONFIG_ENV_EEPROM_IS_ON_I2C
+#define CONFIG_SYS_I2C_EEPROM_ADDR	0x50	/* Main EEPROM */
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN	2
+#define CONFIG_SYS_I2C_MULTI_EEPROMS
+
 /* SPL defines. */
 #define CONFIG_SPL_TEXT_BASE		0x40300350
 #define CONFIG_SPL_MAX_SIZE		(0x4030C000 - CONFIG_SPL_TEXT_BASE)
Signature · 1 line
1.7.9.5
#10 lore raw

PATCH 5/14 ARM: AM43XX: board: add support for reading onboard EEPROM

Quoted 53 lines · Lokesh Vutla

From: Sekhar Nori <[email protected]>

Add support for reading onboard EEPROM to enable
board detection.

---
 arch/arm/include/asm/arch-am33xx/omap.h |    2 ++
 board/ti/am43xx/board.c                 |   46 +++++++++++++++++++++++++++++++
 board/ti/am43xx/board.h                 |   32 +++++++++++++++++++++
 include/configs/am43xx_evm.h            |    7 +++++
 4 files changed, 87 insertions(+)
arch/arm/include/asm/arch-am33xx/omap.h +2 -0
index 2250721..10f05c9 100644
@@ -27,5 +27,7 @@
 #define NON_SECURE_SRAM_START  0x402F0400
 #define NON_SECURE_SRAM_END    0x40340000
 #define SRAM_SCRATCH_SPACE_ADDR        0x4033C000
+#define AM4372_BOARD_NAME_START        SRAM_SCRATCH_SPACE_ADDR
+#define AM4372_BOARD_NAME_END  SRAM_SCRATCH_SPACE_ADDR + 0xC
 #endif
 #endif
board/ti/am43xx/board.c +12 -0
index dcd8cbb..4fc1a40 100644
@@ -9,6 +9,8 @@
  */
 
 #include <common.h>
+#include <i2c.h>
+#include <asm/errno.h>
 #include <spl.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
@@ -17,6 +19,50 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+/*
+ * Read header information from EEPROM into global structure.
+ */
+static int read_eeprom(struct am43xx_board_id *header)
+{
+       /* Check if baseboard eeprom is available */
+       if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) {
+               printf("Could not probe the EEPROM at 0x%x\n",
+                      CONFIG_SYS_I2C_EEPROM_ADDR);
+               return -ENODEV;

board/ti/am43xx/board.c line 41

Quoted 10 lines
board/ti/am43xx/board.c +10 -0
+       }
+
+       /* read the eeprom using i2c */
+       if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 2, (uchar *)header,
+                    sizeof(struct am43xx_board_id))) {
+               printf("Could not read the EEPROM\n");
+               return -EIO;
+       }
+
+       if (header->magic != 0xEE3355AA) {

Why is the header the same as AM335x? Shouldn't it be something like 0xEE3344AA or whatever?

board/ti/am43xx/board.c line 53

Quoted 12 lines
board/ti/am43xx/board.c +12 -0
+               /*
+                * read the eeprom using i2c again,
+                * but use only a 1 byte address
+                */
+               if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 1, (uchar *)header,
+                            sizeof(struct am43xx_board_id))) {
+                       printf("Could not read the EEPROM at 0x%x\n",
+                              CONFIG_SYS_I2C_EEPROM_ADDR);
+                       return -EIO;
+               }
+
+               if (header->magic != 0xEE3355AA) {

Same here.

Regards,
Vaibhav

#11 lore raw

PATCH 5/14 ARM: AM43XX: board: add support for reading onboard EEPROM

Quoted 59 lines · Vaibhav Bedia
Quoted 58 lines · Lokesh Vutla

From: Sekhar Nori <[email protected]>

Add support for reading onboard EEPROM to enable
board detection.

---
 arch/arm/include/asm/arch-am33xx/omap.h |    2 ++
 board/ti/am43xx/board.c                 |   46 +++++++++++++++++++++++++++++++
 board/ti/am43xx/board.h                 |   32 +++++++++++++++++++++
 include/configs/am43xx_evm.h            |    7 +++++
 4 files changed, 87 insertions(+)
arch/arm/include/asm/arch-am33xx/omap.h +2 -0
index 2250721..10f05c9 100644
@@ -27,5 +27,7 @@
 #define NON_SECURE_SRAM_START  0x402F0400
 #define NON_SECURE_SRAM_END    0x40340000
 #define SRAM_SCRATCH_SPACE_ADDR        0x4033C000
+#define AM4372_BOARD_NAME_START        SRAM_SCRATCH_SPACE_ADDR
+#define AM4372_BOARD_NAME_END  SRAM_SCRATCH_SPACE_ADDR + 0xC
 #endif
 #endif
board/ti/am43xx/board.c +17 -0
index dcd8cbb..4fc1a40 100644
@@ -9,6 +9,8 @@
  */
 
 #include <common.h>
+#include <i2c.h>
+#include <asm/errno.h>
 #include <spl.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
@@ -17,6 +19,50 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+/*
+ * Read header information from EEPROM into global structure.
+ */
+static int read_eeprom(struct am43xx_board_id *header)
+{
+       /* Check if baseboard eeprom is available */
+       if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) {
+               printf("Could not probe the EEPROM at 0x%x\n",
+                      CONFIG_SYS_I2C_EEPROM_ADDR);
+               return -ENODEV;
+       }
+
+       /* read the eeprom using i2c */
+       if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 2, (uchar *)header,
+                    sizeof(struct am43xx_board_id))) {
Quoted 8 lines

board/ti/am43xx/board.c line 41

Quoted 5 lines
board/ti/am43xx/board.c +5 -0
+               printf("Could not read the EEPROM\n");
+               return -EIO;
+       }
+
+       if (header->magic != 0xEE3355AA) {

Why is the header the same as AM335x? Shouldn't it be something like 0xEE3344AA or whatever?

No, the header is still same. It is 0xEE3355AA.

Thanks and regards,
Lokesh

Quoted 19 lines

board/ti/am43xx/board.c line 53

Quoted 13 lines
board/ti/am43xx/board.c +12 -0
+               /*
+                * read the eeprom using i2c again,
+                * but use only a 1 byte address
+                */
+               if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 1, (uchar *)header,
+                            sizeof(struct am43xx_board_id))) {
+                       printf("Could not read the EEPROM at 0x%x\n",
+                              CONFIG_SYS_I2C_EEPROM_ADDR);
+                       return -EIO;
+               }
+
+               if (header->magic != 0xEE3355AA) {

Same here.

Regards,
Vaibhav

#12 lore raw

PATCH 5/14 ARM: AM43XX: board: add support for reading onboard EEPROM

Quoted 68 lines · Lokesh Vutla
Quoted 59 lines · Vaibhav Bedia
Quoted 58 lines · Lokesh Vutla

From: Sekhar Nori <[email protected]>

Add support for reading onboard EEPROM to enable
board detection.

---
 arch/arm/include/asm/arch-am33xx/omap.h |    2 ++
 board/ti/am43xx/board.c                 |   46 +++++++++++++++++++++++++++++++
 board/ti/am43xx/board.h                 |   32 +++++++++++++++++++++
 include/configs/am43xx_evm.h            |    7 +++++
 4 files changed, 87 insertions(+)
arch/arm/include/asm/arch-am33xx/omap.h +2 -0
index 2250721..10f05c9 100644
@@ -27,5 +27,7 @@
 #define NON_SECURE_SRAM_START  0x402F0400
 #define NON_SECURE_SRAM_END    0x40340000
 #define SRAM_SCRATCH_SPACE_ADDR        0x4033C000
+#define AM4372_BOARD_NAME_START        SRAM_SCRATCH_SPACE_ADDR
+#define AM4372_BOARD_NAME_END  SRAM_SCRATCH_SPACE_ADDR + 0xC
 #endif
 #endif
board/ti/am43xx/board.c +17 -0
index dcd8cbb..4fc1a40 100644
@@ -9,6 +9,8 @@
  */
 
 #include <common.h>
+#include <i2c.h>
+#include <asm/errno.h>
 #include <spl.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
@@ -17,6 +19,50 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+/*
+ * Read header information from EEPROM into global structure.
+ */
+static int read_eeprom(struct am43xx_board_id *header)
+{
+       /* Check if baseboard eeprom is available */
+       if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) {
+               printf("Could not probe the EEPROM at 0x%x\n",
+                      CONFIG_SYS_I2C_EEPROM_ADDR);
+               return -ENODEV;
+       }
+
+       /* read the eeprom using i2c */
+       if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 2, (uchar *)header,
+                    sizeof(struct am43xx_board_id))) {
Quoted 8 lines

board/ti/am43xx/board.c line 41

Quoted 5 lines
board/ti/am43xx/board.c +5 -0
+               printf("Could not read the EEPROM\n");
+               return -EIO;
+       }
+
+       if (header->magic != 0xEE3355AA) {

Why is the header the same as AM335x? Shouldn't it be something like 0xEE3344AA or whatever?

Quoted 2 lines

No, the header is still same. It is 0xEE3355AA.

My question was why ;)
What's the point of adding the same magic value for a different SoC? Unless there's a good reason for doing so i think this needs to be fixed in the EEPROM programmer.

#13 lore raw

PATCH 5/14 ARM: AM43XX: board: add support for reading onboard EEPROM

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 69 lines · Vaibhav Bedia
Quoted 68 lines · Lokesh Vutla
Quoted 67 lines · Vaibhav Bedia
Quoted 53 lines · Lokesh Vutla

From: Sekhar Nori <[email protected]>

Add support for reading onboard EEPROM to enable
board detection.

---
 arch/arm/include/asm/arch-am33xx/omap.h |    2 ++
 board/ti/am43xx/board.c                 |   46 +++++++++++++++++++++++++++++++
 board/ti/am43xx/board.h                 |   32 +++++++++++++++++++++
 include/configs/am43xx_evm.h            |    7 +++++
 4 files changed, 87 insertions(+)
arch/arm/include/asm/arch-am33xx/omap.h +2 -0
index 2250721..10f05c9 100644
@@ -27,5 +27,7 @@
 #define NON_SECURE_SRAM_START  0x402F0400
 #define NON_SECURE_SRAM_END    0x40340000
 #define SRAM_SCRATCH_SPACE_ADDR        0x4033C000
+#define AM4372_BOARD_NAME_START        SRAM_SCRATCH_SPACE_ADDR
+#define AM4372_BOARD_NAME_END  SRAM_SCRATCH_SPACE_ADDR + 0xC
 #endif
 #endif
board/ti/am43xx/board.c +12 -0
index dcd8cbb..4fc1a40 100644
@@ -9,6 +9,8 @@
  */
 
 #include <common.h>
+#include <i2c.h>
+#include <asm/errno.h>
 #include <spl.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
@@ -17,6 +19,50 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+/*
+ * Read header information from EEPROM into global structure.
+ */
+static int read_eeprom(struct am43xx_board_id *header)
+{
+       /* Check if baseboard eeprom is available */
+       if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) {
+               printf("Could not probe the EEPROM at 0x%x\n",
+                      CONFIG_SYS_I2C_EEPROM_ADDR);
+               return -ENODEV;

board/ti/am43xx/board.c line 41

Quoted 10 lines
board/ti/am43xx/board.c +10 -0
+       }
+
+       /* read the eeprom using i2c */
+       if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 2, (uchar *)header,
+                    sizeof(struct am43xx_board_id))) {
+               printf("Could not read the EEPROM\n");
+               return -EIO;
+       }
+
+       if (header->magic != 0xEE3355AA) {

Why is the header the same as AM335x? Shouldn't it be something like 0xEE3344AA or whatever?

Quoted 7 lines
Quoted 2 lines

No, the header is still same. It is 0xEE3355AA.

My question was why ;)
What's the point of adding the same magic value for a different SoC? Unless there's a good reason for doing so i think this needs to be fixed in the EEPROM programmer.

A magic value is sufficiently magical, I don't think we'll get anyone to change it at this point.

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJSeraOAAoJENk4IS6UOR1W/JgP/jShfGcdKDNKJ8EcwAgdy+iU uFlC02b3f/I4cx7B4s0W3GWJVfHAlPlddSevzSE+I81/f+XRVy9w9Aso3J5hvD3e XJ/deA5xSpKMV4kZjhE0mOO62iemH4r5ewiM1WFbzUUoWIa1Jf+C8pjygvac5UJb DCIE40VigasMjl/bJbMOyZPKbrRbHIh+N7fFZNbo+WUp76ZM2dv0S1JWRaY/Zhpq 08wplMmlONGrOkRQmbVYTp2SPrSiYkxq98cIjyzqrzW2pAPDpWP9z7T5hlfI5iWz It9AENzEkJhmzHTt2P6wq4R9z+giAGweRlFe08tB4lIawX5MaNYOU6TilZee7uf2 PbE5QP2ZXpXCH2Yme59syev/PVqrI02Z8zmZAvvUYQslkEXiXN4mCgWhGXVmZePE +o+O2bACVAbaRANUZv4vosrPkFI5ooBCn9DR7ME7lZu93nIziMk+xRnzmYacSdQK k2+GSQSmJ4zd0NCDNaYQ0Svhd3KY6jLZ/RaaYjN4ylNiEkNv8Skk+Vz8l4R8bctY VZPJeZI/slNH4LfMV6pDuWjmVirJwrj8CmbrpBbWuILjcFjmwvDXt9mGZDlari9z kK5s4TsAib29bGOPJIjBedmTLuQbaOy6GFppAYQCU063z+n/Jzsyp1ICQGtA5b6P 0PE9WmzQtC7+X15bIL5d
=l8oP
-----END PGP SIGNATURE-----

#14 lore raw

PATCH 5/14 ARM: AM43XX: board: add support for reading onboard EEPROM

Hi Tom,

Quoted 8 lines · Tom Rini
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+       if (header->magic != 0xEE3355AA) {

Why is the header the same as AM335x? Shouldn't it be something like 0xEE3344AA or whatever?

No, the header is still same. It is 0xEE3355AA.

Quoted 8 lines
Quoted 4 lines

My question was why ;)
What's the point of adding the same magic value for a different SoC? Unless there's a good reason for doing so i think this needs to be fixed in the EEPROM programmer.

A magic value is sufficiently magical, I don't think we'll get anyone to change it at this point.

With almost half a dozen of AM335x board variants floating around this thing is bound to cause problems eventually. The EEPROM format can simply be updated to fix this. If there's a big resistance in doing this then we might as well live with it - but i would at least ask once ;)

Regards,
Vaibhav

#15 lore raw

PATCH 5/14 ARM: AM43XX: board: add support for reading onboard EEPROM

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 16 lines · Vaibhav Bedia

Hi Tom,

Quoted 13 lines · Tom Rini
Quoted 12 lines
Quoted 7 lines
Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+       if (header->magic != 0xEE3355AA) {

Why is the header the same as AM335x? Shouldn't it be something like 0xEE3344AA or whatever?

No, the header is still same. It is 0xEE3355AA.

My question was why ;)
What's the point of adding the same magic value for a different SoC? Unless there's a good reason for doing so i think this needs to be fixed in the EEPROM programmer.

Quoted 7 lines
Quoted 2 lines

A magic value is sufficiently magical, I don't think we'll get anyone to change it at this point.

With almost half a dozen of AM335x board variants floating around this thing is bound to cause problems eventually. The EEPROM format can simply be updated to fix this. If there's a big resistance in doing this then we might as well live with it - but i would at least ask once ;)

The thing is, customers drop the EEPROM or come up with their own, see the Siemens am335x boards :)

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJSfADXAAoJENk4IS6UOR1WRa0P/1EMaiNOZsztbkdosA+Gja5y /FDdvJl8fWrKKMY0gBUNIplFNev2cDdOyb0EdglD77oinYM8cpdYHkh1rhZEv7rA kvx5rFZ0iOftuavbgtUEBcTs2/oLbFjKZV8ajCkwuFig6E1XY49yeT9obsB9UKxG uBYIs75SYBPZg/8RzDlQbwpyBR/3cSwRQ9t61p21lQVnZvenIwNPhVxCg++jxtdT i0IuzraMwcdUXKIBoBkE6Lu+vYgbi4yWcrPIrllxo5C3vRkw9ua6rRHB9qTG60xM V02CSxm9UTfrg4yMlBZHMkPDAHcbAirV4+z70vMdqsffzMhGspL3/Lo8+bf6FD31 xnlws8IVJTLjNTLL/ZZ6POcPXI2rHsLkdfVQoXYWVBVmn5ZHvfrCEL2ahkYBG40Y y2rzyw/QiFCZz8GXPHNV7NNDaVTaasw7ph7dJ03/a3yMBJJNIK7OV3EdR22dtgUe a2734X2DWbPQtdovkH5YQMULXi5pYH6aCXMbcPGsGWVN8HZXuEOdmNdWkdFyoD4W /l8vx63X5BdUCsrbahp6KI9Es4AZN/QbNGbn5oLSkf/qVDdJTxW3RrZ/wcgk+r3I F7ufYYetQi0nOE+2ri0ayFgZNNqNCbUZKeZEuEMzUNXwPfY4CZDTov3fk2C4rnfk PewbVnXTpc2lnUyjxD1v
=B5PZ
-----END PGP SIGNATURE-----

#16 lore raw

PATCH 5/14 ARM: AM43XX: board: add support for reading onboard EEPROM

Quoted 23 lines · Tom Rini

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 19 lines · Vaibhav Bedia

Hi Tom,

Quoted 15 lines · Tom Rini
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+       if (header->magic != 0xEE3355AA) {

Why is the header the same as AM335x? Shouldn't it be something like 0xEE3344AA or whatever?

Quoted 7 lines
Quoted 2 lines

No, the header is still same. It is 0xEE3355AA.

My question was why ;)
What's the point of adding the same magic value for a different SoC? Unless there's a good reason for doing so i think this needs to be fixed in the EEPROM programmer.

A magic value is sufficiently magical, I don't think we'll get anyone to change it at this point.

Quoted 8 lines
Quoted 4 lines

With almost half a dozen of AM335x board variants floating around this thing is bound to cause problems eventually. The EEPROM format can simply be updated to fix this. If there's a big resistance in doing this then we might as well live with it - but i would at least ask once ;)

The thing is, customers drop the EEPROM or come up with their own, see the Siemens am335x boards :)

Customers fix a design and get rid of whatever they can ;)

I always considered the EEPROM as one of the ways of maintaining some sanity amongst the numerous board variants that go around internally :P

I'll leave this for the right folks to decide then :)

Regards,
Vaibhav

#17 lore raw

PATCH 6/14 ARM: AM43XX: Add CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG support

In reply to Lokesh Vutla

From: Sekhar Nori <[email protected]>

CONFIG_ENV_VARS_UBOOT_CONFIG, CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG and CONFIG_BOARD_LATE_INIT is already set. Adding support to detect the board. These variables are used by findfdt.

---
 board/ti/am43xx/board.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
board/ti/am43xx/board.c +16 -0
index 4fc1a40..723d0ca 100644
@@ -98,6 +98,22 @@ int board_init(void)
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
+#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+	char safe_string[HDR_NAME_LEN + 1];
+	struct am43xx_board_id header;
+
+	if (read_eeprom(&header) < 0)
+		puts("Could not get board ID.\n");
+
+	/* Now set variables based on the header. */
+	strncpy(safe_string, (char *)header.name, sizeof(header.name));
+	safe_string[sizeof(header.name)] = 0;
+	setenv("board_name", safe_string);
+
+	strncpy(safe_string, (char *)header.version, sizeof(header.version));
+	safe_string[sizeof(header.version)] = 0;
+	setenv("board_rev", safe_string);
+#endif
 	return 0;
 }
 #endif
Signature · 1 line
1.7.9.5
#18 lore raw

PATCH 7/14 ARM: AM43xx: Select clk source for Timer2

In reply to Lokesh Vutla

Selecting the Master osc clk as Timer2 clock source.

---
 arch/arm/cpu/armv7/am33xx/clock_am43xx.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/arm/cpu/armv7/am33xx/clock_am43xx.c +4 -0
index c4890f2..22963b7 100644
@@ -18,6 +18,7 @@
 
 struct cm_perpll *const cmper = (struct cm_perpll *)CM_PER;
 struct cm_wkuppll *const cmwkup = (struct cm_wkuppll *)CM_WKUP;
+struct cm_dpll *const cmdpll = (struct cm_dpll *)CM_DPLL;
 
 const struct dpll_regs dpll_mpu_regs = {
 	.cm_clkmode_dpll	= CM_WKUP + 0x560,
@@ -107,4 +108,7 @@ void enable_basic_clocks(void)
 	};
 
 	do_enable_clocks(clk_domains, clk_modules_explicit_en, 1);
+
+	/* Select the Master osc clk as Timer2 clock source */
+	writel(0x1, &cmdpll->clktimer2clk);
 }
Signature · 1 line
1.7.9.5
#19 lore raw

PATCH 7/14 ARM: AM43xx: Select clk source for Timer2

Quoted 1 line · Lokesh Vutla

Selecting the Master osc clk as Timer2 clock source.

I obviously missed the first round of patches for AM43xx here. Why is timer2 being used here? Don't we use the synctimer and timer1 in the kernel?

Regards,
Vaibhav

#20 lore raw

PATCH 7/14 ARM: AM43xx: Select clk source for Timer2

Hi Vaibhav,

Quoted 5 lines · Vaibhav Bedia
Quoted 1 line · Lokesh Vutla

Selecting the Master osc clk as Timer2 clock source.

I obviously missed the first round of patches for AM43xx here. Why is timer2 being used here? Don't we use the synctimer and timer1 in the kernel?

In u-boot there is already code present to handle timer2 in arch/arm/cpu/armv7/omap-common/timer.c(Registers offsets are different for timer1 and timer2) . Trying to reuse the same here. This is how it is done in am335x also.
Correct me if I am wrong.

Thanks and regards,
Lokesh

Quoted 4 lines

Regards,
Vaibhav

#21 lore raw

PATCH 7/14 ARM: AM43xx: Select clk source for Timer2

Hi Lokesh,

Quoted 11 lines · Lokesh Vutla

Hi Vaibhav,

Quoted 5 lines · Vaibhav Bedia
Quoted 1 line · Lokesh Vutla

Selecting the Master osc clk as Timer2 clock source.

I obviously missed the first round of patches for AM43xx here. Why is timer2 being used here? Don't we use the synctimer and timer1 in the kernel?

In u-boot there is already code present to handle timer2 in arch/arm/cpu/armv7/omap-common/timer.c(Registers offsets are different for timer1 and timer2) . Trying to reuse the same here. This is how it is done in am335x also.
Correct me if I am wrong.

On AM335x that timer is used in U-Boot in the delay loop and later gets used in the kernel as a system timer. On AM437x it might be a good idea to use synctimer since it has some stabilization period requirements and that's going to affect the kernel boot eventually.

Regards,
Vaibhav

#22 lore raw

PATCH 7/14 ARM: AM43xx: Select clk source for Timer2

Hi Vaibhav,

Quoted 15 lines · Vaibhav Bedia

Hi Lokesh,

Quoted 11 lines · Lokesh Vutla

Hi Vaibhav,

Quoted 5 lines · Vaibhav Bedia
Quoted 1 line · Lokesh Vutla

Selecting the Master osc clk as Timer2 clock source.

I obviously missed the first round of patches for AM43xx here. Why is timer2 being used here? Don't we use the synctimer and timer1 in the kernel?

In u-boot there is already code present to handle timer2 in arch/arm/cpu/armv7/omap-common/timer.c(Registers offsets are different for timer1 and timer2) . Trying to reuse the same here. This is how it is done in am335x also.
Correct me if I am wrong.

Quoted 5 lines

On AM335x that timer is used in U-Boot in the delay loop and later gets used in the kernel as a system timer. On AM437x it might be a good idea to use synctimer since it has some stabilization period requirements and that's going to affect the kernel boot eventually.

OK, Correct me if I am wrong.
On AM437X also this timer is used in U-Boot in delay loop only.
Is there any documentation or any requirement saying that the synctimer needs
some stabilization period? (AFAIK and discussed with Sekhar and Afzal, there is no such requirement.) If there is any such requirement for stabilization, then I should not use such timer in delay loop(So use time2 :) ). Should just enable the timer and leave it for stabilization.
(There was a special case for RTC clock stabilization and was agreed to enable RTC in U-Boot)
Let me know if I am not clear..:)

Thanks and regards,
Lokesh

Quoted 4 lines

Regards,
Vaibhav

#23 lore raw

PATCH 8/14 ARM: AM43xx: Update Current Booting devices list

In reply to Lokesh Vutla

Current Booting devices list is different from that of AM33xx. Updating the same.

---
 arch/arm/include/asm/arch-am33xx/spl.h |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
arch/arm/include/asm/arch-am33xx/spl.h +9 -3
index 95de9aa..82116a9 100644
@@ -13,11 +13,17 @@
 #define BOOT_DEVICE_MMC1	6
 #define BOOT_DEVICE_MMC2	5
 #define BOOT_DEVICE_UART	0x43
-#define BOOT_DEVICE_MMC2_2	0xFF
+#elif defined(CONFIG_AM43XX)
+#define BOOT_DEVICE_NOR		1
+#define BOOT_DEVICE_NAND	5
+#define BOOT_DEVICE_MMC1	7
+#define BOOT_DEVICE_MMC2	8
+#define BOOT_DEVICE_SPI		10
+#define BOOT_DEVICE_UART	65
 #else
 #define BOOT_DEVICE_XIP       	2
 #define BOOT_DEVICE_NAND	5
-#if defined(CONFIG_AM33XX) || defined(CONFIG_AM43XX)
+#if defined(CONFIG_AM33XX)
 #define BOOT_DEVICE_MMC1	8
 #define BOOT_DEVICE_MMC2	9	/* eMMC or daughter card */
 #elif defined(CONFIG_TI814X)
@@ -28,8 +34,8 @@
 #define BOOT_DEVICE_UART	65
 #define BOOT_DEVICE_USBETH	68
 #define BOOT_DEVICE_CPGMAC	70
-#define BOOT_DEVICE_MMC2_2      0xFF
 #endif
+#define BOOT_DEVICE_MMC2_2      0xFF
 
 #if defined(CONFIG_AM33XX) || defined(CONFIG_AM43XX)
 #define MMC_BOOT_DEVICES_START	BOOT_DEVICE_MMC1
Signature · 1 line
1.7.9.5
#24 lore raw

PATCH 9/14 ARM: AM43xx: mux: Update mux data

In reply to Lokesh Vutla

Updating the mux data for UART, and adding data for i2c0 and mmc.

---
 arch/arm/include/asm/arch-am33xx/mux_am43xx.h |    4 +++-
 board/ti/am43xx/mux.c                         |   24 ++++++++++++++++++++++--
 2 files changed, 25 insertions(+), 3 deletions(-)
arch/arm/include/asm/arch-am33xx/mux_am43xx.h +3 -1
index 0206912..e95efdd 100644
@@ -16,7 +16,9 @@
 	__raw_writel(value, (CTRL_BASE + offset));
 
 /* PAD Control Fields */
-#define SLEWCTRL	(0x1 << 19)
+#define DSPULLUDEN	(0x1 << 27) /* DS0 mode Pull-Up/Down enable */
+#define DSPULLUDDIS	(0x0 << 27) /* DS0 mode Pull-Up/Down Disable */
+#define SLEWCTRL	(0x1 << 19) /* Slow slew rate selection */
 #define RXACTIVE	(0x1 << 18)
 #define PULLDOWN_EN	(0x0 << 17) /* Pull Down Selection */
 #define PULLUP_EN	(0x1 << 17) /* Pull Up Selection */
board/ti/am43xx/mux.c +22 -2
index 700e9a7..818a046 100644
@@ -12,8 +12,26 @@
 #include "board.h"
 
 static struct module_pin_mux uart0_pin_mux[] = {
-	{OFFSET(uart0_rxd), (MODE(0) | RXACTIVE)},	/* UART0_RXD */
-	{OFFSET(uart0_txd), (MODE(0))},			/* UART0_TXD */
+	{OFFSET(uart0_rxd),
+	 (MODE(0) | PULLUP_EN | RXACTIVE | SLEWCTRL | DSPULLUDEN)},
+	{OFFSET(uart0_txd),
+	 (MODE(0) | PULLUDDIS | PULLUP_EN | SLEWCTRL | DSPULLUDEN)},
+	{-1},
+};
+
+static struct module_pin_mux mmc0_pin_mux[] = {
+	{OFFSET(mmc0_clk), (MODE(0) | PULLUDDIS | RXACTIVE | DSPULLUDEN)},
+	{OFFSET(mmc0_cmd), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+	{OFFSET(mmc0_dat0), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+	{OFFSET(mmc0_dat1), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+	{OFFSET(mmc0_dat2), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+	{OFFSET(mmc0_dat3), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+	{-1},
+};
+
+static struct module_pin_mux i2c0_pin_mux[] = {
+	{OFFSET(i2c0_sda), (MODE(0) | PULLUP_EN | RXACTIVE | SLEWCTRL)},
+	{OFFSET(i2c0_scl), (MODE(0) | PULLUP_EN | RXACTIVE | SLEWCTRL)},
 	{-1},
 };
 
@@ -24,4 +42,6 @@ void enable_uart0_pin_mux(void)
 
 void enable_board_pin_mux(void)
 {
+	configure_module_pin_mux(mmc0_pin_mux);
+	configure_module_pin_mux(i2c0_pin_mux);
 }
Signature · 1 line
1.7.9.5
#25 lore raw

PATCH 9/14 ARM: AM43xx: mux: Update mux data

Quoted 38 lines · Lokesh Vutla

Updating the mux data for UART, and adding data for i2c0 and mmc.

---
 arch/arm/include/asm/arch-am33xx/mux_am43xx.h |    4 +++-
 board/ti/am43xx/mux.c                         |   24 ++++++++++++++++++++++--
 2 files changed, 25 insertions(+), 3 deletions(-)
arch/arm/include/asm/arch-am33xx/mux_am43xx.h +3 -1
index 0206912..e95efdd 100644
@@ -16,7 +16,9 @@
        __raw_writel(value, (CTRL_BASE + offset));
 
 /* PAD Control Fields */
-#define SLEWCTRL       (0x1 << 19)
+#define DSPULLUDEN     (0x1 << 27) /* DS0 mode Pull-Up/Down enable */
+#define DSPULLUDDIS    (0x0 << 27) /* DS0 mode Pull-Up/Down Disable */
+#define SLEWCTRL       (0x1 << 19) /* Slow slew rate selection */
 #define RXACTIVE       (0x1 << 18)
 #define PULLDOWN_EN    (0x0 << 17) /* Pull Down Selection */
 #define PULLUP_EN      (0x1 << 17) /* Pull Up Selection */
board/ti/am43xx/mux.c +5 -2
index 700e9a7..818a046 100644
@@ -12,8 +12,26 @@
 #include "board.h"
 
 static struct module_pin_mux uart0_pin_mux[] = {
-       {OFFSET(uart0_rxd), (MODE(0) | RXACTIVE)},      /* UART0_RXD */
-       {OFFSET(uart0_txd), (MODE(0))},                 /* UART0_TXD */
+       {OFFSET(uart0_rxd),
+        (MODE(0) | PULLUP_EN | RXACTIVE | SLEWCTRL | DSPULLUDEN)},
+       {OFFSET(uart0_txd),
+        (MODE(0) | PULLUDDIS | PULLUP_EN | SLEWCTRL | DSPULLUDEN)},
+       {-1},

board/ti/am43xx/mux.c line 29

Quoted 10 lines
board/ti/am43xx/mux.c +10 -0
+};
+
+static struct module_pin_mux mmc0_pin_mux[] = {
+       {OFFSET(mmc0_clk), (MODE(0) | PULLUDDIS | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_cmd), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_dat0), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_dat1), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_dat2), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_dat3), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {-1},

Hmm i don't think updating the DSPULL here is a good idea. Since not all the pins
are used in U-Boot, this is just partially updating the pulls for the low power state.
I would suggest leaving this bit for the kernel where things can be updated without
updating the bootloader.

Regards,
Vaibhav

#26 lore raw

PATCH 9/14 ARM: AM43xx: mux: Update mux data

Quoted 50 lines · Vaibhav Bedia
Quoted 38 lines · Lokesh Vutla

Updating the mux data for UART, and adding data for i2c0 and mmc.

---
 arch/arm/include/asm/arch-am33xx/mux_am43xx.h |    4 +++-
 board/ti/am43xx/mux.c                         |   24 ++++++++++++++++++++++--
 2 files changed, 25 insertions(+), 3 deletions(-)
arch/arm/include/asm/arch-am33xx/mux_am43xx.h +3 -1
index 0206912..e95efdd 100644
@@ -16,7 +16,9 @@
        __raw_writel(value, (CTRL_BASE + offset));
 
 /* PAD Control Fields */
-#define SLEWCTRL       (0x1 << 19)
+#define DSPULLUDEN     (0x1 << 27) /* DS0 mode Pull-Up/Down enable */
+#define DSPULLUDDIS    (0x0 << 27) /* DS0 mode Pull-Up/Down Disable */
+#define SLEWCTRL       (0x1 << 19) /* Slow slew rate selection */
 #define RXACTIVE       (0x1 << 18)
 #define PULLDOWN_EN    (0x0 << 17) /* Pull Down Selection */
 #define PULLUP_EN      (0x1 << 17) /* Pull Up Selection */
board/ti/am43xx/mux.c +5 -2
index 700e9a7..818a046 100644
@@ -12,8 +12,26 @@
 #include "board.h"
 
 static struct module_pin_mux uart0_pin_mux[] = {
-       {OFFSET(uart0_rxd), (MODE(0) | RXACTIVE)},      /* UART0_RXD */
-       {OFFSET(uart0_txd), (MODE(0))},                 /* UART0_TXD */
+       {OFFSET(uart0_rxd),
+        (MODE(0) | PULLUP_EN | RXACTIVE | SLEWCTRL | DSPULLUDEN)},
+       {OFFSET(uart0_txd),
+        (MODE(0) | PULLUDDIS | PULLUP_EN | SLEWCTRL | DSPULLUDEN)},
+       {-1},

board/ti/am43xx/mux.c line 29

Quoted 10 lines
board/ti/am43xx/mux.c +10 -0
+};
+
+static struct module_pin_mux mmc0_pin_mux[] = {
+       {OFFSET(mmc0_clk), (MODE(0) | PULLUDDIS | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_cmd), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_dat0), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_dat1), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_dat2), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_dat3), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {-1},
Quoted 7 lines

Hmm i don't think updating the DSPULL here is a good idea. Since not all the pins
are used in U-Boot, this is just partially updating the pulls for the low power state.
I would suggest leaving this bit for the kernel where things can be updated without
updating the bootloader.

These are the preferred settings given to me.
Any way if kernel is updating it overwrites these settings, it shouldn't matter I guess..:)

Thanks and regards,
Lokesh

Quoted 4 lines

Regards,
Vaibhav

#27 lore raw

PATCH 9/14 ARM: AM43xx: mux: Update mux data

Quoted 58 lines · Lokesh Vutla
Quoted 50 lines · Vaibhav Bedia
Quoted 38 lines · Lokesh Vutla

Updating the mux data for UART, and adding data for i2c0 and mmc.

---
 arch/arm/include/asm/arch-am33xx/mux_am43xx.h |    4 +++-
 board/ti/am43xx/mux.c                         |   24 ++++++++++++++++++++++--
 2 files changed, 25 insertions(+), 3 deletions(-)
arch/arm/include/asm/arch-am33xx/mux_am43xx.h +3 -1
index 0206912..e95efdd 100644
@@ -16,7 +16,9 @@
        __raw_writel(value, (CTRL_BASE + offset));
 
 /* PAD Control Fields */
-#define SLEWCTRL       (0x1 << 19)
+#define DSPULLUDEN     (0x1 << 27) /* DS0 mode Pull-Up/Down enable */
+#define DSPULLUDDIS    (0x0 << 27) /* DS0 mode Pull-Up/Down Disable */
+#define SLEWCTRL       (0x1 << 19) /* Slow slew rate selection */
 #define RXACTIVE       (0x1 << 18)
 #define PULLDOWN_EN    (0x0 << 17) /* Pull Down Selection */
 #define PULLUP_EN      (0x1 << 17) /* Pull Up Selection */
board/ti/am43xx/mux.c +5 -2
index 700e9a7..818a046 100644
@@ -12,8 +12,26 @@
 #include "board.h"
 
 static struct module_pin_mux uart0_pin_mux[] = {
-       {OFFSET(uart0_rxd), (MODE(0) | RXACTIVE)},      /* UART0_RXD */
-       {OFFSET(uart0_txd), (MODE(0))},                 /* UART0_TXD */
+       {OFFSET(uart0_rxd),
+        (MODE(0) | PULLUP_EN | RXACTIVE | SLEWCTRL | DSPULLUDEN)},
+       {OFFSET(uart0_txd),
+        (MODE(0) | PULLUDDIS | PULLUP_EN | SLEWCTRL | DSPULLUDEN)},
+       {-1},

board/ti/am43xx/mux.c line 29

Quoted 10 lines
board/ti/am43xx/mux.c +10 -0
+};
+
+static struct module_pin_mux mmc0_pin_mux[] = {
+       {OFFSET(mmc0_clk), (MODE(0) | PULLUDDIS | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_cmd), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_dat0), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_dat1), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_dat2), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_dat3), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {-1},
Quoted 7 lines

Hmm i don't think updating the DSPULL here is a good idea. Since not all the pins
are used in U-Boot, this is just partially updating the pulls for the low power state.
I would suggest leaving this bit for the kernel where things can be updated without
updating the bootloader.

Quoted 3 lines

These are the preferred settings given to me.
Any way if kernel is updating it overwrites these settings, it shouldn't matter I guess..:)

It's better to clearly list down what configuration a particular entity in the system is
responsible for. Doing partial updates her just makes issues harder to debug.

Regards,
Vaibhav

#28 lore raw

PATCH 9/14 ARM: AM43xx: mux: Update mux data

Quoted 59 lines · Vaibhav Bedia
Quoted 58 lines · Lokesh Vutla
Quoted 57 lines · Vaibhav Bedia
Quoted 38 lines · Lokesh Vutla

Updating the mux data for UART, and adding data for i2c0 and mmc.

---
 arch/arm/include/asm/arch-am33xx/mux_am43xx.h |    4 +++-
 board/ti/am43xx/mux.c                         |   24 ++++++++++++++++++++++--
 2 files changed, 25 insertions(+), 3 deletions(-)
arch/arm/include/asm/arch-am33xx/mux_am43xx.h +3 -1
index 0206912..e95efdd 100644
@@ -16,7 +16,9 @@
        __raw_writel(value, (CTRL_BASE + offset));
 
 /* PAD Control Fields */
-#define SLEWCTRL       (0x1 << 19)
+#define DSPULLUDEN     (0x1 << 27) /* DS0 mode Pull-Up/Down enable */
+#define DSPULLUDDIS    (0x0 << 27) /* DS0 mode Pull-Up/Down Disable */
+#define SLEWCTRL       (0x1 << 19) /* Slow slew rate selection */
 #define RXACTIVE       (0x1 << 18)
 #define PULLDOWN_EN    (0x0 << 17) /* Pull Down Selection */
 #define PULLUP_EN      (0x1 << 17) /* Pull Up Selection */
board/ti/am43xx/mux.c +5 -2
index 700e9a7..818a046 100644
@@ -12,8 +12,26 @@
 #include "board.h"
 
 static struct module_pin_mux uart0_pin_mux[] = {
-       {OFFSET(uart0_rxd), (MODE(0) | RXACTIVE)},      /* UART0_RXD */
-       {OFFSET(uart0_txd), (MODE(0))},                 /* UART0_TXD */
+       {OFFSET(uart0_rxd),
+        (MODE(0) | PULLUP_EN | RXACTIVE | SLEWCTRL | DSPULLUDEN)},
+       {OFFSET(uart0_txd),
+        (MODE(0) | PULLUDDIS | PULLUP_EN | SLEWCTRL | DSPULLUDEN)},
+       {-1},

board/ti/am43xx/mux.c line 29

Quoted 10 lines
board/ti/am43xx/mux.c +10 -0
+};
+
+static struct module_pin_mux mmc0_pin_mux[] = {
+       {OFFSET(mmc0_clk), (MODE(0) | PULLUDDIS | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_cmd), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_dat0), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_dat1), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_dat2), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {OFFSET(mmc0_dat3), (MODE(0) | PULLUP_EN | RXACTIVE | DSPULLUDEN)},
+       {-1},

Hmm i don't think updating the DSPULL here is a good idea. Since not all the pins
are used in U-Boot, this is just partially updating the pulls for the low power state.
I would suggest leaving this bit for the kernel where things can be updated without
updating the bootloader.

Quoted 6 lines
Quoted 3 lines

These are the preferred settings given to me.
Any way if kernel is updating it overwrites these settings, it shouldn't matter I guess..:)

It's better to clearly list down what configuration a particular entity in the system is
responsible for. Doing partial updates her just makes issues harder to debug.

Ok, Ill update..

Thanks and regards,
Lokesh

Quoted 4 lines

Regards,
Vaibhav

#29 lore raw

PATCH 10/14 ARM: AM43xx: clocks: Update DPLL details for EPOS EVM

In reply to Lokesh Vutla

Updating the Multiplier and Dividers values for all DPLLs for EPOS EVM. Following are the DPLL locking frequencies at OPP NOM:
MPU locks at 600MHz
Core locks at 1000MHz
Per locks at 960MHz
DDR locks at 266MHz

---
 arch/arm/cpu/armv7/am33xx/clock.c        |   12 +++++++---
 arch/arm/cpu/armv7/am33xx/clock_am33xx.c |   15 ++++++++++++
 arch/arm/cpu/armv7/am33xx/clock_am43xx.c |    8 +------
 arch/arm/include/asm/arch-am33xx/clock.h |    7 +++---
 board/ti/am43xx/board.c                  |   38 +++++++++++++++++++++++++++---
 board/ti/am43xx/board.h                  |    1 +
 board/ti/am43xx/mux.c                    |    5 ++++
 7 files changed, 69 insertions(+), 17 deletions(-)
arch/arm/cpu/armv7/am33xx/clock.c +9 -3
index 8e5f3c6..0672798 100644
@@ -101,9 +101,15 @@ void do_setup_dpll(const struct dpll_regs *dpll_regs,
 static void setup_dplls(void)
 {
 	const struct dpll_params *params;
-	do_setup_dpll(&dpll_core_regs, &dpll_core);
-	do_setup_dpll(&dpll_mpu_regs, &dpll_mpu);
-	do_setup_dpll(&dpll_per_regs, &dpll_per);
+
+	params = get_dpll_core_params();
+	do_setup_dpll(&dpll_core_regs, params);
+
+	params = get_dpll_mpu_params();
+	do_setup_dpll(&dpll_mpu_regs, params);
+
+	params = get_dpll_per_params();
+	do_setup_dpll(&dpll_per_regs, params);
 	writel(0x300, &cmwkup->clkdcoldodpllper);
 
 	params = get_dpll_ddr_params();
arch/arm/cpu/armv7/am33xx/clock_am33xx.c +15 -0
index fabe259..92142c8 100644
@@ -62,6 +62,21 @@ const struct dpll_params dpll_core = {
 const struct dpll_params dpll_per = {
 		960, OSC-1, 5, -1, -1, -1, -1};
 
+const struct dpll_params *get_dpll_mpu_params(void)
+{
+	return &dpll_mpu;
+}
+
+const struct dpll_params *get_dpll_core_params(void)
+{
+	return &dpll_core;
+}
+
+const struct dpll_params *get_dpll_per_params(void)
+{
+	return &dpll_per;
+}
+
 void setup_clocks_for_console(void)
 {
 	clrsetbits_le32(&cmwkup->wkclkstctrl, CD_CLKCTRL_CLKTRCTRL_MASK,
arch/arm/cpu/armv7/am33xx/clock_am43xx.c +1 -7
index 22963b7..97c00b4 100644
@@ -48,15 +48,9 @@ const struct dpll_regs dpll_ddr_regs = {
 	.cm_idlest_dpll		= CM_WKUP + 0x5A4,
 	.cm_clksel_dpll		= CM_WKUP + 0x5AC,
 	.cm_div_m2_dpll		= CM_WKUP + 0x5B0,
+	.cm_div_m4_dpll		= CM_WKUP + 0x5B8,
 };
 
-const struct dpll_params dpll_mpu = {
-		-1, -1, -1, -1, -1, -1, -1};
-const struct dpll_params dpll_core = {
-		-1, -1, -1, -1, -1, -1, -1};
-const struct dpll_params dpll_per = {
-		-1, -1, -1, -1, -1, -1, -1};
-
 void setup_clocks_for_console(void)
 {
 	/* Do not add any spl_debug prints in this function */
arch/arm/include/asm/arch-am33xx/clock.h +3 -4
index 519249e..7637457 100644
@@ -98,13 +98,12 @@ extern const struct dpll_regs dpll_mpu_regs;
 extern const struct dpll_regs dpll_core_regs;
 extern const struct dpll_regs dpll_per_regs;
 extern const struct dpll_regs dpll_ddr_regs;
-extern const struct dpll_params dpll_mpu;
-extern const struct dpll_params dpll_core;
-extern const struct dpll_params dpll_per;
-extern const struct dpll_params dpll_ddr;
 
 extern struct cm_wkuppll *const cmwkup;
 
+const struct dpll_params *get_dpll_mpu_params(void);
+const struct dpll_params *get_dpll_core_params(void);
+const struct dpll_params *get_dpll_per_params(void);
 const struct dpll_params *get_dpll_ddr_params(void);
 void do_setup_dpll(const struct dpll_regs *, const struct dpll_params *);
 void prcm_init(void);
board/ti/am43xx/board.c +35 -3
index 723d0ca..e28e844 100644
@@ -65,12 +65,44 @@ static int read_eeprom(struct am43xx_board_id *header)
 
 #ifdef CONFIG_SPL_BUILD
 
-const struct dpll_params dpll_ddr = {
-		-1, -1, -1, -1, -1, -1, -1};
+const struct dpll_params epos_evm_dpll_ddr = {
+		266, 24, 1, -1, 1, -1, -1};
+const struct dpll_params epos_evm_dpll_mpu = {
+		600, 24, 1, -1, -1, -1, -1};
+const struct dpll_params epos_evm_dpll_core = {
+		1000, 24, -1, -1, 10, 8, 4};
+const struct dpll_params epos_evm_dpll_per = {
+		960, 24, 5, -1, -1, -1, -1};
 
 const struct dpll_params *get_dpll_ddr_params(void)
 {
-	return &dpll_ddr;
+	if (board_is_eposevm())
+		return &epos_evm_dpll_ddr;
+}
+
+const struct dpll_params *get_dpll_mpu_params(void)
+{
+	if (board_is_eposevm())
+		return &epos_evm_dpll_mpu;
+}
+
+const struct dpll_params *get_dpll_core_params(void)
+{
+	struct am43xx_board_id header;
+
+	enable_i2c0_pin_mux();
+	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+	if (read_eeprom(&header) < 0)
+		puts("Could not get board ID.\n");
+
+	if (board_is_eposevm())
+		return &epos_evm_dpll_core;
+}
+
+const struct dpll_params *get_dpll_per_params(void)
+{
+	if (board_is_eposevm())
+		return &epos_evm_dpll_per;
 }
 
 void set_uart_mux_conf(void)
board/ti/am43xx/board.h +1 -0
index 9268895..beee770 100644
@@ -46,4 +46,5 @@ static inline int board_is_gpevm(void)
 
 void enable_uart0_pin_mux(void);
 void enable_board_pin_mux(void);
+void enable_i2c0_pin_mux(void);
 #endif
board/ti/am43xx/mux.c +5 -0
index 818a046..341214d 100644
@@ -45,3 +45,8 @@ void enable_board_pin_mux(void)
 	configure_module_pin_mux(mmc0_pin_mux);
 	configure_module_pin_mux(i2c0_pin_mux);
 }
+
+void enable_i2c0_pin_mux(void)
+{
+	configure_module_pin_mux(i2c0_pin_mux);
+}
Signature · 1 line
1.7.9.5
#30 lore raw

PATCH 10/14 ARM: AM43xx: clocks: Update DPLL details for EPOS EVM

Quoted 7 lines · Lokesh Vutla

Updating the Multiplier and Dividers values for all DPLLs for EPOS EVM. Following are the DPLL locking frequencies at OPP NOM:
MPU locks at 600MHz
Core locks at 1000MHz
Per locks at 960MHz
DDR locks at 266MHz

Why is this not reading the eFuses to detect what speeds are actually supported on a device? If the eFuses are not currently blown it's much much safer to start off from the slowest OPP. Things might be working fine now but dialing to a high frequency without detecting the supported rates is going to come back to haunt us later.

Quoted 169 lines
---
 arch/arm/cpu/armv7/am33xx/clock.c        |   12 +++++++---
 arch/arm/cpu/armv7/am33xx/clock_am33xx.c |   15 ++++++++++++
 arch/arm/cpu/armv7/am33xx/clock_am43xx.c |    8 +------
 arch/arm/include/asm/arch-am33xx/clock.h |    7 +++---
 board/ti/am43xx/board.c                  |   38 +++++++++++++++++++++++++++---
 board/ti/am43xx/board.h                  |    1 +
 board/ti/am43xx/mux.c                    |    5 ++++
 7 files changed, 69 insertions(+), 17 deletions(-)
arch/arm/cpu/armv7/am33xx/clock.c +9 -3
index 8e5f3c6..0672798 100644
@@ -101,9 +101,15 @@ void do_setup_dpll(const struct dpll_regs *dpll_regs,
 static void setup_dplls(void)
 {
        const struct dpll_params *params;
-       do_setup_dpll(&dpll_core_regs, &dpll_core);
-       do_setup_dpll(&dpll_mpu_regs, &dpll_mpu);
-       do_setup_dpll(&dpll_per_regs, &dpll_per);
+
+       params = get_dpll_core_params();
+       do_setup_dpll(&dpll_core_regs, params);
+
+       params = get_dpll_mpu_params();
+       do_setup_dpll(&dpll_mpu_regs, params);
+
+       params = get_dpll_per_params();
+       do_setup_dpll(&dpll_per_regs, params);
        writel(0x300, &cmwkup->clkdcoldodpllper);
 
        params = get_dpll_ddr_params();
arch/arm/cpu/armv7/am33xx/clock_am33xx.c +15 -0
index fabe259..92142c8 100644
@@ -62,6 +62,21 @@ const struct dpll_params dpll_core = {
 const struct dpll_params dpll_per = {
                960, OSC-1, 5, -1, -1, -1, -1};
 
+const struct dpll_params *get_dpll_mpu_params(void)
+{
+       return &dpll_mpu;
+}
+
+const struct dpll_params *get_dpll_core_params(void)
+{
+       return &dpll_core;
+}
+
+const struct dpll_params *get_dpll_per_params(void)
+{
+       return &dpll_per;
+}
+
 void setup_clocks_for_console(void)
 {
        clrsetbits_le32(&cmwkup->wkclkstctrl, CD_CLKCTRL_CLKTRCTRL_MASK,
arch/arm/cpu/armv7/am33xx/clock_am43xx.c +1 -7
index 22963b7..97c00b4 100644
@@ -48,15 +48,9 @@ const struct dpll_regs dpll_ddr_regs = {
        .cm_idlest_dpll         = CM_WKUP + 0x5A4,
        .cm_clksel_dpll         = CM_WKUP + 0x5AC,
        .cm_div_m2_dpll         = CM_WKUP + 0x5B0,
+       .cm_div_m4_dpll         = CM_WKUP + 0x5B8,
 };
 
-const struct dpll_params dpll_mpu = {
-               -1, -1, -1, -1, -1, -1, -1};
-const struct dpll_params dpll_core = {
-               -1, -1, -1, -1, -1, -1, -1};
-const struct dpll_params dpll_per = {
-               -1, -1, -1, -1, -1, -1, -1};
-
 void setup_clocks_for_console(void)
 {
        /* Do not add any spl_debug prints in this function */
arch/arm/include/asm/arch-am33xx/clock.h +3 -4
index 519249e..7637457 100644
@@ -98,13 +98,12 @@ extern const struct dpll_regs dpll_mpu_regs;
 extern const struct dpll_regs dpll_core_regs;
 extern const struct dpll_regs dpll_per_regs;
 extern const struct dpll_regs dpll_ddr_regs;
-extern const struct dpll_params dpll_mpu;
-extern const struct dpll_params dpll_core;
-extern const struct dpll_params dpll_per;
-extern const struct dpll_params dpll_ddr;
 
 extern struct cm_wkuppll *const cmwkup;
 
+const struct dpll_params *get_dpll_mpu_params(void);
+const struct dpll_params *get_dpll_core_params(void);
+const struct dpll_params *get_dpll_per_params(void);
 const struct dpll_params *get_dpll_ddr_params(void);
 void do_setup_dpll(const struct dpll_regs *, const struct dpll_params *);
 void prcm_init(void);
board/ti/am43xx/board.c +35 -3
index 723d0ca..e28e844 100644
@@ -65,12 +65,44 @@ static int read_eeprom(struct am43xx_board_id *header)
 
 #ifdef CONFIG_SPL_BUILD
 
-const struct dpll_params dpll_ddr = {
-               -1, -1, -1, -1, -1, -1, -1};
+const struct dpll_params epos_evm_dpll_ddr = {
+               266, 24, 1, -1, 1, -1, -1};
+const struct dpll_params epos_evm_dpll_mpu = {
+               600, 24, 1, -1, -1, -1, -1};
+const struct dpll_params epos_evm_dpll_core = {
+               1000, 24, -1, -1, 10, 8, 4};
+const struct dpll_params epos_evm_dpll_per = {
+               960, 24, 5, -1, -1, -1, -1};
 
 const struct dpll_params *get_dpll_ddr_params(void)
 {
-       return &dpll_ddr;
+       if (board_is_eposevm())
+               return &epos_evm_dpll_ddr;
+}
+
+const struct dpll_params *get_dpll_mpu_params(void)
+{
+       if (board_is_eposevm())
+               return &epos_evm_dpll_mpu;
+}
+
+const struct dpll_params *get_dpll_core_params(void)
+{
+       struct am43xx_board_id header;
+
+       enable_i2c0_pin_mux();
+       i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+       if (read_eeprom(&header) < 0)
+               puts("Could not get board ID.\n");
+
+       if (board_is_eposevm())
+               return &epos_evm_dpll_core;
+}
+
+const struct dpll_params *get_dpll_per_params(void)
+{
+       if (board_is_eposevm())
+               return &epos_evm_dpll_per;
 }
 
 void set_uart_mux_conf(void)
board/ti/am43xx/board.h +1 -0
index 9268895..beee770 100644
@@ -46,4 +46,5 @@ static inline int board_is_gpevm(void)
 
 void enable_uart0_pin_mux(void);
 void enable_board_pin_mux(void);
+void enable_i2c0_pin_mux(void);
 #endif
board/ti/am43xx/mux.c +0 -0
index 818a046..341214d 100644

board/ti/am43xx/mux.c void enable_board_pin_mux(void) · line 52

Quoted 8 lines
board/ti/am43xx/mux.c +5 -0
@@ -45,3 +45,8 @@ void enable_board_pin_mux(void)
        configure_module_pin_mux(mmc0_pin_mux);
        configure_module_pin_mux(i2c0_pin_mux);
 }
+
+void enable_i2c0_pin_mux(void)
+{
+       configure_module_pin_mux(i2c0_pin_mux);
+}

This change looks a bit out of place... can you add why this is needed in the commit message.

Regards,
Vaibhav

#31 lore raw

PATCH 10/14 ARM: AM43xx: clocks: Update DPLL details for EPOS EVM

Quoted 9 lines · Vaibhav Bedia
Quoted 7 lines · Lokesh Vutla

Updating the Multiplier and Dividers values for all DPLLs for EPOS EVM. Following are the DPLL locking frequencies at OPP NOM:
MPU locks at 600MHz
Core locks at 1000MHz
Per locks at 960MHz
DDR locks at 266MHz

Quoted 5 lines

Why is this not reading the eFuses to detect what speeds are actually supported on a device? If the eFuses are not currently blown it's much much safer to start off from the slowest OPP. Things might be working fine now but dialing to a high frequency without detecting the supported rates is going to come back to haunt us later.

Currently these values are not blown in eFuse. Both EPOS and GP evms support OPP NOM. So there is no harm in booting at OPP NOM here.
Shekar can comment more on this.

Thanks and regards,
Lokesh

Quoted 185 lines
Quoted 170 lines
---
 arch/arm/cpu/armv7/am33xx/clock.c        |   12 +++++++---
 arch/arm/cpu/armv7/am33xx/clock_am33xx.c |   15 ++++++++++++
 arch/arm/cpu/armv7/am33xx/clock_am43xx.c |    8 +------
 arch/arm/include/asm/arch-am33xx/clock.h |    7 +++---
 board/ti/am43xx/board.c                  |   38 +++++++++++++++++++++++++++---
 board/ti/am43xx/board.h                  |    1 +
 board/ti/am43xx/mux.c                    |    5 ++++
 7 files changed, 69 insertions(+), 17 deletions(-)
arch/arm/cpu/armv7/am33xx/clock.c +9 -3
index 8e5f3c6..0672798 100644
@@ -101,9 +101,15 @@ void do_setup_dpll(const struct dpll_regs *dpll_regs,
 static void setup_dplls(void)
 {
        const struct dpll_params *params;
-       do_setup_dpll(&dpll_core_regs, &dpll_core);
-       do_setup_dpll(&dpll_mpu_regs, &dpll_mpu);
-       do_setup_dpll(&dpll_per_regs, &dpll_per);
+
+       params = get_dpll_core_params();
+       do_setup_dpll(&dpll_core_regs, params);
+
+       params = get_dpll_mpu_params();
+       do_setup_dpll(&dpll_mpu_regs, params);
+
+       params = get_dpll_per_params();
+       do_setup_dpll(&dpll_per_regs, params);
        writel(0x300, &cmwkup->clkdcoldodpllper);
 
        params = get_dpll_ddr_params();
arch/arm/cpu/armv7/am33xx/clock_am33xx.c +15 -0
index fabe259..92142c8 100644
@@ -62,6 +62,21 @@ const struct dpll_params dpll_core = {
 const struct dpll_params dpll_per = {
                960, OSC-1, 5, -1, -1, -1, -1};
 
+const struct dpll_params *get_dpll_mpu_params(void)
+{
+       return &dpll_mpu;
+}
+
+const struct dpll_params *get_dpll_core_params(void)
+{
+       return &dpll_core;
+}
+
+const struct dpll_params *get_dpll_per_params(void)
+{
+       return &dpll_per;
+}
+
 void setup_clocks_for_console(void)
 {
        clrsetbits_le32(&cmwkup->wkclkstctrl, CD_CLKCTRL_CLKTRCTRL_MASK,
arch/arm/cpu/armv7/am33xx/clock_am43xx.c +1 -7
index 22963b7..97c00b4 100644
@@ -48,15 +48,9 @@ const struct dpll_regs dpll_ddr_regs = {
        .cm_idlest_dpll         = CM_WKUP + 0x5A4,
        .cm_clksel_dpll         = CM_WKUP + 0x5AC,
        .cm_div_m2_dpll         = CM_WKUP + 0x5B0,
+       .cm_div_m4_dpll         = CM_WKUP + 0x5B8,
 };
 
-const struct dpll_params dpll_mpu = {
-               -1, -1, -1, -1, -1, -1, -1};
-const struct dpll_params dpll_core = {
-               -1, -1, -1, -1, -1, -1, -1};
-const struct dpll_params dpll_per = {
-               -1, -1, -1, -1, -1, -1, -1};
-
 void setup_clocks_for_console(void)
 {
        /* Do not add any spl_debug prints in this function */
arch/arm/include/asm/arch-am33xx/clock.h +3 -4
index 519249e..7637457 100644
@@ -98,13 +98,12 @@ extern const struct dpll_regs dpll_mpu_regs;
 extern const struct dpll_regs dpll_core_regs;
 extern const struct dpll_regs dpll_per_regs;
 extern const struct dpll_regs dpll_ddr_regs;
-extern const struct dpll_params dpll_mpu;
-extern const struct dpll_params dpll_core;
-extern const struct dpll_params dpll_per;
-extern const struct dpll_params dpll_ddr;
 
 extern struct cm_wkuppll *const cmwkup;
 
+const struct dpll_params *get_dpll_mpu_params(void);
+const struct dpll_params *get_dpll_core_params(void);
+const struct dpll_params *get_dpll_per_params(void);
 const struct dpll_params *get_dpll_ddr_params(void);
 void do_setup_dpll(const struct dpll_regs *, const struct dpll_params *);
 void prcm_init(void);
board/ti/am43xx/board.c +35 -3
index 723d0ca..e28e844 100644
@@ -65,12 +65,44 @@ static int read_eeprom(struct am43xx_board_id *header)
 
 #ifdef CONFIG_SPL_BUILD
 
-const struct dpll_params dpll_ddr = {
-               -1, -1, -1, -1, -1, -1, -1};
+const struct dpll_params epos_evm_dpll_ddr = {
+               266, 24, 1, -1, 1, -1, -1};
+const struct dpll_params epos_evm_dpll_mpu = {
+               600, 24, 1, -1, -1, -1, -1};
+const struct dpll_params epos_evm_dpll_core = {
+               1000, 24, -1, -1, 10, 8, 4};
+const struct dpll_params epos_evm_dpll_per = {
+               960, 24, 5, -1, -1, -1, -1};
 
 const struct dpll_params *get_dpll_ddr_params(void)
 {
-       return &dpll_ddr;
+       if (board_is_eposevm())
+               return &epos_evm_dpll_ddr;
+}
+
+const struct dpll_params *get_dpll_mpu_params(void)
+{
+       if (board_is_eposevm())
+               return &epos_evm_dpll_mpu;
+}
+
+const struct dpll_params *get_dpll_core_params(void)
+{
+       struct am43xx_board_id header;
+
+       enable_i2c0_pin_mux();
+       i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+       if (read_eeprom(&header) < 0)
+               puts("Could not get board ID.\n");
+
+       if (board_is_eposevm())
+               return &epos_evm_dpll_core;
+}
+
+const struct dpll_params *get_dpll_per_params(void)
+{
+       if (board_is_eposevm())
+               return &epos_evm_dpll_per;
 }
 
 void set_uart_mux_conf(void)
board/ti/am43xx/board.h +1 -0
index 9268895..beee770 100644
@@ -46,4 +46,5 @@ static inline int board_is_gpevm(void)
 
 void enable_uart0_pin_mux(void);
 void enable_board_pin_mux(void);
+void enable_i2c0_pin_mux(void);
 #endif
board/ti/am43xx/mux.c +0 -0
index 818a046..341214d 100644

board/ti/am43xx/mux.c void enable_board_pin_mux(void) · line 52

Quoted 8 lines
board/ti/am43xx/mux.c +5 -0
@@ -45,3 +45,8 @@ void enable_board_pin_mux(void)
        configure_module_pin_mux(mmc0_pin_mux);
        configure_module_pin_mux(i2c0_pin_mux);
 }
+
+void enable_i2c0_pin_mux(void)
+{
+       configure_module_pin_mux(i2c0_pin_mux);
+}

This change looks a bit out of place... can you add why this is needed in the commit message.

Regards,
Vaibhav

#32 lore raw

PATCH 11/14 ARM: AM43xx: clocks: Add DPLL data for GP EVM

In reply to Lokesh Vutla

Adding DPLLs Multiplier and DIvider values for GP EVM Following are the DPLL locking frequencies at OPP NOM MPU locks at 600MHz
Core locks at 1000MHz
Per locks at 960MHz
DDR locks at 400MHz

---
 board/ti/am43xx/board.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)
board/ti/am43xx/board.c +17 -0
index e28e844..a700d1f 100644
@@ -74,16 +74,29 @@ const struct dpll_params epos_evm_dpll_core = {
 const struct dpll_params epos_evm_dpll_per = {
 		960, 24, 5, -1, -1, -1, -1};
 
+const struct dpll_params gp_evm_dpll_ddr = {
+		400, 23, 1, -1, 1, -1, -1};
+const struct dpll_params gp_evm_dpll_mpu = {
+		600, 23, 1, -1, -1, -1, -1};
+const struct dpll_params gp_evm_dpll_core = {
+		1000, 23, -1, -1, 10, 8, 4};
+const struct dpll_params gp_evm_dpll_per = {
+		960, 23, 5, -1, -1, -1, -1};
+
 const struct dpll_params *get_dpll_ddr_params(void)
 {
 	if (board_is_eposevm())
 		return &epos_evm_dpll_ddr;
+	else
+		return &gp_evm_dpll_ddr;
 }
 
 const struct dpll_params *get_dpll_mpu_params(void)
 {
 	if (board_is_eposevm())
 		return &epos_evm_dpll_mpu;
+	else
+		return &gp_evm_dpll_mpu;
 }
 
 const struct dpll_params *get_dpll_core_params(void)
@@ -97,12 +110,16 @@ const struct dpll_params *get_dpll_core_params(void)
 
 	if (board_is_eposevm())
 		return &epos_evm_dpll_core;
+	else
+		return &gp_evm_dpll_core;
 }
 
 const struct dpll_params *get_dpll_per_params(void)
 {
 	if (board_is_eposevm())
 		return &epos_evm_dpll_per;
+	else
+		return &gp_evm_dpll_per;
 }
 
 void set_uart_mux_conf(void)
Signature · 1 line
1.7.9.5
#33 lore raw

PATCH 11/14 ARM: AM43xx: clocks: Add DPLL data for GP EVM

Quoted 7 lines · Lokesh Vutla

Adding DPLLs Multiplier and DIvider values for GP EVM Following are the DPLL locking frequencies at OPP NOM MPU locks at 600MHz
Core locks at 1000MHz
Per locks at 960MHz
DDR locks at 400MHz

Comment on getting the data from eFuse or falling back to lower freq applies here too.

Regards,
Vaibhav

#34 lore raw

PATCH 12/14 ARM: AM43xx: EPOS_EVM: Add support for LPDDR2

In reply to Lokesh Vutla

AM4372 EPOS EVM has 1GB LPDDR2(Part no: MT42L256M32D2LG-25 WT:A) Adding LPDDR2 init sequence and register details for the same. Below is the brief description of LPDDR2 init sequence:
-> Configure VTP
-> Configure DDR IO settings
-> Disable initialization and refreshes until EMIF registers are programmed. -> Program Timing registers
-> Program PHY control and Temp alert and ZQ config registers. -> Enable initialization and refreshes and configure SDRAM CONFIG register -> Wait till initialization is complete and the configure MR registers.

---
 arch/arm/cpu/armv7/am33xx/Makefile                 |    8 +-
 arch/arm/cpu/armv7/am33xx/emif4d5.c                |  183 ++++++++++++++++++++
 arch/arm/include/asm/arch-am33xx/clocks_am33xx.h   |    3 +
 arch/arm/include/asm/arch-am33xx/cpu.h             |    5 +
 arch/arm/include/asm/arch-am33xx/ddr_defs.h        |   26 +++
 arch/arm/include/asm/arch-am33xx/hardware_am43xx.h |    1 +
 arch/arm/include/asm/emif.h                        |   12 ++
 board/ti/am43xx/board.c                            |   59 +++++++
 8 files changed, 295 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/am33xx/emif4d5.c
arch/arm/cpu/armv7/am33xx/Makefile +6 -2
index f6a297c..8414430 100644
@@ -19,12 +19,16 @@ endif
 COBJS-$(CONFIG_TI816X)	+= clock_ti816x.o
 COBJS	+= sys_info.o
 COBJS	+= mem.o
-COBJS	+= ddr.o
-COBJS	+= emif4.o
 COBJS	+= board.o
 COBJS	+= mux.o
 COBJS-$(CONFIG_NAND_OMAP_GPMC)	+= elm.o
 
+ifeq ($(CONFIG_AM43XX),)
+COBJS	+= ddr.o
+COBJS	+= emif4.o
+endif
+COBJS-$(CONFIG_AM43XX)	+= emif4d5.o
+
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS) $(COBJS-y) $(SOBJS))
 
arch/arm/cpu/armv7/am33xx/emif4d5.c new file +183 -0

183 lines not on this page · raw message

arch/arm/include/asm/arch-am33xx/clocks_am33xx.h +3 -0
index 02ed595..4c9352a 100644
@@ -28,6 +28,9 @@
 #define UART_CLK_RUNNING_MASK	0x1
 #define UART_SMART_IDLE_EN	(0x1 << 0x3)
 
+#define CM_DLL_CTRL_NO_OVERRIDE	0x0
+#define CM_DLL_READYST		0x4
+
 extern void enable_dmm_clocks(void);
 extern const struct dpll_params dpll_core_opp100;
 extern struct dpll_params dpll_mpu_opp100;
arch/arm/include/asm/arch-am33xx/cpu.h +5 -0
index f463b27..23af125 100644
@@ -401,6 +401,11 @@ struct cm_perpll {
 	unsigned int cpgmac0clkctrl;	/* offset 0xB20 */
 };
 
+struct cm_device_inst {
+	unsigned int cm_clkout1_ctrl;
+	unsigned int cm_dll_ctrl;
+};
+
 struct cm_dpll {
 	unsigned int resv1;
 	unsigned int clktimer2clk;	/* offset 0x04 */
arch/arm/include/asm/arch-am33xx/ddr_defs.h +26 -0
index fe48b5f..1880415 100644
@@ -126,6 +126,14 @@
 #define K4B2G1646EBIH9_PHY_WR_DATA		0x76
 #define K4B2G1646EBIH9_IOCTRL_VALUE		0x18B
 
+#define  LPDDR2_ADDRCTRL_IOCTRL_VALUE   0x294
+#define  LPDDR2_ADDRCTRL_WD0_IOCTRL_VALUE 0x00000000
+#define  LPDDR2_ADDRCTRL_WD1_IOCTRL_VALUE 0x00000000
+#define  LPDDR2_DATA0_IOCTRL_VALUE   0x20000294
+#define  LPDDR2_DATA1_IOCTRL_VALUE   0x20000294
+#define  LPDDR2_DATA2_IOCTRL_VALUE   0x20000294
+#define  LPDDR2_DATA3_IOCTRL_VALUE   0x20000294
+
 /**
  * Configure DMM
  */
@@ -291,6 +299,21 @@ struct ddr_cmdtctrl {
 	unsigned int resv2[12];
 	unsigned int dt0ioctl;
 	unsigned int dt1ioctl;
+	unsigned int dt2ioctrl;
+	unsigned int dt3ioctrl;
+	unsigned int resv3[4];
+	unsigned int emif_sdram_config_ext;
+};
+
+struct ctrl_ioregs {
+	unsigned int cm0ioctl;
+	unsigned int cm1ioctl;
+	unsigned int cm2ioctl;
+	unsigned int dt0ioctl;
+	unsigned int dt1ioctl;
+	unsigned int dt2ioctrl;
+	unsigned int dt3ioctrl;
+	unsigned int emif_sdram_config_ext;
 };
 
 /**
@@ -308,4 +331,7 @@ void config_ddr(unsigned int pll, unsigned int ioctrl,
 		const struct ddr_data *data, const struct cmd_control *ctrl,
 		const struct emif_regs *regs, int nr);
 
+void do_sdram_init(const struct ctrl_ioregs *ioregs,
+		   const struct emif_regs *emif_regs,
+		   const u32 *ext_phy_ctrl_const_regs);
 #endif  /* _DDR_DEFS_H */
arch/arm/include/asm/arch-am33xx/hardware_am43xx.h +1 -0
index 4dbc789..d82f050 100644
@@ -63,5 +63,6 @@
 #define PRM_PER_USBPHYOCP2SCP0_CLKCTRL (CM_PER + 0x5b8)
 #define PRM_PER_USBPHYOCP2SCP1_CLKCTRL (CM_PER + 0x5c0)
 #define USBPHYOCPSCP_MODULE_EN	(1 << 2)
+#define CM_DEVICE_INST			0x44df4100
 
 #endif /* __AM43XX_HARDWARE_AM43XX_H */
arch/arm/include/asm/emif.h +12 -0
index 1b94a99..5edc3a4 100644
@@ -690,6 +690,18 @@ struct emif_reg_struct {
 	u32 emif_ddr_ext_phy_ctrl_23_shdw;
 	u32 emif_ddr_ext_phy_ctrl_24;
 	u32 emif_ddr_ext_phy_ctrl_24_shdw;
+	u32 emif_ddr_ext_phy_ctrl_25;
+	u32 emif_ddr_ext_phy_ctrl_25_shdw;
+	u32 emif_ddr_ext_phy_ctrl_26;
+	u32 emif_ddr_ext_phy_ctrl_26_shdw;
+	u32 emif_ddr_ext_phy_ctrl_27;
+	u32 emif_ddr_ext_phy_ctrl_27_shdw;
+	u32 emif_ddr_ext_phy_ctrl_28;
+	u32 emif_ddr_ext_phy_ctrl_28_shdw;
+	u32 emif_ddr_ext_phy_ctrl_29;
+	u32 emif_ddr_ext_phy_ctrl_29_shdw;
+	u32 emif_ddr_ext_phy_ctrl_30;
+	u32 emif_ddr_ext_phy_ctrl_30_shdw;
 };
 
 struct dmm_lisa_map_regs {
board/ti/am43xx/board.c +59 -0

77 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#35 lore raw

PATCH 12/14 ARM: AM43xx: EPOS_EVM: Add support for LPDDR2

Quoted 11 lines · Lokesh Vutla

AM4372 EPOS EVM has 1GB LPDDR2(Part no: MT42L256M32D2LG-25 WT:A) Adding LPDDR2 init sequence and register details for the same. Below is the brief description of LPDDR2 init sequence:
-> Configure VTP
-> Configure DDR IO settings
-> Disable initialization and refreshes until EMIF registers are programmed. -> Program Timing registers
-> Program PHY control and Temp alert and ZQ config registers. -> Enable initialization and refreshes and configure SDRAM CONFIG register -> Wait till initialization is complete and the configure MR registers.

Is there any public documentation to go with this? I would suggest sprinkling the code with comments to mention the different stages.

BTW, no IO powerdown setting for now?

[...]

arch/arm/cpu/armv7/am33xx/Makefile endif · line 31

Quoted 7 lines
arch/arm/cpu/armv7/am33xx/Makefile +6 -0
+ifeq ($(CONFIG_AM43XX),)
+COBJS  += ddr.o
+COBJS  += emif4.o
+endif
+COBJS-$(CONFIG_AM43XX) += emif4d5.o
+

Are the steps really different enough to warrant a new file? Can't the changes be handled properly in the code? How has this been handled in OMAPx where DDR3 and LPDDR both are supported?

Regards,
Vaibhav

#36 lore raw

PATCH 12/14 ARM: AM43xx: EPOS_EVM: Add support for LPDDR2

Quoted 13 lines · Vaibhav Bedia
Quoted 11 lines · Lokesh Vutla

AM4372 EPOS EVM has 1GB LPDDR2(Part no: MT42L256M32D2LG-25 WT:A) Adding LPDDR2 init sequence and register details for the same. Below is the brief description of LPDDR2 init sequence:
-> Configure VTP
-> Configure DDR IO settings
-> Disable initialization and refreshes until EMIF registers are programmed. -> Program Timing registers
-> Program PHY control and Temp alert and ZQ config registers. -> Enable initialization and refreshes and configure SDRAM CONFIG register -> Wait till initialization is complete and the configure MR registers.

Quoted 3 lines

Is there any public documentation to go with this? I would suggest sprinkling the code with comments to mention the different stages.

Yep ll add the comments in the code..

Quoted 2 lines

BTW, no IO powerdown setting for now?

You mean DDR IO settings?

Quoted 13 lines

[...]

arch/arm/cpu/armv7/am33xx/Makefile endif · line 31

Quoted 7 lines
arch/arm/cpu/armv7/am33xx/Makefile +6 -0
+ifeq ($(CONFIG_AM43XX),)
+COBJS  += ddr.o
+COBJS  += emif4.o
+endif
+COBJS-$(CONFIG_AM43XX) += emif4d5.o
+

Are the steps really different enough to warrant a new file? Can't the changes be handled properly in the code? How has this been handled in OMAPx where DDR3 and LPDDR both are supported?

Initially Tom also suggested not to use a new file. I tried with not to add a new file, but I ended up with many #ifdefs. EMIF is new IP(reused from OMAP5) very different from AM33xx EMIF IP. So to make things more cleaner I had to use a new file..

Thanks and regards,
Lokesh

Quoted 4 lines

Regards,
Vaibhav

#37 lore raw

PATCH 12/14 ARM: AM43xx: EPOS_EVM: Add support for LPDDR2

Quoted 14 lines · Lokesh Vutla
Quoted 13 lines · Vaibhav Bedia
Quoted 11 lines · Lokesh Vutla

AM4372 EPOS EVM has 1GB LPDDR2(Part no: MT42L256M32D2LG-25 WT:A) Adding LPDDR2 init sequence and register details for the same. Below is the brief description of LPDDR2 init sequence:
-> Configure VTP
-> Configure DDR IO settings
-> Disable initialization and refreshes until EMIF registers are programmed. -> Program Timing registers
-> Program PHY control and Temp alert and ZQ config registers. -> Enable initialization and refreshes and configure SDRAM CONFIG register -> Wait till initialization is complete and the configure MR registers.

Quoted 7 lines
Quoted 3 lines

Is there any public documentation to go with this? I would suggest sprinkling the code with comments to mention the different stages.

Yep ll add the comments in the code..

Quoted 2 lines

BTW, no IO powerdown setting for now?

You mean DDR IO settings?

Yeah. I assume you have configured the dynamic power down bit properly. Can't tell without looking at the TRM.

Quoted 13 lines
Quoted 13 lines

[...]

arch/arm/cpu/armv7/am33xx/Makefile endif · line 31

Quoted 7 lines
arch/arm/cpu/armv7/am33xx/Makefile +6 -0
+ifeq ($(CONFIG_AM43XX),)
+COBJS  += ddr.o
+COBJS  += emif4.o
+endif
+COBJS-$(CONFIG_AM43XX) += emif4d5.o
+

Are the steps really different enough to warrant a new file? Can't the changes be handled properly in the code? How has this been handled in OMAPx where DDR3 and LPDDR both are supported?

Quoted 4 lines

Initially Tom also suggested not to use a new file. I tried with not to add a new file, but I ended up with many #ifdefs. EMIF is new IP(reused from OMAP5) very different from AM33xx EMIF IP. So to make things more cleaner I had to use a new file..

It really looks a step backward. The new IP should be an update to the old version and not just a complete overhaul of the programming model that folks are familiar with.

Regards,
Vaibhav

#38 lore raw

PATCH 12/14 ARM: AM43xx: EPOS_EVM: Add support for LPDDR2

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 3 lines · Vaibhav Bedia
Quoted 1 line · Lokesh Vutla

On Wednesday 06 November 2013 06:27 PM, Vaibhav Bedia wrote:

[snip]

Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

Are the steps really different enough to warrant a new file? Can't the changes be handled properly in the code? How has this been handled in OMAPx where DDR3 and LPDDR both are supported?

Initially Tom also suggested not to use a new file. I tried with not to add a new file, but I ended up with many #ifdefs. EMIF is new IP(reused from OMAP5) very different from AM33xx EMIF IP. So to make things more cleaner I had to use a new file..

Quoted 3 lines

It really looks a step backward. The new IP should be an update to the old version and not just a complete overhaul of the programming model that folks are familiar with.

It sounds like we need to re-think the EMIF code here since it's not all THAT different between the OMAP parts, the am33xx parts, the am43xx parts and the ti81xx parts (and even the am35xx parts, but I'm OK setting that aside).

And no, I'm not 100% happy with the OMAP code either, but that's mainly the bits where we say OMAP rev FOO means memory chip BAR.

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJSerQdAAoJENk4IS6UOR1WD9QP/jhANTw5BKPyxtHFjGHymSUL +d4jJ5VwvCsWYLOv/zQ961EtWn3FGedNxiqFjTI2ZUQk9Xge9zycp0ZaHscBybJF 65A+RqUBEJ+jBVdtV7oT/zHq8KLsE4m9yYV9qU8L5bHLbzATulX7mG2waRB+lZcZ Qz/nFKYQ0cyvW92JAUbf2/Iza4GxIAQ0ZIjJdcEE86VBVJD0E+udVJZtP7RdryMg usyuxaQOBxM5I9XTCuuV6K1ZFGGOWEOebhfKEegH5MTjn7/apQXY0ufP4u7+IJGl Ss1vDwTEUQ8qNIZwbGoiiA24wE0E8Ou8Vtn29KNpiWWt0pTYR/VUaGJHK0CdhHEd MlKlIsmjbpXfLAhm3oCeoPSRJLUcb7QXHyJvhjMmMOxVs7FCvy3H2LRogcXk+I/c SO5wn7JvlSj12VhGgmc4IYw9I8wqLHxUP9tMVNC5V3D5yVZTOl3YjJGql35hkZmR mWGIUEqGs4uwD1P4hEonUPFFpn9bNGZLBdFpk9ytuS58ZHGD09WEFqWy8aqKHNC0 2TlPUl3T/YK6jk8PZyz962jwX8ropKKWsOZ2mGBB9ix5OHCeMzF22QYmd7d9dD3B tt9blk1w817QeWiglMc2ErT2tWIMhlAR+0+3RkVKrBOda8pkBEyRp32uV6Pb7lks gcky1J0tdq6ViMYX3Pt/
=KnCE
-----END PGP SIGNATURE-----

#39 lore raw

PATCH 13/14 ARM: AM43xx: GP_EVM: Add support for DDR3

In reply to Lokesh Vutla

GP EVM has 1GB DDR3 attached(Part no: MT47H128M16RT-187E:C). Adding details for the same.
Below is the brief description of DDR3 init sequence(SW leveling):
-> Enable VTT regulator
-> Configure VTP
-> Configure DDR IO settings
-> Disable initialization and refreshes until EMIF registers are programmed. -> Program Timing registers
-> Program leveling registers
-> Program PHY control and Temp alert and ZQ config registers. -> Enable initialization and refreshes and configure SDRAM CONFIG register

---
 arch/arm/cpu/armv7/am33xx/emif4d5.c         |    8 ++-
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   10 ++-
 board/ti/am43xx/board.c                     |   89 ++++++++++++++++++++++++++-
 3 files changed, 101 insertions(+), 6 deletions(-)
arch/arm/cpu/armv7/am33xx/emif4d5.c +5 -3
index eea1fa3..8bac0f2 100644
@@ -120,7 +120,7 @@ static void configure_mr(u32 base, u32 cs)
 
 void do_sdram_init(const struct ctrl_ioregs *ioregs,
 		   const struct emif_regs *regs,
-		   const u32 *ext_phy_ctrl_const_regs)
+		   const u32 *ext_phy_ctrl_const_regs, u32 sdram_type)
 {
 	struct emif_reg_struct *emif = (struct emif_reg_struct *)EMIF1_BASE;
 
@@ -178,6 +178,8 @@ void do_sdram_init(const struct ctrl_ioregs *ioregs,
 	writel(regs->sdram_config, &emif->emif_sdram_config);
 	writel(regs->ref_ctrl, &emif->emif_sdram_ref_ctrl);
 
-	configure_mr(EMIF1_BASE, 0);
-	configure_mr(EMIF1_BASE, 1);
+	if (sdram_type == EMIF_SDRAM_TYPE_LPDDR2) {
+		configure_mr(EMIF1_BASE, 0);
+		configure_mr(EMIF1_BASE, 1);
+	}
 }
arch/arm/include/asm/arch-am33xx/ddr_defs.h +9 -1
index 1880415..796e9df 100644
@@ -134,6 +134,14 @@
 #define  LPDDR2_DATA2_IOCTRL_VALUE   0x20000294
 #define  LPDDR2_DATA3_IOCTRL_VALUE   0x20000294
 
+#define  DDR3_ADDRCTRL_WD0_IOCTRL_VALUE 0x00000000
+#define  DDR3_ADDRCTRL_WD1_IOCTRL_VALUE 0x00000000
+#define  DDR3_ADDRCTRL_IOCTRL_VALUE   0x84
+#define  DDR3_DATA0_IOCTRL_VALUE   0x84
+#define  DDR3_DATA1_IOCTRL_VALUE   0x84
+#define  DDR3_DATA2_IOCTRL_VALUE   0x84
+#define  DDR3_DATA3_IOCTRL_VALUE   0x84
+
 /**
  * Configure DMM
  */
@@ -333,5 +341,5 @@ void config_ddr(unsigned int pll, unsigned int ioctrl,
 
 void do_sdram_init(const struct ctrl_ioregs *ioregs,
 		   const struct emif_regs *emif_regs,
-		   const u32 *ext_phy_ctrl_const_regs);
+		   const u32 *ext_phy_ctrl_const_regs, u32 ddr_type);
 #endif  /* _DDR_DEFS_H */
board/ti/am43xx/board.c +87 -2

103 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#40 lore raw

PATCH 13/14 ARM: AM43xx: GP_EVM: Add support for DDR3

Quoted 10 lines · Lokesh Vutla

GP EVM has 1GB DDR3 attached(Part no: MT47H128M16RT-187E:C). Adding details for the same.
Below is the brief description of DDR3 init sequence(SW leveling):
-> Enable VTT regulator
-> Configure VTP
-> Configure DDR IO settings
-> Disable initialization and refreshes until EMIF registers are programmed. -> Program Timing registers
-> Program leveling registers
-> Program PHY control and Temp alert and ZQ config registers.

Temp alert? Is that really relevant here?

Quoted 139 lines

-> Enable initialization and refreshes and configure SDRAM CONFIG register

---
 arch/arm/cpu/armv7/am33xx/emif4d5.c         |    8 ++-
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   10 ++-
 board/ti/am43xx/board.c                     |   89 ++++++++++++++++++++++++++-
 3 files changed, 101 insertions(+), 6 deletions(-)
arch/arm/cpu/armv7/am33xx/emif4d5.c +5 -3
index eea1fa3..8bac0f2 100644
@@ -120,7 +120,7 @@ static void configure_mr(u32 base, u32 cs)
 
 void do_sdram_init(const struct ctrl_ioregs *ioregs,
                   const struct emif_regs *regs,
-                  const u32 *ext_phy_ctrl_const_regs)
+                  const u32 *ext_phy_ctrl_const_regs, u32 sdram_type)
 {
        struct emif_reg_struct *emif = (struct emif_reg_struct *)EMIF1_BASE;
 
@@ -178,6 +178,8 @@ void do_sdram_init(const struct ctrl_ioregs *ioregs,
        writel(regs->sdram_config, &emif->emif_sdram_config);
        writel(regs->ref_ctrl, &emif->emif_sdram_ref_ctrl);
 
-       configure_mr(EMIF1_BASE, 0);
-       configure_mr(EMIF1_BASE, 1);
+       if (sdram_type == EMIF_SDRAM_TYPE_LPDDR2) {
+               configure_mr(EMIF1_BASE, 0);
+               configure_mr(EMIF1_BASE, 1);
+       }
 }
arch/arm/include/asm/arch-am33xx/ddr_defs.h +9 -1
index 1880415..796e9df 100644
@@ -134,6 +134,14 @@
 #define  LPDDR2_DATA2_IOCTRL_VALUE   0x20000294
 #define  LPDDR2_DATA3_IOCTRL_VALUE   0x20000294
 
+#define  DDR3_ADDRCTRL_WD0_IOCTRL_VALUE 0x00000000
+#define  DDR3_ADDRCTRL_WD1_IOCTRL_VALUE 0x00000000
+#define  DDR3_ADDRCTRL_IOCTRL_VALUE   0x84
+#define  DDR3_DATA0_IOCTRL_VALUE   0x84
+#define  DDR3_DATA1_IOCTRL_VALUE   0x84
+#define  DDR3_DATA2_IOCTRL_VALUE   0x84
+#define  DDR3_DATA3_IOCTRL_VALUE   0x84
+
 /**
  * Configure DMM
  */
@@ -333,5 +341,5 @@ void config_ddr(unsigned int pll, unsigned int ioctrl,
 
 void do_sdram_init(const struct ctrl_ioregs *ioregs,
                   const struct emif_regs *emif_regs,
-                  const u32 *ext_phy_ctrl_const_regs);
+                  const u32 *ext_phy_ctrl_const_regs, u32 ddr_type);
 #endif  /* _DDR_DEFS_H */
board/ti/am43xx/board.c +65 -0
index 83d184d..a943b45 100644
@@ -140,6 +140,57 @@ const u32 ext_phy_ctrl_const_base_lpddr2[EMIF_EXT_PHY_CTRL_CONST_REG] = {
        0x08102040
 };
 
+const struct ctrl_ioregs ioregs_ddr3 = {
+       .cm0ioctl               = DDR3_ADDRCTRL_IOCTRL_VALUE,
+       .cm1ioctl               = DDR3_ADDRCTRL_WD0_IOCTRL_VALUE,
+       .cm2ioctl               = DDR3_ADDRCTRL_WD1_IOCTRL_VALUE,
+       .dt0ioctl               = DDR3_DATA0_IOCTRL_VALUE,
+       .dt1ioctl               = DDR3_DATA0_IOCTRL_VALUE,
+       .dt2ioctrl              = DDR3_DATA0_IOCTRL_VALUE,
+       .dt3ioctrl              = DDR3_DATA0_IOCTRL_VALUE,
+       .emif_sdram_config_ext  = 0x0043,
+};
+
+const struct emif_regs ddr3_emif_regs_400Mhz = {
+       .sdram_config                   = 0x638413B2,
+       .ref_ctrl                       = 0x00000C30,
+       .sdram_tim1                     = 0xEAAAD4DB,
+       .sdram_tim2                     = 0x266B7FDA,
+       .sdram_tim3                     = 0x107F8678,
+       .read_idle_ctrl                 = 0x00050000,
+       .zq_config                      = 0x50074BE4,
+       .temp_alert_config              = 0x0,
+       .emif_ddr_phy_ctlr_1            = 0x0E084007,
+       .emif_ddr_ext_phy_ctrl_1        = 0x08020080,
+       .emif_ddr_ext_phy_ctrl_2        = 0x00400040,
+       .emif_ddr_ext_phy_ctrl_3        = 0x00400040,
+       .emif_ddr_ext_phy_ctrl_4        = 0x00400040,
+       .emif_ddr_ext_phy_ctrl_5        = 0x00400040
+};
+
+const u32 ext_phy_ctrl_const_base_ddr3[EMIF_EXT_PHY_CTRL_CONST_REG] = {
+       0x00400040,
+       0x00350035,
+       0x00350035,
+       0x00350035,
+       0x00350035,
+       0x00350035,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00340034,
+       0x00340034,
+       0x00340034,
+       0x00340034,
+       0x00340034,
+       0x0,
+       0x0,
+       0x40000000,
+       0x08102040
+};
+
 const struct dpll_params *get_dpll_ddr_params(void)
 {
        if (board_is_eposevm())
@@ -189,10 +240,44 @@ void set_mux_conf_regs(void)
        enable_board_pin_mux();
 }
 
+static void enable_vtt_regulator(void)
+{
+       u32 temp;
+
+       /*GPIO_VTTEN - GPIO0_21 PINMUX Setup*/
+       writel(0x20009, CTRL_BASE + 0x0A60);
+
+       writel(0x40002, PRCM_BASE + 0x2B68);
+
+       /* Poll if module is functional */
+       while ((readl(PRCM_BASE + 0x2B68) & 0x30000) != 0x0)
+               ;
+
+       while ((readl(PRCM_BASE + 0x2B00) & 0x100) != 0x100)

board/ti/am43xx/board.c void set_mux_conf_regs(void) · line 266

Quoted 10 lines
board/ti/am43xx/board.c +10 -0
+               ;
+
+       /* enable module */
+       writel(0x0, GPIO0_BASE + 0x0130);
+
+       /*enable output for GPIO0_21*/
+       writel((1 << 22), GPIO0_BASE + 0x0194);
+       temp = readl(GPIO0_BASE + 0x0134);
+       temp = temp & ~(1 << 22);
+       writel(temp, GPIO0_BASE + 0x0134);

That's a lot of direct register writes :P

Can't you use some proper APIs for doing the pinmux, enabling the modules and controlling the GPIO?

board/ti/am43xx/board.c void set_mux_conf_regs(void) · line 276

Quoted 12 lines
board/ti/am43xx/board.c +8 -2
+}
+
 void sdram_init(void)
 {
-       do_sdram_init(&ioregs_lpddr2, &emif_regs_lpddr2,
-                     ext_phy_ctrl_const_base_lpddr2);
+       if (board_is_eposevm()) {
+               do_sdram_init(&ioregs_lpddr2, &emif_regs_lpddr2,
+                             ext_phy_ctrl_const_base_lpddr2,
+                             EMIF_SDRAM_TYPE_LPDDR2);
+       } else {
+               enable_vtt_regulator();

Hmm there must a smarter way of finding out whether the VTT regulator is present or not? You can always have DDR3 setups which don't use the regulator. Why not get this added to the EEPROM?

Regards,
Vaibhav

#41 lore raw

PATCH 13/14 ARM: AM43xx: GP_EVM: Add support for DDR3

Quoted 12 lines · Vaibhav Bedia
Quoted 10 lines · Lokesh Vutla

GP EVM has 1GB DDR3 attached(Part no: MT47H128M16RT-187E:C). Adding details for the same.
Below is the brief description of DDR3 init sequence(SW leveling):
-> Enable VTT regulator
-> Configure VTP
-> Configure DDR IO settings
-> Disable initialization and refreshes until EMIF registers are programmed. -> Program Timing registers
-> Program leveling registers
-> Program PHY control and Temp alert and ZQ config registers.

Quoted 1 line

Temp alert? Is that really relevant here?

Yes, Need to configure all the emif registers before accessing SDRAM.

Quoted 144 lines
Quoted 144 lines

-> Enable initialization and refreshes and configure SDRAM CONFIG register

---
 arch/arm/cpu/armv7/am33xx/emif4d5.c         |    8 ++-
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   10 ++-
 board/ti/am43xx/board.c                     |   89 ++++++++++++++++++++++++++-
 3 files changed, 101 insertions(+), 6 deletions(-)
arch/arm/cpu/armv7/am33xx/emif4d5.c +5 -3
index eea1fa3..8bac0f2 100644
@@ -120,7 +120,7 @@ static void configure_mr(u32 base, u32 cs)
 
 void do_sdram_init(const struct ctrl_ioregs *ioregs,
                   const struct emif_regs *regs,
-                  const u32 *ext_phy_ctrl_const_regs)
+                  const u32 *ext_phy_ctrl_const_regs, u32 sdram_type)
 {
        struct emif_reg_struct *emif = (struct emif_reg_struct *)EMIF1_BASE;
 
@@ -178,6 +178,8 @@ void do_sdram_init(const struct ctrl_ioregs *ioregs,
        writel(regs->sdram_config, &emif->emif_sdram_config);
        writel(regs->ref_ctrl, &emif->emif_sdram_ref_ctrl);
 
-       configure_mr(EMIF1_BASE, 0);
-       configure_mr(EMIF1_BASE, 1);
+       if (sdram_type == EMIF_SDRAM_TYPE_LPDDR2) {
+               configure_mr(EMIF1_BASE, 0);
+               configure_mr(EMIF1_BASE, 1);
+       }
 }
arch/arm/include/asm/arch-am33xx/ddr_defs.h +9 -1
index 1880415..796e9df 100644
@@ -134,6 +134,14 @@
 #define  LPDDR2_DATA2_IOCTRL_VALUE   0x20000294
 #define  LPDDR2_DATA3_IOCTRL_VALUE   0x20000294
 
+#define  DDR3_ADDRCTRL_WD0_IOCTRL_VALUE 0x00000000
+#define  DDR3_ADDRCTRL_WD1_IOCTRL_VALUE 0x00000000
+#define  DDR3_ADDRCTRL_IOCTRL_VALUE   0x84
+#define  DDR3_DATA0_IOCTRL_VALUE   0x84
+#define  DDR3_DATA1_IOCTRL_VALUE   0x84
+#define  DDR3_DATA2_IOCTRL_VALUE   0x84
+#define  DDR3_DATA3_IOCTRL_VALUE   0x84
+
 /**
  * Configure DMM
  */
@@ -333,5 +341,5 @@ void config_ddr(unsigned int pll, unsigned int ioctrl,
 
 void do_sdram_init(const struct ctrl_ioregs *ioregs,
                   const struct emif_regs *emif_regs,
-                  const u32 *ext_phy_ctrl_const_regs);
+                  const u32 *ext_phy_ctrl_const_regs, u32 ddr_type);
 #endif  /* _DDR_DEFS_H */
board/ti/am43xx/board.c +69 -0
index 83d184d..a943b45 100644
@@ -140,6 +140,57 @@ const u32 ext_phy_ctrl_const_base_lpddr2[EMIF_EXT_PHY_CTRL_CONST_REG] = {
        0x08102040
 };
 
+const struct ctrl_ioregs ioregs_ddr3 = {
+       .cm0ioctl               = DDR3_ADDRCTRL_IOCTRL_VALUE,
+       .cm1ioctl               = DDR3_ADDRCTRL_WD0_IOCTRL_VALUE,
+       .cm2ioctl               = DDR3_ADDRCTRL_WD1_IOCTRL_VALUE,
+       .dt0ioctl               = DDR3_DATA0_IOCTRL_VALUE,
+       .dt1ioctl               = DDR3_DATA0_IOCTRL_VALUE,
+       .dt2ioctrl              = DDR3_DATA0_IOCTRL_VALUE,
+       .dt3ioctrl              = DDR3_DATA0_IOCTRL_VALUE,
+       .emif_sdram_config_ext  = 0x0043,
+};
+
+const struct emif_regs ddr3_emif_regs_400Mhz = {
+       .sdram_config                   = 0x638413B2,
+       .ref_ctrl                       = 0x00000C30,
+       .sdram_tim1                     = 0xEAAAD4DB,
+       .sdram_tim2                     = 0x266B7FDA,
+       .sdram_tim3                     = 0x107F8678,
+       .read_idle_ctrl                 = 0x00050000,
+       .zq_config                      = 0x50074BE4,
+       .temp_alert_config              = 0x0,
+       .emif_ddr_phy_ctlr_1            = 0x0E084007,
+       .emif_ddr_ext_phy_ctrl_1        = 0x08020080,
+       .emif_ddr_ext_phy_ctrl_2        = 0x00400040,
+       .emif_ddr_ext_phy_ctrl_3        = 0x00400040,
+       .emif_ddr_ext_phy_ctrl_4        = 0x00400040,
+       .emif_ddr_ext_phy_ctrl_5        = 0x00400040
+};
+
+const u32 ext_phy_ctrl_const_base_ddr3[EMIF_EXT_PHY_CTRL_CONST_REG] = {
+       0x00400040,
+       0x00350035,
+       0x00350035,
+       0x00350035,
+       0x00350035,
+       0x00350035,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00340034,
+       0x00340034,
+       0x00340034,
+       0x00340034,
+       0x00340034,
+       0x0,
+       0x0,
+       0x40000000,
+       0x08102040
+};
+
 const struct dpll_params *get_dpll_ddr_params(void)
 {
        if (board_is_eposevm())
@@ -189,10 +240,44 @@ void set_mux_conf_regs(void)
        enable_board_pin_mux();
 }
 
+static void enable_vtt_regulator(void)
+{
+       u32 temp;
+
+       /*GPIO_VTTEN - GPIO0_21 PINMUX Setup*/
+       writel(0x20009, CTRL_BASE + 0x0A60);
+
+       writel(0x40002, PRCM_BASE + 0x2B68);
+
+       /* Poll if module is functional */
+       while ((readl(PRCM_BASE + 0x2B68) & 0x30000) != 0x0)
+               ;
+
+       while ((readl(PRCM_BASE + 0x2B00) & 0x100) != 0x100)
+               ;
+
+       /* enable module */
+       writel(0x0, GPIO0_BASE + 0x0130);
Quoted 8 lines

board/ti/am43xx/board.c void set_mux_conf_regs(void) · line 266

Quoted 6 lines
board/ti/am43xx/board.c +6 -0
+
+       /*enable output for GPIO0_21*/
+       writel((1 << 22), GPIO0_BASE + 0x0194);
+       temp = readl(GPIO0_BASE + 0x0134);
+       temp = temp & ~(1 << 22);
+       writel(temp, GPIO0_BASE + 0x0134);

That's a lot of direct register writes :P

He he.. Completely missed it. Thanks for pointing it out. LL update it..:)

Quoted 4 lines

Can't you use some proper APIs for doing the pinmux, enabling the modules and controlling the GPIO?

Quoted 16 lines

board/ti/am43xx/board.c void set_mux_conf_regs(void) · line 276

Quoted 12 lines
board/ti/am43xx/board.c +8 -2
+}
+
 void sdram_init(void)
 {
-       do_sdram_init(&ioregs_lpddr2, &emif_regs_lpddr2,
-                     ext_phy_ctrl_const_base_lpddr2);
+       if (board_is_eposevm()) {
+               do_sdram_init(&ioregs_lpddr2, &emif_regs_lpddr2,
+                             ext_phy_ctrl_const_base_lpddr2,
+                             EMIF_SDRAM_TYPE_LPDDR2);
+       } else {
+               enable_vtt_regulator();

Hmm there must a smarter way of finding out whether the VTT regulator is present or not? You can always have DDR3 setups which don't use the regulator. Why not get this added to the EEPROM?

Hmm.. I am not sure. LL check it and update in V2.

Thanks and regards,
Lokesh

Quoted 4 lines

Regards,
Vaibhav

#42 lore raw

PATCH 13/14 ARM: AM43xx: GP_EVM: Add support for DDR3

Quoted 13 lines · Lokesh Vutla
Quoted 12 lines · Vaibhav Bedia
Quoted 10 lines · Lokesh Vutla

GP EVM has 1GB DDR3 attached(Part no: MT47H128M16RT-187E:C). Adding details for the same.
Below is the brief description of DDR3 init sequence(SW leveling):
-> Enable VTT regulator
-> Configure VTP
-> Configure DDR IO settings
-> Disable initialization and refreshes until EMIF registers are programmed. -> Program Timing registers
-> Program leveling registers
-> Program PHY control and Temp alert and ZQ config registers.

Quoted 2 lines
Quoted 1 line

Temp alert? Is that really relevant here?

Yes, Need to configure all the emif registers before accessing SDRAM.

Ok. What's done on an AM437x system when the temp goes beyond a threshold?

Regards,
Vaibhav

#43 lore raw

PATCH 13/14 ARM: AM43xx: GP_EVM: Add support for DDR3

In reply to Lokesh Vutla

Hi Vaibhav,

Quoted 167 lines · Lokesh Vutla
Quoted 12 lines · Vaibhav Bedia
Quoted 10 lines · Lokesh Vutla

GP EVM has 1GB DDR3 attached(Part no: MT47H128M16RT-187E:C). Adding details for the same.
Below is the brief description of DDR3 init sequence(SW leveling):
-> Enable VTT regulator
-> Configure VTP
-> Configure DDR IO settings
-> Disable initialization and refreshes until EMIF registers are programmed. -> Program Timing registers
-> Program leveling registers
-> Program PHY control and Temp alert and ZQ config registers.

Quoted 1 line

Temp alert? Is that really relevant here?

Yes, Need to configure all the emif registers before accessing SDRAM.

Quoted 144 lines
Quoted 144 lines

-> Enable initialization and refreshes and configure SDRAM CONFIG register

---
 arch/arm/cpu/armv7/am33xx/emif4d5.c         |    8 ++-
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   10 ++-
 board/ti/am43xx/board.c                     |   89 ++++++++++++++++++++++++++-
 3 files changed, 101 insertions(+), 6 deletions(-)
arch/arm/cpu/armv7/am33xx/emif4d5.c +5 -3
index eea1fa3..8bac0f2 100644
@@ -120,7 +120,7 @@ static void configure_mr(u32 base, u32 cs)
 
 void do_sdram_init(const struct ctrl_ioregs *ioregs,
                   const struct emif_regs *regs,
-                  const u32 *ext_phy_ctrl_const_regs)
+                  const u32 *ext_phy_ctrl_const_regs, u32 sdram_type)
 {
        struct emif_reg_struct *emif = (struct emif_reg_struct *)EMIF1_BASE;
 
@@ -178,6 +178,8 @@ void do_sdram_init(const struct ctrl_ioregs *ioregs,
        writel(regs->sdram_config, &emif->emif_sdram_config);
        writel(regs->ref_ctrl, &emif->emif_sdram_ref_ctrl);
 
-       configure_mr(EMIF1_BASE, 0);
-       configure_mr(EMIF1_BASE, 1);
+       if (sdram_type == EMIF_SDRAM_TYPE_LPDDR2) {
+               configure_mr(EMIF1_BASE, 0);
+               configure_mr(EMIF1_BASE, 1);
+       }
 }
arch/arm/include/asm/arch-am33xx/ddr_defs.h +9 -1
index 1880415..796e9df 100644
@@ -134,6 +134,14 @@
 #define  LPDDR2_DATA2_IOCTRL_VALUE   0x20000294
 #define  LPDDR2_DATA3_IOCTRL_VALUE   0x20000294
 
+#define  DDR3_ADDRCTRL_WD0_IOCTRL_VALUE 0x00000000
+#define  DDR3_ADDRCTRL_WD1_IOCTRL_VALUE 0x00000000
+#define  DDR3_ADDRCTRL_IOCTRL_VALUE   0x84
+#define  DDR3_DATA0_IOCTRL_VALUE   0x84
+#define  DDR3_DATA1_IOCTRL_VALUE   0x84
+#define  DDR3_DATA2_IOCTRL_VALUE   0x84
+#define  DDR3_DATA3_IOCTRL_VALUE   0x84
+
 /**
  * Configure DMM
  */
@@ -333,5 +341,5 @@ void config_ddr(unsigned int pll, unsigned int ioctrl,
 
 void do_sdram_init(const struct ctrl_ioregs *ioregs,
                   const struct emif_regs *emif_regs,
-                  const u32 *ext_phy_ctrl_const_regs);
+                  const u32 *ext_phy_ctrl_const_regs, u32 ddr_type);
 #endif  /* _DDR_DEFS_H */
board/ti/am43xx/board.c +69 -0
index 83d184d..a943b45 100644
@@ -140,6 +140,57 @@ const u32 ext_phy_ctrl_const_base_lpddr2[EMIF_EXT_PHY_CTRL_CONST_REG] = {
        0x08102040
 };
 
+const struct ctrl_ioregs ioregs_ddr3 = {
+       .cm0ioctl               = DDR3_ADDRCTRL_IOCTRL_VALUE,
+       .cm1ioctl               = DDR3_ADDRCTRL_WD0_IOCTRL_VALUE,
+       .cm2ioctl               = DDR3_ADDRCTRL_WD1_IOCTRL_VALUE,
+       .dt0ioctl               = DDR3_DATA0_IOCTRL_VALUE,
+       .dt1ioctl               = DDR3_DATA0_IOCTRL_VALUE,
+       .dt2ioctrl              = DDR3_DATA0_IOCTRL_VALUE,
+       .dt3ioctrl              = DDR3_DATA0_IOCTRL_VALUE,
+       .emif_sdram_config_ext  = 0x0043,
+};
+
+const struct emif_regs ddr3_emif_regs_400Mhz = {
+       .sdram_config                   = 0x638413B2,
+       .ref_ctrl                       = 0x00000C30,
+       .sdram_tim1                     = 0xEAAAD4DB,
+       .sdram_tim2                     = 0x266B7FDA,
+       .sdram_tim3                     = 0x107F8678,
+       .read_idle_ctrl                 = 0x00050000,
+       .zq_config                      = 0x50074BE4,
+       .temp_alert_config              = 0x0,
+       .emif_ddr_phy_ctlr_1            = 0x0E084007,
+       .emif_ddr_ext_phy_ctrl_1        = 0x08020080,
+       .emif_ddr_ext_phy_ctrl_2        = 0x00400040,
+       .emif_ddr_ext_phy_ctrl_3        = 0x00400040,
+       .emif_ddr_ext_phy_ctrl_4        = 0x00400040,
+       .emif_ddr_ext_phy_ctrl_5        = 0x00400040
+};
+
+const u32 ext_phy_ctrl_const_base_ddr3[EMIF_EXT_PHY_CTRL_CONST_REG] = {
+       0x00400040,
+       0x00350035,
+       0x00350035,
+       0x00350035,
+       0x00350035,
+       0x00350035,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00340034,
+       0x00340034,
+       0x00340034,
+       0x00340034,
+       0x00340034,
+       0x0,
+       0x0,
+       0x40000000,
+       0x08102040
+};
+
 const struct dpll_params *get_dpll_ddr_params(void)
 {
        if (board_is_eposevm())
@@ -189,10 +240,44 @@ void set_mux_conf_regs(void)
        enable_board_pin_mux();
 }
 
+static void enable_vtt_regulator(void)
+{
+       u32 temp;
+
+       /*GPIO_VTTEN - GPIO0_21 PINMUX Setup*/
+       writel(0x20009, CTRL_BASE + 0x0A60);
+
+       writel(0x40002, PRCM_BASE + 0x2B68);
+
+       /* Poll if module is functional */
+       while ((readl(PRCM_BASE + 0x2B68) & 0x30000) != 0x0)
+               ;
+
+       while ((readl(PRCM_BASE + 0x2B00) & 0x100) != 0x100)
+               ;
+
+       /* enable module */
+       writel(0x0, GPIO0_BASE + 0x0130);
Quoted 8 lines

board/ti/am43xx/board.c void set_mux_conf_regs(void) · line 266

Quoted 6 lines
board/ti/am43xx/board.c +6 -0
+
+       /*enable output for GPIO0_21*/
+       writel((1 << 22), GPIO0_BASE + 0x0194);
+       temp = readl(GPIO0_BASE + 0x0134);
+       temp = temp & ~(1 << 22);
+       writel(temp, GPIO0_BASE + 0x0134);

That's a lot of direct register writes :P

Quoted 22 lines

He he.. Completely missed it. Thanks for pointing it out. LL update it..:)

Quoted 20 lines

Can't you use some proper APIs for doing the pinmux, enabling the modules and controlling the GPIO?

board/ti/am43xx/board.c void set_mux_conf_regs(void) · line 276

Quoted 12 lines
board/ti/am43xx/board.c +8 -2
+}
+
 void sdram_init(void)
 {
-       do_sdram_init(&ioregs_lpddr2, &emif_regs_lpddr2,
-                     ext_phy_ctrl_const_base_lpddr2);
+       if (board_is_eposevm()) {
+               do_sdram_init(&ioregs_lpddr2, &emif_regs_lpddr2,
+                             ext_phy_ctrl_const_base_lpddr2,
+                             EMIF_SDRAM_TYPE_LPDDR2);
+       } else {
+               enable_vtt_regulator();

Hmm there must a smarter way of finding out whether the VTT regulator is present or not? You can always have DDR3 setups which don't use the regulator. Why not get this added to the EEPROM?

I checked with hardware folks. There is no register or some way to tell
if VTT is present. It is not added in EEPROM also and I have no answer why it is not added in EEPROM..:(
It is specific to boards using DDR3. So its good to have it in board files as I did it here instead of adding this check in emif file.

Thanks and regards,
Lokesh

Quoted 9 lines

Hmm.. I am not sure. LL check it and update in V2.

Thanks and regards,
Lokesh

Quoted 4 lines

Regards,
Vaibhav

#44 lore raw

PATCH 13/14 ARM: AM43xx: GP_EVM: Add support for DDR3

On Wed, Nov 13, 2013 at 3:48 AM, Lokesh Vutla <[email protected]> wrote:
[...]

Quoted 5 lines

I checked with hardware folks. There is no register or some way to tell
if VTT is present. It is not added in EEPROM also and I have no answer why it is not added in EEPROM..:(
It is specific to boards using DDR3. So its good to have it in board files as I did it here instead of adding this check in emif file.

That EEPROM is clearly not getting used the way i think it should be :\
I would have made a lot of noise to get details like this added there.

You should at least check for the GP EVM (if possible) and then enable VTT. Doing this unconditionally is bound to cause problems later on. I would also put in a big comment over there so that folks who design their own board with DDR3 don't miss this fact.

Regards,
Vaibhav

#45 lore raw

PATCH 13/14 ARM: AM43xx: GP_EVM: Add support for DDR3

Hi Vaibhav,

Quoted 10 lines · Vaibhav Bedia

On Wed, Nov 13, 2013 at 3:48 AM, Lokesh Vutla <[email protected]> wrote:
[...]

Quoted 5 lines

I checked with hardware folks. There is no register or some way to tell
if VTT is present. It is not added in EEPROM also and I have no answer why it is not added in EEPROM..:(
It is specific to boards using DDR3. So its good to have it in board files as I did it here instead of adding this check in emif file.

That EEPROM is clearly not getting used the way i think it should be :\
I would have made a lot of noise to get details like this added there.

The EEPROM was designed as a way to differentiate between different TI EVMs, not as a generic way to differentiate between various possible board hook-ups. Even if we did define it that way, why would all boards using AM437x have an onboard EEPROM?

We could request this information be placed in EEPROM and see if hardware folks oblige, but I don't see how that's going to be used beyond TI EVMs.

Thanks,
Sekhar

#46 lore raw

PATCH 13/14 ARM: AM43xx: GP_EVM: Add support for DDR3

Hi Sekhar :)

Quoted 14 lines · Sekhar Nori

Hi Vaibhav,

Quoted 10 lines · Vaibhav Bedia

On Wed, Nov 13, 2013 at 3:48 AM, Lokesh Vutla <[email protected]> wrote:
[...]

Quoted 5 lines

I checked with hardware folks. There is no register or some way to tell
if VTT is present. It is not added in EEPROM also and I have no answer why it is not added in EEPROM..:(
It is specific to boards using DDR3. So its good to have it in board files as I did it here instead of adding this check in emif file.

That EEPROM is clearly not getting used the way i think it should be :\
I would have made a lot of noise to get details like this added there.

Quoted 9 lines

The EEPROM was designed as a way to differentiate between different TI EVMs, not as a generic way to differentiate between various possible board hook-ups. Even if we did define it that way, why would all boards using AM437x have an onboard EEPROM?

We could request this information be placed in EEPROM and see if hardware folks oblige, but I don't see how that's going to be used beyond TI EVMs.

I understand the intent of customers to get rid of all the components they can to lower the cost. But if one just thinks about this a bit more, the current solution does a half-hearted attempt to differentiate the boards variants. It doesn't really capture the differences that are there and that is leading to hard coding to a certain extent.

#47 lore raw

PATCH 13/14 ARM: AM43xx: GP_EVM: Add support for DDR3

Quoted 33 lines · Vaibhav Bedia

Hi Sekhar :)

Quoted 14 lines · Sekhar Nori

Hi Vaibhav,

Quoted 10 lines · Vaibhav Bedia

On Wed, Nov 13, 2013 at 3:48 AM, Lokesh Vutla <[email protected]> wrote:
[...]

Quoted 5 lines

I checked with hardware folks. There is no register or some way to tell
if VTT is present. It is not added in EEPROM also and I have no answer why it is not added in EEPROM..:(
It is specific to boards using DDR3. So its good to have it in board files as I did it here instead of adding this check in emif file.

That EEPROM is clearly not getting used the way i think it should be :\
I would have made a lot of noise to get details like this added there.

Quoted 9 lines

The EEPROM was designed as a way to differentiate between different TI EVMs, not as a generic way to differentiate between various possible board hook-ups. Even if we did define it that way, why would all boards using AM437x have an onboard EEPROM?

We could request this information be placed in EEPROM and see if hardware folks oblige, but I don't see how that's going to be used beyond TI EVMs.

I understand the intent of customers to get rid of all the components they can to lower the cost. But if one just thinks about this a bit more, the current solution does a half-hearted attempt to differentiate the boards variants. It doesn't really capture the differences that are there and that is leading to hard coding to a certain extent.

Quoted 10 lines

From AM335x boards we should now have a decent idea of what things change across boards that go into production. I don't think it makes sense to throw away all that knowledge and go ahead assuming we will never make a change. The request for change is just to future proof the current code and have the EEPROM actually help us do our jobs. Why? Because life's too short to keep worrying about why a board rev that a you pick up from a neighbor's desk doesn't boot, hooking up the JTAG to trace the DDR setup code, figure out what needs to change in the boot-loader, add in the appropriate check and then get to the task at hand ;)

In theory, one could also learn from the customers that did keep the EEPROM about what additional information they programmed in.

I think however, the most likely outcome here is that we'll be able to only rely on the board name (and rev) part of the EEPROM being populated and the board code should be clear and well commented about non-obvious things such as design choice A means B is required.

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/20131114/e91a24ce/attachment.pgp>
#48 lore raw

PATCH 13/14 ARM: AM43xx: GP_EVM: Add support for DDR3

In reply to Vaibhav Bedia
Quoted 8 lines · Vaibhav Bedia

On Wed, Nov 13, 2013 at 3:48 AM, Lokesh Vutla <[email protected]> wrote:
[...]

Quoted 5 lines

I checked with hardware folks. There is no register or some way to tell
if VTT is present. It is not added in EEPROM also and I have no answer why it is not added in EEPROM..:(
It is specific to boards using DDR3. So its good to have it in board files as I did it here instead of adding this check in emif file.

Quoted 7 lines

That EEPROM is clearly not getting used the way i think it should be :\
I would have made a lot of noise to get details like this added there.

You should at least check for the GP EVM (if possible) and then enable VTT. Doing this unconditionally is bound to cause problems later on. I would also put in a big comment over there so that folks who design their own board with DDR3 don't miss this fact.

I agree, the code should be doing a check for what board we're on and enabling VTT, and a good comment about what's going on here.

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/20131114/4e0d7534/attachment.pgp>
#49 lore raw

PATCH 14/14 ARM: AM43xx: Add Maintainer

In reply to Lokesh Vutla

Adding Maintainer for AM43xx.

---
 boards.cfg |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
boards.cfg +1 -1
index 5e10125..52db48d 100644
@@ -263,7 +263,7 @@ Active  arm         armv7          am33xx      ti              am335x
 Active  arm         armv7          am33xx      ti              am335x              am335x_evm_uart4                     am335x_evm:SERIAL5,CONS_INDEX=1,NAND                                                                                              Tom Rini <[email protected]>
 Active  arm         armv7          am33xx      ti              am335x              am335x_evm_uart5                     am335x_evm:SERIAL6,CONS_INDEX=1,NAND                                                                                              Tom Rini <[email protected]>
 Active  arm         armv7          am33xx      ti              am335x              am335x_evm_usbspl                    am335x_evm:SERIAL1,CONS_INDEX=1,NAND,SPL_USBETH_SUPPORT                                                                           Tom Rini <[email protected]>
-Active  arm         armv7          am33xx      ti              am43xx              am43xx_evm                           am43xx_evm:SERIAL1,CONS_INDEX=1                                                                                                   -
+Active  arm         armv7          am33xx      ti              am43xx              am43xx_evm                           am43xx_evm:SERIAL1,CONS_INDEX=1                                                                                                   Lokesh Vutla <[email protected]>
 Active  arm         armv7          am33xx      ti              ti814x              ti814x_evm                           -                                                                                                                                 Matt Porter <[email protected]>
 Active  arm         armv7          am33xx      ti              ti816x              ti816x_evm                           -                                                                                                                                 -
 Active  arm         armv7          at91        atmel           sama5d3xek          sama5d3xek_mmc                       sama5d3xek:SAMA5D3,SYS_USE_MMC                                                                                                    Bo Shen <[email protected]>
Signature · 1 line
1.7.9.5