tty: serial: msm: Add DMA support and fix bit definitions
v2 cover tty: serial: msm: Add DMA support and fix bit definitions
Hi,
This is second version of patches which DMA support for UARTDM type of hardware found in Qualcomm chip sets.
Changes since v0 (https://lkml.org/lkml/2015/9/12/108):
* Fixed SysRq issue reported by Srini.
* Dropped [PATCH 3/7], which did not make any functional change.
Ivan T. Ivanov (4):
tty: serial: msm: Add msm prefix to all driver functions
tty: serial: msm: Add TX DMA support
tty: serial: msm: Add RX DMA support
tty: serial: msm: Remove 115.2 Kbps maximum baud rate limitation
Pramod Gurav (2):
tty: serial: msm: Add mask value for UART_DM registers
tty: serial: msm: replaces (1 << x) with BIT(x) macro
.../devicetree/bindings/serial/qcom,msm-uartdm.txt | 6 + drivers/tty/serial/msm_serial.c | 620 +++++++++++++++++++-- drivers/tty/serial/msm_serial.h | 53 +- 3 files changed, 606 insertions(+), 73 deletions(-)
--
1.9.1
PATCH v2 1/6 tty: serial: msm: Add mask value for UART_DM registers
From: Pramod Gurav <[email protected]>
The bit masks for RFR_LEVEL1 and STALE_TIMEOUT_MSB values in MR1 and IPR registers respectively are different for UART and UART_DM hardware cores. We have been using UART core mask values for these. Add the same for UART_DM core.
There is no bit setting as UART_IPR_RXSTALE_LAST for UART_DM core so do it only for UART core.
--- drivers/tty/serial/msm_serial.c | 26 ++++++++++++++++++++------ drivers/tty/serial/msm_serial.h | 2 ++ 2 files changed, 22 insertions(+), 6 deletions(-)
drivers/tty/serial/msm_serial.c +20 -6
@@ -421,7 +421,7 @@ msm_find_best_baud(struct uart_port *port, unsigned int baud)static int msm_set_baud_rate (struct uart_port *port,unsigned int baud) { -unsigned int rxstale, watermark; +unsigned int rxstale, watermark, mask;struct msm_port *msm_port =UART_TO_MSM (port);const struct msm_baud_map *entry;
@@ -432,8 +432,15 @@ static int msm_set_baud_rate(struct uart_port *port, unsigned int baud)/* RX stale watermark */ rxstale = entry->rxstale; watermark =UART_IPR_STALE_LSB & rxstale; - watermark |=UART_IPR_RXSTALE_LAST ; - watermark |=UART_IPR_STALE_TIMEOUT_MSB & (rxstale <<2 ); +if (msm_port->is_uartdm) { + mask =UART_DM_IPR_STALE_TIMEOUT_MSB ; + }else { + watermark |=UART_IPR_RXSTALE_LAST ; + mask =UART_IPR_STALE_TIMEOUT_MSB ; + } + + watermark |= mask & (rxstale <<2 ); +msm_write (port, watermark,UART_IPR );/* set RX watermark */
@@ -476,7 +483,7 @@ static void msm_init_clock(struct uart_port *port)static int msm_startup (struct uart_port *port) {struct msm_port *msm_port =UART_TO_MSM (port); -unsigned int data, rfr_level; +unsigned int data, rfr_level, mask;int ret; snprintf(msm_port->name, sizeof(msm_port->name),
@@ -496,11 +503,18 @@ static int msm_startup(struct uart_port *port)/* set automatic RFR level */ data =msm_read (port,UART_MR1 ); - data &= ~UART_MR1_AUTO_RFR_LEVEL1 ; + +if (msm_port->is_uartdm) + mask =UART_DM_MR1_AUTO_RFR_LEVEL1 ; +else + mask =UART_MR1_AUTO_RFR_LEVEL1 ; + + data &= ~mask; data &= ~UART_MR1_AUTO_RFR_LEVEL0 ; - data |=UART_MR1_AUTO_RFR_LEVEL1 & (rfr_level <<2 ); + data |= mask & (rfr_level <<2 ); data |=UART_MR1_AUTO_RFR_LEVEL0 & rfr_level;msm_write (port, data,UART_MR1 ); +return 0 ; }
drivers/tty/serial/msm_serial.h +2 -0
@@ -20,6 +20,7 @@#define UART_MR1_AUTO_RFR_LEVEL0 0x3F#define UART_MR1_AUTO_RFR_LEVEL1 0x3FF00 +#define UART_DM_MR1_AUTO_RFR_LEVEL1 0xFFFFFF00#define UART_MR1_RX_RDY_CTL (1 << 7)#define UART_MR1_CTS_CTL (1 << 6)
@@ -78,6 +79,7 @@#define UART_IPR_RXSTALE_LAST 0x20#define UART_IPR_STALE_LSB 0x1F#define UART_IPR_STALE_TIMEOUT_MSB 0x3FF80 +#define UART_DM_IPR_STALE_TIMEOUT_MSB 0xFFFFFF80#define UART_IPR 0x0018#define UART_TFWR 0x001C
--
1.9.1
PATCH v2 2/6 tty: serial: msm: replaces (1 << x) with BIT(x) macro
In reply to Ivan T. IvanovFrom: Pramod Gurav <[email protected]>
Replaces (1 << x) with BIT(x) macro
--- drivers/tty/serial/msm_serial.h | 44 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-)
drivers/tty/serial/msm_serial.h +22 -22
@@ -21,11 +21,11 @@#define UART_MR1_AUTO_RFR_LEVEL0 0x3F#define UART_MR1_AUTO_RFR_LEVEL1 0x3FF00#define UART_DM_MR1_AUTO_RFR_LEVEL1 0xFFFFFF00 -#define UART_MR1_RX_RDY_CTL (1 << 7) -#define UART_MR1_CTS_CTL (1 << 6) +#define UART_MR1_RX_RDY_CTL BIT(7) +#define UART_MR1_CTS_CTL BIT(6)#define UART_MR2 0x0004 -#define UART_MR2_ERROR_MODE (1 << 6) +#define UART_MR2_ERROR_MODE BIT(6)#define UART_MR2_BITS_PER_CHAR 0x30#define UART_MR2_BITS_PER_CHAR_5 (0x0 << 4)#define UART_MR2_BITS_PER_CHAR_6 (0x1 << 4)
@@ -62,19 +62,19 @@#define UART_CR_CMD_STALE_EVENT_ENABLE (80 << 4)#define UART_CR_CMD_FORCE_STALE (4 << 8)#define UART_CR_CMD_RESET_TX_READY (3 << 8) -#define UART_CR_TX_DISABLE (1 << 3) -#define UART_CR_TX_ENABLE (1 << 2) -#define UART_CR_RX_DISABLE (1 << 1) -#define UART_CR_RX_ENABLE (1 << 0) +#define UART_CR_TX_DISABLE BIT(3) +#define UART_CR_TX_ENABLE BIT(2) +#define UART_CR_RX_DISABLE BIT(1) +#define UART_CR_RX_ENABLE BIT(0)#define UART_CR_CMD_RESET_RXBREAK_START ((1 << 11) | (2 << 4))#define UART_IMR 0x0014 -#define UART_IMR_TXLEV (1 << 0) -#define UART_IMR_RXSTALE (1 << 3) -#define UART_IMR_RXLEV (1 << 4) -#define UART_IMR_DELTA_CTS (1 << 5) -#define UART_IMR_CURRENT_CTS (1 << 6) -#define UART_IMR_RXBREAK_START (1 << 10) +#define UART_IMR_TXLEV BIT(0) +#define UART_IMR_RXSTALE BIT(3) +#define UART_IMR_RXLEV BIT(4) +#define UART_IMR_DELTA_CTS BIT(5) +#define UART_IMR_CURRENT_CTS BIT(6) +#define UART_IMR_RXBREAK_START BIT(10)#define UART_IPR_RXSTALE_LAST 0x20#define UART_IPR_STALE_LSB 0x1F
@@ -98,20 +98,20 @@#define UART_TEST_CTRL 0x0050#define UART_SR 0x0008 -#define UART_SR_HUNT_CHAR (1 << 7) -#define UART_SR_RX_BREAK (1 << 6) -#define UART_SR_PAR_FRAME_ERR (1 << 5) -#define UART_SR_OVERRUN (1 << 4) -#define UART_SR_TX_EMPTY (1 << 3) -#define UART_SR_TX_READY (1 << 2) -#define UART_SR_RX_FULL (1 << 1) -#define UART_SR_RX_READY (1 << 0) +#define UART_SR_HUNT_CHAR BIT(7) +#define UART_SR_RX_BREAK BIT(6) +#define UART_SR_PAR_FRAME_ERR BIT(5) +#define UART_SR_OVERRUN BIT(4) +#define UART_SR_TX_EMPTY BIT(3) +#define UART_SR_TX_READY BIT(2) +#define UART_SR_RX_FULL BIT(1) +#define UART_SR_RX_READY BIT(0)#define UART_RF 0x000C#define UARTDM_RF 0x0070#define UART_MISR 0x0010#define UART_ISR 0x0014 -#define UART_ISR_TX_READY (1 << 7) +#define UART_ISR_TX_READY BIT(7)#define UARTDM_RXFS 0x50#define UARTDM_RXFS_BUF_SHIFT 0x7
--
1.9.1
PATCH v2 3/6 tty: serial: msm: Add msm prefix to all driver functions
In reply to Ivan T. IvanovMake function naming consistent across this driver. Also rename msm_irq to msm_uart_irq. No functional changes.
--- drivers/tty/serial/msm_serial.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/tty/serial/msm_serial.c +20 -20
@@ -57,7 +57,7 @@ struct msm_port {bool break_detected; }; -static inline void wait_for_xmitr (struct uart_port *port) +static inline void msm_wait_for_xmitr (struct uart_port *port) {while (!(msm_read (port,UART_SR ) &UART_SR_TX_EMPTY )) {if (msm_read (port,UART_ISR ) &UART_ISR_TX_READY )
@@ -99,7 +99,7 @@ static void msm_enable_ms(struct uart_port *port)msm_write (port, msm_port->imr,UART_IMR ); } -static void handle_rx_dm (struct uart_port *port,unsigned int misr) +static void msm_handle_rx_dm (struct uart_port *port,unsigned int misr) {struct tty_port *tport = &port->state->port;unsigned int sr;
@@ -171,7 +171,7 @@ static void handle_rx_dm(struct uart_port *port, unsigned int misr)msm_write (port,UART_CR_CMD_STALE_EVENT_ENABLE ,UART_CR ); } -static void handle_rx (struct uart_port *port) +static void msm_handle_rx (struct uart_port *port) {struct tty_port *tport = &port->state->port;unsigned int sr;
@@ -224,14 +224,14 @@ static void handle_rx(struct uart_port *port)spin_lock (&port->lock); } -static void reset_dm_count (struct uart_port *port,int count) +static void msm_reset_dm_count (struct uart_port *port,int count) { -wait_for_xmitr (port); +msm_wait_for_xmitr (port);msm_write (port, count,UARTDM_NCF_TX );msm_read (port,UARTDM_NCF_TX ); } -static void handle_tx (struct uart_port *port) +static void msm_handle_tx (struct uart_port *port) {struct circ_buf *xmit = &port->state->xmit;struct msm_port *msm_port =UART_TO_MSM (port);
@@ -250,13 +250,13 @@ static void handle_tx(struct uart_port *port)if (port->x_char) {if (msm_port->is_uartdm) -reset_dm_count (port, tx_count +1 ); +msm_reset_dm_count (port, tx_count +1 );iowrite8_rep (tf, &port->x_char,1 ); port->icount.tx++; port->x_char =0 ; }else if (tx_count && msm_port->is_uartdm) { -reset_dm_count (port, tx_count); +msm_reset_dm_count (port, tx_count); }while (tf_pointer < tx_count) {
@@ -290,14 +290,14 @@ static void handle_tx(struct uart_port *port)uart_write_wakeup (port); } -static void handle_delta_cts (struct uart_port *port) +static void msm_handle_delta_cts (struct uart_port *port) {msm_write (port,UART_CR_CMD_RESET_CTS ,UART_CR ); port->icount.cts++;wake_up_interruptible (&port->state->port.delta_msr_wait); } -static irqreturn_t msm_irq (int irq,void *dev_id) +static irqreturn_t msm_uart_irq (int irq,void *dev_id) {struct uart_port *port = dev_id;struct msm_port *msm_port =UART_TO_MSM (port);
@@ -314,14 +314,14 @@ static irqreturn_t msm_irq(int irq, void *dev_id)if (misr & (UART_IMR_RXLEV |UART_IMR_RXSTALE )) {if (msm_port->is_uartdm) -handle_rx_dm (port, misr); +msm_handle_rx_dm (port, misr);else -handle_rx (port); +msm_handle_rx (port); }if (misr &UART_IMR_TXLEV ) -handle_tx (port); +msm_handle_tx (port);if (misr &UART_IMR_DELTA_CTS ) -handle_delta_cts (port); +msm_handle_delta_cts (port);msm_write (port, msm_port->imr,UART_IMR );/* restore interrupt */ spin_unlock (&port->lock);
@@ -779,7 +779,7 @@ static void msm_poll_put_char(struct uart_port *port, unsigned char c)msm_write (port,0 ,UART_IMR );if (msm_port->is_uartdm) -reset_dm_count (port,1 ); +msm_reset_dm_count (port,1 );/* Wait until FIFO is empty */ while (!(msm_read (port,UART_SR ) &UART_SR_TX_READY ))
@@ -853,7 +853,7 @@ static struct msm_port msm_uart_ports[] = {#define UART_NR ARRAY_SIZE(msm_uart_ports) -static inline struct uart_port *get_port_from_line (unsigned int line) +static inline struct uart_port *msm_get_port_from_line (unsigned int line) {return &msm_uart_ports[line].uart; }
@@ -880,7 +880,7 @@ static void __msm_console_write(struct uart_port *port, const char *s,spin_lock (&port->lock);if (is_uartdm) -reset_dm_count (port, count); +msm_reset_dm_count (port, count); i =0 ;while (i < count) {
@@ -925,7 +925,7 @@ static void msm_console_write(struct console *co, const char *s,BUG_ON (co->index <0 || co->index >=UART_NR ); - port =get_port_from_line (co->index); + port =msm_get_port_from_line (co->index); msm_port =UART_TO_MSM (port);__msm_console_write (port, s, count, msm_port->is_uartdm);
@@ -942,7 +942,7 @@ static int __init msm_console_setup(struct console *co, char *options)if (unlikely (co->index >=UART_NR || co->index <0 ))return -ENXIO ; - port =get_port_from_line (co->index); + port =msm_get_port_from_line (co->index);if (unlikely (!port->membase))return -ENXIO ;
@@ -1057,7 +1057,7 @@ static int msm_serial_probe(struct platform_device *pdev)dev_info (&pdev->dev,"msm_serial: detected port #%d\n" , line); - port =get_port_from_line (line); + port =msm_get_port_from_line (line); port->dev = &pdev->dev; msm_port =UART_TO_MSM (port);
--
1.9.1
PATCH v2 4/6 tty: serial: msm: Add TX DMA support
In reply to Ivan T. IvanovAdd transmit DMA support for UARTDM type of controllers.
Tested on APQ8064, which have UARTDM v1.3 and ADM DMA engine and APQ8016, which have UARTDM v1.4 and BAM DMA engine.
--- .../devicetree/bindings/serial/qcom,msm-uartdm.txt | 3 + drivers/tty/serial/msm_serial.c | 312 +++++++++++++++++++-- drivers/tty/serial/msm_serial.h | 3 + 3 files changed, 294 insertions(+), 24 deletions(-)
Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt +3 -0
@@ -26,6 +26,9 @@ Required properties: Optional properties: - dmas: Should contain dma specifiers for transmit and receive channels - dma-names: Should contain "tx" for transmit and "rx" for receive channels +- qcom,tx-crci: Identificator <u32> for Client Rate Control Interface to be + used with TX DMA channel. Required when using DMA for transmission + with UARTDM v1.3 and bellow. Note: Aliases may be defined to ensure the correct ordering of the UARTs. The alias serialN will result in the UART being assigned port N. If any
drivers/tty/serial/msm_serial.c +288 -24
397 lines not on this page · raw message
drivers/tty/serial/msm_serial.h +3 -0
@@ -121,6 +121,9 @@#define UARTDM_DMEN_RX_SC_ENABLE BIT(5)#define UARTDM_DMEN_TX_SC_ENABLE BIT(4) +#define UARTDM_DMEN_TX_BAM_ENABLE BIT(2)/* UARTDM_1P4 */ +#define UARTDM_DMEN_TX_DM_ENABLE BIT(0)/* < UARTDM_1P4 */ +#define UARTDM_DMRX 0x34#define UARTDM_NCF_TX 0x40#define UARTDM_RX_TOTAL_SNAP 0x38
--
1.9.1
PATCH v2 5/6 tty: serial: msm: Add RX DMA support
In reply to Ivan T. IvanovAdd receive DMA support for UARTDM type of controllers.
Tested on APQ8064, which have UARTDM v1.3 and ADM DMA engine and APQ8016, which have UARTDM v1.4 and BAM DMA engine.
--- .../devicetree/bindings/serial/qcom,msm-uartdm.txt | 3 + drivers/tty/serial/msm_serial.c | 232 ++++++++++++++++++++- drivers/tty/serial/msm_serial.h | 4 + 3 files changed, 236 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt +3 -0
@@ -29,6 +29,9 @@ Optional properties: - qcom,tx-crci: Identificator <u32> for Client Rate Control Interface to be used with TX DMA channel. Required when using DMA for transmission with UARTDM v1.3 and bellow. +- qcom,rx-crci: Identificator <u32> for Client Rate Control Interface to be + used with RX DMA channel. Required when using DMA for reception + with UARTDM v1.3 and bellow. Note: Aliases may be defined to ensure the correct ordering of the UARTs. The alias serialN will result in the UART being assigned port N. If any
drivers/tty/serial/msm_serial.c +229 -3
323 lines not on this page · raw message
drivers/tty/serial/msm_serial.h +4 -0
@@ -59,6 +59,7 @@#define UART_CR_CMD_SET_RFR (13 << 4)#define UART_CR_CMD_RESET_RFR (14 << 4)#define UART_CR_CMD_PROTECTION_EN (16 << 4) +#define UART_CR_CMD_STALE_EVENT_DISABLE (6 << 8)#define UART_CR_CMD_STALE_EVENT_ENABLE (80 << 4)#define UART_CR_CMD_FORCE_STALE (4 << 8)#define UART_CR_CMD_RESET_TX_READY (3 << 8)
@@ -124,6 +125,9 @@#define UARTDM_DMEN_TX_BAM_ENABLE BIT(2)/* UARTDM_1P4 */ #define UARTDM_DMEN_TX_DM_ENABLE BIT(0)/* < UARTDM_1P4 */ +#define UARTDM_DMEN_RX_BAM_ENABLE BIT(3)/* UARTDM_1P4 */ +#define UARTDM_DMEN_RX_DM_ENABLE BIT(1)/* < UARTDM_1P4 */ +#define UARTDM_DMRX 0x34#define UARTDM_NCF_TX 0x40#define UARTDM_RX_TOTAL_SNAP 0x38
--
1.9.1
PATCH v2 6/6 tty: serial: msm: Remove 115.2 Kbps maximum baud rate limitation
In reply to Ivan T. IvanovUART controller is capable to perform transfers up to 4 Mbps. Remove artificial 115.2 Kbps limitation.
--- drivers/tty/serial/msm_serial.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/tty/serial/msm_serial.c +17 -3
@@ -882,6 +882,7 @@ msm_find_best_baud(struct uart_port *port, unsigned int baud) { 3, 0xdd, 8 }, { 2, 0xee, 16 }, { 1, 0xff, 31 }, + { 0, 0xff, 31 }, }; divisor =uart_get_divisor (port, baud);
@@ -893,16 +894,29 @@ msm_find_best_baud(struct uart_port *port, unsigned int baud)return entry;/* Default to smallest divider */ } -static int msm_set_baud_rate (struct uart_port *port,unsigned int baud) +static int msm_set_baud_rate (struct uart_port *port,unsigned int baud, +unsigned long *saved_flags) {unsigned int rxstale, watermark, mask;struct msm_port *msm_port =UART_TO_MSM (port);const struct msm_baud_map *entry; +unsigned long flags; entry =msm_find_best_baud (port, baud);msm_write (port, entry->code,UART_CSR ); +if (baud >460800 ) + port->uartclk = baud *16 ; + + flags = *saved_flags; +spin_unlock_irqrestore (&port->lock, flags); + +clk_set_rate (msm_port->clk, port->uartclk); + +spin_lock_irqsave (&port->lock, flags); + *saved_flags = flags; +/* RX stale watermark */ rxstale = entry->rxstale; watermark =UART_IPR_STALE_LSB & rxstale;
@@ -1026,8 +1040,8 @@ static void msm_set_termios(struct uart_port *port, struct ktermios *termios,msm_stop_dma (port, dma);/* calculate and set baud rate */ - baud =uart_get_baud_rate (port, termios, old,300 ,115200 ); - baud =msm_set_baud_rate (port, baud); + baud =uart_get_baud_rate (port, termios, old,300 ,4000000 ); + baud =msm_set_baud_rate (port, baud, &flags);if (tty_termios_baud_rate (termios))tty_termios_encode_baud_rate (termios, baud, baud);
--
1.9.1
Quoted 5 lines · Ivan T. Ivanov
Hi,
This is second version of patches which DMA support for UARTDM type of hardware found in Qualcomm chip sets.
Please ignore this patch set. Wrong set of changes.
Sorry,
Ivan
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 4/6] tty: serial: msm: Add TX DMA support
In reply to Ivan T. IvanovQuoted 17 lines · Ivan T. Ivanov
Add transmit DMA support for UARTDM type of controllers.
Tested on APQ8064, which have UARTDM v1.3 and ADM DMA engine and APQ8016, which have UARTDM v1.4 and BAM DMA engine.
Signed-off-by Ivan T. Ivanov <[email protected]>--- .../devicetree/bindings/serial/qcom,msm-uartdm.txt | 3 + drivers/tty/serial/msm_serial.c | 312 +++++++++++++++++++-- drivers/tty/serial/msm_serial.h | 3 + 3 files changed, 294 insertions(+), 24 deletions(-)Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt +0
-0
Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt Required properties: · line 31
Quoted 6 lines
Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt +3
-0@@ -26,6 +26,9 @@ Required properties: Optional properties: - dmas: Should contain dma specifiers for transmit and receive channels - dma-names: Should contain "tx" for transmit and "rx" for receive channels +- qcom,tx-crci: Identificator <u32> for Client Rate Control Interface to be + used with TX DMA channel. Required when using DMA for transmission + with UARTDM v1.3 and bellow.
This sounds like it belongs in the dma-specifier, and dealt with by the DMA controller driver.
Why does the UART driver need to know about this?
Mark.
Re: [PATCH v2 5/6] tty: serial: msm: Add RX DMA support
In reply to Ivan T. IvanovQuoted 17 lines · Ivan T. Ivanov
Add receive DMA support for UARTDM type of controllers.
Tested on APQ8064, which have UARTDM v1.3 and ADM DMA engine and APQ8016, which have UARTDM v1.4 and BAM DMA engine.
Signed-off-by Ivan T. Ivanov <[email protected]>--- .../devicetree/bindings/serial/qcom,msm-uartdm.txt | 3 + drivers/tty/serial/msm_serial.c | 232 ++++++++++++++++++++- drivers/tty/serial/msm_serial.h | 4 + 3 files changed, 236 insertions(+), 3 deletions(-)Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt +0
-0
Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt Optional properties: · line 34
Quoted 6 lines
Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt +3
-0@@ -29,6 +29,9 @@ Optional properties: - qcom,tx-crci: Identificator <u32> for Client Rate Control Interface to be used with TX DMA channel. Required when using DMA for transmission with UARTDM v1.3 and bellow. +- qcom,rx-crci: Identificator <u32> for Client Rate Control Interface to be + used with RX DMA channel. Required when using DMA for reception + with UARTDM v1.3 and bellow.
My comments on qcom,tx-crci apply to qcom,rx-crci too.
This does not deel like it belongs in the UART binding and/or driver.
Mark.
Re: [PATCH v2 4/6] tty: serial: msm: Add TX DMA support
In reply to Mark RutlandQuoted 28 lines · Mark Rutland
Quoted 17 lines · Ivan T. Ivanov
Add transmit DMA support for UARTDM type of controllers.
Tested on APQ8064, which have UARTDM v1.3 and ADM DMA engine and APQ8016, which have UARTDM v1.4 and BAM DMA engine.
Signed-off-by Ivan T. Ivanov [email protected]>--- .../devicetree/bindings/serial/qcom,msm-uartdm.txt | 3 + drivers/tty/serial/msm_serial.c | 312 +++++++++++++++++++-- drivers/tty/serial/msm_serial.h | 3 + 3 files changed, 294 insertions(+), 24 deletions(-)Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt +0
-0Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt Required properties: · line 31
Quoted 6 lines
Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt +3
-0@@ -26,6 +26,9 @@ Required properties: Optional properties: - dmas: Should contain dma specifiers for transmit and receive channels - dma-names: Should contain "tx" for transmit and "rx" for receive channels +- qcom,tx-crci: Identificator <u32> for Client Rate Control Interface to be + used with TX DMA channel. Required when using DMA for transmission + with UARTDM v1.3 and bellow.This sounds like it belongs in the dma-specifier, and dealt with by the DMA controller driver.
Quoted 1 line
Why does the UART driver need to know about this?
CRCI information was part of the first version of ADM DMA engine driver bindings, but Andy remove it because some client devices are requiring more that one CRCI number. See here[1] and here [2].
Regards,
Ivan
[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2015-January/314190.html
[2] https://lkml.org/lkml/2015/8/19/19
Re: [PATCH v2 4/6] tty: serial: msm: Add TX DMA support
Quoted 36 lines · Ivan T. Ivanov
Quoted 28 lines · Mark Rutland
Quoted 17 lines · Ivan T. Ivanov
Add transmit DMA support for UARTDM type of controllers.
Tested on APQ8064, which have UARTDM v1.3 and ADM DMA engine and APQ8016, which have UARTDM v1.4 and BAM DMA engine.
Signed-off-by Ivan T. Ivanov [email protected]>--- .../devicetree/bindings/serial/qcom,msm-uartdm.txt | 3 + drivers/tty/serial/msm_serial.c | 312 +++++++++++++++++++-- drivers/tty/serial/msm_serial.h | 3 + 3 files changed, 294 insertions(+), 24 deletions(-)Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt +0
-0Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt Required properties: · line 31
Quoted 6 lines
Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt +3
-0@@ -26,6 +26,9 @@ Required properties: Optional properties: - dmas: Should contain dma specifiers for transmit and receive channels - dma-names: Should contain "tx" for transmit and "rx" for receive channels +- qcom,tx-crci: Identificator <u32> for Client Rate Control Interface to be + used with TX DMA channel. Required when using DMA for transmission + with UARTDM v1.3 and bellow.This sounds like it belongs in the dma-specifier, and dealt with by the DMA controller driver.
Quoted 1 line
Why does the UART driver need to know about this?
CRCI information was part of the first version of ADM DMA engine driver bindings, but Andy remove it because some client devices are requiring more that one CRCI number. See here[1] and here [2].
Quoted 5 lines
Regards,
Ivan[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2015-January/314190.html
[2] https://lkml.org/lkml/2015/8/19/19
This leaves me more confused. If different writes from the same agent are being distinguished then it sounds like you actually have two logical DMA channels.
Could you elaborate on the qcom,ebi2-nand binding? From a brief read I'd expect you to have "txrx" and "cmd" dmas, rather than describing the CRCI information on the side.
Mark.
Re: [PATCH v2 4/6] tty: serial: msm: Add TX DMA support
Quoted 43 lines · Mark Rutland
Quoted 36 lines · Ivan T. Ivanov
Quoted 28 lines · Mark Rutland
Quoted 17 lines · Ivan T. Ivanov
Add transmit DMA support for UARTDM type of controllers.
Tested on APQ8064, which have UARTDM v1.3 and ADM DMA engine and APQ8016, which have UARTDM v1.4 and BAM DMA engine.
Signed-off-by Ivan T. Ivanov [email protected]>--- .../devicetree/bindings/serial/qcom,msm-uartdm.txt | 3 + drivers/tty/serial/msm_serial.c | 312 +++++++++++++++++++-- drivers/tty/serial/msm_serial.h | 3 + 3 files changed, 294 insertions(+), 24 deletions(-)Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt +0
-0Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt Required properties: · line 31
Quoted 6 lines
Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt +3
-0@@ -26,6 +26,9 @@ Required properties: Optional properties: - dmas: Should contain dma specifiers for transmit and receive channels - dma-names: Should contain "tx" for transmit and "rx" for receive channels +- qcom,tx-crci: Identificator <u32> for Client Rate Control Interface to be + used with TX DMA channel. Required when using DMA for transmission + with UARTDM v1.3 and bellow.This sounds like it belongs in the dma-specifier, and dealt with by the DMA controller driver.
Quoted 1 line
Why does the UART driver need to know about this?
CRCI information was part of the first version of ADM DMA engine driver bindings, but Andy remove it because some client devices are requiring more that one CRCI number. See here[1] and here [2].
Quoted 5 lines
Regards,
Ivan[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2015-January/314190.html
[2] https://lkml.org/lkml/2015/8/19/19
Quoted 7 lines
This leaves me more confused. If different writes from the same agent are being distinguished then it sounds like you actually have two logical DMA channels.
Could you elaborate on the qcom,ebi2-nand binding? From a brief read I'd expect you to have "txrx" and "cmd" dmas, rather than describing the CRCI information on the side.
The ADM does have physical channels, but when you utilize those channels you may also need to describe the flow control used for specific transactions. And this flow control has to be configured for that specific transaction, if you are interleaving different flow control origination/end points.
In the case of nand, they actually use different flow controls on the same physical channel. For UART/I2C/SPI, they use just one flow control identifier.
I see your point at specifying these as logical channels. That is certainly a possibility. Then the ADM driver would just have to handle the logical channel allocation. That would remove the need for the slave_config being sent.
Signature · 3 lines
Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project