forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/tty/serial/stm32-usart.h
....@@ -1,4 +1,4 @@
1
-// SPDX-License-Identifier: GPL-2.0
1
+/* SPDX-License-Identifier: GPL-2.0 */
22 /*
33 * Copyright (C) Maxime Coquelin 2015
44 * Copyright (C) STMicroelectronics SA 2017
....@@ -27,6 +27,7 @@
2727 bool has_7bits_data;
2828 bool has_wakeup;
2929 bool has_fifo;
30
+ int fifosize;
3031 };
3132
3233 struct stm32_usart_info {
....@@ -54,6 +55,7 @@
5455 .cfg = {
5556 .uart_enable_bit = 13,
5657 .has_7bits_data = false,
58
+ .fifosize = 1,
5759 }
5860 };
5961
....@@ -74,6 +76,7 @@
7476 .cfg = {
7577 .uart_enable_bit = 0,
7678 .has_7bits_data = true,
79
+ .fifosize = 1,
7780 }
7881 };
7982
....@@ -96,6 +99,7 @@
9699 .has_7bits_data = true,
97100 .has_wakeup = true,
98101 .has_fifo = true,
102
+ .fifosize = 16,
99103 }
100104 };
101105
....@@ -201,6 +205,19 @@
201205 #define USART_CR3_WUS_MASK GENMASK(21, 20) /* H7 */
202206 #define USART_CR3_WUS_START_BIT BIT(21) /* H7 */
203207 #define USART_CR3_WUFIE BIT(22) /* H7 */
208
+#define USART_CR3_TXFTIE BIT(23) /* H7 */
209
+#define USART_CR3_TCBGTIE BIT(24) /* H7 */
210
+#define USART_CR3_RXFTCFG_MASK GENMASK(27, 25) /* H7 */
211
+#define USART_CR3_RXFTCFG_SHIFT 25 /* H7 */
212
+#define USART_CR3_RXFTIE BIT(28) /* H7 */
213
+#define USART_CR3_TXFTCFG_MASK GENMASK(31, 29) /* H7 */
214
+#define USART_CR3_TXFTCFG_SHIFT 29 /* H7 */
215
+
216
+/* TX FIFO threashold set to half of its depth */
217
+#define USART_CR3_TXFTCFG_HALF 0x2
218
+
219
+/* RX FIFO threashold set to half of its depth */
220
+#define USART_CR3_RXFTCFG_HALF 0x2
204221
205222 /* USART_GTPR */
206223 #define USART_GTPR_PSC_MASK GENMASK(7, 0)
....@@ -239,19 +256,22 @@
239256 struct stm32_port {
240257 struct uart_port port;
241258 struct clk *clk;
242
- struct stm32_usart_info *info;
259
+ const struct stm32_usart_info *info;
243260 struct dma_chan *rx_ch; /* dma rx channel */
244261 dma_addr_t rx_dma_buf; /* dma rx buffer bus address */
245262 unsigned char *rx_buf; /* dma rx buffer cpu address */
246263 struct dma_chan *tx_ch; /* dma tx channel */
247264 dma_addr_t tx_dma_buf; /* dma tx buffer bus address */
248265 unsigned char *tx_buf; /* dma tx buffer cpu address */
266
+ u32 cr1_irq; /* USART_CR1_RXNEIE or RTOIE */
267
+ u32 cr3_irq; /* USART_CR3_RXFTIE */
249268 int last_res;
250269 bool tx_dma_busy; /* dma tx busy */
251270 bool hw_flow_control;
252271 bool fifoen;
253272 int wakeirq;
254273 int rdr_mask; /* receive data register mask */
274
+ struct mctrl_gpios *gpios; /* modem control gpios */
255275 };
256276
257277 static struct stm32_port stm32_ports[STM32_MAX_PORTS];