From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH 4/4] Modify sh-sci.h to adopt specific serial behaviour of SH-2007
Date: Wed, 02 Jun 2010 06:37:21 +0000 [thread overview]
Message-ID: <20100602063721.GG15411@linux-sh.org> (raw)
On Mon, May 31, 2010 at 04:59:56PM +0900, Hitoshi Mitake wrote:
> Two points are changed,
> * At end of sci_set_termios(), the value SCSCR_INIT(port)
> is written to SCSCR. And the value of it for Subtype 7780
> is 0x3a. This containts CKE1=1.
> But, when this value is written to serial device of SH-2007,
> this will stop. So we have to drop the flag of CKE1.
>
> * Baud rate written to SCBRR should be caliculated with this expression:
> ((clk+16*bps)/(32*bps)-1)
> Original form of this expression is:
> ((clk+16*bps)/(16*bps)-1)
>
I don't have any particular problems with this, the entire serial setup
is incredibly messy. I've been slowly rewriting most of the header to get
rid of this stuff, but it will still be some time before that work is
complete.
> These two points are really mysterious.
> But I don't have the way to validate processor on SH-2007,
> so I've mocked the kernel provided by the manufacture of this board :(
> ( http://ms-n.org/sh-linux/kernel/ )
>
> This patch fix sh-sci.h in dirty way,
> but fortunately, this has no harm for other board and processors supports.
> If you permit to apply this patch,
> I'd like to find cause of this behaviour and revert this change someday.
>
> Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
> ---
> drivers/serial/sh-sci.h | 16 +++++++++++++++-
> 1 files changed, 15 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h
> index f70c49f..f8c684c 100644
> --- a/drivers/serial/sh-sci.h
> +++ b/drivers/serial/sh-sci.h
> # define SCIF_ORER 0x0001 /* Overrun error bit */
> -# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
> +
> +#if defined(CONFIG_SH_SH2007)
> +/* TIE=0,RIE=0,TE=1,RE=1,REIE=1,CKE1=0 */
> +# define SCSCR_INIT(port) 0x38
> +#else
> +/* TIE=0,RIE=0,TE=1,RE=1,REIE=1,CKE1=1 */
> +# define SCSCR_INIT(port) 0x3a
> +#endif
> +
> #elif defined(CONFIG_CPU_SUBTYPE_SH7785) || \
> defined(CONFIG_CPU_SUBTYPE_SH7786)
> # define SCSPTR0 0xffea0024 /* 16 bit SCIF */
This is ok, but..
> @@ -602,7 +610,13 @@ static inline int sci_rxd_in(struct uart_port *port)
> #if defined(CONFIG_CPU_SUBTYPE_SH7780) || \
> defined(CONFIG_CPU_SUBTYPE_SH7785) || \
> defined(CONFIG_CPU_SUBTYPE_SH7786)
> +
> +#if defined(CONFIG_SH_SH2007)
> +#define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(32*bps)-1)
> +#else
> #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1)
> +#endif
> +
> #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
> defined(CONFIG_CPU_SUBTYPE_SH7720) || \
> defined(CONFIG_CPU_SUBTYPE_SH7721) || \
This is just defaulting to the generic SH baudrate calculation, so you
can accomplish the same thing by just changing this to:
#if defined(CONFIG_CPU_SUBTYPE_SH7780) || \
defined(CONFIG_CPU_SUBTYPE_SH7785) || \
defined(CONFIG_CPU_SUBTYPE_SH7786) && \
!defined(CONFIG_SH_SH2007)
next reply other threads:[~2010-06-02 6:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-02 6:37 Paul Mundt [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-05-31 7:59 [PATCH 4/4] Modify sh-sci.h to adopt specific serial behaviour of SH-2007 Hitoshi Mitake
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=20100602063721.GG15411@linux-sh.org \
--to=lethal@linux-sh.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.