From patchwork Fri Jun 12 22:11:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 29974 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5CMCZ1d016656 for ; Fri, 12 Jun 2009 22:12:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934406AbZFLWLg (ORCPT ); Fri, 12 Jun 2009 18:11:36 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932979AbZFLWLg (ORCPT ); Fri, 12 Jun 2009 18:11:36 -0400 Received: from mail-pz0-f187.google.com ([209.85.222.187]:36154 "EHLO mail-pz0-f187.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934215AbZFLWLf (ORCPT ); Fri, 12 Jun 2009 18:11:35 -0400 Received: by mail-pz0-f187.google.com with SMTP id 17so811108pzk.33 for ; Fri, 12 Jun 2009 15:11:38 -0700 (PDT) Received: by 10.142.246.19 with SMTP id t19mr1629116wfh.146.1244844698311; Fri, 12 Jun 2009 15:11:38 -0700 (PDT) Received: from localhost ([216.254.16.51]) by mx.google.com with ESMTPS id 30sm447867wfc.38.2009.06.12.15.11.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 12 Jun 2009 15:11:37 -0700 (PDT) From: Kevin Hilman To: linux-omap@vger.kernel.org Cc: Kevin Hilman Subject: [PATCH 1/2] OMAP2/3: SoC IDs: add omap_type() for determining GP/EMU/HS Date: Fri, 12 Jun 2009 15:11:32 -0700 Message-Id: <1244844693-24126-2-git-send-email-khilman@ti.deeprootsystems.com> X-Mailer: git-send-email 1.6.2.2 In-Reply-To: <1244844693-24126-1-git-send-email-khilman@ti.deeprootsystems.com> References: <1244844693-24126-1-git-send-email-khilman@ti.deeprootsystems.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org The omap_type() function is added and returns the DEVICETYPE field of the CONTROL_STATUS register. The result can be used for conditional code based on whether device is GP, EMU or HS. Signed-off-by: Kevin Hilman --- arch/arm/mach-omap2/id.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c index 458990e..a98201c 100644 --- a/arch/arm/mach-omap2/id.c +++ b/arch/arm/mach-omap2/id.c @@ -48,6 +48,28 @@ int omap_chip_is(struct omap_chip_id oci) } EXPORT_SYMBOL(omap_chip_is); +int omap_type(void) +{ + u32 val = 0; + + if (cpu_is_omap24xx()) + val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS); + else if (cpu_is_omap34xx()) + val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS); + else { + pr_err("Cannot detect omap type!\n"); + goto out; + } + + val &= OMAP2_DEVICETYPE_MASK; + val >>= 8; + +out: + return val; +} +EXPORT_SYMBOL(omap_type); + + /*----------------------------------------------------------------------------*/ #define OMAP_TAP_IDCODE 0x0204