linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/21] ARM: select legacy gpiolib interfaces where used
       [not found] <20250808151822.536879-1-arnd@kernel.org>
@ 2025-08-08 15:17 ` Arnd Bergmann
  2025-08-11  8:49   ` Krzysztof Kozlowski
  2025-08-08 15:18 ` [PATCH 19/21] usb: udc: pxa: remove unused platform_data Arnd Bergmann
  2025-08-08 15:18 ` [PATCH 20/21] ASoC: pxa: add GPIOLIB_LEGACY dependency Arnd Bergmann
  2 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
  To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Russell King, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Krzysztof Kozlowski
  Cc: Arnd Bergmann, Alim Akhtar, linux-arm-kernel, linux-kernel,
	linux-samsung-soc

From: Arnd Bergmann <arnd@arndb.de>

A few old machines have not been converted away from the old-style
gpiolib interfaces. Make these select the new CONFIG_GPIOLIB_LEGACY
symbol so the code still works where it is needed but can be left
out otherwise.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-mv78xx0/Kconfig     | 1 +
 arch/arm/mach-orion5x/Kconfig     | 1 +
 arch/arm/mach-pxa/Kconfig         | 1 +
 arch/arm/mach-s3c/Kconfig.s3c64xx | 1 +
 arch/arm/mach-sa1100/Kconfig      | 1 +
 5 files changed, 5 insertions(+)

diff --git a/arch/arm/mach-mv78xx0/Kconfig b/arch/arm/mach-mv78xx0/Kconfig
index 9de3bbc09c3a..670e6587827e 100644
--- a/arch/arm/mach-mv78xx0/Kconfig
+++ b/arch/arm/mach-mv78xx0/Kconfig
@@ -6,6 +6,7 @@ menuconfig ARCH_MV78XX0
 	depends on ATAGS
 	select CPU_FEROCEON
 	select GPIOLIB
+	select GPIOLIB_LEGACY
 	select MVEBU_MBUS
 	select FORCE_PCI
 	select PLAT_ORION_LEGACY
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
index ee449ca032d2..cef19bea6164 100644
--- a/arch/arm/mach-orion5x/Kconfig
+++ b/arch/arm/mach-orion5x/Kconfig
@@ -5,6 +5,7 @@ menuconfig ARCH_ORION5X
 	depends on CPU_LITTLE_ENDIAN
 	select CPU_FEROCEON
 	select GPIOLIB
+	select GPIOLIB_LEGACY
 	select MVEBU_MBUS
 	select FORCE_PCI
 	select PCI_QUIRKS
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 10e472f4fa43..66e26990e2c8 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -10,6 +10,7 @@ menuconfig ARCH_PXA
 	select CPU_XSCALE if !CPU_XSC3
 	select GPIO_PXA
 	select GPIOLIB
+	select GPIOLIB_LEGACY
 	select PLAT_PXA
 	help
 	  Support for Intel/Marvell's PXA2xx/PXA3xx processor line.
diff --git a/arch/arm/mach-s3c/Kconfig.s3c64xx b/arch/arm/mach-s3c/Kconfig.s3c64xx
index 8f40af063ad6..3f97fba8e4f5 100644
--- a/arch/arm/mach-s3c/Kconfig.s3c64xx
+++ b/arch/arm/mach-s3c/Kconfig.s3c64xx
@@ -101,6 +101,7 @@ config MACH_WLF_CRAGG_6410
 	depends on ATAGS
 	depends on I2C=y
 	select CPU_S3C6410
+	select GPIOLIB_LEGACY
 	select LEDS_GPIO_REGISTER
 	select S3C64XX_DEV_SPI0
 	select S3C64XX_SETUP_FB_24BPP
diff --git a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig
index 0fb4c24cfad5..e23700e0d6c8 100644
--- a/arch/arm/mach-sa1100/Kconfig
+++ b/arch/arm/mach-sa1100/Kconfig
@@ -13,6 +13,7 @@ menuconfig ARCH_SA1100
 	select CPU_FREQ
 	select CPU_SA1100
 	select GPIOLIB
+	select GPIOLIB_LEGACY
 	select IRQ_DOMAIN
 	select ISA
 	select NEED_MACH_MEMORY_H
-- 
2.39.5



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

* [PATCH 19/21] usb: udc: pxa: remove unused platform_data
       [not found] <20250808151822.536879-1-arnd@kernel.org>
  2025-08-08 15:17 ` [PATCH 01/21] ARM: select legacy gpiolib interfaces where used Arnd Bergmann
@ 2025-08-08 15:18 ` Arnd Bergmann
  2025-08-09 10:15   ` Andy Shevchenko
  2025-08-11 22:12   ` Dmitry Torokhov
  2025-08-08 15:18 ` [PATCH 20/21] ASoC: pxa: add GPIOLIB_LEGACY dependency Arnd Bergmann
  2 siblings, 2 replies; 6+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:18 UTC (permalink / raw)
  To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Russell King, Greg Kroah-Hartman
  Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Andy Shevchenko,
	linux-arm-kernel, linux-kernel, linux-usb

From: Arnd Bergmann <arnd@arndb.de>

None of the remaining boards put useful data into the platform_data
structures, so effectively this only works with DT based probing.

Remove all code that references this data, to stop using the legacy
gpiolib interfaces. The pxa27x version already supports gpio
descriptors, while the pxa25x version now does it the same way.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-pxa/devices.c              |  7 ----
 arch/arm/mach-pxa/gumstix.c              |  1 -
 arch/arm/mach-pxa/udc.h                  |  8 -----
 drivers/usb/gadget/udc/pxa25x_udc.c      | 41 ++++++++----------------
 drivers/usb/gadget/udc/pxa25x_udc.h      |  2 +-
 drivers/usb/gadget/udc/pxa27x_udc.c      | 35 +++-----------------
 drivers/usb/gadget/udc/pxa27x_udc.h      |  2 --
 include/linux/platform_data/pxa2xx_udc.h | 15 ---------
 8 files changed, 19 insertions(+), 92 deletions(-)
 delete mode 100644 arch/arm/mach-pxa/udc.h

diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index 7695cfce01a1..edad956a1483 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -11,7 +11,6 @@
 #include <linux/platform_data/i2c-pxa.h>
 #include <linux/soc/pxa/cpu.h>
 
-#include "udc.h"
 #include <linux/platform_data/video-pxafb.h>
 #include <linux/platform_data/mmc-pxamci.h>
 #include "irqs.h"
@@ -83,10 +82,6 @@ void __init pxa_set_mci_info(const struct pxamci_platform_data *info,
 		pr_err("Unable to create mci device: %d\n", err);
 }
 
-static struct pxa2xx_udc_mach_info pxa_udc_info = {
-	.gpio_pullup = -1,
-};
-
 static struct resource pxa2xx_udc_resources[] = {
 	[0] = {
 		.start	= 0x40600000,
@@ -108,7 +103,6 @@ struct platform_device pxa25x_device_udc = {
 	.resource	= pxa2xx_udc_resources,
 	.num_resources	= ARRAY_SIZE(pxa2xx_udc_resources),
 	.dev		=  {
-		.platform_data	= &pxa_udc_info,
 		.dma_mask	= &udc_dma_mask,
 	}
 };
@@ -119,7 +113,6 @@ struct platform_device pxa27x_device_udc = {
 	.resource	= pxa2xx_udc_resources,
 	.num_resources	= ARRAY_SIZE(pxa2xx_udc_resources),
 	.dev		=  {
-		.platform_data	= &pxa_udc_info,
 		.dma_mask	= &udc_dma_mask,
 	}
 };
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
index 1713bdf3b71e..6074815a4bca 100644
--- a/arch/arm/mach-pxa/gumstix.c
+++ b/arch/arm/mach-pxa/gumstix.c
@@ -39,7 +39,6 @@
 
 #include "pxa25x.h"
 #include <linux/platform_data/mmc-pxamci.h>
-#include "udc.h"
 #include "gumstix.h"
 #include "devices.h"
 
diff --git a/arch/arm/mach-pxa/udc.h b/arch/arm/mach-pxa/udc.h
deleted file mode 100644
index 9a827e32db98..000000000000
--- a/arch/arm/mach-pxa/udc.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * arch/arm/mach-pxa/include/mach/udc.h
- *
- */
-#include <linux/platform_data/pxa2xx_udc.h>
-
-extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info);
-
diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
index b97fb7b0cb2c..bad151aedec1 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.c
+++ b/drivers/usb/gadget/udc/pxa25x_udc.c
@@ -12,7 +12,7 @@
 /* #define VERBOSE_DEBUG */
 
 #include <linux/device.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/ioport.h>
@@ -261,24 +261,12 @@ static void nuke (struct pxa25x_ep *, int status);
 /* one GPIO should control a D+ pullup, so host sees this device (or not) */
 static void pullup_off(void)
 {
-	struct pxa2xx_udc_mach_info		*mach = the_controller->mach;
-	int off_level = mach->gpio_pullup_inverted;
-
-	if (gpio_is_valid(mach->gpio_pullup))
-		gpio_set_value(mach->gpio_pullup, off_level);
-	else if (mach->udc_command)
-		mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT);
+	gpiod_set_value(the_controller->pullup_gpio, 0);
 }
 
 static void pullup_on(void)
 {
-	struct pxa2xx_udc_mach_info		*mach = the_controller->mach;
-	int on_level = !mach->gpio_pullup_inverted;
-
-	if (gpio_is_valid(mach->gpio_pullup))
-		gpio_set_value(mach->gpio_pullup, on_level);
-	else if (mach->udc_command)
-		mach->udc_command(PXA2XX_UDC_CMD_CONNECT);
+	gpiod_set_value(the_controller->pullup_gpio, 1);
 }
 
 #if defined(CONFIG_CPU_BIG_ENDIAN)
@@ -1190,8 +1178,7 @@ static int pxa25x_udc_pullup(struct usb_gadget *_gadget, int is_active)
 
 	udc = container_of(_gadget, struct pxa25x_udc, gadget);
 
-	/* not all boards support pullup control */
-	if (!gpio_is_valid(udc->mach->gpio_pullup) && !udc->mach->udc_command)
+	if (!udc->pullup_gpio)
 		return -EOPNOTSUPP;
 
 	udc->pullup = (is_active != 0);
@@ -2343,19 +2330,17 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
 
 	/* other non-static parts of init */
 	dev->dev = &pdev->dev;
-	dev->mach = dev_get_platdata(&pdev->dev);
 
 	dev->transceiver = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
 
-	if (gpio_is_valid(dev->mach->gpio_pullup)) {
-		retval = devm_gpio_request_one(&pdev->dev, dev->mach->gpio_pullup,
-					       GPIOF_OUT_INIT_LOW, "pca25x_udc GPIO PULLUP");
-		if (retval) {
-			dev_dbg(&pdev->dev,
-				"can't get pullup gpio %d, err: %d\n",
-				dev->mach->gpio_pullup, retval);
-			goto err;
-		}
+	dev->pullup_gpio = devm_gpiod_get_index_optional(&pdev->dev, "pullup", 0,
+						    GPIOD_OUT_LOW);
+	if (IS_ERR(dev->pullup_gpio)) {
+		dev_dbg(&pdev->dev,
+			"can't get pullup gpio err: %ld\n",
+			PTR_ERR(dev->pullup_gpio));
+		retval = PTR_ERR(dev->pullup_gpio);
+		goto err;
 	}
 
 	timer_setup(&dev->timer, udc_watchdog, 0);
@@ -2439,7 +2424,7 @@ static int pxa25x_udc_suspend(struct platform_device *dev, pm_message_t state)
 	struct pxa25x_udc	*udc = platform_get_drvdata(dev);
 	unsigned long flags;
 
-	if (!gpio_is_valid(udc->mach->gpio_pullup) && !udc->mach->udc_command)
+	if (!udc->pullup_gpio)
 		WARNING("USB host won't detect disconnect!\n");
 	udc->suspended = 1;
 
diff --git a/drivers/usb/gadget/udc/pxa25x_udc.h b/drivers/usb/gadget/udc/pxa25x_udc.h
index 6ab6047edc83..3452cf54286c 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.h
+++ b/drivers/usb/gadget/udc/pxa25x_udc.h
@@ -112,7 +112,7 @@ struct pxa25x_udc {
 
 	struct device				*dev;
 	struct clk				*clk;
-	struct pxa2xx_udc_mach_info		*mach;
+	struct gpio_desc			*pullup_gpio;
 	struct usb_phy				*transceiver;
 	u64					dma_mask;
 	struct pxa25x_ep			ep [PXA_UDC_NUM_ENDPOINTS];
diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c
index 897f53601b5b..dbce931d7d3b 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -17,7 +17,6 @@
 #include <linux/proc_fs.h>
 #include <linux/clk.h>
 #include <linux/irq.h>
-#include <linux/gpio.h>
 #include <linux/gpio/consumer.h>
 #include <linux/slab.h>
 #include <linux/string_choices.h>
@@ -1423,14 +1422,7 @@ static const struct usb_ep_ops pxa_ep_ops = {
  */
 static void dplus_pullup(struct pxa_udc *udc, int on)
 {
-	if (udc->gpiod) {
-		gpiod_set_value(udc->gpiod, on);
-	} else if (udc->udc_command) {
-		if (on)
-			udc->udc_command(PXA2XX_UDC_CMD_CONNECT);
-		else
-			udc->udc_command(PXA2XX_UDC_CMD_DISCONNECT);
-	}
+	gpiod_set_value(udc->gpiod, on);
 	udc->pullup_on = on;
 }
 
@@ -1520,7 +1512,7 @@ static int pxa_udc_pullup(struct usb_gadget *_gadget, int is_active)
 {
 	struct pxa_udc *udc = to_gadget_udc(_gadget);
 
-	if (!udc->gpiod && !udc->udc_command)
+	if (!udc->gpiod)
 		return -EOPNOTSUPP;
 
 	dplus_pullup(udc, is_active);
@@ -2354,26 +2346,9 @@ MODULE_DEVICE_TABLE(of, udc_pxa_dt_ids);
 static int pxa_udc_probe(struct platform_device *pdev)
 {
 	struct pxa_udc *udc = &memory;
-	int retval = 0, gpio;
-	struct pxa2xx_udc_mach_info *mach = dev_get_platdata(&pdev->dev);
-
-	if (mach) {
-		gpio = mach->gpio_pullup;
-		if (gpio_is_valid(gpio)) {
-			retval = devm_gpio_request_one(&pdev->dev, gpio,
-						       GPIOF_OUT_INIT_LOW,
-						       "USB D+ pullup");
-			if (retval)
-				return retval;
-			udc->gpiod = gpio_to_desc(mach->gpio_pullup);
-
-			if (mach->gpio_pullup_inverted ^ gpiod_is_active_low(udc->gpiod))
-				gpiod_toggle_active_low(udc->gpiod);
-		}
-		udc->udc_command = mach->udc_command;
-	} else {
-		udc->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS);
-	}
+	int retval = 0;
+
+	udc->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS);
 
 	udc->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(udc->regs))
diff --git a/drivers/usb/gadget/udc/pxa27x_udc.h b/drivers/usb/gadget/udc/pxa27x_udc.h
index 31bf79ce931c..2c28b691010a 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.h
+++ b/drivers/usb/gadget/udc/pxa27x_udc.h
@@ -426,7 +426,6 @@ struct udc_stats {
  * @usb_gadget: udc gadget structure
  * @driver: bound gadget (zero, g_ether, g_mass_storage, ...)
  * @dev: device
- * @udc_command: machine specific function to activate D+ pullup
  * @gpiod: gpio descriptor of gpio for D+ pullup (or NULL if none)
  * @transceiver: external transceiver to handle vbus sense and D+ pullup
  * @ep0state: control endpoint state machine state
@@ -452,7 +451,6 @@ struct pxa_udc {
 	struct usb_gadget			gadget;
 	struct usb_gadget_driver		*driver;
 	struct device				*dev;
-	void					(*udc_command)(int);
 	struct gpio_desc			*gpiod;
 	struct usb_phy				*transceiver;
 
diff --git a/include/linux/platform_data/pxa2xx_udc.h b/include/linux/platform_data/pxa2xx_udc.h
index bc99cc6a3c5f..c1e4d03bae2c 100644
--- a/include/linux/platform_data/pxa2xx_udc.h
+++ b/include/linux/platform_data/pxa2xx_udc.h
@@ -10,21 +10,6 @@
 #ifndef PXA2XX_UDC_H
 #define PXA2XX_UDC_H
 
-struct pxa2xx_udc_mach_info {
-        int  (*udc_is_connected)(void);		/* do we see host? */
-        void (*udc_command)(int cmd);
-#define	PXA2XX_UDC_CMD_CONNECT		0	/* let host see us */
-#define	PXA2XX_UDC_CMD_DISCONNECT	1	/* so host won't see us */
-
-	/* Boards following the design guidelines in the developer's manual,
-	 * with on-chip GPIOs not Lubbock's weird hardware, can have a sane
-	 * VBUS IRQ and omit the methods above.  Store the GPIO number
-	 * here.  Note that sometimes the signals go through inverters...
-	 */
-	bool	gpio_pullup_inverted;
-	int	gpio_pullup;			/* high == pullup activated */
-};
-
 #ifdef CONFIG_PXA27x
 extern void pxa27x_clear_otgph(void);
 #else
-- 
2.39.5



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

* [PATCH 20/21] ASoC: pxa: add GPIOLIB_LEGACY dependency
       [not found] <20250808151822.536879-1-arnd@kernel.org>
  2025-08-08 15:17 ` [PATCH 01/21] ARM: select legacy gpiolib interfaces where used Arnd Bergmann
  2025-08-08 15:18 ` [PATCH 19/21] usb: udc: pxa: remove unused platform_data Arnd Bergmann
@ 2025-08-08 15:18 ` Arnd Bergmann
  2 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:18 UTC (permalink / raw)
  To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai
  Cc: Arnd Bergmann, Kuninori Morimoto, linux-arm-kernel, linux-sound,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The pxa27x platform uses the legacy gpiolib interfaces, including
in its sound drivers:

sound/arm/pxa2xx-ac97-lib.c: In function 'pxa2xx_ac97_hw_probe':
sound/arm/pxa2xx-ac97-lib.c:374:23: error: implicit declaration of function 'gpio_request_one' [-Wimplicit-function-declaration]
  374 |                 ret = gpio_request_one(reset_gpio, GPIOF_OUT_INIT_HIGH,

Make sure we don't select those drivers for compile-testing unless
we are building for a pxa27x system, or CONFIG_GPIOLIB_LEGACY is
already enabled.

The SND_PXA_SOC_SSP driver accidentally used a dependency on PLAT_PXA,
which includes both ARCH_PXA and ARCH_MMP, but it is only used on
the former.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/soc/pxa/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig
index e026f9912a6d..e54abcd39f79 100644
--- a/sound/soc/pxa/Kconfig
+++ b/sound/soc/pxa/Kconfig
@@ -3,7 +3,7 @@ menu "PXA"
 
 config SND_PXA2XX_SOC
 	tristate "SoC Audio for the Intel PXA2xx chip"
-	depends on ARCH_PXA || COMPILE_TEST
+	depends on ARCH_PXA || (COMPILE_TEST && GPIOLIB_LEGACY)
 	select SND_PXA2XX_LIB
 	help
 	  Say Y or M if you want to add support for codecs attached to
@@ -26,7 +26,7 @@ config SND_PXA2XX_SOC_I2S
 
 config SND_PXA_SOC_SSP
 	tristate "Soc Audio via PXA2xx/PXA3xx SSP ports"
-	depends on PLAT_PXA
+	depends on ARCH_PXA
 	select PXA_SSP
 	select SND_PXA2XX_LIB
 
-- 
2.39.5



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

* Re: [PATCH 19/21] usb: udc: pxa: remove unused platform_data
  2025-08-08 15:18 ` [PATCH 19/21] usb: udc: pxa: remove unused platform_data Arnd Bergmann
@ 2025-08-09 10:15   ` Andy Shevchenko
  2025-08-11 22:12   ` Dmitry Torokhov
  1 sibling, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-08-09 10:15 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Russell King, Greg Kroah-Hartman,
	Arnd Bergmann, Thomas Gleixner, Ingo Molnar, linux-arm-kernel,
	linux-kernel, linux-usb

On Fri, Aug 08, 2025 at 05:18:04PM +0200, Arnd Bergmann wrote:
> 
> None of the remaining boards put useful data into the platform_data
> structures, so effectively this only works with DT based probing.
> 
> Remove all code that references this data, to stop using the legacy
> gpiolib interfaces. The pxa27x version already supports gpio
> descriptors, while the pxa25x version now does it the same way.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
See a comment below.

...

>  static int pxa_udc_probe(struct platform_device *pdev)
>  {
>  	struct pxa_udc *udc = &memory;
> -	int retval = 0, gpio;
> -	struct pxa2xx_udc_mach_info *mach = dev_get_platdata(&pdev->dev);
> -
> -	if (mach) {
> -		gpio = mach->gpio_pullup;
> -		if (gpio_is_valid(gpio)) {
> -			retval = devm_gpio_request_one(&pdev->dev, gpio,
> -						       GPIOF_OUT_INIT_LOW,
> -						       "USB D+ pullup");
> -			if (retval)
> -				return retval;
> -			udc->gpiod = gpio_to_desc(mach->gpio_pullup);
> -
> -			if (mach->gpio_pullup_inverted ^ gpiod_is_active_low(udc->gpiod))
> -				gpiod_toggle_active_low(udc->gpiod);
> -		}
> -		udc->udc_command = mach->udc_command;
> -	} else {
> -		udc->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS);
> -	}
> +	int retval = 0;
> +
> +	udc->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS);

Missed error check, in particular it will ignore deferred probe case.

>  	udc->regs = devm_platform_ioremap_resource(pdev, 0);

-- 
With Best Regards,
Andy Shevchenko




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

* Re: [PATCH 01/21] ARM: select legacy gpiolib interfaces where used
  2025-08-08 15:17 ` [PATCH 01/21] ARM: select legacy gpiolib interfaces where used Arnd Bergmann
@ 2025-08-11  8:49   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-11  8:49 UTC (permalink / raw)
  To: Arnd Bergmann, Bartosz Golaszewski, Linus Walleij, linux-gpio,
	Andrew Lunn, Sebastian Hesselbarth, Gregory Clement, Russell King,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik
  Cc: Arnd Bergmann, Alim Akhtar, linux-arm-kernel, linux-kernel,
	linux-samsung-soc

On 08/08/2025 17:17, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> A few old machines have not been converted away from the old-style
> gpiolib interfaces. Make these select the new CONFIG_GPIOLIB_LEGACY
> symbol so the code still works where it is needed but can be left
> out otherwise.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


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

* Re: [PATCH 19/21] usb: udc: pxa: remove unused platform_data
  2025-08-08 15:18 ` [PATCH 19/21] usb: udc: pxa: remove unused platform_data Arnd Bergmann
  2025-08-09 10:15   ` Andy Shevchenko
@ 2025-08-11 22:12   ` Dmitry Torokhov
  1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 22:12 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Russell King, Greg Kroah-Hartman,
	Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Andy Shevchenko,
	linux-arm-kernel, linux-kernel, linux-usb

On Fri, Aug 08, 2025 at 05:18:04PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> None of the remaining boards put useful data into the platform_data
> structures, so effectively this only works with DT based probing.
> 
> Remove all code that references this data, to stop using the legacy
> gpiolib interfaces. The pxa27x version already supports gpio
> descriptors, while the pxa25x version now does it the same way.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  arch/arm/mach-pxa/devices.c              |  7 ----
>  arch/arm/mach-pxa/gumstix.c              |  1 -
>  arch/arm/mach-pxa/udc.h                  |  8 -----
>  drivers/usb/gadget/udc/pxa25x_udc.c      | 41 ++++++++----------------
>  drivers/usb/gadget/udc/pxa25x_udc.h      |  2 +-
>  drivers/usb/gadget/udc/pxa27x_udc.c      | 35 +++-----------------
>  drivers/usb/gadget/udc/pxa27x_udc.h      |  2 --
>  include/linux/platform_data/pxa2xx_udc.h | 15 ---------
>  8 files changed, 19 insertions(+), 92 deletions(-)
>  delete mode 100644 arch/arm/mach-pxa/udc.h
> 
> diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
> index 7695cfce01a1..edad956a1483 100644
> --- a/arch/arm/mach-pxa/devices.c
> +++ b/arch/arm/mach-pxa/devices.c
> @@ -11,7 +11,6 @@
>  #include <linux/platform_data/i2c-pxa.h>
>  #include <linux/soc/pxa/cpu.h>
>  
> -#include "udc.h"
>  #include <linux/platform_data/video-pxafb.h>
>  #include <linux/platform_data/mmc-pxamci.h>
>  #include "irqs.h"
> @@ -83,10 +82,6 @@ void __init pxa_set_mci_info(const struct pxamci_platform_data *info,
>  		pr_err("Unable to create mci device: %d\n", err);
>  }
>  
> -static struct pxa2xx_udc_mach_info pxa_udc_info = {
> -	.gpio_pullup = -1,
> -};
> -
>  static struct resource pxa2xx_udc_resources[] = {
>  	[0] = {
>  		.start	= 0x40600000,
> @@ -108,7 +103,6 @@ struct platform_device pxa25x_device_udc = {
>  	.resource	= pxa2xx_udc_resources,
>  	.num_resources	= ARRAY_SIZE(pxa2xx_udc_resources),
>  	.dev		=  {
> -		.platform_data	= &pxa_udc_info,
>  		.dma_mask	= &udc_dma_mask,
>  	}
>  };
> @@ -119,7 +113,6 @@ struct platform_device pxa27x_device_udc = {
>  	.resource	= pxa2xx_udc_resources,
>  	.num_resources	= ARRAY_SIZE(pxa2xx_udc_resources),
>  	.dev		=  {
> -		.platform_data	= &pxa_udc_info,
>  		.dma_mask	= &udc_dma_mask,
>  	}
>  };
> diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
> index 1713bdf3b71e..6074815a4bca 100644
> --- a/arch/arm/mach-pxa/gumstix.c
> +++ b/arch/arm/mach-pxa/gumstix.c
> @@ -39,7 +39,6 @@
>  
>  #include "pxa25x.h"
>  #include <linux/platform_data/mmc-pxamci.h>
> -#include "udc.h"
>  #include "gumstix.h"
>  #include "devices.h"
>  
> diff --git a/arch/arm/mach-pxa/udc.h b/arch/arm/mach-pxa/udc.h
> deleted file mode 100644
> index 9a827e32db98..000000000000
> --- a/arch/arm/mach-pxa/udc.h
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -/*
> - * arch/arm/mach-pxa/include/mach/udc.h
> - *
> - */
> -#include <linux/platform_data/pxa2xx_udc.h>
> -
> -extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info);
> -
> diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
> index b97fb7b0cb2c..bad151aedec1 100644
> --- a/drivers/usb/gadget/udc/pxa25x_udc.c
> +++ b/drivers/usb/gadget/udc/pxa25x_udc.c
> @@ -12,7 +12,7 @@
>  /* #define VERBOSE_DEBUG */
>  
>  #include <linux/device.h>
> -#include <linux/gpio.h>
> +#include <linux/gpio/consumer.h>
>  #include <linux/module.h>
>  #include <linux/kernel.h>
>  #include <linux/ioport.h>
> @@ -261,24 +261,12 @@ static void nuke (struct pxa25x_ep *, int status);
>  /* one GPIO should control a D+ pullup, so host sees this device (or not) */
>  static void pullup_off(void)
>  {
> -	struct pxa2xx_udc_mach_info		*mach = the_controller->mach;
> -	int off_level = mach->gpio_pullup_inverted;
> -
> -	if (gpio_is_valid(mach->gpio_pullup))
> -		gpio_set_value(mach->gpio_pullup, off_level);
> -	else if (mach->udc_command)
> -		mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT);
> +	gpiod_set_value(the_controller->pullup_gpio, 0);
>  }
>  
>  static void pullup_on(void)
>  {
> -	struct pxa2xx_udc_mach_info		*mach = the_controller->mach;
> -	int on_level = !mach->gpio_pullup_inverted;
> -
> -	if (gpio_is_valid(mach->gpio_pullup))
> -		gpio_set_value(mach->gpio_pullup, on_level);
> -	else if (mach->udc_command)
> -		mach->udc_command(PXA2XX_UDC_CMD_CONNECT);
> +	gpiod_set_value(the_controller->pullup_gpio, 1);
>  }
>  
>  #if defined(CONFIG_CPU_BIG_ENDIAN)
> @@ -1190,8 +1178,7 @@ static int pxa25x_udc_pullup(struct usb_gadget *_gadget, int is_active)
>  
>  	udc = container_of(_gadget, struct pxa25x_udc, gadget);
>  
> -	/* not all boards support pullup control */
> -	if (!gpio_is_valid(udc->mach->gpio_pullup) && !udc->mach->udc_command)
> +	if (!udc->pullup_gpio)
>  		return -EOPNOTSUPP;
>  
>  	udc->pullup = (is_active != 0);
> @@ -2343,19 +2330,17 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
>  
>  	/* other non-static parts of init */
>  	dev->dev = &pdev->dev;
> -	dev->mach = dev_get_platdata(&pdev->dev);
>  
>  	dev->transceiver = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
>  
> -	if (gpio_is_valid(dev->mach->gpio_pullup)) {
> -		retval = devm_gpio_request_one(&pdev->dev, dev->mach->gpio_pullup,
> -					       GPIOF_OUT_INIT_LOW, "pca25x_udc GPIO PULLUP");
> -		if (retval) {
> -			dev_dbg(&pdev->dev,
> -				"can't get pullup gpio %d, err: %d\n",
> -				dev->mach->gpio_pullup, retval);
> -			goto err;
> -		}
> +	dev->pullup_gpio = devm_gpiod_get_index_optional(&pdev->dev, "pullup", 0,
> +						    GPIOD_OUT_LOW);

I think this should be GPIOD_OUT_HIGH: you want this to be active and
GPIO is likely "active low".

Thanks.

-- 
Dmitry


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

end of thread, other threads:[~2025-08-11 22:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250808151822.536879-1-arnd@kernel.org>
2025-08-08 15:17 ` [PATCH 01/21] ARM: select legacy gpiolib interfaces where used Arnd Bergmann
2025-08-11  8:49   ` Krzysztof Kozlowski
2025-08-08 15:18 ` [PATCH 19/21] usb: udc: pxa: remove unused platform_data Arnd Bergmann
2025-08-09 10:15   ` Andy Shevchenko
2025-08-11 22:12   ` Dmitry Torokhov
2025-08-08 15:18 ` [PATCH 20/21] ASoC: pxa: add GPIOLIB_LEGACY dependency Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).