[PATCH 7/7] serial: samsung: Get default port register settings from device tree

Thomas Abraham thomas.abraham at linaro.org
Fri Feb 18 01:09:52 EST 2011


Hi Grant,

On 17 February 2011 05:56, Grant Likely <grant.likely at secretlab.ca> wrote:
> 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.

The above configuration is obtained from the uart device tree node
(dev->dev.of_node).

>
> Also, don't forget to add binding documentation do
> Documentation/devicetree/bindings for the properties that you define
> for the samsung uart.

Ok. The documentation will be added.

Thanks,
Thomas.

>
> g.
>
>


More information about the devicetree-discuss mailing list