9
0
Fork 0

tegra: lowlevel: fix ODMdata fetch on Tegra124

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Lucas Stach 2014-06-03 22:34:54 +02:00 committed by Sascha Hauer
parent ff5f8ef49a
commit c8e61fa978
1 changed files with 35 additions and 15 deletions

View File

@ -31,8 +31,9 @@
/* Bootinfotable */
#define NV_BIT_BCTSIZE 0x38 /* size of the BCT in IRAM */
#define NV_BIT_BCTPTR 0x3C /* location of the BCT in IRAM */
/* location of the BCT in IRAM */
#define NV_BIT_BCTPTR_T20 0x3c
#define NV_BIT_BCTPTR_T114 0x4c
/* ODM data */
#define BCT_ODMDATA_OFFSET 12 /* offset from the _end_ of the BCT */
@ -45,19 +46,6 @@
#define T20_ODMDATA_UARTID_SHIFT 15
#define T20_ODMDATA_UARTID_MASK (7 << T20_ODMDATA_UARTID_SHIFT)
static __always_inline
u32 tegra_get_odmdata(void)
{
u32 bctsize, bctptr, odmdata;
bctsize = cpu_readl(TEGRA_IRAM_BASE + NV_BIT_BCTSIZE);
bctptr = cpu_readl(TEGRA_IRAM_BASE + NV_BIT_BCTPTR);
odmdata = cpu_readl(bctptr + bctsize - BCT_ODMDATA_OFFSET);
return odmdata;
}
/* chip ID */
#define APB_MISC_HIDREV 0x804
#define HIDREV_CHIPID_SHIFT 8
@ -96,6 +84,38 @@ enum tegra_chiptype tegra_get_chiptype(void)
}
}
static __always_inline
u32 tegra_get_odmdata(void)
{
u32 bctptr_offset, bctptr, odmdata_offset;
enum tegra_chiptype chiptype = tegra_get_chiptype();
switch(chiptype) {
case TEGRA20:
bctptr_offset = NV_BIT_BCTPTR_T20;
odmdata_offset = 4068;
break;
case TEGRA30:
bctptr_offset = NV_BIT_BCTPTR_T20;
odmdata_offset = 6116;
break;
case TEGRA114:
bctptr_offset = NV_BIT_BCTPTR_T114;
odmdata_offset = 1752;
break;
case TEGRA124:
bctptr_offset = NV_BIT_BCTPTR_T114;
odmdata_offset = 1704;
break;
default:
return 0;
}
bctptr = cpu_readl(TEGRA_IRAM_BASE + bctptr_offset);
return cpu_readl(bctptr + odmdata_offset);
}
static __always_inline
int tegra_get_num_cores(void)
{