From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Subject: [v2] usb: host: ehci-platform: add support for optional external vbus supply From: Felipe Balbi Message-Id: <87h8qbq0em.fsf@linux.intel.com> Date: Tue, 20 Feb 2018 15:02:41 +0200 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 List-ID: SGksCgpBbWVsaWUgRGVsYXVuYXkgPGFtZWxpZS5kZWxhdW5heUBzdC5jb20+IHdyaXRlczoKPiBP biBzb21lIGJvYXJkcywgZXNwZWNpYWxseSB3aGVuIHZidXMgc3VwcGx5IHJlcXVpcmVzIGxhcmdl IGN1cnJlbnQsCj4gYW5kIHRoZSBjaGFyZ2UgcHVtcCBvbiB0aGUgUEhZIGlzbid0IGVub3VnaCwg YW4gZXh0ZXJuYWwgdmJ1cyBwb3dlciBzd2l0Y2gKPiBtYXkgYmUgdXNlZC4KPiBBZGQgc3VwcG9y dCBmb3IgdGhpcyBvcHRpb25hbCBleHRlcm5hbCB2YnVzIHN1cHBseSBpbiBlaGNpLXBsYXRmb3Jt Lgo+Cj4gU2lnbmVkLW9mZi1ieTogQW1lbGllIERlbGF1bmF5IDxhbWVsaWUuZGVsYXVuYXlAc3Qu Y29tPgo+Cj4gLS0tCj4gQ2hhbmdlcyBpbiB2MjoKPiAgKiBBZGRyZXNzIFJvZ2VyIFF1YWRyb3Mg Y29tbWVudHM6IG1vdmUgcmVndWxhdG9yX2VuYWJsZS9kaXNhYmxlIGZyb20KPiBlaGNpX3BsYXRm b3JtX3Bvd2VyX29uL29mZiB0byBlaGNpX3BsYXRmb3JtX3BvcnRfcG93ZXIuCj4gLS0tCj4gIERv Y3VtZW50YXRpb24vZGV2aWNldHJlZS9iaW5kaW5ncy91c2IvdXNiLWVoY2kud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pZiAocHJpdi0+dmJ1c19zdXBwbHkpIHsKCnlvdSBj YW4gcmVkdWNlIGluZGVudGF0aW9uIGhlcmU6CgoJaWYgKCFwcml2LT52YnVzX3N1cHBseSkKICAg ICAgICAJcmV0dXJuIDA7Cg== From mboxrd@z Thu Jan 1 00:00:00 1970 From: felipe.balbi@linux.intel.com (Felipe Balbi) Date: Tue, 20 Feb 2018 15:02:41 +0200 Subject: [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> Message-ID: <87h8qbq0em.fsf@linux.intel.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.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 at 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Felipe Balbi Subject: Re: [PATCH v2] usb: host: ehci-platform: add support for optional external vbus supply Date: Tue, 20 Feb 2018 15:02:41 +0200 Message-ID: <87h8qbq0em.fsf@linux.intel.com> References: <1519131492-27913-1-git-send-email-amelie.delaunay@st.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1519131492-27913-1-git-send-email-amelie.delaunay@st.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Greg Kroah-Hartman , Rob Herring , Mark Rutland , Tony Prisk , Alan Stern Cc: devicetree@vger.kernel.org, Amelie Delaunay , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org List-Id: devicetree@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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Cyrus-Session-Id: sloti22d1t05-2825185-1519131817-5-17625779852964401152 X-Sieve: CMU Sieve 3.0 X-Spam-known-sender: no X-Spam-score: 0.0 X-Spam-hits: BAYES_00 -1.9, HEADER_FROM_DIFFERENT_DOMAINS 0.001, ME_NOAUTH 0.01, RCVD_IN_DNSWL_HI -5, T_RP_MATCHES_RCVD -0.01, LANGUAGES enro, BAYES_USED global, SA_VERSION 3.4.0 X-Spam-source: IP='209.132.180.67', Host='vger.kernel.org', Country='US', FromHeader='com', MailFrom='org' X-Spam-charsets: X-Resolved-to: greg@kroah.com X-Delivered-to: greg@kroah.com X-Mail-from: linux-usb-owner@vger.kernel.org ARC-Seal: i=1; a=rsa-sha256; cv=none; d=messagingengine.com; s=arctest; t=1519131817; b=CH5lf3Ae9KW5Ug7YT4aJk42A3cWOTDMFEsDksZtkfZ/HaJ1 dEa1cz/DGssnRyMDhAOWPM4uz1tDdbwZv9gKnO1DeG6fDwn01LUIAcjGS1Yakznp QtvUeq7jzeCoUti+au4o1cZ9fntZTs1Souet+oVJT6QNWmIukeU/O/lZQDOmtjgg ruT+z6vJt8Kt5PDYcVzJDYrymsaZ8srZ7p3PDRsFJzp31/OhHXmfQUtDAxk48lVs u9PhKqrfPV+8y0ywTbTUKGNJY8BCvVVFFSDOWMcxGa8KhmaZyhvfIkz/KCcQvu9t 0sHfXpEcKetAROJeEU2X6S6dUVthu9AcqYzXRHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=from:to:cc:subject:in-reply-to:references :date:message-id:mime-version:content-type:sender:list-id; s= arctest; t=1519131817; bh=LnPlv09ohxLap4WuleNioRKa6DyK6EpVHHO1Bh EBAqE=; b=BDAifuAq7UiFnHSPPcBl3b46rNKYf8RBDEp5Gq5DXzPFuBDkpLCoN0 o2TJmb5sVB26WRJOo1iHmOSgSZ4DUOYS/S5m8z7Oh35M35Fx8eCic7owHDmeg5FF uNrR/G9T2wKNd0ogItEENZfwCAz5r2rgVJmw5aBANVdARTWyRwezt5i7hI0OmwbH gDEWZYpuTRyB5kk4a1T4PY8YzTRF47Q3vHAxkI5HEePiLDXOU/hxmLgCXFWUpcfa ElYmZ2kfCGKGN7ZkR0isZqRPJ5i7DkF41iwyva1Oe68SPLd4wTsvqNXbbKA1BzW6 yMQSIezyNNOyYTjzHttu9ElfyhAV7k3g== ARC-Authentication-Results: i=1; mx4.messagingengine.com; arc=none (no signatures found); dkim=none (no signatures found); dmarc=none (p=none,has-list-id=yes,d=none) header.from=linux.intel.com; iprev=pass policy.iprev=209.132.180.67 (vger.kernel.org); spf=none smtp.mailfrom=linux-usb-owner@vger.kernel.org smtp.helo=vger.kernel.org; x-aligned-from=fail; x-ptr=pass x-ptr-helo=vger.kernel.org x-ptr-lookup=vger.kernel.org; x-return-mx=pass smtp.domain=vger.kernel.org smtp.result=pass smtp_org.domain=kernel.org smtp_org.result=pass smtp_is_org_domain=no header.domain=linux.intel.com header.result=pass header_org.domain=intel.com header_org.result=pass header_is_org_domain=no Authentication-Results: mx4.messagingengine.com; arc=none (no signatures found); dkim=none (no signatures found); dmarc=none (p=none,has-list-id=yes,d=none) header.from=linux.intel.com; iprev=pass policy.iprev=209.132.180.67 (vger.kernel.org); spf=none smtp.mailfrom=linux-usb-owner@vger.kernel.org smtp.helo=vger.kernel.org; x-aligned-from=fail; x-ptr=pass x-ptr-helo=vger.kernel.org x-ptr-lookup=vger.kernel.org; x-return-mx=pass smtp.domain=vger.kernel.org smtp.result=pass smtp_org.domain=kernel.org smtp_org.result=pass smtp_is_org_domain=no header.domain=linux.intel.com header.result=pass header_org.domain=intel.com header_org.result=pass header_is_org_domain=no Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752330AbeBTNDU (ORCPT ); Tue, 20 Feb 2018 08:03:20 -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 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,539,1511856000"; d="scan'208";a="19102587" 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-usb-owner@vger.kernel.org X-Mailing-List: linux-usb@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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