]> git.sur5r.net Git - u-boot/commitdiff
arm, davinci: add workaround for not resetting DMA bus and VPSS modules
authorHeiko Schocher <hs@denx.de>
Sat, 14 Jan 2012 21:42:46 +0000 (21:42 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Sun, 12 Feb 2012 09:11:23 +0000 (10:11 +0100)
The Buffer Logic of VPSS is Not Reset by System Reset Pin, see
http://www.ti.com/lit/er/sprz316b/sprz316b.pdf chapter Advisory 1.2.1
on page 9. Add workaroundcode proposed in the errata.

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Sandeep Paulraj <s-paulraj@ti.com>
Cc: Tom Rini <tom.rini@gmail.com>
arch/arm/cpu/arm926ejs/davinci/dm365_lowlevel.c
arch/arm/include/asm/arch-davinci/dm365_lowlevel.h
arch/arm/include/asm/arch-davinci/hardware.h
arch/arm/include/asm/arch-davinci/timer_defs.h

index 6e998ded99e7cf7609d2a841f178b81d4cf723a4..c9936fd0de9e92c94ac545c6e6b69c8cc0bd9591 100644 (file)
@@ -254,7 +254,7 @@ int dm365_ddr_setup(void)
        return 0;
 }
 
-void dm365_vpss_sync_reset(void)
+static void dm365_vpss_sync_reset(void)
 {
        unsigned int PdNum = 0;
 
@@ -276,11 +276,52 @@ void dm365_vpss_sync_reset(void)
                ;
 }
 
-void dm365_por_reset(void)
+static void dm365_por_reset(void)
 {
+       struct davinci_timer *wdog =
+               (struct davinci_timer *)DAVINCI_WDOG_BASE;
+
        if (readl(&dv_pll0_regs->rstype) &
-               (PLL_RSTYPE_POR | PLL_RSTYPE_XWRST))
+               (PLL_RSTYPE_POR | PLL_RSTYPE_XWRST)) {
+               dm365_vpss_sync_reset();
+
+               writel(DV_TMPBUF_VAL, TMPBUF);
+               setbits_le32(TMPSTATUS, FLAG_PORRST);
+               writel(DV_WDT_ENABLE_SYS_RESET, &wdog->na1);
+               writel(DV_WDT_TRIGGER_SYS_RESET, &wdog->na2);
+
+               while (1);
+       }
+}
+
+static void dm365_wdt_reset(void)
+{
+       struct davinci_timer *wdog =
+               (struct davinci_timer *)DAVINCI_WDOG_BASE;
+
+       if (readl(TMPBUF) != DV_TMPBUF_VAL) {
+               writel(DV_TMPBUF_VAL, TMPBUF);
+               setbits_le32(TMPSTATUS, FLAG_PORRST);
+               setbits_le32(TMPSTATUS, FLAG_FLGOFF);
+
+               dm365_waitloop(100);
+
                dm365_vpss_sync_reset();
+
+               writel(DV_WDT_ENABLE_SYS_RESET, &wdog->na1);
+               writel(DV_WDT_TRIGGER_SYS_RESET, &wdog->na2);
+
+               while (1);
+       }
+}
+
+static void dm365_wdt_flag_on(void)
+{
+       /* VPSS_CLKMD 1:2 */
+       clrbits_le32(&dv_sys_module_regs->vpss_clkctl,
+               VPSS_CLK_CTL_VPSS_CLKMD);
+       writel(0, TMPBUF);
+       setbits_le32(TMPSTATUS, FLAG_FLGON);
 }
 
 void dm365_psc_init(void)
@@ -382,6 +423,9 @@ void dm36x_lowlevel_init(ulong bootflag)
        writel(0xffffffff, &dv_aintc_regs->irq0);
        writel(0xffffffff, &dv_aintc_regs->irq1);
 
+       dm365_por_reset();
+       dm365_wdt_reset();
+
        /* System PSC setup - enable all */
        dm365_psc_init();
 
@@ -418,6 +462,8 @@ void dm36x_lowlevel_init(ulong bootflag)
        puts("emif init\n");
        dm365_emif_init();
 
+       dm365_wdt_flag_on();
+
 #if defined(CONFIG_POST)
        /*
         * Do memory tests, calls arch_memory_failure_handle()
index 4986e829833cc048a088109c88fff90058ef246e..c70930d8d3ab9c417a3295a23efea5beb820255b 100644 (file)
@@ -32,7 +32,6 @@ void dm365_waitloop(unsigned long loopcnt);
 int dm365_pll1_init(unsigned long pllmult, unsigned long prediv);
 int dm365_pll2_init(unsigned long pllm, unsigned long prediv);
 int dm365_ddr_setup(void);
-void dm365_por_reset(void);
 void dm365_psc_init(void);
 void dm365_pinmux_ctl(unsigned long offset, unsigned long mask,
        unsigned long value);
index 1c71540e481fb249879ab0d1c455e673d17cb9d3..b145c6e7f163b1e9992839b058d5425349320ea3 100644 (file)
@@ -587,6 +587,15 @@ static inline int get_async3_src(void)
 #include <asm/arch/psc_defs.h>
 #include <asm/arch/syscfg_defs.h>
 #include <asm/arch/timer_defs.h>
+
+#define TMPBUF                 0x00017ff8
+#define TMPSTATUS              0x00017ff0
+#define DV_TMPBUF_VAL          0x591b3ed7
+#define FLAG_PORRST            0x00000001
+#define FLAG_WDTRST            0x00000002
+#define FLAG_FLGON             0x00000004
+#define FLAG_FLGOFF            0x00000010
+
 #endif
 
 struct davinci_rtc {
index 53c961e8da1573f7068dce2a19bcef5b284abd12..49b9e249568c3592b7ef89097d30d90b1ec98658 100644 (file)
@@ -37,6 +37,9 @@ struct davinci_timer {
        u_int32_t       wdtcr;
 };
 
+#define DV_WDT_ENABLE_SYS_RESET                0x00020000
+#define DV_WDT_TRIGGER_SYS_RESET       0x00020002
+
 #ifdef CONFIG_HW_WATCHDOG
 void davinci_hw_watchdog_enable(void);
 void davinci_hw_watchdog_reset(void);