[U-Boot] [PATCH 0/4] Make some changes to SDP

From: Sherry Sun sherry.sun@nxp.com
This patchset adds: 1. Add usb_gadget_initialize() and usb_gadget_release() to initialize and release UDC during sdp download. 2. Add high speed endpoint descriptor for sdp. 3. Add a macro definition--CONFIG_SDP_LOADADDR as default sdp load address while SDP_WRITE and SDP_JUMP command addr is zero.
Sherry Sun (4): imx: spl: Change USB boot device type SDP: use CONFIG_SDP_LOADADDR as default load address SDP: fix wrong usb request size and add high speed endpoint descriptor SDP: Call usb_gadget_initialize and usb_gadget_release to support UDC
arch/arm/mach-imx/spl.c | 2 +- common/spl/spl_sdp.c | 4 ++++ drivers/usb/gadget/Kconfig | 4 ++++ drivers/usb/gadget/f_sdp.c | 39 +++++++++++++++++++++++++++++++++----- 4 files changed, 43 insertions(+), 6 deletions(-)

From: Sherry Sun sherry.sun@nxp.com
The SPL SDP is configured as BOOT_DEVICE_BOARD, so when booting from USB, change its type to BOOT_DEVICE_BOARD, so we can use SDP.
Signed-off-by: Sherry Sun sherry.sun@nxp.com Signed-off-by: Ye Li ye.li@nxp.com --- arch/arm/mach-imx/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index 9f1e0f6a72..2355019243 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -156,7 +156,7 @@ u32 spl_boot_device(void) case SPI_NOR_BOOT: return BOOT_DEVICE_SPI; case USB_BOOT: - return BOOT_DEVICE_USB; + return BOOT_DEVICE_BOARD; default: return BOOT_DEVICE_NONE; }

Hi Sherry,
From: Sherry Sun sherry.sun@nxp.com
The SPL SDP is configured as BOOT_DEVICE_BOARD, so when booting from USB, change its type to BOOT_DEVICE_BOARD, so we can use SDP.
Signed-off-by: Sherry Sun sherry.sun@nxp.com Signed-off-by: Ye Li ye.li@nxp.com
arch/arm/mach-imx/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index 9f1e0f6a72..2355019243 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -156,7 +156,7 @@ u32 spl_boot_device(void) case SPI_NOR_BOOT: return BOOT_DEVICE_SPI; case USB_BOOT:
return BOOT_DEVICE_USB;
return BOOT_DEVICE_BOARD;
Why this change is required? What is the problem you are trying to solve here? (And it is always welcome if one write the detailed description of the problem in the commit message).
I've been using recently SDP (with uuu on imx6q) and I did not experience any issues.
default: return BOOT_DEVICE_NONE; }
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

Hi Lukasz,
Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type
Hi Sherry,
From: Sherry Sun sherry.sun@nxp.com
The SPL SDP is configured as BOOT_DEVICE_BOARD, so when booting from USB, change its type to BOOT_DEVICE_BOARD, so we can use SDP.
Signed-off-by: Sherry Sun sherry.sun@nxp.com Signed-off-by: Ye Li ye.li@nxp.com
arch/arm/mach-imx/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index 9f1e0f6a72..2355019243 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -156,7 +156,7 @@ u32 spl_boot_device(void) case SPI_NOR_BOOT: return BOOT_DEVICE_SPI; case USB_BOOT:
return BOOT_DEVICE_USB;
return BOOT_DEVICE_BOARD;
Why this change is required? What is the problem you are trying to solve here? (And it is always welcome if one write the detailed description of the problem in the commit message).
It is spl sdp need it. SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);
Regards, Peng.
I've been using recently SDP (with uuu on imx6q) and I did not experience any issues.
default: return BOOT_DEVICE_NONE; }
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

On Thu, 18 Jul 2019 07:38:10 +0000 Peng Fan peng.fan@nxp.com wrote:
Hi Lukasz,
Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type
Hi Sherry,
From: Sherry Sun sherry.sun@nxp.com
The SPL SDP is configured as BOOT_DEVICE_BOARD, so when booting from USB, change its type to BOOT_DEVICE_BOARD, so we can use SDP.
Signed-off-by: Sherry Sun sherry.sun@nxp.com Signed-off-by: Ye Li ye.li@nxp.com
arch/arm/mach-imx/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index 9f1e0f6a72..2355019243 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -156,7 +156,7 @@ u32 spl_boot_device(void) case SPI_NOR_BOOT: return BOOT_DEVICE_SPI; case USB_BOOT:
return BOOT_DEVICE_USB;
return BOOT_DEVICE_BOARD;
Why this change is required? What is the problem you are trying to solve here? (And it is always welcome if one write the detailed description of the problem in the commit message).
It is spl sdp need it. SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);
My point is why this error was not apparent earlier (or when I was using the uuu with newest u-boot)?
I'm just curious why let's say "average" uuu/SDP user did not encountered this problem (as I had also to recover SPL on my i.MX6 board).
Regards, Peng.
I've been using recently SDP (with uuu on imx6q) and I did not experience any issues.
default: return BOOT_DEVICE_NONE; }
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type
On Thu, 18 Jul 2019 07:38:10 +0000 Peng Fan peng.fan@nxp.com wrote:
Hi Lukasz,
Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type
Hi Sherry,
From: Sherry Sun sherry.sun@nxp.com
The SPL SDP is configured as BOOT_DEVICE_BOARD, so when booting from USB, change its type to BOOT_DEVICE_BOARD, so we can use SDP.
Signed-off-by: Sherry Sun sherry.sun@nxp.com Signed-off-by: Ye Li ye.li@nxp.com
arch/arm/mach-imx/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index 9f1e0f6a72..2355019243 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -156,7 +156,7 @@ u32 spl_boot_device(void) case SPI_NOR_BOOT: return BOOT_DEVICE_SPI; case USB_BOOT:
return BOOT_DEVICE_USB;
return BOOT_DEVICE_BOARD;
Why this change is required? What is the problem you are trying to solve here? (And it is always welcome if one write the detailed description of the problem in the commit message).
It is spl sdp need it. SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);
My point is why this error was not apparent earlier (or when I was using the uuu with newest u-boot)?
The patch changes the i.MX7/8/8M spl_boot_device, i.MX7 already have BOARD support. i.MX8/8M has not been verified SDP before, so this patch is to fix for i.MX8/8M SDP.
Regards, Peng.
I'm just curious why let's say "average" uuu/SDP user did not encountered this problem (as I had also to recover SPL on my i.MX6 board).
Regards, Peng.
I've been using recently SDP (with uuu on imx6q) and I did not experience any issues.
default: return BOOT_DEVICE_NONE; }
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

On Thu, 18 Jul 2019 07:47:53 +0000 Peng Fan peng.fan@nxp.com wrote:
Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type
On Thu, 18 Jul 2019 07:38:10 +0000 Peng Fan peng.fan@nxp.com wrote:
Hi Lukasz,
Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type
Hi Sherry,
From: Sherry Sun sherry.sun@nxp.com
The SPL SDP is configured as BOOT_DEVICE_BOARD, so when booting from USB, change its type to BOOT_DEVICE_BOARD, so we can use SDP.
Signed-off-by: Sherry Sun sherry.sun@nxp.com Signed-off-by: Ye Li ye.li@nxp.com
arch/arm/mach-imx/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index 9f1e0f6a72..2355019243 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -156,7 +156,7 @@ u32 spl_boot_device(void) case SPI_NOR_BOOT: return BOOT_DEVICE_SPI; case USB_BOOT:
return BOOT_DEVICE_USB;
return BOOT_DEVICE_BOARD;
Why this change is required? What is the problem you are trying to solve here? (And it is always welcome if one write the detailed description of the problem in the commit message).
It is spl sdp need it. SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);
My point is why this error was not apparent earlier (or when I was using the uuu with newest u-boot)?
The patch changes the i.MX7/8/8M spl_boot_device, i.MX7 already have BOARD support. i.MX8/8M has not been verified SDP before, so this patch is to fix for i.MX8/8M SDP.
I've looked into the source code and this fix is indeed for IMX7/8.
That was not apparent from either the code nor commit message.
Please prepare more detailed commit messages, so we would know much more from the patch without the need to see the relevant source code.
Regards, Peng.
I'm just curious why let's say "average" uuu/SDP user did not encountered this problem (as I had also to recover SPL on my i.MX6 board).
Regards, Peng.
I've been using recently SDP (with uuu on imx6q) and I did not experience any issues.
default: return BOOT_DEVICE_NONE; }
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

Hi, Lukasz
On Thu, 18 Jul 2019 07:47:53 +0000 Peng Fan peng.fan@nxp.com wrote:
Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type
On Thu, 18 Jul 2019 07:38:10 +0000 Peng Fan peng.fan@nxp.com wrote:
Hi Lukasz,
Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type
Hi Sherry,
From: Sherry Sun sherry.sun@nxp.com
The SPL SDP is configured as BOOT_DEVICE_BOARD, so when booting from USB, change its type to BOOT_DEVICE_BOARD, so we can use SDP.
Signed-off-by: Sherry Sun sherry.sun@nxp.com Signed-off-by: Ye Li ye.li@nxp.com
arch/arm/mach-imx/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index 9f1e0f6a72..2355019243 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -156,7 +156,7 @@ u32 spl_boot_device(void) case SPI_NOR_BOOT: return BOOT_DEVICE_SPI; case USB_BOOT:
return BOOT_DEVICE_USB;
return BOOT_DEVICE_BOARD;
Why this change is required? What is the problem you are trying to solve here? (And it is always welcome if one write the detailed description of the problem in the commit message).
It is spl sdp need it. SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);
My point is why this error was not apparent earlier (or when I was using the uuu with newest u-boot)?
The patch changes the i.MX7/8/8M spl_boot_device, i.MX7 already have BOARD support. i.MX8/8M has not been verified SDP before, so this patch is to fix for i.MX8/8M SDP.
I've looked into the source code and this fix is indeed for IMX7/8.
That was not apparent from either the code nor commit message.
Please prepare more detailed commit messages, so we would know much more from the patch without the need to see the relevant source code.
Okay, I will add more commit messages for this patch. Thanks for your comments.
Regards, Peng.
I'm just curious why let's say "average" uuu/SDP user did not encountered this problem (as I had also to recover SPL on my i.MX6 board).
Regards, Peng.
I've been using recently SDP (with uuu on imx6q) and I did not experience any issues.
default: return BOOT_DEVICE_NONE; }
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Best regards Sherry sun

Hi, Lukasz
On Thu, 18 Jul 2019 07:38:10 +0000 Peng Fan peng.fan@nxp.com wrote:
Hi Lukasz,
Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type
Hi Sherry,
From: Sherry Sun sherry.sun@nxp.com
The SPL SDP is configured as BOOT_DEVICE_BOARD, so when booting from USB, change its type to BOOT_DEVICE_BOARD, so we can use SDP.
Signed-off-by: Sherry Sun sherry.sun@nxp.com Signed-off-by: Ye Li ye.li@nxp.com
arch/arm/mach-imx/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index 9f1e0f6a72..2355019243 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -156,7 +156,7 @@ u32 spl_boot_device(void) case SPI_NOR_BOOT: return BOOT_DEVICE_SPI; case USB_BOOT:
return BOOT_DEVICE_USB;
return BOOT_DEVICE_BOARD;
Why this change is required? What is the problem you are trying to solve here? (And it is always welcome if one write the detailed description of the problem in the commit message).
It is spl sdp need it. SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);
My point is why this error was not apparent earlier (or when I was using the uuu with newest u-boot)?
I'm just curious why let's say "average" uuu/SDP user did not encountered this problem (as I had also to recover SPL on my i.MX6 board).
This change is only available on imx8 and imx8m platform.
For imx7, BOOT_DEVICE_BOARD has already been set at the beginning of u32 spl_boot_device(void). For imx6, BOOT_DEVICE_BOARD also has been set as below. 21#if defined(CONFIG_MX6) 22 /* determine boot device from SRC_SBMR1 (BOOT_CFG[4:1]) or SRC_GPR9 register */ 23 u32 spl_boot_device(void) 24 { 25 unsigned int bmode = readl(&src_base->sbmr2); 26 u32 reg = imx6_src_get_boot_mode(); 27 28 /* 29 * Check for BMODE if serial downloader is enabled 30 * BOOT_MODE - see IMX6DQRM Table 8-1 31 */ 32 if (((bmode >> 24) & 0x03) == 0x01) /* Serial Downloader */ 33 return BOOT_DEVICE_BOARD;
Regards, Peng.
I've been using recently SDP (with uuu on imx6q) and I did not experience any issues.
default: return BOOT_DEVICE_NONE; }
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Best regards Sherry sun

From: Sherry Sun sherry.sun@nxp.com
If SDP_WRITE and SDP_JUMP command addr is zero, use CONFIG_SDP_LOADADDR as default address.
Signed-off-by: Sherry Sun sherry.sun@nxp.com Signed-off-by: Frank Li Frank.Li@nxp.com --- drivers/usb/gadget/Kconfig | 4 ++++ drivers/usb/gadget/f_sdp.c | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 26b4d12a09..172a82195b 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -115,6 +115,10 @@ config USB_GADGET_VBUS_DRAW This value will be used except for system-specific gadget drivers that have more specific information.
+config SDP_LOADADDR + hex "Default load address at SDP_WRITE and SDP_JUMP" + default 0 + # Selected by UDC drivers that support high-speed operation. config USB_GADGET_DUALSPEED bool diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index fab7ce6f97..b1601575e0 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -275,7 +275,8 @@ static void sdp_rx_command_complete(struct usb_ep *ep, struct usb_request *req) sdp->error_status = SDP_WRITE_FILE_COMPLETE;
sdp->state = SDP_STATE_RX_FILE_DATA; - sdp->dnl_address = be32_to_cpu(cmd->addr); + sdp->dnl_address = cmd->addr ? be32_to_cpu(cmd->addr) : + CONFIG_SDP_LOADADDR; sdp->dnl_bytes_remaining = be32_to_cpu(cmd->cnt); sdp->dnl_bytes = sdp->dnl_bytes_remaining; sdp->next_state = SDP_STATE_IDLE; @@ -303,7 +304,8 @@ static void sdp_rx_command_complete(struct usb_ep *ep, struct usb_request *req) sdp->always_send_status = false; sdp->error_status = 0;
- sdp->jmp_address = be32_to_cpu(cmd->addr); + sdp->jmp_address = cmd->addr ? be32_to_cpu(cmd->addr) : + CONFIG_SDP_LOADADDR; sdp->state = SDP_STATE_TX_SEC_CONF; sdp->next_state = SDP_STATE_JUMP; break;

On Thu, 18 Jul 2019 09:40:54 +0800 sherry sun sherry.sun@nxp.com wrote:
From: Sherry Sun sherry.sun@nxp.com
If SDP_WRITE and SDP_JUMP command addr is zero, use CONFIG_SDP_LOADADDR as default address.
Signed-off-by: Sherry Sun sherry.sun@nxp.com Signed-off-by: Frank Li Frank.Li@nxp.com
drivers/usb/gadget/Kconfig | 4 ++++ drivers/usb/gadget/f_sdp.c | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 26b4d12a09..172a82195b 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -115,6 +115,10 @@ config USB_GADGET_VBUS_DRAW This value will be used except for system-specific gadget drivers that have more specific information.
+config SDP_LOADADDR
- hex "Default load address at SDP_WRITE and SDP_JUMP"
- default 0
# Selected by UDC drivers that support high-speed operation. config USB_GADGET_DUALSPEED bool diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index fab7ce6f97..b1601575e0 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -275,7 +275,8 @@ static void sdp_rx_command_complete(struct usb_ep *ep, struct usb_request *req) sdp->error_status = SDP_WRITE_FILE_COMPLETE; sdp->state = SDP_STATE_RX_FILE_DATA;
sdp->dnl_address = be32_to_cpu(cmd->addr);
sdp->dnl_address = cmd->addr ?
be32_to_cpu(cmd->addr) :
sdp->dnl_bytes_remaining = be32_to_cpu(cmd->cnt); sdp->dnl_bytes = sdp->dnl_bytes_remaining; sdp->next_state = SDP_STATE_IDLE;CONFIG_SDP_LOADADDR;
@@ -303,7 +304,8 @@ static void sdp_rx_command_complete(struct usb_ep *ep, struct usb_request *req) sdp->always_send_status = false; sdp->error_status = 0;
sdp->jmp_address = be32_to_cpu(cmd->addr);
sdp->jmp_address = cmd->addr ?
be32_to_cpu(cmd->addr) :
sdp->state = SDP_STATE_TX_SEC_CONF; sdp->next_state = SDP_STATE_JUMP; break;CONFIG_SDP_LOADADDR;
Reviewed-by: Lukasz Majewski lukma@denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

From: Sherry Sun sherry.sun@nxp.com
Because the buffer length of sdp usb request is 65, we have to allocate 65 bytes not 64 bytes. Otherwise there is potential buffer overflow.
So the wMaxPacketSize of fullspeed can't meet the needs. Add HS endpoint descriptor for SDP. Then we can use high speed endpoint, and the SDP device can send packet with 512 byte size.
Signed-off-by: Sherry Sun sherry.sun@nxp.com Signed-off-by: Ye Li ye.li@nxp.com --- drivers/usb/gadget/f_sdp.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index b1601575e0..532041063a 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -157,6 +157,16 @@ static struct usb_endpoint_descriptor in_desc = { .bInterval = 1, };
+static struct usb_endpoint_descriptor in_hs_desc = { + .bLength = USB_DT_ENDPOINT_SIZE, + .bDescriptorType = USB_DT_ENDPOINT, /*USB_DT_CS_ENDPOINT*/ + + .bEndpointAddress = 1 | USB_DIR_IN, + .bmAttributes = USB_ENDPOINT_XFER_INT, + .wMaxPacketSize = 512, + .bInterval = 1, +}; + static struct usb_descriptor_header *sdp_runtime_descs[] = { (struct usb_descriptor_header *)&sdp_intf_runtime, (struct usb_descriptor_header *)&sdp_hid_desc, @@ -164,6 +174,13 @@ static struct usb_descriptor_header *sdp_runtime_descs[] = { NULL, };
+static struct usb_descriptor_header *sdp_runtime_hs_descs[] = { + (struct usb_descriptor_header *)&sdp_intf_runtime, + (struct usb_descriptor_header *)&sdp_hid_desc, + (struct usb_descriptor_header *)&in_hs_desc, + NULL, +}; + /* This is synchronized with what the SoC implementation reports */ static struct hid_report sdp_hid_report = { .usage_page = { @@ -489,6 +506,11 @@ static int sdp_bind(struct usb_configuration *c, struct usb_function *f) goto error; }
+ if (gadget_is_dualspeed(gadget)) { + /* Assume endpoint addresses are the same for both speeds */ + in_hs_desc.bEndpointAddress = in_desc.bEndpointAddress; + } + sdp->in_ep = ep; /* Store IN EP for enabling @ setup */
cdev->req->context = sdp; @@ -526,7 +548,7 @@ static struct usb_request *sdp_start_ep(struct usb_ep *ep) { struct usb_request *req;
- req = alloc_ep_req(ep, 64); + req = alloc_ep_req(ep, 65); debug("%s: ep:%p req:%p\n", __func__, ep, req);
if (!req) @@ -541,11 +563,15 @@ static int sdp_set_alt(struct usb_function *f, unsigned intf, unsigned alt) { struct f_sdp *sdp = func_to_sdp(f); struct usb_composite_dev *cdev = f->config->cdev; + struct usb_gadget *gadget = cdev->gadget; int result;
debug("%s: intf: %d alt: %d\n", __func__, intf, alt);
- result = usb_ep_enable(sdp->in_ep, &in_desc); + if (gadget_is_dualspeed(gadget) && gadget->speed == USB_SPEED_HIGH) + result = usb_ep_enable(sdp->in_ep, &in_hs_desc); + else + result = usb_ep_enable(sdp->in_ep, &in_desc); if (result) return result; sdp->in_req = sdp_start_ep(sdp->in_ep); @@ -591,7 +617,7 @@ static int sdp_bind_config(struct usb_configuration *c) memset(sdp_func, 0, sizeof(*sdp_func));
sdp_func->usb_function.name = "sdp"; - sdp_func->usb_function.hs_descriptors = sdp_runtime_descs; + sdp_func->usb_function.hs_descriptors = sdp_runtime_hs_descs; sdp_func->usb_function.descriptors = sdp_runtime_descs; sdp_func->usb_function.bind = sdp_bind; sdp_func->usb_function.unbind = sdp_unbind; @@ -724,6 +750,7 @@ static void sdp_handle_in_ep(struct spl_image_info *spl_image) /* In SPL, allow jumps to U-Boot images */ struct spl_image_info spl_image = {}; spl_parse_image_header(&spl_image, header); + jump_to_image_no_args(&spl_image); #else /* In U-Boot, allow jumps to scripts */

Hi Sherry,
From: Sherry Sun sherry.sun@nxp.com
Because the buffer length of sdp usb request is 65,
Is the value 65 mentioned somewhere (in any doc/spec)?
As fair as I remember other protocols - like DFU use 64B. Do we need here to store extra \0 or \n ?
The 64 bytes are default packet size on EP0.
If I may ask - what user space program do you use? imx_loader (imx_usb) or uuu ?
we have to allocate 65 bytes not 64 bytes. Otherwise there is potential buffer overflow.
So the wMaxPacketSize of fullspeed can't meet the needs. Add HS endpoint descriptor for SDP. Then we can use high speed endpoint, and the SDP device can send packet with 512 byte size.
Signed-off-by: Sherry Sun sherry.sun@nxp.com Signed-off-by: Ye Li ye.li@nxp.com
drivers/usb/gadget/f_sdp.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index b1601575e0..532041063a 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -157,6 +157,16 @@ static struct usb_endpoint_descriptor in_desc = { .bInterval = 1, };
+static struct usb_endpoint_descriptor in_hs_desc = {
- .bLength = USB_DT_ENDPOINT_SIZE,
- .bDescriptorType =
USB_DT_ENDPOINT, /*USB_DT_CS_ENDPOINT*/ +
- .bEndpointAddress = 1 | USB_DIR_IN,
- .bmAttributes = USB_ENDPOINT_XFER_INT,
- .wMaxPacketSize = 512,
- .bInterval = 1,
Which endpoint do we use in SDP? EP0 or EP1...n ?
+};
static struct usb_descriptor_header *sdp_runtime_descs[] = { (struct usb_descriptor_header *)&sdp_intf_runtime, (struct usb_descriptor_header *)&sdp_hid_desc, @@ -164,6 +174,13 @@ static struct usb_descriptor_header *sdp_runtime_descs[] = { NULL, };
+static struct usb_descriptor_header *sdp_runtime_hs_descs[] = {
- (struct usb_descriptor_header *)&sdp_intf_runtime,
- (struct usb_descriptor_header *)&sdp_hid_desc,
- (struct usb_descriptor_header *)&in_hs_desc,
- NULL,
+};
/* This is synchronized with what the SoC implementation reports */ static struct hid_report sdp_hid_report = { .usage_page = { @@ -489,6 +506,11 @@ static int sdp_bind(struct usb_configuration *c, struct usb_function *f) goto error; }
- if (gadget_is_dualspeed(gadget)) {
/* Assume endpoint addresses are the same for both
speeds */
in_hs_desc.bEndpointAddress =
in_desc.bEndpointAddress;
}
sdp->in_ep = ep; /* Store IN EP for enabling @ setup */
cdev->req->context = sdp;
@@ -526,7 +548,7 @@ static struct usb_request *sdp_start_ep(struct usb_ep *ep) { struct usb_request *req;
- req = alloc_ep_req(ep, 64);
req = alloc_ep_req(ep, 65); debug("%s: ep:%p req:%p\n", __func__, ep, req);
if (!req)
@@ -541,11 +563,15 @@ static int sdp_set_alt(struct usb_function *f, unsigned intf, unsigned alt) { struct f_sdp *sdp = func_to_sdp(f); struct usb_composite_dev *cdev = f->config->cdev;
struct usb_gadget *gadget = cdev->gadget; int result;
debug("%s: intf: %d alt: %d\n", __func__, intf, alt);
- result = usb_ep_enable(sdp->in_ep, &in_desc);
- if (gadget_is_dualspeed(gadget) && gadget->speed ==
USB_SPEED_HIGH)
result = usb_ep_enable(sdp->in_ep, &in_hs_desc);
- else
if (result) return result; sdp->in_req = sdp_start_ep(sdp->in_ep);result = usb_ep_enable(sdp->in_ep, &in_desc);
@@ -591,7 +617,7 @@ static int sdp_bind_config(struct usb_configuration *c) memset(sdp_func, 0, sizeof(*sdp_func));
sdp_func->usb_function.name = "sdp";
- sdp_func->usb_function.hs_descriptors = sdp_runtime_descs;
- sdp_func->usb_function.hs_descriptors = sdp_runtime_hs_descs; sdp_func->usb_function.descriptors = sdp_runtime_descs; sdp_func->usb_function.bind = sdp_bind; sdp_func->usb_function.unbind = sdp_unbind;
@@ -724,6 +750,7 @@ static void sdp_handle_in_ep(struct spl_image_info *spl_image) /* In SPL, allow jumps to U-Boot images */ struct spl_image_info spl_image = {}; spl_parse_image_header(&spl_image, header);
jump_to_image_no_args(&spl_image);
#else /* In U-Boot, allow jumps to scripts */
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

Hi, Lukasz
Hi Sherry,
From: Sherry Sun sherry.sun@nxp.com
Because the buffer length of sdp usb request is 65,
Is the value 65 mentioned somewhere (in any doc/spec)?
As fair as I remember other protocols - like DFU use 64B. Do we need here to store extra \0 or \n ?
You can see case SDP_STATE_TX_STATUS and case SDP_STATE_TX_REGISTER in static void sdp_handle_in_ep(struct spl_image_info *spl_image) Here sdp_func->in_req->length = 65;
Data[0] is the report id, and the next 64 bytes are the date to host. So totally we need 65 bytes.
The 64 bytes are default packet size on EP0.
If I may ask - what user space program do you use? imx_loader (imx_usb) or uuu ?
Yes, I use uuu.
we have to allocate 65 bytes not 64 bytes. Otherwise there is potential buffer overflow.
So the wMaxPacketSize of fullspeed can't meet the needs. Add HS endpoint descriptor for SDP. Then we can use high speed endpoint, and the SDP device can send packet with 512 byte size.
Signed-off-by: Sherry Sun sherry.sun@nxp.com Signed-off-by: Ye Li ye.li@nxp.com
drivers/usb/gadget/f_sdp.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index b1601575e0..532041063a 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -157,6 +157,16 @@ static struct usb_endpoint_descriptor in_desc = { .bInterval = 1, };
+static struct usb_endpoint_descriptor in_hs_desc = {
- .bLength = USB_DT_ENDPOINT_SIZE,
- .bDescriptorType =
USB_DT_ENDPOINT, /*USB_DT_CS_ENDPOINT*/ +
- .bEndpointAddress = 1 | USB_DIR_IN,
- .bmAttributes = USB_ENDPOINT_XFER_INT,
- .wMaxPacketSize = 512,
- .bInterval = 1,
Which endpoint do we use in SDP? EP0 or EP1...n ?
We use EP0 to transfer datas from host to device in report 1 and report 2. And use EP1 to transfer datas from device to host in report3 and report 4.
+};
static struct usb_descriptor_header *sdp_runtime_descs[] = { (struct usb_descriptor_header *)&sdp_intf_runtime, (struct usb_descriptor_header *)&sdp_hid_desc, @@ -164,6 +174,13 @@ static struct usb_descriptor_header *sdp_runtime_descs[] = { NULL, };
+static struct usb_descriptor_header *sdp_runtime_hs_descs[] = {
- (struct usb_descriptor_header *)&sdp_intf_runtime,
- (struct usb_descriptor_header *)&sdp_hid_desc,
- (struct usb_descriptor_header *)&in_hs_desc,
- NULL,
+};
/* This is synchronized with what the SoC implementation reports */ static struct hid_report sdp_hid_report = { .usage_page = { @@ -489,6 +506,11 @@ static int sdp_bind(struct usb_configuration *c, struct usb_function *f) goto error; }
- if (gadget_is_dualspeed(gadget)) {
/* Assume endpoint addresses are the same for both
speeds */
in_hs_desc.bEndpointAddress =
in_desc.bEndpointAddress;
}
sdp->in_ep = ep; /* Store IN EP for enabling @ setup */
cdev->req->context = sdp;
@@ -526,7 +548,7 @@ static struct usb_request *sdp_start_ep(struct usb_ep *ep) { struct usb_request *req;
- req = alloc_ep_req(ep, 64);
req = alloc_ep_req(ep, 65); debug("%s: ep:%p req:%p\n", __func__, ep, req);
if (!req)
@@ -541,11 +563,15 @@ static int sdp_set_alt(struct usb_function *f, unsigned intf, unsigned alt) { struct f_sdp *sdp = func_to_sdp(f); struct usb_composite_dev *cdev = f->config->cdev;
struct usb_gadget *gadget = cdev->gadget; int result;
debug("%s: intf: %d alt: %d\n", __func__, intf, alt);
- result = usb_ep_enable(sdp->in_ep, &in_desc);
- if (gadget_is_dualspeed(gadget) && gadget->speed ==
USB_SPEED_HIGH)
result = usb_ep_enable(sdp->in_ep, &in_hs_desc);
- else
if (result) return result; sdp->in_req = sdp_start_ep(sdp->in_ep); @@ -591,7 +617,7 @@ staticresult = usb_ep_enable(sdp->in_ep, &in_desc);
int sdp_bind_config(struct usb_configuration *c) memset(sdp_func, 0, sizeof(*sdp_func));
sdp_func->usb_function.name = "sdp";
- sdp_func->usb_function.hs_descriptors = sdp_runtime_descs;
- sdp_func->usb_function.hs_descriptors = sdp_runtime_hs_descs; sdp_func->usb_function.descriptors = sdp_runtime_descs; sdp_func->usb_function.bind = sdp_bind; sdp_func->usb_function.unbind = sdp_unbind; @@ -724,6 +750,7 @@
static void sdp_handle_in_ep(struct spl_image_info *spl_image) /* In SPL, allow jumps to U-Boot images */ struct spl_image_info spl_image = {}; spl_parse_image_header(&spl_image, header);
jump_to_image_no_args(&spl_image);
#else /* In U-Boot, allow jumps to scripts */
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Best regards Sherry sun

From: Sherry Sun sherry.sun@nxp.com
Need initialize UDC before run sdp download and release it at the end of sdp.
Signed-off-by: Sherry Sun sherry.sun@nxp.com Signed-off-by: Frank Li Frank.Li@nxp.com --- common/spl/spl_sdp.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c index 806bf1327e..7b0a213d4c 100644 --- a/common/spl/spl_sdp.c +++ b/common/spl/spl_sdp.c @@ -16,6 +16,8 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image, int ret; const int controller_index = 0;
+ usb_gadget_initialize(controller_index); + g_dnl_clear_detach(); ret = g_dnl_register("usb_dnl_sdp"); if (ret) { @@ -37,6 +39,8 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image, ret = spl_sdp_handle(controller_index, spl_image); debug("SDP ended\n");
+ usb_gadget_release(controller_index); + return ret; } SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);

On Thu, 18 Jul 2019 09:40:56 +0800 sherry sun sherry.sun@nxp.com wrote:
From: Sherry Sun sherry.sun@nxp.com
Need initialize UDC before run sdp download and release it at the end of sdp.
Signed-off-by: Sherry Sun sherry.sun@nxp.com Signed-off-by: Frank Li Frank.Li@nxp.com
common/spl/spl_sdp.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c index 806bf1327e..7b0a213d4c 100644 --- a/common/spl/spl_sdp.c +++ b/common/spl/spl_sdp.c @@ -16,6 +16,8 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image, int ret; const int controller_index = 0;
- usb_gadget_initialize(controller_index);
- g_dnl_clear_detach(); ret = g_dnl_register("usb_dnl_sdp"); if (ret) {
@@ -37,6 +39,8 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image, ret = spl_sdp_handle(controller_index, spl_image); debug("SDP ended\n");
- usb_gadget_release(controller_index);
- return ret;
} SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);
Reviewed-by: Lukasz Majewski lukma@denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

Hi Sherry,
On 2019-07-17 18:40, sherry sun wrote:
From: Sherry Sun sherry.sun@nxp.com
This patchset adds:
- Add usb_gadget_initialize() and usb_gadget_release() to initialize
and release UDC during sdp download. 2. Add high speed endpoint descriptor for sdp. 3. Add a macro definition--CONFIG_SDP_LOADADDR as default sdp load address while SDP_WRITE and SDP_JUMP command addr is zero.
Sherry Sun (4): imx: spl: Change USB boot device type SDP: use CONFIG_SDP_LOADADDR as default load address SDP: fix wrong usb request size and add high speed endpoint descriptor SDP: Call usb_gadget_initialize and usb_gadget_release to support UDC
These changes look like like they target SDP on imx8. For imx8mq is this all that is required to get SDP working with uuu or are there additional changes required ?
Thanks Angus
arch/arm/mach-imx/spl.c | 2 +- common/spl/spl_sdp.c | 4 ++++ drivers/usb/gadget/Kconfig | 4 ++++ drivers/usb/gadget/f_sdp.c | 39 +++++++++++++++++++++++++++++++++----- 4 files changed, 43 insertions(+), 6 deletions(-)

Hi Angus
Hi Sherry,
On 2019-07-17 18:40, sherry sun wrote:
From: Sherry Sun sherry.sun@nxp.com
This patchset adds:
- Add usb_gadget_initialize() and usb_gadget_release() to initialize
and release UDC during sdp download. 2. Add high speed endpoint descriptor for sdp. 3. Add a macro definition--CONFIG_SDP_LOADADDR as default sdp load address while SDP_WRITE and SDP_JUMP command addr is zero.
Sherry Sun (4): imx: spl: Change USB boot device type SDP: use CONFIG_SDP_LOADADDR as default load address SDP: fix wrong usb request size and add high speed endpoint descriptor SDP: Call usb_gadget_initialize and usb_gadget_release to support UDC
These changes look like like they target SDP on imx8. For imx8mq is this all that is required to get SDP working with uuu or are there additional changes required ?
The changes in patch 1/4 are target on both imx8 and imx8m. The rest three patches are target on all boards which used SDP. So for imx8mq, if your usb gadget driver is ready ,these changes are enough to get SDP working with UUU.
Best regards Sherry sun
Thanks Angus
arch/arm/mach-imx/spl.c | 2 +- common/spl/spl_sdp.c | 4 ++++ drivers/usb/gadget/Kconfig | 4 ++++ drivers/usb/gadget/f_sdp.c | 39 +++++++++++++++++++++++++++++++++----- 4 files changed, 43 insertions(+), 6 deletions(-)

Hi Sherry,
On 2019-07-31 19:56, Sherry Sun wrote:
Hi Angus
Hi Sherry,
On 2019-07-17 18:40, sherry sun wrote:
From: Sherry Sun sherry.sun@nxp.com
This patchset adds:
- Add usb_gadget_initialize() and usb_gadget_release() to initialize
and release UDC during sdp download. 2. Add high speed endpoint descriptor for sdp. 3. Add a macro definition--CONFIG_SDP_LOADADDR as default sdp load address while SDP_WRITE and SDP_JUMP command addr is zero.
Sherry Sun (4): imx: spl: Change USB boot device type SDP: use CONFIG_SDP_LOADADDR as default load address SDP: fix wrong usb request size and add high speed endpoint descriptor SDP: Call usb_gadget_initialize and usb_gadget_release to support UDC
These changes look like like they target SDP on imx8. For imx8mq is this all that is required to get SDP working with uuu or are there additional changes required ?
The changes in patch 1/4 are target on both imx8 and imx8m. The rest three patches are target on all boards which used SDP. So for imx8mq, if your usb gadget driver is ready ,these changes are enough to get SDP working with UUU.
I'm trying to use SDP on the imx8mq-evk but it doesn't look like it's enabled there. Do you have patches to enable SDP on the imx8mq-evk , even if they aren't ready to go upstream ?
Thanks Angus
Best regards Sherry sun
Thanks Angus
arch/arm/mach-imx/spl.c | 2 +- common/spl/spl_sdp.c | 4 ++++ drivers/usb/gadget/Kconfig | 4 ++++ drivers/usb/gadget/f_sdp.c | 39 +++++++++++++++++++++++++++++++++----- 4 files changed, 43 insertions(+), 6 deletions(-)

Angus,
Subject: Re: 答复: [U-Boot] [PATCH 0/4] Make some changes to SDP
Hi Sherry,
On 2019-07-31 19:56, Sherry Sun wrote:
Hi Angus
Hi Sherry,
On 2019-07-17 18:40, sherry sun wrote:
From: Sherry Sun sherry.sun@nxp.com
This patchset adds:
- Add usb_gadget_initialize() and usb_gadget_release() to
initialize and release UDC during sdp download. 2. Add high speed endpoint descriptor for sdp. 3. Add a macro definition--CONFIG_SDP_LOADADDR as default sdp load address while SDP_WRITE and SDP_JUMP command addr is zero.
Sherry Sun (4): imx: spl: Change USB boot device type SDP: use CONFIG_SDP_LOADADDR as default load address SDP: fix wrong usb request size and add high speed endpoint descriptor SDP: Call usb_gadget_initialize and usb_gadget_release to support UDC
These changes look like like they target SDP on imx8. For imx8mq is this all that is required to get SDP working with uuu or are there additional changes required ?
The changes in patch 1/4 are target on both imx8 and imx8m. The rest three patches are target on all boards which used SDP. So for imx8mq, if your usb gadget driver is ready ,these changes are enough to get SDP working with UUU.
I'm trying to use SDP on the imx8mq-evk but it doesn't look like it's enabled there. Do you have patches to enable SDP on the imx8mq-evk , even if they aren't ready to go upstream ?
You could try downstream code, https://source.codeaurora.org/external/imx/uboot-imx/ branch: imx_v2019.04_4.19.35_1.0.0
Regards, Peng.
Thanks Angus
Best regards Sherry sun
Thanks Angus
arch/arm/mach-imx/spl.c | 2 +- common/spl/spl_sdp.c | 4 ++++ drivers/usb/gadget/Kconfig | 4 ++++ drivers/usb/gadget/f_sdp.c | 39 +++++++++++++++++++++++++++++++++----- 4 files changed, 43 insertions(+), 6 deletions(-)

Hi Peng,
On 2019-08-01 18:01, Peng Fan wrote:
Angus,
Subject: Re: 答复: [U-Boot] [PATCH 0/4] Make some changes to SDP
Hi Sherry,
On 2019-07-31 19:56, Sherry Sun wrote:
Hi Angus
Hi Sherry,
On 2019-07-17 18:40, sherry sun wrote:
From: Sherry Sun sherry.sun@nxp.com
This patchset adds:
- Add usb_gadget_initialize() and usb_gadget_release() to
initialize and release UDC during sdp download. 2. Add high speed endpoint descriptor for sdp. 3. Add a macro definition--CONFIG_SDP_LOADADDR as default sdp load address while SDP_WRITE and SDP_JUMP command addr is zero.
Sherry Sun (4): imx: spl: Change USB boot device type SDP: use CONFIG_SDP_LOADADDR as default load address SDP: fix wrong usb request size and add high speed endpoint descriptor SDP: Call usb_gadget_initialize and usb_gadget_release to support UDC
These changes look like like they target SDP on imx8. For imx8mq is this all that is required to get SDP working with uuu or are there additional changes required ?
The changes in patch 1/4 are target on both imx8 and imx8m. The rest three patches are target on all boards which used SDP. So for imx8mq, if your usb gadget driver is ready ,these changes are enough to get SDP working with UUU.
I'm trying to use SDP on the imx8mq-evk but it doesn't look like it's enabled there. Do you have patches to enable SDP on the imx8mq-evk , even if they aren't ready to go upstream ?
You could try downstream code, https://source.codeaurora.org/external/imx/uboot-imx/ branch: imx_v2019.04_4.19.35_1.0.0
I already have SDP working with the vendor u-boot. I'm trying to switch to mainline u-boot so I'm looking for mainline patches.
Thanks Angus
Regards, Peng.
Thanks Angus
Best regards Sherry sun
Thanks Angus
arch/arm/mach-imx/spl.c | 2 +- common/spl/spl_sdp.c | 4 ++++ drivers/usb/gadget/Kconfig | 4 ++++ drivers/usb/gadget/f_sdp.c | 39 +++++++++++++++++++++++++++++++++----- 4 files changed, 43 insertions(+), 6 deletions(-)

Hi Angus,
Sorry for the late reply.
-----邮件原件----- 发件人: Angus Ainslie angus@akkea.ca 发送时间: 2019年8月2日 10:30 收件人: Peng Fan peng.fan@nxp.com 抄送: Sherry Sun sherry.sun@nxp.com; sbabic@denx.de; festevam@gmail.com; lukma@denx.de; marex@denx.de; u-boot@lists.denx.de; dl-uboot-imx uboot-imx@nxp.com 主题: Re: 答复: [U-Boot] [PATCH 0/4] Make some changes to SDP
Hi Peng,
On 2019-08-01 18:01, Peng Fan wrote:
Angus,
Subject: Re: 答复: [U-Boot] [PATCH 0/4] Make some changes to SDP
Hi Sherry,
On 2019-07-31 19:56, Sherry Sun wrote:
Hi Angus
Hi Sherry,
On 2019-07-17 18:40, sherry sun wrote:
From: Sherry Sun sherry.sun@nxp.com
This patchset adds:
- Add usb_gadget_initialize() and usb_gadget_release() to
initialize and release UDC during sdp download. 2. Add high speed endpoint descriptor for sdp. 3. Add a macro definition--CONFIG_SDP_LOADADDR as default sdp load address while SDP_WRITE and SDP_JUMP command addr is zero.
Sherry Sun (4): imx: spl: Change USB boot device type SDP: use CONFIG_SDP_LOADADDR as default load address SDP: fix wrong usb request size and add high speed endpoint descriptor SDP: Call usb_gadget_initialize and usb_gadget_release to support UDC
These changes look like like they target SDP on imx8. For imx8mq is this all that is required to get SDP working with uuu or are there additional changes required ?
The changes in patch 1/4 are target on both imx8 and imx8m. The rest three patches are target on all boards which used SDP. So for imx8mq, if your usb gadget driver is ready ,these changes are enough to get SDP working with UUU.
I'm trying to use SDP on the imx8mq-evk but it doesn't look like it's enabled there. Do you have patches to enable SDP on the imx8mq-evk , even if they aren't ready to go upstream ?
You could try downstream code, https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsour
ce.codeaurora.org%2Fexternal%2Fimx%2Fuboot-imx%2F&data=02%7C01 %7Cs
herry.sun%40nxp.com%7C6d63289fbb104168bce308d716f157c4%7C686ea1 d3bc2b4
c6fa92cd99c5c301635%7C0%7C0%7C637003098143081621&sdata=beh 08%2Fv3f
s8ZZPP29F1iVMfo3uNTWGf91SYYyak2GVU%3D&reserved=0 branch: imx_v2019.04_4.19.35_1.0.0
I already have SDP working with the vendor u-boot. I'm trying to switch to mainline u-boot so I'm looking for mainline patches.
May I ask, is your usb gadget driver is working? Such as you can use it for fastboot or ums.
Best regards Sherry sun
Thanks Angus
Regards, Peng.
Thanks Angus
Best regards Sherry sun
Thanks Angus
arch/arm/mach-imx/spl.c | 2 +- common/spl/spl_sdp.c | 4 ++++ drivers/usb/gadget/Kconfig | 4 ++++ drivers/usb/gadget/f_sdp.c | 39 +++++++++++++++++++++++++++++++++----- 4 files changed, 43 insertions(+), 6 deletions(-)
participants (5)
-
Angus Ainslie
-
Lukasz Majewski
-
Peng Fan
-
Sherry Sun
-
sherry sun