From patchwork Thu Mar 24 13:32:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 64356 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp648510lbc; Thu, 24 Mar 2016 06:32:57 -0700 (PDT) X-Received: by 10.28.128.83 with SMTP id b80mr10653675wmd.6.1458826377451; Thu, 24 Mar 2016 06:32:57 -0700 (PDT) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id ju3si9020434wjb.228.2016.03.24.06.32.57; Thu, 24 Mar 2016 06:32:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5761BA74C5; Thu, 24 Mar 2016 14:32:38 +0100 (CET) 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 1gMfe11lqbwq; Thu, 24 Mar 2016 14:32:38 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A88E0A7532; Thu, 24 Mar 2016 14:32:32 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1D0CFA7550 for ; Thu, 24 Mar 2016 14:32:24 +0100 (CET) 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 H0KEYJJeki6l for ; Thu, 24 Mar 2016 14:32:24 +0100 (CET) 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 conuserg010-v.nifty.com (conuserg010.nifty.com [202.248.44.36]) by theia.denx.de (Postfix) with ESMTPS id 27813A74A8 for ; Thu, 24 Mar 2016 14:32:19 +0100 (CET) Received: from beagle.diag.org (p14090-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.90]) (authenticated) by conuserg010-v.nifty.com with ESMTP id u2ODW5nH018160; Thu, 24 Mar 2016 22:32:07 +0900 X-Nifty-SrcIP: [153.142.97.90] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Thu, 24 Mar 2016 22:32:40 +0900 Message-Id: <1458826368-2159-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1458826368-2159-1-git-send-email-yamada.masahiro@socionext.com> References: <1458826368-2159-1-git-send-email-yamada.masahiro@socionext.com> Subject: [U-Boot] [PATCH 03/10] i2c: uniphier: use devm_get_addr() to get base address 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" Currently, fdtdec_get_addr_size() does not support the address translation, so it cannot handle device trees with non-straight "ranges" properties. (This would be a problem with DTS for UniPhier ARMv8 SoCs.) Signed-off-by: Masahiro Yamada --- drivers/i2c/i2c-uniphier-f.c | 12 +++++------- drivers/i2c/i2c-uniphier.c | 11 +++++------ 2 files changed, 10 insertions(+), 13 deletions(-) -- 1.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/drivers/i2c/i2c-uniphier-f.c b/drivers/i2c/i2c-uniphier-f.c index b3349af..aebdcfc 100644 --- a/drivers/i2c/i2c-uniphier-f.c +++ b/drivers/i2c/i2c-uniphier-f.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -14,8 +15,6 @@ #include #include -DECLARE_GLOBAL_DATA_PTR; - struct uniphier_fi2c_regs { u32 cr; /* control register */ #define I2C_CR_MST (1 << 3) /* master mode */ @@ -112,15 +111,14 @@ static int check_device_busy(struct uniphier_fi2c_regs __iomem *regs) static int uniphier_fi2c_probe(struct udevice *dev) { fdt_addr_t addr; - fdt_size_t size; struct uniphier_fi2c_dev *priv = dev_get_priv(dev); int ret; - addr = fdtdec_get_addr_size(gd->fdt_blob, dev->of_offset, "reg", - &size); - - priv->regs = map_sysmem(addr, size); + addr = dev_get_addr(dev); + if (addr == FDT_ADDR_T_NONE) + return -EINVAL; + priv->regs = map_sysmem(addr, SZ_128); if (!priv->regs) return -ENOMEM; diff --git a/drivers/i2c/i2c-uniphier.c b/drivers/i2c/i2c-uniphier.c index 85b9eff..f8221da 100644 --- a/drivers/i2c/i2c-uniphier.c +++ b/drivers/i2c/i2c-uniphier.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -14,8 +15,6 @@ #include #include -DECLARE_GLOBAL_DATA_PTR; - struct uniphier_i2c_regs { u32 dtrm; /* data transmission */ #define I2C_DTRM_STA (1 << 10) @@ -48,13 +47,13 @@ struct uniphier_i2c_dev { static int uniphier_i2c_probe(struct udevice *dev) { fdt_addr_t addr; - fdt_size_t size; struct uniphier_i2c_dev *priv = dev_get_priv(dev); - addr = fdtdec_get_addr_size(gd->fdt_blob, dev->of_offset, "reg", &size); - - priv->regs = map_sysmem(addr, size); + addr = dev_get_addr(dev); + if (addr == FDT_ADDR_T_NONE) + return -EINVAL; + priv->regs = map_sysmem(addr, SZ_64); if (!priv->regs) return -ENOMEM;