123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- /*
- * bfin_serial.h - Blackfin UART/Serial definitions
- *
- * Copyright 2006-2010 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
- #ifndef __BFIN_ASM_SERIAL_H__
- #define __BFIN_ASM_SERIAL_H__
- #include <linux/serial_core.h>
- #include <linux/spinlock.h>
- #include <mach/anomaly.h>
- #include <mach/bfin_serial.h>
- #if defined(CONFIG_BFIN_UART0_CTSRTS) || \
- defined(CONFIG_BFIN_UART1_CTSRTS) || \
- defined(CONFIG_BFIN_UART2_CTSRTS) || \
- defined(CONFIG_BFIN_UART3_CTSRTS)
- # if defined(BFIN_UART_BF54X_STYLE) || defined(BFIN_UART_BF60X_STYLE)
- # define CONFIG_SERIAL_BFIN_HARD_CTSRTS
- # else
- # define CONFIG_SERIAL_BFIN_CTSRTS
- # endif
- #endif
- struct circ_buf;
- struct timer_list;
- struct work_struct;
- struct bfin_serial_port {
- struct uart_port port;
- unsigned int old_status;
- int tx_irq;
- int rx_irq;
- int status_irq;
- #ifndef BFIN_UART_BF54X_STYLE
- unsigned int lsr;
- #endif
- #ifdef CONFIG_SERIAL_BFIN_DMA
- int tx_done;
- int tx_count;
- struct circ_buf rx_dma_buf;
- struct timer_list rx_dma_timer;
- int rx_dma_nrows;
- spinlock_t rx_lock;
- unsigned int tx_dma_channel;
- unsigned int rx_dma_channel;
- struct work_struct tx_dma_workqueue;
- #elif ANOMALY_05000363
- unsigned int anomaly_threshold;
- #endif
- #if defined(CONFIG_SERIAL_BFIN_CTSRTS) || \
- defined(CONFIG_SERIAL_BFIN_HARD_CTSRTS)
- int cts_pin;
- int rts_pin;
- #endif
- };
- #ifdef BFIN_UART_BF60X_STYLE
- /* UART_CTL Masks */
- #define UCEN 0x1 /* Enable UARTx Clocks */
- #define LOOP_ENA 0x2 /* Loopback Mode Enable */
- #define UMOD_MDB 0x10 /* Enable MDB Mode */
- #define UMOD_IRDA 0x20 /* Enable IrDA Mode */
- #define UMOD_MASK 0x30 /* Uart Mode Mask */
- #define WLS(x) (((x-5) & 0x03) << 8) /* Word Length Select */
- #define WLS_MASK 0x300 /* Word length Select Mask */
- #define WLS_OFFSET 8 /* Word length Select Offset */
- #define STB 0x1000 /* Stop Bits */
- #define STBH 0x2000 /* Half Stop Bits */
- #define PEN 0x4000 /* Parity Enable */
- #define EPS 0x8000 /* Even Parity Select */
- #define STP 0x10000 /* Stick Parity */
- #define FPE 0x20000 /* Force Parity Error On Transmit */
- #define FFE 0x40000 /* Force Framing Error On Transmit */
- #define SB 0x80000 /* Set Break */
- #define LCR_MASK (SB | STP | EPS | PEN | STB | WLS_MASK)
- #define FCPOL 0x400000 /* Flow Control Pin Polarity */
- #define RPOLC 0x800000 /* IrDA RX Polarity Change */
- #define TPOLC 0x1000000 /* IrDA TX Polarity Change */
- #define MRTS 0x2000000 /* Manual Request To Send */
- #define XOFF 0x4000000 /* Transmitter Off */
- #define ARTS 0x8000000 /* Automatic Request To Send */
- #define ACTS 0x10000000 /* Automatic Clear To Send */
- #define RFIT 0x20000000 /* Receive FIFO IRQ Threshold */
- #define RFRT 0x40000000 /* Receive FIFO RTS Threshold */
- /* UART_STAT Masks */
- #define DR 0x01 /* Data Ready */
- #define OE 0x02 /* Overrun Error */
- #define PE 0x04 /* Parity Error */
- #define FE 0x08 /* Framing Error */
- #define BI 0x10 /* Break Interrupt */
- #define THRE 0x20 /* THR Empty */
- #define TEMT 0x80 /* TSR and UART_THR Empty */
- #define TFI 0x100 /* Transmission Finished Indicator */
- #define ASTKY 0x200 /* Address Sticky */
- #define ADDR 0x400 /* Address bit status */
- #define RO 0x800 /* Reception Ongoing */
- #define SCTS 0x1000 /* Sticky CTS */
- #define CTS 0x10000 /* Clear To Send */
- #define RFCS 0x20000 /* Receive FIFO Count Status */
- /* UART_CLOCK Masks */
- #define EDBO 0x80000000 /* Enable Devide by One */
- #else /* BFIN_UART_BF60X_STYLE */
- /* UART_LCR Masks */
- #define WLS(x) (((x)-5) & 0x03) /* Word Length Select */
- #define WLS_MASK 0x03 /* Word length Select Mask */
- #define WLS_OFFSET 0 /* Word length Select Offset */
- #define STB 0x04 /* Stop Bits */
- #define PEN 0x08 /* Parity Enable */
- #define EPS 0x10 /* Even Parity Select */
- #define STP 0x20 /* Stick Parity */
- #define SB 0x40 /* Set Break */
- #define DLAB 0x80 /* Divisor Latch Access */
- #define LCR_MASK (SB | STP | EPS | PEN | STB | WLS_MASK)
- /* UART_LSR Masks */
- #define DR 0x01 /* Data Ready */
- #define OE 0x02 /* Overrun Error */
- #define PE 0x04 /* Parity Error */
- #define FE 0x08 /* Framing Error */
- #define BI 0x10 /* Break Interrupt */
- #define THRE 0x20 /* THR Empty */
- #define TEMT 0x40 /* TSR and UART_THR Empty */
- #define TFI 0x80 /* Transmission Finished Indicator */
- /* UART_MCR Masks */
- #define XOFF 0x01 /* Transmitter Off */
- #define MRTS 0x02 /* Manual Request To Send */
- #define RFIT 0x04 /* Receive FIFO IRQ Threshold */
- #define RFRT 0x08 /* Receive FIFO RTS Threshold */
- #define LOOP_ENA 0x10 /* Loopback Mode Enable */
- #define FCPOL 0x20 /* Flow Control Pin Polarity */
- #define ARTS 0x40 /* Automatic Request To Send */
- #define ACTS 0x80 /* Automatic Clear To Send */
- /* UART_MSR Masks */
- #define SCTS 0x01 /* Sticky CTS */
- #define CTS 0x10 /* Clear To Send */
- #define RFCS 0x20 /* Receive FIFO Count Status */
- /* UART_GCTL Masks */
- #define UCEN 0x01 /* Enable UARTx Clocks */
- #define UMOD_IRDA 0x02 /* Enable IrDA Mode */
- #define UMOD_MASK 0x02 /* Uart Mode Mask */
- #define TPOLC 0x04 /* IrDA TX Polarity Change */
- #define RPOLC 0x08 /* IrDA RX Polarity Change */
- #define FPE 0x10 /* Force Parity Error On Transmit */
- #define FFE 0x20 /* Force Framing Error On Transmit */
- #endif /* BFIN_UART_BF60X_STYLE */
- /* UART_IER Masks */
- #define ERBFI 0x01 /* Enable Receive Buffer Full Interrupt */
|