[U-Boot] [PATCH] ARM: tegra: Disable VPR

Stephen Warren
2014-06-19T16:08:59Z

On 06/19/2014 12:58 AM, Alexandre Courbot wrote:
> From: Bryan Wu <pengw@nvidia.com>
>
> On Tegra114 and Tegra124 platforms, certain display-related registers cannot
> be accessed unless the VPR registers are programmed. For bootloader, we
> probably don't care about VPR, so we disable it (which counts as programming
> it, and allows those display-related registers to be accessed.

> diff --git a/arch/arm/cpu/tegra-common/vpr.c b/arch/arm/cpu/tegra-common/vpr.c

> +void config_vpr(void)

> + /* Turn off VPR */
> + writel(0x00000000, &mc->mc_video_protect_size_mb);
> + writel(0x00000001, &mc->mc_video_protect_reg_ctrl);

Can we use a #define rather than "1" there, so we know what the bit
means. Also "0" is as good as "0x00000000" and same for "1".

> diff --git a/arch/arm/include/asm/arch-tegra/mc.h b/arch/arm/include/asm/arch-tegra/mc.h

> +/**
> + * Defines the memory controller registers we need/care about
> + */
> +struct mc_ctlr {
> + u32 reserved0[4]; /* offset 0x00 - 0x0C */
> + u32 mc_smmu_config; /* offset 0x10 */
...

Is this entire layout valid for Tegra20/30 too, and identical for
Tegra114/124? If not, I'd prefer that we:

- Define the structure in arch/arm/include/asm/arch-tegraNNN/mc.h, so
it's obvious that it's not identical on all SoCs (or if the differences
are small, then ifdef the fields in the struct without moving the file
to avoid duplicating the identical parts).

- ifdef out the body of config_vpr() except on SoCs where struct mc_ctrl
is defined.

(actually, ifdefing the body might be useful anyway to remove the code
from builds for older SoCs)