mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter De Schrijver <pdeschrijver@nvidia.com>
To: Peter De Schrijver <pdeschrijver@nvidia.com>
Cc: Colin Cross <ccross@android.com>, Olof Johansson <olof@lixom.net>,
	Stephen Warren <swarren@nvidia.com>,
	Russell King <linux@arm.linux.org.uk>,
	Gary King <gking@nvidia.com>, Arnd Bergmann <arnd@arndb.de>,
	linux-tegra@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v3 01/10] ARM: tegra: cleanup use of chipid register
Date: Fri, 10 Feb 2012 01:47:41 +0200	[thread overview]
Message-ID: <1328831277-21002-2-git-send-email-pdeschrijver@nvidia.com> (raw)
In-Reply-To: <1328831277-21002-1-git-send-email-pdeschrijver@nvidia.com>

The chipid register contains information about the Tegra variant and revision.
We want differentiate between Tegra variants for powergating and secondary
core bringup. This patch cleans up the reading and decoding of this register.
In subsequent patches the variant will exported as a global variable.

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
---
 arch/arm/mach-tegra/fuse.c |   18 +++++++++++-------
 arch/arm/mach-tegra/fuse.h |    3 +++
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
index adfa429..032a936 100644
--- a/arch/arm/mach-tegra/fuse.c
+++ b/arch/arm/mach-tegra/fuse.c
@@ -34,6 +34,7 @@
 int tegra_sku_id;
 int tegra_cpu_process_id;
 int tegra_core_process_id;
+static int tegra_chip_id;
 enum tegra_revision tegra_revision;
 
 /* The BCT to use at boot is specified by board straps that can be read
@@ -66,12 +67,9 @@ static inline bool get_spare_fuse(int bit)
 	return tegra_fuse_readl(FUSE_SPARE_BIT + bit * 4);
 }
 
-static enum tegra_revision tegra_get_revision(void)
+static enum tegra_revision tegra_get_revision(u32 id)
 {
-	void __iomem *chip_id = IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804;
-	u32 id = readl(chip_id);
 	u32 minor_rev = (id >> 16) & 0xf;
-	u32 chipid = (id >> 8) & 0xff;
 
 	switch (minor_rev) {
 	case 1:
@@ -79,7 +77,8 @@ static enum tegra_revision tegra_get_revision(void)
 	case 2:
 		return TEGRA_REVISION_A02;
 	case 3:
-		if (chipid == 0x20 && (get_spare_fuse(18) || get_spare_fuse(19)))
+		if (tegra_chip_id == TEGRA20 &&
+			(get_spare_fuse(18) || get_spare_fuse(19)))
 			return TEGRA_REVISION_A03p;
 		else
 			return TEGRA_REVISION_A03;
@@ -92,6 +91,8 @@ static enum tegra_revision tegra_get_revision(void)
 
 void tegra_init_fuse(void)
 {
+	u32 id;
+
 	u32 reg = readl(IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48));
 	reg |= 1 << 28;
 	writel(reg, IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48));
@@ -108,10 +109,13 @@ void tegra_init_fuse(void)
 	reg = tegra_apb_readl(TEGRA_APB_MISC_BASE + STRAP_OPT);
 	tegra_bct_strapping = (reg & RAM_ID_MASK) >> RAM_CODE_SHIFT;
 
-	tegra_revision = tegra_get_revision();
+	id = readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804);
+	tegra_chip_id = (id >> 8) & 0xff;
+
+	tegra_revision = tegra_get_revision(id);
 
 	pr_info("Tegra Revision: %s SKU: %d CPU Process: %d Core Process: %d\n",
-		tegra_revision_name[tegra_get_revision()],
+		tegra_revision_name[tegra_revision],
 		tegra_sku_id, tegra_cpu_process_id,
 		tegra_core_process_id);
 }
diff --git a/arch/arm/mach-tegra/fuse.h b/arch/arm/mach-tegra/fuse.h
index d65d2ab..c554572 100644
--- a/arch/arm/mach-tegra/fuse.h
+++ b/arch/arm/mach-tegra/fuse.h
@@ -35,6 +35,9 @@ enum tegra_revision {
 #define SKU_ID_AP25E	27
 #define SKU_ID_T25E	28
 
+#define TEGRA20		0x20
+#define TEGRA30		0x30
+
 extern int tegra_sku_id;
 extern int tegra_cpu_process_id;
 extern int tegra_core_process_id;
-- 
1.7.4.1


  reply	other threads:[~2012-02-09 23:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-09 23:47 [PATCH v3 00/10] Add tegra30 support for secondary cores Peter De Schrijver
2012-02-09 23:47 ` Peter De Schrijver [this message]
2012-02-09 23:47 ` [PATCH v3 02/10] ARM: tegra: export Tegra chipid Peter De Schrijver
2012-02-20 23:13   ` Colin Cross
2012-02-20 23:30     ` Olof Johansson
2012-02-22 19:19       ` Colin Cross
2012-02-09 23:47 ` [PATCH v3 03/10] ARM: tegra: initialize Tegra chipid early Peter De Schrijver
2012-02-09 23:47 ` [PATCH v3 04/10] ARM: tegra: functions to access the flowcontroller Peter De Schrijver
2012-02-09 23:47 ` [PATCH v3 05/10] ARM: tegra: rework Tegra secondary CPU core bringup Peter De Schrijver
2012-02-20 23:04   ` Colin Cross
2012-02-26 21:57     ` Olof Johansson
2012-02-09 23:47 ` [PATCH v3 06/10] ARM: tegra: prepare powergate.c for multiple variants Peter De Schrijver
2012-02-09 23:47 ` [PATCH v3 07/10] ARM: tegra: export tegra_powergate_is_powered() Peter De Schrijver
2012-02-09 23:47 ` [PATCH v3 08/10] ARM: tegra: add support for Tegra30 powerdomains Peter De Schrijver
2012-02-09 23:47 ` [PATCH v3 09/10] ARM: tegra: support for Tegra30 CPU powerdomains Peter De Schrijver
2012-02-09 23:47 ` [PATCH v3 10/10] ARM: tegra: support for secondary cores on Tegra30 Peter De Schrijver
2012-02-15 21:27 ` [PATCH v3 00/10] Add tegra30 support for secondary cores Stephen Warren
2012-02-15 22:25   ` Peter De Schrijver
2012-02-29 15:42   ` Peter De Schrijver
2012-02-29 22:38     ` Stephen Warren
2012-03-01 11:42       ` Peter De Schrijver
2012-03-01 14:35         ` Peter De Schrijver
2012-02-26 21:59 ` Olof Johansson

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=1328831277-21002-2-git-send-email-pdeschrijver@nvidia.com \
    --to=pdeschrijver@nvidia.com \
    --cc=arnd@arndb.de \
    --cc=ccross@android.com \
    --cc=gking@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=olof@lixom.net \
    --cc=swarren@nvidia.com \
    /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

Powered by JetHome