From patchwork Wed Mar 3 07:48:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Lin X-Patchwork-Id: 12113641 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=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 D7B19C433DB for ; Wed, 3 Mar 2021 14:49:08 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AF17B64ED7 for ; Wed, 3 Mar 2021 14:49:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF17B64ED7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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:In-Reply-To:References:List-Owner; bh=rMcHWoIsf1ejRiLfPS7+IW8xsULbSnGMwCluK1vQN/U=; b=Amc2TXUvOCDKpnGnmRuHSalHSw vvZC6PDxin59axove9fzbZ0Mwjq1olyLZz4dwdjKLMe7XprqkWN6RQn7aKBUt9wZi9V3hkKx+JB1L 67jMRnkgtaisFmkERE2DhM9dj4Sd6JiR2stQBALaldKUFwCsvRRUoLTjkQkZm5nNg35SvoXvuyDs9 Z3eFPwRxT5OTZwE0tJOVrGC90Flg7mPqT3dmyL1SVs2NVmN9pPtl8wiJjDp2DAHtiS7FtWXZxPEmo Sxf05LslUby2xMOk4c+xKtvp01m2WjB1DaqGoddBmMn3MFdfobyVuwu024yAjhLcBbdH8vDk0Z/iU oR/FSeyg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHSo5-005DTn-JB; Wed, 03 Mar 2021 14:48:57 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHSB7-0054Gb-OD for linux-rockchip@desiato.infradead.org; Wed, 03 Mar 2021 14:08:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To:References; bh=IrQh3JLbK3Yv3BjvVtXH1zijsvbNyUjn2/vRjilvQVw=; b=Sz0455au8DJjeqOedJknXfGlOP E08WmQyaFhf4g40lemaAbag/0ZVFXskJeeHfs9QeYNre9eTlKWFAFMoeSLVrsrMe8DtSKoeiMi8LB kMGynhpVAH69rj3U5uUspWpIUFwujSWtE0D9vEEq5e4dVPg+CjiQOowXRJ4r0e9k5plW0kbUtDap5 VDLiJkqE5OcJ1sUfDRbOxU2HM/bbFrvI+z0e5yElBiLcFVKmbtD7SUYBSzt5nJK9orSEFq/0dZTPa EHsYMPag+jX/9VmyvnFSIo1OIKKoiSIobvovu1SynckQYNyZgi6VYMotSW+R8K7IX9F8+A+l9o/1P KBr948Zw==; Received: from lucky1.263xmail.com ([211.157.147.130]) by casper.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHMFu-001j7r-Ua for linux-rockchip@lists.infradead.org; Wed, 03 Mar 2021 07:49:20 +0000 Received: from localhost (unknown [192.168.167.235]) by lucky1.263xmail.com (Postfix) with ESMTP id 99DBAD0466; Wed, 3 Mar 2021 15:48:55 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P19729T140185384916736S1614757734881043_; Wed, 03 Mar 2021 15:48:55 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <55670f28143b4e4f191b9b53dc7aabaf> X-RL-SENDER: shawn.lin@rock-chips.com X-SENDER: lintao@rock-chips.com X-LOGIN-NAME: shawn.lin@rock-chips.com X-FST-TO: robh+dt@kernel.org X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Shawn Lin To: Rob Herring , Ulf Hansson Cc: linux-mmc@vger.kernel.org, Adrian Hunter , devicetree@vger.kernel.org, linux-rockchip@lists.infradead.org, Shawn Lin Subject: [PATCH 1/3] dt-bindings: mmc: sdhci-of-dwcmhsc: Convert to yaml file Date: Wed, 3 Mar 2021 15:48:41 +0800 Message-Id: <1614757723-225262-1-git-send-email-shawn.lin@rock-chips.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210303_074920_756885_D27B9471 X-CRM114-Status: GOOD ( 17.01 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org This patch converts sdhci-of-dwcmshc.txt to sdhci-of-dwcmshc.yaml Signed-off-by: Shawn Lin --- .../devicetree/bindings/mmc/sdhci-of-dwcmshc.txt | 20 ------- .../devicetree/bindings/mmc/sdhci-of-dwcmshc.yaml | 67 ++++++++++++++++++++++ 2 files changed, 67 insertions(+), 20 deletions(-) delete mode 100644 Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.yaml diff --git a/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt b/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt deleted file mode 100644 index ee4253b..0000000 --- a/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt +++ /dev/null @@ -1,20 +0,0 @@ -* Synopsys DesignWare Cores Mobile Storage Host Controller - -Required properties: -- compatible: should be one of the following: - "snps,dwcmshc-sdhci" -- reg: offset and length of the register set for the device. -- interrupts: a single interrupt specifier. -- clocks: Array of clocks required for SDHCI; requires at least one for - core clock. -- clock-names: Array of names corresponding to clocks property; shall be - "core" for core clock and "bus" for optional bus clock. - -Example: - sdhci2: sdhci@aa0000 { - compatible = "snps,dwcmshc-sdhci"; - reg = <0xaa0000 0x1000>; - interrupts = ; - clocks = <&emmcclk>; - bus-width = <8>; - } diff --git a/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.yaml b/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.yaml new file mode 100644 index 0000000..ff2bff1 --- /dev/null +++ b/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.yaml @@ -0,0 +1,67 @@ +# SPDX-License-Identifier: GPL-2.0-only +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mmc/sdhci-of-dwcmshc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synopsys Designware Mobile Storage Host Controller Binding + +maintainers: + - Ulf Hansson + - Jisheng Zhang + +allOf: + - $ref: mmc-controller.yaml# + +select: + properties: + compatible: + contains: + const: snps,dwcmshc-sdhci + +properties: + compatible: + enum: + - snps,dwcmshc-sdhci + + reg: + minItems: 1 + maxItems: 3 + + interrupts: + maxItems: 1 + + clocks: + minItems: 1 + maxItems: 2 + description: + Handle to "core" for core clock and "bus" for optional bus clock. + + clock-names: + minItems: 1 + maxItems: 2 + items: + - const: bus + - const: core + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + +unevaluatedProperties: false + +examples: + - | + sdhci@aa0000 { + compatible = "snps,dwcmshc-sdhci"; + reg = <0xaa000 0x1000>; + interrupts = <0 25 0x4>; + bus-width = <8>; + clocks = <&cru 17>; + clock-names = "core"; + }; + +... From patchwork Wed Mar 3 07:48:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Lin X-Patchwork-Id: 12114229 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=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 88F1AC433DB for ; Wed, 3 Mar 2021 20:58:06 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7774764E87 for ; Wed, 3 Mar 2021 20:58:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7774764E87 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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=YZBzkBTDPUcyFHsMY9WyjsL+nQlO+RBeZaAEP/yffAE=; b=cC29fPNz0UKFHn33HScM+RFEj9 yMvNwokQkH/QberovVEXu4tL9gD7JIiNwlwl8tqgFUmQHtDMjZH+8VeTJTd/cNGx1G/+ksXsGLtMh g9F3VUYD+sRjDSTfxvaVG4HYyNnkya3pEZZKYC67shfj1NhBpbmB4gYdJxi6yqvqg2fUnF0PJ1XHu fpcB3zHWjZoKkFikKkGEPx/qkVsIQVCgShjoq+yPBYIgBJ2pUisKMp3tFjZ5W1+CvNgRaSrgcxB+h fTBLFbp5kXK5v5uzS7VyJKqta6mWq2XqKJWLw5E9sxR4tRtK8U823MklaH1V5mi5TCRCBtNO/yl31 BeFotaqw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHYZB-006ViB-Sz; Wed, 03 Mar 2021 20:57:58 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHT7V-005JR0-MU for linux-rockchip@desiato.infradead.org; Wed, 03 Mar 2021 15:09:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=VJhkGKAX9qudk4Ggp5etOWoPJMaJEUmWZLILG3GBD88=; b=ZavHljqsiCYB2+Y3tuo28eZTH9 SmI4P8feWWzrL1bzaf9IN/FWDxz1RRCnTiwBq+u53oK1GFBIt50kL6j+HunSMpS3CRuOHNDw2VI6D X5lWkfYV3kQ1M6bLAVxYR6Rr03B+ZTeFI82sRhe+OVQWLKyJRDtmkw/+NiLditDm4Cq8BSIEXN9fO 5c3mhJhA23MGGVdZpcWFK27cVgwmqe6Dc3nDaK9pTm0gh0C0gHqZco3xmTIUAKq9NM5XDsfZwccfj P9XcNOKH3QcFfLiLjyaqj4VhErZbgP5yJuMZf82p5M2U3jN4RDgO9R4EFGqU3qtoSBVebxONujWKl 0EIcd3wA==; Received: from lucky1.263xmail.com ([211.157.147.135]) by casper.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHMFz-001j8A-LJ for linux-rockchip@lists.infradead.org; Wed, 03 Mar 2021 07:49:21 +0000 Received: from localhost (unknown [192.168.167.235]) by lucky1.263xmail.com (Postfix) with ESMTP id 99419A7884; Wed, 3 Mar 2021 15:48:56 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P19729T140185384916736S1614757734881043_; Wed, 03 Mar 2021 15:48:57 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <8c5b24f560b714c292c798000abcaba7> X-RL-SENDER: shawn.lin@rock-chips.com X-SENDER: lintao@rock-chips.com X-LOGIN-NAME: shawn.lin@rock-chips.com X-FST-TO: robh+dt@kernel.org X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Shawn Lin To: Rob Herring , Ulf Hansson Cc: linux-mmc@vger.kernel.org, Adrian Hunter , devicetree@vger.kernel.org, linux-rockchip@lists.infradead.org, Shawn Lin Subject: [PATCH 2/3] dt-bindings: mmc: sdhci-of-dwcmhsc: Add rockchip support Date: Wed, 3 Mar 2021 15:48:42 +0800 Message-Id: <1614757723-225262-2-git-send-email-shawn.lin@rock-chips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1614757723-225262-1-git-send-email-shawn.lin@rock-chips.com> References: <1614757723-225262-1-git-send-email-shawn.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210303_074921_866877_4038AD55 X-CRM114-Status: GOOD ( 12.29 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org This patch adds rockchip support in sdhci-of-dwcmhsc.yaml Signed-off-by: Shawn Lin --- .../devicetree/bindings/mmc/sdhci-of-dwcmshc.yaml | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.yaml b/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.yaml index ff2bff1..4808094 100644 --- a/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.yaml +++ b/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.yaml @@ -22,6 +22,7 @@ select: properties: compatible: enum: + - rockchip,dwcmshc-sdhci - snps,dwcmshc-sdhci reg: @@ -33,16 +34,26 @@ properties: clocks: minItems: 1 - maxItems: 2 + maxItems: 5 description: Handle to "core" for core clock and "bus" for optional bus clock. + "axi", "block" and "timer" are for Rockchip specified which aims for + DMA, pipe and internal timer respectively. clock-names: minItems: 1 - maxItems: 2 + maxItems: 5 items: - const: bus - const: core + - const: axi + - const: block + - const: timer + + rockchip,txclk-tapnum: + description: Specify the number of delay for tx sampling. + $ref: /schemas/types.yaml#/definitions/uint32 + required: - compatible @@ -55,6 +66,15 @@ unevaluatedProperties: false examples: - | + sdhci@fe310000 { + compatible = "rockchip,dwcmshc-sdhci"; + reg = <0xfe310000 0x10000>; + interrupts = <0 25 0x4>; + bus-width = <8>; + clocks = <&cru 17>, <&cru 18>, <&cru 19>, <&cru 20>; + clock-names = "core", "axi", "block", "timer"; + }; + - | sdhci@aa0000 { compatible = "snps,dwcmshc-sdhci"; reg = <0xaa000 0x1000>; From patchwork Wed Mar 3 07:48:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Lin X-Patchwork-Id: 12113753 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=-14.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,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 7B9F6C433E0 for ; Wed, 3 Mar 2021 16:10:50 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 154C264EE7 for ; Wed, 3 Mar 2021 16:10:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 154C264EE7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id: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=t5ajqj3rJOEmlaze63xxLKWfDgsc2ntMkNVB8uhlE0o=; b=O2TC2bCaAiVYmA7pEaCSGol4zl 8RKF+g1YIReSsw3oAlwBXav8CwaJjMfKBrhX0XyMs2iVYiregMYdU3imG+LAWWyvnSTSvOqFbOvCB mUl9E5GwCYzw9it7XDrGBvmk1Eeyv5nnQyj2SsTKSjawJizlsQpYNwlmeErmynOQtP4l/MX41TUVF lC4UFJJTEguC7s+cZr8E64IowawVcrFerNVrB2E5Hg164V0DD1iHbmGmbgchj7AIqfFFuBCbTJVWA nZhGkeiqu3W27KjuegnS5Wki2jPz81qj9IgG/qq9zFbfU/UAzSx4f5k8AwztlKmBpO+RDr5T5w/M/ A0FPvNhA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHU5A-005XtB-Mb; Wed, 03 Mar 2021 16:10:41 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHSov-005Dl5-2y for linux-rockchip@desiato.infradead.org; Wed, 03 Mar 2021 14:49:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=0ibwTabnvPWvhpPGWlbz4YUuG/I55noqZnUIS8jpcvI=; b=bompmHFhX/O/5AiVj80JHSRoTY SgKVhPSta1rJ1jhO3nVfHuW7HKkW5hANeHyqS8ugZXmO9b86L0yOiLUxemJUGwJOvKkFMMDVqX53L 9RwVEr8eHHHpG2W35eL45S4qnBW/08pbRM3q0fJ+1kqR99UEN5FEV1deaaq8AKce5oURP3d13+jPc hiLj12zXxNrVCMyBPjz30uxWOYMF4XOVvBk1+uWFbO8+vjvnqTWg+E+J6SKPxPHbSJ5Lg+NUzV1n7 yJ31IEVNbPrYcA1f++z97caUju7CMNYOrMGeEoTaj45Xc+iIvX0PRYYaWN9N3rBNDDsos0O8sSHgo y5kEMkQQ==; Received: from lucky1.263xmail.com ([211.157.147.132]) by casper.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHMFv-001j7n-56 for linux-rockchip@lists.infradead.org; Wed, 03 Mar 2021 07:49:20 +0000 Received: from localhost (unknown [192.168.167.235]) by lucky1.263xmail.com (Postfix) with ESMTP id C4D4CF19F3; Wed, 3 Mar 2021 15:48:58 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P19729T140185384916736S1614757734881043_; Wed, 03 Mar 2021 15:48:58 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <9a0803e127dd50988e9ecd91592f8ddd> X-RL-SENDER: shawn.lin@rock-chips.com X-SENDER: lintao@rock-chips.com X-LOGIN-NAME: shawn.lin@rock-chips.com X-FST-TO: robh+dt@kernel.org X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Shawn Lin To: Rob Herring , Ulf Hansson Cc: linux-mmc@vger.kernel.org, Adrian Hunter , devicetree@vger.kernel.org, linux-rockchip@lists.infradead.org, Shawn Lin Subject: [PATCH 3/3] mmc: sdhci-of-dwcmshc: add rockchip platform support Date: Wed, 3 Mar 2021 15:48:43 +0800 Message-Id: <1614757723-225262-3-git-send-email-shawn.lin@rock-chips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1614757723-225262-1-git-send-email-shawn.lin@rock-chips.com> References: <1614757723-225262-1-git-send-email-shawn.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210303_074920_777975_336F8A83 X-CRM114-Status: GOOD ( 23.51 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org sdhci based synopsys MMC IP is also used on some rockchip platforms, so add a basic support here. Signed-off-by: Shawn Lin --- drivers/mmc/host/sdhci-of-dwcmshc.c | 220 ++++++++++++++++++++++++++++++++++-- 1 file changed, 213 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c index 59d8d96..959084c 100644 --- a/drivers/mmc/host/sdhci-of-dwcmshc.c +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c @@ -9,9 +9,11 @@ #include #include +#include #include #include #include +#include #include #include "sdhci-pltfm.h" @@ -21,11 +23,43 @@ /* DWCMSHC specific Mode Select value */ #define DWCMSHC_CTRL_HS400 0x7 +/* Rockchip specific Registers */ +#define DWCMSHC_HOST_CTRL3 0x508 +#define DWCMSHC_EMMC_CONTROL 0x52c +#define DWCMSHC_EMMC_ATCTRL 0x540 +#define DWCMSHC_EMMC_DLL_CTRL 0x800 +#define DWCMSHC_EMMC_DLL_RXCLK 0x804 +#define DWCMSHC_EMMC_DLL_TXCLK 0x808 +#define DWCMSHC_EMMC_DLL_STRBIN 0x80c +#define DWCMSHC_EMMC_DLL_STATUS0 0x840 +#define DWCMSHC_EMMC_DLL_START BIT(0) +#define DWCMSHC_EMMC_DLL_RXCLK_SRCSEL 29 +#define DWCMSHC_EMMC_DLL_START_POINT 16 +#define DWCMSHC_EMMC_DLL_INC 8 +#define DWCMSHC_EMMC_DLL_DLYENA BIT(27) +#define DLL_TXCLK_TAPNUM_DEFAULT 0x8 +#define DLL_STRBIN_TAPNUM_DEFAULT 0x8 +#define DLL_TXCLK_TAPNUM_FROM_SW BIT(24) +#define DLL_STRBIN_TAPNUM_FROM_SW BIT(24) +#define DWCMSHC_EMMC_DLL_LOCKED BIT(8) +#define DWCMSHC_EMMC_DLL_TIMEOUT BIT(9) +#define DLL_RXCLK_NO_INVERTER 1 +#define DLL_RXCLK_INVERTER 0 +#define DWCMSHC_ENHANCED_STROBE BIT(8) +#define DLL_LOCK_WO_TMOUT(x) \ + ((((x) & DWCMSHC_EMMC_DLL_LOCKED) == DWCMSHC_EMMC_DLL_LOCKED) && \ + (((x) & DWCMSHC_EMMC_DLL_TIMEOUT) == 0)) +#define ROCKCHIP_MAX_CLKS 3 + #define BOUNDARY_OK(addr, len) \ ((addr | (SZ_128M - 1)) == ((addr + len - 1) | (SZ_128M - 1))) struct dwcmshc_priv { struct clk *bus_clk; + + /* Rockchip specified optional clocks */ + struct clk_bulk_data rockchip_clks[ROCKCHIP_MAX_CLKS]; + int txclk_tapnum; }; /* @@ -100,6 +134,97 @@ static void dwcmshc_set_uhs_signaling(struct sdhci_host *host, sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); } +static void dwcmshc_rk_hs400_enhanced_strobe(struct mmc_host *mmc, + struct mmc_ios *ios) +{ + u32 vendor; + struct sdhci_host *host = mmc_priv(mmc); + + vendor = sdhci_readl(host, DWCMSHC_EMMC_CONTROL); + if (ios->enhanced_strobe) + vendor |= DWCMSHC_ENHANCED_STROBE; + else + vendor &= ~DWCMSHC_ENHANCED_STROBE; + + sdhci_writel(host, vendor, DWCMSHC_EMMC_CONTROL); +} + +static void dwcmshc_rk_set_clock(struct sdhci_host *host, unsigned int clock) +{ + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct dwcmshc_priv *priv = sdhci_pltfm_priv(pltfm_host); + u32 txclk_tapnum = DLL_TXCLK_TAPNUM_DEFAULT, extra; + int err; + + host->mmc->actual_clock = 0; + + /* DO NOT TOUCH THIS SETTING */ + extra = DWCMSHC_EMMC_DLL_DLYENA | + DLL_RXCLK_NO_INVERTER << DWCMSHC_EMMC_DLL_RXCLK_SRCSEL; + sdhci_writel(host, extra, DWCMSHC_EMMC_DLL_RXCLK); + + if (clock == 0) + return; + + /* Rockchip platform only support 375KHz for identify mode */ + if (clock <= 400000) + clock = 375000; + + err = clk_set_rate(pltfm_host->clk, clock); + if (err) + dev_err(mmc_dev(host->mmc), "fail to set clock %d", clock); + + sdhci_set_clock(host, clock); + + /* Disable cmd conflict check */ + extra = sdhci_readl(host, DWCMSHC_HOST_CTRL3); + extra &= ~BIT(0); + sdhci_writel(host, extra, DWCMSHC_HOST_CTRL3); + + if (clock <= 400000) { + /* Disable DLL to reset sample clock */ + sdhci_writel(host, 0, DWCMSHC_EMMC_DLL_CTRL); + return; + } + + /* Reset DLL */ + sdhci_writel(host, BIT(1), DWCMSHC_EMMC_DLL_CTRL); + udelay(1); + sdhci_writel(host, 0x0, DWCMSHC_EMMC_DLL_CTRL); + + /* Init DLL settings */ + extra = 0x5 << DWCMSHC_EMMC_DLL_START_POINT | + 0x2 << DWCMSHC_EMMC_DLL_INC | + DWCMSHC_EMMC_DLL_START; + sdhci_writel(host, extra, DWCMSHC_EMMC_DLL_CTRL); + err = readl_poll_timeout(host->ioaddr + DWCMSHC_EMMC_DLL_STATUS0, + extra, DLL_LOCK_WO_TMOUT(extra), 1, + 500 * USEC_PER_MSEC); + if (err) { + dev_err(mmc_dev(host->mmc), "DLL lock timeout!\n"); + return; + } + + extra = 0x1 << 16 | /* tune clock stop en */ + 0x2 << 17 | /* pre-change delay */ + 0x3 << 19; /* post-change delay */ + sdhci_writel(host, extra, DWCMSHC_EMMC_ATCTRL); + + if (host->mmc->ios.timing == MMC_TIMING_MMC_HS200 || + host->mmc->ios.timing == MMC_TIMING_MMC_HS400) + txclk_tapnum = priv->txclk_tapnum; + + extra = DWCMSHC_EMMC_DLL_DLYENA | + DLL_TXCLK_TAPNUM_FROM_SW | + txclk_tapnum; + sdhci_writel(host, extra, DWCMSHC_EMMC_DLL_TXCLK); + + extra = DWCMSHC_EMMC_DLL_DLYENA | + DLL_STRBIN_TAPNUM_DEFAULT | + DLL_STRBIN_TAPNUM_FROM_SW; + sdhci_writel(host, extra, DWCMSHC_EMMC_DLL_STRBIN); +} + static const struct sdhci_ops sdhci_dwcmshc_ops = { .set_clock = sdhci_set_clock, .set_bus_width = sdhci_set_bus_width, @@ -109,21 +234,91 @@ static const struct sdhci_ops sdhci_dwcmshc_ops = { .adma_write_desc = dwcmshc_adma_write_desc, }; +static const struct sdhci_ops sdhci_dwcmshc_rk_ops = { + .set_clock = dwcmshc_rk_set_clock, + .set_bus_width = sdhci_set_bus_width, + .set_uhs_signaling = dwcmshc_set_uhs_signaling, + .get_max_clock = sdhci_pltfm_clk_get_max_clock, + .reset = sdhci_reset, + .adma_write_desc = dwcmshc_adma_write_desc, +}; + static const struct sdhci_pltfm_data sdhci_dwcmshc_pdata = { .ops = &sdhci_dwcmshc_ops, .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, }; +static const struct sdhci_pltfm_data sdhci_dwcmshc_rk_pdata = { + .ops = &sdhci_dwcmshc_rk_ops, + .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN | + SDHCI_QUIRK_BROKEN_TIMEOUT_VAL, + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | + SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN, +}; + +static int rockchip_pltf_init(struct sdhci_host *host, struct dwcmshc_priv *priv) +{ + int err; + + priv->rockchip_clks[0].id = "axi"; + priv->rockchip_clks[1].id = "block"; + priv->rockchip_clks[2].id = "timer"; + err = devm_clk_bulk_get_optional(mmc_dev(host->mmc), ROCKCHIP_MAX_CLKS, + priv->rockchip_clks); + if (err) { + dev_err(mmc_dev(host->mmc), "failed to get clocks %d\n", err); + return err; + } + + err = clk_bulk_prepare_enable(ROCKCHIP_MAX_CLKS, priv->rockchip_clks); + if (err) { + dev_err(mmc_dev(host->mmc), "failed to enable clocks %d\n", err); + return err; + } + + if (of_property_read_u32(mmc_dev(host->mmc)->of_node, "rockchip,txclk-tapnum", + &priv->txclk_tapnum)) + priv->txclk_tapnum = DLL_TXCLK_TAPNUM_DEFAULT; + + /* Disable cmd conflict check */ + sdhci_writel(host, 0x0, DWCMSHC_HOST_CTRL3); + /* Reset previous settings */ + sdhci_writel(host, 0, DWCMSHC_EMMC_DLL_TXCLK); + sdhci_writel(host, 0, DWCMSHC_EMMC_DLL_STRBIN); + + return 0; +} + +static const struct of_device_id sdhci_dwcmshc_dt_ids[] = { + { + .compatible = "snps,dwcmshc-sdhci", + .data = &sdhci_dwcmshc_pdata, + }, + { + .compatible = "rockchip,dwcmshc-sdhci", + .data = &sdhci_dwcmshc_rk_pdata, + }, + {}, +}; +MODULE_DEVICE_TABLE(of, sdhci_dwcmshc_dt_ids); + static int dwcmshc_probe(struct platform_device *pdev) { struct sdhci_pltfm_host *pltfm_host; struct sdhci_host *host; struct dwcmshc_priv *priv; + const struct sdhci_pltfm_data *pltfm_data; int err; u32 extra; - host = sdhci_pltfm_init(pdev, &sdhci_dwcmshc_pdata, + pltfm_data = of_device_get_match_data(&pdev->dev); + if (!pltfm_data) { + dev_err(&pdev->dev, "Error: No device match data found\n"); + return -ENODEV; + } + + host = sdhci_pltfm_init(pdev, pltfm_data, sizeof(struct dwcmshc_priv)); if (IS_ERR(host)) return PTR_ERR(host); @@ -161,6 +356,15 @@ static int dwcmshc_probe(struct platform_device *pdev) host->mmc_host_ops.request = dwcmshc_request; + if (pltfm_data == &sdhci_dwcmshc_rk_pdata) { + host->mmc_host_ops.hs400_enhanced_strobe = + dwcmshc_rk_hs400_enhanced_strobe; + + err = rockchip_pltf_init(host, priv); + if (err) + goto err_clk; + } + err = sdhci_add_host(host); if (err) goto err_clk; @@ -170,6 +374,7 @@ static int dwcmshc_probe(struct platform_device *pdev) err_clk: clk_disable_unprepare(pltfm_host->clk); clk_disable_unprepare(priv->bus_clk); + clk_bulk_disable_unprepare(ROCKCHIP_MAX_CLKS, priv->rockchip_clks); free_pltfm: sdhci_pltfm_free(pdev); return err; @@ -185,6 +390,7 @@ static int dwcmshc_remove(struct platform_device *pdev) clk_disable_unprepare(pltfm_host->clk); clk_disable_unprepare(priv->bus_clk); + clk_bulk_disable_unprepare(ROCKCHIP_MAX_CLKS, priv->rockchip_clks); sdhci_pltfm_free(pdev); @@ -207,6 +413,8 @@ static int dwcmshc_suspend(struct device *dev) if (!IS_ERR(priv->bus_clk)) clk_disable_unprepare(priv->bus_clk); + clk_bulk_disable_unprepare(ROCKCHIP_MAX_CLKS, priv->rockchip_clks); + return ret; } @@ -227,18 +435,16 @@ static int dwcmshc_resume(struct device *dev) return ret; } + ret = clk_bulk_prepare_enable(ROCKCHIP_MAX_CLKS, priv->rockchip_clks); + if (ret) + return ret; + return sdhci_resume_host(host); } #endif static SIMPLE_DEV_PM_OPS(dwcmshc_pmops, dwcmshc_suspend, dwcmshc_resume); -static const struct of_device_id sdhci_dwcmshc_dt_ids[] = { - { .compatible = "snps,dwcmshc-sdhci" }, - {} -}; -MODULE_DEVICE_TABLE(of, sdhci_dwcmshc_dt_ids); - static struct platform_driver sdhci_dwcmshc_driver = { .driver = { .name = "sdhci-dwcmshc",