From patchwork Mon Sep 13 08:00:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 509953 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6070C433EF for ; Mon, 13 Sep 2021 08:00:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE44260FBF for ; Mon, 13 Sep 2021 08:00:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237840AbhIMIBu (ORCPT ); Mon, 13 Sep 2021 04:01:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237838AbhIMIBt (ORCPT ); Mon, 13 Sep 2021 04:01:49 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2010DC061762 for ; Mon, 13 Sep 2021 01:00:34 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id a4so19230223lfg.8 for ; Mon, 13 Sep 2021 01:00:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8u0fRL7/WtYh13V0VL96ZPbNOKZAmwP1HL9vKQArsNU=; b=N8uo1W5bIWEeY6l3C2BNxEYJ40i32+XodLrhXu8Kdbrrv82LcoZIG1BCCH+6ZUb+xF ZXl9IS/4ppRT2jmTTvrR7WyL6vuM3qriR2A6z6Djh5mA4lTTgwjC63UJ5spNG/aDtrPE Yk/v31W4WIc21mP7seCIW7gHltGU60rxOIgtdSyhwN8Ip7yO2pRoYwRwzHYfaGMOazHk JAW/RA3sfif+VeH8DOEte+0OrYgGCo3m5XTNeCbrAr8xUtm8BFVDtKcL800fSQjJDlx7 ujHpWcXMJn1v6Am5x1YiTEolK5NOI7bwWyvWOqD7zOhGtjn6g2J21C/licj92lEwrU9h rVEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8u0fRL7/WtYh13V0VL96ZPbNOKZAmwP1HL9vKQArsNU=; b=8GE0QyuauWazbT9fSBKaPEv/MSlbprlitK8Woouh7r1Pn+IZfDj9BXI9d9HyNes+cE Vn5Q/w2TfRD7+T7y7bvwcybjto1Q26FiSOB2kheYV87ufHAUQZUMnLDtmgwZrx49mXOK GsV9SX2WwLW0jkQHcXg9fvpBwiTYEwz/C8sII3hshAswfLV7aUqCW4Zf2/40Tz+gzxjr Zi7vh68PsMlZU5Xy5WCsPhDsQ0slhGhewIqt38xwTBbhE9H5p++jBeGIq3A4LufNIGzf jjVmxOECpBgW+f8Tw7q97QMjoq8nzWyw3EptVSbuiI48Kk9kjbYUGqgz2qyyxZ5epKaK gRVg== X-Gm-Message-State: AOAM530LV8ZZEv0BcMlT81rQvUJpLMCbnZAIu/l/BzLdl0yckLN02GKj /EGbjJuzrd4LcD2wfswzpuA= X-Google-Smtp-Source: ABdhPJwtAtZdB6NNq0qSlE2Pn4jMd+9FtZOAFlcXue44QZOy3MVnTmt5XGM7en9RAeBIe43H5R0j4w== X-Received: by 2002:a05:6512:4008:: with SMTP id br8mr5800865lfb.23.1631520032515; Mon, 13 Sep 2021 01:00:32 -0700 (PDT) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id t13sm747059lff.46.2021.09.13.01.00.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 01:00:32 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Kishon Vijay Abraham I , Vinod Koul , Lee Jones , Rob Herring Cc: linux-phy@lists.infradead.org, Florian Fainelli , Chunfeng Yun , devicetree@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH 1/4] dt-bindings: mfd: brcm,cru: add clkset syscon Date: Mon, 13 Sep 2021 10:00:21 +0200 Message-Id: <20210913080024.6951-1-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Rafał Miłecki CRU has a shared register that is used e.g. to control USB 2.0 PHY block access. It's a single 32 b register. Document it as syscon so it can be used with a regmap. Signed-off-by: Rafał Miłecki Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/mfd/brcm,cru.yaml | 8 ++++++++ Documentation/devicetree/bindings/mfd/syscon.yaml | 1 + 2 files changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/brcm,cru.yaml b/Documentation/devicetree/bindings/mfd/brcm,cru.yaml index fc1317ab3226..bf4e585d3c18 100644 --- a/Documentation/devicetree/bindings/mfd/brcm,cru.yaml +++ b/Documentation/devicetree/bindings/mfd/brcm,cru.yaml @@ -39,6 +39,9 @@ patternProperties: '^clock-controller@[a-f0-9]+$': $ref: ../clock/brcm,iproc-clocks.yaml + '^syscon@[a-f0-9]+$': + $ref: syscon.yaml + '^thermal@[a-f0-9]+$': $ref: ../thermal/brcm,ns-thermal.yaml @@ -73,6 +76,11 @@ examples: "iprocfast", "sata1", "sata2"; }; + syscon@180 { + compatible = "brcm,cru-clkset", "syscon"; + reg = <0x180 0x4>; + }; + pinctrl { compatible = "brcm,bcm4708-pinmux"; offset = <0x1c0>; diff --git a/Documentation/devicetree/bindings/mfd/syscon.yaml b/Documentation/devicetree/bindings/mfd/syscon.yaml index abe3fd817e0b..0dcffc273c2b 100644 --- a/Documentation/devicetree/bindings/mfd/syscon.yaml +++ b/Documentation/devicetree/bindings/mfd/syscon.yaml @@ -38,6 +38,7 @@ properties: - allwinner,sun8i-h3-system-controller - allwinner,sun8i-v3s-system-controller - allwinner,sun50i-a64-system-controller + - brcm,cru-clkset - hisilicon,dsa-subctrl - hisilicon,hi6220-sramctrl - hisilicon,pcie-sas-subctrl From patchwork Mon Sep 13 08:00:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 511217 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89C8FC433FE for ; Mon, 13 Sep 2021 08:00:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7153F61004 for ; Mon, 13 Sep 2021 08:00:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237855AbhIMIBx (ORCPT ); Mon, 13 Sep 2021 04:01:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237838AbhIMIBv (ORCPT ); Mon, 13 Sep 2021 04:01:51 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D74FCC061574 for ; Mon, 13 Sep 2021 01:00:35 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id i7so3052084lfr.13 for ; Mon, 13 Sep 2021 01:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ygJ8+TTyO2TV1eqf1wmE9UFoLoL7v5Vtx+glrXFSGyc=; b=i2ybDonmhlLSPRvcTL4w7fMCcPKnFTDWuj4crFhpLu3j5C5SCUcqlyaE1SVKnh+iE7 HOX5P1G4l9j6hFG1NwUcLLKDBi2iiPCA/EqlX90/JnmelnJX/uf374crfwrpfx4Jtr8o 9PZ9Q6dCrffAZ3rOhD+cCGQ1MS/4qB5Ql73zCkfH0O5kuRphG9NwP4fOaYJT4yQoQIhn PG3dPHfj2W29EmItpuv9hRz6/iNyC+oaK4T5QAdzr2OZvL6/R3XVQKDKgW34e9x9SXt7 EdiYIjBKokD6Lz/T8K6T8Q2CTzLST4qn1vIsadjpVaS6XLD7ovrQH20cqa3mFWFvr66d RJyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ygJ8+TTyO2TV1eqf1wmE9UFoLoL7v5Vtx+glrXFSGyc=; b=EQ9QgSrPCVC8nOotbc6n5JSA2RD0L4S/nEwS+APyAFx//k9nLiL0YteyFqpkK5ZfUs lxT5ilsjzgDeb+v29rtQbTDBG5dya1bO14dgFh4Kzk4yON7/Np7Tk7w6+VtkaAqA+jMr LkP1JqEOIcc2/jh5+uUMujv0OZN+paPMPIS+36Gw8MsixY7FVmZBLMAIfGuQHhVF+yXu yFY0N82lKSPpIBvrBP7UH+khEOFx261lkamrzMIc/yWXtWwlnReogtyhbxeyfdVrhGYc +CDor4lkKxs0BReIJsNGa0Aq1fCXCrbVCPZ5Jsb+6sKEURAkR8FtQhnZCUvyNxKVtSjs elfw== X-Gm-Message-State: AOAM532FlpDUbXJk/xVdy3W6KvcvvKxd3QdkbL4dhu5MY27cQTjrUA18 /OJ1/GmE9z4C7whVmCy5oj0= X-Google-Smtp-Source: ABdhPJx0+UW8Q3+/Fm2tU/fZcSP7+gBFgsoCHE0ltnjp388+fOkrei/2tRgR3ZDQ04xs8Liu2gvQZw== X-Received: by 2002:a05:6512:33c3:: with SMTP id d3mr7389359lfg.194.1631520034293; Mon, 13 Sep 2021 01:00:34 -0700 (PDT) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id t13sm747059lff.46.2021.09.13.01.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 01:00:33 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Kishon Vijay Abraham I , Vinod Koul , Lee Jones , Rob Herring Cc: linux-phy@lists.infradead.org, Florian Fainelli , Chunfeng Yun , devicetree@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH 2/4] dt-bindings: phy: brcm, ns-usb2-phy: bind just a PHY block Date: Mon, 13 Sep 2021 10:00:22 +0200 Message-Id: <20210913080024.6951-2-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210913080024.6951-1-zajec5@gmail.com> References: <20210913080024.6951-1-zajec5@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Rafał Miłecki The old binding was covering the whole DMU block space (DMU block contains CRU block which contains USB PHY). It was a bad design, overkill and a non-generic solution. Northstar's USB 2.0 PHY is a small block (part of the CRU MFD) and binding should be designed to represent that properly. Rework the binding to map just PHY with the "reg" property and use syscon to reference shared register that controls block access. The old binding is deprecated now. Signed-off-by: Rafał Miłecki Reviewed-by: Rob Herring --- .../bindings/phy/bcm-ns-usb2-phy.yaml | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.yaml index 05b4dcd80019..426101530a21 100644 --- a/Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.yaml +++ b/Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.yaml @@ -18,13 +18,21 @@ properties: const: brcm,ns-usb2-phy reg: - items: - - description: iomem address range of DMU (Device Management Unit) + anyOf: + - maxItems: 1 + description: PHY control register + - maxItems: 1 + description: iomem address range of DMU (Device Management Unit) + deprecated: true reg-names: items: - const: dmu + brcm,syscon-clkset: + description: phandle to syscon for clkset register + $ref: /schemas/types.yaml#/definitions/phandle + clocks: items: - description: USB PHY reference clock @@ -39,20 +47,25 @@ properties: required: - compatible - reg - - reg-names - clocks - clock-names - "#phy-cells" +oneOf: + - required: + - brcm,syscon-clkset + - required: + - reg-names + additionalProperties: false examples: - | #include - phy@1800c000 { + phy@1800c164 { compatible = "brcm,ns-usb2-phy"; - reg = <0x1800c000 0x1000>; - reg-names = "dmu"; + reg = <0x1800c164 0x4>; + brcm,syscon-clkset = <&clkset>; clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>; clock-names = "phy-ref-clk"; #phy-cells = <0>; From patchwork Mon Sep 13 08:00:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 509952 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48642C433EF for ; Mon, 13 Sep 2021 08:00:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A50860F92 for ; Mon, 13 Sep 2021 08:00:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237838AbhIMIBy (ORCPT ); Mon, 13 Sep 2021 04:01:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237853AbhIMIBx (ORCPT ); Mon, 13 Sep 2021 04:01:53 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2B71C0613C1 for ; Mon, 13 Sep 2021 01:00:37 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id s10so19215258lfr.11 for ; Mon, 13 Sep 2021 01:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vlYI72az+h1GSzT+KG/59hM5JtHvcZcByQ0ounNHO2U=; b=DPK3BL4e38LGamDuhR47D9vYop2OOzeDkoJkoRfQUS17RgpWs74+DhDV1Hj9DFji/o xr8wl0cYH5ymAEBdo7LFalu2Y5g1EjRilB7yK003AmuB3feVGtv8jEOIqDbHREoDRZ11 7t/+UiFhiK6+fb/3pwq3Wzq7aNxWExKeptBoM2iIZao8NExX+tsAYqudgREe9DKbtYDf 52JJXyiUQeWJa7y/TbOW/8rW2+IuTLDawya+CWSGil1R3e3721B+aVHIYhd82kLE59aF QGsvbYa1/t0DrCz0HB+3IC/yHIKKftiL+6tMyvqCSf1/HK0GtfTST0ZwPyMRNyXoqNQj 1CBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vlYI72az+h1GSzT+KG/59hM5JtHvcZcByQ0ounNHO2U=; b=buroC5RH1vT6Ceo0l3Y24GIjNQxZ05Ao941ivcAs/biFOUuS8RawiLPAbFAQwgYGwO n22DsAlfx4obzJrlx0WBbXKwnd1Ub9XVo5wd6ORFLiop+3pYUKG2w8qqMtWbNBbr3F5u dPKFErJuwsBZ6Z3VSkTjRPQiuTGrX+epsRRzsf3G4cM8pMsxw2d5Yp2VoW0PPHQJf4zU 3n8v5DrQ4ZC6PbXE1UYxEqFLTpHhNA7/fWkTWqUDnCDQP0uVVA1Bx3MkuVSC3UJDPXyd YJgu1BTQeAlfRDzFsHRKJZXj1ufvezbzpS5i/zm/jHfz5xnEc0q5qcH/SIZ0dnqNp2BY MELw== X-Gm-Message-State: AOAM531D8Lllh9hJ5GzyRjco37TWloJQ7TMkmb9cpqjyWswoInvKpxrf 7jACnAQ+tJh5EWdWLUPxrSM= X-Google-Smtp-Source: ABdhPJxUllraKRY8XIslWCFTdKHXnhkQWzeqy+WPW56KQM0UrCO8UgCllmPbOcb+rQzy5LYj20jUIA== X-Received: by 2002:a19:3818:: with SMTP id f24mr8119306lfa.601.1631520036157; Mon, 13 Sep 2021 01:00:36 -0700 (PDT) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id t13sm747059lff.46.2021.09.13.01.00.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 01:00:35 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Kishon Vijay Abraham I , Vinod Koul , Lee Jones , Rob Herring Cc: linux-phy@lists.infradead.org, Florian Fainelli , Chunfeng Yun , devicetree@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH 3/4] dt-bindings: mfd: brcm,cru: add USB 2.0 PHY Date: Mon, 13 Sep 2021 10:00:23 +0200 Message-Id: <20210913080024.6951-3-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210913080024.6951-1-zajec5@gmail.com> References: <20210913080024.6951-1-zajec5@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Rafał Miłecki Northstar's USB 2.0 PHY is part of the CRU MFD. Signed-off-by: Rafał Miłecki Reviewed-by: Rob Herring --- .../devicetree/bindings/mfd/brcm,cru.yaml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/mfd/brcm,cru.yaml b/Documentation/devicetree/bindings/mfd/brcm,cru.yaml index bf4e585d3c18..262284ae80f1 100644 --- a/Documentation/devicetree/bindings/mfd/brcm,cru.yaml +++ b/Documentation/devicetree/bindings/mfd/brcm,cru.yaml @@ -39,6 +39,9 @@ patternProperties: '^clock-controller@[a-f0-9]+$': $ref: ../clock/brcm,iproc-clocks.yaml + '^phy@[a-f0-9]+$': + $ref: ../phy/bcm-ns-usb2-phy.yaml + '^syscon@[a-f0-9]+$': $ref: syscon.yaml @@ -52,6 +55,7 @@ required: examples: - | + #include cru-bus@1800c100 { compatible = "brcm,ns-cru", "simple-mfd"; reg = <0x1800c100 0x1d0>; @@ -76,7 +80,16 @@ examples: "iprocfast", "sata1", "sata2"; }; - syscon@180 { + phy@164 { + compatible = "brcm,ns-usb2-phy"; + reg = <0x164 0x4>; + brcm,syscon-clkset = <&clkset>; + clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>; + clock-names = "phy-ref-clk"; + #phy-cells = <0>; + }; + + clkset: syscon@180 { compatible = "brcm,cru-clkset", "syscon"; reg = <0x180 0x4>; }; From patchwork Mon Sep 13 08:00:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 511216 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8715C433FE for ; Mon, 13 Sep 2021 08:00:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE0AF61004 for ; Mon, 13 Sep 2021 08:00:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237775AbhIMIBz (ORCPT ); Mon, 13 Sep 2021 04:01:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237796AbhIMIBz (ORCPT ); Mon, 13 Sep 2021 04:01:55 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8491C061574 for ; Mon, 13 Sep 2021 01:00:39 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id g1so7758111lfj.12 for ; Mon, 13 Sep 2021 01:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8Y5f7mSG/Z4kpKHyPCOHxfNeioXgmOEZEZUSqKOsaYE=; b=MOvB4u7DxrRG7GkuoSJRj4wpNAKnTOeqOwRc//qPvxb/IRzRrmzB9442GS8q32GPQ7 rUyffWyQHt6jhfwciVi5YscsZFFJExuTzSqHxox7Tzznwb/0JZLiowNuMHuoOP21CvTy TUVWzwfpgnx5ztrve/gNVenPJdy1ebq8yLWbdNuaR08XmzdLaDC4GxrItTMvHbrsEEU7 +6wAV4ab/J2HfYEZUHn9ybpb9K4gxbJyjomeCjN48851sT5HhgA/lEo23gT7+bVSX7uQ UOno0QDQUB/CbylaiaLwaPwUid6uwaewz5GcFlZ+vhxORjiudNO/QVmP++lMn1vffxwW sMtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8Y5f7mSG/Z4kpKHyPCOHxfNeioXgmOEZEZUSqKOsaYE=; b=ttDllUdfRbBk0YOxboZgr637st08yHYGXrFi39xDLz5mK/ezNTMMu5EAi8dEo6ra7Y Puo2pkDlIKhSVgvjSghdoGIRaeMwo8JtODl3hVrwAajQtoFZCOfVPwMrwvf41WiX+5Zh TUPOIYZHKH8Q1zCBBVrZqwZigpE1YnzNB02w+yVdWU5kOduqLbWCGnBEG4KvWGW+zDvg Xls3BIXt3iuQP+y7fR6k9tws3L4MoblFu6g9rLLmq8ZLhZk+NTDDiXb/7LjREJy/ruAE QnCAQlCMbE7fedX7x0Aoc7VbC7xnyk+AlHv+Mtp0EYbsMLgAqDRGydWazYQtMEVzKNP6 2TRA== X-Gm-Message-State: AOAM530DpAO0iIhvUZBakfuCpYqrQprExnK7ZVOzU5P1ZMJFxssSP/Yc gIWCc/kqVvafuk9pg+fOiJ0= X-Google-Smtp-Source: ABdhPJyPCwAiyRpWpSima2Twrhc/9WwN43NHYTDarTV3e5vdg9OWv7I4NVTpYnicJ9h8qzcGAzDEMg== X-Received: by 2002:a05:6512:3c99:: with SMTP id h25mr7946722lfv.640.1631520038031; Mon, 13 Sep 2021 01:00:38 -0700 (PDT) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id t13sm747059lff.46.2021.09.13.01.00.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 01:00:37 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Kishon Vijay Abraham I , Vinod Koul , Lee Jones , Rob Herring Cc: linux-phy@lists.infradead.org, Florian Fainelli , Chunfeng Yun , devicetree@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH 4/4] phy: bcm-ns-usb2: support updated DT binding with PHY reg space Date: Mon, 13 Sep 2021 10:00:24 +0200 Message-Id: <20210913080024.6951-4-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210913080024.6951-1-zajec5@gmail.com> References: <20210913080024.6951-1-zajec5@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Rafał Miłecki Updated DT binding maps just a PHY's register space instead of the whole DMU block. Accessing a common CRU reg is handled using syscon & regmap. The old binding has been deprecated and remains supported as a fallback method. Signed-off-by: Rafał Miłecki --- drivers/phy/broadcom/phy-bcm-ns-usb2.c | 52 +++++++++++++++++++++----- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/drivers/phy/broadcom/phy-bcm-ns-usb2.c b/drivers/phy/broadcom/phy-bcm-ns-usb2.c index 4b015b8a71c3..98d32729a45d 100644 --- a/drivers/phy/broadcom/phy-bcm-ns-usb2.c +++ b/drivers/phy/broadcom/phy-bcm-ns-usb2.c @@ -9,17 +9,23 @@ #include #include #include +#include #include #include #include #include #include +#include #include struct bcm_ns_usb2 { struct device *dev; struct clk *ref_clk; struct phy *phy; + struct regmap *clkset; + void __iomem *base; + + /* Deprecated binding */ void __iomem *dmu; }; @@ -27,7 +33,6 @@ static int bcm_ns_usb2_phy_init(struct phy *phy) { struct bcm_ns_usb2 *usb2 = phy_get_drvdata(phy); struct device *dev = usb2->dev; - void __iomem *dmu = usb2->dmu; u32 ref_clk_rate, usb2ctl, usb_pll_ndiv, usb_pll_pdiv; int err = 0; @@ -44,7 +49,10 @@ static int bcm_ns_usb2_phy_init(struct phy *phy) goto err_clk_off; } - usb2ctl = readl(dmu + BCMA_DMU_CRU_USB2_CONTROL); + if (usb2->base) + usb2ctl = readl(usb2->base); + else + usb2ctl = readl(usb2->dmu + BCMA_DMU_CRU_USB2_CONTROL); if (usb2ctl & BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_PDIV_MASK) { usb_pll_pdiv = usb2ctl; @@ -58,15 +66,24 @@ static int bcm_ns_usb2_phy_init(struct phy *phy) usb_pll_ndiv = (1920000000 * usb_pll_pdiv) / ref_clk_rate; /* Unlock DMU PLL settings with some magic value */ - writel(0x0000ea68, dmu + BCMA_DMU_CRU_CLKSET_KEY); + if (usb2->clkset) + regmap_write(usb2->clkset, 0, 0x0000ea68); + else + writel(0x0000ea68, usb2->dmu + BCMA_DMU_CRU_CLKSET_KEY); /* Write USB 2.0 PLL control setting */ usb2ctl &= ~BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_NDIV_MASK; usb2ctl |= usb_pll_ndiv << BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_NDIV_SHIFT; - writel(usb2ctl, dmu + BCMA_DMU_CRU_USB2_CONTROL); + if (usb2->base) + writel(usb2ctl, usb2->base); + else + writel(usb2ctl, usb2->dmu + BCMA_DMU_CRU_USB2_CONTROL); /* Lock DMU PLL settings */ - writel(0x00000000, dmu + BCMA_DMU_CRU_CLKSET_KEY); + if (usb2->clkset) + regmap_write(usb2->clkset, 0, 0x00000000); + else + writel(0x00000000, usb2->dmu + BCMA_DMU_CRU_CLKSET_KEY); err_clk_off: clk_disable_unprepare(usb2->ref_clk); @@ -90,10 +107,27 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev) return -ENOMEM; usb2->dev = dev; - usb2->dmu = devm_platform_ioremap_resource_byname(pdev, "dmu"); - if (IS_ERR(usb2->dmu)) { - dev_err(dev, "Failed to map DMU regs\n"); - return PTR_ERR(usb2->dmu); + if (of_find_property(dev->of_node, "brcm,syscon-clkset", NULL)) { + usb2->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(usb2->base)) { + dev_err(dev, "Failed to map control reg\n"); + return PTR_ERR(usb2->base); + } + + usb2->clkset = syscon_regmap_lookup_by_phandle(dev->of_node, + "brcm,syscon-clkset"); + if (IS_ERR(usb2->clkset)) { + dev_err(dev, "Failed to lookup clkset regmap\n"); + return PTR_ERR(usb2->clkset); + } + } else { + usb2->dmu = devm_platform_ioremap_resource_byname(pdev, "dmu"); + if (IS_ERR(usb2->dmu)) { + dev_err(dev, "Failed to map DMU regs\n"); + return PTR_ERR(usb2->dmu); + } + + dev_warn(dev, "using deprecated DT binding\n"); } usb2->ref_clk = devm_clk_get(dev, "phy-ref-clk");