diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-13 12:49:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-13 12:49:04 -0400 |
commit | dcf397f037f52add9945eced57ca300ab6a4413c (patch) | |
tree | e78767d164589e9097a54bf564b072fb01f80820 /drivers/serial | |
parent | 6faf035cf9fdd8283c2b2b2c34b76b5445ec6fc4 (diff) | |
parent | 68ee0f9c98a42e36f9eab29155b2bb0e7e409ac6 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (124 commits)
sh: allow building for both r2d boards in same binary.
sh: fix r2d board detection
sh: Discard .exit.text/.exit.data at runtime.
sh: Fix up some section alignments in linker script.
sh: Fix SH-4 DMAC CHCR masking.
sh: Rip out left-over nommu cond syscall cruft.
sh: Make kgdb i-cache flushing less inept.
sh: kgdb section mismatches and tidying.
sh: cleanup struct irqaction initializers.
sh: early_printk tidying.
video: pvr2fb: Add TV (RGB) support to Dreamcast PVR driver.
sh: Conditionalize gUSA support.
sh: Follow gUSA preempt changes in __switch_to().
sh: Tidy up gUSA preempt handling.
sh: __copy_user() optimizations for small copies.
sh: clkfwk: Support multi-level clock propagation.
sh: Fix URAM start address on SH7785.
sh: Use boot_cpu_data for CPU probe.
sh: Support extended mode TLB on SH-X3.
sh: Bump MAX_ACTIVE_REGIONS for SH7785.
...
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/sh-sci.c | 39 | ||||
-rw-r--r-- | drivers/serial/sh-sci.h | 34 |
2 files changed, 61 insertions, 12 deletions
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index 053fca41b08a..73440e26834b 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO) | 4 | * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO) |
5 | * | 5 | * |
6 | * Copyright (C) 2002 - 2006 Paul Mundt | 6 | * Copyright (C) 2002 - 2006 Paul Mundt |
7 | * Modified to support SH7720 SCIF. Markus Brunner, Mark Jonas (Jul 2007). | ||
7 | * | 8 | * |
8 | * based off of the old drivers/char/sh-sci.c by: | 9 | * based off of the old drivers/char/sh-sci.c by: |
9 | * | 10 | * |
@@ -301,6 +302,38 @@ static void sci_init_pins_scif(struct uart_port* port, unsigned int cflag) | |||
301 | } | 302 | } |
302 | sci_out(port, SCFCR, fcr_val); | 303 | sci_out(port, SCFCR, fcr_val); |
303 | } | 304 | } |
305 | #elif defined(CONFIG_CPU_SUBTYPE_SH7720) | ||
306 | static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) | ||
307 | { | ||
308 | unsigned int fcr_val = 0; | ||
309 | unsigned short data; | ||
310 | |||
311 | if (cflag & CRTSCTS) { | ||
312 | /* enable RTS/CTS */ | ||
313 | if (port->mapbase == 0xa4430000) { /* SCIF0 */ | ||
314 | /* Clear PTCR bit 9-2; enable all scif pins but sck */ | ||
315 | data = ctrl_inw(PORT_PTCR); | ||
316 | ctrl_outw((data & 0xfc03), PORT_PTCR); | ||
317 | } else if (port->mapbase == 0xa4438000) { /* SCIF1 */ | ||
318 | /* Clear PVCR bit 9-2 */ | ||
319 | data = ctrl_inw(PORT_PVCR); | ||
320 | ctrl_outw((data & 0xfc03), PORT_PVCR); | ||
321 | } | ||
322 | fcr_val |= SCFCR_MCE; | ||
323 | } else { | ||
324 | if (port->mapbase == 0xa4430000) { /* SCIF0 */ | ||
325 | /* Clear PTCR bit 5-2; enable only tx and rx */ | ||
326 | data = ctrl_inw(PORT_PTCR); | ||
327 | ctrl_outw((data & 0xffc3), PORT_PTCR); | ||
328 | } else if (port->mapbase == 0xa4438000) { /* SCIF1 */ | ||
329 | /* Clear PVCR bit 5-2 */ | ||
330 | data = ctrl_inw(PORT_PVCR); | ||
331 | ctrl_outw((data & 0xffc3), PORT_PVCR); | ||
332 | } | ||
333 | } | ||
334 | sci_out(port, SCFCR, fcr_val); | ||
335 | } | ||
336 | |||
304 | #elif defined(CONFIG_CPU_SH3) | 337 | #elif defined(CONFIG_CPU_SH3) |
305 | /* For SH7705, SH7706, SH7707, SH7709, SH7709A, SH7729 */ | 338 | /* For SH7705, SH7706, SH7707, SH7709, SH7709A, SH7729 */ |
306 | static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) | 339 | static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) |
@@ -1276,7 +1309,7 @@ static int __init sci_console_init(void) | |||
1276 | console_initcall(sci_console_init); | 1309 | console_initcall(sci_console_init); |
1277 | #endif /* CONFIG_SERIAL_SH_SCI_CONSOLE */ | 1310 | #endif /* CONFIG_SERIAL_SH_SCI_CONSOLE */ |
1278 | 1311 | ||
1279 | #ifdef CONFIG_SH_KGDB | 1312 | #ifdef CONFIG_SH_KGDB_CONSOLE |
1280 | /* | 1313 | /* |
1281 | * FIXME: Most of this can go away.. at the moment, we rely on | 1314 | * FIXME: Most of this can go away.. at the moment, we rely on |
1282 | * arch/sh/kernel/setup.c to do the command line parsing for kgdb, though | 1315 | * arch/sh/kernel/setup.c to do the command line parsing for kgdb, though |
@@ -1334,9 +1367,7 @@ int __init kgdb_console_setup(struct console *co, char *options) | |||
1334 | 1367 | ||
1335 | return uart_set_options(port, co, baud, parity, bits, flow); | 1368 | return uart_set_options(port, co, baud, parity, bits, flow); |
1336 | } | 1369 | } |
1337 | #endif /* CONFIG_SH_KGDB */ | ||
1338 | 1370 | ||
1339 | #ifdef CONFIG_SH_KGDB_CONSOLE | ||
1340 | static struct console kgdb_console = { | 1371 | static struct console kgdb_console = { |
1341 | .name = "ttySC", | 1372 | .name = "ttySC", |
1342 | .device = uart_console_device, | 1373 | .device = uart_console_device, |
@@ -1432,7 +1463,7 @@ static int __devinit sci_probe(struct platform_device *dev) | |||
1432 | 1463 | ||
1433 | #ifdef CONFIG_CPU_FREQ | 1464 | #ifdef CONFIG_CPU_FREQ |
1434 | cpufreq_register_notifier(&sci_nb, CPUFREQ_TRANSITION_NOTIFIER); | 1465 | cpufreq_register_notifier(&sci_nb, CPUFREQ_TRANSITION_NOTIFIER); |
1435 | dev_info(&dev->dev, "sci: CPU frequency notifier registered\n"); | 1466 | dev_info(&dev->dev, "CPU frequency notifier registered\n"); |
1436 | #endif | 1467 | #endif |
1437 | 1468 | ||
1438 | #ifdef CONFIG_SH_STANDARD_BIOS | 1469 | #ifdef CONFIG_SH_STANDARD_BIOS |
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h index cf75466ebf57..e89ae29645d6 100644 --- a/drivers/serial/sh-sci.h +++ b/drivers/serial/sh-sci.h | |||
@@ -10,19 +10,19 @@ | |||
10 | * Modified to support SH7300(SH-Mobile) SCIF. Takashi Kusuda (Jun 2003). | 10 | * Modified to support SH7300(SH-Mobile) SCIF. Takashi Kusuda (Jun 2003). |
11 | * Modified to support H8/300 Series Yoshinori Sato (Feb 2004). | 11 | * Modified to support H8/300 Series Yoshinori Sato (Feb 2004). |
12 | * Removed SH7300 support (Jul 2007). | 12 | * Removed SH7300 support (Jul 2007). |
13 | * Modified to support SH7720 SCIF. Markus Brunner, Mark Jonas (Aug 2007). | ||
13 | */ | 14 | */ |
14 | #include <linux/serial_core.h> | 15 | #include <linux/serial_core.h> |
15 | #include <asm/io.h> | 16 | #include <asm/io.h> |
16 | 17 | ||
17 | #if defined(__H8300H__) || defined(__H8300S__) | ||
18 | #include <asm/gpio.h> | 18 | #include <asm/gpio.h> |
19 | |||
19 | #if defined(CONFIG_H83007) || defined(CONFIG_H83068) | 20 | #if defined(CONFIG_H83007) || defined(CONFIG_H83068) |
20 | #include <asm/regs306x.h> | 21 | #include <asm/regs306x.h> |
21 | #endif | 22 | #endif |
22 | #if defined(CONFIG_H8S2678) | 23 | #if defined(CONFIG_H8S2678) |
23 | #include <asm/regs267x.h> | 24 | #include <asm/regs267x.h> |
24 | #endif | 25 | #endif |
25 | #endif | ||
26 | 26 | ||
27 | #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \ | 27 | #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \ |
28 | defined(CONFIG_CPU_SUBTYPE_SH7707) || \ | 28 | defined(CONFIG_CPU_SUBTYPE_SH7707) || \ |
@@ -46,6 +46,10 @@ | |||
46 | */ | 46 | */ |
47 | # define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0 | 47 | # define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0 |
48 | # define SCIF_ONLY | 48 | # define SCIF_ONLY |
49 | #elif defined(CONFIG_CPU_SUBTYPE_SH7720) | ||
50 | # define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */ | ||
51 | # define SCIF_ONLY | ||
52 | #define SCIF_ORER 0x0200 /* overrun error bit */ | ||
49 | #elif defined(CONFIG_SH_RTS7751R2D) | 53 | #elif defined(CONFIG_SH_RTS7751R2D) |
50 | # define SCSPTR2 0xFFE80020 /* 16 bit SCIF */ | 54 | # define SCSPTR2 0xFFE80020 /* 16 bit SCIF */ |
51 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 55 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
@@ -217,7 +221,8 @@ | |||
217 | #define SCIF_RDF 0x0002 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */ | 221 | #define SCIF_RDF 0x0002 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */ |
218 | #define SCIF_DR 0x0001 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */ | 222 | #define SCIF_DR 0x0001 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */ |
219 | 223 | ||
220 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) | 224 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ |
225 | defined(CONFIG_CPU_SUBTYPE_SH7720) | ||
221 | #define SCIF_ORER 0x0200 | 226 | #define SCIF_ORER 0x0200 |
222 | #define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER) | 227 | #define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER) |
223 | #define SCIF_RFDC_MASK 0x007f | 228 | #define SCIF_RFDC_MASK 0x007f |
@@ -254,7 +259,8 @@ | |||
254 | # define SCxSR_FER(port) SCIF_FER | 259 | # define SCxSR_FER(port) SCIF_FER |
255 | # define SCxSR_PER(port) SCIF_PER | 260 | # define SCxSR_PER(port) SCIF_PER |
256 | # define SCxSR_BRK(port) SCIF_BRK | 261 | # define SCxSR_BRK(port) SCIF_BRK |
257 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) | 262 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ |
263 | defined(CONFIG_CPU_SUBTYPE_SH7720) | ||
258 | # define SCxSR_RDxF_CLEAR(port) (sci_in(port,SCxSR)&0xfffc) | 264 | # define SCxSR_RDxF_CLEAR(port) (sci_in(port,SCxSR)&0xfffc) |
259 | # define SCxSR_ERROR_CLEAR(port) (sci_in(port,SCxSR)&0xfd73) | 265 | # define SCxSR_ERROR_CLEAR(port) (sci_in(port,SCxSR)&0xfd73) |
260 | # define SCxSR_TDxE_CLEAR(port) (sci_in(port,SCxSR)&0xffdf) | 266 | # define SCxSR_TDxE_CLEAR(port) (sci_in(port,SCxSR)&0xffdf) |
@@ -362,7 +368,8 @@ | |||
362 | CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size) | 368 | CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size) |
363 | #define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \ | 369 | #define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \ |
364 | CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size) | 370 | CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size) |
365 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) | 371 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ |
372 | defined(CONFIG_CPU_SUBTYPE_SH7720) | ||
366 | #define SCIF_FNS(name, scif_offset, scif_size) \ | 373 | #define SCIF_FNS(name, scif_offset, scif_size) \ |
367 | CPU_SCIF_FNS(name, scif_offset, scif_size) | 374 | CPU_SCIF_FNS(name, scif_offset, scif_size) |
368 | #else | 375 | #else |
@@ -388,7 +395,8 @@ | |||
388 | CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size) | 395 | CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size) |
389 | #endif | 396 | #endif |
390 | 397 | ||
391 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) | 398 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ |
399 | defined(CONFIG_CPU_SUBTYPE_SH7720) | ||
392 | 400 | ||
393 | SCIF_FNS(SCSMR, 0x00, 16) | 401 | SCIF_FNS(SCSMR, 0x00, 16) |
394 | SCIF_FNS(SCBRR, 0x04, 8) | 402 | SCIF_FNS(SCBRR, 0x04, 8) |
@@ -510,7 +518,15 @@ static inline void set_sh771x_scif_pfc(struct uart_port *port) | |||
510 | return; | 518 | return; |
511 | } | 519 | } |
512 | } | 520 | } |
513 | 521 | #elif defined(CONFIG_CPU_SUBTYPE_SH7720) | |
522 | static inline int sci_rxd_in(struct uart_port *port) | ||
523 | { | ||
524 | if (port->mapbase == 0xa4430000) | ||
525 | return sci_in(port, SCxSR) & 0x0003 ? 1 : 0; | ||
526 | else if (port->mapbase == 0xa4438000) | ||
527 | return sci_in(port, SCxSR) & 0x0003 ? 1 : 0; | ||
528 | return 1; | ||
529 | } | ||
514 | #elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \ | 530 | #elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \ |
515 | defined(CONFIG_CPU_SUBTYPE_SH7751) || \ | 531 | defined(CONFIG_CPU_SUBTYPE_SH7751) || \ |
516 | defined(CONFIG_CPU_SUBTYPE_SH7751R) || \ | 532 | defined(CONFIG_CPU_SUBTYPE_SH7751R) || \ |
@@ -653,6 +669,7 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
653 | return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ | 669 | return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ |
654 | if (port->mapbase == 0xffc60000) | 670 | if (port->mapbase == 0xffc60000) |
655 | return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ | 671 | return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */ |
672 | return 1; | ||
656 | } | 673 | } |
657 | #endif | 674 | #endif |
658 | 675 | ||
@@ -691,7 +708,8 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
691 | #if defined(CONFIG_CPU_SUBTYPE_SH7780) || \ | 708 | #if defined(CONFIG_CPU_SUBTYPE_SH7780) || \ |
692 | defined(CONFIG_CPU_SUBTYPE_SH7785) | 709 | defined(CONFIG_CPU_SUBTYPE_SH7785) |
693 | #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1) | 710 | #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1) |
694 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) | 711 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ |
712 | defined(CONFIG_CPU_SUBTYPE_SH7720) | ||
695 | #define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1) | 713 | #define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1) |
696 | #elif defined(__H8300H__) || defined(__H8300S__) | 714 | #elif defined(__H8300H__) || defined(__H8300S__) |
697 | #define SCBRR_VALUE(bps) (((CONFIG_CPU_CLOCK*1000/32)/bps)-1) | 715 | #define SCBRR_VALUE(bps) (((CONFIG_CPU_CLOCK*1000/32)/bps)-1) |