mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
usb: udc: pxa: remove unused platform_data
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> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://patch.msgid.link/20260427143300.2887692-1-arnd@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
0677deacad
commit
25bd55f460
|
|
@ -11,7 +11,6 @@
|
||||||
#include <linux/platform_data/i2c-pxa.h>
|
#include <linux/platform_data/i2c-pxa.h>
|
||||||
#include <linux/soc/pxa/cpu.h>
|
#include <linux/soc/pxa/cpu.h>
|
||||||
|
|
||||||
#include "udc.h"
|
|
||||||
#include <linux/platform_data/video-pxafb.h>
|
#include <linux/platform_data/video-pxafb.h>
|
||||||
#include <linux/platform_data/mmc-pxamci.h>
|
#include <linux/platform_data/mmc-pxamci.h>
|
||||||
#include "irqs.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);
|
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[] = {
|
static struct resource pxa2xx_udc_resources[] = {
|
||||||
[0] = {
|
[0] = {
|
||||||
.start = 0x40600000,
|
.start = 0x40600000,
|
||||||
|
|
@ -108,7 +103,6 @@ struct platform_device pxa25x_device_udc = {
|
||||||
.resource = pxa2xx_udc_resources,
|
.resource = pxa2xx_udc_resources,
|
||||||
.num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
|
.num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
|
||||||
.dev = {
|
.dev = {
|
||||||
.platform_data = &pxa_udc_info,
|
|
||||||
.dma_mask = &udc_dma_mask,
|
.dma_mask = &udc_dma_mask,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -119,7 +113,6 @@ struct platform_device pxa27x_device_udc = {
|
||||||
.resource = pxa2xx_udc_resources,
|
.resource = pxa2xx_udc_resources,
|
||||||
.num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
|
.num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
|
||||||
.dev = {
|
.dev = {
|
||||||
.platform_data = &pxa_udc_info,
|
|
||||||
.dma_mask = &udc_dma_mask,
|
.dma_mask = &udc_dma_mask,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@
|
||||||
|
|
||||||
#include "pxa25x.h"
|
#include "pxa25x.h"
|
||||||
#include <linux/platform_data/mmc-pxamci.h>
|
#include <linux/platform_data/mmc-pxamci.h>
|
||||||
#include "udc.h"
|
|
||||||
#include "gumstix.h"
|
#include "gumstix.h"
|
||||||
#include "devices.h"
|
#include "devices.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
|
||||||
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
/* #define VERBOSE_DEBUG */
|
/* #define VERBOSE_DEBUG */
|
||||||
|
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio/consumer.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/ioport.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) */
|
/* one GPIO should control a D+ pullup, so host sees this device (or not) */
|
||||||
static void pullup_off(void)
|
static void pullup_off(void)
|
||||||
{
|
{
|
||||||
struct pxa2xx_udc_mach_info *mach = the_controller->mach;
|
gpiod_set_value(the_controller->pullup_gpio, 0);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pullup_on(void)
|
static void pullup_on(void)
|
||||||
{
|
{
|
||||||
struct pxa2xx_udc_mach_info *mach = the_controller->mach;
|
gpiod_set_value(the_controller->pullup_gpio, 1);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_CPU_BIG_ENDIAN)
|
#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);
|
udc = container_of(_gadget, struct pxa25x_udc, gadget);
|
||||||
|
|
||||||
/* not all boards support pullup control */
|
if (!udc->pullup_gpio)
|
||||||
if (!gpio_is_valid(udc->mach->gpio_pullup) && !udc->mach->udc_command)
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
udc->pullup = (is_active != 0);
|
udc->pullup = (is_active != 0);
|
||||||
|
|
@ -2343,20 +2330,18 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
/* other non-static parts of init */
|
/* other non-static parts of init */
|
||||||
dev->dev = &pdev->dev;
|
dev->dev = &pdev->dev;
|
||||||
dev->mach = dev_get_platdata(&pdev->dev);
|
|
||||||
|
|
||||||
dev->transceiver = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
|
dev->transceiver = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
|
||||||
|
|
||||||
if (gpio_is_valid(dev->mach->gpio_pullup)) {
|
dev->pullup_gpio = devm_gpiod_get_index_optional(&pdev->dev, "pullup", 0,
|
||||||
retval = devm_gpio_request_one(&pdev->dev, dev->mach->gpio_pullup,
|
GPIOD_OUT_HIGH);
|
||||||
GPIOF_OUT_INIT_LOW, "pca25x_udc GPIO PULLUP");
|
if (IS_ERR(dev->pullup_gpio)) {
|
||||||
if (retval) {
|
|
||||||
dev_dbg(&pdev->dev,
|
dev_dbg(&pdev->dev,
|
||||||
"can't get pullup gpio %d, err: %d\n",
|
"can't get pullup gpio err: %ld\n",
|
||||||
dev->mach->gpio_pullup, retval);
|
PTR_ERR(dev->pullup_gpio));
|
||||||
|
retval = PTR_ERR(dev->pullup_gpio);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
timer_setup(&dev->timer, udc_watchdog, 0);
|
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);
|
struct pxa25x_udc *udc = platform_get_drvdata(dev);
|
||||||
unsigned long flags;
|
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");
|
WARNING("USB host won't detect disconnect!\n");
|
||||||
udc->suspended = 1;
|
udc->suspended = 1;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ struct pxa25x_udc {
|
||||||
|
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
struct pxa2xx_udc_mach_info *mach;
|
struct gpio_desc *pullup_gpio;
|
||||||
struct usb_phy *transceiver;
|
struct usb_phy *transceiver;
|
||||||
u64 dma_mask;
|
u64 dma_mask;
|
||||||
struct pxa25x_ep ep [PXA_UDC_NUM_ENDPOINTS];
|
struct pxa25x_ep ep [PXA_UDC_NUM_ENDPOINTS];
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/irq.h>
|
#include <linux/irq.h>
|
||||||
#include <linux/gpio.h>
|
|
||||||
#include <linux/gpio/consumer.h>
|
#include <linux/gpio/consumer.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/string_choices.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)
|
static void dplus_pullup(struct pxa_udc *udc, int on)
|
||||||
{
|
{
|
||||||
if (udc->gpiod) {
|
|
||||||
gpiod_set_value(udc->gpiod, on);
|
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);
|
|
||||||
}
|
|
||||||
udc->pullup_on = 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);
|
struct pxa_udc *udc = to_gadget_udc(_gadget);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!udc->gpiod && !udc->udc_command)
|
if (!udc->gpiod)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
dplus_pullup(udc, is_active);
|
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)
|
static int pxa_udc_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct pxa_udc *udc = &memory;
|
struct pxa_udc *udc = &memory;
|
||||||
int retval = 0, gpio;
|
int retval = 0;
|
||||||
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);
|
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);
|
udc->regs = devm_platform_ioremap_resource(pdev, 0);
|
||||||
if (IS_ERR(udc->regs))
|
if (IS_ERR(udc->regs))
|
||||||
|
|
|
||||||
|
|
@ -426,7 +426,6 @@ struct udc_stats {
|
||||||
* @usb_gadget: udc gadget structure
|
* @usb_gadget: udc gadget structure
|
||||||
* @driver: bound gadget (zero, g_ether, g_mass_storage, ...)
|
* @driver: bound gadget (zero, g_ether, g_mass_storage, ...)
|
||||||
* @dev: device
|
* @dev: device
|
||||||
* @udc_command: machine specific function to activate D+ pullup
|
|
||||||
* @gpiod: gpio descriptor of gpio for D+ pullup (or NULL if none)
|
* @gpiod: gpio descriptor of gpio for D+ pullup (or NULL if none)
|
||||||
* @transceiver: external transceiver to handle vbus sense and D+ pullup
|
* @transceiver: external transceiver to handle vbus sense and D+ pullup
|
||||||
* @ep0state: control endpoint state machine state
|
* @ep0state: control endpoint state machine state
|
||||||
|
|
@ -452,7 +451,6 @@ struct pxa_udc {
|
||||||
struct usb_gadget gadget;
|
struct usb_gadget gadget;
|
||||||
struct usb_gadget_driver *driver;
|
struct usb_gadget_driver *driver;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
void (*udc_command)(int);
|
|
||||||
struct gpio_desc *gpiod;
|
struct gpio_desc *gpiod;
|
||||||
struct usb_phy *transceiver;
|
struct usb_phy *transceiver;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,21 +10,6 @@
|
||||||
#ifndef PXA2XX_UDC_H
|
#ifndef PXA2XX_UDC_H
|
||||||
#define 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
|
#ifdef CONFIG_PXA27x
|
||||||
extern void pxa27x_clear_otgph(void);
|
extern void pxa27x_clear_otgph(void);
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user