serial: samsung: get fifosize from DT and clean up
cover serial: samsung: get fifosize from DT and clean up
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(-)
Signature · 1 line
1.7.9.5
PATCH 1/3 serial: samsung: get fifosize via device tree
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.
--- .../devicetree/bindings/serial/samsung_uart.txt | 4 ++++ drivers/tty/serial/samsung.c | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/serial/samsung_uart.txt +4 -0
@@ -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>; };
drivers/tty/serial/samsung.c +9 -3
@@ -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++;
Signature · 1 line
1.7.9.5
PATCH 2/3 serial: samsung: correct the case and default order in switch
In reply to Naveen Krishna ChatradhiThe 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.
--- drivers/tty/serial/samsung.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/samsung.c +1 -1
@@ -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 ; }
Signature · 1 line
1.7.9.5
PATCH 3/3 serial: samsung: improve code clarity by defining a variable
In reply to Naveen Krishna ChatradhiThe of_node is derived from pdev for every usage, define a device_node variable instead.
--- drivers/tty/serial/samsung.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/tty/serial/samsung.c +5 -4
@@ -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) {
Signature · 1 line
1.7.9.5
cover serial: samsung: get fifosize from DT and clean up
In reply to Naveen Krishna ChatradhiHi Naveen,
Quoted 7 lines · Naveen Krishna Chatradhi
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.
Quoted 9 lines
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(-)
--
Best regards,
Tomasz