Skip to content

Commit

Permalink
Merge branch 'master' of git://git.denx.de/u-boot-tegra
Browse files Browse the repository at this point in the history
  • Loading branch information
trini committed Jan 1, 2015
2 parents b7b3b8c + cc0856c commit a74a4a8
Show file tree
Hide file tree
Showing 50 changed files with 4,433 additions and 44 deletions.
19 changes: 19 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -4016,6 +4016,25 @@ Configuration Settings:
boards which do not use the full malloc in SPL (which is
enabled with CONFIG_SYS_SPL_MALLOC_START).

- CONFIG_SYS_NONCACHED_MEMORY:
Size of non-cached memory area. This area of memory will be
typically located right below the malloc() area and mapped
uncached in the MMU. This is useful for drivers that would
otherwise require a lot of explicit cache maintenance. For
some drivers it's also impossible to properly maintain the
cache. For example if the regions that need to be flushed
are not a multiple of the cache-line size, *and* padding
cannot be allocated between the regions to align them (i.e.
if the HW requires a contiguous array of regions, and the
size of each region is not cache-aligned), then a flush of
one region may result in overwriting data that hardware has
written to another region in the same cache-line. This can
happen for example in network drivers where descriptors for
buffers are typically smaller than the CPU cache-line (e.g.
16 bytes vs. 32 or 64 bytes).

Non-cached memory is only supported on 32-bit ARM at present.

- CONFIG_SYS_BOOTM_LEN:
Normally compressed uImages are limited to an
uncompressed size of 8 MBytes. If this is not enough,
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/cpu/tegra-common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ obj-y += cache.o
obj-y += clock.o
obj-y += lowlevel_init.o
obj-y += pinmux-common.o
obj-y += powergate.o
obj-y += xusb-padctl.o
obj-$(CONFIG_DISPLAY_CPUINFO) += sys_info.o
obj-$(CONFIG_TEGRA124) += vpr.o
102 changes: 102 additions & 0 deletions arch/arm/cpu/tegra-common/powergate.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
* Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0
*/

#include <common.h>
#include <errno.h>

#include <asm/io.h>
#include <asm/types.h>

#include <asm/arch/powergate.h>
#include <asm/arch/tegra.h>

#define PWRGATE_TOGGLE 0x30
#define PWRGATE_TOGGLE_START (1 << 8)

#define REMOVE_CLAMPING 0x34

#define PWRGATE_STATUS 0x38

static int tegra_powergate_set(enum tegra_powergate id, bool state)
{
u32 value, mask = state ? (1 << id) : 0, old_mask;
unsigned long start, timeout = 25;

value = readl(NV_PA_PMC_BASE + PWRGATE_STATUS);
old_mask = value & (1 << id);

if (mask == old_mask)
return 0;

writel(PWRGATE_TOGGLE_START | id, NV_PA_PMC_BASE + PWRGATE_TOGGLE);

start = get_timer(0);

while (get_timer(start) < timeout) {
value = readl(NV_PA_PMC_BASE + PWRGATE_STATUS);
if ((value & (1 << id)) == mask)
return 0;
}

return -ETIMEDOUT;
}

static int tegra_powergate_power_on(enum tegra_powergate id)
{
return tegra_powergate_set(id, true);
}

int tegra_powergate_power_off(enum tegra_powergate id)
{
return tegra_powergate_set(id, false);
}

static int tegra_powergate_remove_clamping(enum tegra_powergate id)
{
unsigned long value;

/*
* The REMOVE_CLAMPING register has the bits for the PCIE and VDEC
* partitions reversed. This was originally introduced on Tegra20 but
* has since been carried forward for backwards-compatibility.
*/
if (id == TEGRA_POWERGATE_VDEC)
value = 1 << TEGRA_POWERGATE_PCIE;
else if (id == TEGRA_POWERGATE_PCIE)
value = 1 << TEGRA_POWERGATE_VDEC;
else
value = 1 << id;

writel(value, NV_PA_PMC_BASE + REMOVE_CLAMPING);

return 0;
}

int tegra_powergate_sequence_power_up(enum tegra_powergate id,
enum periph_id periph)
{
int err;

reset_set_enable(periph, 1);

err = tegra_powergate_power_on(id);
if (err < 0)
return err;

clock_enable(periph);

udelay(10);

err = tegra_powergate_remove_clamping(id);
if (err < 0)
return err;

udelay(10);

reset_set_enable(periph, 0);

return 0;
}
39 changes: 39 additions & 0 deletions arch/arm/cpu/tegra-common/xusb-padctl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0
*/

#include <common.h>
#include <errno.h>

#include <asm/arch-tegra/xusb-padctl.h>

struct tegra_xusb_phy * __weak tegra_xusb_phy_get(unsigned int type)
{
return NULL;
}

int __weak tegra_xusb_phy_prepare(struct tegra_xusb_phy *phy)
{
return -ENOSYS;
}

int __weak tegra_xusb_phy_enable(struct tegra_xusb_phy *phy)
{
return -ENOSYS;
}

int __weak tegra_xusb_phy_disable(struct tegra_xusb_phy *phy)
{
return -ENOSYS;
}

int __weak tegra_xusb_phy_unprepare(struct tegra_xusb_phy *phy)
{
return -ENOSYS;
}

void __weak tegra_xusb_padctl_init(const void *fdt)
{
}
1 change: 1 addition & 0 deletions arch/arm/cpu/tegra124-common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
obj-y += clock.o
obj-y += funcmux.o
obj-y += pinmux.o
obj-y += xusb-padctl.o
109 changes: 109 additions & 0 deletions arch/arm/cpu/tegra124-common/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,3 +824,112 @@ void arch_timer_init(void)
writel(val, &sysctr->cntcr);
debug("%s: TSC CNTCR = 0x%08X\n", __func__, val);
}

#define PLLE_SS_CNTL 0x68
#define PLLE_SS_CNTL_SSCINCINTR(x) (((x) & 0x3f) << 24)
#define PLLE_SS_CNTL_SSCINC(x) (((x) & 0xff) << 16)
#define PLLE_SS_CNTL_SSCINVERT (1 << 15)
#define PLLE_SS_CNTL_SSCCENTER (1 << 14)
#define PLLE_SS_CNTL_SSCBYP (1 << 12)
#define PLLE_SS_CNTL_INTERP_RESET (1 << 11)
#define PLLE_SS_CNTL_BYPASS_SS (1 << 10)
#define PLLE_SS_CNTL_SSCMAX(x) (((x) & 0x1ff) << 0)

#define PLLE_BASE 0x0e8
#define PLLE_BASE_ENABLE (1 << 30)
#define PLLE_BASE_LOCK_OVERRIDE (1 << 29)
#define PLLE_BASE_PLDIV_CML(x) (((x) & 0xf) << 24)
#define PLLE_BASE_NDIV(x) (((x) & 0xff) << 8)
#define PLLE_BASE_MDIV(x) (((x) & 0xff) << 0)

#define PLLE_MISC 0x0ec
#define PLLE_MISC_IDDQ_SWCTL (1 << 14)
#define PLLE_MISC_IDDQ_OVERRIDE (1 << 13)
#define PLLE_MISC_LOCK_ENABLE (1 << 9)
#define PLLE_MISC_PTS (1 << 8)
#define PLLE_MISC_VREG_BG_CTRL(x) (((x) & 0x3) << 4)
#define PLLE_MISC_VREG_CTRL(x) (((x) & 0x3) << 2)

#define PLLE_AUX 0x48c
#define PLLE_AUX_SEQ_ENABLE (1 << 24)
#define PLLE_AUX_ENABLE_SWCTL (1 << 4)

int tegra_plle_enable(void)
{
unsigned int m = 1, n = 200, cpcon = 13;
u32 value;

value = readl(NV_PA_CLK_RST_BASE + PLLE_BASE);
value &= ~PLLE_BASE_LOCK_OVERRIDE;
writel(value, NV_PA_CLK_RST_BASE + PLLE_BASE);

value = readl(NV_PA_CLK_RST_BASE + PLLE_AUX);
value |= PLLE_AUX_ENABLE_SWCTL;
value &= ~PLLE_AUX_SEQ_ENABLE;
writel(value, NV_PA_CLK_RST_BASE + PLLE_AUX);

udelay(1);

value = readl(NV_PA_CLK_RST_BASE + PLLE_MISC);
value |= PLLE_MISC_IDDQ_SWCTL;
value &= ~PLLE_MISC_IDDQ_OVERRIDE;
value |= PLLE_MISC_LOCK_ENABLE;
value |= PLLE_MISC_PTS;
value |= PLLE_MISC_VREG_BG_CTRL(3);
value |= PLLE_MISC_VREG_CTRL(2);
writel(value, NV_PA_CLK_RST_BASE + PLLE_MISC);

udelay(5);

value = readl(NV_PA_CLK_RST_BASE + PLLE_SS_CNTL);
value |= PLLE_SS_CNTL_SSCBYP | PLLE_SS_CNTL_INTERP_RESET |
PLLE_SS_CNTL_BYPASS_SS;
writel(value, NV_PA_CLK_RST_BASE + PLLE_SS_CNTL);

value = readl(NV_PA_CLK_RST_BASE + PLLE_BASE);
value &= ~PLLE_BASE_PLDIV_CML(0xf);
value &= ~PLLE_BASE_NDIV(0xff);
value &= ~PLLE_BASE_MDIV(0xff);
value |= PLLE_BASE_PLDIV_CML(cpcon);
value |= PLLE_BASE_NDIV(n);
value |= PLLE_BASE_MDIV(m);
writel(value, NV_PA_CLK_RST_BASE + PLLE_BASE);

udelay(1);

value = readl(NV_PA_CLK_RST_BASE + PLLE_BASE);
value |= PLLE_BASE_ENABLE;
writel(value, NV_PA_CLK_RST_BASE + PLLE_BASE);

/* wait for lock */
udelay(300);

value = readl(NV_PA_CLK_RST_BASE + PLLE_SS_CNTL);
value &= ~PLLE_SS_CNTL_SSCINVERT;
value &= ~PLLE_SS_CNTL_SSCCENTER;

value &= ~PLLE_SS_CNTL_SSCINCINTR(0x3f);
value &= ~PLLE_SS_CNTL_SSCINC(0xff);
value &= ~PLLE_SS_CNTL_SSCMAX(0x1ff);

value |= PLLE_SS_CNTL_SSCINCINTR(0x20);
value |= PLLE_SS_CNTL_SSCINC(0x01);
value |= PLLE_SS_CNTL_SSCMAX(0x25);

writel(value, NV_PA_CLK_RST_BASE + PLLE_SS_CNTL);

value = readl(NV_PA_CLK_RST_BASE + PLLE_SS_CNTL);
value &= ~PLLE_SS_CNTL_SSCBYP;
value &= ~PLLE_SS_CNTL_BYPASS_SS;
writel(value, NV_PA_CLK_RST_BASE + PLLE_SS_CNTL);

udelay(1);

value = readl(NV_PA_CLK_RST_BASE + PLLE_SS_CNTL);
value &= ~PLLE_SS_CNTL_INTERP_RESET;
writel(value, NV_PA_CLK_RST_BASE + PLLE_SS_CNTL);

udelay(1);

return 0;
}
Loading

0 comments on commit a74a4a8

Please sign in to comment.