diff options
-rw-r--r-- | drivers/serial/amba-pl011.c | 12 | ||||
-rw-r--r-- | include/linux/amba/serial.h | 15 |
2 files changed, 27 insertions, 0 deletions
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index ab025dc52fa4..e76d7d000128 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c | |||
@@ -74,6 +74,7 @@ struct vendor_data { | |||
74 | unsigned int lcrh_tx; | 74 | unsigned int lcrh_tx; |
75 | unsigned int lcrh_rx; | 75 | unsigned int lcrh_rx; |
76 | bool oversampling; | 76 | bool oversampling; |
77 | bool dma_threshold; | ||
77 | }; | 78 | }; |
78 | 79 | ||
79 | static struct vendor_data vendor_arm = { | 80 | static struct vendor_data vendor_arm = { |
@@ -82,6 +83,7 @@ static struct vendor_data vendor_arm = { | |||
82 | .lcrh_tx = UART011_LCRH, | 83 | .lcrh_tx = UART011_LCRH, |
83 | .lcrh_rx = UART011_LCRH, | 84 | .lcrh_rx = UART011_LCRH, |
84 | .oversampling = false, | 85 | .oversampling = false, |
86 | .dma_threshold = false, | ||
85 | }; | 87 | }; |
86 | 88 | ||
87 | static struct vendor_data vendor_st = { | 89 | static struct vendor_data vendor_st = { |
@@ -90,6 +92,7 @@ static struct vendor_data vendor_st = { | |||
90 | .lcrh_tx = ST_UART011_LCRH_TX, | 92 | .lcrh_tx = ST_UART011_LCRH_TX, |
91 | .lcrh_rx = ST_UART011_LCRH_RX, | 93 | .lcrh_rx = ST_UART011_LCRH_RX, |
92 | .oversampling = true, | 94 | .oversampling = true, |
95 | .dma_threshold = true, | ||
93 | }; | 96 | }; |
94 | 97 | ||
95 | /* Deals with DMA transactions */ | 98 | /* Deals with DMA transactions */ |
@@ -527,6 +530,15 @@ static void pl011_dma_startup(struct uart_amba_port *uap) | |||
527 | /* Turn on DMA error (RX/TX will be enabled on demand) */ | 530 | /* Turn on DMA error (RX/TX will be enabled on demand) */ |
528 | uap->dmacr |= UART011_DMAONERR; | 531 | uap->dmacr |= UART011_DMAONERR; |
529 | writew(uap->dmacr, uap->port.membase + UART011_DMACR); | 532 | writew(uap->dmacr, uap->port.membase + UART011_DMACR); |
533 | |||
534 | /* | ||
535 | * ST Micro variants has some specific dma burst threshold | ||
536 | * compensation. Set this to 16 bytes, so burst will only | ||
537 | * be issued above/below 16 bytes. | ||
538 | */ | ||
539 | if (uap->vendor->dma_threshold) | ||
540 | writew(ST_UART011_DMAWM_RX_16 | ST_UART011_DMAWM_TX_16, | ||
541 | uap->port.membase + ST_UART011_DMAWM); | ||
530 | } | 542 | } |
531 | 543 | ||
532 | static void pl011_dma_shutdown(struct uart_amba_port *uap) | 544 | static void pl011_dma_shutdown(struct uart_amba_port *uap) |
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h index 577f22eb9225..5479fdc849e9 100644 --- a/include/linux/amba/serial.h +++ b/include/linux/amba/serial.h | |||
@@ -113,6 +113,21 @@ | |||
113 | #define UART01x_LCRH_PEN 0x02 | 113 | #define UART01x_LCRH_PEN 0x02 |
114 | #define UART01x_LCRH_BRK 0x01 | 114 | #define UART01x_LCRH_BRK 0x01 |
115 | 115 | ||
116 | #define ST_UART011_DMAWM_RX_1 (0 << 3) | ||
117 | #define ST_UART011_DMAWM_RX_2 (1 << 3) | ||
118 | #define ST_UART011_DMAWM_RX_4 (2 << 3) | ||
119 | #define ST_UART011_DMAWM_RX_8 (3 << 3) | ||
120 | #define ST_UART011_DMAWM_RX_16 (4 << 3) | ||
121 | #define ST_UART011_DMAWM_RX_32 (5 << 3) | ||
122 | #define ST_UART011_DMAWM_RX_48 (6 << 3) | ||
123 | #define ST_UART011_DMAWM_TX_1 0 | ||
124 | #define ST_UART011_DMAWM_TX_2 1 | ||
125 | #define ST_UART011_DMAWM_TX_4 2 | ||
126 | #define ST_UART011_DMAWM_TX_8 3 | ||
127 | #define ST_UART011_DMAWM_TX_16 4 | ||
128 | #define ST_UART011_DMAWM_TX_32 5 | ||
129 | #define ST_UART011_DMAWM_TX_48 6 | ||
130 | |||
116 | #define UART010_IIR_RTIS 0x08 | 131 | #define UART010_IIR_RTIS 0x08 |
117 | #define UART010_IIR_TIS 0x04 | 132 | #define UART010_IIR_TIS 0x04 |
118 | #define UART010_IIR_RIS 0x02 | 133 | #define UART010_IIR_RIS 0x02 |