Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4602634ybl; Mon, 9 Dec 2019 13:45:12 -0800 (PST) X-Google-Smtp-Source: APXvYqy9QTBhC8yv5fGyBWLltqCj+53934NfCO5W++OjPwzC2tnvgOizXSBA0w9pB2dJjYRicsOm X-Received: by 2002:aca:aacf:: with SMTP id t198mr1131408oie.135.1575927912160; Mon, 09 Dec 2019 13:45:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575927912; cv=none; d=google.com; s=arc-20160816; b=K9jxGc2obyzaUIx8Vucrpf/UDdW1pj+XHkI5RUE3iqntKT6gS+I7tHAFaNH59upxTV CuflLlVOQpK00Q2pR1U9i5VT6F3cNApPxEq7iOcQ+3b93bX5Pz2v126pyOiSQAkYRIEJ iu7Eod0K1ffZ8RsIQO055shDAeFFAUUJj/d4iPI/k81kgwGLFrIsWypGYbPbkl/+2HkN 9xTUarqODaqMaeoXywWngBACdmKLnWHNqfn5usYdJNU/Cfh536jgKfsJV/VUIn+o+Y7i B2D7daHsTRpjFNhNWv1Geqkn9fHNphL7rO9O1wHZ7+XCUKd6tNL/xE/9dE1F0IuiQUZQ 7D1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=n5G8vs80VS3sA4MhM4cgPCr2IxsX3rpduYhIhTGIkuI=; b=AJ6O5QPgs15FrDq14J4Rvey7/2iiafk8/ypfpaTHiMGaUfzq2eiIVOtJoPnfp2l5Nq sD820CTVi+RTBDQVK2i0cUbc9EnhqGU3HkuMgqoWALXhKgT2/X9qrY/40BZmudyfOgy2 jFE/Z4832G80ME/zCdzGQJDK6xsjsP3rv59cC1Ctv8VtTGpzXAwErweME6lWowFvrQbd EU6LpbWBJ+W50wKhMRQfNtgBl9/WkNiU+PIzyfU1k5o72qab4+/ZK+cwGJJJGt7odXFb rELluC8vw7z9qEtys8zxeqWtBaCPHwAL2RZzruUgLslMBkUco9+imPvGZ4QzPo5TQ9MA Lv1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cWe12ucl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id h3si686906otk.60.2019.12.09.13.45.00; Mon, 09 Dec 2019 13:45:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cWe12ucl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726986AbfLIVoF (ORCPT + 99 others); Mon, 9 Dec 2019 16:44:05 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:56240 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726801AbfLIVoA (ORCPT ); Mon, 9 Dec 2019 16:44:00 -0500 Received: by mail-wm1-f67.google.com with SMTP id q9so951420wmj.5; Mon, 09 Dec 2019 13:44:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=n5G8vs80VS3sA4MhM4cgPCr2IxsX3rpduYhIhTGIkuI=; b=cWe12uclXhwcu3izBnCofTph9kxBd/6LXwa4QBGTN4n4LSo+2knEV3Wry8p7QgPiXu lYp0dhqziRpTdkloONIna+3gEoD04zY8TaL37bUlhZtzie6mxJ1KSumGwITx2829S/GS EtRL0ZDYDmMU1uGox/1zfr/qcx0h7jYve6Z03mrZ1FAXxdHt0HOQEjyIGx8gTE2F6Kyz 59CeHgZRyjZw5qZfNr48P/rXFC2Fd6bEh+bzmA75kOqbZkFfMoy3gPiGx+9sG1sZtrmM FRGISjnDDxoUVdFxx19gkfkSAYOG0X7ki/ShXt2N9dEhIphEB4bYVyg46gx3DvOSeWC5 zHdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=n5G8vs80VS3sA4MhM4cgPCr2IxsX3rpduYhIhTGIkuI=; b=Xgb58rtZHNz3almt1nuLGSz8hfXKTda+kL9bD53HqdJWOboYZPao/S8gAG4WX9XoSY +JUmE72mrvwFevmJAnKZYA6VRJsSSYb4bRUurwUIFcYW2HcTauAunzsU9tU7brRxc8yd YD+My2YX2z4vKERXXHsB9wunMrVgtFzD7uXR3gSm3IPq2A4kokYqEJV46sG5/XF8/9rZ 8UkhSxH4tH4Ac6fKOYa2vJCQ1rjmnQuy8v/6XZxiH0e8Mo+PCJviF6DCFUOjf6OKdNe3 /hjpxonLKZVdP9W0ok2xE1JoNTEOfauco+AK5udWhlTyQYarA4qi6GCf1A1o4KNQi6G5 li4w== X-Gm-Message-State: APjAAAWqT98sHuvu/qKWJewL5eHVadVjPxdwsiv3ypvl9hThV6ZB0b3b rzOSVFUWPHYhecVv4DuzmtMmVwlz9ig= X-Received: by 2002:a05:600c:1007:: with SMTP id c7mr1267751wmc.158.1575927839077; Mon, 09 Dec 2019 13:43:59 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id z6sm757714wmz.12.2019.12.09.13.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 13:43:58 -0800 (PST) From: Al Cooper To: linux-kernel@vger.kernel.org Cc: Al Cooper , bcm-kernel-feedback-list@broadcom.com, devicetree@vger.kernel.org, Florian Fainelli , Kishon Vijay Abraham I , linux-arm-kernel@lists.infradead.org, Mark Rutland , Rob Herring , Srinath Mannam Subject: [PATCH v2 resend 03/13] phy: usb: Put USB phys into IDDQ on suspend to save power in S2 mode Date: Mon, 9 Dec 2019 16:42:39 -0500 Message-Id: <20191209214249.41137-4-alcooperx@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191209214249.41137-1-alcooperx@gmail.com> References: <20191209214249.41137-1-alcooperx@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently the Phy driver will put the USB phys into the max power saving mode (IDDQ) when there is no corresponding XHCI, EHCI or OHCI client (through rmmod, unbind or if the driver is not builtin). This change will also put the Phys into IDDQ mode on suspend so that S2 will get the additional power savings. Signed-off-by: Al Cooper --- drivers/phy/broadcom/phy-brcm-usb-init.c | 2 -- drivers/phy/broadcom/phy-brcm-usb.c | 11 +++++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/phy/broadcom/phy-brcm-usb-init.c b/drivers/phy/broadcom/phy-brcm-usb-init.c index 56d9b314a8d0..0e6b921072be 100644 --- a/drivers/phy/broadcom/phy-brcm-usb-init.c +++ b/drivers/phy/broadcom/phy-brcm-usb-init.c @@ -1002,8 +1002,6 @@ void brcm_usb_uninit_common(struct brcm_usb_init_params *params) void brcm_usb_uninit_eohci(struct brcm_usb_init_params *params) { - if (USB_CTRL_MASK_FAMILY(params, USB_PM, USB20_HC_RESETB)) - USB_CTRL_UNSET_FAMILY(params, USB_PM, USB20_HC_RESETB); } void brcm_usb_uninit_xhci(struct brcm_usb_init_params *params) diff --git a/drivers/phy/broadcom/phy-brcm-usb.c b/drivers/phy/broadcom/phy-brcm-usb.c index 217e3702ef4e..634afc803778 100644 --- a/drivers/phy/broadcom/phy-brcm-usb.c +++ b/drivers/phy/broadcom/phy-brcm-usb.c @@ -381,8 +381,15 @@ static int brcm_usb_phy_suspend(struct device *dev) struct brcm_usb_phy_data *priv = dev_get_drvdata(dev); if (priv->init_count) { - clk_disable_unprepare(priv->usb_20_clk); - clk_disable_unprepare(priv->usb_30_clk); + if (priv->phys[BRCM_USB_PHY_3_0].inited) + brcm_usb_uninit_xhci(&priv->ini); + if (priv->phys[BRCM_USB_PHY_2_0].inited) + brcm_usb_uninit_eohci(&priv->ini); + brcm_usb_uninit_common(&priv->ini); + if (priv->phys[BRCM_USB_PHY_3_0].inited) + clk_disable_unprepare(priv->usb_30_clk); + if (priv->phys[BRCM_USB_PHY_2_0].inited) + clk_disable_unprepare(priv->usb_20_clk); } return 0; } -- 2.17.1