usb: udc: pxa: remove unused platform_data
Subsystems (5)
PATCH 1/1 usb: udc: pxa: remove unused platform_data
From: Arnd Bergmann <[email protected]>
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.
---
v2: add devm_gpiod_get() error check in pxa27x
use GPIOD_OUT_HIGH instead of low for pxa25x pullup
--- 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 | 37 ++++----------------- drivers/usb/gadget/udc/pxa27x_udc.h | 2 -- include/linux/platform_data/pxa2xx_udc.h | 15 --------- 8 files changed, 21 insertions(+), 92 deletions(-) delete mode 100644 arch/arm/mach-pxa/udc.h
arch/arm/mach-pxa/devices.c +0 -7
@@ -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, } };
arch/arm/mach-pxa/gumstix.c +0 -1
@@ -39,7 +39,6 @@#include "pxa25x.h" #include <linux/platform_data/mmc-pxamci.h> -#include "udc.h" #include "gumstix.h" #include "devices.h"
arch/arm/mach-pxa/udc.h deleted +0 -8
@@ -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); -
drivers/usb/gadget/udc/pxa25x_udc.c +13 -28
78 lines not on this page · raw message
drivers/usb/gadget/udc/pxa25x_udc.h +1 -1
@@ -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 ];
drivers/usb/gadget/udc/pxa27x_udc.c +7 -30
@@ -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; }
@@ -1521,7 +1513,7 @@ static int pxa_udc_pullup(struct usb_gadget *_gadget, int is_active)struct pxa_udc *udc =to_gadget_udc (_gadget);int ret; -if (!udc->gpiod && !udc->udc_command) +if (!udc->gpiod)return -EOPNOTSUPP ;dplus_pullup (udc, is_active);
@@ -2380,26 +2372,11 @@ 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 ); +if (IS_ERR (udc->gpiod)) +return PTR_ERR (udc->gpiod); udc->regs =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (udc->regs))
drivers/usb/gadget/udc/pxa27x_udc.h +0 -2
@@ -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;
include/linux/platform_data/pxa2xx_udc.h +0 -15
@@ -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_PXA27xextern void pxa27x_clear_otgph (void );#else
Signature · 1 line
2.39.5
Quoted 6 lines · Arnd Bergmann
None of the remaining boards put useful data into the
platform_datastructures, 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.
...
drivers/usb/gadget/udc/pxa25x_udc.c static int pxa25x_udc_probe(struct platform_device *pdev) · line 2337
Quoted 2 lines
drivers/usb/gadget/udc/pxa25x_udc.c +2
-0+ dev->pullup_gpio =devm_gpiod_get_index_optional (&pdev->dev,"pullup" ,0 , +GPIOD_OUT_HIGH );
While I gave a tag some time ago, I still wonder why we use _index variant here. With
struct device *dev = &pdev->dev;
it becomes just a single line (yes, 82 characters long).
dev->pullup_gpio = devm_gpiod_get_optional(dev, "pullup", GPIOD_OUT_HIGH);
drivers/usb/gadget/udc/pxa25x_udc.c static int pxa25x_udc_probe(struct platform_device *pdev) · line 2341
Quoted 4 lines
drivers/usb/gadget/udc/pxa25x_udc.c +4
-0+if (IS_ERR (dev->pullup_gpio)) { +dev_dbg (&pdev->dev, +"can't get pullup gpio err: %ld\n" , +PTR_ERR (dev->pullup_gpio));
This occupies more LOC than needed (also gpio --> GPIO).
dev_dbg(dev, "can't get pullup GPIO err: %ld\n", PTR_ERR(dev->pullup_gpio));
I even wouldn't mind this to be long single line
dev_dbg(dev, "can't get pullup GPIO: %ld\n", PTR_ERR(dev->pullup_gpio));
(I dropped ' err' part in this variant, though).
Quoted 3 lines
drivers/usb/gadget/udc/pxa25x_udc.c +2
-0+ retval =PTR_ERR (dev->pullup_gpio); + goto err; }
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 1 line · Andy Shevchenko
On Mon, Apr 27, 2026 at 04:32:10PM +0200, Arnd Bergmann wrote:
...
Quoted 5 lines
I even wouldn't mind this to be long single line
dev_dbg(dev, "can't get pullup GPIO: %ld\n", PTR_ERR(dev->pullup_gpio));(I dropped ' err' part in this variant, though).
Or even
dev_dbg(dev, "can't get pullup GPIO: %pe\n", dev->pullup_gpio);
which fits 80.
Signature · 2 lines
With Best Regards, Andy Shevchenko