diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-10-01 19:35:42 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-10-01 19:35:42 -0400 |
commit | 52ff5adc1f942008a790d6f964dec13793480c27 (patch) | |
tree | d45ebe69cee9706eaedf0f149d4050114c3aa021 | |
parent | 08895a8b6b06ed2323cd97a36ee40a116b3db8ed (diff) | |
parent | 20a875e2e86e73d13ec256781a7d55a7885868ec (diff) |
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
-rw-r--r-- | drivers/acpi/acpi_apd.c | 15 | ||||
-rw-r--r-- | drivers/acpi/acpi_lpss.c | 17 | ||||
-rw-r--r-- | drivers/base/core.c | 1 | ||||
-rw-r--r-- | drivers/tty/serial/8250/8250_dw.c | 15 |
4 files changed, 43 insertions, 5 deletions
diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c index 1daf9c46df8e..5f112d811e42 100644 --- a/drivers/acpi/acpi_apd.c +++ b/drivers/acpi/acpi_apd.c | |||
@@ -42,6 +42,7 @@ struct apd_private_data; | |||
42 | struct apd_device_desc { | 42 | struct apd_device_desc { |
43 | unsigned int flags; | 43 | unsigned int flags; |
44 | unsigned int fixed_clk_rate; | 44 | unsigned int fixed_clk_rate; |
45 | struct property_entry *properties; | ||
45 | int (*setup)(struct apd_private_data *pdata); | 46 | int (*setup)(struct apd_private_data *pdata); |
46 | }; | 47 | }; |
47 | 48 | ||
@@ -76,9 +77,17 @@ static struct apd_device_desc cz_i2c_desc = { | |||
76 | .fixed_clk_rate = 133000000, | 77 | .fixed_clk_rate = 133000000, |
77 | }; | 78 | }; |
78 | 79 | ||
80 | static struct property_entry uart_properties[] = { | ||
81 | PROPERTY_ENTRY_U32("reg-io-width", 4), | ||
82 | PROPERTY_ENTRY_U32("reg-shift", 2), | ||
83 | PROPERTY_ENTRY_BOOL("snps,uart-16550-compatible"), | ||
84 | { }, | ||
85 | }; | ||
86 | |||
79 | static struct apd_device_desc cz_uart_desc = { | 87 | static struct apd_device_desc cz_uart_desc = { |
80 | .setup = acpi_apd_setup, | 88 | .setup = acpi_apd_setup, |
81 | .fixed_clk_rate = 48000000, | 89 | .fixed_clk_rate = 48000000, |
90 | .properties = uart_properties, | ||
82 | }; | 91 | }; |
83 | #endif | 92 | #endif |
84 | 93 | ||
@@ -125,6 +134,12 @@ static int acpi_apd_create_device(struct acpi_device *adev, | |||
125 | goto err_out; | 134 | goto err_out; |
126 | } | 135 | } |
127 | 136 | ||
137 | if (dev_desc->properties) { | ||
138 | ret = device_add_properties(&adev->dev, dev_desc->properties); | ||
139 | if (ret) | ||
140 | goto err_out; | ||
141 | } | ||
142 | |||
128 | adev->driver_data = pdata; | 143 | adev->driver_data = pdata; |
129 | pdev = acpi_create_platform_device(adev); | 144 | pdev = acpi_create_platform_device(adev); |
130 | if (!IS_ERR_OR_NULL(pdev)) | 145 | if (!IS_ERR_OR_NULL(pdev)) |
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 357a0b8f860b..552010288135 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -75,6 +75,7 @@ struct lpss_device_desc { | |||
75 | const char *clk_con_id; | 75 | const char *clk_con_id; |
76 | unsigned int prv_offset; | 76 | unsigned int prv_offset; |
77 | size_t prv_size_override; | 77 | size_t prv_size_override; |
78 | struct property_entry *properties; | ||
78 | void (*setup)(struct lpss_private_data *pdata); | 79 | void (*setup)(struct lpss_private_data *pdata); |
79 | }; | 80 | }; |
80 | 81 | ||
@@ -163,11 +164,19 @@ static const struct lpss_device_desc lpt_i2c_dev_desc = { | |||
163 | .prv_offset = 0x800, | 164 | .prv_offset = 0x800, |
164 | }; | 165 | }; |
165 | 166 | ||
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 | |||
166 | static const struct lpss_device_desc lpt_uart_dev_desc = { | 174 | static const struct lpss_device_desc lpt_uart_dev_desc = { |
167 | .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_LTR, | 175 | .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_LTR, |
168 | .clk_con_id = "baudclk", | 176 | .clk_con_id = "baudclk", |
169 | .prv_offset = 0x800, | 177 | .prv_offset = 0x800, |
170 | .setup = lpss_uart_setup, | 178 | .setup = lpss_uart_setup, |
179 | .properties = uart_properties, | ||
171 | }; | 180 | }; |
172 | 181 | ||
173 | static const struct lpss_device_desc lpt_sdio_dev_desc = { | 182 | 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 | .clk_con_id = "baudclk", | 198 | .clk_con_id = "baudclk", |
190 | .prv_offset = 0x800, | 199 | .prv_offset = 0x800, |
191 | .setup = lpss_uart_setup, | 200 | .setup = lpss_uart_setup, |
201 | .properties = uart_properties, | ||
192 | }; | 202 | }; |
193 | 203 | ||
194 | static const struct lpss_device_desc bsw_uart_dev_desc = { | 204 | 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 | .clk_con_id = "baudclk", | 207 | .clk_con_id = "baudclk", |
198 | .prv_offset = 0x800, | 208 | .prv_offset = 0x800, |
199 | .setup = lpss_uart_setup, | 209 | .setup = lpss_uart_setup, |
210 | .properties = uart_properties, | ||
200 | }; | 211 | }; |
201 | 212 | ||
202 | static const struct lpss_device_desc byt_spi_dev_desc = { | 213 | 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 | goto err_out; | 451 | goto err_out; |
441 | } | 452 | } |
442 | 453 | ||
454 | if (dev_desc->properties) { | ||
455 | ret = device_add_properties(&adev->dev, dev_desc->properties); | ||
456 | if (ret) | ||
457 | goto err_out; | ||
458 | } | ||
459 | |||
443 | adev->driver_data = pdata; | 460 | adev->driver_data = pdata; |
444 | pdev = acpi_create_platform_device(adev); | 461 | pdev = acpi_create_platform_device(adev); |
445 | if (!IS_ERR_OR_NULL(pdev)) { | 462 | if (!IS_ERR_OR_NULL(pdev)) { |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 0a8bdade53f2..70c5be5b03a7 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -1266,6 +1266,7 @@ void device_del(struct device *dev) | |||
1266 | bus_remove_device(dev); | 1266 | bus_remove_device(dev); |
1267 | device_pm_remove(dev); | 1267 | device_pm_remove(dev); |
1268 | driver_deferred_probe_del(dev); | 1268 | driver_deferred_probe_del(dev); |
1269 | device_remove_properties(dev); | ||
1269 | 1270 | ||
1270 | /* Notify the platform of the removal, in case they | 1271 | /* Notify the platform of the removal, in case they |
1271 | * need to do anything... | 1272 | * need to do anything... |
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index e19969614203..5c0c123565ad 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c | |||
@@ -298,12 +298,17 @@ static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data) | |||
298 | p->serial_out = dw8250_serial_out32be; | 298 | p->serial_out = dw8250_serial_out32be; |
299 | } | 299 | } |
300 | } else if (has_acpi_companion(p->dev)) { | 300 | } else if (has_acpi_companion(p->dev)) { |
301 | p->iotype = UPIO_MEM32; | 301 | const struct acpi_device_id *id; |
302 | p->regshift = 2; | 302 | |
303 | p->serial_in = dw8250_serial_in32; | 303 | id = acpi_match_device(p->dev->driver->acpi_match_table, |
304 | p->dev); | ||
305 | if (id && !strcmp(id->id, "APMC0D08")) { | ||
306 | p->iotype = UPIO_MEM32; | ||
307 | p->regshift = 2; | ||
308 | p->serial_in = dw8250_serial_in32; | ||
309 | data->uart_16550_compatible = true; | ||
310 | } | ||
304 | p->set_termios = dw8250_set_termios; | 311 | p->set_termios = dw8250_set_termios; |
305 | /* So far none of there implement the Busy Functionality */ | ||
306 | data->uart_16550_compatible = true; | ||
307 | } | 312 | } |
308 | 313 | ||
309 | /* Platforms with iDMA */ | 314 | /* Platforms with iDMA */ |