lkml.org 
[lkml]   [2021]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/3] dt-bindings: phy: brcm,ns-usb2-phy: bind single CRU reg
From
Date
On 06.03.2021 22:52, Rob Herring wrote:
> On Fri, Feb 26, 2021 at 12:45:00PM +0100, Rafał Miłecki wrote:
>> From: Rafał Miłecki <rafal@milecki.pl>
>>
>> The old binding was using whole DMU space. It was an overkill. DMU is a
>> big block which contains e.g. CRU which contains e.g. PLLs, PHY, pinctrl
>> and thermal blocks.
>>
>> Rework the binding to directly use a single CRU register that controls
>> USB 2.0 PHY. It's still required to reference CRU generic clkset
>> register so add a syscon for that.
>>
>> For a full DMU & CRU description see arch/arm/boot/dts/bcm5301x.dtsi .
>>
>> The old binding is deprecated now.
>>
>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
>> ---
>> This has been verified using dt_binding_check
>>
>> I'd really like to get Rob's ack to make sure I don't do anything stupid
>>
>> It's a reworked version of my abonded 2019 patch:
>> [PATCH V2 1/2] dt-bindings: bcm-ns-usb2-phy: rework binding to use CRU syscon
>> https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20190108123907.19816-1-zajec5@gmail.com/
>> ---
>> .../bindings/phy/brcm,ns-usb2-phy.yaml | 46 +++++++++++++++----
>> 1 file changed, 36 insertions(+), 10 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
>> index b8b683ce8fa9..8e056d4d205a 100644
>> --- a/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
>> +++ b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
>> @@ -16,11 +16,20 @@ properties:
>> const: brcm,ns-usb2-phy
>>
>> reg:
>> - maxItems: 1
>> - description: DMU (Device Management Unit) address range
>> + anyOf:
>> + - maxItems: 1
>> + description: PHY control register
>> + - maxItems: 1
>> + description: DMU (Device Management Unit) address range
>> + deprecated: true
>>
>> reg-names:
>> const: dmu
>> + deprecated: true
>> +
>> + brcm,syscon-clkset:
>> + description: phandle to syscon for clkset register
>> + $ref: /schemas/types.yaml#/definitions/phandle
>
> Don't really need this as it's just a compatible node of the parent
> node.

Thanks


>>
>> clocks:
>> maxItems: 1
>> @@ -34,22 +43,39 @@ properties:
>>
>> required:
>> - reg
>> - - reg-names
>> - clocks
>> - clock-names
>> - "#phy-cells"
>>
>> +oneOf:
>> + - required:
>> + - brcm,syscon-clkset
>> + - required:
>> + - reg-names
>> +
>> additionalProperties: false
>>
>> examples:
>> - |
>> #include <dt-bindings/clock/bcm-nsp.h>
>>
>> - usb2-phy@1800c000 {
>> - compatible = "brcm,ns-usb2-phy";
>> - reg = <0x1800c000 0x1000>;
>> - reg-names = "dmu";
>> - clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
>> - clock-names = "phy-ref-clk";
>> - #phy-cells = <0>;
>> + cru-bus@1800c100 {
>> + compatible = "simple-bus";
>
> A specific compatible is needed for this block.

I've just sent independently following patch:
[PATCH robh next] dt-bindings: bus: add Broadcom CRU


>> + ranges = <0 0x1800c100 0x1a4>;
>> + #address-cells = <1>;
>> + #size-cells = <1>;
>> +
>> + usb2-phy@64 {
>> + compatible = "brcm,ns-usb2-phy";
>> + reg = <0x64 0x4>;
>> + brcm,syscon-clkset = <&clkset>;
>> + clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
>> + clock-names = "phy-ref-clk";
>> + #phy-cells = <0>;
>> + };
>> +
>> + clkset: syscon@80 {
>> + compatible = "brcm,cru-clkset", "syscon";
>> + reg = <0x80 0x4>;
>> + };
>
> Is this going to expand to 0x1a4/4 child nodes? The problem with one
> node per register is I don't know when it ends and you have to
> constantly update your DT.

I'm sorry, I don't fully understand that expanding question.

Most of CRU subblocks are standalone devices occupying multiple
registers. The last one is thermal@1800c2c0. That "brcm,cru-clkset"
seems to be an exception in the CRU space. clkset is a single
register so it should never become reg = <0x80 0x8>;

The finally documented CRU is expected to look like:

cru-bus@1800c100 {
compatible = "brcm,cru", "simple-bus";
reg = <0x1800c100 0x1d0>;
ranges = <0 0x1800c100 0x1d0>;
#address-cells = <1>;
#size-cells = <1>;

lcpll0@0 {
compatible = "brcm,nsp-lcpll0";
reg = <0x0 0x14>;
(...)
};

genpll@40 {
compatible = "brcm,nsp-genpll";
reg = <0x40 0x24>;
(...)
};

usb2-phy@64 {
compatible = "brcm,ns-usb2-phy";
reg = <0x64 0x4>;
brcm,syscon-clkset = <&clkset>;
clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
clock-names = "phy-ref-clk";
#phy-cells = <0>;
};

clkset: syscon@80 {
compatible = "brcm,cru-clkset", "syscon";
reg = <0x80 0x4>;
};

pin-controller@c0 {
compatible = "brcm,bcm4708-pinmux";
reg = <0xc0 0x24>;
(...)
};

thermal@1c0 {
compatible = "brcm,ns-thermal";
reg = <0x1c0 0x10>;
(...)
};
};

\
 
 \ /
  Last update: 2021-03-09 15:53    [W:0.058 / U:0.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site