Re: [RFC 2/7] tty: add support for "tty slave" devices

From: Greg Kroah-Hartman
Date: Sat Aug 13 2016 - 06:03:41 EST


On Sat, Aug 13, 2016 at 05:14:33AM +0200, Sebastian Reichel wrote:
> From: NeilBrown <neilb@xxxxxxx>
>
> A "tty slave" is a device connected via UART. It may need a driver to,
> for example, power the device on when the tty is opened, and power it
> off when the tty is released.
>
> Signed-off-by: NeilBrown <neilb@xxxxxxx>
> Signed-off-by: Sebastian Reichel <sre@xxxxxxxxxx>
> ---
> Documentation/devicetree/bindings/serial/8250.txt | 4 ++++
> drivers/tty/tty_io.c | 6 ++++++
> 2 files changed, 10 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/serial/8250.txt b/Documentation/devicetree/bindings/serial/8250.txt
> index f5561ac7e17e..ecb74730f71b 100644
> --- a/Documentation/devicetree/bindings/serial/8250.txt
> +++ b/Documentation/devicetree/bindings/serial/8250.txt
> @@ -46,6 +46,10 @@ Optional properties:
> line respectively. It will use specified GPIO instead of the peripheral
> function pin for the UART feature. If unsure, don't specify this property.
>
> +Optional child node:
> +- a device connected to the uart can be specified as child node with
> + compatible value.
> +
> Note:
> * fsl,ns16550:
> ------------
> diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
> index 734a635e7363..39ff5dcdfd50 100644
> --- a/drivers/tty/tty_io.c
> +++ b/drivers/tty/tty_io.c
> @@ -95,6 +95,7 @@
> #include <linux/seq_file.h>
> #include <linux/serial.h>
> #include <linux/ratelimit.h>
> +#include <linux/of_platform.h>
>
> #include <linux/uaccess.h>
>
> @@ -3317,6 +3318,11 @@ struct device *tty_register_device_attr(struct tty_driver *driver,
> retval = device_register(dev);
> if (retval)
> goto error;
> + if (device && device->of_node)
> + /* Children are platform devices and will be
> + * runtime_pm managed by this tty.
> + */
> + of_platform_populate(device->of_node, NULL, NULL, dev);

Why are these platform devices? And why only OF?

thanks,

greg k-h