[U-Boot] [PATCH 3/4] ARM: AM33xx: Move s_init to a common place
From: Heiko Schocher h...@denx.de s_init has the same outline for all the AM33xx based board. So making it generic. This also helps in addition of new Soc with minimal changes. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com Signed-off-by: Heiko Schocher h...@denx.de Signed-off-by: Tom Rini tr...@ti.com --- arch/arm/cpu/armv7/am33xx/board.c| 46 +-- arch/arm/cpu/armv7/am33xx/clock_ti814x.c |6 ++ arch/arm/cpu/armv7/am33xx/emif4.c|6 +- arch/arm/include/asm/arch-am33xx/clocks_am33xx.h |6 +- arch/arm/include/asm/arch-am33xx/sys_proto.h |5 +- board/isee/igep0033/board.c | 49 +++- board/phytec/pcm051/board.c | 48 +++- board/ti/am335x/board.c | 52 +++-- board/ti/ti814x/evm.c| 67 +++--- 9 files changed, 90 insertions(+), 195 deletions(-) diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c index 1d743d6..3d08673 100644 --- a/arch/arm/cpu/armv7/am33xx/board.c +++ b/arch/arm/cpu/armv7/am33xx/board.c @@ -145,7 +145,7 @@ int arch_misc_init(void) } #ifdef CONFIG_SPL_BUILD -void rtc32k_enable(void) +static void rtc32k_enable(void) { struct rtc_regs *rtc = (struct rtc_regs *)RTC_BASE; @@ -161,11 +161,7 @@ void rtc32k_enable(void) writel((1 3) | (1 6), rtc-osc); } -#define UART_RESET (0x1 1) -#define UART_CLK_RUNNING_MASK 0x1 -#define UART_SMART_IDLE_EN (0x1 0x3) - -void uart_soft_reset(void) +static void uart_soft_reset(void) { struct uart_sys *uart_base = (struct uart_sys *)DEFAULT_UART_BASE; u32 regval; @@ -182,4 +178,42 @@ void uart_soft_reset(void) regval |= UART_SMART_IDLE_EN; writel(regval, uart_base-uartsyscfg); } + +static void watchdog_disable(void) +{ + struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE; + + writel(0x, wdtimer-wdtwspr); + while (readl(wdtimer-wdtwwps) != 0x0) + ; + writel(0x, wdtimer-wdtwspr); + while (readl(wdtimer-wdtwwps) != 0x0) + ; +} #endif + +void s_init(void) +{ + /* +* Save the boot parameters passed from romcode. +* We cannot delay the saving further than this, +* to prevent overwrites. +*/ +#ifdef CONFIG_SPL_BUILD + save_omap_boot_params(); + watchdog_disable(); + timer_init(); + set_uart_mux_conf(); + setup_clocks_for_console(); + uart_soft_reset(); + + gd = gdata; + preloader_console_init(); + + prcm_init(); + set_mux_conf_regs(); + /* Enable RTC32K clock */ + rtc32k_enable(); + sdram_init(); +#endif +} diff --git a/arch/arm/cpu/armv7/am33xx/clock_ti814x.c b/arch/arm/cpu/armv7/am33xx/clock_ti814x.c index 1a23746..ca7d7ad 100644 --- a/arch/arm/cpu/armv7/am33xx/clock_ti814x.c +++ b/arch/arm/cpu/armv7/am33xx/clock_ti814x.c @@ -285,6 +285,12 @@ static void enable_per_clocks(void) writel(PRCM_MOD_EN, cmalwon-ethernet1clkctrl); while ((readl(cmalwon-ethernet1clkctrl) ENET_CLKCTRL_CMPL) != 0) ; + + /* RTC clocks */ + writel(PRCM_MOD_EN, cmalwon-rtcclkstctrl); + writel(PRCM_MOD_EN, cmalwon-rtcclkctrl); + while (readl(cmalwon-rtcclkctrl) != PRCM_MOD_EN) + ; } /* diff --git a/arch/arm/cpu/armv7/am33xx/emif4.c b/arch/arm/cpu/armv7/am33xx/emif4.c index 47d3dee..3abb609 100644 --- a/arch/arm/cpu/armv7/am33xx/emif4.c +++ b/arch/arm/cpu/armv7/am33xx/emif4.c @@ -44,8 +44,6 @@ void dram_init_banksize(void) #ifdef CONFIG_SPL_BUILD -static struct dmm_lisa_map_regs *hw_lisa_map_regs = - (struct dmm_lisa_map_regs *)DMM_BASE; static struct vtp_reg *vtpreg[2] = { (struct vtp_reg *)VTP0_CTRL_ADDR, (struct vtp_reg *)VTP1_CTRL_ADDR}; @@ -53,6 +51,9 @@ static struct vtp_reg *vtpreg[2] = { static struct ddr_ctrl *ddrctrl = (struct ddr_ctrl *)DDR_CTRL_ADDR; #endif +#ifdef CONFIG_TI81XX +static struct dmm_lisa_map_regs *hw_lisa_map_regs = + (struct dmm_lisa_map_regs *)DMM_BASE; void config_dmm(const struct dmm_lisa_map_regs *regs) { enable_dmm_clocks(); @@ -67,6 +68,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/arch/arm/include/asm/arch-am33xx/clocks_am33xx.h b/arch/arm/include/asm/arch-am33xx/clocks_am33xx.h index 89b63d9..dc49e7e 100644 --- a/arch/arm/include/asm/arch-am33xx/clocks_am33xx.h +++ b/arch/arm/include/asm/arch-am33xx/clocks_am33xx.h @@ -24,8 +24,10 @@ #define CONFIG_SYS_MPUCLK 550 #endif -extern void pll_init(void); -extern void
Re: [U-Boot] [PATCH 3/4] ARM: AM33xx: Move s_init to a common place
Hello Lokesh, Am 24.06.2013 15:15, schrieb Lokesh Vutla: From: Heiko Schocher h...@denx.de s_init has the same outline for all the AM33xx based board. So making it generic. This also helps in addition of new Soc with minimal changes. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com Signed-off-by: Heiko Schocher h...@denx.de Signed-off-by: Tom Rini tr...@ti.com --- arch/arm/cpu/armv7/am33xx/board.c| 46 +-- arch/arm/cpu/armv7/am33xx/clock_ti814x.c |6 ++ arch/arm/cpu/armv7/am33xx/emif4.c|6 +- arch/arm/include/asm/arch-am33xx/clocks_am33xx.h |6 +- arch/arm/include/asm/arch-am33xx/sys_proto.h |5 +- board/isee/igep0033/board.c | 49 +++- board/phytec/pcm051/board.c | 48 +++- board/ti/am335x/board.c | 52 +++-- board/ti/ti814x/evm.c| 67 +++--- 9 files changed, 90 insertions(+), 195 deletions(-) diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c index 1d743d6..3d08673 100644 --- a/arch/arm/cpu/armv7/am33xx/board.c +++ b/arch/arm/cpu/armv7/am33xx/board.c @@ -145,7 +145,7 @@ int arch_misc_init(void) } #ifdef CONFIG_SPL_BUILD -void rtc32k_enable(void) +static void rtc32k_enable(void) { struct rtc_regs *rtc = (struct rtc_regs *)RTC_BASE; @@ -161,11 +161,7 @@ void rtc32k_enable(void) writel((1 3) | (1 6), rtc-osc); } -#define UART_RESET (0x1 1) -#define UART_CLK_RUNNING_MASK0x1 -#define UART_SMART_IDLE_EN (0x1 0x3) - -void uart_soft_reset(void) +static void uart_soft_reset(void) { struct uart_sys *uart_base = (struct uart_sys *)DEFAULT_UART_BASE; u32 regval; @@ -182,4 +178,42 @@ void uart_soft_reset(void) regval |= UART_SMART_IDLE_EN; writel(regval, uart_base-uartsyscfg); } + +static void watchdog_disable(void) +{ + struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE; + + writel(0x, wdtimer-wdtwspr); + while (readl(wdtimer-wdtwwps) != 0x0) + ; + writel(0x, wdtimer-wdtwspr); + while (readl(wdtimer-wdtwwps) != 0x0) + ; +} #endif + +void s_init(void) +{ + /* + * Save the boot parameters passed from romcode. + * We cannot delay the saving further than this, + * to prevent overwrites. + */ +#ifdef CONFIG_SPL_BUILD + save_omap_boot_params(); + watchdog_disable(); + timer_init(); + set_uart_mux_conf(); + setup_clocks_for_console(); + uart_soft_reset(); + + gd = gdata; + preloader_console_init(); + + prcm_init(); + set_mux_conf_regs(); + /* Enable RTC32K clock */ + rtc32k_enable(); I tried your patches on my three boards. The board with the rtc32k_enable() problem, did not work with them too :-( Maybe we make rtc32k_enable() weak in common code, and so I can make a board specific (dummy) function? [...] bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/4] ARM: AM33xx: Move s_init to a common place
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/24/2013 03:17 PM, Heiko Schocher wrote: Hello Lokesh, [snip] +/* Enable RTC32K clock */ + rtc32k_enable(); I tried your patches on my three boards. The board with the rtc32k_enable() problem, did not work with them too :-( Maybe we make rtc32k_enable() weak in common code, and so I can make a board specific (dummy) function? I'm not a big fan of this since without this kicked, you can't do PM. And we don't want to do it in the kernel as it takes a few seconds to settle. Kicking it in U-Boot means it will be settled by the time it's needed, if I recall things right. - -- Tom -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJRyJ6YAAoJENk4IS6UOR1WpRsP/id6+SDeuNpbq3+d2e4VXXii j4Wq9Sm0wKkzzg/TcDT3ycyp7EqfyaJnpYjRORMAUjNjVcGAqTrssYtnjYgTLZXS oAN9E4hv15bxUPJJs2+/aLsI8jaHQ8E6IzKI5qLfxOKZePMPhhXmCes4V4qrkpMQ BcwinNMgfcyiNhkiDX4MvdB/tnKpMddzK/3SjiokGvH7jESFUzxw26BzpOy6uD8j tFj4D/LRzRmGXp1YqdtdqIAy15oNmTmOfK9zwVDPKLs4NUDHLGBUE6sgQJ5JLxjT pbS3JzQLe57weuW7WbD6/2RN7sJXfeZR1OUgJxuSzw8JQVDvWpW+2BJLyzoyOO7x t2XeuVgEyNyEVBRDtoeQ42hLFyk3O5G/kvRfLqqH0jDFkQKkMXMBhs2Bo4HA+157 o+HbB7GZkwR5ZKx+8RqmhP9t+IQjb1A8dkD/4gA0U0bYhbj4XhJSsDYtw1DMjya2 gr19m4n0qaRcwsRWZKX0ZahcxqWFWoRiNFxIBOeFSpeilR9dxEA3xE9VMC0jTSKA 1Wgi+cyRICTqXFhhpNinK79aszHEVBcU+A1ZgmHtpvZ2UNh4V+uXE0ydWMLw61gT ZHfB96WmFWQItu40/DN9Fo3JbJcGPtRHoR9yYV52WFszFml6p5+y6BHrNQ6D0a7l 2/4y5iHiZ7b8xpQKZbAp =ZwYD -END PGP SIGNATURE- ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/4] ARM: AM33xx: Move s_init to a common place
Hello Tom, Am 24.06.2013 21:31, schrieb Tom Rini: On 06/24/2013 03:17 PM, Heiko Schocher wrote: Hello Lokesh, [snip] + /* Enable RTC32K clock */ + rtc32k_enable(); I tried your patches on my three boards. The board with the rtc32k_enable() problem, did not work with them too :-( Maybe we make rtc32k_enable() weak in common code, and so I can make a board specific (dummy) function? I'm not a big fan of this since without this kicked, you can't do PM. And we don't want to do it in the kernel as it takes a few seconds to settle. Kicking it in U-Boot means it will be settled by the time it's needed, if I recall things right. Hmm.. but on my board, the cpu hangs (not accessible through bdi anymore) if I access this registers ... looking still for an explanation ... Clocks are enabled, 24MHz (same as on am335x eval board) used ... I know, this is only a bugfix, without knowing the real reason ... bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/4] ARM: AM33xx: Move s_init to a common place
Hi Heiko, I followed the same steps that you mentioned, but still i have same problem. During get uboot-spl.bin from uart, system become hanged and it is not ready to receive u-boot.img. Still compiling to uboot, i had to comment rtc32k_enable() function. then it is working fine. Thanks Regards ~Sumit On Tue, Jun 25, 2013 at 1:14 AM, Heiko Schocher h...@denx.de wrote: Hello Tom, Am 24.06.2013 21:31, schrieb Tom Rini: On 06/24/2013 03:17 PM, Heiko Schocher wrote: Hello Lokesh, [snip] + /* Enable RTC32K clock */ + rtc32k_enable(); I tried your patches on my three boards. The board with the rtc32k_enable() problem, did not work with them too :-( Maybe we make rtc32k_enable() weak in common code, and so I can make a board specific (dummy) function? I'm not a big fan of this since without this kicked, you can't do PM. And we don't want to do it in the kernel as it takes a few seconds to settle. Kicking it in U-Boot means it will be settled by the time it's needed, if I recall things right. Hmm.. but on my board, the cpu hangs (not accessible through bdi anymore) if I access this registers ... looking still for an explanation ... Clocks are enabled, 24MHz (same as on am335x eval board) used ... I know, this is only a bugfix, without knowing the real reason ... bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/4] ARM: AM33xx: Move s_init to a common place
Hello Summit, Am 25.06.2013 07:09, schrieb Sumit Gemini: Hi Heiko, I followed the same steps that you mentioned, but still i have same problem. During get uboot-spl.bin from uart, system become hanged and it is not ready to receive u-boot.img. On which hardware? Still compiling to uboot, i had to comment rtc32k_enable() function. then it is working fine. Ok ... Hmm.. maybe some missing init the ROM Bootloader does (and some ROM bootloader versions not, and we miss this in spl code)? (just speculation ...) bye, Heiko On Tue, Jun 25, 2013 at 1:14 AM, Heiko Schocher h...@denx.de mailto:h...@denx.de wrote: Hello Tom, Am 24.06.2013 21 tel:24.06.2013%2021:31, schrieb Tom Rini: On 06/24/2013 03:17 PM, Heiko Schocher wrote: Hello Lokesh, [snip] + /* Enable RTC32K clock */ + rtc32k_enable(); I tried your patches on my three boards. The board with the rtc32k_enable() problem, did not work with them too :-( Maybe we make rtc32k_enable() weak in common code, and so I can make a board specific (dummy) function? I'm not a big fan of this since without this kicked, you can't do PM. And we don't want to do it in the kernel as it takes a few seconds to settle. Kicking it in U-Boot means it will be settled by the time it's needed, if I recall things right. Hmm.. but on my board, the cpu hangs (not accessible through bdi anymore) if I access this registers ... looking still for an explanation ... Clocks are enabled, 24MHz (same as on am335x eval board) used ... I know, this is only a bugfix, without knowing the real reason ... bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de mailto:U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot