Skip to contentSkip to conversation

serial: sh-sci: fix register alocation in h8300.

RFC PATCH In review Yoshinori Sato 2 participants 3 messages Jul 11, 2018 – Jul 12, 2018

Subsystems (2)
lore
Share & tools
lore

Yoshinori Sato

author maintainer
#0 lore raw

RFC PATCH 1/1 serial: sh-sci: fix register alocation in h8300.

h8300's SCI registers aligned byte address. Although it may be appropriate to put it in sci_port_params, because I can not think of a good way, I did it like this.

---
 drivers/tty/serial/sh-sci.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/tty/serial/sh-sci.c +4 -0
index c181eb37f985..827ef57cebb8 100644
@@ -2862,12 +2862,16 @@ static int sci_init_single(struct platform_device *dev,
 	port->flags		= UPF_FIXED_PORT | UPF_BOOT_AUTOCONF | p->flags;
 	port->fifosize		= sci_port->params->fifosize;
 
+#if !defined(CONFIG_H8300)
 	if (port->type = PORT_SCI) {
 		if (sci_port->reg_size >= 0x20)
 			port->regshift = 2;
 		else
 			port->regshift = 1;
 	}
+#else
+	port->regshift = 0;
+#endif
 
 	/*
 	 * The UART port needs an IRQ value, so we peg this to the RX IRQ
Signature · 1 line
2.11.0
#1 lore raw

Hi Sato-san,

CC Laurent

Quoted 5 lines · Yoshinori Sato

h8300's SCI registers aligned byte address. Although it may be appropriate to put it in sci_port_params, because I can not think of a good way, I did it like this.

Thanks for your patch!

Fixes dfc80387aefb7816 ("serial: sh-sci: Compute the regshift value

for SCI ports")

Quoted 6 lines
drivers/tty/serial/sh-sci.c +0 -0
@@ -2862,12 +2862,16 @@ static int sci_init_single(struct platform_device *dev,
        port->flags             = UPF_FIXED_PORT | UPF_BOOT_AUTOCONF | p->flags;
        port->fifosize          = sci_port->params->fifosize;
 

drivers/tty/serial/sh-sci.c static int sci_init_single(struct platform_device *dev, · line 2874

Quoted 10 lines
drivers/tty/serial/sh-sci.c +4 -0
+#if !defined(CONFIG_H8300)
        if (port->type = PORT_SCI) {
                if (sci_port->reg_size >= 0x20)
                        port->regshift = 2;
                else
                        port->regshift = 1;
        }
+#else
+       port->regshift = 0;
+#endif

What about using reg_size instead?

        if (sci_port->reg_size >= 0x20)
                port->regshift = 2;
        else if (sci_port->reg_size >= 0x10)
                port->regshift = 1;
        else
                port->regshift = 0;

drivers/tty/serial/sh-sci.c static int sci_init_single(struct platform_device *dev, · line 2877

Quoted 2 lines
drivers/tty/serial/sh-sci.c +0 -0
        /*
         * The UART port needs an IRQ value, so we peg this to the RX IRQ

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#2 lore raw
In reply to Yoshinori Sato
Quoted 37 lines · Geert Uytterhoeven

Hi Sato-san,

CC Laurent

Quoted 5 lines · Yoshinori Sato

h8300's SCI registers aligned byte address. Although it may be appropriate to put it in sci_port_params, because I can not think of a good way, I did it like this.

Thanks for your patch!

Fixes dfc80387aefb7816 ("serial: sh-sci: Compute the regshift value

for SCI ports")

Quoted 6 lines
drivers/tty/serial/sh-sci.c +0 -0
@@ -2862,12 +2862,16 @@ static int sci_init_single(struct platform_device *dev,
        port->flags             = UPF_FIXED_PORT | UPF_BOOT_AUTOCONF | p->flags;
        port->fifosize          = sci_port->params->fifosize;
 

drivers/tty/serial/sh-sci.c static int sci_init_single(struct platform_device *dev, · line 2874

Quoted 10 lines
drivers/tty/serial/sh-sci.c +4 -0
+#if !defined(CONFIG_H8300)
        if (port->type = PORT_SCI) {
                if (sci_port->reg_size >= 0x20)
                        port->regshift = 2;
                else
                        port->regshift = 1;
        }
+#else
+       port->regshift = 0;
+#endif

What about using reg_size instead?

Quoted 10 lines
        if (sci_port->reg_size >= 0x20)
                port->regshift = 2;
        else if (sci_port->reg_size >= 0x10)
                port->regshift = 1;
        else
                port->regshift = 0;
Quoted 2 lines
drivers/tty/serial/sh-sci.c +0 -0
        /*
         * The UART port needs an IRQ value, so we peg this to the RX IRQ

It looks more better fix.
And works fine of h8300.

Thanks.

Quoted 10 lines

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds