xref: /openbmc/linux/arch/m68k/include/asm/mcfuart.h (revision 49148020)
149148020SSam Ravnborg /****************************************************************************/
249148020SSam Ravnborg 
349148020SSam Ravnborg /*
449148020SSam Ravnborg  *	mcfuart.h -- ColdFire internal UART support defines.
549148020SSam Ravnborg  *
649148020SSam Ravnborg  *	(C) Copyright 1999-2003, Greg Ungerer (gerg@snapgear.com)
749148020SSam Ravnborg  * 	(C) Copyright 2000, Lineo Inc. (www.lineo.com)
849148020SSam Ravnborg  */
949148020SSam Ravnborg 
1049148020SSam Ravnborg /****************************************************************************/
1149148020SSam Ravnborg #ifndef	mcfuart_h
1249148020SSam Ravnborg #define	mcfuart_h
1349148020SSam Ravnborg /****************************************************************************/
1449148020SSam Ravnborg 
1549148020SSam Ravnborg /*
1649148020SSam Ravnborg  *	Define the base address of the UARTS within the MBAR address
1749148020SSam Ravnborg  *	space.
1849148020SSam Ravnborg  */
1949148020SSam Ravnborg #if defined(CONFIG_M5272)
2049148020SSam Ravnborg #define	MCFUART_BASE1		0x100		/* Base address of UART1 */
2149148020SSam Ravnborg #define	MCFUART_BASE2		0x140		/* Base address of UART2 */
2249148020SSam Ravnborg #elif defined(CONFIG_M5206) || defined(CONFIG_M5206e)
2349148020SSam Ravnborg #if defined(CONFIG_NETtel)
2449148020SSam Ravnborg #define	MCFUART_BASE1		0x180		/* Base address of UART1 */
2549148020SSam Ravnborg #define	MCFUART_BASE2		0x140		/* Base address of UART2 */
2649148020SSam Ravnborg #else
2749148020SSam Ravnborg #define	MCFUART_BASE1		0x140		/* Base address of UART1 */
2849148020SSam Ravnborg #define	MCFUART_BASE2		0x180		/* Base address of UART2 */
2949148020SSam Ravnborg #endif
3049148020SSam Ravnborg #elif defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x)
3149148020SSam Ravnborg #define MCFUART_BASE1		0x200           /* Base address of UART1 */
3249148020SSam Ravnborg #define MCFUART_BASE2		0x240           /* Base address of UART2 */
3349148020SSam Ravnborg #define MCFUART_BASE3		0x280           /* Base address of UART3 */
3449148020SSam Ravnborg #elif defined(CONFIG_M5249) || defined(CONFIG_M5307) || defined(CONFIG_M5407)
3549148020SSam Ravnborg #if defined(CONFIG_NETtel) || defined(CONFIG_SECUREEDGEMP3)
3649148020SSam Ravnborg #define MCFUART_BASE1		0x200           /* Base address of UART1 */
3749148020SSam Ravnborg #define MCFUART_BASE2		0x1c0           /* Base address of UART2 */
3849148020SSam Ravnborg #else
3949148020SSam Ravnborg #define MCFUART_BASE1		0x1c0           /* Base address of UART1 */
4049148020SSam Ravnborg #define MCFUART_BASE2		0x200           /* Base address of UART2 */
4149148020SSam Ravnborg #endif
4249148020SSam Ravnborg #elif defined(CONFIG_M520x)
4349148020SSam Ravnborg #define MCFUART_BASE1		0x60000		/* Base address of UART1 */
4449148020SSam Ravnborg #define MCFUART_BASE2		0x64000		/* Base address of UART2 */
4549148020SSam Ravnborg #define MCFUART_BASE3		0x68000		/* Base address of UART2 */
4649148020SSam Ravnborg #elif defined(CONFIG_M532x)
4749148020SSam Ravnborg #define MCFUART_BASE1		0xfc060000	/* Base address of UART1 */
4849148020SSam Ravnborg #define MCFUART_BASE2		0xfc064000	/* Base address of UART2 */
4949148020SSam Ravnborg #define MCFUART_BASE3		0xfc068000	/* Base address of UART3 */
5049148020SSam Ravnborg #endif
5149148020SSam Ravnborg 
5249148020SSam Ravnborg 
5349148020SSam Ravnborg #include <linux/serial_core.h>
5449148020SSam Ravnborg #include <linux/platform_device.h>
5549148020SSam Ravnborg 
5649148020SSam Ravnborg struct mcf_platform_uart {
5749148020SSam Ravnborg 	unsigned long	mapbase;	/* Physical address base */
5849148020SSam Ravnborg 	void __iomem	*membase;	/* Virtual address if mapped */
5949148020SSam Ravnborg 	unsigned int	irq;		/* Interrupt vector */
6049148020SSam Ravnborg 	unsigned int	uartclk;	/* UART clock rate */
6149148020SSam Ravnborg };
6249148020SSam Ravnborg 
6349148020SSam Ravnborg /*
6449148020SSam Ravnborg  *	Define the ColdFire UART register set addresses.
6549148020SSam Ravnborg  */
6649148020SSam Ravnborg #define	MCFUART_UMR		0x00		/* Mode register (r/w) */
6749148020SSam Ravnborg #define	MCFUART_USR		0x04		/* Status register (r) */
6849148020SSam Ravnborg #define	MCFUART_UCSR		0x04		/* Clock Select (w) */
6949148020SSam Ravnborg #define	MCFUART_UCR		0x08		/* Command register (w) */
7049148020SSam Ravnborg #define	MCFUART_URB		0x0c		/* Receiver Buffer (r) */
7149148020SSam Ravnborg #define	MCFUART_UTB		0x0c		/* Transmit Buffer (w) */
7249148020SSam Ravnborg #define	MCFUART_UIPCR		0x10		/* Input Port Change (r) */
7349148020SSam Ravnborg #define	MCFUART_UACR		0x10		/* Auxiliary Control (w) */
7449148020SSam Ravnborg #define	MCFUART_UISR		0x14		/* Interrupt Status (r) */
7549148020SSam Ravnborg #define	MCFUART_UIMR		0x14		/* Interrupt Mask (w) */
7649148020SSam Ravnborg #define	MCFUART_UBG1		0x18		/* Baud Rate MSB (r/w) */
7749148020SSam Ravnborg #define	MCFUART_UBG2		0x1c		/* Baud Rate LSB (r/w) */
7849148020SSam Ravnborg #ifdef	CONFIG_M5272
7949148020SSam Ravnborg #define	MCFUART_UTF		0x28		/* Transmitter FIFO (r/w) */
8049148020SSam Ravnborg #define	MCFUART_URF		0x2c		/* Receiver FIFO (r/w) */
8149148020SSam Ravnborg #define	MCFUART_UFPD		0x30		/* Frac Prec. Divider (r/w) */
8249148020SSam Ravnborg #else
8349148020SSam Ravnborg #define	MCFUART_UIVR		0x30		/* Interrupt Vector (r/w) */
8449148020SSam Ravnborg #endif
8549148020SSam Ravnborg #define	MCFUART_UIPR		0x34		/* Input Port (r) */
8649148020SSam Ravnborg #define	MCFUART_UOP1		0x38		/* Output Port Bit Set (w) */
8749148020SSam Ravnborg #define	MCFUART_UOP0		0x3c		/* Output Port Bit Reset (w) */
8849148020SSam Ravnborg 
8949148020SSam Ravnborg 
9049148020SSam Ravnborg /*
9149148020SSam Ravnborg  *	Define bit flags in Mode Register 1 (MR1).
9249148020SSam Ravnborg  */
9349148020SSam Ravnborg #define	MCFUART_MR1_RXRTS	0x80		/* Auto RTS flow control */
9449148020SSam Ravnborg #define	MCFUART_MR1_RXIRQFULL	0x40		/* RX IRQ type FULL */
9549148020SSam Ravnborg #define	MCFUART_MR1_RXIRQRDY	0x00		/* RX IRQ type RDY */
9649148020SSam Ravnborg #define	MCFUART_MR1_RXERRBLOCK	0x20		/* RX block error mode */
9749148020SSam Ravnborg #define	MCFUART_MR1_RXERRCHAR	0x00		/* RX char error mode */
9849148020SSam Ravnborg 
9949148020SSam Ravnborg #define	MCFUART_MR1_PARITYNONE	0x10		/* No parity */
10049148020SSam Ravnborg #define	MCFUART_MR1_PARITYEVEN	0x00		/* Even parity */
10149148020SSam Ravnborg #define	MCFUART_MR1_PARITYODD	0x04		/* Odd parity */
10249148020SSam Ravnborg #define	MCFUART_MR1_PARITYSPACE	0x08		/* Space parity */
10349148020SSam Ravnborg #define	MCFUART_MR1_PARITYMARK	0x0c		/* Mark parity */
10449148020SSam Ravnborg 
10549148020SSam Ravnborg #define	MCFUART_MR1_CS5		0x00		/* 5 bits per char */
10649148020SSam Ravnborg #define	MCFUART_MR1_CS6		0x01		/* 6 bits per char */
10749148020SSam Ravnborg #define	MCFUART_MR1_CS7		0x02		/* 7 bits per char */
10849148020SSam Ravnborg #define	MCFUART_MR1_CS8		0x03		/* 8 bits per char */
10949148020SSam Ravnborg 
11049148020SSam Ravnborg /*
11149148020SSam Ravnborg  *	Define bit flags in Mode Register 2 (MR2).
11249148020SSam Ravnborg  */
11349148020SSam Ravnborg #define	MCFUART_MR2_LOOPBACK	0x80		/* Loopback mode */
11449148020SSam Ravnborg #define	MCFUART_MR2_REMOTELOOP	0xc0		/* Remote loopback mode */
11549148020SSam Ravnborg #define	MCFUART_MR2_AUTOECHO	0x40		/* Automatic echo */
11649148020SSam Ravnborg #define	MCFUART_MR2_TXRTS	0x20		/* Assert RTS on TX */
11749148020SSam Ravnborg #define	MCFUART_MR2_TXCTS	0x10		/* Auto CTS flow control */
11849148020SSam Ravnborg 
11949148020SSam Ravnborg #define	MCFUART_MR2_STOP1	0x07		/* 1 stop bit */
12049148020SSam Ravnborg #define	MCFUART_MR2_STOP15	0x08		/* 1.5 stop bits */
12149148020SSam Ravnborg #define	MCFUART_MR2_STOP2	0x0f		/* 2 stop bits */
12249148020SSam Ravnborg 
12349148020SSam Ravnborg /*
12449148020SSam Ravnborg  *	Define bit flags in Status Register (USR).
12549148020SSam Ravnborg  */
12649148020SSam Ravnborg #define	MCFUART_USR_RXBREAK	0x80		/* Received BREAK */
12749148020SSam Ravnborg #define	MCFUART_USR_RXFRAMING	0x40		/* Received framing error */
12849148020SSam Ravnborg #define	MCFUART_USR_RXPARITY	0x20		/* Received parity error */
12949148020SSam Ravnborg #define	MCFUART_USR_RXOVERRUN	0x10		/* Received overrun error */
13049148020SSam Ravnborg #define	MCFUART_USR_TXEMPTY	0x08		/* Transmitter empty */
13149148020SSam Ravnborg #define	MCFUART_USR_TXREADY	0x04		/* Transmitter ready */
13249148020SSam Ravnborg #define	MCFUART_USR_RXFULL	0x02		/* Receiver full */
13349148020SSam Ravnborg #define	MCFUART_USR_RXREADY	0x01		/* Receiver ready */
13449148020SSam Ravnborg 
13549148020SSam Ravnborg #define	MCFUART_USR_RXERR	(MCFUART_USR_RXBREAK | MCFUART_USR_RXFRAMING | \
13649148020SSam Ravnborg 				MCFUART_USR_RXPARITY | MCFUART_USR_RXOVERRUN)
13749148020SSam Ravnborg 
13849148020SSam Ravnborg /*
13949148020SSam Ravnborg  *	Define bit flags in Clock Select Register (UCSR).
14049148020SSam Ravnborg  */
14149148020SSam Ravnborg #define	MCFUART_UCSR_RXCLKTIMER	0xd0		/* RX clock is timer */
14249148020SSam Ravnborg #define	MCFUART_UCSR_RXCLKEXT16	0xe0		/* RX clock is external x16 */
14349148020SSam Ravnborg #define	MCFUART_UCSR_RXCLKEXT1	0xf0		/* RX clock is external x1 */
14449148020SSam Ravnborg 
14549148020SSam Ravnborg #define	MCFUART_UCSR_TXCLKTIMER	0x0d		/* TX clock is timer */
14649148020SSam Ravnborg #define	MCFUART_UCSR_TXCLKEXT16	0x0e		/* TX clock is external x16 */
14749148020SSam Ravnborg #define	MCFUART_UCSR_TXCLKEXT1	0x0f		/* TX clock is external x1 */
14849148020SSam Ravnborg 
14949148020SSam Ravnborg /*
15049148020SSam Ravnborg  *	Define bit flags in Command Register (UCR).
15149148020SSam Ravnborg  */
15249148020SSam Ravnborg #define	MCFUART_UCR_CMDNULL		0x00	/* No command */
15349148020SSam Ravnborg #define	MCFUART_UCR_CMDRESETMRPTR	0x10	/* Reset MR pointer */
15449148020SSam Ravnborg #define	MCFUART_UCR_CMDRESETRX		0x20	/* Reset receiver */
15549148020SSam Ravnborg #define	MCFUART_UCR_CMDRESETTX		0x30	/* Reset transmitter */
15649148020SSam Ravnborg #define	MCFUART_UCR_CMDRESETERR		0x40	/* Reset error status */
15749148020SSam Ravnborg #define	MCFUART_UCR_CMDRESETBREAK	0x50	/* Reset BREAK change */
15849148020SSam Ravnborg #define	MCFUART_UCR_CMDBREAKSTART	0x60	/* Start BREAK */
15949148020SSam Ravnborg #define	MCFUART_UCR_CMDBREAKSTOP	0x70	/* Stop BREAK */
16049148020SSam Ravnborg 
16149148020SSam Ravnborg #define	MCFUART_UCR_TXNULL	0x00		/* No TX command */
16249148020SSam Ravnborg #define	MCFUART_UCR_TXENABLE	0x04		/* Enable TX */
16349148020SSam Ravnborg #define	MCFUART_UCR_TXDISABLE	0x08		/* Disable TX */
16449148020SSam Ravnborg #define	MCFUART_UCR_RXNULL	0x00		/* No RX command */
16549148020SSam Ravnborg #define	MCFUART_UCR_RXENABLE	0x01		/* Enable RX */
16649148020SSam Ravnborg #define	MCFUART_UCR_RXDISABLE	0x02		/* Disable RX */
16749148020SSam Ravnborg 
16849148020SSam Ravnborg /*
16949148020SSam Ravnborg  *	Define bit flags in Input Port Change Register (UIPCR).
17049148020SSam Ravnborg  */
17149148020SSam Ravnborg #define	MCFUART_UIPCR_CTSCOS	0x10		/* CTS change of state */
17249148020SSam Ravnborg #define	MCFUART_UIPCR_CTS	0x01		/* CTS value */
17349148020SSam Ravnborg 
17449148020SSam Ravnborg /*
17549148020SSam Ravnborg  *	Define bit flags in Input Port Register (UIP).
17649148020SSam Ravnborg  */
17749148020SSam Ravnborg #define	MCFUART_UIPR_CTS	0x01		/* CTS value */
17849148020SSam Ravnborg 
17949148020SSam Ravnborg /*
18049148020SSam Ravnborg  *	Define bit flags in Output Port Registers (UOP).
18149148020SSam Ravnborg  *	Clear bit by writing to UOP0, set by writing to UOP1.
18249148020SSam Ravnborg  */
18349148020SSam Ravnborg #define	MCFUART_UOP_RTS		0x01		/* RTS set or clear */
18449148020SSam Ravnborg 
18549148020SSam Ravnborg /*
18649148020SSam Ravnborg  *	Define bit flags in the Auxiliary Control Register (UACR).
18749148020SSam Ravnborg  */
18849148020SSam Ravnborg #define	MCFUART_UACR_IEC	0x01		/* Input enable control */
18949148020SSam Ravnborg 
19049148020SSam Ravnborg /*
19149148020SSam Ravnborg  *	Define bit flags in Interrupt Status Register (UISR).
19249148020SSam Ravnborg  *	These same bits are used for the Interrupt Mask Register (UIMR).
19349148020SSam Ravnborg  */
19449148020SSam Ravnborg #define	MCFUART_UIR_COS		0x80		/* Change of state (CTS) */
19549148020SSam Ravnborg #define	MCFUART_UIR_DELTABREAK	0x04		/* Break start or stop */
19649148020SSam Ravnborg #define	MCFUART_UIR_RXREADY	0x02		/* Receiver ready */
19749148020SSam Ravnborg #define	MCFUART_UIR_TXREADY	0x01		/* Transmitter ready */
19849148020SSam Ravnborg 
19949148020SSam Ravnborg #ifdef	CONFIG_M5272
20049148020SSam Ravnborg /*
20149148020SSam Ravnborg  *	Define bit flags in the Transmitter FIFO Register (UTF).
20249148020SSam Ravnborg  */
20349148020SSam Ravnborg #define	MCFUART_UTF_TXB		0x1f		/* Transmitter data level */
20449148020SSam Ravnborg #define	MCFUART_UTF_FULL	0x20		/* Transmitter fifo full */
20549148020SSam Ravnborg #define	MCFUART_UTF_TXS		0xc0		/* Transmitter status */
20649148020SSam Ravnborg 
20749148020SSam Ravnborg /*
20849148020SSam Ravnborg  *	Define bit flags in the Receiver FIFO Register (URF).
20949148020SSam Ravnborg  */
21049148020SSam Ravnborg #define	MCFUART_URF_RXB		0x1f		/* Receiver data level */
21149148020SSam Ravnborg #define	MCFUART_URF_FULL	0x20		/* Receiver fifo full */
21249148020SSam Ravnborg #define	MCFUART_URF_RXS		0xc0		/* Receiver status */
21349148020SSam Ravnborg #endif
21449148020SSam Ravnborg 
21549148020SSam Ravnborg /****************************************************************************/
21649148020SSam Ravnborg #endif	/* mcfuart_h */
217