diff mbox series

[v1,1/6] dt_bindings: mfd: Add ROHM BD9576MUF and BD9573MUF PMICs

Message ID 434579d4cddf891f8fa0f50a152c098b113fa2fb.1600329307.git.matti.vaittinen@fi.rohmeurope.com
State Changes Requested, archived
Headers show
Series Support ROHM BD9576MUF and BD9573MUF PMICs | expand

Checks

Context Check Description
robh/checkpatch success
robh/dt-meta-schema fail build log

Commit Message

Matti Vaittinen Sept. 17, 2020, 8:01 a.m. UTC
Add bindings for ROHM BD9576MUF and BD9573MUF PMICs. These
PMICs are primarily intended to be used to power the R-Car series
processors. They provide 6 power outputs, safety features and a
watchdog with two functional modes.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
---
 .../bindings/mfd/rohm,bd9576-pmic.yaml        | 129 ++++++++++++++++++
 1 file changed, 129 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml

Comments

Rob Herring Sept. 18, 2020, 5:28 p.m. UTC | #1
On Thu, Sep 17, 2020 at 11:01:52AM +0300, Matti Vaittinen wrote:
> Add bindings for ROHM BD9576MUF and BD9573MUF PMICs. These
> PMICs are primarily intended to be used to power the R-Car series
> processors. They provide 6 power outputs, safety features and a
> watchdog with two functional modes.
> 
> Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> ---
>  .../bindings/mfd/rohm,bd9576-pmic.yaml        | 129 ++++++++++++++++++
>  1 file changed, 129 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml
> 
> diff --git a/Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml b/Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml
> new file mode 100644
> index 000000000000..f17d4d621585
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml
> @@ -0,0 +1,129 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mfd/rohm,bd9576-pmic.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: ROHM BD9576MUF and BD9573MUF Power Management Integrated Circuit bindings
> +
> +maintainers:
> +  - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> +
> +description: |
> +  BD9576MUF and BD9573MUF are power management ICs primarily intended for
> +  powering the R-Car series processors.
> +  The IC provides 6 power outputs with configurable sequencing and safety
> +  monitoring. A watchdog logic with slow ping/windowed modes is also included.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - rohm,bd9576
> +      - rohm,bd9573
> +
> +  reg:
> +    description:
> +      I2C slave address.
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  rohm,vout1-en-low:
> +    description:
> +      BD9576 and BD9573 VOUT1 regulator enable state can be individually
> +      controlled by a GPIO. This is dictated by state of vout1-en pin during
> +      the PMIC startup. If vout1-en is LOW during PMIC startup then the VOUT1
> +      enable sate is controlled via this pin. Set this property if vout1-en
> +      is wired to be down at PMIC start-up.
> +    type: boolean
> +
> +  rohm,vout1-en-gpios:
> +    description:
> +      GPIO specifier to specify the GPIO connected to vout1-en for vout1 ON/OFF
> +      state control.
> +    maxItems: 1
> +
> +  rohm,ddr-sel-low:
> +    description:
> +      The BD9576 and BD9573 output voltage for DDR can be selected by setting
> +      the ddr-sel pin low or high. Set this property if ddr-sel is grounded.
> +    type: boolean
> +
> +  rohm,watchdog-enable-gpios:
> +    description: The GPIO line used to enable the watchdog.
> +    maxItems: 1
> +
> +  rohm,watchdog-ping-gpios:
> +    description: The GPIO line used to ping the watchdog.
> +    maxItems: 1
> +
> +  hw_margin_ms:

Needs a vendor prefix.

s/_/-/

> +    minimum: 4
> +    maximum: 4416
> +    description: Watchog timeout in milliseconds

Maybe the words in the description should be in the property name as 
I don't see how 'h/w margin' relates to 'watchdog timeout'.

Is this a max and below is the min?:

> +
> +  rohm,hw-margin-min-ms:
> +    minimum: 2
> +    maximum: 220
> +    description:
> +      Watchdog on these ICs can be configured in a window mode where the ping
> +      must come within certain time-window. Eg. too quick pinging will also
> +      trigger timeout. Specify the minimum delay between pings if you wish to
> +      use the window mode. Note, the maximum delay is internally configured as
> +      a certain multiple of this value so maximum delay can be only up to 15
> +      times this value. For example for 73 ms short ping value the maximum
> +      timeout will be close to 1 sec.
> +
> +  regulators:
> +    $ref: ../regulator/rohm,bd9576-regulator.yaml
> +    description:
> +      List of child nodes that specify the regulators.
> +
> +required:
> +  - compatible
> +  - reg
> +  - regulators
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +    #include <dt-bindings/leds/common.h>
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +        pmic: pmic@30 {
> +            compatible = "rohm,bd9576";
> +            reg = <0x30>;
> +            rohm,vout1-en-low;
> +            rohm,vout1-en-gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>;
> +            rohm,ddr-sel-low;
> +            rohm,watchdog-enable-gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>;
> +            rohm,watchdog-ping-gpios = <&gpio2 7 GPIO_ACTIVE_HIGH>;
> +            hw_margin_ms = <30>;
> +            rohm,hw-margin-min-ms = <4>;
> +
> +            regulators {
> +                boost1: regulator-vd50 {
> +                    regulator-name = "VD50";
> +                };
> +                buck1: regulator-vd18 {
> +                    regulator-name = "VD18";
> +                };
> +                buck2: regulator-vdddr {
> +                    regulator-name = "vdddr";
> +                };
> +                buck3: regulator-vd10 {
> +                    regulator-name = "vd10";
> +                };
> +                ldo: regulator-voutl1 {
> +                    regulator-name = "VOUTL1";
> +                };
> +                sw: regulator-vouts1 {
> +                    regulator-name = "VOUTS1";
> +                };
> +            };
> +        };
> +    };
> -- 
> 2.21.0
> 
> 
> -- 
> Matti Vaittinen, Linux device drivers
> ROHM Semiconductors, Finland SWDC
> Kiviharjunlenkki 1E
> 90220 OULU
> FINLAND
> 
> ~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
> Simon says - in Latin please.
> ~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
> Thanks to Simon Glass for the translation =]
Matti Vaittinen Sept. 19, 2020, 11:46 a.m. UTC | #2
Thanks Rob for taking a look at this!

On Fri, 2020-09-18 at 11:28 -0600, Rob Herring wrote:
> On Thu, Sep 17, 2020 at 11:01:52AM +0300, Matti Vaittinen wrote:
> > Add bindings for ROHM BD9576MUF and BD9573MUF PMICs. These
> > PMICs are primarily intended to be used to power the R-Car series
> > processors. They provide 6 power outputs, safety features and a
> > watchdog with two functional modes.
> > 
> > Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> > ---
> >  .../bindings/mfd/rohm,bd9576-pmic.yaml        | 129
> > ++++++++++++++++++
> >  1 file changed, 129 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/mfd/rohm,bd9576-
> > pmic.yaml b/Documentation/devicetree/bindings/mfd/rohm,bd9576-
> > pmic.yaml
> > new file mode 100644
> > index 000000000000..f17d4d621585
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml
> > @@ -0,0 +1,129 @@
> > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/mfd/rohm,bd9576-pmic.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: ROHM BD9576MUF and BD9573MUF Power Management Integrated
> > Circuit bindings
> > +
> > +maintainers:
> > +  - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> > +
> > +description: |
> > +  BD9576MUF and BD9573MUF are power management ICs primarily
> > intended for
> > +  powering the R-Car series processors.
> > +  The IC provides 6 power outputs with configurable sequencing and
> > safety
> > +  monitoring. A watchdog logic with slow ping/windowed modes is
> > also included.
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - rohm,bd9576
> > +      - rohm,bd9573
> > +
> > +  reg:
> > +    description:
> > +      I2C slave address.
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    maxItems: 1
> > +
> > +  rohm,vout1-en-low:
> > +    description:
> > +      BD9576 and BD9573 VOUT1 regulator enable state can be
> > individually
> > +      controlled by a GPIO. This is dictated by state of vout1-en
> > pin during
> > +      the PMIC startup. If vout1-en is LOW during PMIC startup
> > then the VOUT1
> > +      enable sate is controlled via this pin. Set this property if
> > vout1-en
> > +      is wired to be down at PMIC start-up.
> > +    type: boolean
> > +
> > +  rohm,vout1-en-gpios:
> > +    description:
> > +      GPIO specifier to specify the GPIO connected to vout1-en for
> > vout1 ON/OFF
> > +      state control.
> > +    maxItems: 1
> > +
> > +  rohm,ddr-sel-low:
> > +    description:
> > +      The BD9576 and BD9573 output voltage for DDR can be selected
> > by setting
> > +      the ddr-sel pin low or high. Set this property if ddr-sel is
> > grounded.
> > +    type: boolean
> > +
> > +  rohm,watchdog-enable-gpios:
> > +    description: The GPIO line used to enable the watchdog.
> > +    maxItems: 1
> > +
> > +  rohm,watchdog-ping-gpios:
> > +    description: The GPIO line used to ping the watchdog.
> > +    maxItems: 1
> > +
> > +  hw_margin_ms:
> 
> Needs a vendor prefix.
> 
> s/_/-/
> 
> > +    minimum: 4
> > +    maximum: 4416
> > +    description: Watchog timeout in milliseconds
> 
> Maybe the words in the description should be in the property name as 
> I don't see how 'h/w margin' relates to 'watchdog timeout'.

The hw_margin_ms is an existing property. As I wrote to Guenter:
"hw_margin_ms" is an existing binding for specifying the maximum TMO in
HW (if I understood it correctly). (It is used at least by the generig
GPIO watchdog) I thought it's better to not invent a new vendor
specific binding when we have a generic one.

https://elixir.bootlin.com/linux/v5.9-rc2/source/Documentation/devicetree/bindings/watchdog/gpio-wdt.txt

> 
> Is this a max and below is the min?:
> 
> > +
> > +  rohm,hw-margin-min-ms:
> > +    minimum: 2
> > +    maximum: 220
> > +    description:
> > +      Watchdog on these ICs can be configured in a window mode
> > where the ping
> > +      must come within certain time-window. Eg. too quick pinging
> > will also
> > +      trigger timeout. Specify the minimum delay between pings if
> > you wish to
> > +      use the window mode. Note, the maximum delay is internally
> > configured as
> > +      a certain multiple of this value so maximum delay can be
> > only up to 15
> > +      times this value. For example for 73 ms short ping value the
> > maximum
> > +      timeout will be close to 1 sec.

Yes. I didn't find existing property for "minimum time to ping WDG"
from existing properties. And I think it is not so common to have such
"ping window" in watchdog HW that it would warrant generic minimum tmo.
Hence vendor specific property for minimum tmo.

Would you still prefer me to introduce a new vendor specific property
for "max tmo"?

Best Regards
	Matti Vaittinen
Rob Herring Sept. 23, 2020, 2:27 p.m. UTC | #3
On Sat, Sep 19, 2020 at 5:46 AM Vaittinen, Matti
<Matti.Vaittinen@fi.rohmeurope.com> wrote:
>
> Thanks Rob for taking a look at this!
>
> On Fri, 2020-09-18 at 11:28 -0600, Rob Herring wrote:
> > On Thu, Sep 17, 2020 at 11:01:52AM +0300, Matti Vaittinen wrote:
> > > Add bindings for ROHM BD9576MUF and BD9573MUF PMICs. These
> > > PMICs are primarily intended to be used to power the R-Car series
> > > processors. They provide 6 power outputs, safety features and a
> > > watchdog with two functional modes.
> > >
> > > Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> > > ---
> > >  .../bindings/mfd/rohm,bd9576-pmic.yaml        | 129
> > > ++++++++++++++++++
> > >  1 file changed, 129 insertions(+)
> > >  create mode 100644
> > > Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml
> > >
> > > diff --git a/Documentation/devicetree/bindings/mfd/rohm,bd9576-
> > > pmic.yaml b/Documentation/devicetree/bindings/mfd/rohm,bd9576-
> > > pmic.yaml
> > > new file mode 100644
> > > index 000000000000..f17d4d621585
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml
> > > @@ -0,0 +1,129 @@
> > > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/mfd/rohm,bd9576-pmic.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: ROHM BD9576MUF and BD9573MUF Power Management Integrated
> > > Circuit bindings
> > > +
> > > +maintainers:
> > > +  - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> > > +
> > > +description: |
> > > +  BD9576MUF and BD9573MUF are power management ICs primarily
> > > intended for
> > > +  powering the R-Car series processors.
> > > +  The IC provides 6 power outputs with configurable sequencing and
> > > safety
> > > +  monitoring. A watchdog logic with slow ping/windowed modes is
> > > also included.
> > > +
> > > +properties:
> > > +  compatible:
> > > +    enum:
> > > +      - rohm,bd9576
> > > +      - rohm,bd9573
> > > +
> > > +  reg:
> > > +    description:
> > > +      I2C slave address.
> > > +    maxItems: 1
> > > +
> > > +  interrupts:
> > > +    maxItems: 1
> > > +
> > > +  rohm,vout1-en-low:
> > > +    description:
> > > +      BD9576 and BD9573 VOUT1 regulator enable state can be
> > > individually
> > > +      controlled by a GPIO. This is dictated by state of vout1-en
> > > pin during
> > > +      the PMIC startup. If vout1-en is LOW during PMIC startup
> > > then the VOUT1
> > > +      enable sate is controlled via this pin. Set this property if
> > > vout1-en
> > > +      is wired to be down at PMIC start-up.
> > > +    type: boolean
> > > +
> > > +  rohm,vout1-en-gpios:
> > > +    description:
> > > +      GPIO specifier to specify the GPIO connected to vout1-en for
> > > vout1 ON/OFF
> > > +      state control.
> > > +    maxItems: 1
> > > +
> > > +  rohm,ddr-sel-low:
> > > +    description:
> > > +      The BD9576 and BD9573 output voltage for DDR can be selected
> > > by setting
> > > +      the ddr-sel pin low or high. Set this property if ddr-sel is
> > > grounded.
> > > +    type: boolean
> > > +
> > > +  rohm,watchdog-enable-gpios:
> > > +    description: The GPIO line used to enable the watchdog.
> > > +    maxItems: 1
> > > +
> > > +  rohm,watchdog-ping-gpios:
> > > +    description: The GPIO line used to ping the watchdog.
> > > +    maxItems: 1
> > > +
> > > +  hw_margin_ms:
> >
> > Needs a vendor prefix.
> >
> > s/_/-/
> >
> > > +    minimum: 4
> > > +    maximum: 4416
> > > +    description: Watchog timeout in milliseconds
> >
> > Maybe the words in the description should be in the property name as
> > I don't see how 'h/w margin' relates to 'watchdog timeout'.
>
> The hw_margin_ms is an existing property. As I wrote to Guenter:
> "hw_margin_ms" is an existing binding for specifying the maximum TMO in
> HW (if I understood it correctly). (It is used at least by the generig
> GPIO watchdog) I thought it's better to not invent a new vendor
> specific binding when we have a generic one.
>
> https://elixir.bootlin.com/linux/v5.9-rc2/source/Documentation/devicetree/bindings/watchdog/gpio-wdt.txt

That one is odd and I haven't found an actual user of it. It would
make more sense as a collection of properties devices could use rather
than a virtual device.

I think I'd do something like 'watchdog-ping-time-msec' that can be
either '<min> <max>' or '<max>'.

Rob
Matti Vaittinen Sept. 24, 2020, 6:12 a.m. UTC | #4
On Wed, 2020-09-23 at 08:27 -0600, Rob Herring wrote:
> On Sat, Sep 19, 2020 at 5:46 AM Vaittinen, Matti
> <Matti.Vaittinen@fi.rohmeurope.com> wrote:
> > Thanks Rob for taking a look at this!
> > 
> > On Fri, 2020-09-18 at 11:28 -0600, Rob Herring wrote:
> > > On Thu, Sep 17, 2020 at 11:01:52AM +0300, Matti Vaittinen wrote:
> > > > Add bindings for ROHM BD9576MUF and BD9573MUF PMICs. These
> > > > PMICs are primarily intended to be used to power the R-Car
> > > > series
> > > > processors. They provide 6 power outputs, safety features and a
> > > > watchdog with two functional modes.
> > > > 
> > > > Signed-off-by: Matti Vaittinen <
> > > > matti.vaittinen@fi.rohmeurope.com>
> > > > ---
> > > >  .../bindings/mfd/rohm,bd9576-pmic.yaml        | 129
> > > > ++++++++++++++++++
> > > >  1 file changed, 129 insertions(+)
> > > >  create mode 100644
> > > > Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml
> > > > 
> > > > diff --git a/Documentation/devicetree/bindings/mfd/rohm,bd9576-
> > > > pmic.yaml b/Documentation/devicetree/bindings/mfd/rohm,bd9576-
> > > > pmic.yaml
> > > > new file mode 100644
> > > > index 000000000000..f17d4d621585
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/mfd/rohm,bd9576-
> > > > pmic.yaml
> > > > @@ -0,0 +1,129 @@
> > > > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > > > +%YAML 1.2
> > > > +---
> > > > +$id: http://devicetree.org/schemas/mfd/rohm,bd9576-pmic.yaml#
> > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > +
> > > > +title: ROHM BD9576MUF and BD9573MUF Power Management
> > > > Integrated
> > > > Circuit bindings
> > > > +
> > > > +maintainers:
> > > > +  - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> > > > +
> > > > +description: |
> > > > +  BD9576MUF and BD9573MUF are power management ICs primarily
> > > > intended for
> > > > +  powering the R-Car series processors.
> > > > +  The IC provides 6 power outputs with configurable sequencing
> > > > and
> > > > safety
> > > > +  monitoring. A watchdog logic with slow ping/windowed modes
> > > > is
> > > > also included.
> > > > +
> > > > +properties:
> > > > +  compatible:
> > > > +    enum:
> > > > +      - rohm,bd9576
> > > > +      - rohm,bd9573
> > > > +
> > > > +  reg:
> > > > +    description:
> > > > +      I2C slave address.
> > > > +    maxItems: 1
> > > > +
> > > > +  interrupts:
> > > > +    maxItems: 1
> > > > +
> > > > +  rohm,vout1-en-low:
> > > > +    description:
> > > > +      BD9576 and BD9573 VOUT1 regulator enable state can be
> > > > individually
> > > > +      controlled by a GPIO. This is dictated by state of
> > > > vout1-en
> > > > pin during
> > > > +      the PMIC startup. If vout1-en is LOW during PMIC startup
> > > > then the VOUT1
> > > > +      enable sate is controlled via this pin. Set this
> > > > property if
> > > > vout1-en
> > > > +      is wired to be down at PMIC start-up.
> > > > +    type: boolean
> > > > +
> > > > +  rohm,vout1-en-gpios:
> > > > +    description:
> > > > +      GPIO specifier to specify the GPIO connected to vout1-en 
> > > > for
> > > > vout1 ON/OFF
> > > > +      state control.
> > > > +    maxItems: 1
> > > > +
> > > > +  rohm,ddr-sel-low:
> > > > +    description:
> > > > +      The BD9576 and BD9573 output voltage for DDR can be
> > > > selected
> > > > by setting
> > > > +      the ddr-sel pin low or high. Set this property if ddr-
> > > > sel is
> > > > grounded.
> > > > +    type: boolean
> > > > +
> > > > +  rohm,watchdog-enable-gpios:
> > > > +    description: The GPIO line used to enable the watchdog.
> > > > +    maxItems: 1
> > > > +
> > > > +  rohm,watchdog-ping-gpios:
> > > > +    description: The GPIO line used to ping the watchdog.
> > > > +    maxItems: 1
> > > > +
> > > > +  hw_margin_ms:
> > > 
> > > Needs a vendor prefix.
> > > 
> > > s/_/-/
> > > 
> > > > +    minimum: 4
> > > > +    maximum: 4416
> > > > +    description: Watchog timeout in milliseconds
> > > 
> > > Maybe the words in the description should be in the property name
> > > as
> > > I don't see how 'h/w margin' relates to 'watchdog timeout'.
> > 
> > The hw_margin_ms is an existing property. As I wrote to Guenter:
> > "hw_margin_ms" is an existing binding for specifying the maximum
> > TMO in
> > HW (if I understood it correctly). (It is used at least by the
> > generig
> > GPIO watchdog) I thought it's better to not invent a new vendor
> > specific binding when we have a generic one.
> > 
> > https://elixir.bootlin.com/linux/v5.9-rc2/source/Documentation/devicetree/bindings/watchdog/gpio-wdt.txt
> 
> That one is odd and I haven't found an actual user of it. It would
> make more sense as a collection of properties devices could use
> rather
> than a virtual device.
> 
> I think I'd do something like 'watchdog-ping-time-msec' that can be
> either '<min> <max>' or '<max>'.

Your suggestion looks good to me. If we introduce such then it would
make sense to add handling for this in GPIO watchdog too.

What I do wonder is how "hw_margin_ms" is unused? I see it is a
required property for GPIO watchdog. The GPIO WDG probe seems to
actually error out if reading this property fails with any error. I
would assume the GPIO WDG is used somewhere? Hence I am a bit afraid of
touching it. Breaking existing setups would not be nice.

Guenter - how do you see this? Should we leave GPIO WDG as it is,
convert it to use this new binding Rob suggested - or support both the
old and new (at least for some time) in the driver - and possibly print
a warning when old is used?

Best Regards
	Matti Vaittinen
Matti Vaittinen Sept. 24, 2020, 9:06 a.m. UTC | #5
Hi dee Ho peeps!

On Thu, 2020-09-24 at 09:12 +0300, Matti Vaittinen wrote:
> On Wed, 2020-09-23 at 08:27 -0600, Rob Herring wrote:
> > On Sat, Sep 19, 2020 at 5:46 AM Vaittinen, Matti
> > <Matti.Vaittinen@fi.rohmeurope.com> wrote:
> > > Thanks Rob for taking a look at this!
> > > 
> > > On Fri, 2020-09-18 at 11:28 -0600, Rob Herring wrote:
> > > > On Thu, Sep 17, 2020 at 11:01:52AM +0300, Matti Vaittinen
> > > > wrote:
> > > > > Add bindings for ROHM BD9576MUF and BD9573MUF PMICs. These
> > > > > PMICs are primarily intended to be used to power the R-Car
> > > > > series
> > > > > processors. They provide 6 power outputs, safety features and
> > > > > a
> > > > > watchdog with two functional modes.
> > > > > 
> > > > > Signed-off-by: Matti Vaittinen <
> > > > > matti.vaittinen@fi.rohmeurope.com>
> > > > > ---
> > > > >  .../bindings/mfd/rohm,bd9576-pmic.yaml        | 129
> > > > > ++++++++++++++++++
> > > > >  1 file changed, 129 insertions(+)
> > > > >  create mode 100644
> > > > > Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml

// Snip

> > > > > +
> > > > > +  hw_margin_ms:
> > > > 
> > > > Needs a vendor prefix.
> > > > 
> > > > s/_/-/
> > > > 
> > > > > +    minimum: 4
> > > > > +    maximum: 4416
> > > > > +    description: Watchog timeout in milliseconds
> > > > 
> > > > Maybe the words in the description should be in the property
> > > > name
> > > > as
> > > > I don't see how 'h/w margin' relates to 'watchdog timeout'.
> > > 
> > > The hw_margin_ms is an existing property. As I wrote to Guenter:
> > > "hw_margin_ms" is an existing binding for specifying the maximum
> > > TMO in
> > > HW (if I understood it correctly). (It is used at least by the
> > > generig
> > > GPIO watchdog) I thought it's better to not invent a new vendor
> > > specific binding when we have a generic one.
> > > 
> > > https://elixir.bootlin.com/linux/v5.9-rc2/source/Documentation/devicetree/bindings/watchdog/gpio-wdt.txt
> > 
> > That one is odd and I haven't found an actual user of it. It would
> > make more sense as a collection of properties devices could use
> > rather
> > than a virtual device.
> > 
> > I think I'd do something like 'watchdog-ping-time-msec' that can be
> > either '<min> <max>' or '<max>'.
> 
> Your suggestion looks good to me. If we introduce such then it would
> make sense to add handling for this in GPIO watchdog too.
> 
> What I do wonder is how "hw_margin_ms" is unused? I see it is a
> required property for GPIO watchdog. The GPIO WDG probe seems to
> actually error out if reading this property fails with any error. I
> would assume the GPIO WDG is used somewhere? Hence I am a bit afraid
> of
> touching it. Breaking existing setups would not be nice.
> 
> Guenter - how do you see this? Should we leave GPIO WDG as it is,
> convert it to use this new binding Rob suggested - or support both
> the
> old and new (at least for some time) in the driver - and possibly
> print
> a warning when old is used?

And one thing more - I don't think the 'watchdog-ping-time-msec' is
best candidate as it sounds like the time when one should ping the WDG
(SW feature). We already have the timeout-sec defined for that. This
new property is to configure/advertice the HW time limit - Eg, time
when WDG takes action if it has not been pinged (for max) or takes
action if WDG is pinged too quickly (min). Thus I liked hw-margin
better than ping-time. (For example with hw-margin <500ms> ... <4000ms>
the ping-time 1000 ms would be just fine.

Couple of things I would like to get opinions for ... 

1. Corect location for this binding - and should it be vendor specific
or generic?
 - I wonder if I should put this new property in rohm-bd9576.yaml? 
 - Should it be vendor specific? 
 - Or should I put it in watchdog.yaml and make it generic?

I think it should be generic as many wdg chips implement the timeout
configuration.

2. Should we extend WDG core to parse this property if it is placed in
watchdog.yaml?
2a) And should we extend watchdog core to call the driver callback for
setting timeout if it finds the <max> tmo?
2b) Should we extend driver IF to allow callback for setting min tmo?
2c) Current tmo setting callback uses units of seconds. Should we
support setting TMO in ms? I think it might make sense for few specific
Linux setups. (I know people use Linux for things that are almost RT -
no matter how clever that is. So some might benefit from sub-second
scale wdg window).

Thoughts?

Best Regards
	Matti Vaittinen


--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~

Simon says - in Latin please.
"non cogito me" dixit Rene Descarte, deinde evanescavit

(Thanks for the translation Simon)
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml b/Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml
new file mode 100644
index 000000000000..f17d4d621585
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/rohm,bd9576-pmic.yaml
@@ -0,0 +1,129 @@ 
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/rohm,bd9576-pmic.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ROHM BD9576MUF and BD9573MUF Power Management Integrated Circuit bindings
+
+maintainers:
+  - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
+
+description: |
+  BD9576MUF and BD9573MUF are power management ICs primarily intended for
+  powering the R-Car series processors.
+  The IC provides 6 power outputs with configurable sequencing and safety
+  monitoring. A watchdog logic with slow ping/windowed modes is also included.
+
+properties:
+  compatible:
+    enum:
+      - rohm,bd9576
+      - rohm,bd9573
+
+  reg:
+    description:
+      I2C slave address.
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  rohm,vout1-en-low:
+    description:
+      BD9576 and BD9573 VOUT1 regulator enable state can be individually
+      controlled by a GPIO. This is dictated by state of vout1-en pin during
+      the PMIC startup. If vout1-en is LOW during PMIC startup then the VOUT1
+      enable sate is controlled via this pin. Set this property if vout1-en
+      is wired to be down at PMIC start-up.
+    type: boolean
+
+  rohm,vout1-en-gpios:
+    description:
+      GPIO specifier to specify the GPIO connected to vout1-en for vout1 ON/OFF
+      state control.
+    maxItems: 1
+
+  rohm,ddr-sel-low:
+    description:
+      The BD9576 and BD9573 output voltage for DDR can be selected by setting
+      the ddr-sel pin low or high. Set this property if ddr-sel is grounded.
+    type: boolean
+
+  rohm,watchdog-enable-gpios:
+    description: The GPIO line used to enable the watchdog.
+    maxItems: 1
+
+  rohm,watchdog-ping-gpios:
+    description: The GPIO line used to ping the watchdog.
+    maxItems: 1
+
+  hw_margin_ms:
+    minimum: 4
+    maximum: 4416
+    description: Watchog timeout in milliseconds
+
+  rohm,hw-margin-min-ms:
+    minimum: 2
+    maximum: 220
+    description:
+      Watchdog on these ICs can be configured in a window mode where the ping
+      must come within certain time-window. Eg. too quick pinging will also
+      trigger timeout. Specify the minimum delay between pings if you wish to
+      use the window mode. Note, the maximum delay is internally configured as
+      a certain multiple of this value so maximum delay can be only up to 15
+      times this value. For example for 73 ms short ping value the maximum
+      timeout will be close to 1 sec.
+
+  regulators:
+    $ref: ../regulator/rohm,bd9576-regulator.yaml
+    description:
+      List of child nodes that specify the regulators.
+
+required:
+  - compatible
+  - reg
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/leds/common.h>
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        pmic: pmic@30 {
+            compatible = "rohm,bd9576";
+            reg = <0x30>;
+            rohm,vout1-en-low;
+            rohm,vout1-en-gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>;
+            rohm,ddr-sel-low;
+            rohm,watchdog-enable-gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>;
+            rohm,watchdog-ping-gpios = <&gpio2 7 GPIO_ACTIVE_HIGH>;
+            hw_margin_ms = <30>;
+            rohm,hw-margin-min-ms = <4>;
+
+            regulators {
+                boost1: regulator-vd50 {
+                    regulator-name = "VD50";
+                };
+                buck1: regulator-vd18 {
+                    regulator-name = "VD18";
+                };
+                buck2: regulator-vdddr {
+                    regulator-name = "vdddr";
+                };
+                buck3: regulator-vd10 {
+                    regulator-name = "vd10";
+                };
+                ldo: regulator-voutl1 {
+                    regulator-name = "VOUTL1";
+                };
+                sw: regulator-vouts1 {
+                    regulator-name = "VOUTS1";
+                };
+            };
+        };
+    };