Message ID | 1556369542-13247-38-git-send-email-info@metux.net (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [01/41] drivers: tty: serial: dz: use dev_err() instead of printk() | expand |
On 4/27/19 2:52 PM, Enrico Weigelt, metux IT consult wrote:
> Simpily io resource size computation by setting mapsize field.
^^^^
Here's a typo
Adrian
On Sat, Apr 27, 2019 at 02:52:18PM +0200, Enrico Weigelt, metux IT consult wrote: > Simpily io resource size computation by setting mapsize field. > > Some of the special cases handled by serial8250_port_size() can be > simplified by putting this data to corresponding platform data > or probe function. > --- a/drivers/tty/serial/8250/8250.h > +++ b/drivers/tty/serial/8250/8250.h > @@ -105,6 +105,7 @@ struct serial8250_config { > > #define SERIAL8250_PORT(_base, _irq) SERIAL8250_PORT_FLAGS(_base, _irq, 0) > > +#define SERIAL_RT2880_IOSIZE 0x100 And why this is in the header file and not in corresponding C one? > diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c > index d09af4c..51d6076 100644 > --- a/drivers/tty/serial/8250/8250_port.c > +++ b/drivers/tty/serial/8250/8250_port.c > @@ -2833,11 +2833,7 @@ 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.type == PORT_RT2880) > - return 0x100; > - return 0x1000; > - } > + > if (is_omap1_8250(pt)) > return 0x16 << pt->port.regshift; This is good. We definitely need to get rid of custom stuff in generic 8250_port, etc.
On 28.04.19 17:21, Andy Shevchenko wrote: > >> +#define SERIAL_RT2880_IOSIZE 0x100 > > And why this is in the header file and not in corresponding C one? hmm, no particular reason, maybe just an old habit to put definitions into .h files ;-) I can move it to 8250_of.c if you like me to. --mtx
On Mon, Apr 29, 2019 at 08:48:53AM +0200, Enrico Weigelt, metux IT consult wrote: > On 28.04.19 17:21, Andy Shevchenko wrote: > >> +#define SERIAL_RT2880_IOSIZE 0x100 > > > > And why this is in the header file and not in corresponding C one? > > hmm, no particular reason, maybe just an old habit to put definitions > into .h files ;-) > > I can move it to 8250_of.c if you like me to. Please, do.
On 27.04.19 15:03, John Paul Adrian Glaubitz wrote: > On 4/27/19 2:52 PM, Enrico Weigelt, metux IT consult wrote: >> Simpily io resource size computation by setting mapsize field. > ^^^^ > Here's a typo thx. fixed. --mtx
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c index 1454d9f..226096d 100644 --- a/arch/mips/alchemy/common/platform.c +++ b/arch/mips/alchemy/common/platform.c @@ -51,6 +51,7 @@ static void alchemy_8250_pm(struct uart_port *port, unsigned int state, #define PORT(_base, _irq) \ { \ .mapbase = _base, \ + .mapsize = 0x1000, \ .irq = _irq, \ .regshift = 2, \ .iotype = UPIO_AU, \ diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h index 89e3f09..7984aad 100644 --- a/drivers/tty/serial/8250/8250.h +++ b/drivers/tty/serial/8250/8250.h @@ -105,6 +105,7 @@ struct serial8250_config { #define SERIAL8250_PORT(_base, _irq) SERIAL8250_PORT_FLAGS(_base, _irq, 0) +#define SERIAL_RT2880_IOSIZE 0x100 static inline int serial_in(struct uart_8250_port *up, int offset) { diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c index 0277479c..08157a1 100644 --- a/drivers/tty/serial/8250/8250_of.c +++ b/drivers/tty/serial/8250/8250_of.c @@ -185,6 +185,7 @@ static int of_platform_serial_setup(struct platform_device *ofdev, case PORT_RT2880: port->iotype = UPIO_AU; + port->mapsize = SERIAL_RT2880_IOSIZE; break; } diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index d09af4c..51d6076 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2833,11 +2833,7 @@ 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.type == PORT_RT2880) - return 0x100; - return 0x1000; - } + if (is_omap1_8250(pt)) return 0x16 << pt->port.regshift;
Simpily io resource size computation by setting mapsize field. Some of the special cases handled by serial8250_port_size() can be simplified by putting this data to corresponding platform data or probe function. Signed-off-by: Enrico Weigelt <info@metux.net> --- arch/mips/alchemy/common/platform.c | 1 + drivers/tty/serial/8250/8250.h | 1 + drivers/tty/serial/8250/8250_of.c | 1 + drivers/tty/serial/8250/8250_port.c | 6 +----- 4 files changed, 4 insertions(+), 5 deletions(-)