From patchwork Sat Feb 9 17:23:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sekhar Nori X-Patchwork-Id: 2120841 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by patchwork1.kernel.org (Postfix) with ESMTP id 0BEBF3FCA4 for ; Sat, 9 Feb 2013 17:27:27 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r19HNRi2004305; Sat, 9 Feb 2013 11:23:27 -0600 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r19HNRX3032032; Sat, 9 Feb 2013 11:23:27 -0600 Received: from dlelxv23.itg.ti.com (172.17.1.198) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Sat, 9 Feb 2013 11:23:27 -0600 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id r19HNRcd009585; Sat, 9 Feb 2013 11:23:27 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 26A1880627; Sat, 9 Feb 2013 11:23:26 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dbdp20.itg.ti.com (dbdp20.itg.ti.com [172.24.170.38]) by linux.omap.com (Postfix) with ESMTP id 4B8FF80626 for ; Sat, 9 Feb 2013 11:23:24 -0600 (CST) Received: from DBDE70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id r19HNGIU003921; Sat, 9 Feb 2013 22:53:17 +0530 (IST) Received: from dbdp32.itg.ti.com (172.24.170.251) by dbde70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 14.1.323.3; Sat, 9 Feb 2013 22:53:16 +0530 Received: from [172.24.81.202] (smtpvbd.itg.ti.com [172.24.170.250]) by dbdp32.itg.ti.com (8.13.8/8.13.8) with ESMTP id r19HN5YZ031441; Sat, 9 Feb 2013 22:53:05 +0530 Message-ID: <511685F9.5080507@ti.com> Date: Sat, 9 Feb 2013 22:53:05 +0530 From: Sekhar Nori User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: "Kumar, Anil" Subject: Re: [PATCH V2 2/2] ARM: davinci: restart: fix wdt to machine restart with DT References: <1360123204-9978-1-git-send-email-anilkumar.v@ti.com> <1360123204-9978-3-git-send-email-anilkumar.v@ti.com> <5113EF59.80508@ti.com> In-Reply-To: CC: "Porter, Matt" , "davinci-linux-open-source@linux.davincidsp.com" , "linux@arm.linux.org.uk" , "mchehab@redhat.com" , "devicetree-discuss@lists.ozlabs.org" , "broonie@opensource.wolfsonmicro.com" , "linux-kernel@vger.kernel.org" , "grant.likely@secretlab.ca" , "tony@atomide.com" , "rob.herring@calxeda.com" , "hs@denx.de" , "linux-arm-kernel@lists.infradead.org" , "Cousson, Benoit" X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com On 2/8/2013 8:34 AM, Kumar, Anil wrote: > On Thu, Feb 07, 2013 at 23:45:53, Nori, Sekhar wrote: >> On 2/6/2013 9:30 AM, Kumar, Anil wrote: >>> diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c >>> index 2d5502d..1df68fd 100644 >>> --- a/arch/arm/mach-davinci/devices-da8xx.c >>> +++ b/arch/arm/mach-davinci/devices-da8xx.c >>> @@ -359,7 +359,7 @@ static struct resource da8xx_watchdog_resources[] = { >>> }, >>> }; >>> >>> -struct platform_device da8xx_wdt_device = { >>> +static struct platform_device da8xx_wdt_device = { >> >> Making of da8xx_wdt_device static should find a mention in description. > > Ok, > I made da8xx_wdt_device structure static as it is used only > in file. I will update description for this. > >> >>> .name = "watchdog", >>> .id = -1, >>> .num_resources = ARRAY_SIZE(da8xx_watchdog_resources), >>> @@ -368,7 +368,17 @@ struct platform_device da8xx_wdt_device = { >>> >>> void da8xx_restart(char mode, const char *cmd) >>> { >>> - davinci_watchdog_reset(&da8xx_wdt_device); >>> + struct device *dev = NULL; >>> + struct platform_device *wdt_device = NULL; >> >> No need to initialize these variables here. > > Ok, > I think no need to define wdt_device, can be used as > > davinci_watchdog_reset(to_platform_device(dev)); > >> >>> + >>> + dev = bus_find_device_by_name(&platform_bus_type, NULL, "watchdog"); >>> + if (!dev) { >>> + pr_err("wdt device not found to machine reboot\n"); >> >> Rather: "%s: failed to find watchdog device", __func__ > > ok Since time is short and I really want to be able to reboot when using DT in v3.9, I went ahead and fixed these comments. Updated patch follows. I tested it on DA850 EVM. Thanks, Sekhar ----8<---- >From 19c7c0d81a9b1fe7342d0208b629b5e085e4f3ae Mon Sep 17 00:00:00 2001 From: "Kumar, Anil" Date: Wed, 6 Feb 2013 09:30:04 +0530 Subject: [PATCH 3/3] ARM: davinci: da850 DT: add support for machine reboot 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 Signed-off-by: Sekhar Nori --- arch/arm/mach-davinci/devices-da8xx.c | 12 ++++++++++-- arch/arm/mach-davinci/include/mach/da8xx.h | 1 - 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index 2d5502d..cc6916d 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c @@ -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) diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h index 700d311..ef9f70e 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h @@ -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[];