Skip to content

Commit e361d1f

Browse files
fdanis-ossgregkh
authored andcommitted
ACPI / scan: Fix enumeration for special UART devices
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 <frederic.danis.oss@gmail.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Tested-by: Ronald Tschalär <ronald@innovation.ch> Tested-by: Peter Y. Chuang <peteryuchuang@gmail.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 53c7626 commit e361d1f

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

drivers/acpi/scan.c

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,41 +1505,38 @@ static void acpi_init_coherency(struct acpi_device *adev)
15051505
adev->flags.coherent_dma = cca;
15061506
}
15071507

1508-
static int acpi_check_spi_i2c_slave(struct acpi_resource *ares, void *data)
1508+
static int acpi_check_serial_bus_slave(struct acpi_resource *ares, void *data)
15091509
{
1510-
bool *is_spi_i2c_slave_p = data;
1510+
bool *is_serial_bus_slave_p = data;
15111511

15121512
if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
15131513
return 1;
15141514

1515-
/*
1516-
* devices that are connected to UART still need to be enumerated to
1517-
* platform bus
1518-
*/
1519-
if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART)
1520-
*is_spi_i2c_slave_p = true;
1515+
*is_serial_bus_slave_p = true;
15211516

15221517
/* no need to do more checking */
15231518
return -1;
15241519
}
15251520

1526-
static bool acpi_is_spi_i2c_slave(struct acpi_device *device)
1521+
static bool acpi_is_serial_bus_slave(struct acpi_device *device)
15271522
{
15281523
struct list_head resource_list;
1529-
bool is_spi_i2c_slave = false;
1524+
bool is_serial_bus_slave = false;
15301525

15311526
/* Macs use device properties in lieu of _CRS resources */
15321527
if (x86_apple_machine &&
15331528
(fwnode_property_present(&device->fwnode, "spiSclkPeriod") ||
1534-
fwnode_property_present(&device->fwnode, "i2cAddress")))
1529+
fwnode_property_present(&device->fwnode, "i2cAddress") ||
1530+
fwnode_property_present(&device->fwnode, "baud")))
15351531
return true;
15361532

15371533
INIT_LIST_HEAD(&resource_list);
1538-
acpi_dev_get_resources(device, &resource_list, acpi_check_spi_i2c_slave,
1539-
&is_spi_i2c_slave);
1534+
acpi_dev_get_resources(device, &resource_list,
1535+
acpi_check_serial_bus_slave,
1536+
&is_serial_bus_slave);
15401537
acpi_dev_free_resource_list(&resource_list);
15411538

1542-
return is_spi_i2c_slave;
1539+
return is_serial_bus_slave;
15431540
}
15441541

15451542
void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
@@ -1557,7 +1554,7 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
15571554
acpi_bus_get_flags(device);
15581555
device->flags.match_driver = false;
15591556
device->flags.initialized = true;
1560-
device->flags.spi_i2c_slave = acpi_is_spi_i2c_slave(device);
1557+
device->flags.serial_bus_slave = acpi_is_serial_bus_slave(device);
15611558
acpi_device_clear_enumerated(device);
15621559
device_initialize(&device->dev);
15631560
dev_set_uevent_suppress(&device->dev, true);
@@ -1841,10 +1838,10 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used,
18411838
static void acpi_default_enumeration(struct acpi_device *device)
18421839
{
18431840
/*
1844-
* Do not enumerate SPI/I2C slaves as they will be enumerated by their
1845-
* respective parents.
1841+
* Do not enumerate SPI/I2C/UART slaves as they will be enumerated by
1842+
* their respective parents.
18461843
*/
1847-
if (!device->flags.spi_i2c_slave) {
1844+
if (!device->flags.serial_bus_slave) {
18481845
acpi_create_platform_device(device, NULL);
18491846
acpi_device_set_enumerated(device);
18501847
} else {
@@ -1941,7 +1938,7 @@ static void acpi_bus_attach(struct acpi_device *device)
19411938
return;
19421939

19431940
device->flags.match_driver = true;
1944-
if (ret > 0 && !device->flags.spi_i2c_slave) {
1941+
if (ret > 0 && !device->flags.serial_bus_slave) {
19451942
acpi_device_set_enumerated(device);
19461943
goto ok;
19471944
}
@@ -1950,7 +1947,7 @@ static void acpi_bus_attach(struct acpi_device *device)
19501947
if (ret < 0)
19511948
return;
19521949

1953-
if (!device->pnp.type.platform_id && !device->flags.spi_i2c_slave)
1950+
if (!device->pnp.type.platform_id && !device->flags.serial_bus_slave)
19541951
acpi_device_set_enumerated(device);
19551952
else
19561953
acpi_default_enumeration(device);

include/acpi/acpi_bus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ struct acpi_device_flags {
211211
u32 of_compatible_ok:1;
212212
u32 coherent_dma:1;
213213
u32 cca_seen:1;
214-
u32 spi_i2c_slave:1;
214+
u32 serial_bus_slave:1;
215215
u32 reserved:19;
216216
};
217217

0 commit comments

Comments
 (0)