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=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 3875CC4724C for ; Mon, 4 May 2020 17:26:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 14A9620721 for ; Mon, 4 May 2020 17:26:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="XAlwCmH4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730153AbgEDR0i (ORCPT ); Mon, 4 May 2020 13:26:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729896AbgEDR0i (ORCPT ); Mon, 4 May 2020 13:26:38 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11A05C061A0E for ; Mon, 4 May 2020 10:26:38 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id e6so173063pjt.4 for ; Mon, 04 May 2020 10:26:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=5bWwbHTGljCtRb2v4FMINcuy14H7s7eCSRthMfBkCAw=; b=XAlwCmH4HBaImEpu9Ay6Lnos34G9TFAH5Pb70ZO5pGTtFJ8LHcEx9fUfzuX4kPgy7w /br4h9rc6MpUd4g5jk6cqoBT3CJuSiSWCfXBnNC8Ac2fXDmqV97lHUetcH57v2uVvmxc iLuwh+bcnU2DlXvFE+HBm+7Iv8JIwKB4SN4dk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=5bWwbHTGljCtRb2v4FMINcuy14H7s7eCSRthMfBkCAw=; b=bqspCzygcTX6BwqWEZas9RtgpFSS+zWVGYS1RdWJlGIO9BHuUeHeiukNhBMMG7hmBS 8WGRbj4Ddt1LNWaRt0FUK050mERcW2sSksSZq6picUFtBqzlbwpaBD8zkuD5/RpVrSzT Wf/2Ge+sp+9+pq8SYAWD+iDJL1ZMvDLmR/IDtK5wE9lcFqjIiqH3M7aylAcaKrmGX+aV 4S6yE+A/B2zy2w+R6i+SLFq6GHJQrv0V9frmABtQbqKknR8enCczvn0r6n1DyFhlcqsD Nn7UZ1s1ETobudrK1ZAIOzT1cBsdG92FDsyxUQEUNUm7A2q3B/x78TSH6AKPZfbwGkcs tyiQ== X-Gm-Message-State: AGi0PuYX5ZYz1ERhu01X4BAoUFX91KsnnMEAWeSISbaf+xbnDooC0E4g QgptC9Ub1qvcalMGrfGRvFocCA== X-Google-Smtp-Source: APiQypI2k1rITHWPougNpuY886eWLdTD5Ibc6IOiWSieEi9yviNfnF5qQG3E6I0D4ExCEB+JSvCqZA== X-Received: by 2002:a17:902:c213:: with SMTP id 19mr275393pll.172.1588613197315; Mon, 04 May 2020 10:26:37 -0700 (PDT) Received: from [10.230.182.181] ([192.19.224.250]) by smtp.gmail.com with ESMTPSA id o68sm9235067pfb.206.2020.05.04.10.26.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 May 2020 10:26:36 -0700 (PDT) Subject: Re: Proper DT bindings for Broadcom's DMU node To: =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , "devicetree@vger.kernel.org" , Rob Herring , Vivek Unune Cc: BCM Kernel Feedback , Florian Fainelli References: <7da2db8f-66d0-24ec-d3eb-84247b383a06@gmail.com> From: Ray Jui Message-ID: Date: Mon, 4 May 2020 10:26:44 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <7da2db8f-66d0-24ec-d3eb-84247b383a06@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi Rafal, On 5/4/2020 8:24 AM, Rafał Miłecki wrote: > Hi, > > I need some help with designing proper bindings for Broadcom's DMU > block. We already have it partially covered but it's inconsistent, some > cleanups were rejected and so I want to redesign it as it should be. > > DMU ("Device Management Unit") is a block that can be found on Broadcom > iProc / Northstar devices. On Northstar it's mapped at: > ranges = <0x1800c000 0x1000> > > It contains: > 1. Few random registers, some of them shared by various hardware >    blocks (and possibly hard to abstract?) > 2. At least one sub-block with even more random registers > > Some of known DMU registers are: > reg = <0x100 0x14>    CRU LCPLL control0 > reg = <0x140 0x24>    CRU GENPLL > reg = <0x164 0x04>    CRU_USB2_CONTROL > reg = <0x180 0x04>    CRU_CLKSET_KEY > reg = <0x184 0x04>    CRU_RESET > reg = <0x1c0 0x24>    pinctrl > reg = <0x2a0 0x04>    CRU_STRAPS_CTRL > reg = <0x2c0 0x04>    PVTMON control0 > (Broadcom never released a proper documentation) > > > As you can see there are a few CRU registers (depending on a source it's > a "Clock and Reset Unit" or "Central Resource Unit"). It's said to be > separated block and was described by Scott (from Broadcom) as: "unit > with a lot of random registers to perform various operations". > > As I said, there are also some shared registers: > > CRU_CLKSET_KEY is accessed by: > 1. USB 2.0 PHY driver for (un)locking DMU PLL settings > 2. GMAC for changing 2.66G line rate to 2Gbps > > CRU_STRAPS_CTRL needs to be accessed by: > 1. USB 3.0 PHY driver for PHY connected to MDIO > 2. PCIE driver for PHY connected to MDIO > > > My initial idea was to have something like: > > dmu@1800c000 { >     compatible = "simple-bus"; >     ranges = <0 0x1800c000 0x1000>; >     #address-cells = <1>; >     #size-cells = <1>; > >     cru@100 { >         compatible = "simple-bus"; >         reg = <0x100 0x1a4>; > >         lcpll { ... }; >         genpll { ... }; >         reset { ... }; >     }; > }; > > but Rob noticed that "simple-bus" requires everything in DMU to have > sub-nodes [0] [1]. > > > I thought it can be solved by using compatible = "syscon", "simple-mfd" > and I even got one patch for that accepted [2] [3] (pinctrl). It seems > it slipped through and was possibly a mistake. Another similar patch was > rejected [4] [5] (bcm-ns-usb2-phy). > > What I tried to achieve was something like this: > > dmu@1800c000 { >     compatible = "simple-bus"; >     ranges = <0 0x1800c000 0x1000>; >     #address-cells = <1>; >     #size-cells = <1>; > >     cru: syscon@100 { >         compatible = "syscon", "simple-mfd"; >         reg = <0x100 0x1a4>; >         ranges; >         #address-cells = <1>; >         #size-cells = <1>; > >         lcpll0@0 { >             #clock-cells = <1>; >             compatible = "brcm,nsp-lcpll0"; >             reg = <0x0 0x14>; >         }; > >         genpll@40 { >             #clock-cells = <1>; >             compatible = "brcm,nsp-genpll"; >             reg = <0x40 0x24>; >         }; > >         pin-controller@c0 { >             compatible = "brcm,bcm4708-pinmux"; >             reg = <0xc0 0x24>; >             reg-names = "cru_gpio_control"; >         }; > >         thermal@1c0 { >             compatible = "brcm,ns-thermal"; >             reg = <0x1c0 0x10>; >             #thermal-sensor-cells = <0>; >         }; >     }; > }; > > cru-reset@??? { >     compatible = "brcm,ns-cru-reset"; >     syscon-cru = <&cru>; /* CRU_RESET */ >     #reset-cells = <1>; > }; > > usb2-phy@??? { >     compatible = "brcm,ns-usb2-phy"; >     syscon-cru = <&cru>; /* CRU_CLKSET_KEY */ >     #phy-cells = <0>; > }; > > (apparently it wasn't a good idea) > > So my question is: how to properly handle this? I'm not sure what's the > proper "compatible" string to use. Is my idea of: > 1. Using sub-node for registers explicitly used by one driver > 2. Using syscon for shared registers > OK? The above two proposed scheme from you to handle CRU in NS makes sense to me and they also model the ASIC architecture correctly. Thanks, Ray > > > [0] https://www.spinics.net/lists/arm-kernel/msg682838.html > [1] > https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20181015093013.31651-1-zajec5@gmail.com/ > > [2] https://spinics.net/lists/linux-gpio/msg35285.html > [3] https://patchwork.kernel.org/patch/10735931/ > [4] https://lkml.org/lkml/2019/1/15/913 > [5] > https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20190108123907.19816-1-zajec5@gmail.com/ >