Skip to content

Commit a5565cf

Browse files
Heikki Krogerusrafaeljw
authored andcommitted
ACPI / LPSS: Provide build-in properties of the UART
The UART driver, dw8250.c, needs some details regarding the Designware UART. For ACPI enumerated devices the values are hard-coded, but since the driver also reads the values from device properties, providing them with build-in properties. This allows us to later remove the hard-coded values from the driver. Signed-off-by: Heikki Krogerus <[email protected]> Acked-by: Mika Westerberg <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 7ff55d1 commit a5565cf

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

drivers/acpi/acpi_lpss.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ struct lpss_device_desc {
7575
const char *clk_con_id;
7676
unsigned int prv_offset;
7777
size_t prv_size_override;
78+
struct property_entry *properties;
7879
void (*setup)(struct lpss_private_data *pdata);
7980
};
8081

@@ -163,11 +164,19 @@ static const struct lpss_device_desc lpt_i2c_dev_desc = {
163164
.prv_offset = 0x800,
164165
};
165166

167+
static struct property_entry uart_properties[] = {
168+
PROPERTY_ENTRY_U32("reg-io-width", 4),
169+
PROPERTY_ENTRY_U32("reg-shift", 2),
170+
PROPERTY_ENTRY_BOOL("snps,uart-16550-compatible"),
171+
{ },
172+
};
173+
166174
static const struct lpss_device_desc lpt_uart_dev_desc = {
167175
.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_LTR,
168176
.clk_con_id = "baudclk",
169177
.prv_offset = 0x800,
170178
.setup = lpss_uart_setup,
179+
.properties = uart_properties,
171180
};
172181

173182
static const struct lpss_device_desc lpt_sdio_dev_desc = {
@@ -189,6 +198,7 @@ static const struct lpss_device_desc byt_uart_dev_desc = {
189198
.clk_con_id = "baudclk",
190199
.prv_offset = 0x800,
191200
.setup = lpss_uart_setup,
201+
.properties = uart_properties,
192202
};
193203

194204
static const struct lpss_device_desc bsw_uart_dev_desc = {
@@ -197,6 +207,7 @@ static const struct lpss_device_desc bsw_uart_dev_desc = {
197207
.clk_con_id = "baudclk",
198208
.prv_offset = 0x800,
199209
.setup = lpss_uart_setup,
210+
.properties = uart_properties,
200211
};
201212

202213
static const struct lpss_device_desc byt_spi_dev_desc = {
@@ -440,6 +451,12 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
440451
goto err_out;
441452
}
442453

454+
if (dev_desc->properties) {
455+
ret = device_add_properties(&adev->dev, dev_desc->properties);
456+
if (ret)
457+
goto err_out;
458+
}
459+
443460
adev->driver_data = pdata;
444461
pdev = acpi_create_platform_device(adev);
445462
if (!IS_ERR_OR_NULL(pdev)) {

0 commit comments

Comments
 (0)