Add ACPI support for serial attached devices.
Currently, serial devices are not set as enumerated during ACPI scan for SPI
or i2c buses (but not for UART). This should also be done for UART serial
devices.
I renamed *spi_i2c_slave* to *serial_bus_slave* to reflect this.
This needs Johan Hovold's "serdev: fix registration of second slave" patch.
Tested on T100TA with Broadcom BCM2E39.
Since v2:
- Remove ctrl->serdev set to NULL in acpi_serdev_register_device() in favor
of Johan's patch
- Fallback to ctrl->serdev check when acpi_walk_namespace() returns an error
to prevent memory leak
- Remove a change in dev_dbg() call in serdev_controller_add(), this will
be done in separate patch
Since v1:
- Check if a serdev device as been allocated during acpi_walk_namespace() to
prevent serdev controller registration instead of the tty-class device.
- Reword dev_dbg() strings replacing Serial by serdev
- Removing redundant "serdev%d" in dev_dbg() calls in serdev_controller_add()
Since RFC:
- Add or reword commit messages
- Rename *serial_slave* to *serial_bus_slave*
- Add specific check for Apple in acpi_is_serial_bus_slave(), thanks to
Lukas Wunner
- Update comment in acpi_default_enumeration()
- Remove patch 3 "Bluetooth: hci_bcm: Add ACPI serdev support for BCM2E39"
in favor of patches from Hans de Goede
Frédéric Danis (2):
serdev: Add ACPI support
ACPI / scan: Fix enumeration for special UART devices
drivers/acpi/scan.c | 37 ++++++++---------
drivers/tty/serdev/core.c | 100 +++++++++++++++++++++++++++++++++++++++++++---
include/acpi/acpi_bus.h | 2 +-
3 files changed, 113 insertions(+), 26 deletions(-)
--
2.7.4
UART devices is expected to be enumerated by SerDev subsystem.
During ACPI scan, serial devices behind SPI, I2C or UART buses are not
enumerated, allowing them to be enumerated by their respective parents.
Rename *spi_i2c_slave* to *serial_bus_slave* as this will be used for serial
devices on serial buses (SPI, I2C or UART).
On Macs an empty ResourceTemplate is returned for uart slaves.
Instead the device properties "baud", "parity", "dataBits", "stopBits" are
provided. Add a check for "baud" in acpi_is_serial_bus_slave().
Signed-off-by: Frédéric Danis <redacted>
Reviewed-by: Sebastian Reichel <redacted>
---
drivers/acpi/scan.c | 37 +++++++++++++++++--------------------
include/acpi/acpi_bus.h | 2 +-
2 files changed, 18 insertions(+), 21 deletions(-)
@@ -1505,41 +1505,38 @@ static void acpi_init_coherency(struct acpi_device *adev)adev->flags.coherent_dma=cca;}-staticintacpi_check_spi_i2c_slave(structacpi_resource*ares,void*data)+staticintacpi_check_serial_bus_slave(structacpi_resource*ares,void*data){-bool*is_spi_i2c_slave_p=data;+bool*is_serial_bus_slave_p=data;if(ares->type!=ACPI_RESOURCE_TYPE_SERIAL_BUS)return1;-/*-*devicesthatareconnectedtoUARTstillneedtobeenumeratedto-*platformbus-*/-if(ares->data.common_serial_bus.type!=ACPI_RESOURCE_SERIAL_TYPE_UART)-*is_spi_i2c_slave_p=true;+*is_serial_bus_slave_p=true;/* no need to do more checking */return-1;}-staticboolacpi_is_spi_i2c_slave(structacpi_device*device)+staticboolacpi_is_serial_bus_slave(structacpi_device*device){structlist_headresource_list;-boolis_spi_i2c_slave=false;+boolis_serial_bus_slave=false;/* Macs use device properties in lieu of _CRS resources */if(x86_apple_machine&&(fwnode_property_present(&device->fwnode,"spiSclkPeriod")||-fwnode_property_present(&device->fwnode,"i2cAddress")))+fwnode_property_present(&device->fwnode,"i2cAddress")||+fwnode_property_present(&device->fwnode,"baud")))returntrue;INIT_LIST_HEAD(&resource_list);-acpi_dev_get_resources(device,&resource_list,acpi_check_spi_i2c_slave,-&is_spi_i2c_slave);+acpi_dev_get_resources(device,&resource_list,+acpi_check_serial_bus_slave,+&is_serial_bus_slave);acpi_dev_free_resource_list(&resource_list);-returnis_spi_i2c_slave;+returnis_serial_bus_slave;}voidacpi_init_device_object(structacpi_device*device,acpi_handlehandle,
From: Johan Hovold <johan@kernel.org> Date: 2017-10-11 09:03:55
On Wed, Oct 11, 2017 at 10:32:12AM +0200, Frédéric Danis wrote:
Add ACPI support for serial attached devices.
Currently, serial devices are not set as enumerated during ACPI scan for SPI
or i2c buses (but not for UART). This should also be done for UART serial
devices.
I renamed *spi_i2c_slave* to *serial_bus_slave* to reflect this.
This needs Johan Hovold's "serdev: fix registration of second slave" patch.
In theory this series could go in through the acpi-tree without my
fix. It would only affect an error case where an unlikely failure to
register an ACPI serdev device, would prevent the tty-class device from
being registered instead of the controller. That is, something we can
live with until this all converges in 4.15-rc1 if needed.
That said, I think we should consider taking all serdev changes, and
therefore also the ACPI patch, through the tty tree instead in order to
avoid merge conflicts. Rafael?
Johan
From: Rafael J. Wysocki <hidden> Date: 2017-10-11 13:09:12
On Wed, Oct 11, 2017 at 11:03 AM, Johan Hovold [off-list ref] wrote:
On Wed, Oct 11, 2017 at 10:32:12AM +0200, Frédéric Danis wrote:
quoted
Add ACPI support for serial attached devices.
Currently, serial devices are not set as enumerated during ACPI scan for SPI
or i2c buses (but not for UART). This should also be done for UART serial
devices.
I renamed *spi_i2c_slave* to *serial_bus_slave* to reflect this.
This needs Johan Hovold's "serdev: fix registration of second slave" patch.
In theory this series could go in through the acpi-tree without my
fix. It would only affect an error case where an unlikely failure to
register an ACPI serdev device, would prevent the tty-class device from
being registered instead of the controller. That is, something we can
live with until this all converges in 4.15-rc1 if needed.
That said, I think we should consider taking all serdev changes, and
therefore also the ACPI patch, through the tty tree instead in order to
avoid merge conflicts. Rafael?
OK
Please feel free to add
Acked-by: Rafael J. Wysocki <redacted>
to the ACPI core change.
And I will assume that this series will go in via the tty tree.
Thanks,
Rafael
Add ACPI support for serial attached devices.
Currently, serial devices are not set as enumerated during ACPI scan for SPI
or i2c buses (but not for UART). This should also be done for UART serial
devices.
I renamed *spi_i2c_slave* to *serial_bus_slave* to reflect this.
This needs Johan Hovold's "serdev: fix registration of second slave" patch.
In theory this series could go in through the acpi-tree without my
fix. It would only affect an error case where an unlikely failure to
register an ACPI serdev device, would prevent the tty-class device from
being registered instead of the controller. That is, something we can
live with until this all converges in 4.15-rc1 if needed.
That said, I think we should consider taking all serdev changes, and
therefore also the ACPI patch, through the tty tree instead in order to
avoid merge conflicts. Rafael?
OK
Please feel free to add
Acked-by: Rafael J. Wysocki <redacted>
to the ACPI core change.
And I will assume that this series will go in via the tty tree.
you have to take these two patches now via the TTY tree now. In case you already marked them as someone else problem ;)
Regards
Marcel
On Wed, Oct 11, 2017 at 10:32:14AM +0200, Frédéric Danis wrote:
UART devices is expected to be enumerated by SerDev subsystem.
During ACPI scan, serial devices behind SPI, I2C or UART buses are not
enumerated, allowing them to be enumerated by their respective parents.
Rename *spi_i2c_slave* to *serial_bus_slave* as this will be used for serial
devices on serial buses (SPI, I2C or UART).
On Macs an empty ResourceTemplate is returned for uart slaves.
Instead the device properties "baud", "parity", "dataBits", "stopBits" are
provided. Add a check for "baud" in acpi_is_serial_bus_slave().
Tested-by: Ronald Tschalär <redacted>
Tested-by: Peter Y. Chuang <redacted>
Ronald and Peter both report success for the above-mentioned Mac-specific
change on GitHub: https://github.com/l1k/linux/pull/1#issuecomment-336126330
Thanks,
Lukas
Hi Greg, Rafael, Marcel,
Le 11/10/2017 à 20:32, Marcel Holtmann a écrit :
Hi Greg,
quoted
quoted
quoted
Add ACPI support for serial attached devices.
Currently, serial devices are not set as enumerated during ACPI scan for SPI
or i2c buses (but not for UART). This should also be done for UART serial
devices.
I renamed *spi_i2c_slave* to *serial_bus_slave* to reflect this.
This needs Johan Hovold's "serdev: fix registration of second slave" patch.
In theory this series could go in through the acpi-tree without my
fix. It would only affect an error case where an unlikely failure to
register an ACPI serdev device, would prevent the tty-class device from
being registered instead of the controller. That is, something we can
live with until this all converges in 4.15-rc1 if needed.
That said, I think we should consider taking all serdev changes, and
therefore also the ACPI patch, through the tty tree instead in order to
avoid merge conflicts. Rafael?
OK
Please feel free to add
Acked-by: Rafael J. Wysocki <redacted>
to the ACPI core change.
And I will assume that this series will go in via the tty tree.
you have to take these two patches now via the TTY tree now. In case you already marked them as someone else problem ;)
Regards
Marcel
Is there any problem I missed with those patches?
Do I have to re-send them?
Regards,
Fred
On Wed, Oct 18, 2017 at 04:46:05PM +0200, Frédéric Danis wrote:
Hi Greg, Rafael, Marcel,
Le 11/10/2017 à 20:32, Marcel Holtmann a écrit :
quoted
Hi Greg,
quoted
quoted
quoted
Add ACPI support for serial attached devices.
Currently, serial devices are not set as enumerated during ACPI scan for SPI
or i2c buses (but not for UART). This should also be done for UART serial
devices.
I renamed *spi_i2c_slave* to *serial_bus_slave* to reflect this.
This needs Johan Hovold's "serdev: fix registration of second slave" patch.
In theory this series could go in through the acpi-tree without my
fix. It would only affect an error case where an unlikely failure to
register an ACPI serdev device, would prevent the tty-class device from
being registered instead of the controller. That is, something we can
live with until this all converges in 4.15-rc1 if needed.
That said, I think we should consider taking all serdev changes, and
therefore also the ACPI patch, through the tty tree instead in order to
avoid merge conflicts. Rafael?
OK
Please feel free to add
Acked-by: Rafael J. Wysocki <redacted>
to the ACPI core change.
And I will assume that this series will go in via the tty tree.
you have to take these two patches now via the TTY tree now. In case you already marked them as someone else problem ;)
Regards
Marcel
Is there any problem I missed with those patches?
Do I have to re-send them?
No, they are in my queue, still catching up...
thanks,
greg k-h