From patchwork Wed Feb 20 15:38:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Shilimkar X-Patchwork-Id: 2168221 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id D8E7B3FE37 for ; Wed, 20 Feb 2013 15:37:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935860Ab3BTPht (ORCPT ); Wed, 20 Feb 2013 10:37:49 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:54258 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935847Ab3BTPhr (ORCPT ); Wed, 20 Feb 2013 10:37:47 -0500 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r1KFbckZ001162; Wed, 20 Feb 2013 09:37:39 -0600 Received: from DBDE70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id r1KFbb9k014583; Wed, 20 Feb 2013 21:07:37 +0530 (IST) Received: from dbdp32.itg.ti.com (172.24.170.251) by dbde70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 14.1.323.3; Wed, 20 Feb 2013 21:07:37 +0530 Received: from ula0393909.apr.dhcp.ti.com (smtpvbd.itg.ti.com [172.24.170.250]) by dbdp32.itg.ti.com (8.13.8/8.13.8) with ESMTP id r1KFbSTk003318; Wed, 20 Feb 2013 21:07:37 +0530 From: Santosh Shilimkar To: CC: , , Santosh Shilimkar , Benoit Cousson , Rajendra Nayak Subject: [PATCH 7/8] ARM: OMAP: hwmod: extract module address space from DT blob Date: Wed, 20 Feb 2013 21:08:54 +0530 Message-ID: <1361374735-22018-8-git-send-email-santosh.shilimkar@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1361374735-22018-1-git-send-email-santosh.shilimkar@ti.com> References: <1361374735-22018-1-git-send-email-santosh.shilimkar@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 Patch adds the code for extracting the module ocp address space from device tree blob in case the hwmod address space look up fails. The idea is to remove the address space data from hwmod and extract it from DT blob. Cc: Benoit Cousson Signed-off-by: Rajendra Nayak Signed-off-by: Santosh Shilimkar --- arch/arm/mach-omap2/omap_hwmod.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 4653efb..5aad348 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -138,6 +138,7 @@ #include #include #include +#include #include "clock.h" #include "omap_hwmod.h" @@ -2336,6 +2337,11 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) { struct omap_hwmod_addr_space *mem; void __iomem *va_start; + struct device_node *np; + const void *reg_prop; + const char *p; + unsigned long start = 0, size = 0; + if (!oh) return; @@ -2349,10 +2355,33 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) if (!mem) { pr_debug("omap_hwmod: %s: no MPU register target found\n", oh->name); + + /* Extract the IO space from device tree blob */ + if (!of_have_populated_dt()) + return; + + for_each_child_of_node(of_find_node_by_name(NULL, "ocp"), np) { + if (of_find_property(np, "ti,hwmods", NULL)) { + p = of_get_property(np, "ti,hwmods", NULL); + if (!strcmp(p, oh->name)) { + reg_prop = of_get_property(np, "reg", + NULL); + start = of_read_number(reg_prop, 1); + size = of_read_number(reg_prop + 4, 1); + } + } + } + } else { + start = mem->pa_start; + size = mem->pa_end - mem->pa_start; + } + + if (!start) { + pr_debug("omap_hwmod: %s: No address space found\n", oh->name); return; } - va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start); + va_start = ioremap(start, size); if (!va_start) { pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name); return;