From: Peter Hurley <peter@hurleysoftware.com>
To: "H. Nikolaus Schaller" <hns@goldelico.com>
Cc: Andrey Vostrikov <andrey.vostrikov@cogentembedded.com>,
Mark Rutland <mark.rutland@arm.com>,
List for communicating with real GTA04 owners
<gta04-owner@goldelico.com>,
tomeu@tomeuvizoso.net, NeilBrown <neil@brown.name>,
One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
Arnd Bergmann <arnd@arndb.de>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sebastian Reichel <sre@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Rob Herring <robherring2@gmail.com>, Pavel Machek <pavel@ucw.cz>,
linux-serial@vger.kernel.org,
Grant Likely <grant.likely@linaro.org>,
Jiri Slaby <jslaby@suse.cz>, Marek Belisko <marek@goldelico.com>
Subject: Re: [Gta04-owner] [PATCH 0/4] UART slave device support - version 4
Date: Fri, 15 Jan 2016 09:43:39 -0800 [thread overview]
Message-ID: <56992FCB.3030101@hurleysoftware.com> (raw)
In-Reply-To: <572D2BBD-1CB4-4048-87AE-23DE16AC2AD4@goldelico.com>
On 01/15/2016 09:32 AM, H. Nikolaus Schaller wrote:
> Hi Peter,
>
> Am 15.01.2016 um 18:16 schrieb Peter Hurley <peter@hurleysoftware.com>:
>
>> On 01/15/2016 08:08 AM, H. Nikolaus Schaller wrote:
>>> Hi Andrey,
>>> ah that is fine to learn about another project that needs some solution (however it will look like).
>>>
>>> Am 15.01.2016 um 16:43 schrieb Andrey Vostrikov <andrey.vostrikov@cogentembedded.com>:
>>>
>>>> Hi Nikolaus,
>>>>
>>>> H. Nikolaus Schaller wrote:
>>>>> And IMHO nobody has described that he/she needs a solution to model the*data* relationship
>>>>> for devices connected behind a tty port.
>>>>
>>>> I am not sure if my case fits *data* relationship or not in this case. Some time ago I asked about state of your patches.
>>>> In my case I have supervising microcontroller unit (MCU) that is connected to one of UARTs on SoC.
>>>>
>>>> This MCU implements several functions that will be implemented as MFD driver:
>>>> - watchdog and system reset
>>>> - NVMEM EEPROM
>>>> - HWMON sensors
>>>> - Input/power button
>>>> - and similar low level functions
>>>>
>>>> So in my case DTS binding looks like:
>>>>
>>>> &uart3 {
>>>> mcu {
>>>> line-speed = <baud rate>;
>>>> watchdog {
>>>> timeout = <ms>;
>>>> ...other params...
>>>> };
>>>> eeprom {
>>>> #address-cells
>>>> #size-cells
>>>> cell1 : cell@1 {
>>>> reg = <1 2>;
>>>> };
>>>> cell2 : cell@2 {
>>>> reg = <2 1>;
>>>> };
>>>> };
>>>> hwmon {
>>>> sensors-list = "voltage", "current", etc...;
>>>> }
>>>> }
>>>> }
>>>
>>> With my proposal it would just become
>>>
>>> / {
>>> themcu: mcu {
>>> uart = <&uart3>;
>>> line-speed = <baud rate>;
>>> watchdog {
>>> timeout = <ms>;
>>> ...other params...
>>> };
>>> eeprom {
>>> #address-cells
>>> #size-cells
>>> cell1 : cell@1 {
>>> reg = <1 2>;
>>> };
>>> cell2 : cell@2 {
>>> reg = <2 1>;
>>> };
>>> };
>>> hwmon {
>>> sensors-list = "voltage", "current", etc...;
>>> }
>>> }
>>> };
>>>
>>> Which is almost the same. Except that it allows to move your mcu node whereever you like and easily allows to change the interface to connect to a different device by
>>>
>>> &themcu {
>>> uart = <&uart1>;
>>> };
>>>
>>> With the subnode style you would need some tricks to get the driver instance for uart3 disabled, although it is possible (everything is possible - just easier or more difficult).
>>>
>>>>
>>>> This MCU receives commands and notifies MFD driver about events via UART protocol.
>>>> It looks like not really a slave though, more like a partnership from data flow point of view.
>>>
>>> Yes!. That is why I started to question the term "slave".
>>>
>>> And yes, this is the second use case I am aware of: a device that just *uses" the UART to do its works and there is no /dev/tty involved.
>>>
>>>>
>>>> There is no user space code involved in this case as whole interactions are between drivers (just a kick to open /dev/ttyXXX using sys_open, as there is no way to start probe on uart_slave bus and assign line discipline).
>>>
>>> Exactly this is what we want to provide as API for the drivers by our patches to serial-core.c.
>>>
>>> We want to allow such a "partner" device to take a line-speed property e.g. from its DT node (or a 9600 constant as for our GPS chip) and ask the UART driver to set the required clocks. Or to get the driver notified that someone has opened the /dev/tty* etc. So make it possible to use some UART from another driver.
>>>
>>> In the long run it should be possible to use the UART even if there is no /dev/tty client or interface in user-space but that is something not perfectly working (there is some initialization race in the tty/serial subsystem we have not yet understood).
>>>
>>> As you see, I have a driver-specific standpoint (and not coming from user space).
>>>
>>> Thanks for sharing this example.
>>
>>
>> I'd like to see the exemplar slave driver be something more complicated than
>> trivial on-off, before hacking in junk into the serial core.
>>
>> As it stands, this gps could be supported on any uart driver that implements
>> mctrl gpios (which is trivial with the serial mctrl gpio helpers).
>
> in the GPS case basic mctrl is not enough because the "partner" driver must get meta-data
> that there is data activity. This is something mctrl can't provide.
A binary state is hardly "meta-data". What is the purpose of the rx notification?
> And the GPS chip does not need a simple gpio state to power on/off but an on/off toggle impulse.
Genericity. If this chip needs such a state mechanism, then that should be reflected
generically in gpio support, and we're back to trivial mctrl.
> In our case there are no mctrl gpios (omap) but part of our driver proposal is just to
> forward changes of the mctrl bits to the partner driver.
Please feel free to submit patches for mctrl gpios for the omap-serial driver.
>> Not that I'm against uart slave device support, just that I don't think hacks
>> is the way to go about it.
>>
>> What I'd like to see is a split of the serial core into a tty driver and a
>> standalone device abstraction. Anything else is just workarounds.
I think you misunderstand what I mean by "standalone device abstraction"; let me
be clearer: "standalone UART device abstraction".
Regards,
Peter Hurley
> Here (was rebased from what I had submitted to LKML a while ago):
>
> 1. serial core (two patches add API for any such partner drivers)
>
> http://git.goldelico.com/?p=gta04-kernel.git;a=commit;h=c75ab51483e56afe08f56de104b5ed3fa1d6b0e8
> http://git.goldelico.com/?p=gta04-kernel.git;a=commit;h=f910d951fcf816fce3261814d7f8c46ac6b35e68
>
> 2. standalone driver example (using the new API)
>
> http://git.goldelico.com/?p=gta04-kernel.git;a=commit;h=4fd1dbd4e915d741dddd264d6f87396e72351b3a
>
> BR and thanks,
> Nikolaus
>
next prev parent reply other threads:[~2016-01-15 17:43 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-11 1:56 [PATCH 0/4] UART slave device support - version 4 NeilBrown
2015-05-11 1:56 ` [PATCH 1/4] TTY: use class_find_device to find port in uart_suspend/resume NeilBrown
2015-05-11 1:56 ` [PATCH 3/4] TTY: add support for uart_slave devices NeilBrown
2015-05-12 8:31 ` Paul Bolle
2015-05-12 23:35 ` NeilBrown
2015-05-11 1:56 ` [PATCH 4/4] tty/slaves: add a driver to power on/off UART attached devices NeilBrown
2015-05-11 1:56 ` [PATCH 2/4] TTY: split tty_register_device_attr into 'initialize' and 'add' parts NeilBrown
2015-05-31 22:01 ` [PATCH 0/4] UART slave device support - version 4 Greg Kroah-Hartman
2015-08-07 13:01 ` Linus Walleij
2015-08-11 23:20 ` NeilBrown
2015-08-28 5:52 ` [Gta04-owner] " Dr. H. Nikolaus Schaller
2015-08-28 7:02 ` Pavel Machek
2015-08-28 9:43 ` Dr. H. Nikolaus Schaller
2015-08-28 11:04 ` Pavel Machek
2015-08-28 20:04 ` Christ van Willegen
2016-01-12 13:06 ` Tomeu Vizoso
2016-01-12 13:28 ` [Gta04-owner] " H. Nikolaus Schaller
2016-01-13 19:15 ` Mark Rutland
[not found] ` <1CD6CA14-AE4F-444F-A9A2-CF9B9485F2DC@goldelico.com>
2016-01-15 11:01 ` Mark Rutland
2016-01-15 15:05 ` H. Nikolaus Schaller
2016-01-15 15:43 ` Andrey Vostrikov
2016-01-15 16:08 ` H. Nikolaus Schaller
2016-01-15 17:16 ` Peter Hurley
2016-01-15 17:32 ` H. Nikolaus Schaller
2016-01-15 17:43 ` Peter Hurley [this message]
2016-01-15 17:58 ` H. Nikolaus Schaller
2016-01-15 19:23 ` Peter Hurley
2016-01-15 21:24 ` H. Nikolaus Schaller
2016-01-15 22:40 ` Rob Herring
2016-01-16 7:34 ` Vostrikov Andrey
2016-01-16 23:31 ` Rob Herring
2016-01-17 8:53 ` H. Nikolaus Schaller
2016-01-17 14:19 ` One Thousand Gnomes
2016-01-17 17:57 ` H. Nikolaus Schaller
2016-01-17 19:38 ` One Thousand Gnomes
2016-01-18 8:17 ` H. Nikolaus Schaller
2016-01-18 8:56 ` Andrey Vostrikov
2016-01-18 11:52 ` H. Nikolaus Schaller
2016-01-18 11:19 ` One Thousand Gnomes
2016-01-18 20:58 ` H. Nikolaus Schaller
2016-01-18 22:03 ` One Thousand Gnomes
2016-01-18 22:32 ` H. Nikolaus Schaller
2016-01-19 14:25 ` One Thousand Gnomes
2016-01-20 17:33 ` H. Nikolaus Schaller
2016-01-20 16:11 ` H. Nikolaus Schaller
2016-01-20 17:46 ` One Thousand Gnomes
2016-01-20 18:03 ` H. Nikolaus Schaller
2016-01-22 15:45 ` Tomeu Vizoso
2016-01-22 16:49 ` Rob Herring
2016-01-22 20:12 ` One Thousand Gnomes
2016-01-23 7:40 ` Andreas Kemnade
2016-01-23 12:19 ` H. Nikolaus Schaller
2016-01-23 17:28 ` One Thousand Gnomes
2016-01-23 22:04 ` H. Nikolaus Schaller
2016-01-24 17:10 ` One Thousand Gnomes
2016-01-25 10:36 ` H. Nikolaus Schaller
2016-01-19 6:32 ` Andreas Kemnade
2016-01-20 19:38 ` Dmitry Torokhov
2016-01-20 20:09 ` Vostrikov Andrey
2016-01-15 16:12 ` Mark Rutland
2016-01-15 19:16 ` H. Nikolaus Schaller
2016-01-15 19:40 ` Pavel Machek
2016-01-15 20:35 ` H. Nikolaus Schaller
2016-01-12 21:28 ` NeilBrown
2016-01-13 19:00 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56992FCB.3030101@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=andrey.vostrikov@cogentembedded.com \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=grant.likely@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=gta04-owner@goldelico.com \
--cc=hns@goldelico.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=marek@goldelico.com \
--cc=mark.rutland@arm.com \
--cc=neil@brown.name \
--cc=pavel@ucw.cz \
--cc=robherring2@gmail.com \
--cc=sre@kernel.org \
--cc=tomeu@tomeuvizoso.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).