serial_sh: Add OF support
PATCH 1/2 serial_sh: Add OF support
Add device tree support.
--- doc/device-tree-bindings/serial/sh.txt | 6 ++++++ drivers/serial/serial_sh.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 doc/device-tree-bindings/serial/sh.txt
doc/device-tree-bindings/serial/sh.txt new file +6 -0
@@ -0,0 +1,6 @@ +* Renesas SCI serial interface + +Required properties: +- compatible: must be "renesas,scif" or "renesas,scifa" +- reg: exactly one register range with length +- clock: input clock frequency for the SCI unit
drivers/serial/serial_sh.c +28 -0
@@ -17,6 +17,8 @@#include <dm/platform_data/serial_sh.h> #include "serial_sh.h" +DECLARE_GLOBAL_DATA_PTR ; + #if defined(CONFIG_CPU_SH7760) || \ defined(CONFIG_CPU_SH7780) || \ defined(CONFIG_CPU_SH7785) || \
@@ -201,10 +203,35 @@ static const struct dm_serial_ops sh_serial_ops = { .setbrg = sh_serial_setbrg, }; +#ifdef CONFIG_OF_CONTROL +static const struct udevice_id sh_serial_id[] = { + {.compatible ="renesas,scif" , .data =PORT_SCIF }, + {.compatible ="renesas,scifa" , .data =PORT_SCIFA }, + {} +}; + +static int sh_serial_ofdata_to_platdata (struct udevice *dev) +{ +struct sh_serial_platdata *plat =dev_get_platdata (dev); +fdt_addr_t addr; + + addr =fdtdec_get_addr (gd->fdt_blob, dev->of_offset,"reg" ); +if (addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + plat->base = addr; + plat->clk =fdtdec_get_int (gd->fdt_blob, dev->of_offset,"clock" ,1 ); + plat->type =dev_get_driver_data (dev); +return 0 ; +} +#endif +U_BOOT_DRIVER (serial_sh) = { .name ="serial_sh" , .id =UCLASS_SERIAL , + .of_match =of_match_ptr (sh_serial_id), + .ofdata_to_platdata =of_match_ptr (sh_serial_ofdata_to_platdata), + .platdata_auto_alloc_size =sizeof (struct sh_serial_platdata ), .probe = sh_serial_probe, .ops = &sh_serial_ops, .flags =DM_FLAG_PRE_RELOC ,
Signature · 1 line
2.1.4
PATCH 2/2 serial_sh: Add standrad SCI (w/o FIFO) support
Add support for standard type SCI (without FIFO) port.
--- doc/device-tree-bindings/serial/sh.txt | 2 +- drivers/serial/serial_sh.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
doc/device-tree-bindings/serial/sh.txt +1 -1
@@ -1,6 +1,6 @@ * Renesas SCI serial interface Required properties: -- compatible: must be "renesas,scif" or "renesas,scifa" +- compatible: must be "renesas,scif", "renesas,scifa" or "renesas,sci" - reg: exactly one register range with length - clock: input clock frequency for the SCI unit
drivers/serial/serial_sh.c +8 -0
@@ -47,6 +47,11 @@ static int scif_rxfill(struct uart_port *port) else return sci_in(port, SCRFDR); } +#elif defined(CONFIG_SCI) +static int scif_rxfill (struct uart_port *port) +{ +return (sci_in (port, SCxSR) &SCxSR_RDxF (port)) ?1 :0 ; +}#else static int scif_rxfill (struct uart_port *port) {
@@ -205,6 +210,7 @@ static const struct dm_serial_ops sh_serial_ops = {#ifdef CONFIG_OF_CONTROL static const struct udevice_id sh_serial_id[] ={ + {.compatible ="renesas,sci" , .data =PORT_SCI }, {.compatible ="renesas,scif" , .data =PORT_SCIF }, {.compatible ="renesas,scifa" , .data =PORT_SCIFA }, {}
@@ -262,6 +268,8 @@ U_BOOT_DRIVER(serial_sh) = {#if defined(CONFIG_SCIF_A )#define SCIF_BASE_PORT PORT_SCIFA +#elif defined(CONFIG_SCI ) +#define SCIF_BASE_PORT PORT_SCI#else #define SCIF_BASE_PORT PORT_SCIF#endif
Signature · 1 line
2.1.4
PATCH 1/2 serial_sh: Add OF support
In reply to Yoshinori SatoHi!
015-05-21 15:31 GMT+09:00 Yoshinori Sato <[email protected]>:
Quoted 8 lines
Add device tree support.
Signed-off-by Yoshinori Sato <[email protected]>--- doc/device-tree-bindings/serial/sh.txt | 6 ++++++ drivers/serial/serial_sh.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 doc/device-tree-bindings/serial/sh.txt
2015-05-21 15:31 GMT+09:00 Yoshinori Sato <[email protected]>:
Quoted 8 lines
Add support for standard type SCI (without FIFO) port.
Signed-off-by Yoshinori Sato <[email protected]>--- doc/device-tree-bindings/serial/sh.txt | 2 +- drivers/serial/serial_sh.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
Thanks for your patch.
Sorry, your patch can not apply u-boot/master HEAD. Could you rebase and resend this patch?
Best regards,
Nobuhiro
2015-05-21 15:31 GMT+09:00 Yoshinori Sato <[email protected]>:
Quoted 73 lines
Add device tree support.
Signed-off-by Yoshinori Sato <[email protected]>--- doc/device-tree-bindings/serial/sh.txt | 6 ++++++ drivers/serial/serial_sh.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 doc/device-tree-bindings/serial/sh.txtdoc/device-tree-bindings/serial/sh.txt new file +6
-0@@ -0,0 +1,6 @@ +* Renesas SCI serial interface + +Required properties: +- compatible: must be "renesas,scif" or "renesas,scifa" +- reg: exactly one register range with length +- clock: input clock frequency for the SCI unitdrivers/serial/serial_sh.c +28
-1@@ -17,6 +17,8 @@#include <dm/platform_data/serial_sh.h> #include "serial_sh.h" +DECLARE_GLOBAL_DATA_PTR ; + #if defined(CONFIG_CPU_SH7760) || \ defined(CONFIG_CPU_SH7780) || \ defined(CONFIG_CPU_SH7785) || \@@ -201,10 +203,35 @@ static const struct dm_serial_ops sh_serial_ops = { .setbrg = sh_serial_setbrg, }; +#ifdef CONFIG_OF_CONTROL +static const struct udevice_id sh_serial_id[] = { + {.compatible ="renesas,scif" , .data =PORT_SCIF }, + {.compatible ="renesas,scifa" , .data =PORT_SCIFA }, + {} +}; + +static int sh_serial_ofdata_to_platdata (struct udevice *dev) +{ +struct sh_serial_platdata *plat =dev_get_platdata (dev); +fdt_addr_t addr; + + addr =fdtdec_get_addr (gd->fdt_blob, dev->of_offset,"reg" ); +if (addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + plat->base = addr; + plat->clk =fdtdec_get_int (gd->fdt_blob, dev->of_offset,"clock" ,1 ); + plat->type =dev_get_driver_data (dev); +return 0 ; +} +#endif +U_BOOT_DRIVER (serial_sh) = { .name ="serial_sh" , .id =UCLASS_SERIAL , + .of_match =of_match_ptr (sh_serial_id), + .ofdata_to_platdata =of_match_ptr (sh_serial_ofdata_to_platdata), + .platdata_auto_alloc_size =sizeof (struct sh_serial_platdata ), .probe = sh_serial_probe, .ops = &sh_serial_ops, .flags =DM_FLAG_PRE_RELOC , --2.1.4
Signature · 3 lines
Nobuhiro Iwamatsu
iwamatsu at {nigauri.org / debian.org}
GPG ID: 40AD1FA6PATCH 1/2 serial_sh: Add OF support
Quoted 23 lines · Nobuhiro Iwamatsu
Hi!
015-05-21 15:31 GMT+09:00 Yoshinori Sato <[email protected]>:
Quoted 8 lines
Add device tree support.
Signed-off-by Yoshinori Sato <[email protected]>--- doc/device-tree-bindings/serial/sh.txt | 6 ++++++ drivers/serial/serial_sh.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 doc/device-tree-bindings/serial/sh.txt2015-05-21 15:31 GMT+09:00 Yoshinori Sato <[email protected]>:
Quoted 8 lines
Add support for standard type SCI (without FIFO) port.
Signed-off-by Yoshinori Sato <[email protected]>--- doc/device-tree-bindings/serial/sh.txt | 2 +- drivers/serial/serial_sh.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
Quoted 4 lines
Thanks for your patch.
Sorry, your patch can not apply u-boot/master HEAD. Could you rebase and resend this patch?
Oh. I'm Sorry.
I will rebase and resend.
Thanks.
Quoted 84 lines
Best regards,
Nobuhiro2015-05-21 15:31 GMT+09:00 Yoshinori Sato <[email protected]>:
Quoted 73 lines
Add device tree support.
Signed-off-by Yoshinori Sato <[email protected]>--- doc/device-tree-bindings/serial/sh.txt | 6 ++++++ drivers/serial/serial_sh.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 doc/device-tree-bindings/serial/sh.txtdoc/device-tree-bindings/serial/sh.txt new file +6
-0@@ -0,0 +1,6 @@ +* Renesas SCI serial interface + +Required properties: +- compatible: must be "renesas,scif" or "renesas,scifa" +- reg: exactly one register range with length +- clock: input clock frequency for the SCI unitdrivers/serial/serial_sh.c +28
-1@@ -17,6 +17,8 @@#include <dm/platform_data/serial_sh.h> #include "serial_sh.h" +DECLARE_GLOBAL_DATA_PTR ; + #if defined(CONFIG_CPU_SH7760) || \ defined(CONFIG_CPU_SH7780) || \ defined(CONFIG_CPU_SH7785) || \@@ -201,10 +203,35 @@ static const struct dm_serial_ops sh_serial_ops = { .setbrg = sh_serial_setbrg, }; +#ifdef CONFIG_OF_CONTROL +static const struct udevice_id sh_serial_id[] = { + {.compatible ="renesas,scif" , .data =PORT_SCIF }, + {.compatible ="renesas,scifa" , .data =PORT_SCIFA }, + {} +}; + +static int sh_serial_ofdata_to_platdata (struct udevice *dev) +{ +struct sh_serial_platdata *plat =dev_get_platdata (dev); +fdt_addr_t addr; + + addr =fdtdec_get_addr (gd->fdt_blob, dev->of_offset,"reg" ); +if (addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + plat->base = addr; + plat->clk =fdtdec_get_int (gd->fdt_blob, dev->of_offset,"clock" ,1 ); + plat->type =dev_get_driver_data (dev); +return 0 ; +} +#endif +U_BOOT_DRIVER (serial_sh) = { .name ="serial_sh" , .id =UCLASS_SERIAL , + .of_match =of_match_ptr (sh_serial_id), + .ofdata_to_platdata =of_match_ptr (sh_serial_ofdata_to_platdata), + .platdata_auto_alloc_size =sizeof (struct sh_serial_platdata ), .probe = sh_serial_probe, .ops = &sh_serial_ops, .flags =DM_FLAG_PRE_RELOC , --2.1.4
Signature · 3 lines
Nobuhiro Iwamatsu iwamatsu at {nigauri.org / debian.org} GPG ID: 40AD1FA6
Signature · 2 lines
Yoshinori Sato <[email protected]>
PATCH v2 1/2 serial_sh: Add OF support
In reply to Yoshinori SatoAdd device tree support.
Changes v2:
rebased v2015.07-rc1
--- doc/device-tree-bindings/serial/sh.txt | 6 ++++++ drivers/serial/serial_sh.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 doc/device-tree-bindings/serial/sh.txt
doc/device-tree-bindings/serial/sh.txt new file +6 -0
@@ -0,0 +1,6 @@ +* Renesas SCI serial interface + +Required properties: +- compatible: must be "renesas,scif" or "renesas,scifa" +- reg: exactly one register range with length +- clock: input clock frequency for the SCI unit
drivers/serial/serial_sh.c +28 -0
@@ -17,6 +17,8 @@#include <dm/platform_data/serial_sh.h> #include "serial_sh.h" +DECLARE_GLOBAL_DATA_PTR ; + #if defined(CONFIG_CPU_SH7760) || \ defined(CONFIG_CPU_SH7780) || \ defined(CONFIG_CPU_SH7785) || \
@@ -201,9 +203,35 @@ static const struct dm_serial_ops sh_serial_ops = { .setbrg = sh_serial_setbrg, }; +#ifdef CONFIG_OF_CONTROL +static const struct udevice_id sh_serial_id[] ={ + {.compatible ="renesas,scif" , .data =PORT_SCIF }, + {.compatible ="renesas,scifa" , .data =PORT_SCIFA }, + {} +}; + +static int sh_serial_ofdata_to_platdata (struct udevice *dev) +{ +struct sh_serial_platdata *plat =dev_get_platdata (dev); +fdt_addr_t addr; + + addr =fdtdec_get_addr (gd->fdt_blob, dev->of_offset,"reg" ); +if (addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + plat->base = addr; + plat->clk =fdtdec_get_int (gd->fdt_blob, dev->of_offset,"clock" ,1 ); + plat->type =dev_get_driver_data (dev); +return 0 ; +} +#endif +U_BOOT_DRIVER (serial_sh) = { .name ="serial_sh" , .id =UCLASS_SERIAL , + .of_match =of_match_ptr (sh_serial_id), + .ofdata_to_platdata =of_match_ptr (sh_serial_ofdata_to_platdata), + .platdata_auto_alloc_size =sizeof (struct sh_serial_platdata ), .probe = sh_serial_probe, .ops = &sh_serial_ops, .flags =DM_FLAG_PRE_RELOC ,
Signature · 1 line
2.1.4
PATCH v2 2/2 serial_sh: Add standrad SCI (w/o FIFO) support
Add support for standard type SCI (without FIFO) port.
Changes v2:
rebased for v2015.07-rc1
--- doc/device-tree-bindings/serial/sh.txt | 2 +- drivers/serial/serial_sh.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
doc/device-tree-bindings/serial/sh.txt +1 -1
@@ -1,6 +1,6 @@ * Renesas SCI serial interface Required properties: -- compatible: must be "renesas,scif" or "renesas,scifa" +- compatible: must be "renesas,scif", "renesas,scifa" or "renesas,sci" - reg: exactly one register range with length - clock: input clock frequency for the SCI unit
drivers/serial/serial_sh.c +3 -0
@@ -205,6 +205,7 @@ static const struct dm_serial_ops sh_serial_ops = {#ifdef CONFIG_OF_CONTROL static const struct udevice_id sh_serial_id[] ={ + {.compatible ="renesas,sci" , .data =PORT_SCI }, {.compatible ="renesas,scif" , .data =PORT_SCIF }, {.compatible ="renesas,scifa" , .data =PORT_SCIFA }, {}
@@ -262,6 +263,8 @@ U_BOOT_DRIVER(serial_sh) = {#if defined(CONFIG_SCIF_A )#define SCIF_BASE_PORT PORT_SCIFA +#elif defined(CONFIG_SCI ) +#define SCIF_BASE_PORT PORT_SCI#else #define SCIF_BASE_PORT PORT_SCIF#endif
Signature · 1 line
2.1.4