From patchwork Mon Jul 27 11:24:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 6872491 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 98C4B9F380 for ; Mon, 27 Jul 2015 11:25:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AA29E20620 for ; Mon, 27 Jul 2015 11:25:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A74E620612 for ; Mon, 27 Jul 2015 11:25:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752188AbbG0LZh (ORCPT ); Mon, 27 Jul 2015 07:25:37 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:46821 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753091AbbG0LYZ (ORCPT ); Mon, 27 Jul 2015 07:24:25 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id t6RBOLAI006238; Mon, 27 Jul 2015 06:24:21 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t6RBOLV4023090; Mon, 27 Jul 2015 06:24:21 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Mon, 27 Jul 2015 06:24:21 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t6RBOELw014747; Mon, 27 Jul 2015 06:24:18 -0500 From: Kishon Vijay Abraham I To: , , , , CC: , , , , Tero Kristo Subject: [PATCH 1/2] regulator: pbias: use untranslated address to program pbias regulator Date: Mon, 27 Jul 2015 16:54:09 +0530 Message-ID: <1437996250-2913-2-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1437996250-2913-1-git-send-email-kishon@ti.com> References: <1437996250-2913-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP vsel_reg and enable_reg of the pbias regulator descriptor should actually have the offset from syscon. However after the pbias device tree node is moved as a child node of syscon, vsel_reg and enable_reg has the absolute address because of the address translation that happens while creating device from device tree node. So avoid using platform_get_resource and use of_get_address in order to get only the offset (untranslated address) and populate these in vsel_reg and enable_reg. Cc: Cc: Tero Kristo Signed-off-by: Kishon Vijay Abraham I Tested-by: Grygorii Strashko --- drivers/regulator/pbias-regulator.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/regulator/pbias-regulator.c b/drivers/regulator/pbias-regulator.c index bd2b75c..a24cb43 100644 --- a/drivers/regulator/pbias-regulator.c +++ b/drivers/regulator/pbias-regulator.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -108,12 +109,14 @@ static int pbias_regulator_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct pbias_regulator_data *drvdata; - struct resource *res; struct regulator_config cfg = { }; struct regmap *syscon; const struct pbias_reg_info *info; int ret = 0; int count, idx, data_idx = 0; + const __be32 *addrp; + int ns; + unsigned int reg; count = of_regulator_match(&pdev->dev, np, pbias_matches, PBIAS_NUM_REGS); @@ -141,10 +144,13 @@ static int pbias_regulator_probe(struct platform_device *pdev) if (!info) return -ENODEV; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) + addrp = of_get_address(np, 0, NULL, NULL); + if (!addrp) return -EINVAL; + ns = of_n_size_cells(np); + reg = of_read_number(addrp, ns); + drvdata[data_idx].syscon = syscon; drvdata[data_idx].info = info; drvdata[data_idx].desc.name = info->name; @@ -154,9 +160,9 @@ static int pbias_regulator_probe(struct platform_device *pdev) drvdata[data_idx].desc.volt_table = pbias_volt_table; drvdata[data_idx].desc.n_voltages = 2; drvdata[data_idx].desc.enable_time = info->enable_time; - drvdata[data_idx].desc.vsel_reg = res->start; + drvdata[data_idx].desc.vsel_reg = reg; drvdata[data_idx].desc.vsel_mask = info->vmode; - drvdata[data_idx].desc.enable_reg = res->start; + drvdata[data_idx].desc.enable_reg = reg; drvdata[data_idx].desc.enable_mask = info->enable_mask; drvdata[data_idx].desc.enable_val = info->enable;