Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B22F6C77B75 for ; Sat, 6 May 2023 09:35:25 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 18CFA85E00; Sat, 6 May 2023 11:35:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 1DC2E85D10; Sat, 6 May 2023 11:35:23 +0200 (CEST) Received: from mail-m11879.qiye.163.com (mail-m11879.qiye.163.com [115.236.118.79]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 74F2685D10 for ; Sat, 6 May 2023 11:35:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kever.yang@rock-chips.com Received: from [172.16.12.93] (unknown [58.22.7.114]) by mail-m11879.qiye.163.com (Hmail) with ESMTPA id 67F0C680532; Sat, 6 May 2023 17:35:06 +0800 (CST) Message-ID: <605b95a7-d4e1-aa10-95dc-363dc3bd7864@rock-chips.com> Date: Sat, 6 May 2023 17:35:06 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v5 5/6] phy: rockchip-inno-usb2: add initial support for rk3588 PHY Content-Language: en-US To: Eugen Hristev , jonas@kwiboo.se, u-boot@lists.denx.de Cc: u-boot-amlogic@groups.io, xdrudis@tinet.cat, jagan@edgeble.ai, neil.armstrong@linaro.org, anarsoul@gmail.com, Frank Wang References: <20230419134014.128461-1-eugen.hristev@collabora.com> <20230419134014.128461-5-eugen.hristev@collabora.com> From: Kever Yang In-Reply-To: <20230419134014.128461-5-eugen.hristev@collabora.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFDSUNOT01LS0k3V1ktWUFJV1kPCRoVCBIfWUFZGkxKT1ZOTx0YSkxCS0pOGElVEwETFh oSFyQUDg9ZV1kYEgtZQVlOQ1VJSVVMVUpKT1lXWRYaDxIVHRRZQVlPS0hVSkpLSEpMVUpLS1VLWQ Y+ X-HM-Tid: 0a87f06a3c502eb5kusn67f0c680532 X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6MSI6Mio5IT0VATJCOVY*KR0Z CzEaCx5VSlVKTUNISE1OTEtMT0pPVTMWGhIXVRAeDR4JVQIaFRw7CRQYEFYYExILCFUYFBZFWVdZ EgtZQVlOQ1VJSVVMVUpKT1lXWQgBWUFPQkJPNwY+ X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean On 2023/4/19 21:40, Eugen Hristev wrote: > Add initial support for the rk3588 PHY variant. > The lookup for the host-port reg inside the struct now does a do {} while() > instead of a while() {} in order to allow a first check for reg == 0. > > Co-developed-by: Frank Wang > Signed-off-by: Frank Wang > Signed-off-by: Eugen Hristev Reviewed-by: Kever Yang Thanks, - Kever > --- > drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 60 ++++++++++++++++++- > 1 file changed, 58 insertions(+), 2 deletions(-) > > diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c > index 55e1dbcfef7e..22e2797eea28 100644 > --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c > +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c > @@ -201,14 +201,14 @@ static int rockchip_usb2phy_probe(struct udevice *dev) > > /* find out a proper config which can be matched with dt. */ > index = 0; > - while (phy_cfgs[index].reg) { > + do { > if (phy_cfgs[index].reg == reg) { > priv->phy_cfg = &phy_cfgs[index]; > break; > } > > ++index; > - } > + } while (phy_cfgs[index].reg); > > if (!priv->phy_cfg) { > dev_err(dev, "failed find proper phy-cfg\n"); > @@ -348,6 +348,58 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { > { /* sentinel */ } > }; > > +static const struct rockchip_usb2phy_cfg rk3588_phy_cfgs[] = { > + { > + .reg = 0x0000, > + .port_cfgs = { > + [USB2PHY_PORT_OTG] = { > + .phy_sus = { 0x000c, 11, 11, 0, 1 }, > + .ls_det_en = { 0x0080, 0, 0, 0, 1 }, > + .ls_det_st = { 0x0084, 0, 0, 0, 1 }, > + .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, > + .utmi_ls = { 0x00c0, 10, 9, 0, 1 }, > + } > + }, > + }, > + { > + .reg = 0x4000, > + .port_cfgs = { > + [USB2PHY_PORT_OTG] = { > + .phy_sus = { 0x000c, 11, 11, 0, 0 }, > + .ls_det_en = { 0x0080, 0, 0, 0, 1 }, > + .ls_det_st = { 0x0084, 0, 0, 0, 1 }, > + .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, > + .utmi_ls = { 0x00c0, 10, 9, 0, 1 }, > + } > + }, > + }, > + { > + .reg = 0x8000, > + .port_cfgs = { > + [USB2PHY_PORT_HOST] = { > + .phy_sus = { 0x0008, 2, 2, 0, 1 }, > + .ls_det_en = { 0x0080, 0, 0, 0, 1 }, > + .ls_det_st = { 0x0084, 0, 0, 0, 1 }, > + .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, > + .utmi_ls = { 0x00c0, 10, 9, 0, 1 }, > + } > + }, > + }, > + { > + .reg = 0xc000, > + .port_cfgs = { > + [USB2PHY_PORT_HOST] = { > + .phy_sus = { 0x0008, 2, 2, 0, 1 }, > + .ls_det_en = { 0x0080, 0, 0, 0, 1 }, > + .ls_det_st = { 0x0084, 0, 0, 0, 1 }, > + .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, > + .utmi_ls = { 0x00c0, 10, 9, 0, 1 }, > + } > + }, > + }, > + { /* sentinel */ } > +}; > + > static const struct udevice_id rockchip_usb2phy_ids[] = { > { > .compatible = "rockchip,rk3399-usb2phy", > @@ -357,6 +409,10 @@ static const struct udevice_id rockchip_usb2phy_ids[] = { > .compatible = "rockchip,rk3568-usb2phy", > .data = (ulong)&rk3568_phy_cfgs, > }, > + { > + .compatible = "rockchip,rk3588-usb2phy", > + .data = (ulong)&rk3588_phy_cfgs, > + }, > { /* sentinel */ } > }; >