Modify sh-sci.h to adopt specific serial behaviour of SH-2007
Quoted 7 lines · Hitoshi Mitake
Two points are changed,
* At end ofsci_set_termios(), the valueSCSCR_INIT(port)is written to SCSCR. And the value of it for Subtype 7780 is0x3a. 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.
Quoted 5 lines
* 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.
Quoted 23 lines
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.hin 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 <[email protected]>--- drivers/serial/sh-sci.h | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)drivers/serial/sh-sci.h +2
-1# 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 )
drivers/serial/sh-sci.h
Quoted 10 lines
drivers/serial/sh-sci.h +7
-0+/* 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..
Quoted 4 lines
drivers/serial/sh-sci.h +0
-0@@ -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 )
drivers/serial/sh-sci.h static inline int sci_rxd_in(struct uart_port *port) · line 622
Quoted 10 lines
drivers/serial/sh-sci.h +6
-0+ +#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)