* [PATCH 0/3] serial: samsung: get fifosize from DT and clean up
@ 2014-07-14 11:37 ` Naveen Krishna Chatradhi
0 siblings, 0 replies; 10+ messages in thread
From: Naveen Krishna Chatradhi @ 2014-07-14 11:37 UTC (permalink / raw)
To: kgene.kim, linux-samsung-soc, linux-arm-kernel, devicetree
Cc: gregkh, ben-linux, cpgs
This patch set does the following
1: Get fifosize from DT node. But, not mandating it.
2. Corrects the case and default order in a switch
3. Defines a variable to simply the code.
Console messages on Exynos5420 based peach pit and pi works fine.
Naveen Krishna Chatradhi (3):
serial: samsung: get fifosize via device tree
serial: samsung: correct the case and default order in switch
serial: samsung: improve code clarity by defining a variable
.../devicetree/bindings/serial/samsung_uart.txt | 4 ++++
drivers/tty/serial/samsung.c | 19 +++++++++++++------
2 files changed, 17 insertions(+), 6 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 0/3] serial: samsung: get fifosize from DT and clean up
@ 2014-07-14 11:37 ` Naveen Krishna Chatradhi
0 siblings, 0 replies; 10+ messages in thread
From: Naveen Krishna Chatradhi @ 2014-07-14 11:37 UTC (permalink / raw)
To: linux-arm-kernel
This patch set does the following
1: Get fifosize from DT node. But, not mandating it.
2. Corrects the case and default order in a switch
3. Defines a variable to simply the code.
Console messages on Exynos5420 based peach pit and pi works fine.
Naveen Krishna Chatradhi (3):
serial: samsung: get fifosize via device tree
serial: samsung: correct the case and default order in switch
serial: samsung: improve code clarity by defining a variable
.../devicetree/bindings/serial/samsung_uart.txt | 4 ++++
drivers/tty/serial/samsung.c | 19 +++++++++++++------
2 files changed, 17 insertions(+), 6 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/3] serial: samsung: get fifosize via device tree
2014-07-14 11:37 ` Naveen Krishna Chatradhi
@ 2014-07-14 11:37 ` Naveen Krishna Chatradhi
-1 siblings, 0 replies; 10+ messages in thread
From: Naveen Krishna Chatradhi @ 2014-07-14 11:37 UTC (permalink / raw)
To: kgene.kim, linux-samsung-soc, linux-arm-kernel, devicetree
Cc: gregkh, ben-linux, cpgs
UART modules on some SoCs only differ in the fifosize of each
UART channel. Its useless to duplicate the drv_data structure
or create a compatible name for such a change.
We can get fifosize via the device tree nodes (not mandating it).
Also updates the documentation.
Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Cc: gregkh@linuxfoundation.org
---
.../devicetree/bindings/serial/samsung_uart.txt | 4 ++++
drivers/tty/serial/samsung.c | 12 +++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/serial/samsung_uart.txt b/Documentation/devicetree/bindings/serial/samsung_uart.txt
index 85e8ee2..e85f37e 100644
--- a/Documentation/devicetree/bindings/serial/samsung_uart.txt
+++ b/Documentation/devicetree/bindings/serial/samsung_uart.txt
@@ -29,6 +29,9 @@ Required properties:
[1] Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
[2] Documentation/devicetree/bindings/clock/clock-bindings.txt
+Optional properties:
+- samsung,uart-fifosize: The fifo size supported by the UART channel
+
Note: Each Samsung UART should have an alias correctly numbered in the
"aliases" node, according to serialN format, where N is the port number
(non-negative decimal integer) as specified by User's Manual of respective
@@ -51,4 +54,5 @@ Example:
"clk_uart_baud3";
clocks = <&clocks PCLK_UART1>, <&clocks PCLK_UART1>,
<&clocks SCLK_UART>;
+ samsung,uart-fifosize = <16>;
};
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 6be852d..e49a945 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1295,9 +1295,15 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
dev_get_platdata(&pdev->dev) :
ourport->drv_data->def_cfg;
- ourport->port.fifosize = (ourport->info->fifosize) ?
- ourport->info->fifosize :
- ourport->drv_data->fifosize[index];
+ if (pdev->dev.of_node)
+ of_property_read_u32(pdev->dev.of_node,
+ "samsung,uart-fifosize", &ourport->port.fifosize);
+
+ if (!ourport->port.fifosize) {
+ ourport->port.fifosize = (ourport->info->fifosize) ?
+ ourport->info->fifosize :
+ ourport->drv_data->fifosize[index];
+ }
probe_index++;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 1/3] serial: samsung: get fifosize via device tree
@ 2014-07-14 11:37 ` Naveen Krishna Chatradhi
0 siblings, 0 replies; 10+ messages in thread
From: Naveen Krishna Chatradhi @ 2014-07-14 11:37 UTC (permalink / raw)
To: linux-arm-kernel
UART modules on some SoCs only differ in the fifosize of each
UART channel. Its useless to duplicate the drv_data structure
or create a compatible name for such a change.
We can get fifosize via the device tree nodes (not mandating it).
Also updates the documentation.
Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Cc: gregkh at linuxfoundation.org
---
.../devicetree/bindings/serial/samsung_uart.txt | 4 ++++
drivers/tty/serial/samsung.c | 12 +++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/serial/samsung_uart.txt b/Documentation/devicetree/bindings/serial/samsung_uart.txt
index 85e8ee2..e85f37e 100644
--- a/Documentation/devicetree/bindings/serial/samsung_uart.txt
+++ b/Documentation/devicetree/bindings/serial/samsung_uart.txt
@@ -29,6 +29,9 @@ Required properties:
[1] Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
[2] Documentation/devicetree/bindings/clock/clock-bindings.txt
+Optional properties:
+- samsung,uart-fifosize: The fifo size supported by the UART channel
+
Note: Each Samsung UART should have an alias correctly numbered in the
"aliases" node, according to serialN format, where N is the port number
(non-negative decimal integer) as specified by User's Manual of respective
@@ -51,4 +54,5 @@ Example:
"clk_uart_baud3";
clocks = <&clocks PCLK_UART1>, <&clocks PCLK_UART1>,
<&clocks SCLK_UART>;
+ samsung,uart-fifosize = <16>;
};
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 6be852d..e49a945 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1295,9 +1295,15 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
dev_get_platdata(&pdev->dev) :
ourport->drv_data->def_cfg;
- ourport->port.fifosize = (ourport->info->fifosize) ?
- ourport->info->fifosize :
- ourport->drv_data->fifosize[index];
+ if (pdev->dev.of_node)
+ of_property_read_u32(pdev->dev.of_node,
+ "samsung,uart-fifosize", &ourport->port.fifosize);
+
+ if (!ourport->port.fifosize) {
+ ourport->port.fifosize = (ourport->info->fifosize) ?
+ ourport->info->fifosize :
+ ourport->drv_data->fifosize[index];
+ }
probe_index++;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] serial: samsung: correct the case and default order in switch
2014-07-14 11:37 ` Naveen Krishna Chatradhi
@ 2014-07-14 11:37 ` Naveen Krishna Chatradhi
-1 siblings, 0 replies; 10+ messages in thread
From: Naveen Krishna Chatradhi @ 2014-07-14 11:37 UTC (permalink / raw)
To: kgene.kim, linux-samsung-soc, linux-arm-kernel, devicetree
Cc: gregkh, ben-linux, cpgs
The cases should comes before default in a switch.
Even if we want the case and default to share same code.
Its good to define the case first followed by default.
Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Cc: gregkh@linuxfoundation.org
---
drivers/tty/serial/samsung.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index e49a945..d98f93d 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1542,8 +1542,8 @@ s3c24xx_serial_get_options(struct uart_port *port, int *baud,
case S3C2410_LCON_CS7:
*bits = 7;
break;
- default:
case S3C2410_LCON_CS8:
+ default:
*bits = 8;
break;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] serial: samsung: correct the case and default order in switch
@ 2014-07-14 11:37 ` Naveen Krishna Chatradhi
0 siblings, 0 replies; 10+ messages in thread
From: Naveen Krishna Chatradhi @ 2014-07-14 11:37 UTC (permalink / raw)
To: linux-arm-kernel
The cases should comes before default in a switch.
Even if we want the case and default to share same code.
Its good to define the case first followed by default.
Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Cc: gregkh at linuxfoundation.org
---
drivers/tty/serial/samsung.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index e49a945..d98f93d 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1542,8 +1542,8 @@ s3c24xx_serial_get_options(struct uart_port *port, int *baud,
case S3C2410_LCON_CS7:
*bits = 7;
break;
- default:
case S3C2410_LCON_CS8:
+ default:
*bits = 8;
break;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] serial: samsung: improve code clarity by defining a variable
2014-07-14 11:37 ` Naveen Krishna Chatradhi
@ 2014-07-14 11:37 ` Naveen Krishna Chatradhi
-1 siblings, 0 replies; 10+ messages in thread
From: Naveen Krishna Chatradhi @ 2014-07-14 11:37 UTC (permalink / raw)
To: kgene.kim, linux-samsung-soc, linux-arm-kernel, devicetree
Cc: gregkh, ben-linux, cpgs
The of_node is derived from pdev for every usage, define a
device_node variable instead.
Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Cc: gregkh@linuxfoundation.org
---
drivers/tty/serial/samsung.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index d98f93d..4aff02d 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1269,12 +1269,13 @@ static inline struct s3c24xx_serial_drv_data *s3c24xx_get_driver_data(
static int s3c24xx_serial_probe(struct platform_device *pdev)
{
+ struct device_node *np = pdev->dev.of_node;
struct s3c24xx_uart_port *ourport;
int index = probe_index;
int ret;
- if (pdev->dev.of_node) {
- ret = of_alias_get_id(pdev->dev.of_node, "serial");
+ if (np) {
+ ret = of_alias_get_id(np, "serial");
if (ret >= 0)
index = ret;
}
@@ -1295,8 +1296,8 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
dev_get_platdata(&pdev->dev) :
ourport->drv_data->def_cfg;
- if (pdev->dev.of_node)
- of_property_read_u32(pdev->dev.of_node,
+ if (np)
+ of_property_read_u32(np,
"samsung,uart-fifosize", &ourport->port.fifosize);
if (!ourport->port.fifosize) {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] serial: samsung: improve code clarity by defining a variable
@ 2014-07-14 11:37 ` Naveen Krishna Chatradhi
0 siblings, 0 replies; 10+ messages in thread
From: Naveen Krishna Chatradhi @ 2014-07-14 11:37 UTC (permalink / raw)
To: linux-arm-kernel
The of_node is derived from pdev for every usage, define a
device_node variable instead.
Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Cc: gregkh at linuxfoundation.org
---
drivers/tty/serial/samsung.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index d98f93d..4aff02d 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1269,12 +1269,13 @@ static inline struct s3c24xx_serial_drv_data *s3c24xx_get_driver_data(
static int s3c24xx_serial_probe(struct platform_device *pdev)
{
+ struct device_node *np = pdev->dev.of_node;
struct s3c24xx_uart_port *ourport;
int index = probe_index;
int ret;
- if (pdev->dev.of_node) {
- ret = of_alias_get_id(pdev->dev.of_node, "serial");
+ if (np) {
+ ret = of_alias_get_id(np, "serial");
if (ret >= 0)
index = ret;
}
@@ -1295,8 +1296,8 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
dev_get_platdata(&pdev->dev) :
ourport->drv_data->def_cfg;
- if (pdev->dev.of_node)
- of_property_read_u32(pdev->dev.of_node,
+ if (np)
+ of_property_read_u32(np,
"samsung,uart-fifosize", &ourport->port.fifosize);
if (!ourport->port.fifosize) {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] serial: samsung: get fifosize from DT and clean up
2014-07-14 11:37 ` Naveen Krishna Chatradhi
@ 2014-07-16 12:02 ` Tomasz Figa
-1 siblings, 0 replies; 10+ messages in thread
From: Tomasz Figa @ 2014-07-16 12:02 UTC (permalink / raw)
To: Naveen Krishna Chatradhi, kgene.kim, linux-samsung-soc,
linux-arm-kernel, devicetree
Cc: gregkh, ben-linux, cpgs
Hi Naveen,
On 14.07.2014 13:37, Naveen Krishna Chatradhi wrote:
> This patch set does the following
> 1: Get fifosize from DT node. But, not mandating it.
> 2. Corrects the case and default order in a switch
> 3. Defines a variable to simply the code.
>
> Console messages on Exynos5420 based peach pit and pi works fine.
>
> Naveen Krishna Chatradhi (3):
> serial: samsung: get fifosize via device tree
> serial: samsung: correct the case and default order in switch
> serial: samsung: improve code clarity by defining a variable
>
> .../devicetree/bindings/serial/samsung_uart.txt | 4 ++++
> drivers/tty/serial/samsung.c | 19 +++++++++++++------
> 2 files changed, 17 insertions(+), 6 deletions(-)
>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
--
Best regards,
Tomasz
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 0/3] serial: samsung: get fifosize from DT and clean up
@ 2014-07-16 12:02 ` Tomasz Figa
0 siblings, 0 replies; 10+ messages in thread
From: Tomasz Figa @ 2014-07-16 12:02 UTC (permalink / raw)
To: linux-arm-kernel
Hi Naveen,
On 14.07.2014 13:37, Naveen Krishna Chatradhi wrote:
> This patch set does the following
> 1: Get fifosize from DT node. But, not mandating it.
> 2. Corrects the case and default order in a switch
> 3. Defines a variable to simply the code.
>
> Console messages on Exynos5420 based peach pit and pi works fine.
>
> Naveen Krishna Chatradhi (3):
> serial: samsung: get fifosize via device tree
> serial: samsung: correct the case and default order in switch
> serial: samsung: improve code clarity by defining a variable
>
> .../devicetree/bindings/serial/samsung_uart.txt | 4 ++++
> drivers/tty/serial/samsung.c | 19 +++++++++++++------
> 2 files changed, 17 insertions(+), 6 deletions(-)
>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
--
Best regards,
Tomasz
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-07-16 12:02 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-14 11:37 [PATCH 0/3] serial: samsung: get fifosize from DT and clean up Naveen Krishna Chatradhi
2014-07-14 11:37 ` Naveen Krishna Chatradhi
2014-07-14 11:37 ` [PATCH 1/3] serial: samsung: get fifosize via device tree Naveen Krishna Chatradhi
2014-07-14 11:37 ` Naveen Krishna Chatradhi
2014-07-14 11:37 ` [PATCH 2/3] serial: samsung: correct the case and default order in switch Naveen Krishna Chatradhi
2014-07-14 11:37 ` Naveen Krishna Chatradhi
2014-07-14 11:37 ` [PATCH 3/3] serial: samsung: improve code clarity by defining a variable Naveen Krishna Chatradhi
2014-07-14 11:37 ` Naveen Krishna Chatradhi
2014-07-16 12:02 ` [PATCH 0/3] serial: samsung: get fifosize from DT and clean up Tomasz Figa
2014-07-16 12:02 ` Tomasz Figa
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.