diff mbox

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

Message ID 1297514825-10345-8-git-send-email-thomas.abraham@linaro.org
State New
Headers show

Commit Message

thomas.abraham@linaro.org Feb. 12, 2011, 12:47 p.m. UTC
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@linaro.org>
---
 drivers/tty/serial/samsung.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

Comments

Grant Likely Feb. 17, 2011, 12:26 a.m. UTC | #1
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@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.
thomas.abraham@linaro.org Feb. 17, 2011, 2:09 p.m. UTC | #2
Hi Grant,

On 17 February 2011 05:56, Grant Likely <grant.likely@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@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.
>
>
Grant Likely Feb. 17, 2011, 4:56 p.m. UTC | #3
On Thu, Feb 17, 2011 at 7:09 AM, Thomas Abraham
<thomas.abraham@linaro.org> wrote:
> Hi Grant,
>
> On 17 February 2011 05:56, Grant Likely <grant.likely@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@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).

Sorry for the noise, I wasn't paying enough attention here and I got confused.

g.
diff mbox

Patch

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]);
+		}
+	}
+
 	ourport = &s3c24xx_serial_ports[probe_index];
 	probe_index++;