|
@@ -356,3 +356,75 @@ UART_PUT_DLH(p, (v >> 8) & 0xFF); } while (0);
|
|
|
|
|
|
#define UART_CLEAR_DLAB(p) /* MMRs not muxed on BF54x */
|
|
|
#define UART_SET_DLAB(p) /* MMRs not muxed on BF54x */
|
|
|
+
|
|
|
+#define UART_CLEAR_LSR(p) bfin_write16(port_membase(p) + OFFSET_LSR, -1)
|
|
|
+#define UART_GET_LSR(p) bfin_read16(port_membase(p) + OFFSET_LSR)
|
|
|
+#define UART_PUT_LSR(p, v) bfin_write16(port_membase(p) + OFFSET_LSR, v)
|
|
|
+
|
|
|
+/* This handles hard CTS/RTS */
|
|
|
+#define BFIN_UART_CTSRTS_HARD
|
|
|
+#define UART_CLEAR_SCTS(p) bfin_write16((port_membase(p) + OFFSET_MSR), SCTS)
|
|
|
+#define UART_GET_CTS(x) (UART_GET_MSR(x) & CTS)
|
|
|
+#define UART_DISABLE_RTS(x) UART_PUT_MCR(x, UART_GET_MCR(x) & ~(ARTS | MRTS))
|
|
|
+#define UART_ENABLE_RTS(x) UART_PUT_MCR(x, UART_GET_MCR(x) | MRTS | ARTS)
|
|
|
+#define UART_ENABLE_INTS(x, v) UART_SET_IER(x, v)
|
|
|
+#define UART_DISABLE_INTS(x) UART_CLEAR_IER(x, 0xF)
|
|
|
+
|
|
|
+#else /* BF533 style */
|
|
|
+
|
|
|
+#define UART_CLEAR_IER(p, v) UART_PUT_IER(p, UART_GET_IER(p) & ~(v))
|
|
|
+#define UART_GET_IER(p) bfin_read16(port_membase(p) + OFFSET_IER)
|
|
|
+#define UART_PUT_IER(p, v) bfin_write16(port_membase(p) + OFFSET_IER, v)
|
|
|
+#define UART_SET_IER(p, v) UART_PUT_IER(p, UART_GET_IER(p) | (v))
|
|
|
+
|
|
|
+#define UART_CLEAR_DLAB(p) do { UART_PUT_LCR(p, UART_GET_LCR(p) & ~DLAB); SSYNC(); } while (0)
|
|
|
+#define UART_SET_DLAB(p) do { UART_PUT_LCR(p, UART_GET_LCR(p) | DLAB); SSYNC(); } while (0)
|
|
|
+
|
|
|
+#define get_lsr_cache(uart) (((struct bfin_serial_port *)(uart))->lsr)
|
|
|
+#define put_lsr_cache(uart, v) (((struct bfin_serial_port *)(uart))->lsr = (v))
|
|
|
+
|
|
|
+/*
|
|
|
+#ifndef put_lsr_cache
|
|
|
+# define put_lsr_cache(p, v)
|
|
|
+#endif
|
|
|
+#ifndef get_lsr_cache
|
|
|
+# define get_lsr_cache(p) 0
|
|
|
+#endif
|
|
|
+*/
|
|
|
+
|
|
|
+/* The hardware clears the LSR bits upon read, so we need to cache
|
|
|
+ * some of the more fun bits in software so they don't get lost
|
|
|
+ * when checking the LSR in other code paths (TX).
|
|
|
+ */
|
|
|
+static inline void UART_CLEAR_LSR(void *p)
|
|
|
+{
|
|
|
+ put_lsr_cache(p, 0);
|
|
|
+ bfin_write16(port_membase(p) + OFFSET_LSR, -1);
|
|
|
+}
|
|
|
+static inline unsigned int UART_GET_LSR(void *p)
|
|
|
+{
|
|
|
+ unsigned int lsr = bfin_read16(port_membase(p) + OFFSET_LSR);
|
|
|
+ put_lsr_cache(p, get_lsr_cache(p) | (lsr & (BI|FE|PE|OE)));
|
|
|
+ return lsr | get_lsr_cache(p);
|
|
|
+}
|
|
|
+static inline void UART_PUT_LSR(void *p, uint16_t val)
|
|
|
+{
|
|
|
+ put_lsr_cache(p, get_lsr_cache(p) & ~val);
|
|
|
+}
|
|
|
+
|
|
|
+/* This handles soft CTS/RTS */
|
|
|
+#define UART_GET_CTS(x) gpio_get_value((x)->cts_pin)
|
|
|
+#define UART_DISABLE_RTS(x) gpio_set_value((x)->rts_pin, 1)
|
|
|
+#define UART_ENABLE_RTS(x) gpio_set_value((x)->rts_pin, 0)
|
|
|
+#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v)
|
|
|
+#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0)
|
|
|
+
|
|
|
+#endif /* BFIN_UART_BF54X_STYLE */
|
|
|
+
|
|
|
+#endif /* BFIN_UART_BF60X_STYLE */
|
|
|
+
|
|
|
+#ifndef BFIN_UART_TX_FIFO_SIZE
|
|
|
+# define BFIN_UART_TX_FIFO_SIZE 2
|
|
|
+#endif
|
|
|
+
|
|
|
+#endif /* __BFIN_ASM_SERIAL_H__ */
|