Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1244480pxu; Thu, 17 Dec 2020 05:50:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzA6jxyDqrah9srUyH7IYVv3hjzWXLZeJY0Gmo2TBeaa2y5l3T5toRoU82jYiSYF2/k8g+U X-Received: by 2002:aa7:c403:: with SMTP id j3mr38067180edq.217.1608213012752; Thu, 17 Dec 2020 05:50:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608213012; cv=none; d=google.com; s=arc-20160816; b=KrJP7CHiVBz35ppEl1k1HorIBoTaKpBv1rW7Y1owmgmVnb0Gurh9pCObC2XLtLQy2K k4K45BR1JrHVLn4RhBGjsm/jzh6kLdv0RNulUSQEdrdiyjsSDtFwZVoV+x/xfjAzxUVj efkpdHRjkiwTd7hXhmTo1x4YzQ9HVrjNBEFj7OYePUrGnLEAH4wJCJ3vT+Z8wLdFvcah GgB1WJqyZMre9RD/jB5Vr3l/DaGEWczrvWbbfnR3rWGYswxscPLSCzohFHe7Jt/1kMYY HyndUK4BjDrrP2s6DrOd30+vdm27cYR54/2dpHgfwuBF3GLo7ObY/HYeiBx+jDeo6GJm QbUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=RQQZWATGx9Cd9i1SGEZJb8vdX4uN6McAm/OXt010CwM=; b=wZooo50V9DP0hJ0EcSvo7iSUmGW2Os56IoSu4k5t8MTH3f5PaUkAhKsdlwlCZFBIZW 08l9osehN5Io/U3w4walLzax0jrYS8fUKIZPpVPnDLe+etRVomnuoZi9EHOvpdbJp2ey IqZaXuL1SYyONl61ivWtOgw8bJG7UmX3pqRK6k2fzSL//4GZkpaP9+K+Ncov8J1SDbpv psUGjAkQw7ZJrJAcdCAyjSiaEJGHZPPHlcG0Iv/Pk+Kfj9v962OKusVNslqtxU7yJSvJ t1XOLWV3LuHBGj6w+EsCCkOCx/ZloSvH9gmFvmd1kCdW8PKaZMLUGwHQLATC7jcDERDE yqxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="usrS9/X1"; 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 t6si4272490edq.353.2020.12.17.05.49.50; Thu, 17 Dec 2020 05:50:12 -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="usrS9/X1"; 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 S1728092AbgLQNse (ORCPT + 99 others); Thu, 17 Dec 2020 08:48:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727656AbgLQNsd (ORCPT ); Thu, 17 Dec 2020 08:48:33 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 166DDC061794; Thu, 17 Dec 2020 05:47:53 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id 23so57462916lfg.10; Thu, 17 Dec 2020 05:47:53 -0800 (PST) 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=RQQZWATGx9Cd9i1SGEZJb8vdX4uN6McAm/OXt010CwM=; b=usrS9/X19WJNJE8tTPznZiyGQ0vhFySggMlc9YeT0s6XcIDl1dLOkz6RZj6uoiSgkw 5Y31qJ85Y6/qOqSqJQ1JQ3XUR99iXNgQUnIFTtO74ap5eRIDlv7hq6eQKHlYIP/4iRqS kD1MmFetx/sNic5eBl0OTBseCT6rjU0skJARBRBHqoFN+jQyhi+JEUwrVFeaGGc0xlyB EA8GCGsRI5rUS0eJSyiW5JtuIqFrLdR3dsCGWFTvOxctK1ZWgj5mvGTzehejVDjYvte3 xmrBS2oY0MTtFQ20AEgJ2KHVJUkTalyr+glQSeQnsw5ktGtwGELo9K3ZyFtUN6I5iyer wrGA== 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=RQQZWATGx9Cd9i1SGEZJb8vdX4uN6McAm/OXt010CwM=; b=a4Ew0G52H0CjtnHdV3XTUdt6TKMtSZKMqzN7OLFdmp9ebC/PXzS7axcV2s1Rll5VD7 DAy0kavId40hiolwPtW/nyTUaS6C5lNJpZekS1wsyvS5sQM31d+r+7xmkn3K9AZYNB0U 0R5eIsdbkSfzW+RxOU62DysWAasuxEY5kKlcclHbDCd9f3WUEQjDmO/Lxpl2gUPmg5Ct H/RLKA8K09AU1l4yxzy+w4OzzbSClclibNH+wbnhRqnp4KcMPSrEb/Q5VdnaVuwY2vQ1 hX7R6+GQeAJ+4UyQ0imFWLKOHtNmVNN1pgHWQkZ6t4WXvQyRwguPhXsgpUBEFOTHWoNF jntw== X-Gm-Message-State: AOAM5339/+QA6uLJiWOxC6YJt+mihaZCXU/skj3qZmNZ2zRlelLH0GHp ifWmQVR0p3OG11fm0bA0PEH4wl/cf2E= X-Received: by 2002:a05:6512:706:: with SMTP id b6mr16181992lfs.115.1608212871402; Thu, 17 Dec 2020 05:47:51 -0800 (PST) Received: from [192.168.2.145] (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.googlemail.com with ESMTPSA id d12sm673175ljl.111.2020.12.17.05.47.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Dec 2020 05:47:50 -0800 (PST) Subject: Re: [PATCH v2 2/8] usb: phy: tegra: Support waking up from a low power mode To: Thierry Reding 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 References: <20201217094007.19336-1-digetx@gmail.com> <20201217094007.19336-3-digetx@gmail.com> From: Dmitry Osipenko Message-ID: <3c204a61-86ae-1bbe-1442-527831f15232@gmail.com> Date: Thu, 17 Dec 2020 16:47:50 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 17.12.2020 16:33, Thierry Reding пишет: >> + /* PHY won't resume if reset is asserted */ >> + if (phy->wakeup_enabled) >> + goto chrg_cfg0; >> >> val = readl_relaxed(base + USB_SUSP_CTRL); >> val |= UTMIP_RESET; >> writel_relaxed(val, base + USB_SUSP_CTRL); >> >> +chrg_cfg0: > I found this diffcult to read until I realized that it was basically > just the equivalent of this: > > if (!phy->wakeup_enabled) { > val = readl_relaxed(base + USB_SUSP_CTRL); > val |= UTMIP_RESET; > writel_relaxed(val, base + USB_SUSP_CTRL); > } > >> val = readl_relaxed(base + UTMIP_BAT_CHRG_CFG0); >> val |= UTMIP_PD_CHRG; >> writel_relaxed(val, base + UTMIP_BAT_CHRG_CFG0); >> >> + if (phy->wakeup_enabled) >> + goto xcvr_cfg1; >> + >> val = readl_relaxed(base + UTMIP_XCVR_CFG0); >> val |= UTMIP_FORCE_PD_POWERDOWN | UTMIP_FORCE_PD2_POWERDOWN | >> UTMIP_FORCE_PDZI_POWERDOWN; >> writel_relaxed(val, base + UTMIP_XCVR_CFG0); >> >> +xcvr_cfg1: > Similarly, I think this is more readable as: > > if (!phy->wakeup_enabled) { > val = readl_relaxed(base + UTMIP_XCVR_CFG0); > val |= UTMIP_FORCE_PD_POWERDOWN | UTMIP_FORCE_PD2_POWERDOWN | > UTMIP_FORCE_PDZI_POWERDOWN; > writel_relaxed(val, base + UTMIP_XCVR_CFG0); > } > >> val = readl_relaxed(base + UTMIP_XCVR_CFG1); >> val |= UTMIP_FORCE_PDDISC_POWERDOWN | UTMIP_FORCE_PDCHRP_POWERDOWN | >> UTMIP_FORCE_PDDR_POWERDOWN; >> writel_relaxed(val, base + UTMIP_XCVR_CFG1); >> >> + if (phy->wakeup_enabled) { > Which then also matches the style of this conditional here. I'll change it in v3, thanks.