public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
To: Leela Krishna Amudala <l.krishna@samsung.com>
Cc: Doug Anderson <dianders@chromium.org>,
	Tomasz Figa <t.figa@samsung.com>,
	linux-samsung-soc <linux-samsung-soc@vger.kernel.org>,
	Wim Van Sebroeck <wim@iguana.be>,
	Kukjin Kim <kgene.kim@samsung.com>,
	devicetree@vger.kernel.org, linux-watchdog@vger.kernel.org
Subject: Re: [PATCH 3/4] watchdog: s3c2410_wdt: parse watchdog dt node to read PMU registers adresses
Date: Mon, 23 Sep 2013 19:03:10 +0200	[thread overview]
Message-ID: <1918747.quF8QJoP6D@amdc1032> (raw)
In-Reply-To: <CAL1wa8eWKNL3kdfjqxqaLsAtc8nqgiPW34SBk4gozAR1jnRaSg@mail.gmail.com>


Hi,

On Wednesday, September 18, 2013 12:20:31 PM Leela Krishna Amudala wrote:
> Tomasz,
> 
> On Wed, Sep 18, 2013 at 10:04 AM, Doug Anderson <dianders@chromium.org> wrote:
> > Tomasz,
> >
> > On Tue, Sep 17, 2013 at 6:30 AM, Tomasz Figa <t.figa@samsung.com> wrote:
> >>> --- a/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt
> >>> +++ b/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt
> >>> @@ -7,8 +7,20 @@ occurred.
> >>>  Required properties:
> >>>  - compatible : should be "samsung,s3c2410-wdt"
> >>
> >> Since the WDT block of Exynos 5420 needs some extra configuration in PMU
> >> registers, it is no longer compatible with samsung.s3c2410-wdt. Please
> >> introduce separate compatible ("samsung,exynos5420-wdt") and make the
> >> driver handle the additional configuration only if running on a device with
> >> this compatible value.
> >>
> >> I'd suggest introducing quirk system to the driver and adding a
> >> NEEDS_PMU_CONFIG quirk selected by DT match entry with "samsung,exynos5420-
> >> wdt" compatible.
> >>
> >>>  - reg : base physical address of the controller and length of memory
> >>> mapped -      region.
> >>> +     region and the optional (addresses and length of memory mapped regions
> >>> +     of) PMU registers for masking/unmasking WDT.
> >>>  - interrupts : interrupt number to the cpu.
> >>>
> >>>  Optional properties:
> >>>  - timeout-sec : contains the watchdog timeout in seconds.
> >>> +- reset-mask-bit: bit number in the PMU registers to program mask/unmask
> >>> WDT. +
> >>
> >> I believe this is mandatory on Exynos 5420 and unused on previous SoCs. It
> >> should be handled depending on compatible value.
> >
> > I think at least 5250 needs something similar.  I believe we got away
> > with it in the past since other (non-WDT) code was tweaking with this
> > bit, but that was a little bit gross.  Leela Krishna can correct me if
> > I'm wrong.
> >
> 
> Yes, 5250 also needs this reset-mask-bit, but not required by SoCs
> other than Exynos5xxx.
> Hence I kept it as optional parameter.
> 
> I took care of this code such that it won't break on older SoCs.
> 
> If you notice the code in probe function, I used the check condition
> 
> if (!IS_ERR(wdt->pmu_disable_reg) && !IS_ERR(wdt->pmu_mask_reset_reg)) {
> }
> 
> i.e., if any of the PMU register address is not mentioned in the DT
> node it simply skips reading reset-mask-bit
> and continues execution (which may happen in older SoC DT node).
> 
> ..also, in s3c2410wdt_mask_and_disable_reset() function, below
> condition check is happening
> 
> if (IS_ERR(wdt->pmu_disable_reg) || IS_ERR(wdt->pmu_mask_reset_reg)
>                                 || (wdt->pmu_mask_bit < 0))
>         return;
> 
> i.e., if any of the registers is not specified in DT node simply
> return without programming
> PMU registers(which is true in case of older SoCs).
> 
> If you think this doesn't sounds good way of handling older SoCs.
> I'll add new compatible string for Exynos5xxx and do like what you said. :)

Yes, please re-do the code per Tomasz's suggestions.

This would also allow you to check return values of devm_ioremap_resource()
calls in the probe method and require them to succeed in order to register
watchdog device (which is unfortunately not what happens currently).

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

  reply	other threads:[~2013-09-23 17:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-17 10:43 [PATCH 0/4] Add watchdog DT nodes and parse it to read PMU registers addresses Leela Krishna Amudala
2013-09-17 10:43 ` [PATCH 1/4] ARM: dts: Fix the watchdog DT node name for Exynos5 Leela Krishna Amudala
     [not found] ` <1379414623-26329-1-git-send-email-l.krishna-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-09-17 10:43   ` [PATCH 2/4] ARM: dts: add watchdog device tree node for exynos5420 Leela Krishna Amudala
2013-09-17 10:43   ` [PATCH 3/4] watchdog: s3c2410_wdt: parse watchdog dt node to read PMU registers adresses Leela Krishna Amudala
     [not found]     ` <1379414623-26329-4-git-send-email-l.krishna-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-09-17 13:30       ` Tomasz Figa
2013-09-18  4:34         ` Doug Anderson
     [not found]           ` <CAD=FV=XQSLULsYanJCCFehxrs9LESZ=KO8XgyzZaacL4GNeXPA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-18  6:50             ` Leela Krishna Amudala
2013-09-23 17:03               ` Bartlomiej Zolnierkiewicz [this message]
2013-09-23 17:11                 ` Tomasz Figa
2013-09-27 10:12                   ` Tomasz Figa
2013-09-27 11:18                     ` Leela Krishna Amudala
     [not found]                       ` <CAL1wa8cDAui8AJXvmYPpPEWtUum-ZNpW2hQWjwKLpzXBFLv=eA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-27 11:25                         ` Tomasz Figa
2013-09-27 15:20                           ` Doug Anderson
     [not found]                             ` <CAD=FV=WZBrJ5Qhky6VQqfu59LVQcKMTdLa+gJwnnFM85bEzzNQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-27 18:14                               ` Tomasz Figa
2013-09-27 18:48                                 ` Doug Anderson
     [not found]                                   ` <CAD=FV=Wa0BpmE7mQoAk-RC_g9QCCz2T_7=Pd46CDSN8Z9KQ8jg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-29  1:49                                     ` Tomasz Figa
2013-09-30 16:54                                       ` Doug Anderson
2013-09-30 17:20                                         ` Tomasz Figa
2013-09-17 10:43   ` [PATCH 4/4] ARM: dts: exynos: add PMU registers addresses and mask bit to watchdog node Leela Krishna Amudala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1918747.quF8QJoP6D@amdc1032 \
    --to=b.zolnierkie@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=kgene.kim@samsung.com \
    --cc=l.krishna@samsung.com \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=t.figa@samsung.com \
    --cc=wim@iguana.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox