diff mbox

[v1,1/8] ARM: tegra: introduce support for reading chipid

Message ID 1327597641-7519-2-git-send-email-pdeschrijver@nvidia.com
State Superseded, archived
Headers show

Commit Message

Peter De Schrijver Jan. 26, 2012, 5:07 p.m. UTC
Introduce a function to read the Tegra chipid. This will be used by the SMP
code to distinguish between Tegra variants.

---

Should this be merged with the fuse reading code even though this is a
hardwired register, not a fuse based register?

Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
---
 arch/arm/mach-tegra/chipid.h |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-tegra/chipid.h

Comments

Olof Johansson Jan. 27, 2012, 8:19 a.m. UTC | #1
Hi,

On Thu, Jan 26, 2012 at 07:07:06PM +0200, Peter De Schrijver wrote:
> Introduce a function to read the Tegra chipid. This will be used by the SMP
> code to distinguish between Tegra variants.
> 
> ---
> 
> Should this be merged with the fuse reading code even though this is a
> hardwired register, not a fuse based register?

Well, it's part of a register that the fuse code already reads, i.e. in
tegra_get_revision(). I'd say add it there instead of create a separate
file for it.

There's actually an opencoded version of this in that very function
already that can be cleaned up at the same time (to check for A03p vs
A03 revisions).


-Olof

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-tegra/chipid.h b/arch/arm/mach-tegra/chipid.h
new file mode 100644
index 0000000..beb6a66
--- /dev/null
+++ b/arch/arm/mach-tegra/chipid.h
@@ -0,0 +1,38 @@ 
+/*
+ * arch/arm/mach-tegra/chipid.h
+ *
+ * Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __MACH_TEGRA_CHIPID_H
+#define __MACH_TEGRA_CHIPID_H
+
+#define APB_MISC_GP_HIDREV	0x804
+
+#define	TEGRA20			0x20
+#define	TEGRA30			0x30
+
+#ifndef __ASSEMBLY__
+
+#include <asm/io.h>
+
+static inline u32 tegra_get_chipid(void)
+{
+	return readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) +
+				APB_MISC_GP_HIDREV) >> 8 & 0xff;
+}
+
+#endif
+#endif