Re: Serdev: USB device and sysdev probing ala i2c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rob
On Thu, May 24, 2018 at 6:49 PM Rob Herring <robh@xxxxxxxxxx> wrote:

> On Thu, May 24, 2018 at 7:18 AM, Ricardo Ribalda Delgado
> <ricardo.ribalda@xxxxxxxxx> wrote:
> > Hi Johan,
> >
> > On Thu, May 24, 2018 at 2:07 PM Johan Hovold <johan@xxxxxxxxxx> wrote:
> >
> >> Hi Ricardo,
> >
> >> On Wed, May 23, 2018 at 11:17:20AM +0200, Ricardo Ribalda Delgado
wrote:
> >> > Hi
> >> >
> >> > I have a flash controller connected to the main computer via a usb to
> >> > serial. My plan is to expose it to the system as a video4linux
> > subdevice.
> >> >
> >> > With the inclusion of serdev I was expecting that it would be as
easy as
> >> > adding a i2c device, but seems that there are some functionality that
> > it is
> >> > still not implemented:
> >> >
> >> > 1) Serdev for usb serial devices.
> >
> >> Right, I didn't want to enable serdev for USB serial before we have
> >> determined how to handle hotplugging (e.g. in serdev core or by making
> >> sure every serdev driver can handle devices going away at any time) in
> >> order to avoid having things crash left and right.
> >
> >> I have out-of-tree code for USB serial that I use for testing purposes,
> >> so it's mostly a matter of finding the time to think this through.
> >
> > Could you share those patches? I would love to test them.
> > In my setup the system does not support hotplugg and/or power saving.
> >
> >
> >> > 2) Instatiating via sysfs. Something like
> >> > echo hci_nokia > /sys/bus/serio/devices/serio0/new_device
> >> > (inspired in: echo eeprom 0x50 >
/sys/bus/i2c/devices/i2c-3/new_device)
> >
> >> Serdev currently only supports device tree and ACPI. Using out-of-tree
> >> code, you could load a device tree fragment during runtime to describe
> >> your serial bus (or you just amend the device tree).
> >
> >> Using device tree overlays would have the benefit of being able to
> >> describe associated resources (e.g. reset gpios) which a simple
> >> compatible string (or equivalent) would not.
> >
> >> But there are examples where a simple compatible string would do, for
> >> example an existing CEC device presenting itself as a generic USB CDC
> >> device (hopefully with a dedicated VID/PID so that no user-space
> >> configuration is needed at all).
> >
> > What about platform devices? Can it be instatiated like that?

> Platform devices generally mean memory mapped devices. How would that
> work thru serial? I guess you could have some serial to mmio bridge
> exposed thru regmap.


Actually I was thinking about a module that is autoloaded based on a acpi
string and then creates the serial devices with something like:

static struct serio_board_info ledctrl = {
    .modalias = "serio_ledctrl",
};

serio_adap = serio_get_adapter(0);
if (!serio_adap){
printk(KERN_ERR "Could not find serio bus.");
return -EIO;
}
serio_client=serio_new_device(serio_adap, ledctrl);

Yes, there would be one driver per board, and that does not scale on the
kernel tree, but for out of tree is really helpful (and maybe also for
notebooks that already have their own platform driver on the tree)

> The fundamental problem here is you need a parent device node to apply
> a DT overlay to and a USB device hotplugged has no DT device node. The
> system you are running on may not even have a DT (like a PC). If you
> have an overlay of the downstream devices, they have to be a child of
> something for the overlay to apply to. We could just create virtual
> device nodes for the purposes of applying overlays to. Another option
> would be allowing multiple DTs. Then you aren't even using overlays
> (what's the point of an overlay when a system has no real DT to begin
> with). That also would mean they are completely independent from any
> real DT or other instances (you may want to plug in multiple of the
> same device).

In my usecase the DT is way too overkilled. The previously mentioned
echo tty > /sys/bus/serio/devices/serio0/unregister
echo hci_nokia > /sys/bus/serio/devices/serio0/new_device

would be the most convenient way to use/experiment with serio.


I am not taking into consideration hot pluggable devices. I am thinking
about a use case where the usb2serial is soldered in the board.


> Rob



-- 
Ricardo Ribalda
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux