Skip to contentSkip to conversation

Make some changes to SDP

PATCH New sherry sun 5 participants 24 messages Jul 18, 2019 – Dec 12, 2019 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore

sherry sun

author
#0 lore raw

cover Make some changes to SDP

From: Sherry Sun <[email protected]>

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(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/4 imx: spl: Change USB boot device type

From: Sherry Sun <[email protected]>

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.

---
 arch/arm/mach-imx/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/spl.c +1 -1
index 9f1e0f6a72..2355019243 100644
@@ -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;
 	}
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/4 imx: spl: Change USB boot device type

Hi Sherry,

Quoted 16 lines

From: Sherry Sun <[email protected]>

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.

---
 arch/arm/mach-imx/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/spl.c +0 -0
index 9f1e0f6a72..2355019243 100644

arch/arm/mach-imx/spl.c u32 spl_boot_device(void) · line 159

Quoted 5 lines
arch/arm/mach-imx/spl.c +1 -1
@@ -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.

arch/arm/mach-imx/spl.c u32 spl_boot_device(void) · line 162

Quoted 3 lines
arch/arm/mach-imx/spl.c +0 -0
 	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 at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/c3a6df85/attachment.sig>

#3 lore raw

PATCH 1/4 imx: spl: Change USB boot device type

Hi Lukasz,

Quoted 15 lines

Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type

Hi Sherry,

Quoted 11 lines

From: Sherry Sun <[email protected]>

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.

---
 arch/arm/mach-imx/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

arch/arm/mach-imx/spl.c u32 spl_boot_device(void) · line 159

Quoted 10 lines
arch/arm/mach-imx/spl.c index renamed from arch/arm/mach-imx/spl.c +0 -0

9f1e0f6a72..2355019243 100644

arch/arm/mach-imx/spl.c +1 -1
@@ -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.

Quoted 21 lines

I've been using recently SDP (with uuu on imx6q) and I did not experience any issues.

arch/arm/mach-imx/spl.c u32 spl_boot_device(void) · line 162

Quoted 3 lines
arch/arm/mach-imx/spl.c +0 -0
 	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 at denx.de

#4 lore raw

PATCH 1/4 imx: spl: Change USB boot device type

Quoted 32 lines · On Thu, 18 Jul 2019 07:38:10 +0000 Peng Fan <[email protected]> wrote:

Hi Lukasz,

Quoted 15 lines

Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type

Hi Sherry,

Quoted 11 lines

From: Sherry Sun <[email protected]>

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.

---
 arch/arm/mach-imx/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

arch/arm/mach-imx/spl.c u32 spl_boot_device(void) · line 159

Quoted 10 lines
arch/arm/mach-imx/spl.c +1 -1
index 9f1e0f6a72..2355019243 100644
@@ -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).

Quoted 3 lines

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

Quoted 25 lines

Regards,
Peng.

Quoted 21 lines

I've been using recently SDP (with uuu on imx6q) and I did not experience any issues.

arch/arm/mach-imx/spl.c u32 spl_boot_device(void) · line 162

Quoted 3 lines
arch/arm/mach-imx/spl.c +0 -0
 	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 at 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 at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/54f0797a/attachment.sig>

#5 lore raw

PATCH 1/4 imx: spl: Change USB boot device type

Quoted 37 lines

Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type

Quoted 32 lines · On Thu, 18 Jul 2019 07:38:10 +0000 Peng Fan <[email protected]> wrote:

Hi Lukasz,

Quoted 29 lines

Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type

Hi Sherry,

Quoted 16 lines

From: Sherry Sun <[email protected]>

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.

---
 arch/arm/mach-imx/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/spl.c +0 -0
index 9f1e0f6a72..2355019243 100644

arch/arm/mach-imx/spl.c u32 spl_boot_device(void) · line 159

Quoted 5 lines
arch/arm/mach-imx/spl.c +1 -1
@@ -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).

Quoted 6 lines
Quoted 3 lines

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.

Quoted 43 lines

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

Quoted 25 lines

Regards,
Peng.

Quoted 21 lines

I've been using recently SDP (with uuu on imx6q) and I did not experience any issues.

arch/arm/mach-imx/spl.c u32 spl_boot_device(void) · line 162

Quoted 3 lines
arch/arm/mach-imx/spl.c +0 -0
 	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 at 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 at denx.de

#6 lore raw

PATCH 1/4 imx: spl: Change USB boot device type

Quoted 42 lines · On Thu, 18 Jul 2019 07:47:53 +0000 Peng Fan <[email protected]> wrote:
Quoted 42 lines

Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type

Quoted 36 lines · On Thu, 18 Jul 2019 07:38:10 +0000 Peng Fan <[email protected]> wrote:

Hi Lukasz,

Quoted 16 lines

Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type

Hi Sherry,

Quoted 12 lines

From: Sherry Sun <[email protected]>

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.

---
 arch/arm/mach-imx/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

arch/arm/mach-imx/spl.c u32 spl_boot_device(void) · line 159

Quoted 10 lines
arch/arm/mach-imx/spl.c +1 -1
index 9f1e0f6a72..2355019243 100644
@@ -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);

Quoted 6 lines
Quoted 2 lines

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.

Quoted 47 lines

Regards,
Peng.

Quoted 43 lines

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

Quoted 25 lines

Regards,
Peng.

Quoted 21 lines

I've been using recently SDP (with uuu on imx6q) and I did not experience any issues.

arch/arm/mach-imx/spl.c u32 spl_boot_device(void) · line 162

Quoted 3 lines
arch/arm/mach-imx/spl.c +0 -0
 	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 at 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 at 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 at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/f9507141/attachment.sig>

author
#7 lore raw

[U-Boot] 答复: [PATCH 1/4] imx: spl: Change USB boot device type

Hi, Lukasz

Quoted 53 lines
Quoted 42 lines · On Thu, 18 Jul 2019 07:47:53 +0000 Peng Fan <[email protected]> wrote:
Quoted 42 lines

Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type

Quoted 36 lines · On Thu, 18 Jul 2019 07:38:10 +0000 Peng Fan <[email protected]> wrote:

Hi Lukasz,

Quoted 16 lines

Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type

Hi Sherry,

Quoted 12 lines

From: Sherry Sun <[email protected]>

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.

---
 arch/arm/mach-imx/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

arch/arm/mach-imx/spl.c u32 spl_boot_device(void) · line 159

Quoted 10 lines
arch/arm/mach-imx/spl.c +1 -1
index 9f1e0f6a72..2355019243 100644
@@ -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);

Quoted 6 lines
Quoted 2 lines

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.

Quoted 7 lines

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.

Quoted 53 lines
Quoted 47 lines

Regards,
Peng.

Quoted 43 lines

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

Quoted 25 lines

Regards,
Peng.

Quoted 21 lines

I've been using recently SDP (with uuu on imx6q) and I did not experience any issues.

arch/arm/mach-imx/spl.c u32 spl_boot_device(void) · line 162

Quoted 3 lines
arch/arm/mach-imx/spl.c +0 -0
 	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 at 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 at denx.de

Best regards,

Quoted 8 lines

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 at denx.de

Best regards
Sherry sun

author
#8 lore raw

[U-Boot] 答复: [EXT] Re: [PATCH 1/4] imx: spl: Change USB boot device type

In reply to Lukasz Majewski

Hi, Lukasz

Quoted 40 lines
Quoted 32 lines · On Thu, 18 Jul 2019 07:38:10 +0000 Peng Fan <[email protected]> wrote:

Hi Lukasz,

Quoted 15 lines

Subject: Re: [PATCH 1/4] imx: spl: Change USB boot device type

Hi Sherry,

Quoted 11 lines

From: Sherry Sun <[email protected]>

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.

---
 arch/arm/mach-imx/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

arch/arm/mach-imx/spl.c u32 spl_boot_device(void) · line 159

Quoted 10 lines
arch/arm/mach-imx/spl.c +1 -1
index 9f1e0f6a72..2355019243 100644
@@ -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).

Quoted 3 lines

It is spl sdp need it. SPL_LOAD_IMAGE_METHOD("USB SDP", 0, BOOT_DEVICE_BOARD, spl_sdp_load_image);

Quoted 5 lines

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;

Quoted 32 lines
Quoted 26 lines

Regards,
Peng.

Quoted 21 lines

I've been using recently SDP (with uuu on imx6q) and I did not experience any issues.

arch/arm/mach-imx/spl.c u32 spl_boot_device(void) · line 162

Quoted 3 lines
arch/arm/mach-imx/spl.c +0 -0
 	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 at denx.de

Best regards,

Quoted 8 lines

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 at denx.de

Best regards
Sherry sun

author
#9 lore raw

PATCH 2/4 SDP: use CONFIG_SDP_LOADADDR as default load address

In reply to sherry sun

From: Sherry Sun <[email protected]>

If SDP_WRITE and SDP_JUMP command addr is zero, use CONFIG_SDP_LOADADDR as default address.

---
 drivers/usb/gadget/Kconfig | 4 ++++
 drivers/usb/gadget/f_sdp.c | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/usb/gadget/Kconfig +4 -0
index 26b4d12a09..172a82195b 100644
@@ -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
drivers/usb/gadget/f_sdp.c +4 -2
index fab7ce6f97..b1601575e0 100644
@@ -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;
Signature · 1 line
2.17.1
#10 lore raw

PATCH 2/4 SDP: use CONFIG_SDP_LOADADDR as default load address

Quoted 49 lines · On Thu, 18 Jul 2019 09:40:54 +0800 sherry sun <[email protected]> wrote:

From: Sherry Sun <[email protected]>

If SDP_WRITE and SDP_JUMP command addr is zero, use CONFIG_SDP_LOADADDR as default address.

---
 drivers/usb/gadget/Kconfig | 4 ++++
 drivers/usb/gadget/f_sdp.c | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/usb/gadget/Kconfig +4 -0
index 26b4d12a09..172a82195b 100644
@@ -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
drivers/usb/gadget/f_sdp.c +1 -1
index fab7ce6f97..b1601575e0 100644
@@ -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) :

drivers/usb/gadget/f_sdp.c +2 -1
+					       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) :

drivers/usb/gadget/f_sdp.c static void sdp_rx_command_complete(struct usb_ep *ep, struct usb_request *req) · line 311

Quoted 4 lines
drivers/usb/gadget/f_sdp.c +1 -0
+					       CONFIG_SDP_LOADADDR;
 		sdp->state = SDP_STATE_TX_SEC_CONF;
 		sdp->next_state = SDP_STATE_JUMP;
 		break;

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 at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/6dc5dfe9/attachment.sig>

author
#11 lore raw

PATCH 3/4 SDP: fix wrong usb request size and add high speed endpoint descriptor

In reply to sherry sun

From: Sherry Sun <[email protected]>

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.

---
 drivers/usb/gadget/f_sdp.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)
drivers/usb/gadget/f_sdp.c +30 -3
index b1601575e0..532041063a 100644
@@ -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 */
Signature · 1 line
2.17.1
#12 lore raw

PATCH 3/4 SDP: fix wrong usb request size and add high speed endpoint descriptor

Hi Sherry,

Quoted 3 lines

From: Sherry Sun <[email protected]>

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 ?

Quoted 26 lines

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.

---
 drivers/usb/gadget/f_sdp.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)
drivers/usb/gadget/f_sdp.c +3 -0
index b1601575e0..532041063a 100644
@@ -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*/ +

drivers/usb/gadget/f_sdp.c static struct usb_endpoint_descriptor in_desc = { · line 167

Quoted 4 lines
drivers/usb/gadget/f_sdp.c +4 -0
+	.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 ?

Quoted 71 lines
drivers/usb/gadget/f_sdp.c +11 -0
+};
+
 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 */

drivers/usb/gadget/f_sdp.c +1 -0
+		in_hs_desc.bEndpointAddress =

in_desc.bEndpointAddress;

drivers/usb/gadget/f_sdp.c +8 -2
+	}
+
 	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;
drivers/usb/gadget/f_sdp.c +1 -1
 	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 */

drivers/usb/gadget/f_sdp.c static void sdp_handle_in_ep(struct spl_image_info *spl_image) · line 756

Quoted 6 lines
drivers/usb/gadget/f_sdp.c +1 -0
 			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 at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/e15ff166/attachment.sig>

author
#13 lore raw

[U-Boot] 答复: [PATCH 3/4] SDP: fix wrong usb request size and add high speed endpoint descriptor

Hi, Lukasz

Quoted 12 lines

Hi Sherry,

Quoted 3 lines

From: Sherry Sun <[email protected]>

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.

Quoted 6 lines

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.

Quoted 22 lines
Quoted 22 lines

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.

---
 drivers/usb/gadget/f_sdp.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)
drivers/usb/gadget/f_sdp.c +0 -0
index b1601575e0..532041063a 100644
@@ -157,6 +157,16 @@ static struct usb_endpoint_descriptor in_desc = {
 	.bInterval =		1,
 };
 
Quoted 10 lines

drivers/usb/gadget/f_sdp.c static struct usb_endpoint_descriptor in_desc = { · line 167

Quoted 8 lines
drivers/usb/gadget/f_sdp.c +3 -0
+static struct usb_endpoint_descriptor in_hs_desc = {
+	.bLength =		USB_DT_ENDPOINT_SIZE,
+	.bDescriptorType =

USB_DT_ENDPOINT, /*USB_DT_CS_ENDPOINT*/ +

drivers/usb/gadget/f_sdp.c +4 -0
+	.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.

Quoted 82 lines
Quoted 70 lines
drivers/usb/gadget/f_sdp.c +2 -0
+};
+
 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, };

drivers/usb/gadget/f_sdp.c +7 -0
+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 = {

drivers/usb/gadget/f_sdp.c +2 -0
 	.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 */

drivers/usb/gadget/f_sdp.c +1 -0
+		in_hs_desc.bEndpointAddress =

in_desc.bEndpointAddress;

drivers/usb/gadget/f_sdp.c +8 -2
+	}
+
 	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));

drivers/usb/gadget/f_sdp.c +1 -1
 	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 */

drivers/usb/gadget/f_sdp.c static void sdp_handle_in_ep(struct spl_image_info *spl_image) · line 756

Quoted 6 lines
drivers/usb/gadget/f_sdp.c +1 -0
 			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,

Quoted 8 lines

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 at denx.de

Best regards
Sherry sun

author
#14 lore raw

PATCH 4/4 SDP: Call usb_gadget_initialize and usb_gadget_release to support UDC

In reply to sherry sun

From: Sherry Sun <[email protected]>

Need initialize UDC before run sdp download and release it at the end of sdp.

---
 common/spl/spl_sdp.c | 4 ++++
 1 file changed, 4 insertions(+)
common/spl/spl_sdp.c +4 -0
index 806bf1327e..7b0a213d4c 100644
@@ -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);
Signature · 1 line
2.17.1
#15 lore raw

PATCH 4/4 SDP: Call usb_gadget_initialize and usb_gadget_release to support UDC

Quoted 33 lines · On Thu, 18 Jul 2019 09:40:56 +0800 sherry sun <[email protected]> wrote:

From: Sherry Sun <[email protected]>

Need initialize UDC before run sdp download and release it at the end of sdp.

---
 common/spl/spl_sdp.c | 4 ++++
 1 file changed, 4 insertions(+)
common/spl/spl_sdp.c +4 -0
index 806bf1327e..7b0a213d4c 100644
@@ -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,
Quoted 1 line

spl_sdp_load_image);

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 at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/de8e0c4d/attachment.sig>

#16 lore raw

cover Make some changes to SDP

In reply to sherry sun

Hi Sherry,

Quoted 10 lines · sherry sun

From: Sherry Sun <[email protected]>

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.

Quoted 6 lines

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

Quoted 6 lines
 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(-)
author
#17 lore raw

Hi Angus

Quoted 21 lines

Hi Sherry,

Quoted 9 lines · sherry sun

From: Sherry Sun <[email protected]>

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.

Quoted 7 lines

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

Quoted 4 lines

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

Quoted 10 lines

Thanks
Angus

Quoted 7 lines
 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(-)
#18 lore raw

Hi Sherry,

Quoted 30 lines · Sherry Sun

Hi Angus

Quoted 21 lines

Hi Sherry,

Quoted 9 lines · sherry sun

From: Sherry Sun <[email protected]>

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.

Quoted 7 lines

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

Quoted 6 lines

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 ?

Quoted 5 lines

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

Quoted 13 lines

Best regards
Sherry sun

Quoted 10 lines

Thanks
Angus

Quoted 7 lines
 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(-)
#19 lore raw

Angus,

Quoted 39 lines

Subject: Re: 答复: [U-Boot] [PATCH 0/4] Make some changes to SDP

Hi Sherry,

Quoted 28 lines · Sherry Sun

Hi Angus

Quoted 21 lines

Hi Sherry,

Quoted 9 lines · sherry sun

From: Sherry Sun <[email protected]>

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.

Quoted 7 lines

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

Quoted 4 lines

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 ?

Quoted 5 lines

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.

Quoted 3 lines

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.

Quoted 17 lines

Thanks
Angus

Quoted 13 lines

Best regards
Sherry sun

Quoted 10 lines

Thanks
Angus

Quoted 7 lines
 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(-)
#20 lore raw

Hi Peng,

Quoted 47 lines · Peng Fan

Angus,

Quoted 39 lines

Subject: Re: 答复: [U-Boot] [PATCH 0/4] Make some changes to SDP

Hi Sherry,

Quoted 28 lines · Sherry Sun

Hi Angus

Quoted 21 lines

Hi Sherry,

Quoted 9 lines · sherry sun

From: Sherry Sun <[email protected]>

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.

Quoted 7 lines

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

Quoted 4 lines

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 ?

Quoted 5 lines

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.

Quoted 5 lines

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 ?

Quoted 4 lines

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

Quoted 20 lines

Regards,
Peng.

Quoted 17 lines

Thanks
Angus

Quoted 13 lines

Best regards
Sherry sun

Quoted 10 lines

Thanks
Angus

Quoted 7 lines
 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(-)
author
#21 lore raw

Hi Angus,

Sorry for the late reply.

Quoted 66 lines

-----邮件原件-----
发件人: Angus Ainslie <[email protected]>
发送时间: 2019年8月2日 10:30
收件人: Peng Fan <[email protected]>
抄送: Sherry Sun <[email protected]>; sbabic at denx.de; festevam at gmail.com; lukma at denx.de; marex at denx.de; u-boot at lists.denx.de; dl-uboot-imx <[email protected]> 主题: Re: 答复: [U-Boot] [PATCH 0/4] Make some changes to SDP

Hi Peng,

Quoted 41 lines · Peng Fan

Angus,

Quoted 39 lines

Subject: Re: 答复: [U-Boot] [PATCH 0/4] Make some changes to SDP

Hi Sherry,

Quoted 33 lines · Sherry Sun

Hi Angus

Quoted 21 lines

Hi Sherry,

Quoted 9 lines · sherry sun

From: Sherry Sun <[email protected]>

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.

Quoted 7 lines

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

Quoted 4 lines

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.

Quoted 7 lines
Quoted 3 lines

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&amp;data=02%7C01 %7Cs

Quoted 1 line

herry.sun%40nxp.com%7C6d63289fbb104168bce308d716f157c4%7C686ea1 d3bc2b4

Quoted 1 line
Quoted 9 lines

c6fa92cd99c5c301635%7C0%7C0%7C637003098143081621&amp;sdata=beh 08%2Fv3f

Quoted 3 lines

s8ZZPP29F1iVMfo3uNTWGf91SYYyak2GVU%3D&amp;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

Quoted 24 lines

Thanks
Angus

Quoted 21 lines

Regards,
Peng.

Quoted 18 lines

Thanks
Angus

Quoted 14 lines

Best regards
Sherry sun

Quoted 11 lines

Thanks
Angus

Quoted 8 lines
 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(-)

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#23 lore raw

Hi Angus,

Hi Sherry,

On Aug. 8, 2019 2:38 a.m., Sherry Sun <sherry.sun at nxp.com<mailto:[email protected]>> wrote:

Hi Angus,

Sorry for the late reply.

Quoted 66 lines

-----邮件原件-----
发件人: Angus Ainslie <angus at akkea.ca<mailto:[email protected]>>
发送时间: 2019年8月2日 10:30
收件人: Peng Fan <peng.fan at nxp.com<mailto:[email protected]>>
抄送: Sherry Sun <sherry.sun at nxp.com<mailto:[email protected]>>; sbabic at denx.de<mailto:[email protected]>; festevam at gmail.com<mailto:[email protected]>; lukma at denx.de<mailto:[email protected]>; marex at denx.de<mailto:[email protected]>; u-boot at lists.denx.de<mailto:[email protected]>; dl-uboot-imx <uboot-imx at nxp.com<mailto:[email protected]>> 主题: Re: 答复: [U-Boot] [PATCH 0/4] Make some changes to SDP

Hi Peng,

Quoted 41 lines · Peng Fan

Angus,

Quoted 39 lines

Subject: Re: 答复: [U-Boot] [PATCH 0/4] Make some changes to SDP

Hi Sherry,

Quoted 33 lines · Sherry Sun

Hi Angus

Quoted 21 lines

Hi Sherry,

Quoted 9 lines · sherry sun

From: Sherry Sun <sherry.sun at nxp.com<mailto:[email protected]>>

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.

Quoted 7 lines

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

Quoted 4 lines

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.

Quoted 7 lines
Quoted 3 lines

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&amp;data=02%7C01 %7Cs

Quoted 1 line

herry.sun%40nxp.com%7C6d63289fbb104168bce308d716f157c4%7C686ea1 d3bc2b4

Quoted 1 line
Quoted 9 lines

c6fa92cd99c5c301635%7C0%7C0%7C637003098143081621&amp;sdata=beh 08%2Fv3f

Quoted 3 lines

s8ZZPP29F1iVMfo3uNTWGf91SYYyak2GVU%3D&amp;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.

Quoted 3 lines

If I enable dwc3 gadget and DM for the SPL then I must start removing other SPL features to get it to fit in the 124k allocation.

It sounds like you haven't tested this on the imx8mq-evk then ?

Yes, I have not used imx8mq-evk yet. I will try to test it later.

Best regards
Sherry sun

Quoted 2 lines

Thanks
Angus

Best regards
Sherry sun

Quoted 24 lines

Thanks
Angus

Quoted 21 lines

Regards,
Peng.

Quoted 18 lines

Thanks
Angus

Quoted 14 lines

Best regards
Sherry sun

Quoted 11 lines

Thanks
Angus

Quoted 8 lines
 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(-)
reviewer
#24 lore raw

Hi Sherry,

Quoted 1 line · Sherry Sun

Yes, I have not used imx8mq-evk yet. I will try to test it later.

Have you managed to make any progress with regards to implementing UMS support on imx8mq-evk?

Thanks