From mboxrd@z Thu Jan 1 00:00:00 1970 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=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED 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 D9235C43381 for ; Tue, 12 Mar 2019 13:08:14 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A7740214AE for ; Tue, 12 Mar 2019 13:08:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tcV6sjTV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7740214AE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sntech.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=epNdahAVwIRNGAxuW1sF0PQqP41cbOSBDA6gR1IQNIc=; b=tcV6sjTVt/ZoHe BWXD2mTqaU0WmR7y107o/kIQg20U02jJzBjojWoJXrB9v+6M4mpHMkDW26POlbIwYICuIB4LLMlg4 FOprz90L4GVeIRBTMBgDyL4uzgG0Q+UiLDiMograotCy4e3G50Yt85VVTV3g3dtSF/uLCOyZ2ppAv ZCYYZydNIlF2D6fa1NIYdvHTFYrFarEpGuSbP959dfHxHnB/rszl7wyP4t2/UesWjK29MXHhKNj1K A89i5zuqTw+/OXXMJChGwgb9xuc4Ngzrb8zhbKzCChBFDlBkWqz8jIlCIouppJS3ZRJgP8tlvtsOG y2X5Gbr/ASS4VLhjsFdg==; 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 1h3h8V-0002t8-Ce; Tue, 12 Mar 2019 13:08:03 +0000 Received: from gloria.sntech.de ([185.11.138.130]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h3h8R-0002sW-1H; Tue, 12 Mar 2019 13:08:01 +0000 Received: from we0652.dip.tu-dresden.de ([141.76.178.140] helo=phil.localnet) by gloria.sntech.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1h3h88-0001ln-59; Tue, 12 Mar 2019 14:07:40 +0100 From: Heiko Stuebner To: Christoph Muellner Subject: Re: [PATCH v2 1/4] phy: rockchip-emmc: Allow to set drive impedance via DTS. Date: Tue, 12 Mar 2019 14:07:39 +0100 Message-ID: <1571188.ajMNexS2DJ@phil> In-Reply-To: <20190307084159.25236-1-christoph.muellner@theobroma-systems.com> References: <20190307084159.25236-1-christoph.muellner@theobroma-systems.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190312_060759_232221_66C807E4 X-CRM114-Status: GOOD ( 19.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, Matthias Brugger , Lin Huang , Tony Xie , Viresh Kumar , shawn.lin@rock-chips.com, Brian Norris , Douglas Anderson , Vicente Bergas , Kishon Vijay Abraham I , linux-rockchip@lists.infradead.org, Jeffy Chen , robh+dt@kernel.org, Klaus Goger , linux-arm-kernel@lists.infradead.org, Enric Balletbo i Serra , Randy Li , Philipp Tomsich , Ezequiel Garcia , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Am Donnerstag, 7. M=E4rz 2019, 09:41:53 CET schrieb Christoph Muellner: > 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 change itself looks good Reviewed-by: Heiko Stuebner Though I cannot say too much about the electrical side. Heiko > --- > drivers/phy/rockchip/phy-rockchip-emmc.c | 30 ++++++++++++++++++++++++++= ++-- > 1 file changed, 28 insertions(+), 2 deletions(-) > = > diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockc= hip/phy-rockchip-emmc.c > index 19bf84f0bc67..b804c6bf4b55 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 *p= hy) > { > struct rockchip_emmc_phy *rk_phy =3D 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,26 @@ static const struct phy_ops ops =3D { > .owner =3D 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.\n", > + dr_ohm); > + return PHYCTRL_DR_50OHM; > +} > + > static int rockchip_emmc_phy_probe(struct platform_device *pdev) > { > struct device *dev =3D &pdev->dev; > @@ -322,6 +343,7 @@ static int rockchip_emmc_phy_probe(struct platform_de= vice *pdev) > struct phy_provider *phy_provider; > struct regmap *grf; > unsigned int reg_offset; > + u32 val; > = > if (!dev->parent || !dev->parent->of_node) > return -ENODEV; > @@ -344,6 +366,10 @@ static int rockchip_emmc_phy_probe(struct platform_d= evice *pdev) > = > rk_phy->reg_offset =3D reg_offset; > rk_phy->reg_base =3D grf; > + rk_phy->drive_impedance =3D PHYCTRL_DR_50OHM; > + > + if (!of_property_read_u32(dev->of_node, "drive-impedance-ohm", &val)) > + rk_phy->drive_impedance =3D convert_drive_impedance_ohm(pdev, val); > = > generic_phy =3D devm_phy_create(dev, dev->of_node, &ops); > if (IS_ERR(generic_phy)) { > = _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel