From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751856AbdDCBzZ (ORCPT ); Sun, 2 Apr 2017 21:55:25 -0400 Received: from mail-yw0-f196.google.com ([209.85.161.196]:33168 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751280AbdDCBzX (ORCPT ); Sun, 2 Apr 2017 21:55:23 -0400 MIME-Version: 1.0 In-Reply-To: References: <20170331133728.GA23725@rajaneesh-OptiPlex-9010> From: Sathyanarayanan Kuppuswamy Natarajan Date: Sun, 2 Apr 2017 18:55:22 -0700 Message-ID: Subject: Re: [PATCH v4 3/5] watchdog: iTCO_wdt: Add PMC specific noreboot update api To: Andy Shevchenko Cc: Kuppuswamy Sathyanarayanan , Andy Shevchenko , Zha Qipeng , "dvhart@infradead.org" , Guenter Roeck , Wim Van Sebroeck , David Box , Rajneesh Bhardwaj , Platform Driver , "linux-kernel@vger.kernel.org" , linux-watchdog@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Sun, Apr 2, 2017 at 7:04 AM, Andy Shevchenko wrote: > On Sat, Apr 1, 2017 at 2:27 AM, Kuppuswamy Sathyanarayanan > wrote: >> In some SOCs, setting noreboot bit needs modification to > > SoCs. > > Perhaps you can create a wikipage to share with your team what style > issues usually needs to be addressed. > One of them is a proper capitalization in abbreviations / code names. > >> PMC GC registers. But not all PMC drivers allow other drivers >> to memory map their GC region. This could create mem request >> conflict in watchdog driver. So this patch adds facility to allow >> PMC drivers to pass noreboot update function to watchdog >> drivers via platform data. > >> --- a/drivers/watchdog/iTCO_wdt.c >> +++ b/drivers/watchdog/iTCO_wdt.c >> @@ -100,6 +100,8 @@ struct iTCO_wdt_private { >> */ >> struct resource *gcs_pmc_res; >> unsigned long __iomem *gcs_pmc; > >> + /* pmc specific api to update noreboot flag */ > > PMC > API will fix in next version. > >> + int (*update_noreboot_flag)(bool status); >> /* the lock for io operations */ >> spinlock_t io_lock; >> /* the PCI-device */ >> @@ -176,9 +178,13 @@ static void iTCO_wdt_set_NO_REBOOT_bit(struct iTCO_wdt_private *p) >> >> /* Set the NO_REBOOT bit: this disables reboots */ >> if (p->iTCO_version >= 2) { >> - val32 = readl(p->gcs_pmc); >> - val32 |= no_reboot_bit(p); >> - writel(val32, p->gcs_pmc); >> + if (p->update_noreboot_flag) > >> + p->update_noreboot_flag(1); > > 1 -> true for sake of consistency. ditto > >> + else { >> + val32 = readl(p->gcs_pmc); >> + val32 |= no_reboot_bit(p); >> + writel(val32, p->gcs_pmc); >> + } >> } else if (p->iTCO_version == 1) { >> pci_read_config_dword(p->pci_dev, 0xd4, &val32); >> val32 |= no_reboot_bit(p); >> @@ -193,11 +199,14 @@ static int iTCO_wdt_unset_NO_REBOOT_bit(struct iTCO_wdt_private *p) >> >> /* Unset the NO_REBOOT bit: this enables reboots */ >> if (p->iTCO_version >= 2) { >> - val32 = readl(p->gcs_pmc); >> - val32 &= ~enable_bit; >> - writel(val32, p->gcs_pmc); >> - >> - val32 = readl(p->gcs_pmc); >> + if (p->update_noreboot_flag) > >> + return p->update_noreboot_flag(0); > > 0 -> false. ditto > >> + else { > >> + val32 = readl(p->gcs_pmc); >> + val32 &= ~enable_bit; >> + writel(val32, p->gcs_pmc); >> + val32 = readl(p->gcs_pmc); > > This and similar above code might be split to a helper and you may > assign it once. In such case you will not need a special flag anymore. > > Helpers split might be done as a preparatory separate patch. Yes, will create a patch for fixing it. > > -- > With Best Regards, > Andy Shevchenko -- -- Sathya From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-yw0-f196.google.com ([209.85.161.196]:33168 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751280AbdDCBzX (ORCPT ); Sun, 2 Apr 2017 21:55:23 -0400 MIME-Version: 1.0 In-Reply-To: References: <20170331133728.GA23725@rajaneesh-OptiPlex-9010> From: Sathyanarayanan Kuppuswamy Natarajan Date: Sun, 2 Apr 2017 18:55:22 -0700 Message-ID: Subject: Re: [PATCH v4 3/5] watchdog: iTCO_wdt: Add PMC specific noreboot update api To: Andy Shevchenko Cc: Kuppuswamy Sathyanarayanan , Andy Shevchenko , Zha Qipeng , "dvhart@infradead.org" , Guenter Roeck , Wim Van Sebroeck , David Box , Rajneesh Bhardwaj , Platform Driver , "linux-kernel@vger.kernel.org" , linux-watchdog@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-watchdog-owner@vger.kernel.org List-Id: linux-watchdog@vger.kernel.org Hi, On Sun, Apr 2, 2017 at 7:04 AM, Andy Shevchenko wrote: > On Sat, Apr 1, 2017 at 2:27 AM, Kuppuswamy Sathyanarayanan > wrote: >> In some SOCs, setting noreboot bit needs modification to > > SoCs. > > Perhaps you can create a wikipage to share with your team what style > issues usually needs to be addressed. > One of them is a proper capitalization in abbreviations / code names. > >> PMC GC registers. But not all PMC drivers allow other drivers >> to memory map their GC region. This could create mem request >> conflict in watchdog driver. So this patch adds facility to allow >> PMC drivers to pass noreboot update function to watchdog >> drivers via platform data. > >> --- a/drivers/watchdog/iTCO_wdt.c >> +++ b/drivers/watchdog/iTCO_wdt.c >> @@ -100,6 +100,8 @@ struct iTCO_wdt_private { >> */ >> struct resource *gcs_pmc_res; >> unsigned long __iomem *gcs_pmc; > >> + /* pmc specific api to update noreboot flag */ > > PMC > API will fix in next version. > >> + int (*update_noreboot_flag)(bool status); >> /* the lock for io operations */ >> spinlock_t io_lock; >> /* the PCI-device */ >> @@ -176,9 +178,13 @@ static void iTCO_wdt_set_NO_REBOOT_bit(struct iTCO_wdt_private *p) >> >> /* Set the NO_REBOOT bit: this disables reboots */ >> if (p->iTCO_version >= 2) { >> - val32 = readl(p->gcs_pmc); >> - val32 |= no_reboot_bit(p); >> - writel(val32, p->gcs_pmc); >> + if (p->update_noreboot_flag) > >> + p->update_noreboot_flag(1); > > 1 -> true for sake of consistency. ditto > >> + else { >> + val32 = readl(p->gcs_pmc); >> + val32 |= no_reboot_bit(p); >> + writel(val32, p->gcs_pmc); >> + } >> } else if (p->iTCO_version == 1) { >> pci_read_config_dword(p->pci_dev, 0xd4, &val32); >> val32 |= no_reboot_bit(p); >> @@ -193,11 +199,14 @@ static int iTCO_wdt_unset_NO_REBOOT_bit(struct iTCO_wdt_private *p) >> >> /* Unset the NO_REBOOT bit: this enables reboots */ >> if (p->iTCO_version >= 2) { >> - val32 = readl(p->gcs_pmc); >> - val32 &= ~enable_bit; >> - writel(val32, p->gcs_pmc); >> - >> - val32 = readl(p->gcs_pmc); >> + if (p->update_noreboot_flag) > >> + return p->update_noreboot_flag(0); > > 0 -> false. ditto > >> + else { > >> + val32 = readl(p->gcs_pmc); >> + val32 &= ~enable_bit; >> + writel(val32, p->gcs_pmc); >> + val32 = readl(p->gcs_pmc); > > This and similar above code might be split to a helper and you may > assign it once. In such case you will not need a special flag anymore. > > Helpers split might be done as a preparatory separate patch. Yes, will create a patch for fixing it. > > -- > With Best Regards, > Andy Shevchenko -- -- Sathya