@@ -1055,6 +1055,66 @@ static void rx_fifo_timer_fn(unsigned long arg)
1055
1055
scif_set_rtrg (port , 1 );
1056
1056
}
1057
1057
1058
+ static ssize_t rx_trigger_show (struct device * dev ,
1059
+ struct device_attribute * attr ,
1060
+ char * buf )
1061
+ {
1062
+ struct uart_port * port = dev_get_drvdata (dev );
1063
+ struct sci_port * sci = to_sci_port (port );
1064
+
1065
+ return sprintf (buf , "%d\n" , sci -> rx_trigger );
1066
+ }
1067
+
1068
+ static ssize_t rx_trigger_store (struct device * dev ,
1069
+ struct device_attribute * attr ,
1070
+ const char * buf ,
1071
+ size_t count )
1072
+ {
1073
+ struct uart_port * port = dev_get_drvdata (dev );
1074
+ struct sci_port * sci = to_sci_port (port );
1075
+ long r ;
1076
+
1077
+ if (kstrtol (buf , 0 , & r ) == - EINVAL )
1078
+ return - EINVAL ;
1079
+ sci -> rx_trigger = scif_set_rtrg (port , r );
1080
+ scif_set_rtrg (port , 1 );
1081
+ return count ;
1082
+ }
1083
+
1084
+ static DEVICE_ATTR (rx_fifo_trigger , 0644 , rx_trigger_show , rx_trigger_store ) ;
1085
+
1086
+ static ssize_t rx_fifo_timeout_show (struct device * dev ,
1087
+ struct device_attribute * attr ,
1088
+ char * buf )
1089
+ {
1090
+ struct uart_port * port = dev_get_drvdata (dev );
1091
+ struct sci_port * sci = to_sci_port (port );
1092
+
1093
+ return sprintf (buf , "%d\n" , sci -> rx_fifo_timeout );
1094
+ }
1095
+
1096
+ static ssize_t rx_fifo_timeout_store (struct device * dev ,
1097
+ struct device_attribute * attr ,
1098
+ const char * buf ,
1099
+ size_t count )
1100
+ {
1101
+ struct uart_port * port = dev_get_drvdata (dev );
1102
+ struct sci_port * sci = to_sci_port (port );
1103
+ long r ;
1104
+
1105
+ if (kstrtol (buf , 0 , & r ) == - EINVAL )
1106
+ return - EINVAL ;
1107
+ sci -> rx_fifo_timeout = r ;
1108
+ scif_set_rtrg (port , 1 );
1109
+ if (r > 0 )
1110
+ setup_timer (& sci -> rx_fifo_timer , rx_fifo_timer_fn ,
1111
+ (unsigned long )sci );
1112
+ return count ;
1113
+ }
1114
+
1115
+ static DEVICE_ATTR (rx_fifo_timeout , 0644 , rx_fifo_timeout_show , rx_fifo_timeout_store ) ;
1116
+
1117
+
1058
1118
#ifdef CONFIG_SERIAL_SH_SCI_DMA
1059
1119
static void sci_dma_tx_complete (void * arg )
1060
1120
{
@@ -2886,6 +2946,15 @@ static int sci_remove(struct platform_device *dev)
2886
2946
2887
2947
sci_cleanup_single (port );
2888
2948
2949
+ if (port -> port .fifosize > 1 ) {
2950
+ sysfs_remove_file (& dev -> dev .kobj ,
2951
+ & dev_attr_rx_fifo_trigger .attr );
2952
+ }
2953
+ if (port -> port .type == PORT_SCIFA || port -> port .type == PORT_SCIFB ) {
2954
+ sysfs_remove_file (& dev -> dev .kobj ,
2955
+ & dev_attr_rx_fifo_timeout .attr );
2956
+ }
2957
+
2889
2958
return 0 ;
2890
2959
}
2891
2960
@@ -3051,6 +3120,24 @@ static int sci_probe(struct platform_device *dev)
3051
3120
if (ret )
3052
3121
return ret ;
3053
3122
3123
+ if (sp -> port .fifosize > 1 ) {
3124
+ ret = sysfs_create_file (& dev -> dev .kobj ,
3125
+ & dev_attr_rx_fifo_trigger .attr );
3126
+ if (ret )
3127
+ return ret ;
3128
+ }
3129
+ if (sp -> port .type == PORT_SCIFA || sp -> port .type == PORT_SCIFB ) {
3130
+ ret = sysfs_create_file (& dev -> dev .kobj ,
3131
+ & dev_attr_rx_fifo_timeout .attr );
3132
+ if (ret ) {
3133
+ if (sp -> port .fifosize > 1 ) {
3134
+ sysfs_remove_file (& dev -> dev .kobj ,
3135
+ & dev_attr_rx_fifo_trigger .attr );
3136
+ }
3137
+ return ret ;
3138
+ }
3139
+ }
3140
+
3054
3141
#ifdef CONFIG_SH_STANDARD_BIOS
3055
3142
sh_bios_gdb_detach ();
3056
3143
#endif
0 commit comments