@@ -1913,6 +1913,30 @@ static void scif_set_rtrg(struct uart_port *port)
serial_port_out(port, SCFCR, serial_port_in(port, SCFCR) | bits);
}
+static ssize_t rx_trigger_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct uart_port *port = dev_get_drvdata(dev);
+ struct sci_port *sci = to_sci_port(port);
+ return sprintf(buf, "%d\n", sci->rx_trigger);
+}
+
+static ssize_t rx_trigger_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf,
+ size_t count)
+{
+ struct uart_port *port = dev_get_drvdata(dev);
+ struct sci_port *sci = to_sci_port(port);
+ int r = simple_strtol(buf, NULL, 0);
+ sci->rx_trigger = r;
+ scif_set_rtrg(port);
+ return count;
+}
+
+static DEVICE_ATTR(rx_trigger_level, 0644, rx_trigger_show, rx_trigger_store);
+
static void sci_reset(struct uart_port *port)
{
struct plat_sci_reg *reg;
@@ -2516,6 +2540,11 @@ static int sci_remove(struct platform_device *dev)
sci_cleanup_single(port);
+ if (port->port.fifosize > 1) {
+ sysfs_remove_file(&dev->dev.kobj,
+ &dev_attr_rx_trigger_level.attr);
+ }
+
return 0;
}
@@ -2660,6 +2689,13 @@ static int sci_probe(struct platform_device *dev)
if (ret)
return ret;
+ if (sp->port.fifosize > 1) {
+ ret = sysfs_create_file(&dev->dev.kobj,
+ &dev_attr_rx_trigger_level.attr);
+ if (ret)
+ return ret;
+ }
+
sp->freq_transition.notifier_call = sci_notifier;
ret = cpufreq_register_notifier(&sp->freq_transition,
Allows tuning of the RX FIFO interrupt threshold in case there are problems with buffer overruns or latency. Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com> --- drivers/tty/serial/sh-sci.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)