linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: linux-sh@vger.kernel.org
Subject: [PATCH v2] serial: sh-sci: byte allocated register support
Date: Sun, 22 Jul 2018 13:02:14 +0000	[thread overview]
Message-ID: <20180722130214.19572-1-ysato@users.sourceforge.jp> (raw)
In-Reply-To: <20180721143436.43675-1-ysato@users.sourceforge.jp>

H8/300 SCI registers allocated byte address.
It must support to the case where shift count is 0.

Changes v2.
more simply code.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
---
 drivers/tty/serial/sh-sci.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index c181eb37f985..3c7326e11d37 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2863,10 +2863,12 @@ static int sci_init_single(struct platform_device *dev,
 	port->fifosize		= sci_port->params->fifosize;
 
 	if (port->type = PORT_SCI) {
-		if (sci_port->reg_size >= 0x20)
-			port->regshift = 2;
-		else
-			port->regshift = 1;
+		/*
+		 * reg_size < 0x10: BYTE aligned (scale factor=1).
+		 * reg_size >= 0x10 and < 0x20: WORD aligned (scale factor=2).
+		 * reg_size >= 0x20: DWORD aligned (scale factor=4).
+		 */
+		port->regshift = sci_port->reg_size >> 4;
 	}
 
 	/*
-- 
2.11.0


  reply	other threads:[~2018-07-22 13:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-21 14:34 [PATCH v2] serial: sh-sci: byte allocated register support Yoshinori Sato
2018-07-22 13:02 ` Yoshinori Sato [this message]
2018-07-23  8:17 ` Geert Uytterhoeven
2018-08-08 17:52 ` Geert Uytterhoeven
2018-08-09 14:41 ` Yoshinori Sato

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=20180722130214.19572-1-ysato@users.sourceforge.jp \
    --to=ysato@users.sourceforge.jp \
    --cc=linux-sh@vger.kernel.org \
    /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 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).