public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.arm.linux.org.uk
Cc: linux-omap@vger.kernel.org,
	Kevin Hilman <khilman@ti.deeprootsystems.com>
Subject: [PATCH 06/12] OMAP2/3: Add omap_type() for determining GP/EMU/HS
Date: Mon, 22 Jun 2009 14:45:06 +0300	[thread overview]
Message-ID: <20090622114506.28477.81240.stgit@localhost> (raw)
In-Reply-To: <20090622113422.28477.27052.stgit@localhost>

From: Kevin Hilman <khilman@deeprootsystems.com>

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 (general purpose), EMU or
HS (high security). Also move the type defines so omap1 code
compile does not require ifdefs for sections using these defines.

This code is needed for the following fix to set the SRAM
size correctly for HS omaps.  Also at least PM and watchdog
code will need this function.

Signed-off-by: Kevin Hilman <khilman@ti.deeprootsystems.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/id.c              |   22 ++++++++++++++++++++++
 arch/arm/plat-omap/include/mach/cpu.h |   22 +++++++++++-----------
 2 files changed, 33 insertions(+), 11 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
diff --git a/arch/arm/plat-omap/include/mach/cpu.h b/arch/arm/plat-omap/include/mach/cpu.h
index fc60c4e..285eaa3 100644
--- a/arch/arm/plat-omap/include/mach/cpu.h
+++ b/arch/arm/plat-omap/include/mach/cpu.h
@@ -30,6 +30,17 @@
 #ifndef __ASM_ARCH_OMAP_CPU_H
 #define __ASM_ARCH_OMAP_CPU_H
 
+/*
+ * Omap device type i.e. EMU/HS/TST/GP/BAD
+ */
+#define OMAP2_DEVICE_TYPE_TEST		0
+#define OMAP2_DEVICE_TYPE_EMU		1
+#define OMAP2_DEVICE_TYPE_SEC		2
+#define OMAP2_DEVICE_TYPE_GP		3
+#define OMAP2_DEVICE_TYPE_BAD		4
+
+int omap_type(void);
+
 struct omap_chip_id {
 	u8 oc;
 	u8 type;
@@ -424,17 +435,6 @@ IS_OMAP_TYPE(3430, 0x3430)
 
 
 int omap_chip_is(struct omap_chip_id oci);
-int omap_type(void);
-
-/*
- * Macro to detect device type i.e. EMU/HS/TST/GP/BAD
- */
-#define OMAP2_DEVICE_TYPE_TEST		0
-#define OMAP2_DEVICE_TYPE_EMU		1
-#define OMAP2_DEVICE_TYPE_SEC		2
-#define OMAP2_DEVICE_TYPE_GP		3
-#define OMAP2_DEVICE_TYPE_BAD		4
-
 void omap2_check_revision(void);
 
 #endif    /* defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) */


  parent reply	other threads:[~2009-06-22 11:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-22 11:36 [PATCH 00/12] Omap fixes for 2.6.31 Tony Lindgren
2009-06-22 11:38 ` [PATCH 01/12] OMAP1: Fix compilation of arch/arm/mach-omap1/mailbox.c Tony Lindgren
2009-06-22 11:39 ` [PATCH 02/12] OMAP1: Fix N770 MMC support Tony Lindgren
2009-06-22 11:41 ` [PATCH 03/12] OMAP1: remove duplicated #include Tony Lindgren
2009-06-22 11:42 ` [PATCH 04/12] OMAP2/3: mmc-twl4030: use correct controller in twl_mmc23_set_power Tony Lindgren
2009-06-22 11:43 ` [PATCH 05/12] OMAP2/3: omap mailbox: platform_get_irq() error ignored Tony Lindgren
2009-06-22 11:45 ` Tony Lindgren [this message]
2009-06-22 11:46 ` [PATCH 07/12] OMAP3: SRAM size fix for HS/EMU devices Tony Lindgren
2009-06-22 11:47 ` [PATCH 08/12] OMAP3: DMA: Enable idlemodes for DMA OCP Tony Lindgren
2009-06-22 11:49 ` [PATCH 09/12] OMAP2/3: gpmc-onenand: correct use of async timings Tony Lindgren
2009-06-22 11:50 ` [PATCH 10/12] OMAP3: RX51: Use OneNAND sync read / write Tony Lindgren
2009-06-22 11:51 ` [PATCH 11/12] OMAP: IOMMU: function flush_iotlb_page is not flushing correct entry Tony Lindgren
2009-06-22 11:53 ` [PATCH 12/12] OMAP2/3: Initialize gpio debounce register Tony Lindgren
2009-06-23 13:57   ` [PATCH 13/12] OMAP: Fix IOMEM macro for assembly Tony Lindgren
2009-06-25 12:27 ` [PATCH 00/12] Omap fixes for 2.6.31 Russell King - ARM Linux
2009-06-25 12:35   ` Git pull request for omap-fixes for 2.6.31 (Re: [PATCH 00/12] Omap fixes for 2.6.31) Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090622114506.28477.81240.stgit@localhost \
    --to=tony@atomide.com \
    --cc=khilman@ti.deeprootsystems.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox