From: NIIBE Y. <gn...@ch...> - 2000-05-01 10:53:30
|
... is support of SH7709A. To compare the behavior (of SH-4), I worked for SH7709A (in the office). It's another SolutionEngine. It also failed with RAMDISK support (like SH-4). In my home, SH7708 works fine (with no RAMDISK), RAMDISK may be the cause. It would be good if PCLK is _not_ constant, but get the value from time.c. I'll commit this tomorrow. -------------------------- 2000-05-01 NIIBE Yutaka <gn...@m1...> Support of SH7709A. * arch/sh/kernel/time.c (do_timer_interrupt): Remove Takeshi's debugging code (output to Port C). * drivers/char/sh-sci.h (PCLK): Added value for my SH7709A board. * drivers/char/sh-sci.c (sci_set_termios_cflag): Added SH7709's SCPCR/SCPDR handling. (put_char, get_char): Added dummy read of SC_SR, Without this, some garbage characters would appear in the line on SH7709A. Index: arch/sh/kernel/time.c =================================================================== RCS file: /cvsroot/linuxsh/kernel/arch/sh/kernel/time.c,v retrieving revision 1.5 diff -u -r1.5 time.c --- arch/sh/kernel/time.c 2000/04/30 23:33:47 1.5 +++ arch/sh/kernel/time.c 2000/05/01 10:35:48 @@ -204,13 +204,6 @@ static inline void do_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) { do_timer(regs); -#ifdef TAKESHI - { - unsigned long what_is_this=0xa4000124; - - ctrl_outb(ctrl_inb(what_is_this)+1,what_is_this); - } -#endif #if 0 if (!user_mode(regs)) sh_do_profile(regs->pc); Index: drivers/char/sh-sci.c =================================================================== RCS file: /cvsroot/linuxsh/kernel/drivers/char/sh-sci.c,v retrieving revision 1.4 diff -u -r1.4 sh-sci.c --- drivers/char/sh-sci.c 2000/04/15 07:08:02 1.4 +++ drivers/char/sh-sci.c 2000/05/01 10:35:49 @@ -189,10 +189,35 @@ ctrl_out(smr_val, SCSMR); #if defined(CONFIG_SH_SCIF_SERIAL) +#if defined(__sh3__) + { /* For SH7709, SH7709A, SH7729 */ + unsigned short data; + + /* We need to set SCPCR to enable RTS/CTS */ + data = ctrl_inw(SCPCR); + /* Clear out SCP7MD1,0, SCP6MD1,0, SCP4MD1,0*/ + ctrl_outw(data&0x0fcf, SCPCR); + } +#endif if (C_CRTSCTS(port->gs.tty)) fcr_val |= 0x08; - else + else { +#if defined(__sh3__) + unsigned short data; + + /* We need to set SCPCR to enable RTS/CTS */ + data = ctrl_inw(SCPCR); + /* Clear out SCP7MD1,0, SCP4MD1,0, + Set SCP6MD1,0 = {01} (output) */ + ctrl_outw((data&0x0fcf)|0x1000, SCPCR); + + data = ctrl_inb(SCPDR); + /* Set /RTS2 (bit6) = 0 */ + ctrl_outb(data&0xbf, SCPDR); +#elif defined(__SH4__) ctrl_outw(0x0080, SCSPTR); /* Set RTS = 1 */ +#endif + } ctrl_out(fcr_val, SCFCR); #endif @@ -789,8 +814,8 @@ while (!(status & SCI_TD_E)); ctrl_outb(c, SC_TDR); + ctrl_in(SC_SR); /* Dummy read */ ctrl_out(SCI_TD_E_CLEAR, SC_SR); - restore_flags(flags); } @@ -817,6 +842,7 @@ } } while (!(status & SCI_RD_F)); c = ctrl_inb(SC_RDR); + ctrl_in(SC_SR); /* Dummy read */ ctrl_out(SCI_RDRF_CLEAR, SC_SR); restore_flags(flags); Index: drivers/char/sh-sci.h =================================================================== RCS file: /cvsroot/linuxsh/kernel/drivers/char/sh-sci.h,v retrieving revision 1.2 diff -u -r1.2 sh-sci.h --- drivers/char/sh-sci.h 2000/04/14 17:25:44 1.2 +++ drivers/char/sh-sci.h 2000/05/01 10:35:49 @@ -69,7 +69,10 @@ #define SC_RDR 0xA400015A #define SCFCR (volatile unsigned char *)0xA400015C #define SCFDR 0xA400015E -#undef SCSPTR /* Is there any register for RTS?? */ + +#undef SCSPTR /* SH7709 doesn't have SCSPTR */ +#define SCPCR 0xA4000116 /* Instead, it has SCPCR and SCPDR */ +#define SCPDR 0xA4000136 #undef SCLSR #define SCSCR_INIT 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ @@ -187,8 +190,17 @@ * -- Greg Banks 27Feb2000 */ +/* + * XXX: Well, this is not relevant... + * Should we have config option for peripheral clock? + * Or we get the value from time.c. + */ #if defined(__sh3__) -#define PCLK 14745600 +#if defined(CONFIG_CPU_SUBTYPE_SH7709) +#define PCLK 33333333 +#else +#define PCLK 14745600 /* Isn't it 15MHz? */ +#endif #elif defined(__SH4__) #define PCLK 33333333 #endif |