Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72348C4338F for ; Wed, 11 Aug 2021 12:29:21 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BEE4A60FA0 for ; Wed, 11 Aug 2021 12:29:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BEE4A60FA0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5DB0B82DB2; Wed, 11 Aug 2021 14:28:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HM4DHZvO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7EC5280735; Wed, 11 Aug 2021 13:24:46 +0200 (CEST) Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EDD5C80735 for ; Wed, 11 Aug 2021 13:24:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jbx6244@gmail.com Received: by mail-ej1-x630.google.com with SMTP id e19so3551108ejs.9 for ; Wed, 11 Aug 2021 04:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=+OesosX6VChe8YMjaCjix/uioEsC6j9iRZWXG7emMf4=; b=HM4DHZvOq53TcAAWYByuxL1p1lcL2kmbH1ECAB08o18VXhcKGb6ph8LZ02djlU/xfV +Ei7GqqZcOR+4BNX0AE4JThe/UfFaijpgxm/u0lSVLHcx58i0vYYqo6+PmRJrRhUHqoj MQhsL2ZYaisCReSl512kTb7SGhihL4IDSBIrVYyUzVk8jqTRC5FvJasP9B7zJ3Ek3iNg r0WYgdoC9897tIbI5m7c46xSOmNjZ4/AtR/Bj3j15UsSf4BMZIJdN3Zw60u5Ws/cGj1c XJMgk5TdZ1hn1ml8yei/XCV8OG1Qz6ikTHIw05vZQCy3JYrSOgtZzABDQy6yqHMaNRVI 7tBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+OesosX6VChe8YMjaCjix/uioEsC6j9iRZWXG7emMf4=; b=eNLB0PEkEbPrpt/ugGy6ia7FEeEYeT8Bopc6ze2Oxsfw37KhovnhPPHo95jMyELs0N wDAl+0vpNd1JzDi+pIJBryglgm9n2TlTjL0/9XJXglcWe/WdgarLjWwOzraq+CWE4cZY FVdu9niceOyUsQtgOa4ivtTnTaQANIXKA87YKlc51OVEiu0X9i6Q51NdHYqsHau/MTiu 0L+TYjQbAmIqVkL29BunQfRZjBubMYV9TtZrHUnarzN+F6jYxcclIr1DS+aBZ0jXShS4 O8XWF7yZHVSL22f4dNJaRfZOBrkSSewwvBXNECCPt9dCaU9mvK6nnibbeceZQmV3U48h we4w== X-Gm-Message-State: AOAM532XyK5LkYiDV9wZMywef6oOxaEPj/AZnyz4JTBvTRQVCT83SEEE B92HO47y8RuvAZF0UlriL9HEBEB3m7I= X-Google-Smtp-Source: ABdhPJxufIypSVzqh54Y9sIbKZAier7SpTWLZGFzulBTPFZYyiKZYuGwhL8+Tg2we34GqXAAhrAwZQ== X-Received: by 2002:a17:907:c12:: with SMTP id ga18mr3106208ejc.107.1628681082516; Wed, 11 Aug 2021 04:24:42 -0700 (PDT) Received: from [192.168.2.1] (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id l20sm8098248ejb.23.2021.08.11.04.24.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Aug 2021 04:24:42 -0700 (PDT) Subject: Re: [RFC PATCH v1] phy: rockchip: add basic rk3328 support to phy-rockchip-inno-usb2.c To: Kever Yang , frank.wang@rock-chips.com Cc: Simon Glass , Philipp Tomsich , Heiko Stuebner , mail@david-bauer.net, ldevulder@suse.com, Chen-Yu Tsai , banglang.huang@foxmail.com, "Matwey V. Kornilov" , U-Boot-Denx References: <20210630164000.7843-1-jbx6244@gmail.com> From: Johan Jonker Message-ID: Date: Wed, 11 Aug 2021 13:24:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Wed, 11 Aug 2021 14:28:28 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Hi Kever, Thank you for your comment. On 8/11/21 12:01 PM, Kever Yang wrote: > Hi Johan, > Thanks for your patch, where does this source code come from? Copied it from here: https://github.com/rockchip-linux/u-boot/blame/next-dev/drivers/phy/phy-rockchip-inno-usb2.c phy: add a new driver for rockchip usb2 phy https://github.com/rockchip-linux/u-boot/commit/f0c40dcdc2ca7d6522efeee4bd2e42dc8e3e8ab2 Adjusted it for current u-boot driver. Mainline u-boot has no chg_det. Is > there any code change other than the structure for rk3328? > Please remove the RFC tag once the patch is ready. Anyone with a tested-by tag? Do I have to resend only to remove a RFC tag or can a maintainer do that when he/she applies? > > Thanks, > - Kever Note: In the rk3328.dtsi sync from Linux phy dr_mode is standard otg, but that doesn't work, so all are set to host in a dts. In rk3318-a95x-z2.dts +&usb20_otg { + dr_mode = "host"; + status = "okay"; +}; In u-boot to work we must set it back to otg because of: port_cfg = &rphy->phy_cfg->port_cfgs[USB2PHY_PORT_OTG]; In rk3318-a95x-z2-u-boot.dtsi +&usb20_otg { + dr_mode = "otg"; +}; > > Johan Jonker 于2021年7月1日周四 上午2:50写道: >> >> The rk3328 uses a usb phy simulair to rk3399 with only >> 1 instead of 2 usb ports. Reuse existing U-boot driver and >> add basic rk3328 support to phy-rockchip-inno-usb2.c >> >> Signed-off-by: Johan Jonker >> --- >> drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 29 +++++++++++++++++++++++++++ >> 1 file changed, 29 insertions(+) >> >> diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c >> index 62b8ba3a4a..bfb531d3cd 100644 >> --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c >> +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c >> @@ -243,6 +243,31 @@ static int rockchip_usb2phy_bind(struct udevice *dev) >> return ret; >> } >> >> +static const struct rockchip_usb2phy_cfg rk3328_usb2phy_cfgs[] = { >> + { >> + .reg = 0x100, >> + .port_cfgs = { >> + [USB2PHY_PORT_OTG] = { U-boot: >> + .phy_sus = { 0x0100, 8, 0, 0, 0x1d1 }, Linux: .phy_sus = { 0x0100, 15, 0, 0, 0x1d1 }, Which is correct? >> + .bvalid_det_en = { 0x0110, 2, 2, 0, 1 }, >> + .bvalid_det_st = { 0x0114, 2, 2, 0, 1 }, >> + .bvalid_det_clr = { 0x0118, 2, 2, 0, 1 }, >> + .utmi_avalid = { 0x0120, 10, 10, 0, 1 }, >> + .utmi_bvalid = { 0x0120, 9, 9, 0, 1 }, >> + }, >> + [USB2PHY_PORT_HOST] = { U-boot: >> + .phy_sus = { 0x104, 8, 0, 0, 0x1d1 }, Linux: .phy_sus = { 0x104, 15, 0, 0, 0x1d1 }, Which is correct? >> + .ls_det_en = { 0x110, 1, 1, 0, 1 }, >> + .ls_det_st = { 0x114, 1, 1, 0, 1 }, >> + .ls_det_clr = { 0x118, 1, 1, 0, 1 }, >> + .utmi_ls = { 0x120, 17, 16, 0, 1 }, >> + .utmi_hstdet = { 0x120, 19, 19, 0, 1 } >> + } >> + }, >> + }, >> + { /* sentinel */ } >> +}; >> + >> static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = { >> { >> .reg = 0xe450, >> @@ -291,6 +316,10 @@ static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = { >> >> static const struct udevice_id rockchip_usb2phy_ids[] = { >> { >> + .compatible = "rockchip,rk3328-usb2phy", >> + .data = (ulong)&rk3328_usb2phy_cfgs >> + }, >> + { >> .compatible = "rockchip,rk3399-usb2phy", >> .data = (ulong)&rk3399_usb2phy_cfgs, >> }, >> -- >> 2.11.0 >>