* [PATCHv2 1/3] ACPI / APD: Provide build-in properties of the UART
2016-08-23 8:33 [PATCHv2 0/3] serial: dw8250: ACPI tuning Heikki Krogerus
@ 2016-08-23 8:33 ` Heikki Krogerus
2016-08-23 8:33 ` [PATCHv2 2/3] ACPI / LPSS: " Heikki Krogerus
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Heikki Krogerus @ 2016-08-23 8:33 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki
Cc: Andy Shevchenko, Kefeng Wang, linux-serial, linux-acpi, Ken Xue
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 <heikki.krogerus@linux.intel.com>
Cc: Ken Xue <Ken.Xue@amd.com>
---
drivers/acpi/acpi_apd.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c
index c80c8f8..1f30fff 100644
--- a/drivers/acpi/acpi_apd.c
+++ b/drivers/acpi/acpi_apd.c
@@ -42,6 +42,7 @@ struct apd_private_data;
struct apd_device_desc {
unsigned int flags;
unsigned int fixed_clk_rate;
+ struct property_entry *properties;
int (*setup)(struct apd_private_data *pdata);
};
@@ -76,9 +77,17 @@ static struct apd_device_desc cz_i2c_desc = {
.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 = {
.setup = acpi_apd_setup,
.fixed_clk_rate = 48000000,
+ .properties = uart_properties,
};
#endif
@@ -130,6 +139,12 @@ static int acpi_apd_create_device(struct acpi_device *adev,
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;
pdev = acpi_create_platform_device(adev);
if (!IS_ERR_OR_NULL(pdev))
--
2.8.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCHv2 2/3] ACPI / LPSS: Provide build-in properties of the UART
2016-08-23 8:33 [PATCHv2 0/3] serial: dw8250: ACPI tuning Heikki Krogerus
2016-08-23 8:33 ` [PATCHv2 1/3] ACPI / APD: Provide build-in properties of the UART Heikki Krogerus
@ 2016-08-23 8:33 ` Heikki Krogerus
2016-08-23 8:33 ` [PATCHv2 3/3] serial: 8250_dw: Add quirk for APM X-Gene SoC Heikki Krogerus
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Heikki Krogerus @ 2016-08-23 8:33 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki
Cc: Andy Shevchenko, Kefeng Wang, linux-serial, linux-acpi
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 <heikki.krogerus@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
drivers/acpi/acpi_lpss.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index 357a0b8..5520102 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -75,6 +75,7 @@ struct lpss_device_desc {
const char *clk_con_id;
unsigned int prv_offset;
size_t prv_size_override;
+ struct property_entry *properties;
void (*setup)(struct lpss_private_data *pdata);
};
@@ -163,11 +164,19 @@ static const struct lpss_device_desc lpt_i2c_dev_desc = {
.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 = {
.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_LTR,
.clk_con_id = "baudclk",
.prv_offset = 0x800,
.setup = lpss_uart_setup,
+ .properties = uart_properties,
};
static const struct lpss_device_desc lpt_sdio_dev_desc = {
@@ -189,6 +198,7 @@ static const struct lpss_device_desc byt_uart_dev_desc = {
.clk_con_id = "baudclk",
.prv_offset = 0x800,
.setup = lpss_uart_setup,
+ .properties = uart_properties,
};
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",
.prv_offset = 0x800,
.setup = lpss_uart_setup,
+ .properties = uart_properties,
};
static const struct lpss_device_desc byt_spi_dev_desc = {
@@ -440,6 +451,12 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
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;
pdev = acpi_create_platform_device(adev);
if (!IS_ERR_OR_NULL(pdev)) {
--
2.8.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCHv2 3/3] serial: 8250_dw: Add quirk for APM X-Gene SoC
2016-08-23 8:33 [PATCHv2 0/3] serial: dw8250: ACPI tuning Heikki Krogerus
2016-08-23 8:33 ` [PATCHv2 1/3] ACPI / APD: Provide build-in properties of the UART Heikki Krogerus
2016-08-23 8:33 ` [PATCHv2 2/3] ACPI / LPSS: " Heikki Krogerus
@ 2016-08-23 8:33 ` Heikki Krogerus
2016-08-31 14:16 ` Greg Kroah-Hartman
2016-08-25 12:47 ` [PATCHv2 0/3] serial: dw8250: ACPI tuning Andy Shevchenko
2016-09-12 22:11 ` Rafael J. Wysocki
4 siblings, 1 reply; 7+ messages in thread
From: Heikki Krogerus @ 2016-08-23 8:33 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki
Cc: Andy Shevchenko, Kefeng Wang, linux-serial, linux-acpi, Feng Kan
The APM X-Gene SoC UART is the only board that still needs
the hard-coded values, so handle it separately in
dw8250_quirks(). The other ACPI platforms are able to
provide the values with device properties.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Feng Kan <fkan@apm.com>
---
drivers/tty/serial/8250/8250_dw.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index e199696..5c0c123 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)
p->serial_out = dw8250_serial_out32be;
}
} else if (has_acpi_companion(p->dev)) {
- p->iotype = UPIO_MEM32;
- p->regshift = 2;
- p->serial_in = dw8250_serial_in32;
+ const struct acpi_device_id *id;
+
+ 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;
- /* So far none of there implement the Busy Functionality */
- data->uart_16550_compatible = true;
}
/* Platforms with iDMA */
--
2.8.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCHv2 3/3] serial: 8250_dw: Add quirk for APM X-Gene SoC
2016-08-23 8:33 ` [PATCHv2 3/3] serial: 8250_dw: Add quirk for APM X-Gene SoC Heikki Krogerus
@ 2016-08-31 14:16 ` Greg Kroah-Hartman
0 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2016-08-31 14:16 UTC (permalink / raw)
To: Heikki Krogerus
Cc: Rafael J. Wysocki, Andy Shevchenko, Kefeng Wang, linux-serial,
linux-acpi, Feng Kan
On Tue, Aug 23, 2016 at 11:33:28AM +0300, Heikki Krogerus wrote:
> The APM X-Gene SoC UART is the only board that still needs
> the hard-coded values, so handle it separately in
> dw8250_quirks(). The other ACPI platforms are able to
> provide the values with device properties.
>
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Cc: Feng Kan <fkan@apm.com>
> ---
> drivers/tty/serial/8250/8250_dw.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCHv2 0/3] serial: dw8250: ACPI tuning
2016-08-23 8:33 [PATCHv2 0/3] serial: dw8250: ACPI tuning Heikki Krogerus
` (2 preceding siblings ...)
2016-08-23 8:33 ` [PATCHv2 3/3] serial: 8250_dw: Add quirk for APM X-Gene SoC Heikki Krogerus
@ 2016-08-25 12:47 ` Andy Shevchenko
2016-09-12 22:11 ` Rafael J. Wysocki
4 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2016-08-25 12:47 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman, Rafael J. Wysocki
Cc: Kefeng Wang, linux-serial, linux-acpi
On Tue, 2016-08-23 at 11:33 +0300, Heikki Krogerus wrote:
> Hi,
>
> Since we now have the build-in properties available, using those when
> ever possible to get the details the driver expects and when they are
> not being provided by the fw. Right now there is only one exception
> ACPI enumerated board where we have no means to provide the properties
> with build-in ones, so simply handling that as an exception in
> dw8250_quirks().
Looks good to me.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Changes since v1:
> - Fix a compiler error in acpi_apd.c found by kbuild test robot
> - ACK from Mika
>
>
> Heikki Krogerus (3):
> ACPI / APD: Provide build-in properties of the UART
> ACPI / LPSS: Provide build-in properties of the UART
> serial: 8250_dw: Add quirk for APM X-Gene SoC
>
> drivers/acpi/acpi_apd.c | 15 +++++++++++++++
> drivers/acpi/acpi_lpss.c | 17 +++++++++++++++++
> drivers/tty/serial/8250/8250_dw.c | 15 ++++++++++-----
> 3 files changed, 42 insertions(+), 5 deletions(-)
>
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCHv2 0/3] serial: dw8250: ACPI tuning
2016-08-23 8:33 [PATCHv2 0/3] serial: dw8250: ACPI tuning Heikki Krogerus
` (3 preceding siblings ...)
2016-08-25 12:47 ` [PATCHv2 0/3] serial: dw8250: ACPI tuning Andy Shevchenko
@ 2016-09-12 22:11 ` Rafael J. Wysocki
4 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2016-09-12 22:11 UTC (permalink / raw)
To: Heikki Krogerus
Cc: Greg Kroah-Hartman, Andy Shevchenko, Kefeng Wang, linux-serial,
linux-acpi
On Tuesday, August 23, 2016 11:33:25 AM Heikki Krogerus wrote:
> Hi,
>
> Since we now have the build-in properties available, using those when
> ever possible to get the details the driver expects and when they are
> not being provided by the fw. Right now there is only one exception
> ACPI enumerated board where we have no means to provide the properties
> with build-in ones, so simply handling that as an exception in
> dw8250_quirks().
>
> Changes since v1:
> - Fix a compiler error in acpi_apd.c found by kbuild test robot
> - ACK from Mika
>
>
> Heikki Krogerus (3):
> ACPI / APD: Provide build-in properties of the UART
> ACPI / LPSS: Provide build-in properties of the UART
> serial: 8250_dw: Add quirk for APM X-Gene SoC
Whole series applied.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 7+ messages in thread