All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: soc@kernel.org, linux-arm-kernel@lists.infradead.org,
	Vladimir Zapolskiy <vz@mleia.com>,
	Sylvain Lemieux <slemieux.tyco@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Gregory Clement <gregory.clement@bootlin.com>,
	Linus Walleij <linus.walleij@linaro.org>
Cc: Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-gpio@vger.kernel.org, netdev@vger.kernel.org,
	linux-serial@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-watchdog@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Jiri Slaby <jslaby@suse.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 09/14] serial: lpc32xx: allow compile testing
Date: Wed, 31 Jul 2019 21:56:51 +0200	[thread overview]
Message-ID: <20190731195713.3150463-10-arnd@arndb.de> (raw)
In-Reply-To: <20190731195713.3150463-1-arnd@arndb.de>

The lpc32xx_loopback_set() function in hte lpc32xx_hs driver is the
one thing that relies on platform header files. Move that into the
core platform code so we only need a variable declaration for it,
and enable COMPILE_TEST building.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-lpc32xx/serial.c       | 30 ++++++++++++++++++++++++
 drivers/tty/serial/lpc32xx_hs.c      | 35 ++++------------------------
 include/linux/soc/nxp/lpc32xx-misc.h |  4 ++++
 3 files changed, 38 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-lpc32xx/serial.c b/arch/arm/mach-lpc32xx/serial.c
index 3f9b30df9f0e..cfb35e5691cd 100644
--- a/arch/arm/mach-lpc32xx/serial.c
+++ b/arch/arm/mach-lpc32xx/serial.c
@@ -60,6 +60,36 @@ static struct uartinit uartinit_data[] __initdata = {
 	},
 };
 
+/* LPC3250 Errata HSUART.1: Hang workaround via loopback mode on inactivity */
+void lpc32xx_loopback_set(resource_size_t mapbase, int state)
+{
+	int bit;
+	u32 tmp;
+
+	switch (mapbase) {
+	case LPC32XX_HS_UART1_BASE:
+		bit = 0;
+		break;
+	case LPC32XX_HS_UART2_BASE:
+		bit = 1;
+		break;
+	case LPC32XX_HS_UART7_BASE:
+		bit = 6;
+		break;
+	default:
+		WARN(1, "lpc32xx_hs: Warning: Unknown port at %08x\n", mapbase);
+		return;
+	}
+
+	tmp = readl(LPC32XX_UARTCTL_CLOOP);
+	if (state)
+		tmp |= (1 << bit);
+	else
+		tmp &= ~(1 << bit);
+	writel(tmp, LPC32XX_UARTCTL_CLOOP);
+}
+EXPORT_SYMBOL_GPL(lpc32xx_loopback_set);
+
 void __init lpc32xx_serial_init(void)
 {
 	u32 tmp, clkmodes = 0;
diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_hs.c
index 7f14cd8fac47..d3843f722182 100644
--- a/drivers/tty/serial/lpc32xx_hs.c
+++ b/drivers/tty/serial/lpc32xx_hs.c
@@ -25,6 +25,8 @@
 #include <linux/irq.h>
 #include <linux/gpio.h>
 #include <linux/of.h>
+#include <linux/sizes.h>
+#include <linux/soc/nxp/lpc32xx-misc.h>
 
 /*
  * High Speed UART register offsets
@@ -79,6 +81,8 @@
 #define LPC32XX_HSU_TX_TL8B			(0x2 << 0)
 #define LPC32XX_HSU_TX_TL16B			(0x3 << 0)
 
+#define LPC32XX_MAIN_OSC_FREQ			13000000
+
 #define MODNAME "lpc32xx_hsuart"
 
 struct lpc32xx_hsuart_port {
@@ -149,8 +153,6 @@ static void lpc32xx_hsuart_console_write(struct console *co, const char *s,
 	local_irq_restore(flags);
 }
 
-static void lpc32xx_loopback_set(resource_size_t mapbase, int state);
-
 static int __init lpc32xx_hsuart_console_setup(struct console *co,
 					       char *options)
 {
@@ -437,35 +439,6 @@ static void serial_lpc32xx_break_ctl(struct uart_port *port,
 	spin_unlock_irqrestore(&port->lock, flags);
 }
 
-/* LPC3250 Errata HSUART.1: Hang workaround via loopback mode on inactivity */
-static void lpc32xx_loopback_set(resource_size_t mapbase, int state)
-{
-	int bit;
-	u32 tmp;
-
-	switch (mapbase) {
-	case LPC32XX_HS_UART1_BASE:
-		bit = 0;
-		break;
-	case LPC32XX_HS_UART2_BASE:
-		bit = 1;
-		break;
-	case LPC32XX_HS_UART7_BASE:
-		bit = 6;
-		break;
-	default:
-		WARN(1, "lpc32xx_hs: Warning: Unknown port at %08x\n", mapbase);
-		return;
-	}
-
-	tmp = readl(LPC32XX_UARTCTL_CLOOP);
-	if (state)
-		tmp |= (1 << bit);
-	else
-		tmp &= ~(1 << bit);
-	writel(tmp, LPC32XX_UARTCTL_CLOOP);
-}
-
 /* port->lock is not held.  */
 static int serial_lpc32xx_startup(struct uart_port *port)
 {
diff --git a/include/linux/soc/nxp/lpc32xx-misc.h b/include/linux/soc/nxp/lpc32xx-misc.h
index af4f82f6cf3b..699c6f1e3aab 100644
--- a/include/linux/soc/nxp/lpc32xx-misc.h
+++ b/include/linux/soc/nxp/lpc32xx-misc.h
@@ -14,6 +14,7 @@
 #ifdef CONFIG_ARCH_LPC32XX
 extern u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr);
 extern void lpc32xx_set_phy_interface_mode(phy_interface_t mode);
+extern void lpc32xx_loopback_set(resource_size_t mapbase, int state);
 #else
 static inline u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr)
 {
@@ -24,6 +25,9 @@ static inline u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaadd
 static inline void lpc32xx_set_phy_interface_mode(phy_interface_t mode)
 {
 }
+static inline void lpc32xx_loopback_set(resource_size_t mapbase, int state)
+{
+}
 #endif
 
 #endif  /* __SOC_LPC32XX_MISC_H */
-- 
2.20.0


WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: soc@kernel.org, linux-arm-kernel@lists.infradead.org,
	Vladimir Zapolskiy <vz@mleia.com>,
	Sylvain Lemieux <slemieux.tyco@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Gregory Clement <gregory.clement@bootlin.com>,
	Linus Walleij <linus.walleij@linaro.org>
Cc: Andrew Lunn <andrew@lunn.ch>,
	linux-watchdog@vger.kernel.org,
	Jason Cooper <jason@lakedaemon.net>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-gpio@vger.kernel.org,
	Alan Stern <stern@rowland.harvard.edu>,
	linux-serial@vger.kernel.org, netdev@vger.kernel.org,
	Jiri Slaby <jslaby@suse.com>,
	"David S. Miller" <davem@davemloft.net>,
	Guenter Roeck <linux@roeck-us.net>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: [PATCH 09/14] serial: lpc32xx: allow compile testing
Date: Wed, 31 Jul 2019 21:56:51 +0200	[thread overview]
Message-ID: <20190731195713.3150463-10-arnd@arndb.de> (raw)
In-Reply-To: <20190731195713.3150463-1-arnd@arndb.de>

The lpc32xx_loopback_set() function in hte lpc32xx_hs driver is the
one thing that relies on platform header files. Move that into the
core platform code so we only need a variable declaration for it,
and enable COMPILE_TEST building.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-lpc32xx/serial.c       | 30 ++++++++++++++++++++++++
 drivers/tty/serial/lpc32xx_hs.c      | 35 ++++------------------------
 include/linux/soc/nxp/lpc32xx-misc.h |  4 ++++
 3 files changed, 38 insertions(+), 31 deletions(-)

diff --git a/arch/arm/mach-lpc32xx/serial.c b/arch/arm/mach-lpc32xx/serial.c
index 3f9b30df9f0e..cfb35e5691cd 100644
--- a/arch/arm/mach-lpc32xx/serial.c
+++ b/arch/arm/mach-lpc32xx/serial.c
@@ -60,6 +60,36 @@ static struct uartinit uartinit_data[] __initdata = {
 	},
 };
 
+/* LPC3250 Errata HSUART.1: Hang workaround via loopback mode on inactivity */
+void lpc32xx_loopback_set(resource_size_t mapbase, int state)
+{
+	int bit;
+	u32 tmp;
+
+	switch (mapbase) {
+	case LPC32XX_HS_UART1_BASE:
+		bit = 0;
+		break;
+	case LPC32XX_HS_UART2_BASE:
+		bit = 1;
+		break;
+	case LPC32XX_HS_UART7_BASE:
+		bit = 6;
+		break;
+	default:
+		WARN(1, "lpc32xx_hs: Warning: Unknown port at %08x\n", mapbase);
+		return;
+	}
+
+	tmp = readl(LPC32XX_UARTCTL_CLOOP);
+	if (state)
+		tmp |= (1 << bit);
+	else
+		tmp &= ~(1 << bit);
+	writel(tmp, LPC32XX_UARTCTL_CLOOP);
+}
+EXPORT_SYMBOL_GPL(lpc32xx_loopback_set);
+
 void __init lpc32xx_serial_init(void)
 {
 	u32 tmp, clkmodes = 0;
diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_hs.c
index 7f14cd8fac47..d3843f722182 100644
--- a/drivers/tty/serial/lpc32xx_hs.c
+++ b/drivers/tty/serial/lpc32xx_hs.c
@@ -25,6 +25,8 @@
 #include <linux/irq.h>
 #include <linux/gpio.h>
 #include <linux/of.h>
+#include <linux/sizes.h>
+#include <linux/soc/nxp/lpc32xx-misc.h>
 
 /*
  * High Speed UART register offsets
@@ -79,6 +81,8 @@
 #define LPC32XX_HSU_TX_TL8B			(0x2 << 0)
 #define LPC32XX_HSU_TX_TL16B			(0x3 << 0)
 
+#define LPC32XX_MAIN_OSC_FREQ			13000000
+
 #define MODNAME "lpc32xx_hsuart"
 
 struct lpc32xx_hsuart_port {
@@ -149,8 +153,6 @@ static void lpc32xx_hsuart_console_write(struct console *co, const char *s,
 	local_irq_restore(flags);
 }
 
-static void lpc32xx_loopback_set(resource_size_t mapbase, int state);
-
 static int __init lpc32xx_hsuart_console_setup(struct console *co,
 					       char *options)
 {
@@ -437,35 +439,6 @@ static void serial_lpc32xx_break_ctl(struct uart_port *port,
 	spin_unlock_irqrestore(&port->lock, flags);
 }
 
-/* LPC3250 Errata HSUART.1: Hang workaround via loopback mode on inactivity */
-static void lpc32xx_loopback_set(resource_size_t mapbase, int state)
-{
-	int bit;
-	u32 tmp;
-
-	switch (mapbase) {
-	case LPC32XX_HS_UART1_BASE:
-		bit = 0;
-		break;
-	case LPC32XX_HS_UART2_BASE:
-		bit = 1;
-		break;
-	case LPC32XX_HS_UART7_BASE:
-		bit = 6;
-		break;
-	default:
-		WARN(1, "lpc32xx_hs: Warning: Unknown port at %08x\n", mapbase);
-		return;
-	}
-
-	tmp = readl(LPC32XX_UARTCTL_CLOOP);
-	if (state)
-		tmp |= (1 << bit);
-	else
-		tmp &= ~(1 << bit);
-	writel(tmp, LPC32XX_UARTCTL_CLOOP);
-}
-
 /* port->lock is not held.  */
 static int serial_lpc32xx_startup(struct uart_port *port)
 {
diff --git a/include/linux/soc/nxp/lpc32xx-misc.h b/include/linux/soc/nxp/lpc32xx-misc.h
index af4f82f6cf3b..699c6f1e3aab 100644
--- a/include/linux/soc/nxp/lpc32xx-misc.h
+++ b/include/linux/soc/nxp/lpc32xx-misc.h
@@ -14,6 +14,7 @@
 #ifdef CONFIG_ARCH_LPC32XX
 extern u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr);
 extern void lpc32xx_set_phy_interface_mode(phy_interface_t mode);
+extern void lpc32xx_loopback_set(resource_size_t mapbase, int state);
 #else
 static inline u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaaddr)
 {
@@ -24,6 +25,9 @@ static inline u32 lpc32xx_return_iram(void __iomem **mapbase, dma_addr_t *dmaadd
 static inline void lpc32xx_set_phy_interface_mode(phy_interface_t mode)
 {
 }
+static inline void lpc32xx_loopback_set(resource_size_t mapbase, int state)
+{
+}
 #endif
 
 #endif  /* __SOC_LPC32XX_MISC_H */
-- 
2.20.0


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

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

Thread overview: 103+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31 19:56 [PATCH 00/14] ARM: move lpc32xx and dove to multiplatform Arnd Bergmann
2019-07-31 19:56 ` Arnd Bergmann
2019-07-31 19:56 ` Arnd Bergmann
2019-07-31 19:56 ` [PATCH 01/14] usb: ohci-nxp: enable compile-testing Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-08-01  5:58   ` Greg Kroah-Hartman
2019-08-01  5:58     ` Greg Kroah-Hartman
2019-07-31 19:56 ` [PATCH 02/14] usb: udc: lpc32xx: allow compile-testing Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-08-01  5:58   ` Greg Kroah-Hartman
2019-08-01  5:58     ` Greg Kroah-Hartman
2019-08-05 12:47     ` Sylvain Lemieux
2019-08-05 12:47       ` Sylvain Lemieux
2019-08-05 12:47       ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 03/14] watchdog: pnx4008_wdt: " Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-07-31 20:23   ` Guenter Roeck
2019-07-31 20:23     ` Guenter Roeck
2019-07-31 20:26     ` Arnd Bergmann
2019-07-31 20:26       ` Arnd Bergmann
2019-07-31 20:26       ` Arnd Bergmann
2019-07-31 20:36       ` Guenter Roeck
2019-07-31 20:36         ` Guenter Roeck
2019-07-31 20:36         ` Guenter Roeck
2019-08-05 12:42         ` Sylvain Lemieux
2019-08-05 12:42           ` Sylvain Lemieux
2019-08-05 12:42           ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 04/14] serial: lpc32xx_hs: " Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-08-01  5:58   ` Greg Kroah-Hartman
2019-08-01  5:58     ` Greg Kroah-Hartman
2019-08-05 12:43     ` Sylvain Lemieux
2019-08-05 12:43       ` Sylvain Lemieux
2019-08-05 12:43       ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 05/14] gpio: lpc32xx: allow building on non-lpc32xx targets Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-08-02  7:10   ` Bartosz Golaszewski
2019-08-02  7:10     ` Bartosz Golaszewski
2019-08-02  7:10     ` Bartosz Golaszewski
2019-08-02 11:19     ` Arnd Bergmann
2019-08-02 11:19       ` Arnd Bergmann
2019-08-02 11:19       ` Arnd Bergmann
2019-08-05  8:27       ` Bartosz Golaszewski
2019-08-05  8:27         ` Bartosz Golaszewski
2019-08-05  8:27         ` Bartosz Golaszewski
2019-08-09 14:18         ` Arnd Bergmann
2019-08-09 14:18           ` Arnd Bergmann
2019-08-09 14:18           ` Arnd Bergmann
2019-08-06 20:02   ` Sylvain Lemieux
2019-08-06 20:02     ` Sylvain Lemieux
2019-08-06 20:02     ` Sylvain Lemieux
2019-08-09 14:19     ` Arnd Bergmann
2019-08-09 14:19       ` Arnd Bergmann
2019-08-09 14:19       ` Arnd Bergmann
2019-07-31 19:56 ` [PATCH 06/14] net: lpc-enet: factor out iram access Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-07-31 19:56 ` [PATCH 07/14] net: lpc-enet: move phy setup into platform code Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-08-06 20:11   ` Sylvain Lemieux
2019-08-06 20:11     ` Sylvain Lemieux
2019-08-06 20:11     ` Sylvain Lemieux
2019-08-06 20:12   ` Sylvain Lemieux
2019-08-06 20:12     ` Sylvain Lemieux
2019-08-06 20:12     ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 08/14] net: lpc-enet: allow compile testing Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-08-06 20:13   ` Sylvain Lemieux
2019-08-06 20:13     ` Sylvain Lemieux
2019-08-06 20:13     ` Sylvain Lemieux
2019-07-31 19:56 ` Arnd Bergmann [this message]
2019-07-31 19:56   ` [PATCH 09/14] serial: lpc32xx: " Arnd Bergmann
2019-08-01  5:59   ` Greg Kroah-Hartman
2019-08-01  5:59     ` Greg Kroah-Hartman
2019-07-31 19:56 ` [PATCH 10/14] ARM: lpc32xx: clean up header files Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-08-06 20:16   ` Sylvain Lemieux
2019-08-06 20:16     ` Sylvain Lemieux
2019-08-06 20:16     ` Sylvain Lemieux
2019-07-31 19:56 ` [PATCH 11/14] ARM: lpc32xx: allow multiplatform build Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-07-31 19:56 ` [PATCH 12/14] ARM: dove: clean up mach/*.h headers Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-07-31 19:56 ` [PATCH 13/14] ARM: orion/mvebu: unify debug-ll virtual addresses Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-07-31 19:56 ` [PATCH 14/14] ARM: dove: multiplatform support Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-07-31 19:56   ` Arnd Bergmann
2019-07-31 22:53 ` [PATCH 00/14] ARM: move lpc32xx and dove to multiplatform Russell King - ARM Linux admin
2019-07-31 22:53   ` Russell King - ARM Linux admin
2019-08-01  7:33   ` Arnd Bergmann
2019-08-01  7:33     ` Arnd Bergmann
2019-08-15 13:11     ` Arnd Bergmann
2019-08-15 13:11       ` Arnd Bergmann
2019-08-15 18:32       ` Sylvain Lemieux
2019-08-15 18:32         ` Sylvain Lemieux
2019-08-15 19:38         ` Arnd Bergmann
2019-08-15 19:38           ` 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=20190731195713.3150463-10-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=gregory.clement@bootlin.com \
    --cc=jason@lakedaemon.net \
    --cc=jslaby@suse.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@roeck-us.net \
    --cc=netdev@vger.kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.