From patchwork Mon May 11 07:53:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1165 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3AB633F9E5 for ; Mon, 11 May 2020 09:53:38 +0200 (CEST) Received: by mail-pf1-f200.google.com with SMTP id r5sf8139851pfh.12 for ; Mon, 11 May 2020 00:53:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183616; cv=pass; d=google.com; s=arc-20160816; b=0EoUl+uzF6Dj1efuxmivjhcX5JHk9PrZt8IQfXR9hlIGGx3ApmYUJGlOwdLNbQNzZG JKKXlij9KHdKWvCytyUL2T2V5Syuc1Wv78YUEaCYQdmaNI8F03VS/2xzf0mse4t6xtDr OXjOYjRSyLzDmBYlydsKEyjWe5gNCSJmRMqVuU0WhPb0ejkEGbVf976EVPF0qFIe/Zq/ 88183zTJMqoctFwey77zBbt30VZSx/Bd/L8qqg9uxOFa6/Jwky9ZKWpAWZu8LXF+ZWCt 9QtWCvLP1OpJSrQDXEdz8H61/J8wDKOMgVg6Cs7JWHakJBYVLlcKt5pyCyWmSw4gGiMF FgWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=ZUBSKwOld9wPtMKB+15EzXxQ8hCATK15RIOALGUx+PA=; b=sTdo/EUtznyDqqzNPaQElFAjjVll/Q6a2n6xoEEFyMdCYVou5acpKEEMerMmW04u+T Xehe5vXY7CgWbOiBhisS4c5HtMp1Zn9SIanfyBuESrO+N9tp+pLzWtzKH2e6Ts8EZ9KZ wGvAtCncPWpHNgFn1k1doDoYgl/bsC6XtYTjxoo1G61yUJqoRgEIPsA1Xr1ulfEEgj5n 0QlTtNbtH/OUS6tDjSw75j6bU0ecq6n3p/MTMnmTA4Lnn5hp45ICePlv11eN6jezorMk Z8NgX2pz8sCrz+VeSPBxivtYmTu+4Lu88r09qcaZNbeDZNTO1kUwI7D9+ZsfxvkwFN0K OIfw== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.134 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=ZUBSKwOld9wPtMKB+15EzXxQ8hCATK15RIOALGUx+PA=; b=p0CIsf2zfBGoGmI/kfD4AAN6ixVVP80pc1fG8AEXyCmrNac0u3p0eDLJI/ixwysDAG ZqS5BGK4+EzbN5QXqV9ofRb4bz2w+qfmMfWQsR0zQCVg9zCmlvqRBtQd2Vcma09vgxc6 ipssyhykVdhecO5LfK1OO/ZMSmqJfC4OvAsJ4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=ZUBSKwOld9wPtMKB+15EzXxQ8hCATK15RIOALGUx+PA=; b=pDDU6FrZy5ntwCH2TBdFaFDbGpYJ/PAhmBQwoc9uZjPQ+M/aEpe9fRER5/77dFx2sI u3mMEInEh491urRhdafmZXhV978ZpMaK59JclsryGsvRT2vIg5d4tre64Lo1eYn9Shuu 6R0VBkHgpZtk1ixq3TWrSarS9ATLUCiQbDyNBE2VxYwkIuMEbI1wE43TBeo4H9nr/gu6 J2h9tkbkBiiYq62+6muBgjlFtvvsiHsp9jdvTa0lzPAofLGicT+ndQUWUYGNU0x684OR tZVa6MG89+rg22CON6yTe8a5FZJ3E/4mzmykmVHjW2g7augIcRFNAbsriYiIP8FqEoYE yJ1g== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuZIg3y2yJrGNICZw5eYGQ91ETMgTOxEdT7IHFE4rC8l6fYXJNUI hHtE0RAsbHmK5+6mFk3Ci27jgOR0 X-Google-Smtp-Source: APiQypIWOn+oW8RWEGxIGqbImi58Dd0iUo1V1MOabfkHVqJ+Ujv/Dw1yDASfnLSNq1DnKAs5VFQgUw== X-Received: by 2002:a17:902:fe06:: with SMTP id g6mr14221463plj.105.1589183615868; Mon, 11 May 2020 00:53:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:8c82:: with SMTP id t2ls4647221plo.5.gmail; Mon, 11 May 2020 00:53:35 -0700 (PDT) X-Received: by 2002:a17:902:b102:: with SMTP id q2mr8492998plr.29.1589183615437; Mon, 11 May 2020 00:53:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183615; cv=none; d=google.com; s=arc-20160816; b=dibkSYXqBRf4j0taBVMATp12LWc7gc6kuci1FWmGiw6ur/8PFJPtQRV4PiI7KDqLQY /lCxtfSDbxw7L0ahS4thKFfB7pTss5ZUJDQRnQ0hpMOA02UUsF/H6E12YgA7Vmh1JMNl jaq8qGPcezIwqsnwP4VzHJSDxnqnwE3Er2mOfZmQt4FQqf8jdZNujbZc8i6rBdzHFvv3 fDmCuve4hgA11zUpImlVuOPs40oSiWc16SE/fnCdodhtDAb8YLZd47GkmpIVOe2IHcKf iXlqaX9/i63+IRFxuY3cmLydvjQt5UOujf8kB++yi+uk/Hki9uJWfy7I6RmJVXjH5BU6 1HLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=pXU7ajYGmatWTl5gCYdERxi57mdgQIg8mIbHRHrNlxk=; b=UOnb8Et1av1lKB+B7KW76wVK7wzxsTAFI3xfk3FrZYcMVxflhAyxKL16KjErjdgj9x OJCrTljS92K57j0JSDuU13KT9ZWZc2yie20yYtD0/hPrPdP5z54pLbzPvARBdKvvstyF 75T9F8a2+8MZiXlD/j7ZoAvjtKCwg80sE4eyKPSIRQhHbdhaJdkbyworQmIlINRWkTIZ IUn9W0OZAwmCwm2nh/ll8RqIXkkkPYJCQAeOu89OBU+YaLCQ1qjYk8w4hOhqayYUQWwP uz+Im7SMHszSj6zOVMsuEaVWGy95Zv4gCpV8zOBFpw2dr6yonh00PSoXu7tPE4lMtU4A P8gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.134 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.134]) by mx.google.com with ESMTPS id f22si7103479pgg.342.2020.05.11.00.53.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:53:35 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.134 as permitted sender) client-ip=211.157.147.134; Received: from localhost (unknown [192.168.167.69]) by lucky1.263xmail.com (Postfix) with ESMTP id 45E9BA4C8D; Mon, 11 May 2020 15:53:33 +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 P27329T140438906509056S1589183610459145_; Mon, 11 May 2020 15:53:33 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <3a74ad31cb8d55cd1d2558ee40d6ae22> X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com Subject: [PATCH v4 01/16] clk: rk3399: Enable/Disable the USB2PHY clk Date: Mon, 11 May 2020 15:53:15 +0800 Message-Id: <20200511075330.26462-2-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075330.26462-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.134 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Jagan Teki Enable/Disable the USB2PHY clk for rk3399. CLK is clear in enable and set in disable functionality. Signed-off-by: Jagan Teki --- drivers/clk/rockchip/clk_rk3399.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c index 5fb72d83c2..b53f2f984e 100644 --- a/drivers/clk/rockchip/clk_rk3399.c +++ b/drivers/clk/rockchip/clk_rk3399.c @@ -1091,6 +1091,12 @@ static int rk3399_clk_enable(struct clk *clk) case SCLK_MACREF_OUT: rk_clrreg(&priv->cru->clkgate_con[5], BIT(6)); break; + case SCLK_USB2PHY0_REF: + rk_clrreg(&priv->cru->clkgate_con[6], BIT(5)); + break; + case SCLK_USB2PHY1_REF: + rk_clrreg(&priv->cru->clkgate_con[6], BIT(6)); + break; case ACLK_GMAC: rk_clrreg(&priv->cru->clkgate_con[32], BIT(0)); break; @@ -1167,6 +1173,12 @@ static int rk3399_clk_disable(struct clk *clk) case SCLK_MACREF_OUT: rk_setreg(&priv->cru->clkgate_con[5], BIT(6)); break; + case SCLK_USB2PHY0_REF: + rk_setreg(&priv->cru->clkgate_con[6], BIT(5)); + break; + case SCLK_USB2PHY1_REF: + rk_setreg(&priv->cru->clkgate_con[6], BIT(6)); + break; case ACLK_GMAC: rk_setreg(&priv->cru->clkgate_con[32], BIT(0)); break; From patchwork Mon May 11 07:53:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1167 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 9663F3FA4F for ; Mon, 11 May 2020 09:53:38 +0200 (CEST) Received: by mail-pg1-f199.google.com with SMTP id q5sf7126274pgp.18 for ; Mon, 11 May 2020 00:53:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183616; cv=pass; d=google.com; s=arc-20160816; b=s8yF3B1oNKQqb03/FxXlPG6bPbPBeDNhgdn+TLH8gerkX2FHZky3LID5UbbiBRn0nO ea+p5v7j6zOTbYNSLut2IIfUD4iW2J/5jnzWwYjPa7bsUfyugcBz2crTHZ8+w4QATNw0 VbAN+fVQp+XTg+ulrUD/+DZcjt1c+9pm/z3OcCSqLWjRkrtEdySzMxdFAXJllcTlOJfD 2jaDFWLOTFfK0y/Bop+ooYaoXNNwIRns9TziAHsPO8L2XUS2Iwqeahnxj1rHG1iWO+AJ 6H/yflBLDmS8xYgBOojaPHzW8d0Q2IO+l5USJR671aqM1EQE4EfM7lXgkt6YddBA7yq+ 67mg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=67DKE1tBO1oq54v2ZqLw2g4yTppIXRGgNcXeRyr1FNw=; b=bc0MprUDBNbH2/4xveOBecHTL2oiG3l8sIqSk/B/5A7kaX6ZYy0pSELN1fmv21aI21 SPPWCoumMXUYlatyK8BAq7wCg/b5ZX+/edAhoWCmZcIBnT8CmS+ujg6NdEMAE8YV5e1b xcLdZzc59H0VF5EEwTAXUlmRmvwDa6JaqcJu5FMiunwek7wKXRrtrW9ZgUlkWbcgKCY6 mEpKVeqElV22kuiSfjqzVX68bAP6LwyZCuV2JT6Sqit/IZmIIZaQGNPwYWTEmd0QrISi FsstOELjdVu3oI15U/Wto6xV9ZB+lbCyuL1iKdbL4cTky0WAttvPy8W2M85oScoF0CwA JH8g== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.135 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=67DKE1tBO1oq54v2ZqLw2g4yTppIXRGgNcXeRyr1FNw=; b=FnD+3fkQ1QIklEEZk+AnX5E3/CQIZyLNjt5utAq/+JrnyxGBS73pkn0eg41C8BslFk Lti+QmvbWe7YQ8rwq3EQDGazWmsbtQgJ3M+dAEgx3ERmAGt+R/iDc9ev6p0pBsQ2IGoj jkEfTM75PX1xbXgEYfo8H/OBsmjI+RcA4MNj4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=67DKE1tBO1oq54v2ZqLw2g4yTppIXRGgNcXeRyr1FNw=; b=DPzrEHeAMKRdXzYkw8AyAc2P6kUXSqqXSr+BB0fBG4u3NGn2xBAp69ED0/mFGiQ0Tn q5bWG/ug50u7+AsFHFTX5ydXSFBQAliHiIOzS7HMLP0QJrO5X4cLdZGdPFajyjSIhH2B d9mUJSGczFixp6bgyTQx2FWYTcG2pHScZ7AS+Bd9hHPpkw/xsEmfPs/2drGVlc6eEhix f4uBuI+bz7Yo7IntS6O6X7KHsmJ86F7qFJeOI5IsjKZkGqDYs7Zgswe93AxIPN9MpIrr H2DBTogTLGfyZRf5RaN9V8HKqrtgg863YQW1jGCGLOLLSrU3jVY2pChoiVb8fLD+rqWA 8PoQ== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuaCf1F1Ty5f6LLvtwzvmM7Nkp0XQiwneUCS+RvRrxiVnFEGEAWE ODoLok56tZDAPFgqe4miIva9XyQL X-Google-Smtp-Source: APiQypISDcI7z7OD7n+S5o0W/5SJG/ETnEyAWgHaGa4Ez0tdzz+ZfxknP4zIILHXLH06zkV8RL2nbA== X-Received: by 2002:a17:902:694b:: with SMTP id k11mr14444228plt.59.1589183616746; Mon, 11 May 2020 00:53:36 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:c713:: with SMTP id o19ls16186325pjt.1.gmail; Mon, 11 May 2020 00:53:36 -0700 (PDT) X-Received: by 2002:a17:90a:4d4e:: with SMTP id l14mr20369194pjh.136.1589183616104; Mon, 11 May 2020 00:53:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183616; cv=none; d=google.com; s=arc-20160816; b=T0RKOP5KeYco3ExXAIUUR8K+G0gTPzuBLn/77FpExKKG5nf36y6sJxZtSOoPvZ6kcB 4Yyqq2+C4ohmZDbAElxRhEquCPMzdArWX+N3kySNr+d5PoY5MXRbP6b1Hp/FD4EzwX6q KriiGcHhy9QLHGDk596DBikjffVbN5TZkCGLultHS63vbUdeksEiBICMuNqkwMiRKkJe Sw/HXz3g3FIfXzD+GF4CzSX/aXQ82EwE9y+whkIsmw3z+YfXsAOvbforVHL5SaDIGIUG M+1z3VW0lKEzjOmq0bBRHgZ/Cri2UiZ+P+5W7Kq4SOjpMCgnWXpd2ZdGzFGWqhqmYlhP 0OAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=OZ1ETU+eldI2OY3ShbFht/7FzHTxFV+8pZqUAvGabvU=; b=aIm+EmU/gJo0O9lh70Pa6Jgj3wYFcVLukpty3R5G10jxBFneUXOplg/jO3GvPU2TTM gq3M0uZMYFwNoVowluSFh7IuBsNQ25cOWwmcYNwRTYDfa6DJjDeP3X8G5PNEM91um32O Bek5biHReuwNAeVD6v6IMrwwRWhqRiCMJfF752iCK7HfCi2waQ+gwoM86IfPMVisyS4f MIw+ensF/owOm2lZssnHJlz3zZEx2xbhXjEAM41qo51tEEh9/VxjLLogPnfCMNwpez19 0tfJzY6nCedvIBgBz1AREsS5udkS1CdVgEvNxEbnQ/XVxEzVYLz/IDzWVPX3PWhSvOw9 e4Iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.135 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.135]) by mx.google.com with ESMTPS id z186si3651569pgz.341.2020.05.11.00.53.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:53:36 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.135 as permitted sender) client-ip=211.157.147.135; Received: from localhost (unknown [192.168.167.69]) by lucky1.263xmail.com (Postfix) with ESMTP id 28AF38255C; Mon, 11 May 2020 15:53:34 +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 P27329T140438906509056S1589183610459145_; Mon, 11 May 2020 15:53:33 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <95950efd630bd0b3b9e1de52904f83e3> X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com Subject: [PATCH v4 02/16] clk: rk3399: Set empty for TCPHY assigned-clocks Date: Mon, 11 May 2020 15:53:16 +0800 Message-Id: <20200511075330.26462-3-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075330.26462-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.135 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Jagan Teki Due to v5.7-rc1 sync the SD controller nodes in rk3399.dtsi have SCLK_UPHY0_TCPDCORE, SCLK_UPHY1_TCPDCORE assigned-clocks which are usually required for Linux and don't require to handle them in U-Boot. assigned-clocks = <&cru SCLK_UPHY0_TCPDCORE>; assigned-clocks = <&cru SCLK_UPHY1_TCPDCORE>; So, mark them as empty in clock otherwise device probe on those typec phy driver would fail. Signed-off-by: Jagan Teki --- drivers/clk/rockchip/clk_rk3399.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c index b53f2f984e..98fc6a3267 100644 --- a/drivers/clk/rockchip/clk_rk3399.c +++ b/drivers/clk/rockchip/clk_rk3399.c @@ -997,6 +997,8 @@ static ulong rk3399_clk_set_rate(struct clk *clk, ulong rate) case ACLK_VOP1: case HCLK_VOP1: case HCLK_SD: + case SCLK_UPHY0_TCPDCORE: + case SCLK_UPHY1_TCPDCORE: /** * assigned-clocks handling won't require for vopl, so * return 0 to satisfy clk_set_defaults during device probe. From patchwork Mon May 11 07:53:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1169 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id E50FD3F1DD for ; Mon, 11 May 2020 09:53:40 +0200 (CEST) Received: by mail-pj1-f71.google.com with SMTP id s6sf16882621pjq.1 for ; Mon, 11 May 2020 00:53:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183619; cv=pass; d=google.com; s=arc-20160816; b=fxaNGC34Q3RkT6deESaIb66gW3YKdB2xy/bM5RqtQdTw5G0kh5HM4/Z27b3aLpeSm7 bjULLyXPYkOOlOa60ATRA21IUyhNAm7upHJdGgSxq9yrpKAEuhX9Mz8XRKzTrJWcfZRt nYnDElE60XoxlG3uYgXAoRVUyIRB1O5JBSJXGsmvypwU12GwuH3fj8XSW9NjAbJSnvYp IGwmNEKihAtjwndTBncXRgrdBcnOTesOfkBrxs4mUR3K6t4Huujfr9nhPn8K51KAii+W YVXsQbhsqZo68oH0dzsI8vlNfO8xbTbmfafP4e1Im9bRW5BY85QAr4DBSwMfj9Wy9I6k lgog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=VbrroEfLdi4LT9Vu+9gjU6aYcTOCMaYqVP+MIj8NcYk=; b=r1DFOEYscOth0b1mQbCfmpD6jnOvSCf+0PpFqHKindRDFC5viqs+XckVPhVKLAjbIb 25QgW1/l1XWfNtnqGYNBaF4chk0KU0KHqhumEWQyfb+fxuk55ex6FzRvUZKXw9OjJp3A Iv82b1Pi9w1MqWZ6QucZCPEYIY6SQFcD7Mc8oK4Os+MvUX9GrBFk2tNEp+0ApM6O4Ymq MfE82VlqABRWMizXsKyYiqk3T9ifeWOu7v6M/+FD3PQF7DvlUbR+vnkcfsL9zoLQlmyE U7FSPvC5q3kC7QSnnrHjPCEm+F0/EqD1O40nZM6W/eXKJdtwf0Okn7Z7YJglPSZNnzmI Z6cA== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.132 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=VbrroEfLdi4LT9Vu+9gjU6aYcTOCMaYqVP+MIj8NcYk=; b=SekH4lIBdOL8mBzGOmYpE2kEFqlgixNiJ8AlJ3FhhhJsAT7DyJni71D870/EfACKyy QmZnn1HHMik6ynfYXxwt9jfiotqFrY7+VWX1E8EFwa97qgFhp2aUifOvae6L6mf/Yudc f1QLPXUeovrUtfXrlXIe7JIwOOKvRf95Rbl2c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=VbrroEfLdi4LT9Vu+9gjU6aYcTOCMaYqVP+MIj8NcYk=; b=l/tUav6q44THMi4fJzEQSTpCTnV8iGPmlAWNFuuAEOPc1twatCInEyRcIwjUrRi6PP ZlIEMYYLqQmJ4+S/0EnbhyunY54LKZitNmqj9CKbcj5unYRRyZOKcgWKooEkRJdkQDDD yz/WMoJO8j/8HaS3CFXc257XnLM1i6BaZqBndqCA8tuwmCleRD3TlQXNDsbv5OytkGIN Zxw/i/F28RiL0klGCdQQar19Oc8KhFk/cNJeeIIV5xzfUK26he88w4zoR+Asjbs215ww EhssgFcBo/DMkndzPEqbL1X++Nz/MBPNqsQroRa6Ku6EonUmoML9sUupbDiGvyF7vsnO H4aA== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuZSJStnjKcROnL/qLhahstsbd5vwOQkJrbNyEiGXR4dhgXRDenH tQD2+HXNyN9k/KMy1rmZDtDcII6W X-Google-Smtp-Source: APiQypKTmulfm8ViCmz4adsOynmAAXn27pVYRAEKqVuZkanXYcILODc7J74jtdSS496maW2anGOkgw== X-Received: by 2002:a17:902:74cb:: with SMTP id f11mr14503042plt.171.1589183619615; Mon, 11 May 2020 00:53:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:2944:: with SMTP id p65ls135529pgp.2.gmail; Mon, 11 May 2020 00:53:39 -0700 (PDT) X-Received: by 2002:a63:ed02:: with SMTP id d2mr13579396pgi.119.1589183619059; Mon, 11 May 2020 00:53:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183619; cv=none; d=google.com; s=arc-20160816; b=vTFRx+LND3di6H9Kcq2MXiJ0UF6y4ncdAvh/IB4UzP6HVSVw7WRJMcoQQN4Vf567Ya e2reuL9oqyaFpArXW/a0N2VhGZJapUT8bBBxjT389Q5UnPz9h7hsv26DaBjJJapBvBGk hA2O3y+vn0SVnyahUo0zryl1lXZ2uv7qqrZW/LRm7pfJf1M8vLg0a3WoEN6Guv1eU1uK PKBQ4j9YNtvHhcC8o+PMSmZY9dSWRDxOxlBxghed1lCgQ1ssKnT4Z8fnA08Nl1ZCxpU1 GTwiODlHw8YGOtlFVpZ2g1p+jZb6JY9NM/jIKa6OIjzGiGHCEuSxYbi1LKTv2eNg7/3O dLVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=jKU85SHa10bWtGHnX4BI2iJtxErlsF4mk6Wlf2D4FSo=; b=TJxkYTR9c2x/zQlxQHnQLDUkN2BGln95Wqj8V7Ftep3A4u7WTDz0djqk1HCfGqovGt 1uWy5GO38wnvDn3Wmx+z1FlU83Jy6rdeHX45bXSW+ArNRz+lY0CrKLxhOvu3rni8Xz2D jpHeIoKkqDgrKZgh2ldmY7PaavDC9B/6ghNLPwU5UR1q6K3vcwCU40XksBtIDpBl6pAL CUKKFuAKkmjPNAm8TPPB5BAKR3mpl/PpB8MVm9f6xdV+skbwP64ZBtJ7v1O1WdI21ssS 3C1GdVz9zMkrOnLEVQqxqOHSJrfFdA+wYrPeuTQkI4LMqe03KID1wqjwRyqID8+mz5vg 6abQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.132 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.132]) by mx.google.com with ESMTPS id v24si1192572pgo.424.2020.05.11.00.53.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:53:39 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.132 as permitted sender) client-ip=211.157.147.132; Received: from localhost (unknown [192.168.167.69]) by lucky1.263xmail.com (Postfix) with ESMTP id 70083CD5DA; Mon, 11 May 2020 15:53:36 +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 P27329T140438906509056S1589183610459145_; Mon, 11 May 2020 15:53:34 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com Subject: [PATCH v4 03/16] clk: rk3399: Enable/Disable TCPHY clocks Date: Mon, 11 May 2020 15:53:17 +0800 Message-Id: <20200511075330.26462-4-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075330.26462-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.132 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Jagan Teki Enable/Disable TCPHY clock for rk3399 platform. Signed-off-by: Jagan Teki --- drivers/clk/rockchip/clk_rk3399.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c index 98fc6a3267..06232f1903 100644 --- a/drivers/clk/rockchip/clk_rk3399.c +++ b/drivers/clk/rockchip/clk_rk3399.c @@ -1144,6 +1144,18 @@ static int rk3399_clk_enable(struct clk *clk) case HCLK_HOST1_ARB: rk_clrreg(&priv->cru->clksel_con[20], BIT(8)); break; + case SCLK_UPHY0_TCPDPHY_REF: + rk_clrreg(&priv->cru->clkgate_con[13], BIT(4)); + break; + case SCLK_UPHY0_TCPDCORE: + rk_clrreg(&priv->cru->clkgate_con[13], BIT(5)); + break; + case SCLK_UPHY1_TCPDPHY_REF: + rk_clrreg(&priv->cru->clkgate_con[13], BIT(6)); + break; + case SCLK_UPHY1_TCPDCORE: + rk_clrreg(&priv->cru->clkgate_con[13], BIT(7)); + break; case SCLK_PCIEPHY_REF: rk_clrreg(&priv->cru->clksel_con[18], BIT(10)); break; @@ -1226,6 +1238,18 @@ static int rk3399_clk_disable(struct clk *clk) case HCLK_HOST1_ARB: rk_setreg(&priv->cru->clksel_con[20], BIT(8)); break; + case SCLK_UPHY0_TCPDPHY_REF: + rk_setreg(&priv->cru->clkgate_con[13], BIT(4)); + break; + case SCLK_UPHY0_TCPDCORE: + rk_setreg(&priv->cru->clkgate_con[13], BIT(5)); + break; + case SCLK_UPHY1_TCPDPHY_REF: + rk_setreg(&priv->cru->clkgate_con[13], BIT(6)); + break; + case SCLK_UPHY1_TCPDCORE: + rk_setreg(&priv->cru->clkgate_con[13], BIT(7)); + break; case SCLK_PCIEPHY_REF: rk_clrreg(&priv->cru->clksel_con[18], BIT(10)); break; From patchwork Mon May 11 07:53:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1168 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id E50883FA5A for ; Mon, 11 May 2020 09:53:39 +0200 (CEST) Received: by mail-pf1-f199.google.com with SMTP id y16sf8151373pfe.16 for ; Mon, 11 May 2020 00:53:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183618; cv=pass; d=google.com; s=arc-20160816; b=ZeXK19DQsvIO18OjPWF2HfDpNq9w9XNBzWGAeJ/Kcbgz1k6oJDG5k6WqJt5LVL2wCW tXEhNa4TNMgnUKtgK6Vby22x8UyWTAOigy3X5+zkW/4e54wq6A/7TtgXfgQTlU/dnI3H O2bKF4mH6PqPr0A1ZK8VNJru6i24Hgn/9g6k+L8BmvBju0a3pxZRPdQs64gIGmFZCcjz XikaEph7edbWog6kklVCVbCkiDPacSHiyeAJdkq/2Q8BeljYF7vAc4smGNB8yRLprKdB QdKow85cD8i4x6xpNdRIIvagT8gyWLJ0rbTOQFd/hHLyQb+B18uJwgl+gGfNuKVQAs2W 94JQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=cbfYHrWc4uF4KAPQl3jXsB6ZtKAiLiVPhBelyr2ATwM=; b=toNIdIaOh+FXr4Sl14SgMsTQKCQHK7OvgOFGIoUqq0fJ1uq6quFlkV31aNs0ree5na BGdSX8HFXKQHRlvxkfoWzoxvNr43oZmLvE8zbSw8ox/ocekeAV5/QW3jZKmJgiMY67MA rb2WuzBkdqoC+nMw+nejyXwj4dwE3tNW2LAJ0jxjOLBWglB3DE6F/iVJDQE4gsTxbmoG 08141PABhaKIEWXv+aMIJRjqtzZeq/6JyugGmn04Ut+AsBkeKmA14E74OJqdJRfCLs6x 8UrDSprCRRFXkw3ozxR/L9yFXAPoQlBuQkEDzGW97sFSogm85Sp8jiAJAcIjHs/7MHH2 TRow== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=cbfYHrWc4uF4KAPQl3jXsB6ZtKAiLiVPhBelyr2ATwM=; b=jyocSI+iIFHdpOyw9cOT+gMUy8VpEYsd9rv4rnTPDCw99XilvvGO/hcyRtcxzRE5Rf UsLSMyknaSDYVjMMnhFTHTyrH8jhSXgHWens5ySDRTjAMTsxN5Mo1P+Uvd/jd5iVzu0i QPjWInxmLKtQyN1mbj06DqJ23JYzVfwhaRsZw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=cbfYHrWc4uF4KAPQl3jXsB6ZtKAiLiVPhBelyr2ATwM=; b=JO5q6gbsm0NJtbJ0vaMK7WwXTvJtwoclUlqpz124EERHgbN3OVsTeB+IgLHMyUhBxQ +RV8Rw+R3J9icWI+eI9M2h4fmzSEX72ekeBIKeFK0ZuGaaYzmNv5goGQbL7qXCdQKdj5 YwqXH7eqq8E9vfLyxk7F00cklN0lCJ+hxSUgWYwO48RmCnTQK6Jx9t89E9OXkOufttTA 1Yda+4UoO9J/YEEY1UTGzOFk5eAAkc27yhK0DoDiVXr+eaVxKX8/q+MpXx1/rM/PPJiZ JaC7cXQ5o3onGBpIEWMVDFF7p+GS9F7F3e8Xrfp4IFwU6u3pqGJTwaQLZEGC+AxQM2uE 7x6g== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuZaI0hMrs0tayJq9bAtnxUio/5ROsoxViD8kLb3m46INQXrxfAT cSw3cx2POa5YY9fQTVk87gpPhMX2 X-Google-Smtp-Source: APiQypKFfaHCeXAD/UtzROx+pPXfZd2eL1VZKBoOECc5PyrQZidOzAPcXfK3SA9mDQFcFJRq66htKg== X-Received: by 2002:a17:902:a416:: with SMTP id p22mr8938340plq.270.1589183618712; Mon, 11 May 2020 00:53:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:7143:: with SMTP id g3ls16185696pjs.0.canary-gmail; Mon, 11 May 2020 00:53:38 -0700 (PDT) X-Received: by 2002:a17:902:9049:: with SMTP id w9mr14039732plz.27.1589183618210; Mon, 11 May 2020 00:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183618; cv=none; d=google.com; s=arc-20160816; b=UaFQLLEq1RKdOs9X811/+TJWwE199EHLVbXVlX1ZZ2sS1+ku8ryQ/jX/zcWTHfB9HA EfhX1HOjcngrl4xgYVdwhuN5wiciwneoWl2OR+bpViZp17b6ivY2L/+8+yfj0OXv4qjh O+cybucv3HyuOfgREIZQqFr/FuvVkj1Zprahg/tVAvcyRO7jGAB87mKUtgUUg6Nn31/r yQOtIIDDcRo9UUua4FcdSjl4zPjx4meXNPuZSFpd68tWLxw8KzD92izPMn7naEoccupb zsNtcXiNqhifRnwXIQWVew3CTkLgdGww/Hm/FemhSzqlVv9hjvmFfK61JHxGAi9x7QXX Vpsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=LS2DtfXabgesCT/z6WAwoTGmUi9FAPKDluED2NbN/xk=; b=JneLfOBjdrH4BDJul5tNo6yjATJa/tDoGeX5THjbXYJnVnJUVzjEfUpSfSEFDkjXcm SFDm1+FkQebBd65VMOMC0RNA0LJjqSOv6HHQaJfk+MER8qbPOvDhC3ZjOLVDyJfeFKTS nkik1xCcUAIOK8ysAq0w4gUZ4gFOAx84iueLRDlw2K2YaO5v/O9elPwPrD+Z1FYHudWm r/l0So5fdAhVJhOFcKB/ZASXGXKjQ7EYr4Wgjm0HoqWp1CxaxbYyRQfwMInAmJVMX8Tl 2vWXzwzW5zl4kjJbgr9quxsw1cFIjUtWMNZpABgjr8Hm8ab0YbvY81LTT8GxYKu5EgeU HmNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.130]) by mx.google.com with ESMTPS id 26si7807595pja.29.2020.05.11.00.53.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:53:38 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) client-ip=211.157.147.130; Received: from localhost (unknown [192.168.167.69]) by lucky1.263xmail.com (Postfix) with ESMTP id BAE33B4CF6; Mon, 11 May 2020 15:53:36 +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 P27329T140438906509056S1589183610459145_; Mon, 11 May 2020 15:53:35 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <9dc4958250cb7f3a629eb38445fdc069> X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com Subject: [PATCH v4 04/16] phy: rockchip: Add Rockchip USB2PHY driver Date: Mon, 11 May 2020 15:53:18 +0800 Message-Id: <20200511075330.26462-5-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075330.26462-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Jagan Teki Add Rockchip USB2PHY driver with initial support. This will help to use it for EHCI controller in host mode, and USB 3.0 controller in otg mode. More functionality like charge, vbus detection will add it in future changes. Signed-off-by: Jagan Teki --- drivers/Makefile | 1 + drivers/phy/Kconfig | 1 + drivers/phy/rockchip/Kconfig | 14 + drivers/phy/rockchip/Makefile | 6 + drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 312 ++++++++++++++++++ 5 files changed, 334 insertions(+) create mode 100644 drivers/phy/rockchip/Kconfig create mode 100644 drivers/phy/rockchip/Makefile create mode 100644 drivers/phy/rockchip/phy-rockchip-inno-usb2.c diff --git a/drivers/Makefile b/drivers/Makefile index 4208750428..94e8c5da17 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -91,6 +91,7 @@ obj-y += dfu/ obj-$(CONFIG_PCH) += pch/ obj-y += phy/allwinner/ obj-y += phy/marvell/ +obj-y += phy/rockchip/ obj-y += rtc/ obj-y += scsi/ obj-y += sound/ diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 1e38c8741f..9c775107e9 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -225,4 +225,5 @@ config PHY_MTK_TPHY multi-ports is first version, otherwise is second veriosn, so you can easily distinguish them by banks layout. +source "drivers/phy/rockchip/Kconfig" endmenu diff --git a/drivers/phy/rockchip/Kconfig b/drivers/phy/rockchip/Kconfig new file mode 100644 index 0000000000..d73ac695e1 --- /dev/null +++ b/drivers/phy/rockchip/Kconfig @@ -0,0 +1,14 @@ +# +# Phy drivers for Rockchip platforms +# + +menu "Rockchip PHY driver" + +config PHY_ROCKCHIP_INNO_USB2 + bool "Rockchip INNO USB2PHY Driver" + depends on ARCH_ROCKCHIP + select PHY + help + Support for Rockchip USB2.0 PHY with Innosilicon IP block. + +endmenu diff --git a/drivers/phy/rockchip/Makefile b/drivers/phy/rockchip/Makefile new file mode 100644 index 0000000000..9b0cbc6acf --- /dev/null +++ b/drivers/phy/rockchip/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2020 Amarula Solutions(India) +# + +obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2) += phy-rockchip-inno-usb2.o diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c new file mode 100644 index 0000000000..dd4905d834 --- /dev/null +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -0,0 +1,312 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Rockchip USB2.0 PHY with Innosilicon IP block driver + * + * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd + * Copyright (C) 2020 Amarula Solutions(India) + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +#define usleep_range(a, b) udelay((b)) +#define BIT_WRITEABLE_SHIFT 16 + +enum rockchip_usb2phy_port_id { + USB2PHY_PORT_OTG, + USB2PHY_PORT_HOST, + USB2PHY_NUM_PORTS, +}; + +struct usb2phy_reg { + unsigned int offset; + unsigned int bitend; + unsigned int bitstart; + unsigned int disable; + unsigned int enable; +}; + +struct rockchip_usb2phy_port_cfg { + struct usb2phy_reg phy_sus; + struct usb2phy_reg bvalid_det_en; + struct usb2phy_reg bvalid_det_st; + struct usb2phy_reg bvalid_det_clr; + struct usb2phy_reg ls_det_en; + struct usb2phy_reg ls_det_st; + struct usb2phy_reg ls_det_clr; + struct usb2phy_reg utmi_avalid; + struct usb2phy_reg utmi_bvalid; + struct usb2phy_reg utmi_ls; + struct usb2phy_reg utmi_hstdet; +}; + +struct rockchip_usb2phy_cfg { + unsigned int reg; + const struct rockchip_usb2phy_port_cfg port_cfgs[USB2PHY_NUM_PORTS]; +}; + +struct rockchip_usb2phy { + void *reg_base; + struct clk phyclk; + const struct rockchip_usb2phy_cfg *phy_cfg; +}; + +static inline int property_enable(void *reg_base, + const struct usb2phy_reg *reg, bool en) +{ + unsigned int val, mask, tmp; + + tmp = en ? reg->enable : reg->disable; + mask = GENMASK(reg->bitend, reg->bitstart); + val = (tmp << reg->bitstart) | (mask << BIT_WRITEABLE_SHIFT); + + return writel(val, reg_base + reg->offset); +} + +static const +struct rockchip_usb2phy_port_cfg *us2phy_get_port(struct phy *phy) +{ + struct udevice *parent = dev_get_parent(phy->dev); + struct rockchip_usb2phy *priv = dev_get_priv(parent); + const struct rockchip_usb2phy_cfg *phy_cfg = priv->phy_cfg; + + return &phy_cfg->port_cfgs[phy->id]; +} + +static int rockchip_usb2phy_power_on(struct phy *phy) +{ + struct udevice *parent = dev_get_parent(phy->dev); + struct rockchip_usb2phy *priv = dev_get_priv(parent); + const struct rockchip_usb2phy_port_cfg *port_cfg = us2phy_get_port(phy); + + property_enable(priv->reg_base, &port_cfg->phy_sus, false); + + /* waiting for the utmi_clk to become stable */ + usleep_range(1500, 2000); + + return 0; +} + +static int rockchip_usb2phy_power_off(struct phy *phy) +{ + struct udevice *parent = dev_get_parent(phy->dev); + struct rockchip_usb2phy *priv = dev_get_priv(parent); + const struct rockchip_usb2phy_port_cfg *port_cfg = us2phy_get_port(phy); + + property_enable(priv->reg_base, &port_cfg->phy_sus, true); + + return 0; +} + +static int rockchip_usb2phy_init(struct phy *phy) +{ + struct udevice *parent = dev_get_parent(phy->dev); + struct rockchip_usb2phy *priv = dev_get_priv(parent); + const struct rockchip_usb2phy_port_cfg *port_cfg = us2phy_get_port(phy); + int ret; + + ret = clk_enable(&priv->phyclk); + if (ret) { + dev_err(phy->dev, "failed to enable phyclk (ret=%d)\n", ret); + return ret; + } + + if (phy->id == USB2PHY_PORT_OTG) { + property_enable(priv->reg_base, &port_cfg->bvalid_det_clr, true); + property_enable(priv->reg_base, &port_cfg->bvalid_det_en, true); + } else if (phy->id == USB2PHY_PORT_HOST) { + property_enable(priv->reg_base, &port_cfg->bvalid_det_clr, true); + property_enable(priv->reg_base, &port_cfg->bvalid_det_en, true); + } + + return 0; +} + +static int rockchip_usb2phy_exit(struct phy *phy) +{ + struct udevice *parent = dev_get_parent(phy->dev); + struct rockchip_usb2phy *priv = dev_get_priv(parent); + + clk_disable(&priv->phyclk); + + return 0; +} + +static int rockchip_usb2phy_of_xlate(struct phy *phy, + struct ofnode_phandle_args *args) +{ + const char *name = phy->dev->name; + + if (!strcasecmp(name, "host-port")) + phy->id = USB2PHY_PORT_HOST; + else if (!strcasecmp(name, "otg-port")) + phy->id = USB2PHY_PORT_OTG; + else + dev_err(phy->dev, "improper %s device\n", name); + + return 0; +} + +static struct phy_ops rockchip_usb2phy_ops = { + .init = rockchip_usb2phy_init, + .exit = rockchip_usb2phy_exit, + .power_on = rockchip_usb2phy_power_on, + .power_off = rockchip_usb2phy_power_off, + .of_xlate = rockchip_usb2phy_of_xlate, +}; + +static int rockchip_usb2phy_probe(struct udevice *dev) +{ + struct rockchip_usb2phy *priv = dev_get_priv(dev); + const struct rockchip_usb2phy_cfg *phy_cfgs; + unsigned int reg; + int index, ret; + + priv->reg_base = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); + if (IS_ERR(priv->reg_base)) + return PTR_ERR(priv->reg_base); + + ret = dev_read_u32_index(dev, "reg", 1, ®); + if (ret) { + dev_err(dev, "failed to read reg property (ret = %d)\n", ret); + return ret; + } + + phy_cfgs = (const struct rockchip_usb2phy_cfg *) + dev_get_driver_data(dev); + if (!phy_cfgs) + return -EINVAL; + + /* find out a proper config which can be matched with dt. */ + index = 0; + while (phy_cfgs[index].reg) { + if (phy_cfgs[index].reg == reg) { + priv->phy_cfg = &phy_cfgs[index]; + break; + } + + ++index; + } + + if (!priv->phy_cfg) { + dev_err(dev, "failed find proper phy-cfg\n"); + return -EINVAL; + } + + ret = clk_get_by_name(dev, "phyclk", &priv->phyclk); + if (ret) { + dev_err(dev, "failed to get the phyclk (ret=%d)\n", ret); + return ret; + } + + return 0; +} + +static int rockchip_usb2phy_bind(struct udevice *dev) +{ + struct udevice *usb2phy_dev; + ofnode node; + const char *name; + int ret = 0; + + dev_for_each_subnode(node, dev) { + if (!ofnode_valid(node)) { + dev_info(dev, "subnode %s not found\n", dev->name); + return -ENXIO; + } + + name = ofnode_get_name(node); + dev_dbg(dev, "subnode %s\n", name); + + ret = device_bind_driver_to_node(dev, "rockchip_usb2phy_port", + name, node, &usb2phy_dev); + if (ret) { + dev_err(dev, + "'%s' cannot bind 'rockchip_usb2phy_port'\n", name); + return ret; + } + } + + return ret; +} + +static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = { + { + .reg = 0xe450, + .port_cfgs = { + [USB2PHY_PORT_OTG] = { + .phy_sus = { 0xe454, 1, 0, 2, 1 }, + .bvalid_det_en = { 0xe3c0, 3, 3, 0, 1 }, + .bvalid_det_st = { 0xe3e0, 3, 3, 0, 1 }, + .bvalid_det_clr = { 0xe3d0, 3, 3, 0, 1 }, + .utmi_avalid = { 0xe2ac, 7, 7, 0, 1 }, + .utmi_bvalid = { 0xe2ac, 12, 12, 0, 1 }, + }, + [USB2PHY_PORT_HOST] = { + .phy_sus = { 0xe458, 1, 0, 0x2, 0x1 }, + .ls_det_en = { 0xe3c0, 6, 6, 0, 1 }, + .ls_det_st = { 0xe3e0, 6, 6, 0, 1 }, + .ls_det_clr = { 0xe3d0, 6, 6, 0, 1 }, + .utmi_ls = { 0xe2ac, 22, 21, 0, 1 }, + .utmi_hstdet = { 0xe2ac, 23, 23, 0, 1 } + } + }, + }, + { + .reg = 0xe460, + .port_cfgs = { + [USB2PHY_PORT_OTG] = { + .phy_sus = { 0xe464, 1, 0, 2, 1 }, + .bvalid_det_en = { 0xe3c0, 8, 8, 0, 1 }, + .bvalid_det_st = { 0xe3e0, 8, 8, 0, 1 }, + .bvalid_det_clr = { 0xe3d0, 8, 8, 0, 1 }, + .utmi_avalid = { 0xe2ac, 10, 10, 0, 1 }, + .utmi_bvalid = { 0xe2ac, 16, 16, 0, 1 }, + }, + [USB2PHY_PORT_HOST] = { + .phy_sus = { 0xe468, 1, 0, 0x2, 0x1 }, + .ls_det_en = { 0xe3c0, 11, 11, 0, 1 }, + .ls_det_st = { 0xe3e0, 11, 11, 0, 1 }, + .ls_det_clr = { 0xe3d0, 11, 11, 0, 1 }, + .utmi_ls = { 0xe2ac, 26, 25, 0, 1 }, + .utmi_hstdet = { 0xe2ac, 27, 27, 0, 1 } + } + }, + }, + { /* sentinel */ } +}; + +static const struct udevice_id rockchip_usb2phy_ids[] = { + { + .compatible = "rockchip,rk3399-usb2phy", + .data = (ulong)&rk3399_usb2phy_cfgs, + }, + { /* sentinel */ } +}; + +U_BOOT_DRIVER(rockchip_usb2phy_port) = { + .name = "rockchip_usb2phy_port", + .id = UCLASS_PHY, + .ops = &rockchip_usb2phy_ops, +}; + +U_BOOT_DRIVER(rockchip_usb2phy) = { + .name = "rockchip_usb2phy", + .id = UCLASS_PHY, + .of_match = rockchip_usb2phy_ids, + .probe = rockchip_usb2phy_probe, + .bind = rockchip_usb2phy_bind, + .priv_auto_alloc_size = sizeof(struct rockchip_usb2phy), +}; From patchwork Mon May 11 07:55:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1170 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C27443F08B for ; Mon, 11 May 2020 09:55:27 +0200 (CEST) Received: by mail-pg1-f199.google.com with SMTP id u7sf7142899pga.8 for ; Mon, 11 May 2020 00:55:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183726; cv=pass; d=google.com; s=arc-20160816; b=rnb3N0k0bAfzx3GA1XzWmrTudvkqY+uqdLPOAEV60c4TOg1sn2CsTOCDfSAVAThBev UTRbnvHfLE5onE9dvaPvWMyRH/hsPsz29vVaLE9dTSMmPNuByTxGKGygDHy/1n/E8dgO wfb5E67r4f4Z8DZ5X6Ij+VVZBkjSnRUTq+lP4gvJTW91awOSPq15V3kvDFrJrlrhgtOT SuWsbW4teFuPQVvTvsrEFAzYQdXkbT30xu2L/vosAvACVCEmf1d+V+CRt7zX6BsCgRPr lei2wztRHQuRZ3CidfnH38nO2hC/Za7y1FRr3UU2ZaKqRBuaDUU7MH3bY9hCpHASrClF hISQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=1Sf+0V4O4MWtPsZxr+dUo/vsjQJ+k3pRyNNpFXj2ie0=; b=VvslAMgQMpMZ91KQlQQgwBRp4kflmqMWogpSr9OKgouegi4Z9aZuDs2TZgROsvJhl9 onP5QflO2j8hGhiidM+VUc2OE7XkuyWxuN6GaEsh76so2elqCPwiIZSuDgYG3PYeIOL/ IMD1VEPZ7vGnqdwOww9AEwD7cs576vPK6gHeEd+126W24422T6ajVaQqhErlUwHvNhlG hPyjmSWLG8GBfd+8Oqjvk77PUsla966jxkQmVys22uUybVtKb1aRQOlsIMgrC3UZo4ya ZeHvZB1m4btHlYr4GymViRdWSSx7RpdH1SXEkhH/Z++u/Uk67/o1qUqCgD01VPUr+pLj 83uw== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.134 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=1Sf+0V4O4MWtPsZxr+dUo/vsjQJ+k3pRyNNpFXj2ie0=; b=asFpGXOk/8kd6hKt6RlIb7lxZcwfuSf0Z9oXiWXV8bhU57PmCxoHIu+YPA3sHJQh4J cndCgEh90sNIs1b/CAqv4fZhjAMqPPwO42L1ODOTAi4q0XoaHNsZ1W/M9lajxWHIOoDr YXCfzVhIFXGTcqGY6L0ltYborltDwExJ3wdh0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=1Sf+0V4O4MWtPsZxr+dUo/vsjQJ+k3pRyNNpFXj2ie0=; b=eA58bgKQMHo4uX1FO8rHKwyjhzF0/OJ792YZJckOCs69o3reVZ2txsigTDbnfP0rcJ wfxMuSJAYwKFeQWnP3ZkNFm7SCpJAzNUS5F/3qUdb19DKGPBd1JGS7LrZz7kV0IUaJRf j8rWDY907rbqa8Z1PnTTFGqTZIcqE1fuom+6uZsSz609sKhv1QZ1xxJnzJu2SUlvrEd8 xWmuQmse1dd3OzprlTwYzsL1PcPN2nv7d3FdrwyaQHfDab0TfOsYlR0awSzapnNzn34m Ccfjf+71UuOXDChDMBhpwwzf842UZz5DFDQKyqoi3xl5lc5Kq94XHqo04Y1+fvvF/+GC x1Tg== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuaIIrnHTgBzpmp/Q35t+I522fAkTdFzEq7xiB+l1ZVFNv6c0/kX BELYcHxvhDgNrEAkbXUTrJPGIHKJ X-Google-Smtp-Source: APiQypLfEEwqMOEYfZnYwwCfmJmSQkrVITXKZ7JYPrMzsSY2K19uCgQzZYnSE2Puj9P0qWm8eVZ7ww== X-Received: by 2002:a17:90a:498a:: with SMTP id d10mr21952559pjh.194.1589183726409; Mon, 11 May 2020 00:55:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a62:8f0a:: with SMTP id n10ls4395172pfd.3.gmail; Mon, 11 May 2020 00:55:25 -0700 (PDT) X-Received: by 2002:a63:1a01:: with SMTP id a1mr12648957pga.87.1589183725622; Mon, 11 May 2020 00:55:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183725; cv=none; d=google.com; s=arc-20160816; b=QIiDw5RJc8lsxsTBHRy89E4YS6zn/Gp9jHqcYtcuIz6aFyR4IFLHXDy2/ZyUEOECRQ y03tqD0QkMDXtFW3nLoCJJZoSvd7SsvmsiWxmWjrlupX1UmKCsvsqLgeI1OnALaKGzBr 0H9yL3jLQG1IiAHg35wLBbOPEfBe+Uxla5ExRB5XRB//wZjdXi/2Ta1XunwdEMeAZv8i vHZBGygLwdiQ4g70CUYhDk+JgVZaGcFrOHBfNnBD8VWV+y7IrvQtJuFO0q7/ZhU9Hhf9 k8NiwdTcV9sl0FN7W06UwyT8uxw4kdD62G3MMWoakGDBP4tescx9j5fGrRtSa6A4RlFP UDrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=tjK0StnLtK2TeBCvS4Tad3vTTTqcjYgSdpe4Rr6ECDE=; b=gXNA0e09Jw+eFUlAoRIsfjMfvz477LedP6eDjwnuXhPff+xQiPFsZ6dN8Z5YRpoyBA MMEESktdgXkfZqGKcxnHzML2qXzzwWlLrOZZ26m62oY9B1eI+sModbRFSU5hvoWA7IQF O+0mmnJLHNFZmgHQ2Mi14oBBh9saAZIpS5IHCDjOPEsSeQhNubDg2wP5Cnl1qrWJBr+2 rwI/PyXzIVcDab88x787Os3VGI32x8pkSxM61ZQSVHJK4B9oz+ZPVuQCjkvYLrXurEfc cFHyqQoX/T/+M/BqsMjo2bqKvdsuT2u5noqCUpku//DxbwSueaUFN9W4KCO2xWpEKVul uAWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.134 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.134]) by mx.google.com with ESMTPS id m2si6769399pgq.478.2020.05.11.00.55.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:55:25 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.134 as permitted sender) client-ip=211.157.147.134; Received: from localhost (unknown [192.168.167.8]) by lucky1.263xmail.com (Postfix) with ESMTP id 83584A4D90; Mon, 11 May 2020 15:55:23 +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 P2949T140479804974848S1589183722650576_; Mon, 11 May 2020 15:55:24 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com Subject: [PATCH v4 05/16] arm64: dts: rk3399: Move u2phy into root port Date: Mon, 11 May 2020 15:55:09 +0800 Message-Id: <20200511075520.26557-1-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075330.26462-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.134 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Jagan Teki Yes, This is changing the actual device tree u2phy structure but the problem with the current Generic PHY subsystem is unable to find PHY if the PHY node is not part of the root structure. This will be reverted, - Once we support the PHY subsystem to get the PHY even though it is not part of the root node or - any other relevant solution that get the phy directly without traversing all nodes. Signed-off-by: Jagan Teki --- arch/arm/dts/rk3399.dtsi | 108 +++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/arch/arm/dts/rk3399.dtsi b/arch/arm/dts/rk3399.dtsi index 74f2c3d490..6c77f25f23 100644 --- a/arch/arm/dts/rk3399.dtsi +++ b/arch/arm/dts/rk3399.dtsi @@ -1387,60 +1387,6 @@ status = "disabled"; }; - u2phy0: usb2-phy@e450 { - compatible = "rockchip,rk3399-usb2phy"; - reg = <0xe450 0x10>; - clocks = <&cru SCLK_USB2PHY0_REF>; - clock-names = "phyclk"; - #clock-cells = <0>; - clock-output-names = "clk_usbphy0_480m"; - status = "disabled"; - - u2phy0_host: host-port { - #phy-cells = <0>; - interrupts = ; - interrupt-names = "linestate"; - status = "disabled"; - }; - - u2phy0_otg: otg-port { - #phy-cells = <0>; - interrupts = , - , - ; - interrupt-names = "otg-bvalid", "otg-id", - "linestate"; - status = "disabled"; - }; - }; - - u2phy1: usb2-phy@e460 { - compatible = "rockchip,rk3399-usb2phy"; - reg = <0xe460 0x10>; - clocks = <&cru SCLK_USB2PHY1_REF>; - clock-names = "phyclk"; - #clock-cells = <0>; - clock-output-names = "clk_usbphy1_480m"; - status = "disabled"; - - u2phy1_host: host-port { - #phy-cells = <0>; - interrupts = ; - interrupt-names = "linestate"; - status = "disabled"; - }; - - u2phy1_otg: otg-port { - #phy-cells = <0>; - interrupts = , - , - ; - interrupt-names = "otg-bvalid", "otg-id", - "linestate"; - status = "disabled"; - }; - }; - emmc_phy: phy@f780 { compatible = "rockchip,rk3399-emmc-phy"; reg = <0xf780 0x24>; @@ -1462,6 +1408,60 @@ }; }; + u2phy0: usb2-phy@e450 { + compatible = "rockchip,rk3399-usb2phy"; + reg = <0x0 0xe450 0x0 0x10>; + clocks = <&cru SCLK_USB2PHY0_REF>; + clock-names = "phyclk"; + #clock-cells = <0>; + clock-output-names = "clk_usbphy0_480m"; + status = "disabled"; + + u2phy0_host: host-port { + #phy-cells = <0>; + interrupts = ; + interrupt-names = "linestate"; + status = "disabled"; + }; + + u2phy0_otg: otg-port { + #phy-cells = <0>; + interrupts = , + , + ; + interrupt-names = "otg-bvalid", "otg-id", + "linestate"; + status = "disabled"; + }; + }; + + u2phy1: usb2-phy@e460 { + compatible = "rockchip,rk3399-usb2phy"; + reg = <0x0 0xe460 0x0 0x10>; + clocks = <&cru SCLK_USB2PHY1_REF>; + clock-names = "phyclk"; + #clock-cells = <0>; + clock-output-names = "clk_usbphy1_480m"; + status = "disabled"; + + u2phy1_host: host-port { + #phy-cells = <0>; + interrupts = ; + interrupt-names = "linestate"; + status = "disabled"; + }; + + u2phy1_otg: otg-port { + #phy-cells = <0>; + interrupts = , + , + ; + interrupt-names = "otg-bvalid", "otg-id", + "linestate"; + status = "disabled"; + }; + }; + tcphy0: phy@ff7c0000 { compatible = "rockchip,rk3399-typec-phy"; reg = <0x0 0xff7c0000 0x0 0x40000>; From patchwork Mon May 11 07:55:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1172 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 311313F9E5 for ; Mon, 11 May 2020 09:55:29 +0200 (CEST) Received: by mail-pf1-f199.google.com with SMTP id v21sf8133925pfn.18 for ; Mon, 11 May 2020 00:55:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183728; cv=pass; d=google.com; s=arc-20160816; b=YWvAeNSEmap1YT6+8sKyh+LkKd09VHkf/MB0adfSwTRGnqsys+AMWElCvB3o/HA3fl 4dOPEn1tYyHwqO85Lq9I5DYcxjtbBDSsIZn18JZ5Daqc6AYYQxqAuGtx/ad9sD2MDtID GlTNFpfRJ7VhSd8mZy+SnOtzPNA9XBR4DblJVcmNAGL3bshtXBsOwZ4eyKDWWpN6NWEv 4HtQmfZ6s3+tgEvGJ/pLOnjczZRPWqCcDN+xLwAn98lIn5GFPnHHhyRAemK3/5JHBlEj Q53Dn0D9ejbg6fymGNjzGg/tv0TOx/YgnMvX/sMAeJBLjFBfybvsh6GopKE901TBSbdX BDLA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=TMZCbySaCSRGmAecWHTQ9ahIO77I1AFv+I9ynaQJfdg=; b=xn/xo2K0uOzGMrGFX+3ukjQkw04etRTvI15sJeNRjibdSfYjGimzWuglde0sDYDGOW j8TzyOeV5TCha3wzBycyQzeNXE9M/mCb32EVNEQyfAs0S0M+IFC/WU7iR6HhY9ZV8Axr oGIanDC7JBSA83Lidb0GSAoFWC5ne569VsPkkFfp2aXC7BdbP9x9vYKvhPn+B2czuR03 LAJybStI5noc61XP5OCYtvlRwun4suWTy4JojeiJFZpmtaaixZE01gC9py7OZqk4rl82 Pid725wZUfUji3YiBr4VTCkhGv08QKm7mjbIxwn3qb46dzXyueOwCQWCbe18J+BF/n2w HvzQ== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.135 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=TMZCbySaCSRGmAecWHTQ9ahIO77I1AFv+I9ynaQJfdg=; b=oCpcTcH3pG60NKjN9l7yIkQy+HcP2O82h4p1nCe47N/kAAOYUJgk6hIIBNrxRtswNv eZlSfxM/5BVCFgmkD03LELYbcQExW1J2bsjyotN5NF9tz7yKigltm2rZ9JyUwVyzJSQb Unv1RQKNZCR5gSTaI9YWzYXxUo5ewXLJoUBHw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=TMZCbySaCSRGmAecWHTQ9ahIO77I1AFv+I9ynaQJfdg=; b=P9S3GA91MRcw5IQ0YaRw+U5LfZ4buY8u/PWyb6FIGTlMT0hh9BVMef1TKtddEj5jFd iMfSvq3mP71xFKFUEV7W+g4lxi7kbSWKqPHyWQRMifKCQVTqFEYqhPVLTX20TT6VDfPY R0JR1wz3v3NFWHj0x1OnRJD/1Eg8oqkFyThzAaNAeDSTV1h+BGAUv6k7gGidB+qmS1PZ /vrvxidOs1pkvKB07zcH+2RdZR9DiS28KcgYwKC0t1TRA1VMYlG044XAOZrAp0E5lkwx 1oj07oPYc1YBaQy/DKDCjvUCJzS7wUE8lhpYcmQcYGLSGUtJXRtot4+tQyFGIhUtQJYW hmLQ== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuZfzTb86sOPXXOkI9r6KaWaSHCB13+9STvmtS+0c/YCn4bGt1Z4 G0dYs3+cYQ/sLIcupHkIiXdjmawf X-Google-Smtp-Source: APiQypKo+JL8M0ztVec2/AXuqx+M8T/UfFKNZR6bc0TfC/jDJDc4EwEfa28YmeXaiuIJtJqYRqRrfQ== X-Received: by 2002:a63:b0e:: with SMTP id 14mr12725955pgl.404.1589183727864; Mon, 11 May 2020 00:55:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:2944:: with SMTP id p65ls136909pgp.2.gmail; Mon, 11 May 2020 00:55:27 -0700 (PDT) X-Received: by 2002:aa7:9dca:: with SMTP id g10mr15619934pfq.320.1589183727329; Mon, 11 May 2020 00:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183727; cv=none; d=google.com; s=arc-20160816; b=N7FgeXbEB8u7A3V9Q9nc6CWf0EInJYCJjldtX8PROjjSZwRcBAhm3T/dIuiLrOxVPb FZEkbb1F/eb4Xi310PHuVVoHbAb9M8QnD4WxuswIvIM24543cI+4QJ9T+ohwat/217k2 UKRzf1Yyp2WwpnnNmMS5jQnRPL7KTi66DcdfzxIDRxqMCM3LOAHNBiLgLeiT08IVTMqY zkak5LNHvhNt/FnvlEizhHBUW0C2G/FsZ/kyMMnJXYrWkERSXi8RJp+em5p5kdHfj7ok t22eeV+s5kyj+83PDPnNjtWFUny9pxUUFy5nqAdo1RQ4u3MgoZWHijqS7JUS5SMEo4+p FqOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=ZJP0vWA/4hcfTS7bok3ytFkrxs4tkWXFF8jBEx4cKiY=; b=w6TpWsRevfnBGYH49NXGEBzj+8+5hd6PUo/phPfqkDKMt/+wQUnrS+dDB2d6xyt8+f O2BbhR2d8I74PfDNxp67eA460jrGnui1YSs7N70TyRvjTpLgu910rREUy5CdjDyXVmxn 8Jkg3B6CaGmNCDRmi1EyG0YBI854uEb3V88ZRc9Zy4eOLnOvigmiqPS/FuVEa3ziiSJX FAd4mc3AE8yu9U71dWkmINPIupDlb0S+6/pH8tgOOlnFeWXSJcALyoFvu2wP9PZvs1UL JxE5eXr85Ws3LIsT6utCjtbuf1uaD6DbCJXVME9xO9828Z0KPiaVfV6EnM8debfkF1cf aaNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.135 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.135]) by mx.google.com with ESMTPS id n20si2124336pgc.159.2020.05.11.00.55.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:55:27 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.135 as permitted sender) client-ip=211.157.147.135; Received: from localhost (unknown [192.168.167.8]) by lucky1.263xmail.com (Postfix) with ESMTP id 4109A82606; Mon, 11 May 2020 15:55:25 +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 P2949T140479804974848S1589183722650576_; Mon, 11 May 2020 15:55:25 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <862dd4eaf951facc91b7b2e8ebbf535b> X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com, Frank Wang Subject: [PATCH v4 06/16] phy: rockchip: Add Rockchip USB TypeC PHY driver Date: Mon, 11 May 2020 15:55:10 +0800 Message-Id: <20200511075520.26557-2-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075520.26557-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> <20200511075520.26557-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.135 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Jagan Teki Add USB TYPEC PHY driver for rockchip platform. Referenced from Linux TypeC PHY driver, currently supporting usb3-port and dp-port need to add it in the future. Signed-off-by: Frank Wang Signed-off-by: Jagan Teki --- drivers/phy/rockchip/Kconfig | 7 + drivers/phy/rockchip/Makefile | 1 + drivers/phy/rockchip/phy-rockchip-typec.c | 796 ++++++++++++++++++++++ 3 files changed, 804 insertions(+) create mode 100644 drivers/phy/rockchip/phy-rockchip-typec.c diff --git a/drivers/phy/rockchip/Kconfig b/drivers/phy/rockchip/Kconfig index d73ac695e1..84cc7c876d 100644 --- a/drivers/phy/rockchip/Kconfig +++ b/drivers/phy/rockchip/Kconfig @@ -11,4 +11,11 @@ config PHY_ROCKCHIP_INNO_USB2 help Support for Rockchip USB2.0 PHY with Innosilicon IP block. +config PHY_ROCKCHIP_TYPEC + bool "Rockchip TYPEC PHY Driver" + depends on ARCH_ROCKCHIP + select PHY + help + Enable this to support the Rockchip USB TYPEC PHY. + endmenu diff --git a/drivers/phy/rockchip/Makefile b/drivers/phy/rockchip/Makefile index 9b0cbc6acf..95b2f8a3c0 100644 --- a/drivers/phy/rockchip/Makefile +++ b/drivers/phy/rockchip/Makefile @@ -4,3 +4,4 @@ # obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2) += phy-rockchip-inno-usb2.o +obj-$(CONFIG_PHY_ROCKCHIP_TYPEC) += phy-rockchip-typec.o diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c new file mode 100644 index 0000000000..c9c8e1c542 --- /dev/null +++ b/drivers/phy/rockchip/phy-rockchip-typec.c @@ -0,0 +1,796 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * ROCKCHIP Type-C PHY driver. + * + * Copyright (C) 2020 Amarula Solutions(India) + * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd + * Author: Chris Zhong + * Kever Yang + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +#define usleep_range(a, b) udelay((b)) + +#define CMN_SSM_BANDGAP (0x21 << 2) +#define CMN_SSM_BIAS (0x22 << 2) +#define CMN_PLLSM0_PLLEN (0x29 << 2) +#define CMN_PLLSM0_PLLPRE (0x2a << 2) +#define CMN_PLLSM0_PLLVREF (0x2b << 2) +#define CMN_PLLSM0_PLLLOCK (0x2c << 2) +#define CMN_PLLSM1_PLLEN (0x31 << 2) +#define CMN_PLLSM1_PLLPRE (0x32 << 2) +#define CMN_PLLSM1_PLLVREF (0x33 << 2) +#define CMN_PLLSM1_PLLLOCK (0x34 << 2) +#define CMN_PLLSM1_USER_DEF_CTRL (0x37 << 2) +#define CMN_ICAL_OVRD (0xc1 << 2) +#define CMN_PLL0_VCOCAL_OVRD (0x83 << 2) +#define CMN_PLL0_VCOCAL_INIT (0x84 << 2) +#define CMN_PLL0_VCOCAL_ITER (0x85 << 2) +#define CMN_PLL0_LOCK_REFCNT_START (0x90 << 2) +#define CMN_PLL0_LOCK_PLLCNT_START (0x92 << 2) +#define CMN_PLL0_LOCK_PLLCNT_THR (0x93 << 2) +#define CMN_PLL0_INTDIV (0x94 << 2) +#define CMN_PLL0_FRACDIV (0x95 << 2) +#define CMN_PLL0_HIGH_THR (0x96 << 2) +#define CMN_PLL0_DSM_DIAG (0x97 << 2) +#define CMN_PLL0_SS_CTRL1 (0x98 << 2) +#define CMN_PLL0_SS_CTRL2 (0x99 << 2) +#define CMN_PLL1_VCOCAL_START (0xa1 << 2) +#define CMN_PLL1_VCOCAL_OVRD (0xa3 << 2) +#define CMN_PLL1_VCOCAL_INIT (0xa4 << 2) +#define CMN_PLL1_VCOCAL_ITER (0xa5 << 2) +#define CMN_PLL1_LOCK_REFCNT_START (0xb0 << 2) +#define CMN_PLL1_LOCK_PLLCNT_START (0xb2 << 2) +#define CMN_PLL1_LOCK_PLLCNT_THR (0xb3 << 2) +#define CMN_PLL1_INTDIV (0xb4 << 2) +#define CMN_PLL1_FRACDIV (0xb5 << 2) +#define CMN_PLL1_HIGH_THR (0xb6 << 2) +#define CMN_PLL1_DSM_DIAG (0xb7 << 2) +#define CMN_PLL1_SS_CTRL1 (0xb8 << 2) +#define CMN_PLL1_SS_CTRL2 (0xb9 << 2) +#define CMN_RXCAL_OVRD (0xd1 << 2) + +#define CMN_TXPUCAL_CTRL (0xe0 << 2) +#define CMN_TXPUCAL_OVRD (0xe1 << 2) +#define CMN_TXPDCAL_CTRL (0xf0 << 2) +#define CMN_TXPDCAL_OVRD (0xf1 << 2) + +/* For CMN_TXPUCAL_CTRL, CMN_TXPDCAL_CTRL */ +#define CMN_TXPXCAL_START BIT(15) +#define CMN_TXPXCAL_DONE BIT(14) +#define CMN_TXPXCAL_NO_RESPONSE BIT(13) +#define CMN_TXPXCAL_CURRENT_RESPONSE BIT(12) + +#define CMN_TXPU_ADJ_CTRL (0x108 << 2) +#define CMN_TXPD_ADJ_CTRL (0x10c << 2) + +/* + * For CMN_TXPUCAL_CTRL, CMN_TXPDCAL_CTRL, + * CMN_TXPU_ADJ_CTRL, CMN_TXPDCAL_CTRL + * + * NOTE: some of these registers are documented to be 2's complement + * signed numbers, but then documented to be always positive. Weird. + * In such a case, using CMN_CALIB_CODE_POS() avoids the unnecessary + * sign extension. + */ +#define CMN_CALIB_CODE_WIDTH 7 +#define CMN_CALIB_CODE_OFFSET 0 +#define CMN_CALIB_CODE_MASK GENMASK(CMN_CALIB_CODE_WIDTH, 0) +#define CMN_CALIB_CODE(x) \ + sign_extend32((x) >> CMN_CALIB_CODE_OFFSET, CMN_CALIB_CODE_WIDTH) + +#define CMN_CALIB_CODE_POS_MASK GENMASK(CMN_CALIB_CODE_WIDTH - 1, 0) +#define CMN_CALIB_CODE_POS(x) \ + (((x) >> CMN_CALIB_CODE_OFFSET) & CMN_CALIB_CODE_POS_MASK) + +#define CMN_DIAG_PLL0_FBH_OVRD (0x1c0 << 2) +#define CMN_DIAG_PLL0_FBL_OVRD (0x1c1 << 2) +#define CMN_DIAG_PLL0_OVRD (0x1c2 << 2) +#define CMN_DIAG_PLL0_V2I_TUNE (0x1c5 << 2) +#define CMN_DIAG_PLL0_CP_TUNE (0x1c6 << 2) +#define CMN_DIAG_PLL0_LF_PROG (0x1c7 << 2) +#define CMN_DIAG_PLL1_FBH_OVRD (0x1d0 << 2) +#define CMN_DIAG_PLL1_FBL_OVRD (0x1d1 << 2) +#define CMN_DIAG_PLL1_OVRD (0x1d2 << 2) +#define CMN_DIAG_PLL1_V2I_TUNE (0x1d5 << 2) +#define CMN_DIAG_PLL1_CP_TUNE (0x1d6 << 2) +#define CMN_DIAG_PLL1_LF_PROG (0x1d7 << 2) +#define CMN_DIAG_PLL1_PTATIS_TUNE1 (0x1d8 << 2) +#define CMN_DIAG_PLL1_PTATIS_TUNE2 (0x1d9 << 2) +#define CMN_DIAG_PLL1_INCLK_CTRL (0x1da << 2) +#define CMN_DIAG_HSCLK_SEL (0x1e0 << 2) + +#define XCVR_PSM_RCTRL(n) ((0x4001 | ((n) << 9)) << 2) +#define XCVR_PSM_CAL_TMR(n) ((0x4002 | ((n) << 9)) << 2) +#define XCVR_PSM_A0IN_TMR(n) ((0x4003 | ((n) << 9)) << 2) +#define TX_TXCC_CAL_SCLR_MULT(n) ((0x4047 | ((n) << 9)) << 2) +#define TX_TXCC_CPOST_MULT_00(n) ((0x404c | ((n) << 9)) << 2) +#define TX_TXCC_CPOST_MULT_01(n) ((0x404d | ((n) << 9)) << 2) +#define TX_TXCC_CPOST_MULT_10(n) ((0x404e | ((n) << 9)) << 2) +#define TX_TXCC_CPOST_MULT_11(n) ((0x404f | ((n) << 9)) << 2) +#define TX_TXCC_MGNFS_MULT_000(n) ((0x4050 | ((n) << 9)) << 2) +#define TX_TXCC_MGNFS_MULT_001(n) ((0x4051 | ((n) << 9)) << 2) +#define TX_TXCC_MGNFS_MULT_010(n) ((0x4052 | ((n) << 9)) << 2) +#define TX_TXCC_MGNFS_MULT_011(n) ((0x4053 | ((n) << 9)) << 2) +#define TX_TXCC_MGNFS_MULT_100(n) ((0x4054 | ((n) << 9)) << 2) +#define TX_TXCC_MGNFS_MULT_101(n) ((0x4055 | ((n) << 9)) << 2) +#define TX_TXCC_MGNFS_MULT_110(n) ((0x4056 | ((n) << 9)) << 2) +#define TX_TXCC_MGNFS_MULT_111(n) ((0x4057 | ((n) << 9)) << 2) +#define TX_TXCC_MGNLS_MULT_000(n) ((0x4058 | ((n) << 9)) << 2) +#define TX_TXCC_MGNLS_MULT_001(n) ((0x4059 | ((n) << 9)) << 2) +#define TX_TXCC_MGNLS_MULT_010(n) ((0x405a | ((n) << 9)) << 2) +#define TX_TXCC_MGNLS_MULT_011(n) ((0x405b | ((n) << 9)) << 2) +#define TX_TXCC_MGNLS_MULT_100(n) ((0x405c | ((n) << 9)) << 2) +#define TX_TXCC_MGNLS_MULT_101(n) ((0x405d | ((n) << 9)) << 2) +#define TX_TXCC_MGNLS_MULT_110(n) ((0x405e | ((n) << 9)) << 2) +#define TX_TXCC_MGNLS_MULT_111(n) ((0x405f | ((n) << 9)) << 2) + +#define XCVR_DIAG_PLLDRC_CTRL(n) ((0x40e0 | ((n) << 9)) << 2) +#define XCVR_DIAG_BIDI_CTRL(n) ((0x40e8 | ((n) << 9)) << 2) +#define XCVR_DIAG_LANE_FCM_EN_MGN(n) ((0x40f2 | ((n) << 9)) << 2) +#define TX_PSC_A0(n) ((0x4100 | ((n) << 9)) << 2) +#define TX_PSC_A1(n) ((0x4101 | ((n) << 9)) << 2) +#define TX_PSC_A2(n) ((0x4102 | ((n) << 9)) << 2) +#define TX_PSC_A3(n) ((0x4103 | ((n) << 9)) << 2) +#define TX_RCVDET_CTRL(n) ((0x4120 | ((n) << 9)) << 2) +#define TX_RCVDET_EN_TMR(n) ((0x4122 | ((n) << 9)) << 2) +#define TX_RCVDET_ST_TMR(n) ((0x4123 | ((n) << 9)) << 2) +#define TX_DIAG_TX_DRV(n) ((0x41e1 | ((n) << 9)) << 2) +#define TX_DIAG_BGREF_PREDRV_DELAY (0x41e7 << 2) + +/* Use this for "n" in macros like "_MULT_XXX" to target the aux channel */ +#define AUX_CH_LANE 8 + +#define TX_ANA_CTRL_REG_1 (0x5020 << 2) + +#define TXDA_DP_AUX_EN BIT(15) +#define AUXDA_SE_EN BIT(14) +#define TXDA_CAL_LATCH_EN BIT(13) +#define AUXDA_POLARITY BIT(12) +#define TXDA_DRV_POWER_ISOLATION_EN BIT(11) +#define TXDA_DRV_POWER_EN_PH_2_N BIT(10) +#define TXDA_DRV_POWER_EN_PH_1_N BIT(9) +#define TXDA_BGREF_EN BIT(8) +#define TXDA_DRV_LDO_EN BIT(7) +#define TXDA_DECAP_EN_DEL BIT(6) +#define TXDA_DECAP_EN BIT(5) +#define TXDA_UPHY_SUPPLY_EN_DEL BIT(4) +#define TXDA_UPHY_SUPPLY_EN BIT(3) +#define TXDA_LOW_LEAKAGE_EN BIT(2) +#define TXDA_DRV_IDLE_LOWI_EN BIT(1) +#define TXDA_DRV_CMN_MODE_EN BIT(0) + +#define TX_ANA_CTRL_REG_2 (0x5021 << 2) + +#define AUXDA_DEBOUNCING_CLK BIT(15) +#define TXDA_LPBK_RECOVERED_CLK_EN BIT(14) +#define TXDA_LPBK_ISI_GEN_EN BIT(13) +#define TXDA_LPBK_SERIAL_EN BIT(12) +#define TXDA_LPBK_LINE_EN BIT(11) +#define TXDA_DRV_LDO_REDC_SINKIQ BIT(10) +#define XCVR_DECAP_EN_DEL BIT(9) +#define XCVR_DECAP_EN BIT(8) +#define TXDA_MPHY_ENABLE_HS_NT BIT(7) +#define TXDA_MPHY_SA_MODE BIT(6) +#define TXDA_DRV_LDO_RBYR_FB_EN BIT(5) +#define TXDA_DRV_RST_PULL_DOWN BIT(4) +#define TXDA_DRV_LDO_BG_FB_EN BIT(3) +#define TXDA_DRV_LDO_BG_REF_EN BIT(2) +#define TXDA_DRV_PREDRV_EN_DEL BIT(1) +#define TXDA_DRV_PREDRV_EN BIT(0) + +#define TXDA_COEFF_CALC_CTRL (0x5022 << 2) + +#define TX_HIGH_Z BIT(6) +#define TX_VMARGIN_OFFSET 3 +#define TX_VMARGIN_MASK 0x7 +#define LOW_POWER_SWING_EN BIT(2) +#define TX_FCM_DRV_MAIN_EN BIT(1) +#define TX_FCM_FULL_MARGIN BIT(0) + +#define TX_DIG_CTRL_REG_2 (0x5024 << 2) + +#define TX_HIGH_Z_TM_EN BIT(15) +#define TX_RESCAL_CODE_OFFSET 0 +#define TX_RESCAL_CODE_MASK 0x3f + +#define TXDA_CYA_AUXDA_CYA (0x5025 << 2) +#define TX_ANA_CTRL_REG_3 (0x5026 << 2) +#define TX_ANA_CTRL_REG_4 (0x5027 << 2) +#define TX_ANA_CTRL_REG_5 (0x5029 << 2) + +#define RX_PSC_A0(n) ((0x8000 | ((n) << 9)) << 2) +#define RX_PSC_A1(n) ((0x8001 | ((n) << 9)) << 2) +#define RX_PSC_A2(n) ((0x8002 | ((n) << 9)) << 2) +#define RX_PSC_A3(n) ((0x8003 | ((n) << 9)) << 2) +#define RX_PSC_CAL(n) ((0x8006 | ((n) << 9)) << 2) +#define RX_PSC_RDY(n) ((0x8007 | ((n) << 9)) << 2) +#define RX_IQPI_ILL_CAL_OVRD (0x8023 << 2) +#define RX_EPI_ILL_CAL_OVRD (0x8033 << 2) +#define RX_SDCAL0_OVRD (0x8041 << 2) +#define RX_SDCAL1_OVRD (0x8049 << 2) +#define RX_SLC_INIT (0x806d << 2) +#define RX_SLC_RUN (0x806e << 2) +#define RX_CDRLF_CNFG2 (0x8081 << 2) +#define RX_SIGDET_HL_FILT_TMR(n) ((0x8090 | ((n) << 9)) << 2) +#define RX_SLC_IOP0_OVRD (0x8101 << 2) +#define RX_SLC_IOP1_OVRD (0x8105 << 2) +#define RX_SLC_QOP0_OVRD (0x8109 << 2) +#define RX_SLC_QOP1_OVRD (0x810d << 2) +#define RX_SLC_EOP0_OVRD (0x8111 << 2) +#define RX_SLC_EOP1_OVRD (0x8115 << 2) +#define RX_SLC_ION0_OVRD (0x8119 << 2) +#define RX_SLC_ION1_OVRD (0x811d << 2) +#define RX_SLC_QON0_OVRD (0x8121 << 2) +#define RX_SLC_QON1_OVRD (0x8125 << 2) +#define RX_SLC_EON0_OVRD (0x8129 << 2) +#define RX_SLC_EON1_OVRD (0x812d << 2) +#define RX_SLC_IEP0_OVRD (0x8131 << 2) +#define RX_SLC_IEP1_OVRD (0x8135 << 2) +#define RX_SLC_QEP0_OVRD (0x8139 << 2) +#define RX_SLC_QEP1_OVRD (0x813d << 2) +#define RX_SLC_EEP0_OVRD (0x8141 << 2) +#define RX_SLC_EEP1_OVRD (0x8145 << 2) +#define RX_SLC_IEN0_OVRD (0x8149 << 2) +#define RX_SLC_IEN1_OVRD (0x814d << 2) +#define RX_SLC_QEN0_OVRD (0x8151 << 2) +#define RX_SLC_QEN1_OVRD (0x8155 << 2) +#define RX_SLC_EEN0_OVRD (0x8159 << 2) +#define RX_SLC_EEN1_OVRD (0x815d << 2) +#define RX_REE_CTRL_DATA_MASK(n) ((0x81bb | ((n) << 9)) << 2) +#define RX_DIAG_SIGDET_TUNE(n) ((0x81dc | ((n) << 9)) << 2) +#define RX_DIAG_SC2C_DELAY (0x81e1 << 2) + +#define PMA_LANE_CFG (0xc000 << 2) +#define PIPE_CMN_CTRL1 (0xc001 << 2) +#define PIPE_CMN_CTRL2 (0xc002 << 2) +#define PIPE_COM_LOCK_CFG1 (0xc003 << 2) +#define PIPE_COM_LOCK_CFG2 (0xc004 << 2) +#define PIPE_RCV_DET_INH (0xc005 << 2) +#define DP_MODE_CTL (0xc008 << 2) +#define DP_CLK_CTL (0xc009 << 2) +#define STS (0xc00F << 2) +#define PHY_ISO_CMN_CTRL (0xc010 << 2) +#define PHY_DP_TX_CTL (0xc408 << 2) +#define PMA_CMN_CTRL1 (0xc800 << 2) +#define PHY_PMA_ISO_CMN_CTRL (0xc810 << 2) +#define PHY_ISOLATION_CTRL (0xc81f << 2) +#define PHY_PMA_ISO_XCVR_CTRL(n) ((0xcc11 | ((n) << 6)) << 2) +#define PHY_PMA_ISO_LINK_MODE(n) ((0xcc12 | ((n) << 6)) << 2) +#define PHY_PMA_ISO_PWRST_CTRL(n) ((0xcc13 | ((n) << 6)) << 2) +#define PHY_PMA_ISO_TX_DATA_LO(n) ((0xcc14 | ((n) << 6)) << 2) +#define PHY_PMA_ISO_TX_DATA_HI(n) ((0xcc15 | ((n) << 6)) << 2) +#define PHY_PMA_ISO_RX_DATA_LO(n) ((0xcc16 | ((n) << 6)) << 2) +#define PHY_PMA_ISO_RX_DATA_HI(n) ((0xcc17 | ((n) << 6)) << 2) +#define TX_BIST_CTRL(n) ((0x4140 | ((n) << 9)) << 2) +#define TX_BIST_UDDWR(n) ((0x4141 | ((n) << 9)) << 2) + +/* + * Selects which PLL clock will be driven on the analog high speed + * clock 0: PLL 0 div 1 + * clock 1: PLL 1 div 2 + */ +#define CLK_PLL_CONFIG 0X30 +#define CLK_PLL_MASK 0x33 + +#define CMN_READY BIT(0) + +#define DP_PLL_CLOCK_ENABLE BIT(2) +#define DP_PLL_ENABLE BIT(0) +#define DP_PLL_DATA_RATE_RBR ((2 << 12) | (4 << 8)) +#define DP_PLL_DATA_RATE_HBR ((2 << 12) | (4 << 8)) +#define DP_PLL_DATA_RATE_HBR2 ((1 << 12) | (2 << 8)) + +#define DP_MODE_A0 BIT(4) +#define DP_MODE_A2 BIT(6) +#define DP_MODE_ENTER_A0 0xc101 +#define DP_MODE_ENTER_A2 0xc104 + +#define PHY_MODE_SET_TIMEOUT 100000 + +#define PIN_ASSIGN_C_E 0x51d9 +#define PIN_ASSIGN_D_F 0x5100 + +#define MODE_DISCONNECT 0 +#define MODE_UFP_USB BIT(0) +#define MODE_DFP_USB BIT(1) +#define MODE_DFP_DP BIT(2) + +struct usb3phy_reg { + u32 offset; + u32 enable_bit; + u32 write_enable; +}; + +/** + * struct rockchip_usb3phy_port_cfg: usb3-phy port configuration. + * @reg: the base address for usb3-phy config. + * @typec_conn_dir: the register of type-c connector direction. + * @usb3tousb2_en: the register of type-c force usb2 to usb2 enable. + * @external_psm: the register of type-c phy external psm clock. + * @pipe_status: the register of type-c phy pipe status. + * @usb3_host_disable: the register of type-c usb3 host disable. + * @usb3_host_port: the register of type-c usb3 host port. + * @uphy_dp_sel: the register of type-c phy DP select control. + */ +struct rockchip_usb3phy_port_cfg { + unsigned int reg; + struct usb3phy_reg typec_conn_dir; + struct usb3phy_reg usb3tousb2_en; + struct usb3phy_reg external_psm; + struct usb3phy_reg pipe_status; + struct usb3phy_reg usb3_host_disable; + struct usb3phy_reg usb3_host_port; + struct usb3phy_reg uphy_dp_sel; +}; + +struct rockchip_tcphy { + void __iomem *reg_base; + void __iomem *grf_base; + struct clk clk_core; + struct clk clk_ref; + struct reset_ctl uphy_rst; + struct reset_ctl pipe_rst; + struct reset_ctl tcphy_rst; + const struct rockchip_usb3phy_port_cfg *port_cfgs; + u8 mode; +}; + +struct phy_reg { + u16 value; + u32 addr; +}; + +static struct phy_reg usb3_pll_cfg[] = { + { 0xf0, CMN_PLL0_VCOCAL_INIT }, + { 0x18, CMN_PLL0_VCOCAL_ITER }, + { 0xd0, CMN_PLL0_INTDIV }, + { 0x4a4a, CMN_PLL0_FRACDIV }, + { 0x34, CMN_PLL0_HIGH_THR }, + { 0x1ee, CMN_PLL0_SS_CTRL1 }, + { 0x7f03, CMN_PLL0_SS_CTRL2 }, + { 0x20, CMN_PLL0_DSM_DIAG }, + { 0, CMN_DIAG_PLL0_OVRD }, + { 0, CMN_DIAG_PLL0_FBH_OVRD }, + { 0, CMN_DIAG_PLL0_FBL_OVRD }, + { 0x7, CMN_DIAG_PLL0_V2I_TUNE }, + { 0x45, CMN_DIAG_PLL0_CP_TUNE }, + { 0x8, CMN_DIAG_PLL0_LF_PROG }, +}; + +static inline int property_enable(struct rockchip_tcphy *priv, + const struct usb3phy_reg *reg, bool en) +{ + u32 mask = 1 << reg->write_enable; + u32 val = en << reg->enable_bit; + + return writel(val | mask, priv->grf_base + reg->offset); +} + +static int rockchip_tcphy_get_mode(struct rockchip_tcphy *priv) +{ + /* TODO: Add proper logic to find DP or USB3 mode */ + return MODE_DFP_USB | MODE_UFP_USB; +} + +static void rockchip_tcphy_cfg_24m(struct rockchip_tcphy *priv) +{ + u32 i, rdata; + + /* + * cmn_ref_clk_sel = 3, select the 24Mhz for clk parent + * cmn_psm_clk_dig_div = 2, set the clk division to 2 + */ + writel(0x830, priv->reg_base + PMA_CMN_CTRL1); + for (i = 0; i < 4; i++) { + /* + * The following PHY configuration assumes a 24 MHz reference + * clock. + */ + writel(0x90, priv->reg_base + XCVR_DIAG_LANE_FCM_EN_MGN(i)); + writel(0x960, priv->reg_base + TX_RCVDET_EN_TMR(i)); + writel(0x30, priv->reg_base + TX_RCVDET_ST_TMR(i)); + } + + rdata = readl(priv->reg_base + CMN_DIAG_HSCLK_SEL); + rdata &= ~CLK_PLL_MASK; + rdata |= CLK_PLL_CONFIG; + writel(rdata, priv->reg_base + CMN_DIAG_HSCLK_SEL); +} + +static void rockchip_tcphy_cfg_usb3_pll(struct rockchip_tcphy *priv) +{ + u32 i; + + /* load the configuration of PLL0 */ + for (i = 0; i < ARRAY_SIZE(usb3_pll_cfg); i++) + writel(usb3_pll_cfg[i].value, + priv->reg_base + usb3_pll_cfg[i].addr); +} + +static void rockchip_tcphy_tx_usb3_cfg_lane(struct rockchip_tcphy *priv, + u32 lane) +{ + writel(0x7799, priv->reg_base + TX_PSC_A0(lane)); + writel(0x7798, priv->reg_base + TX_PSC_A1(lane)); + writel(0x5098, priv->reg_base + TX_PSC_A2(lane)); + writel(0x5098, priv->reg_base + TX_PSC_A3(lane)); + writel(0, priv->reg_base + TX_TXCC_MGNFS_MULT_000(lane)); + writel(0xbf, priv->reg_base + XCVR_DIAG_BIDI_CTRL(lane)); +} + +static void rockchip_tcphy_rx_usb3_cfg_lane(struct rockchip_tcphy *priv, + u32 lane) +{ + writel(0xa6fd, priv->reg_base + RX_PSC_A0(lane)); + writel(0xa6fd, priv->reg_base + RX_PSC_A1(lane)); + writel(0xa410, priv->reg_base + RX_PSC_A2(lane)); + writel(0x2410, priv->reg_base + RX_PSC_A3(lane)); + writel(0x23ff, priv->reg_base + RX_PSC_CAL(lane)); + writel(0x13, priv->reg_base + RX_SIGDET_HL_FILT_TMR(lane)); + writel(0x03e7, priv->reg_base + RX_REE_CTRL_DATA_MASK(lane)); + writel(0x1004, priv->reg_base + RX_DIAG_SIGDET_TUNE(lane)); + writel(0x2010, priv->reg_base + RX_PSC_RDY(lane)); + writel(0xfb, priv->reg_base + XCVR_DIAG_BIDI_CTRL(lane)); +} + +static int rockchip_tcphy_init(struct rockchip_tcphy *priv) +{ + const struct rockchip_usb3phy_port_cfg *cfg = priv->port_cfgs; + u32 val; + int ret; + + ret = clk_enable(&priv->clk_core); + if (ret) { + dev_err(phy->dev, "failed to enable core clk (ret=%d)\n", ret); + return ret; + } + + ret = clk_enable(&priv->clk_ref); + if (ret) { + dev_err(phy->dev, "failed to enable ref clk (ret=%d)\n", ret); + goto err_clk_core; + } + + ret = reset_deassert(&priv->tcphy_rst); + if (ret) { + dev_err(phy->dev, "failed to deassert uphy-tcphy reset (ret=%d)\n", + ret); + goto err_clk_ref; + } + + property_enable(priv, &cfg->typec_conn_dir, 0); + + rockchip_tcphy_cfg_24m(priv); + + rockchip_tcphy_cfg_usb3_pll(priv); + + rockchip_tcphy_tx_usb3_cfg_lane(priv, 0); + rockchip_tcphy_rx_usb3_cfg_lane(priv, 1); + + ret = reset_deassert(&priv->uphy_rst); + if (ret) { + dev_err(phy->dev, "failed to deassert uphy rst (ret=%d)\n", + ret); + goto err_tcphy_rst; + } + + ret = readl_poll_sleep_timeout(priv->reg_base + PMA_CMN_CTRL1, + val, val & CMN_READY, 10, + PHY_MODE_SET_TIMEOUT); + if (ret < 0) { + dev_err(phy->dev, "PMA Timeout!\n"); + ret = -ETIMEDOUT; + goto err_uphy_rst; + } + + ret = reset_deassert(&priv->pipe_rst); + if (ret) { + dev_err(phy->dev, "failed to deassert pipe rst (ret=%d)\n", + ret); + goto err_uphy_rst; + } + + return 0; + +err_uphy_rst: + reset_assert(&priv->uphy_rst); +err_tcphy_rst: + reset_assert(&priv->tcphy_rst); +err_clk_ref: + clk_disable(&priv->clk_ref); +err_clk_core: + clk_disable(&priv->clk_core); + return ret; +} + +static void rockchip_tcphy_exit(struct rockchip_tcphy *priv) +{ + reset_assert(&priv->tcphy_rst); + reset_assert(&priv->uphy_rst); + reset_assert(&priv->pipe_rst); + clk_disable(&priv->clk_core); + clk_disable(&priv->clk_ref); +} + +static int tcphy_cfg_usb3_to_usb2_only(struct rockchip_tcphy *priv, + bool value) +{ + const struct rockchip_usb3phy_port_cfg *cfg = priv->port_cfgs; + + property_enable(priv, &cfg->usb3tousb2_en, value); + property_enable(priv, &cfg->usb3_host_disable, value); + property_enable(priv, &cfg->usb3_host_port, !value); + + return 0; +} + +static int rockchip_usb3_phy_power_on(struct phy *phy) +{ + struct udevice *parent = dev_get_parent(phy->dev); + struct rockchip_tcphy *priv = dev_get_priv(parent); + const struct rockchip_usb3phy_port_cfg *cfg = priv->port_cfgs; + const struct usb3phy_reg *reg = &cfg->pipe_status; + int timeout, new_mode; + u32 val; + int ret; + + new_mode = rockchip_tcphy_get_mode(priv); + if (new_mode < 0) { + dev_err(phy->dev, "invalid mode %d\n", new_mode); + return new_mode; + } + + if (priv->mode == new_mode) + return 0; + + if (priv->mode == MODE_DISCONNECT) { + ret = rockchip_tcphy_init(priv); + if (ret) { + dev_err(dev, "failed to init tcphy (ret=%d)\n", ret); + return ret; + } + } + + /* wait TCPHY for pipe ready */ + for (timeout = 0; timeout < 100; timeout++) { + val = readl(priv->grf_base + reg->offset); + if (!(val & BIT(reg->enable_bit))) { + priv->mode |= new_mode & (MODE_DFP_USB | MODE_UFP_USB); + + /* enable usb3 host */ + tcphy_cfg_usb3_to_usb2_only(priv, false); + return 0; + } + usleep_range(10, 20); + } + + if (priv->mode == MODE_DISCONNECT) + rockchip_tcphy_exit(priv); + + return -ETIMEDOUT; +} + +static int rockchip_usb3_phy_power_off(struct phy *phy) +{ + struct udevice *parent = dev_get_parent(phy->dev); + struct rockchip_tcphy *priv = dev_get_priv(parent); + + tcphy_cfg_usb3_to_usb2_only(priv, false); + + if (priv->mode == MODE_DISCONNECT) + goto exit; + + priv->mode &= ~(MODE_UFP_USB | MODE_DFP_USB); + if (priv->mode == MODE_DISCONNECT) + rockchip_tcphy_exit(priv); + +exit: + return 0; +} + +static struct phy_ops rockchip_tcphy_usb3_ops = { + .power_on = rockchip_usb3_phy_power_on, + .power_off = rockchip_usb3_phy_power_off, +}; + +static void rockchip_tcphy_pre_init(struct udevice *dev) +{ + struct rockchip_tcphy *priv = dev_get_priv(dev); + const struct rockchip_usb3phy_port_cfg *cfg = priv->port_cfgs; + + reset_assert(&priv->tcphy_rst); + reset_assert(&priv->uphy_rst); + reset_assert(&priv->pipe_rst); + + /* select external psm clock */ + property_enable(priv, &cfg->external_psm, 1); + property_enable(priv, &cfg->usb3tousb2_en, 0); + + priv->mode = MODE_DISCONNECT; +} + +static int rockchip_tcphy_parse_dt(struct udevice *dev) +{ + struct rockchip_tcphy *priv = dev_get_priv(dev); + int ret; + + priv->grf_base = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); + if (IS_ERR(priv->grf_base)) + return PTR_ERR(priv->grf_base); + + ret = clk_get_by_name(dev, "tcpdcore", &priv->clk_core); + if (ret) { + dev_err(dev, "failed to get tcpdcore clk (ret=%d)\n", ret); + return ret; + } + + ret = clk_get_by_name(dev, "tcpdphy-ref", &priv->clk_ref); + if (ret) { + dev_err(dev, "failed to get tcpdphy-ref clk (ret=%d)\n", ret); + return ret; + } + + ret = reset_get_by_name(dev, "uphy", &priv->uphy_rst); + if (ret) { + dev_err(dev, "failed to get uphy reset (ret=%d)\n", ret); + return ret; + } + + ret = reset_get_by_name(dev, "uphy-pipe", &priv->pipe_rst); + if (ret) { + dev_err(dev, "failed to get uphy-pipe reset (ret=%d)\n", ret); + return ret; + } + + ret = reset_get_by_name(dev, "uphy-tcphy", &priv->tcphy_rst); + if (ret) { + dev_err(dev, "failed to get uphy-tcphy reset (ret=%d)\n", ret); + return ret; + } + + return 0; +} + +static int rockchip_tcphy_probe(struct udevice *dev) +{ + struct rockchip_tcphy *priv = dev_get_priv(dev); + const struct rockchip_usb3phy_port_cfg *phy_cfgs; + unsigned int reg; + int index, ret; + + priv->reg_base = (void __iomem *)dev_read_addr(dev); + if (IS_ERR(priv->reg_base)) + return PTR_ERR(priv->reg_base); + + ret = dev_read_u32_index(dev, "reg", 1, ®); + if (ret) { + dev_err(dev, "failed to read reg property (ret = %d)\n", ret); + return ret; + } + + phy_cfgs = (const struct rockchip_usb3phy_port_cfg *) + dev_get_driver_data(dev); + if (!phy_cfgs) + return -EINVAL; + + /* find out a proper config which can be matched with dt. */ + index = 0; + while (phy_cfgs[index].reg) { + if (phy_cfgs[index].reg == reg) { + priv->port_cfgs = &phy_cfgs[index]; + break; + } + + ++index; + } + + if (!priv->port_cfgs) { + dev_err(dev, "failed find proper phy-cfg\n"); + return -EINVAL; + } + + ret = rockchip_tcphy_parse_dt(dev); + if (ret) + return ret; + + rockchip_tcphy_pre_init(dev); + + return 0; +} + +static int rockchip_tcphy_bind(struct udevice *dev) +{ + struct udevice *tcphy_dev; + ofnode node; + const char *name; + int ret = 0; + + dev_for_each_subnode(node, dev) { + if (!ofnode_valid(node)) { + dev_info(dev, "subnode %s not found\n", dev->name); + return -ENXIO; + } + + name = ofnode_get_name(node); + dev_dbg(dev, "subnode %s\n", name); + + if (!strcasecmp(name, "dp-port")) { + dev_dbg(dev, "Warning: dp-port not supported yet!\n"); + continue; + } else if (!strcasecmp(name, "usb3-port")) { + ret = device_bind_driver_to_node(dev, + "rockchip_tcphy_usb3_port", + name, node, &tcphy_dev); + if (ret) { + dev_err(dev, + "'%s' cannot bind 'rockchip_tcphy_usb3_port'\n", + name); + return ret; + } + } + } + + return ret; +} + +static const struct rockchip_usb3phy_port_cfg rk3399_typec_phy_cfgs[] = { + { + .reg = 0xff7c0000, + .typec_conn_dir = { 0xe580, 0, 16 }, + .usb3tousb2_en = { 0xe580, 3, 19 }, + .external_psm = { 0xe588, 14, 30 }, + .pipe_status = { 0xe5c0, 0, 0 }, + .usb3_host_disable = { 0x2434, 0, 16 }, + .usb3_host_port = { 0x2434, 12, 28 }, + .uphy_dp_sel = { 0x6268, 19, 19 }, + }, + { + .reg = 0xff800000, + .typec_conn_dir = { 0xe58c, 0, 16 }, + .usb3tousb2_en = { 0xe58c, 3, 19 }, + .external_psm = { 0xe594, 14, 30 }, + .pipe_status = { 0xe5c0, 16, 16 }, + .usb3_host_disable = { 0x2444, 0, 16 }, + .usb3_host_port = { 0x2444, 12, 28 }, + .uphy_dp_sel = { 0x6268, 3, 19 }, + }, + { /* sentinel */ } +}; + +static const struct udevice_id rockchip_typec_phy_ids[] = { + { + .compatible = "rockchip,rk3399-typec-phy", + .data = (ulong)&rk3399_typec_phy_cfgs, + }, + { /* sentinel */ } +}; + +U_BOOT_DRIVER(rockchip_tcphy_usb3_port) = { + .name = "rockchip_tcphy_usb3_port", + .id = UCLASS_PHY, + .ops = &rockchip_tcphy_usb3_ops, +}; + +U_BOOT_DRIVER(rockchip_typec_phy) = { + .name = "rockchip_typec_phy", + .id = UCLASS_PHY, + .of_match = rockchip_typec_phy_ids, + .probe = rockchip_tcphy_probe, + .bind = rockchip_tcphy_bind, + .priv_auto_alloc_size = sizeof(struct rockchip_tcphy), +}; From patchwork Mon May 11 07:55:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1171 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 168943F08B for ; Mon, 11 May 2020 09:55:29 +0200 (CEST) Received: by mail-pl1-f199.google.com with SMTP id x3sf6792029plm.9 for ; Mon, 11 May 2020 00:55:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183728; cv=pass; d=google.com; s=arc-20160816; b=yXxaVEYkJjQvB+Lat1wUbFqFQpjXPfNILnp0tdV7mNOCZ6OsNlPV4rbrmkDdfCMdRp pCX59fYr4N89i+GzLQI4lhJ6whLbM2IP77yy9/ICJkrb+LmFphgi6PolrrfISLG7UVxC g4fZB/iQnRg7noEnk0NbtcPI0oHgInwOLS4cIC4OCMCNPHl4P+AsYYnpDN5DyFNv+bTG ZZyA/kebTdQaQKMY9GEW5aAmk7u0Zjpx3349dwinUkDLmiKl2nY2I0HpnxdbigA/7co9 ujP0WYUE5KZcm31bNq9WOYICl8O1hNChHSoLdOiZ0qJ9riK1C4nq0ZnZs+J7GSNY5rZn 04ug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=4I6prDlW7uGnedtxnH4Z/uI3sdmk8lhQX+QHZtMi1zw=; b=Vb4KALy+uqdnMqjQKIAsSwlHtwHdIryVgZW/CnRR+Ak8XSvAFBgMWBqsv5tQkrTz/s N9oE6H0UEjA403/jZfYAWfHvfVYaUiTsptRhBnqO4GKB2M1z5Qz6b9gdjYUYPxIZifxE 7OJog6dTgyBLwhxIvcTDZxfbKYJqMILXl+vFQtctAyMMr5vpHNgPsv3oz2YJpkT+NdeF f92wiXpw9gKfurT64VF8brrOF9Ob0Y+0dKZUARQWrlDVVo00jHMlbDo6VElTnv+Rrqfl ZG8H7mLp5KnEZu+SrzAJAmU2AnWK103dVgjkgdV4eK2mkzcNRW+C2OHbyp8SQMATIWHh 19Ig== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.132 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=4I6prDlW7uGnedtxnH4Z/uI3sdmk8lhQX+QHZtMi1zw=; b=Bd0fKmcDds0siZCOVKGoAw5KhswXQ0RQEWItMGjHJHtSpV4g24VGciNlnl6epwb2CY ytsTzy8yrvUrFvL2bAVT9lPII2/6fd9oQLrUh6Xg+mORygUErQ4M8W6fqPbXK6hnCXwq Chb59wmvjAl0gfNG6ujRHMq/HvN8XaQJeu+/I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=4I6prDlW7uGnedtxnH4Z/uI3sdmk8lhQX+QHZtMi1zw=; b=hqpqmC2RGmFSIyC/WrWN6ZMsS/EtA8mmEaTJh6hbDtl3bAUEhm0eLHm2pOGUAckgBd C5GSUqWZDYCO0UuQq81AWx9hrrUz57BqX+vFRmfD+tURMQvdnPGs3kg1tGhwyGQJ2sCz qlkp4vYCtNFhKHPzcJm/+lj9fUXBxPgkH0lhs9GCkMCb6m/Lu1fRHeHQ1R56ZLyC0/NE E4zlY4E4V4s2DJYcWWqCo2gDdwXoRk6ufuh2TibGihDQjq99YxMG0xgSTfsCs6aIhbVG A9CmTh/Y4r22WEc2PaIoCWYZURPHIwMaxJesezrCEUeTpSeE/BqDJoiSqsk+OvbDDBim Bppg== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0Pubd3ZROuspZjvkuuvL7guVByh8BjlAs6DwLEHqUL93bnNMMcWgl Vu3QDY1LFxKOroW8GRe2B6W+lNFt X-Google-Smtp-Source: APiQypIUfv7i/64sqZo2T2AlGs7ZRNcdKiDSE9UZI8qdK4bElysqNcf1CH/4ZkFuWKQl7qt1HR15tQ== X-Received: by 2002:a17:902:6b01:: with SMTP id o1mr14277742plk.64.1589183727884; Mon, 11 May 2020 00:55:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:7143:: with SMTP id g3ls16188134pjs.0.canary-gmail; Mon, 11 May 2020 00:55:27 -0700 (PDT) X-Received: by 2002:a17:90a:bd91:: with SMTP id z17mr21492652pjr.189.1589183727517; Mon, 11 May 2020 00:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183727; cv=none; d=google.com; s=arc-20160816; b=Qa+yW1RCsyZ2S/LqwqM3DRVDHgn/3pbKLw+jc4Oy0lotW0Jw8NqIHiFvW3+jVMi1Wv XomEeZ6E3cfQ5oj8lLSTvMSUCYJrIopcdqun0Gny/0wP8uWA49/r4OG0dxTRZRqFjm4Q ceAwVn7G42Fz+9trCwsmyJXdf1JnVOfUSHaZLzgYTNOlxVMthGuIK+Ss/qMRjYy6ofxm Av83NcevAFFtv2VNkCjVGEYzAIlsWaRaw3t6nIGP8QxB00b7fbCeNS0fJyxFD8/IzahZ ILDxsnnoEKQqaXfHK0ktRXxrhLB6K++278Jem6y/iXCg8FQGwY9HhbR1VZMjRNNgmA4g AYsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=ewoDqNjGkB95CLMm4CQMxAypYj9Od+ya8eEQpsL5M+g=; b=gPA0HFu8MRuQiDOzNfwaJu7J5cK2T9br6kzrMNCse9xxJv8OBQ2eAPY3OPhqWvc7le cblJPGTOJ47XK4Q6pVwU3deqjxKze3V+BHLRrfkTij+vJwhCaSTOepn2RYCev2Y29wZK Bp03nAtWvP+eQdTqLF7UCAqmOQg31Q1b2CAmJ5J34SF3BVCCWd6I4X1q5EtybFlkmwpY 5Rp7TeK6DH6bLE9afouKrTblgK0VdU4Ejuiqei5rHmzV9bsReNZ/az4yS5QK98fC+Csy trK7CUldiE3fPUb212eksO4VOkMPIsuThbe+03XabIucN6glJzfABhnIFeM69N+7kHDG sw5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.132 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.132]) by mx.google.com with ESMTPS id m1si7021923pls.61.2020.05.11.00.55.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:55:27 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.132 as permitted sender) client-ip=211.157.147.132; Received: from localhost (unknown [192.168.167.8]) by lucky1.263xmail.com (Postfix) with ESMTP id 001AFCD61D; Mon, 11 May 2020 15:55:25 +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 P2949T140479804974848S1589183722650576_; Mon, 11 May 2020 15:55:26 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <19a343bbd400d2876a0394a475736801> X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com, Frank Wang Subject: [PATCH v4 07/16] usb: dwc3: add dis_enblslpm_quirk Date: Mon, 11 May 2020 15:55:11 +0800 Message-Id: <20200511075520.26557-3-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075520.26557-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> <20200511075520.26557-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.132 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add a quirk to clear the GUSB2PHYCFG.ENBLSLPM bit, which controls whether the PHY receives the suspend signal from the controller. Refer to commit ec791d149bca("usb: dwc3: Add dis_enblslpm_quirk") in Linux Kernel. Signed-off-by: Frank Wang Reviewed-by: Kever Yang Reviewed-by: Jagan Teki Tested-by: Jagan Teki # roc-rk3399-pc --- drivers/usb/dwc3/core.c | 6 ++++++ drivers/usb/dwc3/core.h | 2 ++ include/dwc3-uboot.h | 1 + 3 files changed, 9 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 0972e458eb..20be617fd4 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -398,6 +398,9 @@ static void dwc3_phy_setup(struct dwc3 *dwc) if (dwc->dis_u2_susphy_quirk) reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; + if (dwc->dis_enblslpm_quirk) + reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM; + dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); mdelay(100); @@ -719,6 +722,7 @@ int dwc3_uboot_init(struct dwc3_device *dwc3_dev) dwc->dis_u3_susphy_quirk = dwc3_dev->dis_u3_susphy_quirk; dwc->dis_u2_susphy_quirk = dwc3_dev->dis_u2_susphy_quirk; dwc->dis_del_phy_power_chg_quirk = dwc3_dev->dis_del_phy_power_chg_quirk; + dwc->dis_enblslpm_quirk = dwc3_dev->dis_enblslpm_quirk; dwc->tx_de_emphasis_quirk = dwc3_dev->tx_de_emphasis_quirk; if (dwc3_dev->tx_de_emphasis) @@ -926,6 +930,8 @@ void dwc3_of_parse(struct dwc3 *dwc) "snps,dis_u2_susphy_quirk"); dwc->dis_del_phy_power_chg_quirk = dev_read_bool(dev, "snps,dis-del-phy-power-chg-quirk"); + dwc->dis_enblslpm_quirk = dev_read_bool(dev, + "snps,dis_enblslpm_quirk"); dwc->tx_de_emphasis_quirk = dev_read_bool(dev, "snps,tx_de_emphasis_quirk"); tmp = dev_read_u8_array_ptr(dev, "snps,tx_de_emphasis", 1); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 7f45a9c459..e76e357f1e 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -162,6 +162,7 @@ /* Global USB2 PHY Configuration Register */ #define DWC3_GUSB2PHYCFG_PHYSOFTRST (1 << 31) #define DWC3_GUSB2PHYCFG_SUSPHY (1 << 6) +#define DWC3_GUSB2PHYCFG_ENBLSLPM (1 << 8) #define DWC3_GUSB2PHYCFG_PHYIF(n) ((n) << 3) #define DWC3_GUSB2PHYCFG_PHYIF_MASK DWC3_GUSB2PHYCFG_PHYIF(1) #define DWC3_GUSB2PHYCFG_USBTRDTIM(n) ((n) << 10) @@ -822,6 +823,7 @@ struct dwc3 { unsigned dis_u3_susphy_quirk:1; unsigned dis_u2_susphy_quirk:1; unsigned dis_del_phy_power_chg_quirk:1; + unsigned dis_enblslpm_quirk:1; unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2; diff --git a/include/dwc3-uboot.h b/include/dwc3-uboot.h index ecae34bf06..98d51e05e1 100644 --- a/include/dwc3-uboot.h +++ b/include/dwc3-uboot.h @@ -34,6 +34,7 @@ struct dwc3_device { unsigned dis_u3_susphy_quirk; unsigned dis_u2_susphy_quirk; unsigned dis_del_phy_power_chg_quirk; + unsigned dis_enblslpm_quirk; unsigned tx_de_emphasis_quirk; unsigned tx_de_emphasis; int index; From patchwork Mon May 11 07:55:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1174 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 5B1843F08B for ; Mon, 11 May 2020 09:55:33 +0200 (CEST) Received: by mail-pj1-f70.google.com with SMTP id bg6sf16581492pjb.2 for ; Mon, 11 May 2020 00:55:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183732; cv=pass; d=google.com; s=arc-20160816; b=bu2M0Iblr0loE7VuFopPVu9HDUkRuhUUiOc7mglaPhyiCwZrmYfR90VUtMtpjmRy/d Cdd+C/z/ilIsp1QkIl2ML9EMeKmLjh9cHs+AGYKA/eF4VxeBqT3XQpSpfRl3ndh1EHJL N3J+KfgYTas9RTcNLsCMyCPAo8vFE8GHxQDnwE5aq8hze8lx1kuq09v43s2w01JPqZFQ f2b67HDyXKp4PaZ/wqFeyVZR7np1zGRosIGXJ/eTBZkFY3MPC9/wsNYTo6L2SwZ/huii XRdFWaNgeY1ixht0HkJaQaRIustPqMwMSlorbsYlK5GLoRY3Ez32W6fXiioTPzjeA4gk c+Xw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=rbpM808S9neo8EHv8wAd6xEKDZ2uRSqVtC+ialo35fU=; b=ldg3C0/3A5CBzdcmOre0VFZvpC/quFJVLYM9haC+YnsPlqt60LF97BSSP4tK/Ec1b5 NZbHXrc104oUWQHWa4NiKAlVtpy4f9/d0L9in+pXbrrV+41FmdSRGR0Q/nsmTEYiyHUp tmv/Av2gZvxR9gSCPrf0xdWl9ykpZ2AiYaBGRAKcE8Z0msL+ZyTHBx2tl2yE3EE+y5+M w+VMSOKnQPXjIhogOflWKd93EdOr2AuGH5ILCOM2F7kgkulKpLwFA8Kf2OXK0W4AVE/Z 4Xn2+kDrRP5RWzUzXaLOeLExnD1UsBhxdb19Z9SQYXdpMrikB41S+2hf3ptYQ7ZjbwHW IqbQ== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=rbpM808S9neo8EHv8wAd6xEKDZ2uRSqVtC+ialo35fU=; b=cpFAyfAQyjxjOorCETwnlIHBef0zTXhQ6TleINgxXRx/I6skv2sPjpLb1XfKkUJg+p /rsYqoSTSDvjrdDwxCdSMm/ngCGDWOfi97PTdhWfB/p2D4Wcx271x+W2yLf0Lz1ZySrW pxa950gTonhXxcMjeWj+t8R9dX0Rbe5gbmPQs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=rbpM808S9neo8EHv8wAd6xEKDZ2uRSqVtC+ialo35fU=; b=OmBWwnd/mOgYKaZNn503ANe5DYqjOmf9SfuhU5xq76Q+lM9/BzfF1Z9+UJXy3Q9asW 44sR8gAuCP1IylVXUil0VeFZ5tMeqQav4uLMwbIx2XMGnSzx6AmNpQHTcaffHUfV5aK1 Cz3PfsBEXuLqdTPYDRvxX89ZKSsAraDZtWZO38VDm3HrXN1g70TzggjWB4twcScMEP1z mlg/7fRNTtP+wKihFlKxhm3B0K0L63j+LNCzCUJWKj/g9GhSCX33h9uQ074kPBiL0PZf XLmv53lbHueom/UaC7jeWBhn0qdJrWEwIgARsOqSbGmMijmIoHaGfpntuOkmsHSRlCvi FI5g== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuZpkrnLENF9/p1utHzne4ypUeNbMVZiGY2i7gpCv+PaVgXUMkkg k1ABCwQ+4MkUOoAWWM1a06mEKf0J X-Google-Smtp-Source: APiQypKoK63akcc86LeVxMUAlOmA7BQwuXimDcQivMxV9AqM/Kvyda04AOL38yHVVZhOPQTh7mcDqw== X-Received: by 2002:a63:24a:: with SMTP id 71mr14198977pgc.184.1589183732167; Mon, 11 May 2020 00:55:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90b:4d05:: with SMTP id mw5ls15741422pjb.1.canary-gmail; Mon, 11 May 2020 00:55:28 -0700 (PDT) X-Received: by 2002:a17:90a:930c:: with SMTP id p12mr22884585pjo.64.1589183728725; Mon, 11 May 2020 00:55:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183728; cv=none; d=google.com; s=arc-20160816; b=qVrRRGRV8XMrbf6Vo1ZWPTC2caYDPT11vfiMUxA47Jp3yllW/47xvE2WDak37VzPpu GV/0++A5rgffssbi8I6wguzCnFk83XBJ+9o8T29pwcQFkzbfgSK/DaCOcn19viWMkmLp oXgD0ma8TUjGXUW2dAA0BWumnGsCJ+ouSGn1AcvsuDMmEpee8SzsCGX6Fv6JfL0/ejBV WNkIYlJp2plp98f6WAj+tanzdQZ5tw+HxfffFCWsiSgSomCVJVmJ/TM44IOHgXNasuE8 IXywKVyAZfGhfCP4IVIDxOblDJa/rs6Fslt1r6jkcnEQ0n/EXKaoPsVXwkK6rM26CH7E Fsxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=eTRR2rbTad3mEDe0it7aipRqKrJS/X4WiSHZAsD4hPY=; b=uEac4EoJ2qAXfLmCLT7DDzJpOoSbwsU/UoRlwH87ggtdY81SsObgMsoLqb2EsPAuac YKUqmt+biOFpdQXWX8ii3NwX1zJ058rQQ8o2fjA3EJbYEyQeYkuwPe37e7m1/nRCy7Hn 8vhzDHQur9bug1T2JsaJYAbGl6R4pwnnqyUh6vbPN+4PfAEbTvyeK8UaYFXckI7DxNzd yp8MPHKCnQZ1SNR9MEJxFfmaSjkED2dYVhErWzTmhQZzsreziLsKuLeEkXdduKAmD3XO W95JJ8i2ya3ObA34DfEwRfsOMlD9FG5pws/p+exIG8+cWJhRo777ZJ5IisOujb+xXmPk eeJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.130]) by mx.google.com with ESMTPS id i132si7098938pgd.129.2020.05.11.00.55.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:55:28 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) client-ip=211.157.147.130; Received: from localhost (unknown [192.168.167.8]) by lucky1.263xmail.com (Postfix) with ESMTP id 3D543B4E54; Mon, 11 May 2020 15:55:27 +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 P2949T140479804974848S1589183722650576_; Mon, 11 May 2020 15:55:27 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <4d14b74171187f3bbf4b5ef019f15a3c> X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com, Frank Wang Subject: [PATCH v4 08/16] usb: dwc3: add dis_u2_freeclk_exists_quirk Date: Mon, 11 May 2020 15:55:12 +0800 Message-Id: <20200511075520.26557-4-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075520.26557-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> <20200511075520.26557-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add a quirk to clear the GUSB2PHYCFG.U2_FREECLK_EXISTS bit, which specifies whether the USB2.0 PHY provides a free-running PHY clock, which is active when the clock control input is active. Refer to commit 27f83eeb6b42("usb: dwc3: add dis_u2_freeclk_exists_quirk") in Linux Rockchip Kernel. Signed-off-by: Frank Wang Reviewed-by: Kever Yang Reviewed-by: Jagan Teki Tested-by: Jagan Teki # roc-rk3399-pc --- drivers/usb/dwc3/core.c | 6 ++++++ drivers/usb/dwc3/core.h | 2 ++ include/dwc3-uboot.h | 1 + 3 files changed, 9 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 20be617fd4..3cb66515a2 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -401,6 +401,9 @@ static void dwc3_phy_setup(struct dwc3 *dwc) if (dwc->dis_enblslpm_quirk) reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM; + if (dwc->dis_u2_freeclk_exists_quirk) + reg &= ~DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS; + dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); mdelay(100); @@ -723,6 +726,7 @@ int dwc3_uboot_init(struct dwc3_device *dwc3_dev) dwc->dis_u2_susphy_quirk = dwc3_dev->dis_u2_susphy_quirk; dwc->dis_del_phy_power_chg_quirk = dwc3_dev->dis_del_phy_power_chg_quirk; dwc->dis_enblslpm_quirk = dwc3_dev->dis_enblslpm_quirk; + dwc->dis_u2_freeclk_exists_quirk = dwc3_dev->dis_u2_freeclk_exists_quirk; dwc->tx_de_emphasis_quirk = dwc3_dev->tx_de_emphasis_quirk; if (dwc3_dev->tx_de_emphasis) @@ -932,6 +936,8 @@ void dwc3_of_parse(struct dwc3 *dwc) "snps,dis-del-phy-power-chg-quirk"); dwc->dis_enblslpm_quirk = dev_read_bool(dev, "snps,dis_enblslpm_quirk"); + dwc->dis_u2_freeclk_exists_quirk = dev_read_bool(dev, + "snps,dis-u2-freeclk-exists-quirk"); dwc->tx_de_emphasis_quirk = dev_read_bool(dev, "snps,tx_de_emphasis_quirk"); tmp = dev_read_u8_array_ptr(dev, "snps,tx_de_emphasis", 1); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index e76e357f1e..c5e656885a 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -161,6 +161,7 @@ /* Global USB2 PHY Configuration Register */ #define DWC3_GUSB2PHYCFG_PHYSOFTRST (1 << 31) +#define DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS (1 << 30) #define DWC3_GUSB2PHYCFG_SUSPHY (1 << 6) #define DWC3_GUSB2PHYCFG_ENBLSLPM (1 << 8) #define DWC3_GUSB2PHYCFG_PHYIF(n) ((n) << 3) @@ -824,6 +825,7 @@ struct dwc3 { unsigned dis_u2_susphy_quirk:1; unsigned dis_del_phy_power_chg_quirk:1; unsigned dis_enblslpm_quirk:1; + unsigned dis_u2_freeclk_exists_quirk:1; unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2; diff --git a/include/dwc3-uboot.h b/include/dwc3-uboot.h index 98d51e05e1..193d225d31 100644 --- a/include/dwc3-uboot.h +++ b/include/dwc3-uboot.h @@ -35,6 +35,7 @@ struct dwc3_device { unsigned dis_u2_susphy_quirk; unsigned dis_del_phy_power_chg_quirk; unsigned dis_enblslpm_quirk; + unsigned dis_u2_freeclk_exists_quirk; unsigned tx_de_emphasis_quirk; unsigned tx_de_emphasis; int index; From patchwork Mon May 11 07:55:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1173 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 66E423F08B for ; Mon, 11 May 2020 09:55:31 +0200 (CEST) Received: by mail-pf1-f200.google.com with SMTP id q142sf8137424pfc.21 for ; Mon, 11 May 2020 00:55:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183730; cv=pass; d=google.com; s=arc-20160816; b=GmgjMf9DUjeY4fD5tHR7H5k5l19rntDq+dhxLd1hfnGvSK3t2F8SCnEAB05C5Lf27p lNj0A8skFa5RP8ebaHSWqpN65uMzxGHDo4Mz60UwWua8gcVh9wzDq7O5qZU/mN6Li4kc HLEG4Ap64aImTwKZYqw6iV94nPl4zoRZLyuZKlumC2KfWBZYpmARe6iKN68k4N9/5Gkj Lv7OBcBocismyoYEUdUsoghwnx52NR/GqBj6Zofg3ZIzrnzUVUgAuoRSmQrw5iBWfps3 Qx9UITrDHDKKJQqenI9Z5OXnO7Jf8aRlChcXW6JGPVHaaZkltYpZPX8Kt5crrQUCaQ7o PPcg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=e/1LCDRj8p/rOW7qojIR/KOanDuW6UsfVfzxS/X11/8=; b=wqB5qnp6Qf/pi71/ggJstNn0F8fiqMgbyjCu6nB6B96Qfso85W7hQRJyG3T+WnPe7I LgWQWf9EH3SXDEK7mcVrcN5aRjw+EjWWc+RHDi6EUXZI37WPjTQag7RB8mPHnJW2q2uj 6ZZkBEkSj84OVKpprJeUe85diLWzhSU84VQAoNvffEBAZnC1jD2rdrncrNAGS/WOSq7c dhgw4ayP9Xsr+TXX+ySTfOqKrHDj5NlaePVwnZjYZcKxztdlfhCeU0B9k70XW2rOuphY qG6BoDM4YKVVQ9d1cq1RBoxd0VT1JmyK8UVuylAS6flfTlk1D4kGIvUhPUAFMt/eXmYU QxIg== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=e/1LCDRj8p/rOW7qojIR/KOanDuW6UsfVfzxS/X11/8=; b=FHYbI5JUzuYwJAxyu29f4KcZQ5rDMKJcTKoFzftfmMGSvGgoVio0JTCBFReoN+7Hzh vm1tUUyAisF0AxKFv5XfX+dlB+2ehgMuHUCWfuAfYRTeUaOoIrO956LmZ8h0v7mWxvAH QqLfcGm1EPvYf3Vz3whVCGqxjquBaqAXm4zN4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=e/1LCDRj8p/rOW7qojIR/KOanDuW6UsfVfzxS/X11/8=; b=Xhvielk3FBZB0cOJVhMBYE2B1m5oRnghCYbp/lA4a0lY2nagp2D0a2bIY2M/Qg7KTx 2fILFfb4zSt38HdRon8Ebm7PbYqdpqdYJK/r+6f9NrWcuc8dU9wLpP3wN6sgY3NgdgLV b7R7qF1yg0qC3breLwNJ8t0AgyEm2HfZYPEWo4e07V5PTh6diaNnDqB/G6LyyLtdQ8mO WPmWWjHLBFHRUeuSutD+viqVCAIG+wOjtjqlP+ZNJmz+Y9veFNKcUbGIw+TXwo85OaE0 TJmKRJcPyibybc9XD4WSkD09yx0gUkSZmNM+0RURTq2jhusSsQ9ao49GuY5/LAnjSBki ebtw== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PubJa/+V8hViAx0y/wKLqFw0NrbSMBAwtOD95es24Zib8zzSwKqH woAfioVg4Nh9qXk+Bl7TeRhvriPd X-Google-Smtp-Source: APiQypImFpjAPrYRRnzUgC/id2NCCu5RTtdDlaTBniQ+UlFfHJm5sKzEMFMNLAhbo/g5kZt8ivk4WQ== X-Received: by 2002:a17:90a:db83:: with SMTP id h3mr21647446pjv.87.1589183730215; Mon, 11 May 2020 00:55:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:ca12:: with SMTP id x18ls16168383pjt.2.canary-gmail; Mon, 11 May 2020 00:55:29 -0700 (PDT) X-Received: by 2002:a17:90a:3b0c:: with SMTP id d12mr19981404pjc.78.1589183729596; Mon, 11 May 2020 00:55:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183729; cv=none; d=google.com; s=arc-20160816; b=Hl1vugrsE4Wq4Oxv3K8YCKXz9IijW32eAQUh9xbcoOH68mUZaLUPYPjjnPgVOnbeQv GfCnxrBRhuJGHGfUXsLFeG9y8nqNm1J/JspBvUsQ6lFcvsSeEHpUe8dcLpLAcetNPPjP avtBNdpDCUlfshK8O1IrEgA45kSKS/RQS0WUcTYf4VTp/KUS+KG8pGaDodMkS98d9pDo bSZBHSReaHiytPHiLceKUpoYxkSFoHogAj0CmlnkZ53WeetdZAHtkVhNfm3SlfBBb4rT ewrR5xP7OYgWzY6pnUUI7RHluW5jj+XMt9vseMERLkJn9zXBlIpVluR2ItX/77HXD3AN xifA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=UBuGY4J2YSmoEWCwFCKAx6HD7Tfx9/3EKMY0sXZuxBI=; b=BmZU4oGfOcxAbC7KHbhZYIgCnOvPl6slOnkEyIw7BU2yEqmquQkrgl5V4bTwMoGmey JMc0uLtxBKTwPas4gR1pLsuWIvb2EKX7PPHKhrUS/mc0R/KvlIu8wYIT97b2aN7wGDIL Wx5C2ihxbzfkoM0FSdkqTeIFB4eKvB2ulCOdBBA9GGGrlut4dfTwlLdmSEk5BQhW2J5o J2sCEipLqnHRAdFvchuwGoHRmqOyKpPuP6Ws/BwTYM+VcmNrWocyUqwd/GVw9dJ0jGhp 46exfmOTsu48QwcnPuM3U16ATQaG+m8mr6q5mZHeDDMaXimZRveioLvy2e33p/xMqNcI LkIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.130]) by mx.google.com with ESMTPS id c9si6935605pgk.423.2020.05.11.00.55.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:55:29 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) client-ip=211.157.147.130; Received: from localhost (unknown [192.168.167.8]) by lucky1.263xmail.com (Postfix) with ESMTP id 22FC4B4E8D; Mon, 11 May 2020 15:55:28 +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 P2949T140479804974848S1589183722650576_; Mon, 11 May 2020 15:55:28 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com Subject: [PATCH v4 09/16] usb: dwc3: Add disable u2mac linestate check quirk Date: Mon, 11 May 2020 15:55:13 +0800 Message-Id: <20200511075520.26557-5-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075520.26557-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> <20200511075520.26557-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Jagan Teki This patch adds a quirk to disable USB 2.0 MAC linestate check during HS transmit. Refer the dwc3 databook, we can use it for some special platforms if the linestate not reflect the expected line state(J) during transmission. When use this quirk, the controller implements a fixed 40-bit TxEndDelay after the packet is given on UTMI and ignores the linestate during the transmit of a token (during token-to-token and token-to-data IPGAP). On some rockchip platforms (e.g. rk3399), it requires to disable the u2mac linestate check to decrease the SSPLIT token to SETUP token inter-packet delay from 566ns to 466ns, and fix the issue that FS/LS devices not recognized if inserted through USB 3.0 HUB. Reference from below Linux commit, commit <65db7a0c9816> ("usb: dwc3: add disable u2mac linestate check quirk") Cc: Marek Vasut Signed-off-by: Jagan Teki --- drivers/usb/dwc3/core.c | 20 ++++++++++++++++++++ drivers/usb/dwc3/core.h | 7 +++++++ include/dwc3-uboot.h | 1 + 3 files changed, 28 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 3cb66515a2..dc92f471c1 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -725,6 +725,7 @@ int dwc3_uboot_init(struct dwc3_device *dwc3_dev) dwc->dis_u3_susphy_quirk = dwc3_dev->dis_u3_susphy_quirk; dwc->dis_u2_susphy_quirk = dwc3_dev->dis_u2_susphy_quirk; dwc->dis_del_phy_power_chg_quirk = dwc3_dev->dis_del_phy_power_chg_quirk; + dwc->dis_tx_ipgap_linecheck_quirk = dwc3_dev->dis_tx_ipgap_linecheck_quirk; dwc->dis_enblslpm_quirk = dwc3_dev->dis_enblslpm_quirk; dwc->dis_u2_freeclk_exists_quirk = dwc3_dev->dis_u2_freeclk_exists_quirk; @@ -934,6 +935,8 @@ void dwc3_of_parse(struct dwc3 *dwc) "snps,dis_u2_susphy_quirk"); dwc->dis_del_phy_power_chg_quirk = dev_read_bool(dev, "snps,dis-del-phy-power-chg-quirk"); + dwc->dis_tx_ipgap_linecheck_quirk = dev_read_bool(dev, + "snps,dis-tx-ipgap-linecheck-quirk"); dwc->dis_enblslpm_quirk = dev_read_bool(dev, "snps,dis_enblslpm_quirk"); dwc->dis_u2_freeclk_exists_quirk = dev_read_bool(dev, @@ -954,6 +957,7 @@ void dwc3_of_parse(struct dwc3 *dwc) int dwc3_init(struct dwc3 *dwc) { int ret; + u32 reg; dwc3_cache_hwparams(dwc); @@ -975,6 +979,22 @@ int dwc3_init(struct dwc3 *dwc) goto event_fail; } + if (dwc->revision >= DWC3_REVISION_250A) { + reg = dwc3_readl(dwc->regs, DWC3_GUCTL1); + + /* + * Enable hardware control of sending remote wakeup + * in HS when the device is in the L1 state. + */ + if (dwc->revision >= DWC3_REVISION_290A) + reg |= DWC3_GUCTL1_DEV_L1_EXIT_BY_HW; + + if (dwc->dis_tx_ipgap_linecheck_quirk) + reg |= DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS; + + dwc3_writel(dwc->regs, DWC3_GUCTL1, reg); + } + ret = dwc3_core_init_mode(dwc); if (ret) goto mode_fail; diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index c5e656885a..b510d8a983 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -73,6 +73,7 @@ #define DWC3_GCTL 0xc110 #define DWC3_GEVTEN 0xc114 #define DWC3_GSTS 0xc118 +#define DWC3_GUCTL1 0xc11c #define DWC3_GSNPSID 0xc120 #define DWC3_GGPIO 0xc124 #define DWC3_GUID 0xc128 @@ -159,6 +160,10 @@ #define DWC3_GCTL_GBLHIBERNATIONEN (1 << 1) #define DWC3_GCTL_DSBLCLKGTNG (1 << 0) +/* Global User Control 1 Register */ +#define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS BIT(28) +#define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24) + /* Global USB2 PHY Configuration Register */ #define DWC3_GUSB2PHYCFG_PHYSOFTRST (1 << 31) #define DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS (1 << 30) @@ -771,6 +776,7 @@ struct dwc3 { #define DWC3_REVISION_260A 0x5533260a #define DWC3_REVISION_270A 0x5533270a #define DWC3_REVISION_280A 0x5533280a +#define DWC3_REVISION_290A 0x5533290a enum dwc3_ep0_next ep0_next_event; enum dwc3_ep0_state ep0state; @@ -824,6 +830,7 @@ struct dwc3 { unsigned dis_u3_susphy_quirk:1; unsigned dis_u2_susphy_quirk:1; unsigned dis_del_phy_power_chg_quirk:1; + unsigned dis_tx_ipgap_linecheck_quirk:1; unsigned dis_enblslpm_quirk:1; unsigned dis_u2_freeclk_exists_quirk:1; diff --git a/include/dwc3-uboot.h b/include/dwc3-uboot.h index 193d225d31..e08530ec4e 100644 --- a/include/dwc3-uboot.h +++ b/include/dwc3-uboot.h @@ -34,6 +34,7 @@ struct dwc3_device { unsigned dis_u3_susphy_quirk; unsigned dis_u2_susphy_quirk; unsigned dis_del_phy_power_chg_quirk; + unsigned dis_tx_ipgap_linecheck_quirk; unsigned dis_enblslpm_quirk; unsigned dis_u2_freeclk_exists_quirk; unsigned tx_de_emphasis_quirk; From patchwork Mon May 11 07:57:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1175 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id B4E3B3F08B for ; Mon, 11 May 2020 09:57:32 +0200 (CEST) Received: by mail-pl1-f197.google.com with SMTP id c3sf6782758plz.13 for ; Mon, 11 May 2020 00:57:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183851; cv=pass; d=google.com; s=arc-20160816; b=bmXvk7j2krrC6Tct4Y0EeO+muuqJMdUNd0N5QbYAdpCAO1JiH5rEWxudERFmMMRQbe SsPQmATZHhwDiV0l9jO/OMUqvt6+KavDHH4UgOLR6ICTcGs+jATXSraRib4Rx6M4Mfaf E+eN6KKxT1RMCDGLa4V221Nb+tjmfzMxeLk10h8xhW5Qygo6hKD5QiOy4DO2OAGRaMfu XVuj021wU5+WYJVq+B0QTyH1H2AJz9dPS2P0mfSwo3NYYUjERmcUYR0LLokEz+Nch3Sp ilfzuTWcT21ueG5F8LqkgbOq6Mz3erlNlTdmbt9kC7VS3Wx8cEJioCX82qv4NlasXMLQ corA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=XbSuLXaa8Ac7D/kfp5DET+CwySahkL64eB7yKl/+Jts=; b=MpHc5jLmxnzVqYrOIYusxbFEjAHc7mNIDtatWxu+wtgRGfpNLgG4tfHSBvzAXHQnOD cgA7cAdJmEobg8IQuWCc6h+z5ALo0xAPQWN06v9znL6Zuq9mKqof4az80EEL/kIGZtfk GuIor4/H1gioHbSShmWVp6fjuBqrCm5HYmNXpSXc1Tnt4pTTY58PlIotqwUDEGwQyitX rIEtIGv5KRsznoOoCbAGhsdyoZlGxqKAe6Ha9m02dqCeFYR79Wa4dZRA+jup00L1zXZ2 XfZgoHgrMQqxie6Cg1FgBVKW+bNkbKa8g3jUh2PT1YYYxl+f+DkB7CnC6aOtU1xDsB7R xZQg== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.135 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=XbSuLXaa8Ac7D/kfp5DET+CwySahkL64eB7yKl/+Jts=; b=iyRZaPKDpQ3ufwkjTdp0dOyf5LQ+UuWPAVvyCN2WNe0MGGwPhiWkHpqKBdz0uS0npy EXYfeoSBnJKkMNm8ruC85zOj5ZXcTCfoDGz5KHXTrfmJnBV/yzbqDpqcz94SG628K56C Nq3VHVSfLz523amEzmiZgW+qW5yV1vwZrGS90= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=XbSuLXaa8Ac7D/kfp5DET+CwySahkL64eB7yKl/+Jts=; b=gVDr9h5SIt2mc/ZLLcKWzqK93T+uwlQ2x9C1/FADNDL6HBCDzd49wrFD1EjKSe1dfN /RfeBdtN89ZT87sPHE7VEtz781z6jzsjIAFVluSIvwhpJj/aPkviqoRUWbob2+G6QMUP h47bhgCt1iKPQwHKkD1xQ+/21dvMGkgVEkkgr+SZbPx/NgvEunRwifa1dVYIIZllVbjP V0pa3FLrOxrtxadeeOooiGHMUJkZ2YqcA7WFlqViRFnJcmGOTyK+xGA/pwy3xg0l2MXX jPDoXVOIDhpW/uLVTPcuTRSIv/n+juGYnkUw1+h8WKehP8iOEjoB6i0nE3IvzKeCxszT XBxQ== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuZ8wOUJS9eKB5ab+rkr4y3Q5a4AeEAd7BxqENuNECtIeuk4eZak /jLjjRMmZMQdUWf3mxJFx7Ijy5Ih X-Google-Smtp-Source: APiQypJlXOG56K1/dNH3fCc5EljEMW9OFY7CcQ/lOzudsSPjyRy6dtIzLULAgg86KQnxwcCf1nNOew== X-Received: by 2002:a62:1a53:: with SMTP id a80mr15401937pfa.157.1589183851499; Mon, 11 May 2020 00:57:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:8a98:: with SMTP id x24ls16186857pjn.0.gmail; Mon, 11 May 2020 00:57:31 -0700 (PDT) X-Received: by 2002:a17:90a:17ed:: with SMTP id q100mr18963044pja.80.1589183850864; Mon, 11 May 2020 00:57:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183850; cv=none; d=google.com; s=arc-20160816; b=II95MjwxOk8HnJaFH1xfYoxUdKJ7WSGpg7yf8BOH5QgraXW2nHw3KgeBO7gnKOxWZQ /ULUg5L+BEQSz4xZpTUooIFE2vLJbGNlCeqzZADpqSHKQwB5rULSXEZRHMT3+QJhzbIf o9NKMPcmXmvbpWMeparOocmpe0096BoyHlLewFKmkVEUx/89LopfHljzf1dFqswxFiI7 4T7ZZ6Ox9GkTO2oPWtlektteuZKHGHztSYJUGOx/3D6xKFVByvlmOPMphZ/M347rgN1m WU9cQYM3J8qGHpybJJ9P18R3DmP9i24UlKs3FUQeXNKPzMB69OtaLMdlpNiQxlF2l45d D+Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=IqRG4xhsD1aVTUBhCfrrb0VlWbUZWEKZJAMcYROTSGo=; b=wG/EqwXl8InXqpoPH0VzfsL2WPlOqxNAlT6PKooG0SXpkjp9SI5kJhKOe/nHjZFvAD wL+1epF6lMACKRy7mGxobbQxI4rW2I+Jsv77bYc7rEfT0V8gfDnii0tvbdUYe72PUJb8 P2ig5W+ycDkQ4WyOFfT/WiwwDAzYsPY3x7O3Iylkg7uZhXTJkB3g/mRvOgPAuG5/uyeB R9uz2gSxLvI4tOK/N9TJvhiDNFy5rh8us3qqznZ7XZpE5x+VzoeKSe0672A0ry945zhK 8g8lVOzNRHSXAP0R99vdcpnN9n2gh8u7FagMUKQ3G6pbNUZDmpzxURzeVIkDT65Ugr+j XTYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.135 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.135]) by mx.google.com with ESMTPS id m12si7330088pfd.125.2020.05.11.00.57.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:57:30 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.135 as permitted sender) client-ip=211.157.147.135; Received: from localhost (unknown [192.168.167.209]) by lucky1.263xmail.com (Postfix) with ESMTP id D604882477; Mon, 11 May 2020 15:57:28 +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 P21665T139939416696576S1589183847395463_; Mon, 11 May 2020 15:57:29 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com Subject: [PATCH v4 10/16] usb: dwc3: Enable AutoRetry feature in the controller Date: Mon, 11 May 2020 15:57:19 +0800 Message-Id: <20200511075725.26665-1-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075330.26462-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.135 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Jagan Teki By default when core sees any transaction error (CRC or overflow) it replies with terminating retry ACK (Retry=1 and Nump == 0). Enabling this Auto Retry feature in controller will make the core send a non-terminanting ACK upon such transaction errors. That is, ACK TP with Retry=1 and Nump != 0. Doing so will give controller a chance to recover from transient error conditions. Reference from below Linux commit, commit ("usb: dwc3: core: Enable AutoRetry feature in the controller") Cc: Marek Vasut Signed-off-by: Jagan Teki --- drivers/usb/dwc3/core.c | 9 +++++++++ drivers/usb/dwc3/core.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index dc92f471c1..aab6c34c2d 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -995,6 +995,15 @@ int dwc3_init(struct dwc3 *dwc) dwc3_writel(dwc->regs, DWC3_GUCTL1, reg); } + if (dwc->dr_mode == USB_DR_MODE_HOST || + dwc->dr_mode == USB_DR_MODE_OTG) { + reg = dwc3_readl(dwc->regs, DWC3_GUCTL); + + reg |= DWC3_GUCTL_HSTINAUTORETRY; + + dwc3_writel(dwc->regs, DWC3_GUCTL, reg); + } + ret = dwc3_core_init_mode(dwc); if (ret) goto mode_fail; diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index b510d8a983..2adcaf0029 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -160,6 +160,9 @@ #define DWC3_GCTL_GBLHIBERNATIONEN (1 << 1) #define DWC3_GCTL_DSBLCLKGTNG (1 << 0) +/* Global User Control Register */ +#define DWC3_GUCTL_HSTINAUTORETRY BIT(14) + /* Global User Control 1 Register */ #define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS BIT(28) #define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24) From patchwork Mon May 11 07:57:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1176 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 91E7B3F9E5 for ; Mon, 11 May 2020 09:57:33 +0200 (CEST) Received: by mail-pg1-f200.google.com with SMTP id 85sf7162499pgh.13 for ; Mon, 11 May 2020 00:57:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183852; cv=pass; d=google.com; s=arc-20160816; b=LHou1qYaFg8JTaGFwzEY/Nz43vv52ENpUqhRyysA7Ks1iMq/7vIy+v0ss3WVJg6MAH +rKFH0x3EmWYPZXqNnrkEjTLAUw/+Idx+of46HmRsn56Ysmm1W608+3X8rEqaMKW22uI m/HGsHCjM8YQntqqytX0loEHNQb6KYP6mD1KFelQ6eJ92Qs/ohMoDJAhQQCnQdVVaA5v 97X9XnUwQ5/mUN5eQGkdyRoquU7DmXAMu4KzsUCuR/OVb+83IykTpZjXU4Hs+rIE9VKC 1/C8GI8FU5ykcDJFmkQXjcz8SjefJoIN1Z7sBR8eN1qTzFxz1ctLngSU+V5kmZSH8Qm/ zYfQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=Y+t9WiIYNgMGLObOa5j65NZsgsFCAMB3iKOgw7HWQc0=; b=yIWFgPkanzRNBlFOffG86IYmZpiODvfaRN06od8foFS/ntB/YQSXGBxPpkU2QbKwSW axvOwl7MyAdG21wG2+vZSimr2Zpsdf8Jg1tjJssAjlfd1B46D+OQ1ZLDegIgjK1udH9l 3G/LVLjalFyN6BYNxkLaOJvSGySy/QKUn4xRCwScQeHNWEoMq8Q/cB0qIUn0g6ohv+OC +pCPePwJRunOhhfc6ts7FeZ6dkOL6raKzGcucZuyIWK/AzVjd6FVSNdsDPx9gFfcBh8g YkI14VhDrQ9hSztpkfRCPIOO8Y+ZfxgbxNfzZxLW7ws4kJgJAsYzTh8DHLPdRhvK6X7M wh4Q== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=Y+t9WiIYNgMGLObOa5j65NZsgsFCAMB3iKOgw7HWQc0=; b=fXWyCml5AyvurHUz2S75BOo4AFKlpCA2FeNZpA09fEpryLxNgwdOYpxhdgV0Olhkkg Et2HmgpxdXmK+g0AJP6weVh1o+6qcQ6gsREYgOtMa6fD9Qdn/1xuz7JcFJ8+yDKBqIWo NfWRKrjfP0kv5JXv40NY6P4hfc3VNQCRE2myg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=Y+t9WiIYNgMGLObOa5j65NZsgsFCAMB3iKOgw7HWQc0=; b=fDNxyAExTUJK9JI4p+dRhvWdJy/NvBEh8UgUUKEEKNYEvVlyPOF4OkUtfNqcjQujhM bbUw1U7C5+8pfRkd5OOnfmdMg9DgozBz06ApyP2GshmXBZppJPj3tWeRm8Mf5i27dD+Q BEJ7V0jIqo4kPCnSWrZT7M/IreDtMQ11ipanBZ8+hz0n6lhv8EXGN/ab11Hn0QRZtx3l rj96rcarIiTvYFwuA55TPkYT1Z1PqtEbehX12ZK+izVo7U5j54udhn5Mdf+qxsGyFcZi jtOGVvMLI/RraDvDEUxSE/43xWwouucBTX8XZAJ4F5heuqgtEiSFXKuy6FF3ZrnAahVx Uc4w== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuZrZGW5llX8oIfWlkocmv2OH/d7ItNiLfAuf1d38tv8lo7V0u2q mIThauVlVFFl3dZ5io3zWWuJa4Ft X-Google-Smtp-Source: APiQypKJu9TyPGM2i7hGaEC9dWt9fEQdl+1C+tukRZ5OvtApMjENL2AvS6eQQ7azATqFmDMSgJCA5Q== X-Received: by 2002:a17:902:7b94:: with SMTP id w20mr13619091pll.8.1589183852328; Mon, 11 May 2020 00:57:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:d713:: with SMTP id w19ls4627883ply.9.gmail; Mon, 11 May 2020 00:57:31 -0700 (PDT) X-Received: by 2002:a17:902:bd42:: with SMTP id b2mr13252422plx.219.1589183851640; Mon, 11 May 2020 00:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183851; cv=none; d=google.com; s=arc-20160816; b=xV514G+eT+x3UU4sgBdp77rd55q7MHJOgDIeQ1WkkMXu/tT3bZbK36aBtGjizBqvJ9 JiuwHfRixYYdsPlxatlnGyAZ9LVVdXefhx2YTLqVV0opVR78IkcYy9UAmUpHVCkT+tFs r3LTKcpFeTdefq1sn8dI/nkUTNJs5cSnM0MhVJtRQ9De3XwERpGKoqjxvXItGFvEFTEZ 5xP6OKK1afC+wddkD3J8rszkvtfgE1tFJHfEVqUWgh2BCXu84m6bvJkNsG2iHXTKzJQ+ wU8Hr69NeqGf8CRRe5A8/SytAjbrLAuIfiRPOUKYOGFIirIbPON0H4MUTcHpABdpXGOF dnkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=DmO9DBjp+hKN7UwAEdLFRtwja++CTi65mocqrIvVcvg=; b=cMCtMFxfsBDqAaVttC9ddhhRfPKl2A8E5kIT1YXRzmEz3dY2dQqAd03/s9COuLuOnQ qdsKG6aKzODlrQcuoersDeEIKimAiDy8nlw7YSybxLSpQ3XkAuoaCxNGBncEhqMQaMmF Ed3+zooe3hx+RTSUUUorX2Nml08yKNmPz2NIpTU4Z8mzWNIMeXoJJUow9bsivmQrsCYq EfOYEyOxMV+aDi/IstTJ1GYdofvequa8qId8rmEBfvWvmqtPOsQcyWmEqLdl9DJJ/J/r Hh+3alu7qyM6iDyg2RB7hevx8Zm/vEkMfPtmnFvt6lCRCsOaO9g4XYUp1Z4b48444cRX 9UOA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.130]) by mx.google.com with ESMTPS id q19si6874148pfs.107.2020.05.11.00.57.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:57:31 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) client-ip=211.157.147.130; Received: from localhost (unknown [192.168.167.209]) by lucky1.263xmail.com (Postfix) with ESMTP id 1FCBBB4E4B; Mon, 11 May 2020 15:57:30 +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 P21665T139939416696576S1589183847395463_; Mon, 11 May 2020 15:57:30 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com, Frank Wang Subject: [PATCH v4 11/16] usb: dwc3: amend UTMI/UTMIW phy interface setup Date: Mon, 11 May 2020 15:57:20 +0800 Message-Id: <20200511075725.26665-2-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075725.26665-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> <20200511075725.26665-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.130 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Let move 8/16-bit UTMI+ interface initialization into DWC3 core init that is convenient for both DM_USB and u-boot traditional process. Signed-off-by: Frank Wang Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- drivers/usb/common/common.c | 25 ++++++++++++++ drivers/usb/dwc3/core.c | 65 +++++++++++++++++++------------------ drivers/usb/dwc3/core.h | 5 +++ include/linux/usb/phy.h | 18 ++++++++++ 4 files changed, 82 insertions(+), 31 deletions(-) diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index 0db281b970..d4ae18693c 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c @@ -10,6 +10,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -64,3 +65,27 @@ enum usb_device_speed usb_get_maximum_speed(ofnode node) return USB_SPEED_UNKNOWN; } + +#if CONFIG_IS_ENABLED(DM_USB) +static const char *const usbphy_modes[] = { + [USBPHY_INTERFACE_MODE_UNKNOWN] = "", + [USBPHY_INTERFACE_MODE_UTMI] = "utmi", + [USBPHY_INTERFACE_MODE_UTMIW] = "utmi_wide", +}; + +enum usb_phy_interface usb_get_phy_mode(ofnode node) +{ + const char *phy_type; + int i; + + phy_type = ofnode_get_property(node, "phy_type", NULL); + if (!phy_type) + return USBPHY_INTERFACE_MODE_UNKNOWN; + + for (i = 0; i < ARRAY_SIZE(usbphy_modes); i++) + if (!strcmp(phy_type, usbphy_modes[i])) + return i; + + return USBPHY_INTERFACE_MODE_UNKNOWN; +} +#endif diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index aab6c34c2d..c8cb9e13b2 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -334,6 +334,34 @@ static void dwc3_cache_hwparams(struct dwc3 *dwc) parms->hwparams8 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS8); } +static void dwc3_hsphy_mode_setup(struct dwc3 *dwc) +{ + enum usb_phy_interface hsphy_mode = dwc->hsphy_mode; + u32 reg; + + /* Set dwc3 usb2 phy config */ + reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); + + switch (hsphy_mode) { + case USBPHY_INTERFACE_MODE_UTMI: + reg &= ~(DWC3_GUSB2PHYCFG_PHYIF_MASK | + DWC3_GUSB2PHYCFG_USBTRDTIM_MASK); + reg |= DWC3_GUSB2PHYCFG_PHYIF(UTMI_PHYIF_8_BIT) | + DWC3_GUSB2PHYCFG_USBTRDTIM(USBTRDTIM_UTMI_8_BIT); + break; + case USBPHY_INTERFACE_MODE_UTMIW: + reg &= ~(DWC3_GUSB2PHYCFG_PHYIF_MASK | + DWC3_GUSB2PHYCFG_USBTRDTIM_MASK); + reg |= DWC3_GUSB2PHYCFG_PHYIF(UTMI_PHYIF_16_BIT) | + DWC3_GUSB2PHYCFG_USBTRDTIM(USBTRDTIM_UTMI_16_BIT); + break; + default: + break; + } + + dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); +} + /** * dwc3_phy_setup - Configure USB PHY Interface of DWC3 Core * @dwc: Pointer to our controller context structure @@ -382,6 +410,8 @@ static void dwc3_phy_setup(struct dwc3 *dwc) dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg); + dwc3_hsphy_mode_setup(dwc); + mdelay(100); reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); @@ -626,35 +656,6 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc) dwc3_gadget_run(dwc); } -static void dwc3_uboot_hsphy_mode(struct dwc3_device *dwc3_dev, - struct dwc3 *dwc) -{ - enum usb_phy_interface hsphy_mode = dwc3_dev->hsphy_mode; - u32 reg; - - /* Set dwc3 usb2 phy config */ - reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); - - switch (hsphy_mode) { - case USBPHY_INTERFACE_MODE_UTMI: - reg &= ~(DWC3_GUSB2PHYCFG_PHYIF_MASK | - DWC3_GUSB2PHYCFG_USBTRDTIM_MASK); - reg |= DWC3_GUSB2PHYCFG_PHYIF(UTMI_PHYIF_8_BIT) | - DWC3_GUSB2PHYCFG_USBTRDTIM(USBTRDTIM_UTMI_8_BIT); - break; - case USBPHY_INTERFACE_MODE_UTMIW: - reg &= ~(DWC3_GUSB2PHYCFG_PHYIF_MASK | - DWC3_GUSB2PHYCFG_USBTRDTIM_MASK); - reg |= DWC3_GUSB2PHYCFG_PHYIF(UTMI_PHYIF_16_BIT) | - DWC3_GUSB2PHYCFG_USBTRDTIM(USBTRDTIM_UTMI_16_BIT); - break; - default: - break; - } - - dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); -} - #define DWC3_ALIGN_MASK (16 - 1) /** @@ -743,6 +744,8 @@ int dwc3_uboot_init(struct dwc3_device *dwc3_dev) dwc->hird_threshold = hird_threshold | (dwc->is_utmi_l1_suspend << 4); + dwc->hsphy_mode = dwc3_dev->hsphy_mode; + dwc->index = dwc3_dev->index; dwc3_cache_hwparams(dwc); @@ -767,8 +770,6 @@ int dwc3_uboot_init(struct dwc3_device *dwc3_dev) goto err0; } - dwc3_uboot_hsphy_mode(dwc3_dev, dwc); - ret = dwc3_event_buffers_setup(dwc); if (ret) { dev_err(dwc->dev, "failed to setup event buffers\n"); @@ -901,6 +902,8 @@ void dwc3_of_parse(struct dwc3 *dwc) */ hird_threshold = 12; + dwc->hsphy_mode = usb_get_phy_mode(dev->node); + dwc->has_lpm_erratum = dev_read_bool(dev, "snps,has-lpm-erratum"); tmp = dev_read_u8_array_ptr(dev, "snps,lpm-nyet-threshold", 1); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 2adcaf0029..8e562ae6c4 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -21,6 +21,7 @@ #include #include +#include #define DWC3_MSG_MAX 500 @@ -658,6 +659,9 @@ struct dwc3_scratchpad_array { * @maximum_speed: maximum speed requested (mainly for testing purposes) * @revision: revision register contents * @dr_mode: requested mode of operation + * @hsphy_mode: UTMI phy mode, one of following: + * - USBPHY_INTERFACE_MODE_UTMI + * - USBPHY_INTERFACE_MODE_UTMIW * @dcfg: saved contents of DCFG register * @gctl: saved contents of GCTL register * @isoch_delay: wValue from Set Isochronous Delay request; @@ -749,6 +753,7 @@ struct dwc3 { size_t regs_size; enum usb_dr_mode dr_mode; + enum usb_phy_interface hsphy_mode; /* used for suspend/resume */ u32 dcfg; diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index 158ca9cd85..1e1217a958 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h @@ -10,10 +10,28 @@ #ifndef __LINUX_USB_PHY_H #define __LINUX_USB_PHY_H +#include + enum usb_phy_interface { USBPHY_INTERFACE_MODE_UNKNOWN, USBPHY_INTERFACE_MODE_UTMI, USBPHY_INTERFACE_MODE_UTMIW, }; +#if CONFIG_IS_ENABLED(DM_USB) +/** + * usb_get_phy_mode - Get phy mode for given device_node + * @np: Pointer to the given device_node + * + * The function gets phy interface string from property 'phy_type', + * and returns the corresponding enum usb_phy_interface + */ +enum usb_phy_interface usb_get_phy_mode(ofnode node); +#else +static inline enum usb_phy_interface usb_get_phy_mode(ofnode node) +{ + return USBPHY_INTERFACE_MODE_UNKNOWN; +} +#endif + #endif /* __LINUX_USB_PHY_H */ From patchwork Mon May 11 07:57:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1178 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 4F8063F9E5 for ; Mon, 11 May 2020 09:57:35 +0200 (CEST) Received: by mail-pj1-f70.google.com with SMTP id l11sf16582989pjz.4 for ; Mon, 11 May 2020 00:57:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183854; cv=pass; d=google.com; s=arc-20160816; b=tJlV6qhsGaEuJKbXIDlNCGIj3pHa5K+OwPYdzykIVMb+cR5CTYohIy6xUe3EnT3CLd ikJMgQ7LVG4zSjgA2kzQpvlx2bZ/eApr/6kIaufqEulFVkNCDqll78RVB1mfU6k8zu7F oHu4ijhYczXW7RblBjnMghWXjtGynuIjKe1KuYIMmK+dGGyldvAac9JQ4y5hj9GpMY61 8wrObGtbbjRfQcWybv+vuf3SZg0OeyOvIviuehwhSonqUKt486yhO/aYrwXTS0E4XfAm YZ2UpYTffU3ZZrtvbiur5mLEXgIhTfnhiZVIJWhmcWYDSTuCOMVDu6g+haCpNGEt+Bdu rhvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=NGIv+ek+GCnfSEv+ZMQXmcjvAcezHwldlpCU+GINmiI=; b=Yr/srR5wxqVF56KdW9qfgFdyroLSR7/Zv7Tlvg9iVgKsaweCmFMAmpZMZzvTruBi/e f35cOTMmljTydF/6G8HirRx3X8Ybm1zlsY480Z55BjEDpz4ox3/cWgTAEpf+WZw0RyFq KIIn2I6febCzTuk3ZU72jxeBComi1/9YvHXbtA7WZ2jGsh2R0S7tfsM5LADjUXXNaxUs 1GxKIowt+1UmIIVPWD1xOjc/64pF+z+tOQNVt3vyeqJLaOc6Z9zyGuqm/mwCRAxrwTmN qA9P5gNmS8+j0Uh6AikUYqaLgSNQD3oz7LKvc0FyncpBFfZt1zQom3DyX1Yz9/96SGVx 06WA== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.134 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=NGIv+ek+GCnfSEv+ZMQXmcjvAcezHwldlpCU+GINmiI=; b=PiQO6tRCIIyGQTuYzUeZhat23DmIhj2GTrRDWnzJrK1+pdmZOoPB+EGDXSvJ/MjDdZ +ZsAH5a31r9pw/bf6nBUAN/0sQ2C9ZZoPubcLrobymZMeWLZ2ZU+9yOeBhdq7f3BKn9A snL32jeHLegOyp2Lw9t8lnO5aKiNcSLysoBKg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=NGIv+ek+GCnfSEv+ZMQXmcjvAcezHwldlpCU+GINmiI=; b=Cbd5TenvmXQfT2I5sCMEBtfCerhnJl7Svcmn8jf+tRkzZCuJDWnULXxToNagxqy/hF 8p8z9If52G5rXB9Cyx5xcYbQsRlN+aFLQpZ4bZNw9wViieYzjYWCiD8ODBJUX57kLPfU anrbHnZ5drvvFB/lXkoV3olnPcPpqq8Oqbd0YWVaIxc2Ix9onaRssTouhUDzYp9PSS54 xpItu70PpZNKOSuz7m3ndMle4lIpCoZItrOtKeFzABy1kqCUQHPomaw7yHbOoRNfvdaf zVnp8TGSnf1Gr0jasUiq2JMq1lsZMMA9rRLpSTozjtLn+BpFf+oCKowtIyVz8ig+V31c nwQA== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0Pub04ysm+T5NclsFMlP/lO2KQf0w+2dwBQ779nxQ3TjboJZdxI0s GTjQpF7vhTqLkTHgk01tV5eblj/f X-Google-Smtp-Source: APiQypKDq3Krt6VwWvmtqyU1uXnzbyzhqGPKb8Rot2YqH94GhiKP4oIcnq49rj1mTtCnO1zZ5AJzIg== X-Received: by 2002:aa7:9d90:: with SMTP id f16mr15449585pfq.48.1589183854082; Mon, 11 May 2020 00:57:34 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:7b82:: with SMTP id w2ls4672581pll.1.gmail; Mon, 11 May 2020 00:57:33 -0700 (PDT) X-Received: by 2002:a17:90b:3751:: with SMTP id ne17mr20101190pjb.114.1589183853674; Mon, 11 May 2020 00:57:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183853; cv=none; d=google.com; s=arc-20160816; b=VxAdfwLaezFfiI3/PN7hDfj5HBRsCBcKYchY/9topnrAw+IUI4ElTiB03vQgRT9QUS Sg1ocJ5nknqlnzGa+Uyjy+p29Q97Nxo1U56c4RjJh+/OBptIZlyV21bQBPPeTq10JwUy 880RkFv/KdJrVO8IUnH4L0qHC8fTAGr+c1il7MD19FaAuN0J6CCCaPLgu7yVOFUDqCMq 4kMvuRnuRdEKsOQ7PinxQ4lTsnFWKRgRMrli/Wucb2oNDXa/UmSzS0I0GGYX6AwQSESm J3Mgo45glkpwNiCqzAEdbUUQhqbW49d0zjSo+HHYcgvMoif2WxXs/qNW6gbTdtBAmJR+ /MBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=36aEMnW5RrfrLCDZ/dxiJwsiQY1IO4K+MMt/lPSgVAM=; b=ixDCjkz5BA8nkA9ln6O0+Oa2ZfV61koRX/oOgb4Uymb+/+HoGvMziXwAxckgBbjo7j Exx7iXWeXaSkuXE/qzxz8P8fOX3zIFffZHzIV+6xult9rFFiEWmC3yu6VUgO2hj0ZXUR 07w1MQwl5SKR225T33FWHOvbroJRtt/AkvDfz1U0DhYOb2PaWqx+TcAFW3zedgSpBjJi /A02jJ8heAEIfjFwjoamOMywholMAnC8EWBOymJ7fg54Hg03d7GJcIE8Myt4WawDFD4+ c49DbdhyTGv/6mgoO43V7fZUgBEHQ3YKP60CKFtK3ZmkHEdk/BSyLp1fezTrSp1aC9Wz XWLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.134 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.134]) by mx.google.com with ESMTPS id y7si7603314pju.71.2020.05.11.00.57.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:57:33 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.134 as permitted sender) client-ip=211.157.147.134; Received: from localhost (unknown [192.168.167.209]) by lucky1.263xmail.com (Postfix) with ESMTP id 9D291A4C9F; Mon, 11 May 2020 15:57:31 +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 P21665T139939416696576S1589183847395463_; Mon, 11 May 2020 15:57:31 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <676c015d1c9f8c67e14285f35cea79ff> X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com, Frank Wang Subject: [PATCH v4 12/16] usb: dwc3: add make compatible for rockchip platform Date: Mon, 11 May 2020 15:57:21 +0800 Message-Id: <20200511075725.26665-3-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075725.26665-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> <20200511075725.26665-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.134 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , RK3399 Type-C PHY is required that must hold whole USB3.0 OTG controller in resetting to hold pipe power state in P2 before initializing the PHY. This commit fixed it and added device compatible for rockchip platform. Signed-off-by: Frank Wang Signed-off-by: Jagan Teki --- drivers/usb/dwc3/dwc3-generic.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index eabd53a36d..359460eb13 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -24,6 +24,12 @@ #include #include +struct dwc3_glue_data { + struct clk_bulk clks; + struct reset_ctl_bulk resets; + fdt_addr_t regs; +}; + struct dwc3_generic_plat { fdt_addr_t base; u32 maximum_speed; @@ -47,6 +53,7 @@ static int dwc3_generic_probe(struct udevice *dev, int rc; struct dwc3_generic_plat *plat = dev_get_platdata(dev); struct dwc3 *dwc3 = &priv->dwc3; + struct dwc3_glue_data *glue = dev_get_platdata(dev->parent); dwc3->dev = dev; dwc3->maximum_speed = plat->maximum_speed; @@ -55,10 +62,22 @@ static int dwc3_generic_probe(struct udevice *dev, dwc3_of_parse(dwc3); #endif + /* + * It must hold whole USB3.0 OTG controller in resetting to hold pipe + * power state in P2 before initializing TypeC PHY on RK3399 platform. + */ + if (device_is_compatible(dev->parent, "rockchip,rk3399-dwc3")) { + reset_assert_bulk(&glue->resets); + udelay(1); + } + rc = dwc3_setup_phy(dev, &priv->phys); if (rc) return rc; + if (device_is_compatible(dev->parent, "rockchip,rk3399-dwc3")) + reset_deassert_bulk(&glue->resets); + priv->base = map_physmem(plat->base, DWC3_OTG_REGS_END, MAP_NOCACHE); dwc3->regs = priv->base + DWC3_GLOBALS_REGS_START; @@ -186,12 +205,6 @@ U_BOOT_DRIVER(dwc3_generic_host) = { }; #endif -struct dwc3_glue_data { - struct clk_bulk clks; - struct reset_ctl_bulk resets; - fdt_addr_t regs; -}; - struct dwc3_glue_ops { void (*select_dr_mode)(struct udevice *dev, int index, enum usb_dr_mode mode); @@ -394,6 +407,12 @@ static int dwc3_glue_probe(struct udevice *dev) if (ret) return ret; + if (glue->resets.count < 1) { + ret = dwc3_glue_reset_init(child, glue); + if (ret) + return ret; + } + while (child) { enum usb_dr_mode dr_mode; @@ -424,6 +443,8 @@ static const struct udevice_id dwc3_glue_ids[] = { { .compatible = "ti,dwc3", .data = (ulong)&ti_ops }, { .compatible = "ti,am437x-dwc3", .data = (ulong)&ti_ops }, { .compatible = "ti,am654-dwc3" }, + { .compatible = "rockchip,rk3328-dwc3" }, + { .compatible = "rockchip,rk3399-dwc3" }, { } }; From patchwork Mon May 11 07:57:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1177 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 44E163F08B for ; Mon, 11 May 2020 09:57:35 +0200 (CEST) Received: by mail-pl1-f199.google.com with SMTP id c3sf6782814plz.13 for ; Mon, 11 May 2020 00:57:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183854; cv=pass; d=google.com; s=arc-20160816; b=qP9+nnh1KMZk4/+gZob8xjJGUKubnL6LT5zbyZmLZ5us67qXh3Hew2fN/6IoYvDBt5 3pc4vDW6FWuTFRHMI9QJg3ESj4eIhKXTPzj/AluoW57QVDcia1AJDS1b00S8WCvJZ/xw j5nc1O0a0cbqQfNvRdJ4t3s/nXZsmpdDPtVQR0u+Ee/0vxB4Bx4CI8R0r+qKd870Ap5i UB5K2QZmsTceyhkGMhWHKLi+9jjziUoEaxZpHoI/N6DC6S+jGe9mD7emkxQBd0qfDqol a1p94WaiolHxbTnwg3616m+jpsQDHg4IgbKRhZ2Ax+RDUfM/MvsJHBmAO2cF7D+TaB8F d6YQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=d0SB3aTUd19bg2a4MG4AqnXF9C1S5PuzUbNz6JPp0tU=; b=nIcvy9rfNgKKeyoTNI54nNdx7/IR+5h60h1MIxdXlMh+QOtDkTDIUY36ebcUzSR9UH fb+iGeo9RY/gPzPJAvZWPOXHro5T7UYjwXl/wk9TzWqrBHonyYrHFNFMW45JR9s7qgNu FnU1FxZXlYk2+AvXnDxhOSdnqfrAadUOVLcirGy4YpCMk7U1R8FjUP/WDtaJ/TgfM2oK Cio6s7JbbNrYRm0wYxGhQ3ejrns5/OypDRlt9qGnRMYeMfdd9XwOV6FCJiUGjzO/gxiC OK2BMymw/S0OFjPMWaUk0Xp3xHqGpE13kUyak3TCO6YHJpV4fXO78KrrCRtWgrhHY29Q kdDg== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.131 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=d0SB3aTUd19bg2a4MG4AqnXF9C1S5PuzUbNz6JPp0tU=; b=q9CMLvAU5wduuyQRM6zc2zPYsPSx/YFE1Ett/rjE5WqFOf5/oWAgVe+lVUjC2LM3wo 8mFtQbPJd3Kc3LIH7pNU5HYVSPs6eMLTmASb8WCMxdIZMroTfa2IU0niT1zrDFMx6AA4 dMjzBhk/VMTPiG8CQ7WiqDhDXmFREZoQr4yn0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=d0SB3aTUd19bg2a4MG4AqnXF9C1S5PuzUbNz6JPp0tU=; b=g1ryeIGrcPiVhaBbrgssIGQc9jRwbSTN+7mh7PL1seIfwBSjdUOuhARuAhXUkuI7tb l1Zxr377qPu8ImQJPEuAKXXChcNnOAkF+naXSzabbeXyjzje5rE3ycr6HsrkULx6wMML KdUS6H3EIFvTUoGVkp4oLfWmkUE2y5/iBa01Yf2HnWj9eijg3L6IB99GkQmfUICu+xJo W2RPpMdMn03xJQuXG69R8NDELSQdOr8AFbLWs968XeAAVSBn26YxibVZ22xnQP9bfT9+ MibrLK7tFIPSeAlAuWkiekGaquU6G6I+89Ge/GYhOMO2SHy7xiThyCV6FUT+w9BiLMcI uedg== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuaPdCLvkQLc2m9tT/F0LjWz21HkYQhOXSThVvV3Yoit9rYYgDKA dh6czTPQzv2r7ETEdiq5ixAy3EM3 X-Google-Smtp-Source: APiQypI1kztm4nw8O0wI46J6OVRmT8yhk/GRg976iSraxwdUqAKU+8dRYXuhyRfOxe122wiQF+IGjA== X-Received: by 2002:a17:90a:154e:: with SMTP id y14mr21547027pja.180.1589183853988; Mon, 11 May 2020 00:57:33 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:8a98:: with SMTP id x24ls16186928pjn.0.gmail; Mon, 11 May 2020 00:57:33 -0700 (PDT) X-Received: by 2002:a17:90a:3b42:: with SMTP id t2mr21223506pjf.11.1589183853562; Mon, 11 May 2020 00:57:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183853; cv=none; d=google.com; s=arc-20160816; b=xXaNGvIrSyWcsLxmq5PId6OrA3R4X99bOifGDe7YwFskfRUsboDVpbUOv4mZtgqjRf r7i9Q6SfltEpuHDuScwCqoFBUD5Xq6cG+PcZVxNzgb3fAyIuQBLluLNDVBIBBSnN6HEa 4/6fJIELCcOSHFna+wDUt69fPTm/TexTIdZCgzKh9G9C4WdcEEVGmjhL4xbB4PD+YZp4 o4NPR9HcJOJGMdFI4+hqA8302zEc2xw7S2lQzxOBDZc/BZkU8nCY9YJhAZSB9n26LRxX UnfohLSaBoqnEkaKgwmH5u1X+k7Nm81hHnvSjGWDpVOq8a57XBORiHkyjwdDDco+WMxA rBJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=fPji1BXGpDPzcbBdAXGma0ZIvWKW+zQmloAR7c+Ty3M=; b=M249E3G//kS95LA5VhNB/vVUdSWUr8KIl/R6nM0FLuwcn1fyFgDKgXhBJXDmwmxYG0 WCVvDxNaidwElLwLqx0JAsTWJKrp+e5IB3dnQJ3j+b7/QphF0/Paao4hhCjFbCwJYs6b lo1Xqs12+04qcYes36VzsW0AQ9ZRurczhKqz1Jtntltw2s5XWtv+L6Jz3MbYDzqHKn7B 46pX6m2hl55jqR0dykPqGM2Y5cS2AV/zagZZK4ezFlgEMeAEfxWZysllmG74JxcfvtB/ 0AX9LnUZ51JRqLI0GwS4PZUZd4xGXqkL3WXgGgCorSLLWY6NgQ+dggJ/WLVhRv22hGuv hzvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.131 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.131]) by mx.google.com with ESMTPS id 72si7053950ple.53.2020.05.11.00.57.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:57:33 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.131 as permitted sender) client-ip=211.157.147.131; Received: from localhost (unknown [192.168.167.209]) by lucky1.263xmail.com (Postfix) with ESMTP id 2B1A8A1FF6; Mon, 11 May 2020 15:57:32 +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 P21665T139939416696576S1589183847395463_; Mon, 11 May 2020 15:57:32 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com, Frank Wang Subject: [PATCH v4 13/16] driver: usb: drop legacy rockchip xhci driver Date: Mon, 11 May 2020 15:57:22 +0800 Message-Id: <20200511075725.26665-4-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075725.26665-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> <20200511075725.26665-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.131 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , We have changed to use dwc3 generic driver for usb3.0 host, so the legacy Rockchip's xHCI driver is not needed, and drop it. Signed-off-by: Frank Wang Reviewed-by: Jagan Teki --- drivers/usb/host/Kconfig | 9 -- drivers/usb/host/Makefile | 1 - drivers/usb/host/xhci-rockchip.c | 196 ------------------------------- 3 files changed, 206 deletions(-) delete mode 100644 drivers/usb/host/xhci-rockchip.c diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 2f381dc958..088931a6b9 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -53,15 +53,6 @@ config USB_XHCI_PCI help Enables support for the PCI-based xHCI controller. -config USB_XHCI_ROCKCHIP - bool "Support for Rockchip on-chip xHCI USB controller" - depends on ARCH_ROCKCHIP - depends on DM_REGULATOR - depends on DM_USB - default y - help - Enables support for the on-chip xHCI controller on Rockchip SoCs. - config USB_XHCI_RCAR bool "Renesas RCar USB 3.0 support" default y diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index e8e3b17e42..29d4f87e38 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -48,7 +48,6 @@ obj-$(CONFIG_USB_XHCI_BRCM) += xhci-brcm.o obj-$(CONFIG_USB_XHCI_HCD) += xhci.o xhci-mem.o xhci-ring.o obj-$(CONFIG_USB_XHCI_DWC3) += xhci-dwc3.o obj-$(CONFIG_USB_XHCI_DWC3_OF_SIMPLE) += dwc3-of-simple.o -obj-$(CONFIG_USB_XHCI_ROCKCHIP) += xhci-rockchip.o obj-$(CONFIG_USB_XHCI_EXYNOS) += xhci-exynos5.o obj-$(CONFIG_USB_XHCI_FSL) += xhci-fsl.o obj-$(CONFIG_USB_XHCI_MTK) += xhci-mtk.o diff --git a/drivers/usb/host/xhci-rockchip.c b/drivers/usb/host/xhci-rockchip.c deleted file mode 100644 index b67722fe45..0000000000 --- a/drivers/usb/host/xhci-rockchip.c +++ /dev/null @@ -1,196 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (c) 2016 Rockchip, Inc. - * Authors: Daniel Meng - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -struct rockchip_xhci_platdata { - fdt_addr_t hcd_base; - struct udevice *vbus_supply; -}; - -/* - * Contains pointers to register base addresses - * for the usb controller. - */ -struct rockchip_xhci { - struct usb_platdata usb_plat; - struct xhci_ctrl ctrl; - struct xhci_hccr *hcd; - struct dwc3 *dwc3_reg; -}; - -static int xhci_usb_ofdata_to_platdata(struct udevice *dev) -{ - struct rockchip_xhci_platdata *plat = dev_get_platdata(dev); - int ret = 0; - - /* - * Get the base address for XHCI controller from the device node - */ - plat->hcd_base = dev_read_addr(dev); - if (plat->hcd_base == FDT_ADDR_T_NONE) { - pr_err("Can't get the XHCI register base address\n"); - return -ENXIO; - } - - /* Vbus regulator */ - ret = device_get_supply_regulator(dev, "vbus-supply", - &plat->vbus_supply); - if (ret) - debug("Can't get VBus regulator!\n"); - - return 0; -} - -/* - * rockchip_dwc3_phy_setup() - Configure USB PHY Interface of DWC3 Core - * @dwc: Pointer to our controller context structure - * @dev: Pointer to ulcass device - */ -static void rockchip_dwc3_phy_setup(struct dwc3 *dwc3_reg, - struct udevice *dev) -{ - u32 reg; - u32 utmi_bits; - - /* Set dwc3 usb2 phy config */ - reg = readl(&dwc3_reg->g_usb2phycfg[0]); - - if (dev_read_bool(dev, "snps,dis-enblslpm-quirk")) - reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM; - - utmi_bits = dev_read_u32_default(dev, "snps,phyif-utmi-bits", -1); - if (utmi_bits == 16) { - reg |= DWC3_GUSB2PHYCFG_PHYIF; - reg &= ~DWC3_GUSB2PHYCFG_USBTRDTIM_MASK; - reg |= DWC3_GUSB2PHYCFG_USBTRDTIM_16BIT; - } else if (utmi_bits == 8) { - reg &= ~DWC3_GUSB2PHYCFG_PHYIF; - reg &= ~DWC3_GUSB2PHYCFG_USBTRDTIM_MASK; - reg |= DWC3_GUSB2PHYCFG_USBTRDTIM_8BIT; - } - - if (dev_read_bool(dev, "snps,dis-u2-freeclk-exists-quirk")) - reg &= ~DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS; - - if (dev_read_bool(dev, "snps,dis-u2-susphy-quirk")) - reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; - - writel(reg, &dwc3_reg->g_usb2phycfg[0]); -} - -static int rockchip_xhci_core_init(struct rockchip_xhci *rkxhci, - struct udevice *dev) -{ - int ret; - - ret = dwc3_core_init(rkxhci->dwc3_reg); - if (ret) { - pr_err("failed to initialize core\n"); - return ret; - } - - rockchip_dwc3_phy_setup(rkxhci->dwc3_reg, dev); - - /* We are hard-coding DWC3 core to Host Mode */ - dwc3_set_mode(rkxhci->dwc3_reg, DWC3_GCTL_PRTCAP_HOST); - - return 0; -} - -static int rockchip_xhci_core_exit(struct rockchip_xhci *rkxhci) -{ - return 0; -} - -static int xhci_usb_probe(struct udevice *dev) -{ - struct rockchip_xhci_platdata *plat = dev_get_platdata(dev); - struct rockchip_xhci *ctx = dev_get_priv(dev); - struct xhci_hcor *hcor; - int ret; - - ctx->hcd = (struct xhci_hccr *)plat->hcd_base; - ctx->dwc3_reg = (struct dwc3 *)((char *)(ctx->hcd) + DWC3_REG_OFFSET); - hcor = (struct xhci_hcor *)((uint64_t)ctx->hcd + - HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase))); - - if (plat->vbus_supply) { - ret = regulator_set_enable(plat->vbus_supply, true); - if (ret) { - pr_err("XHCI: failed to set VBus supply\n"); - return ret; - } - } - - ret = rockchip_xhci_core_init(ctx, dev); - if (ret) { - pr_err("XHCI: failed to initialize controller\n"); - return ret; - } - - return xhci_register(dev, ctx->hcd, hcor); -} - -static int xhci_usb_remove(struct udevice *dev) -{ - struct rockchip_xhci_platdata *plat = dev_get_platdata(dev); - struct rockchip_xhci *ctx = dev_get_priv(dev); - int ret; - - ret = xhci_deregister(dev); - if (ret) - return ret; - ret = rockchip_xhci_core_exit(ctx); - if (ret) - return ret; - - if (plat->vbus_supply) { - ret = regulator_set_enable(plat->vbus_supply, false); - if (ret) - pr_err("XHCI: failed to set VBus supply\n"); - } - - return ret; -} - -static const struct udevice_id xhci_usb_ids[] = { - { .compatible = "rockchip,rk3328-xhci" }, - { } -}; - -U_BOOT_DRIVER(usb_xhci) = { - .name = "xhci_rockchip", - .id = UCLASS_USB, - .of_match = xhci_usb_ids, - .ofdata_to_platdata = xhci_usb_ofdata_to_platdata, - .probe = xhci_usb_probe, - .remove = xhci_usb_remove, - .ops = &xhci_usb_ops, - .bind = dm_scan_fdt_dev, - .platdata_auto_alloc_size = sizeof(struct rockchip_xhci_platdata), - .priv_auto_alloc_size = sizeof(struct rockchip_xhci), - .flags = DM_FLAG_ALLOC_PRIV_DMA, -}; - -static const struct udevice_id usb_phy_ids[] = { - { .compatible = "rockchip,rk3328-usb3-phy" }, - { } -}; - -U_BOOT_DRIVER(usb_phy) = { - .name = "usb_phy_rockchip", - .of_match = usb_phy_ids, -}; From patchwork Mon May 11 07:57:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1179 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 6EF0A3FA4F for ; Mon, 11 May 2020 09:57:36 +0200 (CEST) Received: by mail-pf1-f199.google.com with SMTP id r5sf8146144pfh.12 for ; Mon, 11 May 2020 00:57:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183855; cv=pass; d=google.com; s=arc-20160816; b=dWawvaSUBOYnVqdFj9ax5X4SgAhm4sIPkAWw/HxFdFvXNVZ7GwXuORr6t3JyVsfKwT NrUxLF1Ihx+PnydUmIcszRrkoSK/ghLJcn5NA/KWHgOvfoLJv1kJAas9ZRcoh5ethfUZ dYxPoLMBn4Mp4eD58bzb91sF53M9cS1I3C9y9yPvW2cogaOP9yKE09c2DQ8ZhCDOO+S2 g0mopVy8N6wK1q4wygX5pUROB0K+3vPwR7mb7kmWb7a8wSwccCIQuCmR7CDBe90Kl3cF 84JLII5+gFom9hk3G5QLAWXOPUYCkwKpJH+MeGcZvlNodymlFTYo1euUNggqfUwSyAgc Py4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=oYyFRhOCObaIKiU9By6l7OteIgKyPughBv0x9/N4CSI=; b=Ecjr8xVNN9d6Ocxn5XxtQo0a/lOzilPwtutzbX/18X2/zSFePgp36RObUP73anVqct h7qv0/mMfDbWg/y93m4QMY4OubqHXqPnoTil3OC5i5JB0e88z3Fi97ZM5Eo7x3lgBMdF wxGLzrAHaDdHwsvur+WT57NzFks1dFl9c2K/u6xrb7lPijPM/3fZ+X5Egn7hO8MF0jD5 rz6kB/sCVEmXN46gGlsADfB4dB9iXAkHyePBKsFC6S7kScaTTlj4DhW/uVfRS2Ck1uNZ LIabKqdEfdCS8MmX4BnJSgRoxXEoU+X5KXTFTZny7HAStYlzVhJRlZBoW4a3metewUHL xCVQ== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.133 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=oYyFRhOCObaIKiU9By6l7OteIgKyPughBv0x9/N4CSI=; b=PxeyFHfUyBhzqPnterZgyvCmpf5tt9sBKyATf0Q4FSmZ6RMYY8WSJo3sUL+f505p3O GyiIhODF0AlMqdO1fgNm5I/GtvbkoXjygtzmKNKzK2JYaX1ETZu8dffghdkzm4ffRfCy Vkpao6i5CnCNLwfI3rzEhAlrjQ4EtK2GnG7zE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=oYyFRhOCObaIKiU9By6l7OteIgKyPughBv0x9/N4CSI=; b=HZ2elco5+/tBh0BDD/sdS1zLhg9K07KpkBfsvkrDpcQmGxgzNNJb9IEdOOxdfrBVcK N7k0Oca4MAz67udXFfevyyftw3SqaK0ytk3amhcUb8Oziho4jBQUYf83MFkAF/Im2S97 v0sWHRTjjHyR22Dcg6fXcxiqHLkk0US4i9cbZ9nxYYQyQAUmZVSxE0OpYVdDFhUiXM5Z CCuyyrAp2Aud3gWbPdNlCVzYZQz44AZq862liyuCcNgMfFLU8yHLbMzu0sM4fdiOd0/Y eqjWCX54QYf8yuZS0Xk/hKsZfvP4LRttcwc703i30qKJsWwXar963qOojpuv5a3GKinz h08w== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuYFeFeAJFcySy0EwsI/3Jh9Q2ZaGmteWNtjjSLznPND9vIRfjKx 9NDU6h9e9oCPZD1bCSXpABgAd5Bd X-Google-Smtp-Source: APiQypLp71swub/axwidKCmOpzGRQJVgUjLhDkdAwVNkWRoQT9dYnGHELcaSK07g3UEK9COUTGKNHw== X-Received: by 2002:a63:881:: with SMTP id 123mr14128902pgi.52.1589183855255; Mon, 11 May 2020 00:57:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:7c87:: with SMTP id y7ls1044077pll.0.gmail; Mon, 11 May 2020 00:57:35 -0700 (PDT) X-Received: by 2002:a17:90a:c297:: with SMTP id f23mr19270755pjt.21.1589183854840; Mon, 11 May 2020 00:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183854; cv=none; d=google.com; s=arc-20160816; b=o5xbBHp0S3bBUB8QBcShRtqib51fZZEr/cb+sHndvJcSn1tIf+o/0CUDyWjCZK2GJf TuVlfYmvAWVizXB7Mo81oriZM9rIQyuQ9ixLAc+ydGy7b8FSzOM2KenHPhiswjZWxZw6 XB1CMv+fGYxaY7qbioHvM68iil6tW2JlSg57u579qt5E/6Tvnnk7KJWHwcGHLsL0a1Ju BwQCsWaKeWjp+XKWQ8DoDAVfL3dFnNAXv0bxFweNivGQkA0PGYdiIP/cxrD+zMJCwd1Z BobwcAfOLWkKYFK6QeEtlbQftlkNT88iSiKymvM00/zEf7+nLp+0IWTKpXoQAvDnZ+js 1o7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=w+MpgizUKhLDANj07RU83zTRFID3Eikwie6UzCbinVE=; b=IDmyGIaRwLA1esWmPD4CuKbYCKSBrvNLhkhKrtDdfw8zxtw6I5+L0kJ/Oiqjv76nxX RhiJokV1HiQPVJmbgCvZSIj/LQEY6vLuycqRpyza0S5FFDjmqvCQcldBroANYpwmGNPh /ybqp/rSxr6K/y01nLaqVZMA4AIfe0f/AO+OjX8oxE4g2B7hVxg4AHIFxPEVylIDKtdV YaWo0mmHQLhl1eKSuPs766jsovhhhwc4rnWldAKfwCUVfc1BjSFqYUrFpohwVNBM8o2F 5ZWX/8xbxFSOezBZt1EvfVZU5YqhjLIqpnSO38AK6ecNG5/8mwnh9X60cizpI1G/zrrE SNPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.133 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.133]) by mx.google.com with ESMTPS id x5si7139269pll.431.2020.05.11.00.57.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:57:34 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.133 as permitted sender) client-ip=211.157.147.133; Received: from localhost (unknown [192.168.167.209]) by lucky1.263xmail.com (Postfix) with ESMTP id 65A9DB2A5B; Mon, 11 May 2020 15:57:33 +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 P21665T139939416696576S1589183847395463_; Mon, 11 May 2020 15:57:33 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <33f5511c61066db49aa10ae9db923700> X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com, Frank Wang Subject: [PATCH v4 14/16] ARM: dts: rk3399-evb: usb3.0 host support Date: Mon, 11 May 2020 15:57:23 +0800 Message-Id: <20200511075725.26665-5-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075725.26665-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> <20200511075725.26665-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.133 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Configure 'tcphy1' and 'usbdrd_dwc3_1' nodes to support USB3.0 host for Rockchip RK3399 Evaluation Board. Signed-off-by: Frank Wang Reviewed-by: Jagan Teki --- arch/arm/dts/rk3399-evb-u-boot.dtsi | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm/dts/rk3399-evb-u-boot.dtsi b/arch/arm/dts/rk3399-evb-u-boot.dtsi index e5659d7999..1bebe258f0 100644 --- a/arch/arm/dts/rk3399-evb-u-boot.dtsi +++ b/arch/arm/dts/rk3399-evb-u-boot.dtsi @@ -23,3 +23,16 @@ &rk808 { u-boot,dm-pre-reloc; }; + +&tcphy1 { + status = "okay"; +}; + +&usbdrd3_1 { + status = "okay"; +}; + +&usbdrd_dwc3_1 { + dr_mode = "host"; + status = "okay"; +}; From patchwork Mon May 11 07:58:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1180 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 465F63F08B for ; Mon, 11 May 2020 09:58:37 +0200 (CEST) Received: by mail-pg1-f199.google.com with SMTP id 5sf7170730pgb.0 for ; Mon, 11 May 2020 00:58:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183916; cv=pass; d=google.com; s=arc-20160816; b=miek1nNRST8tvtteSGkYjyoV/xhuLe8lXLlL16HYnCiCV6d7HSC1g8EHM+6/f1dOBx MkwJmmRCnVW6NgTP4nCBtuXsz83kxMNsxQcFMm+X5JnVNWr0xDaEcuvOHpEIy9IgN9Zc Mewm+PoikSn+ujokDvkqTHnx0Zmr0EuUsXmQsErQGmAV/IyKhkfV79V9U2c+iGRZVnmz imydLx+FGhKVhT5FuLWwGlMRxd32G5gSwq5qUkce8qyFg4aNA1lPgO7QqmK01Axm/Fp2 eKzdgrc9ze54kgfN3jaah5DDw8IHNWMMAYuLaC12Ms6AWQFADcRvsosgowKN2s21V/uK 9+SA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=Rim+iEZgpRbwOZ2gH3xlLRabfelZAitZiH6PqplxvbI=; b=kDxFHh2bU/72OiS7Z0T5Z0OTrAwNaftlr/a3AW3e+NcaPmpbmwbmXg8cN4yqVTAQp5 CI5j0h6NaCzwE+fQ1BxOOPEkN1Baiju/WxK6Kod4ykTsRO2APyAV0AVcR/Bwp7z18G02 aRWGlqfR5MiUCNOSwXa15mpDSEsGk7lrmu5SkQhXPfKLDSSKo2SpFg0eXf7NGM85xrA0 VHqg5r707A+RKfBcL0DyoP46bVIaU5APh9jUi8rDzHqK1nrSq6sh5GvmhohaYaDVZl7S rt49fhSWyu8L6T/zKPF8piRoMo0XkciqCxcsTj+gpo+0FNYH76jzY7OUyFsX5WMk4LTu kcgg== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.133 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=Rim+iEZgpRbwOZ2gH3xlLRabfelZAitZiH6PqplxvbI=; b=amvJ2bLkoOViZfDe6/uHKc9sgZJd+42GFSIZ46KGtb60IR8+RzZiF7brlyRaYj3POG xgyEf3NqltxClK0BYkBkKZ4elZk9nC1pcWxFoRkACmh4ML8JT/ESR3GBwm5sxlhfvU16 /2h5yGUEJW6GE52WX1MWnuIOnZrBVituYlxGE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=Rim+iEZgpRbwOZ2gH3xlLRabfelZAitZiH6PqplxvbI=; b=FAho1h8DOvBjr6YMb6LqCBpP0C0QXCU/4SoHsqZn7FsT2OD/u9+NsrJSZnA74PyjGp mFnhQTgJk4mj6D3GyEak5aoqFgJTBypIt9rikh202mlNPcDr3QsvqHxTt2jkHsYAcbmB j5/82nVvWMpC6vq2aIJfbK3I5xVFgqFSwV/KymljnowT6LtRc3wH641cOgsD3eXNm0xR syh4xmNUKlZn1fRmFCyY9wMJRl9LScejbssgamn53zVOYImEkc3u9l/j4BBlcR2w2cvv 8VdJcl8rtsc4k/pl6QgvUVFYEgSoy1L3NuplOLF1vMuqZKyh7NcgBlc0bYdQpuK1DyEb dmnw== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PubVxRUhThvIwkXEqE5hkDrQtmybaCbjurw4Ic+SabjhYQ0vHG+d Z1eLla4NGDSgHn5p5URaWY6CIKFE X-Google-Smtp-Source: APiQypKVfF0u6cwffNO0vNlXryNpAh20JZM2vFwLa+2YYsOPS0k9XNC26GBHXnSscczi6pBbXRXUbw== X-Received: by 2002:a17:90a:fe07:: with SMTP id ck7mr22038202pjb.216.1589183916130; Mon, 11 May 2020 00:58:36 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:8a98:: with SMTP id x24ls16188424pjn.0.gmail; Mon, 11 May 2020 00:58:35 -0700 (PDT) X-Received: by 2002:a17:90b:110d:: with SMTP id gi13mr19935108pjb.131.1589183915741; Mon, 11 May 2020 00:58:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183915; cv=none; d=google.com; s=arc-20160816; b=ShulaA/SUGfhPv2XjuBs8+0uIiLL9DElEJASPYaBleQgmROtvYWdOn4McU5N/rS8ZB Tbg0IL7Et7Zim6cP8wcy6ma//SM7NZSuP9L3nhuV0PWyJmaWJC6oCocEWvAZ/Zr8mFdm uC0rx/ET11TQVtSfzFrqnnnIrUe23tU/PUNtlpwDuTWP9R/OCQd9qX3oq4mjaOu2yhqF a7P2JKy/VwuxWjXipbZH0xSrwnCG4+bJwxNy0v3xC9TPkn8NXMMZGkCnE2XYybFNRPpX oxus0Iezu/ShZJFnPd/mDbTUjbujp5idrO5sgwriJSDXQCF1JljmBLl+EJ3OUH55xU2n cACg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=8Jb5TK5DN4GvkWm/TUJxeWg+gt113VAYhVDz0Fq6LOY=; b=OtZg+PEOUjo+5girE8N4NwvoKzjY+OevK9SRr4Jd9LiVQGDtHN7Ev6GoTaQk9jkF/R V1XS4WGiMUI21me7AgcY0KFnU0VBsrPfPogMUX/6Pc5KkAbb81PQlsIZT5Tu9WN11TDP zycCIC3QjcbOJmYvQZyxmGVU0gkfKW46BepDpueUq97jGsVob0ivg1Ttc9UzavRjg4z5 vt14+woX3Fq6Iz4ceGu1ClsE60DKNoX3rL6T5t2me/7Qn8o9Oj7SxZ3UwooYhFRB7eMD T9CDX7KC47ihRZOKlUbuF1nQPskAXSER6akKZSQ7Kxvp4t1NVnXMxqfBCsZEVEPAgKEQ TMtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.133 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.133]) by mx.google.com with ESMTPS id q15si6921615pff.75.2020.05.11.00.58.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:58:35 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.133 as permitted sender) client-ip=211.157.147.133; Received: from localhost (unknown [192.168.167.13]) by lucky1.263xmail.com (Postfix) with ESMTP id 4F122B27AB; Mon, 11 May 2020 15:58:34 +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 P7429T140153204791040S1589183912455749_; Mon, 11 May 2020 15:58:34 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com, Frank Wang Subject: [PATCH v4 15/16] configs: evb-rk3399: update support usb3.0 host Date: Mon, 11 May 2020 15:58:29 +0800 Message-Id: <20200511075830.26754-1-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075330.26462-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.133 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Update evb-rk3399 default config to support USB3.0 Host. Signed-off-by: Frank Wang Reviewed-by: Jagan Teki --- configs/evb-rk3399_defconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configs/evb-rk3399_defconfig b/configs/evb-rk3399_defconfig index 7f14e18b1b..6cfb4e5dac 100644 --- a/configs/evb-rk3399_defconfig +++ b/configs/evb-rk3399_defconfig @@ -28,6 +28,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y +CONFIG_MISC=y CONFIG_MMC_DW=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ROCKCHIP=y @@ -35,10 +36,13 @@ CONFIG_SF_DEFAULT_SPEED=20000000 CONFIG_DM_ETH=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY_ROCKCHIP_INNO_USB2=y +CONFIG_PHY_ROCKCHIP_TYPEC=y CONFIG_PMIC_RK8XX=y CONFIG_REGULATOR_PWM=y CONFIG_REGULATOR_RK8XX=y CONFIG_PWM_ROCKCHIP=y +CONFIG_DM_RESET=y CONFIG_DM_RNG=y CONFIG_RNG_ROCKCHIP=y CONFIG_BAUDRATE=1500000 @@ -49,6 +53,8 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_ETHER_ASIX88179=y From patchwork Mon May 11 07:58:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1181 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 406D83F9E5 for ; Mon, 11 May 2020 09:58:38 +0200 (CEST) Received: by mail-pg1-f200.google.com with SMTP id 5sf7170761pgb.0 for ; Mon, 11 May 2020 00:58:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183917; cv=pass; d=google.com; s=arc-20160816; b=MRvSRIOTNa5oBSJosWHmw7QOUpDORnnb1zhFJ3B6OTFh5dfr/VT1kKKx96l+1Rldcj TexzDJUCz2x9P3YpA7JTs1v0LU54gbjJiv+ETpV2HEaxC0MtOD0bPHybwvGC0LsDf+Zf Bfj52R3ckk0VkvZA7n5CkkcLQewSRkqGKFOV9uTt0Dc/xugwRaA2DOb8oziEvqaKQ8DM vJ/jsfmR57sRYs7nKiXbT+nz9Q17hXWlPaTGeDd/BW9Y4iidWBqEQJLpf/Hi3h11vwDq 75quEQO4eSe512RlyBoim2CdYw3bbcTd+JP7/pt0JEXGbLRp2ggSolh+FQ1G+IxukWSL zqXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=OVZpmL9bTXg4O43fb/EQrtsw3smLAOlQV7MiPBXDBlk=; b=z/PbltyGemmbHQ0yd5ec00KPyRjZ3OmpZBpRSWY/QpQWl4wgFam3/g1QE8TKy34V0m bwF3jjdpj1OB2JS4hidcYigYgp/KArvk2VEWJ6vweY2dhU7+VDG4cfGm5VRaIsMdHvzL w1SJ/S3QunqcUO12JJL9DMrsA3O0CM266NSQhQtYhADMwg8jq/iNFATksmEGu5tGnUMi ovIp6u/KFqOrIoVdEsbAEOrcEAkC7Fs6PTurefNzQyjHqcqlkMb13kFoHep+uiOjql8j bRiPzgjhFr9XdDX7BRINlsFm1mg9GSD1pQQqnH7CGw2m0xhojZO2cYupstGK8mZq0LBj M5ew== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.132 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=OVZpmL9bTXg4O43fb/EQrtsw3smLAOlQV7MiPBXDBlk=; b=QChBML0P1xLNQk67qhFe1L7LD38BR5ZFiG4ABhfN034cJmy2wMlyfOT63liaDsuQ/h Hzvf6gs0sVFDuS936y8FSudSlwMTquZcPSwq7fcV/Y6CnftJkhI+F5za90hYiRPsbW23 /AVH3dA9MnQXqxDMr5vcvMCuqAMQq1HZwp+/M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=OVZpmL9bTXg4O43fb/EQrtsw3smLAOlQV7MiPBXDBlk=; b=rqz+5Gee1/ZJjHpwRZWBfuVgAqf+JApNChC/4ijvC64gT0J8kcFbS7XzDbTgiPnJpF kCv0EmPXaFt9lJ/kVHf+vhEWq6vcn2AxEjce0nfBRNYa5Dc4dniYJT4PL+UX+VninV2e Ga+Xr47Rmb/l2/m7aps2jO6mKXxu7PHZ8IwFIKhcG5vqia6OcS0ytLOaINll/OSTjuFy PZxbnTs2ipNzcWo/uOhpgl6PS/BZ/8zyCWdmrksIdgHwsILbojcqxbzhBi2DvOwcrz5o KsM6pr+9MPKYWbsZdcb57qhJ0Kr2gzALsg/LTNpVdNwXxpsUI4szXO62D1agloS7nyX6 qrdg== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuappiFfFeZL4uP2p3rHAs6ngjCkE4gwELbW20SnnXhQw7eEnSIA j53VPtxBF/PXe6C4yJk4+OsHYoiR X-Google-Smtp-Source: APiQypISDLuKeIp7FX2N6dJOBX+Z5GKbjDP3VB/RN0/OKahUDI7wxZIv5AK1M9muHfTGSU8AvRL4Fg== X-Received: by 2002:a17:902:b711:: with SMTP id d17mr14270443pls.333.1589183917037; Mon, 11 May 2020 00:58:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:d68d:: with SMTP id v13ls4666539ply.2.gmail; Mon, 11 May 2020 00:58:36 -0700 (PDT) X-Received: by 2002:a17:902:bd81:: with SMTP id q1mr14157448pls.46.1589183916412; Mon, 11 May 2020 00:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183916; cv=none; d=google.com; s=arc-20160816; b=mk49HlKulUgIyRaH73xTcaYOhyBPv0TnQrOZZUa8u9kYUdtGO79+pbAl9e+0N22WJ8 NyNUqlJ8rfxQMqjgCQQhg1HfdZuhNHYEfK/h4vXr0Gr+YIbCBtt06wCIEXVYkyquyDGn EA+miiyn07tEdXFiuE8M6+7cmqy7dji0e39wYTBCGIddovi3ChlInl4jVHU376wepo+t TKSDBR8d67PPzwfhdIh8vt0KrET5273hfnVyONEOiqfFEadNWOshWsemNhDvcl++Oz9R hA8f6S49OaOGsRE3zOQBL25hvlj/4aKs45KGkr1KQPchn6L/fwiNAaWgkC0SkFbOZD7A 0cgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=jI3eKSEQV0u6U2mwNLoq6qDd3UCMEw1DJpn2gbTzb7U=; b=UpqrNmU2krg5l/bN6bh1t0bIPBL1Dxl63IOjXvhcOBJnE6j7gULf4MiGX6NsRWXUb7 QxegFpokCMUn6EN/bV6qo5nHBo0gCcrWwqxNjNgGpCnnURrUvmc5ySrBR6fFXbrOraUK E4yfCx9K09Ap+6f8c64B9JB/uatNcokFf6QtfchK2xdYIgXo4WvZllagk4EPrLvJL/KL XhbZ1GGFA96dV+rI2Ka27JiioAe4HIAwv9Unp73TFAiRYFZ0CQczVJlHgOk6R65IEdI9 DbmiIh1LOMCGvu+SQFOhIbkHd3I7//P4nsIyQWB/rEx2Vs1iVl4Wov2xdmXcji9IA4ac Rp0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.132 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.132]) by mx.google.com with ESMTPS id w12si7101463pgr.97.2020.05.11.00.58.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:58:36 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.132 as permitted sender) client-ip=211.157.147.132; Received: from localhost (unknown [192.168.167.13]) by lucky1.263xmail.com (Postfix) with ESMTP id DFCB0CD5AE; Mon, 11 May 2020 15:58:34 +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 P7429T140153204791040S1589183912455749_; Mon, 11 May 2020 15:58:35 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <6db34b28beb8ddaa1a30bb965a6d8750> X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com Subject: [PATCH v4 16/16] roc-rk3399-pc: Enable USB3.0 Host Date: Mon, 11 May 2020 15:58:30 +0800 Message-Id: <20200511075830.26754-2-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075830.26754-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> <20200511075830.26754-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.132 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Jagan Teki Enable USB3.0 Host support for ROC-RK3399-PC boards. Tested USB3.0 SSD on Type C1 port on board. => usb start starting USB... Bus usb@fe380000: USB EHCI 1.00 Bus usb@fe3c0000: USB EHCI 1.00 Bus dwc3: usb maximum-speed not found Register 2000140 NbrPorts 2 Starting the controller USB XHCI 1.10 scanning bus usb@fe380000 for devices... 1 USB Device(s) found scanning bus usb@fe3c0000 for devices... 2 USB Device(s) found scanning bus dwc3 for devices... 6 USB Device(s) found scanning usb for storage devices... 1 Storage Device(s) found => usb tree USB device tree: 1 Hub (480 Mb/s, 0mA) u-boot EHCI Host Controller 1 Hub (480 Mb/s, 0mA) | u-boot EHCI Host Controller | +-2 Hub (480 Mb/s, 100mA) USB 2.0 Hub [MTT] 1 Hub (5 Gb/s, 0mA) | U-Boot XHCI Host Controller | +-2 Hub (480 Mb/s, 0mA) | | VIA Labs, Inc. USB2.0 Hub | | | +-4 Hub (480 Mb/s, 100mA) | | USB 2.0 Hub | | | +-5 (480 Mb/s, 100mA) | VIA Technologies Inc. USB 2.0 BILLBOARD 0000000000000001 | +-3 Hub (5 Gb/s, 0mA) | VIA Labs, Inc. USB3.0 Hub | +-6 Mass Storage (5 Gb/s, 224mA) JMicron External Disk 3.0 DB12345678A2 => usb reset resetting USB... Bus usb@fe380000: USB EHCI 1.00 Bus usb@fe3c0000: USB EHCI 1.00 Bus dwc3: usb maximum-speed not found Register 2000140 NbrPorts 2 Starting the controller USB XHCI 1.10 scanning bus usb@fe380000 for devices... 1 USB Device(s) found scanning bus usb@fe3c0000 for devices... 2 USB Device(s) found scanning bus dwc3 for devices... 6 USB Device(s) found scanning usb for storage devices... 1 Storage Device(s) found Signed-off-by: Jagan Teki --- configs/roc-pc-mezzanine-rk3399_defconfig | 5 +++++ configs/roc-pc-rk3399_defconfig | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/configs/roc-pc-mezzanine-rk3399_defconfig b/configs/roc-pc-mezzanine-rk3399_defconfig index 0b853805f3..1f10856caa 100644 --- a/configs/roc-pc-mezzanine-rk3399_defconfig +++ b/configs/roc-pc-mezzanine-rk3399_defconfig @@ -29,6 +29,7 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y +CONFIG_MISC=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y @@ -39,6 +40,8 @@ CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y CONFIG_NVME=y CONFIG_PCI=y +CONFIG_PHY_ROCKCHIP_INNO_USB2=y +CONFIG_PHY_ROCKCHIP_TYPEC=y CONFIG_PMIC_RK8XX=y CONFIG_REGULATOR_PWM=y CONFIG_REGULATOR_RK8XX=y @@ -54,6 +57,8 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y CONFIG_USB_ETHER_ASIX88179=y diff --git a/configs/roc-pc-rk3399_defconfig b/configs/roc-pc-rk3399_defconfig index aff690f039..76e76c160e 100644 --- a/configs/roc-pc-rk3399_defconfig +++ b/configs/roc-pc-rk3399_defconfig @@ -28,6 +28,7 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y +CONFIG_MISC=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y @@ -36,11 +37,14 @@ CONFIG_SPI_FLASH_WINBOND=y CONFIG_DM_ETH=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY_ROCKCHIP_INNO_USB2=y +CONFIG_PHY_ROCKCHIP_TYPEC=y CONFIG_PMIC_RK8XX=y CONFIG_REGULATOR_PWM=y CONFIG_REGULATOR_RK8XX=y CONFIG_PWM_ROCKCHIP=y CONFIG_RAM_RK3399_LPDDR4=y +CONFIG_DM_RESET=y CONFIG_BAUDRATE=1500000 CONFIG_DEBUG_UART_SHIFT=2 CONFIG_ROCKCHIP_SPI=y @@ -50,6 +54,8 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_KEYBOARD=y CONFIG_USB_HOST_ETHER=y CONFIG_USB_ETHER_ASIX=y