linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: soc@kernel.org
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Vladimir Zapolskiy <vz@mleia.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	Sylvain Lemieux <slemieux.tyco@gmail.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 01/13] usb: ohci-nxp: enable compile-testing
Date: Fri,  9 Aug 2019 16:40:27 +0200	[thread overview]
Message-ID: <20190809144043.476786-2-arnd@arndb.de> (raw)
In-Reply-To: <20190809144043.476786-1-arnd@arndb.de>

The driver hardcodes a hardware I/O address the way one should
generally not do, and this prevents both compile-testing, and
moving the platform to CONFIG_ARCH_MULTIPLATFORM.

Change the code to be independent of the machine headers
to allow those two. Removing the hardcoded address would
be hard and is not necessary, so leave that in place for now.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/usb/host/Kconfig    |  3 ++-
 drivers/usb/host/ohci-nxp.c | 25 ++++++++++++++++++-------
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 40b5de597112..73d233d3bf4d 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -441,7 +441,8 @@ config USB_OHCI_HCD_S3C2410
 
 config USB_OHCI_HCD_LPC32XX
 	tristate "Support for LPC on-chip OHCI USB controller"
-	depends on USB_OHCI_HCD && ARCH_LPC32XX
+	depends on USB_OHCI_HCD
+	depends on ARCH_LPC32XX || COMPILE_TEST
 	depends on USB_ISP1301
 	default y
 	---help---
diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
index f5f532601092..c561881d0e79 100644
--- a/drivers/usb/host/ohci-nxp.c
+++ b/drivers/usb/host/ohci-nxp.c
@@ -29,10 +29,7 @@
 
 #include "ohci.h"
 
-#include <mach/hardware.h>
-
 #define USB_CONFIG_BASE		0x31020000
-#define USB_OTG_STAT_CONTROL	IO_ADDRESS(USB_CONFIG_BASE + 0x110)
 
 /* USB_OTG_STAT_CONTROL bit defines */
 #define TRANSPARENT_I2C_EN	(1 << 7)
@@ -122,19 +119,33 @@ static inline void isp1301_vbus_off(void)
 
 static void ohci_nxp_start_hc(void)
 {
-	unsigned long tmp = __raw_readl(USB_OTG_STAT_CONTROL) | HOST_EN;
+	void __iomem *usb_otg_stat_control = ioremap(USB_CONFIG_BASE + 0x110, 4);
+	unsigned long tmp;
+
+	if (WARN_ON(!usb_otg_stat_control))
+		return;
+
+	tmp = __raw_readl(usb_otg_stat_control) | HOST_EN;
 
-	__raw_writel(tmp, USB_OTG_STAT_CONTROL);
+	__raw_writel(tmp, usb_otg_stat_control);
 	isp1301_vbus_on();
+
+	iounmap(usb_otg_stat_control);
 }
 
 static void ohci_nxp_stop_hc(void)
 {
+	void __iomem *usb_otg_stat_control = ioremap(USB_CONFIG_BASE + 0x110, 4);
 	unsigned long tmp;
 
+	if (WARN_ON(!usb_otg_stat_control))
+		return;
+
 	isp1301_vbus_off();
-	tmp = __raw_readl(USB_OTG_STAT_CONTROL) & ~HOST_EN;
-	__raw_writel(tmp, USB_OTG_STAT_CONTROL);
+	tmp = __raw_readl(usb_otg_stat_control) & ~HOST_EN;
+	__raw_writel(tmp, usb_otg_stat_control);
+
+	iounmap(usb_otg_stat_control);
 }
 
 static int ohci_hcd_nxp_probe(struct platform_device *pdev)
-- 
2.20.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-08-09 14:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-09 14:40 [PATCH v2 00/13] v2: ARM: move lpc32xx to multiplatform Arnd Bergmann
2019-08-09 14:40 ` Arnd Bergmann [this message]
2019-08-15 12:42   ` [PATCH v2 01/13] usb: ohci-nxp: enable compile-testing Greg Kroah-Hartman
2019-08-09 14:40 ` [PATCH v2 02/13] usb: udc: lpc32xx: allow compile-testing Arnd Bergmann
2019-08-09 14:40 ` [PATCH v2 03/13] watchdog: pnx4008_wdt: " Arnd Bergmann
2019-08-09 14:40 ` [PATCH v2 04/13] serial: lpc32xx_hs: " Arnd Bergmann
2019-08-09 14:40 ` [PATCH v2 05/13] gpio: lpc32xx: allow building on non-lpc32xx targets Arnd Bergmann
2019-08-12  7:09   ` Bartosz Golaszewski
2019-08-09 14:40 ` [PATCH v2 06/13] net: lpc-enet: factor out iram access Arnd Bergmann
2019-08-09 14:40 ` [PATCH v2 07/13] net: lpc-enet: move phy setup into platform code Arnd Bergmann
2019-08-09 14:40 ` [PATCH v2 08/13] net: lpc-enet: fix badzero.cocci warnings Arnd Bergmann
2019-08-09 14:40 ` [PATCH v2 09/13] net: lpc-enet: fix printk format strings Arnd Bergmann
2019-08-09 16:30   ` Joe Perches
2019-08-09 18:20     ` Arnd Bergmann
2019-08-09 14:40 ` [PATCH v2 10/13] net: lpc-enet: allow compile testing Arnd Bergmann
2019-08-09 14:40 ` [PATCH v2 11/13] serial: lpc32xx: " Arnd Bergmann
2019-08-15 13:40   ` Greg Kroah-Hartman
2019-08-09 14:40 ` [PATCH v2 12/13] ARM: lpc32xx: clean up header files Arnd Bergmann
2019-08-09 14:40 ` [PATCH v2 13/13] ARM: lpc32xx: allow multiplatform build 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=20190809144043.476786-2-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=felipe.balbi@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=slemieux.tyco@gmail.com \
    --cc=soc@kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=vz@mleia.com \
    /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).