linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] serial: 8250: Add support for 8250/16550 as MFD function
@ 2019-04-26  8:40 Esben Haabendal
  2019-04-26  8:40 ` [PATCH 1/2] serial: 8250: Allow port registration without UPF_BOOT_AUTOCONF Esben Haabendal
                   ` (2 more replies)
  0 siblings, 3 replies; 35+ messages in thread
From: Esben Haabendal @ 2019-04-26  8:40 UTC (permalink / raw)
  To: linux-serial, Greg Kroah-Hartman, Jiri Slaby
  Cc: Andy Shevchenko, Darwin Dingel, Florian Fainelli, He Zhe,
	Jisheng Zhang, Lokesh Vutla, Sebastian Andrzej Siewior,
	Tony Lindgren, linux-kernel

This series adds a driver for adding 8250/16550 UART ports as functions to
MFD devices.

Esben Haabendal (2):
  serial: 8250: Allow port registration without UPF_BOOT_AUTOCONF
  serial: 8250: Add support for 8250/16550 as MFD function

 drivers/tty/serial/8250/8250_core.c |  36 ++++++-----
 drivers/tty/serial/8250/8250_mfd.c  | 119 ++++++++++++++++++++++++++++++++++++
 drivers/tty/serial/8250/Kconfig     |  12 ++++
 drivers/tty/serial/8250/Makefile    |   1 +
 include/linux/serial_8250.h         |   2 +
 5 files changed, 155 insertions(+), 15 deletions(-)
 create mode 100644 drivers/tty/serial/8250/8250_mfd.c

-- 
2.4.11


^ permalink raw reply	[flat|nested] 35+ messages in thread
* [PATCH 1/2] serial: 8250: Allow port registration without UPF_BOOT_AUTOCONF
@ 2019-04-26  8:36 Esben Haabendal
  0 siblings, 0 replies; 35+ messages in thread
From: Esben Haabendal @ 2019-04-26  8:36 UTC (permalink / raw)
  To: linux-serial
  Cc: Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko, Darwin Dingel,
	He Zhe, Sebastian Andrzej Siewior, Jisheng Zhang, linux-kernel

With serial8250_register_8250_port() forcing UPF_BOOT_AUTOCONF bit on, it
is not possible to register a port without having
serial8250_request_std_resource() called.

For adding a 8250 port to an MFD device, this is problematic, as the
request_mem_region() call will fail, as the MFD device (and rightly  so)
has requested the region.  For this case, the 8250 port should accept
having passed mapbase and membase, and just use that.

Signed-off-by: Esben Haabendal <esben@geanix.com>
---
 drivers/tty/serial/8250/8250_core.c | 36 +++++++++++++++++++++---------------
 include/linux/serial_8250.h         |  2 ++
 2 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index e441221..ddbb0a0 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -957,20 +957,8 @@ static void serial_8250_overrun_backoff_work(struct work_struct *work)
 	spin_unlock_irqrestore(&port->lock, flags);
 }
 
-/**
- *	serial8250_register_8250_port - register a serial port
- *	@up: serial port template
- *
- *	Configure the serial port specified by the request. If the
- *	port exists and is in use, it is hung up and unregistered
- *	first.
- *
- *	The port is then probed and if necessary the IRQ is autodetected
- *	If this fails an error is returned.
- *
- *	On success the port is ready to use and the line number is returned.
- */
-int serial8250_register_8250_port(struct uart_8250_port *up)
+int __serial8250_register_8250_port(struct uart_8250_port *up,
+				    unsigned int extra_flags)
 {
 	struct uart_8250_port *uart;
 	int ret = -ENOSPC;
@@ -993,7 +981,7 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
 		uart->port.fifosize     = up->port.fifosize;
 		uart->port.regshift     = up->port.regshift;
 		uart->port.iotype       = up->port.iotype;
-		uart->port.flags        = up->port.flags | UPF_BOOT_AUTOCONF;
+		uart->port.flags        = up->port.flags | extra_flags;
 		uart->bugs		= up->bugs;
 		uart->port.mapbase      = up->port.mapbase;
 		uart->port.mapsize      = up->port.mapsize;
@@ -1086,6 +1074,24 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
 
 	return ret;
 }
+
+/**
+ *	serial8250_register_8250_port - register a serial port
+ *	@up: serial port template
+ *
+ *	Configure the serial port specified by the request. If the
+ *	port exists and is in use, it is hung up and unregistered
+ *	first.
+ *
+ *	The port is then probed and if necessary the IRQ is autodetected
+ *	If this fails an error is returned.
+ *
+ *	On success the port is ready to use and the line number is returned.
+ */
+int serial8250_register_8250_port(struct uart_8250_port *up)
+{
+	return __serial8250_register_8250_port(up, UPF_BOOT_AUTOCONF);
+}
 EXPORT_SYMBOL(serial8250_register_8250_port);
 
 /**
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 5a655ba..9d1fe2e 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -145,6 +145,8 @@ static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up)
 	return container_of(up, struct uart_8250_port, port);
 }
 
+extern int __serial8250_register_8250_port(struct uart_8250_port *,
+					   unsigned int);
 int serial8250_register_8250_port(struct uart_8250_port *);
 void serial8250_unregister_port(int line);
 void serial8250_suspend_port(int line);
-- 
2.4.11


^ permalink raw reply related	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2019-05-27 19:56 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-26  8:40 [PATCH 0/2] serial: 8250: Add support for 8250/16550 as MFD function Esben Haabendal
2019-04-26  8:40 ` [PATCH 1/2] serial: 8250: Allow port registration without UPF_BOOT_AUTOCONF Esben Haabendal
2019-04-26 14:39   ` Andy Shevchenko
2019-04-26 16:54     ` Esben Haabendal
2019-04-26 21:51       ` Andy Shevchenko
2019-04-27  8:58         ` Esben Haabendal
2019-04-27 11:57           ` Enrico Weigelt, metux IT consult
2019-04-29  6:37             ` Esben Haabendal
2019-04-27 16:41           ` Andy Shevchenko
2019-04-29  6:27             ` Esben Haabendal
2019-04-29  8:33               ` Andy Shevchenko
2019-04-29  9:29                 ` Esben Haabendal
2019-04-29 12:56                   ` Enrico Weigelt, metux IT consult
2019-04-29 13:35                   ` Andy Shevchenko
2019-04-29 14:25                     ` Esben Haabendal
2019-04-26  8:40 ` [PATCH 2/2] serial: 8250: Add support for 8250/16550 as MFD function Esben Haabendal
2019-05-07 11:49   ` Lee Jones
2019-05-07 12:04     ` Esben Haabendal
2019-05-07 13:38       ` Lee Jones
2019-05-14  8:00         ` Esben Haabendal
2019-05-14 10:47           ` Lee Jones
2019-05-14 12:26             ` Greg Kroah-Hartman
2019-05-14 12:41               ` Esben Haabendal
2019-05-21 10:09                 ` Greg Kroah-Hartman
2019-05-21 11:11                   ` Esben Haabendal
2019-05-21 11:18                     ` Greg Kroah-Hartman
2019-05-21 11:50                       ` Esben Haabendal
2019-05-21 12:56                         ` Greg Kroah-Hartman
2019-05-21 14:31                           ` Esben Haabendal
2019-05-21 14:43                             ` Greg Kroah-Hartman
2019-05-27 19:56                               ` Enrico Weigelt, metux IT consult
2019-04-26 14:35 ` [PATCH 0/2] " Andy Shevchenko
2019-04-26 16:57   ` Esben Haabendal
2019-04-26 17:21     ` Andy Shevchenko
  -- strict thread matches above, loose matches on Subject: below --
2019-04-26  8:36 [PATCH 1/2] serial: 8250: Allow port registration without UPF_BOOT_AUTOCONF Esben Haabendal

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).