* [PATCH 0/3] serial: dw8250: ACPI tuning
@ 2016-08-22 14:24 Heikki Krogerus
2016-08-22 14:24 ` [PATCH 1/3] ACPI / APD: Provide build-in properties of the UART Heikki Krogerus
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Heikki Krogerus @ 2016-08-22 14:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki
Cc: Andy Shevchenko, Kefeng Wang, linux-serial, linux-acpi
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().
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 | 12 ++++++++++++
drivers/acpi/acpi_lpss.c | 17 +++++++++++++++++
drivers/tty/serial/8250/8250_dw.c | 15 ++++++++++-----
3 files changed, 39 insertions(+), 5 deletions(-)
--
2.8.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] ACPI / APD: Provide build-in properties of the UART
2016-08-22 14:24 [PATCH 0/3] serial: dw8250: ACPI tuning Heikki Krogerus
@ 2016-08-22 14:24 ` Heikki Krogerus
2016-08-22 15:00 ` kbuild test robot
2016-08-22 16:01 ` kbuild test robot
2016-08-22 14:24 ` [PATCH 2/3] ACPI / LPSS: " Heikki Krogerus
2016-08-22 14:24 ` [PATCH 3/3] serial: 8250_dw: Add quirk for APM X-Gene SoC Heikki Krogerus
2 siblings, 2 replies; 8+ messages in thread
From: Heikki Krogerus @ 2016-08-22 14:24 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 | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c
index c80c8f8..a51dbef 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);
};
@@ -67,6 +68,9 @@ static int acpi_apd_setup(struct apd_private_data *pdata)
pdata->clk = clk;
}
+ if (pdata->properties)
+ return device_add_properties(&pdata->adev->dev,
+ pdata->properties);
return 0;
}
@@ -76,9 +80,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
--
2.8.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] ACPI / LPSS: Provide build-in properties of the UART
2016-08-22 14:24 [PATCH 0/3] serial: dw8250: ACPI tuning Heikki Krogerus
2016-08-22 14:24 ` [PATCH 1/3] ACPI / APD: Provide build-in properties of the UART Heikki Krogerus
@ 2016-08-22 14:24 ` Heikki Krogerus
2016-08-23 7:03 ` Mika Westerberg
2016-08-22 14:24 ` [PATCH 3/3] serial: 8250_dw: Add quirk for APM X-Gene SoC Heikki Krogerus
2 siblings, 1 reply; 8+ messages in thread
From: Heikki Krogerus @ 2016-08-22 14:24 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki
Cc: Andy Shevchenko, Kefeng Wang, linux-serial, linux-acpi,
Mika Westerberg
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: 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] 8+ messages in thread
* [PATCH 3/3] serial: 8250_dw: Add quirk for APM X-Gene SoC
2016-08-22 14:24 [PATCH 0/3] serial: dw8250: ACPI tuning Heikki Krogerus
2016-08-22 14:24 ` [PATCH 1/3] ACPI / APD: Provide build-in properties of the UART Heikki Krogerus
2016-08-22 14:24 ` [PATCH 2/3] ACPI / LPSS: " Heikki Krogerus
@ 2016-08-22 14:24 ` Heikki Krogerus
2 siblings, 0 replies; 8+ messages in thread
From: Heikki Krogerus @ 2016-08-22 14:24 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] 8+ messages in thread
* Re: [PATCH 1/3] ACPI / APD: Provide build-in properties of the UART
2016-08-22 14:24 ` [PATCH 1/3] ACPI / APD: Provide build-in properties of the UART Heikki Krogerus
@ 2016-08-22 15:00 ` kbuild test robot
2016-08-23 6:37 ` Heikki Krogerus
2016-08-22 16:01 ` kbuild test robot
1 sibling, 1 reply; 8+ messages in thread
From: kbuild test robot @ 2016-08-22 15:00 UTC (permalink / raw)
To: Heikki Krogerus
Cc: kbuild-all, Greg Kroah-Hartman, Rafael J. Wysocki,
Andy Shevchenko, Kefeng Wang, linux-serial, linux-acpi, Ken Xue
[-- Attachment #1: Type: text/plain, Size: 1799 bytes --]
Hi Heikki,
[auto build test ERROR on pm/linux-next]
[also build test ERROR on v4.8-rc3 next-20160822]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]
url: https://github.com/0day-ci/linux/commits/Heikki-Krogerus/ACPI-APD-Provide-build-in-properties-of-the-UART/20160822-222543
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-x016-201634 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/acpi/acpi_apd.c: In function 'acpi_apd_setup':
>> drivers/acpi/acpi_apd.c:71:11: error: 'struct apd_private_data' has no member named 'properties'
if (pdata->properties)
^~
drivers/acpi/acpi_apd.c:73:16: error: 'struct apd_private_data' has no member named 'properties'
pdata->properties);
^~
vim +71 drivers/acpi/acpi_apd.c
65 dev_name(&pdata->adev->dev),
66 NULL, 0, dev_desc->fixed_clk_rate);
67 clk_register_clkdev(clk, NULL, dev_name(&pdata->adev->dev));
68 pdata->clk = clk;
69 }
70
> 71 if (pdata->properties)
72 return device_add_properties(&pdata->adev->dev,
73 pdata->properties);
74 return 0;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 32267 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] ACPI / APD: Provide build-in properties of the UART
2016-08-22 14:24 ` [PATCH 1/3] ACPI / APD: Provide build-in properties of the UART Heikki Krogerus
2016-08-22 15:00 ` kbuild test robot
@ 2016-08-22 16:01 ` kbuild test robot
1 sibling, 0 replies; 8+ messages in thread
From: kbuild test robot @ 2016-08-22 16:01 UTC (permalink / raw)
To: Heikki Krogerus
Cc: kbuild-all, Greg Kroah-Hartman, Rafael J. Wysocki,
Andy Shevchenko, Kefeng Wang, linux-serial, linux-acpi, Ken Xue
[-- Attachment #1: Type: text/plain, Size: 5374 bytes --]
Hi Heikki,
[auto build test WARNING on pm/linux-next]
[also build test WARNING on v4.8-rc3 next-20160822]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]
url: https://github.com/0day-ci/linux/commits/Heikki-Krogerus/ACPI-APD-Provide-build-in-properties-of-the-UART/20160822-222543
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: i386-randconfig-s1-201634 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/io.h:21,
from include/linux/clk-provider.h:14,
from drivers/acpi/acpi_apd.c:13:
drivers/acpi/acpi_apd.c: In function 'acpi_apd_setup':
drivers/acpi/acpi_apd.c:71:11: error: 'struct apd_private_data' has no member named 'properties'
if (pdata->properties)
^
include/linux/compiler.h:149:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
>> drivers/acpi/acpi_apd.c:71:2: note: in expansion of macro 'if'
if (pdata->properties)
^~
drivers/acpi/acpi_apd.c:71:11: error: 'struct apd_private_data' has no member named 'properties'
if (pdata->properties)
^
include/linux/compiler.h:149:42: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
>> drivers/acpi/acpi_apd.c:71:2: note: in expansion of macro 'if'
if (pdata->properties)
^~
drivers/acpi/acpi_apd.c:71:11: error: 'struct apd_private_data' has no member named 'properties'
if (pdata->properties)
^
include/linux/compiler.h:160:16: note: in definition of macro '__trace_if'
______r = !!(cond); \
^~~~
>> drivers/acpi/acpi_apd.c:71:2: note: in expansion of macro 'if'
if (pdata->properties)
^~
drivers/acpi/acpi_apd.c:73:16: error: 'struct apd_private_data' has no member named 'properties'
pdata->properties);
^~
vim +/if +71 drivers/acpi/acpi_apd.c
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
> 13 #include <linux/clk-provider.h>
14 #include <linux/platform_device.h>
15 #include <linux/pm_domain.h>
16 #include <linux/clkdev.h>
17 #include <linux/acpi.h>
18 #include <linux/err.h>
19 #include <linux/pm.h>
20
21 #include "internal.h"
22
23 ACPI_MODULE_NAME("acpi_apd");
24 struct apd_private_data;
25
26 /**
27 * ACPI_APD_SYSFS : add device attributes in sysfs
28 * ACPI_APD_PM : attach power domain to device
29 */
30 #define ACPI_APD_SYSFS BIT(0)
31 #define ACPI_APD_PM BIT(1)
32
33 /**
34 * struct apd_device_desc - a descriptor for apd device
35 * @flags: device flags like %ACPI_APD_SYSFS, %ACPI_APD_PM
36 * @fixed_clk_rate: fixed rate input clock source for acpi device;
37 * 0 means no fixed rate input clock source
38 * @setup: a hook routine to set device resource during create platform device
39 *
40 * Device description defined as acpi_device_id.driver_data
41 */
42 struct apd_device_desc {
43 unsigned int flags;
44 unsigned int fixed_clk_rate;
45 struct property_entry *properties;
46 int (*setup)(struct apd_private_data *pdata);
47 };
48
49 struct apd_private_data {
50 struct clk *clk;
51 struct acpi_device *adev;
52 const struct apd_device_desc *dev_desc;
53 };
54
55 #if defined(CONFIG_X86_AMD_PLATFORM_DEVICE) || defined(CONFIG_ARM64)
56 #define APD_ADDR(desc) ((unsigned long)&desc)
57
58 static int acpi_apd_setup(struct apd_private_data *pdata)
59 {
60 const struct apd_device_desc *dev_desc = pdata->dev_desc;
61 struct clk *clk = ERR_PTR(-ENODEV);
62
63 if (dev_desc->fixed_clk_rate) {
64 clk = clk_register_fixed_rate(&pdata->adev->dev,
65 dev_name(&pdata->adev->dev),
66 NULL, 0, dev_desc->fixed_clk_rate);
67 clk_register_clkdev(clk, NULL, dev_name(&pdata->adev->dev));
68 pdata->clk = clk;
69 }
70
> 71 if (pdata->properties)
72 return device_add_properties(&pdata->adev->dev,
73 pdata->properties);
74 return 0;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 27218 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] ACPI / APD: Provide build-in properties of the UART
2016-08-22 15:00 ` kbuild test robot
@ 2016-08-23 6:37 ` Heikki Krogerus
0 siblings, 0 replies; 8+ messages in thread
From: Heikki Krogerus @ 2016-08-23 6:37 UTC (permalink / raw)
To: kbuild test robot
Cc: kbuild-all, Greg Kroah-Hartman, Rafael J. Wysocki,
Andy Shevchenko, Kefeng Wang, linux-serial, linux-acpi, Ken Xue
Hi,
On Mon, Aug 22, 2016 at 11:00:49PM +0800, kbuild test robot wrote:
> Hi Heikki,
>
> [auto build test ERROR on pm/linux-next]
> [also build test ERROR on v4.8-rc3 next-20160822]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> [Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
> [Check https://git-scm.com/docs/git-format-patch for more information]
>
> url: https://github.com/0day-ci/linux/commits/Heikki-Krogerus/ACPI-APD-Provide-build-in-properties-of-the-UART/20160822-222543
> base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
> config: x86_64-randconfig-x016-201634 (attached as .config)
> compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64
>
> All errors (new ones prefixed by >>):
>
> drivers/acpi/acpi_apd.c: In function 'acpi_apd_setup':
> >> drivers/acpi/acpi_apd.c:71:11: error: 'struct apd_private_data' has no member named 'properties'
> if (pdata->properties)
> ^~
> drivers/acpi/acpi_apd.c:73:16: error: 'struct apd_private_data' has no member named 'properties'
> pdata->properties);
> ^~
>
> vim +71 drivers/acpi/acpi_apd.c
>
> 65 dev_name(&pdata->adev->dev),
> 66 NULL, 0, dev_desc->fixed_clk_rate);
> 67 clk_register_clkdev(clk, NULL, dev_name(&pdata->adev->dev));
> 68 pdata->clk = clk;
> 69 }
> 70
> > 71 if (pdata->properties)
Thanks, I'll fix it. I did not get compiler error from this? Weird.
Br,
--
heikki
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] ACPI / LPSS: Provide build-in properties of the UART
2016-08-22 14:24 ` [PATCH 2/3] ACPI / LPSS: " Heikki Krogerus
@ 2016-08-23 7:03 ` Mika Westerberg
0 siblings, 0 replies; 8+ messages in thread
From: Mika Westerberg @ 2016-08-23 7:03 UTC (permalink / raw)
To: Heikki Krogerus
Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Andy Shevchenko,
Kefeng Wang, linux-serial, linux-acpi
On Mon, Aug 22, 2016 at 05:24:14PM +0300, Heikki Krogerus wrote:
> 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: Mika Westerberg <mika.westerberg@linux.intel.com>
Good idea.
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-08-23 7:03 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-22 14:24 [PATCH 0/3] serial: dw8250: ACPI tuning Heikki Krogerus
2016-08-22 14:24 ` [PATCH 1/3] ACPI / APD: Provide build-in properties of the UART Heikki Krogerus
2016-08-22 15:00 ` kbuild test robot
2016-08-23 6:37 ` Heikki Krogerus
2016-08-22 16:01 ` kbuild test robot
2016-08-22 14:24 ` [PATCH 2/3] ACPI / LPSS: " Heikki Krogerus
2016-08-23 7:03 ` Mika Westerberg
2016-08-22 14:24 ` [PATCH 3/3] serial: 8250_dw: Add quirk for APM X-Gene SoC Heikki Krogerus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).