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: 9566099 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 6DF7C601EA for ; Fri, 10 Feb 2017 07:45:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 598932853F for ; Fri, 10 Feb 2017 07:45:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E4F628546; Fri, 10 Feb 2017 07:45:49 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 D4D422853F for ; Fri, 10 Feb 2017 07:45: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: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=b16sb2rFN8Iasp0qg1poSOlNX73PDbV8mlADn8mkGFs=; b=k6uWioNKEFpjfZQdyRN5zhXmDy mmpvO8zRyyJToXYcGrxCPabYW+YdR5fAAC1h4IQz6zsbGnZGaOGdDdWD8A6Oq7WNVBIrE/XT+3W97 eRYXVdkth96IlpPGEMn4FdVs7YEU6U+vDHrx+n32ck+K1NYiflN4Bx5hp7LzcERDVXzv2hPvg208q L5hqJADncUw01XwKHftTWg3KSoVK8LtUmnJj7x3hnOi/MIqXa3u+gbdv8Gp/xFVL0iHpwUHQpDacf Pk1ws2pBIJFHoRoYOGLN/HEtUstUXJQRNl4SGVuJsOr/05i8gCm9EzffVgE6ujDJw2QfYG2HYqhQi wKkXzo2A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cc5to-0005Pt-FQ; Fri, 10 Feb 2017 07:45:44 +0000 Received: from mail-pg0-f67.google.com ([74.125.83.67]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cc5t8-0003bS-Ab; Fri, 10 Feb 2017 07:45:10 +0000 Received: by mail-pg0-f67.google.com with SMTP id v184so2524603pgv.1; 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=s1R8wiIo8m4soXIAEeoaWMJKfLtjMKVQUfKoxm6ba6qjjXlNv9PqAqXQ72Ru+MjWPJ 4f684mU5JKU9DCD0vvKBYfupjh2Uefc6M3v80l0NgM+CkcehAGAD6P0dbEfk7DXf2p3q QudodIfloV8MIL1CCOzc2nCKAC6cAXWGjFYVmI4r8QY8ZGyHGclWdAHZvN0MUSXBroez 0e0ZLW15uB9stlZdn9O+mfnCYui1qB56kqY1hXH3je6hk68dOJ3JgWqXSwEY3EpYgPt7 kX34Q9LEpROwg++c+orqfE1ZjL3dIxT4e7EAAigkcZOClFpPajfnFvJwEjUCCtwryxqA 5AuQ== X-Gm-Message-State: AMke39n5lInS04E8z0cruVUfPijYV/FxhFIEAvsTfKeUuV+oGxjgXnmMItpGaoQKw8EbMQ== 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170209_234502_858912_80C676A2 X-CRM114-Status: UNSURE ( 9.61 ) X-CRM114-Notice: Please train this message. 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: Heiko Stuebner , linux-kernel@vger.kernel.org, zyw@rock-chips.com, seanpaul@chromium.org, groeck@chromium.org, linux-arm-kernel@lists.infradead.org, mark.yao@rock-chips.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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)) {