All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/8] rk3328: add support of usb host and gadget
@ 2017-05-17 10:21 Meng Dongyang
  2017-05-17 10:21 ` [U-Boot] [PATCH 1/8] configs: rk3328: add support for usb and config ehci and ohci driver Meng Dongyang
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Meng Dongyang @ 2017-05-17 10:21 UTC (permalink / raw)
  To: u-boot

Add support of usb host and gadget function for rk3328
and fix bug of dwc2 host driver.

Meng Dongyang (8):
  configs: rk3328: add support for usb and config ehci and ohci driver
  rockchip: dts: rk3328: add ehci and ohci node and enable host0 port
  configs: rk3328: config xhci controller
  usb: host: xhci-rockchip: add support for rk3328
  rockchip: dts: rk3328: support and enable xhci
  configs: rk3328: enable dwc2 driver and config for fastboot
  usb: dwc2: fix macro error and support gadget function for rk3328
  rockchip: dts: rk3328: support and enable dwc2 controller

 arch/arm/dts/rk3328-evb.dts            | 18 +++++++++++++++
 arch/arm/dts/rk3328.dtsi               | 34 +++++++++++++++++++++++++++
 board/rockchip/evb_rk3328/evb-rk3328.c | 42 +++++++++++++++++++++++++++++++---
 configs/evb-rk3328_defconfig           | 25 ++++++++++++++++++++
 drivers/usb/host/dwc2.c                | 24 ++++++++++++++++++-
 drivers/usb/host/dwc2.h                | 10 ++++----
 drivers/usb/host/xhci-rockchip.c       |  6 +++++
 include/configs/rk3328_common.h        |  9 ++++++++
 8 files changed, 160 insertions(+), 8 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 1/8] configs: rk3328: add support for usb and config ehci and ohci driver
  2017-05-17 10:21 [U-Boot] [PATCH 0/8] rk3328: add support of usb host and gadget Meng Dongyang
@ 2017-05-17 10:21 ` Meng Dongyang
  2017-05-22 20:26   ` Simon Glass
  2017-05-17 10:21 ` [U-Boot] [PATCH 2/8] rockchip: dts: rk3328: add ehci and ohci node and enable host0 port Meng Dongyang
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 17+ messages in thread
From: Meng Dongyang @ 2017-05-17 10:21 UTC (permalink / raw)
  To: u-boot

Add defconfig for usb and ehci and ohci controller, config maximal
number of ports of the root hub for ohci driver.

Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
---
 configs/evb-rk3328_defconfig    | 8 ++++++++
 include/configs/rk3328_common.h | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/configs/evb-rk3328_defconfig b/configs/evb-rk3328_defconfig
index 96241f6..a4312b2 100644
--- a/configs/evb-rk3328_defconfig
+++ b/configs/evb-rk3328_defconfig
@@ -31,3 +31,11 @@ CONFIG_SYS_NS16550=y
 CONFIG_SYSRESET=y
 CONFIG_USE_TINY_PRINTF=y
 CONFIG_ERRNO_STR=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_CMD_USB=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_GENERIC=y
diff --git a/include/configs/rk3328_common.h b/include/configs/rk3328_common.h
index b0dcd48..96b71c3 100644
--- a/include/configs/rk3328_common.h
+++ b/include/configs/rk3328_common.h
@@ -61,4 +61,7 @@
 
 #endif
 
+/* rockchip ohci host driver */
+#define CONFIG_USB_OHCI_NEW
+#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	1
 #endif
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 2/8] rockchip: dts: rk3328: add ehci and ohci node and enable host0 port
  2017-05-17 10:21 [U-Boot] [PATCH 0/8] rk3328: add support of usb host and gadget Meng Dongyang
  2017-05-17 10:21 ` [U-Boot] [PATCH 1/8] configs: rk3328: add support for usb and config ehci and ohci driver Meng Dongyang
@ 2017-05-17 10:21 ` Meng Dongyang
  2017-05-22 20:26   ` Simon Glass
  2017-05-17 10:21 ` [U-Boot] [PATCH 3/8] configs: rk3328: config xhci controller Meng Dongyang
  2017-05-17 10:21 ` [U-Boot] [PATCH 4/8] usb: host: xhci-rockchip: add support for rk3328 Meng Dongyang
  3 siblings, 1 reply; 17+ messages in thread
From: Meng Dongyang @ 2017-05-17 10:21 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
---
 arch/arm/dts/rk3328-evb.dts |  8 ++++++++
 arch/arm/dts/rk3328.dtsi    | 14 ++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/arch/arm/dts/rk3328-evb.dts b/arch/arm/dts/rk3328-evb.dts
index 01794ed..9920935 100644
--- a/arch/arm/dts/rk3328-evb.dts
+++ b/arch/arm/dts/rk3328-evb.dts
@@ -43,3 +43,11 @@
 	pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>;
 	status = "okay";
 };
+
+&usb_host0_ehci {
+	status = "okay";
+};
+
+&usb_host0_ohci {
+	status = "okay";
+};
diff --git a/arch/arm/dts/rk3328.dtsi b/arch/arm/dts/rk3328.dtsi
index 8a98ee3..e1219c3 100644
--- a/arch/arm/dts/rk3328.dtsi
+++ b/arch/arm/dts/rk3328.dtsi
@@ -446,6 +446,20 @@
 		status = "disabled";
 	};
 
+	usb_host0_ehci: usb at ff5c0000 {
+		compatible = "generic-ehci";
+		reg = <0x0 0xff5c0000 0x0 0x10000>;
+		interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
+		status = "disabled";
+	};
+
+	usb_host0_ohci: usb at ff5d0000 {
+		compatible = "generic-ohci";
+		reg = <0x0 0xff5d0000 0x0 0x10000>;
+		interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+		status = "disabled";
+	};
+
 	sdmmc_ext: rksdmmc at ff5f0000 {
 		compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc";
 		reg = <0x0 0xff5f0000 0x0 0x4000>;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 3/8] configs: rk3328: config xhci controller
  2017-05-17 10:21 [U-Boot] [PATCH 0/8] rk3328: add support of usb host and gadget Meng Dongyang
  2017-05-17 10:21 ` [U-Boot] [PATCH 1/8] configs: rk3328: add support for usb and config ehci and ohci driver Meng Dongyang
  2017-05-17 10:21 ` [U-Boot] [PATCH 2/8] rockchip: dts: rk3328: add ehci and ohci node and enable host0 port Meng Dongyang
@ 2017-05-17 10:21 ` Meng Dongyang
  2017-05-22 20:26   ` Simon Glass
  2017-05-17 10:21 ` [U-Boot] [PATCH 4/8] usb: host: xhci-rockchip: add support for rk3328 Meng Dongyang
  3 siblings, 1 reply; 17+ messages in thread
From: Meng Dongyang @ 2017-05-17 10:21 UTC (permalink / raw)
  To: u-boot

Add config of max root ports and add config to enable xhci
controller.

Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
---
 configs/evb-rk3328_defconfig    | 3 +++
 include/configs/rk3328_common.h | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/configs/evb-rk3328_defconfig b/configs/evb-rk3328_defconfig
index a4312b2..57aee02 100644
--- a/configs/evb-rk3328_defconfig
+++ b/configs/evb-rk3328_defconfig
@@ -39,3 +39,6 @@ CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_GENERIC=y
 CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_OHCI_GENERIC=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_RK=y
diff --git a/include/configs/rk3328_common.h b/include/configs/rk3328_common.h
index 96b71c3..cc6c890 100644
--- a/include/configs/rk3328_common.h
+++ b/include/configs/rk3328_common.h
@@ -64,4 +64,7 @@
 /* rockchip ohci host driver */
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	1
+
+/* xhci host */
+#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS	2
 #endif
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 4/8] usb: host: xhci-rockchip: add support for rk3328
  2017-05-17 10:21 [U-Boot] [PATCH 0/8] rk3328: add support of usb host and gadget Meng Dongyang
                   ` (2 preceding siblings ...)
  2017-05-17 10:21 ` [U-Boot] [PATCH 3/8] configs: rk3328: config xhci controller Meng Dongyang
@ 2017-05-17 10:21 ` Meng Dongyang
  2017-05-17 17:07   ` Marek Vasut
  3 siblings, 1 reply; 17+ messages in thread
From: Meng Dongyang @ 2017-05-17 10:21 UTC (permalink / raw)
  To: u-boot

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);
+
 	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" },
 	{ }
 };
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 4/8] usb: host: xhci-rockchip: add support for rk3328
  2017-05-17 10:21 ` [U-Boot] [PATCH 4/8] usb: host: xhci-rockchip: add support for rk3328 Meng Dongyang
@ 2017-05-17 17:07   ` Marek Vasut
  2017-05-27  7:44     ` rock-chips
  0 siblings, 1 reply; 17+ messages in thread
From: Marek Vasut @ 2017-05-17 17:07 UTC (permalink / raw)
  To: u-boot

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" },
>  	{ }
>  };
>  
> 


-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 1/8] configs: rk3328: add support for usb and config ehci and ohci driver
  2017-05-17 10:21 ` [U-Boot] [PATCH 1/8] configs: rk3328: add support for usb and config ehci and ohci driver Meng Dongyang
@ 2017-05-22 20:26   ` Simon Glass
  2017-05-24  0:47     ` sjg at google.com
  0 siblings, 1 reply; 17+ messages in thread
From: Simon Glass @ 2017-05-22 20:26 UTC (permalink / raw)
  To: u-boot

On 17 May 2017 at 04:21, Meng Dongyang <daniel.meng@rock-chips.com> wrote:
> Add defconfig for usb and ehci and ohci controller, config maximal
> number of ports of the root hub for ohci driver.
>
> Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
> ---
>  configs/evb-rk3328_defconfig    | 8 ++++++++
>  include/configs/rk3328_common.h | 3 +++
>  2 files changed, 11 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 2/8] rockchip: dts: rk3328: add ehci and ohci node and enable host0 port
  2017-05-17 10:21 ` [U-Boot] [PATCH 2/8] rockchip: dts: rk3328: add ehci and ohci node and enable host0 port Meng Dongyang
@ 2017-05-22 20:26   ` Simon Glass
  2017-05-24  0:47     ` sjg at google.com
  0 siblings, 1 reply; 17+ messages in thread
From: Simon Glass @ 2017-05-22 20:26 UTC (permalink / raw)
  To: u-boot

On 17 May 2017 at 04:21, Meng Dongyang <daniel.meng@rock-chips.com> wrote:

Commit message?

> Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
> ---
>  arch/arm/dts/rk3328-evb.dts |  8 ++++++++
>  arch/arm/dts/rk3328.dtsi    | 14 ++++++++++++++
>  2 files changed, 22 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 3/8] configs: rk3328: config xhci controller
  2017-05-17 10:21 ` [U-Boot] [PATCH 3/8] configs: rk3328: config xhci controller Meng Dongyang
@ 2017-05-22 20:26   ` Simon Glass
  2017-05-24  0:47     ` sjg at google.com
  0 siblings, 1 reply; 17+ messages in thread
From: Simon Glass @ 2017-05-22 20:26 UTC (permalink / raw)
  To: u-boot

On 17 May 2017 at 04:21, Meng Dongyang <daniel.meng@rock-chips.com> wrote:
> Add config of max root ports and add config to enable xhci
> controller.
>
> Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
> ---
>  configs/evb-rk3328_defconfig    | 3 +++
>  include/configs/rk3328_common.h | 3 +++
>  2 files changed, 6 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 3/8] configs: rk3328: config xhci controller
  2017-05-22 20:26   ` Simon Glass
@ 2017-05-24  0:47     ` sjg at google.com
  0 siblings, 0 replies; 17+ messages in thread
From: sjg at google.com @ 2017-05-24  0:47 UTC (permalink / raw)
  To: u-boot

On 17 May 2017 at 04:21, Meng Dongyang <daniel.meng@rock-chips.com> wrote:
> Add config of max root ports and add config to enable xhci
> controller.
>
> Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
> ---
>  configs/evb-rk3328_defconfig    | 3 +++
>  include/configs/rk3328_common.h | 3 +++
>  2 files changed, 6 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-rockchip, thanks!

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 2/8] rockchip: dts: rk3328: add ehci and ohci node and enable host0 port
  2017-05-22 20:26   ` Simon Glass
@ 2017-05-24  0:47     ` sjg at google.com
  0 siblings, 0 replies; 17+ messages in thread
From: sjg at google.com @ 2017-05-24  0:47 UTC (permalink / raw)
  To: u-boot

On 17 May 2017 at 04:21, Meng Dongyang <daniel.meng@rock-chips.com> wrote:

Commit message?

> Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
> ---
>  arch/arm/dts/rk3328-evb.dts |  8 ++++++++
>  arch/arm/dts/rk3328.dtsi    | 14 ++++++++++++++
>  2 files changed, 22 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-rockchip, thanks!

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 1/8] configs: rk3328: add support for usb and config ehci and ohci driver
  2017-05-22 20:26   ` Simon Glass
@ 2017-05-24  0:47     ` sjg at google.com
  0 siblings, 0 replies; 17+ messages in thread
From: sjg at google.com @ 2017-05-24  0:47 UTC (permalink / raw)
  To: u-boot

On 17 May 2017 at 04:21, Meng Dongyang <daniel.meng@rock-chips.com> wrote:
> Add defconfig for usb and ehci and ohci controller, config maximal
> number of ports of the root hub for ohci driver.
>
> Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
> ---
>  configs/evb-rk3328_defconfig    | 8 ++++++++
>  include/configs/rk3328_common.h | 3 +++
>  2 files changed, 11 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-rockchip, thanks!

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 4/8] usb: host: xhci-rockchip: add support for rk3328
  2017-05-17 17:07   ` Marek Vasut
@ 2017-05-27  7:44     ` rock-chips
  2017-05-27  8:38       ` Marek Vasut
  0 siblings, 1 reply; 17+ messages in thread
From: rock-chips @ 2017-05-27  7:44 UTC (permalink / raw)
  To: u-boot



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" },
>>   	{ }
>>   };
>>   
>>
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 4/8] usb: host: xhci-rockchip: add support for rk3328
  2017-05-27  7:44     ` rock-chips
@ 2017-05-27  8:38       ` Marek Vasut
  2017-05-27 10:09         ` rock-chips
  0 siblings, 1 reply; 17+ messages in thread
From: Marek Vasut @ 2017-05-27  8:38 UTC (permalink / raw)
  To: u-boot

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.

-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 4/8] usb: host: xhci-rockchip: add support for rk3328
  2017-05-27  8:38       ` Marek Vasut
@ 2017-05-27 10:09         ` rock-chips
  2017-05-27 10:13           ` Marek Vasut
  0 siblings, 1 reply; 17+ messages in thread
From: rock-chips @ 2017-05-27 10:09 UTC (permalink / raw)
  To: u-boot



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.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 4/8] usb: host: xhci-rockchip: add support for rk3328
  2017-05-27 10:09         ` rock-chips
@ 2017-05-27 10:13           ` Marek Vasut
  2017-05-27 10:36             ` rock-chips
  0 siblings, 1 reply; 17+ messages in thread
From: Marek Vasut @ 2017-05-27 10:13 UTC (permalink / raw)
  To: u-boot

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 ?

-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [U-Boot] [PATCH 4/8] usb: host: xhci-rockchip: add support for rk3328
  2017-05-27 10:13           ` Marek Vasut
@ 2017-05-27 10:36             ` rock-chips
  0 siblings, 0 replies; 17+ messages in thread
From: rock-chips @ 2017-05-27 10:36 UTC (permalink / raw)
  To: u-boot



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.
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2017-05-27 10:36 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-17 10:21 [U-Boot] [PATCH 0/8] rk3328: add support of usb host and gadget Meng Dongyang
2017-05-17 10:21 ` [U-Boot] [PATCH 1/8] configs: rk3328: add support for usb and config ehci and ohci driver Meng Dongyang
2017-05-22 20:26   ` Simon Glass
2017-05-24  0:47     ` sjg at google.com
2017-05-17 10:21 ` [U-Boot] [PATCH 2/8] rockchip: dts: rk3328: add ehci and ohci node and enable host0 port Meng Dongyang
2017-05-22 20:26   ` Simon Glass
2017-05-24  0:47     ` sjg at google.com
2017-05-17 10:21 ` [U-Boot] [PATCH 3/8] configs: rk3328: config xhci controller Meng Dongyang
2017-05-22 20:26   ` Simon Glass
2017-05-24  0:47     ` sjg at google.com
2017-05-17 10:21 ` [U-Boot] [PATCH 4/8] usb: host: xhci-rockchip: add support for rk3328 Meng Dongyang
2017-05-17 17:07   ` Marek Vasut
2017-05-27  7:44     ` rock-chips
2017-05-27  8:38       ` Marek Vasut
2017-05-27 10:09         ` rock-chips
2017-05-27 10:13           ` Marek Vasut
2017-05-27 10:36             ` rock-chips

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.