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 */ 50ea49f8ffSPhilippe De Muyter #elif defined(CONFIG_M548x) 51ea49f8ffSPhilippe De Muyter #define MCFUART_BASE1 0x8600 /* on M548x */ 52ea49f8ffSPhilippe De Muyter #define MCFUART_BASE2 0x8700 /* on M548x */ 53ea49f8ffSPhilippe De Muyter #define MCFUART_BASE3 0x8800 /* on M548x */ 54ea49f8ffSPhilippe De Muyter #define MCFUART_BASE4 0x8900 /* on M548x */ 5549148020SSam Ravnborg #endif 5649148020SSam Ravnborg 5749148020SSam Ravnborg 5849148020SSam Ravnborg #include <linux/serial_core.h> 5949148020SSam Ravnborg #include <linux/platform_device.h> 6049148020SSam Ravnborg 6149148020SSam Ravnborg struct mcf_platform_uart { 6249148020SSam Ravnborg unsigned long mapbase; /* Physical address base */ 6349148020SSam Ravnborg void __iomem *membase; /* Virtual address if mapped */ 6449148020SSam Ravnborg unsigned int irq; /* Interrupt vector */ 6549148020SSam Ravnborg unsigned int uartclk; /* UART clock rate */ 6649148020SSam Ravnborg }; 6749148020SSam Ravnborg 6849148020SSam Ravnborg /* 6949148020SSam Ravnborg * Define the ColdFire UART register set addresses. 7049148020SSam Ravnborg */ 7149148020SSam Ravnborg #define MCFUART_UMR 0x00 /* Mode register (r/w) */ 7249148020SSam Ravnborg #define MCFUART_USR 0x04 /* Status register (r) */ 7349148020SSam Ravnborg #define MCFUART_UCSR 0x04 /* Clock Select (w) */ 7449148020SSam Ravnborg #define MCFUART_UCR 0x08 /* Command register (w) */ 7549148020SSam Ravnborg #define MCFUART_URB 0x0c /* Receiver Buffer (r) */ 7649148020SSam Ravnborg #define MCFUART_UTB 0x0c /* Transmit Buffer (w) */ 7749148020SSam Ravnborg #define MCFUART_UIPCR 0x10 /* Input Port Change (r) */ 7849148020SSam Ravnborg #define MCFUART_UACR 0x10 /* Auxiliary Control (w) */ 7949148020SSam Ravnborg #define MCFUART_UISR 0x14 /* Interrupt Status (r) */ 8049148020SSam Ravnborg #define MCFUART_UIMR 0x14 /* Interrupt Mask (w) */ 8149148020SSam Ravnborg #define MCFUART_UBG1 0x18 /* Baud Rate MSB (r/w) */ 8249148020SSam Ravnborg #define MCFUART_UBG2 0x1c /* Baud Rate LSB (r/w) */ 8349148020SSam Ravnborg #ifdef CONFIG_M5272 8449148020SSam Ravnborg #define MCFUART_UTF 0x28 /* Transmitter FIFO (r/w) */ 8549148020SSam Ravnborg #define MCFUART_URF 0x2c /* Receiver FIFO (r/w) */ 8649148020SSam Ravnborg #define MCFUART_UFPD 0x30 /* Frac Prec. Divider (r/w) */ 8749148020SSam Ravnborg #else 8849148020SSam Ravnborg #define MCFUART_UIVR 0x30 /* Interrupt Vector (r/w) */ 8949148020SSam Ravnborg #endif 9049148020SSam Ravnborg #define MCFUART_UIPR 0x34 /* Input Port (r) */ 9149148020SSam Ravnborg #define MCFUART_UOP1 0x38 /* Output Port Bit Set (w) */ 9249148020SSam Ravnborg #define MCFUART_UOP0 0x3c /* Output Port Bit Reset (w) */ 9349148020SSam Ravnborg 9449148020SSam Ravnborg 9549148020SSam Ravnborg /* 9649148020SSam Ravnborg * Define bit flags in Mode Register 1 (MR1). 9749148020SSam Ravnborg */ 9849148020SSam Ravnborg #define MCFUART_MR1_RXRTS 0x80 /* Auto RTS flow control */ 9949148020SSam Ravnborg #define MCFUART_MR1_RXIRQFULL 0x40 /* RX IRQ type FULL */ 10049148020SSam Ravnborg #define MCFUART_MR1_RXIRQRDY 0x00 /* RX IRQ type RDY */ 10149148020SSam Ravnborg #define MCFUART_MR1_RXERRBLOCK 0x20 /* RX block error mode */ 10249148020SSam Ravnborg #define MCFUART_MR1_RXERRCHAR 0x00 /* RX char error mode */ 10349148020SSam Ravnborg 10449148020SSam Ravnborg #define MCFUART_MR1_PARITYNONE 0x10 /* No parity */ 10549148020SSam Ravnborg #define MCFUART_MR1_PARITYEVEN 0x00 /* Even parity */ 10649148020SSam Ravnborg #define MCFUART_MR1_PARITYODD 0x04 /* Odd parity */ 10749148020SSam Ravnborg #define MCFUART_MR1_PARITYSPACE 0x08 /* Space parity */ 10849148020SSam Ravnborg #define MCFUART_MR1_PARITYMARK 0x0c /* Mark parity */ 10949148020SSam Ravnborg 11049148020SSam Ravnborg #define MCFUART_MR1_CS5 0x00 /* 5 bits per char */ 11149148020SSam Ravnborg #define MCFUART_MR1_CS6 0x01 /* 6 bits per char */ 11249148020SSam Ravnborg #define MCFUART_MR1_CS7 0x02 /* 7 bits per char */ 11349148020SSam Ravnborg #define MCFUART_MR1_CS8 0x03 /* 8 bits per char */ 11449148020SSam Ravnborg 11549148020SSam Ravnborg /* 11649148020SSam Ravnborg * Define bit flags in Mode Register 2 (MR2). 11749148020SSam Ravnborg */ 11849148020SSam Ravnborg #define MCFUART_MR2_LOOPBACK 0x80 /* Loopback mode */ 11949148020SSam Ravnborg #define MCFUART_MR2_REMOTELOOP 0xc0 /* Remote loopback mode */ 12049148020SSam Ravnborg #define MCFUART_MR2_AUTOECHO 0x40 /* Automatic echo */ 12149148020SSam Ravnborg #define MCFUART_MR2_TXRTS 0x20 /* Assert RTS on TX */ 12249148020SSam Ravnborg #define MCFUART_MR2_TXCTS 0x10 /* Auto CTS flow control */ 12349148020SSam Ravnborg 12449148020SSam Ravnborg #define MCFUART_MR2_STOP1 0x07 /* 1 stop bit */ 12549148020SSam Ravnborg #define MCFUART_MR2_STOP15 0x08 /* 1.5 stop bits */ 12649148020SSam Ravnborg #define MCFUART_MR2_STOP2 0x0f /* 2 stop bits */ 12749148020SSam Ravnborg 12849148020SSam Ravnborg /* 12949148020SSam Ravnborg * Define bit flags in Status Register (USR). 13049148020SSam Ravnborg */ 13149148020SSam Ravnborg #define MCFUART_USR_RXBREAK 0x80 /* Received BREAK */ 13249148020SSam Ravnborg #define MCFUART_USR_RXFRAMING 0x40 /* Received framing error */ 13349148020SSam Ravnborg #define MCFUART_USR_RXPARITY 0x20 /* Received parity error */ 13449148020SSam Ravnborg #define MCFUART_USR_RXOVERRUN 0x10 /* Received overrun error */ 13549148020SSam Ravnborg #define MCFUART_USR_TXEMPTY 0x08 /* Transmitter empty */ 13649148020SSam Ravnborg #define MCFUART_USR_TXREADY 0x04 /* Transmitter ready */ 13749148020SSam Ravnborg #define MCFUART_USR_RXFULL 0x02 /* Receiver full */ 13849148020SSam Ravnborg #define MCFUART_USR_RXREADY 0x01 /* Receiver ready */ 13949148020SSam Ravnborg 14049148020SSam Ravnborg #define MCFUART_USR_RXERR (MCFUART_USR_RXBREAK | MCFUART_USR_RXFRAMING | \ 14149148020SSam Ravnborg MCFUART_USR_RXPARITY | MCFUART_USR_RXOVERRUN) 14249148020SSam Ravnborg 14349148020SSam Ravnborg /* 14449148020SSam Ravnborg * Define bit flags in Clock Select Register (UCSR). 14549148020SSam Ravnborg */ 14649148020SSam Ravnborg #define MCFUART_UCSR_RXCLKTIMER 0xd0 /* RX clock is timer */ 14749148020SSam Ravnborg #define MCFUART_UCSR_RXCLKEXT16 0xe0 /* RX clock is external x16 */ 14849148020SSam Ravnborg #define MCFUART_UCSR_RXCLKEXT1 0xf0 /* RX clock is external x1 */ 14949148020SSam Ravnborg 15049148020SSam Ravnborg #define MCFUART_UCSR_TXCLKTIMER 0x0d /* TX clock is timer */ 15149148020SSam Ravnborg #define MCFUART_UCSR_TXCLKEXT16 0x0e /* TX clock is external x16 */ 15249148020SSam Ravnborg #define MCFUART_UCSR_TXCLKEXT1 0x0f /* TX clock is external x1 */ 15349148020SSam Ravnborg 15449148020SSam Ravnborg /* 15549148020SSam Ravnborg * Define bit flags in Command Register (UCR). 15649148020SSam Ravnborg */ 15749148020SSam Ravnborg #define MCFUART_UCR_CMDNULL 0x00 /* No command */ 15849148020SSam Ravnborg #define MCFUART_UCR_CMDRESETMRPTR 0x10 /* Reset MR pointer */ 15949148020SSam Ravnborg #define MCFUART_UCR_CMDRESETRX 0x20 /* Reset receiver */ 16049148020SSam Ravnborg #define MCFUART_UCR_CMDRESETTX 0x30 /* Reset transmitter */ 16149148020SSam Ravnborg #define MCFUART_UCR_CMDRESETERR 0x40 /* Reset error status */ 16249148020SSam Ravnborg #define MCFUART_UCR_CMDRESETBREAK 0x50 /* Reset BREAK change */ 16349148020SSam Ravnborg #define MCFUART_UCR_CMDBREAKSTART 0x60 /* Start BREAK */ 16449148020SSam Ravnborg #define MCFUART_UCR_CMDBREAKSTOP 0x70 /* Stop BREAK */ 16549148020SSam Ravnborg 16649148020SSam Ravnborg #define MCFUART_UCR_TXNULL 0x00 /* No TX command */ 16749148020SSam Ravnborg #define MCFUART_UCR_TXENABLE 0x04 /* Enable TX */ 16849148020SSam Ravnborg #define MCFUART_UCR_TXDISABLE 0x08 /* Disable TX */ 16949148020SSam Ravnborg #define MCFUART_UCR_RXNULL 0x00 /* No RX command */ 17049148020SSam Ravnborg #define MCFUART_UCR_RXENABLE 0x01 /* Enable RX */ 17149148020SSam Ravnborg #define MCFUART_UCR_RXDISABLE 0x02 /* Disable RX */ 17249148020SSam Ravnborg 17349148020SSam Ravnborg /* 17449148020SSam Ravnborg * Define bit flags in Input Port Change Register (UIPCR). 17549148020SSam Ravnborg */ 17649148020SSam Ravnborg #define MCFUART_UIPCR_CTSCOS 0x10 /* CTS change of state */ 17749148020SSam Ravnborg #define MCFUART_UIPCR_CTS 0x01 /* CTS value */ 17849148020SSam Ravnborg 17949148020SSam Ravnborg /* 18049148020SSam Ravnborg * Define bit flags in Input Port Register (UIP). 18149148020SSam Ravnborg */ 18249148020SSam Ravnborg #define MCFUART_UIPR_CTS 0x01 /* CTS value */ 18349148020SSam Ravnborg 18449148020SSam Ravnborg /* 18549148020SSam Ravnborg * Define bit flags in Output Port Registers (UOP). 18649148020SSam Ravnborg * Clear bit by writing to UOP0, set by writing to UOP1. 18749148020SSam Ravnborg */ 18849148020SSam Ravnborg #define MCFUART_UOP_RTS 0x01 /* RTS set or clear */ 18949148020SSam Ravnborg 19049148020SSam Ravnborg /* 19149148020SSam Ravnborg * Define bit flags in the Auxiliary Control Register (UACR). 19249148020SSam Ravnborg */ 19349148020SSam Ravnborg #define MCFUART_UACR_IEC 0x01 /* Input enable control */ 19449148020SSam Ravnborg 19549148020SSam Ravnborg /* 19649148020SSam Ravnborg * Define bit flags in Interrupt Status Register (UISR). 19749148020SSam Ravnborg * These same bits are used for the Interrupt Mask Register (UIMR). 19849148020SSam Ravnborg */ 19949148020SSam Ravnborg #define MCFUART_UIR_COS 0x80 /* Change of state (CTS) */ 20049148020SSam Ravnborg #define MCFUART_UIR_DELTABREAK 0x04 /* Break start or stop */ 20149148020SSam Ravnborg #define MCFUART_UIR_RXREADY 0x02 /* Receiver ready */ 20249148020SSam Ravnborg #define MCFUART_UIR_TXREADY 0x01 /* Transmitter ready */ 20349148020SSam Ravnborg 20449148020SSam Ravnborg #ifdef CONFIG_M5272 20549148020SSam Ravnborg /* 20649148020SSam Ravnborg * Define bit flags in the Transmitter FIFO Register (UTF). 20749148020SSam Ravnborg */ 20849148020SSam Ravnborg #define MCFUART_UTF_TXB 0x1f /* Transmitter data level */ 20949148020SSam Ravnborg #define MCFUART_UTF_FULL 0x20 /* Transmitter fifo full */ 21049148020SSam Ravnborg #define MCFUART_UTF_TXS 0xc0 /* Transmitter status */ 21149148020SSam Ravnborg 21249148020SSam Ravnborg /* 21349148020SSam Ravnborg * Define bit flags in the Receiver FIFO Register (URF). 21449148020SSam Ravnborg */ 21549148020SSam Ravnborg #define MCFUART_URF_RXB 0x1f /* Receiver data level */ 21649148020SSam Ravnborg #define MCFUART_URF_FULL 0x20 /* Receiver fifo full */ 21749148020SSam Ravnborg #define MCFUART_URF_RXS 0xc0 /* Receiver status */ 21849148020SSam Ravnborg #endif 21949148020SSam Ravnborg 2203732b68fSPhilippe De Muyter #if defined(CONFIG_M5272) 2213732b68fSPhilippe De Muyter #define MCFUART_TXFIFOSIZE 25 2223732b68fSPhilippe De Muyter #else 2233732b68fSPhilippe De Muyter #define MCFUART_TXFIFOSIZE 1 2243732b68fSPhilippe De Muyter #endif 22549148020SSam Ravnborg /****************************************************************************/ 22649148020SSam Ravnborg #endif /* mcfuart_h */ 227