Explorar el Código

serial: 8250: allow specifying iomem size in addition to address

This adds a mapsize field to struct uart_port to be used in
conjunction with mapbase. If set, it overrides whatever value
serial8250_port_size() would otherwise report.

Signed-off-by: Mans Rullgard <mans@mansr.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mans Rullgard hace 10 años
padre
commit
ee97d0e3f0
Se han modificado 2 ficheros con 5 adiciones y 0 borrados
  1. 4 0
      drivers/tty/serial/8250/8250_core.c
  2. 1 0
      include/linux/serial_core.h

+ 4 - 0
drivers/tty/serial/8250/8250_core.c

@@ -2722,6 +2722,8 @@ serial8250_pm(struct uart_port *port, unsigned int state,
 
 
 static unsigned int serial8250_port_size(struct uart_8250_port *pt)
 static unsigned int serial8250_port_size(struct uart_8250_port *pt)
 {
 {
+	if (pt->port.mapsize)
+		return pt->port.mapsize;
 	if (pt->port.iotype == UPIO_AU) {
 	if (pt->port.iotype == UPIO_AU) {
 		if (pt->port.type == PORT_RT2880)
 		if (pt->port.type == PORT_RT2880)
 			return 0x100;
 			return 0x100;
@@ -3553,6 +3555,7 @@ int __init early_serial_setup(struct uart_port *port)
 	p->iotype       = port->iotype;
 	p->iotype       = port->iotype;
 	p->flags        = port->flags;
 	p->flags        = port->flags;
 	p->mapbase      = port->mapbase;
 	p->mapbase      = port->mapbase;
+	p->mapsize      = port->mapsize;
 	p->private_data = port->private_data;
 	p->private_data = port->private_data;
 	p->type		= port->type;
 	p->type		= port->type;
 	p->line		= port->line;
 	p->line		= port->line;
@@ -3807,6 +3810,7 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
 		uart->port.flags        = up->port.flags | UPF_BOOT_AUTOCONF;
 		uart->port.flags        = up->port.flags | UPF_BOOT_AUTOCONF;
 		uart->bugs		= up->bugs;
 		uart->bugs		= up->bugs;
 		uart->port.mapbase      = up->port.mapbase;
 		uart->port.mapbase      = up->port.mapbase;
+		uart->port.mapsize      = up->port.mapsize;
 		uart->port.private_data = up->port.private_data;
 		uart->port.private_data = up->port.private_data;
 		uart->port.fifosize	= up->port.fifosize;
 		uart->port.fifosize	= up->port.fifosize;
 		uart->tx_loadsz		= up->tx_loadsz;
 		uart->tx_loadsz		= up->tx_loadsz;

+ 1 - 0
include/linux/serial_core.h

@@ -237,6 +237,7 @@ struct uart_port {
 	unsigned int		line;			/* port index */
 	unsigned int		line;			/* port index */
 	unsigned int		minor;
 	unsigned int		minor;
 	resource_size_t		mapbase;		/* for ioremap */
 	resource_size_t		mapbase;		/* for ioremap */
+	resource_size_t		mapsize;
 	struct device		*dev;			/* parent device */
 	struct device		*dev;			/* parent device */
 	unsigned char		hub6;			/* this should be in the 8250 driver */
 	unsigned char		hub6;			/* this should be in the 8250 driver */
 	unsigned char		suspended;
 	unsigned char		suspended;