Skip to content

Commit c7736ed

Browse files
prasshantgStephen Warren
authored andcommitted
ARM: tegra: add function to read chipid
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> Signed-off-by: Stephen Warren <swarren@nvidia.com>
1 parent 24e30c9 commit c7736ed

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

‎arch/arm/mach-tegra/fuse.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/kernel.h>
2121
#include <linux/io.h>
2222
#include <linux/export.h>
23+
#include <linux/tegra-soc.h>
2324

2425
#include "fuse.h"
2526
#include "iomap.h"
@@ -105,6 +106,11 @@ static void tegra_get_process_id(void)
105106
tegra_core_process_id = (reg >> 12) & 3;
106107
}
107108

109+
u32 tegra_read_chipid(void)
110+
{
111+
return readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804);
112+
}
113+
108114
void tegra_init_fuse(void)
109115
{
110116
u32 id;
@@ -119,7 +125,7 @@ void tegra_init_fuse(void)
119125
reg = tegra_apb_readl(TEGRA_APB_MISC_BASE + STRAP_OPT);
120126
tegra_bct_strapping = (reg & RAM_ID_MASK) >> RAM_CODE_SHIFT;
121127

122-
id = readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804);
128+
id = tegra_read_chipid();
123129
tegra_chip_id = (id >> 8) & 0xff;
124130

125131
switch (tegra_chip_id) {

‎include/linux/tegra-soc.h‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
3+
*
4+
* This program is free software; you can redistribute it and/or modify it
5+
* under the terms and conditions of the GNU General Public License,
6+
* version 2, as published by the Free Software Foundation.
7+
*
8+
* This program is distributed in the hope it will be useful, but WITHOUT
9+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11+
* more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
17+
#ifndef __LINUX_TEGRA_SOC_H_
18+
#define __LINUX_TEGRA_SOC_H_
19+
20+
u32 tegra_read_chipid(void);
21+
22+
#endif /* __LINUX_TEGRA_SOC_H_ */

0 commit comments

Comments
 (0)