[PATCH 3/3] watchdog: bcm7038_wdt: support BCM4908 SoC

Rob Herring robh at kernel.org
Mon Nov 1 10:28:45 PDT 2021


On Fri, Oct 29, 2021 at 11:45 AM Florian Fainelli <f.fainelli at gmail.com> wrote:
>
> On 10/29/21 6:03 AM, Rob Herring wrote:
> > On Fri, Oct 29, 2021 at 01:39:02PM +0200, Rafał Miłecki wrote:
> >> [Rob: please kindly comment on this]
> >>
> >> On 28.10.2021 18:29, Florian Fainelli wrote:
> >>> On 10/28/21 2:30 AM, Rafał Miłecki wrote:
> >>>> From: Rafał Miłecki <rafal at milecki.pl>
> >>>>
> >>>> Hardware supported by this driver goes back to the old bcm63xx days. It
> >>>> was then reused in BCM7038 and later also in BCM4908.
> >>>>
> >>>> Depending on SoC model registers layout differs a bit. This commit
> >>>> introduces support for per-chipset registers offsets & adds BCM4908
> >>>> layout.
> >>>>
> >>>> Later on BCM63xx SoCs support should be added too (probably as platform
> >>>> devices due to missing DT). Eventually this driver should replace
> >>>> bcm63xx_wdt.c.
> >>>>
> >>>> Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
> >>>> ---
> >>>
> >>> [snip]
> >>>
> >>>> +
> >>>> +static const u16 bcm7038_wdt_regs_bcm4908[] = {
> >>>> +  [BCM63XX_WDT_REG_DEFVAL]        = 0x28,
> >>>> +  [BCM63XX_WDT_REG_CTL]           = 0x2c,
> >>>> +  [BCM63XX_WDT_REG_SOFTRESET]     = 0x34,
> >>>
> >>> I don't understand what you are doing here and why you are not
> >>> offsetting the "reg" property appropriately when you create your
> >>> bcm4908-wdt Device Tree node such that the base starts at 0, and the
> >>> existing driver becomes usable as-is. This does not make any sense to me
> >>> when it is obviously the simplest way to make the driver "accept" the
> >>> resource being passed.
> >>
> >> I believe that DT binding should cover the whole hardware block and
> >> describe it (here: use proper compatible to allow recognizing block
> >> variant).
> >>
> >> That's because (as far as I understand) DT should be used to describe
> >> hardware as closely as possible. I think it shouldn't be adjusted to
> >> make mapping match Linux's driver implementation.
> >>
> >>
> >> So if:
> >> 1. Hardware block is mapped at 0xff800400
> >> 2. It has interesting registers at 0xff800428 and 0xff80042c
> >>
> >> I think mapping should use:
> >> reg = <0xff800400 0x3c>;
> >> even if we don't use the first N registers.
> >>
> >> That way, at some point, you can extend Linux (or whatever) driver to
> >> use extra registers without reworking the whole binding. That's why I
> >> think we need to map whole hardware block & handle different registers
> >> layouts in a driver.
> >
> > Yes, that's the correct thing to do.
>
> So in the future if we happen to want to manage the hardware timers in
> that block, they would be part of the watchdog driver? I am fairly sure
> they won't be, so you will be creating a composite driver/MFD to
> separate out the functions, more likely. So you might as well create
> sub-nodes.

There is no requirement that an MFD have child nodes. They are done
both ways. If you need some internal kernel restructuring, then I
don't care (as DT maintainer).

We very commonly have a single node that's both clock and reset
provider for example. It's primarily when the sub blocks consume
different DT resources that you need sub-nodes.

> > The question is whether you'd need sub nodes for the other functions.
> > Folks tend to want to have sub nodes for convenience which isn't really
> > needed and then requires a DT update ('cause they add nodes as adding
> > drivers).
>
> Sorry but not, this is getting completely ridiculous, the

Huh?

>
> >
> > Based on the registers, you really don't need sub nodes here.
>
> I sort of disagree here, the watchdog is a part of a sundry timer block
> here, but it is logically broken up into different parts and if if I
> were to imagine how this would map into different drivers, I can easily
> see that we would have:
>
> - a driver to manage the timer interrupt controller
> - a driver to manage each of the 3 hardware timers, be they clockevent
> or else
> - a driver to manage the watchdog

You know the h/w better than me. I was giving my opinion based only on
the limited information presented.

> The simplest way to get there, and also because these same timer blocks
> are actually spread in other parts of STB chips just like the watchdog
> is, but in a different layout where they stand on their own was the main
> drive for defining the bcm7038_wdt binding the way it was.

A sub-block reused in different blocks is a decent reason for sub-nodes.

Most important for me is that the binding be complete and not have to
change in an incompatible way in the future. The more detailed you
make the binding, the harder it will be to get right. It's the same
reason we moved away from doing a clock per node for clock trees. So,
if you want child nodes, then you need to define all of them.

Rob



More information about the linux-arm-kernel mailing list