From patchwork Fri Jul 22 18:41:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12926752 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E8BEAC433EF for ; Fri, 22 Jul 2022 18:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OB6NWwJw/CWAP05HBgR5e9m/B+HFZx5jcL+Zee/Gobk=; b=rYKk2m0J7tfBK1 /ex/2TFGvqnn5TbVYqyqaPpyqPZJEm5ZIhUYXYCRFDzG+j1bDYT7kxWDlmpAv821msk6OyDMTvyw7 47KBV6e2XxyVGSwfLs1Wv5QY5cxGRZ8KP18cFUKutz6drPANu96Lu2SjwVsRZO5hOyKWAdTbjLC0n +GGmqqRIGOkT8NO6XJbsDXYiFwlQEk0M74qOHhC0OVFCNEz8VDtUHcJuEncgfc6i8vV6J8Bkkp4mg /TTtuQcxf05mCR0/3N3f82S2DlZ/R61UG+/vxfjuMILZ0GT5QMrYuUPrMVRRN0Jk/YCbbGm0qayCj odIeDWlIba91QXWxU+kA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oExb4-0090kU-Ro; Fri, 22 Jul 2022 18:41:58 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oExar-0090d2-O4 for linux-arm-kernel@lists.infradead.org; Fri, 22 Jul 2022 18:41:47 +0000 Received: by mail-pj1-x1030.google.com with SMTP id d7-20020a17090a564700b001f209736b89so8941437pji.0 for ; Fri, 22 Jul 2022 11:41:43 -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=jofpAqecbdGgkYzZMNCG3YcniBpkLsYrCEk/bJeq2jo=; b=GBKqB6O9kXYaONhBo6rVzjwqjKkOq+RwSRcG8s+Z13pqae0x2+nNdfx+WSZWhzSUK/ gOwdostQNIlQrjHgtnEK7EZfk5bE1RyW+ZcwJ1E5XyHALjjy3HmOVUdObkApoErHP2a+ i1Plw+EGu7H5gG5ULKHEhGqjdChBBk9cTnpcYkdxHSaLFfSwNsR6Ik5/uJcZ5E/X0YN+ MZ4CBM8h/WOD3ZqTmGY5Q5sGuyacf2iBIaYptW67Tb6LEWbkSuJv/MNq9whE0Kxek0U/ zf9p0rnkGB0TFozR/0Yj3NktngM/8mNU2nflV78gR4bV37PCoSIE1Rq5aE5MZgf4lhlN 83Ig== 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=jofpAqecbdGgkYzZMNCG3YcniBpkLsYrCEk/bJeq2jo=; b=TGOKjTtQLY7sBZevrUctTVWdscwATZKIQUEEFOXcCCY6WciblS46nG4kQ1D6zT1dbL raOU9D2nosqZ90C8csMPn1Qhc53uZiOqMkeJDElWHAoKFMTU1L06M4FlsPkf7C6D0YbE 8uUVGJPs1/QH010yjPgVlzrSwYLGDjCpfOB2o0ocF3hmpAg6ODgzBcUc1bfBSJU5XVxW HvrJDit/KiKnWfNTFUQ3sNplX/Gxa3qcM9rPFZYiHoHcCtIMFzemifz799bTGCsxXO7t WRGZZh8sQ0N1uh8UvNwX6UE8ponYdkT730C1L8ZecXRBS5wauI1Xt5SixTsFFTSJoiyZ 77BQ== X-Gm-Message-State: AJIora/VFD5Q54ufGB/fqbVFM366XV6JfsXYbSJrKNWIt5MO40SGgJPF aDumzMBDPaZr6uOAh9cXURc= X-Google-Smtp-Source: AGRyM1vaJyPY9HB20qdpQMq2mZVxyUFMAIfPg1DJF+L3ybnhQs9TCzD0nAv24ZFvyrIwX+ysckI82A== X-Received: by 2002:a17:902:d711:b0:16d:1665:1162 with SMTP id w17-20020a170902d71100b0016d16651162mr857242ply.5.1658515303257; Fri, 22 Jul 2022 11:41:43 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id y12-20020a17090322cc00b0016c9e5f291bsm675976plg.111.2022.07.22.11.41.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 11:41:42 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Rob Herring , Krzysztof Kozlowski , Broadcom internal kernel review list , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE) Subject: [PATCH 1/3] dt-bindings: memory-controller: Document Broadcom STB MEMC Date: Fri, 22 Jul 2022 11:41:36 -0700 Message-Id: <20220722184138.2666241-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220722184138.2666241-1-f.fainelli@gmail.com> References: <20220722184138.2666241-1-f.fainelli@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220722_114145_813523_3F7FA847 X-CRM114-Status: GOOD ( 14.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Document the Broadcom STB memory controller which is a trivial binding for now with a set of compatible strings and single register. Signed-off-by: Florian Fainelli --- .../memory-controllers/brcm,memc.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/memory-controllers/brcm,memc.yaml diff --git a/Documentation/devicetree/bindings/memory-controllers/brcm,memc.yaml b/Documentation/devicetree/bindings/memory-controllers/brcm,memc.yaml new file mode 100644 index 000000000000..a629734f0cd0 --- /dev/null +++ b/Documentation/devicetree/bindings/memory-controllers/brcm,memc.yaml @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/memory-controllers/brcm,memc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Memory controller (MEMC) for Broadcom STB + +maintainers: + - Florian Fainelli + +properties: + compatible: + items: + - enum: + - brcm,brcmstb-memc-ddr-rev-b.1.x + - brcm,brcmstb-memc-ddr-rev-b.2.0 + - brcm,brcmstb-memc-ddr-rev-b.2.1 + - brcm,brcmstb-memc-ddr-rev-b.2.2 + - brcm,brcmstb-memc-ddr-rev-b.2.3 + - brcm,brcmstb-memc-ddr-rev-b.2.5 + - brcm,brcmstb-memc-ddr-rev-b.2.6 + - brcm,brcmstb-memc-ddr-rev-b.2.7 + - brcm,brcmstb-memc-ddr-rev-b.2.8 + - brcm,brcmstb-memc-ddr-rev-b.3.0 + - brcm,brcmstb-memc-ddr-rev-b.3.1 + - brcm,brcmstb-memc-ddr-rev-c.1.0 + - brcm,brcmstb-memc-ddr-rev-c.1.1 + - brcm,brcmstb-memc-ddr-rev-c.1.2 + - brcm,brcmstb-memc-ddr-rev-c.1.3 + - brcm,brcmstb-memc-ddr-rev-c.1.4 + - const: brcm,brcmstb-memc-ddr + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + memory-controller@9902000 { + compatible = "brcm,brcmstb-memc-ddr-rev-c.1.1", + "brcm,brcmstb-memc-ddr"; + reg = <0x9902000 0x600>; + }; From patchwork Fri Jul 22 18:41:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12926753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 276DCC433EF for ; Fri, 22 Jul 2022 18:43:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2VSoxLOt8vSWYIy0DDRMepl6HWPBlWeeVJ4ri43GXSc=; b=vQhMQtuTpyCWP8 CFrb6Z4eFPOLEUdIJF9TJgqJmgpTUS3kZFGb52fpvL4abV5Zp0XNvNFtN/97ezoBTVAJz94OKnnON f5WekIpBTm2RQN0d9/Q/4Pzb+6b1qdjcjje+VHFEIQOZmNv9M6kiqFLKc05hGdL/g9DRf39eCLGDL Ef3RSYk8dZbebyTNmGP8b8A51bhzzYV8pnQSBypeBbDW1sHlkcJ8HHo7K3GJ/yKmLrc38Fjvuz5Q4 X2Bkw2DR+Gdy1Z7EB6BUTe+3uCzvWK6A7yMgjMHo9RlojgmcasMv5nxR+ki9wzGuyu81LRAsrg+c7 BPVBwQbmAKFrsUQI67Tw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oExbF-0090oW-Rs; Fri, 22 Jul 2022 18:42:10 +0000 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oExat-0090dT-Nm for linux-arm-kernel@lists.infradead.org; Fri, 22 Jul 2022 18:41:49 +0000 Received: by mail-pg1-x52e.google.com with SMTP id bh13so5101589pgb.4 for ; Fri, 22 Jul 2022 11:41:45 -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=kWeiGUgbB/Te5E2qxCGo+QOl86zPGhX0rSetu8yADHI=; b=ZgJsZRfHCKAcdhkh1nRJ/gRPa+ODGJbXV19X7SQMWsIy5aZlZIO8o7lRaTmAqRNd/H ynQvPqTrmy5OH2o5CllLCogBC+uetlDnWSMepUSLcZSAy0oCVK3Pj5nJOAgItmWm+5Ln Iu1435Zl4LVbaBpqPXbp5BYb9YwSZhP6FwmqAnglm+LJAVfp0RP1N1cBimomxCDnUZsq ACTUkXE4V6EKU/w410rVeimKdzU/smiN0S9k93RMrhrjE4qqbnlnRkHeKKIlsfJCmEHp l1DKIMlKWw7aBOIVHlsmZjsxz04M9WqiHz9VIzjwCaPGvvwndupw+r8wz9RZWLMBKhrp 3aIg== 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=kWeiGUgbB/Te5E2qxCGo+QOl86zPGhX0rSetu8yADHI=; b=Q/nPxiKOJIt8Pf8o7dRVkE7J+rzUwYHFCfQ+k3Xs3L1poHtwyB5+aN2KsyvIM+h0Z0 xLm2tutiYVMnmzZqzZvwiAQyESTTzeHP89F2yP1WDe0up5LM+6Wb+Lyd6y95/Mtn/YN5 je9chaodmlhjMEbAX4dvJWjlMUrYn5LbteJirUezBJhsOICSjINgMQ0uFKx8KkJXVkM+ TXUmoKvt9/Duw1Z0jDRniTHuwh1JF889RQejKWW4ZTul5it38rzbLD0YtfQruDHibtHO 0CCwC0dV0S7QhNg4pY2u6evpKCwn5k67HZSIk3AGrw0ySfHfDpf73Gr/JJAs9q3cjQ6J O2fA== X-Gm-Message-State: AJIora+45PJf/+cFwJINUNbVLRqHqgean/YzwUvPXgrk2SrUWkcw0rj/ Q4Hw+oU2rtK2Ib8ZObKMdaaGECC3szA= X-Google-Smtp-Source: AGRyM1tsRj7NU0R3Gg8FAWTv4tcbIF9zMtEt5/TuC5YEXy2+0L6rcIKH6FqvfzaNRKxPf3XCfM1pCQ== X-Received: by 2002:a05:6a00:e8f:b0:528:a1c7:3d00 with SMTP id bo15-20020a056a000e8f00b00528a1c73d00mr1245280pfb.25.1658515304515; Fri, 22 Jul 2022 11:41:44 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id y12-20020a17090322cc00b0016c9e5f291bsm675976plg.111.2022.07.22.11.41.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 11:41:44 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Rob Herring , Krzysztof Kozlowski , Broadcom internal kernel review list , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE) Subject: [PATCH 2/3] dt-bindings: arm: bcm: Refer to the YAML binding for MEMC Date: Fri, 22 Jul 2022 11:41:37 -0700 Message-Id: <20220722184138.2666241-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220722184138.2666241-1-f.fainelli@gmail.com> References: <20220722184138.2666241-1-f.fainelli@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220722_114147_836811_8B695FC0 X-CRM114-Status: GOOD ( 12.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Remove the list of existing compatible strings and prefer to use the YAML binding which more complete and up to date. Signed-off-by: Florian Fainelli --- .../devicetree/bindings/arm/bcm/brcm,brcmstb.txt | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/arm/bcm/brcm,brcmstb.txt b/Documentation/devicetree/bindings/arm/bcm/brcm,brcmstb.txt index 104cc9b41df4..4db7209d5be3 100644 --- a/Documentation/devicetree/bindings/arm/bcm/brcm,brcmstb.txt +++ b/Documentation/devicetree/bindings/arm/bcm/brcm,brcmstb.txt @@ -187,15 +187,8 @@ Required properties: Sequencer DRAM parameters and control registers. Used for Self-Refresh Power-Down (SRPD), among other things. -Required properties: -- compatible : should contain one of these - "brcm,brcmstb-memc-ddr-rev-b.2.1" - "brcm,brcmstb-memc-ddr-rev-b.2.2" - "brcm,brcmstb-memc-ddr-rev-b.2.3" - "brcm,brcmstb-memc-ddr-rev-b.3.0" - "brcm,brcmstb-memc-ddr-rev-b.3.1" - "brcm,brcmstb-memc-ddr" -- reg : the MEMC DDR register range +See Documentation/devicetree/bindings/memory-controller/brcm,memc.yaml for +a full list of supported compatible strings. Example: From patchwork Fri Jul 22 18:41:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12926754 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C215DC433EF for ; Fri, 22 Jul 2022 18:43:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LxFgnLYAz1kKGp4XaL127LsiOxq/anbw55xnJZ3oVbA=; b=DPyt4NLnOuauJw JZpEyuIFC5HMwx2jarJyM3+Tj17H93Alp9rJ4GBO/h1RaICTNN9KxM6dVxh82noekrhUihykhR0RZ Ef0IRyM26s8L/uf4kX/B82OzUbtXMIZorSYMIWwOjyHzReFHKRBjvRXg1C+mbLJ2r98rcngKgW1ID JwbyOmxvEZNfR7CEemJR1cgrCpokGWeAv9dZl9rFh4ApdrCOQwzFPBPTblzzaPPQnDfdYn6ZTQQqP rn0GefS6YCJYJjCMLuYYOdQzpD+VZyzG1rt0pVDuGQYEoSdQ+MT8B9qZ4Wfzlul9zJjtsmtOzIxoy +BdRxHmvtXAu851nwAbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oExbR-0090vM-1o; Fri, 22 Jul 2022 18:42:21 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oExau-0090eZ-Cf for linux-arm-kernel@lists.infradead.org; Fri, 22 Jul 2022 18:41:50 +0000 Received: by mail-pl1-x630.google.com with SMTP id d7so5247790plr.9 for ; Fri, 22 Jul 2022 11:41:46 -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=C5Xsj66xxsI8UZs+AVns8DSIdMWqwjaUdpUS2P9wJnY=; b=fNEcOHQ7HWXM6gS95YYCZ5vn5e/Ehuvl+K76mGVCjrhL/cB8j/iHUYMl/3gm4tQPZJ CQA9JRrc4M+CKtzmDtvLf4HLqAVv/VJHSbIxwxrwmwI/BbuxxrMf/tkjiLBDkSNdQfpS s2ukdA/ZB69rquwgs+xsvfQkSGNiVkOOUbeXXcL/rccmsy8c/kOrbwSgD+4dhIA1z6QQ CZM6EnZdOdcE+7jfnte8Q5wisoD5P3sxmHQLIZt8xYx8GnG+kOuiWlUHLR77pSTct+/Q i/462QSpmpnUNl3swtGTSmPQsWJuv5AAWg7Zl6yyLe1C/1Mri4+tNsCRRSakf8OJHvO9 +OKQ== 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=C5Xsj66xxsI8UZs+AVns8DSIdMWqwjaUdpUS2P9wJnY=; b=lJh4mVpdw1DukEqdC3bOQPClAQdpKgl9y40WGKziCtBFlcm+RUvPoAIKe/foYAOtmC djtm/Ek5MPNhHwItu1VNRqhbNGC9l1LRaenHM6GsgW+BBxfTynsC4UdxFnTu6PvQQJWC geIvRiTI1t2T4ilkaTugK9B9AlQn7rAq87jvK7yt60X4XNEJWESZsXiyTEOPr6c0w7hR MIuESJkgS2wYlkHPsP00j5rX1PDJlfO0doClMP2XFGkmYV3inkN9uVR3PKm8i+ZikRRN dkaMiuB0jPlDms+V87m3VUrS41Nqaa+fL4HmyOnKJrp1TI4GBnhmND44W7qyuca2JeWc YpVQ== X-Gm-Message-State: AJIora80EZQaxKNy/+qIljUbHSjBBvKNs+z8ASsJNhViVnwSh6AMPCqs KOipbS3YCDtewwpFUUfvv+xHoG/KSrg= X-Google-Smtp-Source: AGRyM1t+RNULRgXeo5W7u1cUgfEXfTrkNxMxLtd06HvttxsDE1MeHr2HpCk7m3bOx6NDFHyl00FMZA== X-Received: by 2002:a17:90b:4a8c:b0:1f2:4736:e75e with SMTP id lp12-20020a17090b4a8c00b001f24736e75emr5960645pjb.239.1658515305728; Fri, 22 Jul 2022 11:41:45 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id y12-20020a17090322cc00b0016c9e5f291bsm675976plg.111.2022.07.22.11.41.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 11:41:45 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , Rob Herring , Krzysztof Kozlowski , Broadcom internal kernel review list , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE) Subject: [PATCH 3/3] memory: Add Broadcom STB memory controller driver Date: Fri, 22 Jul 2022 11:41:38 -0700 Message-Id: <20220722184138.2666241-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220722184138.2666241-1-f.fainelli@gmail.com> References: <20220722184138.2666241-1-f.fainelli@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220722_114148_481932_53F6FF33 X-CRM114-Status: GOOD ( 27.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add support for configuring the Self Refresh Power Down (SRPD) inactivity timeout on Broadcom STB chips. This is used to conserve power when the DRAM activity is reduced. Signed-off-by: Florian Fainelli --- drivers/memory/Kconfig | 9 + drivers/memory/Makefile | 1 + drivers/memory/brcmstb_memc.c | 304 ++++++++++++++++++++++++++++++++++ 3 files changed, 314 insertions(+) create mode 100644 drivers/memory/brcmstb_memc.c diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig index ac1a411648d8..fac290e48e0b 100644 --- a/drivers/memory/Kconfig +++ b/drivers/memory/Kconfig @@ -66,6 +66,15 @@ config BRCMSTB_DPFE for the DRAM's temperature. Slower refresh rate means cooler RAM, higher refresh rate means hotter RAM. +config BRCMSTB_MEMC + tristate "Broadcom STB MEMC driver" + default ARCH_BRCMSTB + depends on ARCH_BRCMSTB || COMPILE_TEST + help + This driver provides a way to configure the Broadcom STB memory + controller and specifically control the Self Refresh Power Down + (SRPD) inactivity timeout. + config BT1_L2_CTL bool "Baikal-T1 CM2 L2-RAM Cache Control Block" depends on MIPS_BAIKAL_T1 || COMPILE_TEST diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile index bc7663ed1c25..e148f636c082 100644 --- a/drivers/memory/Makefile +++ b/drivers/memory/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_ARM_PL172_MPMC) += pl172.o obj-$(CONFIG_ATMEL_SDRAMC) += atmel-sdramc.o obj-$(CONFIG_ATMEL_EBI) += atmel-ebi.o obj-$(CONFIG_BRCMSTB_DPFE) += brcmstb_dpfe.o +obj-$(CONFIG_BRCMSTB_MEMC) += brcmstb_memc.o obj-$(CONFIG_BT1_L2_CTL) += bt1-l2-ctl.o obj-$(CONFIG_TI_AEMIF) += ti-aemif.o obj-$(CONFIG_TI_EMIF) += emif.o diff --git a/drivers/memory/brcmstb_memc.c b/drivers/memory/brcmstb_memc.c new file mode 100644 index 000000000000..881da958c542 --- /dev/null +++ b/drivers/memory/brcmstb_memc.c @@ -0,0 +1,304 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * DDR Self-Refresh Power Down (SRPD) support for Broadcom STB SoCs + * + */ + +#include +#include +#include +#include +#include +#include + +#define REG_MEMC_CNTRLR_CONFIG 0x00 +#define CNTRLR_CONFIG_LPDDR4 5 +#define CNTRLR_CONFIG_MASK 0xf +#define REG_MEMC_SRPD_CFG_21 0x20 +#define REG_MEMC_SRPD_CFG_20 0x34 +#define REG_MEMC_SRPD_CFG_1x 0x3c +#define INACT_COUNT_SHIFT 0 +#define INACT_COUNT_MASK 0xffff +#define SRPD_EN_SHIFT 16 + +struct brcmstb_memc_data { + u32 srpd_offset; +}; + +struct brcmstb_memc { + struct device *dev; + void __iomem *ddr_ctrl; + unsigned int timeout_cycles; + u32 frequency; + u32 srpd_offset; +}; + +static int brcmstb_memc_uses_lpddr4(struct brcmstb_memc *memc) +{ + void __iomem *config = memc->ddr_ctrl + REG_MEMC_CNTRLR_CONFIG; + u32 reg; + + reg = readl_relaxed(config) & CNTRLR_CONFIG_MASK; + + return reg == CNTRLR_CONFIG_LPDDR4; +} + +static int brcmstb_memc_srpd_config(struct brcmstb_memc *memc, + unsigned int cycles) +{ + void __iomem *cfg = memc->ddr_ctrl + memc->srpd_offset; + u32 val; + + /* Max timeout supported in HW */ + if (cycles > INACT_COUNT_MASK) + return -EINVAL; + + memc->timeout_cycles = cycles; + + val = (cycles << INACT_COUNT_SHIFT) & INACT_COUNT_MASK; + if (cycles) + val |= (1 << SRPD_EN_SHIFT); + + writel_relaxed(val, cfg); + (void)readl_relaxed(cfg); + + return 0; +} + +static ssize_t frequency_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct brcmstb_memc *memc = dev_get_drvdata(dev); + + return sprintf(buf, "%d\n", memc->frequency); +} + +static ssize_t srpd_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct brcmstb_memc *memc = dev_get_drvdata(dev); + + return sprintf(buf, "%d\n", memc->timeout_cycles); +} + +static ssize_t srpd_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct brcmstb_memc *memc = dev_get_drvdata(dev); + unsigned int val; + int ret; + + /* Cannot change the inactivity timeout on LPDDR4 chips because the + * dynamic tuning process will also get affected by the inactivity + * timeout, thus making it non functional. + */ + if (brcmstb_memc_uses_lpddr4(memc)) + return -EOPNOTSUPP; + + ret = kstrtouint(buf, 10, &val); + if (ret < 0) + return ret; + + ret = brcmstb_memc_srpd_config(memc, val); + if (ret) + return ret; + + return count; +} + +static DEVICE_ATTR_RO(frequency); +static DEVICE_ATTR_RW(srpd); + +static struct attribute *dev_attrs[] = { + &dev_attr_frequency.attr, + &dev_attr_srpd.attr, + NULL, +}; + +static struct attribute_group dev_attr_group = { + .attrs = dev_attrs, +}; + +static const struct of_device_id brcmstb_memc_of_match[]; + +static int brcmstb_memc_probe(struct platform_device *pdev) +{ + const struct brcmstb_memc_data *memc_data; + const struct of_device_id *of_id; + struct device *dev = &pdev->dev; + struct brcmstb_memc *memc; + struct resource *res; + int ret; + + memc = devm_kzalloc(dev, sizeof(*memc), GFP_KERNEL); + if (!memc) + return -ENOMEM; + + dev_set_drvdata(dev, memc); + + of_id = of_match_device(brcmstb_memc_of_match, dev); + if (!of_id || !of_id->data) + return -EINVAL; + + memc_data = of_id->data; + memc->srpd_offset = memc_data->srpd_offset; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + memc->ddr_ctrl = devm_ioremap_resource(dev, res); + if (IS_ERR(memc->ddr_ctrl)) + return PTR_ERR(memc->ddr_ctrl); + + of_property_read_u32(pdev->dev.of_node, "clock-frequency", + &memc->frequency); + + ret = sysfs_create_group(&dev->kobj, &dev_attr_group); + if (ret) { + dev_err(dev, "failed to create attribute group (%d)\n", ret); + return ret; + } + + return 0; +} + +static int brcmstb_memc_remove(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + + sysfs_remove_group(&dev->kobj, &dev_attr_group); + + return 0; +} + +enum brcmstb_memc_hwtype { + BRCMSTB_MEMC_V21, + BRCMSTB_MEMC_V20, + BRCMSTB_MEMC_V1X, +}; + +static const struct brcmstb_memc_data brcmstb_memc_versions[] = { + { .srpd_offset = REG_MEMC_SRPD_CFG_21 }, + { .srpd_offset = REG_MEMC_SRPD_CFG_20 }, + { .srpd_offset = REG_MEMC_SRPD_CFG_1x }, +}; + +static const struct of_device_id brcmstb_memc_of_match[] = { + { + .compatible = "brcm,brcmstb-memc-ddr-rev-b.1.x", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V1X] + }, + { + .compatible = "brcm,brcmstb-memc-ddr-rev-b.2.0", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V20] + }, + { + .compatible = "brcm,brcmstb-memc-ddr-rev-b.2.1", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V21] + }, + { + .compatible = "brcm,brcmstb-memc-ddr-rev-b.2.2", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V21] + }, + { + .compatible = "brcm,brcmstb-memc-ddr-rev-b.2.3", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V21] + }, + { + .compatible = "brcm,brcmstb-memc-ddr-rev-b.2.5", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V21] + }, + { + .compatible = "brcm,brcmstb-memc-ddr-rev-b.2.6", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V21] + }, + { + .compatible = "brcm,brcmstb-memc-ddr-rev-b.2.7", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V21] + }, + { + .compatible = "brcm,brcmstb-memc-ddr-rev-b.2.8", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V21] + }, + { + .compatible = "brcm,brcmstb-memc-ddr-rev-b.3.0", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V21] + }, + { + .compatible = "brcm,brcmstb-memc-ddr-rev-b.3.1", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V21] + }, + { + .compatible = "brcm,brcmstb-memc-ddr-rev-c.1.0", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V21] + }, + { + .compatible = "brcm,brcmstb-memc-ddr-rev-c.1.1", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V21] + }, + { + .compatible = "brcm,brcmstb-memc-ddr-rev-c.1.2", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V21] + }, + { + .compatible = "brcm,brcmstb-memc-ddr-rev-c.1.3", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V21] + }, + { + .compatible = "brcm,brcmstb-memc-ddr-rev-c.1.4", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V21] + }, + /* default to the original offset */ + { + .compatible = "brcm,brcmstb-memc-ddr", + .data = &brcmstb_memc_versions[BRCMSTB_MEMC_V1X] + }, + {} +}; + +static int __maybe_unused brcmstb_memc_suspend(struct device *dev) +{ + struct brcmstb_memc *memc = dev_get_drvdata(dev); + void __iomem *cfg = memc->ddr_ctrl + memc->srpd_offset; + u32 val; + + if (memc->timeout_cycles == 0) + return 0; + + /* Disable SPRD prior to suspending the system since that can + * cause issues with e.g: XPT_DMA trying to hash memory + */ + val = readl_relaxed(cfg); + val &= ~(1 << SRPD_EN_SHIFT); + writel_relaxed(val, cfg); + (void)readl_relaxed(cfg); + + return 0; +} + +static int __maybe_unused brcmstb_memc_resume(struct device *dev) +{ + struct brcmstb_memc *memc = dev_get_drvdata(dev); + + if (memc->timeout_cycles == 0) + return 0; + + return brcmstb_memc_srpd_config(memc, memc->timeout_cycles); +} + +static SIMPLE_DEV_PM_OPS(brcmstb_memc_pm_ops, brcmstb_memc_suspend, + brcmstb_memc_resume); + +static struct platform_driver brcmstb_memc_driver = { + .probe = brcmstb_memc_probe, + .remove = brcmstb_memc_remove, + .driver = { + .name = "brcmstb_memc", + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(brcmstb_memc_of_match), + .pm = &brcmstb_memc_pm_ops, + }, +}; +module_platform_driver(brcmstb_memc_driver); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Broadcom"); +MODULE_DESCRIPTION("DDR SRPD driver for Broadcom STB chips");