mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: fpg@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] usb: misc: rename USB onboard hub support to onboard device
Date: Tue,  6 May 2025 12:21:47 +0200	[thread overview]
Message-ID: <20250506102147.3547357-1-a.fatoum@pengutronix.de> (raw)

There is nothing hub-specific about the driver and Linux has already
renamed it to reflect its use with USB devices in general, so follow
suit in barebox.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Documentation/migration-guides/index.rst      |  1 +
 .../migration-guides/migration-2025.06.0.rst  |  8 +++
 arch/arm/configs/multi_v7_defconfig           |  2 +-
 arch/arm/configs/multi_v8_defconfig           |  2 +-
 arch/arm/configs/stm32mp_defconfig            |  2 +-
 drivers/usb/core/usb.c                        |  2 +-
 drivers/usb/misc/Kconfig                      | 14 ++---
 drivers/usb/misc/Makefile                     |  2 +-
 .../{onboard_usb_hub.c => onboard_usb_dev.c}  | 62 +++++++++----------
 .../{onboard_usb_hub.h => onboard_usb_dev.h}  | 24 +++----
 include/linux/usb/usb.h                       |  6 +-
 11 files changed, 67 insertions(+), 58 deletions(-)
 create mode 100644 Documentation/migration-guides/migration-2025.06.0.rst
 rename drivers/usb/misc/{onboard_usb_hub.c => onboard_usb_dev.c} (41%)
 rename drivers/usb/misc/{onboard_usb_hub.h => onboard_usb_dev.h} (64%)

diff --git a/Documentation/migration-guides/index.rst b/Documentation/migration-guides/index.rst
index fbe7a0205980..182654847f17 100644
--- a/Documentation/migration-guides/index.rst
+++ b/Documentation/migration-guides/index.rst
@@ -11,3 +11,4 @@ cause build errors are generally out-of-scope for these documents.
 .. toctree::
 
    migration-2025.05.0
+   migration-2025.06.0
diff --git a/Documentation/migration-guides/migration-2025.06.0.rst b/Documentation/migration-guides/migration-2025.06.0.rst
new file mode 100644
index 000000000000..ce39b117c8cb
--- /dev/null
+++ b/Documentation/migration-guides/migration-2025.06.0.rst
@@ -0,0 +1,8 @@
+Release v2025.06.0
+==================
+
+Configuration options
+---------------------
+
+* ``CONFIG_USB_ONBOARD_HUB`` has been renamed to ``CONFIG_USB_ONBOARD_DEV``
+  for compatibility with Linux.
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 9880a45c70a6..3eea4e640572 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -255,7 +255,7 @@ CONFIG_USB_DWC2_GADGET=y
 CONFIG_USB_EHCI=y
 CONFIG_USB_ULPI=y
 CONFIG_USB_STORAGE=y
-CONFIG_USB_ONBOARD_HUB=y
+CONFIG_USB_ONBOARD_DEV=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DFU=y
 CONFIG_USB_GADGET_SERIAL=y
diff --git a/arch/arm/configs/multi_v8_defconfig b/arch/arm/configs/multi_v8_defconfig
index a4685a90f850..3256f8ea7957 100644
--- a/arch/arm/configs/multi_v8_defconfig
+++ b/arch/arm/configs/multi_v8_defconfig
@@ -197,7 +197,7 @@ CONFIG_USB_DWC3=y
 CONFIG_USB_DWC3_DUAL_ROLE=y
 CONFIG_USB_EHCI=y
 CONFIG_USB_STORAGE=y
-CONFIG_USB_ONBOARD_HUB=y
+CONFIG_USB_ONBOARD_DEV=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_SERIAL=y
 CONFIG_USB_GADGET_FASTBOOT=y
diff --git a/arch/arm/configs/stm32mp_defconfig b/arch/arm/configs/stm32mp_defconfig
index 4b169993e902..366c9430d551 100644
--- a/arch/arm/configs/stm32mp_defconfig
+++ b/arch/arm/configs/stm32mp_defconfig
@@ -120,7 +120,7 @@ CONFIG_USB_DWC2_HOST=y
 CONFIG_USB_DWC2_GADGET=y
 CONFIG_USB_EHCI=y
 CONFIG_USB_STORAGE=y
-CONFIG_USB_ONBOARD_HUB=y
+CONFIG_USB_ONBOARD_DEV=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DFU=y
 CONFIG_USB_GADGET_SERIAL=y
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 01d193d072fe..f59b525f6276 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -623,7 +623,7 @@ int usb_host_detect(struct usb_host *host)
 {
 	int ret;
 
-	of_usb_host_probe_hubs(host);
+	of_usb_host_probe_devs(host);
 
 	if (!host->root_dev) {
 		if (host->init) {
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
index fde57fd74309..6fe80a0f176b 100644
--- a/drivers/usb/misc/Kconfig
+++ b/drivers/usb/misc/Kconfig
@@ -15,12 +15,12 @@ config USB_HUB_USB251XB
 	  parameters may be set in devicetree or platform data.
 	  Say Y or M here if you need to configure such a device via SMBus.
 
-config USB_ONBOARD_HUB
-	bool "Onboard USB hub support"
+config USB_ONBOARD_DEV
+	bool "Onboard USB hubs and devices support"
 	depends on OFDEVICE || COMPILE_TEST
 	help
-	  Say Y here if you want to support discrete onboard USB hubs that
-	  don't require an additional control bus for initialization, but
-	  need some non-trivial form of initialization, such as enabling a
-	  power regulator. An example for such a hub is the Realtek
-	  RTS5411.
+	  Say Y here if you want to support discrete onboard USB hubs
+	  that don't require an additional control bus for initialization,
+	  but need some non-trivial form of initialization, such as
+	  enabling a power regulator. An example for such device is the
+	  Realtek RTS5411 hub.
diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile
index e00f66a5ed1c..d8745a85de9b 100644
--- a/drivers/usb/misc/Makefile
+++ b/drivers/usb/misc/Makefile
@@ -4,4 +4,4 @@
 # (the ones that don't fit into any other categories)
 #
 obj-$(CONFIG_USB_HUB_USB251XB)		+= usb251xb.o
-obj-$(CONFIG_USB_ONBOARD_HUB)		+= onboard_usb_hub.o
+obj-$(CONFIG_USB_ONBOARD_DEV)		+= onboard_usb_dev.o
diff --git a/drivers/usb/misc/onboard_usb_hub.c b/drivers/usb/misc/onboard_usb_dev.c
similarity index 41%
rename from drivers/usb/misc/onboard_usb_hub.c
rename to drivers/usb/misc/onboard_usb_dev.c
index 603fd693a137..730f443dfefe 100644
--- a/drivers/usb/misc/onboard_usb_hub.c
+++ b/drivers/usb/misc/onboard_usb_dev.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Driver for onboard USB hubs
+ * Driver for onboard USB devices
  *
  * Copyright (c) 2022, Google LLC
  */
@@ -15,9 +15,9 @@
 #include <xfuncs.h>
 #include <linux/usb/usb.h>
 
-#include "onboard_usb_hub.h"
+#include "onboard_usb_dev.h"
 
-void of_usb_host_probe_hubs(struct usb_host *host)
+void of_usb_host_probe_devs(struct usb_host *host)
 {
 	struct device_node *np;
 
@@ -25,38 +25,38 @@ void of_usb_host_probe_hubs(struct usb_host *host)
 	if (!np)
 		return;
 
-	of_platform_populate(np, onboard_hub_match, host->hw_dev);
+	of_platform_populate(np, onboard_dev_match, host->hw_dev);
 }
 
-struct onboard_hub {
+struct onboard_dev {
 	struct regulator *vdd;
 	struct device *dev;
-	const struct onboard_hub_pdata *pdata;
+	const struct onboard_dev_pdata *pdata;
 	struct gpio_desc *reset_gpio;
 };
 
-static int onboard_hub_power_on(struct onboard_hub *hub)
+static int onboard_dev_power_on(struct onboard_dev *onboard_dev)
 {
 	int err;
 
-	err = regulator_enable(hub->vdd);
+	err = regulator_enable(onboard_dev->vdd);
 	if (err) {
-		dev_err(hub->dev, "failed to enable regulator: %pe\n",
+		dev_err(onboard_dev->dev, "failed to enable regulator: %pe\n",
 			ERR_PTR(err));
 		return err;
 	}
 
-	udelay(hub->pdata->reset_us);
-	gpiod_set_value(hub->reset_gpio, 0);
+	udelay(onboard_dev->pdata->reset_us);
+	gpiod_set_value(onboard_dev->reset_gpio, 0);
 
 	return 0;
 }
 
-static int onboard_hub_probe(struct device *dev)
+static int onboard_dev_probe(struct device *dev)
 {
 	struct device_node *peer_node;
 	struct device *peer_dev;
-	struct onboard_hub *hub;
+	struct onboard_dev *onboard_dev;
 
 	peer_node = of_parse_phandle(dev->of_node, "peer-hub", 0);
 	if (peer_node) {
@@ -65,34 +65,34 @@ static int onboard_hub_probe(struct device *dev)
 			return 0;
 	}
 
-	hub = xzalloc(sizeof(*hub));
+	onboard_dev = xzalloc(sizeof(*onboard_dev));
 
-	hub->pdata = device_get_match_data(dev);
-	if (!hub->pdata)
+	onboard_dev->pdata = device_get_match_data(dev);
+	if (!onboard_dev->pdata)
 		return -EINVAL;
 
-	hub->vdd = regulator_get(dev, "vdd");
-	if (IS_ERR(hub->vdd))
-		return PTR_ERR(hub->vdd);
+	onboard_dev->vdd = regulator_get(dev, "vdd");
+	if (IS_ERR(onboard_dev->vdd))
+		return PTR_ERR(onboard_dev->vdd);
 
-	hub->reset_gpio = gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
-	if (IS_ERR(hub->reset_gpio))
-		return dev_errp_probe(dev, hub->reset_gpio,
+	onboard_dev->reset_gpio = gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
+	if (IS_ERR(onboard_dev->reset_gpio))
+		return dev_errp_probe(dev, onboard_dev->reset_gpio,
 				     "failed to get reset GPIO\n");
 
-	hub->dev = dev;
-	dev->priv = hub;
+	onboard_dev->dev = dev;
+	dev->priv = onboard_dev;
 
-	return onboard_hub_power_on(hub);
+	return onboard_dev_power_on(onboard_dev);
 }
 
-static struct driver onboard_hub_driver = {
-	.name = "onboard-usb-hub",
-	.probe = onboard_hub_probe,
-	.of_compatible = onboard_hub_match,
+static struct driver onboard_dev_driver = {
+	.name = "onboard-usb-dev",
+	.probe = onboard_dev_probe,
+	.of_compatible = onboard_dev_match,
 };
-device_platform_driver(onboard_hub_driver);
+device_platform_driver(onboard_dev_driver);
 
 MODULE_AUTHOR("Matthias Kaehlcke <mka@chromium.org>");
-MODULE_DESCRIPTION("Driver for discrete onboard USB hubs");
+MODULE_DESCRIPTION("Driver for discrete onboard USB devices");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/usb/misc/onboard_usb_hub.h b/drivers/usb/misc/onboard_usb_dev.h
similarity index 64%
rename from drivers/usb/misc/onboard_usb_hub.h
rename to drivers/usb/misc/onboard_usb_dev.h
index e379ca811ad5..edb91485bd83 100644
--- a/drivers/usb/misc/onboard_usb_hub.h
+++ b/drivers/usb/misc/onboard_usb_dev.h
@@ -3,38 +3,38 @@
  * Copyright (c) 2022, Google LLC
  */
 
-#ifndef _USB_MISC_ONBOARD_USB_HUB_H
-#define _USB_MISC_ONBOARD_USB_HUB_H
+#ifndef _USB_MISC_ONBOARD_USB_DEV_H
+#define _USB_MISC_ONBOARD_USB_DEV_H
 
-struct onboard_hub_pdata {
+struct onboard_dev_pdata {
 	unsigned long reset_us;		/* reset pulse width in us */
 };
 
-static const struct onboard_hub_pdata microchip_usb424_data = {
+static const struct onboard_dev_pdata microchip_usb424_data = {
 	.reset_us = 1,
 };
 
-static const struct onboard_hub_pdata realtek_rts5411_data = {
+static const struct onboard_dev_pdata realtek_rts5411_data = {
 	.reset_us = 0,
 };
 
-static const struct onboard_hub_pdata ti_tusb8041_data = {
+static const struct onboard_dev_pdata ti_tusb8041_data = {
 	.reset_us = 3000,
 };
 
-static const struct onboard_hub_pdata genesys_gl850g_data = {
+static const struct onboard_dev_pdata genesys_gl850g_data = {
 	.reset_us = 3,
 };
 
-static const struct onboard_hub_pdata genesys_gl852g_data = {
+static const struct onboard_dev_pdata genesys_gl852g_data = {
 	.reset_us = 50,
 };
 
-static const struct onboard_hub_pdata vialab_vl817_data = {
+static const struct onboard_dev_pdata vialab_vl817_data = {
 	.reset_us = 10,
 };
 
-static const struct of_device_id onboard_hub_match[] = {
+static const struct of_device_id onboard_dev_match[] = {
 	{ .compatible = "usb424,2514", .data = &microchip_usb424_data, },
 	{ .compatible = "usb424,2517", .data = &microchip_usb424_data, },
 	{ .compatible = "usb451,8140", .data = &ti_tusb8041_data, },
@@ -50,6 +50,6 @@ static const struct of_device_id onboard_hub_match[] = {
 	{ .compatible = "usb2109,2817", .data = &vialab_vl817_data, },
 	{}
 };
-MODULE_DEVICE_TABLE(of, onboard_hub_match);
+MODULE_DEVICE_TABLE(of, onboard_dev_match);
 
-#endif /* _USB_MISC_ONBOARD_USB_HUB_H */
+#endif /* _USB_MISC_ONBOARD_USB_DEV_H */
diff --git a/include/linux/usb/usb.h b/include/linux/usb/usb.h
index ac980e8f0d4d..f2cc69751064 100644
--- a/include/linux/usb/usb.h
+++ b/include/linux/usb/usb.h
@@ -485,10 +485,10 @@ extern struct list_head usb_device_list;
 
 bool usb_hub_is_root_hub(struct usb_device *hdev);
 
-#ifdef CONFIG_USB_ONBOARD_HUB
-void of_usb_host_probe_hubs(struct usb_host *host);
+#ifdef CONFIG_USB_ONBOARD_DEV
+void of_usb_host_probe_devs(struct usb_host *host);
 #else
-static inline void of_usb_host_probe_hubs(struct usb_host *host)
+static inline void of_usb_host_probe_devs(struct usb_host *host)
 {
 }
 #endif
-- 
2.39.5




             reply	other threads:[~2025-05-06 12:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-06 10:21 Ahmad Fatoum [this message]
2025-05-08  7:38 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250506102147.3547357-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=fpg@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox