Received: by 10.223.185.116 with SMTP id b49csp2249889wrg; Thu, 22 Feb 2018 10:29:19 -0800 (PST) X-Google-Smtp-Source: AH8x226zcdaarlXn+8oNkwrZNI0wNBieImiN0PhUaClenowNAJfkoUujpMjOU+zQgwpzABvKKkhf X-Received: by 2002:a17:902:52cd:: with SMTP id a71-v6mr5118205pli.389.1519324158821; Thu, 22 Feb 2018 10:29:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519324158; cv=none; d=google.com; s=arc-20160816; b=YgGofr9ebxU5/aAXkR6HfZUG73DWYQT5F6OYNbpb4a7rXilg0ZTwQZJY6+S2BWcqJu c5andjNu26ywNZb20wF5utoUoLQaZMUepMddJuHmU0Qc7UG3hM8PrQnDNVodcmlHXZ/G ovy8PJBM+WW/4c8VWrHFDDdwjJroI0XM7vLJktyz3aPImVyD+5nE72o36Vlz9lnyl5ZN ABHdxP7RTeeF6Lvb1+qagPYvXO4e3H0V4Y+OtIkG3BHHKbzDr0GHZvAaA4qj1tYxdiWC K882W0g4UNoVpwa/8qHkYgUBXnZqcnEu1vNw73AIh9pEChIFjgXIsRvWRJmdfltu0ZGI mV6w== 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:in-reply-to :subject:cc:to:from:date:arc-authentication-results; bh=MUPw9G/gmFylzBhODWXaiyLEav0IUV7saETIhc9HQbg=; b=vRkAmQSKoaWZlQvXFZRZEEXZPo6L8Y2RE8OrJGuUErUcOFgxMUSxK/PuAJ/zNvXx+G M7Nz9VvmWf/Ri/nVfgo3lrl93ZifdOeJcZ9mIwFMM9suLY7D1E75y/B8ywiy0lolMXc3 dvR4TsUJ9QoPbs7tGLMFcUkpPIL7ss3SRCV0d/Z4IHdkuVUcXaDtDVkvDTOh7njiIokF maDnJGhuNWCGdffxH4X5VxF5VERWmE8AxL8Uc7BduI7zBZnMbYzP0n0lnqFj91DtDPNx lo8cAQlWQ9E7XMf1tgdtH+WAjEomHfoYnGM+MPme+2osEto07gcAZUl1Cmx1mfoma5OI HHzg== 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 s71si365658pgc.17.2018.02.22.10.29.03; Thu, 22 Feb 2018 10:29:18 -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 S933766AbeBVS16 (ORCPT + 99 others); Thu, 22 Feb 2018 13:27:58 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:48390 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S933737AbeBVS14 (ORCPT ); Thu, 22 Feb 2018 13:27:56 -0500 Received: (qmail 2826 invoked by uid 2102); 22 Feb 2018 13:27:54 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 22 Feb 2018 13:27:54 -0500 Date: Thu, 22 Feb 2018 13:27:54 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Amelie DELAUNAY cc: Roger Quadros , Greg Kroah-Hartman , Rob Herring , Mark Rutland , Tony Prisk , "linux-usb@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH v2] usb: host: ehci-platform: add support for optional external vbus supply In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 22 Feb 2018, Amelie DELAUNAY wrote: > >>>>> --- 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 > >>>>> > >>>> > >>>> Can platforms have more than one regulator e.g. one regulator per port? > >>>> > >>> > >>> I imagine that yes, platforms could have one regulator per port. > >>> Regulator consumers bindings impose a -supply property per > >>> regulator, so, what do you think about : > >>> vbus0-supply for port#0 > >>> vbus1-supply for port#1 > >>> ... > >>> vbusN-supply for port#N > >>> > >>> And then in probe, allocate 'struct regulator *vbus_supplies' with a > >>> size corresponding to 'HCS_N_PORTS(ehci->hcs_params) * sizeof(struct > >>> regulator *)'. > >>> And loop to get optional regulator vbus0, vbus1,..., vbusN. > >>> And then enable/disable the corresponding regulator in > >>> ehci_platform_port_power thanks to portnum. > >> > >> Looks fine to me but we need to get Alan's opinion if this is worth the effort. > >> If there isn't a single platform needing it we could probably do without it > >> but the DT binding must be scalable to add this feature in the future. > > > > I agree that for now there don't seem to be any platforms requiring > > more than one regulator, but this should be implemented in a way that > > could be expanded if necessary. > > > > Anyway, the basic idea is reasonable. I don't know to what extent > > people want to power-off their EHCI ports, but if they do then we ought > > to turn off external regulators at the same time. > > > > Is there a real-life use case for this? > > > > Alan Stern > > > > On my setup I have the following: > > regulator_____vbus > _________________ \ > | EHCI controller |-port0-----[USB connector] > |_________________|-port1-----X > > So, I have one regulator only for port0. But I could I have one more if > port1 was connected. My current regulator could also supplies port1. > > To allocate a vbus_supplies array depending on N_PORTS, I have to move > this initialization from probe to ehci_platform_reset, after ehci_setup > is done. > Then, I have to define each regulator id depending on the port number. > This imposes a binding like > - portN_vbus-supply : phandle of regulator supplying vbus for port N > But I don't know if we can describe it like this in dt-bindings ? > > &ehci { > ... > port0_vbus-supply = <&vbus_reg>; > port1_vbus-supply = <&vbus_reg>; //Could be another regulator, or not > specified if port is not connected. > ... > }; > > Is it ok to move vbus_supplies initialization in ehci_platform_reset ? Yes, it's okay to move the code if you need to. However, I can not speak on the DT implications. Someone who knows more about it should chime in. Alan Stern