On 05/27/2017 12:09 PM, rock-chips(daniel.meng) wrote: > > > On 2017/5/27 16:38, Marek Vasut wrote: >> On 05/27/2017 09:44 AM, rock-chips(daniel.meng) wrote: >>> >>> On 2017/5/18 1:07, Marek Vasut wrote: >>>> On 05/17/2017 12:21 PM, Meng Dongyang wrote: >>>>> Add the compatible "rockchip,rk3328-xhci" in match table >>>>> for rk3328 to probe xhci controller. Turn off vbus when >>>>> usb stop. >>>>> >>>>> Signed-off-by: Meng Dongyang <daniel.m...@rock-chips.com> >>>>> --- >>>>> drivers/usb/host/xhci-rockchip.c | 6 ++++++ >>>>> 1 file changed, 6 insertions(+) >>>>> >>>>> diff --git a/drivers/usb/host/xhci-rockchip.c >>>>> b/drivers/usb/host/xhci-rockchip.c >>>>> index f559830..8db92cb 100644 >>>>> --- a/drivers/usb/host/xhci-rockchip.c >>>>> +++ b/drivers/usb/host/xhci-rockchip.c >>>>> @@ -168,6 +168,7 @@ static int xhci_usb_probe(struct udevice *dev) >>>>> static int xhci_usb_remove(struct udevice *dev) >>>>> { >>>>> + struct rockchip_xhci_platdata *plat = dev_get_platdata(dev); >>>>> struct rockchip_xhci *ctx = dev_get_priv(dev); >>>>> int ret; >>>>> @@ -178,11 +179,15 @@ static int xhci_usb_remove(struct udevice *dev) >>>>> if (ret) >>>>> return ret; >>>>> + if (dm_gpio_is_valid(&plat->vbus_gpio)) >>>>> + dm_gpio_set_value(&plat->vbus_gpio, 0); >>>> This should be a fixed regulator, then you don't have to mess with GPIOs >>>> directly. >>> Indeed, this is better to be a fixed regulator. Yet other platforms >>> still use GPIOs directly. >>> So I must change the dts of the other platforms if change like this. >>> Maybe it's better to change >>> by another commit. This patch is only for turning off vbus when usb stop. >> How do you assure the polarity of this GPIO here though ? Anyway, >> turning this into regulator could be done in separate patch if this >> practice is already establish. > I config the active voltageof gpio throw dts to assure the polarity. > > for example: > vbus-gpio = <&gpio0 27 GPIO_ACTIVE_HIGH>; > The active voltage is configed to high, then if I call the function > dm_gpio_set_value(&plat->vbus_gpio, 1); > the gpio output voltage will be high.
So DM handles the polarity for you behind the scenes ? -- Best regards, Marek Vasut _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot