U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] usb: host: load Renesas xHCI firmware from a build-time supplied file
@ 2026-11-26  6:20 Aswin Murugan
  2026-11-29  0:14 ` Marek Vasut
  2026-11-30 16:26 ` Gopinath Sekar
  0 siblings, 2 replies; 5+ messages in thread
From: Aswin Murugan @ 2026-11-26  6:20 UTC (permalink / raw)
  To: trini, marek.vasut+usb, bmeng.cn, iwamatsu, neil.armstrong,
	jbx6244, aswin.murugan, senthilkumar.l, u-boot

From: Senthilkumar <senthilkumar.l@oss.qualcomm.com>

The Renesas uPD720201/uPD720202 PCIe-to-USB3 host controller requires
firmware to be downloaded over PCI configuration space before it can
operate as an xHCI host controller.

Add support for supplying the firmware at build time through the
USB_XHCI_PCI_RENESAS_FW_FILE Kconfig option. The firmware image is
linked into the U-Boot binary using .incbin and exposed through linker
symbols for consumption by the xHCI driver.

This ensures the firmware is available before PCI/USB initialization,
without requiring runtime access to network or storage. On platforms
such as QCM6490, where the onboard Ethernet interface is connected
through this controller, the firmware must be available before network
initialization, enabling network boot use cases.

Signed-off-by: Senthilkumar <senthilkumar.l@oss.qualcomm.com>
Signed-off-by: Aswin Murugan <aswin.murugan@oss.qualcomm.com>
---
 drivers/usb/host/Kconfig                    |  24 ++
 drivers/usb/host/Makefile                   |   7 +
 drivers/usb/host/xhci-pci-renesas-fw-seed.S |  16 +
 drivers/usb/host/xhci-pci-renesas.c         | 374 ++++++++++++++++++++
 include/pci_ids.h                           |   2 +
 5 files changed, 423 insertions(+)
 create mode 100644 drivers/usb/host/xhci-pci-renesas-fw-seed.S
 create mode 100644 drivers/usb/host/xhci-pci-renesas.c

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 6bbed9cb513..9c638fc09c3 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -102,6 +102,30 @@ config USB_XHCI_PCI
 	help
 	  Enables support for the PCI-based xHCI controller.
 
+config USB_XHCI_PCI_RENESAS
+	bool "Renesas uPD720201/uPD720202 PCIe xHCI controller support"
+	depends on USB_XHCI_PCI
+	help
+	  Enables firmware download and xHCI bring-up support for the
+	  Renesas uPD720201/uPD720202 PCIe-to-USB3 host controller. This
+	  chip requires a firmware image to be downloaded over PCI
+	  configuration space before it functions as a standard xHCI
+	  controller.
+
+if USB_XHCI_PCI_RENESAS
+
+config USB_XHCI_PCI_RENESAS_FW_FILE
+	string "File with the Renesas uPD720201/uPD720202 firmware image"
+	depends on !COMPILE_TEST
+	default "renesas_usb_fw.mem"
+	help
+	  File with the Renesas uPD720201/uPD720202 firmware image, obtained
+	  separately. This file is linked into the U-Boot binary at build
+	  time. If a relative file path is used, it is relative to the
+	  source directory.
+
+endif
+
 config USB_XHCI_RCAR
 	bool "Renesas R-Car USB 3.0 support"
 	default y
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 9cac53f07c7..ec00ae333ba 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -53,8 +53,15 @@ obj-$(CONFIG_USB_XHCI_MVEBU) += xhci-mvebu.o
 obj-$(CONFIG_USB_XHCI_GENERIC) += xhci-generic.o
 obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o
 obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o
+obj-$(CONFIG_USB_XHCI_PCI_RENESAS) += xhci-pci-renesas.o xhci-pci-renesas-fw-seed.o
 obj-$(CONFIG_USB_XHCI_RCAR) += xhci-rcar.o
 obj-$(CONFIG_USB_XHCI_OCTEON) += dwc3-octeon-glue.o
 
+TMP_RENESAS_XHCI_FW := $(subst $\",,$(CONFIG_USB_XHCI_PCI_RENESAS_FW_FILE))
+RENESAS_XHCI_FW_SEED_FILE := $(if $(filter /% ,$(TMP_RENESAS_XHCI_FW)) \
+  ,$(TMP_RENESAS_XHCI_FW),$(srctree)/$(TMP_RENESAS_XHCI_FW))
+AFLAGS_xhci-pci-renesas-fw-seed.o := -DRENESAS_XHCI_FW_SEED_FILE=\"$(RENESAS_XHCI_FW_SEED_FILE)\"
+$(obj)/xhci-pci-renesas-fw-seed.o: $(RENESAS_XHCI_FW_SEED_FILE)
+
 # designware
 obj-$(CONFIG_USB_DWC2) += dwc2.o
diff --git a/drivers/usb/host/xhci-pci-renesas-fw-seed.S b/drivers/usb/host/xhci-pci-renesas-fw-seed.S
new file mode 100644
index 00000000000..bfeb73a0506
--- /dev/null
+++ b/drivers/usb/host/xhci-pci-renesas-fw-seed.S
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Renesas uPD720201/uPD720202 xHCI controller firmware, linked in from a
+ * file supplied at build time via CONFIG_USB_XHCI_PCI_RENESAS_FW_FILE.
+ *
+ * Copyright (c) Qualcomm Technologies, Inc. All rights reserved.
+ */
+
+.section .rodata.renesas_xhci_fw.init,"a"
+.balign 16
+.global __renesas_xhci_fw_begin
+__renesas_xhci_fw_begin:
+.incbin RENESAS_XHCI_FW_SEED_FILE
+.global __renesas_xhci_fw_end
+__renesas_xhci_fw_end:
+.balign 16
diff --git a/drivers/usb/host/xhci-pci-renesas.c b/drivers/usb/host/xhci-pci-renesas.c
new file mode 100644
index 00000000000..5ed859a353e
--- /dev/null
+++ b/drivers/usb/host/xhci-pci-renesas.c
@@ -0,0 +1,374 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Renesas uPD720201/uPD720202 PCIe xHCI controller driver.
+ *
+ * This controller has no firmware in ROM; a firmware image must be
+ * downloaded over PCI configuration space before the device behaves as a
+ * standard xHCI host controller. Ported from the Linux kernel driver
+ * xhci-pci-renesas.c
+ *
+ * The firmware image is supplied at build time via
+ * CONFIG_USB_XHCI_PCI_RENESAS_FW_FILE and linked directly into the
+ * U-Boot binary by xhci-pci-renesas-fw-seed.S, since on boards where
+ * Ethernet is itself a USB-attached device behind this controller,
+ * USB must already be functional before any storage or network path
+ * exists to load firmware from at runtime.
+ *
+ * Copyright (c) Qualcomm Technologies, Inc. All rights reserved.
+ */
+
+#include <dm.h>
+#include <dm/device_compat.h>
+#include <init.h>
+#include <log.h>
+#include <pci.h>
+#include <pci_ids.h>
+#include <reset.h>
+#include <time.h>
+#include <usb.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
+#include <usb/xhci.h>
+
+extern char __renesas_xhci_fw_begin[];
+extern char __renesas_xhci_fw_end[];
+
+#define RENESAS_FW_VERSION		0x6c
+#define RENESAS_FW_VERSION_FIELD	GENMASK(23, 7)
+#define RENESAS_FW_VERSION_OFFSET	8
+
+#define RENESAS_FW_STATUS		0xf4
+#define RENESAS_FW_STATUS_DOWNLOAD_ENABLE	BIT(0)
+#define RENESAS_FW_STATUS_LOCK			BIT(1)
+#define RENESAS_FW_STATUS_RESULT		GENMASK(6, 4)
+#define RENESAS_FW_STATUS_INVALID		0
+#define RENESAS_FW_STATUS_SUCCESS		BIT(4)
+#define RENESAS_FW_STATUS_ERROR		BIT(5)
+
+#define RENESAS_FW_STATUS_MSB		0xf5
+#define RENESAS_FW_STATUS_SET_DATA0	BIT(0)
+#define RENESAS_FW_STATUS_SET_DATA1	BIT(1)
+
+#define RENESAS_DATA0			0xf8
+#define RENESAS_DATA1			0xfc
+
+/* Firmware header, per Renesas datasheet R19UH0078EJ0500 Rev.5.00 6.3 */
+#define RENESAS_FW_MIN_SIZE		0x1000
+#define RENESAS_FW_MAX_SIZE		0x10000
+#define RENESAS_FW_MAGIC		0x55aa
+
+#define RENESAS_RETRY			50000	/* * 10us ~= 500ms */
+#define RENESAS_DELAY_US		10
+
+struct xhci_pci_renesas_plat {
+	struct reset_ctl reset;
+};
+
+/*
+ * renesas_fw_verify() - sanity-check the embedded firmware header
+ *
+ * @data: firmware image, treated as an array of 32-bit little-endian words
+ * @size: firmware image size in bytes
+ */
+static int renesas_fw_verify(const u32 *data, size_t size)
+{
+	const u8 *fw_data = (const u8 *)data;
+	u16 fw_version_pointer;
+
+	if (size < RENESAS_FW_MIN_SIZE || size >= RENESAS_FW_MAX_SIZE) {
+		log_err("renesas xhci: bad firmware size %zu\n", size);
+		return -EINVAL;
+	}
+
+	if (get_unaligned_le16(fw_data) != RENESAS_FW_MAGIC) {
+		log_err("renesas xhci: bad firmware magic\n");
+		return -EINVAL;
+	}
+
+	fw_version_pointer = get_unaligned_le16(fw_data + 4);
+	if (fw_version_pointer + 2 >= size) {
+		log_err("renesas xhci: bad firmware version pointer\n");
+		return -EINVAL;
+	}
+
+	log_err("renesas xhci: firmware version %02x.%02x\n",
+		fw_data[fw_version_pointer + 1], fw_data[fw_version_pointer]);
+
+	return 0;
+}
+
+/*
+ * renesas_fw_check_running() - check whether firmware is already loaded
+ *
+ * Return: 0 if firmware is already loaded and running, 1 if firmware needs
+ * to be downloaded, or a negative error code on unrecoverable failure.
+ */
+static int renesas_fw_check_running(struct udevice *dev)
+{
+	u8 fw_status;
+	int ret;
+
+	ret = dm_pci_read_config8(dev, RENESAS_FW_STATUS, &fw_status);
+	if (ret)
+		return ret;
+
+	if (fw_status & RENESAS_FW_STATUS_LOCK) {
+		if (fw_status & RENESAS_FW_STATUS_SUCCESS)
+			return 0;
+
+		dev_err(dev, "renesas xhci: firmware lock set without success\n");
+		return -EIO;
+	}
+
+	if (fw_status & RENESAS_FW_STATUS_DOWNLOAD_ENABLE) {
+		dev_err(dev, "renesas xhci: firmware download left enabled\n");
+		return -EIO;
+	}
+
+	switch (fw_status & RENESAS_FW_STATUS_RESULT) {
+	case RENESAS_FW_STATUS_INVALID:
+		return 1;
+	case RENESAS_FW_STATUS_SUCCESS:
+		return 0;
+	case RENESAS_FW_STATUS_ERROR:
+		return -ENODEV;
+	default:
+		return -EINVAL;
+	}
+}
+
+/*
+ * renesas_fw_download_word() - transfer a single 32-bit firmware word
+ *
+ * @step: word index into the firmware image; even steps go to DATA0, odd
+ * steps go to DATA1, per the controller's 64-bit "row" mailbox layout.
+ */
+static int renesas_fw_download_word(struct udevice *dev, u32 word, size_t step)
+{
+	bool data1 = step & 1;
+	u8 status_bit = data1 ? RENESAS_FW_STATUS_SET_DATA1 :
+				 RENESAS_FW_STATUS_SET_DATA0;
+	u8 fw_status;
+	int ret, i;
+
+	for (i = 0; i < RENESAS_RETRY; i++) {
+		ret = dm_pci_read_config8(dev, RENESAS_FW_STATUS_MSB, &fw_status);
+		if (ret)
+			return ret;
+		if (!(fw_status & status_bit))
+			break;
+		udelay(RENESAS_DELAY_US);
+	}
+	if (i == RENESAS_RETRY)
+		return -ETIMEDOUT;
+
+	ret = dm_pci_write_config32(dev, data1 ? RENESAS_DATA1 : RENESAS_DATA0,
+				    word);
+	if (ret)
+		return ret;
+	udelay(100);
+
+	return dm_pci_write_config8(dev, RENESAS_FW_STATUS_MSB, status_bit);
+}
+
+/*
+ * renesas_fw_download() - download firmware into the controller's internal
+ * RAM over PCI configuration space
+ */
+static int renesas_fw_download(struct udevice *dev, const u32 *fw_data,
+			       size_t fw_size)
+{
+	u8 fw_status;
+	int ret, i;
+	size_t words = fw_size / 4;
+
+	ret = dm_pci_write_config8(dev, RENESAS_FW_STATUS,
+				   RENESAS_FW_STATUS_DOWNLOAD_ENABLE);
+	if (ret)
+		return ret;
+
+	for (i = 0; i < words; i++) {
+		ret = renesas_fw_download_word(dev, fw_data[i], i);
+		if (ret) {
+			dev_err(dev, "renesas xhci: download failed at word %d/%zu (%d)\n",
+				i, words, ret);
+			return ret;
+		}
+	}
+
+	for (i = 0; i < RENESAS_RETRY; i++) {
+		ret = dm_pci_read_config8(dev, RENESAS_FW_STATUS_MSB, &fw_status);
+		if (ret)
+			return ret;
+		if (!(fw_status & (RENESAS_FW_STATUS_SET_DATA0 |
+				    RENESAS_FW_STATUS_SET_DATA1)))
+			break;
+		udelay(RENESAS_DELAY_US);
+	}
+	if (i == RENESAS_RETRY)
+		dev_warn(dev, "renesas xhci: timeout waiting for final word ack\n");
+
+	ret = dm_pci_write_config8(dev, RENESAS_FW_STATUS, 0);
+	if (ret)
+		return ret;
+
+	for (i = 0; i < RENESAS_RETRY; i++) {
+		ret = dm_pci_read_config8(dev, RENESAS_FW_STATUS, &fw_status);
+		if (ret)
+			return ret;
+		if (fw_status & RENESAS_FW_STATUS_SUCCESS)
+			break;
+		if (fw_status & RENESAS_FW_STATUS_ERROR) {
+			dev_err(dev, "renesas xhci: firmware download error\n");
+			return -EIO;
+		}
+		udelay(RENESAS_DELAY_US);
+	}
+	if (i == RENESAS_RETRY) {
+		dev_err(dev, "renesas xhci: timeout waiting for download result\n");
+		return -ETIMEDOUT;
+	}
+
+	log_err("renesas xhci: firmware download succeeded\n");
+	return 0;
+}
+
+static int renesas_xhci_check_request_fw(struct udevice *dev)
+{
+	size_t fw_size = __renesas_xhci_fw_end - __renesas_xhci_fw_begin;
+	const u32 *fw_data = (const u32 *)__renesas_xhci_fw_begin;
+	int ret;
+
+	ret = renesas_fw_check_running(dev);
+	if (ret <= 0)
+		return ret;
+
+	ret = renesas_fw_verify(fw_data, fw_size);
+	if (ret)
+		return ret;
+
+	log_err("renesas xhci: firmware not running, downloading\n");
+	return renesas_fw_download(dev, fw_data, fw_size);
+}
+
+static int xhci_pci_renesas_init(struct udevice *dev,
+				 struct xhci_hccr **ret_hccr,
+				 struct xhci_hcor **ret_hcor)
+{
+	struct xhci_hccr *hccr;
+	struct xhci_hcor *hcor;
+	u32 cmd;
+
+	hccr = (struct xhci_hccr *)dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0,
+						   0, PCI_REGION_TYPE,
+						   PCI_REGION_MEM);
+	if (!hccr) {
+		dev_err(dev, "renesas xhci: cannot map PCI mem bar\n");
+		return -EIO;
+	}
+
+	hcor = (struct xhci_hcor *)((uintptr_t)hccr +
+			HC_LENGTH(xhci_readl(&hccr->cr_capbase)));
+
+	log_err("renesas xhci: hccr %p hcor %p\n", hccr, hcor);
+
+	*ret_hccr = hccr;
+	*ret_hcor = hcor;
+
+	dm_pci_read_config32(dev, PCI_COMMAND, &cmd);
+	cmd |= PCI_COMMAND_MASTER;
+	dm_pci_write_config32(dev, PCI_COMMAND, cmd);
+
+	return 0;
+}
+
+static int xhci_pci_renesas_probe(struct udevice *dev)
+{
+	struct xhci_pci_renesas_plat *plat = dev_get_plat(dev);
+	struct xhci_ctrl *ctrl = dev_get_priv(dev);
+	struct xhci_hccr *hccr;
+	struct xhci_hcor *hcor;
+	int ret;
+
+	ret = reset_get_by_index(dev, 0, &plat->reset);
+	if (ret && ret != -ENOENT && ret != -ENOTSUPP) {
+		dev_err(dev, "renesas xhci: failed to get reset\n");
+		return ret;
+	}
+
+	if (reset_valid(&plat->reset)) {
+		ret = reset_assert(&plat->reset);
+		if (ret)
+			goto err_reset;
+
+		ret = reset_deassert(&plat->reset);
+		if (ret)
+			goto err_reset;
+	}
+
+	ret = renesas_xhci_check_request_fw(dev);
+	if (ret) {
+		dev_err(dev, "renesas xhci: firmware bring-up failed (%d)\n", ret);
+		goto err_reset;
+	}
+
+	/*
+	 * Settle time between firmware-download-success and first MMIO/xHCI
+	 * touch. The Renesas on-chip CPU needs time to finish booting into
+	 * xHCI mode after FW_STATUS reports SUCCESS.
+	 */
+	mdelay(100);
+
+	ret = xhci_pci_renesas_init(dev, &hccr, &hcor);
+	if (ret)
+		goto err_reset;
+
+	ret = xhci_register(dev, hccr, hcor);
+	if (ret)
+		goto err_reset;
+
+	return 0;
+
+err_reset:
+	if (reset_valid(&plat->reset))
+		reset_free(&plat->reset);
+
+	return ret;
+}
+
+static int xhci_pci_renesas_remove(struct udevice *dev)
+{
+	struct xhci_pci_renesas_plat *plat = dev_get_plat(dev);
+
+	xhci_deregister(dev);
+	if (reset_valid(&plat->reset))
+		reset_free(&plat->reset);
+
+	return 0;
+}
+
+/*
+ * pci_find_and_bind_driver() binds the first alphabetically-sorted driver
+ * whose pci_device_id table matches. The uPD720201 reports a standard xHCI
+ * class code even before firmware loads, matching generic xhci-pci.c's
+ * wildcard too, so "renesas_xhci_pci" relies on sorting before "xhci_pci" -
+ * do not rename without re-verifying bind order on hardware.
+ */
+U_BOOT_DRIVER(renesas_xhci_pci) = {
+	.name	= "renesas_xhci_pci",
+	.id	= UCLASS_USB,
+	.probe = xhci_pci_renesas_probe,
+	.remove	= xhci_pci_renesas_remove,
+	.ops	= &xhci_usb_ops,
+	.plat_auto	= sizeof(struct xhci_pci_renesas_plat),
+	.priv_auto	= sizeof(struct xhci_ctrl),
+	.flags	= DM_FLAG_OS_PREPARE | DM_FLAG_ALLOC_PRIV_DMA,
+};
+
+static struct pci_device_id xhci_pci_renesas_supported[] = {
+	{ PCI_DEVICE(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_UPD720201) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_UPD720202) },
+	{},
+};
+
+U_BOOT_PCI_DEVICE(renesas_xhci_pci, xhci_pci_renesas_supported);
diff --git a/include/pci_ids.h b/include/pci_ids.h
index cfff275daba..3ccb76fc3ff 100644
--- a/include/pci_ids.h
+++ b/include/pci_ids.h
@@ -2443,6 +2443,8 @@
 #define PCI_DEVICE_ID_RENESAS_SH7763	0x0004
 #define PCI_DEVICE_ID_RENESAS_SH7785	0x0007
 #define PCI_DEVICE_ID_RENESAS_SH7786	0x0010
+#define PCI_DEVICE_ID_RENESAS_UPD720201	0x0014
+#define PCI_DEVICE_ID_RENESAS_UPD720202	0x0015
 
 #define PCI_VENDOR_ID_SOLARFLARE	0x1924
 #define PCI_DEVICE_ID_SOLARFLARE_SFC4000A_0	0x0703
-- 
2.34.1


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

* Re: [PATCH v1] usb: host: load Renesas xHCI firmware from a build-time supplied file
  2026-11-26  6:20 [PATCH v1] usb: host: load Renesas xHCI firmware from a build-time supplied file Aswin Murugan
@ 2026-11-29  0:14 ` Marek Vasut
  2026-11-30 16:48   ` Aswin Murugan
  2026-11-30 16:26 ` Gopinath Sekar
  1 sibling, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2026-11-29  0:14 UTC (permalink / raw)
  To: Aswin Murugan, trini, bmeng.cn, iwamatsu, neil.armstrong, jbx6244,
	senthilkumar.l, u-boot

On 11/26/26 7:20 AM, Aswin Murugan wrote:
> From: Senthilkumar <senthilkumar.l@oss.qualcomm.com>
> 
> The Renesas uPD720201/uPD720202 PCIe-to-USB3 host controller requires
> firmware to be downloaded over PCI configuration space before it can
> operate as an xHCI host controller.
> 
> Add support for supplying the firmware at build time through the
> USB_XHCI_PCI_RENESAS_FW_FILE Kconfig option. The firmware image is
> linked into the U-Boot binary using .incbin and exposed through linker
> symbols for consumption by the xHCI driver.
> 
> This ensures the firmware is available before PCI/USB initialization,
> without requiring runtime access to network or storage. On platforms
> such as QCM6490, where the onboard Ethernet interface is connected
> through this controller, the firmware must be available before network
> initialization, enabling network boot use cases.

Can you try to use request_firmware_into_buf_via_script() and load the 
firmware from storage instead ? This way the firmware can be kept 
outside of the U-Boot binary, which is preferable.

Is the firmware loading code imported from Linux or written from scratch?

> Signed-off-by: Senthilkumar <senthilkumar.l@oss.qualcomm.com>

Please use full name for DCO.

[...]

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

* Re: [PATCH v1] usb: host: load Renesas xHCI firmware from a build-time supplied file
  2026-11-26  6:20 [PATCH v1] usb: host: load Renesas xHCI firmware from a build-time supplied file Aswin Murugan
  2026-11-29  0:14 ` Marek Vasut
@ 2026-11-30 16:26 ` Gopinath Sekar
  1 sibling, 0 replies; 5+ messages in thread
From: Gopinath Sekar @ 2026-11-30 16:26 UTC (permalink / raw)
  To: Aswin Murugan, trini, marek.vasut+usb, bmeng.cn, iwamatsu,
	neil.armstrong, jbx6244, senthilkumar.l, u-boot

Hi Aswin,

Could see that log_err is used even for info/debug level messages.

On 11/26/2026 11:50 AM, Aswin Murugan wrote:
> From: Senthilkumar <senthilkumar.l@oss.qualcomm.com>
>
> The Renesas uPD720201/uPD720202 PCIe-to-USB3 host controller requires
> firmware to be downloaded over PCI configuration space before it can
> operate as an xHCI host controller.
>
> Add support for supplying the firmware at build time through the
> USB_XHCI_PCI_RENESAS_FW_FILE Kconfig option. The firmware image is
> linked into the U-Boot binary using .incbin and exposed through linker
> symbols for consumption by the xHCI driver.
>
> This ensures the firmware is available before PCI/USB initialization,
> without requiring runtime access to network or storage. On platforms
> such as QCM6490, where the onboard Ethernet interface is connected
> through this controller, the firmware must be available before network
> initialization, enabling network boot use cases.
>
> Signed-off-by: Senthilkumar <senthilkumar.l@oss.qualcomm.com>
> Signed-off-by: Aswin Murugan <aswin.murugan@oss.qualcomm.com>
> ---
>   drivers/usb/host/Kconfig                    |  24 ++
>   drivers/usb/host/Makefile                   |   7 +
>   drivers/usb/host/xhci-pci-renesas-fw-seed.S |  16 +
>   drivers/usb/host/xhci-pci-renesas.c         | 374 ++++++++++++++++++++
>   include/pci_ids.h                           |   2 +
>   5 files changed, 423 insertions(+)
>   create mode 100644 drivers/usb/host/xhci-pci-renesas-fw-seed.S
>   create mode 100644 drivers/usb/host/xhci-pci-renesas.c
>
> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> index 6bbed9cb513..9c638fc09c3 100644
> --- a/drivers/usb/host/Kconfig
> +++ b/drivers/usb/host/Kconfig
> @@ -102,6 +102,30 @@ config USB_XHCI_PCI
>   	help
>   	  Enables support for the PCI-based xHCI controller.
>   
> +config USB_XHCI_PCI_RENESAS
> +	bool "Renesas uPD720201/uPD720202 PCIe xHCI controller support"
> +	depends on USB_XHCI_PCI
> +	help
> +	  Enables firmware download and xHCI bring-up support for the
> +	  Renesas uPD720201/uPD720202 PCIe-to-USB3 host controller. This
> +	  chip requires a firmware image to be downloaded over PCI
> +	  configuration space before it functions as a standard xHCI
> +	  controller.
> +
> +if USB_XHCI_PCI_RENESAS
> +
> +config USB_XHCI_PCI_RENESAS_FW_FILE
> +	string "File with the Renesas uPD720201/uPD720202 firmware image"
> +	depends on !COMPILE_TEST
> +	default "renesas_usb_fw.mem"
> +	help
> +	  File with the Renesas uPD720201/uPD720202 firmware image, obtained
> +	  separately. This file is linked into the U-Boot binary at build
> +	  time. If a relative file path is used, it is relative to the
> +	  source directory.
> +
> +endif
> +
>   config USB_XHCI_RCAR
>   	bool "Renesas R-Car USB 3.0 support"
>   	default y
> diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
> index 9cac53f07c7..ec00ae333ba 100644
> --- a/drivers/usb/host/Makefile
> +++ b/drivers/usb/host/Makefile
> @@ -53,8 +53,15 @@ obj-$(CONFIG_USB_XHCI_MVEBU) += xhci-mvebu.o
>   obj-$(CONFIG_USB_XHCI_GENERIC) += xhci-generic.o
>   obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o
>   obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o
> +obj-$(CONFIG_USB_XHCI_PCI_RENESAS) += xhci-pci-renesas.o xhci-pci-renesas-fw-seed.o
>   obj-$(CONFIG_USB_XHCI_RCAR) += xhci-rcar.o
>   obj-$(CONFIG_USB_XHCI_OCTEON) += dwc3-octeon-glue.o
>   
> +TMP_RENESAS_XHCI_FW := $(subst $\",,$(CONFIG_USB_XHCI_PCI_RENESAS_FW_FILE))
> +RENESAS_XHCI_FW_SEED_FILE := $(if $(filter /% ,$(TMP_RENESAS_XHCI_FW)) \
> +  ,$(TMP_RENESAS_XHCI_FW),$(srctree)/$(TMP_RENESAS_XHCI_FW))
> +AFLAGS_xhci-pci-renesas-fw-seed.o := -DRENESAS_XHCI_FW_SEED_FILE=\"$(RENESAS_XHCI_FW_SEED_FILE)\"
> +$(obj)/xhci-pci-renesas-fw-seed.o: $(RENESAS_XHCI_FW_SEED_FILE)
> +
>   # designware
>   obj-$(CONFIG_USB_DWC2) += dwc2.o
> diff --git a/drivers/usb/host/xhci-pci-renesas-fw-seed.S b/drivers/usb/host/xhci-pci-renesas-fw-seed.S
> new file mode 100644
> index 00000000000..bfeb73a0506
> --- /dev/null
> +++ b/drivers/usb/host/xhci-pci-renesas-fw-seed.S
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Renesas uPD720201/uPD720202 xHCI controller firmware, linked in from a
> + * file supplied at build time via CONFIG_USB_XHCI_PCI_RENESAS_FW_FILE.
> + *
> + * Copyright (c) Qualcomm Technologies, Inc. All rights reserved.
> + */
> +
> +.section .rodata.renesas_xhci_fw.init,"a"
> +.balign 16
> +.global __renesas_xhci_fw_begin
> +__renesas_xhci_fw_begin:
> +.incbin RENESAS_XHCI_FW_SEED_FILE
> +.global __renesas_xhci_fw_end
> +__renesas_xhci_fw_end:
> +.balign 16
> diff --git a/drivers/usb/host/xhci-pci-renesas.c b/drivers/usb/host/xhci-pci-renesas.c
> new file mode 100644
> index 00000000000..5ed859a353e
> --- /dev/null
> +++ b/drivers/usb/host/xhci-pci-renesas.c
> @@ -0,0 +1,374 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Renesas uPD720201/uPD720202 PCIe xHCI controller driver.
> + *
> + * This controller has no firmware in ROM; a firmware image must be
> + * downloaded over PCI configuration space before the device behaves as a
> + * standard xHCI host controller. Ported from the Linux kernel driver
> + * xhci-pci-renesas.c
> + *
> + * The firmware image is supplied at build time via
> + * CONFIG_USB_XHCI_PCI_RENESAS_FW_FILE and linked directly into the
> + * U-Boot binary by xhci-pci-renesas-fw-seed.S, since on boards where
> + * Ethernet is itself a USB-attached device behind this controller,
> + * USB must already be functional before any storage or network path
> + * exists to load firmware from at runtime.
> + *
> + * Copyright (c) Qualcomm Technologies, Inc. All rights reserved.
> + */
> +
> +#include <dm.h>
> +#include <dm/device_compat.h>
> +#include <init.h>
> +#include <log.h>
> +#include <pci.h>
> +#include <pci_ids.h>
> +#include <reset.h>
> +#include <time.h>
> +#include <usb.h>
> +#include <linux/bitops.h>
> +#include <linux/delay.h>
> +#include <usb/xhci.h>
> +
> +extern char __renesas_xhci_fw_begin[];
> +extern char __renesas_xhci_fw_end[];
> +
> +#define RENESAS_FW_VERSION		0x6c
> +#define RENESAS_FW_VERSION_FIELD	GENMASK(23, 7)
> +#define RENESAS_FW_VERSION_OFFSET	8
> +
> +#define RENESAS_FW_STATUS		0xf4
> +#define RENESAS_FW_STATUS_DOWNLOAD_ENABLE	BIT(0)
> +#define RENESAS_FW_STATUS_LOCK			BIT(1)
> +#define RENESAS_FW_STATUS_RESULT		GENMASK(6, 4)
> +#define RENESAS_FW_STATUS_INVALID		0
> +#define RENESAS_FW_STATUS_SUCCESS		BIT(4)
> +#define RENESAS_FW_STATUS_ERROR		BIT(5)
> +
> +#define RENESAS_FW_STATUS_MSB		0xf5
> +#define RENESAS_FW_STATUS_SET_DATA0	BIT(0)
> +#define RENESAS_FW_STATUS_SET_DATA1	BIT(1)
> +
> +#define RENESAS_DATA0			0xf8
> +#define RENESAS_DATA1			0xfc
> +
> +/* Firmware header, per Renesas datasheet R19UH0078EJ0500 Rev.5.00 6.3 */
> +#define RENESAS_FW_MIN_SIZE		0x1000
> +#define RENESAS_FW_MAX_SIZE		0x10000
> +#define RENESAS_FW_MAGIC		0x55aa
> +
> +#define RENESAS_RETRY			50000	/* * 10us ~= 500ms */
> +#define RENESAS_DELAY_US		10
> +
> +struct xhci_pci_renesas_plat {
> +	struct reset_ctl reset;
> +};
> +
> +/*
> + * renesas_fw_verify() - sanity-check the embedded firmware header
> + *
> + * @data: firmware image, treated as an array of 32-bit little-endian words
> + * @size: firmware image size in bytes
> + */
> +static int renesas_fw_verify(const u32 *data, size_t size)
> +{
> +	const u8 *fw_data = (const u8 *)data;
> +	u16 fw_version_pointer;
> +
> +	if (size < RENESAS_FW_MIN_SIZE || size >= RENESAS_FW_MAX_SIZE) {
> +		log_err("renesas xhci: bad firmware size %zu\n", size);
> +		return -EINVAL;
> +	}
> +
> +	if (get_unaligned_le16(fw_data) != RENESAS_FW_MAGIC) {
> +		log_err("renesas xhci: bad firmware magic\n");
> +		return -EINVAL;
> +	}
> +
> +	fw_version_pointer = get_unaligned_le16(fw_data + 4);
> +	if (fw_version_pointer + 2 >= size) {
> +		log_err("renesas xhci: bad firmware version pointer\n");
> +		return -EINVAL;
> +	}
> +
> +	log_err("renesas xhci: firmware version %02x.%02x\n",
> +		fw_data[fw_version_pointer + 1], fw_data[fw_version_pointer]);
Should this be changed as log_info()/log_debug() this doesn't seem to be 
error log.
> +
> +	return 0;
> +}
> +
> +/*
> + * renesas_fw_check_running() - check whether firmware is already loaded
> + *
> + * Return: 0 if firmware is already loaded and running, 1 if firmware needs
> + * to be downloaded, or a negative error code on unrecoverable failure.
> + */
> +static int renesas_fw_check_running(struct udevice *dev)
> +{
> +	u8 fw_status;
> +	int ret;
> +
> +	ret = dm_pci_read_config8(dev, RENESAS_FW_STATUS, &fw_status);
> +	if (ret)
> +		return ret;
> +
> +	if (fw_status & RENESAS_FW_STATUS_LOCK) {
> +		if (fw_status & RENESAS_FW_STATUS_SUCCESS)
> +			return 0;
> +
> +		dev_err(dev, "renesas xhci: firmware lock set without success\n");
> +		return -EIO;
> +	}
> +
> +	if (fw_status & RENESAS_FW_STATUS_DOWNLOAD_ENABLE) {
> +		dev_err(dev, "renesas xhci: firmware download left enabled\n");
> +		return -EIO;
> +	}
> +
> +	switch (fw_status & RENESAS_FW_STATUS_RESULT) {
> +	case RENESAS_FW_STATUS_INVALID:
> +		return 1;
> +	case RENESAS_FW_STATUS_SUCCESS:
> +		return 0;
> +	case RENESAS_FW_STATUS_ERROR:
> +		return -ENODEV;
> +	default:
> +		return -EINVAL;
> +	}
> +}
> +
> +/*
> + * renesas_fw_download_word() - transfer a single 32-bit firmware word
> + *
> + * @step: word index into the firmware image; even steps go to DATA0, odd
> + * steps go to DATA1, per the controller's 64-bit "row" mailbox layout.
> + */
> +static int renesas_fw_download_word(struct udevice *dev, u32 word, size_t step)
> +{
> +	bool data1 = step & 1;
> +	u8 status_bit = data1 ? RENESAS_FW_STATUS_SET_DATA1 :
> +				 RENESAS_FW_STATUS_SET_DATA0;
> +	u8 fw_status;
> +	int ret, i;
> +
> +	for (i = 0; i < RENESAS_RETRY; i++) {
> +		ret = dm_pci_read_config8(dev, RENESAS_FW_STATUS_MSB, &fw_status);
> +		if (ret)
> +			return ret;
> +		if (!(fw_status & status_bit))
> +			break;
> +		udelay(RENESAS_DELAY_US);
> +	}
> +	if (i == RENESAS_RETRY)
> +		return -ETIMEDOUT;
> +
> +	ret = dm_pci_write_config32(dev, data1 ? RENESAS_DATA1 : RENESAS_DATA0,
> +				    word);
> +	if (ret)
> +		return ret;
> +	udelay(100);
> +
> +	return dm_pci_write_config8(dev, RENESAS_FW_STATUS_MSB, status_bit);
> +}
> +
> +/*
> + * renesas_fw_download() - download firmware into the controller's internal
> + * RAM over PCI configuration space
> + */
> +static int renesas_fw_download(struct udevice *dev, const u32 *fw_data,
> +			       size_t fw_size)
> +{
> +	u8 fw_status;
> +	int ret, i;
> +	size_t words = fw_size / 4;
> +
> +	ret = dm_pci_write_config8(dev, RENESAS_FW_STATUS,
> +				   RENESAS_FW_STATUS_DOWNLOAD_ENABLE);
> +	if (ret)
> +		return ret;
> +
> +	for (i = 0; i < words; i++) {
> +		ret = renesas_fw_download_word(dev, fw_data[i], i);
> +		if (ret) {
> +			dev_err(dev, "renesas xhci: download failed at word %d/%zu (%d)\n",
> +				i, words, ret);
> +			return ret;
> +		}
> +	}
> +
> +	for (i = 0; i < RENESAS_RETRY; i++) {
> +		ret = dm_pci_read_config8(dev, RENESAS_FW_STATUS_MSB, &fw_status);
> +		if (ret)
> +			return ret;
> +		if (!(fw_status & (RENESAS_FW_STATUS_SET_DATA0 |
> +				    RENESAS_FW_STATUS_SET_DATA1)))
> +			break;
> +		udelay(RENESAS_DELAY_US);
> +	}
> +	if (i == RENESAS_RETRY)
> +		dev_warn(dev, "renesas xhci: timeout waiting for final word ack\n");
> +
> +	ret = dm_pci_write_config8(dev, RENESAS_FW_STATUS, 0);
> +	if (ret)
> +		return ret;
> +
> +	for (i = 0; i < RENESAS_RETRY; i++) {
> +		ret = dm_pci_read_config8(dev, RENESAS_FW_STATUS, &fw_status);
> +		if (ret)
> +			return ret;
> +		if (fw_status & RENESAS_FW_STATUS_SUCCESS)
> +			break;
> +		if (fw_status & RENESAS_FW_STATUS_ERROR) {
> +			dev_err(dev, "renesas xhci: firmware download error\n");
> +			return -EIO;
> +		}
> +		udelay(RENESAS_DELAY_US);
> +	}
> +	if (i == RENESAS_RETRY) {
> +		dev_err(dev, "renesas xhci: timeout waiting for download result\n");
> +		return -ETIMEDOUT;
> +	}
> +
> +	log_err("renesas xhci: firmware download succeeded\n");
same here too log_info/log_debug
> +	return 0;
> +}
> +
> +static int renesas_xhci_check_request_fw(struct udevice *dev)
> +{
> +	size_t fw_size = __renesas_xhci_fw_end - __renesas_xhci_fw_begin;
> +	const u32 *fw_data = (const u32 *)__renesas_xhci_fw_begin;
> +	int ret;
> +
> +	ret = renesas_fw_check_running(dev);
> +	if (ret <= 0)
> +		return ret;
> +
> +	ret = renesas_fw_verify(fw_data, fw_size);
> +	if (ret)
> +		return ret;
> +
> +	log_err("renesas xhci: firmware not running, downloading\n");
log_info/debug
> +	return renesas_fw_download(dev, fw_data, fw_size);
> +}
> +
> +static int xhci_pci_renesas_init(struct udevice *dev,
> +				 struct xhci_hccr **ret_hccr,
> +				 struct xhci_hcor **ret_hcor)
> +{
> +	struct xhci_hccr *hccr;
> +	struct xhci_hcor *hcor;
> +	u32 cmd;
> +
> +	hccr = (struct xhci_hccr *)dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, 0,
> +						   0, PCI_REGION_TYPE,
> +						   PCI_REGION_MEM);
> +	if (!hccr) {
> +		dev_err(dev, "renesas xhci: cannot map PCI mem bar\n");
> +		return -EIO;
> +	}
> +
> +	hcor = (struct xhci_hcor *)((uintptr_t)hccr +
> +			HC_LENGTH(xhci_readl(&hccr->cr_capbase)));
> +
> +	log_err("renesas xhci: hccr %p hcor %p\n", hccr, hcor);
> +
> +	*ret_hccr = hccr;
> +	*ret_hcor = hcor;
> +
> +	dm_pci_read_config32(dev, PCI_COMMAND, &cmd);
> +	cmd |= PCI_COMMAND_MASTER;
> +	dm_pci_write_config32(dev, PCI_COMMAND, cmd);
> +
> +	return 0;
> +}
> +
> +static int xhci_pci_renesas_probe(struct udevice *dev)
> +{
> +	struct xhci_pci_renesas_plat *plat = dev_get_plat(dev);
> +	struct xhci_ctrl *ctrl = dev_get_priv(dev);
> +	struct xhci_hccr *hccr;
> +	struct xhci_hcor *hcor;
> +	int ret;
> +
> +	ret = reset_get_by_index(dev, 0, &plat->reset);
> +	if (ret && ret != -ENOENT && ret != -ENOTSUPP) {
> +		dev_err(dev, "renesas xhci: failed to get reset\n");
> +		return ret;
> +	}
> +
> +	if (reset_valid(&plat->reset)) {
> +		ret = reset_assert(&plat->reset);
> +		if (ret)
> +			goto err_reset;
> +
> +		ret = reset_deassert(&plat->reset);
> +		if (ret)
> +			goto err_reset;
> +	}
> +
> +	ret = renesas_xhci_check_request_fw(dev);
> +	if (ret) {
> +		dev_err(dev, "renesas xhci: firmware bring-up failed (%d)\n", ret);
> +		goto err_reset;
> +	}
> +
> +	/*
> +	 * Settle time between firmware-download-success and first MMIO/xHCI
> +	 * touch. The Renesas on-chip CPU needs time to finish booting into
> +	 * xHCI mode after FW_STATUS reports SUCCESS.
> +	 */
> +	mdelay(100);
> +
> +	ret = xhci_pci_renesas_init(dev, &hccr, &hcor);
> +	if (ret)
> +		goto err_reset;
> +
> +	ret = xhci_register(dev, hccr, hcor);
> +	if (ret)
> +		goto err_reset;
> +
> +	return 0;
> +
> +err_reset:
> +	if (reset_valid(&plat->reset))
> +		reset_free(&plat->reset);
> +
> +	return ret;
> +}
> +
> +static int xhci_pci_renesas_remove(struct udevice *dev)
> +{
> +	struct xhci_pci_renesas_plat *plat = dev_get_plat(dev);
> +
> +	xhci_deregister(dev);
> +	if (reset_valid(&plat->reset))
> +		reset_free(&plat->reset);
> +
> +	return 0;
> +}
> +
> +/*
> + * pci_find_and_bind_driver() binds the first alphabetically-sorted driver
> + * whose pci_device_id table matches. The uPD720201 reports a standard xHCI
> + * class code even before firmware loads, matching generic xhci-pci.c's
> + * wildcard too, so "renesas_xhci_pci" relies on sorting before "xhci_pci" -
> + * do not rename without re-verifying bind order on hardware.
> + */
> +U_BOOT_DRIVER(renesas_xhci_pci) = {
> +	.name	= "renesas_xhci_pci",
> +	.id	= UCLASS_USB,
> +	.probe = xhci_pci_renesas_probe,
> +	.remove	= xhci_pci_renesas_remove,
> +	.ops	= &xhci_usb_ops,
> +	.plat_auto	= sizeof(struct xhci_pci_renesas_plat),
> +	.priv_auto	= sizeof(struct xhci_ctrl),
> +	.flags	= DM_FLAG_OS_PREPARE | DM_FLAG_ALLOC_PRIV_DMA,
> +};
> +
> +static struct pci_device_id xhci_pci_renesas_supported[] = {
> +	{ PCI_DEVICE(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_UPD720201) },
> +	{ PCI_DEVICE(PCI_VENDOR_ID_RENESAS, PCI_DEVICE_ID_RENESAS_UPD720202) },
> +	{},
> +};
> +
> +U_BOOT_PCI_DEVICE(renesas_xhci_pci, xhci_pci_renesas_supported);
> diff --git a/include/pci_ids.h b/include/pci_ids.h
> index cfff275daba..3ccb76fc3ff 100644
> --- a/include/pci_ids.h
> +++ b/include/pci_ids.h
> @@ -2443,6 +2443,8 @@
>   #define PCI_DEVICE_ID_RENESAS_SH7763	0x0004
>   #define PCI_DEVICE_ID_RENESAS_SH7785	0x0007
>   #define PCI_DEVICE_ID_RENESAS_SH7786	0x0010
> +#define PCI_DEVICE_ID_RENESAS_UPD720201	0x0014
> +#define PCI_DEVICE_ID_RENESAS_UPD720202	0x0015
>   
>   #define PCI_VENDOR_ID_SOLARFLARE	0x1924
>   #define PCI_DEVICE_ID_SOLARFLARE_SFC4000A_0	0x0703

Thanks,

Gopinath


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

* Re: [PATCH v1] usb: host: load Renesas xHCI firmware from a build-time supplied file
  2026-11-29  0:14 ` Marek Vasut
@ 2026-11-30 16:48   ` Aswin Murugan
  2026-11-30 17:12     ` Marek Vasut
  0 siblings, 1 reply; 5+ messages in thread
From: Aswin Murugan @ 2026-11-30 16:48 UTC (permalink / raw)
  To: Marek Vasut, trini, bmeng.cn, iwamatsu, neil.armstrong, jbx6244,
	senthilkumar.l, u-boot

Hi Marek,

On 11/29/2026 5:44 AM, Marek Vasut wrote:
> On 11/26/26 7:20 AM, Aswin Murugan wrote:
>> From: Senthilkumar <senthilkumar.l@oss.qualcomm.com>
>>
>> The Renesas uPD720201/uPD720202 PCIe-to-USB3 host controller requires
>> firmware to be downloaded over PCI configuration space before it can
>> operate as an xHCI host controller.
>>
>> Add support for supplying the firmware at build time through the
>> USB_XHCI_PCI_RENESAS_FW_FILE Kconfig option. The firmware image is
>> linked into the U-Boot binary using .incbin and exposed through linker
>> symbols for consumption by the xHCI driver.
>>
>> This ensures the firmware is available before PCI/USB initialization,
>> without requiring runtime access to network or storage. On platforms
>> such as QCM6490, where the onboard Ethernet interface is connected
>> through this controller, the firmware must be available before network
>> initialization, enabling network boot use cases.
>
> Can you try to use request_firmware_into_buf_via_script() and load the 
> firmware from storage instead ? This way the firmware can be kept 
> outside of the U-Boot binary, which is preferable.
>
Thanks for the suggestion. Normally we'd agree, but it doesn't work for 
this boot flow.
The Renesas xHCI controller sits in front of the only network device 
(USB Ethernet), so the controller must be initialized and its firmware 
loaded before DHCP/TFTP can be used. In network-boot deployments, 
storage containing the firmware may also not be available at this stage.
This results in a circular dependency, when the driver's probe() runs, 
neither a usable network path nor guaranteed storage access exists. The 
firmware therefore has to be available in the U-Boot image itself, which 
is why it is embedded at build time.


> Is the firmware loading code imported from Linux or written from scratch?
>
Yes, it was ported from Linux xhci-pci-renesas.c, will add this info in 
the commit msg for V2

Thanks,
Aswin

>> Signed-off-by: Senthilkumar <senthilkumar.l@oss.qualcomm.com>
>
> Please use full name for DCO.
>
> [...]

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

* Re: [PATCH v1] usb: host: load Renesas xHCI firmware from a build-time supplied file
  2026-11-30 16:48   ` Aswin Murugan
@ 2026-11-30 17:12     ` Marek Vasut
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2026-11-30 17:12 UTC (permalink / raw)
  To: Aswin Murugan, trini, bmeng.cn, iwamatsu, neil.armstrong, jbx6244,
	senthilkumar.l, u-boot

On 11/30/26 5:48 PM, Aswin Murugan wrote:

Hello Aswin,

>> Can you try to use request_firmware_into_buf_via_script() and load the 
>> firmware from storage instead ? This way the firmware can be kept 
>> outside of the U-Boot binary, which is preferable.
>>
> Thanks for the suggestion. Normally we'd agree, but it doesn't work for 
> this boot flow.
> The Renesas xHCI controller sits in front of the only network device 
> (USB Ethernet), so the controller must be initialized and its firmware 
> loaded before DHCP/TFTP can be used. In network-boot deployments, 
> storage containing the firmware may also not be available at this stage.
> This results in a circular dependency, when the driver's probe() runs, 
> neither a usable network path nor guaranteed storage access exists. The 
> firmware therefore has to be available in the U-Boot image itself, which 
> is why it is embedded at build time.

U-Boot had to be loaded from somewhere, can the same place contain the 
firmware (separately) from U-Boot ? If so, then you can use the script 
loader to pull the firmware from there.

>> Is the firmware loading code imported from Linux or written from scratch?
>>
> Yes, it was ported from Linux xhci-pci-renesas.c, will add this info in 
> the commit msg for V2

Please include the abbreviated commit SHA and commit subject of the 
kernel commit from which this was ported.

-- 
Best regards,
Marek Vasut

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

end of thread, other threads:[~2026-11-30 23:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26  6:20 [PATCH v1] usb: host: load Renesas xHCI firmware from a build-time supplied file Aswin Murugan
2026-11-29  0:14 ` Marek Vasut
2026-11-30 16:48   ` Aswin Murugan
2026-11-30 17:12     ` Marek Vasut
2026-11-30 16:26 ` Gopinath Sekar

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