Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1307131pxu; Thu, 17 Dec 2020 07:07:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXBtSMt1LGCwsUNK1Vb8BykrjBwOCC5DEwOmsFevEO4QavXgpPSu+txNlmRN3suKTjivCi X-Received: by 2002:a17:906:3a55:: with SMTP id a21mr36083350ejf.516.1608217639384; Thu, 17 Dec 2020 07:07:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608217639; cv=none; d=google.com; s=arc-20160816; b=jXkcNE1dok7FraGiQJP282/R5shDlKAvIjfXJa0kUUy/0ENddGrMLJwUTlzY8oW/ZY UO26x42vN7Ttkgx6IJlVq3h9q9OT5DZSSw1dtR76aVYsh/6e1/zZDi+P3mvZclvQcNO4 tnW7B9gFi6C2eho5TayHavFxrM7iQIO2cxIa2vrN8tBlHKDfNra8BFxhqzJLQyqoCpIw akRXLywwIlOYY2K0ppI/3iSJ5LlB+NhJ7B4PBUSBLjMzxVWzn6Q5n5CMH9nQNZrrU4PC e6cWzrNWdefpQawxuL12i4ss03qBYhBK6Y8BCzfX+QyQ9kYVRM4z+23NbbY6aqQsoCGO qaWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=bwrKelRIw2P46W12+V8LfoBE7/ASZSlAN9pQ3TxWDLo=; b=OuFLA/HU1H1jVFPwbtaCRUNd6BtZfnVk4kWjdxZIAyQgweIq6B6bajlX9rAJvsrDIN XD3YkGbpirOM3uuUeWfjvr7MMyhpAWFeTSJqOp3TV6tsi4xbN5LzdMxvmyAChnncCAr6 MUoiyY73ycHec6c3X6wazBOcP0oq1p46LNcm3VNb6mIF1ZANWsa33rIsHqTNTi8HO8Mu 0iLkFDU1qGr7zzrcI19vO7kKm8e4xp9MMd64Wh+mnrX87wktOa/p2/igS4hMpqu0hvYH YcH3OOy/kWK2jWfP9ch3ezKgH2OA0NoMEsyyjV/WQIzMxW6Tb7QODvRCwr2IMKOxwEEy yAew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oUp0+y3z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p8si2669391eja.494.2020.12.17.07.06.55; Thu, 17 Dec 2020 07:07:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oUp0+y3z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729009AbgLQPGI (ORCPT + 99 others); Thu, 17 Dec 2020 10:06:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728680AbgLQPGG (ORCPT ); Thu, 17 Dec 2020 10:06:06 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C4D7C0611C5; Thu, 17 Dec 2020 07:04:57 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id g185so6003417wmf.3; Thu, 17 Dec 2020 07:04:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=bwrKelRIw2P46W12+V8LfoBE7/ASZSlAN9pQ3TxWDLo=; b=oUp0+y3zuKEpg0X6dwedwVaRgcvY+s5BET0TxUEpClDImHGCFOMZZP54NbHNBk7fOp emm7Mju7/9eAFJwxr5AkUnNFRWU8iVyICeZElbyNwD0X84JBLMIighc4e7wiW1W3i/ht 8g0I//ZG36+6VMdrUpPjYroBUnaGSZGI9g/xEZrknjvUuBBETxXZHuzf7FMYLhc93C4y 5oAReoMp0IHAUAHWJTHMWRBKbgTICFqhEKPpOx+mb+yW44ZQ1nKRGbtnZGJSa8xRzv06 Pr/bwwu6ept+g0aNU0QLdGBPTBQHBJadQhJd4wZwWeuFnSSdb/yRc0ElVolNYtYURSFt 93zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=bwrKelRIw2P46W12+V8LfoBE7/ASZSlAN9pQ3TxWDLo=; b=c0TROpf89sRrPUWTuhN7qkNbp1eXzCyHPnVuocFE0qGfGJWNuKReNQiLQCVugMLCCV pRVS7SmOnKIYOnho81ykt9T1PtO5OFVNY0cEDzeaKsYRoOkGcSxgU6EIceKQUqW58KLY SLAacXjLrMr0XZiJgrkNhsiJZcZpsniG/bLgw51Jienvo3ShaQS5BQxlWJqtolovsASy I/jdJjS8XHfoalZWaYQsXp/JTZoZynqc2N5NJjIKqvL3kOCK8Mp5spXTcPq4p4dlSApN y1PkiXBnFKhNYYiHhv4DaHvdZUQSPSutyJhUmUHwTu11aV5U/EH8dhmjdGC/LIP61Mr6 I0Xw== X-Gm-Message-State: AOAM532XciwHG7Npbyo8AeeldyuBTxsxi1fZfQKM9fRzRBwDTaickHWx q9fc+65COcWS5HskyTrLAJ8= X-Received: by 2002:a1c:c204:: with SMTP id s4mr8965841wmf.73.1608217496297; Thu, 17 Dec 2020 07:04:56 -0800 (PST) Received: from localhost ([62.96.65.119]) by smtp.gmail.com with ESMTPSA id c81sm8877583wmd.6.2020.12.17.07.04.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 07:04:55 -0800 (PST) Date: Thu, 17 Dec 2020 16:04:53 +0100 From: Thierry Reding To: Dmitry Osipenko Cc: Jonathan Hunter , Peter Chen , Greg Kroah-Hartman , Alan Stern , Felipe Balbi , Matt Merhar , Nicolas Chauvet , Peter Geis , Ion Agorria , linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/8] usb: phy: tegra: Support waking up from a low power mode Message-ID: References: <20201217094007.19336-1-digetx@gmail.com> <20201217094007.19336-3-digetx@gmail.com> <3c204a61-86ae-1bbe-1442-527831f15232@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cOXpBbUiKUTaRQTC" Content-Disposition: inline In-Reply-To: <3c204a61-86ae-1bbe-1442-527831f15232@gmail.com> User-Agent: Mutt/2.0.3 (a51f058f) (2020-12-04) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --cOXpBbUiKUTaRQTC Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 17, 2020 at 04:47:50PM +0300, Dmitry Osipenko wrote: > 17.12.2020 16:33, Thierry Reding =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > >> + /* PHY won't resume if reset is asserted */ > >> + if (phy->wakeup_enabled) > >> + goto chrg_cfg0; > >> =20 > >> val =3D readl_relaxed(base + USB_SUSP_CTRL); > >> val |=3D UTMIP_RESET; > >> writel_relaxed(val, base + USB_SUSP_CTRL); > >> =20 > >> +chrg_cfg0: > > I found this diffcult to read until I realized that it was basically > > just the equivalent of this: > >=20 > > if (!phy->wakeup_enabled) { > > val =3D readl_relaxed(base + USB_SUSP_CTRL); > > val |=3D UTMIP_RESET; > > writel_relaxed(val, base + USB_SUSP_CTRL); > > } > >=20 > >> val =3D readl_relaxed(base + UTMIP_BAT_CHRG_CFG0); > >> val |=3D UTMIP_PD_CHRG; > >> writel_relaxed(val, base + UTMIP_BAT_CHRG_CFG0); > >> =20 > >> + if (phy->wakeup_enabled) > >> + goto xcvr_cfg1; > >> + > >> val =3D readl_relaxed(base + UTMIP_XCVR_CFG0); > >> val |=3D UTMIP_FORCE_PD_POWERDOWN | UTMIP_FORCE_PD2_POWERDOWN | > >> UTMIP_FORCE_PDZI_POWERDOWN; > >> writel_relaxed(val, base + UTMIP_XCVR_CFG0); > >> =20 > >> +xcvr_cfg1: > > Similarly, I think this is more readable as: > >=20 > > if (!phy->wakeup_enabled) { > > val =3D readl_relaxed(base + UTMIP_XCVR_CFG0); > > val |=3D UTMIP_FORCE_PD_POWERDOWN | UTMIP_FORCE_PD2_POWERDOWN | > > UTMIP_FORCE_PDZI_POWERDOWN; > > writel_relaxed(val, base + UTMIP_XCVR_CFG0); > > } > >=20 > >> val =3D readl_relaxed(base + UTMIP_XCVR_CFG1); > >> val |=3D UTMIP_FORCE_PDDISC_POWERDOWN | UTMIP_FORCE_PDCHRP_POWERDOWN= | > >> UTMIP_FORCE_PDDR_POWERDOWN; > >> writel_relaxed(val, base + UTMIP_XCVR_CFG1); > >> =20 > >> + if (phy->wakeup_enabled) { > > Which then also matches the style of this conditional here. >=20 > I'll change it in v3, thanks. Given that my other comment about the WARN_ONCE seems to have been resolved, with the above gotos replaced by conditionals as I suggested: Acked-by: Thierry Reding --cOXpBbUiKUTaRQTC Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAl/bc5UACgkQ3SOs138+ s6EBzxAAq3HvcNtFiWElWKh9GGfrXYJAGBC3RHJPAOe0lYIfQlvBBbCnatiPqEEm IfdoQcNF0EejAYZ6TvkUvICIpbJ9gNv2mes7MW+7qg4+rml76dAcVlPde0lap9oj 1J0qKl9bcwckRsCIHsa+A0NK2vf1BO/Slh4y5YqHJf6F2cU0YZBjX5DiqjYnaDyD tx7CuZDcuwaUDHSfSZECL2fCmqdSkcUrXI3tLGTnS4OUualtZUh843Lf8fWoouAj 7ZHuA+SYx+ZgTbM7OZczx2h7mBYb4LGHAIkqyj57ZFu5GZozZBgZ+oqIp9QRw343 UoznZj/kpj64oNQI3WG8ecSG8vhObHRzgpqiX7+OzhAXMceRr41SuXglJOiqpi2d /uk8i1sqG+SVET1BjsPukhQXetvt5QwaXQly2vMad/vNkUrzrAlefjSduKJ2i5Gz 1p4eDwpRpQ+VLZy/6zCOJjGmXUJAfCA+tUfCKcJwvaaVyLcjcKczCBomHdcwLrQG Nii7y1ctcHxG5mhTxHDbgx9cQtWqVuSosDylVp7MZweJTYTVIHDJ/EG/Q9IUqcCh aSj99DKpY8LMB+fvCgz+6oF2iBvjC2NoinOcV0s5AtXFbX9VDc1SO8EpLPaxhWX+ 5S7dZkM2aJBlL8IWSNKCorDvcOSaU0yX/n3Ho/hEZz0OuBhht9M= =E4e/ -----END PGP SIGNATURE----- --cOXpBbUiKUTaRQTC--