ARM: tegra: RAM code access for v4.2-rc1

The RAM code is used by the memory and external memory controllers to
 determine which set of timings to use for memory frequency scaling.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJVU1A5AAoJEN0jrNd/PrOhd9IP/iKCdG7BcPX5V+ae7u+12quN
 iMvYQBW7z9g292XnFvrB7pOqJaZIp0qLGAWpqA8DqOmF2nLVt5yw8yBB9kEWeeJ6
 0Il3xUneZ7NNpdN5NzCWkVfKdr2xFIvWfsl4LrW4fr7C0VaeMi9xq+cFBxK82Xpz
 9z9PDDz02ZnVGbaNZJNR7Tc5Ub0dEKHeRlpCFi9wJi0DXrURIklXuLPCoCiEH4KV
 K6AuC69ChR4m0nQqhkbeXK4395nfKEIgV+Rmlp6/spJoaQBFC5WELtEzzDLuPS2+
 4asfoFZgqEI0tSbG7sczJ4wdPrissYTULfpMW7cVC98vtzMmZLTixoAsgTss9CxS
 wmkKyrrgbHM7yxqMksIF7b1z385E7OgNaMMmNPKHfKbzyuoHo+qomFo3WfMLHoZt
 2sNvg8qfD0ueCsrsy4zNLoBq+QgwXyDRRO8DnAlToUD7sadqBbPpb3gJd2tBUVjI
 v29hf/k3TnMVJJo+uRcZfAaQMvhDr2SK1XDSTzJ3Emkvch70d9idlxmf2H+auSY7
 Fbv+NHmdjQeoARicwKAR2ZMc9RVrtQ2/FCMxirX/lagnB3ky+3W3CkhRGuid3yNq
 koxW15TY+4YIbgPXXxAwc5uL5IeBQ8YfR7kupSaGLL+FmDD2VBSw7bogc9Plb941
 PKocKOFnw3/HRY3mOtjQ
 =yv05
 -----END PGP SIGNATURE-----

Merge tag 'tegra-for-4.2-ramcode' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into next/drivers

Merge "ARM: tegra: RAM code access for v4.2-rc1" from Thierry Reding:

The RAM code is used by the memory and external memory controllers to
determine which set of timings to use for memory frequency scaling.

* tag 'tegra-for-4.2-ramcode' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux:
  soc/tegra: fuse: Add RAM code reader helper
  of: Document long-ram-code property in nvidia,tegra20-apbmisc
This commit is contained in:
Arnd Bergmann 2015-05-13 17:56:47 +02:00
commit 92d19e26d6
3 changed files with 24 additions and 0 deletions

View File

@ -10,3 +10,5 @@ Required properties:
The second entry gives the physical address and length of the The second entry gives the physical address and length of the
registers indicating the strapping options. registers indicating the strapping options.
Optional properties:
- nvidia,long-ram-code: If present, the RAM code is long (4 bit). If not, short (2 bit).

View File

@ -28,8 +28,15 @@
#define APBMISC_SIZE 0x64 #define APBMISC_SIZE 0x64
#define FUSE_SKU_INFO 0x10 #define FUSE_SKU_INFO 0x10
#define PMC_STRAPPING_OPT_A_RAM_CODE_SHIFT 4
#define PMC_STRAPPING_OPT_A_RAM_CODE_MASK_LONG \
(0xf << PMC_STRAPPING_OPT_A_RAM_CODE_SHIFT)
#define PMC_STRAPPING_OPT_A_RAM_CODE_MASK_SHORT \
(0x3 << PMC_STRAPPING_OPT_A_RAM_CODE_SHIFT)
static void __iomem *apbmisc_base; static void __iomem *apbmisc_base;
static void __iomem *strapping_base; static void __iomem *strapping_base;
static bool long_ram_code;
u32 tegra_read_chipid(void) u32 tegra_read_chipid(void)
{ {
@ -54,6 +61,18 @@ u32 tegra_read_straps(void)
return 0; return 0;
} }
u32 tegra_read_ram_code(void)
{
u32 straps = tegra_read_straps();
if (long_ram_code)
straps &= PMC_STRAPPING_OPT_A_RAM_CODE_MASK_LONG;
else
straps &= PMC_STRAPPING_OPT_A_RAM_CODE_MASK_SHORT;
return straps >> PMC_STRAPPING_OPT_A_RAM_CODE_SHIFT;
}
static const struct of_device_id apbmisc_match[] __initconst = { static const struct of_device_id apbmisc_match[] __initconst = {
{ .compatible = "nvidia,tegra20-apbmisc", }, { .compatible = "nvidia,tegra20-apbmisc", },
{}, {},
@ -112,4 +131,6 @@ void __init tegra_init_apbmisc(void)
strapping_base = of_iomap(np, 1); strapping_base = of_iomap(np, 1);
if (!strapping_base) if (!strapping_base)
pr_err("ioremap tegra strapping_base failed\n"); pr_err("ioremap tegra strapping_base failed\n");
long_ram_code = of_property_read_bool(np, "nvidia,long-ram-code");
} }

View File

@ -56,6 +56,7 @@ struct tegra_sku_info {
}; };
u32 tegra_read_straps(void); u32 tegra_read_straps(void);
u32 tegra_read_ram_code(void);
u32 tegra_read_chipid(void); u32 tegra_read_chipid(void);
int tegra_fuse_readl(unsigned long offset, u32 *value); int tegra_fuse_readl(unsigned long offset, u32 *value);