Commit 52ff5adc authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branch 'device-properties'

* device-properties:
  serial: 8250_dw: Add quirk for APM X-Gene SoC
  ACPI / LPSS: Provide build-in properties of the UART
  ACPI / APD: Provide build-in properties of the UART
  driver core: Don't leak secondary fwnode on device removal
parents 08895a8b 20a875e2
...@@ -42,6 +42,7 @@ struct apd_private_data; ...@@ -42,6 +42,7 @@ struct apd_private_data;
struct apd_device_desc { struct apd_device_desc {
unsigned int flags; unsigned int flags;
unsigned int fixed_clk_rate; unsigned int fixed_clk_rate;
struct property_entry *properties;
int (*setup)(struct apd_private_data *pdata); int (*setup)(struct apd_private_data *pdata);
}; };
...@@ -76,9 +77,17 @@ static struct apd_device_desc cz_i2c_desc = { ...@@ -76,9 +77,17 @@ static struct apd_device_desc cz_i2c_desc = {
.fixed_clk_rate = 133000000, .fixed_clk_rate = 133000000,
}; };
static struct property_entry uart_properties[] = {
PROPERTY_ENTRY_U32("reg-io-width", 4),
PROPERTY_ENTRY_U32("reg-shift", 2),
PROPERTY_ENTRY_BOOL("snps,uart-16550-compatible"),
{ },
};
static struct apd_device_desc cz_uart_desc = { static struct apd_device_desc cz_uart_desc = {
.setup = acpi_apd_setup, .setup = acpi_apd_setup,
.fixed_clk_rate = 48000000, .fixed_clk_rate = 48000000,
.properties = uart_properties,
}; };
#endif #endif
...@@ -125,6 +134,12 @@ static int acpi_apd_create_device(struct acpi_device *adev, ...@@ -125,6 +134,12 @@ static int acpi_apd_create_device(struct acpi_device *adev,
goto err_out; goto err_out;
} }
if (dev_desc->properties) {
ret = device_add_properties(&adev->dev, dev_desc->properties);
if (ret)
goto err_out;
}
adev->driver_data = pdata; adev->driver_data = pdata;
pdev = acpi_create_platform_device(adev); pdev = acpi_create_platform_device(adev);
if (!IS_ERR_OR_NULL(pdev)) if (!IS_ERR_OR_NULL(pdev))
......
...@@ -75,6 +75,7 @@ struct lpss_device_desc { ...@@ -75,6 +75,7 @@ struct lpss_device_desc {
const char *clk_con_id; const char *clk_con_id;
unsigned int prv_offset; unsigned int prv_offset;
size_t prv_size_override; size_t prv_size_override;
struct property_entry *properties;
void (*setup)(struct lpss_private_data *pdata); void (*setup)(struct lpss_private_data *pdata);
}; };
...@@ -163,11 +164,19 @@ static const struct lpss_device_desc lpt_i2c_dev_desc = { ...@@ -163,11 +164,19 @@ static const struct lpss_device_desc lpt_i2c_dev_desc = {
.prv_offset = 0x800, .prv_offset = 0x800,
}; };
static struct property_entry uart_properties[] = {
PROPERTY_ENTRY_U32("reg-io-width", 4),
PROPERTY_ENTRY_U32("reg-shift", 2),
PROPERTY_ENTRY_BOOL("snps,uart-16550-compatible"),
{ },
};
static const struct lpss_device_desc lpt_uart_dev_desc = { static const struct lpss_device_desc lpt_uart_dev_desc = {
.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_LTR, .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_LTR,
.clk_con_id = "baudclk", .clk_con_id = "baudclk",
.prv_offset = 0x800, .prv_offset = 0x800,
.setup = lpss_uart_setup, .setup = lpss_uart_setup,
.properties = uart_properties,
}; };
static const struct lpss_device_desc lpt_sdio_dev_desc = { static const struct lpss_device_desc lpt_sdio_dev_desc = {
...@@ -189,6 +198,7 @@ static const struct lpss_device_desc byt_uart_dev_desc = { ...@@ -189,6 +198,7 @@ static const struct lpss_device_desc byt_uart_dev_desc = {
.clk_con_id = "baudclk", .clk_con_id = "baudclk",
.prv_offset = 0x800, .prv_offset = 0x800,
.setup = lpss_uart_setup, .setup = lpss_uart_setup,
.properties = uart_properties,
}; };
static const struct lpss_device_desc bsw_uart_dev_desc = { static const struct lpss_device_desc bsw_uart_dev_desc = {
...@@ -197,6 +207,7 @@ static const struct lpss_device_desc bsw_uart_dev_desc = { ...@@ -197,6 +207,7 @@ static const struct lpss_device_desc bsw_uart_dev_desc = {
.clk_con_id = "baudclk", .clk_con_id = "baudclk",
.prv_offset = 0x800, .prv_offset = 0x800,
.setup = lpss_uart_setup, .setup = lpss_uart_setup,
.properties = uart_properties,
}; };
static const struct lpss_device_desc byt_spi_dev_desc = { static const struct lpss_device_desc byt_spi_dev_desc = {
...@@ -440,6 +451,12 @@ static int acpi_lpss_create_device(struct acpi_device *adev, ...@@ -440,6 +451,12 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
goto err_out; goto err_out;
} }
if (dev_desc->properties) {
ret = device_add_properties(&adev->dev, dev_desc->properties);
if (ret)
goto err_out;
}
adev->driver_data = pdata; adev->driver_data = pdata;
pdev = acpi_create_platform_device(adev); pdev = acpi_create_platform_device(adev);
if (!IS_ERR_OR_NULL(pdev)) { if (!IS_ERR_OR_NULL(pdev)) {
......
...@@ -1266,6 +1266,7 @@ void device_del(struct device *dev) ...@@ -1266,6 +1266,7 @@ void device_del(struct device *dev)
bus_remove_device(dev); bus_remove_device(dev);
device_pm_remove(dev); device_pm_remove(dev);
driver_deferred_probe_del(dev); driver_deferred_probe_del(dev);
device_remove_properties(dev);
/* Notify the platform of the removal, in case they /* Notify the platform of the removal, in case they
* need to do anything... * need to do anything...
......
...@@ -298,12 +298,17 @@ static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data) ...@@ -298,12 +298,17 @@ static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data)
p->serial_out = dw8250_serial_out32be; p->serial_out = dw8250_serial_out32be;
} }
} else if (has_acpi_companion(p->dev)) { } else if (has_acpi_companion(p->dev)) {
p->iotype = UPIO_MEM32; const struct acpi_device_id *id;
p->regshift = 2;
p->serial_in = dw8250_serial_in32; id = acpi_match_device(p->dev->driver->acpi_match_table,
p->dev);
if (id && !strcmp(id->id, "APMC0D08")) {
p->iotype = UPIO_MEM32;
p->regshift = 2;
p->serial_in = dw8250_serial_in32;
data->uart_16550_compatible = true;
}
p->set_termios = dw8250_set_termios; p->set_termios = dw8250_set_termios;
/* So far none of there implement the Busy Functionality */
data->uart_16550_compatible = true;
} }
/* Platforms with iDMA */ /* Platforms with iDMA */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment