U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] A series of patch for enable sc7180 android boot
@ 2025-06-07  5:24 George Chan via B4 Relay
  2025-06-07  5:24 ` [PATCH v2 1/5] image-android: Prepend/postpend default bootargs value with given bootcmd George Chan via B4 Relay
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: George Chan via B4 Relay @ 2025-06-07  5:24 UTC (permalink / raw)
  To: Tom Rini, Casey Connolly, Neil Armstrong, Sumit Garg, Simon Glass,
	Mattijs Korpershoek, Lukasz Majewski, Marek Vasut
  Cc: u-boot, u-boot-qcom, gchan9527, Vitalii Skorkin

Since attempt[1] to embed android specific boot param into fdt bootargs,
a new idea is formed as to make use of env file to contain default param
value. Current code logic is already working fine, unless the priority
of param at begining is higher than at tail. From env file, bootargs is
treated important, and prepend at begining. So there is a need to
reverse the logic, and make sure default bootargs value at the end, and
let androidboot img bootargs value sit at begining.

So a new kconfig item is introduced. Once enabled, the bootargs strcat
param will get reversed.

A similar logic is needed for fastboot->bootm glue function, so apply
same trick to glue function too.

Some one-liners patch is included to enable device driver for sc7180
soc. It is about iommu for usb, usb gadget vendor/product id.

Reduce dependency on abootimg when androidboot v3 or greater is not
needed. Since Tom suggested to reduce __maybe_unused directive and 
use IS_ENABLE() instead; two __weak func proto need to add into image.h

This series is independent, but modified boot/Kconfig that roughly same
location to another patch series[2], so directly apply both would fail.
Please let me know if maintainer wanna to let the one gets applied
first and rebase _OR_ combine two series as one.

[1]https://lists.denx.de/pipermail/u-boot/2025-May/588828.html
[2]https://lists.denx.de/pipermail/u-boot/2025-May/589926.html

Signed-off-by: George Chan <gchan9527@gmail.com>
---
Changes in v2:
- Add new patch #2 that is same trick as #1 to fastboot->bootm glue layer.
- Remove default n to patch #1, suggested by Tom.
- Use IS_ENABLE() instead, suggested by Tom.
- Collect review-by from Casey and Neil.
- Rebase to u-boot/next branch.
- CCing myself too.
- Link to v1: https://lore.kernel.org/r/20250520-sc7180-android-boot-v1-0-3075a84ea094@gmail.com

---
George Chan (5):
      image-android: Prepend/postpend default bootargs value with given bootcmd
      bootm: Append bootargs value when bootmeth_android provide cmdline
      boot: bootmeth_android: Conditionally dependent on abootimg
      iommu: qcom-smmu: Introduce sc7180 compatible string
      usb: gadget: Introduce usb gadget vendor/product default id for ARCH_QCOM

 boot/Kconfig                  |  7 +++++++
 boot/bootm.c                  | 29 ++++++++++++++++++++++++++++-
 boot/bootmeth_android.c       |  2 +-
 boot/image-android.c          | 10 ++++++++--
 drivers/iommu/qcom-hyp-smmu.c |  1 +
 drivers/usb/gadget/Kconfig    |  2 ++
 include/image.h               |  3 ++-
 7 files changed, 49 insertions(+), 5 deletions(-)
---
base-commit: a822b95da4b799bdc2a42c06923af4359238dc9e
change-id: 20250520-sc7180-android-boot-a845ecf48a48

Best regards,
-- 
George Chan <gchan9527@gmail.com>



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

* [PATCH v2 1/5] image-android: Prepend/postpend default bootargs value with given bootcmd
  2025-06-07  5:24 [PATCH v2 0/5] A series of patch for enable sc7180 android boot George Chan via B4 Relay
@ 2025-06-07  5:24 ` George Chan via B4 Relay
  2025-06-12  7:19   ` Mattijs Korpershoek
  2025-06-07  5:24 ` [PATCH v2 2/5] bootm: Append bootargs value when bootmeth_android provide cmdline George Chan via B4 Relay
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: George Chan via B4 Relay @ 2025-06-07  5:24 UTC (permalink / raw)
  To: Tom Rini, Casey Connolly, Neil Armstrong, Sumit Garg, Simon Glass,
	Mattijs Korpershoek, Lukasz Majewski, Marek Vasut
  Cc: u-boot, u-boot-qcom, gchan9527

From: George Chan <gchan9527@gmail.com>

Control how default bootargs is prepended or postpended to boot param found
from androidboot img.

Signed-off-by: George Chan <gchan9527@gmail.com>
---
 boot/Kconfig         |  7 +++++++
 boot/image-android.c | 10 ++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/boot/Kconfig b/boot/Kconfig
index 30eb5b328d7..7b71a340620 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -11,6 +11,13 @@ config ANDROID_BOOT_IMAGE
 	  This enables support for booting images which use the Android
 	  image format header.
 
+config ANDROID_BOOT_IMAGE_PREPEND_ENV_BOOTARGS
+	bool "Android Boot Image boot cmd param will prepend to env bootargs"
+	help
+	  This control how androidboot img with bootcmd param integrate with u-boot
+	  env bootargs. By enable this, androidboot boot param will prepend to
+	  head of bootargs env.
+
 config TIMESTAMP
 	bool "Show image date and time when displaying image information"
 	default y if CMD_DATE
diff --git a/boot/image-android.c b/boot/image-android.c
index 1746b018900..fbcd2682a5e 100644
--- a/boot/image-android.c
+++ b/boot/image-android.c
@@ -347,14 +347,14 @@ int android_image_get_kernel(const void *hdr,
 		len += strlen(img_data.kcmdline_extra) + (len ? 1 : 0); /* +1 for extra space */
 	}
 
-	char *newbootargs = malloc(len + 1); /* +1 for the '\0' */
+	char *newbootargs = malloc(len + 2); /* +2 for 2x '\0' */
 	if (!newbootargs) {
 		puts("Error: malloc in android_image_get_kernel failed!\n");
 		return -ENOMEM;
 	}
 	*newbootargs = '\0'; /* set to Null in case no components below are present */
 
-	if (bootargs)
+	if (bootargs && !IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE_PREPEND_ENV_BOOTARGS))
 		strcpy(newbootargs, bootargs);
 
 	if (img_data.kcmdline && *img_data.kcmdline) {
@@ -369,6 +369,12 @@ int android_image_get_kernel(const void *hdr,
 		strcat(newbootargs, img_data.kcmdline_extra);
 	}
 
+	if (bootargs && IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE_PREPEND_ENV_BOOTARGS)) {
+		if (*newbootargs) /* If there is something in newbootargs, a space is needed */
+			strcat(newbootargs, " ");
+		strcat(newbootargs, bootargs);
+	}
+
 	env_set("bootargs", newbootargs);
 	free(newbootargs);
 

-- 
2.43.0



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

* [PATCH v2 2/5] bootm: Append bootargs value when bootmeth_android provide cmdline
  2025-06-07  5:24 [PATCH v2 0/5] A series of patch for enable sc7180 android boot George Chan via B4 Relay
  2025-06-07  5:24 ` [PATCH v2 1/5] image-android: Prepend/postpend default bootargs value with given bootcmd George Chan via B4 Relay
@ 2025-06-07  5:24 ` George Chan via B4 Relay
  2025-06-07  5:24 ` [PATCH v2 3/5] boot: bootmeth_android: Conditionally dependent on abootimg George Chan via B4 Relay
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: George Chan via B4 Relay @ 2025-06-07  5:24 UTC (permalink / raw)
  To: Tom Rini, Casey Connolly, Neil Armstrong, Sumit Garg, Simon Glass,
	Mattijs Korpershoek, Lukasz Majewski, Marek Vasut
  Cc: u-boot, u-boot-qcom, gchan9527

From: George Chan <gchan9527@gmail.com>

Old logic wipe bootargs env with cmdline, new logic maintain the
value by prepending cmdline value to bootargs.

Signed-off-by: George Chan <gchan9527@gmail.com>
---
 boot/bootm.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/boot/bootm.c b/boot/bootm.c
index f6aa32746b7..888684a91f5 100644
--- a/boot/bootm.c
+++ b/boot/bootm.c
@@ -1152,11 +1152,38 @@ int bootm_boot_start(ulong addr, const char *cmdline)
 
 	snprintf(addr_str, sizeof(addr_str), "%lx", addr);
 
-	ret = env_set("bootargs", cmdline);
+	if (IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE_PREPEND_ENV_BOOTARGS)) {
+		char *bootargs;
+		char *newbootargs;
+		bootargs = env_get("bootargs");
+		ret = strlen(bootargs) + strlen(cmdline) + 2;
+
+		newbootargs = malloc(ret);
+
+		*newbootargs = '\0';
+
+		if (*newbootargs) /* If there is something in newbootargs, a space is needed */
+			strcat(newbootargs, " ");
+		strcat(newbootargs, cmdline);
+
+		if (*newbootargs) /* If there is something in newbootargs, a space is needed */
+			strcat(newbootargs, " ");
+		strcat(newbootargs, bootargs);
+
+		/* force to terminate the string */
+		memset(newbootargs + MAX_CMDLINE_SIZE - 2, '\0', 1);
+
+		ret = env_set("bootargs", newbootargs);
+
+		free(newbootargs);
+	} else
+		ret = env_set("bootargs", cmdline);
+
 	if (ret) {
 		printf("Failed to set cmdline\n");
 		return ret;
 	}
+
 	bootm_init(&bmi);
 	bmi.addr_img = addr_str;
 	bmi.cmd_name = "bootm";

-- 
2.43.0



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

* [PATCH v2 3/5] boot: bootmeth_android: Conditionally dependent on abootimg
  2025-06-07  5:24 [PATCH v2 0/5] A series of patch for enable sc7180 android boot George Chan via B4 Relay
  2025-06-07  5:24 ` [PATCH v2 1/5] image-android: Prepend/postpend default bootargs value with given bootcmd George Chan via B4 Relay
  2025-06-07  5:24 ` [PATCH v2 2/5] bootm: Append bootargs value when bootmeth_android provide cmdline George Chan via B4 Relay
@ 2025-06-07  5:24 ` George Chan via B4 Relay
  2025-06-12  7:35   ` Mattijs Korpershoek
  2025-06-07  5:24 ` [PATCH v2 4/5] iommu: qcom-smmu: Introduce sc7180 compatible string George Chan via B4 Relay
  2025-06-07  5:25 ` [PATCH v2 5/5] usb: gadget: Introduce usb gadget vendor/product default id for ARCH_QCOM George Chan via B4 Relay
  4 siblings, 1 reply; 9+ messages in thread
From: George Chan via B4 Relay @ 2025-06-07  5:24 UTC (permalink / raw)
  To: Tom Rini, Casey Connolly, Neil Armstrong, Sumit Garg, Simon Glass,
	Mattijs Korpershoek, Lukasz Majewski, Marek Vasut
  Cc: u-boot, u-boot-qcom, gchan9527

From: George Chan <gchan9527@gmail.com>

If target u-boot img do not support androidboot v3 or greater,
abootimg might not be necessary.

aarch64-linux-gnu-ld.bfd: boot/bootmeth_android.o: in function `boot_android_normal':
/home/user/sources/u-boot-next/boot/bootmeth_android.c:541:(.text.boot_android_normal+0xd0): undefined reference to `set_avendor_bootimg_addr'
aarch64-linux-gnu-ld.bfd: /home/user/sources/u-boot-next/boot/bootmeth_android.c:543:(.text.boot_android_normal+0xd8): undefined reference to `set_abootimg_addr'
Segmentation fault (core dumped)

Signed-off-by: George Chan <gchan9527@gmail.com>
---
 boot/bootmeth_android.c | 2 +-
 include/image.h         | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/boot/bootmeth_android.c b/boot/bootmeth_android.c
index 8c2bde10e17..d7740b86d67 100644
--- a/boot/bootmeth_android.c
+++ b/boot/bootmeth_android.c
@@ -534,7 +534,7 @@ static int boot_android_normal(struct bootflow *bflow)
 	if (ret < 0)
 		return log_msg_ret("read boot", ret);
 
-	if (priv->header_version >= 3) {
+	if (IS_ENABLED(CONFIG_CMD_ABOOTIMG) && priv->header_version >= 3) {
 		ret = read_slotted_partition(desc, "vendor_boot", priv->slot,
 					     priv->vendor_boot_img_size, vloadaddr);
 		if (ret < 0)
diff --git a/include/image.h b/include/image.h
index 1e1bded690b..2c03dde768d 100644
--- a/include/image.h
+++ b/include/image.h
@@ -2038,7 +2038,7 @@ ulong get_abootimg_addr(void);
  * Return: no returned results
  */
 void set_abootimg_addr(ulong addr);
-
+void __weak set_abootimg_addr(ulong addr) {}
 /**
  * get_ainit_bootimg_addr() - Get Android init boot image address
  *
@@ -2059,6 +2059,7 @@ ulong get_avendor_bootimg_addr(void);
  * Return: no returned results
  */
 void set_avendor_bootimg_addr(ulong addr);
+void __weak set_avendor_bootimg_addr(ulong addr) {}
 
 /**
  * board_fit_config_name_match() - Check for a matching board name

-- 
2.43.0



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

* [PATCH v2 4/5] iommu: qcom-smmu: Introduce sc7180 compatible string
  2025-06-07  5:24 [PATCH v2 0/5] A series of patch for enable sc7180 android boot George Chan via B4 Relay
                   ` (2 preceding siblings ...)
  2025-06-07  5:24 ` [PATCH v2 3/5] boot: bootmeth_android: Conditionally dependent on abootimg George Chan via B4 Relay
@ 2025-06-07  5:24 ` George Chan via B4 Relay
  2025-06-07  5:25 ` [PATCH v2 5/5] usb: gadget: Introduce usb gadget vendor/product default id for ARCH_QCOM George Chan via B4 Relay
  4 siblings, 0 replies; 9+ messages in thread
From: George Chan via B4 Relay @ 2025-06-07  5:24 UTC (permalink / raw)
  To: Tom Rini, Casey Connolly, Neil Armstrong, Sumit Garg, Simon Glass,
	Mattijs Korpershoek, Lukasz Majewski, Marek Vasut
  Cc: u-boot, u-boot-qcom, gchan9527, Vitalii Skorkin

From: George Chan <gchan9527@gmail.com>

Add basic compatible string for sc7180 family soc.

Signed-off-by: Vitalii Skorkin <nikroks@mainlining.org>
Co-developed-by: George Chan <gchan9527@gmail.com>
Signed-off-by: George Chan <gchan9527@gmail.com>
Reviewed-by: Casey Connolly <casey.connolly@linaro.org>
---
 drivers/iommu/qcom-hyp-smmu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iommu/qcom-hyp-smmu.c b/drivers/iommu/qcom-hyp-smmu.c
index c1b95bc8b8c..2a356613a26 100644
--- a/drivers/iommu/qcom-hyp-smmu.c
+++ b/drivers/iommu/qcom-hyp-smmu.c
@@ -388,6 +388,7 @@ static struct iommu_ops qcom_smmu_ops = {
 
 static const struct udevice_id qcom_smmu500_ids[] = {
 	{ .compatible = "qcom,sdm845-smmu-500" },
+	{ .compatible = "qcom,sc7180-smmu-500" },
 	{ .compatible = "qcom,sc7280-smmu-500" },
 	{ .compatible = "qcom,smmu-500", },
 	{ /* sentinel */ }

-- 
2.43.0



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

* [PATCH v2 5/5] usb: gadget: Introduce usb gadget vendor/product default id for ARCH_QCOM
  2025-06-07  5:24 [PATCH v2 0/5] A series of patch for enable sc7180 android boot George Chan via B4 Relay
                   ` (3 preceding siblings ...)
  2025-06-07  5:24 ` [PATCH v2 4/5] iommu: qcom-smmu: Introduce sc7180 compatible string George Chan via B4 Relay
@ 2025-06-07  5:25 ` George Chan via B4 Relay
  2025-06-12  7:24   ` Mattijs Korpershoek
  4 siblings, 1 reply; 9+ messages in thread
From: George Chan via B4 Relay @ 2025-06-07  5:25 UTC (permalink / raw)
  To: Tom Rini, Casey Connolly, Neil Armstrong, Sumit Garg, Simon Glass,
	Mattijs Korpershoek, Lukasz Majewski, Marek Vasut
  Cc: u-boot, u-boot-qcom, gchan9527

From: George Chan <gchan9527@gmail.com>

Currently vendor/product id are both 0, and that might not as we want.
Set to some arbitary known value that we can make it work more smoothly.

Signed-off-by: George Chan <gchan9527@gmail.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
---
 drivers/usb/gadget/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 46a83141481..2a56e360b5f 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -60,6 +60,7 @@ config USB_GADGET_VENDOR_NUM
 	default 0x0955 if ARCH_TEGRA
 	default 0x1f3a if ARCH_SUNXI
 	default 0x2207 if ARCH_ROCKCHIP
+	default 0x18d1 if ARCH_QCOM
 	default 0x0
 	help
 	  Vendor ID of the USB device emulated, reported to the host device.
@@ -86,6 +87,7 @@ config USB_GADGET_PRODUCT_NUM
 	default 0x350a if ROCKCHIP_RK3568
 	default 0x350b if ROCKCHIP_RK3588
 	default 0x350c if ROCKCHIP_RK3528
+	default 0x4ee0 if ARCH_QCOM
 	default 0x0
 	help
 	  Product ID of the USB device emulated, reported to the host device.

-- 
2.43.0



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

* Re: [PATCH v2 1/5] image-android: Prepend/postpend default bootargs value with given bootcmd
  2025-06-07  5:24 ` [PATCH v2 1/5] image-android: Prepend/postpend default bootargs value with given bootcmd George Chan via B4 Relay
@ 2025-06-12  7:19   ` Mattijs Korpershoek
  0 siblings, 0 replies; 9+ messages in thread
From: Mattijs Korpershoek @ 2025-06-12  7:19 UTC (permalink / raw)
  To: George Chan via B4 Relay, Tom Rini, Casey Connolly,
	Neil Armstrong, Sumit Garg, Simon Glass, Mattijs Korpershoek,
	Lukasz Majewski, Marek Vasut
  Cc: u-boot, u-boot-qcom, gchan9527

Hi George,

Thank you for the patch.

I have a couple of small remarks on wording/spelling but the code
change looks good already.

On Sat, Jun 07, 2025 at 13:24, George Chan via B4 Relay <devnull+gchan9527.gmail.com@kernel.org> wrote:

> From: George Chan <gchan9527@gmail.com>
>
> Control how default bootargs is prepended or postpended to boot param found
> from androidboot img.

Let's rephrase to be slightly more accurate, and add a problem statement
first:

By default, the boot.img's cmdline are appended to the bootargs
environment.
If we take a cmdline example of:
* androidboot.hardware=warm (in U-Boot environment)
* androidboot.hardware=chilly (in boot.img's cmdline)

The resulting commandline will be:
androidboot.hardware=warm [...] androidboot.hardware=chilly.

Because of this, the U-Boot environment always take priority on the
boot.img.

If we want to have a single U-Boot binary that support multiple
board variants, we can't override androidboot.hardware via the boot.img.

Add a new Kconfig option, ANDROID_BOOT_IMAGE_PREPEND_ENV_BOOTARGS that
reverse the logic.

with ANDROID_BOOT_IMAGE_PREPEND_ENV_BOOTARGS=y, the resulting
commandline would be:
androidboot.hardware=chilly [...] androidboot.hardware=warm.

(feel free to rephrase some parts to your liking)

>
> Signed-off-by: George Chan <gchan9527@gmail.com>
> ---
>  boot/Kconfig         |  7 +++++++
>  boot/image-android.c | 10 ++++++++--
>  2 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/boot/Kconfig b/boot/Kconfig
> index 30eb5b328d7..7b71a340620 100644
> --- a/boot/Kconfig
> +++ b/boot/Kconfig
> @@ -11,6 +11,13 @@ config ANDROID_BOOT_IMAGE
>  	  This enables support for booting images which use the Android
>  	  image format header.
>  
> +config ANDROID_BOOT_IMAGE_PREPEND_ENV_BOOTARGS
> +	bool "Android Boot Image boot cmd param will prepend to env bootargs"
> +	help
> +	  This control how androidboot img with bootcmd param integrate with u-boot

Please, no abbreviations and some minor spelling tweaks:

This controls how Android boot image embedded cmdline integrates
with U-Boot bootargs environment.

By enabling this, the boot.img's cmdline is prepended to the bootargs
environment. By default, when disabled, the cmdline is appended.

(Note: We use cmdline here since that's the terminology used by
Android's mkbootimg tool [1])

[1] https://android.googlesource.com/platform/system/tools/mkbootimg/+/refs/heads/main/mkbootimg.py#511

With the wording fixed, please add

Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>

Also, Casey, feel free to pick of the reworded version through your tree !

> +	  env bootargs. By enable this, androidboot boot param will prepend to
> +	  head of bootargs env.
> +
>  config TIMESTAMP
>  	bool "Show image date and time when displaying image information"
>  	default y if CMD_DATE
> diff --git a/boot/image-android.c b/boot/image-android.c
> index 1746b018900..fbcd2682a5e 100644
> --- a/boot/image-android.c
> +++ b/boot/image-android.c
> @@ -347,14 +347,14 @@ int android_image_get_kernel(const void *hdr,
>  		len += strlen(img_data.kcmdline_extra) + (len ? 1 : 0); /* +1 for extra space */
>  	}
>  
> -	char *newbootargs = malloc(len + 1); /* +1 for the '\0' */
> +	char *newbootargs = malloc(len + 2); /* +2 for 2x '\0' */
>  	if (!newbootargs) {
>  		puts("Error: malloc in android_image_get_kernel failed!\n");
>  		return -ENOMEM;
>  	}
>  	*newbootargs = '\0'; /* set to Null in case no components below are present */
>  
> -	if (bootargs)
> +	if (bootargs && !IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE_PREPEND_ENV_BOOTARGS))
>  		strcpy(newbootargs, bootargs);
>  
>  	if (img_data.kcmdline && *img_data.kcmdline) {
> @@ -369,6 +369,12 @@ int android_image_get_kernel(const void *hdr,
>  		strcat(newbootargs, img_data.kcmdline_extra);
>  	}
>  
> +	if (bootargs && IS_ENABLED(CONFIG_ANDROID_BOOT_IMAGE_PREPEND_ENV_BOOTARGS)) {
> +		if (*newbootargs) /* If there is something in newbootargs, a space is needed */
> +			strcat(newbootargs, " ");
> +		strcat(newbootargs, bootargs);
> +	}
> +
>  	env_set("bootargs", newbootargs);
>  	free(newbootargs);
>  
>
> -- 
> 2.43.0

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

* Re: [PATCH v2 5/5] usb: gadget: Introduce usb gadget vendor/product default id for ARCH_QCOM
  2025-06-07  5:25 ` [PATCH v2 5/5] usb: gadget: Introduce usb gadget vendor/product default id for ARCH_QCOM George Chan via B4 Relay
@ 2025-06-12  7:24   ` Mattijs Korpershoek
  0 siblings, 0 replies; 9+ messages in thread
From: Mattijs Korpershoek @ 2025-06-12  7:24 UTC (permalink / raw)
  To: George Chan via B4 Relay, Tom Rini, Casey Connolly,
	Neil Armstrong, Sumit Garg, Simon Glass, Mattijs Korpershoek,
	Lukasz Majewski, Marek Vasut
  Cc: u-boot, u-boot-qcom, gchan9527

Hi George,

Thank you for the patch.

On Sat, Jun 07, 2025 at 13:25, George Chan via B4 Relay <devnull+gchan9527.gmail.com@kernel.org> wrote:

> From: George Chan <gchan9527@gmail.com>
>
> Currently vendor/product id are both 0, and that might not as we want.
> Set to some arbitary known value that we can make it work more smoothly.
>
> Signed-off-by: George Chan <gchan9527@gmail.com>
> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>

Acked-by: Mattijs Korpershoek <mkorpershoek@kernel.org>

Casey, even if this is usb gadget, feel free to pick this up in your
tree.

Thanks,
Mattijs


> ---
>  drivers/usb/gadget/Kconfig | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
> index 46a83141481..2a56e360b5f 100644
> --- a/drivers/usb/gadget/Kconfig
> +++ b/drivers/usb/gadget/Kconfig
> @@ -60,6 +60,7 @@ config USB_GADGET_VENDOR_NUM
>  	default 0x0955 if ARCH_TEGRA
>  	default 0x1f3a if ARCH_SUNXI
>  	default 0x2207 if ARCH_ROCKCHIP
> +	default 0x18d1 if ARCH_QCOM
>  	default 0x0
>  	help
>  	  Vendor ID of the USB device emulated, reported to the host device.
> @@ -86,6 +87,7 @@ config USB_GADGET_PRODUCT_NUM
>  	default 0x350a if ROCKCHIP_RK3568
>  	default 0x350b if ROCKCHIP_RK3588
>  	default 0x350c if ROCKCHIP_RK3528
> +	default 0x4ee0 if ARCH_QCOM
>  	default 0x0
>  	help
>  	  Product ID of the USB device emulated, reported to the host device.
>
> -- 
> 2.43.0

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

* Re: [PATCH v2 3/5] boot: bootmeth_android: Conditionally dependent on abootimg
  2025-06-07  5:24 ` [PATCH v2 3/5] boot: bootmeth_android: Conditionally dependent on abootimg George Chan via B4 Relay
@ 2025-06-12  7:35   ` Mattijs Korpershoek
  0 siblings, 0 replies; 9+ messages in thread
From: Mattijs Korpershoek @ 2025-06-12  7:35 UTC (permalink / raw)
  To: George Chan via B4 Relay, Tom Rini, Casey Connolly,
	Neil Armstrong, Sumit Garg, Simon Glass, Mattijs Korpershoek,
	Lukasz Majewski, Marek Vasut
  Cc: u-boot, u-boot-qcom, gchan9527

Hi George,

Thank you for the patch.

On Sat, Jun 07, 2025 at 13:24, George Chan via B4 Relay <devnull+gchan9527.gmail.com@kernel.org> wrote:

> From: George Chan <gchan9527@gmail.com>
>
> If target u-boot img do not support androidboot v3 or greater,
> abootimg might not be necessary.

Indeed, and this is already handled properly in ./boot/bootm.c and
./boot/image-board.c.

>
> aarch64-linux-gnu-ld.bfd: boot/bootmeth_android.o: in function `boot_android_normal':
> /home/user/sources/u-boot-next/boot/bootmeth_android.c:541:(.text.boot_android_normal+0xd0): undefined reference to `set_avendor_bootimg_addr'
> aarch64-linux-gnu-ld.bfd: /home/user/sources/u-boot-next/boot/bootmeth_android.c:543:(.text.boot_android_normal+0xd8): undefined reference to `set_abootimg_addr'
> Segmentation fault (core dumped)
>
> Signed-off-by: George Chan <gchan9527@gmail.com>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>

Acked-by: Mattijs Korpershoek <mkorpershoek@kernel.org>

Casey, feel free to pick this up through your tree.

> ---
>  boot/bootmeth_android.c | 2 +-
>  include/image.h         | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/boot/bootmeth_android.c b/boot/bootmeth_android.c
> index 8c2bde10e17..d7740b86d67 100644
> --- a/boot/bootmeth_android.c
> +++ b/boot/bootmeth_android.c
> @@ -534,7 +534,7 @@ static int boot_android_normal(struct bootflow *bflow)
>  	if (ret < 0)
>  		return log_msg_ret("read boot", ret);
>  
> -	if (priv->header_version >= 3) {
> +	if (IS_ENABLED(CONFIG_CMD_ABOOTIMG) && priv->header_version >= 3) {
>  		ret = read_slotted_partition(desc, "vendor_boot", priv->slot,
>  					     priv->vendor_boot_img_size, vloadaddr);
>  		if (ret < 0)
> diff --git a/include/image.h b/include/image.h
> index 1e1bded690b..2c03dde768d 100644
> --- a/include/image.h
> +++ b/include/image.h
> @@ -2038,7 +2038,7 @@ ulong get_abootimg_addr(void);
>   * Return: no returned results
>   */
>  void set_abootimg_addr(ulong addr);
> -
> +void __weak set_abootimg_addr(ulong addr) {}
>  /**
>   * get_ainit_bootimg_addr() - Get Android init boot image address
>   *
> @@ -2059,6 +2059,7 @@ ulong get_avendor_bootimg_addr(void);
>   * Return: no returned results
>   */
>  void set_avendor_bootimg_addr(ulong addr);
> +void __weak set_avendor_bootimg_addr(ulong addr) {}
>  
>  /**
>   * board_fit_config_name_match() - Check for a matching board name
>
> -- 
> 2.43.0

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

end of thread, other threads:[~2025-06-12  7:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-07  5:24 [PATCH v2 0/5] A series of patch for enable sc7180 android boot George Chan via B4 Relay
2025-06-07  5:24 ` [PATCH v2 1/5] image-android: Prepend/postpend default bootargs value with given bootcmd George Chan via B4 Relay
2025-06-12  7:19   ` Mattijs Korpershoek
2025-06-07  5:24 ` [PATCH v2 2/5] bootm: Append bootargs value when bootmeth_android provide cmdline George Chan via B4 Relay
2025-06-07  5:24 ` [PATCH v2 3/5] boot: bootmeth_android: Conditionally dependent on abootimg George Chan via B4 Relay
2025-06-12  7:35   ` Mattijs Korpershoek
2025-06-07  5:24 ` [PATCH v2 4/5] iommu: qcom-smmu: Introduce sc7180 compatible string George Chan via B4 Relay
2025-06-07  5:25 ` [PATCH v2 5/5] usb: gadget: Introduce usb gadget vendor/product default id for ARCH_QCOM George Chan via B4 Relay
2025-06-12  7:24   ` Mattijs Korpershoek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox