lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 9 Nov 2022 10:55:25 +0100
From:   AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>
To:     Alexandre Mergnat <amergnat@...libre.com>,
        Fabien Parent <fabien.parent@...aro.org>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Sean Wang <sean.wang@...iatek.com>,
        Mark Brown <broonie@...nel.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Lee Jones <lee@...nel.org>,
        Chen Zhong <chen.zhong@...iatek.com>,
        Alessandro Zummo <a.zummo@...ertech.it>,
        Pavel Machek <pavel@....cz>, Rob Herring <robh+dt@...nel.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:     linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-input@...r.kernel.org,
        Fabien Parent <fparent@...libre.com>,
        linux-rtc@...r.kernel.org, Rob Herring <robh@...nel.org>,
        linux-mediatek@...ts.infradead.org, devicetree@...r.kernel.org,
        Mattijs Korpershoek <mkorpershoek@...libre.com>
Subject: Re: [PATCH v4 5/9] dt-bindings: soc: mediatek: convert pwrap
 documentation

Il 08/11/22 19:43, Alexandre Mergnat ha scritto:
> - Convert soc/mediatek/pwrap.txt to soc/mediatek/mediatek,pwrap.yaml
> - MT8365 SoC has 2 additional clock items and a yaml schema for its PMIC
> - Remove pwrap.txt file
> 
> Signed-off-by: Alexandre Mergnat <amergnat@...libre.com>
> ---
>   .../devicetree/bindings/leds/leds-mt6323.txt       |   2 +-
>   Documentation/devicetree/bindings/mfd/mt6397.txt   |   2 +-
>   .../bindings/soc/mediatek/mediatek,pwrap.yaml      | 158 +++++++++++++++++++++
>   .../devicetree/bindings/soc/mediatek/pwrap.txt     |  75 ----------
>   4 files changed, 160 insertions(+), 77 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/leds/leds-mt6323.txt b/Documentation/devicetree/bindings/leds/leds-mt6323.txt
> index 45bf9f7d85f3..73353692efa1 100644
> --- a/Documentation/devicetree/bindings/leds/leds-mt6323.txt
> +++ b/Documentation/devicetree/bindings/leds/leds-mt6323.txt
> @@ -9,7 +9,7 @@ MT6323 PMIC hardware.
>   For MT6323 MFD bindings see:
>   Documentation/devicetree/bindings/mfd/mt6397.txt
>   For MediaTek PMIC wrapper bindings see:
> -Documentation/devicetree/bindings/soc/mediatek/pwrap.txt
> +Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
>   
>   Required properties:
>   - compatible : Must be "mediatek,mt6323-led"
> diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt b/Documentation/devicetree/bindings/mfd/mt6397.txt
> index 79aaf21af8e9..3bee4a42555d 100644
> --- a/Documentation/devicetree/bindings/mfd/mt6397.txt
> +++ b/Documentation/devicetree/bindings/mfd/mt6397.txt
> @@ -13,7 +13,7 @@ MT6397/MT6323 is a multifunction device with the following sub modules:
>   It is interfaced to host controller using SPI interface by a proprietary hardware
>   called PMIC wrapper or pwrap. MT6397/MT6323 MFD is a child device of pwrap.
>   See the following for pwarp node definitions:
> -../soc/mediatek/pwrap.txt
> +../soc/mediatek/mediatek,pwrap.yaml
>   
>   This document describes the binding for MFD device and its sub module.
>   
> diff --git a/Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml b/Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
> new file mode 100644
> index 000000000000..fe83458b801a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
> @@ -0,0 +1,158 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/mediatek/mediatek,pwrap.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Mediatek PMIC Wrapper
> +
> +maintainers:
> +  - Alexandre Mergnat <amergnat@...libre.com>

I say that the maintainer for pwrap is Flora Fu <flora.fu@...iatek.com>....

> +
> +description: |
> +  On MediaTek SoCs the PMIC is connected via SPI. The SPI master interface
> +  is not directly visible to the CPU, but only through the PMIC wrapper
> +  inside the SoC. The communication between the SoC and the PMIC can
> +  optionally be encrypted. Also a non standard Dual IO SPI mode can be
> +  used to increase speed.
> +
> +  IP Pairing
> +
> +  On MT8135 the pins of some SoC internal peripherals can be on the PMIC.
> +  The signals of these pins are routed over the SPI bus using the pwrap
> +  bridge. In the binding description below the properties needed for bridging
> +  are marked with "IP Pairing". These are optional on SoCs which do not support
> +  IP Pairing
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - items:
> +          - enum:
> +              - mediatek,mt2701-pwrap

..snip..

> +  interrupts:
> +    maxItems: 1
> +    description: IRQ for pwrap in SOC

description: PMIC Wrapper interrupt

> +
> +  clocks: true
> +
> +  clock-names: true
> +
> +  resets:
> +    minItems: 1
> +    items:
> +      - description: PMIC wrapper reset
> +      - description: IP pairing reset
> +
> +  reset-names:
> +    minItems: 1
> +    items:
> +      - const: pwrap
> +      - const: pwrap-bridge
> +
> +  pmic:
> +    type: object
> +
> +allOf:
> +  - if:

if `resets` is present, reset-names is *required*...

> +      properties:
> +        compatible:
> +          contains:
> +            const: mediatek,mt8365-pwrap
> +    then:
> +      properties:
> +        pmic:
> +          $ref: /schemas/mfd/mediatek,mt6357.yaml#
> +
> +        clocks:
> +          items:
> +            - description: SPI bus clock
> +            - description: Main module clock
> +            - description: System module clock
> +            - description: Timer module clock
> +        clock-names:
> +          items:
> +            - const: spi
> +            - const: wrap
> +            - const: sys
> +            - const: tmr

For clocks and clock-names... you can declare that globally and set
`minItems: 2` for both: this means that the first two items are mandatory,
but the last two are not.

If you really want to force a validation error when using mediatek,mt8365-pwrap
and not providing `sys` and `tmr` clocks, you can just override minItems.

> +    else:
> +      properties:
> +        pmic:
> +          description: |

You don't need this '|'.

> +            List of child nodes that specify the regulators.
> +            See ../../mfd/mt6397.txt for more details.
> +
> +        clocks:
> +          items:
> +            - description: SPI bus clock
> +            - description: Main module clock
> +        clock-names:
> +          items:
> +            - const: spi
> +            - const: wrap
> +
> +required:
> +  - compatible
> +  - reg
> +  - reg-names
> +  - interrupts
> +  - clocks
> +  - clock-names
> +
> +additionalProperties: true
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    #include <dt-bindings/reset/mt8135-resets.h>
> +
> +    soc {
> +      #address-cells = <2>;
> +      #size-cells = <2>;
> +      pwrap@...0f000 {
> +          compatible = "mediatek,mt8135-pwrap";
> +          reg = <0 0x1000f000 0 0x1000>, <0 0x11017000 0 0x1000>;
> +          reg-names = "pwrap", "pwrap-bridge";
> +          interrupts = <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>;
> +          resets = <&infracfg MT8135_INFRA_PMIC_WRAP_RST>,
> +              <&pericfg MT8135_PERI_PWRAP_BRIDGE_SW_RST>;

Fix indentation please

           resets = <&infracfg MT8135_INFRA_PMIC_WRAP_RST>,
                    <&pericfg MT8135_PERI_PWRAP_BRIDGE_SW_RST>;

> +          reset-names = "pwrap", "pwrap-bridge";
> +          clocks = <&clk26m>, <&clk26m>;

...and also, clocks/clock-names before resets/reset-names please.

> +          clock-names = "spi", "wrap";
> +
> +          pmic {
> +            compatible = "mediatek,mt6397";
> +          };
> +      };
> +    };

Regards,
Angelo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ