mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Prashant Gaikwad <pgaikwad@nvidia.com>
To: <mturquette@linaro.org>, <swarren@nvidia.com>
Cc: <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	Prashant Gaikwad <pgaikwad@nvidia.com>
Subject: [PATCH v3 1/9] ARM: tegra: Add function to read chipid
Date: Fri, 4 Jan 2013 15:10:45 +0530	[thread overview]
Message-ID: <1357292453-28418-2-git-send-email-pgaikwad@nvidia.com> (raw)
In-Reply-To: <1357292453-28418-1-git-send-email-pgaikwad@nvidia.com>

Add function to read chip id from APB MISC registers. This function
will also get called from clock driver to flush write operations on
apb bus.

Signed-off-by: Prashant Gaikwad <pgaikwad@nvidia.com>
---
 arch/arm/mach-tegra/fuse.c |   12 ++++++++++--
 include/linux/tegra-soc.h  |   22 ++++++++++++++++++++++
 2 files changed, 32 insertions(+), 2 deletions(-)
 create mode 100644 include/linux/tegra-soc.h

diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
index 8121742..2cd8ac9 100644
--- a/arch/arm/mach-tegra/fuse.c
+++ b/arch/arm/mach-tegra/fuse.c
@@ -20,6 +20,7 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 #include <linux/export.h>
+#include <linux/tegra-soc.h>
 
 #include "fuse.h"
 #include "iomap.h"
@@ -105,6 +106,14 @@ static void tegra_get_process_id(void)
 	tegra_core_process_id = (reg >> 12) & 3;
 }
 
+void tegra_read_chipid(void)
+{
+	u32 reg;
+
+	reg = readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804);
+	tegra_chip_id = (reg >> 8) & 0xff;
+}
+
 void tegra_init_fuse(void)
 {
 	u32 id;
@@ -119,8 +128,7 @@ 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;
 
-	id = readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804);
-	tegra_chip_id = (id >> 8) & 0xff;
+	tegra_read_chipid();
 
 	switch (tegra_chip_id) {
 	case TEGRA20:
diff --git a/include/linux/tegra-soc.h b/include/linux/tegra-soc.h
new file mode 100644
index 0000000..dcbc14c
--- /dev/null
+++ b/include/linux/tegra-soc.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 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 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 __LINUX_TEGRA_SOC_H_
+#define __LINUX_TEGRA_SOC_H_
+
+void tegra_read_chipid(void);
+
+#endif /* __LINUX_TEGRA_SOC_H_ */
-- 
1.7.4.1


  reply	other threads:[~2013-01-04  9:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-04  9:40 [PATCH v3 0/9] Migrate Tegra to common clock framework Prashant Gaikwad
2013-01-04  9:40 ` Prashant Gaikwad [this message]
2013-01-04  9:40 ` [PATCH v3 2/9] clk: tegra: Add tegra specific clocks Prashant Gaikwad
2013-01-04  9:40 ` [PATCH v3 3/9] arm: tegra: Move tegra_cpu_car.h to linux/clk/tegra.h Prashant Gaikwad
2013-01-04  9:40 ` [PATCH v3 4/9] ARM: tegra: Define Tegra20 CAR binding Prashant Gaikwad
2013-01-04  9:40 ` [PATCH v3 5/9] ARM: Tegra: Define Tegra30 " Prashant Gaikwad
2013-01-04  9:40 ` [PATCH v3 6/9] clk: tegra: add clock support for tegra20 Prashant Gaikwad
2013-01-04  9:40 ` [PATCH v3 7/9] clk: tegra: add clock support for tegra30 Prashant Gaikwad
2013-01-04  9:40 ` [PATCH v3 8/9] arm: tegra: Migrate to new clock code Prashant Gaikwad
2013-01-04  9:40 ` [PATCH v3 9/9] arm: tegra: Remove legacy " Prashant Gaikwad
2013-01-04 11:20 ` [PATCH v3 0/9] Migrate Tegra to common clock framework Joseph Lo
2013-01-04 17:22 ` Stephen Warren

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=1357292453-28418-2-git-send-email-pgaikwad@nvidia.com \
    --to=pgaikwad@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --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

all inboxes | Powered by JetHome®