From patchwork Fri Mar 1 15:33:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Muellner X-Patchwork-Id: 10835567 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F0D0C1390 for ; Fri, 1 Mar 2019 15:37:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCC002F4E4 for ; Fri, 1 Mar 2019 15:37:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0C3F2FC7C; Fri, 1 Mar 2019 15:37:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7D5E02F4E4 for ; Fri, 1 Mar 2019 15:37:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject: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=q4RNfnDjK8taD1Yl1iZ+4WsDnedMF5acgjyc+OX9/Is=; b=qXg TIvWSVqyOv+jVXF+OHns5FSrnZerNVtzRct9shpy6O+VELEUZuVFuxYXAuaXu6OCKIoAvsDC9E9pb c/5JK7j7CzkGsz5LQlxo6o4KVrn/RVB5Lc/wEhKtknQs9lrB47D5zPBEugj3pZfSIws+iIlSnWs+3 llB0apxgaSJa9xNelYO2wJdwS0Sdwn0h+mqCjwoSVs+M9+EMkZ3/VRKZtPxBiY5pvmCVq/elzj6Jm 8C1IymmWGZwU+oFi7R6wlTrKLoESOv00el4elIv8tmHBDlMJkFYb1RUzcVfXuU4t3fVd0gro7G4oO 1kPBzKNxT9DyJ7tkBx4bJH/ftvWs+qw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzkEJ-00071O-SG; Fri, 01 Mar 2019 15:37:43 +0000 Received: from vegas.theobroma-systems.com ([144.76.126.164] helo=mail.theobroma-systems.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzkDr-0006aM-Ac; Fri, 01 Mar 2019 15:37:17 +0000 Received: from ip092042140082.rev.nessus.at ([92.42.140.82]:42682 helo=purcell.lan) by mail.theobroma-systems.com with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1gzkDW-0005Ag-JD; Fri, 01 Mar 2019 16:36:54 +0100 From: Christoph Muellner To: robh+dt@kernel.org, mark.rutland@arm.com, heiko@sntech.de, shawn.lin@rock-chips.com Subject: [PATCH 1/3] phy: rockchip-emmc: Allow to set drive impedance via DTS. Date: Fri, 1 Mar 2019 16:33:43 +0100 Message-Id: <20190301153348.29870-1-christoph.muellner@theobroma-systems.com> X-Mailer: git-send-email 2.11.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190301_073715_623372_4243EB91 X-CRM114-Status: GOOD ( 13.48 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Matthias Brugger , linux-kernel@vger.kernel.org, Emil Renner Berthing , Viresh Kumar , Randy Li , Douglas Anderson , Vicente Bergas , Kishon Vijay Abraham I , linux-rockchip@lists.infradead.org, Tony Xie , Klaus Goger , Enric Balletbo i Serra , Philipp Tomsich , Ezequiel Garcia , linux-arm-kernel@lists.infradead.org, Christoph Muellner MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The rockchip-emmc PHY can be configured with different drive impedance values. Currenlty a value of 50 Ohm is hard coded into the driver. This patch introduces the DTS property 'drive-impedance-ohm' for the rockchip-emmc phy node, which uses the value from the DTS to setup the drive impedance accordingly. Signed-off-by: Christoph Muellner Signed-off-by: Philipp Tomsich --- drivers/phy/rockchip/phy-rockchip-emmc.c | 38 ++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockchip/phy-rockchip-emmc.c index 19bf84f0bc67..5413fa73dd45 100644 --- a/drivers/phy/rockchip/phy-rockchip-emmc.c +++ b/drivers/phy/rockchip/phy-rockchip-emmc.c @@ -87,6 +87,7 @@ struct rockchip_emmc_phy { unsigned int reg_offset; struct regmap *reg_base; struct clk *emmcclk; + unsigned int drive_impedance; }; static int rockchip_emmc_phy_power(struct phy *phy, bool on_off) @@ -281,10 +282,10 @@ static int rockchip_emmc_phy_power_on(struct phy *phy) { struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy); - /* Drive impedance: 50 Ohm */ + /* Drive impedance: from DTS */ regmap_write(rk_phy->reg_base, rk_phy->reg_offset + GRF_EMMCPHY_CON6, - HIWORD_UPDATE(PHYCTRL_DR_50OHM, + HIWORD_UPDATE(rk_phy->drive_impedance, PHYCTRL_DR_MASK, PHYCTRL_DR_SHIFT)); @@ -314,6 +315,28 @@ static const struct phy_ops ops = { .owner = THIS_MODULE, }; +static u32 convert_drive_impedance_ohm(struct platform_device *pdev, u32 dr_ohm) +{ + switch (dr_ohm) { + case 100: + return PHYCTRL_DR_100OHM; + case 66: + return PHYCTRL_DR_66OHM; + case 50: + return PHYCTRL_DR_50OHM; + case 40: + return PHYCTRL_DR_40OHM; + case 33: + return PHYCTRL_DR_33OHM; + } + + dev_warn(&pdev->dev, + "Invalid value %u for drive-impedance-ohm. " + "Falling back to 50 Ohm.\n", + dr_ohm); + return PHYCTRL_DR_50OHM; +} + static int rockchip_emmc_phy_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -322,6 +345,7 @@ static int rockchip_emmc_phy_probe(struct platform_device *pdev) struct phy_provider *phy_provider; struct regmap *grf; unsigned int reg_offset; + u32 val; if (!dev->parent || !dev->parent->of_node) return -ENODEV; @@ -345,6 +369,16 @@ static int rockchip_emmc_phy_probe(struct platform_device *pdev) rk_phy->reg_offset = reg_offset; rk_phy->reg_base = grf; + if (of_property_read_u32(dev->of_node, "drive-impedance-ohm", &val)) { + dev_info(dev, + "Missing drive-impedance-ohm property in node %s " + "Falling back to 50 Ohm.\n", + dev->of_node->name); + rk_phy->drive_impedance = PHYCTRL_DR_50OHM; + } else { + rk_phy->drive_impedance = convert_drive_impedance_ohm(pdev, val); + } + generic_phy = devm_phy_create(dev, dev->of_node, &ops); if (IS_ERR(generic_phy)) { dev_err(dev, "failed to create PHY\n"); From patchwork Fri Mar 1 15:33:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Muellner X-Patchwork-Id: 10835571 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 19A0C139A for ; Fri, 1 Mar 2019 15:38:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02B272F4E4 for ; Fri, 1 Mar 2019 15:38:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9A372F512; Fri, 1 Mar 2019 15:38:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 92D3D2F4E4 for ; Fri, 1 Mar 2019 15:38:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ODBDHYLMtVNZEcbn8/9cWFS2AUeP8X6QsG8y2L9YFM8=; b=MJvAiWwExjKEnaVjSx09ZPzrOR m3yoYjaAsF8bCKMAYzoq3gO9W9K7F6Mv3jisGqUMiK98gXMiGqZ+7y+FbUn7iaDvP8vxJgcbYtTT+ ammZfA4Ghh9Csmu1Ain0+/S0iWAADLyFWoJXi8Oy+10u2Bhb+OSEe55zcIP0/aj0OoUj1BsnnW8Uq CcDhDSe+QDaodqmMfNF2nFzwFMpoxTKJpMzyozhDr5UYQV2j+uFLkUAjLvJPFmVW/5Z3CI7u5A1df yLjUzcrftrMWAsYy0u+tRdSkFRnskrPK15vkx+sOfIoCAWPx3YItryBD0ZCApdhlpWJEb+kredBdt ABmcp4hg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzkEX-0007LS-En; Fri, 01 Mar 2019 15:37:57 +0000 Received: from vegas.theobroma-systems.com ([144.76.126.164] helo=mail.theobroma-systems.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzkDr-0006aV-Qc; Fri, 01 Mar 2019 15:37:18 +0000 Received: from ip092042140082.rev.nessus.at ([92.42.140.82]:42682 helo=purcell.lan) by mail.theobroma-systems.com with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1gzkDa-0005Ag-2G; Fri, 01 Mar 2019 16:36:58 +0100 From: Christoph Muellner To: robh+dt@kernel.org, mark.rutland@arm.com, heiko@sntech.de, shawn.lin@rock-chips.com Subject: [PATCH 2/3] arm64: dts: rockchip: Define drive-impedance-ohm for RK3399's emmc-phy. Date: Fri, 1 Mar 2019 16:33:44 +0100 Message-Id: <20190301153348.29870-2-christoph.muellner@theobroma-systems.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190301153348.29870-1-christoph.muellner@theobroma-systems.com> References: <20190301153348.29870-1-christoph.muellner@theobroma-systems.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190301_073716_029649_BE2906A7 X-CRM114-Status: GOOD ( 10.31 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Jeffy Chen , linux-kernel@vger.kernel.org, Viresh Kumar , Brian Norris , Douglas Anderson , Vicente Bergas , Kishon Vijay Abraham I , linux-rockchip@lists.infradead.org, Tony Xie , Klaus Goger , Enric Balletbo i Serra , Randy Li , Philipp Tomsich , Ezequiel Garcia , linux-arm-kernel@lists.infradead.org, Christoph Muellner MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP A previous patch introduced the property 'drive-impedance-ohm' for the RK3399's emmc phy node. This patch sets this value explicitly to the default value of 50 Ohm. Signed-off-by: Christoph Muellner Signed-off-by: Philipp Tomsich --- arch/arm64/boot/dts/rockchip/rk3399.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi index 6cc1c9fa4ea6..b875364a7709 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi @@ -1450,6 +1450,7 @@ clock-names = "refclk"; #phy-cells = <1>; resets = <&cru SRST_PCIEPHY>; + drive-impedance-ohm = <50>; reset-names = "phy"; status = "disabled"; }; From patchwork Fri Mar 1 15:33:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Muellner X-Patchwork-Id: 10835565 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C694139A for ; Fri, 1 Mar 2019 15:37:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC6632F4E4 for ; Fri, 1 Mar 2019 15:37:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E05F22F512; Fri, 1 Mar 2019 15:37:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 92A7A2F4E4 for ; Fri, 1 Mar 2019 15:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=DGPgAahbykTqwYRKZmOAygF3rbd1DTAetJIk5vyaDVo=; b=E8qF9Jw9ZLk5IQ5+WiWYejmseW bhFkBQ9g0Qo3X07k30tDQOEsnCzlBR3X7pPLAmxDvcjOjrU7O+kctDfR+fq0fHv+Iteiucyl3n/1B Ad/q/T2t20itQPbiO4sAOwXhfXZ9yIPWA1wWKPSePcuij9YfvtYE4rjt3G3DnVWpUsFuoHm19fQnk JIbXBJgnvl2B4wXr/ZpQCWKQCDkft9Pz4qyc1mra0Lwf/no46zxDbXq6XGXX2XyI/O3TlhS3wkIwn mGCf8/roH1G9RuTXpvuPmPkdzKNQvZRArrnsczMFL9X0HFsWbYMpFDUR9VYjJEeZXhwLH5k+74IsI KTY82UpA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzkEI-0006zi-Qc; Fri, 01 Mar 2019 15:37:42 +0000 Received: from vegas.theobroma-systems.com ([144.76.126.164] helo=mail.theobroma-systems.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzkDr-0006aZ-H6; Fri, 01 Mar 2019 15:37:17 +0000 Received: from ip092042140082.rev.nessus.at ([92.42.140.82]:42682 helo=purcell.lan) by mail.theobroma-systems.com with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1gzkDd-0005Ag-Ec; Fri, 01 Mar 2019 16:37:01 +0100 From: Christoph Muellner To: robh+dt@kernel.org, mark.rutland@arm.com, heiko@sntech.de, shawn.lin@rock-chips.com Subject: [PATCH 3/3] arm64: dts: rockchip: Decrease emmc-phy's drive impedance on rk3399-puma Date: Fri, 1 Mar 2019 16:33:45 +0100 Message-Id: <20190301153348.29870-3-christoph.muellner@theobroma-systems.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190301153348.29870-1-christoph.muellner@theobroma-systems.com> References: <20190301153348.29870-1-christoph.muellner@theobroma-systems.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190301_073715_860762_175DD714 X-CRM114-Status: UNSURE ( 9.18 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Matthias Brugger , linux-kernel@vger.kernel.org, Ezequiel Garcia , Viresh Kumar , Brian Norris , Douglas Anderson , Vicente Bergas , Kishon Vijay Abraham I , linux-rockchip@lists.infradead.org, Tony Xie , Klaus Goger , Enric Balletbo i Serra , Randy Li , Philipp Tomsich , Shunqian Zheng , linux-arm-kernel@lists.infradead.org, Christoph Muellner MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The RK3399-Q7 (Puma) requires 33 Ohm drive strength to ensure signal integrity at HS-400 (200MHz clock, DDR signalling). A repeated EMC testing run validates that this increase does not negatively impact EMC compliance (emissions have ample distance to the regulatory limits). Signed-off-by: Christoph Muellner Signed-off-by: Philipp Tomsich Tested-by: Jakob Unterwurzacher Tested-by: Klaus Goger --- arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi index 0130b9f98c9d..4f75bb6b2f14 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi @@ -146,6 +146,7 @@ &emmc_phy { status = "okay"; + drive-impedance-ohm = <33>; }; &gmac {