Skip to contentSkip to conversation

vexpress64: Add MMC card to the BOOT_TARGET_DEVICES of FVP

PATCH In review Qi Feng 3 participants 7 messages Oct 18, 2023 – Oct 28, 2023

Subsystems (2)
lore
Share & tools
lore

Qi Feng

author
#0 lore raw

cover vexpress64: Add MMC card to the BOOT_TARGET_DEVICES of FVP

Add MMC disk to FVP's BOOT_TARGET_DEVICES. This allows the user to boot from MMC devices.

While working on that, one compilation error has been observed and fixed.

Wei Chen (2):
misc: vexpress_config: Use member .priv_auto to set the private data
vexpress64: Add MMC card to the BOOT_TARGET_DEVICES of FVP

 drivers/misc/vexpress_config.c   | 5 ++---
 include/configs/vexpress_aemv8.h | 7 +++++++
 2 files changed, 9 insertions(+), 3 deletions(-)
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 1/2 misc: vexpress_config: Use member .priv_auto to set the private data

From: Wei Chen <[email protected]>

In current vexpress_config_probe code, it sets the uclass private data directly. This will cause one compilation error:
drivers/misc/vexpress_config.c:114:27: error: lvalue required as left operand of assignment
114 | dev_get_uclass_priv(dev) = priv;
| ^

In this patch we set the uclass private data through struct member .priv_auto, and this compilation error disappears.

---
 drivers/misc/vexpress_config.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/misc/vexpress_config.c +2 -3
index 2baca48109f..99aad1412ae 100644
@@ -92,7 +92,7 @@ static struct misc_ops vexpress_config_ops = {
 static int vexpress_config_probe(struct udevice *dev)
 {
 	struct ofnode_phandle_args args;
-	struct vexpress_config_sysreg *priv;
+	struct vexpress_config_sysreg *priv = dev_get_priv(dev);
 	const char *prop;
 	int err, prop_size;
 
@@ -105,11 +105,9 @@ static int vexpress_config_probe(struct udevice *dev)
 	if (!prop || (strncmp(prop, "arm,vexpress-sysreg", 19) != 0))
 		return -ENOENT;
 
-	priv = calloc(1, sizeof(*priv));
 	if (!priv)
 		return -ENOMEM;
 
-	dev_get_uclass_priv(dev) = priv;
 	priv->addr = ofnode_get_addr(args.node);
 
 	return dev_read_u32(dev, "arm,vexpress,site", &priv->site);
@@ -127,4 +125,5 @@ U_BOOT_DRIVER(vexpress_config_drv) = {
 	.bind = dm_scan_fdt_dev,
 	.probe = vexpress_config_probe,
 	.ops = &vexpress_config_ops,
+	.priv_auto = sizeof(struct vexpress_config_sysreg),
 };
Signature · 1 line
2.25.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] misc: vexpress_config: Use member .priv_auto to set the private data

Quoted 8 lines · Qi Feng

From: Wei Chen <[email protected]>

In current vexpress_config_probe code, it sets the uclass private data directly. This will cause one compilation error:
drivers/misc/vexpress_config.c:114:27: error: lvalue required as left operand of assignment
114 | dev_get_uclass_priv(dev) = priv;
| ^

Quoted 5 lines

In this patch we set the uclass private data through struct member .priv_auto, and this compilation error disappears.

Looks like a reasonable solution to me!

Yours,
Linus Walleij

#3 lore raw

Re: [PATCH 1/2] misc: vexpress_config: Use member .priv_auto to set the private data

In reply to Qi Feng
Quoted 8 lines · Qi Feng

From: Wei Chen <[email protected]>

In current vexpress_config_probe code, it sets the uclass private data directly. This will cause one compilation error:
drivers/misc/vexpress_config.c:114:27: error: lvalue required as left operand of assignment
114 | dev_get_uclass_priv(dev) = priv;
| ^

Quoted 6 lines

In this patch we set the uclass private data through struct member .priv_auto, and this compilation error disappears.

Applied to u-boot/master, thanks!

Signature · 1 line
Tom
author
#4 lore raw

PATCH 2/2 vexpress64: Add MMC card to the BOOT_TARGET_DEVICES of FVP

In reply to Qi Feng

From: Wei Chen <[email protected]>

Add MMC disk to FVP's BOOT_TARGET_DEVICES. This allows the user to boot from MMC devices.

---
 include/configs/vexpress_aemv8.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/configs/vexpress_aemv8.h +7 -0
index 43f7e454d81..24d8ca08665 100644
@@ -148,6 +148,12 @@
 #define FUNC_VIRTIO(func)
 #endif
 
+#ifdef CONFIG_CMD_MMC
+#define FUNC_MMC(func)	func(MMC, mmc, 0)
+#else
+#define FUNC_MMC(func)
+#endif
+
 /*
  * Boot by loading an Android image, or kernel, initrd and FDT through
  * semihosting into DRAM.
@@ -204,6 +210,7 @@
 	func(SMH, smh, na)		\
 	func(MEM, mem, na)		\
 	FUNC_VIRTIO(func)		\
+	FUNC_MMC(func)			\
 	func(PXE, pxe, na)		\
 	func(DHCP, dhcp, na)
 
Signature · 1 line
2.25.1