Commit 701096cf authored by Miles Bader's avatar Miles Bader Committed by Linus Torvalds

[PATCH] Refactor v850 UART driver

The v850 family contains several related-but-not-identical on-chip
UARTs.  This patch factors out the common code and uses it to implement
both types (only one was supported before).

Also, this patch changes the way the v850 UART is initialized, to use
the same method as other linux serial drivers.

This patch renames the UART code to be `v850e_uart' rather than
`nb85e_uart', as the former is more correct.  As this change renames
some files too, the patch contains a number of whole-file add/removes.
parent 15d7359a
...@@ -63,10 +63,6 @@ void __init mach_early_init (void) ...@@ -63,10 +63,6 @@ void __init mach_early_init (void)
void __init mach_setup (char **cmdline) void __init mach_setup (char **cmdline)
{ {
#ifdef CONFIG_V850E_NB85E_UART_CONSOLE
nb85e_uart_cons_init (1);
#endif
ANNA_PORT_PM (LEDS_PORT) = 0; /* Make all LED pins output pins. */ ANNA_PORT_PM (LEDS_PORT) = 0; /* Make all LED pins output pins. */
mach_tick = anna_led_tick; mach_tick = anna_led_tick;
} }
......
...@@ -95,10 +95,6 @@ void __init mach_early_init (void) ...@@ -95,10 +95,6 @@ void __init mach_early_init (void)
void __init mach_setup (char **cmdline) void __init mach_setup (char **cmdline)
{ {
#ifdef CONFIG_V850E_NB85E_UART_CONSOLE
nb85e_uart_cons_init (1);
#endif
AS85EP1_PORT_PMC (LEDS_PORT) = 0; /* Make the LEDs port an I/O port. */ AS85EP1_PORT_PMC (LEDS_PORT) = 0; /* Make the LEDs port an I/O port. */
AS85EP1_PORT_PM (LEDS_PORT) = 0; /* Make all the bits output pins. */ AS85EP1_PORT_PM (LEDS_PORT) = 0; /* Make all the bits output pins. */
mach_tick = as85ep1_led_tick; mach_tick = as85ep1_led_tick;
......
...@@ -53,23 +53,11 @@ void __init mach_setup (char **cmdline) ...@@ -53,23 +53,11 @@ void __init mach_setup (char **cmdline)
" NEC SolutionGear/Midas lab" " NEC SolutionGear/Midas lab"
" RTE-MOTHER-A motherboard\n"); " RTE-MOTHER-A motherboard\n");
} }
#endif /* CONFIG_RTE_MB_A_PCI */
#if defined (CONFIG_V850E_NB85E_UART_CONSOLE) && !defined (CONFIG_TIME_BOOTUP)
nb85e_uart_cons_init (0);
#endif
mach_tick = led_tick; mach_tick = led_tick;
} }
#ifdef CONFIG_TIME_BOOTUP
void initial_boot_done (void)
{
#ifdef CONFIG_V850E_NB85E_UART_CONSOLE
nb85e_uart_cons_init (0);
#endif
}
#endif
void machine_restart (char *__unused) void machine_restart (char *__unused)
{ {
#ifdef CONFIG_RESET_GUARD #ifdef CONFIG_RESET_GUARD
......
...@@ -404,14 +404,19 @@ config SERIAL_SUNSAB_CONSOLE ...@@ -404,14 +404,19 @@ config SERIAL_SUNSAB_CONSOLE
on your Sparc system as the console, you can do so by answering on your Sparc system as the console, you can do so by answering
Y to this option. Y to this option.
config V850E_NB85E_UART config V850E_UART
bool "NEC V850E on-chip UART support" bool "NEC V850E on-chip UART support"
depends on V850E_NB85E || V850E2_ANNA || V850E_AS85EP1 depends on V850E_MA1 || V850E_ME2 || V850E_TEG || V850E2_ANNA || V850E_AS85EP1
default y default y
config V850E_NB85E_UART_CONSOLE config V850E_UARTB
bool
depends V850E_UART && V850E_ME2
default y
config V850E_UART_CONSOLE
bool "Use NEC V850E on-chip UART for console" bool "Use NEC V850E on-chip UART for console"
depends on V850E_NB85E_UART depends on V850E_UART
config SERIAL98 config SERIAL98
tristate "PC-9800 8251-based primary serial port support" tristate "PC-9800 8251-based primary serial port support"
...@@ -426,12 +431,12 @@ config SERIAL98_CONSOLE ...@@ -426,12 +431,12 @@ config SERIAL98_CONSOLE
config SERIAL_CORE config SERIAL_CORE
tristate tristate
default m if SERIAL_AMBA!=y && SERIAL_CLPS711X!=y && SERIAL_21285!=y && !SERIAL_SA1100 && !SERIAL_ANAKIN && !SERIAL_UART00 && SERIAL_8250!=y && SERIAL_MUX!=y && !SERIAL_ROCKETPORT && !SERIAL_SUNCORE && !V850E_NB85E_UART && (SERIAL_AMBA=m || SERIAL_CLPS711X=m || SERIAL_21285=m || SERIAL_8250=m || SERIAL_MUX=m || SERIAL98=m) default m if SERIAL_AMBA!=y && SERIAL_CLPS711X!=y && SERIAL_21285!=y && !SERIAL_SA1100 && !SERIAL_ANAKIN && !SERIAL_UART00 && SERIAL_8250!=y && SERIAL_MUX!=y && !SERIAL_ROCKETPORT && !SERIAL_SUNCORE && !V850E_UART && (SERIAL_AMBA=m || SERIAL_CLPS711X=m || SERIAL_21285=m || SERIAL_8250=m || SERIAL_MUX=m || SERIAL98=m)
default y if SERIAL_AMBA=y || SERIAL_CLPS711X=y || SERIAL_21285=y || SERIAL_SA1100 || SERIAL_ANAKIN || SERIAL_UART00 || SERIAL_8250=y || SERIAL_MUX=y || SERIAL_ROCKETPORT || SERIAL_SUNCORE || V850E_NB85E_UART || SERIAL98=y default y if SERIAL_AMBA=y || SERIAL_CLPS711X=y || SERIAL_21285=y || SERIAL_SA1100 || SERIAL_ANAKIN || SERIAL_UART00 || SERIAL_8250=y || SERIAL_MUX=y || SERIAL_ROCKETPORT || SERIAL_SUNCORE || V850E_UART || SERIAL98=y
config SERIAL_CORE_CONSOLE config SERIAL_CORE_CONSOLE
bool bool
depends on SERIAL_AMBA_CONSOLE || SERIAL_CLPS711X_CONSOLE || SERIAL_21285_CONSOLE || SERIAL_SA1100_CONSOLE || SERIAL_ANAKIN_CONSOLE || SERIAL_UART00_CONSOLE || SERIAL_8250_CONSOLE || SERIAL_MUX_CONSOLE || SERIAL_SUNZILOG_CONSOLE || SERIAL_SUNSU_CONSOLE || SERIAL_SUNSAB_CONSOLE || V850E_NB85E_UART_CONSOLE || SERIAL98_CONSOLE depends on SERIAL_AMBA_CONSOLE || SERIAL_CLPS711X_CONSOLE || SERIAL_21285_CONSOLE || SERIAL_SA1100_CONSOLE || SERIAL_ANAKIN_CONSOLE || SERIAL_UART00_CONSOLE || SERIAL_8250_CONSOLE || SERIAL_MUX_CONSOLE || SERIAL_SUNZILOG_CONSOLE || SERIAL_SUNSU_CONSOLE || SERIAL_SUNSAB_CONSOLE || V850E_UART_CONSOLE || SERIAL98_CONSOLE
default y default y
config SERIAL_68328 config SERIAL_68328
......
...@@ -29,5 +29,5 @@ obj-$(CONFIG_SERIAL_MUX) += mux.o ...@@ -29,5 +29,5 @@ obj-$(CONFIG_SERIAL_MUX) += mux.o
obj-$(CONFIG_SERIAL_68328) += 68328serial.o obj-$(CONFIG_SERIAL_68328) += 68328serial.o
obj-$(CONFIG_SERIAL_68360) += 68360serial.o obj-$(CONFIG_SERIAL_68360) += 68360serial.o
obj-$(CONFIG_SERIAL_COLDFIRE) += mcfserial.o obj-$(CONFIG_SERIAL_COLDFIRE) += mcfserial.o
obj-$(CONFIG_V850E_NB85E_UART) += nb85e_uart.o obj-$(CONFIG_V850E_UART) += v850e_uart.o
obj-$(CONFIG_SERIAL98) += serial98.o obj-$(CONFIG_SERIAL98) += serial98.o
...@@ -116,12 +116,15 @@ extern void anna_init_irqs (void); ...@@ -116,12 +116,15 @@ extern void anna_init_irqs (void);
/* Anna UART details (basically the same as the V850E/MA1, but 2 channels). */ /* Anna UART details (basically the same as the V850E/MA1, but 2 channels). */
#define NB85E_UART_NUM_CHANNELS 2 #define V850E_UART_NUM_CHANNELS 2
#define NB85E_UART_BASE_FREQ (SYS_CLOCK_FREQ / 2) #define V850E_UART_BASE_FREQ (SYS_CLOCK_FREQ / 2)
#define NB85E_UART_CHIP_NAME "V850E2/NA85E2A" #define V850E_UART_CHIP_NAME "V850E2/NA85E2A"
/* This is the UART channel that's actually connected on the board. */
#define V850E_UART_CONSOLE_CHANNEL 1
/* This is a function that gets called before configuring the UART. */ /* This is a function that gets called before configuring the UART. */
#define NB85E_UART_PRE_CONFIGURE anna_uart_pre_configure #define V850E_UART_PRE_CONFIGURE anna_uart_pre_configure
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern void anna_uart_pre_configure (unsigned chan, extern void anna_uart_pre_configure (unsigned chan,
unsigned cflags, unsigned baud); unsigned cflags, unsigned baud);
...@@ -130,9 +133,9 @@ extern void anna_uart_pre_configure (unsigned chan, ...@@ -130,9 +133,9 @@ extern void anna_uart_pre_configure (unsigned chan,
/* This board supports RTS/CTS for the on-chip UART, but only for channel 1. */ /* This board supports RTS/CTS for the on-chip UART, but only for channel 1. */
/* CTS for UART channel 1 is pin P37 (bit 7 of port 3). */ /* CTS for UART channel 1 is pin P37 (bit 7 of port 3). */
#define NB85E_UART_CTS(chan) ((chan) == 1 ? !(ANNA_PORT_IO(3) & 0x80) : 1) #define V850E_UART_CTS(chan) ((chan) == 1 ? !(ANNA_PORT_IO(3) & 0x80) : 1)
/* RTS for UART channel 1 is pin P07 (bit 7 of port 0). */ /* RTS for UART channel 1 is pin P07 (bit 7 of port 0). */
#define NB85E_UART_SET_RTS(chan, val) \ #define V850E_UART_SET_RTS(chan, val) \
do { \ do { \
if (chan == 1) { \ if (chan == 1) { \
unsigned old = ANNA_PORT_IO(0); \ unsigned old = ANNA_PORT_IO(0); \
......
...@@ -110,12 +110,12 @@ extern void as85ep1_init_irqs (void); ...@@ -110,12 +110,12 @@ extern void as85ep1_init_irqs (void);
/* AS85EP1 UART details (basically the same as the V850E/MA1, but 2 channels). */ /* AS85EP1 UART details (basically the same as the V850E/MA1, but 2 channels). */
#define NB85E_UART_NUM_CHANNELS 2 #define V850E_UART_NUM_CHANNELS 2
#define NB85E_UART_BASE_FREQ (SYS_CLOCK_FREQ / 4) #define V850E_UART_BASE_FREQ (SYS_CLOCK_FREQ / 4)
#define NB85E_UART_CHIP_NAME "V850E/NA85E" #define V850E_UART_CHIP_NAME "V850E/NA85E"
/* This is a function that gets called before configuring the UART. */ /* This is a function that gets called before configuring the UART. */
#define NB85E_UART_PRE_CONFIGURE as85ep1_uart_pre_configure #define V850E_UART_PRE_CONFIGURE as85ep1_uart_pre_configure
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern void as85ep1_uart_pre_configure (unsigned chan, extern void as85ep1_uart_pre_configure (unsigned chan,
unsigned cflags, unsigned baud); unsigned cflags, unsigned baud);
...@@ -124,9 +124,9 @@ extern void as85ep1_uart_pre_configure (unsigned chan, ...@@ -124,9 +124,9 @@ extern void as85ep1_uart_pre_configure (unsigned chan,
/* This board supports RTS/CTS for the on-chip UART, but only for channel 1. */ /* This board supports RTS/CTS for the on-chip UART, but only for channel 1. */
/* CTS for UART channel 1 is pin P54 (bit 4 of port 5). */ /* CTS for UART channel 1 is pin P54 (bit 4 of port 5). */
#define NB85E_UART_CTS(chan) ((chan) == 1 ? !(AS85EP1_PORT_IO(5) & 0x10) : 1) #define V850E_UART_CTS(chan) ((chan) == 1 ? !(AS85EP1_PORT_IO(5) & 0x10) : 1)
/* RTS for UART channel 1 is pin P53 (bit 3 of port 5). */ /* RTS for UART channel 1 is pin P53 (bit 3 of port 5). */
#define NB85E_UART_SET_RTS(chan, val) \ #define V850E_UART_SET_RTS(chan, val) \
do { \ do { \
if (chan == 1) { \ if (chan == 1) { \
unsigned old = AS85EP1_PORT_IO(5); \ unsigned old = AS85EP1_PORT_IO(5); \
......
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
/* MA series UART details. */ /* MA series UART details. */
#define NB85E_UART_BASE_FREQ CPU_CLOCK_FREQ #define V850E_UART_BASE_FREQ CPU_CLOCK_FREQ
/* This is a function that gets called before configuring the UART. */ /* This is a function that gets called before configuring the UART. */
#define NB85E_UART_PRE_CONFIGURE ma_uart_pre_configure #define V850E_UART_PRE_CONFIGURE ma_uart_pre_configure
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern void ma_uart_pre_configure (unsigned chan, extern void ma_uart_pre_configure (unsigned chan,
unsigned cflags, unsigned baud); unsigned cflags, unsigned baud);
......
/* /*
* include/asm-v850/ma1.h -- V850E/MA1 cpu chip * include/asm-v850/ma1.h -- V850E/MA1 cpu chip
* *
* Copyright (C) 2001,02 NEC Corporation * Copyright (C) 2001,02,03 NEC Electronics Corporation
* Copyright (C) 2001,02 Miles Bader <miles@gnu.org> * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
* *
* This file is subject to the terms and conditions of the GNU General * This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this * Public License. See the file COPYING in the main directory of this
...@@ -40,12 +40,11 @@ ...@@ -40,12 +40,11 @@
#define IRQ_INTST(n) (0x27 + (n)*4) /* UART 0-2 transmission completion */ #define IRQ_INTST(n) (0x27 + (n)*4) /* UART 0-2 transmission completion */
#define IRQ_INTST_NUM 3 #define IRQ_INTST_NUM 3
/* For <asm/irq.h> */
#define NUM_CPU_IRQS 0x30 #define NUM_CPU_IRQS 0x30
/* The MA1 has a UART with 3 channels. */ /* The MA1 has a UART with 3 channels. */
#define NB85E_UART_NUM_CHANNELS 3 #define V850E_UART_NUM_CHANNELS 3
#endif /* __V850_MA1_H__ */ #endif /* __V850_MA1_H__ */
/*
* include/asm-v850/nb85e_uart.h -- On-chip UART often used with the
* NB85E cpu core
*
* Copyright (C) 2001,02 NEC Corporation
* Copyright (C) 2001,02 Miles Bader <miles@gnu.org>
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this
* archive for more details.
*
* Written by Miles Bader <miles@gnu.org>
*/
/* There's not actually a single UART implementation used by nb85e
derivatives, but rather a series of implementations that are all
`close' to one another. This file attempts to capture some
commonality between them. */
#ifndef __V850_NB85E_UART_H__
#define __V850_NB85E_UART_H__
#include <asm/types.h>
#include <asm/machdep.h> /* Pick up chip-specific defs. */
/* The base address of the UART control registers for channel N.
The default is the address used on the V850E/MA1. */
#ifndef NB85E_UART_BASE_ADDR
#define NB85E_UART_BASE_ADDR(n) (0xFFFFFA00 + 0x10 * (n))
#endif
/* Addresses of specific UART control registers for channel N.
The defaults are the addresses used on the V850E/MA1; if a platform
wants to redefine any of these, it must redefine them all. */
#ifndef NB85E_UART_ASIM_ADDR
#define NB85E_UART_ASIM_ADDR(n) (NB85E_UART_BASE_ADDR(n) + 0x0)
#define NB85E_UART_RXB_ADDR(n) (NB85E_UART_BASE_ADDR(n) + 0x2)
#define NB85E_UART_ASIS_ADDR(n) (NB85E_UART_BASE_ADDR(n) + 0x3)
#define NB85E_UART_TXB_ADDR(n) (NB85E_UART_BASE_ADDR(n) + 0x4)
#define NB85E_UART_ASIF_ADDR(n) (NB85E_UART_BASE_ADDR(n) + 0x5)
#define NB85E_UART_CKSR_ADDR(n) (NB85E_UART_BASE_ADDR(n) + 0x6)
#define NB85E_UART_BRGC_ADDR(n) (NB85E_UART_BASE_ADDR(n) + 0x7)
#endif
#ifndef NB85E_UART_CKSR_MAX_FREQ
#define NB85E_UART_CKSR_MAX_FREQ (25*1000*1000)
#endif
/* UART config registers. */
#define NB85E_UART_ASIM(n) (*(volatile u8 *)NB85E_UART_ASIM_ADDR(n))
/* Control bits for config registers. */
#define NB85E_UART_ASIM_CAE 0x80 /* clock enable */
#define NB85E_UART_ASIM_TXE 0x40 /* transmit enable */
#define NB85E_UART_ASIM_RXE 0x20 /* receive enable */
#define NB85E_UART_ASIM_PS_MASK 0x18 /* mask covering parity-select bits */
#define NB85E_UART_ASIM_PS_NONE 0x00 /* no parity */
#define NB85E_UART_ASIM_PS_ZERO 0x08 /* zero parity */
#define NB85E_UART_ASIM_PS_ODD 0x10 /* odd parity */
#define NB85E_UART_ASIM_PS_EVEN 0x18 /* even parity */
#define NB85E_UART_ASIM_CL_8 0x04 /* char len is 8 bits (otherwise, 7) */
#define NB85E_UART_ASIM_SL_2 0x02 /* 2 stop bits (otherwise, 1) */
#define NB85E_UART_ASIM_ISRM 0x01 /* generate INTSR interrupt on errors
(otherwise, generate INTSER) */
/* UART serial interface status registers. */
#define NB85E_UART_ASIS(n) (*(volatile u8 *)NB85E_UART_ASIS_ADDR(n))
/* Control bits for status registers. */
#define NB85E_UART_ASIS_PE 0x04 /* parity error */
#define NB85E_UART_ASIS_FE 0x02 /* framing error */
#define NB85E_UART_ASIS_OVE 0x01 /* overrun error */
/* UART serial interface transmission status registers. */
#define NB85E_UART_ASIF(n) (*(volatile u8 *)NB85E_UART_ASIF_ADDR(n))
#define NB85E_UART_ASIF_TXBF 0x02 /* transmit buffer flag (data in TXB) */
#define NB85E_UART_ASIF_TXSF 0x01 /* transmit shift flag (sending data) */
/* UART receive buffer register. */
#define NB85E_UART_RXB(n) (*(volatile u8 *)NB85E_UART_RXB_ADDR(n))
/* UART transmit buffer register. */
#define NB85E_UART_TXB(n) (*(volatile u8 *)NB85E_UART_TXB_ADDR(n))
/* UART baud-rate generator control registers. */
#define NB85E_UART_CKSR(n) (*(volatile u8 *)NB85E_UART_CKSR_ADDR(n))
#define NB85E_UART_CKSR_MAX 11
#define NB85E_UART_BRGC(n) (*(volatile u8 *)NB85E_UART_BRGC_ADDR(n))
/* This UART doesn't implement RTS/CTS by default, but some platforms
implement them externally, so check to see if <asm/machdep.h> defined
anything. */
#ifdef NB85E_UART_CTS
#define nb85e_uart_cts(n) NB85E_UART_CTS(n)
#else
#define nb85e_uart_cts(n) (1)
#endif
/* Do the same for RTS. */
#ifdef NB85E_UART_SET_RTS
#define nb85e_uart_set_rts(n,v) NB85E_UART_SET_RTS(n,v)
#else
#define nb85e_uart_set_rts(n,v) ((void)0)
#endif
/* Return true if all characters awaiting transmission on uart channel N
have been transmitted. */
#define nb85e_uart_xmit_done(n) \
(! (NB85E_UART_ASIF(n) & NB85E_UART_ASIF_TXBF))
/* Wait for this to be true. */
#define nb85e_uart_wait_for_xmit_done(n) \
do { } while (! nb85e_uart_xmit_done (n))
/* Return true if uart channel N is ready to transmit a character. */
#define nb85e_uart_xmit_ok(n) \
(nb85e_uart_xmit_done(n) && nb85e_uart_cts(n))
/* Wait for this to be true. */
#define nb85e_uart_wait_for_xmit_ok(n) \
do { } while (! nb85e_uart_xmit_ok (n))
/* Write character CH to uart channel N. */
#define nb85e_uart_putc(n, ch) (NB85E_UART_TXB(n) = (ch))
#define NB85E_UART_MINOR_BASE 64
#ifndef __ASSEMBLY__
/* Setup a console using channel 0 of the builtin uart. */
extern void nb85e_uart_cons_init (unsigned chan);
/* Configure and turn on uart channel CHAN, using the termios `control
modes' bits in CFLAGS, and a baud-rate of BAUD. */
void nb85e_uart_configure (unsigned chan, unsigned cflags, unsigned baud);
/* If the macro NB85E_UART_PRE_CONFIGURE is defined (presumably by a
<asm/machdep.h>), it is called from nb85e_uart_pre_configure before
anything else is done, with interrupts disabled. */
#endif /* !__ASSEMBLY__ */
#endif /* __V850_NB85E_UART_H__ */
...@@ -98,8 +98,8 @@ ...@@ -98,8 +98,8 @@
/* Override the basic MA uart pre-initialization so that we can /* Override the basic MA uart pre-initialization so that we can
initialize extra stuff. */ initialize extra stuff. */
#undef NB85E_UART_PRE_CONFIGURE /* should be defined by <asm/ma.h> */ #undef V850E_UART_PRE_CONFIGURE /* should be defined by <asm/ma.h> */
#define NB85E_UART_PRE_CONFIGURE rte_ma1_cb_uart_pre_configure #define V850E_UART_PRE_CONFIGURE rte_ma1_cb_uart_pre_configure
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern void rte_ma1_cb_uart_pre_configure (unsigned chan, extern void rte_ma1_cb_uart_pre_configure (unsigned chan,
unsigned cflags, unsigned baud); unsigned cflags, unsigned baud);
...@@ -108,9 +108,9 @@ extern void rte_ma1_cb_uart_pre_configure (unsigned chan, ...@@ -108,9 +108,9 @@ extern void rte_ma1_cb_uart_pre_configure (unsigned chan,
/* This board supports RTS/CTS for the on-chip UART, but only for channel 0. */ /* This board supports RTS/CTS for the on-chip UART, but only for channel 0. */
/* CTS for UART channel 0 is pin P43 (bit 3 of port 4). */ /* CTS for UART channel 0 is pin P43 (bit 3 of port 4). */
#define NB85E_UART_CTS(chan) ((chan) == 0 ? !(MA_PORT4_IO & 0x8) : 1) #define V850E_UART_CTS(chan) ((chan) == 0 ? !(MA_PORT4_IO & 0x8) : 1)
/* RTS for UART channel 0 is pin P42 (bit 2 of port 4). */ /* RTS for UART channel 0 is pin P42 (bit 2 of port 4). */
#define NB85E_UART_SET_RTS(chan, val) \ #define V850E_UART_SET_RTS(chan, val) \
do { \ do { \
if (chan == 0) { \ if (chan == 0) { \
unsigned old = MA_PORT4_IO; \ unsigned old = MA_PORT4_IO; \
......
...@@ -89,8 +89,8 @@ ...@@ -89,8 +89,8 @@
/* Override the basic TEG UART pre-initialization so that we can /* Override the basic TEG UART pre-initialization so that we can
initialize extra stuff. */ initialize extra stuff. */
#undef NB85E_UART_PRE_CONFIGURE /* should be defined by <asm/teg.h> */ #undef V850E_UART_PRE_CONFIGURE /* should be defined by <asm/teg.h> */
#define NB85E_UART_PRE_CONFIGURE rte_nb85e_cb_uart_pre_configure #define V850E_UART_PRE_CONFIGURE rte_nb85e_cb_uart_pre_configure
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern void rte_nb85e_cb_uart_pre_configure (unsigned chan, extern void rte_nb85e_cb_uart_pre_configure (unsigned chan,
unsigned cflags, unsigned baud); unsigned cflags, unsigned baud);
...@@ -99,9 +99,9 @@ extern void rte_nb85e_cb_uart_pre_configure (unsigned chan, ...@@ -99,9 +99,9 @@ extern void rte_nb85e_cb_uart_pre_configure (unsigned chan,
/* This board supports RTS/CTS for the on-chip UART. */ /* This board supports RTS/CTS for the on-chip UART. */
/* CTS is pin P00. */ /* CTS is pin P00. */
#define NB85E_UART_CTS(chan) (! (TEG_PORT0_IO & 0x1)) #define V850E_UART_CTS(chan) (! (TEG_PORT0_IO & 0x1))
/* RTS is pin P02. */ /* RTS is pin P02. */
#define NB85E_UART_SET_RTS(chan, val) \ #define V850E_UART_SET_RTS(chan, val) \
do { \ do { \
unsigned old = TEG_PORT0_IO; \ unsigned old = TEG_PORT0_IO; \
TEG_PORT0_IO = val ? (old & ~0x4) : (old | 0x4); \ TEG_PORT0_IO = val ? (old & ~0x4) : (old | 0x4); \
......
...@@ -51,18 +51,18 @@ ...@@ -51,18 +51,18 @@
/* TEG UART details. */ /* TEG UART details. */
#define NB85E_UART_BASE_ADDR(n) (0xFFFFF600 + 0x10 * (n)) #define V850E_UART_BASE_ADDR(n) (0xFFFFF600 + 0x10 * (n))
#define NB85E_UART_ASIM_ADDR(n) (NB85E_UART_BASE_ADDR(n) + 0x0) #define V850E_UART_ASIM_ADDR(n) (V850E_UART_BASE_ADDR(n) + 0x0)
#define NB85E_UART_ASIS_ADDR(n) (NB85E_UART_BASE_ADDR(n) + 0x2) #define V850E_UART_ASIS_ADDR(n) (V850E_UART_BASE_ADDR(n) + 0x2)
#define NB85E_UART_ASIF_ADDR(n) (NB85E_UART_BASE_ADDR(n) + 0x4) #define V850E_UART_ASIF_ADDR(n) (V850E_UART_BASE_ADDR(n) + 0x4)
#define NB85E_UART_CKSR_ADDR(n) (NB85E_UART_BASE_ADDR(n) + 0x6) #define V850E_UART_CKSR_ADDR(n) (V850E_UART_BASE_ADDR(n) + 0x6)
#define NB85E_UART_BRGC_ADDR(n) (NB85E_UART_BASE_ADDR(n) + 0x8) #define V850E_UART_BRGC_ADDR(n) (V850E_UART_BASE_ADDR(n) + 0x8)
#define NB85E_UART_TXB_ADDR(n) (NB85E_UART_BASE_ADDR(n) + 0xA) #define V850E_UART_TXB_ADDR(n) (V850E_UART_BASE_ADDR(n) + 0xA)
#define NB85E_UART_RXB_ADDR(n) (NB85E_UART_BASE_ADDR(n) + 0xC) #define V850E_UART_RXB_ADDR(n) (V850E_UART_BASE_ADDR(n) + 0xC)
#define NB85E_UART_NUM_CHANNELS 1 #define V850E_UART_NUM_CHANNELS 1
#define NB85E_UART_BASE_FREQ CPU_CLOCK_FREQ #define V850E_UART_BASE_FREQ CPU_CLOCK_FREQ
/* This is a function that gets called before configuring the UART. */ /* This is a function that gets called before configuring the UART. */
#define NB85E_UART_PRE_CONFIGURE teg_uart_pre_configure #define V850E_UART_PRE_CONFIGURE teg_uart_pre_configure
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern void teg_uart_pre_configure (unsigned chan, extern void teg_uart_pre_configure (unsigned chan,
unsigned cflags, unsigned baud); unsigned cflags, unsigned baud);
......
/*
* include/asm-v850/v850e_uart.h -- common V850E on-chip UART driver
*
* Copyright (C) 2001,02,03 NEC Electronics Corporation
* Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this
* archive for more details.
*
* Written by Miles Bader <miles@gnu.org>
*/
/* There's not actually a single UART implementation used by V850E CPUs,
but rather a series of implementations that are all `close' to one
another. This file corresponds to the single driver which handles all
of them. */
#ifndef __V850_V850E_UART_H__
#define __V850_V850E_UART_H__
#include <linux/config.h>
#include <linux/termios.h>
#include <asm/v850e_utils.h>
#include <asm/types.h>
#include <asm/machdep.h> /* Pick up chip-specific defs. */
/* Include model-specific definitions. */
#ifdef CONFIG_V850E_UART
# ifdef CONFIG_V850E_UARTB
# include <asm-v850/v850e_uartb.h>
# else
# include <asm-v850/v850e_uarta.h> /* original V850E UART */
# endif
#endif
/* Optional capabilities some hardware provides. */
/* This UART doesn't implement RTS/CTS by default, but some platforms
implement them externally, so check to see if <asm/machdep.h> defined
anything. */
#ifdef V850E_UART_CTS
#define v850e_uart_cts(n) V850E_UART_CTS(n)
#else
#define v850e_uart_cts(n) (1)
#endif
/* Do the same for RTS. */
#ifdef V850E_UART_SET_RTS
#define v850e_uart_set_rts(n,v) V850E_UART_SET_RTS(n,v)
#else
#define v850e_uart_set_rts(n,v) ((void)0)
#endif
/* This is the serial channel to use for the boot console (if desired). */
#ifndef V850E_UART_CONSOLE_CHANNEL
# define V850E_UART_CONSOLE_CHANNEL 0
#endif
#ifndef __ASSEMBLY__
/* Setup a console using channel 0 of the builtin uart. */
extern void v850e_uart_cons_init (unsigned chan);
/* Configure and turn on uart channel CHAN, using the termios `control
modes' bits in CFLAGS, and a baud-rate of BAUD. */
void v850e_uart_configure (unsigned chan, unsigned cflags, unsigned baud);
#endif /* !__ASSEMBLY__ */
#endif /* __V850_V850E_UART_H__ */
This diff is collapsed.
This diff is collapsed.
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
#define PORT_SUNSAB 39 #define PORT_SUNSAB 39
/* NEC v850. */ /* NEC v850. */
#define PORT_NB85E_UART 40 #define PORT_V850E_UART 40
/* NEC PC-9800 */ /* NEC PC-9800 */
#define PORT_8251_PC98 41 #define PORT_8251_PC98 41
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment