mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 14:42:24 +00:00
usb: gadget: s3c: use platform resources
The resources are correctly initialized, so just use them instead of relying on hardcoded data from platform headers. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Felipe Balbi <balbi@kernel.org> Link: https://lore.kernel.org/r/20200806182059.2431-8-krzk@kernel.org Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
This commit is contained in:
parent
98c2922ec8
commit
188db4435a
@ -36,15 +36,11 @@
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/unaligned.h>
|
||||
#include <mach/irqs.h>
|
||||
|
||||
#include <mach/hardware.h>
|
||||
|
||||
#include <plat/regs-udc.h>
|
||||
#include <linux/platform_data/usb-s3c2410_udc.h>
|
||||
|
||||
|
||||
#include "s3c2410_udc.h"
|
||||
#include "s3c2410_udc_regs.h"
|
||||
|
||||
#define DRIVER_DESC "S3C2410 USB Device Controller Gadget"
|
||||
#define DRIVER_AUTHOR "Herbert Pötzl <herbert@13thfloor.at>, " \
|
||||
@ -57,6 +53,7 @@ static struct s3c2410_udc *the_controller;
|
||||
static struct clk *udc_clock;
|
||||
static struct clk *usb_bus_clock;
|
||||
static void __iomem *base_addr;
|
||||
static int irq_usbd;
|
||||
static u64 rsrc_start;
|
||||
static u64 rsrc_len;
|
||||
static struct dentry *s3c2410_udc_debugfs_root;
|
||||
@ -835,8 +832,6 @@ static void s3c2410_udc_handle_ep(struct s3c2410_ep *ep)
|
||||
}
|
||||
}
|
||||
|
||||
#include <mach/regs-irq.h>
|
||||
|
||||
/*
|
||||
* s3c2410_udc_irq - interrupt handler
|
||||
*/
|
||||
@ -977,7 +972,7 @@ static irqreturn_t s3c2410_udc_irq(int dummy, void *_dev)
|
||||
}
|
||||
}
|
||||
|
||||
dprintk(DEBUG_VERBOSE, "irq: %d s3c2410_udc_done.\n", IRQ_USBD);
|
||||
dprintk(DEBUG_VERBOSE, "irq: %d s3c2410_udc_done.\n", irq_usbd);
|
||||
|
||||
/* Restore old index */
|
||||
udc_write(idx, S3C2410_UDC_INDEX_REG);
|
||||
@ -1780,13 +1775,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
|
||||
spin_lock_init(&udc->lock);
|
||||
udc_info = dev_get_platdata(&pdev->dev);
|
||||
|
||||
rsrc_start = S3C2410_PA_USBDEV;
|
||||
rsrc_len = S3C24XX_SZ_USBDEV;
|
||||
|
||||
if (!request_mem_region(rsrc_start, rsrc_len, gadget_name))
|
||||
return -EBUSY;
|
||||
|
||||
base_addr = ioremap(rsrc_start, rsrc_len);
|
||||
base_addr = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (!base_addr) {
|
||||
retval = -ENOMEM;
|
||||
goto err_mem;
|
||||
@ -1798,17 +1787,19 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
|
||||
s3c2410_udc_disable(udc);
|
||||
s3c2410_udc_reinit(udc);
|
||||
|
||||
irq_usbd = platform_get_irq(pdev, 0);
|
||||
|
||||
/* irq setup after old hardware state is cleaned up */
|
||||
retval = request_irq(IRQ_USBD, s3c2410_udc_irq,
|
||||
retval = request_irq(irq_usbd, s3c2410_udc_irq,
|
||||
0, gadget_name, udc);
|
||||
|
||||
if (retval != 0) {
|
||||
dev_err(dev, "cannot get irq %i, err %d\n", IRQ_USBD, retval);
|
||||
dev_err(dev, "cannot get irq %i, err %d\n", irq_usbd, retval);
|
||||
retval = -EBUSY;
|
||||
goto err_map;
|
||||
}
|
||||
|
||||
dev_dbg(dev, "got irq %i\n", IRQ_USBD);
|
||||
dev_dbg(dev, "got irq %i\n", irq_usbd);
|
||||
|
||||
if (udc_info && udc_info->vbus_pin > 0) {
|
||||
retval = gpio_request(udc_info->vbus_pin, "udc vbus");
|
||||
@ -1875,7 +1866,7 @@ err_gpio_claim:
|
||||
if (udc_info && udc_info->vbus_pin > 0)
|
||||
gpio_free(udc_info->vbus_pin);
|
||||
err_int:
|
||||
free_irq(IRQ_USBD, udc);
|
||||
free_irq(irq_usbd, udc);
|
||||
err_map:
|
||||
iounmap(base_addr);
|
||||
err_mem:
|
||||
@ -1909,7 +1900,7 @@ static int s3c2410_udc_remove(struct platform_device *pdev)
|
||||
free_irq(irq, udc);
|
||||
}
|
||||
|
||||
free_irq(IRQ_USBD, udc);
|
||||
free_irq(irq_usbd, udc);
|
||||
|
||||
iounmap(base_addr);
|
||||
release_mem_region(rsrc_start, rsrc_len);
|
||||
|
@ -90,6 +90,7 @@ struct s3c2410_udc {
|
||||
unsigned req_pending : 1;
|
||||
u8 vbus;
|
||||
struct dentry *regs_info;
|
||||
int irq;
|
||||
};
|
||||
#define to_s3c2410(g) (container_of((g), struct s3c2410_udc, gadget))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user