From patchwork Fri Feb 10 07:44:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Zhong X-Patchwork-Id: 9566079 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 79C4D601EA for ; Fri, 10 Feb 2017 07:44:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 660222853F for ; Fri, 10 Feb 2017 07:44:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A77D28546; Fri, 10 Feb 2017 07:44: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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1EDB72853F for ; Fri, 10 Feb 2017 07:44:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 22C476E1F3; Fri, 10 Feb 2017 07:44:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by gabe.freedesktop.org (Postfix) with ESMTPS id 897016E1F3 for ; Fri, 10 Feb 2017 07:44:45 +0000 (UTC) Received: by mail-pg0-f68.google.com with SMTP id 75so2512886pgf.3 for ; Thu, 09 Feb 2017 23:44:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kcseC78abqArlTsBw0eQo9dUTzMRPKsax87tdvO4j/c=; b=oHbkZ8TbzE4sqLl4CuYPCX2duNbeuiLCs6t1upi7LqXAHbc8QMxQhA766CvrXOjyU9 ceJkrOD8zQecxHUePUonHLdH5CuxEoQHz8l+Gjsb6wkCOfEqsXoKHSHrAppZuD0whK8f hXLmLzZtc/KS26KgXX4a50qmkNj/tWZHrKqUnByLSpyi/Ad0S6hggLUMbEGiNd+X2Ofo /blbdWuPa37a/SGGGJdFtvrJfA60eZPAXphqUU7ZJTMdTnSKxhsddppTDW9H0TQzEnak 5DpNgVk/BnRrZF3qzjaVvHR2/oP88ymvZbd79CUDz2ADfHcrUDr2dGclu9ymfP/z3t3Y 5ikQ== X-Gm-Message-State: AMke39lblpmQuDGRSfKxWK8OsqDb6eLG7jGT+AeY3RlH+lr82hQ9/yelk0JWK7uWgU1DfA== X-Received: by 10.99.166.17 with SMTP id t17mr9129007pge.196.1486712685174; Thu, 09 Feb 2017 23:44:45 -0800 (PST) Received: from localhost.localdomain ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id 82sm2686857pge.42.2017.02.09.23.44.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Feb 2017 23:44:44 -0800 (PST) From: Chris Zhong To: dri-devel@lists.freedesktop.org, kishon@ti.com, robh@kernel.org, linux-rockchip@lists.infradead.org Subject: [PATCH 3/4] phy: rockchip-typec: support DP phy switch Date: Fri, 10 Feb 2017 15:44:13 +0800 Message-Id: <1486712654-15431-4-git-send-email-zyw@rock-chips.com> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1486712654-15431-1-git-send-email-zyw@rock-chips.com> References: <1486712654-15431-1-git-send-email-zyw@rock-chips.com> Cc: linux-kernel@vger.kernel.org, zyw@rock-chips.com, groeck@chromium.org, linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP There are 2 Type-c PHYs in RK3399, but only one DP controller. Hence only one PHY can connect to DP controller at one time, the other should be disconnected. The GRF_SOC_CON26 register has a switch bit to do it, set this bit means enable PHY 1, clear this bit means enable PHY 0. Signed-off-by: Chris Zhong --- drivers/phy/phy-rockchip-typec.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/phy/phy-rockchip-typec.c b/drivers/phy/phy-rockchip-typec.c index 7cfb0f8..1604aaa 100644 --- a/drivers/phy/phy-rockchip-typec.c +++ b/drivers/phy/phy-rockchip-typec.c @@ -267,6 +267,7 @@ struct rockchip_usb3phy_port_cfg { struct usb3phy_reg usb3tousb2_en; struct usb3phy_reg external_psm; struct usb3phy_reg pipe_status; + struct usb3phy_reg uphy_dp_sel; }; struct rockchip_typec_phy { @@ -736,6 +737,7 @@ static const struct phy_ops rockchip_usb3_phy_ops = { static int rockchip_dp_phy_power_on(struct phy *phy) { struct rockchip_typec_phy *tcphy = phy_get_drvdata(phy); + struct rockchip_usb3phy_port_cfg *cfg = &tcphy->port_cfgs; int new_mode, ret = 0; u32 val; @@ -766,6 +768,8 @@ static int rockchip_dp_phy_power_on(struct phy *phy) tcphy_phy_init(tcphy, new_mode); } + property_enable(tcphy, &cfg->uphy_dp_sel, 1); + ret = readx_poll_timeout(readl, tcphy->base + DP_MODE_CTL, val, val & DP_MODE_A2, 1000, PHY_MODE_SET_TIMEOUT); @@ -869,6 +873,11 @@ static int tcphy_parse_dt(struct rockchip_typec_phy *tcphy, if (ret) return ret; + ret = tcphy_get_param(dev, &cfg->uphy_dp_sel, + "rockchip,uphy-dp-sel"); + if (ret) + return ret; + tcphy->grf_regs = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf"); if (IS_ERR(tcphy->grf_regs)) {