Re: Re: [PATCH V7] serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers

2014-05-28 Thread Yoshihiro YUNOMAE

Hi Greg,

Thank you for your review.

(2014/05/29 5:13), Greg Kroah-Hartman wrote:

On Tue, May 27, 2014 at 02:09:21PM +0900, Yoshihiro YUNOMAE wrote:

Add tunable RX interrupt trigger I/F of FIFO buffers.

Serial devices are used as not only message communication devices but control
or sending communication devices. For the latter uses, normally small data
will be exchanged, so user applications want to receive data unit as soon as
possible for real-time tendency. If we have a sensor which sends a 1 byte data
each time and must control a device based on the sensor feedback, the RX
interrupt should be triggered for each data.

According to HW specification of serial UART devices, RX interrupt trigger
can be changed, but the trigger is hard-coded. For example, RX interrupt trigger
in 16550A can be set to 1, 4, 8, or 14 bytes for HW, but current driver sets
the trigger to only 8bytes.

This patch makes some devices change RX interrupt trigger from userland.


I'd prefer it if you could split the attr_grps logic out into a separate
patch, the first one in a 2 patch series.  I don't think it is quite
correct what you are doing here, but given the other changes going on at
the same time, it's hard to pick it apart.


OK, I understood. If this patch will be separated as you say, other
people will be able to understand easily when attr_grps will have
been introduced.


So, can you split this up into 2 patches and resend please?


Sure. I'll do it soon.

Thank you,
Yoshihiro YUNOMAE

--
Yoshihiro YUNOMAE
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: yoshihiro.yunomae...@hitachi.com


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V7] serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers

2014-05-28 Thread Greg Kroah-Hartman
On Tue, May 27, 2014 at 02:09:21PM +0900, Yoshihiro YUNOMAE wrote:
> Add tunable RX interrupt trigger I/F of FIFO buffers.
> 
> Serial devices are used as not only message communication devices but control
> or sending communication devices. For the latter uses, normally small data
> will be exchanged, so user applications want to receive data unit as soon as
> possible for real-time tendency. If we have a sensor which sends a 1 byte data
> each time and must control a device based on the sensor feedback, the RX
> interrupt should be triggered for each data.
> 
> According to HW specification of serial UART devices, RX interrupt trigger
> can be changed, but the trigger is hard-coded. For example, RX interrupt 
> trigger
> in 16550A can be set to 1, 4, 8, or 14 bytes for HW, but current driver sets
> the trigger to only 8bytes.
> 
> This patch makes some devices change RX interrupt trigger from userland.

I'd prefer it if you could split the attr_grps logic out into a separate
patch, the first one in a 2 patch series.  I don't think it is quite
correct what you are doing here, but given the other changes going on at
the same time, it's hard to pick it apart.

So, can you split this up into 2 patches and resend please?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Re: [PATCH V7] serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers

2014-05-28 Thread Yoshihiro YUNOMAE

Hi Greg,

Thank you for your review.

(2014/05/29 5:13), Greg Kroah-Hartman wrote:

On Tue, May 27, 2014 at 02:09:21PM +0900, Yoshihiro YUNOMAE wrote:

Add tunable RX interrupt trigger I/F of FIFO buffers.

Serial devices are used as not only message communication devices but control
or sending communication devices. For the latter uses, normally small data
will be exchanged, so user applications want to receive data unit as soon as
possible for real-time tendency. If we have a sensor which sends a 1 byte data
each time and must control a device based on the sensor feedback, the RX
interrupt should be triggered for each data.

According to HW specification of serial UART devices, RX interrupt trigger
can be changed, but the trigger is hard-coded. For example, RX interrupt trigger
in 16550A can be set to 1, 4, 8, or 14 bytes for HW, but current driver sets
the trigger to only 8bytes.

This patch makes some devices change RX interrupt trigger from userland.


I'd prefer it if you could split the attr_grps logic out into a separate
patch, the first one in a 2 patch series.  I don't think it is quite
correct what you are doing here, but given the other changes going on at
the same time, it's hard to pick it apart.


OK, I understood. If this patch will be separated as you say, other
people will be able to understand easily when attr_grps will have
been introduced.


So, can you split this up into 2 patches and resend please?


Sure. I'll do it soon.

Thank you,
Yoshihiro YUNOMAE

--
Yoshihiro YUNOMAE
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: yoshihiro.yunomae...@hitachi.com


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V7] serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers

2014-05-28 Thread Greg Kroah-Hartman
On Tue, May 27, 2014 at 02:09:21PM +0900, Yoshihiro YUNOMAE wrote:
 Add tunable RX interrupt trigger I/F of FIFO buffers.
 
 Serial devices are used as not only message communication devices but control
 or sending communication devices. For the latter uses, normally small data
 will be exchanged, so user applications want to receive data unit as soon as
 possible for real-time tendency. If we have a sensor which sends a 1 byte data
 each time and must control a device based on the sensor feedback, the RX
 interrupt should be triggered for each data.
 
 According to HW specification of serial UART devices, RX interrupt trigger
 can be changed, but the trigger is hard-coded. For example, RX interrupt 
 trigger
 in 16550A can be set to 1, 4, 8, or 14 bytes for HW, but current driver sets
 the trigger to only 8bytes.
 
 This patch makes some devices change RX interrupt trigger from userland.

I'd prefer it if you could split the attr_grps logic out into a separate
patch, the first one in a 2 patch series.  I don't think it is quite
correct what you are doing here, but given the other changes going on at
the same time, it's hard to pick it apart.

So, can you split this up into 2 patches and resend please?

thanks,

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V7] serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers

2014-05-26 Thread Yoshihiro YUNOMAE
Add tunable RX interrupt trigger I/F of FIFO buffers.

Serial devices are used as not only message communication devices but control
or sending communication devices. For the latter uses, normally small data
will be exchanged, so user applications want to receive data unit as soon as
possible for real-time tendency. If we have a sensor which sends a 1 byte data
each time and must control a device based on the sensor feedback, the RX
interrupt should be triggered for each data.

According to HW specification of serial UART devices, RX interrupt trigger
can be changed, but the trigger is hard-coded. For example, RX interrupt trigger
in 16550A can be set to 1, 4, 8, or 14 bytes for HW, but current driver sets
the trigger to only 8bytes.

This patch makes some devices change RX interrupt trigger from userland.


- Read current setting
 # cat /sys/class/tty/ttyS0/rx_trig_bytes
 8

- Write user setting
 # echo 1 > /sys/class/tty/ttyS0/rx_trig_bytes
 # cat /sys/class/tty/ttyS0/rx_trig_bytes
 1


- 16550A and Tegra (1, 4, 8, or 14 bytes)
- 16650V2 (8, 16, 24, or 28 bytes)
- 16654 (8, 16, 56, or 60 bytes)
- 16750 (1, 16, 32, or 56 bytes)

Changed in V2:
 - Use _IOW for TIOCSFIFORTRIG definition
 - Pass the interrupt trigger value itself

Changes in V3:
 - Change I/F from ioctl(2) to sysfs(rx_int_trig)

Changes in V4:
 - Introduce fifo_bug flag in uart_8250_port structure
   This is enabled only when parity is enabled and UART_BUG_PARITY is enabled
   for up->bugs. If this flag is enabled, user cannot set RX trigger.
 - Return -EOPNOTSUPP when it does not support device at convert_fcr2val() and
   at convert_val2rxtrig()
 - Set the nearest lower RX trigger when users input a meaningless value at
   convert_val2rxtrig()
 - Check whether p->fcr is existing at serial8250_clear_and_reinit_fifos()
 - Set fcr = up->fcr in the begging of serial8250_do_set_termios()

Changes in V5:
 - Support Tegra, 16650V2, 16654, and 16750
 - Store default FCR value to up->fcr when the port is first created
 - Add rx_trig_byte[] in uart_config[] for each device and use rx_trig_byte[]
   in convert_fcr2val() and convert_val2rxtrig()

Changes in V5.1:
 - Fix FCR_RX_TRIG_MAX_STATE definition

Changes in V6:
 - Move FCR_RX_TRIG_* definition in 8250.h to include/uapi/linux/serial_reg.h,
   rename those to UART_FCR_R_TRIG_*, and use UART_FCR_TRIGGER_MASK to
   UART_FCR_R_TRIG_BITS()
 - Change following function names:
convert_fcr2val() => fcr_get_rxtrig_bytes()
convert_val2rxtrig() => bytes_to_fcr_rxtrig()
 - Fix typo in serial8250_do_set_termios()
 - Delete the verbose error message pr_info() in bytes_to_fcr_rxtrig()
 - Rename *rx_int_trig/rx_trig* to *rxtrig* for several functions or variables
   (but UI remains rx_int_trig)
 - Change the meaningless variable name 'val' to 'bytes' following functions:
fcr_get_rxtrig_bytes(), bytes_to_fcr_rxtrig(), do_set_rxtrig(),
do_serial8250_set_rxtrig(), and serial8250_set_attr_rxtrig()
 - Use up->fcr in order to get rxtrig_bytes instead of rx_trig_raw in
   fcr_get_rxtrig_bytes()
 - Use conf_type->rxtrig_bytes[0] instead of switch statement for support check
   in register_dev_spec_attr_grp()
 - Delete the checking whether a user changed FCR or not when minimum buffer
   is needed in serial8250_do_set_termios()

Changes in V7:
 - Add Documentation
 - Change I/F name from rx_int_trig to rx_trig_bytes because the name
   rx_int_trig is hard to understand how users specify the value

Signed-off-by: Yoshihiro YUNOMAE 
Reviewed-by: Stephen Warren 
Cc: Greg Kroah-Hartman 
Cc: Jiri Slaby 
Cc: Heikki Krogerus 
Cc: Jingoo Han 
Cc: Aaron Sierra 
Cc: linux-ser...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 Documentation/ABI/testing/sysfs-tty |   16 +++
 drivers/tty/serial/8250/8250.h  |2 
 drivers/tty/serial/8250/8250_core.c |  173 ---
 drivers/tty/serial/serial_core.c|   18 ++--
 include/linux/serial_8250.h |2 
 include/linux/serial_core.h |4 +
 include/uapi/linux/serial_reg.h |5 +
 7 files changed, 198 insertions(+), 22 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-tty 
b/Documentation/ABI/testing/sysfs-tty
index ad22fb0..9eb3c2b 100644
--- a/Documentation/ABI/testing/sysfs-tty
+++ b/Documentation/ABI/testing/sysfs-tty
@@ -138,3 +138,19 @@ Description:
 
 These sysfs values expose the TIOCGSERIAL interface via
 sysfs rather than via ioctls.
+
+What:  /sys/class/tty/ttyS0/rx_trig_bytes
+Date:  May 2014
+Contact:   Yoshihiro YUNOMAE 
+Description:
+Shows current RX interrupt trigger bytes or sets the
+user specified value to change it for the FIFO buffer.
+Users can show or set this value regardless of opening the
+serial device file or not.
+
+The RX trigger can be set one of four kinds of values for UART
+serials. When users input a meaning less value to 

[PATCH V7] serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers

2014-05-26 Thread Yoshihiro YUNOMAE
Add tunable RX interrupt trigger I/F of FIFO buffers.

Serial devices are used as not only message communication devices but control
or sending communication devices. For the latter uses, normally small data
will be exchanged, so user applications want to receive data unit as soon as
possible for real-time tendency. If we have a sensor which sends a 1 byte data
each time and must control a device based on the sensor feedback, the RX
interrupt should be triggered for each data.

According to HW specification of serial UART devices, RX interrupt trigger
can be changed, but the trigger is hard-coded. For example, RX interrupt trigger
in 16550A can be set to 1, 4, 8, or 14 bytes for HW, but current driver sets
the trigger to only 8bytes.

This patch makes some devices change RX interrupt trigger from userland.

How to use
- Read current setting
 # cat /sys/class/tty/ttyS0/rx_trig_bytes
 8

- Write user setting
 # echo 1  /sys/class/tty/ttyS0/rx_trig_bytes
 # cat /sys/class/tty/ttyS0/rx_trig_bytes
 1

Support uart devices
- 16550A and Tegra (1, 4, 8, or 14 bytes)
- 16650V2 (8, 16, 24, or 28 bytes)
- 16654 (8, 16, 56, or 60 bytes)
- 16750 (1, 16, 32, or 56 bytes)

Changed in V2:
 - Use _IOW for TIOCSFIFORTRIG definition
 - Pass the interrupt trigger value itself

Changes in V3:
 - Change I/F from ioctl(2) to sysfs(rx_int_trig)

Changes in V4:
 - Introduce fifo_bug flag in uart_8250_port structure
   This is enabled only when parity is enabled and UART_BUG_PARITY is enabled
   for up-bugs. If this flag is enabled, user cannot set RX trigger.
 - Return -EOPNOTSUPP when it does not support device at convert_fcr2val() and
   at convert_val2rxtrig()
 - Set the nearest lower RX trigger when users input a meaningless value at
   convert_val2rxtrig()
 - Check whether p-fcr is existing at serial8250_clear_and_reinit_fifos()
 - Set fcr = up-fcr in the begging of serial8250_do_set_termios()

Changes in V5:
 - Support Tegra, 16650V2, 16654, and 16750
 - Store default FCR value to up-fcr when the port is first created
 - Add rx_trig_byte[] in uart_config[] for each device and use rx_trig_byte[]
   in convert_fcr2val() and convert_val2rxtrig()

Changes in V5.1:
 - Fix FCR_RX_TRIG_MAX_STATE definition

Changes in V6:
 - Move FCR_RX_TRIG_* definition in 8250.h to include/uapi/linux/serial_reg.h,
   rename those to UART_FCR_R_TRIG_*, and use UART_FCR_TRIGGER_MASK to
   UART_FCR_R_TRIG_BITS()
 - Change following function names:
convert_fcr2val() = fcr_get_rxtrig_bytes()
convert_val2rxtrig() = bytes_to_fcr_rxtrig()
 - Fix typo in serial8250_do_set_termios()
 - Delete the verbose error message pr_info() in bytes_to_fcr_rxtrig()
 - Rename *rx_int_trig/rx_trig* to *rxtrig* for several functions or variables
   (but UI remains rx_int_trig)
 - Change the meaningless variable name 'val' to 'bytes' following functions:
fcr_get_rxtrig_bytes(), bytes_to_fcr_rxtrig(), do_set_rxtrig(),
do_serial8250_set_rxtrig(), and serial8250_set_attr_rxtrig()
 - Use up-fcr in order to get rxtrig_bytes instead of rx_trig_raw in
   fcr_get_rxtrig_bytes()
 - Use conf_type-rxtrig_bytes[0] instead of switch statement for support check
   in register_dev_spec_attr_grp()
 - Delete the checking whether a user changed FCR or not when minimum buffer
   is needed in serial8250_do_set_termios()

Changes in V7:
 - Add Documentation
 - Change I/F name from rx_int_trig to rx_trig_bytes because the name
   rx_int_trig is hard to understand how users specify the value

Signed-off-by: Yoshihiro YUNOMAE yoshihiro.yunomae...@hitachi.com
Reviewed-by: Stephen Warren swar...@nvidia.com
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Cc: Jiri Slaby jsl...@suse.cz
Cc: Heikki Krogerus heikki.kroge...@linux.intel.com
Cc: Jingoo Han jg1@samsung.com
Cc: Aaron Sierra asie...@xes-inc.com
Cc: linux-ser...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 Documentation/ABI/testing/sysfs-tty |   16 +++
 drivers/tty/serial/8250/8250.h  |2 
 drivers/tty/serial/8250/8250_core.c |  173 ---
 drivers/tty/serial/serial_core.c|   18 ++--
 include/linux/serial_8250.h |2 
 include/linux/serial_core.h |4 +
 include/uapi/linux/serial_reg.h |5 +
 7 files changed, 198 insertions(+), 22 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-tty 
b/Documentation/ABI/testing/sysfs-tty
index ad22fb0..9eb3c2b 100644
--- a/Documentation/ABI/testing/sysfs-tty
+++ b/Documentation/ABI/testing/sysfs-tty
@@ -138,3 +138,19 @@ Description:
 
 These sysfs values expose the TIOCGSERIAL interface via
 sysfs rather than via ioctls.
+
+What:  /sys/class/tty/ttyS0/rx_trig_bytes
+Date:  May 2014
+Contact:   Yoshihiro YUNOMAE yoshihiro.yunomae...@hitachi.com
+Description:
+Shows current RX interrupt trigger bytes or sets the
+user specified value to change it for the FIFO buffer.
+Users can show or set this value