blob: b11127d0edab0e613f8d615923420af44560eaf0 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* $Id: sh-sci.h,v 1.4 2004/02/19 16:43:56 lethal Exp $
2 *
3 * linux/drivers/serial/sh-sci.h
4 *
5 * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO)
6 * Copyright (C) 1999, 2000 Niibe Yutaka
7 * Copyright (C) 2000 Greg Banks
8 * Copyright (C) 2002, 2003 Paul Mundt
9 * Modified to support multiple serial ports. Stuart Menefy (May 2000).
10 * Modified to support SH7300(SH-Mobile) SCIF. Takashi Kusuda (Jun 2003).
11 * Modified to support H8/300 Series Yoshinori Sato (Feb 2004).
12 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/serial_core.h>
Paul Mundte108b2c2006-09-27 16:32:13 +090014#include <asm/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
16#if defined(__H8300H__) || defined(__H8300S__)
17#include <asm/gpio.h>
18#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
19#include <asm/regs306x.h>
20#endif
21#if defined(CONFIG_H8S2678)
22#include <asm/regs267x.h>
23#endif
24#endif
25
Magnus Damm0fbde952007-07-26 10:14:16 +090026#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
27 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
28 defined(CONFIG_CPU_SUBTYPE_SH7708) || \
29 defined(CONFIG_CPU_SUBTYPE_SH7709)
Linus Torvalds1da177e2005-04-16 15:20:36 -070030# define SCPCR 0xA4000116 /* 16 bit SCI and SCIF */
31# define SCPDR 0xA4000136 /* 8 bit SCI and SCIF */
32# define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
33# define SCI_AND_SCIF
34#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
35# define SCIF0 0xA4400000
36# define SCIF2 0xA4410000
Paul Mundtb7a76e42006-02-01 03:06:06 -080037# define SCSMR_Ir 0xA44A0000
38# define IRDA_SCIF SCIF0
Linus Torvalds1da177e2005-04-16 15:20:36 -070039# define SCPCR 0xA4000116
40# define SCPDR 0xA4000136
41
42/* Set the clock source,
43 * SCIF2 (0xA4410000) -> External clock, SCK pin used as clock input
44 * SCIF0 (0xA4400000) -> Internal clock, SCK pin as serial clock output
45 */
46# define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0
47# define SCIF_ONLY
48#elif defined(CONFIG_SH_RTS7751R2D)
Linus Torvalds1da177e2005-04-16 15:20:36 -070049# define SCSPTR2 0xFFE80020 /* 16 bit SCIF */
50# define SCIF_ORER 0x0001 /* overrun error bit */
51# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
52# define SCIF_ONLY
Paul Mundt05627482007-05-15 16:25:47 +090053#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \
54 defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
55 defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
56 defined(CONFIG_CPU_SUBTYPE_SH7091) || \
57 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
58 defined(CONFIG_CPU_SUBTYPE_SH7751R)
Linus Torvalds1da177e2005-04-16 15:20:36 -070059# define SCSPTR1 0xffe0001c /* 8 bit SCI */
60# define SCSPTR2 0xFFE80020 /* 16 bit SCIF */
61# define SCIF_ORER 0x0001 /* overrun error bit */
62# define SCSCR_INIT(port) (((port)->type == PORT_SCI) ? \
63 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ : \
64 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ )
65# define SCI_AND_SCIF
66#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
Paul Mundtb7a76e42006-02-01 03:06:06 -080067# define SCSPTR0 0xfe600024 /* 16 bit SCIF */
68# define SCSPTR1 0xfe610024 /* 16 bit SCIF */
69# define SCSPTR2 0xfe620024 /* 16 bit SCIF */
Linus Torvalds1da177e2005-04-16 15:20:36 -070070# define SCIF_ORER 0x0001 /* overrun error bit */
71# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
72# define SCIF_ONLY
73#elif defined(CONFIG_CPU_SUBTYPE_SH7300)
Linus Torvalds1da177e2005-04-16 15:20:36 -070074# define SCPCR 0xA4050116 /* 16 bit SCIF */
75# define SCPDR 0xA4050136 /* 16 bit SCIF */
76# define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */
77# define SCIF_ONLY
Paul Mundt2b1bd1a2007-06-20 18:27:10 +090078#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
Paul Mundte108b2c2006-09-27 16:32:13 +090079# define SCSPTR0 0xA4400000 /* 16 bit SCIF */
Nobuhiro Iwamatsu9465a542007-03-27 18:13:51 +090080# define SCI_NPORTS 2
81# define SCIF_ORER 0x0001 /* overrun error bit */
82# define PACR 0xa4050100
83# define PBCR 0xa4050102
84# define SCSCR_INIT(port) 0x3B
Paul Mundte108b2c2006-09-27 16:32:13 +090085# define SCIF_ONLY
Paul Mundte108b2c2006-09-27 16:32:13 +090086#elif defined(CONFIG_CPU_SUBTYPE_SH7343)
87# define SCSPTR0 0xffe00010 /* 16 bit SCIF */
88# define SCSPTR1 0xffe10010 /* 16 bit SCIF */
89# define SCSPTR2 0xffe20010 /* 16 bit SCIF */
90# define SCSPTR3 0xffe30010 /* 16 bit SCIF */
91# define SCSCR_INIT(port) 0x32 /* TIE=0,RIE=0,TE=1,RE=1,REIE=0,CKE=1 */
92# define SCIF_ONLY
Paul Mundt41504c32006-12-11 20:28:03 +090093#elif defined(CONFIG_CPU_SUBTYPE_SH7722)
94# define SCPDR0 0xA405013E /* 16 bit SCIF0 PSDR */
95# define SCSPTR0 SCPDR0
96# define SCIF_ORER 0x0001 /* overrun error bit */
97# define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
98# define SCIF_ONLY
99# define PORT_PSCR 0xA405011E
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100#elif defined(CONFIG_CPU_SUBTYPE_SH4_202)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101# define SCSPTR2 0xffe80020 /* 16 bit SCIF */
102# define SCIF_ORER 0x0001 /* overrun error bit */
103# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
104# define SCIF_ONLY
105#elif defined(CONFIG_CPU_SUBTYPE_ST40STB1)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106# define SCSPTR1 0xffe00020 /* 16 bit SCIF */
107# define SCSPTR2 0xffe80020 /* 16 bit SCIF */
108# define SCIF_ORER 0x0001 /* overrun error bit */
109# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
110# define SCIF_ONLY
111#elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103)
112# include <asm/hardware.h>
113# define SCIF_BASE_ADDR 0x01030000
114# define SCIF_ADDR_SH5 PHYS_PERIPHERAL_BLOCK+SCIF_BASE_ADDR
115# define SCIF_PTR2_OFFS 0x0000020
116# define SCIF_LSR2_OFFS 0x0000024
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117# define SCSPTR2 ((port->mapbase)+SCIF_PTR2_OFFS) /* 16 bit SCIF */
118# define SCLSR2 ((port->mapbase)+SCIF_LSR2_OFFS) /* 16 bit SCIF */
119# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,
120 TE=1,RE=1,REIE=1 */
121# define SCIF_ONLY
122#elif defined(CONFIG_H83007) || defined(CONFIG_H83068)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123# define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
124# define SCI_ONLY
125# define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port)
126#elif defined(CONFIG_H8S2678)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127# define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
128# define SCI_ONLY
129# define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port)
Paul Mundtb7a76e42006-02-01 03:06:06 -0800130#elif defined(CONFIG_CPU_SUBTYPE_SH7770)
131# define SCSPTR0 0xff923020 /* 16 bit SCIF */
132# define SCSPTR1 0xff924020 /* 16 bit SCIF */
133# define SCSPTR2 0xff925020 /* 16 bit SCIF */
134# define SCIF_ORER 0x0001 /* overrun error bit */
135# define SCSCR_INIT(port) 0x3c /* TIE=0,RIE=0,TE=1,RE=1,REIE=1,cke=2 */
136# define SCIF_ONLY
137#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
138# define SCSPTR0 0xffe00024 /* 16 bit SCIF */
139# define SCSPTR1 0xffe10024 /* 16 bit SCIF */
Paul Mundte108b2c2006-09-27 16:32:13 +0900140# define SCIF_ORER 0x0001 /* Overrun error bit */
Paul Mundtb7a76e42006-02-01 03:06:06 -0800141# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
142# define SCIF_ONLY
Paul Mundt32351a22007-03-12 14:38:59 +0900143#elif defined(CONFIG_CPU_SUBTYPE_SH7785)
144# define SCSPTR0 0xffea0024 /* 16 bit SCIF */
145# define SCSPTR1 0xffeb0024 /* 16 bit SCIF */
146# define SCSPTR2 0xffec0024 /* 16 bit SCIF */
147# define SCSPTR3 0xffed0024 /* 16 bit SCIF */
148# define SCSPTR4 0xffee0024 /* 16 bit SCIF */
149# define SCSPTR5 0xffef0024 /* 16 bit SCIF */
150# define SCIF_OPER 0x0001 /* Overrun error bit */
151# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
152# define SCIF_ONLY
Yoshinori Sato9d4436a2006-11-05 15:40:13 +0900153#elif defined(CONFIG_CPU_SUBTYPE_SH7206)
154# define SCSPTR0 0xfffe8020 /* 16 bit SCIF */
155# define SCSPTR1 0xfffe8820 /* 16 bit SCIF */
156# define SCSPTR2 0xfffe9020 /* 16 bit SCIF */
157# define SCSPTR3 0xfffe9820 /* 16 bit SCIF */
158# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
159# define SCIF_ONLY
160#elif defined(CONFIG_CPU_SUBTYPE_SH7619)
161# define SCSPTR0 0xf8400020 /* 16 bit SCIF */
162# define SCSPTR1 0xf8410020 /* 16 bit SCIF */
163# define SCSPTR2 0xf8420020 /* 16 bit SCIF */
164# define SCIF_ORER 0x0001 /* overrun error bit */
165# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
166# define SCIF_ONLY
Paul Mundt2b1bd1a2007-06-20 18:27:10 +0900167#elif defined(CONFIG_CPU_SUBTYPE_SHX3)
168# define SCSPTR0 0xffc30020 /* 16 bit SCIF */
169# define SCSPTR1 0xffc40020 /* 16 bit SCIF */
170# define SCSPTR2 0xffc50020 /* 16 bit SCIF */
171# define SCSPTR3 0xffc60020 /* 16 bit SCIF */
172# define SCIF_ORER 0x0001 /* Overrun error bit */
173# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
174# define SCIF_ONLY
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175#else
176# error CPU subtype not defined
177#endif
178
179/* SCSCR */
180#define SCI_CTRL_FLAGS_TIE 0x80 /* all */
181#define SCI_CTRL_FLAGS_RIE 0x40 /* all */
182#define SCI_CTRL_FLAGS_TE 0x20 /* all */
183#define SCI_CTRL_FLAGS_RE 0x10 /* all */
Paul Mundt05627482007-05-15 16:25:47 +0900184#if defined(CONFIG_CPU_SUBTYPE_SH7750) || \
185 defined(CONFIG_CPU_SUBTYPE_SH7091) || \
186 defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
187 defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
188 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
189 defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
190 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
Paul Mundt2b1bd1a2007-06-20 18:27:10 +0900191 defined(CONFIG_CPU_SUBTYPE_SH7785) || \
192 defined(CONFIG_CPU_SUBTYPE_SHX3)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193#define SCI_CTRL_FLAGS_REIE 0x08 /* 7750 SCIF */
194#else
195#define SCI_CTRL_FLAGS_REIE 0
196#endif
197/* SCI_CTRL_FLAGS_MPIE 0x08 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
198/* SCI_CTRL_FLAGS_TEIE 0x04 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
199/* SCI_CTRL_FLAGS_CKE1 0x02 * all */
200/* SCI_CTRL_FLAGS_CKE0 0x01 * 7707 SCI/SCIF, 7708 SCI, 7709 SCI/SCIF, 7750 SCI */
201
202/* SCxSR SCI */
203#define SCI_TDRE 0x80 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
204#define SCI_RDRF 0x40 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
205#define SCI_ORER 0x20 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
206#define SCI_FER 0x10 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
207#define SCI_PER 0x08 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
208#define SCI_TEND 0x04 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
209/* SCI_MPB 0x02 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
210/* SCI_MPBT 0x01 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
211
212#define SCI_ERRORS ( SCI_PER | SCI_FER | SCI_ORER)
213
214/* SCxSR SCIF */
215#define SCIF_ER 0x0080 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
216#define SCIF_TEND 0x0040 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
217#define SCIF_TDFE 0x0020 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
218#define SCIF_BRK 0x0010 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
219#define SCIF_FER 0x0008 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
220#define SCIF_PER 0x0004 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
221#define SCIF_RDF 0x0002 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
222#define SCIF_DR 0x0001 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
223
224#if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7705)
225#define SCIF_ORER 0x0200
226#define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER)
227#define SCIF_RFDC_MASK 0x007f
228#define SCIF_TXROOM_MAX 64
229#else
230#define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
231#define SCIF_RFDC_MASK 0x001f
232#define SCIF_TXROOM_MAX 16
233#endif
234
235#if defined(SCI_ONLY)
236# define SCxSR_TEND(port) SCI_TEND
237# define SCxSR_ERRORS(port) SCI_ERRORS
238# define SCxSR_RDxF(port) SCI_RDRF
239# define SCxSR_TDxE(port) SCI_TDRE
240# define SCxSR_ORER(port) SCI_ORER
241# define SCxSR_FER(port) SCI_FER
242# define SCxSR_PER(port) SCI_PER
243# define SCxSR_BRK(port) 0x00
244# define SCxSR_RDxF_CLEAR(port) 0xbc
245# define SCxSR_ERROR_CLEAR(port) 0xc4
246# define SCxSR_TDxE_CLEAR(port) 0x78
Paul Mundtb7a76e42006-02-01 03:06:06 -0800247# define SCxSR_BREAK_CLEAR(port) 0xc4
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248#elif defined(SCIF_ONLY)
249# define SCxSR_TEND(port) SCIF_TEND
250# define SCxSR_ERRORS(port) SCIF_ERRORS
251# define SCxSR_RDxF(port) SCIF_RDF
252# define SCxSR_TDxE(port) SCIF_TDFE
253#if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7705)
254# define SCxSR_ORER(port) SCIF_ORER
255#else
256# define SCxSR_ORER(port) 0x0000
257#endif
258# define SCxSR_FER(port) SCIF_FER
259# define SCxSR_PER(port) SCIF_PER
260# define SCxSR_BRK(port) SCIF_BRK
261#if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7705)
262# define SCxSR_RDxF_CLEAR(port) (sci_in(port,SCxSR)&0xfffc)
263# define SCxSR_ERROR_CLEAR(port) (sci_in(port,SCxSR)&0xfd73)
264# define SCxSR_TDxE_CLEAR(port) (sci_in(port,SCxSR)&0xffdf)
265# define SCxSR_BREAK_CLEAR(port) (sci_in(port,SCxSR)&0xffe3)
266#else
267/* SH7705 can also use this, clearing is same between 7705 and 7709 and 7300 */
268# define SCxSR_RDxF_CLEAR(port) 0x00fc
269# define SCxSR_ERROR_CLEAR(port) 0x0073
270# define SCxSR_TDxE_CLEAR(port) 0x00df
Paul Mundtb7a76e42006-02-01 03:06:06 -0800271# define SCxSR_BREAK_CLEAR(port) 0x00e3
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272#endif
273#else
274# define SCxSR_TEND(port) (((port)->type == PORT_SCI) ? SCI_TEND : SCIF_TEND)
275# define SCxSR_ERRORS(port) (((port)->type == PORT_SCI) ? SCI_ERRORS : SCIF_ERRORS)
276# define SCxSR_RDxF(port) (((port)->type == PORT_SCI) ? SCI_RDRF : SCIF_RDF)
277# define SCxSR_TDxE(port) (((port)->type == PORT_SCI) ? SCI_TDRE : SCIF_TDFE)
278# define SCxSR_ORER(port) (((port)->type == PORT_SCI) ? SCI_ORER : 0x0000)
279# define SCxSR_FER(port) (((port)->type == PORT_SCI) ? SCI_FER : SCIF_FER)
280# define SCxSR_PER(port) (((port)->type == PORT_SCI) ? SCI_PER : SCIF_PER)
281# define SCxSR_BRK(port) (((port)->type == PORT_SCI) ? 0x00 : SCIF_BRK)
282# define SCxSR_RDxF_CLEAR(port) (((port)->type == PORT_SCI) ? 0xbc : 0x00fc)
283# define SCxSR_ERROR_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x0073)
284# define SCxSR_TDxE_CLEAR(port) (((port)->type == PORT_SCI) ? 0x78 : 0x00df)
285# define SCxSR_BREAK_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x00e3)
286#endif
287
288/* SCFCR */
289#define SCFCR_RFRST 0x0002
290#define SCFCR_TFRST 0x0004
291#define SCFCR_TCRST 0x4000
292#define SCFCR_MCE 0x0008
293
294#define SCI_MAJOR 204
295#define SCI_MINOR_START 8
296
297/* Generic serial flags */
298#define SCI_RX_THROTTLE 0x0000001
299
300#define SCI_MAGIC 0xbabeface
301
302/*
303 * Events are used to schedule things to happen at timer-interrupt
304 * time, instead of at rs interrupt time.
305 */
306#define SCI_EVENT_WRITE_WAKEUP 0
307
Linus Torvalds1da177e2005-04-16 15:20:36 -0700308#define SCI_IN(size, offset) \
309 unsigned int addr = port->mapbase + (offset); \
Paul Mundtb7a76e42006-02-01 03:06:06 -0800310 if ((size) == 8) { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700311 return ctrl_inb(addr); \
Paul Mundtb7a76e42006-02-01 03:06:06 -0800312 } else { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313 return ctrl_inw(addr); \
314 }
315#define SCI_OUT(size, offset, value) \
316 unsigned int addr = port->mapbase + (offset); \
Paul Mundtb7a76e42006-02-01 03:06:06 -0800317 if ((size) == 8) { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318 ctrl_outb(value, addr); \
319 } else { \
320 ctrl_outw(value, addr); \
321 }
322
323#define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\
324 static inline unsigned int sci_##name##_in(struct uart_port *port) \
325 { \
Paul Mundtb7a76e42006-02-01 03:06:06 -0800326 if (port->type == PORT_SCI) { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327 SCI_IN(sci_size, sci_offset) \
328 } else { \
Paul Mundtb7a76e42006-02-01 03:06:06 -0800329 SCI_IN(scif_size, scif_offset); \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330 } \
331 } \
332 static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \
333 { \
334 if (port->type == PORT_SCI) { \
335 SCI_OUT(sci_size, sci_offset, value) \
336 } else { \
337 SCI_OUT(scif_size, scif_offset, value); \
338 } \
339 }
340
341#define CPU_SCIF_FNS(name, scif_offset, scif_size) \
342 static inline unsigned int sci_##name##_in(struct uart_port *port) \
343 { \
Paul Mundtb7a76e42006-02-01 03:06:06 -0800344 SCI_IN(scif_size, scif_offset); \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345 } \
346 static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \
347 { \
348 SCI_OUT(scif_size, scif_offset, value); \
349 }
350
351#define CPU_SCI_FNS(name, sci_offset, sci_size) \
352 static inline unsigned int sci_##name##_in(struct uart_port* port) \
353 { \
Paul Mundtb7a76e42006-02-01 03:06:06 -0800354 SCI_IN(sci_size, sci_offset); \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700355 } \
356 static inline void sci_##name##_out(struct uart_port* port, unsigned int value) \
357 { \
358 SCI_OUT(sci_size, sci_offset, value); \
359 }
360
361#ifdef CONFIG_CPU_SH3
Nobuhiro Iwamatsu9465a542007-03-27 18:13:51 +0900362#if defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
363#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
364 sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
365 h8_sci_offset, h8_sci_size) \
366 CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size)
367#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
368 CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
369#elif defined(CONFIG_CPU_SUBTYPE_SH7300) || \
370 defined(CONFIG_CPU_SUBTYPE_SH7705)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700371#define SCIF_FNS(name, scif_offset, scif_size) \
372 CPU_SCIF_FNS(name, scif_offset, scif_size)
373#else
374#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
375 sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
376 h8_sci_offset, h8_sci_size) \
377 CPU_SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh3_scif_offset, sh3_scif_size)
378#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
379 CPU_SCIF_FNS(name, sh3_scif_offset, sh3_scif_size)
380#endif
381#elif defined(__H8300H__) || defined(__H8300S__)
382#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
383 sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
384 h8_sci_offset, h8_sci_size) \
385 CPU_SCI_FNS(name, h8_sci_offset, h8_sci_size)
386#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size)
387#else
388#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
389 sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
390 h8_sci_offset, h8_sci_size) \
391 CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size)
392#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
393 CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
394#endif
395
Paul Mundte108b2c2006-09-27 16:32:13 +0900396#if defined(CONFIG_CPU_SUBTYPE_SH7300) || \
Nobuhiro Iwamatsu9465a542007-03-27 18:13:51 +0900397 defined(CONFIG_CPU_SUBTYPE_SH7705)
398
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399SCIF_FNS(SCSMR, 0x00, 16)
400SCIF_FNS(SCBRR, 0x04, 8)
401SCIF_FNS(SCSCR, 0x08, 16)
402SCIF_FNS(SCTDSR, 0x0c, 8)
403SCIF_FNS(SCFER, 0x10, 16)
404SCIF_FNS(SCxSR, 0x14, 16)
405SCIF_FNS(SCFCR, 0x18, 16)
406SCIF_FNS(SCFDR, 0x1c, 16)
407SCIF_FNS(SCxTDR, 0x20, 8)
408SCIF_FNS(SCxRDR, 0x24, 8)
409SCIF_FNS(SCLSR, 0x24, 16)
410#else
411/* reg SCI/SH3 SCI/SH4 SCIF/SH3 SCIF/SH4 SCI/H8*/
412/* name off sz off sz off sz off sz off sz*/
413SCIx_FNS(SCSMR, 0x00, 8, 0x00, 8, 0x00, 8, 0x00, 16, 0x00, 8)
414SCIx_FNS(SCBRR, 0x02, 8, 0x04, 8, 0x02, 8, 0x04, 8, 0x01, 8)
415SCIx_FNS(SCSCR, 0x04, 8, 0x08, 8, 0x04, 8, 0x08, 16, 0x02, 8)
416SCIx_FNS(SCxTDR, 0x06, 8, 0x0c, 8, 0x06, 8, 0x0C, 8, 0x03, 8)
417SCIx_FNS(SCxSR, 0x08, 8, 0x10, 8, 0x08, 16, 0x10, 16, 0x04, 8)
418SCIx_FNS(SCxRDR, 0x0a, 8, 0x14, 8, 0x0A, 8, 0x14, 8, 0x05, 8)
419SCIF_FNS(SCFCR, 0x0c, 8, 0x18, 16)
Paul Mundt32351a22007-03-12 14:38:59 +0900420#if defined(CONFIG_CPU_SUBTYPE_SH7760) || \
421 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
422 defined(CONFIG_CPU_SUBTYPE_SH7785)
Paul Mundt6fc21b82006-11-27 12:10:23 +0900423SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16)
Paul Mundtb7a76e42006-02-01 03:06:06 -0800424SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16)
425SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16)
426SCIF_FNS(SCSPTR, 0, 0, 0x24, 16)
427SCIF_FNS(SCLSR, 0, 0, 0x28, 16)
428#else
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16)
430SCIF_FNS(SCSPTR, 0, 0, 0x20, 16)
431SCIF_FNS(SCLSR, 0, 0, 0x24, 16)
432#endif
Paul Mundtb7a76e42006-02-01 03:06:06 -0800433#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434#define sci_in(port, reg) sci_##reg##_in(port)
435#define sci_out(port, reg, value) sci_##reg##_out(port, value)
436
437/* H8/300 series SCI pins assignment */
438#if defined(__H8300H__) || defined(__H8300S__)
439static const struct __attribute__((packed)) {
440 int port; /* GPIO port no */
441 unsigned short rx,tx; /* GPIO bit no */
442} h8300_sci_pins[] = {
443#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
444 { /* SCI0 */
445 .port = H8300_GPIO_P9,
446 .rx = H8300_GPIO_B2,
447 .tx = H8300_GPIO_B0,
448 },
449 { /* SCI1 */
450 .port = H8300_GPIO_P9,
451 .rx = H8300_GPIO_B3,
452 .tx = H8300_GPIO_B1,
453 },
454 { /* SCI2 */
455 .port = H8300_GPIO_PB,
456 .rx = H8300_GPIO_B7,
457 .tx = H8300_GPIO_B6,
458 }
459#elif defined(CONFIG_H8S2678)
460 { /* SCI0 */
461 .port = H8300_GPIO_P3,
462 .rx = H8300_GPIO_B2,
463 .tx = H8300_GPIO_B0,
464 },
465 { /* SCI1 */
466 .port = H8300_GPIO_P3,
467 .rx = H8300_GPIO_B3,
468 .tx = H8300_GPIO_B1,
469 },
470 { /* SCI2 */
471 .port = H8300_GPIO_P5,
472 .rx = H8300_GPIO_B1,
473 .tx = H8300_GPIO_B0,
474 }
475#endif
476};
477#endif
478
Magnus Damm0fbde952007-07-26 10:14:16 +0900479#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
480 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
481 defined(CONFIG_CPU_SUBTYPE_SH7708) || \
482 defined(CONFIG_CPU_SUBTYPE_SH7709)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483static inline int sci_rxd_in(struct uart_port *port)
484{
485 if (port->mapbase == 0xfffffe80)
486 return ctrl_inb(SCPDR)&0x01 ? 1 : 0; /* SCI */
487 if (port->mapbase == 0xa4000150)
488 return ctrl_inb(SCPDR)&0x10 ? 1 : 0; /* SCIF */
489 if (port->mapbase == 0xa4000140)
490 return ctrl_inb(SCPDR)&0x04 ? 1 : 0; /* IRDA */
491 return 1;
492}
493#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
494static inline int sci_rxd_in(struct uart_port *port)
495{
496 if (port->mapbase == SCIF0)
497 return ctrl_inb(SCPDR)&0x04 ? 1 : 0; /* IRDA */
498 if (port->mapbase == SCIF2)
499 return ctrl_inb(SCPDR)&0x10 ? 1 : 0; /* SCIF */
500 return 1;
501}
Nobuhiro Iwamatsu9465a542007-03-27 18:13:51 +0900502#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
Paul Mundte108b2c2006-09-27 16:32:13 +0900503static inline int sci_rxd_in(struct uart_port *port)
504{
Nobuhiro Iwamatsu9465a542007-03-27 18:13:51 +0900505 return sci_in(port,SCxSR)&0x0010 ? 1 : 0;
Paul Mundte108b2c2006-09-27 16:32:13 +0900506}
Nobuhiro Iwamatsu9465a542007-03-27 18:13:51 +0900507static inline void set_sh771x_scif_pfc(struct uart_port *port)
508{
509 if (port->mapbase == 0xA4400000){
510 ctrl_outw(ctrl_inw(PACR)&0xffc0,PACR);
511 ctrl_outw(ctrl_inw(PBCR)&0x0fff,PBCR);
512 return;
513 }
514 if (port->mapbase == 0xA4410000){
515 ctrl_outw(ctrl_inw(PBCR)&0xf003,PBCR);
516 return;
517 }
518}
519
Paul Mundt05627482007-05-15 16:25:47 +0900520#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \
521 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
522 defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
523 defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
524 defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
525 defined(CONFIG_CPU_SUBTYPE_SH7091) || \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700526 defined(CONFIG_CPU_SUBTYPE_SH4_202)
527static inline int sci_rxd_in(struct uart_port *port)
528{
529#ifndef SCIF_ONLY
530 if (port->mapbase == 0xffe00000)
531 return ctrl_inb(SCSPTR1)&0x01 ? 1 : 0; /* SCI */
532#endif
533#ifndef SCI_ONLY
534 if (port->mapbase == 0xffe80000)
535 return ctrl_inw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */
536#endif
537 return 1;
538}
539#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
540static inline int sci_rxd_in(struct uart_port *port)
541{
542 if (port->mapbase == 0xfe600000)
543 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
544 if (port->mapbase == 0xfe610000)
545 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
546 if (port->mapbase == 0xfe620000)
547 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
Paul Mundt31388752006-12-08 14:26:19 +0900548 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549}
550#elif defined(CONFIG_CPU_SUBTYPE_SH7300)
551static inline int sci_rxd_in(struct uart_port *port)
552{
553 if (port->mapbase == 0xa4430000)
554 return ctrl_inb(SCPDR)&0x01 ? 1 : 0; /* SCIF0 */
555 return 1;
556}
Paul Mundte108b2c2006-09-27 16:32:13 +0900557#elif defined(CONFIG_CPU_SUBTYPE_SH7343)
558static inline int sci_rxd_in(struct uart_port *port)
559{
560 if (port->mapbase == 0xffe00000)
561 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
562 if (port->mapbase == 0xffe10000)
563 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
564 if (port->mapbase == 0xffe20000)
565 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
566 if (port->mapbase == 0xffe30000)
567 return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
568 return 1;
569}
Paul Mundt41504c32006-12-11 20:28:03 +0900570#elif defined(CONFIG_CPU_SUBTYPE_SH7722)
571static inline int sci_rxd_in(struct uart_port *port)
572{
573 if (port->mapbase == 0xffe00000)
574 return ctrl_inb(SCPDR0) & 0x0001 ? 1 : 0; /* SCIF0 */
575 return 1;
576}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577#elif defined(CONFIG_CPU_SUBTYPE_ST40STB1)
578static inline int sci_rxd_in(struct uart_port *port)
579{
580 if (port->mapbase == 0xffe00000)
581 return ctrl_inw(SCSPTR1)&0x0001 ? 1 : 0; /* SCIF */
582 else
583 return ctrl_inw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */
584
585}
586#elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103)
587static inline int sci_rxd_in(struct uart_port *port)
588{
589 return sci_in(port, SCSPTR)&0x0001 ? 1 : 0; /* SCIF */
590}
591#elif defined(__H8300H__) || defined(__H8300S__)
592static inline int sci_rxd_in(struct uart_port *port)
593{
594 int ch = (port->mapbase - SMR0) >> 3;
595 return (H8300_SCI_DR(ch) & h8300_sci_pins[ch].rx) ? 1 : 0;
596}
Paul Mundtb7a76e42006-02-01 03:06:06 -0800597#elif defined(CONFIG_CPU_SUBTYPE_SH7770)
598static inline int sci_rxd_in(struct uart_port *port)
599{
600 if (port->mapbase == 0xff923000)
601 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
602 if (port->mapbase == 0xff924000)
603 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
604 if (port->mapbase == 0xff925000)
605 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
Paul Mundt31388752006-12-08 14:26:19 +0900606 return 1;
Paul Mundtb7a76e42006-02-01 03:06:06 -0800607}
608#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
609static inline int sci_rxd_in(struct uart_port *port)
610{
611 if (port->mapbase == 0xffe00000)
612 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
613 if (port->mapbase == 0xffe10000)
614 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
Paul Mundt31388752006-12-08 14:26:19 +0900615 return 1;
Paul Mundtb7a76e42006-02-01 03:06:06 -0800616}
Paul Mundt32351a22007-03-12 14:38:59 +0900617#elif defined(CONFIG_CPU_SUBTYPE_SH7785)
618static inline int sci_rxd_in(struct uart_port *port)
619{
620 if (port->mapbase == 0xffea0000)
621 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
622 if (port->mapbase == 0xffeb0000)
623 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
624 if (port->mapbase == 0xffec0000)
625 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
626 if (port->mapbase == 0xffed0000)
627 return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
628 if (port->mapbase == 0xffee0000)
629 return ctrl_inw(SCSPTR4) & 0x0001 ? 1 : 0; /* SCIF */
630 if (port->mapbase == 0xffef0000)
631 return ctrl_inw(SCSPTR5) & 0x0001 ? 1 : 0; /* SCIF */
632 return 1;
633}
Yoshinori Sato9d4436a2006-11-05 15:40:13 +0900634#elif defined(CONFIG_CPU_SUBTYPE_SH7206)
635static inline int sci_rxd_in(struct uart_port *port)
636{
637 if (port->mapbase == 0xfffe8000)
638 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
639 if (port->mapbase == 0xfffe8800)
640 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
641 if (port->mapbase == 0xfffe9000)
642 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
643 if (port->mapbase == 0xfffe9800)
644 return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
Paul Mundt31388752006-12-08 14:26:19 +0900645 return 1;
Yoshinori Sato9d4436a2006-11-05 15:40:13 +0900646}
647#elif defined(CONFIG_CPU_SUBTYPE_SH7619)
648static inline int sci_rxd_in(struct uart_port *port)
649{
650 if (port->mapbase == 0xf8400000)
651 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
652 if (port->mapbase == 0xf8410000)
653 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
654 if (port->mapbase == 0xf8420000)
655 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
Paul Mundt31388752006-12-08 14:26:19 +0900656 return 1;
Yoshinori Sato9d4436a2006-11-05 15:40:13 +0900657}
Paul Mundt2b1bd1a2007-06-20 18:27:10 +0900658#elif defined(CONFIG_CPU_SUBTYPE_SHX3)
659static inline int sci_rxd_in(struct uart_port *port)
660{
661 if (port->mapbase == 0xffc30000)
662 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
663 if (port->mapbase == 0xffc40000)
664 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
665 if (port->mapbase == 0xffc50000)
666 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
667 if (port->mapbase == 0xffc60000)
668 return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
669}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700670#endif
671
672/*
673 * Values for the BitRate Register (SCBRR)
674 *
675 * The values are actually divisors for a frequency which can
676 * be internal to the SH3 (14.7456MHz) or derived from an external
677 * clock source. This driver assumes the internal clock is used;
678 * to support using an external clock source, config options or
679 * possibly command-line options would need to be added.
680 *
681 * Also, to support speeds below 2400 (why?) the lower 2 bits of
682 * the SCSMR register would also need to be set to non-zero values.
683 *
684 * -- Greg Banks 27Feb2000
685 *
686 * Answer: The SCBRR register is only eight bits, and the value in
687 * it gets larger with lower baud rates. At around 2400 (depending on
688 * the peripherial module clock) you run out of bits. However the
689 * lower two bits of SCSMR allow the module clock to be divided down,
690 * scaling the value which is needed in SCBRR.
691 *
692 * -- Stuart Menefy - 23 May 2000
693 *
694 * I meant, why would anyone bother with bitrates below 2400.
695 *
696 * -- Greg Banks - 7Jul2000
697 *
698 * You "speedist"! How will I use my 110bps ASR-33 teletype with paper
699 * tape reader as a console!
700 *
701 * -- Mitch Davis - 15 Jul 2000
702 */
703
Paul Mundt32351a22007-03-12 14:38:59 +0900704#if defined(CONFIG_CPU_SUBTYPE_SH7300) || \
705 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
706 defined(CONFIG_CPU_SUBTYPE_SH7785)
Paul Mundtb7a76e42006-02-01 03:06:06 -0800707#define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700708#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
Paul Mundtb7a76e42006-02-01 03:06:06 -0800709#define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1)
710#elif defined(__H8300H__) || defined(__H8300S__)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700711#define SCBRR_VALUE(bps) (((CONFIG_CPU_CLOCK*1000/32)/bps)-1)
Paul Mundtb7a76e42006-02-01 03:06:06 -0800712#elif defined(CONFIG_SUPERH64)
713#define SCBRR_VALUE(bps) ((current_cpu_data.module_clock+16*bps)/(32*bps)-1)
714#else /* Generic SH */
715#define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(32*bps)-1)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700716#endif