File tree Expand file tree Collapse file tree 1 file changed +59
-0
lines changed Expand file tree Collapse file tree 1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change @@ -974,6 +974,65 @@ static int sci_handle_breaks(struct uart_port *port)
974
974
return copied ;
975
975
}
976
976
977
+ static int scif_set_rtrg (struct uart_port * port , int rx_trig )
978
+ {
979
+ unsigned int bits ;
980
+
981
+ if (rx_trig < 1 )
982
+ rx_trig = 1 ;
983
+ if (rx_trig >= port -> fifosize )
984
+ rx_trig = port -> fifosize ;
985
+
986
+ /* HSCIF can be set to an arbitrary level. */
987
+ if (sci_getreg (port , HSRTRGR )-> size ) {
988
+ serial_port_out (port , HSRTRGR , rx_trig );
989
+ return rx_trig ;
990
+ }
991
+
992
+ switch (port -> type ) {
993
+ case PORT_SCIF :
994
+ if (rx_trig < 4 ) {
995
+ bits = 0 ;
996
+ rx_trig = 1 ;
997
+ } else if (rx_trig < 8 ) {
998
+ bits = SCFCR_RTRG0 ;
999
+ rx_trig = 4 ;
1000
+ } else if (rx_trig < 14 ) {
1001
+ bits = SCFCR_RTRG1 ;
1002
+ rx_trig = 8 ;
1003
+ } else {
1004
+ bits = SCFCR_RTRG0 | SCFCR_RTRG1 ;
1005
+ rx_trig = 14 ;
1006
+ }
1007
+ break ;
1008
+ case PORT_SCIFA :
1009
+ case PORT_SCIFB :
1010
+ if (rx_trig < 16 ) {
1011
+ bits = 0 ;
1012
+ rx_trig = 1 ;
1013
+ } else if (rx_trig < 32 ) {
1014
+ bits = SCFCR_RTRG0 ;
1015
+ rx_trig = 16 ;
1016
+ } else if (rx_trig < 48 ) {
1017
+ bits = SCFCR_RTRG1 ;
1018
+ rx_trig = 32 ;
1019
+ } else {
1020
+ bits = SCFCR_RTRG0 | SCFCR_RTRG1 ;
1021
+ rx_trig = 48 ;
1022
+ }
1023
+ break ;
1024
+ default :
1025
+ WARN (1 , "unknown FIFO configuration" );
1026
+ return 1 ;
1027
+ }
1028
+
1029
+ serial_port_out (port , SCFCR ,
1030
+ (serial_port_in (port , SCFCR ) &
1031
+ ~(SCFCR_RTRG1 | SCFCR_RTRG0 )) | bits );
1032
+
1033
+ return rx_trig ;
1034
+ }
1035
+
977
1036
#ifdef CONFIG_SERIAL_SH_SCI_DMA
978
1037
static void sci_dma_tx_complete (void * arg )
979
1038
{
You can’t perform that action at this time.
0 commit comments