Message ID | 1368469719-22406-7-git-send-email-trini@ti.com |
---|---|
State | Changes Requested |
Delegated to: | Tom Rini |
Headers | show |
>>>>> "Tom" == Tom Rini <trini@ti.com> writes:
Tom> From: Steve Kipisz <s-kipisz2@ti.com>
Tom> NOR requires that s_init be within the first 4KiB of the image so that
Tom> we can perform the rest of the required pinmuxing to talk with the rest
Tom> of NOR that we are found on. When NOR_BOOT is set we save our
Tom> environment in NOR at 512KiB and a redundant copy at 768KiB. We avoid
Tom> using SPL for this case and u-boot.bin is written directly to the start
Tom> of NOR.
Tom> Signed-off-by: Steve Kipisz <s-kipisz2@ti.com>
Tom> Signed-off-by: Tom Rini <trini@ti.com>
Tom> ---
Tom> Changes in v2:
Tom> - Reword commit message slightly
Tom> ---
Tom> arch/arm/cpu/armv7/am33xx/emif4.c | 6 +-
Tom> board/ti/am335x/Makefile | 2 +-
Tom> board/ti/am335x/board.c | 31 ++++++++++-
Tom> board/ti/am335x/mux.c | 6 +-
Tom> board/ti/am335x/u-boot.lds | 110 +++++++++++++++++++++++++++++++++++++
Tom> boards.cfg | 1 +
Tom> include/configs/am335x_evm.h | 26 ++++++++-
Tom> 7 files changed, 173 insertions(+), 9 deletions(-)
Tom> create mode 100644 board/ti/am335x/u-boot.lds
Tom> diff --git a/arch/arm/cpu/armv7/am33xx/emif4.c b/arch/arm/cpu/armv7/am33xx/emif4.c
Tom> index aa84e96..370230b 100644
Tom> --- a/arch/arm/cpu/armv7/am33xx/emif4.c
Tom> +++ b/arch/arm/cpu/armv7/am33xx/emif4.c
Tom> @@ -43,9 +43,11 @@ void dram_init_banksize(void)
Tom> }
Tom> -#ifdef CONFIG_SPL_BUILD
Tom> +#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT)
Tom> +#ifdef CONFIG_TI81XX
Tom> static struct dmm_lisa_map_regs *hw_lisa_map_regs =
Tom> (struct dmm_lisa_map_regs *)DMM_BASE;
Tom> +#endif
Tom> static struct vtp_reg *vtpreg[2] = {
Tom> (struct vtp_reg *)VTP0_CTRL_ADDR,
Tom> (struct vtp_reg *)VTP1_CTRL_ADDR};
Tom> @@ -53,6 +55,7 @@ static struct vtp_reg *vtpreg[2] = {
Tom> static struct ddr_ctrl *ddrctrl = (struct ddr_ctrl *)DDR_CTRL_ADDR;
Tom> #endif
Tom> +#ifdef CONFIG_TI81XX
Why are you adding the TI81XX dependency here? That doesn't have
anything to do with nor boot, does it?
Tom> void config_dmm(const struct dmm_lisa_map_regs *regs)
Tom> {
Tom> enable_dmm_clocks();
Tom> @@ -67,6 +70,7 @@ void config_dmm(const struct dmm_lisa_map_regs *regs)
Tom> writel(regs->dmm_lisa_map_1, &hw_lisa_map_regs->dmm_lisa_map_1);
Tom> writel(regs->dmm_lisa_map_0, &hw_lisa_map_regs->dmm_lisa_map_0);
Tom> }
Tom> +#endif
On Thu, May 16, 2013 at 04:36:02PM +0200, Peter Korsgaard wrote: > >>>>> "Tom" == Tom Rini <trini@ti.com> writes: > > Tom> From: Steve Kipisz <s-kipisz2@ti.com> > Tom> NOR requires that s_init be within the first 4KiB of the image so that > Tom> we can perform the rest of the required pinmuxing to talk with the rest > Tom> of NOR that we are found on. When NOR_BOOT is set we save our > Tom> environment in NOR at 512KiB and a redundant copy at 768KiB. We avoid > Tom> using SPL for this case and u-boot.bin is written directly to the start > Tom> of NOR. [snip] > Tom> -#ifdef CONFIG_SPL_BUILD > Tom> +#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT) > Tom> +#ifdef CONFIG_TI81XX > Tom> static struct dmm_lisa_map_regs *hw_lisa_map_regs = > Tom> (struct dmm_lisa_map_regs *)DMM_BASE; > Tom> +#endif > Tom> static struct vtp_reg *vtpreg[2] = { > Tom> (struct vtp_reg *)VTP0_CTRL_ADDR, > Tom> (struct vtp_reg *)VTP1_CTRL_ADDR}; > Tom> @@ -53,6 +55,7 @@ static struct vtp_reg *vtpreg[2] = { > Tom> static struct ddr_ctrl *ddrctrl = (struct ddr_ctrl *)DDR_CTRL_ADDR; > Tom> #endif > > Tom> +#ifdef CONFIG_TI81XX > > Why are you adding the TI81XX dependency here? That doesn't have > anything to do with nor boot, does it? dmm is TI81XX-only (for this file, it's also omap4+) and since main U-Boot doesn't use --ffunction-sections/--fdata-sections/--gc-sections we end up with a link error about not having enable_dmm_clocks(). This is OK on SPL since we do use --gc-sections and the link error is avoided as we discard config_dmm on am33xx builds.
>>>>> "Tom" == Tom Rini <trini@ti.com> writes: Hi, Tom> +#ifdef CONFIG_TI81XX >> >> Why are you adding the TI81XX dependency here? That doesn't have >> anything to do with nor boot, does it? Tom> dmm is TI81XX-only (for this file, it's also omap4+) and since main Tom> U-Boot doesn't use --ffunction-sections/--fdata-sections/--gc-sections Tom> we end up with a link error about not having enable_dmm_clocks(). This Tom> is OK on SPL since we do use --gc-sections and the link error is avoided Tom> as we discard config_dmm on am33xx builds. Ok, that's interesting info which imho belongs in the commit message.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/16/2013 02:55 PM, Peter Korsgaard wrote: >>>>>> "Tom" == Tom Rini <trini@ti.com> writes: > > Hi, > > Tom> +#ifdef CONFIG_TI81XX >>> >>> Why are you adding the TI81XX dependency here? That doesn't >>> have anything to do with nor boot, does it? > > Tom> dmm is TI81XX-only (for this file, it's also omap4+) and since > main Tom> U-Boot doesn't use > --ffunction-sections/--fdata-sections/--gc-sections Tom> we end up > with a link error about not having enable_dmm_clocks(). This Tom> > is OK on SPL since we do use --gc-sections and the link error is > avoided Tom> as we discard config_dmm on am33xx builds. > > Ok, that's interesting info which imho belongs in the commit > message. Reworded, thanks! - -- Tom -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJRlTO9AAoJENk4IS6UOR1W+0EP/iJp6by7wCSRgF3pbpRxO9OL kchUz33xA1eckOaPWkCjrxDyVL8tkvEY/cD9eO6f0LdwOLei4PEaEXc5kt2pobm1 9L5NWqKPXgfHcJFEH/kH7s9jZDi3camXZ00jDkJn2kegtxCFQ/3OjLYaj3bze6vA xh1GtokP89lzXQcznQxUStKKWEs1Q/VZ07tI6Pac188V8OWewnH+d3IzWLZ77X88 TLCOT/YQXJGNCPQ8SrdxyC4lIdLpP8tGF2D7c/wAcWVpdbrcDKJ5jl96TorWIoz2 BsTcyFyM902jH1+s6xyspDvLMJ+HiuPWdn5dkNgwqI5Dk6bO/5cUcQlGehFNlILA hsQTGmvb4JElcnVjbsNzjaS4LFcUpNYMFnbz8VADHrSo3fvIkQPECqa2h7hpmnxP v0WItkEoNt3NTapcjKllot6Mja4/7RCTIVj6N8s7D5oxzdqvQ8huCANGqIy0MTfu RhLkAjvjkv43/T3uslhsi7ZPbirdV/++pEBRMLWFdFYWJr0SFju5JMgmcHWMmZtA 8EdsOopRqUMiS4ZER1/FbOEF4/NQof6YUVRYjvSr96qCkMmbYFkp9vhVEaKovPXH Gs4qM3FYFnBX+sptYjND5sCQvBw2hzFLyF7heRtfnQqmZa+34usdZe3Xe1xQ/RYr O2EkA8rp+XQC9PZam3jj =myST -----END PGP SIGNATURE-----
>>>>> "Tom" == Tom Rini <trini@ti.com> writes: >> Ok, that's interesting info which imho belongs in the commit >> message. Tom> Reworded, thanks! Great, thanks.
On 13/05/13 19:28, Tom Rini wrote: > From: Steve Kipisz <s-kipisz2@ti.com> > > NOR requires that s_init be within the first 4KiB of the image so that > we can perform the rest of the required pinmuxing to talk with the rest > of NOR that we are found on. When NOR_BOOT is set we save our > environment in NOR at 512KiB and a redundant copy at 768KiB. We avoid > using SPL for this case and u-boot.bin is written directly to the start > of NOR. I'm trying to get this up and running our NanoBone platform, but I'm having no success. Using a non "NOR_BOOT" version, I can boot u-boot and read / write to the NOR device (located at 0x08000000). So I've compiled my "NOR_BOOT" version and stored it at the start of the flash device. But when I switch to booting from NOR (rather than SD) I get no output on the serial console. Using an oscilloscope, I can see the NOR chip select is active for a while (approx 350us), so *something* is trying to boot. How can I debug such an early part of the boot process ? Thanks for any help you can give me. Regards Mark J.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/17/2013 10:43 AM, Mark Jackson wrote: > On 13/05/13 19:28, Tom Rini wrote: >> From: Steve Kipisz <s-kipisz2@ti.com> >> >> NOR requires that s_init be within the first 4KiB of the image so >> that we can perform the rest of the required pinmuxing to talk >> with the rest of NOR that we are found on. When NOR_BOOT is set >> we save our environment in NOR at 512KiB and a redundant copy at >> 768KiB. We avoid using SPL for this case and u-boot.bin is >> written directly to the start of NOR. > > I'm trying to get this up and running our NanoBone platform, but > I'm having no success. > > Using a non "NOR_BOOT" version, I can boot u-boot and read / write > to the NOR device (located at 0x08000000). > > So I've compiled my "NOR_BOOT" version and stored it at the start > of the flash device. > > But when I switch to booting from NOR (rather than SD) I get no > output on the serial console. > > Using an oscilloscope, I can see the NOR chip select is active for > a while (approx 350us), so *something* is trying to boot. > > How can I debug such an early part of the boot process ? Did you copy the parts that setup the pinmuxing in s_init for NOR? - -- Tom -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJRvyIDAAoJENk4IS6UOR1W0v4P/0Nudkj1/7PhxndIRr3z1pXa pbEDg3leDIiWHgoM5Z1Ruxti6s6l2LH+vzZ15Sl2XF4xrU8BQ6pxdBuMpbluiv2W ePr3P2iQ/C67pT5WqXwXO2uIXzTxtUWNc6VOcd1ejDUWfHOAPZjWa7ObpPnklc/o pGkN01xYuv+9Na/aLPVO2fB9KPE0t1xiVrAwReWaEGC8JaOMCN7XFslYjKSBOkRh yai3NycmR6N12JcZVvzpRkA5WbcI4GdGC0TK/RywmF3bP6DdgNmc1GMCfKyQRs0c h26S87AzUO4NyoEfecExLEhS8eP3LU0I5um2tp0kbLBOX/Wdy6hQ/Vn/LNGGFrDs +urLVetNZweznxlyDn+dtxvo7dEQyiiIHN0xzOVwONUhz9mTnhDk8HBQAPRAqwOK PVom+jNaG9UYxks4S0qjJvSiJR4VqvYdlOqMxwfPphIb0Nt1a/cVnhm7PCwWvvw2 q3bOAxq11+5aRDeBCOG+8rdFqotgXZ7ig4vwFb5qg4AFJE7wbJLoyAgxhO2o4KNe Opa8DZsA4Joier1tC2fVuqPcl00tsg9JOqMDug4pgKyCz0EGWtREgy4/KKLT0/9J JBXrv6h3D+tfUbNjNR7b5seMhK3WxYAMQQwgDGSLgs5Vwnydz5iI0Vp3xH21HSar 2SxW1hU4pMkAjBm2V4OA =BJ51 -----END PGP SIGNATURE-----
On 17/06/13 15:49, Tom Rini wrote:
<snip>
> Did you copy the parts that setup the pinmuxing in s_init for NOR?
This bit ?
#ifdef CONFIG_NOR_BOOT
asm("stmfd sp!, {r2 - r4}");
asm("movw r4, #0x8A4");
asm("movw r3, #0x44E1");
asm("orr r4, r4, r3, lsl #16");
asm("mov r2, #9");
asm("mov r3, #8");
asm("gpmc_mux: str r2, [r4], #4");
asm("subs r3, r3, #1");
asm("bne gpmc_mux");
asm("ldmfd sp!, {r2 - r4}");
#endif
Yes ... :-)
Mark J.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/17/2013 10:59 AM, Mark Jackson wrote: > On 17/06/13 15:49, Tom Rini wrote: > > <snip> > >> Did you copy the parts that setup the pinmuxing in s_init for >> NOR? > > This bit ? > > #ifdef CONFIG_NOR_BOOT asm("stmfd sp!, {r2 - r4}"); asm("movw > r4, #0x8A4"); asm("movw r3, #0x44E1"); asm("orr r4, > r4, r3, lsl #16"); asm("mov r2, #9"); asm("mov r3, > #8"); asm("gpmc_mux: str r2, [r4], #4"); asm("subs r3, > r3, #1"); asm("bne gpmc_mux"); asm("ldmfd sp!, {r2 - > r4}"); #endif > > Yes ... :-) Right. Well, baring hints from Steve, time to hook up the JTAG and see where it's stuck. - -- Tom -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJRvyThAAoJENk4IS6UOR1WiuAP/0EYvMxbkfhncVCqIG6cPmi2 8+LM+VXNqJFice+WtD0peDZ6fh8HQHz9Dtehzd83J9dXea7W99mP6TvoYz/2x/q5 xyjtNwqiFdxCXLZB8qxRlaXLBMgT4KTBWV6SIk61PIhcIA46dX8pn8DT895Cx556 wHXFfvQEm8mK2unR5pNS4YBxtM/ka31bFQWpFUapDHhfkPnFHUhj98gl2C9JCpq3 Qa4UxcxsouXDGwzoa3nkhiss+HDdj2jEiDviNXPtq5wdzpjNGXz2GGlL7yL1aLOy m+ewBadFiRxIhZAozDKyS4w7W5OndtTBVQrLKZWiHct2r1Ui1hrQCrazMWbs7Wzn 8usWKjElFr0uowcooRQ6IuHNsBxzT+ZSc+wVOKQOgemhSmLrLwXS+x3FgA8VW1eC q2ijx/TzadorX4ZyiRyWSiYxgc6W84yZjhEAJ6TRYeVuN06iww5AFkNlpfMkrtqy Pxem7TIhrP9eoUjGkLnTVIcAUmctrymekSh7B+fq3CKOrYDyCy2bqSsQzvALs3o7 o635vX97jdwNGUUQGwCholDqijFq9d5kR5yXFpcYP+0f0SCqDG6VmueW80EYaMnL J7GeL1LIl09yKtTyTkZlL7JSuArKPerKTj5UwYGsvml99I+9E2f4bpvI7213MlnM fh1BoB9u3nteGEG25HUH =DrWl -----END PGP SIGNATURE-----
On 17/06/13 16:01, Tom Rini wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 06/17/2013 10:59 AM, Mark Jackson wrote: >> On 17/06/13 15:49, Tom Rini wrote: >> >> <snip> >> >>> Did you copy the parts that setup the pinmuxing in s_init for >>> NOR? >> >> This bit ? >> >> #ifdef CONFIG_NOR_BOOT asm("stmfd sp!, {r2 - r4}"); asm("movw >> r4, #0x8A4"); asm("movw r3, #0x44E1"); asm("orr r4, >> r4, r3, lsl #16"); asm("mov r2, #9"); asm("mov r3, >> #8"); asm("gpmc_mux: str r2, [r4], #4"); asm("subs r3, >> r3, #1"); asm("bne gpmc_mux"); asm("ldmfd sp!, {r2 - >> r4}"); #endif >> >> Yes ... :-) > > Right. Well, baring hints from Steve, time to hook up the JTAG and > see where it's stuck. Urm ... unfortunately, we have no JTAG on this board ... :-(
On 17/06/13 15:59, Mark Jackson wrote: > On 17/06/13 15:49, Tom Rini wrote: > > <snip> > >> Did you copy the parts that setup the pinmuxing in s_init for NOR? > > This bit ? > > #ifdef CONFIG_NOR_BOOT > asm("stmfd sp!, {r2 - r4}"); > asm("movw r4, #0x8A4"); > asm("movw r3, #0x44E1"); > asm("orr r4, r4, r3, lsl #16"); > asm("mov r2, #9"); > asm("mov r3, #8"); > asm("gpmc_mux: str r2, [r4], #4"); > asm("subs r3, r3, #1"); > asm("bne gpmc_mux"); > asm("ldmfd sp!, {r2 - r4}"); > #endif > > Yes ... :-) > Below is my entire s_init() routine. One question ... the SPL code has:- ... gd = &gdata; ... But there seems to be no similar assignment when in NOR boot mode. I'm no expert in the internal workings of u-boot, so I thought I'd check, just in case !?! Cheers Mark J. --- void s_init(void) { /* * The ROM will only have set up sufficient pinmux to allow for the * first 4KiB NOR to be read, we must finish doing what we know of * the NOR mux in this space in order to continue. */ #ifdef CONFIG_NOR_BOOT asm("stmfd sp!, {r2 - r4}"); asm("movw r4, #0x8A4"); asm("movw r3, #0x44E1"); asm("orr r4, r4, r3, lsl #16"); asm("mov r2, #9"); asm("mov r3, #8"); asm("gpmc_mux: str r2, [r4], #4"); asm("subs r3, r3, #1"); asm("bne gpmc_mux"); asm("ldmfd sp!, {r2 - r4}"); #endif /* * Save the boot parameters passed from romcode. * We cannot delay the saving further than this, * to prevent overwrites. */ #if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT) save_omap_boot_params(); #endif /* WDT1 is already running when the bootloader gets control * Disable it to avoid "random" resets */ writel(0xAAAA, &wdtimer->wdtwspr); while (readl(&wdtimer->wdtwwps) != 0x0) ; writel(0x5555, &wdtimer->wdtwspr); while (readl(&wdtimer->wdtwwps) != 0x0) ; #if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT) /* Setup the PLLs and the clocks for the peripherals */ pll_init(); /* Enable RTC32K clock */ rtc32k_enable(); enable_board_pin_mux(); /* UART softreset */ u32 regVal; regVal = readl(&uart_base->uartsyscfg); regVal |= UART_RESET; writel(regVal, &uart_base->uartsyscfg); while ((readl(&uart_base->uartsyssts) & UART_CLK_RUNNING_MASK) != UART_CLK_RUNNING_MASK) ; /* Disable smart idle */ regVal = readl(&uart_base->uartsyscfg); regVal |= UART_SMART_IDLE_EN; writel(regVal, &uart_base->uartsyscfg); #if defined(CONFIG_NOR_BOOT) /* We want our console now. */ gd->baudrate = CONFIG_BAUDRATE; serial_init(); gd->have_console = 1; puts("\nU-Boot NOR Boot\n"); #else gd = &gdata; preloader_console_init(); #endif config_ddr(303, MT41J128MJT125_IOCTRL_VALUE, &ddr3_data, &ddr3_cmd_ctrl_data, &ddr3_emif_reg_data, 0); i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); #endif /* CONFIG_SPL_BUILD */ }
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/17/2013 11:23 AM, Mark Jackson wrote: > On 17/06/13 15:59, Mark Jackson wrote: >> On 17/06/13 15:49, Tom Rini wrote: >> >> <snip> >> >>> Did you copy the parts that setup the pinmuxing in s_init for >>> NOR? >> >> This bit ? >> >> #ifdef CONFIG_NOR_BOOT asm("stmfd sp!, {r2 - r4}"); >> asm("movw r4, #0x8A4"); asm("movw r3, #0x44E1"); >> asm("orr r4, r4, r3, lsl #16"); asm("mov r2, #9"); >> asm("mov r3, #8"); asm("gpmc_mux: str r2, [r4], >> #4"); asm("subs r3, r3, #1"); asm("bne gpmc_mux"); >> asm("ldmfd sp!, {r2 - r4}"); #endif >> >> Yes ... :-) >> > > Below is my entire s_init() routine. > > One question ... the SPL code has:- > > ... gd = &gdata; ... > > But there seems to be no similar assignment when in NOR boot mode. > I'm no expert in the internal workings of u-boot, so I thought I'd > check, just in case !?! Maybe some of the recent changes broke things? I recall having to take a bit to track down where gd is assigned in the non-SPL case before.. - -- Tom -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJRvytfAAoJENk4IS6UOR1WisEQAJo4jQDfFMdVE9G/KiCphySx 0Y0YwQ7uR5eEktUIQ6P9a+Hcy5ipom4i1cQszUTBjfQgcL6NCD9ta98hdf9aXti/ Rtmn65Yt4+YSRmcRbLDvzqyRw4Z0tUPvwEZrur9dzGkwdTcGe/aW1edKPUUdkSiA 4CfkZo8bQOPPJJB/GF/rIvdLrKNpGBL4gy0LtwKsyduXNiqhXXI4Y/2hMHbafFgV ZTpZylHTfm/3esNmyv2Es9Ftsxq52tVGIr488RMibrzPj/ERIl3Whpn0HmPd3ew0 irn+MVPzO6aRCE4HyM+43KI4/7cM6HuX97jxML5BmLNAD3b06DM+J2R8HLr+MVwb 9sv8PPxLcPfvDqujAQtzj8LQSyEbHajXG5y42ZB3V0afBIjVjPJ8FRtD88LjDvXJ PmiaX2wBGnYCg+9q+xeF/4J3FqO1BvCSqxzNHJo2U1YrQFxMzIgl9Rvoh9pXUoVh U8fIdQnSw6r9w+FKIVlpAKLNw8Ed8xWjPsZgSzRKdmZnJfvTR+XfVVNK3z1b5dc+ ogeky/Jtn1qffOyOOrOG1vGtXE+HHWRqYDK4FFb3wv6puxZbJpakV4Rj+x1qkU9F AULG/z9cjDrSo2xZtjyCF9/I2fHq9X7NX0AxdVUqezNR0V0E8JQ28cTK8ywQuJkr itP0oHGBqU0o/Ty+q92O =sPuh -----END PGP SIGNATURE-----
Hi Mark, On 17.06.2013 17:23, Mark Jackson wrote: > On 17/06/13 15:59, Mark Jackson wrote: >> On 17/06/13 15:49, Tom Rini wrote: >> >> <snip> >> >>> Did you copy the parts that setup the pinmuxing in s_init for NOR? >> >> This bit ? >> >> #ifdef CONFIG_NOR_BOOT >> asm("stmfd sp!, {r2 - r4}"); >> asm("movw r4, #0x8A4"); >> asm("movw r3, #0x44E1"); >> asm("orr r4, r4, r3, lsl #16"); >> asm("mov r2, #9"); >> asm("mov r3, #8"); >> asm("gpmc_mux: str r2, [r4], #4"); >> asm("subs r3, r3, #1"); >> asm("bne gpmc_mux"); >> asm("ldmfd sp!, {r2 - r4}"); >> #endif >> >> Yes ... :-) >> > > Below is my entire s_init() routine. > > One question ... the SPL code has:- > > ... > gd = &gdata; > ... > > But there seems to be no similar assignment when in NOR boot mode. > I'm no expert in the internal workings of u-boot, so I thought I'd > check, just in case !?! I just noticed you mentioning "gd" here and wanted to point you to a patch that fixed a gd-related boot issue for me on OMAP3: [U-Boot] [PATCH 1/3] arm: spl: Fix SPL booting for OMAP3 (sorry, I can't find a link to this patch right now and I'm in a hurry) Not sure if this has something to do with your problem (I don't have the time to dig into this mail thread today as I'm leaving right now). Cheers, Stefan
On 17/06/13 17:01, Stefan Roese wrote: > Hi Mark, > > On 17.06.2013 17:23, Mark Jackson wrote: <snip> >> One question ... the SPL code has:- >> >> ... >> gd = &gdata; >> ... >> >> But there seems to be no similar assignment when in NOR boot mode. >> I'm no expert in the internal workings of u-boot, so I thought I'd >> check, just in case !?! > > I just noticed you mentioning "gd" here and wanted to point you to a > patch that fixed a gd-related boot issue for me on OMAP3: > > [U-Boot] [PATCH 1/3] arm: spl: Fix SPL booting for OMAP3 > > (sorry, I can't find a link to this patch right now and I'm in a hurry) > > Not sure if this has something to do with your problem (I don't have the > time to dig into this mail thread today as I'm leaving right now). I'll look at that thanks. But I've taken a slightly different approach, and added the following to the start of s_init() ... void s_init(void) { unsigned short *p = (unsigned short*)0x08000000; while (1) { int i; for (i = 0; i < (1 * 1024); i++) { unsigned short d = p[i]; d++; *p = d; } } ... AFAICT, that should just spin on reading/writing the NOR device, but I still get only an initial 350us burst on the CS0 line, and then nothing. So I can only assume that the boot code isn't getting as far as s_init() at all !! In start.S and low_levelinit.c, there are various uses of:- #ifdef CONFIG_SPL_BUILD Do any of these also need referencing with a CONFIG_NOR_BOOT ? Mark J.
> -----Original Message----- > From: Mark Jackson [mailto:mpfj-list@newflow.co.uk] > Sent: Monday, June 17, 2013 11:10 AM > To: Stefan Roese > Cc: Rini, Tom; Kipisz, Steven; u-boot@lists.denx.de > Subject: Re: [U-Boot] [PATCH v2 7/7] am335x_evm: Add support to boot > from NOR. > > On 17/06/13 17:01, Stefan Roese wrote: > > Hi Mark, > > > > On 17.06.2013 17:23, Mark Jackson wrote: > > <snip> > > >> One question ... the SPL code has:- > >> > >> ... > >> gd = &gdata; > >> ... > >> > >> But there seems to be no similar assignment when in NOR boot mode. > >> I'm no expert in the internal workings of u-boot, so I thought I'd > >> check, just in case !?! > > > > I just noticed you mentioning "gd" here and wanted to point you to a > > patch that fixed a gd-related boot issue for me on OMAP3: > > > > [U-Boot] [PATCH 1/3] arm: spl: Fix SPL booting for OMAP3 > > > > (sorry, I can't find a link to this patch right now and I'm in a > > hurry) > > > > Not sure if this has something to do with your problem (I don't have > > the time to dig into this mail thread today as I'm leaving right now). > > I'll look at that thanks. > > But I've taken a slightly different approach, and added the following to the > start of s_init() ... > > > > void s_init(void) > { > unsigned short *p = (unsigned short*)0x08000000; > while (1) > { > int i; > for (i = 0; i < (1 * 1024); i++) > { > unsigned short d = p[i]; > d++; > *p = d; > } > } > ... > > AFAICT, that should just spin on reading/writing the NOR device, but I still get > only an initial 350us burst on the CS0 line, and then nothing. > > So I can only assume that the boot code isn't getting as far as > s_init() at all !! > > In start.S and low_levelinit.c, there are various uses of:- > > #ifdef CONFIG_SPL_BUILD > > Do any of these also need referencing with a CONFIG_NOR_BOOT ? > > Mark J. Do you have a u-boot.lds in board/ti/am335x? That should put s_init() earlier in the boot. Also, include/configs/am335x_evm.h should have /* Custom script for NOR */ #define CONFIG_SYS_LDSCRIPT "board/ti/am335x/u-boot.lds" Before using JTAG, take a look in System.map where s_init is located. For a multiplex NOR it should be in the first 64K of address space. Steve K.
On 17/06/13 18:04, Kipisz, Steven wrote: <snip> >> I'll look at that thanks. >> >> But I've taken a slightly different approach, and added the following to the >> start of s_init() ... >> >> >> >> void s_init(void) >> { >> unsigned short *p = (unsigned short*)0x08000000; >> while (1) >> { >> int i; >> for (i = 0; i < (1 * 1024); i++) >> { >> unsigned short d = p[i]; >> d++; >> *p = d; >> } >> } >> ... >> >> AFAICT, that should just spin on reading/writing the NOR device, but I still get >> only an initial 350us burst on the CS0 line, and then nothing. >> >> So I can only assume that the boot code isn't getting as far as >> s_init() at all !! >> >> In start.S and low_levelinit.c, there are various uses of:- >> >> #ifdef CONFIG_SPL_BUILD >> >> Do any of these also need referencing with a CONFIG_NOR_BOOT ? >> >> Mark J. > > Do you have a u-boot.lds in board/ti/am335x? That should put s_init() earlier in the boot. Also, include/configs/am335x_evm.h should have > /* Custom script for NOR */ > #define CONFIG_SYS_LDSCRIPT "board/ti/am335x/u-boot.lds" Yes ... I have both u-boot.lds in my board directory, and the reference to it in the config. #define CONFIG_SYS_LDSCRIPT "board/newflow/nanobone/u-boot.lds" > Before using JTAG, take a look in System.map where s_init is located. For a multiplex NOR it should be in the first 64K of address space. That all seems in order ... 08000000 T __image_copy_start 08000000 T _start 08000020 t _undefined_instruction 08000024 t _software_interrupt 08000028 t _prefetch_abort 0800002c t _data_abort 08000030 t _not_used 08000034 t _irq 08000038 t _fiq 0800003c t _pad 08000040 T _TEXT_BASE 08000040 T _end_vect 08000044 T _bss_start_ofs 08000048 T _bss_end_ofs 0800004c T _end_ofs 08000050 T IRQ_STACK_START_IN 08000054 t reset 08000094 T c_runtime_cpu_setup 080000b0 T cpu_init_cp15 080000e8 T cpu_init_crit 08000100 t undefined_instruction 08000160 t software_interrupt 080001c0 t prefetch_abort 08000220 t data_abort 08000280 t not_used 080002e0 t irq 08000340 t fiq 080003a0 T enable_board_pin_mux 08000444 t cpsw_control 08000448 T s_init <<<<<<<<<<<<<<<<<<<<<<<<< 08000464 t gpmc_mux 08000568 T board_init 080005d8 T board_late_init 0800060c T board_eth_init 0800076c T enable_gpmc_cs_config 080007e0 T gpmc_init ...
On 17/06/13 15:43, Mark Jackson wrote: > On 13/05/13 19:28, Tom Rini wrote: >> From: Steve Kipisz <s-kipisz2@ti.com> >> >> NOR requires that s_init be within the first 4KiB of the image so that >> we can perform the rest of the required pinmuxing to talk with the rest >> of NOR that we are found on. When NOR_BOOT is set we save our >> environment in NOR at 512KiB and a redundant copy at 768KiB. We avoid >> using SPL for this case and u-boot.bin is written directly to the start >> of NOR. > > I'm trying to get this up and running our NanoBone platform, but I'm having > no success. Just an update ... I now have it working ... yay !! The main (and possibly the *only*) culprit was that SYSBOOT[8] (which selects 8/16bit mode) was being incorrectly influenced by a hardware fault. I have pulled quite a few patches from various places, some of which might not be required. Now I have a working base, I'll work out what is needed on top of Tom's original patch set. Thanks for everyone's support. Mark J.
diff --git a/arch/arm/cpu/armv7/am33xx/emif4.c b/arch/arm/cpu/armv7/am33xx/emif4.c index aa84e96..370230b 100644 --- a/arch/arm/cpu/armv7/am33xx/emif4.c +++ b/arch/arm/cpu/armv7/am33xx/emif4.c @@ -43,9 +43,11 @@ void dram_init_banksize(void) } -#ifdef CONFIG_SPL_BUILD +#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT) +#ifdef CONFIG_TI81XX static struct dmm_lisa_map_regs *hw_lisa_map_regs = (struct dmm_lisa_map_regs *)DMM_BASE; +#endif static struct vtp_reg *vtpreg[2] = { (struct vtp_reg *)VTP0_CTRL_ADDR, (struct vtp_reg *)VTP1_CTRL_ADDR}; @@ -53,6 +55,7 @@ static struct vtp_reg *vtpreg[2] = { static struct ddr_ctrl *ddrctrl = (struct ddr_ctrl *)DDR_CTRL_ADDR; #endif +#ifdef CONFIG_TI81XX void config_dmm(const struct dmm_lisa_map_regs *regs) { enable_dmm_clocks(); @@ -67,6 +70,7 @@ void config_dmm(const struct dmm_lisa_map_regs *regs) writel(regs->dmm_lisa_map_1, &hw_lisa_map_regs->dmm_lisa_map_1); writel(regs->dmm_lisa_map_0, &hw_lisa_map_regs->dmm_lisa_map_0); } +#endif static void config_vtp(int nr) { diff --git a/board/ti/am335x/Makefile b/board/ti/am335x/Makefile index 67a87a1..1795e3e 100644 --- a/board/ti/am335x/Makefile +++ b/board/ti/am335x/Makefile @@ -18,7 +18,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).o -ifdef CONFIG_SPL_BUILD +ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_NOR_BOOT),y) COBJS := mux.o endif diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 3660655..69b8e0d 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -39,7 +39,7 @@ DECLARE_GLOBAL_DATA_PTR; static struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE; -#ifdef CONFIG_SPL_BUILD +#if defined(CONFIG_SPL_BUILD) || (CONFIG_NOR_BOOT) static struct uart_sys *uart_base = (struct uart_sys *)DEFAULT_UART_BASE; #endif @@ -95,7 +95,7 @@ static int read_eeprom(struct am335x_baseboard_id *header) } /* UART Defines */ -#ifdef CONFIG_SPL_BUILD +#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT) #define UART_RESET (0x1 << 1) #define UART_CLK_RUNNING_MASK 0x1 #define UART_SMART_IDLE_EN (0x1 << 0x3) @@ -274,6 +274,24 @@ void s_init(void) { __maybe_unused struct am335x_baseboard_id header; + /* + * The ROM will only have set up sufficient pinmux to allow for the + * first 4KiB NOR to be read, we must finish doing what we know of + * the NOR mux in this space in order to continue. + */ +#ifdef CONFIG_NOR_BOOT + asm("stmfd sp!, {r2 - r4}"); + asm("movw r4, #0x8A4"); + asm("movw r3, #0x44E1"); + asm("orr r4, r4, r3, lsl #16"); + asm("mov r2, #9"); + asm("mov r3, #8"); + asm("gpmc_mux: str r2, [r4], #4"); + asm("subs r3, r3, #1"); + asm("bne gpmc_mux"); + asm("ldmfd sp!, {r2 - r4}"); +#endif + /* WDT1 is already running when the bootloader gets control * Disable it to avoid "random" resets */ @@ -284,7 +302,7 @@ void s_init(void) while (readl(&wdtimer->wdtwwps) != 0x0) ; -#ifdef CONFIG_SPL_BUILD +#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_NOR_BOOT) /* Setup the PLLs and the clocks for the peripherals */ pll_init(); @@ -325,9 +343,16 @@ void s_init(void) regVal |= UART_SMART_IDLE_EN; writel(regVal, &uart_base->uartsyscfg); +#if defined(CONFIG_NOR_BOOT) + /* We want our console now. */ + gd->baudrate = CONFIG_BAUDRATE; + serial_init(); + gd->have_console = 1; +#else gd = &gdata; preloader_console_init(); +#endif /* Initalize the board header */ enable_i2c0_pin_mux(); diff --git a/board/ti/am335x/mux.c b/board/ti/am335x/mux.c index 187468e..5b7ed63 100644 --- a/board/ti/am335x/mux.c +++ b/board/ti/am335x/mux.c @@ -190,7 +190,7 @@ static struct module_pin_mux nand_pin_mux[] = { {-1}, }; -#if defined(CONFIG_NOR) +#if defined(CONFIG_NOR) && !defined(CONFIG_NOR_BOOT) static struct module_pin_mux bone_norcape_pin_mux[] = { {OFFSET(lcd_data0), MODE(1) | PULLUDEN | RXACTIVE}, /* NOR_A0 */ {OFFSET(lcd_data1), MODE(1) | PULLUDEN | RXACTIVE}, /* NOR_A1 */ @@ -317,8 +317,10 @@ void enable_board_pin_mux(struct am335x_baseboard_id *header) configure_module_pin_mux(i2c1_pin_mux); configure_module_pin_mux(mii1_pin_mux); configure_module_pin_mux(mmc0_pin_mux); +#ifndef CONFIG_NOR configure_module_pin_mux(mmc1_pin_mux); -#if defined(CONFIG_NOR) +#endif +#if defined(CONFIG_NOR) && !defined(CONFIG_NOR_BOOT) configure_module_pin_mux(bone_norcape_pin_mux); #endif } else if (board_is_gp_evm(header)) { diff --git a/board/ti/am335x/u-boot.lds b/board/ti/am335x/u-boot.lds new file mode 100644 index 0000000..d376743 --- /dev/null +++ b/board/ti/am335x/u-boot.lds @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2004-2008 Texas Instruments + * + * (C) Copyright 2002 + * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(_start) +SECTIONS +{ + . = 0x00000000; + + . = ALIGN(4); + .text : + { + __image_copy_start = .; + CPUDIR/start.o (.text*) + board/ti/am335x/libam335x.o (.text*) + *(.text*) + } + + . = ALIGN(4); + .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } + + . = ALIGN(4); + .data : { + *(.data*) + } + + . = ALIGN(4); + + . = .; + + . = ALIGN(4); + .u_boot_list : { + KEEP(*(SORT(.u_boot_list*))); + } + + . = ALIGN(4); + + __image_copy_end = .; + + .rel.dyn : { + __rel_dyn_start = .; + *(.rel*) + __rel_dyn_end = .; + } + + .dynsym : { + __dynsym_start = .; + *(.dynsym) + } + + _end = .; + + /* + * Deprecated: this MMU section is used by pxa at present but + * should not be used by new boards/CPUs. + */ + . = ALIGN(4096); + .mmutable : { + *(.mmutable) + } + +/* + * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c + * __bss_base and __bss_limit are for linker only (overlay ordering) + */ + + .bss_start __rel_dyn_start (OVERLAY) : { + KEEP(*(.__bss_start)); + __bss_base = .; + } + + .bss __bss_base (OVERLAY) : { + *(.bss*) + . = ALIGN(4); + __bss_limit = .; + } + + .bss_end __bss_limit (OVERLAY) : { + KEEP(*(.__bss_end)); + } + + /DISCARD/ : { *(.dynstr*) } + /DISCARD/ : { *(.dynamic*) } + /DISCARD/ : { *(.plt*) } + /DISCARD/ : { *(.interp*) } + /DISCARD/ : { *(.gnu*) } +} diff --git a/boards.cfg b/boards.cfg index d74840d..90e018f 100644 --- a/boards.cfg +++ b/boards.cfg @@ -237,6 +237,7 @@ integratorcp_cm946es arm arm946es integrator armltd ca9x4_ct_vxp arm armv7 vexpress armltd am335x_evm arm armv7 am335x ti am33xx am335x_evm:SERIAL1,CONS_INDEX=1 am335x_evm_nor arm armv7 am335x ti am33xx am335x_evm:SERIAL1,CONS_INDEX=1,NOR +am335x_evm_norboot arm armv7 am335x ti am33xx am335x_evm:SERIAL1,CONS_INDEX=1,NOR,NOR_BOOT am335x_evm_spiboot arm armv7 am335x ti am33xx am335x_evm:SERIAL1,CONS_INDEX=1,SPI_BOOT am335x_evm_uart1 arm armv7 am335x ti am33xx am335x_evm:SERIAL2,CONS_INDEX=2 am335x_evm_uart2 arm armv7 am335x ti am33xx am335x_evm:SERIAL3,CONS_INDEX=3 diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index b4d57e1..f246111 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -39,6 +39,9 @@ #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_INITRD_TAG +/* Custom script for NOR */ +#define CONFIG_SYS_LDSCRIPT "board/ti/am335x/u-boot.lds" + #define CONFIG_SYS_CACHELINE_SIZE 64 /* commands to include */ @@ -300,6 +303,7 @@ #define CONFIG_ENV_OVERWRITE 1 #define CONFIG_SYS_CONSOLE_INFO_QUIET +#ifndef CONFIG_NOR_BOOT /* Defines for SPL */ #define CONFIG_SPL #define CONFIG_SPL_FRAMEWORK @@ -344,6 +348,7 @@ #define CONFIG_SPL_NAND_DRIVERS #define CONFIG_SPL_NAND_ECC #endif +#endif #define CONFIG_SYS_NAND_5_ADDR_CYCLE #define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \ CONFIG_SYS_NAND_PAGE_SIZE) @@ -376,14 +381,18 @@ * header. That is 0x800FFFC0--0x80100000 should not be used for any * other needs. */ +#ifdef CONFIG_NOR_BOOT +#define CONFIG_SYS_TEXT_BASE 0x08000000 +#else #define CONFIG_SYS_TEXT_BASE 0x80800000 +#endif #define CONFIG_SYS_SPL_MALLOC_START 0x80208000 #define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000 /* Since SPL did pll and ddr initialization for us, * we don't need to do it twice. */ -#ifndef CONFIG_SPL_BUILD +#if !defined(CONFIG_SPL_BUILD) && !defined(CONFIG_NOR_BOOT) #define CONFIG_SKIP_LOWLEVEL_INIT #endif @@ -468,7 +477,7 @@ #define CONFIG_PHY_ADDR 0 #define CONFIG_PHY_SMSC -#if !defined(CONFIG_SPI_BOOT) +#if !defined(CONFIG_SPI_BOOT) && !defined(CONFIG_NOR_BOOT) #define CONFIG_NAND #endif @@ -518,6 +527,19 @@ #define CONFIG_SYS_FLASH_BASE (0x08000000) #define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE +#ifdef CONFIG_NOR_BOOT +#define CONFIG_ENV_IS_IN_FLASH +#define CONFIG_ENV_SECT_SIZE (128 << 10) /* 128 KiB */ +#define CONFIG_ENV_OFFSET (512 << 10) /* 512 KiB */ +#define CONFIG_ENV_OFFSET_REDUND (768 << 10) /* 768 KiB */ +#define CONFIG_CMD_MTDPARTS +#define MTDIDS_DEFAULT "nor0=physmap-flash.0" +#define MTDPARTS_DEFAULT "mtdparts=physmap-flash.0:" \ + "512k(u-boot)," \ + "128k(u-boot-env1)," \ + "128k(u-boot-env2)," \ + "4m(kernel),-(rootfs)" +#endif #define CONFIG_MTD_DEVICE #define CONFIG_CMD_FLASH #endif /* NOR support */