Received: by 10.223.185.116 with SMTP id b49csp613326wrg; Tue, 20 Feb 2018 05:05:47 -0800 (PST) X-Google-Smtp-Source: AH8x227hREBMWZTWQtpK37x2zBMznjKz8+3XNTpsFJP/2aTZ8nHcbDJoygGLcR8riyzyurEtBLwm X-Received: by 10.99.50.66 with SMTP id y63mr15466412pgy.207.1519131947112; Tue, 20 Feb 2018 05:05:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519131947; cv=none; d=google.com; s=arc-20160816; b=wv7SHSmH8NfGjwne6HxJtGujS7Zuj3LIMdb91AzfN3QAf+4fTDYM7R2s+KjWlbMN3Q tOrgCGWO/IJbZaCZkZvqfzByzjnpiFoXGo09bVcwZ+nQXXvuVNagb3lP3vFYXEdu3O+E l0it7lWu8BupisfWyC9lh9tryqRSCWLGWSeuTzy5RJhGz5xfbI7SOAeHpoSujTM14uFB 1Hhz8JCY8YOeKxiYVG/Bh9OHjdOKAQ+1ovpoK61fTdt7hsSSJXXQdQdVtFi1IP2t9lNZ FmEzJsUHlTUAuTe1fkakfRsHPJ4800jz69cpdvPnE85cdItgiRp27rmccO2p0OMSAz4V i7jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:arc-authentication-results; bh=zWLKL0TqDC+966DLXEACEn5RGfECAuR31wuOfLZik1Y=; b=cLJVB7z+GO03klTLiCq5GRVRNmM2IzFKH0YHJeqjIho0lQNDXBfWdzE2PiawTfDt84 bP/XDAksoGR5zrX17sdP3q/3Sv3y/rs9aMjI6ozFyMkS0aYGLNEi9Wk0uu63UoWL4Dri qtlI9stvMJgjHzEyoYyNm9en0rpW+WBn1ZIBjpZ6/U56erGaHxTxuEINar4hN0oA4Gk4 l7R80QoEeuE/ELDHKcnIya80vQau6q6aGSRgnC3WvtNFEIV6xNPqnQMuHcbqpfLtlspp 4dZUTxfnhzqdThJJ0quFD4mO5hdUjFRFLn/L9TDt2Ou8VKcNuhkVOP6rxaN+9j6yfQfa RGiA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t71si6245426pgb.108.2018.02.20.05.05.28; Tue, 20 Feb 2018 05:05:47 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752339AbeBTNDV (ORCPT + 99 others); Tue, 20 Feb 2018 08:03:21 -0500 Received: from mga17.intel.com ([192.55.52.151]:47267 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752314AbeBTNDR (ORCPT ); Tue, 20 Feb 2018 08:03:17 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Feb 2018 05:03:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,539,1511856000"; d="scan'208";a="19102587" Received: from pipin.fi.intel.com (HELO localhost) ([10.237.68.37]) by fmsmga008.fm.intel.com with ESMTP; 20 Feb 2018 05:03:14 -0800 From: Felipe Balbi To: Amelie Delaunay , Greg Kroah-Hartman , Rob Herring , Mark Rutland , Tony Prisk , Alan Stern Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Amelie Delaunay Subject: Re: [PATCH v2] usb: host: ehci-platform: add support for optional external vbus supply In-Reply-To: <1519131492-27913-1-git-send-email-amelie.delaunay@st.com> References: <1519131492-27913-1-git-send-email-amelie.delaunay@st.com> Date: Tue, 20 Feb 2018 15:02:41 +0200 Message-ID: <87h8qbq0em.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Amelie Delaunay writes: > On some boards, especially when vbus supply requires large current, > and the charge pump on the PHY isn't enough, an external vbus power switch > may be used. > Add support for this optional external vbus supply in ehci-platform. > > Signed-off-by: Amelie Delaunay > > --- > Changes in v2: > * Address Roger Quadros comments: move regulator_enable/disable from > ehci_platform_power_on/off to ehci_platform_port_power. > --- > Documentation/devicetree/bindings/usb/usb-ehci.txt | 1 + > drivers/usb/host/ehci-platform.c | 31 ++++++++++++++++++++++ > 2 files changed, 32 insertions(+) > > diff --git a/Documentation/devicetree/bindings/usb/usb-ehci.txt b/Documentation/devicetree/bindings/usb/usb-ehci.txt > index 3efde12..fc480cd 100644 > --- a/Documentation/devicetree/bindings/usb/usb-ehci.txt > +++ b/Documentation/devicetree/bindings/usb/usb-ehci.txt > @@ -19,6 +19,7 @@ Optional properties: > - phys : phandle + phy specifier pair > - phy-names : "usb" > - resets : phandle + reset specifier pair > + - vbus-supply : phandle of regulator supplying vbus > > Example (Sequoia 440EPx): > ehci@e0000300 { > diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c > index b065a96..05be100 100644 > --- a/drivers/usb/host/ehci-platform.c > +++ b/drivers/usb/host/ehci-platform.c > @@ -29,6 +29,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -46,6 +47,7 @@ struct ehci_platform_priv { > struct reset_control *rsts; > struct phy **phys; > int num_phys; > + struct regulator *vbus_supply; > bool reset_on_resume; > }; > > @@ -76,6 +78,25 @@ static int ehci_platform_reset(struct usb_hcd *hcd) > return 0; > } > > +static int ehci_platform_port_power(struct usb_hcd *hcd, int portnum, > + bool enable) > +{ > + struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd); > + int ret = 0; > + > + if (priv->vbus_supply) { you can reduce indentation here: if (!priv->vbus_supply) return 0; -- balbi