ARM: davinci: da850 DT: add support for machine reboot
authorKumar, Anil <anilkumar.v@ti.com>
Wed, 6 Feb 2013 04:00:04 +0000 (09:30 +0530)
committerSekhar Nori <nsekhar@ti.com>
Sat, 9 Feb 2013 17:08:26 +0000 (22:38 +0530)
Update the da8xx_restart() function to support machine reboot
when booting using DT. Have the function search for the watchdog
platform device instead of always using "da8xx_wdt_device" which
is never registered in DT case.

While at it, also make da8xx_wdt_device static since there is no need
for it to be globally visible.

Tested machine reboot with both DT and non-DT boot on DA850 EVM.

Signed-off-by: Kumar, Anil <anilkumar.v@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
arch/arm/mach-davinci/devices-da8xx.c
arch/arm/mach-davinci/include/mach/da8xx.h

index 2d5502d84a223aaf9b0a05ccb80d284393c9a815..cc6916dc46294c2e29503505841b6cf3459b7e27 100644 (file)
@@ -359,7 +359,7 @@ static struct resource da8xx_watchdog_resources[] = {
        },
 };
 
-struct platform_device da8xx_wdt_device = {
+static struct platform_device da8xx_wdt_device = {
        .name           = "watchdog",
        .id             = -1,
        .num_resources  = ARRAY_SIZE(da8xx_watchdog_resources),
@@ -368,7 +368,15 @@ struct platform_device da8xx_wdt_device = {
 
 void da8xx_restart(char mode, const char *cmd)
 {
-       davinci_watchdog_reset(&da8xx_wdt_device);
+       struct device *dev;
+
+       dev = bus_find_device_by_name(&platform_bus_type, NULL, "watchdog");
+       if (!dev) {
+               pr_err("%s: failed to find watchdog device\n", __func__);
+               return;
+       }
+
+       davinci_watchdog_reset(to_platform_device(dev));
 }
 
 int __init da8xx_register_watchdog(void)
index 700d311c6854f0abc3054d4a732fbf8fc522a418..ef9f70ea30a0f8075d51011d2624cb4fe60c44a5 100644 (file)
@@ -112,7 +112,6 @@ extern struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata;
 extern struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata;
 extern struct davinci_spi_platform_data da8xx_spi_pdata[];
 
-extern struct platform_device da8xx_wdt_device;
 
 extern const short da830_emif25_pins[];
 extern const short da830_spi0_pins[];
This page took 0.027421 seconds and 5 git commands to generate.