From 74f40ea1bcbe96a91067d6f8056a18393d311e67 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Tue, 9 Apr 2013 11:40:40 -0400 Subject: [PATCH 1/9] am335x/ti814x: Correct MMC_BOOT_DEVICES_START/END Given that on TI814x we have MMC1/2 swapped, we also need to swap them in MMC_BOOT_DEVICES_START/END Reported-by: Peter Korsgaard Signed-off-by: Tom Rini --- arch/arm/include/asm/arch-am33xx/spl.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/include/asm/arch-am33xx/spl.h b/arch/arm/include/asm/arch-am33xx/spl.h index 14a2c7c28e..4c23b271b5 100644 --- a/arch/arm/include/asm/arch-am33xx/spl.h +++ b/arch/arm/include/asm/arch-am33xx/spl.h @@ -38,6 +38,11 @@ #define BOOT_DEVICE_CPGMAC 70 #define BOOT_DEVICE_MMC2_2 0xFF +#ifdef CONFIG_AM33XX #define MMC_BOOT_DEVICES_START BOOT_DEVICE_MMC1 #define MMC_BOOT_DEVICES_END BOOT_DEVICE_MMC2 +#elif defined(CONFIG_TI814X) +#define MMC_BOOT_DEVICES_START BOOT_DEVICE_MMC2 +#define MMC_BOOT_DEVICES_END BOOT_DEVICE_MMC1 +#endif #endif From b996a3e9a88ce247bce3d29a9ac5ff34c37845fd Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 10 Apr 2013 15:10:54 +0200 Subject: [PATCH 2/9] am335x: Update timings for the beaglebone again After further testing we can run DDR at 400MHz so update the timings again. Tested-by: Koen Kooi Signed-off-by: Tom Rini --- arch/arm/include/asm/arch-am33xx/ddr_defs.h | 20 ++++++++++---------- board/ti/am335x/board.c | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h b/arch/arm/include/asm/arch-am33xx/ddr_defs.h index 260cc3484f..914df01525 100644 --- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h +++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h @@ -84,19 +84,19 @@ #define MT41J256M8HX15E_IOCTRL_VALUE 0x18B /* Micron MT41K256M16HA-125E */ -#define MT41K256M16HA125E_EMIF_READ_LATENCY 0x100006 -#define MT41K256M16HA125E_EMIF_TIM1 0x0888A39B -#define MT41K256M16HA125E_EMIF_TIM2 0x26517FDA -#define MT41K256M16HA125E_EMIF_TIM3 0x501F84EF -#define MT41K256M16HA125E_EMIF_SDCFG 0x61C04BB2 -#define MT41K256M16HA125E_EMIF_SDREF 0x0000093B +#define MT41K256M16HA125E_EMIF_READ_LATENCY 0x100007 +#define MT41K256M16HA125E_EMIF_TIM1 0x0AAAD4DB +#define MT41K256M16HA125E_EMIF_TIM2 0x26437FDA +#define MT41K256M16HA125E_EMIF_TIM3 0x501F83FF +#define MT41K256M16HA125E_EMIF_SDCFG 0x61C052B2 +#define MT41K256M16HA125E_EMIF_SDREF 0xC30 #define MT41K256M16HA125E_ZQ_CFG 0x50074BE4 #define MT41K256M16HA125E_DLL_LOCK_DIFF 0x1 -#define MT41K256M16HA125E_RATIO 0x40 +#define MT41K256M16HA125E_RATIO 0x80 #define MT41K256M16HA125E_INVERT_CLKOUT 0x0 -#define MT41K256M16HA125E_RD_DQS 0x3C -#define MT41K256M16HA125E_WR_DQS 0x45 -#define MT41K256M16HA125E_PHY_WR_DATA 0x7F +#define MT41K256M16HA125E_RD_DQS 0x3A +#define MT41K256M16HA125E_WR_DQS 0x42 +#define MT41K256M16HA125E_PHY_WR_DATA 0x7E #define MT41K256M16HA125E_PHY_FIFO_WE 0x9B #define MT41K256M16HA125E_IOCTRL_VALUE 0x18B diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 12620bb69c..b371376bc7 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -379,7 +379,7 @@ void s_init(void) config_ddr(303, MT41J128MJT125_IOCTRL_VALUE, &ddr3_data, &ddr3_cmd_ctrl_data, &ddr3_emif_reg_data, 0); else if (board_is_bone_lt()) - config_ddr(303, MT41K256M16HA125E_IOCTRL_VALUE, + config_ddr(400, MT41K256M16HA125E_IOCTRL_VALUE, &ddr3_beagleblack_data, &ddr3_beagleblack_cmd_ctrl_data, &ddr3_beagleblack_emif_reg_data, 0); From a1c8fb91325d1e0a928bd71f4ac7522712f7de82 Mon Sep 17 00:00:00 2001 From: Lubomir Popov Date: Mon, 8 Apr 2013 22:05:33 +0000 Subject: [PATCH 3/9] OMAP4: Fix bug in omap4460_volts struct The omap4460_volts struct was incorrectly referencing tps62361 instead of twl6030 as PMIC for the core and mm voltages (the tps is used for mpu supply only). This shall lead to bad OPP settings while booting kernel. Fixing it. Fix some comments as well. Signed-off-by: Lubomir Popov --- arch/arm/cpu/armv7/omap4/hw_data.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/armv7/omap4/hw_data.c b/arch/arm/cpu/armv7/omap4/hw_data.c index 7551b9861e..04977b4f2b 100644 --- a/arch/arm/cpu/armv7/omap4/hw_data.c +++ b/arch/arm/cpu/armv7/omap4/hw_data.c @@ -216,14 +216,14 @@ struct dplls omap4460_dplls = { struct pmic_data twl6030_4430es1 = { .base_offset = PHOENIX_SMPS_BASE_VOLT_STD_MODE_UV, - .step = 12660, /* 10 mV represented in uV */ + .step = 12660, /* 12.66 mV represented in uV */ /* The code starts at 1 not 0 */ .start_code = 1, }; struct pmic_data twl6030 = { .base_offset = PHOENIX_SMPS_BASE_VOLT_STD_MODE_WITH_OFFSET_UV, - .step = 12660, /* 10 mV represented in uV */ + .step = 12660, /* 12.66 mV represented in uV */ /* The code starts at 1 not 0 */ .start_code = 1, }; @@ -271,11 +271,11 @@ struct vcores_data omap4460_volts = { .core.value = 1200, .core.addr = SMPS_REG_ADDR_VCORE1, - .core.pmic = &tps62361, + .core.pmic = &twl6030, .mm.value = 1200, .mm.addr = SMPS_REG_ADDR_VCORE2, - .mm.pmic = &tps62361, + .mm.pmic = &twl6030, }; /* From a519602d9599a3afe53ec3f7687aba5fe3dd3af1 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 10 Apr 2013 15:10:10 -0400 Subject: [PATCH 4/9] omap5_uevm: Correct to 2MiB aligned partitions on eMMC This has a 2MiB erase block size eMMC, so make sure we align on that for best possible performance. Signed-off-by: Tom Rini --- include/configs/omap5_uevm.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/configs/omap5_uevm.h b/include/configs/omap5_uevm.h index e490523d6e..240fdfcb47 100644 --- a/include/configs/omap5_uevm.h +++ b/include/configs/omap5_uevm.h @@ -31,8 +31,7 @@ /* Define the default GPT table for eMMC */ #define PARTS_DEFAULT \ "uuid_disk=${uuid_gpt_disk};" \ - "name=u-boot,size=1792KiB,uuid=${uuid_gpt_u-boot};" \ - "name=rootfs,size=-,uuid=${uuid_gpt_rootfs}" + "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}" #include From c8b30b858fe3425e005940b2db314fc3cc9d106c Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Tue, 9 Apr 2013 16:41:29 -0500 Subject: [PATCH 5/9] omap5912-osk: Fix DRAM initialisation The size of the DRAM for the omap5912-osk board is getting setup in the dram_init() function. However, for the current u-boot release this is too late and needs to be done in dram_init_banksize(). Therefore, add a dram_init_banksize() function for the omap5912-osk board and setup the DRAM size there. Signed-off-by: Jon Hunter --- board/ti/omap5912osk/omap5912osk.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/board/ti/omap5912osk/omap5912osk.c b/board/ti/omap5912osk/omap5912osk.c index fac683a7e6..9e91c5efc1 100644 --- a/board/ti/omap5912osk/omap5912osk.c +++ b/board/ti/omap5912osk/omap5912osk.c @@ -128,12 +128,17 @@ void ether__init (void) Routine: Description: ******************************/ -int dram_init (void) +int dram_init(void) +{ + gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE); + + return 0; +} + +void dram_init_banksize(void) { gd->bd->bi_dram[0].start = PHYS_SDRAM_1; gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; - - return 0; } /****************************************************** From 5faba1eac6ebfd769e25727283afa9d7275e9700 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Tue, 9 Apr 2013 16:41:30 -0500 Subject: [PATCH 6/9] omap5912-osk: Fix booting from NOR flash The omap5912-osk board is using a RAM based address as the linker location for code. This is causing several problems when attempting to run the latest u-boot code base on this board from flash. Update the default linker location for code to be in NOR flash at address 0x00000000. The omap5912-osk board only has 32MB of RAM and so fix the comment in the omap5912-osk config.mk file as well. Signed-off-by: Jon Hunter --- board/ti/omap5912osk/config.mk | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/board/ti/omap5912osk/config.mk b/board/ti/omap5912osk/config.mk index 0ed7d8a6a7..5b8d952ba6 100644 --- a/board/ti/omap5912osk/config.mk +++ b/board/ti/omap5912osk/config.mk @@ -14,17 +14,17 @@ # TI OSK board with OMAP5912 (ARM925EJS) cpu # see http://www.ti.com/ for more information on Texas Instruments # -# OSK has 1 bank of 256 MB SDRAM +# OSK has 1 bank of 32 MB SDRAM # Physical Address: -# 1000'0000 to 2000'0000 +# 1000'0000 to 1200'0000 # # # Linux-Kernel is expected to be at 1000'8000, entry 1000'8000 # (mem base + reserved) # -# we load ourself to 1108'0000 -# +# When running from RAM use address 1108'0000, otherwise when +# booting from NOR flash link to address 0000'0000. # - -CONFIG_SYS_TEXT_BASE = 0x11080000 +CONFIG_SYS_TEXT_BASE = 0x00000000 +#CONFIG_SYS_TEXT_BASE = 0x11080000 From 2a309f33def4a8f72cb3b2e6f6a93ad487a50189 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Tue, 9 Apr 2013 16:41:31 -0500 Subject: [PATCH 7/9] omap5912-osk: Fix device initialisation In the current u-boot, the device pin multiplexing and clock initialisation needs to be early during the boot process and before board_init() is called. U-boot is currently crashing on this board because this is not being done early enough. Therefore, add a s_init() function for the omap5912-osk board to do this. Also fix the stack pointer so that it is pointing to the end of the internal RAM and not the beginning as this was also causing the device to crash. Signed-off-by: Jon Hunter --- board/ti/omap5912osk/lowlevel_init.S | 20 ++++++++++++++++++++ board/ti/omap5912osk/omap5912osk.c | 12 ++++++++---- include/configs/omap5912osk.h | 7 +++++-- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/board/ti/omap5912osk/lowlevel_init.S b/board/ti/omap5912osk/lowlevel_init.S index e60161ebaf..ca7361e05a 100644 --- a/board/ti/omap5912osk/lowlevel_init.S +++ b/board/ti/omap5912osk/lowlevel_init.S @@ -306,6 +306,23 @@ common_tc: ldr r1, VAL_MPU_CNTL_TIMER str r1, [r0] + /* + * Setup a temporary stack + */ + ldr sp, SRAM_STACK + bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ + + /* + * Save the old lr(passed in ip) and the current lr to stack + */ + push {ip, lr} + + /* + * go setup pll, mux, memory + */ + bl s_init + pop {ip, pc} + /* back to arch calling code */ mov pc, lr @@ -470,6 +487,9 @@ VAL_ARM_IDLECT2: VAL_ARM_IDLECT3: .word 0x00000015 +SRAM_STACK: + .word CONFIG_SYS_INIT_SP_ADDR + /* command values */ .equ CMD_SDRAM_NOP, 0x00000000 .equ CMD_SDRAM_PRECHARGE, 0x00000001 diff --git a/board/ti/omap5912osk/omap5912osk.c b/board/ti/omap5912osk/omap5912osk.c index 9e91c5efc1..95140719aa 100644 --- a/board/ti/omap5912osk/omap5912osk.c +++ b/board/ti/omap5912osk/omap5912osk.c @@ -66,6 +66,14 @@ int board_init (void) /* adress of boot parameters */ gd->bd->bi_boot_params = 0x10000100; + flash__init(); + ether__init(); + + return 0; +} + +void s_init(void) +{ /* Configure MUX settings */ set_muxconf_regs (); peripheral_power_enable (); @@ -75,10 +83,6 @@ int board_init (void) * ... rkw ... */ icache_enable (); - - flash__init (); - ether__init (); - return 0; } /****************************** diff --git a/include/configs/omap5912osk.h b/include/configs/omap5912osk.h index 40ca9bb98d..558e933b0a 100644 --- a/include/configs/omap5912osk.h +++ b/include/configs/omap5912osk.h @@ -183,7 +183,10 @@ #define CONFIG_ENV_SIZE 0x20000 /* Total Size of Environment Sector */ #define CONFIG_ENV_OFFSET 0x20000 /* environment starts here */ -#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 -#define CONFIG_SYS_INIT_SP_ADDR PHYS_SRAM +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +#define CONFIG_SYS_INIT_RAM_ADDR PHYS_SRAM +#define CONFIG_SYS_INIT_RAM_SIZE (250 * 1024) +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \ + CONFIG_SYS_INIT_RAM_SIZE) #endif /* __CONFIG_H */ From 54ef1f6774a2ced26789a072249c048201dc8987 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Tue, 9 Apr 2013 16:41:32 -0500 Subject: [PATCH 8/9] omap5912-osk: Increase flash partition for u-boot The current u-boot binary needs more than 128KB of flash space and so move the u-boot environment from an offset of 128KB to 256KB in flash to ensure the enviroment does not overlap with u-boot. Signed-off-by: Jon Hunter --- include/configs/omap5912osk.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/configs/omap5912osk.h b/include/configs/omap5912osk.h index 558e933b0a..3276a5070a 100644 --- a/include/configs/omap5912osk.h +++ b/include/configs/omap5912osk.h @@ -178,10 +178,10 @@ */ #define CONFIG_ENV_IS_IN_FLASH 1 /* addr of environment */ -#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + 0x020000) +#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET) -#define CONFIG_ENV_SIZE 0x20000 /* Total Size of Environment Sector */ -#define CONFIG_ENV_OFFSET 0x20000 /* environment starts here */ +#define CONFIG_ENV_SIZE 0x20000 /* Total Size of Environment Sector */ +#define CONFIG_ENV_OFFSET 0x40000 /* environment starts here */ #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 #define CONFIG_SYS_INIT_RAM_ADDR PHYS_SRAM From eef6da0326834cc90b9f3b2e80dec71ee8e39e9a Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Tue, 9 Apr 2013 16:41:33 -0500 Subject: [PATCH 9/9] omap5912-osk: Fix get_timer() and CONFIG_SYS_HZ The function get_timer() should return time in ms and CONFIG_SYS_HZ should be set to 1000 by default. Fix both of these items. Signed-off-by: Jon Hunter --- arch/arm/cpu/arm926ejs/omap/timer.c | 15 ++++++++------- include/configs/omap5912osk.h | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/omap/timer.c b/arch/arm/cpu/arm926ejs/omap/timer.c index 34ec7b2b1c..16530b03b8 100644 --- a/arch/arm/cpu/arm926ejs/omap/timer.c +++ b/arch/arm/cpu/arm926ejs/omap/timer.c @@ -36,11 +36,14 @@ */ #include +#include -#define TIMER_LOAD_VAL 0xffffffff +#define TIMER_CLOCK (CONFIG_SYS_CLK_FREQ / (2 << CONFIG_SYS_PTV)) +#define TIMER_LOAD_VAL 0xffffffff /* macro to read the 32 bit timer */ -#define READ_TIMER (*(volatile ulong *)(CONFIG_SYS_TIMERBASE+8)) +#define READ_TIMER readl(CONFIG_SYS_TIMERBASE+8) \ + / (TIMER_CLOCK / CONFIG_SYS_HZ) DECLARE_GLOBAL_DATA_PTR; @@ -114,7 +117,8 @@ ulong get_timer_masked (void) * (TLV-now) amount of time after passing though -1 * nts = new "advancing time stamp"...it could also roll and cause problems. */ - timestamp += lastdec + TIMER_LOAD_VAL - now; + timestamp += lastdec + (TIMER_LOAD_VAL / (TIMER_CLOCK / + CONFIG_SYS_HZ)) - now; } lastdec = now; @@ -160,8 +164,5 @@ unsigned long long get_ticks(void) */ ulong get_tbclk (void) { - ulong tbclk; - - tbclk = CONFIG_SYS_HZ; - return tbclk; + return CONFIG_SYS_HZ; } diff --git a/include/configs/omap5912osk.h b/include/configs/omap5912osk.h index 3276a5070a..c5797a238f 100644 --- a/include/configs/omap5912osk.h +++ b/include/configs/omap5912osk.h @@ -134,7 +134,7 @@ */ #define CONFIG_SYS_TIMERBASE 0xFFFEC500 /* use timer 1 */ #define CONFIG_SYS_PTV 7 /* 2^(PTV+1), divide by 256 */ -#define CONFIG_SYS_HZ ((CONFIG_SYS_CLK_FREQ)/(2 << CONFIG_SYS_PTV)) +#define CONFIG_SYS_HZ 1000 /*----------------------------------------------------------------------- * Physical Memory Map