devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@nxp.com>
To: Mike Looijmans <mike.looijmans@topic.nl>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"balbi@kernel.org" <balbi@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb/phy-generic: Add support for OTG VBUS supply control
Date: Fri, 29 May 2020 07:20:14 +0000	[thread overview]
Message-ID: <20200529072036.GA32755@b29397-desktop> (raw)
In-Reply-To: <3fe53080-cc74-3b0b-3041-2c4fde1b7e30@topic.nl>

On 20-05-29 07:47:37, Mike Looijmans wrote:
> 
> Met vriendelijke groet / kind regards,
> 
> Mike Looijmans
> System Expert
> 
> 
> TOPIC Embedded Products B.V.
> Materiaalweg 4, 5681 RJ Best
> The Netherlands
> 
> T: +31 (0) 499 33 69 69
> E: mike.looijmans@topicproducts.com
> W: https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.topicproducts.com%2F&amp;data=02%7C01%7Cpeter.chen%40nxp.com%7Cc8a5e33bbd3141b57d5408d80393cff2%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637263280668758097&amp;sdata=e5yJuVtOJ9%2BUqmRl6HNk14Fd0%2FPR2jQAhOl1vHtYJKg%3D&amp;reserved=0
> 
> Please consider the environment before printing this e-mail
> On 28-05-2020 13:20, Peter Chen wrote:
> > On 20-05-26 16:50:51, Mike Looijmans wrote:
> > > This enables support for VBUS on boards where the power is supplied
> > > by a regulator. The regulator is enabled when the USB port enters
> > > HOST mode.
> > > 
> > Why you don't do this at your host controller driver?
> 
> That was my first thought too, but it made more sense to do it here. It's
> about how things are connected on the board, and not about the controller.
> Also makes for a consistent devicetree when using different SOCs on the same
> carrier board.

A standard interface is: port_power for hc_driver, but seems the xHCI
doesn't implement it.

> 
> I already needed this driver to properly reset the USB phy, which the
> controller driver also did not do. So it made sense to add the vbus power
> control to this driver too.
> 
> If you have a strong preference for the controller driver, I can move this
> to the DWC3 driver which happens to be the controller for the latest batch
> of SOMs.
> 

You may ask Mathias or Felipe for comments where is suitable for vbus
regulator.

> > > +
> > >   	nop->dev		= dev;
> > >   	nop->phy.dev		= nop->dev;
> > >   	nop->phy.label		= "nop-xceiv";
> > > @@ -278,6 +319,7 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop)
> > >   	nop->phy.otg->usb_phy		= &nop->phy;
> > >   	nop->phy.otg->set_host		= nop_set_host;
> > >   	nop->phy.otg->set_peripheral	= nop_set_peripheral;
> > > +	nop->phy.otg->set_vbus		= nop_set_vbus;

OTG is dead, even USB-IF has refused OTG test since 2019-09, you may
avoid to use OTG structure.

Peter


> > >   	return 0;
> > >   }
> > > diff --git a/drivers/usb/phy/phy-generic.h b/drivers/usb/phy/phy-generic.h
> > > index 7ee80211a688..a3663639ea1e 100644
> > > --- a/drivers/usb/phy/phy-generic.h
> > > +++ b/drivers/usb/phy/phy-generic.h
> > > @@ -14,7 +14,9 @@ struct usb_phy_generic {
> > >   	struct gpio_desc *gpiod_reset;
> > >   	struct gpio_desc *gpiod_vbus;
> > >   	struct regulator *vbus_draw;
> > > +	struct regulator *vbus_reg;
> > >   	bool vbus_draw_enabled;
> > > +	bool vbus_reg_enabled;
> > >   	unsigned long mA;
> > >   	unsigned int vbus;
> > >   };
> > > -- 
> > > 2.17.1
> > > 
> 
> -- 
> Mike Looijmans
> 

-- 

Thanks,
Peter Chen

      reply	other threads:[~2020-05-29  7:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26 14:50 [PATCH] usb/phy-generic: Add support for OTG VBUS supply control Mike Looijmans
2020-05-27  7:15 ` kbuild test robot
2020-05-27 17:25 ` kbuild test robot
2020-05-28 11:20 ` Peter Chen
     [not found]   ` <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.976751ef-854e-4011-a18e-b2d0439b2aee@emailsignatures365.codetwo.com>
     [not found]     ` <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.0d2bd5fa-15cc-4b27-b94e-83614f9e5b38.5ef445e7-974a-4eff-8ab7-9d43664977e4@emailsignatures365.codetwo.com>
2020-05-29  5:47       ` Mike Looijmans
2020-05-29  7:20         ` Peter Chen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200529072036.GA32755@b29397-desktop \
    --to=peter.chen@nxp.com \
    --cc=balbi@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mike.looijmans@topic.nl \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).