From patchwork Mon Apr 18 07:51:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 611594 X-Patchwork-Delegate: iwamatsu@nigauri.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3qpLQQ2bnBz9t3y for ; Mon, 18 Apr 2016 18:09:18 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1F291A75F5; Mon, 18 Apr 2016 10:09:16 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yVGTmXPh06xm; Mon, 18 Apr 2016 10:09:15 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BC06CA75CE; Mon, 18 Apr 2016 10:09:15 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A24D5A75CE for ; Mon, 18 Apr 2016 10:09:12 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wBUFMiBY7F0b for ; Mon, 18 Apr 2016 10:09:12 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail1.asahi-net.or.jp (mail1.asahi-net.or.jp [202.224.39.197]) by theia.denx.de (Postfix) with ESMTP id 3DB3FA7498 for ; Mon, 18 Apr 2016 10:09:07 +0200 (CEST) Received: from sa76r4 (y081184.ppp.asahi-net.or.jp [118.243.81.184]) by mail1.asahi-net.or.jp (Postfix) with ESMTP id DCF6214346; Mon, 18 Apr 2016 16:51:20 +0900 (JST) Received: from localhost (localhost [127.0.0.1]) by sa76r4 (Postfix) with ESMTP id 39F8A11D9; Mon, 18 Apr 2016 16:51:20 +0900 (JST) X-Virus-Scanned: Debian amavisd-new at sa76r4.localdomain Received: from sa76r4 ([127.0.0.1]) by localhost (sa76r4.localdomain [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NftPbJiVyMb3; Mon, 18 Apr 2016 16:51:20 +0900 (JST) Received: by sa76r4 (Postfix, from userid 1000) id 1B0B930E3; Mon, 18 Apr 2016 16:51:20 +0900 (JST) From: Yoshinori Sato To: u-boot@lists.denx.de Date: Mon, 18 Apr 2016 16:51:04 +0900 Message-Id: <1460965865-12123-1-git-send-email-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.7.0 Cc: Yoshinori Sato Subject: [U-Boot] [PATCH 1/2] serial_sh: Device Tree support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add Device Tree bindings. Signed-off-by: Yoshinori Sato --- 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 diff --git a/doc/device-tree-bindings/serial/sh.txt b/doc/device-tree-bindings/serial/sh.txt new file mode 100644 index 0000000..b23b135 --- /dev/null +++ b/doc/device-tree-bindings/serial/sh.txt @@ -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 diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c index 8693c1e..32b2bf0 100644 --- a/drivers/serial/serial_sh.c +++ b/drivers/serial/serial_sh.c @@ -17,6 +17,8 @@ #include #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,