linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Kukjin Kim <kgene@kernel.org>, Krzysztof Kozlowski <krzk@kernel.org>
Cc: linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linus.walleij@linaro.org,
	Arnd Bergmann <arnd@arndb.de>, Felipe Balbi <balbi@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: [PATCH 03/36] usb: gadget: s3c: use platform resources
Date: Thu, 10 Oct 2019 22:29:47 +0200	[thread overview]
Message-ID: <20191010203043.1241612-3-arnd@arndb.de> (raw)
In-Reply-To: <20191010203043.1241612-1-arnd@arndb.de>

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>
---
 drivers/usb/gadget/udc/s3c2410_udc.c          | 31 +++++++------------
 drivers/usb/gadget/udc/s3c2410_udc.h          |  1 +
 .../usb/gadget/udc/s3c2410_udc_regs.h         |  0
 3 files changed, 12 insertions(+), 20 deletions(-)
 rename arch/arm/plat-samsung/include/plat/regs-udc.h => drivers/usb/gadget/udc/s3c2410_udc_regs.h (100%)

diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c
index f82208fbc249..e411d27b79fc 100644
--- a/drivers/usb/gadget/udc/s3c2410_udc.c
+++ b/drivers/usb/gadget/udc/s3c2410_udc.c
@@ -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;
@@ -839,8 +836,6 @@ static void s3c2410_udc_handle_ep(struct s3c2410_ep *ep)
 	}
 }
 
-#include <mach/regs-irq.h>
-
 /*
  *	s3c2410_udc_irq - interrupt handler
  */
@@ -981,7 +976,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);
@@ -1784,13 +1779,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;
@@ -1802,17 +1791,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");
@@ -1879,7 +1870,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
 	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:
@@ -1913,7 +1904,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);
diff --git a/drivers/usb/gadget/udc/s3c2410_udc.h b/drivers/usb/gadget/udc/s3c2410_udc.h
index bdcaa8dd300f..68bdf3e5aac2 100644
--- a/drivers/usb/gadget/udc/s3c2410_udc.h
+++ b/drivers/usb/gadget/udc/s3c2410_udc.h
@@ -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))
 
diff --git a/arch/arm/plat-samsung/include/plat/regs-udc.h b/drivers/usb/gadget/udc/s3c2410_udc_regs.h
similarity index 100%
rename from arch/arm/plat-samsung/include/plat/regs-udc.h
rename to drivers/usb/gadget/udc/s3c2410_udc_regs.h
-- 
2.20.0


  parent reply	other threads:[~2019-10-10 20:31 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 20:28 [PATCH 00/36] ARM: samsung platform cleanup Arnd Bergmann
2019-10-10 20:29 ` [PATCH 01/36] ARM: samsung: make S3C24XX_MISCCR access indirect Arnd Bergmann
2019-10-10 20:29   ` [PATCH 02/36] ARM: s3c: simplify mach/io.h Arnd Bergmann
2019-10-10 20:29   ` Arnd Bergmann [this message]
2019-10-23 10:06     ` [PATCH 03/36] usb: gadget: s3c: use platform resources Krzysztof Kozlowski
2019-10-23 12:46     ` Krzysztof Kozlowski
2019-10-23 13:26       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 04/36] usb: gadget: s3c-hsudc: remove platform header dependency Arnd Bergmann
2019-10-23 10:09     ` Krzysztof Kozlowski
2019-10-23 12:21       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 05/36] ARM: samsung: make pm-debug platform independent Arnd Bergmann
2019-10-23 10:27     ` Krzysztof Kozlowski
2019-10-23 12:13       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 06/36] ARM: samsung: move CONFIG_DEBUG_S3C_UART to Kconfig.debug Arnd Bergmann
2019-10-23 10:12     ` Krzysztof Kozlowski
2019-10-23 12:22       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 07/36] ARM: exynos: use private samsung_cpu_id copy Arnd Bergmann
2019-10-23 10:54     ` Krzysztof Kozlowski
2019-10-23 12:37       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 08/36] ARM: exynos: stop selecting PLAT_SAMSUNG Arnd Bergmann
2019-10-15 14:12     ` Ulf Hansson
2019-10-23 10:57     ` Krzysztof Kozlowski
2019-10-23 12:43       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 09/36] ARM: samsung: move pm check code to drivers/soc Arnd Bergmann
2019-10-23 11:32     ` Krzysztof Kozlowski
2019-10-23 12:45       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 10/36] ARM: s5pv210: use private pm save/restore Arnd Bergmann
2019-10-23 11:55     ` Krzysztof Kozlowski
2019-10-23 13:12       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 11/36] ARM: s5pv210: split from plat-samsung Arnd Bergmann
2019-10-11  5:51     ` Uwe Kleine-König
2019-10-22 14:01       ` Arnd Bergmann
2019-10-22 15:53         ` Uwe Kleine-König
2019-10-22 16:20           ` Arnd Bergmann
2019-10-15 14:13     ` Ulf Hansson
2019-10-15 14:23     ` Thierry Reding
2019-10-23 12:14     ` Krzysztof Kozlowski
2019-10-23 13:17       ` Arnd Bergmann
2019-10-23 14:12         ` Krzysztof Kozlowski
2019-10-10 20:29   ` [PATCH 12/36] ARM: s3c64xx: remove mach/hardware.h Arnd Bergmann
2019-10-16 10:09     ` Charles Keepax
2019-10-10 20:29   ` [PATCH 13/36] ARM: s3c: move regs-spi.h into spi driver Arnd Bergmann
2019-10-23 12:32     ` Krzysztof Kozlowski
2019-10-23 13:21       ` Arnd Bergmann
2019-10-10 20:29   ` [PATCH 14/36] ARM: s3c: move irqchip driver back into platform Arnd Bergmann
2019-10-10 20:29   ` [PATCH 15/36] ARM: s3c: adc: move header to linux/soc/samsung Arnd Bergmann
2019-10-10 22:20     ` Guenter Roeck
2019-10-10 22:29       ` Dmitry Torokhov
2019-10-10 22:44         ` Sebastian Reichel
2019-10-23 12:37     ` Krzysztof Kozlowski
2019-10-23 13:23       ` Arnd Bergmann
2019-10-10 20:30   ` [PATCH 16/36] ARM: s3c: move spi fiq handler into platform Arnd Bergmann
2019-10-10 20:30   ` [PATCH 17/36] ARM: s3c: h1940-audio: turn into platform driver Arnd Bergmann
2019-10-10 20:30   ` [PATCH 18/36] ARM: s3c: gta02-audio: " Arnd Bergmann
2019-10-10 20:30   ` [PATCH 19/36] ARM: s3c: rx1950: " Arnd Bergmann
2019-10-10 20:30   ` [PATCH 20/36] ASoC: samsung: s3c2412-i2s: avoid hardcoded S3C2410_PA_IIS Arnd Bergmann
2019-10-11 10:50     ` Mark Brown
2019-10-10 20:30   ` [PATCH 21/36] ARM: s3c: move iis pinctrl config into boards Arnd Bergmann
2019-10-23 12:50     ` Krzysztof Kozlowski
2019-10-23 13:29       ` Arnd Bergmann
2019-10-10 20:30   ` [PATCH 22/36] ARM: s3c: leds: move setpull() calls into board files Arnd Bergmann
2019-10-10 20:30   ` [PATCH 23/36] ARM: s3c: move s3cmci pinctrl handling " Arnd Bergmann
2019-10-15 14:12     ` Ulf Hansson
2019-10-16 13:12     ` Linus Walleij
2019-10-10 20:30   ` [PATCH 24/36] ARM: s3c: include mach/irqs.h where needed Arnd Bergmann
2019-10-10 20:30   ` [PATCH 25/36] ARM: s3c: spi: avoid hardcoding fiq number in driver Arnd Bergmann
2019-10-10 20:30   ` [PATCH 26/36] ARM: s3c: bast: avoid irq_desc array usage Arnd Bergmann
2019-10-10 20:30   ` [PATCH 27/36] ARM: s3c: fix mmc gpio lookup tables Arnd Bergmann
2019-10-10 20:30   ` [PATCH 28/36] fbdev: s3c2410fb: remove mach header dependency Arnd Bergmann
2019-10-23 13:13     ` Krzysztof Kozlowski
2019-10-23 13:35       ` Arnd Bergmann
2019-10-10 20:30   ` [PATCH 29/36] ARM: s3c: cpufreq: split out registers Arnd Bergmann
2019-10-10 20:30   ` [PATCH 30/36] ARM: s3c: remove cpufreq header dependencies Arnd Bergmann
2019-10-23 13:38     ` Krzysztof Kozlowski
2019-10-23 13:46       ` Arnd Bergmann
2019-10-10 20:30   ` [PATCH 31/36] ARM: s3c: cpufreq: use global s3c2412_cpufreq_setrefresh Arnd Bergmann
2019-10-23 13:44     ` Krzysztof Kozlowski
2019-10-23 13:57       ` Arnd Bergmann
2019-10-10 20:30   ` [PATCH 32/36] ARM: s3c: iotiming: make functions static Arnd Bergmann
2019-10-10 20:30   ` [PATCH 33/36] ARM: s3c: move low-level clk reg access into platform code Arnd Bergmann
2019-10-23 13:49     ` Krzysztof Kozlowski
2019-10-23 13:54       ` Arnd Bergmann
2019-10-10 20:30   ` [PATCH 34/36] ARM: s3c: stop including mach/hardware.h from mach/io.h Arnd Bergmann
2019-10-10 21:02     ` Russell King - ARM Linux admin
2019-10-10 21:53       ` Arnd Bergmann
2019-10-15 14:52   ` [PATCH 01/36] ARM: samsung: make S3C24XX_MISCCR access indirect Tomasz Figa
2019-10-23 13:10 ` [PATCH 00/36] ARM: samsung platform cleanup Krzysztof Kozlowski
2019-10-23 13:39   ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191010203043.1241612-3-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kgene@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).