22#include <linux/io.h>
33#include <linux/gpio.h>
44
5- #if defined(CONFIG_H83007 ) || defined(CONFIG_H83068 )
6- #include <asm/regs306x.h>
7- #endif
8- #if defined(CONFIG_H8S2678 )
9- #include <asm/regs267x.h>
10- #endif
11-
125#if defined(CONFIG_CPU_SUBTYPE_SH7706 ) || \
136 defined(CONFIG_CPU_SUBTYPE_SH7707 ) || \
147 defined(CONFIG_CPU_SUBTYPE_SH7708 ) || \
7265#elif defined(CONFIG_CPU_SUBTYPE_SH4_202 )
7366# define SCSPTR2 0xffe80020 /* 16 bit SCIF */
7467# define SCIF_ORER 0x0001 /* overrun error bit */
75- #elif defined(CONFIG_H83007 ) || defined(CONFIG_H83068 )
76- # define H8300_SCI_DR (ch ) *(volatile char *)(P1DR + h8300_sci_pins[ch].port)
77- #elif defined(CONFIG_H8S2678 )
78- # define H8300_SCI_DR (ch ) *(volatile char *)(P1DR + h8300_sci_pins[ch].port)
7968#elif defined(CONFIG_CPU_SUBTYPE_SH7757 )
8069# define SCSPTR0 0xfe4b0020
8170# define SCIF_ORER 0x0001
223212 } \
224213 }
225214
226- #ifdef CONFIG_H8300
227- /* h8300 don't have SCIF */
228- #define CPU_SCIF_FNS (name ) \
229- static inline unsigned int sci_##name##_in(struct uart_port *port) \
230- { \
231- return 0; \
232- } \
233- static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \
234- { \
235- }
236- #else
237215#define CPU_SCIF_FNS (name , scif_offset , scif_size ) \
238216 static inline unsigned int sci_##name##_in(struct uart_port *port) \
239217 { \
243221 { \
244222 SCI_OUT(scif_size, scif_offset, value); \
245223 }
246- #endif
247224
248225#define CPU_SCI_FNS (name , sci_offset , sci_size ) \
249226 static inline unsigned int sci_##name##_in(struct uart_port* port) \
262239 defined(CONFIG_ARCH_SH7372 )
263240#if defined(CONFIG_CPU_SUBTYPE_SH7710 ) || defined(CONFIG_CPU_SUBTYPE_SH7712 )
264241#define SCIx_FNS (name , sh3_sci_offset , sh3_sci_size , sh4_sci_offset , sh4_sci_size , \
265- sh3_scif_offset , sh3_scif_size , sh4_scif_offset , sh4_scif_size , \
266- h8_sci_offset , h8_sci_size ) \
242+ sh3_scif_offset , sh3_scif_size , sh4_scif_offset , sh4_scif_size ) \
267243 CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size)
268244#define SCIF_FNS (name , sh3_scif_offset , sh3_scif_size , sh4_scif_offset , sh4_scif_size ) \
269245 CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
282258 CPU_SCIF_FNS(name, scif_offset, scif_size)
283259#else
284260#define SCIx_FNS (name , sh3_sci_offset , sh3_sci_size , sh4_sci_offset , sh4_sci_size , \
285- sh3_scif_offset , sh3_scif_size , sh4_scif_offset , sh4_scif_size , \
286- h8_sci_offset , h8_sci_size ) \
261+ sh3_scif_offset , sh3_scif_size , sh4_scif_offset , sh4_scif_size ) \
287262 CPU_SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh3_scif_offset, sh3_scif_size)
288263#define SCIF_FNS (name , sh3_scif_offset , sh3_scif_size , sh4_scif_offset , sh4_scif_size ) \
289264 CPU_SCIF_FNS(name, sh3_scif_offset, sh3_scif_size)
290265#endif
291- #elif defined(__H8300H__ ) || defined(__H8300S__ )
292- #define SCIx_FNS (name , sh3_sci_offset , sh3_sci_size , sh4_sci_offset , sh4_sci_size , \
293- sh3_scif_offset , sh3_scif_size , sh4_scif_offset , sh4_scif_size , \
294- h8_sci_offset , h8_sci_size ) \
295- CPU_SCI_FNS(name, h8_sci_offset, h8_sci_size)
296- #define SCIF_FNS (name , sh3_scif_offset , sh3_scif_size , sh4_scif_offset , sh4_scif_size ) \
297- CPU_SCIF_FNS(name)
298266#elif defined(CONFIG_CPU_SUBTYPE_SH7723 ) || \
299267 defined(CONFIG_CPU_SUBTYPE_SH7724 )
300268 #define SCIx_FNS (name , sh4_scifa_offset , sh4_scifa_size , sh4_scif_offset , sh4_scif_size ) \
303271 CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
304272#else
305273#define SCIx_FNS (name , sh3_sci_offset , sh3_sci_size , sh4_sci_offset , sh4_sci_size , \
306- sh3_scif_offset , sh3_scif_size , sh4_scif_offset , sh4_scif_size , \
307- h8_sci_offset , h8_sci_size ) \
274+ sh3_scif_offset , sh3_scif_size , sh4_scif_offset , sh4_scif_size ) \
308275 CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size)
309276#define SCIF_FNS (name , sh3_scif_offset , sh3_scif_size , sh4_scif_offset , sh4_scif_size ) \
310277 CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
@@ -353,14 +320,14 @@ SCIF_FNS(SCFCR, 0x18, 16)
353320SCIF_FNS (SCFDR , 0x1c , 16 )
354321SCIF_FNS (SCLSR , 0x24 , 16 )
355322#else
356- /* reg SCI/SH3 SCI/SH4 SCIF/SH3 SCIF/SH4 SCI/H8 */
357- /* name off sz off sz off sz off sz off sz */
358- SCIx_FNS (SCSMR , 0x00 , 8 , 0x00 , 8 , 0x00 , 8 , 0x00 , 16 , 0x00 , 8 )
359- SCIx_FNS (SCBRR , 0x02 , 8 , 0x04 , 8 , 0x02 , 8 , 0x04 , 8 , 0x01 , 8 )
360- SCIx_FNS (SCSCR , 0x04 , 8 , 0x08 , 8 , 0x04 , 8 , 0x08 , 16 , 0x02 , 8 )
361- SCIx_FNS (SCxTDR , 0x06 , 8 , 0x0c , 8 , 0x06 , 8 , 0x0C , 8 , 0x03 , 8 )
362- SCIx_FNS (SCxSR , 0x08 , 8 , 0x10 , 8 , 0x08 , 16 , 0x10 , 16 , 0x04 , 8 )
363- SCIx_FNS (SCxRDR , 0x0a , 8 , 0x14 , 8 , 0x0A , 8 , 0x14 , 8 , 0x05 , 8 )
323+ /* reg SCI/SH3 SCI/SH4 SCIF/SH3 SCIF/SH4 */
324+ /* name off sz off sz off sz off sz */
325+ SCIx_FNS (SCSMR , 0x00 , 8 , 0x00 , 8 , 0x00 , 8 , 0x00 , 16 )
326+ SCIx_FNS (SCBRR , 0x02 , 8 , 0x04 , 8 , 0x02 , 8 , 0x04 , 8 )
327+ SCIx_FNS (SCSCR , 0x04 , 8 , 0x08 , 8 , 0x04 , 8 , 0x08 , 16 )
328+ SCIx_FNS (SCxTDR , 0x06 , 8 , 0x0c , 8 , 0x06 , 8 , 0x0C , 8 )
329+ SCIx_FNS (SCxSR , 0x08 , 8 , 0x10 , 8 , 0x08 , 16 , 0x10 , 16 )
330+ SCIx_FNS (SCxRDR , 0x0a , 8 , 0x14 , 8 , 0x0A , 8 , 0x14 , 8 )
364331SCIF_FNS (SCFCR , 0x0c , 8 , 0x18 , 16 )
365332#if defined(CONFIG_CPU_SUBTYPE_SH7760 ) || \
366333 defined(CONFIG_CPU_SUBTYPE_SH7780 ) || \
@@ -390,48 +357,6 @@ SCIF_FNS(SCLSR, 0, 0, 0x24, 16)
390357#define sci_in (port , reg ) sci_##reg##_in(port)
391358#define sci_out (port , reg , value ) sci_##reg##_out(port, value)
392359
393- /* H8/300 series SCI pins assignment */
394- #if defined(__H8300H__ ) || defined(__H8300S__ )
395- static const struct __attribute__((packed )) {
396- int port ; /* GPIO port no */
397- unsigned short rx ,tx ; /* GPIO bit no */
398- } h8300_sci_pins [] = {
399- #if defined(CONFIG_H83007 ) || defined (CONFIG_H83068 )
400- { /* SCI0 */
401- .port = H8300_GPIO_P9 ,
402- .rx = H8300_GPIO_B2 ,
403- .tx = H8300_GPIO_B0 ,
404- },
405- { /* SCI1 */
406- .port = H8300_GPIO_P9 ,
407- .rx = H8300_GPIO_B3 ,
408- .tx = H8300_GPIO_B1 ,
409- },
410- { /* SCI2 */
411- .port = H8300_GPIO_PB ,
412- .rx = H8300_GPIO_B7 ,
413- .tx = H8300_GPIO_B6 ,
414- }
415- #elif defined(CONFIG_H8S2678 )
416- { /* SCI0 */
417- .port = H8300_GPIO_P3 ,
418- .rx = H8300_GPIO_B2 ,
419- .tx = H8300_GPIO_B0 ,
420- },
421- { /* SCI1 */
422- .port = H8300_GPIO_P3 ,
423- .rx = H8300_GPIO_B3 ,
424- .tx = H8300_GPIO_B1 ,
425- },
426- { /* SCI2 */
427- .port = H8300_GPIO_P5 ,
428- .rx = H8300_GPIO_B1 ,
429- .tx = H8300_GPIO_B0 ,
430- }
431- #endif
432- };
433- #endif
434-
435360#if defined(CONFIG_CPU_SUBTYPE_SH7706 ) || \
436361 defined(CONFIG_CPU_SUBTYPE_SH7707 ) || \
437362 defined(CONFIG_CPU_SUBTYPE_SH7708 ) || \
@@ -454,12 +379,6 @@ static inline int sci_rxd_in(struct uart_port *port)
454379 return __raw_readb (SCSPTR1 )& 0x01 ? 1 : 0 ; /* SCI */
455380 return 1 ;
456381}
457- #elif defined(__H8300H__ ) || defined(__H8300S__ )
458- static inline int sci_rxd_in (struct uart_port * port )
459- {
460- int ch = (port -> mapbase - SMR0 ) >> 3 ;
461- return (H8300_SCI_DR (ch ) & h8300_sci_pins [ch ].rx ) ? 1 : 0 ;
462- }
463382#else /* default case for non-SCI processors */
464383static inline int sci_rxd_in (struct uart_port * port )
465384{
0 commit comments