Skip to contentSkip to conversation

This series adds support for fastboot related to USB.

PATCH New Frank Wang 4 participants 11 messages Dec 22, 2015 – Jun 8, 2016 USB

lore
Share & tools
lore

Frank Wang

author
#0 lore raw

cover This series adds support for fastboot related to USB.

[PATCH 1/3] Modified the check condition for max packet size of ep_in in high speed

[PATCH 2/3] Fixed the error that the last packet transmission could not be terminated

[PATCH 3/3] Add usb phy control to support fastboot for rk3036

Tested on RK3036 SDK board, it works Okay.

 board/evb_rk3036/evb_rk3036/evb_rk3036.c   |   30 +++++++++++++++++
 drivers/usb/gadget/Makefile                |    1 +
 drivers/usb/gadget/dwc2_udc_otg.c          |    4 +--
 drivers/usb/gadget/dwc2_udc_otg_regs.h     |    5 +++
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c |    2 +-
 drivers/usb/gadget/rk_otg_phy.c            |   48 ++++++++++++++++++++++++++++
 include/configs/rk3036_common.h            |   20 ++++++++++++
 7 files changed, 107 insertions(+), 3 deletions(-)
 create mode 100644 drivers/usb/gadget/rk_otg_phy.c
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/3 usb: gadget: dwc2_udc_otg: modified the check condition for max packet size of ep_in in high speed

In current high speed fastboot, fs_ep_in.wMaxPacketSize is configurated 64 bytes as default, as a result, it is failed to match the size at initialization tage in usb controller.
Actually, hardware can support less than or equal to 512 bytes in high speed mode, so I changed the condition from '!=' to '>' to fix this issue.

---
 drivers/usb/gadget/dwc2_udc_otg.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/dwc2_udc_otg.c +2 -2
index ffe2952..cb20b00 100644
@@ -557,8 +557,8 @@ static int dwc2_ep_enable(struct usb_ep *_ep,
 	}
 
 	/* hardware _could_ do smaller, but driver doesn't */
-	if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK
-	     && le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)) !=
+	if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK &&
+	     le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)) >
 	     ep_maxpacket(ep)) || !get_unaligned(&desc->wMaxPacketSize)) {
 
 		debug("%s: bad %s maxpacket\n", __func__, _ep->name);
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH 2/3 usb: gadget: dwc2_udc_otg: fixed the error that the last packet transmission could not be terminated

In reply to Frank Wang

When the actual length is less than request length in the last request, the data transmission should be terminated, because the packet transmission have alreay finished.

---
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c +1 -1
index bce9c30..ce4d44d 100644
@@ -237,7 +237,7 @@ static void complete_rx(struct dwc2_udc *dev, u8 ep_num)
 		   __func__, ep_num, req->req.actual, req->req.length,
 		   is_short, ep_tsr, xfer_size);
 
-	if (is_short || req->req.actual == req->req.length) {
+	if (is_short || req->req.actual <= req->req.length) {
 		if (ep_num == EP0_CON && dev->ep0state == DATA_STATE_RECV) {
 			debug_cond(DEBUG_OUT_EP != 0, "	=> Send ZLP\n");
 			dwc2_udc_ep0_zlp(dev);
Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH 3/3 usb: gadget: add usb phy control to support fastboot for rk3036

In reply to Frank Wang

Used dwc2 usb otg device driver frame and added USB PHY handle function.

---
 board/evb_rk3036/evb_rk3036/evb_rk3036.c |   30 +++++++++++++++++++
 drivers/usb/gadget/Makefile              |    1 +
 drivers/usb/gadget/dwc2_udc_otg_regs.h   |    5 ++++
 drivers/usb/gadget/rk_otg_phy.c          |   48 ++++++++++++++++++++++++++++++
 include/configs/rk3036_common.h          |   20 +++++++++++++
 5 files changed, 104 insertions(+)
 create mode 100644 drivers/usb/gadget/rk_otg_phy.c
board/evb_rk3036/evb_rk3036/evb_rk3036.c +30 -0
index f5758b1..ec3f973 100644
@@ -10,6 +10,11 @@
 #include <asm/arch/uart.h>
 #include <asm/arch/sdram_rk3036.h>
 
+#ifdef CONFIG_USB_GADGET
+#include <usb.h>
+#include <usb/dwc2_udc.h>
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 void get_ddr_config(struct rk3036_ddr_config *config)
@@ -47,3 +52,28 @@ void enable_caches(void)
 	dcache_enable();
 }
 #endif
+
+#ifdef CONFIG_USB_GADGET
+#define RKIO_GRF_PHYS				0x20008000
+#define RKIO_USBOTG_BASE			0x10180000
+#define RK_USB_PHY_CONTROL			0x10180e00
+
+static struct dwc2_plat_otg_data rk_otg_data = {
+	.regs_phy	= RKIO_GRF_PHYS,
+	.regs_otg	= RKIO_USBOTG_BASE,
+	.usb_phy_ctrl	= RK_USB_PHY_CONTROL,
+	.usb_gusbcfg	= 0x00001408
+};
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+	debug("%s: performing dwc2_udc_probe\n", __func__);
+	return dwc2_udc_probe(&rk_otg_data);
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+	debug("%s\n", __func__);
+	return 0;
+}
+#endif
drivers/usb/gadget/Makefile +1 -0
index c915c79..54eb89b 100644
@@ -22,6 +22,7 @@ obj-$(CONFIG_USB_FUNCTION_THOR) += f_thor.o
 obj-$(CONFIG_USB_FUNCTION_DFU) += f_dfu.o
 obj-$(CONFIG_USB_FUNCTION_MASS_STORAGE) += f_mass_storage.o
 obj-$(CONFIG_USB_FUNCTION_FASTBOOT) += f_fastboot.o
+obj-$(CONFIG_USB_GADGET_RK_OTG_PHY) += rk_otg_phy.o
 endif
 ifdef CONFIG_USB_ETHER
 obj-y += ether.o
drivers/usb/gadget/dwc2_udc_otg_regs.h +5 -0
index 78ec90e..34a29be 100644
@@ -130,8 +130,13 @@ struct dwc2_usbotg_reg {
 #define HIGH_SPEED_CONTROL_PKT_SIZE	64
 #define HIGH_SPEED_BULK_PKT_SIZE	512
 
+#ifndef CONFIG_ARCH_ROCKCHIP
 #define RX_FIFO_SIZE			(1024*4)
 #define NPTX_FIFO_SIZE			(1024*4)
+#else
+#define RX_FIFO_SIZE			((512+16)*4)
+#define NPTX_FIFO_SIZE			(64)
+#endif
 #define PTX_FIFO_SIZE			(1536*1)
 
 #define DEPCTL_TXFNUM_0		(0x0<<22)
drivers/usb/gadget/rk_otg_phy.c new file +48 -0

48 lines not on this page · raw message

include/configs/rk3036_common.h +20 -0
index f753e68..d804b60 100644
@@ -71,6 +71,26 @@
 
 #define CONFIG_CMD_I2C
 
+/* FASTBOOT */
+#define CONFIG_CMD_FASTBOOT
+#define CONFIG_USB_GADGET
+#define CONFIG_USB_GADGET_DOWNLOAD
+#define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_USB_GADGET_DWC2_OTG
+#define CONFIG_USB_GADGET_RK_OTG_PHY
+#define CONFIG_USB_FUNCTION_FASTBOOT
+#define CONFIG_USB_FUNCTION_MASS_STORAGE
+#define CONFIG_FASTBOOT_FLASH
+#define CONFIG_FASTBOOT_FLASH_MMC_DEV		0
+#define CONFIG_FASTBOOT_BUF_ADDR	(CONFIG_SYS_SDRAM_BASE \
+					+ SDRAM_BANK_SIZE)
+#define CONFIG_FASTBOOT_BUF_SIZE		0x07000000
+#define CONFIG_USB_GADGET_VBUS_DRAW		0
+#define CONFIG_SYS_CACHELINE_SIZE		64
+#define CONFIG_G_DNL_MANUFACTURER		"Rockchip"
+#define CONFIG_G_DNL_VENDOR_NUM		0x2207
+#define CONFIG_G_DNL_PRODUCT_NUM		0x0006
+
 #ifndef CONFIG_SPL_BUILD
 #include <config_distro_defaults.h>
 
Signature · 1 line
1.7.9.5
#4 lore raw

cover This series adds support for fastboot related to USB.

In reply to Frank Wang
Quoted 10 lines · Frank Wang

[PATCH 1/3] Modified the check condition for max packet size of ep_in in
high speed

[PATCH 2/3] Fixed the error that the last packet transmission could not be
terminated

[PATCH 3/3] Add usb phy control to support fastboot for rk3036

Tested on RK3036 SDK board, it works Okay.

Quoted 10 lines
 board/evb_rk3036/evb_rk3036/evb_rk3036.c   |   30 +++++++++++++++++
 drivers/usb/gadget/Makefile                |    1 +
 drivers/usb/gadget/dwc2_udc_otg.c          |    4 +--
 drivers/usb/gadget/dwc2_udc_otg_regs.h     |    5 +++
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c |    2 +-
 drivers/usb/gadget/rk_otg_phy.c            |   48
++++++++++++++++++++++++++++ include/configs/rk3036_common.h            | 
 20 ++++++++++++
 7 files changed, 107 insertions(+), 3 deletions(-)
 create mode 100644 drivers/usb/gadget/rk_otg_phy.c

Series looks sensible to me, but I'd like to have Lukasz take a look at it and review it thoroughly too.

Thanks!

Best regards,
Marek Vasut

author
#5 lore raw

cover This series adds support for fastboot related to USB.

Hi Lukasz,

Friendly Ping!

Could you help to review this series of patches in your free time?

BR.
Frank

Quoted 31 lines · Marek Vasut
Quoted 19 lines · Frank Wang

[PATCH 1/3] Modified the check condition for max packet size of ep_in in
high speed

[PATCH 2/3] Fixed the error that the last packet transmission could not be
terminated

[PATCH 3/3] Add usb phy control to support fastboot for rk3036

Tested on RK3036 SDK board, it works Okay.

  board/evb_rk3036/evb_rk3036/evb_rk3036.c   |   30 +++++++++++++++++
  drivers/usb/gadget/Makefile                |    1 +
  drivers/usb/gadget/dwc2_udc_otg.c          |    4 +--
  drivers/usb/gadget/dwc2_udc_otg_regs.h     |    5 +++
  drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c |    2 +-
  drivers/usb/gadget/rk_otg_phy.c            |   48
++++++++++++++++++++++++++++ include/configs/rk3036_common.h            |
  20 ++++++++++++
  7 files changed, 107 insertions(+), 3 deletions(-)
Quoted 1 line

create mode 100644 drivers/usb/gadget/rk_otg_phy.c

Series looks sensible to me, but I'd like to have Lukasz take a look at it and review it thoroughly too.

Thanks!

Best regards,
Marek Vasut

#6 lore raw

cover This series adds support for fastboot related to USB.

In reply to Frank Wang

Hi Frank

Quoted 9 lines

[PATCH 1/3] Modified the check condition for max packet size of
ep_in in high speed

[PATCH 2/3] Fixed the error that the last packet transmission could
not be terminated

[PATCH 3/3] Add usb phy control to support fastboot for rk3036

Tested on RK3036 SDK board, it works Okay.

I'm out of office till the beginning of Jan 2016.

I will review and read your logs (with the max packet problem) when I come back.

Quoted 7 lines
 board/evb_rk3036/evb_rk3036/evb_rk3036.c   |   30 +++++++++++++++++
 drivers/usb/gadget/Makefile                |    1 +
 drivers/usb/gadget/dwc2_udc_otg.c          |    4 +--
 drivers/usb/gadget/dwc2_udc_otg_regs.h     |    5 +++
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c |    2 +-
 drivers/usb/gadget/rk_otg_phy.c            |   48
Quoted 5 lines

++++++++++++++++++++++++++++
include/configs/rk3036_common.h | 20 ++++++++++++ 7
files changed, 107 insertions(+), 3 deletions(-) create mode 100644 drivers/usb/gadget/rk_otg_phy.c

Best regards,
Lukasz Majewski
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151230/4680e0a3/attachment.sig>

#7 lore raw

cover This series adds support for fastboot related to USB.

Hi Lukasz

Have you back to office? Much appreciate if you can review Frank's patch.

Thanks
Eddie

2015-12-30 17:14 GMT+08:00 Lukasz Majewski <[email protected]>:

Quoted 38 lines

Hi Frank

Quoted 9 lines

[PATCH 1/3] Modified the check condition for max packet size of
ep_in in high speed

[PATCH 2/3] Fixed the error that the last packet transmission could
not be terminated

[PATCH 3/3] Add usb phy control to support fastboot for rk3036

Tested on RK3036 SDK board, it works Okay.

I'm out of office till the beginning of Jan 2016.

I will review and read your logs (with the max packet problem) when I come back.

Quoted 7 lines
 board/evb_rk3036/evb_rk3036/evb_rk3036.c   |   30 +++++++++++++++++
 drivers/usb/gadget/Makefile                |    1 +
 drivers/usb/gadget/dwc2_udc_otg.c          |    4 +--
 drivers/usb/gadget/dwc2_udc_otg_regs.h     |    5 +++
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c |    2 +-
 drivers/usb/gadget/rk_otg_phy.c            |   48
Quoted 5 lines

++++++++++++++++++++++++++++
include/configs/rk3036_common.h | 20 ++++++++++++ 7
files changed, 107 insertions(+), 3 deletions(-) create mode 100644 drivers/usb/gadget/rk_otg_phy.c

Best regards,
Lukasz Majewski

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#8 lore raw

cover This series adds support for fastboot related to USB.

Hi Lukasz

I guess you missed this mail thread. So send it again. Can you help to review this patch set?

2016-01-18 14:24 GMT+08:00 Eddie Cai <[email protected]>:

Quoted 46 lines

Hi Lukasz

Have you back to office? Much appreciate if you can review Frank's patch.

Thanks
Eddie

2015-12-30 17:14 GMT+08:00 Lukasz Majewski <[email protected]>:

Quoted 38 lines

Hi Frank

Quoted 9 lines

[PATCH 1/3] Modified the check condition for max packet size of
ep_in in high speed

[PATCH 2/3] Fixed the error that the last packet transmission could
not be terminated

[PATCH 3/3] Add usb phy control to support fastboot for rk3036

Tested on RK3036 SDK board, it works Okay.

I'm out of office till the beginning of Jan 2016.

I will review and read your logs (with the max packet problem) when I come back.

Quoted 7 lines
 board/evb_rk3036/evb_rk3036/evb_rk3036.c   |   30 +++++++++++++++++
 drivers/usb/gadget/Makefile                |    1 +
 drivers/usb/gadget/dwc2_udc_otg.c          |    4 +--
 drivers/usb/gadget/dwc2_udc_otg_regs.h     |    5 +++
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c |    2 +-
 drivers/usb/gadget/rk_otg_phy.c            |   48
Quoted 5 lines

++++++++++++++++++++++++++++
include/configs/rk3036_common.h | 20 ++++++++++++ 7
files changed, 107 insertions(+), 3 deletions(-) create mode 100644 drivers/usb/gadget/rk_otg_phy.c

Best regards,
Lukasz Majewski

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#9 lore raw

cover This series adds support for fastboot related to USB.

Quoted 4 lines · Eddie Cai

Hi Lukasz

I guess you missed this mail thread. So send it again. Can you help to review this patch set?

Hi,

please rebase the series and repost. Keep me on CC

Quoted 47 lines

2016-01-18 14:24 GMT+08:00 Eddie Cai <[email protected]>:

Quoted 46 lines

Hi Lukasz

Have you back to office? Much appreciate if you can review Frank's patch.

Thanks
Eddie

2015-12-30 17:14 GMT+08:00 Lukasz Majewski <[email protected]>:

Quoted 38 lines

Hi Frank

Quoted 9 lines

[PATCH 1/3] Modified the check condition for max packet size of
ep_in in high speed

[PATCH 2/3] Fixed the error that the last packet transmission could
not be terminated

[PATCH 3/3] Add usb phy control to support fastboot for rk3036

Tested on RK3036 SDK board, it works Okay.

I'm out of office till the beginning of Jan 2016.

I will review and read your logs (with the max packet problem) when I come back.

Quoted 7 lines
 board/evb_rk3036/evb_rk3036/evb_rk3036.c   |   30 +++++++++++++++++
 drivers/usb/gadget/Makefile                |    1 +
 drivers/usb/gadget/dwc2_udc_otg.c          |    4 +--
 drivers/usb/gadget/dwc2_udc_otg_regs.h     |    5 +++
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c |    2 +-
 drivers/usb/gadget/rk_otg_phy.c            |   48
Quoted 5 lines

++++++++++++++++++++++++++++
include/configs/rk3036_common.h | 20 ++++++++++++ 7
files changed, 107 insertions(+), 3 deletions(-) create mode 100644 drivers/usb/gadget/rk_otg_phy.c

Best regards,
Lukasz Majewski

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Signature · 2 lines
Best regards,
Marek Vasut
#10 lore raw

cover This series adds support for fastboot related to USB.

Hi Marek, Eddie,

Quoted 9 lines · Eddie Cai
Quoted 4 lines

Hi Lukasz

I guess you missed this mail thread. So send it again. Can you help to review this patch set?

Hi,

please rebase the series and repost. Keep me on CC

I'm currently out of office. I will review those patches ASAP when I will come back.

Quoted 41 lines
Quoted 41 lines

2016-01-18 14:24 GMT+08:00 Eddie Cai <[email protected]>:

Quoted 39 lines

Hi Lukasz

Have you back to office? Much appreciate if you can review Frank's patch.

Thanks
Eddie

2015-12-30 17:14 GMT+08:00 Lukasz Majewski <[email protected]>:

Quoted 30 lines

Hi Frank

Quoted 9 lines

[PATCH 1/3] Modified the check condition for max packet size of
ep_in in high speed

[PATCH 2/3] Fixed the error that the last packet transmission
could not be terminated

[PATCH 3/3] Add usb phy control to support fastboot for rk3036

Tested on RK3036 SDK board, it works Okay.

I'm out of office till the beginning of Jan 2016.

I will review and read your logs (with the max packet problem) when I come back.

Quoted 12 lines
 board/evb_rk3036/evb_rk3036/evb_rk3036.c   |   30
+++++++++++++++++ drivers/usb/gadget/Makefile
|    1 + drivers/usb/gadget/dwc2_udc_otg.c          |    4 +--
 drivers/usb/gadget/dwc2_udc_otg_regs.h     |    5 +++
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c |    2 +-
 drivers/usb/gadget/rk_otg_phy.c            |   48

++++++++++++++++++++++++++++
include/configs/rk3036_common.h | 20 ++++++++++++ 7
files changed, 107 insertions(+), 3 deletions(-) create mode 100644 drivers/usb/gadget/rk_otg_phy.c

Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Best regards,
Lukasz Majewski

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160608/558bbaf8/attachment.sig>