4bb2d1009f
This branch contains a handful of updates of SoC base code that had dependencies on other external trees that have now been merged: * Support for the new EXYNOS5250 SoC from Samsung * SMP and power domain support for Tegra3 from NVIDIA * ux500 updates for exporting SoC information through sysfs -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJPcpwnAAoJEIwa5zzehBx3RIQP/AvTVHF7EIXfu5XGLBYeKW+U HBeT1kO1qL8m3gA/+DG/JzNpd8JDlILGob6hUN4lqA8f49MBkmttdbATZvBj4Nx+ T4+louPteiueexJdolj6hVCuNBhFJLgik3zMKGHvL8wbvqYHKpfqvuWWuzxtP3Hl F1BvFSrQ5TZALGtNiRWDMwxFa2oA03ZNXjy+v9i3GIdn1vH18/IDryz7/7MW6GPv NuKmZkcEpX2jDFe3AkqUMLxqMYizfuGg20FlV4tmxiF5Wlht6EiN38Y56LZgwuly mde6AWN8qgwTYDk4cJ5ZVJtwkowosF5ko57V3SPmVaVc/WajZ0v28gt9YgNLVPL7 TXFEUJgIxzJnyM+DoSltzQ9tCsWUscQGmyPt4QSOLO2D76/3z+8+24/EwAIM/7Bj u5/+74k5jDBZe1suCt/1P1Vr3l5Z3os483R7y4BtyLtWtQvBcjpkITj9lHmnsAf3 RqN2Z4osLcILwWVKa2y2DCOeJm0jvSCsn53+O3FGTSqhfwWTUVkqaDALeGXwJGbH 2rMks18BqJ2sT2ruFXHiVvZOj/8XxkcLsq8ztnuYoHQssrNtAtBM97l/xi1V7L0z FmXnPszVA1mIkelsY2VDImEks/Iaad4o3Iuba9Yr3OKOSr/d8kLyB0reTmS/SHQL u/o8ch/V5QVEo/H+ud7K =X89H -----END PGP SIGNATURE----- Merge tag 'soc2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull "ARM: More SoC support updates" from Olof Johansson: "This branch contains a handful of updates of SoC base code that had dependencies on other external trees that have now been merged: * Support for the new EXYNOS5250 SoC from Samsung * SMP and power domain support for Tegra3 from NVIDIA * ux500 updates for exporting SoC information through sysfs" Fix up trivial merge conflicts as per Olof. * tag 'soc2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (30 commits) ARM: mach-shmobile: ap4evb: Reserve DMA memory for the frame buffer ARM: EXYNOS: Fix compilation error with mach-exynos4-dt board ARM: dts: add initial dts file for EXYNOS5250, SMDK5250 ARM: EXYNOS: add support device tree enabled board file for EXYNOS5 ARM: EXYNOS: add support ARCH_EXYNOS5 for EXYNOS5 SoCs ARM: EXYNOS: add support get_core_count() for EXYNOS5250 ARM: EXYNOS: support EINT for EXYNOS4 and EXYNOS5 ARM: EXYNOS: add interrupt definitions for EXYNOS5250 ARM: EXYNOS: add support for EXYNOS5250 SoC ARM: EXYNOS: add support uart for EXYNOS4 and EXYNOS5 ARM: EXYNOS: add initial setup-i2c0 for EXYNOS5 ARM: EXYNOS: add clock part for EXYNOS5250 SoC ARM: EXYNOS: use exynos_init_uarts() instead of exynos4_init_uarts() ARM: EXYNOS: to declare static for mach-exynos/common.c ARM: EXYNOS: Add clkdev lookup entry for lcd clock ARM: dt: Explicitly configure all serial ports on Tegra Cardhu ARM: tegra: support for secondary cores on Tegra30 ARM: tegra: support for Tegra30 CPU powerdomains ARM: tegra: add support for Tegra30 powerdomains ARM: tegra: export tegra_powergate_is_powered() ...
131 lines
3.2 KiB
C
131 lines
3.2 KiB
C
/*
|
|
* arch/arm/mach-tegra/fuse.c
|
|
*
|
|
* Copyright (C) 2010 Google, Inc.
|
|
*
|
|
* Author:
|
|
* Colin Cross <ccross@android.com>
|
|
*
|
|
* This software is licensed under the terms of the GNU General Public
|
|
* License version 2, as published by the Free Software Foundation, and
|
|
* may be copied, distributed, and modified under those terms.
|
|
*
|
|
* 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.
|
|
*
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/io.h>
|
|
#include <linux/export.h>
|
|
|
|
#include <mach/iomap.h>
|
|
|
|
#include "fuse.h"
|
|
#include "apbio.h"
|
|
|
|
#define FUSE_UID_LOW 0x108
|
|
#define FUSE_UID_HIGH 0x10c
|
|
#define FUSE_SKU_INFO 0x110
|
|
#define FUSE_SPARE_BIT 0x200
|
|
|
|
int tegra_sku_id;
|
|
int tegra_cpu_process_id;
|
|
int tegra_core_process_id;
|
|
int tegra_chip_id;
|
|
enum tegra_revision tegra_revision;
|
|
|
|
/* The BCT to use at boot is specified by board straps that can be read
|
|
* through a APB misc register and decoded. 2 bits, i.e. 4 possible BCTs.
|
|
*/
|
|
int tegra_bct_strapping;
|
|
|
|
#define STRAP_OPT 0x008
|
|
#define GMI_AD0 (1 << 4)
|
|
#define GMI_AD1 (1 << 5)
|
|
#define RAM_ID_MASK (GMI_AD0 | GMI_AD1)
|
|
#define RAM_CODE_SHIFT 4
|
|
|
|
static const char *tegra_revision_name[TEGRA_REVISION_MAX] = {
|
|
[TEGRA_REVISION_UNKNOWN] = "unknown",
|
|
[TEGRA_REVISION_A01] = "A01",
|
|
[TEGRA_REVISION_A02] = "A02",
|
|
[TEGRA_REVISION_A03] = "A03",
|
|
[TEGRA_REVISION_A03p] = "A03 prime",
|
|
[TEGRA_REVISION_A04] = "A04",
|
|
};
|
|
|
|
static inline u32 tegra_fuse_readl(unsigned long offset)
|
|
{
|
|
return tegra_apb_readl(TEGRA_FUSE_BASE + offset);
|
|
}
|
|
|
|
static inline bool get_spare_fuse(int bit)
|
|
{
|
|
return tegra_fuse_readl(FUSE_SPARE_BIT + bit * 4);
|
|
}
|
|
|
|
static enum tegra_revision tegra_get_revision(u32 id)
|
|
{
|
|
u32 minor_rev = (id >> 16) & 0xf;
|
|
|
|
switch (minor_rev) {
|
|
case 1:
|
|
return TEGRA_REVISION_A01;
|
|
case 2:
|
|
return TEGRA_REVISION_A02;
|
|
case 3:
|
|
if (tegra_chip_id == TEGRA20 &&
|
|
(get_spare_fuse(18) || get_spare_fuse(19)))
|
|
return TEGRA_REVISION_A03p;
|
|
else
|
|
return TEGRA_REVISION_A03;
|
|
case 4:
|
|
return TEGRA_REVISION_A04;
|
|
default:
|
|
return TEGRA_REVISION_UNKNOWN;
|
|
}
|
|
}
|
|
|
|
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));
|
|
|
|
reg = tegra_fuse_readl(FUSE_SKU_INFO);
|
|
tegra_sku_id = reg & 0xFF;
|
|
|
|
reg = tegra_fuse_readl(FUSE_SPARE_BIT);
|
|
tegra_cpu_process_id = (reg >> 6) & 3;
|
|
|
|
reg = tegra_fuse_readl(FUSE_SPARE_BIT);
|
|
tegra_core_process_id = (reg >> 12) & 3;
|
|
|
|
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_revision = tegra_get_revision(id);
|
|
|
|
pr_info("Tegra Revision: %s SKU: %d CPU Process: %d Core Process: %d\n",
|
|
tegra_revision_name[tegra_revision],
|
|
tegra_sku_id, tegra_cpu_process_id,
|
|
tegra_core_process_id);
|
|
}
|
|
|
|
unsigned long long tegra_chip_uid(void)
|
|
{
|
|
unsigned long long lo, hi;
|
|
|
|
lo = tegra_fuse_readl(FUSE_UID_LOW);
|
|
hi = tegra_fuse_readl(FUSE_UID_HIGH);
|
|
return (hi << 32ull) | lo;
|
|
}
|
|
EXPORT_SYMBOL(tegra_chip_uid);
|