[PATCH 7/7] serial: samsung: Get default port register settings from device tree
Grant Likely
grant.likely at secretlab.ca
Thu Feb 17 11:26:17 EST 2011
On Sat, Feb 12, 2011 at 06:17:05PM +0530, Thomas Abraham wrote:
> The default uart port register settings are obtained from the platform data.
> In addition to that, this patch adds support for obtaining the default uart port
> register values from the uart node in device tree.
>
> Signed-off-by: Thomas Abraham <thomas.abraham at linaro.org>
> ---
> drivers/tty/serial/samsung.c | 13 +++++++++++++
> 1 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
> index 66fece9..dda1d52 100644
> --- a/drivers/tty/serial/samsung.c
> +++ b/drivers/tty/serial/samsung.c
> @@ -1148,9 +1148,22 @@ int s3c24xx_serial_probe(struct platform_device *dev,
> {
> struct s3c24xx_uart_port *ourport;
> int ret;
> + unsigned int len, *regdef;
> + struct s3c2410_uartcfg *cfg;
>
> dbg("s3c24xx_serial_probe(%p, %p) %d\n", dev, info, probe_index);
>
> + if (dev->dev.of_node) {
> + regdef = (u32 *)of_get_property(dev->dev.of_node,
> + "reg-defaults", &len);
> + if (regdef && (len / sizeof(unsigned int)) == 3) {
> + cfg = s3c24xx_dev_to_cfg(&dev->dev);
> + cfg->ucon = be32_to_cpu(regdef[0]);
> + cfg->ulcon = be32_to_cpu(regdef[1]);
> + cfg->ufcon = be32_to_cpu(regdef[2]);
> + }
> + }
> +
Same comment as before, per-uart configuration belongs in each ports
device tree node.
Also, don't forget to add binding documentation do
Documentation/devicetree/bindings for the properties that you define
for the samsung uart.
g.
More information about the devicetree-discuss
mailing list