From patchwork Fri Aug 22 13:51:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 35831 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D3AC920540 for ; Fri, 22 Aug 2014 13:55:19 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id w10sf80753423pde.3 for ; Fri, 22 Aug 2014 06:55:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=YS1ZIGHBV5WP/qbTfht8LKKbBZzLeKO4tzXbLzH4fks=; b=Ezu0hOP50lTon5fVXhkdpciQYofHX3QLGoajzlM6lQn+4xnqgDEb0w7Vxgx4nc0u7Z lnI2jaZppTWgdHHy/sD0ixf5//k9i4qiwbf8AnNreq2TR35+CchFJH1gJUyLG8OViLT4 tdF2MVvVu+6u9uuUiTvpP4+KLAiBX8jy7bXeiD3CC4y12+Lbd0CD8AS8a/MOyO54ycAJ /m9PvfH/71KkX7vZfhppd4Ey+AxZZmJkt7hBf7z2iiK+YMd3u6TpzgmUg/cNEPdM5+C2 TB/cYs5yaUzAr71seu4j5P65JyDOMJgLX7KCgtq/KDM/VP3/OwctJUR9W9tHdNXot/7t RvdQ== X-Gm-Message-State: ALoCoQmRuN6A/KexERRr5bs/J8Y711SBvbyNnyC9Nv4G5id9w6p1uE4dRStvOGcENXtRYmqGKtJn X-Received: by 10.66.246.229 with SMTP id xz5mr3327214pac.34.1408715719162; Fri, 22 Aug 2014 06:55:19 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.202 with SMTP id w68ls1105707qge.4.gmail; Fri, 22 Aug 2014 06:55:19 -0700 (PDT) X-Received: by 10.53.0.164 with SMTP id az4mr219686vdd.52.1408715718963; Fri, 22 Aug 2014 06:55:18 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id sq19si13609810vdb.44.2014.08.22.06.55.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Aug 2014 06:55:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id hy10so12369717vcb.18 for ; Fri, 22 Aug 2014 06:55:18 -0700 (PDT) X-Received: by 10.221.68.66 with SMTP id xx2mr4113441vcb.1.1408715718859; Fri, 22 Aug 2014 06:55:18 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp18844vcb; Fri, 22 Aug 2014 06:55:18 -0700 (PDT) X-Received: by 10.70.65.100 with SMTP id w4mr6601326pds.128.1408715717992; Fri, 22 Aug 2014 06:55:17 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bo5si40827408pbb.146.2014.08.22.06.55.17 for ; Fri, 22 Aug 2014 06:55:17 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756741AbaHVNzQ (ORCPT + 21 others); Fri, 22 Aug 2014 09:55:16 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:33541 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756419AbaHVNyK (ORCPT ); Fri, 22 Aug 2014 09:54:10 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s7MDrjjZ001051; Fri, 22 Aug 2014 08:53:45 -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 s7MDrjsa008678; Fri, 22 Aug 2014 08:53:45 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Fri, 22 Aug 2014 08:53:44 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s7MDritV011496; Fri, 22 Aug 2014 08:53:44 -0500 From: Nishanth Menon To: Tony Lindgren , Tero Kristo , Paul Walmsley CC: Kevin Hilman , , , , Keerthy , =?UTF-8?q?Beno=C3=AEt=20Cousson?= , Santosh Shilimkar , Nishanth Menon Subject: [PATCH 1/6] ARM: OMAP4+: prminst: provide function to find prm_dev instance offset Date: Fri, 22 Aug 2014 08:51:48 -0500 Message-ID: <1408715513-25851-2-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1408715513-25851-1-git-send-email-nm@ti.com> References: <1408715513-25851-1-git-send-email-nm@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: nm@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , PRM device instance can vary depending on SoC. We already handle the same during reset of the device, However, this is also needed for other logic instances. So, first abstract this out to a generic function. Signed-off-by: Nishanth Menon --- Minor note: this patch has a 'CHECK: extern prototypes should be avoided in .h files' for prminst44xx.h but that is a continuation of existing style in the file. arch/arm/mach-omap2/prminst44xx.c | 40 +++++++++++++++++++++++-------------- arch/arm/mach-omap2/prminst44xx.h | 3 +++ 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c index 69f0dd0..225e025 100644 --- a/arch/arm/mach-omap2/prminst44xx.c +++ b/arch/arm/mach-omap2/prminst44xx.c @@ -31,6 +31,8 @@ static void __iomem *_prm_bases[OMAP4_MAX_PRCM_PARTITIONS]; +static s32 prm_dev_inst = PRM_INSTANCE_UNKNOWN; + /** * omap_prm_base_init - Populates the prm partitions * @@ -43,6 +45,24 @@ void omap_prm_base_init(void) _prm_bases[OMAP4430_PRCM_MPU_PARTITION] = prcm_mpu_base; } +s32 omap4_prmst_get_prm_dev_inst(void) +{ + if (prm_dev_inst != PRM_INSTANCE_UNKNOWN) + return prm_dev_inst; + + /* This cannot be done way early at boot.. as things are not setup */ + if (cpu_is_omap44xx()) + prm_dev_inst = OMAP4430_PRM_DEVICE_INST; + else if (soc_is_omap54xx()) + prm_dev_inst = OMAP54XX_PRM_DEVICE_INST; + else if (soc_is_dra7xx()) + prm_dev_inst = DRA7XX_PRM_DEVICE_INST; + else if (soc_is_am43xx()) + prm_dev_inst = AM43XX_PRM_DEVICE_INST; + + return prm_dev_inst; +} + /* Read a register in a PRM instance */ u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx) { @@ -169,28 +189,18 @@ int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst, void omap4_prminst_global_warm_sw_reset(void) { u32 v; - s16 dev_inst; + s32 inst = omap4_prmst_get_prm_dev_inst(); - if (cpu_is_omap44xx()) - dev_inst = OMAP4430_PRM_DEVICE_INST; - else if (soc_is_omap54xx()) - dev_inst = OMAP54XX_PRM_DEVICE_INST; - else if (soc_is_dra7xx()) - dev_inst = DRA7XX_PRM_DEVICE_INST; - else if (soc_is_am43xx()) - dev_inst = AM43XX_PRM_DEVICE_INST; - else + if (inst == PRM_INSTANCE_UNKNOWN) return; - v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, dev_inst, + v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, inst, OMAP4_PRM_RSTCTRL_OFFSET); v |= OMAP4430_RST_GLOBAL_WARM_SW_MASK; omap4_prminst_write_inst_reg(v, OMAP4430_PRM_PARTITION, - dev_inst, - OMAP4_PRM_RSTCTRL_OFFSET); + inst, OMAP4_PRM_RSTCTRL_OFFSET); /* OCP barrier */ v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, - dev_inst, - OMAP4_PRM_RSTCTRL_OFFSET); + inst, OMAP4_PRM_RSTCTRL_OFFSET); } diff --git a/arch/arm/mach-omap2/prminst44xx.h b/arch/arm/mach-omap2/prminst44xx.h index a2ede2d..583aa37 100644 --- a/arch/arm/mach-omap2/prminst44xx.h +++ b/arch/arm/mach-omap2/prminst44xx.h @@ -12,6 +12,9 @@ #ifndef __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H #define __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H +#define PRM_INSTANCE_UNKNOWN -1 +extern s32 omap4_prmst_get_prm_dev_inst(void); + /* * In an ideal world, we would not export these low-level functions, * but this will probably take some time to fix properly