Message ID | 1495016512-13167-5-git-send-email-daniel.meng@rock-chips.com |
---|---|
State | Changes Requested |
Delegated to: | Simon Glass |
Headers | show |
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.meng@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. > + > return 0; > } > > static const struct udevice_id xhci_usb_ids[] = { > { .compatible = "rockchip,rk3399-xhci" }, > + { .compatible = "rockchip,rk3328-xhci" }, > { } > }; > > @@ -202,6 +207,7 @@ U_BOOT_DRIVER(usb_xhci) = { > > static const struct udevice_id usb_phy_ids[] = { > { .compatible = "rockchip,rk3399-usb3-phy" }, > + { .compatible = "rockchip,rk3328-usb3-phy" }, > { } > }; > >
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.meng@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. > >> + >> return 0; >> } >> >> static const struct udevice_id xhci_usb_ids[] = { >> { .compatible = "rockchip,rk3399-xhci" }, >> + { .compatible = "rockchip,rk3328-xhci" }, >> { } >> }; >> >> @@ -202,6 +207,7 @@ U_BOOT_DRIVER(usb_xhci) = { >> >> static const struct udevice_id usb_phy_ids[] = { >> { .compatible = "rockchip,rk3399-usb3-phy" }, >> + { .compatible = "rockchip,rk3328-usb3-phy" }, >> { } >> }; >> >> >
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.meng@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.
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.meng@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.
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.meng@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 ?
On 2017/5/27 18:13, Marek Vasut wrote: > 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.meng@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 ? Yes, the polarity will be store in the struct of gpio_desc. Setting value function will change the actual value according to the polarity flag in gpio_desc. >
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); + return 0; } static const struct udevice_id xhci_usb_ids[] = { { .compatible = "rockchip,rk3399-xhci" }, + { .compatible = "rockchip,rk3328-xhci" }, { } }; @@ -202,6 +207,7 @@ U_BOOT_DRIVER(usb_xhci) = { static const struct udevice_id usb_phy_ids[] = { { .compatible = "rockchip,rk3399-usb3-phy" }, + { .compatible = "rockchip,rk3328-usb3-phy" }, { } };
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.meng@rock-chips.com> --- drivers/usb/host/xhci-rockchip.c | 6 ++++++ 1 file changed, 6 insertions(+)