diff mbox

[U-Boot,4/7] ti: wdt: hwinit-common: Remove legacy watchdog disable code

Message ID 1487543082-24746-6-git-send-email-lukma@denx.de
State Changes Requested
Delegated to: Tom Rini
Headers show

Commit Message

Lukasz Majewski Feb. 19, 2017, 10:24 p.m. UTC
This patch removes some legacy code inherited from omap4. It is redundant
to the code already available in ./drivers/watchdog/omap_wdt.c

The code dates back to 2010:
"ARMV7: Add basic support for TI OMAP4"
SHA1: d34efc767d26d353e0257042080eec7012e5440f

In contemporary u-boot omap watchdog:
- Can be enabled in SPL:
TI watchdog is initialized in spl_board_init() (call to hw_watchdog_init)

- Is explicitly disabled before making any changes of its registers

- Is re-enabled in init_func_watchdog_init() in ./common/board_f.c with
other architectures.

This patch removes silent watchdog disable on TI platform, which caused
lack of wdt protection in u-boot even when it was explicitly enabled (in
SPL) with CONFIG_HW_WATCHDOG.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
 arch/arm/mach-omap2/hwinit-common.c | 27 ---------------------------
 1 file changed, 27 deletions(-)

Comments

Tom Rini Feb. 20, 2017, 2:25 a.m. UTC | #1
On Sun, Feb 19, 2017 at 11:24:39PM +0100, Lukasz Majewski wrote:

> This patch removes some legacy code inherited from omap4. It is redundant
> to the code already available in ./drivers/watchdog/omap_wdt.c
> 
> The code dates back to 2010:
> "ARMV7: Add basic support for TI OMAP4"
> SHA1: d34efc767d26d353e0257042080eec7012e5440f
> 
> In contemporary u-boot omap watchdog:
> - Can be enabled in SPL:
> TI watchdog is initialized in spl_board_init() (call to hw_watchdog_init)
> 
> - Is explicitly disabled before making any changes of its registers
> 
> - Is re-enabled in init_func_watchdog_init() in ./common/board_f.c with
> other architectures.
> 
> This patch removes silent watchdog disable on TI platform, which caused
> lack of wdt protection in u-boot even when it was explicitly enabled (in
> SPL) with CONFIG_HW_WATCHDOG.
> 
> Signed-off-by: Lukasz Majewski <lukma@denx.de>

Reviewed-by: Tom Rini <trini@konsulko.com>
Lokesh Vutla Feb. 20, 2017, 6:42 a.m. UTC | #2
On Monday 20 February 2017 03:54 AM, Lukasz Majewski wrote:
> This patch removes some legacy code inherited from omap4. It is redundant
> to the code already available in ./drivers/watchdog/omap_wdt.c
> 
> The code dates back to 2010:
> "ARMV7: Add basic support for TI OMAP4"
> SHA1: d34efc767d26d353e0257042080eec7012e5440f
> 
> In contemporary u-boot omap watchdog:
> - Can be enabled in SPL:
> TI watchdog is initialized in spl_board_init() (call to hw_watchdog_init)
> 
> - Is explicitly disabled before making any changes of its registers
> 
> - Is re-enabled in init_func_watchdog_init() in ./common/board_f.c with
> other architectures.
> 
> This patch removes silent watchdog disable on TI platform, which caused
> lack of wdt protection in u-boot even when it was explicitly enabled (in
> SPL) with CONFIG_HW_WATCHDOG.
> 
> Signed-off-by: Lukasz Majewski <lukma@denx.de>

Can you remove similar code from arch/arm/mach-omap2/am33xx/board.c also?

Thanks and regards,
Lokesh
Lukasz Majewski Feb. 20, 2017, 7:32 a.m. UTC | #3
On Mon, 20 Feb 2017 12:12:05 +0530
Lokesh Vutla <lokeshvutla@ti.com> wrote:

> 
> 
> On Monday 20 February 2017 03:54 AM, Lukasz Majewski wrote:
> > This patch removes some legacy code inherited from omap4. It is
> > redundant to the code already available
> > in ./drivers/watchdog/omap_wdt.c
> > 
> > The code dates back to 2010:
> > "ARMV7: Add basic support for TI OMAP4"
> > SHA1: d34efc767d26d353e0257042080eec7012e5440f
> > 
> > In contemporary u-boot omap watchdog:
> > - Can be enabled in SPL:
> > TI watchdog is initialized in spl_board_init() (call to
> > hw_watchdog_init)
> > 
> > - Is explicitly disabled before making any changes of its registers
> > 
> > - Is re-enabled in init_func_watchdog_init() in ./common/board_f.c
> > with other architectures.
> > 
> > This patch removes silent watchdog disable on TI platform, which
> > caused lack of wdt protection in u-boot even when it was explicitly
> > enabled (in SPL) with CONFIG_HW_WATCHDOG.
> > 
> > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> 
> Can you remove similar code from arch/arm/mach-omap2/am33xx/board.c
> also?

Ok, I will do it (and test on BBB). 

Please test/review other patches :-)

> 
> Thanks and regards,
> Lokesh
> 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/hwinit-common.c b/arch/arm/mach-omap2/hwinit-common.c
index f317293..d6549d3 100644
--- a/arch/arm/mach-omap2/hwinit-common.c
+++ b/arch/arm/mach-omap2/hwinit-common.c
@@ -150,7 +150,6 @@  void early_system_init(void)
 	if (warm_reset())
 		force_emif_self_refresh();
 #endif
-	watchdog_init();
 	set_mux_conf_regs();
 #ifdef CONFIG_SPL_BUILD
 	srcomp_enable();
@@ -181,32 +180,6 @@  int arch_cpu_init_dm(void)
 }
 
 /*
- * Routine: wait_for_command_complete
- * Description: Wait for posting to finish on watchdog
- */
-void wait_for_command_complete(struct watchdog *wd_base)
-{
-	int pending = 1;
-	do {
-		pending = readl(&wd_base->wwps);
-	} while (pending);
-}
-
-/*
- * Routine: watchdog_init
- * Description: Shut down watch dogs
- */
-void watchdog_init(void)
-{
-	struct watchdog *wd2_base = (struct watchdog *)WDT2_BASE;
-
-	writel(WD_UNLOCK1, &wd2_base->wspr);
-	wait_for_command_complete(wd2_base);
-	writel(WD_UNLOCK2, &wd2_base->wspr);
-}
-
-
-/*
  * This function finds the SDRAM size available in the system
  * based on DMM section configurations
  * This is needed because the size of memory installed may be