summaryrefslogtreecommitdiff
path: root/drivers/usb/fotg210/fotg210-udc.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2023-01-18 10:09:17 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-19 16:10:43 +0300
commitbaef5330d35b477056c0304ce1283f0aed4d5d20 (patch)
tree212877fcedfca65750f571378cfc15f7a25aecd9 /drivers/usb/fotg210/fotg210-udc.c
parent170da81aab077c9e85fc2b786413ca07942774a0 (diff)
downloadlinux-baef5330d35b477056c0304ce1283f0aed4d5d20.tar.xz
usb: fotg210: Acquire memory resource in core
The subdrivers are obtaining and mapping the memory resource separately. Create a common state container for the shared resources and start populating this by acquiring the IO memory resource and remap it and pass this to the subdrivers for host and peripheral. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230103-gemini-fotg210-usb-v2-3-100388af9810@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/fotg210/fotg210-udc.c')
-rw-r--r--drivers/usb/fotg210/fotg210-udc.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/usb/fotg210/fotg210-udc.c b/drivers/usb/fotg210/fotg210-udc.c
index 87cca81bf4ac..a4a6f57c3190 100644
--- a/drivers/usb/fotg210/fotg210-udc.c
+++ b/drivers/usb/fotg210/fotg210-udc.c
@@ -1142,21 +1142,14 @@ int fotg210_udc_remove(struct platform_device *pdev)
return 0;
}
-int fotg210_udc_probe(struct platform_device *pdev)
+int fotg210_udc_probe(struct platform_device *pdev, struct fotg210 *fotg)
{
- struct resource *res;
struct fotg210_udc *fotg210 = NULL;
struct device *dev = &pdev->dev;
int irq;
int ret = 0;
int i;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- pr_err("platform_get_resource error.\n");
- return -ENODEV;
- }
-
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
pr_err("could not get irq\n");
@@ -1169,6 +1162,7 @@ int fotg210_udc_probe(struct platform_device *pdev)
return -ENOMEM;
fotg210->dev = dev;
+ fotg210->fotg = fotg;
/* It's OK not to supply this clock */
fotg210->pclk = devm_clk_get(dev, "PCLK");
@@ -1209,11 +1203,7 @@ int fotg210_udc_probe(struct platform_device *pdev)
goto err_alloc;
}
- fotg210->reg = ioremap(res->start, resource_size(res));
- if (fotg210->reg == NULL) {
- dev_err(dev, "ioremap error\n");
- goto err_alloc;
- }
+ fotg210->reg = fotg->base;
spin_lock_init(&fotg210->lock);