From patchwork Wed May 13 07:13: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: 1196 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 522373F066 for ; Wed, 13 May 2020 09:17:51 +0200 (CEST) Received: by mail-pl1-f197.google.com with SMTP id g11sf12067872plo.20 for ; Wed, 13 May 2020 00:17:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354270; cv=pass; d=google.com; s=arc-20160816; b=PjBo2TKIiqtITZkk1w4DXkVkbSq7WOl9U6Qa07f1JRr4mum2lQay0koNACOydMFBy3 Vh+FY8Q3NjXgKhplGLx6HWFhYIXTVdBcY1WrYN5LsYc/n04T09Te34e9r9WxTZeN6/3Z /I3QEt8k11QRwbYRUSUCWRs8POURfrubbX6yjBMC8i0kDAgzVNaGU/EJoxDIO+mnQ08e 1okPtABToLC+i3f4xf9sQoVF0TJA3pBnAEdLvL9OzsT/MrFqAd1v+KN/CjrlM03mYQmg +jx7T7YSgO14bwbriqZXdMByI8Qund2BO6JjOf76rvCV4Wev1hOCpXmHrXH6zq+tYOvH hKeg== 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=EuK06AhC7prmbD9L3tvlmYMmUuKDK1TCoO5tViI4J6hGB8tppKVTxtA17hkIk5N26W i/IRvOTmvndSbDE/DnXda1UpGjt57Oru6g2uatLT4uQwEFQTh0CwW74qk5lTNrNnyuRN JYYctPOBLvjO8BmtW8el0PdiCjsquDirp9j0hYStqr/GKG9WeAs2Fgq+973c9wngkO4p ekP9Tn55UwsHZT9Y9jkb4yEHvj+08VggVNjHMpxlTWlzKjuloJHLpPP4zmxcNR8J0wNr vVE2AcG/qoRog+TDSK6EeDjWJYoHXhviSI0kpcu9wGlCsRFUYS++1eVSXz0QMHJvAHWE n59Q== 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=ZUBSKwOld9wPtMKB+15EzXxQ8hCATK15RIOALGUx+PA=; b=aQKrkN7NKz7gj4Sp1MH7RcDcUn6NhwQ/91kLRiijeOpL46d8MLFdzr59t+BVGVs49u s1JDHJ+Q0YY/pU9thsqfVPRx9MmJZsNLs8EuPKmQ1EzuO6uy1pMrJXjHhRx69zj/nry5 nJ5ChimttLfZ913HUqJaZ18VBo34Aoso5BDB4= 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=kVQOq6YlPP3+BUfB5VY2Hab4AHCkoFEfS9NwU9lVW6UOqgOChYCl5GF6RPRL3DjNWY IRwy7ov+hYFZfPpB8Si1Kj5yl4f9WmJGZyM3Dr8SpiDlnpTKTIJg6gRgHvM8doGengxL 11Q/786QYzSFAurG/p77elIMc0q61TwJceuMTiDg1zFbFY0r4/8t4uSG1VeSkMeOEsvM xDaAbumikZO0KLzRBoUx94iCC+loENKG0Ke+o6Rq0P82inBNvAu8uhqmzT8h/QBwlIRo Pw1fFKztynckC70f3j9He2KYBzMbGPtqa85Re10ZrOk8lry5y0txI1BeI4tM5Jotr8nH gN3A== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PubnGi5rQcQA+LZcr/6AcyUw1TcQKZ5gQ2rabdjELoyK2JGdKUZD t+mW55tmjtrX2vgJN1K3MX6kqPOE X-Google-Smtp-Source: APiQypLeWAD1Q54rGJqvUn04u0Kw3Ax8jbKZxtvRb5HnEXf4OoZIIzizSHdi/MqsPE6o8JLxUTnxDw== X-Received: by 2002:a17:90a:a012:: with SMTP id q18mr30193784pjp.220.1589354270130; Wed, 13 May 2020 00:17:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:8a8a:: with SMTP id p10ls165322plo.11.gmail; Wed, 13 May 2020 00:17:49 -0700 (PDT) X-Received: by 2002:a17:90a:32a8:: with SMTP id l37mr7582604pjb.13.1589354269481; Wed, 13 May 2020 00:17:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354269; cv=none; d=google.com; s=arc-20160816; b=dzjgxwdrP3MtyuerYaYJ7QmTYMcpR8Zs2AOQoDfzYnBMZktj3wLCYdkaXplJMWjZG9 63AOyKpWwf2p9RpcifqF+3R2S9XjuMSuy9WjDchiwgzqV2/AnBjAGPT2OFNSCgdkTo1S tX6lGD/xEvY8q08tKeTTWo1b8CAkadOFxfa/JKRfbPXojAcdXUurmDmP0cbELAHQmaWx +gTTElz2GOEPCfisY/T0e/vOBcnzoA0d98aYb3bkvmPOMHP3LZKalbzt6t11zvJPgQGy 2iflB72gTayDPrPVWkS0U138EYJuMzALqlwvu1hgscz76OS/URQOuPPIvjLSh7VIh76N 5RWA== 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=Ur1LR4bETy/24MaJtdaBTqJP6vgRk5OL/yZJ3JvpPf1iu9rVJ9XcltIVIM13RKC4PW XAPbMDI8NZFr8M3MjmZvSl77i8QeOZ7PEyX0wxWXi/CBtzH337hWo0Hnz9/YfoJLBMK/ rwoLOeGxE82upO998jK7GGbyQhpbv0aTjLSrw8L+ctihzZbVxHsxcGW85JcVrDq5FNtn mkbDGFeIFeIY6QTKbMv2eXVsHHHPMMy0JR2yymxQ9hmb0oejyGLk4sXTw98PYx6lLCMh FDlhdrz1PDh3H4EvUhomL5iOZjhscfj+HdIF77HgLqm/AYcYK5FeUa6HEppLdnJFbPyJ JBMw== 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 cx3si64833pjb.37.2020.05.13.00.17.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:17:49 -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.32]) by lucky1.263xmail.com (Postfix) with ESMTP id D1BF9B5E2B; Wed, 13 May 2020 15:13:48 +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 P33519T140426061264640S1589354025823852_; Wed, 13 May 2020 15:13:48 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <91b84ca8cd434994c0ce38886bad323e> 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 v5 01/16] clk: rk3399: Enable/Disable the USB2PHY clk Date: Wed, 13 May 2020 15:13:29 +0800 Message-Id: <20200513071344.5430-2-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071344.5430-1-frank.wang@rock-chips.com> References: <20200513071344.5430-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 Enable/Disable the USB2PHY clk for rk3399. CLK is clear in enable and set in disable functionality. Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- 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 Wed May 13 07:13: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: 1185 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 E581B3F03F for ; Wed, 13 May 2020 09:13:56 +0200 (CEST) Received: by mail-pl1-f199.google.com with SMTP id g9sf12099624plm.1 for ; Wed, 13 May 2020 00:13:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354034; cv=pass; d=google.com; s=arc-20160816; b=cDhz8tov3FW10vqfYGX5stM+x+ESJJmKTbuZpK31cKU4ODqL2yiwDdu7rPQyrLRgRE 1wrGjMeSCtUEVr3fVbzjrnbBmsL61oTcxa1/SOwjLhKNW66YA4O3k122OVInhKoxMH3e AEijIMeDjVv1ZTuAt4/Z08MMHoZtG3nAqmBfEt2L+xjUeajRIPIFoCu6FSBlhvruAgte 6zifRN9VQL5fZy2NxQ7Nd4cPo5FAELq3q7QcO6ptqb6eVgUMuJJhJcFfxKoECnplrq3k 6Xfg6ZB1XF8yr4sz0r/vZbtin21AuK6EfTAVta1RvAqCLteSOeOHTvxxGlLXWjUmGpMa 1g7w== 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=HTHTSp3kgPWzlIkp+cyyUThZtM0ivwEGXl3+152HevFz/lRiitDZplCwADiAaOlzss o+nAIT43cfEXZfFyzdENOoC1oT5Y2Mp3xzLKY5W62C4VFmS0YloKzXnq02chsR6UIZhg qDmUo4LPvTOaeRcA7thE/u1GpAKa3avn00nYjgdsV1Yp0KgSI2/uFo2Syv6cImpmHttL JAqNc+VAtia2+QCFk+Y2Kc/J3AA59aMWxtqs2L/gIsw76MfUunf4hiNeqRxL7vcS2aEb SGGuw2C4xvfkei/IbPA8cfQBgV9BTuooBOz+kBpN8XL+5oandMmrHzxbO+T8K1SZZ4KC P29g== 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=YedkSHS3njE3KK/0TDbbt6LsNzfhh2v2zFSsl0IUyjNXcPiyZTCEbd5UTlYx7xoBgg dzJ7t38dcKRP7e4NAAhyh6+9+VbQJ3W3e+2A4WTtW9Q3dp26K+O7BXiCa5dCnjQplKZA btQwc8GRz1E82fWB4DTrmmbt64ovD6hQ3UzLs= 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=KeZATSvJPfm6b7PzoX08CJL1n77yOkfzQghhqZGhK2V0BuNkH4dw40/8q+PoC1uwJ5 5LEL8UbkJAsc2ThmgROutUX1SghgVs9IXINwH3OBjf6gdtP8lNen33OnMX93dn//5lTl z6qLnsvdTfGjBXyoPj/zW+3bE7W54KWjiTX3U9ZP5Vz44VCmfsoypNcTkpB/ztcQgyK5 JEJ2wxZnjE2D/7zFzJ2++CgqQBKIIKk9uj9MANBodtRXDL3gn2GpaTwACA9bPftVVuiL tZBYaIrekzLYb/HdDmhdnHtSgMOkXGidCFvzRjsYDe8sALcMLVnP5ohI0NTj3I9NBCEG Jd1A== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PubcTwP7GHVNL63F1BwN+fkvF0AZAgi62NZo/t4vTiXvzeErz7di nlZToY8BFgp2k2IKaVt9vcRNl7fH X-Google-Smtp-Source: APiQypKDQIrYg18jVDRvy+gr5Xia3rAJWAOGM8vPOC51jdTVrAOAePgY4TXe+cbTDxtre2dO+uFEgw== X-Received: by 2002:a62:1ccb:: with SMTP id c194mr23827166pfc.325.1589354034655; Wed, 13 May 2020 00:13:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a62:1657:: with SMTP id 84ls463419pfw.7.gmail; Wed, 13 May 2020 00:13:54 -0700 (PDT) X-Received: by 2002:a65:62d5:: with SMTP id m21mr22411531pgv.75.1589354034195; Wed, 13 May 2020 00:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354034; cv=none; d=google.com; s=arc-20160816; b=a7lBMf89xozQaNnD2eqzk13XVPwgUYq47bCPuZnkLZd8eHGhryV478o446npHFPk0F M1EIsS5S/DL2wrYFeJitroCb1/7rP51z4rLrB0F/PG8LlpA0Spmj8fHFS2Afg0BIIEo1 kNqaGD7x95RDz+/KZYg64NEqaIJNi9C0XQhmg2ibTbMdVO8l6PUc3bPldoKmM+ufM2bT OMOm6QSlJPHCzumDhFFBCU2QdcXzeVnXCmmBsi0pDEV3ZXzUBhv1rCnpyqltqiO2HNS4 7Gf7SWBjmYvrhU9WQaJgDKxXvZVn3OP/Plsz5WPadFMDKsz6wZF0+2Td/0e7UuWMll5/ kZHg== 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=GmdR7S/ynree0uxDDs35Gv1St8fNJ5zTcBNmlu57CvzSUdjmuYFMTKEiZ/LADEDxVh Yea35VNRfOfxAU51QaEfZOfcNyrAwEXhgtRY0mIHrIBoH52Eta1qZ5zizUdhRody9wE0 M7GlXQnkMLLEOGcc4c0Njyyr07Ns86iGrrKXdfwA4UAb08v/2fKKNdpKW38N0lafz4qU u1J9AcSNeGVSBAwlE0EyizA+EOrWocrWBBOgyBJ/5bpQmxdHRg+1kzO6+vY0MbQTiJvV BnqGaHls0/Xoi1y32PtA7gekvDrT5qp8J+bIosRs9/angRDBKn6ZoqGnPlcUbKcCKzRe CpPQ== 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 31si8168988pgq.580.2020.05.13.00.13.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:13:54 -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.32]) by lucky1.263xmail.com (Postfix) with ESMTP id 45DBF82BEB; Wed, 13 May 2020 15:13:52 +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 P33519T140426061264640S1589354025823852_; Wed, 13 May 2020 15:13:49 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <893927603098aef32c501ab97553f5ae> 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 v5 02/16] clk: rk3399: Set empty for TCPHY assigned-clocks Date: Wed, 13 May 2020 15:13:30 +0800 Message-Id: <20200513071344.5430-3-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071344.5430-1-frank.wang@rock-chips.com> References: <20200513071344.5430-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 Reviewed-by: Kever Yang --- 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 Wed May 13 07:13:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1184 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 B1A453F1FA for ; Wed, 13 May 2020 09:13:55 +0200 (CEST) Received: by mail-pf1-f199.google.com with SMTP id z19sf4495193pfk.15 for ; Wed, 13 May 2020 00:13:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354034; cv=pass; d=google.com; s=arc-20160816; b=umxatHYYpeGP+XnRIwrWXvTpxvgH5HgLPds8vx+qkTowTWMlXiQotQbNE0fmk2B5KS lbzpDUPg/6i4YraMmj3deGnHMXQQ9eSlKgIHscwnGA4ZnSEjncZCg7nSyxCUuu08SGof rxVrG9UtWZ/REjwGM5ZG8ZEc8CSiTrvSfIOOzL2pXyyhygqXFrNHwmn62vNVbhBeYfDx n4fLXQ5s2lZtnO3o99vyXpfjLBpWPxAJUWsTf+OCqZWP51x8U3v/hDSif5uTNx+dqSSv xCAZEgn3/WaJ+aIoMClrwJrsF6kA8NJ1KS4Ou2nAJuprI+GZZROZP5maoE3Em7RciWZv s/Ew== 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=dRQ+y5FGhctE7kYi0LgiI2PHxgeinJ2mgDNCeIChPG2GVWj2770h2sthj4QHK8GO3k RhuScDsbvsyZT2aa40EopWYIMt054iOheTFmbMXRGH27AgCcjHg9HVkrXiwPqtDT+Epp dRIYvkjcDol+Otv0KgRJiVKBvEEYeGKYWOCXUXihWaywndM5QZAnGfWQjY7+wutM1a5v tmCGxsm6oZcj7L1IaXclC5NC6+/1jGX9F2/KYsiu6O//C+78zdrpqe/HJL14wLXtc37B iFNEwj6JpaeD3Drao+Qel1+zf/ablEePNge6XV7coeifGKPU5U7shJi80uYfE6o0iWYh Mh7Q== 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=VbrroEfLdi4LT9Vu+9gjU6aYcTOCMaYqVP+MIj8NcYk=; b=fafK3HrCCwZ24wlc5JfJVKg1oK88WV97fGfuD3x3lsNUEEKq9R+hWsYTh1VQ31tpsp xRLzNoMOmYGISywJ2S/3XmodMPbN3u1NqbwFpx6DJlAvOs5j9XeDZVPv1PzwQSMs0zXS CedTmMUJ2AN/S/EcSqGggi0BmLEJ5EMMM8QtY= 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=Zu6uGY9JEOyFWI+KswUL50jAp/r30cP2XHVPFhdRV2RRFShspF3jD+8WS4R9SQFFxh +X75BMqnDjFRLG+dhrg/Q0DSNu8c0EMeyCQ+PMiQ+aTJ4+UBIYNnDP5HD/fwoRNn00xR lWiFwxZmkVgqHM3YUB5C4wtVXCud+yTXfOykUSJe69ksRYKr/U+j7qArgQckf2/M5CLT FII+9T3xKDzMVbYpiTAIclE7zLBmPforSUudJ8BnyIW1yaskTXPKDta7X4Ujv+Jg1OH8 lQrzAQwkZV7fMBc7XztpOdxaN96jUc/kpCtlZ/m0HHEUAMgle1jpc8j1Kv4fhJIZakIl B9iQ== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0Pub3FC9Q/NA8wNW9yjezEkJakk8Eb4v4SOTv0pBFJT0y+L3nuXWj vwdhjIfSPLdlL+ScUk17y/xqEhh4 X-Google-Smtp-Source: APiQypL1Q/pOz3goyfWDpjqsldP+23ztwVoWv/6BHmhpeSEgP3aOv2Dehvi6y2o/rPT6JQWpGcowzw== X-Received: by 2002:a17:90b:1993:: with SMTP id mv19mr34211276pjb.88.1589354034581; Wed, 13 May 2020 00:13:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90b:4c02:: with SMTP id na2ls599875pjb.0.gmail; Wed, 13 May 2020 00:13:52 -0700 (PDT) X-Received: by 2002:a17:90a:254b:: with SMTP id j69mr31166978pje.222.1589354032342; Wed, 13 May 2020 00:13:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354032; cv=none; d=google.com; s=arc-20160816; b=lTKJbqsNtlIvinkO/E2a5PLpZ4WkCjfIzuXRzGh7XU/TxTGHnvfQshe4GcokrXtnem SU1a80TI9901FSSes1KHYZK//jPDzSIaCEDQWquFNOhf6LAGHaBBIQCjv9MnI6uZjicW mcEifYXS6jBTa8ah/JFDGG8KM+Ejn9Nu0yi/6NVGzJKAmQ8WDiUL7QPdt6yrIeACrDjk ZjNKLT/P+JQMiwVhG7Y0lro1F/recQPeuYZ1lnEgKSRv084rNqAqBYNyXNqNfJawfBeM 3Ew4oUC6yDb+F9QGkby1NFs7HZG/0FNinA33VhQE+q+9ZcL4LEYnTpEYkQUaom3bMBmF L8TQ== 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=lHzBh5NvBtVUlpydqPHwQ6YeWZFGfnwxNWEQ6q6v9DK3+tEmLafNokgfcZukBs+DIj SSxdLUO3RKlk0vUIx3wFIBvbUaJSbAOaCQpNK5wr+ddgk8dmv86euVkEIherhE+HhUHm ITCzh5MHJQOz1PVws4uSYSKLC1M+iakhCUimdn7kf/nP9wCJeVXJKR0vk6wMamwLmq7e tAXjC80iWCOaoBCkR3tCcGpMZJxD0ILcEoxk+lLh+Xdxc8aMmej6uAS+cTEbs3bTzsXw zojWvWJb+/lhPTR9Weks4BJjcLDAWvFxf9QFtHvoiTluM9laGjmw3tTdQ8A2FLLq5/yp EKSw== 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 15si679047pla.239.2020.05.13.00.13.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:13:52 -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.32]) by lucky1.263xmail.com (Postfix) with ESMTP id 4DD1AA4F2A; Wed, 13 May 2020 15:13:50 +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 P33519T140426061264640S1589354025823852_; Wed, 13 May 2020 15:13:50 +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 v5 03/16] clk: rk3399: Enable/Disable TCPHY clocks Date: Wed, 13 May 2020 15:13:31 +0800 Message-Id: <20200513071344.5430-4-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071344.5430-1-frank.wang@rock-chips.com> References: <20200513071344.5430-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 TCPHY clock for rk3399 platform. Signed-off-by: Jagan Teki Reviewed-by: Kever Yang --- 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 Wed May 13 07:13:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1186 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 716953F1FA for ; Wed, 13 May 2020 09:13:57 +0200 (CEST) Received: by mail-pj1-f72.google.com with SMTP id o89sf993740pjo.3 for ; Wed, 13 May 2020 00:13:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354036; cv=pass; d=google.com; s=arc-20160816; b=N0u+acRuRdd9DkQqYIXsd3dNLjhjB1WVM6itFdbICo5UPwM50z4GPZYc2Jge7BKDlc J6R7qMEYuds6m/2dVgqlw32DHGHXopFYGp/vq47EFiRHYAnwFaUfGJR9NSWTj9jl5LNU urP2y3mWTGd1p17o60D4mVvL6/IEylLi0bSsUL6DP+vJUqUI25+j06kQRyeGvN0EaV9c BMLuy3/yi7kG/t7S3l0nX6aHqjfCUXf8sOPn7v6pttxiH3HQhDQQncQMwyV9NsJv1x4v r4/cwOhh5ryvw/cLMHalVUkr6WJqr7OzOq3PWOglcKxjDc0qlqif9UAT5AlxQPMyysC+ woKQ== 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=DZXpFYmSlycFfJRyC6vADrx5EoVa2mASsknYMCoeHGKnJ48Xqr5b227MhyqqjVpLM6 ee7soAXpcTtNBd1X3SBurSntQ5n+18KntE308MFeXpX27dGfNSyiD+MwMjSbzTaglqNv zF6u3aeAhACY+vF/TrrNXktJ4kwxycvJcG3KORHOXHqC60j36fYR8vbLbS3qwC1GPTbU XQ3FKqLiJV9PhkldpFcfLJiur2Kj6jF05uZ6FM7vJaANgZfJqaxVwC1XoEP+nx2MgKB7 gi2b1UJ68or/AfqQeRIiAg4k3DByV/nKkLz4fhQ21Tdn5TfmM108LhIX73g84qviuxPz KVqw== 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=cbfYHrWc4uF4KAPQl3jXsB6ZtKAiLiVPhBelyr2ATwM=; b=k04qpbt8j5gxUe16K0tIwtvJvE2lqR6XUbvUhBFcV9grafsjIWg2M9V7NSnayaicZw CSLNbhwtdHcz/kN6zGIlBIh6v4sgyA4jsZTA2GYYYlU5JoRbpTtNYa2BNd7WfpCDb7CN BzIHbdqcz1ydYbso4KH/WGyt0o6cdVygceuHc= 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=bJWNMR2focvVb4C599DMUjpnKBVY9mTTZrO420s6BJMxGr3B6x9G8de3r7YO/owJTu 35S85W7tpeZYQ66JQbL0YoO98tRDTaHpwMpxK5LMYmeIlBaqn3Qpapf1prhyjXT92FP4 Mkgz+VaLa32WRLoOL2Nxd/Z5pLaFQ5MNWo39dWWoaHKorNUCgmJ3GbOSwNjZ/OrQXtcW v3Phmp8xaa1C/CMi7jrjUBmAoqQ7m2YqaaouiycR2kRTn8MbVZKQpcUwS1771vapFm0I LS+XwRIVFLKS8T8AQL84/1NPeOcPlyqO/wxNqkR7h9ZTWfyduMxdkWr9YGLKvUvIM9+o BgTA== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AOAM533GQs1Wba2zrrby4pSe3N/0TxQaysbyqMuVnw/hOEQ5R/VaO4Aw scwn44XhTnEDCI0/IQVHrEHlML7b X-Google-Smtp-Source: ABdhPJztG1MXG/gB1NH1lM7MAwoezKN/f1BXGMRtwR/m2lhutY3Ax/KaxSziAoxjE9H7I3OK5wevZA== X-Received: by 2002:a17:90a:22d0:: with SMTP id s74mr566299pjc.200.1589354036277; Wed, 13 May 2020 00:13:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:8f8f:: with SMTP id z15ls497337plo.8.gmail; Wed, 13 May 2020 00:13:55 -0700 (PDT) X-Received: by 2002:a17:90a:7486:: with SMTP id p6mr32090853pjk.62.1589354035545; Wed, 13 May 2020 00:13:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354035; cv=none; d=google.com; s=arc-20160816; b=zW8+h9VHAdglXf5MPxaCfIGkCo9FOe/LUTCOHt+x2srB0GK2YLqdZakoWNzo0BIWp7 qHDXWmpt123P2jxk0pnN0utubw5xN79VmNWAoigOb/G2/CxkT7xuUEDdvADh8RsCzYsB SuK9L6Jj5NupeJLY7qvlFehKJXD5YSkKOFjmRscAN7baCPqzaipfEUZ7y962nCb831ba yIfGYTOHHDRixx3AyjRUYDbKKzpIk7Y5U/uaF2ZyrtOkUQoEz0o+zukCNfqQfFYtDkw0 AgqVkgx39tNY9rQ62b9oz7RIn7Zi5gUkR45xEFiLpBPBG+ubLE6lA1zS8hd4Z/lvQMiu BaVg== 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=B4ecCNUXGQmJjWd0v0SgxlhO47p3s4gAMiYSDwju5qsm4p4HMedn4Zr6n3NjKeOAyJ n8pbkASetvmTvw4u1fS1yko3XtnKMB5ft7Ylqxlw6mMn8mQOX+YVVUESd/Z4v17twd3C DkwjzTOtFCamLJqmxL1vGWqEFmqtK5IpgliEnSCQpGtvEUEqn3e6fG1+FRVJPJRPx5Ug 0ZaD8fdoPZtT8bD/fYWhrl4zJNwXQ0/pA919CcpmOcLUWislhfanTQpPEZ2egfjI5oQ0 9jCavDONykiSH4aF1B1YVMtQImxEnGu5bgLTeyKHlIfBv5imIxnkO9vxa8cKD/nd7tE2 1DaQ== 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 e14si9343367pfi.134.2020.05.13.00.13.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:13:55 -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.32]) by lucky1.263xmail.com (Postfix) with ESMTP id 2BE74A1CBB; Wed, 13 May 2020 15:13:54 +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 P33519T140426061264640S1589354025823852_; Wed, 13 May 2020 15:13:50 +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 v5 04/16] phy: rockchip: Add Rockchip USB2PHY driver Date: Wed, 13 May 2020 15:13:32 +0800 Message-Id: <20200513071344.5430-5-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071344.5430-1-frank.wang@rock-chips.com> References: <20200513071344.5430-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: , 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 Reviewed-by: Kever Yang --- 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 Wed May 13 07:15:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1187 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id AB9F63F066 for ; Wed, 13 May 2020 09:15:53 +0200 (CEST) Received: by mail-pl1-f200.google.com with SMTP id c3sf12082026plz.13 for ; Wed, 13 May 2020 00:15:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354152; cv=pass; d=google.com; s=arc-20160816; b=bpMx3Yx1LrwT+d+IJbsywOzPikk+b9YaeDI5daQ1R+lihVyoqi1SZkntrjNipuCHz3 SvB3lqJ4VQGQfOwd5Z5wMCtM53nCUd8C6nI4JNd+VB7ksMFCIBgqge90Q9nXiPsvNbzQ y6sMv50aogsKX6zpTsnvv8ne93sjbfSpt8C5SDM8RGFllv5ZS3chMa7nb1jSHLfW5L7o BCLXq5makpPDaJiVau3adTIMu3rKrVvaexsGPgh8PGAWRBKV5tT/lJMRfEEbbh321oWu eRTYc3+g94dPiVzKkoCZ6oF3piftR2FwJrudyGv8Rl5vofRkOxjKRYg4vqsqaIBpdw2R uUFw== 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=t72Qlp/2BJce7V4foV5YgaSE5Qf+gL24xvZXQ0wRHZuL7JgdEuuc2omrXkrqxcjRMU neR5s7Ltds3/vYH9pEkqVNLjh6jCq7iqYhvta6KOlXDhJAnwIitePjo8w5YcBdpB0xgZ RsJd1XUNGAPw+XERDDs+tc2O44W1dZTSL+TlsDIAEiRCcTul2tUZjsND0z/SiMhTIFru j6BNwPfCST8XweVvuBqPbnUYdYl47jTwd9EvM4uUaN/LrofciWfrQ8PSXakX8eceXLfR T3SSYOuehWkBdVNRxF5bxskMbNcfDrtAcl/fFyZsvHDZFS2f4ejkTXw5fBY0qokBUUH3 jCxQ== 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=1Sf+0V4O4MWtPsZxr+dUo/vsjQJ+k3pRyNNpFXj2ie0=; b=T8Qe3rR6YQh9PSpQj+yRvLEJvZoE642X/w1L/FAi+U0w9IG82TGmVqf8UjTr1pcQyz MBL7d70OwiMYW1EPmRoAp6IV30YmzIWe1B0LQ/s1g6F0Z6zlCq/HSIplf1Ijejz1ngbo MJ263Kg+fpIABNigbf458bgbHoOa681fhB+Mw= 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=IFWXDuKPGzMYjznRfbvChsaLnvSey6I7TzEa2VVXlTKdL7U1dt0Mpg0EbGE2UPI0RI i50UWRjS6P1ZMyrO2YPrgrqXhUxLNfNMahAPOgFXquh7hULlo3IbtKvVkO7obW7KKnt5 tZchYW9u4sDLKgpMHBAWNG69+nDOgjJ5U57oWhE3Q25R23wpxZ+8x5HG0CQtEfruAMjC aKISqFWRDHn7UYB2/tKtZ9SNcypZ+il9KNH/Vq1KfxMQRgLb88c7OaPJ4HEmUbjJwJLV dhfwXJVsVTGf1nM4u3LokqE472blDx9Yhp4GAPHhjhr4xpq7YUc46I0prYvs0ULhZcgt PxoQ== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PubsdRBhlNlJv6VwXzyA5bByXyIW3j1O7ShTL0ZtygKFuRQU0n+w KPob+fcR92M2C29x7k0+YTwUsJpx X-Google-Smtp-Source: APiQypInRLAXjcXIaYS0jW/1hRfdpHW5NkIsbRET+Au/EfZ9OXgCgSyYVGmVnnNhRm8IuU/LF5QbzA== X-Received: by 2002:a17:902:7609:: with SMTP id k9mr24399376pll.56.1589354152475; Wed, 13 May 2020 00:15:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:4b5c:: with SMTP id k28ls393085pgl.0.gmail; Wed, 13 May 2020 00:15:52 -0700 (PDT) X-Received: by 2002:aa7:8e86:: with SMTP id a6mr7320134pfr.149.1589354151937; Wed, 13 May 2020 00:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354151; cv=none; d=google.com; s=arc-20160816; b=uBSCSw6qMmOkRP78nuazv4hz8OHSVLHJnDs0/2a0kqOA0UUem+Hy3stZbebtxDnhWS KBoFQFWL3c3Jt/OgidcagWu7Pk3niXRC2+n36DuB4b75qTacxFngpmzdyG06cX9tOhG+ 8KK7qPOn8BV1telmySRi3EDvdg1oVSJxziP4tW+nz3/8nAh+bOn4tNb4nTnhQG59xvBU Br+A752+EqlBFRFzeg09MQlBYaJHXcaqH7aiU44oAEdWeIBkid5hM68wGwvvTGHTek9/ NFlu1kLXdFmNV6OsB83+5CSlcz2quwiQxmAoV2D0IbpYjTw6G3Ko+O4gZ0DDTuSUqm7H NfwQ== 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=PUzbRIZ2PSkjMqWozHthAE6s7Vd3ZFhHARLCfNzVpjPAoExNejNaH+w1JJBO6OLgVt E+ZtoS4Ls2MzfQjoVn93dUouUBdP+IkBhJjfqW1jwtdER40+4nmjLR5uqow+E2A0KepT HeKpuUwUejhsk+yZtmEeQIAZ8uzojT4e2wKXXcayu+6uvTTdZoGcQnpKQRp502ZI2tkB qk4mlWonn25tvTn+F5ewB/py//CpoNoLyzqq4VOALRfCLLDfrG8FxQbJn+qbsvZDChR+ S2gdIXomSiBvspjpydkguW3JJpdfb4M4Pugh+owtK+bYABrFCqC6zw4GT1nN6LViAonk obaw== 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 d9si12267400plr.10.2020.05.13.00.15.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:15:51 -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.16]) by lucky1.263xmail.com (Postfix) with ESMTP id 75A9BCDD2D; Wed, 13 May 2020 15:15:50 +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 P15407T140446440306432S1589354149129638_; Wed, 13 May 2020 15:15:50 +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 v5 05/16] arm64: dts: rk3399: Move u2phy into root port Date: Wed, 13 May 2020 15:15:35 +0800 Message-Id: <20200513071546.5560-1-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071344.5430-1-frank.wang@rock-chips.com> References: <20200513071344.5430-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 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 Wed May 13 07:15:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1189 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 59F113F1FA for ; Wed, 13 May 2020 09:15:56 +0200 (CEST) Received: by mail-pf1-f197.google.com with SMTP id r5sf14144525pfh.12 for ; Wed, 13 May 2020 00:15:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354155; cv=pass; d=google.com; s=arc-20160816; b=Y9FgFWI2QzlfZOQd3jW/l7v5v0BqgMF3W8WEpCBL/pS/ECDQ5ZgGWeqXwoGyHdT5Gh qk7c7veDFKzb0f4aG3GYVHgSNQfUF+rKh0nh2O4xQifGETrwSPO0bQM+9YqAqKUAa1gm MvHBCO+ljDGGjHFRJrTSQYy4jTWIzpXPfME4LR/TrKfj5LFzkhUyYNxyCO1RHKOYVab+ bacBgA6yBtwLXZgDZ/cPV6M1yuBHB69HyRT2tFw/+S76AsbpCwmhKt5eOqjbiYJjO848 jY9zq1yzING6pC5Xsgx1oW742QGStsV963VUuX8l3VimS2qUKnku3x9NgdSSz3o1BJJ1 imRw== 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=CMZiGZHQxwFR193qy4p40V5bHm4y38G1V2rdHe1XsubVqW2Dlz34XnBWOegrM9ghkv Moyc1Ay4cmWG0L5rvq0WorYvTYbmenDkQYgXEQg+0ayzjKAW4usbvfDINtKLqWq56BLy XbMR9pnqJPc+XKEgwHMOEZN40ecOqzmDEwFr45Z77d77sZfKXnqdc61m4OYPzpD2Lgfn 7tgw5r7wnBb+jbBrDLdZb13s4dVgiaLyzwaLyNO9bzUhtBhz1yAIEXYOlODUK/so500I YbJejvnB+Z5ZeLAKIL59aOdzidCUlaD3ww5Ia4MwZZfsNu7o2vbc8OoOpXKE39vMpb1d 1BVQ== 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=TMZCbySaCSRGmAecWHTQ9ahIO77I1AFv+I9ynaQJfdg=; b=fSMZ66zSXu+1tLTnn6PnONT9R7fA714LpgM+jeCMCgjY3CWvvaI4NjOA4ISSTnzAzs ZmSpdQm5o9OVAY4/usItgQU0QkTXeE+cDMB6Me7taHUT3YPlbpavGAxls0bBou7b/iyN n/6iBUDGZ94moD9yvZIHFSCQ7TT9jBBpqiOP0= 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=UOLIEtCYsVIL/+ft8yBgKWJkp6GH5+kFvTfrOZbXCqkZAnhBA/nlSHCB4GDcCoI/tj pmP35CSdHcrrei+K50+f6kaiUJ2MnTnXUZkTVVaC1vRYTfOYKTEJ7oaJPhH9yKmU3vGI 8GxxPgRx2Y55lXApIitoMouM7CVli52urYRUt3WQiFhtm3C60ZQSsd0skm2r49IKk7KD EUOKNwiL28uIilXOzWZgSaQVsCrEulJqWmGAj5dfgXpx7HEyXhTVqjv+HRM2uat+6IEA XXtZ6ZskscxV+7xRPL0bTzsYojU0psy2ZTQ6UJPdUdnG4TvhR7MQN8yx9v+XrDPHOJ5Y +W6w== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuZX+1JpB3y3l+/ULIiNCOJjQBaebznRz4PUoqmbwEtu3vPooHbF yAqcNvnepZzFgwgljvK5MDquIvAS X-Google-Smtp-Source: APiQypI6uinN1XnRLMwJwrIbGgm7HlbpCUNA2N0p70GK0iOxbDb7LpLZtKu0if/fTaqflv7ATA7tFA== X-Received: by 2002:a62:2707:: with SMTP id n7mr25909454pfn.209.1589354155036; Wed, 13 May 2020 00:15:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:191c:: with SMTP id z28ls380479pgl.11.gmail; Wed, 13 May 2020 00:15:54 -0700 (PDT) X-Received: by 2002:a63:eb47:: with SMTP id b7mr23484505pgk.310.1589354154314; Wed, 13 May 2020 00:15:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354154; cv=none; d=google.com; s=arc-20160816; b=GhybzJ3oL+Ldj981pRxMYkbcxa6lEGRpsNrSUTvLeRaejDRcjfaBU+viJ4eiA9GDOm glqbU2OwZWBGR6yUEFBKtveepNszz8nDvCCQmSuNE1wiodnFTGvg3AcaUfzzkY0EiaNd i66B3iaf2eVLpGa7rbKuTmJ/NS+B2tHObQBW6t1V4fteu6KPwXV2tI6DkYnKd9Eq0Mmo NJuoJarYKAdoOYCscg5FIjnHjCkX4HfqT3lafBMAXzcB75rFXK9DZ1SPGXgVYcPJx4Y1 RPzmIZ1o+ytKAR/L3jDa0SDPVbpfJby3NnbJyvxkPg+tDtu60VfoaBb1temDLXKGt2le F2+A== 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=YWwC+9O8IOtZ8ZWjjBbr1aXgP40MV1S+VYuOc6ud/Fz126zzFmUNM+AMzyuc205fmD g7MyNKwXphPI+EzWlItpcBqzo5H7aZ/XXa72gde15E/5+EUbqISOOsagjRWWfN4Gb+Bc 2FC+XeAIja+qj8ziNTNJIyv7vqn7e2nyjP/0aLfld3JLD2tdDLBCDQvhK/prbXiQCjW5 dxTa6ogp++ZKsE+peXjrJJkv7k3K4H2d+6quJIhq1NJLpLM7cgGgLRPr1EnPDNeBh+Fp Qdrgg5h6AR3ORaPKHXsHuuN65VU0AZaEZXF6RD7U6sm4hySCww988dv+SW5qRlb6B/Zw aY8Q== 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 j15si11800521pgt.155.2020.05.13.00.15.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:15:54 -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.16]) by lucky1.263xmail.com (Postfix) with ESMTP id DDF2CA21BF; Wed, 13 May 2020 15:15:52 +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 P15407T140446440306432S1589354149129638_; Wed, 13 May 2020 15:15:52 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <5c42faee433ca877104d2e2acb3764aa> 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 v5 06/16] phy: rockchip: Add Rockchip USB TypeC PHY driver Date: Wed, 13 May 2020 15:15:36 +0800 Message-Id: <20200513071546.5560-2-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071546.5560-1-frank.wang@rock-chips.com> References: <20200513071344.5430-1-frank.wang@rock-chips.com> <20200513071546.5560-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: , 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 Reviewed-by: Kever Yang --- 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 Wed May 13 07:15:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1188 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id CFABE3F066 for ; Wed, 13 May 2020 09:15:55 +0200 (CEST) Received: by mail-pl1-f200.google.com with SMTP id f3sf12053345plo.14 for ; Wed, 13 May 2020 00:15:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354154; cv=pass; d=google.com; s=arc-20160816; b=ov0OKsiipyS0bxXzlbUFYqDkN6+07gw3JcCoJT4R8wi8ovbGaM4Zs0WNeZYosqBI7K WLIF0sw/+IE4yXkt9ZqyCgJ4PO+j4sBul7N3u9m5qNWVPom3BH5dq0vFnyvSYWajG6cS hSPLXShlx63xVjb4bnvWDBSj8Fv5ePD3noR0aSFGH1MbRbScEKPZGeEtR+gzTCCDytzp h2xbYdKk9zQfgMEj/AyChxiWvFHcEMpwa2dKATSn9OO/hAS1C/XXSi191XTd46TfPy/W H4YImjJ5myX2q01v2LHxp+L5NDNRas/UfsuL66mGmPuGt22gDhioc4hqzjjYAbVfjGb+ WnIA== 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=zQ7jV0vB5KgTwwOQY7c1thExU7kqIESeQ3qHlzGqRVg=; b=dU7KLr4gDgBgM/Qpk/KOK5exzT7+sL10Xp8s05iUlHAGHCfoe+3LYNls47fNIcI9JR wDdabpC4CaQ3EgdenAyU/hrDUFOsole1swViyN5Ma9l1yI3BMysqtuLev4iRnp0ByWtO kKzvzvi5Qe+J5/D4QX4/Yoqj1TNY3g0A3ZxJQESYLyhEI4rqUUqJsvqSuuaBfwO4COvC qLIcHVnEOIv2uk9bJ69VOGQ1VHP2VqxLGBOBkRFaGwz+NMu0rAwFG0DUJpZsncBF4aaM qK/nQCoryexnL7VntOcQcuX8ay/ftFS45AmX2vHawALJcb3qapmmTUqyGivuVrPR5wqz 8b2g== 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=zQ7jV0vB5KgTwwOQY7c1thExU7kqIESeQ3qHlzGqRVg=; b=rD+9gMYb6sX6CuMvAqKtFNWuFS0LipJ6uu8HQDaBOTjjiBVlWJcwSKTCWc+uNZsboE Jy6RACDl7n3C7qD36T2vGyIss9T29S8wC9vtk14iWQn/KGEdtQmHrJJ4qMF+uSGUEooc TanyXLuw+6p3Qi4qQRTjrXdKOdDO+TCA1geTU= 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=zQ7jV0vB5KgTwwOQY7c1thExU7kqIESeQ3qHlzGqRVg=; b=k7GilDA0dcE+U+3PG5HPtGNifl2sG78FC1JHf2ORQwrCsJVnpFtfrrVi+/9XWYH0H+ NLMdiwhzciXXO33mHY02G2ve/MwUNj7/QHnQN+iIlgn3CH98+o7B/cHgpT0AxWAulXwn plH9IKzgSpdIU0L2w7jLfqC/kUl0TWyXEcPeZRcJjTCA10X4GdyH9ok74Vg1UBXHH8S8 5zbyOVnI0OB3qj7c/S9mTvw4Dr/jEsLUpSdyfv4o6TDy7Gqf/58s6ROhpzoT6d4ey3aD E4pY/JbcZv2tiGwQSxzhRJRd/hAUyRL6Qbu+Bi8oT9t1L9qJEw3xOKg769WmSmZ6XceN A4oA== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuYlLp4CYy2Af6O4Edj6StwOBNohgCw8wuF6g7hFKj5RP0wq6ASL qFr1jvC5hcQZLpBNNl+a+4Bn/xo3 X-Google-Smtp-Source: APiQypI/K+IyVpbcXoXVJF3FX2J1GhTAWjudNAgyfv2/OUCzfeAXsDR95A10GdTD2kXNPODwQUk4zw== X-Received: by 2002:a17:90a:3545:: with SMTP id q63mr33701455pjb.109.1589354154616; Wed, 13 May 2020 00:15:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a62:920e:: with SMTP id o14ls414956pfd.4.gmail; Wed, 13 May 2020 00:15:54 -0700 (PDT) X-Received: by 2002:a62:7d8c:: with SMTP id y134mr26029979pfc.231.1589354154112; Wed, 13 May 2020 00:15:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354154; cv=none; d=google.com; s=arc-20160816; b=QwRQ208JRqmkBBG0vQbly2dpnPxj+Bz/f3rBWNHztlFUgI9BRdRG1fpb1YG9T5IuHO CmBQLQH3sYjpN/29van7KUBrVuE6RzMQ0ROktf7MxTbCiVIRYoESfyB/1DgZDKpwWQi4 flID3JKpaULMGJMMTQJPOWe4aeQzjTm9glN9S7ezeVCx16nUokF0VE9buJy1mUDYjDbb ykwx3K0weTLqPYOlrZQl3AksdvaGXGCA2yqQb3Gu0YsXQ2D6tslyM7N9EVrSkI/er+OD tjoDB5/K53BAbOA+aSwcjJi9KHXs/lgOttKGcqqe9rDQGFaKNIQTimAUrnh/1UbE+6D4 vH3g== 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=2Fzx52TZfLBERSuL4keI2pH1V2y3+3NjowmcHy9G9BE=; b=keNzA+dsUjypkHfptPB3M/dhbYH63ecx05+lipfq3d1tPHLJK6n8/5wldzTQ/ZiwWi Dvi82uuZ9wc1fhsNDACqXe+KrTPGXIwy6TmRT7MVzXoaW7UA0CTs4H28mLRkUwL2ba2B xXsaUoHLDfXv6CCrIWO8nHUPfToZCUCkqqsO7TDG1Us0hB+28nklLWKmtLmqwZJ6uQq3 ZxiO90vD7vJPdtU3ew/72iQb3mqqc8CvtlqEt4CzvCWpoJcYrENXWAaWqXHAFWXX1O57 oebO+U7f8ygVOV6TODgRjMMC2iuhhXngsP+/Z+lhor/wHwmALHTsBbu92rVwxhreqELO friA== 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 ep22si12498672pjb.115.2020.05.13.00.15.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:15:54 -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.16]) by lucky1.263xmail.com (Postfix) with ESMTP id A6A9DB3321; Wed, 13 May 2020 15:15:52 +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 P15407T140446440306432S1589354149129638_; Wed, 13 May 2020 15:15:53 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <988c85494086fbfbf59b4e90dcdfebe1> 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 v5 07/16] usb: dwc3: add dis_enblslpm_quirk Date: Wed, 13 May 2020 15:15:37 +0800 Message-Id: <20200513071546.5560-3-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071546.5560-1-frank.wang@rock-chips.com> References: <20200513071344.5430-1-frank.wang@rock-chips.com> <20200513071546.5560-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: , 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 --- 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 Wed May 13 07:15:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1197 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 D2F2C3F066 for ; Wed, 13 May 2020 09:17:56 +0200 (CEST) Received: by mail-pj1-f70.google.com with SMTP id 9sf22634717pjz.6 for ; Wed, 13 May 2020 00:17:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354275; cv=pass; d=google.com; s=arc-20160816; b=S5om3lq09Bi1P5DoXnGK8bkM2EQQpDhSRz+cu1GQAQFPwjoFT3q7DaEA4kOq8NV/4X znEYz5+KnVJcv5G6lBRQ/YABAxJjsw+Qk+wkT4HtTrMaLXHha3oWyC0i/BuZ6x738JU0 cvwcVui+8a4WuchHWBbIJJsk+ZIJtOcPuyVZ/sZoxvO4b6f4EaxzdsMGgSI+u1CPvOSE D7KM68ChIVmlSzpuCO80IiFtDAnxw5JsV9OPlqTrdenLyHGEARmt7gpyA2zvFBKbCr0j 3rZPl3g9UWhR4IfhqB4VXKG68XAIR/IjrIT8sLCe3lrUQivZlwaNDYPWkGIwT0/6AFAK BxOg== 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=4AOiEItqNQBMBaG5MJlym4sDbASnhFe3lZDElJulYKI=; b=Oebbd20HMjzamMgDuAug3LPZOCT6jJdPzEpY+URnfXW6UaucUoYVkmifT0s3G+opXy /Mevy8nZJGoZr6JfsXvWh/brpnHPooEbSajsY/ryreOQhq/nM0GFzB86NrPP61ZZVnbp 5Z8y+ZWuE0oIM4sX5te2iTRiyuCpC90j1s3PinCwVeHJSiiTAtDlPcW9WBTbqSeogWk2 ItKDuLE2SH6i77hwJyXNz8dZsNFGXC7NftOWep9sNGldRg0RNcc7SOFsrjKoU9Y8CnsJ MY7bgwO4psyhjvkOX2+TVnMXYIArjetD/GjYVT/jVYzO7KvZf8q6JwVOB/BQz2MoL7ws Bfag== 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=4AOiEItqNQBMBaG5MJlym4sDbASnhFe3lZDElJulYKI=; b=Ndy/WBREB9/Y5dWKzs8crOP1drXR/MtjQBFGuPDPj422nreWL9klrHXQJYWykjA6cr jgsj3OGg+ziFP35n95hfDdyvOzLldkgoHhlGssisH9/wMr34MgGj4G52bqrYw+jUPIRE 05CeYh11HuTFOX/vMqK7Uopz2cPeagQiqJg04= 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=4AOiEItqNQBMBaG5MJlym4sDbASnhFe3lZDElJulYKI=; b=E+G99Ft1m2X4mzDH1T7CWCZsOhm6QcfB0QSF39Qy24GPW+VlrPZP6JgLcnuwgoYYZ8 pTxq/h6Q0m+ZsQlziABDjtglI4QQuCXawt9ypiewbpirK7m7MBfw7YxUVOxFV60JLVH+ Ukv8+LlEK2YU1ohgpQu6Rph6elmBZuiK76/Ib2XiC2Wlah2h+MP8D6SUZVmT5CIRr6iF hMdfYsfscJ0x0VkslPQYUXpGjmNQ2aeVP0TV2k/adjTxpELeWsml4se9e7csV+qrjATK YvCJ/3YnHJbkyMXtHF9aFooTXqvpG8+yM+V5bhmfLfbmYz/AvbkAH7d+UfqDOb+WKaeh bYng== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0Pua+DoXk01W9UJmyXdoxqimVywVfyHZHKXzkvtwW+/jA1ezAguAU RPV5CEOqNR5ABHJgoSJuH375dmIC X-Google-Smtp-Source: APiQypJkFrvbXi8IUsqr19eKj48iACNwygAJgbIh6KIiDDbnZVJs7pZ60FZSEBN4ZC54xES84+1RPw== X-Received: by 2002:a62:2bcb:: with SMTP id r194mr24864373pfr.26.1589354275587; Wed, 13 May 2020 00:17:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:e283:: with SMTP id d3ls600692pjz.2.gmail; Wed, 13 May 2020 00:17:55 -0700 (PDT) X-Received: by 2002:a17:902:76c6:: with SMTP id j6mr21776337plt.342.1589354274933; Wed, 13 May 2020 00:17:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354274; cv=none; d=google.com; s=arc-20160816; b=dkMRkJ7Kf+hYNTPgMuuqs9SP7qs1MrHjodldb7HQyAJloODNszC8faEy7nRWAVDq3G ktaiHjBbKLKen+GI6dAscriU4YODxNy34ludzd3yojbdNtpMKcoJZpEhQy/R7XVMBddD iJtE8d65ihGMF87TjY58LoT1al2MU56SbtDl4LwxqqIFEuuk2nEcyQ4jiQEf9SXHuzrf IggtlBC6GU5epee8RISGMvFl1gacOdvwCZ1YkC76GewbirWOEdEmNqkw49eBef7Ftb5Y wA8m9cJP5aHXHQZFePASku2anp4t65tVQ5099C18E8R9F9ck8WMUeRRks1AoToXcaeGm 67Kg== 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=voR2mC0dTFw76/rCrO/CMjej4Bfdg0/gQJz9bWnsGIU=; b=Zs61ajumtlWmGhVDqpSSzB4UOowkPfnUG2qgaid5ayYQNfsJbkd4kOrF3ToOT5O3KW 8md/4DiDAjjsTtKXNNA6X9/sjz8TL7mdNvepCv9lsR/p44ll5cnvG2JyqseuRK05mGM9 H2vIbZOocGETI49kKM4qpDImT6NU5OjRfpPTLNN6aqlFUiLRj3E6Cl8DwSSbofIlq6oZ LeC+PcWhynz9oaI97BvEsUuACikqmYj31lvpF4ciKjeJ1NCnHbt6+mp0GFB2lZe/kzx9 8+NW4yYC/s9IoNZhDYRjzELFmG6yhADbCpOSLBYP7c4w3ZDI47i05Ixl+M0QPo1VTuYL jO5A== 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 w25si6998990pgc.114.2020.05.13.00.17.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:17:54 -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.16]) by lucky1.263xmail.com (Postfix) with ESMTP id CBAEAB601A; Wed, 13 May 2020 15:15:53 +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 P15407T140446440306432S1589354149129638_; Wed, 13 May 2020 15:15:54 +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 v5 08/16] usb: dwc3: add dis_u2_freeclk_exists_quirk Date: Wed, 13 May 2020 15:15:38 +0800 Message-Id: <20200513071546.5560-4-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071546.5560-1-frank.wang@rock-chips.com> References: <20200513071344.5430-1-frank.wang@rock-chips.com> <20200513071546.5560-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 --- 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 Wed May 13 07:15:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1190 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 49EEF3F066 for ; Wed, 13 May 2020 09:15:58 +0200 (CEST) Received: by mail-pg1-f200.google.com with SMTP id v6sf12989927pgh.16 for ; Wed, 13 May 2020 00:15:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354157; cv=pass; d=google.com; s=arc-20160816; b=CLG+Q+cDpNN+Uu92DL7o/pcQCTeSktLG2DQSBLjm8udF0D12I57oF5hPUsaMkjzgcl Zlu2ws0x4BRSanU9CnUbF5+s3lmjxNtduc4o4IkTu9e9OJpUhlzZOQEcHhm+synGk13v MV6Ql7ySgT4C2GraXb5zDxL1Bw3W9ieiomnpkf/RKgvTjLMRCzJ7pbFAk/DJHf/bMeaP s++5F5UrNC/qj1doPhpTAo1iIgbfD2yhWON8MMjDf4Nov0ZFvTB1Es/y8EzmG8r1D+ng aIo5GxtW26vhvNHfxuphndubi7cfs6pc43WO/CU3XqzzdQgUbdttfT4VAXeL8v6eYCfd NW+A== 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=ppsGOzyGrhBqLRqYau21zGzmI0o/FLmzJ0Ib9Iip/VQcYsX2CZG0V5tnC4o2FvA1l1 NQ4QpBbQfV0COquKkVmzuDMcVt5RCFLRWqqZL7CB4ULRm9pxuBFn94IJYNAHml9diD0N ame2bDkak3ImvQBHjX8jdR/mVFnDfjrUqohmTR1i4gO57IzAV0VfjV9bMg/nin2NOymx LWJaJWxBO2NNzOwDOf0ajYqo2JveiAvuETwLU3YGR/TUEnxh+uqCNR+KaGU1cLmAhfJg DbjP3Vay0W7gjYkEj9bccOiclG/LmUo13nvFXyb9gLVW7ug72WgNT6WzjJZaFW9e1Cea jnzg== 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=e/1LCDRj8p/rOW7qojIR/KOanDuW6UsfVfzxS/X11/8=; b=U2EFEr7HKlqgGuCTOuNdNliO7XUcEhVORBNrdcK/eCkN98RQejNiknkLYyiORrgHbr jfbP2iCamYQTzCR1NqYS3tqDtv0kdauZUKCiCnEKiNqsV1xu2fNzQ2pFMJHqSpVyd+H4 wrWQIPX05FudPQmFkOtfCkg/yQw8X+UqBDC4s= 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=hjNI6yzC6quUg68SFGLtjuz3b9LPXKVaFm9aLU8p3m8oFHPpoRNoahLyCg+4/9w/NN DSlJcjz3PccPJAyJ9ezwCRdqJamd8SPlgobPF/7+vyUy+pvg3/Sbkf5AaJdHI5OttdpQ V9D1OYx9PmUirinc5TvLnMl7B5I40O6uuKU6xvux5vsdN5uwCV1G76oBjwKXMWUmun5g 243hxlGjWXdlqrDS/HCrOcvtecpXwWDTb1leyojInA0tkK+c0nUDyNYgU1SCfZR0JTL6 sWk/RDbdXIn6YlpUJ7LMXY8A9/27gIw2aCd+FIfpEpj1B4fxYWE/NeL6LPd9G8Wurbe/ tYmA== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuZxBcarRm5AwcEghL4VLNaBYHn4P/thtUBHvY1Pclm6NF0VOnk6 mldwTf+C/7CeVuf6pSTbPh+z26JV X-Google-Smtp-Source: APiQypJqhGL/4TxwY1ZLmKFFDMbGgriSbONNvLd7YzYttVAns6GNXfh7YvdiUHR+EpbswDjSBQyaAw== X-Received: by 2002:a17:90a:558a:: with SMTP id c10mr32384459pji.53.1589354157106; Wed, 13 May 2020 00:15:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:a717:: with SMTP id w23ls499082plq.7.gmail; Wed, 13 May 2020 00:15:56 -0700 (PDT) X-Received: by 2002:a17:90a:8d02:: with SMTP id c2mr30343970pjo.113.1589354156406; Wed, 13 May 2020 00:15:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354156; cv=none; d=google.com; s=arc-20160816; b=Kdd+CcXhE2Fh/QyfunwEubiZeYMk9PKxNguq/9Mkj6OgYRtKGS9STd3Hmb5dcsq83s MPpk6Uiw0AUYIuOC9wDPxeFEUjXLMh3NlmgVhMfFL5PG0+qrrZKYwH10QbG8k7VW2Gcy +07PlaU9WQSSVepHUs+5dctdEc0c8ONhQS9Se5ylhoqbQ1/vaFZPztmoSXz7/eWCwJoO vuP1e7YBZXt+f5Bossmatx2HywPtyDtcHzTr/lafLNWsbKs7pXRb2CRQ0Wx2R5JpibV4 erFyCceyh3RGGHCKip/ByqzYfEOzPN4GbB4dnw1g+3vFyK0at96YM4B2UwjD8q2KYqMN f2bg== 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=qNPySMyyrzbohDX9MNBhZjvfPsuQ95+Udp27H75UPC3kzVuX6r4aedfHwIk/J/h1gP 1uoap5P0PAKF01g/aDl/cqcT+jDaPiVzz8jRC5m/SokZx7yxgXgGi1xpjQ95RP3l64mz 2cO0DlKm5jsQDyJCR2oivpOShAw32Jt0WTRr8XO8Iir8Xv0kB0zWDfyPycocfYojXjbs gm8cCYxSb71BdnK9lVc66T7wyyfsU96z+9/YmP5jOylb+P/JzROL0bN9eyBalFfddYM3 +p4lC7H8ZctECHwlgsMLZ6ujDptPcNErMU1Y1oguAb8aNIKGtUFUd7wbj7O4fY4kAe5f mtWQ== 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 n6si12319151pgn.270.2020.05.13.00.15.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:15:56 -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.16]) by lucky1.263xmail.com (Postfix) with ESMTP id 6FFD982AC8; Wed, 13 May 2020 15:15:54 +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 P15407T140446440306432S1589354149129638_; Wed, 13 May 2020 15:15:55 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <3ddc54ec96f37bbc93d37ee0e17b2699> 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 v5 09/16] usb: dwc3: Add disable u2mac linestate check quirk Date: Wed, 13 May 2020 15:15:39 +0800 Message-Id: <20200513071546.5560-5-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071546.5560-1-frank.wang@rock-chips.com> References: <20200513071344.5430-1-frank.wang@rock-chips.com> <20200513071546.5560-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 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 Reviewed-by: Kever Yang --- 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 Wed May 13 07:17:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1191 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 0C2263F066 for ; Wed, 13 May 2020 09:17:20 +0200 (CEST) Received: by mail-pg1-f198.google.com with SMTP id y4sf13007290pgo.6 for ; Wed, 13 May 2020 00:17:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354239; cv=pass; d=google.com; s=arc-20160816; b=sRK240ug9eeZpQZfwecCITYWgQ6URm/fZYUfyJjaCZl98fvc/tKHDbNqsddubuv5Fb tU2w28olzRYZTa8S1yo7Wq+YMxfrmNX3fkiANMcK3hXbhsgn79+pNr0EI7DudI1jDRcA 3wokAVNwdYTJ26pQJuQa/t3dobLIBRGP494+JhYvwhOFzxgNU5IRmRTSPefMlZa/1F7g G7tEdqSFbAuHEPhcHtRQfuf/Xvbhw3L9I1nTxPiC65cJDwyC1vejHLhAyKxETs0rGxUa NB0uoWwc+MTvWy6vTETkrvzr+/ncoKx6+f5lnIqtxYxLLZATcIuTYwPkzXdwmZ1FzhSc ujtQ== 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=IHQfD4jUZu+xhU3fyNritFaziareuHO9sI+UM4U+wk9oBEyrmCRC8wfUu2N1Auvyi7 4Yn4k13/0IkGwG3THPMrsmAHiC3NIT79iO03wjfyivFEN+WMrMavsB00Rk5ooVh/Nk/P g2c25B0jOhKwoEU/I7la3yhavzkyhjEZqy988s5m3KIjcHiG65klDRchcmceUaPfC21Z A4Q04VnwOkPNOZBDHXyYeUY57+IHW6LYbArjbLNT11hw3VajyMB1MmZTS66tQjW4NO+N oQz59P2AITlkVR/JLy/LcNfRYuFZ6Evk+3+QKYLfpS+U6iPKiMOs280x9BldUitSWUm2 kj5w== 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=Cpm9MIgdiOIkZgutL34k1gCUso9Jp0IgjhLW7J5+05oSVGfq+UV5Lshg+B3HYgbaQ+ Hrr+JvSDX79cF1WLVOoHdQBWAIF5/dZLA4f+Ch47arP4H61y+OI8oN1t7uo6QS+IXr4y ScxH4Yu/izA2AWNE6rQTQRVlXbmHGZpXsPGV4= 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=jf/HvZhGyZDHp0ctagoeaCAnQDTHLVTzNXqafVL19trQe+AEQOUHOpqiJAZyTjAezE CjkRJ3VQy8isUMTVSwdtZo+GrMcsGHOcWA91ZVvnkVkPAJ8GZ65el8/nQ74qCIaV139u NzziSJUC5/yyK1tfjZucPj8CFEMmIgEeVLsjknJNtuVvpz2nWUKx0tMFF27MTv1RJe1s 3TC2X1wxQ86S0mfQNnaFidDdyq+Q1WBmRZ7Xmcgsi5PXEkWxbQ6OdVRidyCqVzN5josp 5bNPp1Ut9Bk4zg/C9ZdseODO/PJOBBL1rvDlbC5BrlcxRNaWE94IAbkW2bP9FLPrskUY H9lw== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuYnvxTWngn2ZjV2lSpMnkB2r0dP3S2Klf0VDFxr3EK1gpTB54PT esYSvLORg6W/dGegB0nwtppg9KIk X-Google-Smtp-Source: APiQypIGwlJDRd2FQGhi9LQyO0vRnoUvJyjJwQ3gCW91jcv60+Vg+5vR8169fOYRVPSHzvmWVIt9FA== X-Received: by 2002:a62:e803:: with SMTP id c3mr24272567pfi.228.1589354238819; Wed, 13 May 2020 00:17:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:fe52:: with SMTP id x18ls383866pgj.6.gmail; Wed, 13 May 2020 00:17:18 -0700 (PDT) X-Received: by 2002:a62:19d5:: with SMTP id 204mr6167686pfz.189.1589354238133; Wed, 13 May 2020 00:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354238; cv=none; d=google.com; s=arc-20160816; b=csa6m1czlIwJ3ZtF0/gQHrK/1oqkP5jx4sgfcng5Pmats8fsPudhqpWpXySEwEpa3D FIHKoCO11OzbdvKUgIbgeWPB2VM36y1EcUgm8S3gSoWkp/vNmc+LPxA1VPl2gF7JhnOY dc+relwaXf7ylBy4Lqyjx3uj2nVgYHxAxqULW0cNjPU4BbrEyQ59MiKuUy0FpkgHaYI2 +SOpnRZj74QaHTfYkYHdGwYHhJ2qFnPGasO6jHqDe8YWw92ideFelkQ9wvU+xElpeX+H gNwX3cciqn8AbZ4iWMnGUwN6XliX5mEHV/UNQSn7SH1XcBNw2/hCczUCOXuP4/cjjrUU TtvQ== 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=Q4Bg461WEMbFuC8zr6ozO0MNnPi+0NokCyVot0CyEgKsOqKinlgc2bFAGhNLqnrdOz y1kTJ4AV5kQwJeooOO5oxn1aocWkp1L1PK/NbWdz/FkzmaV+LCftKCnLVOB6uvPE2CUc LDrw/05biPx7VXJ517Ze72JAbF19ZUeLBdAyLnTO3N5sGZaTY+8vgBFMFgE66tjTkZMx HLgvquAG8C9KCtoyms/W5uRDizsUypJbDKiMaWBjhM8yIbhXW3ue5Wtzs/VBAGS1+PY1 2OrlM9Jcobh4Fedvj4Ac8o2JrtNwmuMQ0lnmBNfnUglypdUm3cmAik7V7u4gweFIDqmR 6tUA== 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 m129si11990066pfb.56.2020.05.13.00.17.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:17:18 -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.13]) by lucky1.263xmail.com (Postfix) with ESMTP id D133282755; Wed, 13 May 2020 15:17:15 +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 P7429T140153093875456S1589354235047068_; Wed, 13 May 2020 15:17:16 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <1432dadebfece3d9d163dcc4f149b5af> 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 v5 10/16] usb: dwc3: Enable AutoRetry feature in the controller Date: Wed, 13 May 2020 15:17:04 +0800 Message-Id: <20200513071710.5651-1-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071344.5430-1-frank.wang@rock-chips.com> References: <20200513071344.5430-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 Reviewed-by: Kever Yang --- 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 Wed May 13 07:17:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1194 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id E2A9C3F066 for ; Wed, 13 May 2020 09:17:24 +0200 (CEST) Received: by mail-pf1-f197.google.com with SMTP id y22sf4996109pfb.20 for ; Wed, 13 May 2020 00:17:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354243; cv=pass; d=google.com; s=arc-20160816; b=LEL0tN+X0Hw8CT8+mtzWpqnMpw+Unoeev76S6ISrDlWJC6A+0iBkyMp6V2beiUux+D C9qGklfdtFxq8hovCFRklS1wUW73Yuxu15vaV8ERftHFWwlB5bVObgTu0/Lj2Df/7mPE XLHiutDa6/0g9B3rOSUrbkKjE1jRTSEhX1RmGZvBDquNQ5Pckve05XKb83SqYgQotGQ8 oDW43hgqT3eoLC2fGNR5gYe5qABELH8o46s42dcZoSklf8Z+C1MlSyhbWMzixyAI/IcE 6kV1zuCqhgo6NjTrvgEc1kCw5fXE8gVMbM9/Arq13tFUoGVYD0DMHfna0FYDASYLnxUA jthQ== 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=tSwt0Qmx8J6eQfsJFokIuZ39ZEya9vpNDbAaTie4uBkQJf1/SdatUvAI7cBTQaeW6J T4Mq5unVC71JfswqbMPHDKRsU84T0e3e8/R8YejCmBNisURTGKhyr2poevksk1jxTGGu yYagEsaTGqwjY8HxYfme3JSC0Tj42UFddZ7MbngU4jkUkmLChlQKoR/6HfL3QNM6KRdi wmFZUk39+6K5b/Ta67LC7YQT92FNWGe440P9xLoSGrhk3BD6IruPVL7nxXsUbdnOSaKq Sgva7SYrVzabzeCrINceLyTVwV4skIiZjujuFoEMGS2kZurLdbTUyv4Krn4vaQR4IjLj 6HRQ== 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=Y+t9WiIYNgMGLObOa5j65NZsgsFCAMB3iKOgw7HWQc0=; b=UyBtsUx035VAQUSzv01bXWvMKuz60vTrsSO4ahkcCGoN2nbC3znIS/Q2dwFIQP6IZ3 if7gyrs8LjTfaFR7+J2j5kBPmBc/isLWAVooughf09e/xvR+9vHluzNFTTxgZ5rapD08 yLkKLLC63qFBKJSPjvdS8E8zhkI6LTZ57cj6Q= 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=VoRDsz3ALdmMAKp/6FsPQUdrpd7jKF//IwLhJMWeDqpVjxyxGLeTKkHK2XaMKZTaOT XZZfnkC/pCA860/t6xPMrSp0hYh4tCttZ3AVajw7N81gRDdl4RZRyyE4RbpXj7nRxMtf sVNcSLB+CNDTiNID4UW/A7k/aw/RCU+3wzD0WPKC8ti9nhtc+5pLZYKsfgkVgS5d6LlE q+xe2tks4xb+R1Zv/vjxoiiaIsREx+WRM7DJL8cSyrsOHhYx0kNczLOO7aa8tUFWdSYw FCTlbl9MBVYoog2wLjeLGm55llRKVEJLeQ8r79fwLqLyl+uXjJLRw6Xj2kdP69o0RUj/ XUxg== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuZaZEHL0A4aScuVP+o0gpEQ1ragoIGglDXCZyC+9eaoWkoM/xWv JGbWOtd4vO7aW0+45qEZZcaFmyMR X-Google-Smtp-Source: APiQypJT1RJw3TtRqfqzeJnWHXOoa8tnZwXILtQvWHYMcprVY+amGq+kfvJT7mF610s8AH9y0jHAgg== X-Received: by 2002:a63:5d25:: with SMTP id r37mr24031025pgb.239.1589354243546; Wed, 13 May 2020 00:17:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:c713:: with SMTP id o19ls601507pjt.1.gmail; Wed, 13 May 2020 00:17:22 -0700 (PDT) X-Received: by 2002:a17:90a:1743:: with SMTP id 3mr31454268pjm.106.1589354241808; Wed, 13 May 2020 00:17:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354241; cv=none; d=google.com; s=arc-20160816; b=bmCoK+QYLcVa1xrkYKLCSA1CrY+RkR8xIVKZLNZUBWF9CRnNIW8xN6ztSMkAuUq893 oiu6lsmYeTj6dU74OXm3BXwghoA21u08WJQCxqs+Hi4gcAV/nJV07XVN/SxGIK9QZJLs vFWyqcBULGHSQ9PLl8fF4NkpP2fKTyk5UrHdsCWBF0ryhujCquRR0MC4XwK6nva5xue8 K8Glm5fRs254oq0Jl7kX4P3BMbvaUJl3SU7P1egl69B2aRylThV/PQBcnzdeMJq/H//H NwtpG2PMK/O7pVQIpwzfdFcrO1lIT/2FWMRLHQp3fnS6bmHfQbsKgVXVcSKuloi7vJFG Pvpw== 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=QdU8ZyFr0nWqiYgiCTp6z/csLwKYmGCtTv2pqr9/Zqj6ymrKfWw6uz3upuLejpXQIs jfIV2j5+mNfUD6HyCz+85ulgwlgO7KWtPwxUHMIZvwLNWfHm6prhvF8oIftavAvw635J y6uA2aHoqjeswBGZaJXIk5sDKHSyPC1OVpBH3HWPfozNOK5pooM+RfAHvQrOzbtU8hU9 y5nyBxviTQtQHpj81fLOvu9MjbKg7PPSCgVRjgUIsXNEeRdSWg0D/tLuH2eZJoVl3ZgN Cg35N1OVVPlI2smkVFaACX3JHxNbVVLPEfvAdfb4spxGrSVsUGkCsz8xYkvwEmKjp0GH 86XQ== 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 f3si11861640plr.335.2020.05.13.00.17.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:17:21 -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.13]) by lucky1.263xmail.com (Postfix) with ESMTP id AC261A5504; Wed, 13 May 2020 15:17:16 +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 P7429T140153093875456S1589354235047068_; Wed, 13 May 2020 15:17:17 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <4e745c604e511cc13540b4eefa133201> 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 v5 11/16] usb: dwc3: amend UTMI/UTMIW phy interface setup Date: Wed, 13 May 2020 15:17:05 +0800 Message-Id: <20200513071710.5651-2-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071710.5651-1-frank.wang@rock-chips.com> References: <20200513071344.5430-1-frank.wang@rock-chips.com> <20200513071710.5651-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: , 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 Wed May 13 07:17:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1192 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 224623F066 for ; Wed, 13 May 2020 09:17:22 +0200 (CEST) Received: by mail-pj1-f70.google.com with SMTP id o89sf999817pjo.3 for ; Wed, 13 May 2020 00:17:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354241; cv=pass; d=google.com; s=arc-20160816; b=VpCzn+5bB/OuoN1IToXoIOpflVB0qCrDqd4arzOWyciEJ6Cf83K48zDqW/0VB1Psvj gNmFhnv9Kyu03qb84gJC6SieORak5geSOeOIlyLkXpTTKjnnJifY/qY1nOEBblHwIdAx gB2AD+kBWTwynLeT1l+kxL81Br+gKyIr9agISzNl+PnuhXoZpYp7jQm02jaunmS1CBhg hghDBl7MJVuJ3eVvcSBp0edCbaxx28J1GfarB9c8C9TmJd1j/SXo4EJwLaDcBTYm8obs 6peHWQbmsQmT8JvCJ92Jnm8ZMywpoPc/4WdOp1TD+svX8rZMPffSHDjIJvAbHoJ1wi0B xtig== 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=7oqw71i4IYv4CMsZJD2eCusQsltBCcvFkkSVmIXPmMY=; b=qD8ze/fdCTg2JehyYU6YAbtzvOadrkuFnojBASi701MecuZMSepOLWZDwFoVXylXKB T9dTS5pKK8NHSj2/LQ423ZAmPISr19+rQep6Dvq25VSKltiNtRHVOZIR3oLrzZaUK/Bu jgTnbXrjazPvBUuLxhCv2pj3C7/ruM11xVRKssDAemVu2SiH5/e0KhNTErYlc+rISyK0 52XHtrCWLRvLPiuWaWzsa3D3JIgvC4qXNmQKXcTjQGFLnf9Gd1beDWbAnpxDFL8UIiAF TJysOVEc8O60meG7F+yjLMPpffCLXNkcoAe3HUE9pqUvaSKHwYzgUEoQ9tMYvtK5Vs/g 3e3g== 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=7oqw71i4IYv4CMsZJD2eCusQsltBCcvFkkSVmIXPmMY=; b=pG1+AAgqdNM8L6fYD06e18KfeptaVuAdpqFoCBK1EKYziouMQpNH1ahZUUQRTAYZZr cPWZ52AOCaibM8+mXkaBupWYHbcwvk6KGi+kSSHscYnarYukgk7Uzc8JhlapoXNaLot9 RVhLcKs+GKKSWkTVgjQhhxXxXJD39GC92J4+U= 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=7oqw71i4IYv4CMsZJD2eCusQsltBCcvFkkSVmIXPmMY=; b=Z6y+vmCYuFLeOWIngM7h1QyoKZDyccye6DxmM+VRrSUhxVNhK9jd4QzvVUPvLG17Ru YKJZGvrdtqZ62Ar416i5udXTycIFbWxc3VAdsdhJbcEKeebBoC9dr1pGpzY3FBJOwlPi ARRdgCQBq/aZ+M3ANsCrHbymDWTl53tkTI6Ht516+eYN3ssW/14XLwU/omj7cHcGAkgM VJfiX5LODhcUzVxf2W5EhilnngyL14giZFWBWvR++f+HUt/fYhO4uiOpZNnzH0dBuHIk Rv+u4FHV72kuxPHYN42KTvFFTZkBsjLwfjyo5PDDmrhHGrr131kE9n/qKB/SfZVw4oUz 73Aw== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuZat/r/TQ+Mh5Sl7g1YcwVG7ZA285+dIrbuu1/r/E9PAHye35h4 a3xUfIls+2VwfnF0tk2yyXdkLxSp X-Google-Smtp-Source: APiQypICh8X9eioEJgeGbGvfTCLrrBzuus89/W1820DsaQaat9ErXwob23tZsJg217m/uj/4zVnXVg== X-Received: by 2002:a17:902:aa44:: with SMTP id c4mr23116064plr.302.1589354240904; Wed, 13 May 2020 00:17:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a62:54:: with SMTP id 81ls462443pfa.10.gmail; Wed, 13 May 2020 00:17:20 -0700 (PDT) X-Received: by 2002:a65:5186:: with SMTP id h6mr24309934pgq.453.1589354240273; Wed, 13 May 2020 00:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354240; cv=none; d=google.com; s=arc-20160816; b=pGTv5MFp3i0eOlx4spau0nYu+c4Dl4HGPoewrmxnnec9FS34SLhlzr3bJh+9g+bKGH 4Pr82qeSMuY+tW7jtIpX68Yi/FrhgVBcx2PM2N64j2azf1Tqelrj72OfUfv/f796bL6Y G5b3cwHUQqVrqjS/PmIiyuCY+aC0GenLXLqdS0f05xgbiYyMTMOfs8vWhskgZ6a3scMJ UFM0MLMtQsQS9CZ2wiUcSwctlNrdhJB1BsTtMKrS6FoPEEgzYVeQLoLa69b6ikIRzEIb +gLfUGpIo2HQIuu0/CtVfnmm0ym+3oD630Qkt7zKoshB7Ppjp6F2OdZhcujfMsmWPemM x3qQ== 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=gC6XIecpHlXgges4pePSkn7IT9beubgXDNFD7rhvtM0=; b=avGmZn2yOzGs5DfOCtvIJlAO0w+D+DvBnVnTuiV0tNuMFwUkGcNfVdf/GzugBNNU3q K7xOSW9W3RlxgxDDIHulqtc722OYOVuPH2RWjjiqZSwJ8XTkv1gI7ejbDPtub4I4XMhD QnWgwf62EmiP3SP2LRbWikaFWrKeWxykr5RkoYcTPDOXo08T0WZnW9LZCVKgc0H+e9N4 l6z8Wza3wjv2XctAHH1WTPWtO3v63kbszXJ2+Fba1FMMRMPZ+r95J8jjDfQXrPIQQh1T NBNhbCPhLtYqxjcCJDwUzgUme5YNQnG2JMdIirLQNKs7/0Ry/RTUTcVyh6tfZDk0EmJ5 cZSg== 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 r26si11726029pgk.366.2020.05.13.00.17.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:17:20 -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.13]) by lucky1.263xmail.com (Postfix) with ESMTP id 9E483828E2; Wed, 13 May 2020 15:17:17 +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 P7429T140153093875456S1589354235047068_; Wed, 13 May 2020 15:17:18 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <4d4b14dea0f0d84b5421458177f876f5> 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 v5 12/16] usb: dwc3: add make compatible for rockchip platform Date: Wed, 13 May 2020 15:17:06 +0800 Message-Id: <20200513071710.5651-3-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071710.5651-1-frank.wang@rock-chips.com> References: <20200513071344.5430-1-frank.wang@rock-chips.com> <20200513071710.5651-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: , 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 Reviewed-by: Kever Yang --- 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..421e0be135 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 == 0) { + 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 Wed May 13 07:17:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1193 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 B8E593F1FA for ; Wed, 13 May 2020 09:17:22 +0200 (CEST) Received: by mail-pf1-f200.google.com with SMTP id x76sf14128618pfc.17 for ; Wed, 13 May 2020 00:17:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354241; cv=pass; d=google.com; s=arc-20160816; b=Qp5CYPFnjAUH29Wc1We5xPvrBEM5ztUBIaOKE+H19vbo5KDFPzB6ENDhLZcQxpWauA Z2PNXNNLUdAvqkKl8JLxxU4le+SCoDWVFIpENPrD8uH2rgHO1n6Mxg5UTtoej0/dj2sN QdCouO0/+udIavKDc77GPuTF+B2A7/A6mcMMwjv835VA3rM6F8UPzRzQSHKfDjr/U02f 7Lm2gUEFyZN1nFA6olkNcMZMxSZhXFG5vX5wjnQg7IG16zoF0Cn3aDSc/RMhHhnJhfPH xAdImRnDxFv/kGsAiTdv1/G7QbyRD30df973h6hCog25qLv0pTq+02J9qNV+mhsjVIob 09ew== 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=z8IMNl/wiOPy5UHPtKEECHk8nqSZAuw3noVEaLPwt7bbkUiQQNuG9JYUDdIDtdjkyA l7JFr2Cm/qr9jb8Hn4oUEzG27w2wSdiehCnVZPYs53mb24qKANkcyf5uJ4ooy0CvkClE GmllSIyR4ctzimzVnGfzlxk6R8QAn4Z7QqmTz4RFdsIqAnCszYyfz5mSON6hVOsFHbhc t6gwjw4ZE4aSN8v4DqonNPZVTsYYVsE0NSdy0h4WxrG4SranFbWTbf8jknUHBDssHMvw HLmGUDwHFBNr6zk89CKWRUBbk50euAbcx7t4BSH142+76ksdN9EwYUX/33S7ROxFJEc3 xyYg== 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=d0SB3aTUd19bg2a4MG4AqnXF9C1S5PuzUbNz6JPp0tU=; b=Db9jUc+VInxKXR1EJKthhr/JHJfAszasoXjW44i34rsdlUxrl5MfrM/yhgjqpbmL5L G4Jcjoezo63DxH0ErcgvX20Vlg/hKNfj628Yi9r01XIioqvs+rccTluh2j6jaENdzSsk 1Ca7D6sw4mGDHDyVpnQ9xeiJvxLwHrn/+LoOQ= 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=dsHzx+eK3okzmT9zzy80oAgThnBkEtNjKlmfcmEAZGKNkrUBpyhT2KiwDrniMypbuE 0whvjoRUwCkkoMpeTmz1u2ch3sbzjQ012BmrPWLjRwxXyVJ0tFB54hXvBRF9HbHvxeZ3 lbJgPQIWEpjhfdPWJIGS5niy3Ayr93gplvIUiiNJHhVPC5jNzqItzWQ0fAG7bE2FZss8 uZYF7AMu2xEev9CCM+qcQsvTSXX8Bc1DqVZ/xwwVml05XzF3nOvDCDRzSMyZB9H7iB94 HRb/9kkkO9KabTPQ+vYOwGaIO26CD5m9Z8MKiA5yX8CNZYCnFPXRBTbEqFuoEUfEIT/y 3Geg== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AOAM532TNns+e3INyN3qOl0B5FGCeZ+x+P/9GDAkuByjejsynzHIDITK RY8MWypFrQsXgDIC4+5WSCTJNJsf X-Google-Smtp-Source: ABdhPJxKoZTpIwL+5oG/VC1UoBrwQQtYRgw7r5kiXYKx6rhqpfglUIo4clqPXsTgOFysdsV3mlz3iw== X-Received: by 2002:a17:90a:8818:: with SMTP id s24mr1926698pjn.131.1589354241583; Wed, 13 May 2020 00:17:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:9117:: with SMTP id 23ls476389pfh.0.gmail; Wed, 13 May 2020 00:17:21 -0700 (PDT) X-Received: by 2002:a62:cf06:: with SMTP id b6mr24704036pfg.237.1589354241098; Wed, 13 May 2020 00:17:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354241; cv=none; d=google.com; s=arc-20160816; b=bgRgyrbetPkXi8PzxxSsPWgxKv1h6kKXr9Z2UqNkP2eO1kb9xcWaLOYq40oWDlNOLP ry54PcR+Not0iXJuaXrfdV1HGItwevPlvfEHpwURO8qso0FpLN59r4O/Sr0bZMdVgVnj eLu4TCN7vOWsCtyVxLV2dHT5YN3zJoDemg2vwkbX8aqV8A5ST5UUrOm3YZ1NUTKE7X48 NoHx5wykOIdmEckbQVa2rajkm5DQuvk1TkJ/WQU1sIa6c5Ltn8TVX8u/8va6Jhiu4gM4 fiNxTLPi3+AnA/CRboFXdXZxJLsHuhCtyAV05EIP5PKjExLjM1ZJgLJ3JxCWKXmbvI3J WVfw== 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=b9yHiJFI69AqKM6iDbnnhKFHQSCHWfGgapJQWK19qhdk9yH+mlNCKlJyQbGbyOVDnF aylrHMXOwbYnEz3V1ESnk6ZJQysdBJlOHZS3ycC8dHqdypLufrm7OtZG9C5ZlwSr+P0A sCcUHXrvCwZa7JfDdf/qazttf+96KV2UiMliRNrInFCboSsptbGXe9KYhMBYDDTgfrqF Gpz+3E6ZAYWqfsqn8EuPCHtcFwkPq8vUL67Z9lU3ZCRrNxK1ROy2vNdk7FaAR/2hD0E7 K+UnqGin9XFBMvuVesUdcKYKP7gQFURyj7dR16DTUdL99qqYce6KXgUaKbkrwwuw3ATK h3HA== 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 r123si2811137pfc.3.2020.05.13.00.17.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:17:21 -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 951B0CDBDE; Wed, 13 May 2020 15:17:19 +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 P7429T140153093875456S1589354235047068_; Wed, 13 May 2020 15:17:19 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <31ff6e8d57bc44827c21fad1fd4a4a84> 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 v5 13/16] driver: usb: drop legacy rockchip xhci driver Date: Wed, 13 May 2020 15:17:07 +0800 Message-Id: <20200513071710.5651-4-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071710.5651-1-frank.wang@rock-chips.com> References: <20200513071344.5430-1-frank.wang@rock-chips.com> <20200513071710.5651-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: , 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 Reviewed-by: Kever Yang --- 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 Wed May 13 07:17:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1195 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 42F3C3F1FA for ; Wed, 13 May 2020 09:17:25 +0200 (CEST) Received: by mail-pf1-f198.google.com with SMTP id i128sf14200921pfc.4 for ; Wed, 13 May 2020 00:17:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354244; cv=pass; d=google.com; s=arc-20160816; b=i/22B2hCRAc3+bOdrU9aIUEye8YK4E96Qo2rXNc8l2/cu/8RVIBUrqdLSAdiHtY2S1 EWlSWkiglp4raicwp0bM2F67MnFP+gD6arA/EpAkgJNv30MY94OG0GuZomzfbpxCCYtp e/fTrHRb1dttkpvUzjGFZ0v2NUfhduszExVEHWHO+MSMCZMVUCs9F/XHCQcI+AtokQH0 AFigKYU66HFRlwu5JYTPFGo45vUmc3LyZ4V7Xtg4ugq9w0RvTj+CHxQmGtsLIDckeBOf Oe10KFizQ3TSVbswW1uKRJzaxyq0VjEITgMMBQnbvrXe9nGnzTm9nJ8nVGpeuTy87N+U tmeA== 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=mi6fNprqXhPupgtbvwC7JOwR5gs8XNpGewtKqNM84Hsn9bYmk0MeMo0Dw+AFh/6Fx/ NIYcg7YcBaAaE2kAQqHFTkZ4+vGZVld1DZxoCz1TPz0YcIEIrkduMKoMnnQrQQssHmuF oAhiCyj9iPJeiavz2vSR4f5HdGSFui41tJNlhyaIXtioy3rLHA1mvZK6al3pv0SdBKgt F4x+Ykt2tpeJPydI24CiYWSBn4c6tcMoyn0dnv7yCatwPu3bnMdZBsBMpKISy24pi+83 aKUdyH9m7CnPsrMw49BY72odcSzK/GnFkN2rRDKY5AZAcOysYzGYRfz0A4Il1tcVAhsE nKNQ== 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=f/lweQMiiGBzrLFK3tXEXKKxxG8o5YINIIajmqB0e1yjec392jBsVX12Z+77q5aUc3 7dNC+NOlMqJ0lpJFuk1TQbQ5U0uLr5XqxPPgqUhmYiDGhVtt38aFzr9bLD8EGkbmxwrn icwMx0rxf6taon3MTnozbUCixSoYSSdRcrQA4= 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=g7p4QRzgPvqP7RKXRLjgVnZ+4ueIcaV9eJ7JLOlmyZAmsx9EQz4yjtpqyAL0H8/IYx zSKAxEHiT1LzHKN3MTzi3c3V0lz9UyMHZn/h/nFAHBQLIREyw6iLho4GAntHRvM3Bwg4 0dhHQkY2SXhOau+MJ9/bHHzlOj3LW7c+OrjXJxL94WNrt1pyeaa5033ddAxDwaeWNRFU ssj1e8MOt0WNy2iRY52g7qCp/qOAA/rpmJhsj4gTZ4JDnLZiSLpDOPbeEZrSxrjpivHK kxYFhUkD7vTb9I+ERIB/3qMgICY7NL9Eu4XumWe2CaK33Ip8u0IjuCSUkuAya3q+1V8U ogiA== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuYmfkZxoZoSXQsx+o7kImFqwad9AVNLoxIdnogHAP6bsSuhNp4O cpK4Vwx2LiALA80dTF9choxkPMxt X-Google-Smtp-Source: APiQypIvgYA36LrOaCanspS9dtjpmCUb0KvPpjFv/NmRpkM9yBprzcieNSgbeNGkNqssA61cGhzD5Q== X-Received: by 2002:a17:90a:6343:: with SMTP id v3mr33466404pjs.127.1589354244122; Wed, 13 May 2020 00:17:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:ca12:: with SMTP id x18ls600177pjt.2.canary-gmail; Wed, 13 May 2020 00:17:22 -0700 (PDT) X-Received: by 2002:a17:90a:8415:: with SMTP id j21mr5750349pjn.186.1589354242342; Wed, 13 May 2020 00:17:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354242; cv=none; d=google.com; s=arc-20160816; b=c+iTfkWPhoDZ13ef5LVvyYLvIPXzsTdDyl9RBGErV5Lcz8ocUwjGYn5QWtP8kJ/bwW VtUHi2wOruJNsQrzycULxSjleykOK68751zZUL1Vh5n3JPTUQUwoA3LalzRAuYIkioiL bCkndWpjlSWY8/896Kf/zDCn2IaoJAipKU3Q91qaiJCT9DDAS6yZlBOkhNlz4h9cx0Cp 848LHmU+8zhX/XoFiePC+qWxbui3uUl4gna1tywRBG0cCPbmOS9h/maAPfRwRrHxc2ll 4zeTCJ8TPM4RD/kzsBHMeoXgxLSlCuc6H8lqafSp8KLTxR8yXeUmSzxhIFPnMKft8QKl 95Og== 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=CRT5aP5jhRqG6qHY0vZkdgguvv1YYUDN0qOn0ZzR0ubXBiJSTVJTwYjMNpQcLWALHN wyrADhm0k8OJLHmWER926VtRPtFsRN6lmiuIKNPqtVKmAP43qeFwL8AdS2Zm3oegqibL PkVkPtTMLApi6kava0X0IJleMthzLZO7lrRGWaVyNqeDY8CPMZICLLjV+UdWGXpV7V/5 r0TFJjy6rzg0Z6OL/GIWNXFusFuUqNCWXhYxiwrO+Y5k2+tKYyQYrUXwl7al2BtQT4L7 C1gcNEvyWWTIV4R0qbp0ozUjrU5FMmkiZwE+QsMFu1Z0hCL+7rYEi+L5XtUJmdxiI2YX J3Ew== 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 10si8472331pgg.316.2020.05.13.00.17.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:17:22 -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 66EA0B308B; Wed, 13 May 2020 15:17:20 +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 P7429T140153093875456S1589354235047068_; Wed, 13 May 2020 15:17:20 +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 v5 14/16] ARM: dts: rk3399-evb: usb3.0 host support Date: Wed, 13 May 2020 15:17:08 +0800 Message-Id: <20200513071710.5651-5-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071710.5651-1-frank.wang@rock-chips.com> References: <20200513071344.5430-1-frank.wang@rock-chips.com> <20200513071710.5651-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 Reviewed-by: Kever Yang --- 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 Wed May 13 07:17:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1198 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 43B383F066 for ; Wed, 13 May 2020 09:18:32 +0200 (CEST) Received: by mail-oi1-f197.google.com with SMTP id b14sf596062oii.10 for ; Wed, 13 May 2020 00:18:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354310; cv=pass; d=google.com; s=arc-20160816; b=bbI1noCnqeoczGxBY1DfMe8qi/44ZLLX4rSvP3hU9KWBNgOAJIuXiITAgkgdARQymk t3Qsr4NHKzYT6dxlKTPCOx746uJ1E/5Rbso9tb/FfXhyPjrycmuyFGWTZgHteHA17SWa T/GPQhE78PMCs+PHke89oaHP31GELWT2A0vRS0HrWLFIwpEI8gi9N03pAaqWcgT8Gg5L z13YIsh7WZX1O9H1GKJ1uaLPHMynQRN89L3H5pwhboQTZrBWkqz3CT/TcmprNqtPCSGl bgB7VobLE38QOEKvGnmBtpuGpbUlGdcF97syWIumA9/+x56mxUy+gcqIzkipraFiB9XH MCJQ== 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=ewKAJ40fUpmdPKhxHOJkr4yq2U8n3UqguBJveVLG3AHx7rA6juPZ0DRA9JQrL0HBg2 eVtiSGrIFoJqb+BnW57gwFqVl1gkLwZy8kNEh9jt13IzfItnbZYKC26p7GuupQBdnQK0 cHAsQSrnwtLZtQfrDGCZ7JgRimTP+NBf0mdJJck0TJwZI7plCJj/SVRxHsN3ipnz+CKG wPRy5zGX1YltIvcYyb3Qx+scH0BCeHrAAd5abJFhmdMCqrXgoNX2cSfhsY0NX9E+qEH4 C6GcYd0vPvEZgr5fp7m4DbUifVFNDzVIPoRuRY5XlNYmueWxAh4Z8k/M2IpZZbT2o+ay agfw== 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=Rim+iEZgpRbwOZ2gH3xlLRabfelZAitZiH6PqplxvbI=; b=SP69WPNkTBYROBbFX/jvLKcpEBAKcPGbHFqRREu2e+bvShe733aTs91jR6oiwxwIfc y1m+FzltQo+BsS45sM5lQPOze5nF50AmNC0ESa9ZSqzwO1Lpu7fSKUybZDd+fWwX6tS2 42owiepFK1xpaSxoGMMEQIKCfBBEYT6wSXik4= 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=BsASrXIyvRtkbsD2QA9zN7btifSoIQIRn4Z8pCDVzLKqTSfZCIgIpXWwhe9AglNuFd Y57ZPORXCzABszrt1nAz/cB46hkR6tf/W1XSuClROjuhiWUPCATowLkAHqqR64iUbLlT ZiPzFEe8yHZJJLIwV8Fo+Xz1td4bureim0qAlg+7B9AhJYNmIcbvd9YSc9bGfeG7R+ea Wfi1Ulci0EfuGS/KGb9XR/wyNIPP4uhKXOIrdSUM/rTdevs05XO1Hpn5oXWsDQwOBfR1 GIhMIVWIbp/wij7msjzCNFDWhHL7G3Kx2KRBPTSuA/iqPvvg9cfq0tPVbrz+76Zg3boR v7tw== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuYUYx3GItTtPR+F1uD30DAfkgv1cMQIVmmwLPNT8Es8E4wg1rVR +czcOs9x8c/076fd/1zsJU1f9Y7f X-Google-Smtp-Source: APiQypLS1H9mlypUyCTwondZXYpNVxTA9MhvMBb1TKzqRo8CEdXTP22mkhi6PRLkFR129189pFBerw== X-Received: by 2002:a9d:4716:: with SMTP id a22mr18756382otf.46.1589354310209; Wed, 13 May 2020 00:18:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a9d:1b0d:: with SMTP id l13ls274750otl.5.gmail; Wed, 13 May 2020 00:18:24 -0700 (PDT) X-Received: by 2002:a9d:107:: with SMTP id 7mr21190400otu.48.1589354304707; Wed, 13 May 2020 00:18:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354304; cv=none; d=google.com; s=arc-20160816; b=cX7q3Im5tZucr0p7jBWlcQFHaNclambwFUh4X7ITgutWOFXQxq9hNcU98ItdAoDW7G ZQUZQsAdVVA2YG5FmakgWnWMxMhpQo6q6KEo5PTppkKpGtSIqV53D/z1gT32vm4X3+v7 67jCzZ1kJbgwxbAh6HW2Y7MP/UMyyEiOMhVcZDsp3aciza/1EOBkTEMAx1HanfSHg1j4 ecc5LXh5VEQeJ5BHAdDwU8ThRWbJCwINO12FpQdfSDKOgzMu9oIs3dGALFva7TNbyVrc GrUe1i7CwcEE7PVlZM6rgoDvvsAPJakN+P4w3mSnhzRcA19kWZM3OCtmxes3lwm1UW41 yPNg== 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=ZfMtOHgpnUA1HWQyqWRJNIPaIjFIJ/gtp9WRlTJllSjGTzpKCeor2IpLXYMnSsv0ZB //8lK/OMwIG4aHFmPCZeQ6vDPdFSL+toSrR+/VuCoWnjdfSGJAghPoFFfKBwjQhje2+G bYHc/mxJX57MiZobSkj3xbV322TjliZPwrzRwDR/226fRYJ02t6Bb+suEvgPRi4yV+sP d3CNfhUUXghajefMDc9Al9UgYDXVWY5nHWqR86a5kleoYWCHBKg3ThoZkjNbpq3lmXWe nesh5/fKLuqcug2rbvZDf6bJidCF+/LSrAHmtrsv5y9fuGjFi6FjJYdxahKWoVqHSr5p 9B0w== 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 59si2163087otv.202.2020.05.13.00.18.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:18:24 -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.13]) by lucky1.263xmail.com (Postfix) with ESMTP id 6C817828E2; Wed, 13 May 2020 15:17:51 +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 P7429T140153215280896S1589354269289807_; Wed, 13 May 2020 15:17:50 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <7024d5e9ac74910e3239ec78feb28c47> 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 v5 15/16] configs: evb-rk3399: update support usb3.0 host Date: Wed, 13 May 2020 15:17:47 +0800 Message-Id: <20200513071747.5727-1-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071344.5430-1-frank.wang@rock-chips.com> References: <20200513071344.5430-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: , Update evb-rk3399 default config to support USB3.0 Host. Signed-off-by: Frank Wang Reviewed-by: Jagan Teki Reviewed-by: Kever Yang --- 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 Wed May 13 07:18:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1199 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-il1-f197.google.com (mail-il1-f197.google.com [209.85.166.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 268233F066 for ; Wed, 13 May 2020 09:18:43 +0200 (CEST) Received: by mail-il1-f197.google.com with SMTP id t10sf15526428ilf.12 for ; Wed, 13 May 2020 00:18:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589354321; cv=pass; d=google.com; s=arc-20160816; b=sh29oPtMCm3RyMthK/2oLOcwqKww2Fk9JPu0AWs5Y8ZHI3OBbc5BA8M3vTP7zzoA0e IhXJ0w/fPMSPKdJJ1TnfACsk1aezxUzZSe+sAmgBWzr8xwbKrTz1UFn4YNpdghKTRaOn 2ZVwmJN21dRiXkoHl4Re00tFxlJ9Z31zoE403MTr3vUGl1MyokfGGOAjlJA5ZLGUFOQQ m1KjXl6dg/hXVC/t89RVbmWO9HLp6bW7wUOAUbtiDfmdH78hpAin1hAtKxnbeWUxPVvR 69MP4aVMy7jfDJxtW4skNqSQndZJxzyihvX2SISzpXXjRYJ6ZixZ7k2tK0NCM5naVBf2 N/nQ== 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=Ucx+lp1LdKZlLRV8SqtxIiReKcQ55iCditXiFTY4ajrN5yliyXZrPvy4fCLaYK8ymh r58ciVBdEPBLYWsVEkjXLS3lWphajSLLF1D5fLH94e4izeHTzNr04XY+AStBXqvpCtrP NZqmmoqEwJQQ1OogX/zkAr/dAkN5wFKGV8owa+WF+rI+6FlriA2quSJ0cMSk4YK+K4k1 TPmzbaOiz60g7N6mLQ4Aw01QhApgLCTWBWA+4rHdf7csuwzU67h3EfH7Bm1FHB7HJoqQ ysDjkbNHMl2AxGi1z/0RXGhlfWv7jehVYNVsPuCGWeTb2ZXSNtnT4PJFApGBC6NGjgN5 bL4g== 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=OVZpmL9bTXg4O43fb/EQrtsw3smLAOlQV7MiPBXDBlk=; b=BkIB5iqF56cUIHGVvylxb5vYbQbgW/5q6LM1myIgZLi1wpNwRgYcyl+oIsj2bVpunx Ij435CkVwgC4p307V7/3xK1T6tUfqSCwvgAHAw0udrJI8tBvpmQvaDPxhXfqUz7ZuwT6 WLxPqqQQ/9TAql4kYM4mSVkGDoAN6cuUpWWpE= 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=GX2DSGNhJqnkJPWeW0FvPseMcDaItBZUmpEmr/o299JYGJJAf3R/aSTocBZYxsVLQi uQ+esCzrD21cJmWiKrA20Iqss1TnwAophsfOk1jHhG81RYEs0B+iRsECmZYv2mzZGnso 46TvAaHGbdJclfALl+qLUSr+Kx5I2faoxxqVE1/WfvnvNyh66SFQQKbN0m/2yhDrq1gh +A+9uHaAaqKoOlLFdTKVRBFI3HTscq9fVCJZIsUmmTwWCsf+0PIzyjWVZxcZUqbsytY3 LSIqyXGHdIxZN7Tj02VUlkU32obV9LERQyFwbeS3GUcQEzOellN3BzVg/X3koI6wKwXn kwaQ== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AOAM530S6b/bklRGi6EZ0D6BvxzEG3vBS8fKxnD9Wl9pa+AymFNS5M/f 31/3xCSYdsBhlQvlrSZ9N8xjgMR6 X-Google-Smtp-Source: ABdhPJyvsXaFOymMLij4Ej9S93A1FzAW87wmw8zhv7vIL5sPPvK3RUrLbUViaaTMFN2vfHvtR/dh2A== X-Received: by 2002:a92:2c03:: with SMTP id t3mr267807ile.130.1589354321397; Wed, 13 May 2020 00:18:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a92:1b96:: with SMTP id f22ls338925ill.3.gmail; Wed, 13 May 2020 00:18:40 -0700 (PDT) X-Received: by 2002:a05:6e02:4c4:: with SMTP id f4mr20834906ils.278.1589354320775; Wed, 13 May 2020 00:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589354320; cv=none; d=google.com; s=arc-20160816; b=sVCopQ7YQyuLWdgoFZ/snvJDjRGc5ywa6iIViS5fWXQtbBBZMfUdKF8s5neFBhf5gT FMzc8WHQQiRMdNu0Mkki38pbquRKZcekd++Pg/OlH+8VRtlNMPtrp1ghwWLvj5FWwF0x 5LlPGf6TwKo8x5aHOpWQ0ZjQa2+rtmMhRElYSEiEVTUezzyVnrOP+8QoagZS2GHh5rVI hPh7zfeCdgiqfim5PQ+S4hlLWB4cquUin/WxMjjL6rv/bpnPVQv1z6OCNEsBh0EsOwio 97U3Y91yrkqpPHrwRt0cF2DJW8VwmYpj1LdIcfMOw27nek/pPMBV9s6caA9EzQ3Ufzki yiaA== 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=ta/PgHvvQQlM4bQPQz95IuYh9G5u1cDnCQd6TWn/k/2memOMmgw+hDyk2aum3O4l4y quDyd/btPcqevS+efJlXPe6Ma0WLzexnsg3eEaxevnmKQ4zczgQmV/zRJkMlsKPfC4Y5 iR/FeLb71pCTtwpePNJs4MJzsm43h7KsFx1/L6oosnh396YKeo/+CK0Hq4InQ+ra2NJm OCXEW4ichT0fsxM0YWK1aDfQzA0GMUsRfzIePL3TrW5H+vV1dW84iS5X/ClNwWNSuTQ4 0+00TD9JlLnKS1VJ5eJp9NRkvDFnKFkv5xedbS3Sw+yF7LRox+M3WAUFw7bZjbPy+j+6 hHBA== 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 k10si9861944iow.93.2020.05.13.00.18.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 00:18:40 -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 4F244A50C8; Wed, 13 May 2020 15:18:06 +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 P21665T139938758653696S1589354284745427_; Wed, 13 May 2020 15:18:06 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: <388cc3502defd8890569081d8ad8ee2c> 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 v5 16/16] roc-rk3399-pc: Enable USB3.0 Host Date: Wed, 13 May 2020 15:18:03 +0800 Message-Id: <20200513071803.5781-1-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200513071344.5430-1-frank.wang@rock-chips.com> References: <20200513071344.5430-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 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 Reviewed-by: Kever Yang --- 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