Skip to contentSkip to conversation

mmc: tegra: support Tegra124

PATCH Superseded Stephen Warren 4 participants 23 messages Jan 24, 2014 – Jan 27, 2014

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/13 mmc: tegra: support Tegra124

From: Stephen Warren <[email protected]>

Tegra124's MMC controller is very similar to earlier SoC generations, and can be supported by the same driver.

However, there are some non-backwards-compatible HW differences, and hence a new DT compatible value must be used to describe the HW. This patch updates the driver to support that new compatible value.

That said, the HW differences are only relevant when enabling certain high-performance transfer modes. Since the driver is currently very simple and doesn't enable those modes, we don't actually need to address any of these HW differences in the code yet, hence the simple nature of this patch.

Cc Pantelis Antoniou <[email protected]>

---
v2: New patch.

This patch is needed for MMC support on Tegra124 at run-time, but not strictly required at compile-time. So, it can either go into the MMC tree and all get merged together in the main U-Boot repo, or the MMC maintainer can ack it to go through the Tegra tree with the rest of the changes.

---
 drivers/mmc/tegra_mmc.c | 9 +++++++++
 include/fdtdec.h        | 1 +
 lib/fdtdec.c            | 1 +
 3 files changed, 11 insertions(+)
drivers/mmc/tegra_mmc.c +9 -0
index e1817e24f6d4..3d1ce1263c82 100644
@@ -668,6 +668,15 @@ void tegra_mmc_init(void)
 	const void *blob = gd->fdt_blob;
 	debug("%s entry\n", __func__);
 
+	/* See if any Tegra124 MMC controllers are present */
+	count = fdtdec_find_aliases_for_id(blob, "sdhci",
+		COMPAT_NVIDIA_TEGRA124_SDMMC, node_list, MAX_HOSTS);
+	debug("%s: count of Tegra124 sdhci nodes is %d\n", __func__, count);
+	if (process_nodes(blob, node_list, count)) {
+		printf("%s: Error processing T30 mmc node(s)!\n", __func__);
+		return;
+	}
+
 	/* See if any Tegra30 MMC controllers are present */
 	count = fdtdec_find_aliases_for_id(blob, "sdhci",
 		COMPAT_NVIDIA_TEGRA30_SDMMC, node_list, MAX_HOSTS);
include/fdtdec.h +1 -0
index 433d6a7c0256..19bab7944817 100644
@@ -59,6 +59,7 @@ enum fdt_compat_id {
 	COMPAT_NVIDIA_TEGRA20_NAND,	/* Tegra2 NAND controller */
 	COMPAT_NVIDIA_TEGRA20_PWM,	/* Tegra 2 PWM controller */
 	COMPAT_NVIDIA_TEGRA20_DC,	/* Tegra 2 Display controller */
+	COMPAT_NVIDIA_TEGRA124_SDMMC,	/* Tegra124 SDMMC controller */
 	COMPAT_NVIDIA_TEGRA30_SDMMC,	/* Tegra30 SDMMC controller */
 	COMPAT_NVIDIA_TEGRA20_SDMMC,	/* Tegra20 SDMMC controller */
 	COMPAT_NVIDIA_TEGRA20_SFLASH,	/* Tegra 2 SPI flash controller */
lib/fdtdec.c +1 -0
index 207314fa72fb..1fecab3fbc30 100644
@@ -32,6 +32,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
 	COMPAT(NVIDIA_TEGRA20_NAND, "nvidia,tegra20-nand"),
 	COMPAT(NVIDIA_TEGRA20_PWM, "nvidia,tegra20-pwm"),
 	COMPAT(NVIDIA_TEGRA20_DC, "nvidia,tegra20-dc"),
+	COMPAT(NVIDIA_TEGRA124_SDMMC, "nvidia,tegra124-sdhci"),
 	COMPAT(NVIDIA_TEGRA30_SDMMC, "nvidia,tegra30-sdhci"),
 	COMPAT(NVIDIA_TEGRA20_SDMMC, "nvidia,tegra20-sdhci"),
 	COMPAT(NVIDIA_TEGRA20_SFLASH, "nvidia,tegra20-sflash"),
Signature · 1 line
1.8.1.5
#1 lore raw

PATCH v2 2/13 ARM: tegra: misc cleanups triggered by Tegra124 review

From: Stephen Warren <[email protected]>

Use a named constant for the PLL lock bit in enable_cpu_clocks().

Construct the complete value of pmc_pwrgate_toggle, rather than doing a read-modify-write; the register is simple enough and doesn't need to maintain state between operations.

---
v2: New patch, split out from the later Tegra124 changes.

---
 arch/arm/cpu/arm720t/tegra114/cpu.c       | 6 ++----
 arch/arm/include/asm/arch-tegra/clk_rst.h | 3 +++
 2 files changed, 5 insertions(+), 4 deletions(-)
arch/arm/cpu/arm720t/tegra114/cpu.c +2 -4
index 385e1a1c86e0..a5de100140ab 100644
@@ -68,7 +68,7 @@ static void enable_cpu_clocks(void)
 	/* Wait for PLL-X to lock */
 	do {
 		reg = readl(&clkrst->crc_pll_simple[SIMPLE_PLLX].pll_base);
-	} while ((reg & (1 << 27)) == 0);
+	} while ((reg & PLL_LOCK_MASK) == 0);
 
 	/* Wait until all clocks are stable */
 	udelay(PLL_STABILIZATION_DELAY);
@@ -221,9 +221,7 @@ static void power_partition(u32 status, u32 partid)
 	if (!is_partition_powered(status)) {
 		/* No, toggle the partition power state (OFF -> ON) */
 		debug("power_partition, toggling state\n");
-		clrbits_le32(&pmc->pmc_pwrgate_toggle, 0x1F);
-		setbits_le32(&pmc->pmc_pwrgate_toggle, partid);
-		setbits_le32(&pmc->pmc_pwrgate_toggle, START_CP);
+		writel(START_CP | partid, &pmc->pmc_pwrgate_toggle);
 
 		/* Wait for the power to come up */
 		while (!is_partition_powered(status))
arch/arm/include/asm/arch-tegra/clk_rst.h +3 -0
index 021cfcc3c602..b9dccd9c189f 100644
@@ -160,6 +160,9 @@ struct clk_rst_ctlr {
 
 #define PLL_BASE_OVRRIDE_MASK	(1U << 28)
 
+#define PLL_LOCK_SHIFT	27
+#define PLL_LOCK_MASK		(1U << PLL_LOCK_SHIFT)
+
 #define PLL_DIVP_SHIFT		20
 #define PLL_DIVP_MASK		(7U << PLL_DIVP_SHIFT)
 
Signature · 1 line
1.8.1.5
#2 lore raw

PATCH v2 3/13 ARM: tegra: enable PLLX only once it's been fully configured

In reply to Stephen Warren

From: Stephen Warren <[email protected]>

This programming sequence is correct per Jimmy Zhang, and makes sense too!

---
v2: New patch, split out from the later Tegra124 changes.

---
 arch/arm/cpu/arm720t/tegra-common/cpu.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
arch/arm/cpu/arm720t/tegra-common/cpu.c +9 -4
index 03f67b163cc5..322ce10d6fe3 100644
@@ -144,18 +144,23 @@ int pllx_set_rate(struct clk_pll_simple *pll , u32 divn, u32 divm,
 		reg |= (1 << PLL_DCCON_SHIFT);
 	writel(reg, &pll->pll_misc);
 
-	/* Enable PLLX */
-	reg = readl(&pll->pll_base);
-	reg |= PLL_ENABLE_MASK;
-
 	/* Disable BYPASS */
+	reg = readl(&pll->pll_base);
 	reg &= ~PLL_BYPASS_MASK;
 	writel(reg, &pll->pll_base);
+	debug("pllx_set_rate: base = 0x%08X\n", reg);
 
 	/* Set lock_enable to PLLX_MISC */
 	reg = readl(&pll->pll_misc);
 	reg |= PLL_LOCK_ENABLE_MASK;
 	writel(reg, &pll->pll_misc);
+	debug("pllx_set_rate: misc = 0x%08X\n", reg);
+
+	/* Enable PLLX last, once it's all configured */
+	reg = readl(&pll->pll_base);
+	reg |= PLL_ENABLE_MASK;
+	writel(reg, &pll->pll_base);
+	debug("pllx_set_rate: base final = 0x%08X\n", reg);
 
 	return 0;
 }
Signature · 1 line
1.8.1.5
#3 lore raw

PATCH v2 4/13 ARM: tegra: remove a conditional for CSITE rate

In reply to Stephen Warren

From: Stephen Warren <[email protected]>

There's already an SoC-specific conditional in cpu.h to determine the PLLP rate. Define the CSITE clock rate inside the same conditional, so that we can remove a conditional from clock_enable_coresight(). This means one less place to update the code for new SoCs.

---
v2: New patch, split out from the later Tegra124 changes.

---
 arch/arm/cpu/arm720t/tegra-common/cpu.c | 12 +-----------
 arch/arm/cpu/arm720t/tegra-common/cpu.h |  8 +++++---
 2 files changed, 6 insertions(+), 14 deletions(-)
arch/arm/cpu/arm720t/tegra-common/cpu.c +1 -11
index 322ce10d6fe3..d62bb9e370e0 100644
@@ -315,7 +315,6 @@ void reset_A9_cpu(int reset)
 void clock_enable_coresight(int enable)
 {
 	u32 rst, src = 2;
-	int soc_type;
 
 	debug("clock_enable_coresight entry\n");
 	clock_set_enable(PERIPH_ID_CORESIGHT, enable);
@@ -328,16 +327,7 @@ void clock_enable_coresight(int enable)
 		 * Clock divider request would setup CSITE clock as 144MHz
 		 * for PLLP base 216MHz and 204MHz for PLLP base 408MHz
 		 */
-
-		soc_type = tegra_get_chip();
-		if (soc_type == CHIPID_TEGRA30 || soc_type == CHIPID_TEGRA114)
-			src = CLK_DIVIDER(NVBL_PLLP_KHZ, 204000);
-		else if (soc_type == CHIPID_TEGRA20)
-			src = CLK_DIVIDER(NVBL_PLLP_KHZ, 144000);
-		else
-			printf("%s: Unknown SoC type %X!\n",
-				 __func__, soc_type);
-
+		src = CLK_DIVIDER(NVBL_PLLP_KHZ, CSITE_KHZ);
 		clock_ll_set_source_divisor(PERIPH_ID_CSI, 0, src);
 
 		/* Unlock the CPU CoreSight interfaces */
arch/arm/cpu/arm720t/tegra-common/cpu.h +5 -3
index 60412c7f87eb..d1520ce2cc88 100644
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2010-2011
+ * (C) Copyright 2010-2014
  * NVIDIA Corporation <www.nvidia.com>
  *
  * SPDX-License-Identifier:	GPL-2.0+
@@ -11,9 +11,11 @@
 #define IO_STABILIZATION_DELAY	(1000)
 
 #if defined(CONFIG_TEGRA20)
-#define NVBL_PLLP_KHZ	(216000)
+#define NVBL_PLLP_KHZ	216000
+#define CSITE_KHZ	144000
 #elif defined(CONFIG_TEGRA30) || defined(CONFIG_TEGRA114)
-#define NVBL_PLLP_KHZ	(408000)
+#define NVBL_PLLP_KHZ	408000
+#define CSITE_KHZ	204000
 #else
 #error "Unknown Tegra chip!"
 #endif
Signature · 1 line
1.8.1.5
#4 lore raw

PATCH v2 5/13 ARM: tegra: only build __pinmux_nand() when it's needed

In reply to Stephen Warren

From: Tom Warren <[email protected]>

__pinmux_nand() won't compile if PERIPH_ID_NDFLASH isn't defined. Prevent this from causing build problems on newer SoCs without NAND support (or without SW support for NAND yet), but preventing compilation unless the function will actually be used, i.e. when CONFIG_TEGRA_NAND is defined.

[swarren, rewrote commit description, moved ifdef around whole function rather than just body]

---
v2:
* Fixed TODO by moving the ifdef around the whole function rather than being inside the function body. The call to the function is under the same ifdef.

---
 board/nvidia/common/board.c | 2 ++
 1 file changed, 2 insertions(+)
board/nvidia/common/board.c +2 -0
index 1972527e7d11..aa42c69f904e 100644
@@ -78,12 +78,14 @@ void __gpio_early_init_uart(void)
 void gpio_early_init_uart(void)
 __attribute__((weak, alias("__gpio_early_init_uart")));
 
+#if defined(CONFIG_TEGRA_NAND)
 void __pin_mux_nand(void)
 {
 	funcmux_select(PERIPH_ID_NDFLASH, FUNCMUX_DEFAULT);
 }
 
 void pin_mux_nand(void) __attribute__((weak, alias("__pin_mux_nand")));
+#endif
 
 void __pin_mux_display(void)
 {
Signature · 1 line
1.8.1.5
#5 lore raw

PATCH v2 6/13 ARM: tegra: fix a typo in the tegra114.dtsi

In reply to Stephen Warren

From: Stephen Warren <[email protected]>

The reg property for node spi at 7000d800 was wrong. Fix it to match the HW. This change was verified against the Linux kernel.

---
 arch/arm/dts/tegra114.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/dts/tegra114.dtsi +1 -1
index 626cc3c982e7..f52fcf14dddc 100644
@@ -139,7 +139,7 @@
 
 	spi at 7000d800 {
 		compatible = "nvidia,tegra114-spi";
-		reg = <0x7000d480 0x200>;
+		reg = <0x7000d800 0x200>;
 		interrupts = <0 83 0x04>;
 		nvidia,dma-request-selector = <&apbdma 17>;
 		#address-cells = <1>;
Signature · 1 line
1.8.1.5
#6 lore raw

PATCH v2 7/13 ARM: tegra: add/edit headers for Tegra124

In reply to Stephen Warren

From: Tom Warren <[email protected]>

These headers define the Tegra124 hardware. Add them to the usual place.

Add Tegra124 chip ID/SKU ID definitions to common headers.

There's no real HW change on Tegra124 for 90% of the toys, so it might make sense for a future patch to unify some of the content of these files in a common location.

---
v2:
* Put content directly into files in arch-tegra124/; don't put files there that simply include the real files in arch-tegra/.
* Removed unused emc.h, fuse.h.
* Added to arch-tegra/pmc.h rather than creating a new arch-tegra124/pmc.h, since some code already includes arch-tegra/pmc.h, and I didn't feel good about different code getting different versions of pmc.h.
* Remove error-inducing prototype for board_usb_init().
* Squashed in the other patch which edited arch-tegra/*.h, since they're both just adding/editing header files.
* Don't touch Tegra114 SPI header.
* Minor whitespace cleanup.

---
 arch/arm/include/asm/arch-tegra/clk_rst.h         | 156 +++++-
 arch/arm/include/asm/arch-tegra/gp_padctrl.h      |   1 +
 arch/arm/include/asm/arch-tegra/pmc.h             | 245 +++++++++
 arch/arm/include/asm/arch-tegra/tegra.h           |   2 +
 arch/arm/include/asm/arch-tegra124/ahb.h          |  91 ++++
 arch/arm/include/asm/arch-tegra124/clock-tables.h | 496 +++++++++++++++++
 arch/arm/include/asm/arch-tegra124/clock.h        |  19 +
 arch/arm/include/asm/arch-tegra124/flow.h         |  40 ++
 arch/arm/include/asm/arch-tegra124/funcmux.h      |  23 +
 arch/arm/include/asm/arch-tegra124/gp_padctrl.h   |  74 +++
 arch/arm/include/asm/arch-tegra124/gpio.h         | 303 +++++++++++
 arch/arm/include/asm/arch-tegra124/hardware.h     |  16 +
 arch/arm/include/asm/arch-tegra124/pinmux.h       | 620 ++++++++++++++++++++++
 arch/arm/include/asm/arch-tegra124/pmu.h          |  14 +
 arch/arm/include/asm/arch-tegra124/spl.h          |  13 +
 arch/arm/include/asm/arch-tegra124/sysctr.h       |  26 +
 arch/arm/include/asm/arch-tegra124/tegra.h        |  30 ++
 arch/arm/include/asm/arch-tegra124/usb.h          | 268 ++++++++++
 18 files changed, 2409 insertions(+), 28 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-tegra124/ahb.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/clock-tables.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/clock.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/flow.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/funcmux.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/gp_padctrl.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/gpio.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/hardware.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/pinmux.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/pmu.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/spl.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/sysctr.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/tegra.h
 create mode 100644 arch/arm/include/asm/arch-tegra124/usb.h
arch/arm/include/asm/arch-tegra/clk_rst.h +128 -28
index b9dccd9c189f..70a238436ffd 100644
@@ -11,7 +11,8 @@
 /* PLL registers - there are several PLLs in the clock controller */
 struct clk_pll {
 	uint pll_base;		/* the control register */
-	uint pll_out[2];	/* output control */
+	/* pll_out[0] is output A control, pll_out[1] is output B control */
+	uint pll_out[2];
 	uint pll_misc;		/* other misc things */
 };
 
@@ -21,6 +22,13 @@ struct clk_pll_simple {
 	uint pll_misc;		/* other misc things */
 };
 
+struct clk_pllm {
+	uint pllm_base;		/* the control register */
+	uint pllm_out;		/* output control */
+	uint pllm_misc1;	/* misc1 */
+	uint pllm_misc2;	/* misc2 */
+};
+
 /* RST_DEV_(L,H,U,V,W)_(SET,CLR) and CLK_ENB_(L,H,U,V,W)_(SET,CLR) */
 struct clk_set_clr {
 	uint set;
@@ -38,7 +46,8 @@ enum {
 	TEGRA_CLK_REGS		= 3,	/* Number of clock enable regs L/H/U */
 	TEGRA_CLK_SOURCES	= 64,	/* Number of ppl clock sources L/H/U */
 	TEGRA_CLK_REGS_VW	= 2,	/* Number of clock enable regs V/W */
-	TEGRA_CLK_SOURCES_VW	= 32,	/* Number of ppl clock sources V/W*/
+	TEGRA_CLK_SOURCES_VW	= 32,	/* Number of ppl clock sources V/W */
+	TEGRA_CLK_SOURCES_X	= 32,	/* Number of ppl clock sources X */
 };
 
 /* Clock/Reset Controller (CLK_RST_CONTROLLER_) regs */
@@ -47,7 +56,7 @@ struct clk_rst_ctlr {
 	uint crc_rst_dev[TEGRA_CLK_REGS];	/* _RST_DEVICES_L/H/U_0 */
 	uint crc_clk_out_enb[TEGRA_CLK_REGS];	/* _CLK_OUT_ENB_L/H/U_0 */
 	uint crc_reserved0;		/* reserved_0,		0x1C */
-	uint crc_cclk_brst_pol;		/* _CCLK_BURST_POLICY_0,0x20 */
+	uint crc_cclk_brst_pol;		/* _CCLK_BURST_POLICY_0, 0x20 */
 	uint crc_super_cclk_div;	/* _SUPER_CCLK_DIVIDER_0,0x24 */
 	uint crc_sclk_brst_pol;		/* _SCLK_BURST_POLICY_0, 0x28 */
 	uint crc_super_sclk_div;	/* _SUPER_SCLK_DIVIDER_0,0x2C */
@@ -75,7 +84,21 @@ struct clk_rst_ctlr {
 
 	uint crc_clk_src[TEGRA_CLK_SOURCES]; /*_I2S1_0...	0x100-1fc */
 
-	uint crc_reserved20[64];	/* _reserved_20,	0x200-2fc */
+	uint crc_reserved20[32];	/* _reserved_20,	0x200-27c */
+
+	uint crc_clk_out_enb_x;		/* _CLK_OUT_ENB_X_0,	0x280 */
+	uint crc_clk_enb_x_set;		/* _CLK_ENB_X_SET_0,	0x284 */
+	uint crc_clk_enb_x_clr;		/* _CLK_ENB_X_CLR_0,	0x288 */
+
+	uint crc_rst_devices_x;		/* _RST_DEVICES_X_0,	0x28c */
+	uint crc_rst_dev_x_set;		/* _RST_DEV_X_SET_0,	0x290 */
+	uint crc_rst_dev_x_clr;		/* _RST_DEV_X_CLR_0,	0x294 */
+
+	uint crc_reserved21[23];	/* _reserved_21,	0x298-2f0 */
+
+	uint crc_dfll_base;		/* _DFLL_BASE_0,	0x2f4 */
+
+	uint crc_reserved22[2];		/* _reserved_22,	0x2f8-2fc */
 
 	/* _RST_DEV_L/H/U_SET_0 0x300 ~ 0x314 */
 	struct clk_set_clr crc_rst_dev_ex[TEGRA_CLK_REGS];
@@ -105,10 +128,10 @@ struct clk_rst_ctlr {
 	uint crc_clk_cpug_cmplx;	/* _CLK_CPUG_CMPLX_0,       0x378 */
 	uint crc_clk_cpulp_cmplx;	/* _CLK_CPULP_CMPLX_0,      0x37C */
 	uint crc_cpu_softrst_ctrl;	/* _CPU_SOFTRST_CTRL_0,     0x380 */
-	uint crc_cpu_softrst_ctrl1;	/* _CPU_SOFTRST_CTR1L_0,    0x384 */
+	uint crc_cpu_softrst_ctrl1;	/* _CPU_SOFTRST_CTRL1_0,    0x384 */
 	uint crc_cpu_softrst_ctrl2;	/* _CPU_SOFTRST_CTRL2_0,    0x388 */
 	uint crc_reserved33[9];		/* _reserved_33,        0x38c-3ac */
-	uint crc_clk_src_vw[TEGRA_CLK_SOURCES_VW]; /* _G3D2_0..., 0x3b0-0x42c */
+	uint crc_clk_src_vw[TEGRA_CLK_SOURCES_VW];	/* 0x3B0-0x42C */
 	/* _RST_DEV_V/W_SET_0 0x430 ~ 0x43c */
 	struct clk_set_clr crc_rst_dev_ex_vw[TEGRA_CLK_REGS_VW];
 	/* _CLK_ENB_V/W_CLR_0 0x440 ~ 0x44c */
@@ -142,6 +165,47 @@ struct clk_rst_ctlr {
 	uint crc_audio_sync_clk_i2s3;	/* _AUDIO_SYNC_CLK_I2S3_0, 0x4AC */
 	uint crc_audio_sync_clk_i2s4;	/* _AUDIO_SYNC_CLK_I2S4_0, 0x4B0 */
 	uint crc_audio_sync_clk_spdif;	/* _AUDIO_SYNC_CLK_SPDIF_0, 0x4B4 */
+
+	uint crc_plld2_base;		/* _PLLD2_BASE_0, 0x4B8 */
+	uint crc_plld2_misc;		/* _PLLD2_MISC_0, 0x4BC */
+	uint crc_utmip_pll_cfg3;	/* _UTMIP_PLL_CFG3_0, 0x4C0 */
+	uint crc_pllrefe_base;		/* _PLLREFE_BASE_0, 0x4C4 */
+	uint crc_pllrefe_misc;		/* _PLLREFE_MISC_0, 0x4C8 */
+	uint crs_reserved_50[7];	/* _reserved_50, 0x4CC-0x4E4 */
+	uint crc_pllc2_base;		/* _PLLC2_BASE_0, 0x4E8 */
+	uint crc_pllc2_misc0;		/* _PLLC2_MISC_0_0, 0x4EC */
+	uint crc_pllc2_misc1;		/* _PLLC2_MISC_1_0, 0x4F0 */
+	uint crc_pllc2_misc2;		/* _PLLC2_MISC_2_0, 0x4F4 */
+	uint crc_pllc2_misc3;		/* _PLLC2_MISC_3_0, 0x4F8 */
+	uint crc_pllc3_base;		/* _PLLC3_BASE_0, 0x4FC */
+	uint crc_pllc3_misc0;		/* _PLLC3_MISC_0_0, 0x500 */
+	uint crc_pllc3_misc1;		/* _PLLC3_MISC_1_0, 0x504 */
+	uint crc_pllc3_misc2;		/* _PLLC3_MISC_2_0, 0x508 */
+	uint crc_pllc3_misc3;		/* _PLLC3_MISC_3_0, 0x50C */
+	uint crc_pllx_misc1;		/* _PLLX_MISC_1_0, 0x510 */
+	uint crc_pllx_misc2;		/* _PLLX_MISC_2_0, 0x514 */
+	uint crc_pllx_misc3;		/* _PLLX_MISC_3_0, 0x518 */
+	uint crc_xusbio_pll_cfg0;	/* _XUSBIO_PLL_CFG0_0, 0x51C */
+	uint crc_xusbio_pll_cfg1;	/* _XUSBIO_PLL_CFG0_1, 0x520 */
+	uint crc_plle_aux1;		/* _PLLE_AUX1_0, 0x524 */
+	uint crc_pllp_reshift;		/* _PLLP_RESHIFT_0, 0x528 */
+	uint crc_utmipll_hw_pwrdn_cfg0;	/* _UTMIPLL_HW_PWRDN_CFG0_0, 0x52C */
+	uint crc_pllu_hw_pwrdn_cfg0;	/* _PLLU_HW_PWRDN_CFG0_0, 0x530 */
+	uint crc_xusb_pll_cfg0;		/* _XUSB_PLL_CFG0_0, 0x534 */
+	uint crc_reserved51[1];		/* _reserved_51,     0x538 */
+	uint crc_clk_cpu_misc;		/* _CLK_CPU_MISC_0, 0x53C */
+	uint crc_clk_cpug_misc;		/* _CLK_CPUG_MISC_0, 0x540 */
+	uint crc_clk_cpulp_misc;	/* _CLK_CPULP_MISC_0, 0x544 */
+	uint crc_pllx_hw_ctrl_cfg;	/* _PLLX_HW_CTRL_CFG_0, 0x548 */
+	uint crc_pllx_sw_ramp_cfg;	/* _PLLX_SW_RAMP_CFG_0, 0x54C */
+	uint crc_pllx_hw_ctrl_status;	/* _PLLX_HW_CTRL_STATUS_0, 0x550 */
+	uint crc_reserved52[1];		/* _reserved_52,     0x554 */
+	uint crc_super_gr3d_clk_div;	/* _SUPER_GR3D_CLK_DIVIDER_0, 0x558 */
+	uint crc_spare_reg0;		/* _SPARE_REG0_0, 0x55C */
+
+	/* Tegra124 - skip to 0x600 here for new CLK_SOURCE_ regs */
+	uint crc_reserved60[40];	/* _reserved_60,     0x560 - 0x5FC */
+	uint crc_clk_src_x[TEGRA_CLK_SOURCES_X]; /* XUSB, etc, 0x600-0x678 */
 };
 
 /* CLK_RST_CONTROLLER_CLK_CPU_CMPLX_0 */
@@ -236,9 +300,15 @@ enum {
 #define UTMIP_FORCE_PD_SAMP_B_POWERDOWN		(1 << 2)
 #define UTMIP_FORCE_PD_SAMP_A_POWERDOWN		(1 << 0)
 
-/* CLK_RST_CONTROLLER_OSC_CTRL_0 */
-#define OSC_XOBP_SHIFT		1
-#define OSC_XOBP_MASK		(1U << OSC_XOBP_SHIFT)
+/* CLK_RST_CONTROLLER_OSC_CTRL_0 0x50 */
+#define OSC_XOE_SHIFT			0
+#define OSC_XOE_MASK			(1 << OSC_XOE_SHIFT)
+#define OSC_XOE_ENABLE			(1 << OSC_XOE_SHIFT)
+#define OSC_XOBP_SHIFT			1
+#define OSC_XOBP_MASK			(1U << OSC_XOBP_SHIFT)
+#define OSC_XOFS_SHIFT			4
+#define OSC_XOFS_MASK			(0x3F << OSC_XOFS_SHIFT)
+#define OSC_DRIVE_STRENGTH		7
 
 /*
  * CLK_RST_CONTROLLER_CLK_SOURCE_x_OUT_0 - the mask here is normally 8 bits
@@ -311,7 +381,7 @@ enum {
 #define SUPER_SCLK_DIVISOR_SHIFT	0
 #define SUPER_SCLK_DIVISOR_MASK		(0xff << SUPER_SCLK_DIVISOR_SHIFT)
 
-/* CLK_RST_CONTROLLER_CLK_SYSTEM_RATE */
+/* CLK_RST_CONTROLLER_CLK_SYSTEM_RATE 0x30 */
 #define CLK_SYS_RATE_HCLK_DISABLE_SHIFT 7
 #define CLK_SYS_RATE_HCLK_DISABLE_MASK  (1 << CLK_SYS_RATE_HCLK_DISABLE_SHIFT)
 #define CLK_SYS_RATE_AHB_RATE_SHIFT     4
@@ -321,23 +391,53 @@ enum {
 #define CLK_SYS_RATE_APB_RATE_SHIFT     0
 #define CLK_SYS_RATE_APB_RATE_MASK      (3 << CLK_SYS_RATE_AHB_RATE_SHIFT)
 
-/* CLK_RST_CONTROLLER_RST_CPUxx_CMPLX_CLR */
-#define CLR_CPURESET0   (1 << 0)
-#define CLR_CPURESET1   (1 << 1)
-#define CLR_CPURESET2   (1 << 2)
-#define CLR_CPURESET3   (1 << 3)
-#define CLR_DBGRESET0   (1 << 12)
-#define CLR_DBGRESET1   (1 << 13)
-#define CLR_DBGRESET2   (1 << 14)
-#define CLR_DBGRESET3   (1 << 15)
-#define CLR_CORERESET0  (1 << 16)
-#define CLR_CORERESET1  (1 << 17)
-#define CLR_CORERESET2  (1 << 18)
-#define CLR_CORERESET3  (1 << 19)
-#define CLR_CXRESET0    (1 << 20)
-#define CLR_CXRESET1    (1 << 21)
-#define CLR_CXRESET2    (1 << 22)
-#define CLR_CXRESET3    (1 << 23)
-#define CLR_NONCPURESET (1 << 29)
+/* CLK_RST_CONTROLLER_RST_CPUxx_CMPLX_CLR 0x344 */
+#define CLR_CPURESET0			(1 << 0)
+#define CLR_CPURESET1			(1 << 1)
+#define CLR_CPURESET2			(1 << 2)
+#define CLR_CPURESET3			(1 << 3)
+#define CLR_DBGRESET0			(1 << 12)
+#define CLR_DBGRESET1			(1 << 13)
+#define CLR_DBGRESET2			(1 << 14)
+#define CLR_DBGRESET3			(1 << 15)
+#define CLR_CORERESET0			(1 << 16)
+#define CLR_CORERESET1			(1 << 17)
+#define CLR_CORERESET2			(1 << 18)
+#define CLR_CORERESET3			(1 << 19)
+#define CLR_CXRESET0			(1 << 20)
+#define CLR_CXRESET1			(1 << 21)
+#define CLR_CXRESET2			(1 << 22)
+#define CLR_CXRESET3			(1 << 23)
+#define CLR_L2RESET			(1 << 24)
+#define CLR_NONCPURESET			(1 << 29)
+#define CLR_PRESETDBG			(1 << 30)
+
+/* CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR 0x34c */
+#define CLR_CPU3_CLK_STP		(1 << 11)
+#define CLR_CPU2_CLK_STP		(1 << 10)
+#define CLR_CPU1_CLK_STP		(1 << 9)
+#define CLR_CPU0_CLK_STP		(1 << 8)
+
+/* CRC_CLK_SOURCE_MSELECT_0 0x3b4 */
+#define MSELECT_CLK_SRC_PLLP_OUT0	(0 << 29)
+
+/* CRC_CLK_ENB_V_SET_0 0x440 */
+#define SET_CLK_ENB_CPUG_ENABLE		(1 << 0)
+#define SET_CLK_ENB_CPULP_ENABLE	(1 << 1)
+#define SET_CLK_ENB_MSELECT_ENABLE	(1 << 3)
+
+/* CLK_RST_CONTROLLER_UTMIP_PLL_CFG1_0 0x484 */
+#define PLLU_POWERDOWN			(1 << 16)
+#define PLL_ENABLE_POWERDOWN		(1 << 14)
+#define PLL_ACTIVE_POWERDOWN		(1 << 12)
+
+/* CLK_RST_CONTROLLER_UTMIP_PLL_CFG2_0 0x488 */
+#define UTMIP_FORCE_PD_SAMP_C_POWERDOWN	(1 << 4)
+#define UTMIP_FORCE_PD_SAMP_B_POWERDOWN	(1 << 2)
+#define UTMIP_FORCE_PD_SAMP_A_POWERDOWN	(1 << 0)
+
+/* CLK_RST_CONTROLLER_PLLX_MISC_3 */
+#define PLLX_IDDQ_SHIFT			3
+#define PLLX_IDDQ_MASK			(1U << PLLX_IDDQ_SHIFT)
 
 #endif	/* _TEGRA_CLK_RST_H_ */
arch/arm/include/asm/arch-tegra/gp_padctrl.h +1 -0
index c840c08a89b9..7a86acb1b2d8 100644
@@ -20,5 +20,6 @@
 #define CHIPID_TEGRA20			0x20
 #define CHIPID_TEGRA30			0x30
 #define CHIPID_TEGRA114			0x35
+#define CHIPID_TEGRA124			0x40
 
 #endif	/* _TEGRA_GP_PADCTRL_H_ */
arch/arm/include/asm/arch-tegra/pmc.h +245 -0

255 lines not on this page · raw message

arch/arm/include/asm/arch-tegra/tegra.h +2 -0
index e99f681ffddb..5fe19ae1ac13 100644
@@ -68,6 +68,7 @@ enum {
 	SKU_ID_TM30MQS_P_A3	= 0xb1,
 	SKU_ID_T114_ENG		= 0x00, /* Dalmore value, unfused */
 	SKU_ID_T114_1		= 0x01,
+	SKU_ID_T124_ENG		= 0x00, /* Venice2 value, unfused */
 };
 
 /*
@@ -81,6 +82,7 @@ enum {
 	TEGRA_SOC_T25,
 	TEGRA_SOC_T30,
 	TEGRA_SOC_T114,
+	TEGRA_SOC_T124,
 
 	TEGRA_SOC_CNT,
 	TEGRA_SOC_UNKNOWN	= -1,
arch/arm/include/asm/arch-tegra124/ahb.h new file +91 -0

91 lines not on this page · raw message

arch/arm/include/asm/arch-tegra124/clock-tables.h new file +496 -0

496 lines not on this page · raw message

arch/arm/include/asm/arch-tegra124/clock.h new file +19 -0
new file mode 100644
index 000000000000..796f2d695064
@@ -0,0 +1,19 @@
+/*
+ * (C) Copyright 2010-2013
+ * NVIDIA Corporation <www.nvidia.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+/* Tegra124 clock control functions */
+
+#ifndef _TEGRA124_CLOCK_H_
+#define _TEGRA124_CLOCK_H_
+
+#include <asm/arch-tegra/clock.h>
+
+/* CLK_RST_CONTROLLER_OSC_CTRL_0 */
+#define OSC_FREQ_SHIFT          28
+#define OSC_FREQ_MASK           (0xF << OSC_FREQ_SHIFT)
+
+#endif	/* _TEGRA124_CLOCK_H_ */
arch/arm/include/asm/arch-tegra124/flow.h new file +40 -0
new file mode 100644
index 000000000000..0db1881bc6fb
@@ -0,0 +1,40 @@
+/*
+ * (C) Copyright 2010-2013
+ * NVIDIA Corporation <www.nvidia.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef _TEGRA124_FLOW_H_
+#define _TEGRA124_FLOW_H_
+
+struct flow_ctlr {
+	u32 halt_cpu_events;	/* offset 0x00 */
+	u32 halt_cop_events;	/* offset 0x04 */
+	u32 cpu_csr;		/* offset 0x08 */
+	u32 cop_csr;		/* offset 0x0c */
+	u32 xrq_events;		/* offset 0x10 */
+	u32 halt_cpu1_events;	/* offset 0x14 */
+	u32 cpu1_csr;		/* offset 0x18 */
+	u32 halt_cpu2_events;	/* offset 0x1c */
+	u32 cpu2_csr;		/* offset 0x20 */
+	u32 halt_cpu3_events;	/* offset 0x24 */
+	u32 cpu3_csr;		/* offset 0x28 */
+	u32 cluster_control;	/* offset 0x2c */
+	u32 halt_cop1_events;	/* offset 0x30 */
+	u32 halt_cop1_csr;	/* offset 0x34 */
+	u32 cpu_pwr_csr;	/* offset 0x38 */
+	u32 mpid;		/* offset 0x3c */
+	u32 ram_repair;		/* offset 0x40 */
+};
+
+/* HALT_COP_EVENTS_0, 0x04 */
+#define EVENT_MSEC		(1 << 24)
+#define EVENT_USEC		(1 << 25)
+#define EVENT_JTAG		(1 << 28)
+#define EVENT_MODE_STOP		(2 << 29)
+
+/* FLOW_CTLR_CLUSTER_CONTROL_0 0x2c */
+#define ACTIVE_LP		(1 << 0)
+
+#endif	/*  _TEGRA124_FLOW_H_ */
arch/arm/include/asm/arch-tegra124/funcmux.h new file +23 -0
new file mode 100644
index 000000000000..df94d135f86d
@@ -0,0 +1,23 @@
+/*
+ * (C) Copyright 2013
+ * NVIDIA Corporation <www.nvidia.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+/* Tegra124 high-level function multiplexing */
+
+#ifndef _TEGRA124_FUNCMUX_H_
+#define _TEGRA124_FUNCMUX_H_
+
+#include <asm/arch-tegra/funcmux.h>
+
+/* Configs supported by the func mux */
+enum {
+	FUNCMUX_DEFAULT = 0,	/* default config */
+
+	/* UART configs */
+	FUNCMUX_UART1_KBC = 0,
+	FUNCMUX_UART4_GPIO = 0,
+};
+#endif	/* _TEGRA124_FUNCMUX_H_ */
arch/arm/include/asm/arch-tegra124/gp_padctrl.h new file +74 -0

74 lines not on this page · raw message

arch/arm/include/asm/arch-tegra124/gpio.h new file +303 -0

303 lines not on this page · raw message

arch/arm/include/asm/arch-tegra124/hardware.h new file +16 -0
new file mode 100644
index 000000000000..114fce8ada15
@@ -0,0 +1,16 @@
+/*
+ * (C) Copyright 2013
+ * NVIDIA Corporation <www.nvidia.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef _TEGRA124_HARDWARE_H_
+#define _TEGRA124_HARDWARE_H_
+
+/*
+ * Include Tegra-specific hardware definitions
+ * Nothing needed currently for Tegra124
+ */
+
+#endif /* _TEGRA124_HARDWARE_H_ */
arch/arm/include/asm/arch-tegra124/pinmux.h new file +620 -0

620 lines not on this page · raw message

arch/arm/include/asm/arch-tegra124/pmu.h new file +14 -0
new file mode 100644
index 000000000000..b10100a63671
@@ -0,0 +1,14 @@
+/*
+ * (C) Copyright 2010-2013
+ * NVIDIA Corporation <www.nvidia.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef _TEGRA124_PMU_H_
+#define _TEGRA124_PMU_H_
+
+/* Set core and CPU voltages to nominal levels */
+int pmu_set_nominal(void);
+
+#endif	/* _TEGRA124_PMU_H_ */
arch/arm/include/asm/arch-tegra124/spl.h new file +13 -0
new file mode 100644
index 000000000000..76af1f71efe3
@@ -0,0 +1,13 @@
+/*
+ * (C) Copyright 2010-2013
+ * NVIDIA Corporation <www.nvidia.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef	_ARCH_TEGRA_SPL_H_
+#define	_ARCH_TEGRA_SPL_H_
+
+#define BOOT_DEVICE_RAM         1
+
+#endif
arch/arm/include/asm/arch-tegra124/sysctr.h new file +26 -0
new file mode 100644
index 000000000000..3f0309b78fae
@@ -0,0 +1,26 @@
+/*
+ * (C) Copyright 2013
+ * NVIDIA Corporation <www.nvidia.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef _TEGRA124_SYSCTR_H_
+#define _TEGRA124_SYSCTR_H_
+
+struct sysctr_ctlr {
+	u32 cntcr;		/* 0x00: SYSCTR0_CNTCR Counter Control */
+	u32 cntsr;		/* 0x04: SYSCTR0_CNTSR Counter Status */
+	u32 cntcv0;		/* 0x08: SYSCTR0_CNTCV0 Counter Count 31:00 */
+	u32 cntcv1;		/* 0x0C: SYSCTR0_CNTCV1 Counter Count 63:32 */
+	u32 reserved1[4];	/* 0x10 - 0x1C */
+	u32 cntfid0;		/* 0x20: SYSCTR0_CNTFID0 Freq Table Entry */
+	u32 cntfid1;		/* 0x24: SYSCTR0_CNTFID1 Freq Table End */
+	u32 reserved2[1002];	/* 0x28 - 0xFCC */
+	u32 counterid[12];	/* 0xFD0 - 0xFxx CounterID regs, RO */
+};
+
+#define TSC_CNTCR_ENABLE	(1 << 0)	/* Enable */
+#define TSC_CNTCR_HDBG		(1 << 1)	/* Halt on debug */
+
+#endif	/* _TEGRA124_SYSCTR_H_ */
arch/arm/include/asm/arch-tegra124/tegra.h new file +30 -0
new file mode 100644
index 000000000000..db3d8379203b
@@ -0,0 +1,30 @@
+/*
+ * (C) Copyright 2013
+ * NVIDIA Corporation <www.nvidia.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef _TEGRA124_H_
+#define _TEGRA124_H_
+
+#define NV_PA_SDRAM_BASE	0x80000000
+#define NV_PA_TSC_BASE		0x700F0000	/* System Counter TSC regs */
+#define NV_PA_MC_BASE		0x70019000	/* Mem Ctlr regs (MCB, etc.) */
+#define NV_PA_AHB_BASE		0x6000C000	/* System regs (AHB, etc.) */
+
+#include <asm/arch-tegra/tegra.h>
+
+#define BCT_ODMDATA_OFFSET	1704	/* offset to ODMDATA word */
+
+#undef NVBOOTINFOTABLE_BCTSIZE
+#undef NVBOOTINFOTABLE_BCTPTR
+#define NVBOOTINFOTABLE_BCTSIZE	0x48	/* BCT size in BIT in IRAM */
+#define NVBOOTINFOTABLE_BCTPTR	0x4C	/* BCT pointer in BIT in IRAM */
+
+#define MAX_NUM_CPU		4
+#define MCB_EMEM_ARB_OVERRIDE	(NV_PA_MC_BASE + 0xE8)
+
+#define TEGRA_USB1_BASE		0x7D000000
+
+#endif /* _TEGRA124_H_ */
arch/arm/include/asm/arch-tegra124/usb.h new file +268 -0

268 lines not on this page · raw message

Signature · 1 line
1.8.1.5
#7 lore raw

PATCH v2 7/13 ARM: tegra: add/edit headers for Tegra124

On Thu, Jan 23, 2014 at 05:42:54PM -0700, Stephen Warren wrote:
[...]

Quoted 1 line
arch/arm/include/asm/arch-tegra/clk_rst.h +0 -0

[...]

arch/arm/include/asm/arch-tegra/clk_rst.h struct clk_rst_ctlr { · line 134

Quoted 10 lines
arch/arm/include/asm/arch-tegra/clk_rst.h +2 -2
@@ -105,10 +128,10 @@ struct clk_rst_ctlr {
 	uint crc_clk_cpug_cmplx;	/* _CLK_CPUG_CMPLX_0,       0x378 */
 	uint crc_clk_cpulp_cmplx;	/* _CLK_CPULP_CMPLX_0,      0x37C */
 	uint crc_cpu_softrst_ctrl;	/* _CPU_SOFTRST_CTRL_0,     0x380 */
-	uint crc_cpu_softrst_ctrl1;	/* _CPU_SOFTRST_CTR1L_0,    0x384 */
+	uint crc_cpu_softrst_ctrl1;	/* _CPU_SOFTRST_CTRL1_0,    0x384 */
 	uint crc_cpu_softrst_ctrl2;	/* _CPU_SOFTRST_CTRL2_0,    0x388 */
 	uint crc_reserved33[9];		/* _reserved_33,        0x38c-3ac */
-	uint crc_clk_src_vw[TEGRA_CLK_SOURCES_VW]; /* _G3D2_0..., 0x3b0-0x42c */
+	uint crc_clk_src_vw[TEGRA_CLK_SOURCES_VW];	/* 0x3B0-0x42C */

While at it, perhaps also make the offsets in the comment for crc_reserved33 also all caps?

Quoted 1 line
arch/arm/include/asm/arch-tegra/clk_rst.h +0 -0
@@ -142,6 +165,47 @@ struct clk_rst_ctlr {

[...]

Quoted 1 line
arch/arm/include/asm/arch-tegra/clk_rst.h +1 -0
+	uint crs_reserved_50[7];	/* _reserved_50, 0x4CC-0x4E4 */

[...]

Quoted 1 line
arch/arm/include/asm/arch-tegra/clk_rst.h +1 -0
+	uint crc_reserved51[1];		/* _reserved_51,     0x538 */

[...]

Quoted 1 line
arch/arm/include/asm/arch-tegra/clk_rst.h +1 -0
+	uint crc_reserved52[1];		/* _reserved_52,     0x554 */

[...]

arch/arm/include/asm/arch-tegra/clk_rst.h struct clk_rst_ctlr { · line 207

Quoted 1 line
arch/arm/include/asm/arch-tegra/clk_rst.h +1 -0
+	uint crc_reserved60[40];	/* _reserved_60,     0x560 - 0x5FC */

Spacing in these is all somewhat inconsistent.

Quoted 5 lines
arch/arm/include/asm/arch-tegra/clk_rst.h +5 -0
+/* CLK_RST_CONTROLLER_RST_CPUxx_CMPLX_CLR 0x344 */
+#define CLR_CPURESET0			(1 << 0)
+#define CLR_CPURESET1			(1 << 1)
+#define CLR_CPURESET2			(1 << 2)
+#define CLR_CPURESET3			(1 << 3)

[...]

arch/arm/include/asm/arch-tegra/clk_rst.h enum { · line 419

Quoted 5 lines
arch/arm/include/asm/arch-tegra/clk_rst.h +5 -0
+/* CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR 0x34c */
+#define CLR_CPU3_CLK_STP		(1 << 11)
+#define CLR_CPU2_CLK_STP		(1 << 10)
+#define CLR_CPU1_CLK_STP		(1 << 9)
+#define CLR_CPU0_CLK_STP		(1 << 8)

Sometimes these are listed in order of increasing bit positions, other times they are in order of decreasing bit positions.

Quoted 1 line
arch/arm/include/asm/arch-tegra/pmc.h +0 -0

[...]

arch/arm/include/asm/arch-tegra/pmc.h struct pmc_ctlr { · line 330

Quoted 4 lines
arch/arm/include/asm/arch-tegra/pmc.h +4 -0
+/* APBDEV_PMC_PWRGATE_TOGGLE_0 0x30 */
+#define PWRGATE_TOGGLE_PARTID_CRAIL		0
+#define PWRGATE_TOGGLE_PARTID_TD		1
+#define PWRGATE_TOGGLE_PARTID_VE		2

+#define PWRGATE_TOGGLE_PARTID_PCX 3

arch/arm/include/asm/arch-tegra/pmc.h struct pmc_ctlr { · line 334

Quoted 4 lines
arch/arm/include/asm/arch-tegra/pmc.h +4 -0
+#define PWRGATE_TOGGLE_PARTID_VDE		4
+#define PWRGATE_TOGGLE_PARTID_L2C		5
+#define PWRGATE_TOGGLE_PARTID_MPE		6
+#define PWRGATE_TOGGLE_PARTID_HEG		7

+#define PWRGATE_TOGGLE_PARTID_SAX 8

arch/arm/include/asm/arch-tegra/pmc.h struct pmc_ctlr { · line 341

Quoted 7 lines
arch/arm/include/asm/arch-tegra/pmc.h +7 -0
+#define PWRGATE_TOGGLE_PARTID_CE1		9
+#define PWRGATE_TOGGLE_PARTID_CE2		10
+#define PWRGATE_TOGGLE_PARTID_CE3		11
+#define PWRGATE_TOGGLE_PARTID_CELP		12
+#define PWRGATE_TOGGLE_PARTID_CE0		14
+#define PWRGATE_TOGGLE_PARTID_C0NC		15
+#define PWRGATE_TOGGLE_PARTID_C1NC		16

+#define PWRGATE_TOGGLE_PARTID_SOR 17

arch/arm/include/asm/arch-tegra/pmc.h struct pmc_ctlr { · line 346

Quoted 5 lines
arch/arm/include/asm/arch-tegra/pmc.h +5 -0
+#define PWRGATE_TOGGLE_PARTID_DIS		18
+#define PWRGATE_TOGGLE_PARTID_DISB		19
+#define PWRGATE_TOGGLE_PARTID_XUSBA		20
+#define PWRGATE_TOGGLE_PARTID_XUSBB		21
+#define PWRGATE_TOGGLE_PARTID_XUSBC		22

+#define PWRGATE_TOGGLE_PARTID_VIC 23
+#define PWRGATE_TOGGLE_PARTID_IRAM 24

arch/arm/include/asm/arch-tegra/pmc.h struct pmc_ctlr { · line 352

Quoted 4 lines
arch/arm/include/asm/arch-tegra/pmc.h +4 -0
+/* APBDEV_PMC_PWRGATE_STATUS_0 0x38 */
+#define PWRGATE_STATUS_CRAIL_ENABLE		(1 << 0)
+#define PWRGATE_STATUS_TD_ENABLE		(1 << 1)
+#define PWRGATE_STATUS_VE_ENABLE		(1 << 2)

+#define PWRGATE_STATUS_PCX_ENABLE (1 << 3)

arch/arm/include/asm/arch-tegra/pmc.h struct pmc_ctlr { · line 356

Quoted 4 lines
arch/arm/include/asm/arch-tegra/pmc.h +4 -0
+#define PWRGATE_STATUS_VDE_ENABLE		(1 << 4)
+#define PWRGATE_STATUS_L2C_ENABLE		(1 << 5)
+#define PWRGATE_STATUS_MPE_ENABLE		(1 << 6)
+#define PWRGATE_STATUS_HEG_ENABLE		(1 << 7)

+#define PWRGATE_STATUS_SAX_ENABLE (1 << 8)

arch/arm/include/asm/arch-tegra/pmc.h struct pmc_ctlr { · line 363

Quoted 7 lines
arch/arm/include/asm/arch-tegra/pmc.h +7 -0
+#define PWRGATE_STATUS_CE1_ENABLE		(1 << 9)
+#define PWRGATE_STATUS_CE2_ENABLE		(1 << 10)
+#define PWRGATE_STATUS_CE3_ENABLE		(1 << 11)
+#define PWRGATE_STATUS_CELP_ENABLE		(1 << 12)
+#define PWRGATE_STATUS_CE0_ENABLE		(1 << 14)
+#define PWRGATE_STATUS_C0NC_ENABLE		(1 << 15)
+#define PWRGATE_STATUS_C1NC_ENABLE		(1 << 16)

+#define PWRGATE_STATUS_SOR_ENABLE (1 << 17)

arch/arm/include/asm/arch-tegra/pmc.h struct pmc_ctlr { · line 368

Quoted 5 lines
arch/arm/include/asm/arch-tegra/pmc.h +5 -0
+#define PWRGATE_STATUS_DIS_ENABLE		(1 << 18)
+#define PWRGATE_STATUS_DISB_ENABLE		(1 << 19)
+#define PWRGATE_STATUS_XUSBA_ENABLE		(1 << 20)
+#define PWRGATE_STATUS_XUSBB_ENABLE		(1 << 21)
+#define PWRGATE_STATUS_XUSBC_ENABLE		(1 << 22)

+#define PWRGATE_STATUS_VIC_ENABLE (1 << 23)
+#define PWRGATE_STATUS_IRAM_ENABLE (1 << 24)

Quoted 8 lines
arch/arm/include/asm/arch-tegra124/clock-tables.h +7 -0
+/* The PLLs supported by the hardware */
+enum clock_id {
+	CLOCK_ID_FIRST,
+	CLOCK_ID_CGENERAL = CLOCK_ID_FIRST,
+	CLOCK_ID_MEMORY,
+	CLOCK_ID_PERIPH,
+	CLOCK_ID_AUDIO,

arch/arm/include/asm/arch-tegra124/clock-tables.h line 29

Quoted 10 lines
arch/arm/include/asm/arch-tegra124/clock-tables.h +10 -0
+	CLOCK_ID_USB,
+	CLOCK_ID_DISPLAY,
+
+	/* now the simple ones */
+	CLOCK_ID_FIRST_SIMPLE,
+	CLOCK_ID_XCPU = CLOCK_ID_FIRST_SIMPLE,
+	CLOCK_ID_EPCI,
+	CLOCK_ID_SFROM32KHZ,
+
+	/* These are the base clocks (inputs to the Tegra SOC) */

Nit: SOC -> SoC

arch/arm/include/asm/arch-tegra124/clock-tables.h line 36

Quoted 7 lines
arch/arm/include/asm/arch-tegra124/clock-tables.h +7 -0
+	CLOCK_ID_32KHZ,
+	CLOCK_ID_OSC,
+
+	CLOCK_ID_COUNT,	/* number of PLLs */
+
+	/*
+	 * These are clock ids that are used in table clock_source[][]

Nit: ids -> IDs

Quoted 1 line
arch/arm/include/asm/arch-tegra124/clock.h +0 -0

[...]

Quoted 1 line

+/* Tegra124 clock control functions */

There aren't actually any functions in this header file. =P

Quoted 12 lines
arch/arm/include/asm/arch-tegra124/clock.h +10 -0
+#ifndef _TEGRA124_CLOCK_H_
+#define _TEGRA124_CLOCK_H_
+
+#include <asm/arch-tegra/clock.h>
+
+/* CLK_RST_CONTROLLER_OSC_CTRL_0 */
+#define OSC_FREQ_SHIFT          28
+#define OSC_FREQ_MASK           (0xF << OSC_FREQ_SHIFT)
+
+#endif	/* _TEGRA124_CLOCK_H_ */
arch/arm/include/asm/arch-tegra124/gpio.h +0 -0

[...]

Quoted 2 lines
arch/arm/include/asm/arch-tegra124/gpio.h +2 -0
+enum gpio_pin {
+	GPIO_PA0 = 0,	/* pin 0 */

[...]

arch/arm/include/asm/arch-tegra124/gpio.h line 301

Quoted 2 lines
arch/arm/include/asm/arch-tegra124/gpio.h +2 -0
+	GPIO_PFF7,	/* pin 255 */
+};

Perhaps this should be converted to something similar to what we have in the kernel? We essentially duplicate this list for every SoC generation.

Quoted 1 line
arch/arm/include/asm/arch-tegra124/spl.h +0 -0

[...]

arch/arm/include/asm/arch-tegra124/spl.h line 9

Quoted 2 lines
arch/arm/include/asm/arch-tegra124/spl.h +2 -0
+#ifndef	_ARCH_TEGRA_SPL_H_
+#define	_ARCH_TEGRA_SPL_H_

Nit: I don't think any of the other include guards use a tab, but this one does.

arch/arm/include/asm/arch-tegra124/spl.h line 13

Quoted 4 lines
arch/arm/include/asm/arch-tegra124/spl.h +4 -0
+
+#define BOOT_DEVICE_RAM         1
+
+#endif

Also all the other headers have a comment with the identifier on this last line.

Mostly these are just minor nits and I don't feel too strongly about them. But I'd like to see at least the powergate partition table completed with the missing entries.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140124/7da5ef3f/attachment.pgp>

#8 lore raw

PATCH v2 7/13 ARM: tegra: add/edit headers for Tegra124

Quoted 4 lines · Thierry Reding
Quoted 1 line · Stephen Warren
arch/arm/include/asm/arch-tegra124/gpio.h +0 -0

[...]

Quoted 8 lines
Quoted 2 lines
arch/arm/include/asm/arch-tegra124/gpio.h +2 -0
+enum gpio_pin {
+	GPIO_PA0 = 0,	/* pin 0 */

[...]

arch/arm/include/asm/arch-tegra124/gpio.h line 301

Quoted 2 lines
arch/arm/include/asm/arch-tegra124/gpio.h +2 -0
+	GPIO_PFF7,	/* pin 255 */
+};

Perhaps this should be converted to something similar to what we have in the kernel? We essentially duplicate this list for every SoC generation.

I think there's quite a bit of opportunity to unify the headers and drivers for the on-SoC devices. I keep dreaming of an intern that can do a whole bunch of that. Maybe I'll manage to slowly trickle in some patches for it; we'll see.

I'll fix up the other issues you mentioned.

#9 lore raw

PATCH v2 7/13 ARM: tegra: add/edit headers for Tegra124

In reply to Thierry Reding
Quoted 4 lines · Thierry Reding

On Thu, Jan 23, 2014 at 05:42:54PM -0700, Stephen Warren wrote:
[...]

Quoted 1 line
arch/arm/include/asm/arch-tegra/clk_rst.h +0 -0

[...]

Quoted 13 lines

arch/arm/include/asm/arch-tegra/clk_rst.h struct clk_rst_ctlr { · line 134

Quoted 10 lines
arch/arm/include/asm/arch-tegra/clk_rst.h +2 -2
@@ -105,10 +128,10 @@ struct clk_rst_ctlr {
 	uint crc_clk_cpug_cmplx;	/* _CLK_CPUG_CMPLX_0,       0x378 */
 	uint crc_clk_cpulp_cmplx;	/* _CLK_CPULP_CMPLX_0,      0x37C */
 	uint crc_cpu_softrst_ctrl;	/* _CPU_SOFTRST_CTRL_0,     0x380 */
-	uint crc_cpu_softrst_ctrl1;	/* _CPU_SOFTRST_CTR1L_0,    0x384 */
+	uint crc_cpu_softrst_ctrl1;	/* _CPU_SOFTRST_CTRL1_0,    0x384 */
 	uint crc_cpu_softrst_ctrl2;	/* _CPU_SOFTRST_CTRL2_0,    0x388 */
 	uint crc_reserved33[9];		/* _reserved_33,        0x38c-3ac */
-	uint crc_clk_src_vw[TEGRA_CLK_SOURCES_VW]; /* _G3D2_0..., 0x3b0-0x42c */
+	uint crc_clk_src_vw[TEGRA_CLK_SOURCES_VW];	/* 0x3B0-0x42C */

While at it, perhaps also make the offsets in the comment for crc_reserved33 also all caps?

I think I won't change this; it's a pre-existing issue, and "fixing" it would involve adding a bunch of unrelated diffs to this patch. Besides, the actual register entries are upper case to match the way the TRM documents the register names, whereas IIRC the reserved spaces aren't documented specifically in the TRM, and don't have to match :-)

Quoted 6 lines
Quoted 5 lines
arch/arm/include/asm/arch-tegra/clk_rst.h +5 -0
+/* CLK_RST_CONTROLLER_RST_CPUxx_CMPLX_CLR 0x344 */
+#define CLR_CPURESET0			(1 << 0)
+#define CLR_CPURESET1			(1 << 1)
+#define CLR_CPURESET2			(1 << 2)
+#define CLR_CPURESET3			(1 << 3)

[...]

Quoted 8 lines

arch/arm/include/asm/arch-tegra/clk_rst.h enum { · line 419

Quoted 5 lines
arch/arm/include/asm/arch-tegra/clk_rst.h +5 -0
+/* CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR 0x34c */
+#define CLR_CPU3_CLK_STP		(1 << 11)
+#define CLR_CPU2_CLK_STP		(1 << 10)
+#define CLR_CPU1_CLK_STP		(1 << 9)
+#define CLR_CPU0_CLK_STP		(1 << 8)

Sometimes these are listed in order of increasing bit positions, other times they are in order of decreasing bit positions.

Hmmm. The existing files seem to be inconsistent too. I think LSB->MSB is slightly more prevalent, so I'll try and settle on that, at least for the lines this patch adds.

#10 lore raw

PATCH v2 8/13 ARM: tegra: add SPL/AVP (arm720t) CPU files for Tegra124

In reply to Stephen Warren

From: Tom Warren <[email protected]>

This provides SPL support for Tegra124 boards - AVP early init, plus CPU (A15) init/jump to main U-Boot.

---
v2:
* Convert to Kconfig-style make Makefiles.
* Update AVP/PLLP clock programming to match Tegra114.
* Extracted changes to PLLX programming order into a separate patch.
* Use PLL_LOCK_MASK constant instead of a hard-coded value.
* No need to read-modify-write pmc_pwrgate_toggle or crc_clk_cpu_cmplx_clr.
* s/1x4/Tegra124/
* don't mangle (c) header in cpu.c.
* Remove leading space from debug() messages.
* Fix comment re: CPUPWRGOOD_TIMER
* Various code formatting fixes and redundant bracket and comment removal.

---
 arch/arm/cpu/arm720t/tegra-common/cpu.c |  30 +++-
 arch/arm/cpu/arm720t/tegra-common/cpu.h |   4 +-
 arch/arm/cpu/arm720t/tegra124/Makefile  |   8 +
 arch/arm/cpu/arm720t/tegra124/config.mk |   7 +
 arch/arm/cpu/arm720t/tegra124/cpu.c     | 265 ++++++++++++++++++++++++++++++++
 5 files changed, 312 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/cpu/arm720t/tegra124/Makefile
 create mode 100644 arch/arm/cpu/arm720t/tegra124/config.mk
 create mode 100644 arch/arm/cpu/arm720t/tegra124/cpu.c
arch/arm/cpu/arm720t/tegra-common/cpu.c +29 -1
index d62bb9e370e0..b2074157c01a 100644
@@ -112,6 +112,22 @@ struct clk_pll_table tegra_pll_x_table[TEGRA_SOC_CNT][CLOCK_OSC_FREQ_COUNT] = {
 		{ .n = 116, .m = 1, .p = 1 }, /* OSC: 12.0 MHz */
 		{ .n = 108, .m = 2, .p = 1 }, /* OSC: 26.0 MHz */
 	},
+
+	/*
+	 * T124: 700 MHz
+	 *
+	 * Register   Field  Bits   Width
+	 * ------------------------------
+	 * PLLX_BASE  p      23:20    4
+	 * PLLX_BASE  n      15: 8    8
+	 * PLLX_BASE  m       7: 0    8
+	 */
+	{
+		{ .n = 108, .m = 1, .p = 1 }, /* OSC: 13.0 MHz */
+		{ .n =  73, .m = 1, .p = 1 }, /* OSC: 19.2 MHz */
+		{ .n = 116, .m = 1, .p = 1 }, /* OSC: 12.0 MHz */
+		{ .n = 108, .m = 2, .p = 1 }, /* OSC: 26.0 MHz */
+	},
 };
 
 int pllx_set_rate(struct clk_pll_simple *pll , u32 divn, u32 divm,
@@ -128,6 +144,18 @@ int pllx_set_rate(struct clk_pll_simple *pll , u32 divn, u32 divm,
 
 	debug(" pllx_set_rate entry\n");
 
+#if defined(CONFIG_TEGRA124)
+	struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
+
+	/* Disable IDDQ */
+	reg = readl(&clkrst->crc_pllx_misc3);
+	reg &= ~PLLX_IDDQ_MASK;
+	writel(reg, &clkrst->crc_pllx_misc3);
+	udelay(2);
+	debug("%s: IDDQ: PLLX IDDQ = 0x%08X\n", __func__,
+	      readl(&clkrst->crc_pllx_misc3));
+#endif	/* CONFIG_TEGRA124 */
+
 	/* Set BYPASS, m, n and p to PLLX_BASE */
 	reg = PLL_BYPASS_MASK | (divm << PLL_DIVM_SHIFT);
 	reg |= ((divn << PLL_DIVN_SHIFT) | (divp << PLL_DIVP_SHIFT));
@@ -323,7 +351,7 @@ void clock_enable_coresight(int enable)
 	if (enable) {
 		/*
 		 * Put CoreSight on PLLP_OUT0 and divide it down as per
-		 * PLLP base frequency based on SoC type (T20/T30/T114).
+		 * PLLP base frequency based on SoC type (T20/T30+).
 		 * Clock divider request would setup CSITE clock as 144MHz
 		 * for PLLP base 216MHz and 204MHz for PLLP base 408MHz
 		 */
arch/arm/cpu/arm720t/tegra-common/cpu.h +3 -1
index d1520ce2cc88..b4ca44fce18a 100644
@@ -13,7 +13,8 @@
 #if defined(CONFIG_TEGRA20)
 #define NVBL_PLLP_KHZ	216000
 #define CSITE_KHZ	144000
-#elif defined(CONFIG_TEGRA30) || defined(CONFIG_TEGRA114)
+#elif defined(CONFIG_TEGRA30) || defined(CONFIG_TEGRA114) || \
+	defined(CONFIG_TEGRA124)
 #define NVBL_PLLP_KHZ	408000
 #define CSITE_KHZ	204000
 #else
@@ -70,3 +71,4 @@ int tegra_get_chip(void);
 int tegra_get_sku_info(void);
 int tegra_get_chip_sku(void);
 void adjust_pllp_out_freqs(void);
+void pmic_enable_cpu_vdd(void);
arch/arm/cpu/arm720t/tegra124/Makefile new file +8 -0
new file mode 100644
index 000000000000..61abf45d3d29
@@ -0,0 +1,8 @@
+#
+# (C) Copyright 2013-2014
+# NVIDIA Corporation <www.nvidia.com>
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y	+= cpu.o
arch/arm/cpu/arm720t/tegra124/config.mk new file +7 -0
new file mode 100644
index 000000000000..5e10701f0ea8
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2010-2013
+# NVIDIA Corporation <www.nvidia.com>
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#/
+USE_PRIVATE_LIBGCC = yes
arch/arm/cpu/arm720t/tegra124/cpu.c new file +265 -0

265 lines not on this page · raw message

Signature · 1 line
1.8.1.5
#11 lore raw

PATCH v2 8/13 ARM: tegra: add SPL/AVP (arm720t) CPU files for Tegra124

On Thu, Jan 23, 2014 at 05:42:55PM -0700, Stephen Warren wrote:
[...]

Quoted 1 line
arch/arm/cpu/arm720t/tegra-common/cpu.c +0 -0

[...]

arch/arm/cpu/arm720t/tegra-common/cpu.c int pllx_set_rate(struct clk_pll_simple *pll , u32 divn, u32 divm, · line 148

Quoted 6 lines
arch/arm/cpu/arm720t/tegra-common/cpu.c +2 -0
@@ -128,6 +144,18 @@ int pllx_set_rate(struct clk_pll_simple *pll , u32 divn, u32 divm,
 
 	debug(" pllx_set_rate entry\n");
 
+#if defined(CONFIG_TEGRA124)
+	struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;

Eek! You're mixing declarations and code! I'd prefer this to be moved up to where the other variables are declared.

We could turn the #if defined(CONFIG_TEGRA124) into something like this:

	if (CONFIG_TEGRA124) {
		...
	}

so that you get a new scope in which the variable can be declared. Of course that won't work since in U-Boot variables aren't usually defined empty...

Quoted 1 line
arch/arm/cpu/arm720t/tegra124/cpu.c +0 -0

[...]

Quoted 2 lines
arch/arm/cpu/arm720t/tegra124/cpu.c +2 -0
+static void enable_cpu_power_rail(void)
+{

[...]

arch/arm/cpu/arm720t/tegra124/cpu.c line 32

Quoted 5 lines
arch/arm/cpu/arm720t/tegra124/cpu.c +5 -0
+	/* un-tristate PWR_I2C SCL/SDA, rest of the defaults are correct */
+	pinmux_tristate_disable(PINGRP_PWR_I2C_SCL);
+	pinmux_tristate_disable(PINGRP_PWR_I2C_SDA);
+
+	pmic_enable_cpu_vdd();

Should the pinmux changes perhaps be moved to the pmic_enable_cpu_vdd() function?

I guess it doesn't really matter since it should be pretty safe to assume that all boards will always use the power I2C to talk to the PMU?

arch/arm/cpu/arm720t/tegra124/cpu.c line 202

Quoted 9 lines
arch/arm/cpu/arm720t/tegra124/cpu.c +9 -0
+static bool is_partition_powered(u32 mask)
+{
+	struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
+	u32 reg;
+
+	/* Get power gate status */
+	reg = readl(&pmc->pmc_pwrgate_status);
+	return (reg & mask) == mask;
+}

Why can't we pass in the partition ID? That way we don't even have to define the masks in the header file. It's pretty redundant.

Quoted 9 lines
arch/arm/cpu/arm720t/tegra124/cpu.c +9 -0
+static void power_partition(u32 status, u32 partid)
+{
+	struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
+
+	debug("%s: status = %08X, part ID = %08X\n", __func__, status, partid);
+	/* Is the partition already on? */
+	if (!is_partition_powered(status)) {
+		/* No, toggle the partition power state (OFF -> ON) */
+		debug("power_partition, toggling state\n");

arch/arm/cpu/arm720t/tegra124/cpu.c line 222

Quoted 10 lines
arch/arm/cpu/arm720t/tegra124/cpu.c +10 -0
+		writel(START_CP | partid, &pmc->pmc_pwrgate_toggle);
+
+		/* Wait for the power to come up */
+		while (!is_partition_powered(status))
+			;
+
+		/* Give I/O signals time to stabilize */
+		udelay(IO_STABILIZATION_DELAY);
+	}
+}

This is being called as follows:

	power_partition(CRAIL, CRAILID);
	power_partition(C0NC, C0NCID);
	power_partition(CE0, CE0ID);

So instead of passing in (1 << CRAILID, CRAILID), why not just pass around the partition ID only and compute the status mask as needed?

Now that I mention it, I do have a vague recollection that I said the exact same thing during my initial review of Tom's patches.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140124/c5a23896/attachment.pgp>

#12 lore raw

PATCH v2 8/13 ARM: tegra: add SPL/AVP (arm720t) CPU files for Tegra124

Quoted 41 lines · Thierry Reding

arch/arm/cpu/arm720t/tegra124/cpu.c line 202

Quoted 9 lines · Stephen Warren
arch/arm/cpu/arm720t/tegra124/cpu.c new file +9 -0
+static bool is_partition_powered(u32 mask)
+{
+	struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
+	u32 reg;
+
+	/* Get power gate status */
+	reg = readl(&pmc->pmc_pwrgate_status);
+	return (reg & mask) == mask;
+}

Why can't we pass in the partition ID? That way we don't even have to define the masks in the header file. It's pretty redundant.

Quoted 9 lines
arch/arm/cpu/arm720t/tegra124/cpu.c new file +9 -0
+static void power_partition(u32 status, u32 partid)
+{
+	struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
+
+	debug("%s: status = %08X, part ID = %08X\n", __func__, status, partid);
+	/* Is the partition already on? */
+	if (!is_partition_powered(status)) {
+		/* No, toggle the partition power state (OFF -> ON) */
+		debug("power_partition, toggling state\n");

arch/arm/cpu/arm720t/tegra124/cpu.c line 222

Quoted 10 lines
arch/arm/cpu/arm720t/tegra124/cpu.c new file +10 -0
+		writel(START_CP | partid, &pmc->pmc_pwrgate_toggle);
+
+		/* Wait for the power to come up */
+		while (!is_partition_powered(status))
+			;
+
+		/* Give I/O signals time to stabilize */
+		udelay(IO_STABILIZATION_DELAY);
+	}
+}

This is being called as follows:

	power_partition(CRAIL, CRAILID);
	power_partition(C0NC, C0NCID);
	power_partition(CE0, CE0ID);
Quoted 5 lines

So instead of passing in (1 << CRAILID, CRAILID), why not just pass around the partition ID only and compute the status mask as needed?

Now that I mention it, I do have a vague recollection that I said the exact same thing during my initial review of Tom's patches.

Oh, I see what you mean now. I hadn't realized that "CRAIL == 1 << CRAILID", so hadn't understood what you meant before. I'll certainly fix that up.

#13 lore raw

PATCH v2 8/13 ARM: tegra: add SPL/AVP (arm720t) CPU files for Tegra124

In reply to Thierry Reding
Quoted 7 lines · Thierry Reding
Quoted 1 line · Stephen Warren
arch/arm/cpu/arm720t/tegra124/cpu.c +0 -0

[...]

Quoted 2 lines
arch/arm/cpu/arm720t/tegra124/cpu.c +2 -0
+static void enable_cpu_power_rail(void)
+{

[...]

Quoted 8 lines

arch/arm/cpu/arm720t/tegra124/cpu.c line 32

Quoted 5 lines
arch/arm/cpu/arm720t/tegra124/cpu.c +5 -0
+	/* un-tristate PWR_I2C SCL/SDA, rest of the defaults are correct */
+	pinmux_tristate_disable(PINGRP_PWR_I2C_SCL);
+	pinmux_tristate_disable(PINGRP_PWR_I2C_SDA);
+
+	pmic_enable_cpu_vdd();

Should the pinmux changes perhaps be moved to the pmic_enable_cpu_vdd() function?

That function is implemented inside the PMIC "driver", so shouldn't know anything about Tegra pinmux. I guess this special case is required, since this code is part of the SPL, which doesn't do any of the board-specific pinmuxing; that is deferred to the main U-Boot which runs on the main CPU.

Quoted 3 lines

I guess it doesn't really matter since it should be pretty safe to assume that all boards will always use the power I2C to talk to the PMU?

One would hope so; it's a pretty core part of the Tegra chip architecture.

#14 lore raw

PATCH v2 9/13 ARM: tegra: Add CPU (armv7) files for Tegra124

In reply to Stephen Warren

From: Tom Warren <[email protected]>

These files are for code that runs on the CPU (A15) on Tegra124 boards. At this time, there is no A15-specific code here. The warmboot/LP0 files aren't included as that code hasn't been ported yet.

---
v2:
* Convert to Kconfig-style make Makefiles.
* s/MASK_BITS_29_28/MASK_BITS_31_28/ to match earlier renaming patch.
* Update AVP/PLLP clock programming to match Tegra114.
* Minor whitespace & comment cleanup.

---
 arch/arm/cpu/armv7/tegra124/Makefile   |   6 +
 arch/arm/cpu/armv7/tegra124/config.mk  |  10 +
 arch/arm/cpu/tegra124-common/Makefile  |  10 +
 arch/arm/cpu/tegra124-common/clock.c   | 826 +++++++++++++++++++++++++++++++++
 arch/arm/cpu/tegra124-common/funcmux.c |  69 +++
 arch/arm/cpu/tegra124-common/pinmux.c  | 730 +++++++++++++++++++++++++++++
 6 files changed, 1651 insertions(+)
 create mode 100644 arch/arm/cpu/armv7/tegra124/Makefile
 create mode 100644 arch/arm/cpu/armv7/tegra124/config.mk
 create mode 100644 arch/arm/cpu/tegra124-common/Makefile
 create mode 100644 arch/arm/cpu/tegra124-common/clock.c
 create mode 100644 arch/arm/cpu/tegra124-common/funcmux.c
 create mode 100644 arch/arm/cpu/tegra124-common/pinmux.c
arch/arm/cpu/armv7/tegra124/Makefile new file +6 -0
new file mode 100644
index 000000000000..7f127b1ee554
@@ -0,0 +1,6 @@
+#
+# (C) Copyright 2013-2014
+# NVIDIA Corporation <www.nvidia.com>
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
arch/arm/cpu/armv7/tegra124/config.mk new file +10 -0
new file mode 100644
index 000000000000..2f1c645c6951
@@ -0,0 +1,10 @@
+#
+# (C) Copyright 2013
+# NVIDIA Corporation <www.nvidia.com>
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, <[email protected]>
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+CONFIG_ARCH_DEVICE_TREE := tegra124
arch/arm/cpu/tegra124-common/Makefile new file +10 -0
new file mode 100644
index 000000000000..ff77992b330c
@@ -0,0 +1,10 @@
+#
+# (C) Copyright 2013-2014
+# NVIDIA Corporation <www.nvidia.com>
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y	+= clock.o
+obj-y	+= funcmux.o
+obj-y	+= pinmux.o
arch/arm/cpu/tegra124-common/clock.c new file +826 -0

826 lines not on this page · raw message

arch/arm/cpu/tegra124-common/funcmux.c new file +69 -0

69 lines not on this page · raw message

arch/arm/cpu/tegra124-common/pinmux.c new file +730 -0

730 lines not on this page · raw message

Signature · 1 line
1.8.1.5
#15 lore raw

PATCH v2 10/13 ARM: tegra: add common (shared) CPU files

In reply to Stephen Warren

From: Tom Warren <[email protected]>

These files are used by both SPL and main U-Boot.

---
v2:
* Fixed incorrect brace placement in tegra_get_chip_sku(), and allow any SKU on Tegra124 just like other SoCs.
* Simplified change to config_cache().

---
 arch/arm/cpu/tegra-common/ap.c    | 16 ++++++++++++----
 arch/arm/cpu/tegra-common/board.c | 10 ++++++++--
 arch/arm/cpu/tegra-common/cache.c | 10 ++++------
 3 files changed, 24 insertions(+), 12 deletions(-)
arch/arm/cpu/tegra-common/ap.c +12 -4
index f205be402abe..91d70da65661 100644
@@ -1,5 +1,5 @@
 /*
-* (C) Copyright 2010-2011
+* (C) Copyright 2010-2014
 * NVIDIA Corporation <www.nvidia.com>
 *
  * SPDX-License-Identifier:	GPL-2.0+
@@ -27,7 +27,7 @@ int tegra_get_chip(void)
 	/*
 	 * This is undocumented, Chip ID is bits 15:8 of the register
 	 * APB_MISC + 0x804, and has value 0x20 for Tegra20, 0x30 for
-	 * Tegra30, and 0x35 for T114.
+	 * Tegra30, 0x35 for T114, and 0x40 for Tegra124.
 	 */
 	rev = (readl(&gp->hidrev) & HIDREV_CHIPID_MASK) >> HIDREV_CHIPID_SHIFT;
 	debug("%s: CHIPID is 0x%02X\n", __func__, rev);
@@ -84,7 +84,15 @@ int tegra_get_chip_sku(void)
 			return TEGRA_SOC_T114;
 		}
 		break;
+	case CHIPID_TEGRA124:
+		switch (sku_id) {
+		case SKU_ID_T124_ENG:
+		default:
+			return TEGRA_SOC_T124;
+		}
+		break;
 	}
+
 	/* unknown chip/sku id */
 	printf("%s: ERROR: UNKNOWN CHIP/SKU ID COMBO (0x%02X/0x%02X)\n",
 		__func__, chip_id, sku_id);
@@ -119,8 +127,8 @@ static u32 get_odmdata(void)
 	 * ODMDATA is stored in the BCT in IRAM by the BootROM.
 	 * The BCT start and size are stored in the BIT in IRAM.
 	 * Read the data @ bct_start + (bct_size - 12). This works
-	 * on T20 and T30 BCTs, which are locked down. If this changes
-	 * in new chips (T114, etc.), we can revisit this algorithm.
+	 * on BCTs for currently supported SoCs, which are locked down.
+	 * If this changes in new chips, we can revisit this algorithm.
 	 */
 
 	u32 bct_start, odmdata;
arch/arm/cpu/tegra-common/board.c +8 -2
index d9cbda8a749f..6a6faf4b2760 100644
@@ -1,5 +1,5 @@
 /*
- *  (C) Copyright 2010,2011
+ *  (C) Copyright 2010-2014
  *  NVIDIA Corporation <www.nvidia.com>
  *
  * SPDX-License-Identifier:	GPL-2.0+
@@ -109,12 +109,18 @@ static int uart_configs[] = {
 	-1,
 	-1,
 	-1,
-#else	/* Tegra114 */
+#elif defined(CONFIG_TEGRA114)
 	-1,
 	-1,
 	-1,
 	FUNCMUX_UART4_GMI,	/* UARTD */
 	-1,
+#else	/* Tegra124 */
+	FUNCMUX_UART1_KBC,	/* UARTA */
+	-1,
+	-1,
+	FUNCMUX_UART4_GPIO,	/* UARTD */
+	-1,
 #endif
 };
 
arch/arm/cpu/tegra-common/cache.c +4 -6
index 48e9319c7508..94f5bce90ec3 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2013-2014, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -23,8 +23,6 @@
 
 void config_cache(void)
 {
-	struct apb_misc_gp_ctlr *gp =
-		(struct apb_misc_gp_ctlr *)NV_PA_APB_MISC_GP_BASE;
 	u32 reg = 0;
 
 	/* enable SMP mode and FW for CPU0, by writing to Auxiliary Ctl reg */
@@ -33,10 +31,10 @@ void config_cache(void)
 		"orr r0, r0, #0x41\n"
 		"mcr p15, 0, r0, c1, c0, 1\n");
 
-	/* Currently, only T114 needs this L2 cache change to boot Linux */
-	reg = (readl(&gp->hidrev) & HIDREV_CHIPID_MASK);
-	if (reg != (CHIPID_TEGRA114 << HIDREV_CHIPID_SHIFT))
+	/* Currently, only Tegra114+ needs this L2 cache change to boot Linux */
+	if (tegra_get_chip() < CHIPID_TEGRA114)
 		return;
+
 	/*
 	 * Systems with an architectural L2 cache must not use the PL310.
 	 * Config L2CTLR here for a data RAM latency of 3 cycles.
Signature · 1 line
1.8.1.5
#16 lore raw

PATCH v2 11/13 ARM: tegra: add DT files for Tegra124 and Venice2

In reply to Stephen Warren

From: Tom Warren <[email protected]>

These are fairly complete, and near-clones of Tegra114 Venice, with an additional I2C port, and MMC address changes for Tegra124.

---
v2:
* Added aliases for SPI devices so they always have the same ID.
* Gave each node a unit address where required.
* Fixed all compatible values to match the Linux kernel.
* s/status = "disable"/status = "disabled"/
* Removed properties and nodes that ara:
- Non-standard and don't match DTs in U-Boot for earlier Tegra SoCs.
- Not used or for features that don't yet work.
- ChromeOS specific.

---
 arch/arm/dts/tegra124.dtsi            | 250 ++++++++++++++++++++++++++++++++++
 board/nvidia/dts/tegra124-venice2.dts |  84 ++++++++++++
 2 files changed, 334 insertions(+)
 create mode 100644 arch/arm/dts/tegra124.dtsi
 create mode 100644 board/nvidia/dts/tegra124-venice2.dts
arch/arm/dts/tegra124.dtsi new file +250 -0
new file mode 100644
index 000000000000..18a8b24b71f7
@@ -0,0 +1,250 @@
+#include "skeleton.dtsi"
+
+/ {
+	compatible = "nvidia,tegra124";
+
+	tegra_car: clock at 60006000 {
+		compatible = "nvidia,tegra124-car";
+		reg = <0x60006000 0x1000>;
+		#clock-cells = <1>;
+	};
+
+	apbdma: dma at 60020000 {
+		compatible = "nvidia,tegra124-apbdma", "nvidia,tegra148-apbdma";
+		reg = <0x60020000 0x1400>;
+		interrupts = <0 104 0x04
+			      0 105 0x04
+			      0 106 0x04
+			      0 107 0x04
+			      0 108 0x04
+			      0 109 0x04
+			      0 110 0x04
+			      0 111 0x04
+			      0 112 0x04
+			      0 113 0x04
+			      0 114 0x04
+			      0 115 0x04
+			      0 116 0x04
+			      0 117 0x04
+			      0 118 0x04
+			      0 119 0x04
+			      0 128 0x04
+			      0 129 0x04
+			      0 130 0x04
+			      0 131 0x04
+			      0 132 0x04
+			      0 133 0x04
+			      0 134 0x04
+			      0 135 0x04
+			      0 136 0x04
+			      0 137 0x04
+			      0 138 0x04
+			      0 139 0x04
+			      0 140 0x04
+			      0 141 0x04
+			      0 142 0x04
+			      0 143 0x04>;
+	};
+
+	gpio: gpio at 6000d000 {
+		compatible = "nvidia,tegra124-gpio", "nvidia,tegra30-gpio";
+		reg = <0x6000d000 0x1000>;
+		interrupts = <0 32 0x04
+			      0 33 0x04
+			      0 34 0x04
+			      0 35 0x04
+			      0 55 0x04
+			      0 87 0x04
+			      0 89 0x04
+			      0 125 0x04>;
+		#gpio-cells = <2>;
+		gpio-controller;
+		#interrupt-cells = <2>;
+		interrupt-controller;
+	};
+
+	i2c at 7000c000 {
+		compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+		reg = <0x7000c000 0x100>;
+		interrupts = <0 38 0x04>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clocks = <&tegra_car 12>;
+		status = "disabled";
+	};
+
+	i2c at 7000c400 {
+		compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+		reg = <0x7000c400 0x100>;
+		interrupts = <0 84 0x04>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clocks = <&tegra_car 54>;
+		status = "disabled";
+	};
+
+	i2c at 7000c500 {
+		compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+		reg = <0x7000c500 0x100>;
+		interrupts = <0 92 0x04>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clocks = <&tegra_car 67>;
+		status = "disabled";
+	};
+
+	i2c at 7000c700 {
+		compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+		reg = <0x7000c700 0x100>;
+		interrupts = <0 120 0x04>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clocks = <&tegra_car 103>;
+		status = "disabled";
+	};
+
+	i2c at 7000d000 {
+		compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+		reg = <0x7000d000 0x100>;
+		interrupts = <0 53 0x04>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clocks = <&tegra_car 47>;
+		status = "disabled";
+	};
+
+	i2c at 7000d100 {
+		compatible = "nvidia,tegra124-i2c", "nvidia,tegra114-i2c";
+		reg = <0x7000d100 0x100>;
+		interrupts = <0 53 0x04>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		clocks = <&tegra_car 47>;
+		status = "disabled";
+	};
+
+	spi at 7000d400 {
+		compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
+		reg = <0x7000d400 0x200>;
+		interrupts = <0 59 0x04>;
+		nvidia,dma-request-selector = <&apbdma 15>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		status = "disabled";
+		clocks = <&tegra_car 41>;
+	};
+
+	spi at 7000d600 {
+		compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
+		reg = <0x7000d600 0x200>;
+		interrupts = <0 82 0x04>;
+		nvidia,dma-request-selector = <&apbdma 16>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		status = "disabled";
+		clocks = <&tegra_car 44>;
+	};
+
+	spi at 7000d800 {
+		compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
+		reg = <0x7000d800 0x200>;
+		interrupts = <0 83 0x04>;
+		nvidia,dma-request-selector = <&apbdma 17>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		status = "disabled";
+		clocks = <&tegra_car 46>;
+	};
+
+	spi at 7000da00 {
+		compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
+		reg = <0x7000da00 0x200>;
+		interrupts = <0 93 0x04>;
+		nvidia,dma-request-selector = <&apbdma 18>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		status = "disabled";
+		clocks = <&tegra_car 68>;
+	};
+
+	spi at 7000dc00 {
+		compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
+		reg = <0x7000dc00 0x200>;
+		interrupts = <0 94 0x04>;
+		nvidia,dma-request-selector = <&apbdma 27>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		status = "disabled";
+		clocks = <&tegra_car 104>;
+	};
+
+	spi at 7000de00 {
+		compatible = "nvidia,tegra124-spi", "nvidia,tegra114-spi";
+		reg = <0x7000de00 0x200>;
+		interrupts = <0 79 0x04>;
+		nvidia,dma-request-selector = <&apbdma 28>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		status = "disabled";
+		clocks = <&tegra_car 105>;
+	};
+
+	sdhci at 700b0000 {
+		compatible = "nvidia,tegra124-sdhci";
+		reg = <0x700b0000 0x200>;
+		interrupts = <0 14 0x04>;
+		clocks = <&tegra_car 14>;
+		status = "disabled";
+	};
+
+	sdhci at 700b0200 {
+		compatible = "nvidia,tegra124-sdhci";
+		reg = <0x700b0200 0x200>;
+		interrupts = <0 15 0x04>;
+		clocks = <&tegra_car 9>;
+		status = "disabled";
+	};
+
+	sdhci at 700b0400 {
+		compatible = "nvidia,tegra124-sdhci";
+		reg = <0x700b0400 0x200>;
+		interrupts = <0 19 0x04>;
+		clocks = <&tegra_car 69>;
+		status = "disabled";
+	};
+
+	sdhci at 700b0600 {
+		compatible = "nvidia,tegra124-sdhci";
+		reg = <0x700b0600 0x200>;
+		interrupts = <0 31 0x04>;
+		clocks = <&tegra_car 15>;
+		status = "disabled";
+	};
+
+	usb at 7d000000 {
+		compatible = "nvidia,tegra124-ehci", "nvidia,tegra30-ehci";
+		reg = <0x7d000000 0x4000>;
+		interrupts = < 52 >;
+		phy_type = "utmi";
+		clocks = <&tegra_car 22>;	/* PERIPH_ID_USBD */
+		status = "disabled";
+	};
+
+	usb at 7d004000 {
+		compatible = "nvidia,tegra124-ehci", "nvidia,tegra30-ehci";
+		reg = <0x7d004000 0x4000>;
+		interrupts = < 53 >;
+		phy_type = "hsic";
+		clocks = <&tegra_car 58>;	/* PERIPH_ID_USB2 */
+		status = "disabled";
+	};
+
+	usb at 7d008000 {
+		compatible = "nvidia,tegra124-ehci", "nvidia,tegra30-ehci";
+		reg = <0x7d008000 0x4000>;
+		interrupts = < 129 >;
+		phy_type = "utmi";
+		clocks = <&tegra_car 59>;	/* PERIPH_ID_USB3 */
+		status = "disabled";
+	};
+};
board/nvidia/dts/tegra124-venice2.dts new file +84 -0

84 lines not on this page · raw message

Signature · 1 line
1.8.1.5
#17 lore raw

PATCH v2 12/13 ARM: tegra: add Venice2 (Tegra124) board

In reply to Stephen Warren

From: Tom Warren <[email protected]>

These are the board files for Venice2 (Tegra124), plus the AS3722 PMIC files. PMIC init will be moved to pmic_common_init later.

This builds/boots on Venice2, SPI/MMC/USB/I2C all work. Audio, display and WB/LP0 are not supported yet.

---
v2:
* Convert to Kconfig-style make Makefiles.
* Updated default environment to enable bootcmd_pxe.
* Removed most functional diffs (i.e. other than SoC name, valid values, etc.) between include/configs/tegra1[12]4-common.h.
* Deleted PMIC programming code that was disabled; it can be added later if it turns out to be useful.
* Fixed boards.cfg sort order.
* Removed unused define CONFIG_TEGRA_USE_EMC_DRAM_SIZE.
* Minor comment cleanup.

---
 board/nvidia/venice2/Makefile                |   9 +
 board/nvidia/venice2/as3722_init.c           |  91 +++++++
 board/nvidia/venice2/as3722_init.h           |  38 +++
 board/nvidia/venice2/pinmux-config-venice2.h | 339 +++++++++++++++++++++++++++
 board/nvidia/venice2/venice2.c               |  33 +++
 boards.cfg                                   |   1 +
 include/configs/tegra124-common.h            |  82 +++++++
 include/configs/venice2.h                    |  79 +++++++
 8 files changed, 672 insertions(+)
 create mode 100644 board/nvidia/venice2/Makefile
 create mode 100644 board/nvidia/venice2/as3722_init.c
 create mode 100644 board/nvidia/venice2/as3722_init.h
 create mode 100644 board/nvidia/venice2/pinmux-config-venice2.h
 create mode 100644 board/nvidia/venice2/venice2.c
 create mode 100644 include/configs/tegra124-common.h
 create mode 100644 include/configs/venice2.h
board/nvidia/venice2/Makefile new file +9 -0
new file mode 100644
index 000000000000..5fac5ab1f81f
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2013-2014
+# NVIDIA Corporation <www.nvidia.com>
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y	+= as3722_init.o
+obj-y	+= venice2.o
board/nvidia/venice2/as3722_init.c new file +91 -0

91 lines not on this page · raw message

board/nvidia/venice2/as3722_init.h new file +38 -0
new file mode 100644
index 000000000000..2a9e7cdf8721
@@ -0,0 +1,38 @@
+/*
+ * (C) Copyright 2013
+ * NVIDIA Corporation <www.nvidia.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+/* AS3722-PMIC-specific early init regs */
+
+#define AS3722_I2C_ADDR		0x80
+
+#define AS3722_SD0VOLTAGE_REG	0x00	/* CPU */
+#define AS3722_SD1VOLTAGE_REG	0x01	/* CORE, already set by OTP */
+#define AS3722_SD6VOLTAGE_REG	0x06	/* GPU */
+#define AS3722_SDCONTROL_REG	0x4D
+
+#define AS3722_LDO2VOLTAGE_REG	0x12	/* VPP_FUSE */
+#define AS3722_LDO6VOLTAGE_REG	0x16	/* VDD_SDMMC */
+#define AS3722_LDCONTROL_REG	0x4E
+
+#define AS3722_SD0VOLTAGE_DATA	(0x2800 | AS3722_SD0VOLTAGE_REG)
+#define AS3722_SD0CONTROL_DATA	(0x0100 | AS3722_SDCONTROL_REG)
+
+#define AS3722_SD1VOLTAGE_DATA	(0x3200 | AS3722_SD1VOLTAGE_REG)
+#define AS3722_SD1CONTROL_DATA	(0x0200 | AS3722_SDCONTROL_REG)
+
+#define AS3722_SD6CONTROL_DATA	(0x4000 | AS3722_SDCONTROL_REG)
+#define AS3722_SD6VOLTAGE_DATA	(0x2800 | AS3722_SD6VOLTAGE_REG)
+
+#define AS3722_LDO2CONTROL_DATA	(0x0400 | AS3722_LDCONTROL_REG)
+#define AS3722_LDO2VOLTAGE_DATA	(0x1000 | AS3722_LDO2VOLTAGE_REG)
+
+#define AS3722_LDO6CONTROL_DATA	(0x4000 | AS3722_LDCONTROL_REG)
+#define AS3722_LDO6VOLTAGE_DATA	(0x3F00 | AS3722_LDO6VOLTAGE_REG)
+
+#define I2C_SEND_2_BYTES	0x0A02
+
+void pmic_enable_cpu_vdd(void);
board/nvidia/venice2/pinmux-config-venice2.h new file +339 -0

339 lines not on this page · raw message

board/nvidia/venice2/venice2.c new file +33 -0
new file mode 100644
index 000000000000..1ed2fd788ec1
@@ -0,0 +1,33 @@
+/*
+ * (C) Copyright 2013-2014
+ * NVIDIA Corporation <www.nvidia.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm-generic/gpio.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/gp_padctrl.h>
+#include <asm/arch/pinmux.h>
+#include "pinmux-config-venice2.h"
+#include <i2c.h>
+
+/*
+ * Routine: pinmux_init
+ * Description: Do individual peripheral pinmux configs
+ */
+void pinmux_init(void)
+{
+	pinmux_config_table(tegra124_pinmux_set_nontristate,
+			    ARRAY_SIZE(tegra124_pinmux_set_nontristate));
+
+	pinmux_config_table(tegra124_pinmux_common,
+			    ARRAY_SIZE(tegra124_pinmux_common));
+
+	pinmux_config_table(unused_pins_lowpower,
+			    ARRAY_SIZE(unused_pins_lowpower));
+
+	/* Initialize any non-default pad configs (APB_MISC_GP regs) */
+	padgrp_config_table(venice2_padctrl, ARRAY_SIZE(venice2_padctrl));
+}
boards.cfg +1 -0
index a8336cc7a9a0..a884afa97f5e 100644
@@ -363,6 +363,7 @@ Active  arm	    armv7	   zynq	       xilinx	       zynq	   	   zynq_zc770_xm010
 Active  arm	    armv7	   zynq	       xilinx	       zynq	   	   zynq_zc770_xm012			zynq_zc770:ZC770_XM012                                                                                                            Michal Simek <[email protected]>:Jagannadha Sutradharudu Teki <[email protected]>
 Active  arm	    armv7	   zynq	       xilinx	       zynq	   	   zynq_zc770_xm013			zynq_zc770:ZC770_XM013                                                                                                            Michal Simek <[email protected]>:Jagannadha Sutradharudu Teki <[email protected]>
 Active  arm         armv7:arm720t  tegra114    nvidia          dalmore             dalmore                              -                                                                                                                                 Tom Warren <[email protected]>
+Active  arm         armv7:arm720t  tegra124    nvidia          venice2             venice2                              -                                                                                                                                 Tom Warren <[email protected]>
 Active  arm         armv7:arm720t  tegra20     avionic-design  medcom-wide         medcom-wide                          -                                                                                                                                 Alban Bedel <[email protected]>
 Active  arm         armv7:arm720t  tegra20     avionic-design  plutux              plutux                               -                                                                                                                                 Alban Bedel <[email protected]>
 Active  arm         armv7:arm720t  tegra20     avionic-design  tec                 tec                                  -                                                                                                                                 Alban Bedel <[email protected]>
include/configs/tegra124-common.h new file +82 -0

82 lines not on this page · raw message

include/configs/venice2.h new file +79 -0

79 lines not on this page · raw message

Signature · 1 line
1.8.1.5
#18 lore raw

PATCH v2 13/13 ARM: tegra: fix "bootp" issue for Tegra124 too

In reply to Stephen Warren

From: Jim Lin <[email protected]>

Fix the timeout issue after running "bootp" command in U-Boot console.

TXFIFOTHRES bits of TXFILLTUNING register should be set to 0x10 after a controller reset and before RUN bit is se, (per technical reference manual.

---
 include/configs/tegra124-common.h | 1 +
 1 file changed, 1 insertion(+)
include/configs/tegra124-common.h +1 -0
index 32d5bc9c950f..0a4541bd20e6 100644
@@ -78,5 +78,6 @@
 
 /* For USB EHCI controller */
 #define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_EHCI_TXFIFO_THRESH	0x10
 
 #endif /* _TEGRA124_COMMON_H_ */
Signature · 1 line
1.8.1.5
#19 lore raw

PATCH v2 13/13 ARM: tegra: fix "bootp" issue for Tegra124 too

Quoted 7 lines · Stephen Warren

From: Jim Lin <[email protected]>

Fix the timeout issue after running "bootp" command in U-Boot console.

TXFIFOTHRES bits of TXFILLTUNING register should be set to 0x10 after a controller reset and before RUN bit is se, (per technical reference manual.

Stephen,
Could you help to replace "," with "t" and put right parenthesis? Like

controller reset and before RUN bit is set (per technical reference manual).

Thanks,

--nvpublic

#20 lore raw

PATCH v2 13/13 ARM: tegra: fix "bootp" issue for Tegra124 too

Quoted 9 lines · Jim Lin
Quoted 7 lines · Stephen Warren

From: Jim Lin <[email protected]>

Fix the timeout issue after running "bootp" command in U-Boot console.

TXFIFOTHRES bits of TXFILLTUNING register should be set to 0x10 after a controller reset and before RUN bit is se, (per technical reference manual.

Quoted 6 lines

Stephen,
Could you help to replace "," with "t" and put right parenthesis? Like

controller reset and before RUN bit is set (per technical reference manual).

Tom, will you do this when applying the patch, or do you want me to resend? Thanks.

#21 lore raw

PATCH v2 1/13 mmc: tegra: support Tegra124

In reply to Stephen Warren

Hi Stephen,

Looks fine to me..

Quoted 78 lines · Stephen Warren

From: Stephen Warren <[email protected]>

Tegra124's MMC controller is very similar to earlier SoC generations, and can be supported by the same driver.

However, there are some non-backwards-compatible HW differences, and hence a new DT compatible value must be used to describe the HW. This patch updates the driver to support that new compatible value.

That said, the HW differences are only relevant when enabling certain high-performance transfer modes. Since the driver is currently very simple and doesn't enable those modes, we don't actually need to address any of these HW differences in the code yet, hence the simple nature of this patch.

Cc Pantelis Antoniou <[email protected]>

---
v2: New patch.

This patch is needed for MMC support on Tegra124 at run-time, but not strictly required at compile-time. So, it can either go into the MMC tree and all get merged together in the main U-Boot repo, or the MMC maintainer can ack it to go through the Tegra tree with the rest of the changes.
---

drivers/mmc/tegra_mmc.c | 9 +++++++++
include/fdtdec.h        | 1 +
lib/fdtdec.c            | 1 +
3 files changed, 11 insertions(+)
drivers/mmc/tegra_mmc.c +9 -0
index e1817e24f6d4..3d1ce1263c82 100644
@@ -668,6 +668,15 @@ void tegra_mmc_init(void)
 	const void *blob = gd->fdt_blob;
 	debug("%s entry\n", __func__);
 
+	/* See if any Tegra124 MMC controllers are present */
+	count = fdtdec_find_aliases_for_id(blob, "sdhci",
+		COMPAT_NVIDIA_TEGRA124_SDMMC, node_list, MAX_HOSTS);
+	debug("%s: count of Tegra124 sdhci nodes is %d\n", __func__, count);
+	if (process_nodes(blob, node_list, count)) {
+		printf("%s: Error processing T30 mmc node(s)!\n", __func__);
+		return;
+	}
+
 	/* See if any Tegra30 MMC controllers are present */
 	count = fdtdec_find_aliases_for_id(blob, "sdhci",
 		COMPAT_NVIDIA_TEGRA30_SDMMC, node_list, MAX_HOSTS);
include/fdtdec.h +1 -0
index 433d6a7c0256..19bab7944817 100644
@@ -59,6 +59,7 @@ enum fdt_compat_id {
 	COMPAT_NVIDIA_TEGRA20_NAND,	/* Tegra2 NAND controller */
 	COMPAT_NVIDIA_TEGRA20_PWM,	/* Tegra 2 PWM controller */
 	COMPAT_NVIDIA_TEGRA20_DC,	/* Tegra 2 Display controller */
+	COMPAT_NVIDIA_TEGRA124_SDMMC,	/* Tegra124 SDMMC controller */
 	COMPAT_NVIDIA_TEGRA30_SDMMC,	/* Tegra30 SDMMC controller */
 	COMPAT_NVIDIA_TEGRA20_SDMMC,	/* Tegra20 SDMMC controller */
 	COMPAT_NVIDIA_TEGRA20_SFLASH,	/* Tegra 2 SPI flash controller */
lib/fdtdec.c +1 -0
index 207314fa72fb..1fecab3fbc30 100644
@@ -32,6 +32,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
 	COMPAT(NVIDIA_TEGRA20_NAND, "nvidia,tegra20-nand"),
 	COMPAT(NVIDIA_TEGRA20_PWM, "nvidia,tegra20-pwm"),
 	COMPAT(NVIDIA_TEGRA20_DC, "nvidia,tegra20-dc"),
+	COMPAT(NVIDIA_TEGRA124_SDMMC, "nvidia,tegra124-sdhci"),
 	COMPAT(NVIDIA_TEGRA30_SDMMC, "nvidia,tegra30-sdhci"),
 	COMPAT(NVIDIA_TEGRA20_SDMMC, "nvidia,tegra20-sdhci"),
 	COMPAT(NVIDIA_TEGRA20_SFLASH, "nvidia,tegra20-sflash"),
Signature · 1 line
1.8.1.5
#22 lore raw

PATCH v2 1/13 mmc: tegra: support Tegra124

In reply to Stephen Warren

I've been booting Venice2 with these patches for a day now, everything seems to work as expected, so:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140124/99eca1dc/attachment.pgp>