Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18856847ybl; Fri, 3 Jan 2020 10:21:01 -0800 (PST) X-Google-Smtp-Source: APXvYqwLeOC9JSgr5CNALsyEhLiHhqyeTsn8JzGW3fgmrbtrVAM3CyIL++v+0jr7VU/s4/qq5J7u X-Received: by 2002:a9d:7c90:: with SMTP id q16mr83749764otn.191.1578075661565; Fri, 03 Jan 2020 10:21:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578075661; cv=none; d=google.com; s=arc-20160816; b=hfptOcWZDhhXEAovcqqORDfeLkg9RgJuBc/eILoq/LGK32od6LsL/h/00ZFfoc6wAY wd4+pG3PUuV6y5ftgKR+PgiPCiDFOC6hqaRzBj0HMgnxsRNwfvI1th3YdSG1JxcOxQ/T TQjCuZAe02xarzsPPSXVp3wDevK7yn14HmKhgcv/s7pneuUfKJxW+5PEPDh4xbuB46eA fhA6KoZUp5Eq8n0o7fUO2gO2sfHZM4r3O7QuUJtRZ4n/FeVD+1eGfEFMoQsahEbXvRJh dVulW7ZSqQeEWeyqwy3trDrGCYOIqjeU+CXH88AKThPwr6VzoI+v37flYbhApGiJeA8i k+NQ== 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=H4+FLclhdhCw74jAzeAwHm0BVOBLEFDsMtURbkkNBZU=; b=DqkTTZ3i3RAxr4j9bXCN1JuEtJJx05HHjWhRftbZVu2WWqKB2F8TiIBzmYCxenOJ2u CjOKDcb80vwSyq/aLMMCIu2ng2YYa+HCmD6mSgNnfnxL7iFL4+NQRX/3Ai+9l33x5PVp ZPxrDXpEEdEEhg8PvshdSQXLC9sPyFXAk2qlqS37AV6dp3FTpN0PhWgp8Ny83LQjrmI6 6Wa4EqIfN2OD1hcszAMGrSKkJDuKDwEFPQD1zRIb3g6A5BNCR7VC1OWRq+E3lRmJ4E+P 1xxMaDDZD5ehFmKE2Pk6HcjPkgaAa0RANdm8GC9jn5wH0v0SW0puMm0AeK6+BjTfOeyC tZew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=b7fPgsM5; 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 b1si27262887otl.302.2020.01.03.10.20.48; Fri, 03 Jan 2020 10:21:01 -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=b7fPgsM5; 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 S1728375AbgACSTa (ORCPT + 99 others); Fri, 3 Jan 2020 13:19:30 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:40105 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728355AbgACST2 (ORCPT ); Fri, 3 Jan 2020 13:19:28 -0500 Received: by mail-pg1-f195.google.com with SMTP id k25so23749151pgt.7; Fri, 03 Jan 2020 10:19:28 -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=H4+FLclhdhCw74jAzeAwHm0BVOBLEFDsMtURbkkNBZU=; b=b7fPgsM5mGk6z83c9LDyzId6ez04NMpL7DEQSyIYFibdR8sd2Nzz8y+Te0H8CTeU/x iIQ93+fzPhDaXpUfkIFlJIp41Q5ziTuok9fC6iKeeFcJcDp8y4PYLo2n7aqaCLv65QHW E+XccHokjIAdeS7NFMtosBhbiMbcBjFIgGAhcCkZF+Za+qwzMzt4VyAZ8FWIYa1A0v1J OJA0xDmuvxojgCcuSzlrgvjS77AJwoDzrpnViq0evwa4kjljuUNMIPxuJXo0PXPn5Xpl ZFQL3/5qBICsJcUkbK3WXaE0JvCyJja2yA3SQtNbsgUSXbd67LKOLJK9jtB/vnXQrNHW avBg== 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=H4+FLclhdhCw74jAzeAwHm0BVOBLEFDsMtURbkkNBZU=; b=UE3VdBrrxACVc9XaM5AuOLOWBFyeYFLEJpOMY2SbW3nQySFzm5l5WjIP9A3PeZ3wOH 1si6WIaOFwWPvBE55yzWkwK7XjlbKDTEzsCusaP3R+M6clQfEqvwMVVE4Iknka0yi9AJ pW/1CyLc7w5sMP+ggg6NXWYRGq+wrA5TQryhlvUs896Ln4kn8dGsllXw85Dz/dOCnuvv E/ibi3zs6IPTSKL7j9FEzwRJHvi/fchez6YYa0KKK7VbFbfQbOP8M9uViqlDH1mCeS3R Gzhuikyxl3IYTfjqo1+9cePAjqnLKz/WwW5ziAExPimobjG5H4sGwQni8WoTCNVX996n B1Ng== X-Gm-Message-State: APjAAAXlpcz6VITNxrqcLyALxrOXCBPZ+Ja7/q/mugVEbE0N9v6w/Rq+ qljxjF8rZyYginGIju/pnoZgluYzPbc= X-Received: by 2002:a62:158c:: with SMTP id 134mr94582731pfv.81.1578075567622; Fri, 03 Jan 2020 10:19:27 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id j8sm41783602pfe.182.2020.01.03.10.19.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 10:19:27 -0800 (PST) From: Al Cooper To: linux-kernel@vger.kernel.org Cc: Al Cooper , Kishon Vijay Abraham I , Rob Herring , Mark Rutland , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com (maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE), Srinath Mannam , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE) Subject: [PATCH v4 03/13] phy: usb: Put USB phys into IDDQ on suspend to save power in S2 mode Date: Fri, 3 Jan 2020 13:18:01 -0500 Message-Id: <20200103181811.22939-4-alcooperx@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200103181811.22939-1-alcooperx@gmail.com> References: <20200103181811.22939-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 bd473d12ab28..ac7f7995c11f 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