Skip to contentSkip to conversation

Add T30 Cardhu support

PATCH New Tom Warren 4 participants 29 messages Oct 2, 2012 – Oct 4, 2012

Subsystems (4)
lore
Share & tools
lore

Tom Warren

author
#0 lore raw

cover Add T30 Cardhu support

This patch series adds basic (boot to cmd prompt) support for Tegra30. This is based on the Tegra20 SPL, which inits the AVP (ARM7TDMI boot proc) first, then control is transferred to the CPU (A9 quad core). It is based on current u-boot-tegra/next.

Future patches will add support/drivers for MMC/USB/I2C/SPI/etc. The Cardhu T30 board is supported initially.

./MAKEALL -a arm OK; checkpatch.pl is clean except for 1 bogus error where it misread a string as a macro needing parens.

git format-patch -7 -M -C -C was used, to help show renames/copies.

Tom Warren (7):
Tegra30: Add AVP (arm720t) files
Tegra30: Add CPU (armv7) files
Tegra30: Add common CPU (shared) files
Tegra30: Add arch-tegra30 include files
Tegra30: Cardhu: Add DT files
Tegra30: Add generic Tegra30 build support
Tegra30: Add/enable Cardhu build (T30 reference board)

 Makefile                                           |    6 +-
 arch/arm/cpu/arm720t/tegra-common/cpu.h            |   48 +-
 arch/arm/cpu/arm720t/tegra-common/spl.c            |    3 +-
 arch/arm/cpu/arm720t/tegra30/Makefile              |   41 +
 arch/arm/cpu/arm720t/tegra30/config.mk             |   19 +
 arch/arm/cpu/arm720t/tegra30/cpu.c                 |  516 +++++++++
 arch/arm/cpu/armv7/Makefile                        |    2 +-
 arch/arm/cpu/armv7/start.S                         |    4 +-
 arch/arm/cpu/armv7/tegra30/Makefile                |   40 +
 arch/arm/cpu/armv7/tegra30/config.mk               |   19 +
 arch/arm/cpu/tegra-common/ap.c                     |   22 +-
 arch/arm/cpu/tegra-common/board.c                  |   25 +-
 arch/arm/cpu/tegra-common/sys_info.c               |    5 +-
 arch/arm/cpu/tegra20-common/warmboot.c             |    2 +-
 arch/arm/cpu/tegra30-common/Makefile               |   44 +
 arch/arm/cpu/tegra30-common/clock.c                | 1092 ++++++++++++++++++++
 arch/arm/cpu/tegra30-common/funcmux.c              |   57 +
 arch/arm/cpu/tegra30-common/pinmux.c               |  501 +++++++++
 arch/arm/dts/tegra30.dtsi                          |   30 +
 arch/arm/include/asm/arch-tegra/ap.h               |   50 +-
 arch/arm/include/asm/arch-tegra/clk_rst.h          |  148 +++-
 arch/arm/include/asm/arch-tegra/clock.h            |    8 +-
 arch/arm/include/asm/arch-tegra/gp_padctrl.h       |   37 +
 arch/arm/include/asm/arch-tegra/tegra.h            |   11 +-
 arch/arm/include/asm/arch-tegra20/gp_padctrl.h     |   17 +-
 arch/arm/include/asm/arch-tegra30/clock-tables.h   |  378 +++++++
 arch/arm/include/asm/arch-tegra30/clock.h          |   24 +
 arch/arm/include/asm/arch-tegra30/emc.h            |  106 ++
 arch/arm/include/asm/arch-tegra30/flow.h           |   35 +
 arch/arm/include/asm/arch-tegra30/funcmux.h        |   47 +
 arch/arm/include/asm/arch-tegra30/gp_padctrl.h     |   59 ++
 arch/arm/include/asm/arch-tegra30/gpio.h           |  304 ++++++
 arch/arm/include/asm/arch-tegra30/hardware.h       |   22 +
 .../asm/arch-tegra30/pinmux-config-common.h        |  339 ++++++
 arch/arm/include/asm/arch-tegra30/pinmux.h         |  603 +++++++++++
 arch/arm/include/asm/arch-tegra30/pmu.h            |   23 +
 arch/arm/include/asm/arch-tegra30/tegra.h          |   26 +
 board/nvidia/cardhu/Makefile                       |   48 +
 board/nvidia/cardhu/cardhu.c                       |   25 +
 board/nvidia/common/board.c                        |   26 +-
 board/nvidia/dts/tegra30-cardhu.dts                |   35 +
 boards.cfg                                         |    1 +
 include/configs/cardhu.h                           |   52 +
 include/configs/tegra30-common.h                   |  180 ++++
 include/serial.h                                   |    2 +-
 spl/Makefile                                       |    2 +-
 46 files changed, 4950 insertions(+), 134 deletions(-)
 create mode 100644 arch/arm/cpu/arm720t/tegra30/Makefile
 create mode 100644 arch/arm/cpu/arm720t/tegra30/config.mk
 create mode 100644 arch/arm/cpu/arm720t/tegra30/cpu.c
 create mode 100644 arch/arm/cpu/armv7/tegra30/Makefile
 create mode 100644 arch/arm/cpu/armv7/tegra30/config.mk
 create mode 100644 arch/arm/cpu/tegra30-common/Makefile
 create mode 100644 arch/arm/cpu/tegra30-common/clock.c
 create mode 100644 arch/arm/cpu/tegra30-common/funcmux.c
 create mode 100644 arch/arm/cpu/tegra30-common/pinmux.c
 create mode 100644 arch/arm/dts/tegra30.dtsi
 create mode 100644 arch/arm/include/asm/arch-tegra/gp_padctrl.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/clock-tables.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/clock.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/emc.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/flow.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/funcmux.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/gp_padctrl.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/gpio.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/hardware.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/pinmux-config-common.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/pinmux.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/pmu.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/tegra.h
 create mode 100644 board/nvidia/cardhu/Makefile
 create mode 100644 board/nvidia/cardhu/cardhu.c
 create mode 100644 board/nvidia/dts/tegra30-cardhu.dts
 create mode 100644 include/configs/cardhu.h
 create mode 100644 include/configs/tegra30-common.h
author
#1 lore raw

PATCH 1/7 Tegra30: Add AVP (arm720t) files

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

---
 arch/arm/cpu/arm720t/tegra-common/cpu.h            |   48 +--
 arch/arm/cpu/arm720t/tegra-common/spl.c            |    3 +-
 .../arm/cpu/arm720t/tegra30}/Makefile              |   20 +-
 arch/arm/cpu/arm720t/tegra30/config.mk             |   19 +
 arch/arm/cpu/arm720t/tegra30/cpu.c                 |  516 ++++++++++++++++++++
 5 files changed, 554 insertions(+), 52 deletions(-)
 copy {board/compal/paz00 => arch/arm/cpu/arm720t/tegra30}/Makefile (68%)
 create mode 100644 arch/arm/cpu/arm720t/tegra30/config.mk
 create mode 100644 arch/arm/cpu/arm720t/tegra30/cpu.c
arch/arm/cpu/arm720t/tegra-common/cpu.h +7 -41
index 6804cd7..0d9a3c2 100644
@@ -44,50 +44,11 @@
 
 #define CORESIGHT_UNLOCK	0xC5ACCE55;
 
-/* AP20-Specific Base Addresses */
-
-/* AP20 Base physical address of SDRAM. */
-#define AP20_BASE_PA_SDRAM      0x00000000
-/* AP20 Base physical address of internal SRAM. */
-#define AP20_BASE_PA_SRAM       0x40000000
-/* AP20 Size of internal SRAM (256KB). */
-#define AP20_BASE_PA_SRAM_SIZE  0x00040000
-/* AP20 Base physical address of flash. */
-#define AP20_BASE_PA_NOR_FLASH  0xD0000000
-/* AP20 Base physical address of boot information table. */
-#define AP20_BASE_PA_BOOT_INFO  AP20_BASE_PA_SRAM
-
-/*
- * Super-temporary stacks for EXTREMELY early startup. The values chosen for
- * these addresses must be valid on ALL SOCs because this value is used before
- * we are able to differentiate between the SOC types.
- *
- * NOTE: The since CPU's stack will eventually be moved from IRAM to SDRAM, its
- *       stack is placed below the AVP stack. Once the CPU stack has been moved,
- *       the AVP is free to use the IRAM the CPU stack previously occupied if
- *       it should need to do so.
- *
- * NOTE: In multi-processor CPU complex configurations, each processor will have
- *       its own stack of size CPU_EARLY_BOOT_STACK_SIZE. CPU 0 will have a
- *       limit of CPU_EARLY_BOOT_STACK_LIMIT. Each successive CPU will have a
- *       stack limit that is CPU_EARLY_BOOT_STACK_SIZE less then the previous
- *       CPU.
- */
-
-/* Common AVP early boot stack limit */
-#define AVP_EARLY_BOOT_STACK_LIMIT	\
-	(AP20_BASE_PA_SRAM + (AP20_BASE_PA_SRAM_SIZE/2))
-/* Common AVP early boot stack size */
-#define AVP_EARLY_BOOT_STACK_SIZE	0x1000
-/* Common CPU early boot stack limit */
-#define CPU_EARLY_BOOT_STACK_LIMIT	\
-	(AVP_EARLY_BOOT_STACK_LIMIT - AVP_EARLY_BOOT_STACK_SIZE)
-/* Common CPU early boot stack size */
-#define CPU_EARLY_BOOT_STACK_SIZE	0x1000
-
 #define EXCEP_VECTOR_CPU_RESET_VECTOR	(NV_PA_EVP_BASE + 0x100)
 #define CSITE_CPU_DBG0_LAR		(NV_PA_CSITE_BASE + 0x10FB0)
 #define CSITE_CPU_DBG1_LAR		(NV_PA_CSITE_BASE + 0x12FB0)
+#define CSITE_CPU_DBG2_LAR		(NV_PA_CSITE_BASE + 0x14FB0)
+#define CSITE_CPU_DBG3_LAR		(NV_PA_CSITE_BASE + 0x16FB0)
 
 #define FLOW_CTLR_HALT_COP_EVENTS	(NV_PA_FLOW_BASE + 4)
 #define FLOW_MODE_STOP			2
@@ -95,6 +56,11 @@
 #define HALT_COP_EVENT_IRQ_1		(1 << 11)
 #define HALT_COP_EVENT_FIQ_1		(1 << 9)
 
+#define FLOW_MODE_NONE		0
+
+#define SIMPLE_PLLX     (CLOCK_ID_XCPU - CLOCK_ID_FIRST_SIMPLE)
+#define GP_HIDREV	0x804
+
 void start_cpu(u32 reset_vector);
 int ap20_cpu_is_cortexa9(void);
 void halt_avp(void)  __attribute__ ((noreturn));
arch/arm/cpu/arm720t/tegra-common/spl.c +1 -2
index 0d37ce8..2e8d9ca 100644
@@ -33,8 +33,6 @@
 #include <image.h>
 #include <malloc.h>
 #include <linux/compiler.h>
-#include "cpu.h"
-
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/pinmux.h>
@@ -44,6 +42,7 @@
 #include <asm/arch-tegra/pmc.h>
 #include <asm/arch-tegra/scu.h>
 #include <asm/arch-tegra/sys_proto.h>
+#include "cpu.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
arch/arm/cpu/arm720t/tegra30/Makefile renamed from board/compal/paz00/Makefile +11 -9
similarity index 68%
copy from board/compal/paz00/Makefile
copy to arch/arm/cpu/arm720t/tegra30/Makefile
index 7f7287e..bd96997 100644
@@ -1,8 +1,8 @@
 #
 # Copyright (c) 2010-2012, NVIDIA CORPORATION.  All rights reserved.
 #
-# See file CREDITS for list of people who contributed to this
-# project.
+# (C) Copyright 2000-2008
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms and conditions of the GNU General Public License,
@@ -13,20 +13,22 @@
 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 # more details.
 #
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
 
 include $(TOPDIR)/config.mk
 
-$(shell mkdir -p $(obj)../../nvidia/common)
+LIB	= $(obj)lib$(SOC).o
 
-LIB	= $(obj)lib$(BOARD).o
+COBJS-y	+= cpu.o
 
-COBJS	:= $(BOARD).o
-COBJS	+= ../../nvidia/common/board.o
+SRCS	:= $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
 
-SRCS	:= $(COBJS:.o=.c)
-OBJS	:= $(addprefix $(obj),$(COBJS))
+all:	$(obj).depend $(LIB)
 
-$(LIB):	$(obj).depend $(OBJS)
+$(LIB):	$(OBJS)
 	$(call cmd_link_o_target, $(OBJS))
 
 #########################################################################
arch/arm/cpu/arm720t/tegra30/config.mk new file +19 -0
new file mode 100644
index 0000000..2388c56
@@ -0,0 +1,19 @@
+#
+# Copyright (c) 2010-2012, NVIDIA CORPORATION.  All rights reserved.
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, <[email protected]>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms and conditions of the GNU General Public License,
+# version 2, as published by the Free Software Foundation.
+#
+# This program is distributed in the hope it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+USE_PRIVATE_LIBGCC = yes
arch/arm/cpu/arm720t/tegra30/cpu.c new file +516 -0

516 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 1/7 Tegra30: Add AVP (arm720t) files

arch/arm/cpu/arm720t/tegra30/cpu.c line 45

Quoted 11 lines · Tom Warren

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

arch/arm/cpu/arm720t/tegra30/cpu.c +6 -0
 
+/*
+ * Timing tables for each SOC for all four oscillator options.
+ */
+static struct clk_pll_table tegra_pll_x_table[TEGRA_SOC_COUNT]
+						[CLOCK_OSC_FREQ_COUNT] = {
+	/* T20: 1 GHz */

This is odd; it's a Tegra30-specific file, yet has data tables for Tegra20 too, and various code that only makes sense to differentiate Tegra20 and Tegra30 at runtime.

Either everything in this file should be Tegra30-specific, or whatever new code is being added here should be added to a file in tegra-common if it needs to handle both SoCs.

arch/arm/cpu/arm720t/tegra30/cpu.c line 92

Quoted 7 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +7 -0
+static int get_chip_type(void)
+{
+	/*
+	 * T30 has two options. We will return TEGRA_SOC_T30 until
+	 * we have the fdt set up when it may change to
+	 * TEGRA_SOC_T30_408MHZ depending on what we set PLLP to.
+	 */

I'm not sure what the FDT has to do with it? Certainly at this point in the series, I doubt that comment is accurate. Do we actually reprogram the PLLs based on FDT later?

arch/arm/cpu/arm720t/tegra30/cpu.c line 96

Quoted 4 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +4 -0
+	if (clock_get_rate(CLOCK_ID_PERIPH) == 408000000)
+		return TEGRA_SOC_T30_408MHZ;
+	else
+		return TEGRA_SOC_T30;

I thought we'd decided not to support one of those options, but perhaps it's used somewhere...

Quoted 7 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +7 -0
+static void adjust_pllp_out_freqs(void)
+{
+	struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
+	struct clk_pll *pll = &clkrst->crc_pll[CLOCK_ID_PERIPH];
+	u32 reg;
+
+	/* Set T30 PLLP_OUT1, 2, 3 & 4 freqs to 9.6, 48, 102 & 204MHz */

arch/arm/cpu/arm720t/tegra30/cpu.c line 136

Quoted 10 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +10 -0
+	reg = readl(&pll->pll_out[0]);     /* OUTA, contains OUT2 / OUT1 */
+	reg |= (IN_408_OUT_48_DIVISOR << PLLP_OUT2_RATIO) | PLLP_OUT2_OVR
+		| (IN_408_OUT_9_6_DIVISOR << PLLP_OUT1_RATIO) | PLLP_OUT1_OVR;
+	writel(reg, &pll->pll_out[0]);
+
+	reg = readl(&pll->pll_out[1]);   /* OUTB, contains OUT4 / OUT3 */
+	reg |= (IN_408_OUT_204_DIVISOR << PLLP_OUT4_RATIO) | PLLP_OUT4_OVR
+		| (IN_408_OUT_102_DIVISOR << PLLP_OUT3_RATIO) | PLLP_OUT3_OVR;
+	writel(reg, &pll->pll_out[1]);
+}

I don't think that code is ever used, since init_pllx() below is only ever called with slow==1, so never calls it.

Quoted 22 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +22 -0
+void tegra_i2c_ll_write_addr(uint addr, uint config)
+{
+	struct i2c_ctlr *reg = (struct i2c_ctlr *)TEGRA_DVC_BASE;
+
+	writel(addr, &reg->cmd_addr0);
+	writel(config, &reg->cnfg);
+}
+
+void tegra_i2c_ll_write_data(uint data, uint config)
+{
+	struct i2c_ctlr *reg = (struct i2c_ctlr *)TEGRA_DVC_BASE;
+
+	writel(data, &reg->cmd_data1);
+	writel(config, &reg->cnfg);
+}
+
+static void enable_cpu_power_rail(void)
+{
+	struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
+	u32 reg;
+
+	debug("enable_cpu_power_rail entry\n");

arch/arm/cpu/arm720t/tegra30/cpu.c line 339

Quoted 10 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +10 -0
+	reg = readl(&pmc->pmc_cntrl);
+	reg |= CPUPWRREQ_OE;
+	writel(reg, &pmc->pmc_cntrl);
+
+	/*
+	 * Pulse PWRREQ via I2C.  We need to find out what this is
+	 * doing, tidy up the code and maybe find a better place for it.
+	 */
+	tegra_i2c_ll_write_addr(0x005a, 0x0002);
+	tegra_i2c_ll_write_data(0x2328, 0x0a02);

With a TPS65911x attached to the DVC I2C bus, that sets VDD to 1.4V (I assume that's both the VDD1 and VDD2 outputs, but the PMIC datasheet isn't too clear on that at a quick glance), and:

arch/arm/cpu/arm720t/tegra30/cpu.c line 341

Quoted 2 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +2 -0
+	udelay(1000);
+	tegra_i2c_ll_write_data(0x0127, 0x0a02);

... and this enables the VDD regulator.

So, this is:
a) Entirely specific to a TPS65911x regulator. I think this warrants a very large FIXME comment.
b) Nothing to do with pulsing PWRREQ via I2C.
c) Really should be done via programming the EEPROM on the PMIC so that SW doesn't have to do this, but I guess that didn't happen.

arch/arm/cpu/arm720t/tegra30/cpu.c line 353

Quoted 9 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +9 -0
+static void reset_A9_cpu(int reset)
+{
+	/*
+	* NOTE:  Regardless of whether the request is to hold the CPU in reset
+	*        or take it out of reset, every processor in the CPU complex
+	*        except the master (CPU 0) will be held in reset because the
+	*        AVP only talks to the master. The AVP does not know that there
+	*        are multiple processors in the CPU complex.
+	*/

At least the last sentence there is false; this code is running on the AVP and there's explicit code above that determines the number of CPUs in the main CPU complex (get_num_cpus) and sets separate reset bits for each of them (enable_cpu_clock). Oh, and ~7 lines below, there's a loop over num_cpus:

Quoted 9 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +9 -0
+	int mask = crc_rst_cpu | crc_rst_de | crc_rst_debug;
+	int num_cpus = get_num_cpus();
+	int cpu;
+
+	debug("reset_a9_cpu entry\n");
+	/* Hold CPUs 1 onwards in reset, and CPU 0 if asked */
+	for (cpu = 1; cpu < num_cpus; cpu++)
+		reset_cmplx_set_enable(cpu, mask, 1);
+	reset_cmplx_set_enable(0, mask, reset);
author
#3 lore raw

PATCH 1/7 Tegra30: Add AVP (arm720t) files

Stephen,

Quoted 6 lines · Stephen Warren
Quoted 4 lines · Tom Warren

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

arch/arm/cpu/arm720t/tegra30/cpu.c +0 -0
Quoted 10 lines

arch/arm/cpu/arm720t/tegra30/cpu.c line 45

Quoted 6 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +6 -0
+/*
+ * Timing tables for each SOC for all four oscillator options.
+ */
+static struct clk_pll_table tegra_pll_x_table[TEGRA_SOC_COUNT]
+                                             [CLOCK_OSC_FREQ_COUNT] = {
+     /* T20: 1 GHz */

This is odd; it's a Tegra30-specific file, yet has data tables for Tegra20 too, and various code that only makes sense to differentiate Tegra20 and Tegra30 at runtime.

I'd meant to pull this out, or commonize the cpu.c files in arm720t, but forgot about it.

I'll move common code to arm720t/tegra/cpu.c and leave HW-specific stuff in tegra[23]0/cpu.c on the next rev.

Quoted 5 lines

Either everything in this file should be Tegra30-specific, or whatever new code is being added here should be added to a file in tegra-common if it needs to handle both SoCs.

Quoted 11 lines

arch/arm/cpu/arm720t/tegra30/cpu.c line 92

Quoted 7 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +7 -0
+static int get_chip_type(void)
+{
+     /*
+      * T30 has two options. We will return TEGRA_SOC_T30 until
+      * we have the fdt set up when it may change to
+      * TEGRA_SOC_T30_408MHZ depending on what we set PLLP to.
+      */

I'm not sure what the FDT has to do with it? Certainly at this point in the series, I doubt that comment is accurate. Do we actually reprogram the PLLs based on FDT later?

Most of this file was brought in during a merge with our internal T30 U-Boot repo, so most of these comments aren't from me, but from the folks that brought up T30 in-house. I chose to start at the slower PLLX rate (216?) for bringup, and planned to phase in 408MHz support later, once I was sure of a stable SW base.

Quoted 8 lines

arch/arm/cpu/arm720t/tegra30/cpu.c line 96

Quoted 5 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +4 -0
+     if (clock_get_rate(CLOCK_ID_PERIPH) == 408000000)
+             return TEGRA_SOC_T30_408MHZ;
+     else
+             return TEGRA_SOC_T30;

I thought we'd decided not to support one of those options, but perhaps it's used somewhere...

See above. Once 408MHz is ported/working, I can remove the slower clock rate entirely.

Quoted 13 lines
Quoted 13 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +12 -0
+static void adjust_pllp_out_freqs(void)
+{
+     struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
+     struct clk_pll *pll = &clkrst->crc_pll[CLOCK_ID_PERIPH];
+     u32 reg;
+
+     /* Set T30 PLLP_OUT1, 2, 3 & 4 freqs to 9.6, 48, 102 & 204MHz */
+     reg = readl(&pll->pll_out[0]);     /* OUTA, contains OUT2 / OUT1 */
+     reg |= (IN_408_OUT_48_DIVISOR << PLLP_OUT2_RATIO) | PLLP_OUT2_OVR
+             | (IN_408_OUT_9_6_DIVISOR << PLLP_OUT1_RATIO) | PLLP_OUT1_OVR;
+     writel(reg, &pll->pll_out[0]);
+
Quoted 8 lines

arch/arm/cpu/arm720t/tegra30/cpu.c line 136

Quoted 5 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +5 -0
+     reg = readl(&pll->pll_out[1]);   /* OUTB, contains OUT4 / OUT3 */
+     reg |= (IN_408_OUT_204_DIVISOR << PLLP_OUT4_RATIO) | PLLP_OUT4_OVR
+             | (IN_408_OUT_102_DIVISOR << PLLP_OUT3_RATIO) | PLLP_OUT3_OVR;
+     writel(reg, &pll->pll_out[1]);
+}

I don't think that code is ever used, since init_pllx() below is only ever called with slow==1, so never calls it.

Yeah, this'll be used later to get to 408MHz. I'd planned to use it but didn't get around to it. I can remove it in v2, or try for full speed (408MHz) instead. Depends on bandwidth & priorities.

Quoted 41 lines
Quoted 23 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +22 -0
+void tegra_i2c_ll_write_addr(uint addr, uint config)
+{
+     struct i2c_ctlr *reg = (struct i2c_ctlr *)TEGRA_DVC_BASE;
+
+     writel(addr, &reg->cmd_addr0);
+     writel(config, &reg->cnfg);
+}
+
+void tegra_i2c_ll_write_data(uint data, uint config)
+{
+     struct i2c_ctlr *reg = (struct i2c_ctlr *)TEGRA_DVC_BASE;
+
+     writel(data, &reg->cmd_data1);
+     writel(config, &reg->cnfg);
+}
+
+static void enable_cpu_power_rail(void)
+{
+     struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
+     u32 reg;
+
+     debug("enable_cpu_power_rail entry\n");

arch/arm/cpu/arm720t/tegra30/cpu.c line 339

Quoted 10 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +10 -0
+     reg = readl(&pmc->pmc_cntrl);
+     reg |= CPUPWRREQ_OE;
+     writel(reg, &pmc->pmc_cntrl);
+
+     /*
+      * Pulse PWRREQ via I2C.  We need to find out what this is
+      * doing, tidy up the code and maybe find a better place for it.
+      */
+     tegra_i2c_ll_write_addr(0x005a, 0x0002);
+     tegra_i2c_ll_write_data(0x2328, 0x0a02);

With a TPS65911x attached to the DVC I2C bus, that sets VDD to 1.4V (I assume that's both the VDD1 and VDD2 outputs, but the PMIC datasheet isn't too clear on that at a quick glance), and:

arch/arm/cpu/arm720t/tegra30/cpu.c line 341

Quoted 2 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +2 -0
+     udelay(1000);
+     tegra_i2c_ll_write_data(0x0127, 0x0a02);
Quoted 8 lines

... and this enables the VDD regulator.

So, this is:
a) Entirely specific to a TPS65911x regulator. I think this warrants a very large FIXME comment.
b) Nothing to do with pulsing PWRREQ via I2C.
c) Really should be done via programming the EEPROM on the PMIC so that SW doesn't have to do this, but I guess that didn't happen.

Again, this comes from our internal repo & wasn't done by me, so I had no knowledge of what exactly it was doing. But removing it resulted in a hung system, so I had to leave it in. Your comments are helpful - I'll revise this in v2 with new comments and better reg/data defines, etc.

Quoted 16 lines

arch/arm/cpu/arm720t/tegra30/cpu.c line 353

Quoted 10 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +9 -0
+static void reset_A9_cpu(int reset)
+{
+     /*
+     * NOTE:  Regardless of whether the request is to hold the CPU in reset
+     *        or take it out of reset, every processor in the CPU complex
+     *        except the master (CPU 0) will be held in reset because the
+     *        AVP only talks to the master. The AVP does not know that there
+     *        are multiple processors in the CPU complex.
+     */

At least the last sentence there is false; this code is running on the AVP and there's explicit code above that determines the number of CPUs in the main CPU complex (get_num_cpus) and sets separate reset bits for each of them (enable_cpu_clock). Oh, and ~7 lines below, there's a loop over num_cpus:

Again, a comment from a previous dev, not me. I think they're just saying that the AVP is only working on 1 CPU, and doesn't do full init of the other ones, since they're aren't needed for U-Boot to find/fetch a kernel, etc.

Quoted 10 lines

arch/arm/cpu/arm720t/tegra30/cpu.c line 362

Quoted 10 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +9 -0
+     int mask = crc_rst_cpu | crc_rst_de | crc_rst_debug;
+     int num_cpus = get_num_cpus();
+     int cpu;
+
+     debug("reset_a9_cpu entry\n");
+     /* Hold CPUs 1 onwards in reset, and CPU 0 if asked */
+     for (cpu = 1; cpu < num_cpus; cpu++)
+             reset_cmplx_set_enable(cpu, mask, 1);
+     reset_cmplx_set_enable(0, mask, reset);

Thanks for the thorough review,

Tom

#4 lore raw

PATCH 1/7 Tegra30: Add AVP (arm720t) files

In reply to Stephen Warren

Hi Stephen,

Quoted 6 lines · Stephen Warren
Quoted 4 lines · Tom Warren

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

arch/arm/cpu/arm720t/tegra30/cpu.c +0 -0
Quoted 11 lines

arch/arm/cpu/arm720t/tegra30/cpu.c line 92

Quoted 7 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +7 -0
+static int get_chip_type(void)
+{
+     /*
+      * T30 has two options. We will return TEGRA_SOC_T30 until
+      * we have the fdt set up when it may change to
+      * TEGRA_SOC_T30_408MHZ depending on what we set PLLP to.
+      */

I'm not sure what the FDT has to do with it? Certainly at this point in the series, I doubt that comment is accurate. Do we actually reprogram the PLLs based on FDT later?

Yes, and that changes the SOC here. It's a bit odd but the AVP couldn't know what speed we wanted so we updated it later when the Cortex-A9 was running.

Quoted 8 lines

arch/arm/cpu/arm720t/tegra30/cpu.c line 96

Quoted 5 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +4 -0
+     if (clock_get_rate(CLOCK_ID_PERIPH) == 408000000)
+             return TEGRA_SOC_T30_408MHZ;
+     else
+             return TEGRA_SOC_T30;

I thought we'd decided not to support one of those options, but perhaps it's used somewhere...

Yes, in fact we started using 408MHz exclusively. Not sure if that is possible upstream - unless anyone knows for sure I suggest we leave it as is and remove it later if no one needs it.

Quoted 13 lines
Quoted 13 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +12 -0
+static void adjust_pllp_out_freqs(void)
+{
+     struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
+     struct clk_pll *pll = &clkrst->crc_pll[CLOCK_ID_PERIPH];
+     u32 reg;
+
+     /* Set T30 PLLP_OUT1, 2, 3 & 4 freqs to 9.6, 48, 102 & 204MHz */
+     reg = readl(&pll->pll_out[0]);     /* OUTA, contains OUT2 / OUT1 */
+     reg |= (IN_408_OUT_48_DIVISOR << PLLP_OUT2_RATIO) | PLLP_OUT2_OVR
+             | (IN_408_OUT_9_6_DIVISOR << PLLP_OUT1_RATIO) | PLLP_OUT1_OVR;
+     writel(reg, &pll->pll_out[0]);
+
Quoted 8 lines

arch/arm/cpu/arm720t/tegra30/cpu.c line 136

Quoted 5 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +5 -0
+     reg = readl(&pll->pll_out[1]);   /* OUTB, contains OUT4 / OUT3 */
+     reg |= (IN_408_OUT_204_DIVISOR << PLLP_OUT4_RATIO) | PLLP_OUT4_OVR
+             | (IN_408_OUT_102_DIVISOR << PLLP_OUT3_RATIO) | PLLP_OUT3_OVR;
+     writel(reg, &pll->pll_out[1]);
+}

I don't think that code is ever used, since init_pllx() below is only ever called with slow==1, so never calls it.

This probably came from this function that we had in arch/arm/cpu/armv7/tegra-common/board.c:

void arch_full_speed(void)

{
	ap20_init_pllx(0);
	debug("CPU at %d\n", clock_get_rate(CLOCK_ID_XCPU));
	debug("Memory at %d\n", clock_get_rate(CLOCK_ID_MEMORY));
	debug("Periph at %d\n", clock_get_rate(CLOCK_ID_PERIPH));
}

It was called from board/nvidia/common/board.

If you like, take a look at the chromeos-v2011.06 branch of U-Boot for anything about this.

Quoted 16 lines
Quoted 6 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +5 -0
+void tegra_i2c_ll_write_addr(uint addr, uint config)
+{
+     struct i2c_ctlr *reg = (struct i2c_ctlr *)TEGRA_DVC_BASE;
+
+     writel(addr, &reg->cmd_addr0);

arch/arm/cpu/arm720t/tegra30/cpu.c line 322

Quoted 10 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +10 -0
+     writel(config, &reg->cnfg);
+}
+
+void tegra_i2c_ll_write_data(uint data, uint config)
+{
+     struct i2c_ctlr *reg = (struct i2c_ctlr *)TEGRA_DVC_BASE;
+
+     writel(data, &reg->cmd_data1);
+     writel(config, &reg->cnfg);
+}

Well this is a lot better than the ugliness I had. I don't think you can put this into the i2c driver since the AVP doesn't have it, right?

Quoted 59 lines
Quoted 7 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +7 -0
+
+static void enable_cpu_power_rail(void)
+{
+     struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
+     u32 reg;
+
+     debug("enable_cpu_power_rail entry\n");

arch/arm/cpu/arm720t/tegra30/cpu.c line 339

Quoted 10 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +10 -0
+     reg = readl(&pmc->pmc_cntrl);
+     reg |= CPUPWRREQ_OE;
+     writel(reg, &pmc->pmc_cntrl);
+
+     /*
+      * Pulse PWRREQ via I2C.  We need to find out what this is
+      * doing, tidy up the code and maybe find a better place for it.
+      */
+     tegra_i2c_ll_write_addr(0x005a, 0x0002);
+     tegra_i2c_ll_write_data(0x2328, 0x0a02);

With a TPS65911x attached to the DVC I2C bus, that sets VDD to 1.4V (I assume that's both the VDD1 and VDD2 outputs, but the PMIC datasheet isn't too clear on that at a quick glance), and:

arch/arm/cpu/arm720t/tegra30/cpu.c line 341

Quoted 2 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +2 -0
+     udelay(1000);
+     tegra_i2c_ll_write_data(0x0127, 0x0a02);

... and this enables the VDD regulator.

So, this is:
a) Entirely specific to a TPS65911x regulator. I think this warrants a very large FIXME comment.
b) Nothing to do with pulsing PWRREQ via I2C.
c) Really should be done via programming the EEPROM on the PMIC so that SW doesn't have to do this, but I guess that didn't happen.

arch/arm/cpu/arm720t/tegra30/cpu.c line 353

Quoted 9 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +9 -0
+static void reset_A9_cpu(int reset)
+{
+     /*
+     * NOTE:  Regardless of whether the request is to hold the CPU in reset
+     *        or take it out of reset, every processor in the CPU complex
+     *        except the master (CPU 0) will be held in reset because the
+     *        AVP only talks to the master. The AVP does not know that there
+     *        are multiple processors in the CPU complex.
+     */

At least the last sentence there is false; this code is running on the AVP and there's explicit code above that determines the number of CPUs in the main CPU complex (get_num_cpus) and sets separate reset bits for each of them (enable_cpu_clock). Oh, and ~7 lines below, there's a loop over num_cpus:

arch/arm/cpu/arm720t/tegra30/cpu.c line 362

Quoted 9 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +9 -0
+     int mask = crc_rst_cpu | crc_rst_de | crc_rst_debug;
+     int num_cpus = get_num_cpus();
+     int cpu;
+
+     debug("reset_a9_cpu entry\n");
+     /* Hold CPUs 1 onwards in reset, and CPU 0 if asked */
+     for (cpu = 1; cpu < num_cpus; cpu++)
+             reset_cmplx_set_enable(cpu, mask, 1);
+     reset_cmplx_set_enable(0, mask, reset);
Quoted 4 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Regards,
Simon

#5 lore raw

PATCH 1/7 Tegra30: Add AVP (arm720t) files

In reply to Tom Warren

Hi Tom,

Quoted 4 lines · Tom Warren

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

Quoted 10 lines
---
 arch/arm/cpu/arm720t/tegra-common/cpu.h            |   48 +--
 arch/arm/cpu/arm720t/tegra-common/spl.c            |    3 +-
 .../arm/cpu/arm720t/tegra30}/Makefile              |   20 +-
 arch/arm/cpu/arm720t/tegra30/config.mk             |   19 +
 arch/arm/cpu/arm720t/tegra30/cpu.c                 |  516 ++++++++++++++++++++
 5 files changed, 554 insertions(+), 52 deletions(-)
 copy {board/compal/paz00 => arch/arm/cpu/arm720t/tegra30}/Makefile (68%)
 create mode 100644 arch/arm/cpu/arm720t/tegra30/config.mk
 create mode 100644 arch/arm/cpu/arm720t/tegra30/cpu.c

I just have a few additional comments.

Quoted 85 lines
arch/arm/cpu/arm720t/tegra-common/cpu.h +0 -0
index 6804cd7..0d9a3c2 100644
arch/arm/cpu/arm720t/tegra30/cpu.c new file +74 -0
new file mode 100644
index 0000000..e0821ef
@@ -0,0 +1,516 @@
+/*
+ * Copyright (c) 2010-2012, 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,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/flow.h>
+#include <asm/arch/pinmux.h>
+#include <asm/arch/tegra.h>
+#include <asm/arch-tegra/clk_rst.h>
+#include <asm/arch-tegra/fuse.h>
+#include <asm/arch-tegra/pmc.h>
+#include <asm/arch-tegra/scu.h>
+#include <asm/arch-tegra/tegra_i2c.h>
+#include "../tegra-common/cpu.h"
+
+struct clk_pll_table {
+       u16             n;
+       u16             m;
+       u8              p;
+       u8              cpcon;
+};
+
+/* ~0=uninitialized/unknown, 0=false, 1=true */
+uint32_t is_tegra_processor_reset = 0xffffffff;
+
+/*
+ * Timing tables for each SOC for all four oscillator options.
+ */
+static struct clk_pll_table tegra_pll_x_table[TEGRA_SOC_COUNT]
+                                               [CLOCK_OSC_FREQ_COUNT] = {
+       /* T20: 1 GHz */
+       {{ 1000, 13, 0, 12},    /* OSC 13M */
+        { 625,  12, 0, 8},     /* OSC 19.2M */
+        { 1000, 12, 0, 12},    /* OSC 12M */
+        { 1000, 26, 0, 12},    /* OSC 26M */
+       },
+
+       /* T25: 1.2 GHz */
+       {{ 923, 10, 0, 12},
+        { 750, 12, 0, 8},
+        { 600,  6, 0, 12},
+        { 600, 13, 0, 12},
+       },
+
+       /* T30(slow): 1.0 GHz */
+       {{ 1000,  13, 0, 8},
+        { 625,  12, 0, 4},
+        { 1000, 12, 0, 8},
+        { 1000,  26, 0, 8},
+       },
+
+       /* T30(high): 1.4 GHz */
+       {{ 862, 8, 0, 8},
+        { 583, 8, 0, 4},
+        { 700, 6, 0, 8},
+        { 700, 13, 0, 8},
+       },
+
+       /* TEGRA_SOC2_SLOW: 312 MHz */
+       {{ 312, 13, 0, 12},     /* OSC 13M */

arch/arm/cpu/arm720t/tegra30/cpu.c line 84

Quoted 10 lines
arch/arm/cpu/arm720t/tegra30/cpu.c new file +10 -0
+        { 260, 16, 0, 8},      /* OSC 19.2M */
+        { 312, 12, 0, 12},     /* OSC 12M */
+        { 312, 26, 0, 12},     /* OSC 26M */
+       },
+};
+
+enum tegra_family_t {
+       TEGRA_FAMILY_T2x,
+       TEGRA_FAMILY_T3x,
+};

This is fine here since the function that uses it is static. I wonder if we want to export that function one day?

Quoted 55 lines
arch/arm/cpu/arm720t/tegra30/cpu.c new file +55 -0
+
+static int get_chip_type(void)
+{
+       /*
+        * T30 has two options. We will return TEGRA_SOC_T30 until
+        * we have the fdt set up when it may change to
+        * TEGRA_SOC_T30_408MHZ depending on what we set PLLP to.
+        */
+       if (clock_get_rate(CLOCK_ID_PERIPH) == 408000000)
+               return TEGRA_SOC_T30_408MHZ;
+       else
+               return TEGRA_SOC_T30;
+}
+
+static enum tegra_family_t get_family(void)
+{
+       u32 reg, chip_id;
+
+       debug("tegra_get_family entry\n");
+       reg = readl(NV_PA_APB_MISC_BASE + GP_HIDREV);
+
+       chip_id = reg >> 8;
+       chip_id &= 0xff;
+       debug("  tegra_get_family: chip_id = %x\n", chip_id);
+       if (chip_id == 0x30)
+               return TEGRA_FAMILY_T3x;
+       else
+               return TEGRA_FAMILY_T2x;
+}
+
+int get_num_cpus(void)
+{
+       return get_family() == TEGRA_FAMILY_T3x ? 4 : 2;
+}
+
+static void adjust_pllp_out_freqs(void)
+{
+       struct clk_rst_ctlr *clkrst = (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
+       struct clk_pll *pll = &clkrst->crc_pll[CLOCK_ID_PERIPH];
+       u32 reg;
+
+       /* Set T30 PLLP_OUT1, 2, 3 & 4 freqs to 9.6, 48, 102 & 204MHz */
+       reg = readl(&pll->pll_out[0]);     /* OUTA, contains OUT2 / OUT1 */
+       reg |= (IN_408_OUT_48_DIVISOR << PLLP_OUT2_RATIO) | PLLP_OUT2_OVR
+               | (IN_408_OUT_9_6_DIVISOR << PLLP_OUT1_RATIO) | PLLP_OUT1_OVR;
+       writel(reg, &pll->pll_out[0]);
+
+       reg = readl(&pll->pll_out[1]);   /* OUTB, contains OUT4 / OUT3 */
+       reg |= (IN_408_OUT_204_DIVISOR << PLLP_OUT4_RATIO) | PLLP_OUT4_OVR
+               | (IN_408_OUT_102_DIVISOR << PLLP_OUT3_RATIO) | PLLP_OUT3_OVR;
+       writel(reg, &pll->pll_out[1]);
+}
+
+static int pllx_set_rate(struct clk_pll_simple *pll , u32 divn, u32 divm,
+               u32 divp, u32 cpcon)
author
#6 lore raw

PATCH 2/7 Tegra30: Add CPU (armv7) files

In reply to Tom Warren

These files are for code that runs on the CPU (A9) on T30 boards. At this time, it's only the RCM (Recovery Mode) cmd file, which is in tegra-common. As T30-specific run-time code is added, it'll go here.

---
 arch/arm/cpu/{arm720t => armv7}/tegra30/Makefile  |   13 ++++++-------
 arch/arm/cpu/{arm720t => armv7}/tegra30/config.mk |    2 +-
 2 files changed, 7 insertions(+), 8 deletions(-)
 copy arch/arm/cpu/{arm720t => armv7}/tegra30/Makefile (86%)
 copy arch/arm/cpu/{arm720t => armv7}/tegra30/config.mk (95%)
arch/arm/cpu/armv7/tegra30/Makefile renamed from arch/arm/cpu/arm720t/tegra30/Makefile +6 -7
similarity index 86%
copy from arch/arm/cpu/arm720t/tegra30/Makefile
copy to arch/arm/cpu/armv7/tegra30/Makefile
index bd96997..b04732d 100644
@@ -1,7 +1,7 @@
 #
 # Copyright (c) 2010-2012, NVIDIA CORPORATION.  All rights reserved.
 #
-# (C) Copyright 2000-2008
+# (C) Copyright 2000-2003
 # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 #
 # This program is free software; you can redistribute it and/or modify it
@@ -19,14 +19,13 @@
 
 include $(TOPDIR)/config.mk
 
-LIB	= $(obj)lib$(SOC).o
+LIB	=  $(obj)lib$(SOC).o
 
-COBJS-y	+= cpu.o
+COBJS	:= $(COBJS-y)
+SRCS	:= $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
 
-SRCS	:= $(COBJS-y:.o=.c)
-OBJS	:= $(addprefix $(obj),$(COBJS-y))
-
-all:	$(obj).depend $(LIB)
+all:	 $(obj).depend $(LIB)
 
 $(LIB):	$(OBJS)
 	$(call cmd_link_o_target, $(OBJS))
arch/arm/cpu/armv7/tegra30/config.mk renamed from arch/arm/cpu/arm720t/tegra30/config.mk +1 -1
similarity index 95%
copy from arch/arm/cpu/arm720t/tegra30/config.mk
copy to arch/arm/cpu/armv7/tegra30/config.mk
index 2388c56..719ca81 100644
@@ -16,4 +16,4 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
-USE_PRIVATE_LIBGCC = yes
+CONFIG_ARCH_DEVICE_TREE := tegra30
Signature · 1 line
1.7.0.4
#7 lore raw

PATCH 2/7 Tegra30: Add CPU (armv7) files

arch/arm/cpu/armv7/tegra30/Makefile line 22

Quoted 9 lines · Tom Warren

These files are for code that runs on the CPU (A9) on T30 boards. At this time, it's only the RCM (Recovery Mode) cmd file, which is in tegra-common. As T30-specific run-time code is added, it'll go here.

arch/arm/cpu/armv7/tegra30/Makefile renamed from arch/arm/cpu/arm720t/tegra30/Makefile +1 -1
 
-LIB	= $(obj)lib$(SOC).o
+LIB	=  $(obj)lib$(SOC).o

Looks like there are two spaces after the = there.

arch/arm/cpu/armv7/tegra30/Makefile line 28

Quoted 2 lines
arch/arm/cpu/armv7/tegra30/Makefile renamed from arch/arm/cpu/arm720t/tegra30/Makefile +1 -1
-all:	$(obj).depend $(LIB)
+all:	 $(obj).depend $(LIB)

And a space after the TAB there.

Does U-Boot compile at this point in the series? Hopefully "git bisect" is maintained across the series. I suppose there aren't any boards.cfg entries for Tegra30 yet, so the fact that e.g. CONFIG_ARCH_DEVICE_TREE points at a file that doesn't yet exist is impossible to notice.

author
#8 lore raw

PATCH 2/7 Tegra30: Add CPU (armv7) files

Stephen,

Quoted 13 lines · Stephen Warren

arch/arm/cpu/armv7/tegra30/Makefile line 22

Quoted 9 lines · Tom Warren

These files are for code that runs on the CPU (A9) on T30 boards. At this time, it's only the RCM (Recovery Mode) cmd file, which is in tegra-common. As T30-specific run-time code is added, it'll go here.

arch/arm/cpu/armv7/tegra30/Makefile renamed from arch/arm/cpu/arm720t/tegra30/Makefile +1 -1
 
-LIB  = $(obj)lib$(SOC).o
+LIB  =  $(obj)lib$(SOC).o

Looks like there are two spaces after the = there.

Quoted 4 lines

arch/arm/cpu/armv7/tegra30/Makefile line 28

Quoted 2 lines
arch/arm/cpu/armv7/tegra30/Makefile renamed from arch/arm/cpu/arm720t/tegra30/Makefile +1 -1
-all: $(obj).depend $(LIB)
+all:  $(obj).depend $(LIB)

And a space after the TAB there.

Right on both counts. Despite what git format-patch said about the origin of this file, it was really copied over from armv7/tegra20/Makefile, and the spacing errors are in that file originally. Guess checkpatch doesn't look at Makefiles.

I'll correct this on the next rev. Thanks.

Quoted 5 lines

Does U-Boot compile at this point in the series? Hopefully "git bisect" is maintained across the series. I suppose there aren't any boards.cfg entries for Tegra30 yet, so the fact that e.g. CONFIG_ARCH_DEVICE_TREE points at a file that doesn't yet exist is impossible to notice.

I haven't done a git bisect on the series, but I did do individual git am's on each patch with ./MAKEALL -s tegra20 between each, and saw no problems when I did the first port. I did go in and rebase/amend a few commits, though, during a final clean-up effort, so I may have broken bisect. I'll be sure to test each patch/bisect on the next rev.

Thanks,

Tom

author
#9 lore raw

PATCH 3/7 Tegra30: Add common CPU (shared) files

In reply to Tom Warren

These files are used by both SPL and main U-Boot. Also made minor changes to shared Tegra code to support T30 differences.

---
 arch/arm/cpu/tegra-common/ap.c                     |   22 +-
 arch/arm/cpu/tegra-common/board.c                  |   25 +-
 arch/arm/cpu/tegra-common/sys_info.c               |    5 +-
 arch/arm/cpu/tegra20-common/warmboot.c             |    2 +-
 .../{arm720t/tegra30 => tegra30-common}/Makefile   |   11 +-
 .../cpu/{tegra20-common => tegra30-common}/clock.c |  508 +++++++++-----------
 arch/arm/cpu/tegra30-common/funcmux.c              |   57 +++
 arch/arm/cpu/tegra30-common/pinmux.c               |  501 +++++++++++++++++++
 arch/arm/include/asm/arch-tegra/ap.h               |   50 +--
 9 files changed, 851 insertions(+), 330 deletions(-)
 copy arch/arm/cpu/{arm720t/tegra30 => tegra30-common}/Makefile (80%)
 copy arch/arm/cpu/{tegra20-common => tegra30-common}/clock.c (75%)
 create mode 100644 arch/arm/cpu/tegra30-common/funcmux.c
 create mode 100644 arch/arm/cpu/tegra30-common/pinmux.c
arch/arm/cpu/tegra-common/ap.c +20 -2
index c4eb137..e1a400c 100644
@@ -20,10 +20,14 @@
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 */
+
+/* Tegra AP (Application Processor) code */
+
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/gp_padctrl.h>
 #include <asm/arch-tegra/ap.h>
+#include <asm/arch-tegra/clock.h>
 #include <asm/arch-tegra/fuse.h>
 #include <asm/arch-tegra/pmc.h>
 #include <asm/arch-tegra/scu.h>
@@ -58,6 +62,20 @@ int tegra_get_chip_type(void)
 			return TEGRA_SOC_T25;
 		}
 		break;
+	case CHIPID_TEGRA30:
+		switch (tegra_sku_id) {
+		case SKU_ID_T30:
+			/*
+			 * T30 has two options. We will return TEGRA_SOC_T30
+			 * until we have the fdt set up when it may change to
+			 * TEGRA_SOC_T30_408MHZ depending on the PLLP freq.
+			 */
+			if (clock_get_rate(CLOCK_ID_PERIPH) == 408000000)
+				return TEGRA_SOC_T30_408MHZ;
+			else
+				return TEGRA_SOC_T30;
+		}
+		break;
 	}
 	/* unknown sku id */
 	return TEGRA_SOC_UNKNOWN;
@@ -93,7 +111,7 @@ static u32 get_odmdata(void)
 
 	u32 bct_start, odmdata;
 
-	bct_start = readl(AP20_BASE_PA_SRAM + NVBOOTINFOTABLE_BCTPTR);
+	bct_start = readl(NV_PA_BASE_SRAM + NVBOOTINFOTABLE_BCTPTR);
 	odmdata = readl(bct_start + BCT_ODMDATA_OFFSET);
 
 	return odmdata;
@@ -127,5 +145,5 @@ void s_init(void)
 		"orr	r0, r0, #0x41\n"
 		"mcr	p15, 0, r0, c1, c0, 1\n");
 
-	/* FIXME: should have ap20's L2 disabled too? */
+	/* FIXME: should have SoC's L2 disabled too? */
 }
arch/arm/cpu/tegra-common/board.c +18 -7
index b2e10c6..1214bc0 100644
@@ -59,9 +59,12 @@ unsigned int query_sdram_size(void)
 	case 1:
 		return 0x10000000;	/* 256 MB */
 	case 2:
-	default:
 		return 0x20000000;	/* 512 MB */
-	case 3:
+	case 4:
+		return 0x40000000;	/* 1GB */
+	case 8:
+		return 0x7ff00000;	/* 2GB - 1MB */
+	default:
 		return 0x40000000;	/* 1GB */
 	}
 }
@@ -82,19 +85,27 @@ int checkboard(void)
 #endif	/* CONFIG_DISPLAY_BOARDINFO */
 
 static int uart_configs[] = {
-#if defined(CONFIG_TEGRA_UARTA_UAA_UAB)
+#if defined(CONFIG_TEGRA20)
+ #if defined(CONFIG_TEGRA_UARTA_UAA_UAB)
 	FUNCMUX_UART1_UAA_UAB,
-#elif defined(CONFIG_TEGRA_UARTA_GPU)
+ #elif defined(CONFIG_TEGRA_UARTA_GPU)
 	FUNCMUX_UART1_GPU,
-#elif defined(CONFIG_TEGRA_UARTA_SDIO1)
+ #elif defined(CONFIG_TEGRA_UARTA_SDIO1)
 	FUNCMUX_UART1_SDIO1,
-#else
+ #else
 	FUNCMUX_UART1_IRRX_IRTX,
-#endif
+ #endif
 	FUNCMUX_UART2_IRDA,
 	-1,
 	FUNCMUX_UART4_GMC,
 	-1,
+#else	/* Tegra30 */
+	FUNCMUX_UART1_ULPI,	/* UARTA */
+	-1,
+	-1,
+	-1,
+	-1,
+#endif
 };
 
 /**
arch/arm/cpu/tegra-common/sys_info.c +4 -1
index 1a0bb56..60d1de5 100644
@@ -27,8 +27,11 @@
 /* Print CPU information */
 int print_cpuinfo(void)
 {
+#if defined(CONFIG_TEGRA20)
 	puts("TEGRA20\n");
-
+#else	/* Tegra30 */
+	puts("TEGRA30\n");
+#endif
 	/* TBD: Add printf of major/minor rev info, stepping, etc. */
 	return 0;
 }
arch/arm/cpu/tegra20-common/warmboot.c +1 -1
index 157b9ab..0d472cf 100644
@@ -46,7 +46,7 @@ DECLARE_GLOBAL_DATA_PTR;
  * This is the place in SRAM where the SDRAM parameters are stored. There
  * are 4 blocks, one for each RAM code
  */
-#define SDRAM_PARAMS_BASE	(AP20_BASE_PA_SRAM + 0x188)
+#define SDRAM_PARAMS_BASE	(NV_PA_BASE_SRAM + 0x188)
 
 /* TODO: If we later add support for the Misc GP controller, refactor this */
 union xm2cfga_reg {
arch/arm/cpu/tegra30-common/Makefile renamed from arch/arm/cpu/arm720t/tegra30/Makefile +7 -4
similarity index 80%
copy from arch/arm/cpu/arm720t/tegra30/Makefile
copy to arch/arm/cpu/tegra30-common/Makefile
index bd96997..75fef32 100644
@@ -19,12 +19,15 @@
 
 include $(TOPDIR)/config.mk
 
-LIB	= $(obj)lib$(SOC).o
+# The AVP is ARMv4T architecture so we must use special compiler
+# flags for any startup files it might use.
 
-COBJS-y	+= cpu.o
+LIB	= $(obj)lib$(SOC)-common.o
 
-SRCS	:= $(COBJS-y:.o=.c)
-OBJS	:= $(addprefix $(obj),$(COBJS-y))
+COBJS-y	+= clock.o funcmux.o pinmux.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
 
 all:	$(obj).depend $(LIB)
 
arch/arm/cpu/tegra30-common/clock.c renamed from arch/arm/cpu/tegra20-common/clock.c +237 -271

729 lines not on this page · raw message

arch/arm/cpu/tegra30-common/funcmux.c new file +57 -0

57 lines not on this page · raw message

arch/arm/cpu/tegra30-common/pinmux.c new file +501 -0

501 lines not on this page · raw message

arch/arm/include/asm/arch-tegra/ap.h +6 -44

70 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#10 lore raw

PATCH 3/7 Tegra30: Add common CPU (shared) files

Quoted 12 lines · Tom Warren

These files are used by both SPL and main U-Boot. Also made minor changes to shared Tegra code to support T30 differences.

arch/arm/cpu/tegra-common/ap.c +2 -0
@@ -58,6 +62,20 @@ int tegra_get_chip_type(void)
 			return TEGRA_SOC_T25;
 		}
 		break;
+	case CHIPID_TEGRA30:
+		switch (tegra_sku_id) {

arch/arm/cpu/tegra-common/ap.c int tegra_get_chip_type(void) · line 76

Quoted 10 lines
arch/arm/cpu/tegra-common/ap.c +10 -0
+		case SKU_ID_T30:
+			/*
+			 * T30 has two options. We will return TEGRA_SOC_T30
+			 * until we have the fdt set up when it may change to
+			 * TEGRA_SOC_T30_408MHZ depending on the PLLP freq.
+			 */
+			if (clock_get_rate(CLOCK_ID_PERIPH) == 408000000)
+				return TEGRA_SOC_T30_408MHZ;
+			else
+				return TEGRA_SOC_T30;

Hmmm. I wonder why this doesn't return just the actual chip type; isn't the different in PLL_P rates a SW option and not a facet of the HW? The whole TEGRA_SOC_T30_408MHZ thing seems strange to me.

Quoted 7 lines
arch/arm/cpu/tegra-common/board.c +0 -1
@@ -59,9 +59,12 @@ unsigned int query_sdram_size(void)
 	case 1:
 		return 0x10000000;	/* 256 MB */
 	case 2:
-	default:

arch/arm/cpu/tegra-common/board.c unsigned int query_sdram_size(void) · line 70

Quoted 10 lines
arch/arm/cpu/tegra-common/board.c +5 -1
 		return 0x20000000;	/* 512 MB */
-	case 3:
+	case 4:
+		return 0x40000000;	/* 1GB */
+	case 8:
+		return 0x7ff00000;	/* 2GB - 1MB */
+	default:
 		return 0x40000000;	/* 1GB */
 	}
 }

I think we should be a little more explicit about the Tegra20/Tegra30 differences here. At least for case 0, there's a difference in what this field means for the two chips.

Value Tegra20 Tegra30
0 512 256
1 256 256
2 512 512
3 1024 768
4 undef 1024
5 undef undef
6 undef undef
7 undef undef
8 n/a 2048-1

At least the Toshiba AC100 uses value "0" in this field and has 512MB not 1GB of RAM.

I also note that for Tegra30, this field is bits 31:28, whereas for Tegra20 it's bits 30:28; we aren't masking off the top bit as we should in the current code. Again, the Toshiba AC100 appears to set this extra top bit, and only succeeds in getting 512M as the result of this function because of the default case.

arch/arm/cpu/tegra30-common/pinmux.c

Quoted 1 line
arch/arm/cpu/tegra30-common/pinmux.c +0 -0

Hmmm. The header file this relies on doesn't exist yet. But perhaps this is OK since there's no boards.cfg entry for Tegra30 yet.

arch/arm/cpu/tegra30-common/pinmux.c line 62

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+const struct tegra_pingroup_desc tegra_soc_pingroups[PINGRP_COUNT] = {
+	/*  NAME	VDD	f0	f1	f2	f3	fSafe	io */

"fSafe io" should be deleted; those columns don't exist in the table.

I compared this table to that in the upstream kernel, which I spent a lot of time on correlating with the various documentation sources and our downstream kernel. Some changes should be made:

arch/arm/cpu/tegra30-common/pinmux.c line 78

Quoted 4 lines
arch/arm/cpu/tegra30-common/pinmux.c +4 -0
+	PINI(DAP3_FS,	  BB,	   I2S2,	RSVD1,	   DISPA,   DISPB),
+	PINI(DAP3_DIN,	  BB,	   I2S2,	RSVD1,	   DISPA,   DISPB),
+	PINI(DAP3_DOUT,	  BB,	   I2S2,	RSVD1,	   DISPA,   DISPB),
+	PINI(DAP3_SCLK,	  BB,	   I2S2,	RSVD1,	   DISPA,   DISPB),

In the kernel at least, the RSVD values are only used in particular slots, i.e. RSVD1 always yields function 0, RSVD2==func1, RSVD3==func2, RSVD4==func3. That way, when representing the "safe" value, one can use RSVDn to guarantee to get func(n-1). I suspect, it'd be a good idea for U-Boot to adopt the same policy. So, s/RSVD1/RSVD2/ above, and make similar changes throughout this table.

arch/arm/cpu/tegra30-common/pinmux.c line 80

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+	PINI(GPIO_PV0,	  BB,	   RSVD,	RSVD,	   RSVD,    RSVD),
+	PINI(GPIO_PV1,	  BB,	   RSVD,	RSVD,	   RSVD,    RSVD),

And likewise, plain "RSVD" doesn't exist. If you duplicate RSVD into each column of the table, there's no way to know which function pinmux_set_func(foo, RSVD) might pick, since it matches them all.

arch/arm/cpu/tegra30-common/pinmux.c line 86

Quoted 6 lines
arch/arm/cpu/tegra30-common/pinmux.c +6 -0
+	PINI(SDMMC1_CLK,  SDMMC1,  SDMMC1,	RSVD1,	   RSVD2,   BAD),
+	PINI(SDMMC1_CMD,  SDMMC1,  SDMMC1,	RSVD1,	   RSVD2,   BAD),
+	PINI(SDMMC1_DAT3, SDMMC1,  SDMMC1,	RSVD1,	   UARTE,   BAD),
+	PINI(SDMMC1_DAT2, SDMMC1,  SDMMC1,	RSVD1,	   UARTE,   BAD),
+	PINI(SDMMC1_DAT1, SDMMC1,  SDMMC1,	RSVD1,	   UARTE,   BAD),
+	PINI(SDMMC1_DAT0, SDMMC1,  SDMMC1,	RSVD1,	   UARTE,   BAD),

I believe the final column for all those entries should be UARTA.

arch/arm/cpu/tegra30-common/pinmux.c line 88

Quoted 1 line
arch/arm/cpu/tegra30-common/pinmux.c +1 -0
+	PINI(GPIO_PV3,	  SDMMC1,  BAD,		RSVD1,	   RSVD2,   RSVD3),

BAD should be CLK_12M_OUT.

arch/arm/cpu/tegra30-common/pinmux.c line 99

Quoted 5 lines
arch/arm/cpu/tegra30-common/pinmux.c +5 -0
+	PINO(LCD_PWR2,	  LCD,	   DISPA,	DISPB,	  SPI5,     BAD),
+	PINO(LCD_SDOUT,	  LCD,	   DISPA,	DISPB,	  SPI5,     BAD),
+	PINO(LCD_WR_N,	  LCD,	   DISPA,	DISPB,	  SPI5,     BAD),
+	PINO(LCD_SCK,	  LCD,	   DISPA,	DISPB,	  SPI5,     BAD),
+	PINO(LCD_PWR0,	  LCD,	   DISPA,	DISPB,	  SPI5,     BAD),

BAD should be HDCP for all of those.

arch/arm/cpu/tegra30-common/pinmux.c line 131

Quoted 1 line
arch/arm/cpu/tegra30-common/pinmux.c +1 -0
+	PINI(HDMI_INT,	  LCD,	   RSVD,	RSVD,	   RSVD,    RSVD),

The first reserved should be HDMI.

arch/arm/cpu/tegra30-common/pinmux.c line 145

Quoted 10 lines
arch/arm/cpu/tegra30-common/pinmux.c +10 -0
+	PINI(VI_D0,	  VI,	   BAD,		RSVD1,	   VI,      RSVD2),
+	PINI(VI_D1,	  VI,	   BAD,		SDMMC2,	   VI,      RSVD1),
+	PINI(VI_D2,	  VI,	   BAD,		SDMMC2,	   VI,      RSVD1),
+	PINI(VI_D3,	  VI,	   BAD,		SDMMC2,	   VI,      RSVD1),
+	PINI(VI_D4,	  VI,	   BAD,		SDMMC2,	   VI,      RSVD1),
+	PINI(VI_D5,	  VI,	   BAD,		SDMMC2,	   VI,      RSVD1),
+	PINI(VI_D6,	  VI,	   BAD,		SDMMC2,	   VI,      RSVD1),
+	PINI(VI_D7,	  VI,	   BAD,		SDMMC2,	   VI,      RSVD1),
+	PINI(VI_D8,	  VI,	   BAD,		SDMMC2,	   VI,      RSVD1),
+	PINI(VI_D9,	  VI,	   BAD,		SDMMC2,	   VI,      RSVD1),

+ PINI(VI_D10, VI, BAD, RSVD1, VI, RSVD2),

arch/arm/cpu/tegra30-common/pinmux.c line 147

Quoted 1 line
arch/arm/cpu/tegra30-common/pinmux.c +1 -0
+	PINI(VI_D11,	  VI,	   BAD,		RSVD1,	   VI,      RSVD2),

BAD should be DDR for all of those.

arch/arm/cpu/tegra30-common/pinmux.c line 149

Quoted 1 line
arch/arm/cpu/tegra30-common/pinmux.c +1 -0
+	PINI(VI_MCLK,	  VI,	   VI,		BAD,	   BAD,     BAD),

All the functions for this pin select VI.

arch/arm/cpu/tegra30-common/pinmux.c line 151

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+	PINI(VI_VSYNC,	  VI,	   BAD,		RSVD1,	   VI,      RSVD2),
+	PINI(VI_HSYNC,	  VI,	   BAD,		RSVD1,	   VI,      RSVD2),

BAD should be DDR for both of those.

arch/arm/cpu/tegra30-common/pinmux.c line 153

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+	PINI(UART2_RXD,	  UART,	   IRDA,	SPDIF,	   UARTA,   SPI4),
+	PINI(UART2_TXD,	  UART,	   IRDA,	SPDIF,	   UARTA,   SPI4),

IRDA just means UARTB, so I think remove IRDA, and replace all usage with UARTB everywhere.

arch/arm/cpu/tegra30-common/pinmux.c line 205

Quoted 3 lines
arch/arm/cpu/tegra30-common/pinmux.c +3 -0
+	PINI(GMI_CS0_N,	  GMI,	   RSVD1,	NAND,	   GMI,     BAD),
+	PINI(GMI_A17,	  GMI,	   UARTD,	SPI4,	   GMI,     BAD),
+	PINI(GMI_A18,	  GMI,	   UARTD,	SPI4,	   GMI,     BAD),

BAD should be DTV in all of those.

arch/arm/cpu/tegra30-common/pinmux.c line 212

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+	PINI(GEN2_I2C_SCL, GMI,	   I2C2,	BAD,	   GMI,     RSVD3),
+	PINI(GEN2_I2C_SDA, GMI,	   I2C2,	BAD,	   GMI,     RSVD3),

BAD should be HDCP in both of those.

arch/arm/cpu/tegra30-common/pinmux.c line 224

Quoted 1 line
arch/arm/cpu/tegra30-common/pinmux.c +1 -0
+	PINI(CAM_MCLK,	  CAM,	   VI,		BAD,	   VI_ALT2, POPSDMMC4),

We should rename POPSDMMC4 to just SDMMC4 throughout; there's just a single SDMMC4 controller; no a separate POPSDMMC4 controller.

arch/arm/cpu/tegra30-common/pinmux.c line 228

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+	PINI(CAM_I2C_SCL, CAM,	   BAD,		I2C3,	   RSVD2,   POPSDMMC4),
+	PINI(CAM_I2C_SDA, CAM,	   BAD,		I2C3,	   RSVD2,   POPSDMMC4),

BAD should be VGP1 and VGP2 in those two lines.

arch/arm/cpu/tegra30-common/pinmux.c line 241

Quoted 1 line
arch/arm/cpu/tegra30-common/pinmux.c +1 -0
+	PINI(KB_ROW3,	  SYS,	   KBC,		BAD,	   RSVD2,   BAD),

For all of KBC_ROW* and KBC_COL*, the BAD in func1 (i.e. the first BAD) should be NAND.

The second BAD there should be RSVD4.

arch/arm/cpu/tegra30-common/pinmux.c line 253

Quoted 10 lines
arch/arm/cpu/tegra30-common/pinmux.c +10 -0
+	PINI(KB_ROW6,	  SYS,	   KBC,		BAD,	   SDMMC2,  BAD),
+	PINI(KB_ROW7,	  SYS,	   KBC,		BAD,	   SDMMC2,  BAD),
+	PINI(KB_ROW8,	  SYS,	   KBC,		BAD,	   SDMMC2,  BAD),
+	PINI(KB_ROW9,	  SYS,	   KBC,		BAD,	   SDMMC2,  BAD),
+	PINI(KB_ROW10,	  SYS,	   KBC,		BAD,	   SDMMC2,  BAD),
+	PINI(KB_ROW11,	  SYS,	   KBC,		BAD,	   SDMMC2,  BAD),
+	PINI(KB_ROW12,	  SYS,	   KBC,		BAD,	   SDMMC2,  BAD),
+	PINI(KB_ROW13,	  SYS,	   KBC,		BAD,	   SDMMC2,  BAD),
+	PINI(KB_ROW14,	  SYS,	   KBC,		BAD,	   SDMMC2,  BAD),
+	PINI(KB_ROW15,	  SYS,	   KBC,		BAD,	   SDMMC2,  BAD),

The second bad (final column) for all of those should be MIO.

arch/arm/cpu/tegra30-common/pinmux.c line 255

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+	PINI(KB_COL0,	  SYS,	   KBC,		BAD,	   TRACE,   BAD),
+	PINI(KB_COL1,	  SYS,	   KBC,		BAD,	   TRACE,   BAD),

The second bad (final column) for both of those should be TEST.

arch/arm/cpu/tegra30-common/pinmux.c line 261

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+	PINI(KB_COL6,	  SYS,	   KBC,		BAD,	   TRACE,   BAD),
+	PINI(KB_COL7,	  SYS,	   KBC,		BAD,	   TRACE,   BAD),

The second bad (final column) for both of those should be MIO.

arch/arm/cpu/tegra30-common/pinmux.c line 264

Quoted 1 line
arch/arm/cpu/tegra30-common/pinmux.c +1 -0
+	PINI(CORE_PWR_REQ, SYS,	   RSVD,	RSVD,	   RSVD,    RSVD),

func0 (the first RSVD) should be CORE_PWR_REQ.

arch/arm/cpu/tegra30-common/pinmux.c line 265

Quoted 1 line
arch/arm/cpu/tegra30-common/pinmux.c +1 -0
+	PINI(CPU_PWR_REQ, SYS,	   RSVD,	RSVD,	   RSVD,    RSVD),

func0 (the first RSVD) should be CPU_PWR_REQ.

arch/arm/cpu/tegra30-common/pinmux.c line 266

Quoted 1 line
arch/arm/cpu/tegra30-common/pinmux.c +1 -0
+	PINI(PWR_INT_N,	  SYS,	   RSVD,	RSVD,	   RSVD,    RSVD),

func0 (the first RSVD) should be PWR_INT_N.

arch/arm/cpu/tegra30-common/pinmux.c line 267

Quoted 1 line
arch/arm/cpu/tegra30-common/pinmux.c +1 -0
+	PINI(CLK_32K_IN,  SYS,	   RSVD,	RSVD,	   RSVD,    RSVD),

func0 (the first RSVD) should be CLK_32K_IN.

arch/arm/cpu/tegra30-common/pinmux.c line 268

Quoted 1 line
arch/arm/cpu/tegra30-common/pinmux.c +1 -0
+	PINI(OWR,	  SYS,	   OWR,		RSVD,	   RSVD,    RSVD),

func1 (the first RSVD) should be CEC.

arch/arm/cpu/tegra30-common/pinmux.c line 276

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+	PINI(SPDIF_IN,	  AUDIO,   SPDIF,	HDA,	   BAD,     DAPSDMMC2),
+	PINI(SPDIF_OUT,	  AUDIO,   SPDIF,	RSVD1,	   BAD,     DAPSDMMC2),

BAD should be I2C1 for both of those.

Rename DAPSDMMC2 to SDMMC2.

arch/arm/cpu/tegra30-common/pinmux.c line 284

Quoted 4 lines
arch/arm/cpu/tegra30-common/pinmux.c +4 -0
+	PINI(SPI2_MOSI,	  AUDIO,   SPI6,	SPI2,	   BAD,     GMI),
+	PINI(SPI2_MISO,	  AUDIO,   SPI6,	SPI2,	   BAD,     GMI),
+	PINI(SPI2_CS0_N,  AUDIO,   SPI6,	SPI2,	   BAD,     GMI),
+	PINI(SPI2_SCK,	  AUDIO,   SPI6,	SPI2,	   BAD,     GMI),

BAD should be GMI for all of those.

arch/arm/cpu/tegra30-common/pinmux.c line 288

Quoted 4 lines
arch/arm/cpu/tegra30-common/pinmux.c +4 -0
+	PINI(SPI1_MOSI,	  AUDIO,   SPI2,	SPI1,	   BAD,     GMI),
+	PINI(SPI1_SCK,	  AUDIO,   SPI2,	SPI1,	   BAD,     GMI),
+	PINI(SPI1_CS0_N,  AUDIO,   SPI2,	SPI1,	   BAD,     GMI),
+	PINI(SPI1_MISO,	  AUDIO,   BAD,		SPI1,	   BAD,     RSVD3),

SPI1_MISO's first BAD should be SPI3.

For all of those 4, func2's BAD should be SPI2 or rather SPI2_ALT.

arch/arm/cpu/tegra30-common/pinmux.c line 290

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+	PINI(SPI2_CS1_N,  AUDIO,   BAD,		SPI2,	   BAD,     BAD),
+	PINI(SPI2_CS2_N,  AUDIO,   BAD,		SPI2,	   BAD,     BAD),

In both of those, the first BAD should be SPI3, the second BAD SPI2_ALT, and the third BAD I2C1.

arch/arm/cpu/tegra30-common/pinmux.c line 291

Quoted 1 line
arch/arm/cpu/tegra30-common/pinmux.c +1 -0
+	PINI(SDMMC3_CLK,  SDMMC3,  UARTA,	PWM2,	   SDMMC3,  BAD),

BAD should be SPI3.

arch/arm/cpu/tegra30-common/pinmux.c line 292

Quoted 1 line
arch/arm/cpu/tegra30-common/pinmux.c +1 -0
+	PINI(SDMMC3_CMD,  SDMMC3,  UARTA,	PWM3,	   SDMMC3,  BAD),

BAD should be SPI2.

arch/arm/cpu/tegra30-common/pinmux.c line 296

Quoted 4 lines
arch/arm/cpu/tegra30-common/pinmux.c +4 -0
+	PINI(SDMMC3_DAT0, SDMMC3,  RSVD0,	RSVD1,	   SDMMC3,  BAD),
+	PINI(SDMMC3_DAT1, SDMMC3,  RSVD0,	RSVD1,	   SDMMC3,  BAD),
+	PINI(SDMMC3_DAT2, SDMMC3,  RSVD0,	PWM1,	   SDMMC3,  BAD),
+	PINI(SDMMC3_DAT3, SDMMC3,  RSVD0,	PWM0,	   SDMMC3,  BAD),

BAD should be SPI3 in all of those.

arch/arm/cpu/tegra30-common/pinmux.c line 300

Quoted 4 lines
arch/arm/cpu/tegra30-common/pinmux.c +4 -0
+	PINI(SDMMC3_DAT4, SDMMC3,  PWM1,	BAD,	   SDMMC3,  BAD),
+	PINI(SDMMC3_DAT5, SDMMC3,  PWM0,	BAD,	   SDMMC3,  BAD),
+	PINI(SDMMC3_DAT6, SDMMC3,  SPDIF,	BAD,	   SDMMC3,  BAD),
+	PINI(SDMMC3_DAT7, SDMMC3,  SPDIF,	BAD,	   SDMMC3,  BAD),

func1's BAD should be SPI4 in all of those.

func3's BAD should be SPI2 in all of those.

arch/arm/cpu/tegra30-common/pinmux.c line 376

Quoted 8 lines
arch/arm/cpu/tegra30-common/pinmux.c +7 -0
+void pinmux_set_func(enum pmux_pingrp pin, enum pmux_func func)
 
+	/* Handle special values */
+	if (func == PMUX_FUNC_SAFE)
+		func = tegra_soc_pingroups[pin].func_safe;
+
+	if (func & PMUX_FUNC_RSVD) {
+		mux = func & 0x3;

Indeed, this is the way the code should work, but in order for this code to work correctly, RSVD1 must only be used in the func0 column in the data, RSVD2 in the func1 column, etc.

arch/arm/cpu/tegra30-common/pinmux.c line 430

Quoted 7 lines
arch/arm/cpu/tegra30-common/pinmux.c +6 -0
+static int pinmux_set_lock(enum pmux_pingrp pin, enum pmux_pin_lock lock)
 
+	reg = readl(pin_lock);
+	reg &= ~(0x1 << PMUX_LOCK_SHIFT);
+	if (lock == PMUX_PIN_LOCK_ENABLE)
+		reg |= (0x1 << PMUX_LOCK_SHIFT);
+	writel(reg, pin_lock);

Note that the LOCK bit, once set, can never be set back to zero. Perhaps a diagnostic should be issued and/or an error returned if this is attempted? The kernel does that.

author
#11 lore raw

PATCH 3/7 Tegra30: Add common CPU (shared) files

Stephen,

Quoted 19 lines · Stephen Warren
Quoted 18 lines · Tom Warren

These files are used by both SPL and main U-Boot. Also made minor changes to shared Tegra code to support T30 differences.

arch/arm/cpu/tegra-common/ap.c +8 -0
@@ -58,6 +62,20 @@ int tegra_get_chip_type(void)
                      return TEGRA_SOC_T25;
              }
              break;
+     case CHIPID_TEGRA30:
+             switch (tegra_sku_id) {
+             case SKU_ID_T30:
+                     /*
+                      * T30 has two options. We will return TEGRA_SOC_T30
+                      * until we have the fdt set up when it may change to
+                      * TEGRA_SOC_T30_408MHZ depending on the PLLP freq.
+                      */
Quoted 8 lines

arch/arm/cpu/tegra-common/ap.c int tegra_get_chip_type(void) · line 76

Quoted 4 lines
arch/arm/cpu/tegra-common/ap.c +4 -0
+                     if (clock_get_rate(CLOCK_ID_PERIPH) == 408000000)
+                             return TEGRA_SOC_T30_408MHZ;
+                     else
+                             return TEGRA_SOC_T30;

Hmmm. I wonder why this doesn't return just the actual chip type; isn't the different in PLL_P rates a SW option and not a facet of the HW? The whole TEGRA_SOC_T30_408MHZ thing seems strange to me.

As I remember the history of early T30 & our internal U-Boot bringup, we started out at the slower clock rate (216MHz, IIRC), and then phased in 408MHz once things were stable, chips rev'd, etc. I can look into going directly to 408MHz, or phase it in in the next pass so boards have an option of using either speed, much as we have in Tegra20 with T20 and T25.

Quoted 34 lines
Quoted 8 lines
arch/arm/cpu/tegra-common/board.c +0 -1
@@ -59,9 +59,12 @@ unsigned int query_sdram_size(void)
      case 1:
              return 0x10000000;      /* 256 MB */
      case 2:
-     default:

arch/arm/cpu/tegra-common/board.c unsigned int query_sdram_size(void) · line 70

Quoted 10 lines
arch/arm/cpu/tegra-common/board.c +5 -1
              return 0x20000000;      /* 512 MB */
-     case 3:
+     case 4:
+             return 0x40000000;      /* 1GB */
+     case 8:
+             return 0x7ff00000;      /* 2GB - 1MB */
+     default:
              return 0x40000000;      /* 1GB */
      }
 }

I think we should be a little more explicit about the Tegra20/Tegra30 differences here. At least for case 0, there's a difference in what this field means for the two chips.

Value   Tegra20 Tegra30
0       512     256
1       256     256
2       512     512
3       1024    768
4       undef   1024
5       undef   undef
6       undef   undef
7       undef   undef
8       n/a     2048-1
Quoted 2 lines

At least the Toshiba AC100 uses value "0" in this field and has 512MB not 1GB of RAM.

Good point - I've only dealt with 1GB boards here so I'd missed the impact of changing the 'default' option. I'll redo it in V2.

Quoted 6 lines

I also note that for Tegra30, this field is bits 31:28, whereas for Tegra20 it's bits 30:28; we aren't masking off the top bit as we should in the current code. Again, the Toshiba AC100 appears to set this extra top bit, and only succeeds in getting 512M as the result of this function because of the default case.

I thought that we'd made the ODMDATA definitions compatible between T20 and T30. Must have missed it. I'll fix this too in V2.

Quoted 5 lines

arch/arm/cpu/tegra30-common/pinmux.c

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +0 -0

Hmmm. The header file this relies on doesn't exist yet. But perhaps this is OK since there's no boards.cfg entry for Tegra30 yet.

Should be OK. As I said in another thread, I'll double-check with git bisect/git am before posting V2.

Quoted 199 lines

arch/arm/cpu/tegra30-common/pinmux.c line 62

Quoted 3 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+const struct tegra_pingroup_desc tegra_soc_pingroups[PINGRP_COUNT] = {
+     /*  NAME        VDD     f0      f1      f2      f3      fSafe   io */

"fSafe io" should be deleted; those columns don't exist in the table.

I compared this table to that in the upstream kernel, which I spent a lot of time on correlating with the various documentation sources and our downstream kernel. Some changes should be made:

arch/arm/cpu/tegra30-common/pinmux.c line 78

Quoted 4 lines
arch/arm/cpu/tegra30-common/pinmux.c +4 -0
+     PINI(DAP3_FS,     BB,      I2S2,        RSVD1,     DISPA,   DISPB),
+     PINI(DAP3_DIN,    BB,      I2S2,        RSVD1,     DISPA,   DISPB),
+     PINI(DAP3_DOUT,   BB,      I2S2,        RSVD1,     DISPA,   DISPB),
+     PINI(DAP3_SCLK,   BB,      I2S2,        RSVD1,     DISPA,   DISPB),

In the kernel at least, the RSVD values are only used in particular slots, i.e. RSVD1 always yields function 0, RSVD2==func1, RSVD3==func2, RSVD4==func3. That way, when representing the "safe" value, one can use RSVDn to guarantee to get func(n-1). I suspect, it'd be a good idea for U-Boot to adopt the same policy. So, s/RSVD1/RSVD2/ above, and make similar changes throughout this table.

arch/arm/cpu/tegra30-common/pinmux.c line 80

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+     PINI(GPIO_PV0,    BB,      RSVD,        RSVD,      RSVD,    RSVD),
+     PINI(GPIO_PV1,    BB,      RSVD,        RSVD,      RSVD,    RSVD),

And likewise, plain "RSVD" doesn't exist. If you duplicate RSVD into each column of the table, there's no way to know which function pinmux_set_func(foo, RSVD) might pick, since it matches them all.

arch/arm/cpu/tegra30-common/pinmux.c line 86

Quoted 6 lines
arch/arm/cpu/tegra30-common/pinmux.c +6 -0
+     PINI(SDMMC1_CLK,  SDMMC1,  SDMMC1,      RSVD1,     RSVD2,   BAD),
+     PINI(SDMMC1_CMD,  SDMMC1,  SDMMC1,      RSVD1,     RSVD2,   BAD),
+     PINI(SDMMC1_DAT3, SDMMC1,  SDMMC1,      RSVD1,     UARTE,   BAD),
+     PINI(SDMMC1_DAT2, SDMMC1,  SDMMC1,      RSVD1,     UARTE,   BAD),
+     PINI(SDMMC1_DAT1, SDMMC1,  SDMMC1,      RSVD1,     UARTE,   BAD),
+     PINI(SDMMC1_DAT0, SDMMC1,  SDMMC1,      RSVD1,     UARTE,   BAD),

I believe the final column for all those entries should be UARTA.

Quoted 1 line

+ PINI(GPIO_PV3, SDMMC1, BAD, RSVD1, RSVD2, RSVD3),

BAD should be CLK_12M_OUT.

arch/arm/cpu/tegra30-common/pinmux.c line 99

Quoted 5 lines
arch/arm/cpu/tegra30-common/pinmux.c +5 -0
+     PINO(LCD_PWR2,    LCD,     DISPA,       DISPB,    SPI5,     BAD),
+     PINO(LCD_SDOUT,   LCD,     DISPA,       DISPB,    SPI5,     BAD),
+     PINO(LCD_WR_N,    LCD,     DISPA,       DISPB,    SPI5,     BAD),
+     PINO(LCD_SCK,     LCD,     DISPA,       DISPB,    SPI5,     BAD),
+     PINO(LCD_PWR0,    LCD,     DISPA,       DISPB,    SPI5,     BAD),

BAD should be HDCP for all of those.

Quoted 1 line

+ PINI(HDMI_INT, LCD, RSVD, RSVD, RSVD, RSVD),

The first reserved should be HDMI.

arch/arm/cpu/tegra30-common/pinmux.c line 145

Quoted 10 lines
arch/arm/cpu/tegra30-common/pinmux.c +10 -0
+     PINI(VI_D0,       VI,      BAD,         RSVD1,     VI,      RSVD2),
+     PINI(VI_D1,       VI,      BAD,         SDMMC2,    VI,      RSVD1),
+     PINI(VI_D2,       VI,      BAD,         SDMMC2,    VI,      RSVD1),
+     PINI(VI_D3,       VI,      BAD,         SDMMC2,    VI,      RSVD1),
+     PINI(VI_D4,       VI,      BAD,         SDMMC2,    VI,      RSVD1),
+     PINI(VI_D5,       VI,      BAD,         SDMMC2,    VI,      RSVD1),
+     PINI(VI_D6,       VI,      BAD,         SDMMC2,    VI,      RSVD1),
+     PINI(VI_D7,       VI,      BAD,         SDMMC2,    VI,      RSVD1),
+     PINI(VI_D8,       VI,      BAD,         SDMMC2,    VI,      RSVD1),
+     PINI(VI_D9,       VI,      BAD,         SDMMC2,    VI,      RSVD1),
 +      PINI(VI_D10,      VI,      BAD,         RSVD1,     VI,      RSVD2),
> +     PINI(VI_D11,      VI,      BAD,         RSVD1,     VI,      RSVD2),

BAD should be DDR for all of those.

Quoted 1 line

+ PINI(VI_MCLK, VI, VI, BAD, BAD, BAD),

All the functions for this pin select VI.

arch/arm/cpu/tegra30-common/pinmux.c line 151

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+     PINI(VI_VSYNC,    VI,      BAD,         RSVD1,     VI,      RSVD2),
+     PINI(VI_HSYNC,    VI,      BAD,         RSVD1,     VI,      RSVD2),

BAD should be DDR for both of those.

arch/arm/cpu/tegra30-common/pinmux.c line 153

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+     PINI(UART2_RXD,   UART,    IRDA,        SPDIF,     UARTA,   SPI4),
+     PINI(UART2_TXD,   UART,    IRDA,        SPDIF,     UARTA,   SPI4),

IRDA just means UARTB, so I think remove IRDA, and replace all usage with UARTB everywhere.

arch/arm/cpu/tegra30-common/pinmux.c line 205

Quoted 3 lines
arch/arm/cpu/tegra30-common/pinmux.c +3 -0
+     PINI(GMI_CS0_N,   GMI,     RSVD1,       NAND,      GMI,     BAD),
+     PINI(GMI_A17,     GMI,     UARTD,       SPI4,      GMI,     BAD),
+     PINI(GMI_A18,     GMI,     UARTD,       SPI4,      GMI,     BAD),

BAD should be DTV in all of those.

arch/arm/cpu/tegra30-common/pinmux.c line 212

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+     PINI(GEN2_I2C_SCL, GMI,    I2C2,        BAD,       GMI,     RSVD3),
+     PINI(GEN2_I2C_SDA, GMI,    I2C2,        BAD,       GMI,     RSVD3),

BAD should be HDCP in both of those.

Quoted 1 line

+ PINI(CAM_MCLK, CAM, VI, BAD, VI_ALT2, POPSDMMC4),

We should rename POPSDMMC4 to just SDMMC4 throughout; there's just a single SDMMC4 controller; no a separate POPSDMMC4 controller.

arch/arm/cpu/tegra30-common/pinmux.c line 228

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+     PINI(CAM_I2C_SCL, CAM,     BAD,         I2C3,      RSVD2,   POPSDMMC4),
+     PINI(CAM_I2C_SDA, CAM,     BAD,         I2C3,      RSVD2,   POPSDMMC4),

BAD should be VGP1 and VGP2 in those two lines.

Quoted 1 line

+ PINI(KB_ROW3, SYS, KBC, BAD, RSVD2, BAD),

For all of KBC_ROW* and KBC_COL*, the BAD in func1 (i.e. the first BAD) should be NAND.

The second BAD there should be RSVD4.

arch/arm/cpu/tegra30-common/pinmux.c line 253

Quoted 10 lines
arch/arm/cpu/tegra30-common/pinmux.c +10 -0
+     PINI(KB_ROW6,     SYS,     KBC,         BAD,       SDMMC2,  BAD),
+     PINI(KB_ROW7,     SYS,     KBC,         BAD,       SDMMC2,  BAD),
+     PINI(KB_ROW8,     SYS,     KBC,         BAD,       SDMMC2,  BAD),
+     PINI(KB_ROW9,     SYS,     KBC,         BAD,       SDMMC2,  BAD),
+     PINI(KB_ROW10,    SYS,     KBC,         BAD,       SDMMC2,  BAD),
+     PINI(KB_ROW11,    SYS,     KBC,         BAD,       SDMMC2,  BAD),
+     PINI(KB_ROW12,    SYS,     KBC,         BAD,       SDMMC2,  BAD),
+     PINI(KB_ROW13,    SYS,     KBC,         BAD,       SDMMC2,  BAD),
+     PINI(KB_ROW14,    SYS,     KBC,         BAD,       SDMMC2,  BAD),
+     PINI(KB_ROW15,    SYS,     KBC,         BAD,       SDMMC2,  BAD),

The second bad (final column) for all of those should be MIO.

arch/arm/cpu/tegra30-common/pinmux.c line 255

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+     PINI(KB_COL0,     SYS,     KBC,         BAD,       TRACE,   BAD),
+     PINI(KB_COL1,     SYS,     KBC,         BAD,       TRACE,   BAD),

The second bad (final column) for both of those should be TEST.

arch/arm/cpu/tegra30-common/pinmux.c line 261

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+     PINI(KB_COL6,     SYS,     KBC,         BAD,       TRACE,   BAD),
+     PINI(KB_COL7,     SYS,     KBC,         BAD,       TRACE,   BAD),

The second bad (final column) for both of those should be MIO.

Quoted 1 line

+ PINI(CORE_PWR_REQ, SYS, RSVD, RSVD, RSVD, RSVD),

func0 (the first RSVD) should be CORE_PWR_REQ.

Quoted 1 line

+ PINI(CPU_PWR_REQ, SYS, RSVD, RSVD, RSVD, RSVD),

func0 (the first RSVD) should be CPU_PWR_REQ.

Quoted 1 line

+ PINI(PWR_INT_N, SYS, RSVD, RSVD, RSVD, RSVD),

func0 (the first RSVD) should be PWR_INT_N.

Quoted 1 line

+ PINI(CLK_32K_IN, SYS, RSVD, RSVD, RSVD, RSVD),

func0 (the first RSVD) should be CLK_32K_IN.

Quoted 1 line

+ PINI(OWR, SYS, OWR, RSVD, RSVD, RSVD),

func1 (the first RSVD) should be CEC.

arch/arm/cpu/tegra30-common/pinmux.c line 276

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+     PINI(SPDIF_IN,    AUDIO,   SPDIF,       HDA,       BAD,     DAPSDMMC2),
+     PINI(SPDIF_OUT,   AUDIO,   SPDIF,       RSVD1,     BAD,     DAPSDMMC2),

BAD should be I2C1 for both of those.

Rename DAPSDMMC2 to SDMMC2.

arch/arm/cpu/tegra30-common/pinmux.c line 284

Quoted 4 lines
arch/arm/cpu/tegra30-common/pinmux.c +4 -0
+     PINI(SPI2_MOSI,   AUDIO,   SPI6,        SPI2,      BAD,     GMI),
+     PINI(SPI2_MISO,   AUDIO,   SPI6,        SPI2,      BAD,     GMI),
+     PINI(SPI2_CS0_N,  AUDIO,   SPI6,        SPI2,      BAD,     GMI),
+     PINI(SPI2_SCK,    AUDIO,   SPI6,        SPI2,      BAD,     GMI),

BAD should be GMI for all of those.

arch/arm/cpu/tegra30-common/pinmux.c line 288

Quoted 4 lines
arch/arm/cpu/tegra30-common/pinmux.c +4 -0
+     PINI(SPI1_MOSI,   AUDIO,   SPI2,        SPI1,      BAD,     GMI),
+     PINI(SPI1_SCK,    AUDIO,   SPI2,        SPI1,      BAD,     GMI),
+     PINI(SPI1_CS0_N,  AUDIO,   SPI2,        SPI1,      BAD,     GMI),
+     PINI(SPI1_MISO,   AUDIO,   BAD,         SPI1,      BAD,     RSVD3),

SPI1_MISO's first BAD should be SPI3.

For all of those 4, func2's BAD should be SPI2 or rather SPI2_ALT.

arch/arm/cpu/tegra30-common/pinmux.c line 290

Quoted 2 lines
arch/arm/cpu/tegra30-common/pinmux.c +2 -0
+     PINI(SPI2_CS1_N,  AUDIO,   BAD,         SPI2,      BAD,     BAD),
+     PINI(SPI2_CS2_N,  AUDIO,   BAD,         SPI2,      BAD,     BAD),

In both of those, the first BAD should be SPI3, the second BAD SPI2_ALT, and the third BAD I2C1.

Quoted 1 line

+ PINI(SDMMC3_CLK, SDMMC3, UARTA, PWM2, SDMMC3, BAD),

BAD should be SPI3.

Quoted 1 line

+ PINI(SDMMC3_CMD, SDMMC3, UARTA, PWM3, SDMMC3, BAD),

BAD should be SPI2.

arch/arm/cpu/tegra30-common/pinmux.c line 296

Quoted 4 lines
arch/arm/cpu/tegra30-common/pinmux.c +4 -0
+     PINI(SDMMC3_DAT0, SDMMC3,  RSVD0,       RSVD1,     SDMMC3,  BAD),
+     PINI(SDMMC3_DAT1, SDMMC3,  RSVD0,       RSVD1,     SDMMC3,  BAD),
+     PINI(SDMMC3_DAT2, SDMMC3,  RSVD0,       PWM1,      SDMMC3,  BAD),
+     PINI(SDMMC3_DAT3, SDMMC3,  RSVD0,       PWM0,      SDMMC3,  BAD),

BAD should be SPI3 in all of those.

Quoted 8 lines

arch/arm/cpu/tegra30-common/pinmux.c line 300

Quoted 4 lines
arch/arm/cpu/tegra30-common/pinmux.c +4 -0
+     PINI(SDMMC3_DAT4, SDMMC3,  PWM1,        BAD,       SDMMC3,  BAD),
+     PINI(SDMMC3_DAT5, SDMMC3,  PWM0,        BAD,       SDMMC3,  BAD),
+     PINI(SDMMC3_DAT6, SDMMC3,  SPDIF,       BAD,       SDMMC3,  BAD),
+     PINI(SDMMC3_DAT7, SDMMC3,  SPDIF,       BAD,       SDMMC3,  BAD),

func1's BAD should be SPI4 in all of those.

func3's BAD should be SPI2 in all of those.

Holy cow! Very thorough review! Thanks - I'll make those changes. Note that this is the table we're still using in our internal T30 U-Boot (IIRC) - we should update it there, too.

Quoted 10 lines

arch/arm/cpu/tegra30-common/pinmux.c line 376

Quoted 9 lines
arch/arm/cpu/tegra30-common/pinmux.c +7 -0
+void pinmux_set_func(enum pmux_pingrp pin, enum pmux_func func)
 
+     /* Handle special values */
+     if (func == PMUX_FUNC_SAFE)
+             func = tegra_soc_pingroups[pin].func_safe;
+
+     if (func & PMUX_FUNC_RSVD) {
+             mux = func & 0x3;
Quoted 3 lines

Indeed, this is the way the code should work, but in order for this code to work correctly, RSVD1 must only be used in the func0 column in the data, RSVD2 in the func1 column, etc.

I ported this from our internal codebase w/o looking at it too much - it just worked (for the very limited pinmuxing done to get UART output working). I'll check all this out on the next rev. Thanks.

Quoted 9 lines

arch/arm/cpu/tegra30-common/pinmux.c line 430

Quoted 8 lines
arch/arm/cpu/tegra30-common/pinmux.c +6 -0
+static int pinmux_set_lock(enum pmux_pingrp pin, enum pmux_pin_lock lock)
 
+     reg = readl(pin_lock);
+     reg &= ~(0x1 << PMUX_LOCK_SHIFT);
+     if (lock == PMUX_PIN_LOCK_ENABLE)
+             reg |= (0x1 << PMUX_LOCK_SHIFT);
+     writel(reg, pin_lock);
Quoted 3 lines

Note that the LOCK bit, once set, can never be set back to zero. Perhaps a diagnostic should be issued and/or an error returned if this is attempted? The kernel does that.

Good idea - I'll add it.

Thanks again for the hard work,

Tom

author
#12 lore raw

PATCH 4/7 Tegra30: Add arch-tegra30 include files

In reply to Tom Warren

Common Tegra files are in arch-tegra, shared between T20 and T30. Tegra30-specific headers are in arch-tegra30. Note that some of these will be filled in as more T30 support is added (drivers, WB/LP0 support, etc.).

---
 arch/arm/include/asm/arch-tegra/clk_rst.h          |  148 +++++-
 arch/arm/include/asm/arch-tegra/clock.h            |    8 +-
 arch/arm/include/asm/arch-tegra/gp_padctrl.h       |   37 ++
 arch/arm/include/asm/arch-tegra/tegra.h            |   11 +-
 arch/arm/include/asm/arch-tegra20/gp_padctrl.h     |   17 +-
 arch/arm/include/asm/arch-tegra30/clock-tables.h   |  378 ++++++++++++
 arch/arm/include/asm/arch-tegra30/clock.h          |   24 +
 arch/arm/include/asm/arch-tegra30/emc.h            |  106 ++++
 arch/arm/include/asm/arch-tegra30/flow.h           |   35 ++
 arch/arm/include/asm/arch-tegra30/funcmux.h        |   47 ++
 arch/arm/include/asm/arch-tegra30/gp_padctrl.h     |   59 ++
 arch/arm/include/asm/arch-tegra30/gpio.h           |  304 ++++++++++
 arch/arm/include/asm/arch-tegra30/hardware.h       |   22 +
 .../asm/arch-tegra30/pinmux-config-common.h        |  339 +++++++++++
 arch/arm/include/asm/arch-tegra30/pinmux.h         |  603 ++++++++++++++++++++
 arch/arm/include/asm/arch-tegra30/pmu.h            |   23 +
 arch/arm/include/asm/arch-tegra30/tegra.h          |   26 +
 17 files changed, 2161 insertions(+), 26 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-tegra/gp_padctrl.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/clock-tables.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/clock.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/emc.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/flow.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/funcmux.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/gp_padctrl.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/gpio.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/hardware.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/pinmux-config-common.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/pinmux.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/pmu.h
 create mode 100644 arch/arm/include/asm/arch-tegra30/tegra.h
arch/arm/include/asm/arch-tegra/clk_rst.h +139 -9
index 7b548c2..6a6e507 100644
@@ -21,8 +21,8 @@
  * MA 02111-1307 USA
  */
 
-#ifndef _CLK_RST_H_
-#define _CLK_RST_H_
+#ifndef _TEGRA_CLK_RST_H_
+#define _TEGRA_CLK_RST_H_
 
 /* PLL registers - there are several PLLs in the clock controller */
 struct clk_pll {
@@ -37,6 +37,12 @@ struct clk_pll_simple {
 	uint pll_misc;		/* other misc things */
 };
 
+/* 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;
+	uint clr;
+};
+
 /*
  * Most PLLs use the clk_pll structure, but some have a simpler two-member
  * structure for which we use clk_pll_simple. The reason for this non-
@@ -45,8 +51,10 @@ struct clk_pll_simple {
 enum {
 	TEGRA_CLK_PLLS		= 6,	/* Number of normal PLLs */
 	TEGRA_CLK_SIMPLE_PLLS	= 3,	/* Number of simple PLLs */
-	TEGRA_CLK_REGS		= 3,	/* Number of clock enable registers */
-	TEGRA_CLK_SOURCES	= 64,	/* Number of peripheral clock sources */
+	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*/
 };
 
 /* Clock/Reset Controller (CLK_RST_CONTROLLER_) regs */
@@ -82,14 +90,53 @@ struct clk_rst_ctlr {
 	uint crc_reserved11;		/* _reserved_11,	0xFC */
 
 	uint crc_clk_src[TEGRA_CLK_SOURCES]; /*_I2S1_0...	0x100-1fc */
-	uint crc_reserved20[80];	/*			0x200-33C */
-	uint crc_cpu_cmplx_set;		/* _CPU_CMPLX_SET_0,	0x340	  */
-	uint crc_cpu_cmplx_clr;		/* _CPU_CMPLX_CLR_0,	0x344     */
+
+	uint crc_reserved20[64];	/* _reserved_20,	0x200-2fc */
+
+	/* _RST_DEV_L/H/U_SET_0 0x300 ~ 0x314 */
+	struct clk_set_clr crc_rst_dev_ex[TEGRA_CLK_REGS];
+
+	uint crc_reserved30[2];		/* _reserved_30,	0x318, 0x31c */
+
+	/* _CLK_ENB_L/H/U_CLR_0 0x320 ~ 0x334 */
+	struct clk_set_clr crc_clk_enb_ex[TEGRA_CLK_REGS];
+
+	uint crc_reserved31[2];		/* _reserved_31,	0x338, 0x33c */
+
+	uint crc_cpu_cmplx_set;		/* _RST_CPU_CMPLX_SET_0,    0x340 */
+	uint crc_cpu_cmplx_clr;		/* _RST_CPU_CMPLX_CLR_0,    0x344 */
+
+	/* Additional (T30) registers */
+	uint crc_clk_cpu_cmplx_set;	/* _CLK_CPU_CMPLX_SET_0,    0x348 */
+	uint crc_clk_cpu_cmplx_clr;	/* _CLK_CPU_CMPLX_SET_0,    0x34c */
+
+	uint crc_reserved32[2];		/* _reserved_32,      0x350,0x354 */
+
+	uint crc_rst_dev_vw[TEGRA_CLK_REGS_VW]; /* _RST_DEVICES_V/W_0 */
+	uint crc_clk_out_enb_vw[TEGRA_CLK_REGS_VW]; /* _CLK_OUT_ENB_V/W_0 */
+	uint crc_cclkg_brst_pol;	/* _CCLKG_BURST_POLICY_0,   0x368 */
+	uint crc_super_cclkg_div;	/* _SUPER_CCLKG_DIVIDER_0,  0x36C */
+	uint crc_cclklp_brst_pol;	/* _CCLKLP_BURST_POLICY_0,  0x370 */
+	uint crc_super_cclkp_div;	/* _SUPER_CCLKLP_DIVIDER_0, 0x374 */
+	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_reserved33[11];	/* _reserved_33,        0x384-3ac */
+	uint crc_clk_src_vw[TEGRA_CLK_SOURCES_VW]; /* _G3D2_0..., 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 */
+	struct clk_set_clr crc_clk_enb_ex_vw[TEGRA_CLK_REGS_VW];
+	uint crc_reserved40[12];	/* _reserved_40,	0x450-47C */
+	uint crc_pll_cfg0;		/* _PLL_CFG0_0,		0x480 */
+	uint crc_pll_cfg1;		/* _PLL_CFG1_0,		0x484 */
+	uint crc_pll_cfg2;		/* _PLL_CFG2_0,		0x488 */
 };
 
 /* CLK_RST_CONTROLLER_CLK_CPU_CMPLX_0 */
+#define CPU3_CLK_STP_SHIFT	11
+#define CPU2_CLK_STP_SHIFT	10
 #define CPU1_CLK_STP_SHIFT	9
-
 #define CPU0_CLK_STP_SHIFT	8
 #define CPU0_CLK_STP_MASK	(1U << CPU0_CLK_STP_SHIFT)
 
@@ -120,6 +167,12 @@ struct clk_rst_ctlr {
 #define PLL_OUT_RATIO_MASK	(0xffU << PLL_OUT_RATIO_SHIFT)
 
 /* CLK_RST_CONTROLLER_PLLx_MISC_0 */
+#define PLL_DCCON_SHIFT		20
+#define PLL_DCCON_MASK		(1U << PLL_DCCON_SHIFT)
+
+#define PLL_LOCK_ENABLE_SHIFT	18
+#define PLL_LOCK_ENABLE_MASK	(1U << PLL_LOCK_ENABLE_SHIFT)
+
 #define PLL_CPCON_SHIFT		8
 #define PLL_CPCON_MASK		(15U << PLL_CPCON_SHIFT)
 
@@ -129,6 +182,22 @@ struct clk_rst_ctlr {
 #define PLLU_VCO_FREQ_SHIFT	20
 #define PLLU_VCO_FREQ_MASK	(1U << PLLU_VCO_FREQ_SHIFT)
 
+#define PLLP_OUT1_OVR		(1 << 2)
+#define PLLP_OUT2_OVR		(1 << 18)
+#define PLLP_OUT3_OVR		(1 << 2)
+#define PLLP_OUT4_OVR		(1 << 18)
+#define PLLP_OUT1_RATIO		8
+#define PLLP_OUT2_RATIO		24
+#define PLLP_OUT3_RATIO		8
+#define PLLP_OUT4_RATIO		24
+
+enum {
+	IN_408_OUT_204_DIVISOR = 2,
+	IN_408_OUT_102_DIVISOR = 6,
+	IN_408_OUT_48_DIVISOR = 15,
+	IN_408_OUT_9_6_DIVISOR = 83,
+};
+
 /* CLK_RST_CONTROLLER_OSC_CTRL_0 */
 #define OSC_FREQ_SHIFT		30
 #define OSC_FREQ_MASK		(3U << OSC_FREQ_SHIFT)
@@ -151,4 +220,65 @@ struct clk_rst_ctlr {
 #define OUT_CLK_SOURCE4_SHIFT	28
 #define OUT_CLK_SOURCE4_MASK	(15U << OUT_CLK_SOURCE4_SHIFT)
 
-#endif	/* CLK_RST_H */
+/* CLK_RST_CONTROLLER_SCLK_BURST_POLICY */
+#define SCLK_SYS_STATE_SHIFT    28U
+#define SCLK_SYS_STATE_MASK     (15U << SCLK_SYS_STATE_SHIFT)
+enum {
+	SCLK_SYS_STATE_STDBY,
+	SCLK_SYS_STATE_IDLE,
+	SCLK_SYS_STATE_RUN,
+	SCLK_SYS_STATE_IRQ = 4U,
+	SCLK_SYS_STATE_FIQ = 8U,
+};
+#define SCLK_COP_FIQ_MASK       (1 << 27)
+#define SCLK_CPU_FIQ_MASK       (1 << 26)
+#define SCLK_COP_IRQ_MASK       (1 << 25)
+#define SCLK_CPU_IRQ_MASK       (1 << 24)
+
+#define SCLK_SWAKEUP_FIQ_SOURCE_SHIFT		12
+#define SCLK_SWAKEUP_FIQ_SOURCE_MASK		\
+		(7 << SCLK_SWAKEUP_FIQ_SOURCE_SHIFT)
+#define SCLK_SWAKEUP_IRQ_SOURCE_SHIFT		8
+#define SCLK_SWAKEUP_IRQ_SOURCE_MASK		\
+		(7 << SCLK_SWAKEUP_FIQ_SOURCE_SHIFT)
+#define SCLK_SWAKEUP_RUN_SOURCE_SHIFT		4
+#define SCLK_SWAKEUP_RUN_SOURCE_MASK		\
+		(7 << SCLK_SWAKEUP_FIQ_SOURCE_SHIFT)
+#define SCLK_SWAKEUP_IDLE_SOURCE_SHIFT		0
+
+#define SCLK_SWAKEUP_IDLE_SOURCE_MASK		\
+		(7 << SCLK_SWAKEUP_FIQ_SOURCE_SHIFT)
+enum {
+	SCLK_SOURCE_CLKM,
+	SCLK_SOURCE_PLLC_OUT1,
+	SCLK_SOURCE_PLLP_OUT4,
+	SCLK_SOURCE_PLLP_OUT3,
+	SCLK_SOURCE_PLLP_OUT2,
+	SCLK_SOURCE_CLKD,
+	SCLK_SOURCE_CLKS,
+	SCLK_SOURCE_PLLM_OUT1,
+};
+#define SCLK_SWAKE_FIQ_SRC_PLLM_OUT1    (7 << 12)
+#define SCLK_SWAKE_IRQ_SRC_PLLM_OUT1    (7 << 8)
+#define SCLK_SWAKE_RUN_SRC_PLLM_OUT1    (7 << 4)
+#define SCLK_SWAKE_IDLE_SRC_PLLM_OUT1   (7 << 0)
+
+/* CLK_RST_CONTROLLER_SUPER_SCLK_DIVIDER */
+#define SUPER_SCLK_ENB_SHIFT		31U
+#define SUPER_SCLK_ENB_MASK		(1U << 31)
+#define SUPER_SCLK_DIVIDEND_SHIFT	8
+#define SUPER_SCLK_DIVIDEND_MASK	(0xff << SUPER_SCLK_DIVIDEND_SHIFT)
+#define SUPER_SCLK_DIVISOR_SHIFT	0
+#define SUPER_SCLK_DIVISOR_MASK		(0xff << SUPER_SCLK_DIVISOR_SHIFT)
+
+/* CLK_RST_CONTROLLER_CLK_SYSTEM_RATE */
+#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
+#define CLK_SYS_RATE_AHB_RATE_MASK      (3 << CLK_SYS_RATE_AHB_RATE_SHIFT)
+#define CLK_SYS_RATE_PCLK_DISABLE_SHIFT 3
+#define CLK_SYS_RATE_PCLK_DISABLE_MASK  (1 << CLK_SYS_RATE_PCLK_DISABLE_SHIFT)
+#define CLK_SYS_RATE_APB_RATE_SHIFT     0
+#define CLK_SYS_RATE_APB_RATE_MASK      (3 << CLK_SYS_RATE_AHB_RATE_SHIFT)
+
+#endif	/* _TEGRA_CLK_RST_H_ */
arch/arm/include/asm/arch-tegra/clock.h +4 -4
index eac1dc2..01f86ab 100644
@@ -21,8 +21,8 @@
 
 /* Tegra clock control functions */
 
-#ifndef _CLOCK_H
-#define _CLOCK_H
+#ifndef _TEGRA_CLOCK_H_
+#define _TEGRA_CLOCK_H_
 
 /* Set of oscillator frequencies supported in the internal API. */
 enum clock_osc_freq {
@@ -136,7 +136,7 @@ enum crc_reset_id {
 /**
  * Put parts of the CPU complex into or out of reset.\
  *
- * @param cpu		cpu number (0 or 1 on Tegra2)
+ * @param cpu		cpu number (0 or 1 on Tegra2, 0-3 on Tegra3)
  * @param which		which parts of the complex to affect (OR of crc_reset_id)
  * @param reset		1 to assert reset, 0 to de-assert
  */
@@ -262,4 +262,4 @@ void clock_init(void);
 /* Initialize the PLLs */
 void clock_early_init(void);
 
-#endif	/* _CLOCK_H_ */
+#endif	/* _TEGRA_CLOCK_H_ */
arch/arm/include/asm/arch-tegra/gp_padctrl.h new file +37 -0
new file mode 100644
index 0000000..d347e97
@@ -0,0 +1,37 @@
+/*
+ *  (C) Copyright 2010-2012
+ *  NVIDIA Corporation <www.nvidia.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef _TEGRA_GP_PADCTRL_H_
+#define _TEGRA_GP_PADCTRL_H_
+
+/* bit fields definitions for APB_MISC_GP_HIDREV register */
+#define HIDREV_CHIPID_SHIFT		8
+#define HIDREV_CHIPID_MASK		(0xff << HIDREV_CHIPID_SHIFT)
+#define HIDREV_MAJORPREV_SHIFT		4
+#define HIDREV_MAJORPREV_MASK		(0xf << HIDREV_MAJORPREV_SHIFT)
+
+/* CHIPID field returned from APB_MISC_GP_HIDREV register */
+#define CHIPID_TEGRA20				0x20
+#define CHIPID_TEGRA30				0x30
+
+#endif	/* _TEGRA_GP_PADCTRL_H_ */
arch/arm/include/asm/arch-tegra/tegra.h +10 -1
index 6d2e62f..405abd8 100644
@@ -72,12 +72,21 @@ enum {
 	SKU_ID_T25		= 0x18,
 	SKU_ID_AP25E		= 0x1b,
 	SKU_ID_T25E		= 0x1c,
+	SKU_ID_T30		= 0x81, /* Cardhu value */
 };
 
-/* These are the SOC categories that affect clocking */
+/*
+ * These are used to distinguish SOC types for setting up clocks. Mostly
+ * we can tell the clocking required by looking at the SOC sku_id, but
+ * for T30 it is a user option as to whether to run PLLP in fast or slow
+ * mode, so we have two options there.
+ */
 enum {
 	TEGRA_SOC_T20,
 	TEGRA_SOC_T25,
+	TEGRA_SOC_T30,
+	TEGRA_SOC_T30_408MHZ,   /* A T30 with faster PLLP */
+	TEGRA_SOC2_SLOW,	/* T2x needs to run@slow clock initially */
 
 	TEGRA_SOC_COUNT,
 	TEGRA_SOC_UNKNOWN	= -1,
arch/arm/include/asm/arch-tegra20/gp_padctrl.h +5 -12
index 865af5b..eaaf903 100644
@@ -21,8 +21,10 @@
  * MA 02111-1307 USA
  */
 
-#ifndef _GP_PADCTRL_H_
-#define _GP_PADCTRL_H_
+#ifndef _TEGRA20_GP_PADCTRL_H_
+#define _TEGRA20_GP_PADCTRL_H_
+
+#include <asm/arch-tegra/gp_padctrl.h>
 
 /* APB_MISC_GP and padctrl registers */
 struct apb_misc_gp_ctlr {
@@ -61,13 +63,4 @@ struct apb_misc_gp_ctlr {
 	u32	memcomp;	/* 0xD4: APB_MISC_GP_MEMCOMPPADCTRL */
 };
 
-/* bit fields definitions for APB_MISC_GP_HIDREV register */
-#define HIDREV_CHIPID_SHIFT		8
-#define HIDREV_CHIPID_MASK		(0xff << HIDREV_CHIPID_SHIFT)
-#define HIDREV_MAJORPREV_SHIFT		4
-#define HIDREV_MAJORPREV_MASK		(0xf << HIDREV_MAJORPREV_SHIFT)
-
-/* CHIPID field returned from APB_MISC_GP_HIDREV register */
-#define CHIPID_TEGRA20				0x20
-
-#endif
+#endif	/* _TEGRA20_GP_PADCTRL_H_ */
arch/arm/include/asm/arch-tegra30/clock-tables.h new file +378 -0

378 lines not on this page · raw message

arch/arm/include/asm/arch-tegra30/clock.h new file +24 -0
new file mode 100644
index 0000000..61fc4c8
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2010-2012, 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,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* Tegra30 clock control functions */
+
+#ifndef _TEGRA30_CLOCK_H_
+#define _TEGRA30_CLOCK_H_
+
+#include <asm/arch-tegra/clock.h>
+
+#endif	/* _TEGRA30_CLOCK_H_ */
arch/arm/include/asm/arch-tegra30/emc.h new file +106 -0

106 lines not on this page · raw message

arch/arm/include/asm/arch-tegra30/flow.h new file +35 -0
new file mode 100644
index 0000000..f5966a8
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010-2012, 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,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _TEGRA30_FLOW_H_
+#define _TEGRA30_FLOW_H_
+
+struct flow_ctlr {
+	u32 halt_cpu_events;
+	u32 halt_cop_events;
+	u32 cpu_csr;
+	u32 cop_csr;
+	u32 xrq_events;
+	u32 halt_cpu1_events;
+	u32 cpu1_csr;
+	u32 halt_cpu2_events;
+	u32 cpu2_csr;
+	u32 halt_cpu3_events;
+	u32 cpu3_csr;
+	u32 cluster_control;
+};
+
+#endif	/* _TEGRA30_FLOW_H_ */
arch/arm/include/asm/arch-tegra30/funcmux.h new file +47 -0

47 lines not on this page · raw message

arch/arm/include/asm/arch-tegra30/gp_padctrl.h new file +59 -0

59 lines not on this page · raw message

arch/arm/include/asm/arch-tegra30/gpio.h new file +304 -0

304 lines not on this page · raw message

arch/arm/include/asm/arch-tegra30/hardware.h new file +22 -0
new file mode 100644
index 0000000..b1a5aa9
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2010-2012, 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,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _TEGRA30_HARDWARE_H_
+#define _TEGRA30_HARDWARE_H_
+
+/* include tegra specific hardware definitions */
+
+#endif /* _TEGRA30-HARDWARE_H_ */
arch/arm/include/asm/arch-tegra30/pinmux-config-common.h new file +339 -0

339 lines not on this page · raw message

arch/arm/include/asm/arch-tegra30/pinmux.h new file +603 -0

603 lines not on this page · raw message

arch/arm/include/asm/arch-tegra30/pmu.h new file +23 -0
new file mode 100644
index 0000000..52bea29
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2010-2012, 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,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _TEGRA30_PMU_H_
+#define _TEGRA30_PMU_H_
+
+/* Set core and CPU voltages to nominal levels */
+int pmu_set_nominal(void);
+
+#endif	/* _TEGRA30_PMU_H_ */
arch/arm/include/asm/arch-tegra30/tegra.h new file +26 -0
new file mode 100644
index 0000000..46a7474
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2010-2012, 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,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _TEGRA30_H_
+#define _TEGRA30_H_
+
+#define NV_PA_SDRAM_BASE	0x80000000	/* 0x80000000 for real T30 */
+
+#include <asm/arch-tegra/tegra.h>
+
+#define BCT_ODMDATA_OFFSET	6116	/* 12 bytes from end of BCT */
+
+#endif	/* TEGRA30_H */
Signature · 1 line
1.7.0.4
#13 lore raw

PATCH 4/7 Tegra30: Add arch-tegra30 include files

arch/arm/include/asm/arch-tegra/gp_padctrl.h line 31

Quoted 12 lines · Tom Warren

Common Tegra files are in arch-tegra, shared between T20 and T30. Tegra30-specific headers are in arch-tegra30. Note that some of these will be filled in as more T30 support is added (drivers, WB/LP0 support, etc.).

arch/arm/include/asm/arch-tegra/gp_padctrl.h +5 -0
 
+/* bit fields definitions for APB_MISC_GP_HIDREV register */
+#define HIDREV_CHIPID_SHIFT		8
+#define HIDREV_CHIPID_MASK		(0xff << HIDREV_CHIPID_SHIFT)
+#define HIDREV_MAJORPREV_SHIFT		4
+#define HIDREV_MAJORPREV_MASK		(0xf << HIDREV_MAJORPREV_SHIFT)

Patch 1 added the following:

#define GP_HIDREV 0x804

... to arch/arm/cpu/arm720t/tegra-common/cpu.h. I wonder if that line wouldn't be better place here, alongside the macros that allow you to use it?

arch/arm/include/asm/arch-tegra30/emc.h

Quoted 1 line
arch/arm/include/asm/arch-tegra30/emc.h +0 -0

This file seems to be:

a) An exact duplicate of the Tegra20 file. Did the register layout really not change at all? That seems unlikely. If so, shouldn't the file be shared?

b) Not used by anything in this patch series, so shouldn't be needed.

c) Incorrect; struct emc_ctlr doesn't actually match the register layout for Tegra20 or Tegra30 (at least, offset 0 is interrupt status in HW in both chips, not cfg as in the struct). Some fields match though.

Quoted 8 lines
arch/arm/include/asm/arch-tegra30/funcmux.h +6 -0
 
+/**
+ * Select a config for a particular peripheral.
+ *
+ * Each peripheral can operate through a number of configurations,
+ * which are sets of pins that it uses to bring out its signals.
+ * The basic config is 0, and higher numbers indicate different

arch/arm/include/asm/arch-tegra30/funcmux.h line 45

Quoted 10 lines
arch/arm/include/asm/arch-tegra30/funcmux.h +10 -0
+ * pinmux settings to bring the peripheral out on other pins,
+ *
+ * This function also disables tristate for the function's pins,
+ * so that they operate in normal mode.
+ *
+ * @param id		Peripheral id
+ * @param config	Configuration to use (FUNCMUX_...), 0 for default
+ * @return 0 if ok, -1 on error (e.g. incorrect id or config)
+ */
+int funcmux_select(enum periph_id id, int config);

That prototype is identical to Tegra20. Shouldn't there be a common funcmux.h that defines the prototype, either include from the SoC-specific file, or itself including the SoC-specific file? This is important since common code (stuff that's not specific to Tegra20 or Tegra30) calls this function, so it shouldn't be prototyped in multiple places (with associated possibility of divergence) even if the implementation is entirely separate for the two SoCs.

arch/arm/include/asm/arch-tegra30/gpio.h line 22

Quoted 4 lines
arch/arm/include/asm/arch-tegra30/gpio.h +2 -0
 
+ * The Tegra 3x GPIO controller has 246 GPIOS in 8 banks of 4 ports,
+ *  each with 8 GPIOs.

Extra space there after *.

arch/arm/include/asm/arch-tegra30/hardware.h

Quoted 1 line
arch/arm/include/asm/arch-tegra30/hardware.h +0 -0

This file is empty except for comments. Is it really useful? The Tegra20 file is empty too.

arch/arm/include/asm/arch-tegra30/pinmux-config-common.h

Quoted 1 line
arch/arm/include/asm/arch-tegra30/pinmux-config-common.h +0 -0

The content of this file presumably describes Cardhu (which revision?) Surely it should be in board/nvidia/cardhu/*.c?

arch/arm/include/asm/arch-tegra30/pinmux.h line 339

Quoted 12 lines
arch/arm/include/asm/arch-tegra30/pinmux.h +10 -0
 
+/*
+ * Functions which can be assigned to each of the pin groups. The values here
+ * bear no relation to the values programmed into pinmux registers and are
+ * purely a convenience. The translation is done through a table search.
+ */
+enum pmux_func {
+	PMUX_FUNC_RSVD = 0x8000,
+	PMUX_FUNC_RSVD0 = PMUX_FUNC_RSVD,
+	PMUX_FUNC_BAD = 0x4000,		/* Invalid! */
+	PMUX_FUNC_NONE = 0,

I think all four of those should be deleted.

arch/arm/include/asm/arch-tegra30/pinmux.h line 358

Quoted 2 lines
arch/arm/include/asm/arch-tegra30/pinmux.h +2 -0
+	PMUX_FUNC_I2C,
+	PMUX_FUNC_I2C1 = PMUX_FUNC_I2C,

I don't think there's a need for duplicate names for any of these.

author
#14 lore raw

PATCH 4/7 Tegra30: Add arch-tegra30 include files

Stephen,

Quoted 16 lines · Stephen Warren

arch/arm/include/asm/arch-tegra/gp_padctrl.h line 31

Quoted 12 lines · Tom Warren

Common Tegra files are in arch-tegra, shared between T20 and T30. Tegra30-specific headers are in arch-tegra30. Note that some of these will be filled in as more T30 support is added (drivers, WB/LP0 support, etc.).

arch/arm/include/asm/arch-tegra/gp_padctrl.h +5 -0
 
+/* bit fields definitions for APB_MISC_GP_HIDREV register */
+#define HIDREV_CHIPID_SHIFT          8
+#define HIDREV_CHIPID_MASK           (0xff << HIDREV_CHIPID_SHIFT)
+#define HIDREV_MAJORPREV_SHIFT               4
+#define HIDREV_MAJORPREV_MASK                (0xf << HIDREV_MAJORPREV_SHIFT)

Patch 1 added the following:

Quoted 5 lines

#define GP_HIDREV 0x804

... to arch/arm/cpu/arm720t/tegra-common/cpu.h. I wonder if that line wouldn't be better place here, alongside the macros that allow you to use it?

Sure, that would be better. The code that uses this in cpu.c was munged a few times and I may have added this in the wrong file.

Quoted 9 lines

arch/arm/include/asm/arch-tegra30/emc.h

Quoted 2 lines
arch/arm/include/asm/arch-tegra30/emc.h +0 -0

This file seems to be:

a) An exact duplicate of the Tegra20 file. Did the register layout really not change at all? That seems unlikely. If so, shouldn't the file be shared?

Quoted 5 lines

b) Not used by anything in this patch series, so shouldn't be needed.

c) Incorrect; struct emc_ctlr doesn't actually match the register layout for Tegra20 or Tegra30 (at least, offset 0 is interrupt status in HW in both chips, not cfg as in the struct). Some fields match though.

I'll revisit it in our internal U-Boot source. I tried to go through all the include files and make sure any not used on T30 initially were removed, but if it's used in a common file, I didn't want to add #if defined(CONFIG_TEGRA20) fencing if not necessary.

Quoted 20 lines
Quoted 9 lines
arch/arm/include/asm/arch-tegra30/funcmux.h +6 -0
 
+/**
+ * Select a config for a particular peripheral.
+ *
+ * Each peripheral can operate through a number of configurations,
+ * which are sets of pins that it uses to bring out its signals.
+ * The basic config is 0, and higher numbers indicate different

arch/arm/include/asm/arch-tegra30/funcmux.h line 45

Quoted 10 lines
arch/arm/include/asm/arch-tegra30/funcmux.h +10 -0
+ * pinmux settings to bring the peripheral out on other pins,
+ *
+ * This function also disables tristate for the function's pins,
+ * so that they operate in normal mode.
+ *
+ * @param id         Peripheral id
+ * @param config     Configuration to use (FUNCMUX_...), 0 for default
+ * @return 0 if ok, -1 on error (e.g. incorrect id or config)
+ */
+int funcmux_select(enum periph_id id, int config);
Quoted 7 lines

That prototype is identical to Tegra20. Shouldn't there be a common funcmux.h that defines the prototype, either include from the SoC-specific file, or itself including the SoC-specific file? This is important since common code (stuff that's not specific to Tegra20 or Tegra30) calls this function, so it shouldn't be prototyped in multiple places (with associated possibility of divergence) even if the implementation is entirely separate for the two SoCs.

Yep, I can do that.

Quoted 6 lines

arch/arm/include/asm/arch-tegra30/gpio.h line 22

Quoted 5 lines
arch/arm/include/asm/arch-tegra30/gpio.h +2 -0
 
+ * The Tegra 3x GPIO controller has 246 GPIOS in 8 banks of 4 ports,
+ *  each with 8 GPIOs.
Quoted 6 lines

Extra space there after *.

arch/arm/include/asm/arch-tegra30/hardware.h

Quoted 1 line
arch/arm/include/asm/arch-tegra30/hardware.h +0 -0

This file is empty except for comments. Is it really useful? The Tegra20 file is empty too

It's included from include/asm/hardware.h, which is included in 3 or so arm720t files, so it's mandatory. I hate empty files, but I don't see a way around it without polluting some arm720t files with #ifdef's. the integratorap_cm720t does the same thing.

Quoted 5 lines

arch/arm/include/asm/arch-tegra30/pinmux-config-common.h

Quoted 2 lines
arch/arm/include/asm/arch-tegra30/pinmux-config-common.h +0 -0

The content of this file presumably describes Cardhu (which revision?) Surely it should be in board/nvidia/cardhu/*.c?

On the previous review cycle (before I commonized Tegra files), this file lived in board/nvidia/cardhu, and I think it was Tom Rini (or maybe Simon) that pointed out that it had no 'cardhu' identifiers in it, so it should be moved to a more Tegra30-centric area, hence the move to arch-tegra30. Again, this is from our internal repo, and I don't believe there's any rev info in that file (except for commented-out tables that aren't used, so I removed them). I think it's valid to say this file is common to all Tegra30 builds, and additional sparse pinmux tables could be added in board files/areas for board-specific / rev-specific mux changes.

Quoted 15 lines

arch/arm/include/asm/arch-tegra30/pinmux.h line 339

Quoted 13 lines
arch/arm/include/asm/arch-tegra30/pinmux.h +10 -0
 
+/*
+ * Functions which can be assigned to each of the pin groups. The values here
+ * bear no relation to the values programmed into pinmux registers and are
+ * purely a convenience. The translation is done through a table search.
+ */
+enum pmux_func {
+     PMUX_FUNC_RSVD = 0x8000,
+     PMUX_FUNC_RSVD0 = PMUX_FUNC_RSVD,
+     PMUX_FUNC_BAD = 0x4000,         /* Invalid! */
+     PMUX_FUNC_NONE = 0,

I think all four of those should be deleted.

I'll look into it after the pinmux table rewrite you pointed out.

Quoted 5 lines

arch/arm/include/asm/arch-tegra30/pinmux.h line 358

Quoted 3 lines
arch/arm/include/asm/arch-tegra30/pinmux.h +2 -0
+     PMUX_FUNC_I2C,
+     PMUX_FUNC_I2C1 = PMUX_FUNC_I2C,

I don't think there's a need for duplicate names for any of these.

I'll look into it.

Thanks,

Tom

#15 lore raw

PATCH 4/7 Tegra30: Add arch-tegra30 include files

Quoted 8 lines · Tom Warren

Stephen,

Quoted 5 lines · Stephen Warren
Quoted 4 lines · Tom Warren

Common Tegra files are in arch-tegra, shared between T20 and T30. Tegra30-specific headers are in arch-tegra30. Note that some of these will be filled in as more T30 support is added (drivers, WB/LP0 support, etc.).

...

Quoted 10 lines
Quoted 10 lines

arch/arm/include/asm/arch-tegra30/emc.h

Quoted 1 line
arch/arm/include/asm/arch-tegra30/emc.h +0 -0

This file seems to be:

a) An exact duplicate of the Tegra20 file. Did the register layout really not change at all? That seems unlikely. If so, shouldn't the file be shared?

b) Not used by anything in this patch series, so shouldn't be needed.

Quoted 8 lines
Quoted 3 lines

c) Incorrect; struct emc_ctlr doesn't actually match the register layout for Tegra20 or Tegra30 (at least, offset 0 is interrupt status in HW in both chips, not cfg as in the struct). Some fields match though.

I'll revisit it in our internal U-Boot source. I tried to go through all the include files and make sure any not used on T30 initially were removed, but if it's used in a common file, I didn't want to add #if defined(CONFIG_TEGRA20) fencing if not necessary.

Hmm. I guess this should be conditional on something like CONFIG_TEGRA_EMC irrespective of the new Tegra30 changes; I imagine any EMC-related code is quite optional even on Tegra20 where there is a driver coded up.

Quoted 12 lines
Quoted 11 lines

arch/arm/include/asm/arch-tegra30/gpio.h line 22

Quoted 4 lines
arch/arm/include/asm/arch-tegra30/gpio.h +2 -0
 
+ * The Tegra 3x GPIO controller has 246 GPIOS in 8 banks of 4 ports,
+ *  each with 8 GPIOs.

Extra space there after *.

arch/arm/include/asm/arch-tegra30/hardware.h

Quoted 1 line
arch/arm/include/asm/arch-tegra30/hardware.h +0 -0

This file is empty except for comments. Is it really useful? The Tegra20 file is empty too

Quoted 4 lines

It's included from include/asm/hardware.h, which is included in 3 or so arm720t files, so it's mandatory. I hate empty files, but I don't see a way around it without polluting some arm720t files with #ifdef's. the integratorap_cm720t does the same thing.

OK, makes sense.

Quoted 5 lines
Quoted 4 lines

arch/arm/include/asm/arch-tegra30/pinmux-config-common.h

Quoted 1 line
arch/arm/include/asm/arch-tegra30/pinmux-config-common.h +0 -0

The content of this file presumably describes Cardhu (which revision?) Surely it should be in board/nvidia/cardhu/*.c?

Quoted 10 lines

On the previous review cycle (before I commonized Tegra files), this file lived in board/nvidia/cardhu, and I think it was Tom Rini (or maybe Simon) that pointed out that it had no 'cardhu' identifiers in it, so it should be moved to a more Tegra30-centric area, hence the move to arch-tegra30. Again, this is from our internal repo, and I don't believe there's any rev info in that file (except for commented-out tables that aren't used, so I removed them). I think it's valid to say this file is common to all Tegra30 builds, and additional sparse pinmux tables could be added in board files/areas for board-specific / rev-specific mux changes.

Sorry, there's no way those tables aren't Cardhu-specific; they're picking specific pinmux options for all/many of the pins, and there's no reason in general to believe that every Tegra30 board will use the exact same pinmux setup.

In practice, I know that e.g. Waluigi and Beaver use a very similar pinmux, but I imagine there are some differences even there. So, chunks of the table could be re-used, but certainly not the whole thing. I think the best way forward here is to put this current file into the Cardhu directory, and then implement pinmux-from-device-tree before adding support for any other boards that need a different pinmux.

author
#16 lore raw

PATCH 5/7 Tegra30: Cardhu: Add DT files

In reply to Tom Warren

These are stripped down for bringup, They'll be filled out later to match-up with the kernel DT contents, and/or as devices are brought up (mmc, usb, spi, etc.).

---
 arch/arm/dts/tegra30.dtsi           |   30 ++++++++++++++++++++++++++++++
 board/nvidia/dts/tegra30-cardhu.dts |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/dts/tegra30.dtsi
 create mode 100644 board/nvidia/dts/tegra30-cardhu.dts
arch/arm/dts/tegra30.dtsi new file +30 -0
new file mode 100644
index 0000000..122c134
@@ -0,0 +1,30 @@
+/include/ "skeleton.dtsi"
+
+/ {
+	model = "NVIDIA Tegra30";
+	compatible = "nvidia,tegra30";
+
+	clocks {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		osc: clock {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+		};
+	};
+
+	gpio: gpio at 6000d000 {
+		compatible = "nvidia,tegra30-gpio", "nvidia,tegra20-gpio";
+		reg = <0x6000d000 0x1000>;
+		#gpio-cells = <2>;
+		gpio-controller;
+	};
+
+	serial at 70006000 {
+		compatible = "nvidia,tegra30-uart", "nvidia,tegra20-uart";
+		reg = <0x70006000 0x40>;
+		reg-shift = <2>;
+		status = "disabled";
+	};
+};
board/nvidia/dts/tegra30-cardhu.dts new file +35 -0
new file mode 100644
index 0000000..68563e8
@@ -0,0 +1,35 @@
+/dts-v1/;
+
+/memreserve/ 0x1c000000 0x04000000;
+/include/ ARCH_CPU_DTS
+
+/ {
+	model = "NVIDIA Cardhu";
+	compatible = "nvidia,cardhu", "nvidia,tegra30";
+
+	aliases {
+	};
+
+        memory {
+                device_type = "memory";
+                reg = <0x80000000 0xc0000000>;
+        };
+
+	clocks {
+		clk_32k: clk_32k {
+			clock_frequency = <32000>;
+		};
+		osc {
+			clock-frequency = <12000000>;
+		};
+	};
+
+	clock at 60006000 {
+		clocks = <&clk_32k &osc>;
+	};
+
+	serial at 70006000 {
+		status = "ok";
+		clock-frequency = < 216000000 >;
+	};
+};
Signature · 1 line
1.7.0.4
#17 lore raw

PATCH 5/7 Tegra30: Cardhu: Add DT files

Am Dienstag, den 02.10.2012, 15:45 -0700 schrieb Tom Warren:

Quoted 73 lines

These are stripped down for bringup, They'll be filled out later to match-up with the kernel DT contents, and/or as devices are brought up (mmc, usb, spi, etc.).

---
 arch/arm/dts/tegra30.dtsi           |   30 ++++++++++++++++++++++++++++++
 board/nvidia/dts/tegra30-cardhu.dts |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/dts/tegra30.dtsi
 create mode 100644 board/nvidia/dts/tegra30-cardhu.dts
arch/arm/dts/tegra30.dtsi new file +30 -0
new file mode 100644
index 0000000..122c134
@@ -0,0 +1,30 @@
+/include/ "skeleton.dtsi"
+
+/ {
+	model = "NVIDIA Tegra30";
+	compatible = "nvidia,tegra30";
+
+	clocks {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		osc: clock {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+		};
+	};
+
+	gpio: gpio at 6000d000 {
+		compatible = "nvidia,tegra30-gpio", "nvidia,tegra20-gpio";
+		reg = <0x6000d000 0x1000>;
+		#gpio-cells = <2>;
+		gpio-controller;
+	};
+
+	serial at 70006000 {
+		compatible = "nvidia,tegra30-uart", "nvidia,tegra20-uart";
+		reg = <0x70006000 0x40>;
+		reg-shift = <2>;
+		status = "disabled";
+	};
+};
board/nvidia/dts/tegra30-cardhu.dts new file +19 -0
new file mode 100644
index 0000000..68563e8
@@ -0,0 +1,35 @@
+/dts-v1/;
+
+/memreserve/ 0x1c000000 0x04000000;
+/include/ ARCH_CPU_DTS
+
+/ {
+	model = "NVIDIA Cardhu";
+	compatible = "nvidia,cardhu", "nvidia,tegra30";
+
+	aliases {
+	};
+
+        memory {
+                device_type = "memory";
+                reg = <0x80000000 0xc0000000>;
+        };
+
+	clocks {
+		clk_32k: clk_32k {

board/nvidia/dts/tegra30-cardhu.dts line 29

Quoted 10 lines
board/nvidia/dts/tegra30-cardhu.dts new file +10 -0
+			clock_frequency = <32000>;
+		};
+		osc {
+			clock-frequency = <12000000>;
+		};
+	};
+
+	clock at 60006000 {
+		clocks = <&clk_32k &osc>;
+	};

Is this clock thing really needed? I don't think we are doing anything with those DT entries.

Quoted 6 lines
board/nvidia/dts/tegra30-cardhu.dts new file +6 -0
+
+	serial at 70006000 {
+		status = "ok";
+		clock-frequency = < 216000000 >;
+	};
+};
author
#18 lore raw

PATCH 5/7 Tegra30: Cardhu: Add DT files

Lucas,

Quoted 78 lines · Lucas Stach

Am Dienstag, den 02.10.2012, 15:45 -0700 schrieb Tom Warren:

Quoted 77 lines

These are stripped down for bringup, They'll be filled out later to match-up with the kernel DT contents, and/or as devices are brought up (mmc, usb, spi, etc.).

---
 arch/arm/dts/tegra30.dtsi           |   30 ++++++++++++++++++++++++++++++
 board/nvidia/dts/tegra30-cardhu.dts |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/dts/tegra30.dtsi
 create mode 100644 board/nvidia/dts/tegra30-cardhu.dts
arch/arm/dts/tegra30.dtsi new file +30 -0
new file mode 100644
index 0000000..122c134
@@ -0,0 +1,30 @@
+/include/ "skeleton.dtsi"
+
+/ {
+     model = "NVIDIA Tegra30";
+     compatible = "nvidia,tegra30";
+
+     clocks {
+             #address-cells = <1>;
+             #size-cells = <0>;
+
+             osc: clock {
+                     compatible = "fixed-clock";
+                     #clock-cells = <0>;
+             };
+     };
+
+     gpio: gpio at 6000d000 {
+             compatible = "nvidia,tegra30-gpio", "nvidia,tegra20-gpio";
+             reg = <0x6000d000 0x1000>;
+             #gpio-cells = <2>;
+             gpio-controller;
+     };
+
+     serial at 70006000 {
+             compatible = "nvidia,tegra30-uart", "nvidia,tegra20-uart";
+             reg = <0x70006000 0x40>;
+             reg-shift = <2>;
+             status = "disabled";
+     };
+};
board/nvidia/dts/tegra30-cardhu.dts new file +23 -0
new file mode 100644
index 0000000..68563e8
@@ -0,0 +1,35 @@
+/dts-v1/;
+
+/memreserve/ 0x1c000000 0x04000000;
+/include/ ARCH_CPU_DTS
+
+/ {
+     model = "NVIDIA Cardhu";
+     compatible = "nvidia,cardhu", "nvidia,tegra30";
+
+     aliases {
+     };
+
+        memory {
+                device_type = "memory";
+                reg = <0x80000000 0xc0000000>;
+        };
+
+     clocks {
+             clk_32k: clk_32k {
+                     clock_frequency = <32000>;
+             };
+             osc {
+                     clock-frequency = <12000000>;
Quoted 8 lines

board/nvidia/dts/tegra30-cardhu.dts line 29

Quoted 6 lines
board/nvidia/dts/tegra30-cardhu.dts new file +6 -0
+             };
+     };
+
+     clock at 60006000 {
+             clocks = <&clk_32k &osc>;
+     };

Is this clock thing really needed? I don't think we are doing anything with those DT entries.

During bringup, I tried stripping down our internal DT files for Cardhu to the absolute minimum that'd still boot.
AFAIR, clock entries were essential. Regardless, as periphs/drivers are brought up in future days, this'll all begin to grow.

Tom

Quoted 9 lines
Quoted 7 lines
board/nvidia/dts/tegra30-cardhu.dts new file +6 -0
+
+     serial at 70006000 {
+             status = "ok";
+             clock-frequency = < 216000000 >;
+     };
+};
#19 lore raw

PATCH 5/7 Tegra30: Cardhu: Add DT files

In reply to Tom Warren
Quoted 11 lines · Tom Warren

These are stripped down for bringup, They'll be filled out later to match-up with the kernel DT contents, and/or as devices are brought up (mmc, usb, spi, etc.).

arch/arm/dts/tegra30.dtsi +5 -0
 
+/include/ "skeleton.dtsi"
+
+/ {
+	model = "NVIDIA Tegra30";
+	compatible = "nvidia,tegra30";

arch/arm/dts/tegra30.dtsi line 15

Quoted 10 lines
arch/arm/dts/tegra30.dtsi +10 -0
+
+	clocks {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		osc: clock {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+		};
+	};

Nothing uses any of the clock stuff; I don't think we should add this until it's needed.

arch/arm/dts/tegra30.dtsi line 22

Quoted 6 lines
arch/arm/dts/tegra30.dtsi +6 -0
+	gpio: gpio at 6000d000 {
+		compatible = "nvidia,tegra30-gpio", "nvidia,tegra20-gpio";
+		reg = <0x6000d000 0x1000>;
+		#gpio-cells = <2>;
+		gpio-controller;
+	};

Similarly, nothing uses this.

arch/arm/dts/tegra30.dtsi line 27

Quoted 4 lines
arch/arm/dts/tegra30.dtsi +4 -0
+	serial at 70006000 {
+		compatible = "nvidia,tegra30-uart", "nvidia,tegra20-uart";
+		reg = <0x70006000 0x40>;
+		reg-shift = <2>;

This needs the following extra line here:

                interrupts = <0 36 0x04>;

arch/arm/dts/tegra30.dtsi

Quoted 2 lines
arch/arm/dts/tegra30.dtsi +2 -0
+		status = "disabled";
+	};

Although again, nothing uses this, so may as well omit it.

Quoted 7 lines
board/nvidia/dts/tegra30-cardhu.dts new file +1 -0
new file mode 100644
index 0000000..68563e8
@@ -0,0 +1,35 @@
+/dts-v1/;

board/nvidia/dts/tegra30-cardhu.dts line 11

Quoted 10 lines
board/nvidia/dts/tegra30-cardhu.dts new file +10 -0
+
+/memreserve/ 0x1c000000 0x04000000;
+/include/ ARCH_CPU_DTS
+
+/ {
+	model = "NVIDIA Cardhu";
+	compatible = "nvidia,cardhu", "nvidia,tegra30";
+
+	aliases {
+	};

May as well leave that out until it's needed.

board/nvidia/dts/tegra30-cardhu.dts line 16

Quoted 4 lines
board/nvidia/dts/tegra30-cardhu.dts new file +4 -0
+        memory {
+                device_type = "memory";
+                reg = <0x80000000 0xc0000000>;
+        };

There's an indentation error there.

Quoted 9 lines
board/nvidia/dts/tegra30-cardhu.dts new file +9 -0
+
+	clocks {
+		clk_32k: clk_32k {
+			clock_frequency = <32000>;
+		};
+		osc {
+			clock-frequency = <12000000>;
+		};
+	};

board/nvidia/dts/tegra30-cardhu.dts line 35

Quoted 10 lines
board/nvidia/dts/tegra30-cardhu.dts new file +10 -0
+
+	clock at 60006000 {
+		clocks = <&clk_32k &osc>;
+	};
+
+	serial at 70006000 {
+		status = "ok";
+		clock-frequency = < 216000000 >;
+	};
+};

Similarly, I don't think anything uses any of that.

author
#20 lore raw

PATCH 5/7 Tegra30: Cardhu: Add DT files

Stephen,

Quoted 89 lines · Stephen Warren
Quoted 11 lines · Tom Warren

These are stripped down for bringup, They'll be filled out later to match-up with the kernel DT contents, and/or as devices are brought up (mmc, usb, spi, etc.).

arch/arm/dts/tegra30.dtsi +5 -0
 
+/include/ "skeleton.dtsi"
+
+/ {
+     model = "NVIDIA Tegra30";
+     compatible = "nvidia,tegra30";

arch/arm/dts/tegra30.dtsi line 15

Quoted 10 lines
arch/arm/dts/tegra30.dtsi +10 -0
+
+     clocks {
+             #address-cells = <1>;
+             #size-cells = <0>;
+
+             osc: clock {
+                     compatible = "fixed-clock";
+                     #clock-cells = <0>;
+             };
+     };

Nothing uses any of the clock stuff; I don't think we should add this until it's needed.

arch/arm/dts/tegra30.dtsi line 22

Quoted 6 lines
arch/arm/dts/tegra30.dtsi +6 -0
+     gpio: gpio at 6000d000 {
+             compatible = "nvidia,tegra30-gpio", "nvidia,tegra20-gpio";
+             reg = <0x6000d000 0x1000>;
+             #gpio-cells = <2>;
+             gpio-controller;
+     };

Similarly, nothing uses this.

arch/arm/dts/tegra30.dtsi line 27

Quoted 4 lines
arch/arm/dts/tegra30.dtsi +4 -0
+     serial at 70006000 {
+             compatible = "nvidia,tegra30-uart", "nvidia,tegra20-uart";
+             reg = <0x70006000 0x40>;
+             reg-shift = <2>;

This needs the following extra line here:

                interrupts = <0 36 0x04>;

arch/arm/dts/tegra30.dtsi

Quoted 2 lines
arch/arm/dts/tegra30.dtsi +2 -0
+             status = "disabled";
+     };

Although again, nothing uses this, so may as well omit it.

Quoted 7 lines
board/nvidia/dts/tegra30-cardhu.dts new file +1 -0
new file mode 100644
index 0000000..68563e8
@@ -0,0 +1,35 @@
+/dts-v1/;

board/nvidia/dts/tegra30-cardhu.dts line 11

Quoted 10 lines
board/nvidia/dts/tegra30-cardhu.dts new file +10 -0
+
+/memreserve/ 0x1c000000 0x04000000;
+/include/ ARCH_CPU_DTS
+
+/ {
+     model = "NVIDIA Cardhu";
+     compatible = "nvidia,cardhu", "nvidia,tegra30";
+
+     aliases {
+     };

May as well leave that out until it's needed.

board/nvidia/dts/tegra30-cardhu.dts line 16

Quoted 4 lines
board/nvidia/dts/tegra30-cardhu.dts new file +4 -0
+        memory {
+                device_type = "memory";
+                reg = <0x80000000 0xc0000000>;
+        };

There's an indentation error there.

Quoted 13 lines
board/nvidia/dts/tegra30-cardhu.dts new file +13 -0
+
+     clocks {
+             clk_32k: clk_32k {
+                     clock_frequency = <32000>;
+             };
+             osc {
+                     clock-frequency = <12000000>;
+             };
+     };
+
+     clock at 60006000 {
+             clocks = <&clk_32k &osc>;
+     };
Quoted 9 lines

board/nvidia/dts/tegra30-cardhu.dts line 35

Quoted 6 lines
board/nvidia/dts/tegra30-cardhu.dts new file +6 -0
+
+     serial at 70006000 {
+             status = "ok";
+             clock-frequency = < 216000000 >;
+     };
+};

Similarly, I don't think anything uses any of that.

I stripped these both down to bare minimums as per your review, and I can still build/boot on Cardhu. When I tried to remove some of these entries earlier (clock, etc.) I guess I wasn't editing _both_ files at the same time, so it would build or would hang.

Next rev will have truly minimal DT files. Thanks.

author
#21 lore raw

PATCH 6/7 Tegra30: Add generic Tegra30 build support

In reply to Tom Warren

This patch adds basic Tegra30 (T30) build support - no specific board is targeted.

---
 Makefile                    |    6 +++---
 arch/arm/cpu/armv7/Makefile |    2 +-
 arch/arm/cpu/armv7/start.S  |    4 ++--
 board/nvidia/common/board.c |   26 ++++++++++++++++++++++++--
 include/serial.h            |    2 +-
 spl/Makefile                |    2 +-
 6 files changed, 32 insertions(+), 10 deletions(-)
Makefile +3 -3
index 614f6fe..d7e2c2f 100644
@@ -323,7 +323,7 @@ endif
 ifeq ($(SOC),exynos)
 LIBS-y += $(CPUDIR)/s5p-common/libs5p-common.o
 endif
-ifeq ($(SOC),tegra20)
+ifneq ($(CONFIG_TEGRA),)
 LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o
 LIBS-y += arch/$(ARCH)/cpu/tegra-common/libcputegra-common.o
 LIBS-y += $(CPUDIR)/tegra-common/libtegra-common.o
@@ -387,7 +387,7 @@ ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
 ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
 
 # enable combined SPL/u-boot/dtb rules for tegra
-ifeq ($(SOC),tegra20)
+ifneq ($(CONFIG_TEGRA),)
 ifeq ($(CONFIG_OF_SEPARATE),y)
 ALL-y += $(obj)u-boot-dtb-tegra.bin
 else
@@ -494,7 +494,7 @@ $(obj)u-boot.spr:	$(obj)u-boot.img $(obj)spl/u-boot-spl.bin
 			conv=notrunc 2>/dev/null
 		cat $(obj)spl/u-boot-spl-pad.img $(obj)u-boot.img > $@
 
-ifeq ($(SOC),tegra20)
+ifneq ($(CONFIG_TEGRA),)
 ifeq ($(CONFIG_OF_SEPARATE),y)
 $(obj)u-boot-dtb-tegra.bin:	$(obj)spl/u-boot-spl.bin $(obj)u-boot.bin $(obj)u-boot.dtb
 		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
arch/arm/cpu/armv7/Makefile +1 -1
index 4fdbee4..ee8c2b3 100644
@@ -32,7 +32,7 @@ COBJS	+= cache_v7.o
 COBJS	+= cpu.o
 COBJS	+= syslib.o
 
-ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20),)
+ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA),)
 SOBJS	+= lowlevel_init.o
 endif
 
arch/arm/cpu/armv7/start.S +2 -2
index f26308d..11317b0 100644
@@ -272,12 +272,12 @@ jump_2_ram:
 /*
  * Move vector table
  */
-#if !defined(CONFIG_TEGRA20)
+#if !defined(CONFIG_TEGRA)
 	/* Set vector address in CP15 VBAR register */
 	ldr     r0, =_start
 	add     r0, r0, r9
 	mcr     p15, 0, r0, c12, c0, 0  @Set VBAR
-#endif /* !Tegra20 */
+#endif /* !Tegra */
 
 	ldr	r0, _board_init_r_ofs
 	adr	r1, _start
board/nvidia/common/board.c +24 -2
index 2c7cd0d..151d972 100644
@@ -31,15 +31,20 @@
 #include <asm/arch/pinmux.h>
 #include <asm/arch/pmu.h>
 #include <asm/arch/tegra.h>
-#include <asm/arch/usb.h>
 #include <asm/arch-tegra/board.h>
 #include <asm/arch-tegra/clk_rst.h>
 #include <asm/arch-tegra/pmc.h>
 #include <asm/arch-tegra/sys_proto.h>
 #include <asm/arch-tegra/uart.h>
 #include <asm/arch-tegra/warmboot.h>
-#include <spi.h>
+#ifdef CONFIG_USB_EHCI_TEGRA
+#include <asm/arch/usb.h>
+#endif
+#ifdef CONFIG_TEGRA30
+#include <asm/arch/pinmux-config-common.h>
+#endif
 #include <i2c.h>
+#include <spi.h>
 #include "emc.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -101,6 +106,21 @@ static void power_det_init(void)
 }
 
 /*
+ * Routine: pinmux_init
+ * Description: Do individual peripheral pinmux configs
+ */
+static void pinmux_init(void)
+{
+#if defined(CONFIG_TEGRA30)
+	pinmux_config_table(tegra3_pinmux_common,
+		ARRAY_SIZE(tegra3_pinmux_common));
+
+	pinmux_config_table(unused_pins_lowpower,
+		ARRAY_SIZE(unused_pins_lowpower));
+#endif
+}
+
+/*
  * Routine: board_init
  * Description: Early hardware init.
  */
@@ -169,6 +189,8 @@ void gpio_early_init(void) __attribute__((weak, alias("__gpio_early_init")));
 
 int board_early_init_f(void)
 {
+	pinmux_init();
+
 	board_init_uart_f();
 
 	/* Initialize periph GPIOs */
include/serial.h +1 -1
index d76d6df..75d76e6 100644
@@ -31,7 +31,7 @@ extern struct serial_device *default_serial_console(void);
 	defined(CONFIG_MB86R0x) || defined(CONFIG_MPC5xxx) || \
 	defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) || \
 	defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520) || \
-	defined(CONFIG_TEGRA20) || defined(CONFIG_SYS_COREBOOT) || \
+	defined(CONFIG_TEGRA) || defined(CONFIG_SYS_COREBOOT) || \
 	defined(CONFIG_MICROBLAZE)
 extern struct serial_device serial0_device;
 extern struct serial_device serial1_device;
spl/Makefile +1 -1
index 8c6dcbd..7d6df9d 100644
@@ -62,7 +62,7 @@ ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),)
 LIBS-y += $(CPUDIR)/omap-common/libomap-common.o
 endif
 
-ifeq ($(SOC),tegra20)
+ifneq ($(CONFIG_TEGRA),)
 LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o
 LIBS-y += arch/$(ARCH)/cpu/tegra-common/libcputegra-common.o
 LIBS-y += $(CPUDIR)/tegra-common/libtegra-common.o
Signature · 1 line
1.7.0.4
#22 lore raw

PATCH 6/7 Tegra30: Add generic Tegra30 build support

board/nvidia/common/board.c line 42

Quoted 9 lines · Tom Warren

This patch adds basic Tegra30 (T30) build support - no specific board is targeted.

board/nvidia/common/board.c +3 -0
 
+#ifdef CONFIG_USB_EHCI_TEGRA
+#include <asm/arch/usb.h>
+#endif

That seems unrelated.

Quoted 3 lines
board/nvidia/common/board.c +3 -0
+#ifdef CONFIG_TEGRA30
+#include <asm/arch/pinmux-config-common.h>
+#endif

...

Quoted 4 lines

/*
+ * Routine: pinmux_init
+ * Description: Do individual peripheral pinmux configs
+ */

board/nvidia/common/board.c static void power_det_init(void) · line 121

Quoted 10 lines
board/nvidia/common/board.c +10 -0
+static void pinmux_init(void)
+{
+#if defined(CONFIG_TEGRA30)
+	pinmux_config_table(tegra3_pinmux_common,
+		ARRAY_SIZE(tegra3_pinmux_common));
+
+	pinmux_config_table(unused_pins_lowpower,
+		ARRAY_SIZE(unused_pins_lowpower));
+#endif
+}

I think that should be done by the Cardhu board file, since the data is Cardhu-specific.

author
#23 lore raw

PATCH 6/7 Tegra30: Add generic Tegra30 build support

Stephen,

Quoted 5 lines · Stephen Warren
Quoted 3 lines · Tom Warren

This patch adds basic Tegra30 (T30) build support - no specific board is targeted.

Quoted 7 lines

board/nvidia/common/board.c line 42

Quoted 5 lines
board/nvidia/common/board.c +3 -0
 
+#ifdef CONFIG_USB_EHCI_TEGRA
+#include <asm/arch/usb.h>
+#endif

That seems unrelated.

It's related because I don't have a usb.h file for Tegra30 yet (not used/needed), and this is a common file, so I have to #ifdef the inclusion or Cardhu won't build. I could put an empty usb.h file in arch-tegra30, but I don't like that approach and there's a need for this if someone turns off USB support in a Tegra20 build. The code further down in the file uses the same #ifdef.

Quoted 14 lines
Quoted 4 lines
board/nvidia/common/board.c +3 -0
+#ifdef CONFIG_TEGRA30
+#include <asm/arch/pinmux-config-common.h>
+#endif

...

Quoted 9 lines

/*
+ * Routine: pinmux_init
+ * Description: Do individual peripheral pinmux configs
+ */

board/nvidia/common/board.c +5 -0
+static void pinmux_init(void)
+{
+#if defined(CONFIG_TEGRA30)
+     pinmux_config_table(tegra3_pinmux_common,
+             ARRAY_SIZE(tegra3_pinmux_common));
Quoted 8 lines

board/nvidia/common/board.c static void power_det_init(void) · line 121

Quoted 5 lines
board/nvidia/common/board.c +5 -0
+
+     pinmux_config_table(unused_pins_lowpower,
+             ARRAY_SIZE(unused_pins_lowpower));
+#endif
+}

I think that should be done by the Cardhu board file, since the data is Cardhu-specific.

If I move pinmux_init to cardhu.c, I'll need matching (empty) funcs in all the other board files, since it's called in board_early_init_f later in board.c. Or it could be made a weak function that's only overridden in cardhu files. But all this is more that I wanted to change in this first pass of T30/Cardhu support - I didn't want to touch any of the Tegra20 builds that I didn't have to.

Tom

#24 lore raw

PATCH 6/7 Tegra30: Add generic Tegra30 build support

Quoted 16 lines · Tom Warren

Stephen,

Quoted 5 lines · Stephen Warren
Quoted 3 lines · Tom Warren

This patch adds basic Tegra30 (T30) build support - no specific board is targeted.

Quoted 7 lines

board/nvidia/common/board.c line 42

Quoted 5 lines
board/nvidia/common/board.c +3 -0
 
+#ifdef CONFIG_USB_EHCI_TEGRA
+#include <asm/arch/usb.h>
+#endif

That seems unrelated.

Quoted 6 lines

It's related because I don't have a usb.h file for Tegra30 yet (not used/needed), and this is a common file, so I have to #ifdef the inclusion or Cardhu won't build. I could put an empty usb.h file in arch-tegra30, but I don't like that approach and there's a need for this if someone turns off USB support in a Tegra20 build. The code further down in the file uses the same #ifdef.

Ah right, that makes sense.

Quoted 22 lines
Quoted 13 lines
Quoted 3 lines
board/nvidia/common/board.c +3 -0
+#ifdef CONFIG_TEGRA30
+#include <asm/arch/pinmux-config-common.h>
+#endif

...

Quoted 9 lines

/*
+ * Routine: pinmux_init
+ * Description: Do individual peripheral pinmux configs
+ */

board/nvidia/common/board.c +5 -0
+static void pinmux_init(void)
+{
+#if defined(CONFIG_TEGRA30)
+     pinmux_config_table(tegra3_pinmux_common,
+             ARRAY_SIZE(tegra3_pinmux_common));
Quoted 8 lines

board/nvidia/common/board.c static void power_det_init(void) · line 121

Quoted 5 lines
board/nvidia/common/board.c +5 -0
+
+     pinmux_config_table(unused_pins_lowpower,
+             ARRAY_SIZE(unused_pins_lowpower));
+#endif
+}

I think that should be done by the Cardhu board file, since the data is Cardhu-specific.

Quoted 6 lines

If I move pinmux_init to cardhu.c, I'll need matching (empty) funcs in all the other board files, since it's called in board_early_init_f later in board.c. Or it could be made a weak function that's only overridden in cardhu files. But all this is more that I wanted to change in this first pass of T30/Cardhu support - I didn't want to touch any of the Tegra20 builds that I didn't have to.

A weak function certainly seems the way to go; all (or at least most of) the other per-device pinmux/GPIO setup functions are all implemented this way now.

author
#25 lore raw

PATCH 7/7 Tegra30: Add/enable Cardhu build (T30 reference board)

In reply to Tom Warren

This build is stripped down. It boots to the command prompt. GPIO is the only peripheral supported. Others TBD.

---
 board/nvidia/{whistler => cardhu}/Makefile         |    4 ++
 .../cpu/cpu.c => board/nvidia/cardhu/cardhu.c      |    8 ++--
 boards.cfg                                         |    1 +
 .../gp_padctrl.h => include/configs/cardhu.h       |   37 +++++++++----
 .../configs/{tegra20-common.h => tegra30-common.h} |   54 +++++---------------
 5 files changed, 48 insertions(+), 56 deletions(-)
 copy board/nvidia/{whistler => cardhu}/Makefile (94%)
 copy arch/microblaze/cpu/cpu.c => board/nvidia/cardhu/cardhu.c (88%)
 copy arch/arm/include/asm/arch-tegra/gp_padctrl.h => include/configs/cardhu.h (55%)
 copy include/configs/{tegra20-common.h => tegra30-common.h} (77%)
board/nvidia/cardhu/Makefile renamed from board/nvidia/whistler/Makefile +4 -0
similarity index 94%
copy from board/nvidia/whistler/Makefile
copy to board/nvidia/cardhu/Makefile
index 913f1ce..a910577 100644
@@ -24,6 +24,10 @@
 
 include $(TOPDIR)/config.mk
 
+ifneq ($(OBJTREE),$(SRCTREE))
+$(shell mkdir -p $(obj)../common)
+endif
+
 LIB	= $(obj)lib$(BOARD).o
 
 COBJS	:= $(BOARD).o
board/nvidia/cardhu/cardhu.c renamed from arch/microblaze/cpu/cpu.c +4 -4
similarity index 88%
copy from arch/microblaze/cpu/cpu.c
copy to board/nvidia/cardhu/cardhu.c
index 4d2b270..69b89db 100644
@@ -1,7 +1,6 @@
 /*
- * (C) Copyright 2004 Atmark Techno, Inc.
- *
- * Yasushi SHOJI <[email protected]>
+ *  (C) Copyright 2010-2012
+ *  NVIDIA Corporation <www.nvidia.com>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -22,4 +21,5 @@
  * MA 02111-1307 USA
  */
 
-/* EMPTY FILE */
+#include <common.h>
+
boards.cfg +1 -0
index 4ae6656..7fb17ca 100644
@@ -270,6 +270,7 @@ harmony                      arm         armv7:arm720t harmony           nvidia
 seaboard                     arm         armv7:arm720t seaboard          nvidia         tegra20
 ventana                      arm         armv7:arm720t ventana           nvidia         tegra20
 whistler                     arm         armv7:arm720t whistler          nvidia         tegra20
+cardhu                       arm         armv7:arm720t cardhu            nvidia         tegra30
 u8500_href                   arm         armv7       u8500               st-ericsson    u8500
 snowball                     arm         armv7       snowball               st-ericsson    u8500
 actux1_4_16                  arm         ixp         actux1              -              -           actux1:FLASH2X2
include/configs/cardhu.h renamed from arch/arm/include/asm/arch-tegra/gp_padctrl.h +26 -11
similarity index 55%
copy from arch/arm/include/asm/arch-tegra/gp_padctrl.h
copy to include/configs/cardhu.h
index d347e97..bfadbff 100644
@@ -21,17 +21,32 @@
  * MA 02111-1307 USA
  */
 
-#ifndef _TEGRA_GP_PADCTRL_H_
-#define _TEGRA_GP_PADCTRL_H_
+#ifndef __CONFIG_H
+#define __CONFIG_H
 
-/* bit fields definitions for APB_MISC_GP_HIDREV register */
-#define HIDREV_CHIPID_SHIFT		8
-#define HIDREV_CHIPID_MASK		(0xff << HIDREV_CHIPID_SHIFT)
-#define HIDREV_MAJORPREV_SHIFT		4
-#define HIDREV_MAJORPREV_MASK		(0xf << HIDREV_MAJORPREV_SHIFT)
+#include <asm/sizes.h>
 
-/* CHIPID field returned from APB_MISC_GP_HIDREV register */
-#define CHIPID_TEGRA20				0x20
-#define CHIPID_TEGRA30				0x30
+#include "tegra30-common.h"
 
-#endif	/* _TEGRA_GP_PADCTRL_H_ */
+/* Enable fdt support for Cardhu. Flash the image in u-boot-dtb.bin */
+#define CONFIG_DEFAULT_DEVICE_TREE	tegra30-cardhu
+#define CONFIG_OF_CONTROL
+#define CONFIG_OF_SEPARATE
+
+/* High-level configuration options */
+#define V_PROMPT		"Tegra30 (Cardhu) # "
+#define CONFIG_TEGRA_BOARD_STRING	"NVIDIA Cardhu"
+
+/* Board-specific serial config */
+#define CONFIG_SERIAL_MULTI
+#define CONFIG_TEGRA_ENABLE_UARTA
+#define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTA_BASE
+
+#define CONFIG_MACH_TYPE		MACH_TYPE_CARDHU
+
+#define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_ENV_IS_NOWHERE
+
+#include "tegra-common-post.h"
+
+#endif /* __CONFIG_H */
include/configs/tegra30-common.h renamed from include/configs/tegra20-common.h +13 -41

111 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#26 lore raw

PATCH 7/7 Tegra30: Add/enable Cardhu build (T30 reference board)

Quoted 11 lines · Tom Warren

This build is stripped down. It boots to the command prompt. GPIO is the only peripheral supported. Others TBD.

board/nvidia/cardhu/Makefile renamed from board/nvidia/whistler/Makefile +0 -0
similarity index 94%
copy from board/nvidia/whistler/Makefile
copy to board/nvidia/cardhu/Makefile
index 913f1ce..a910577 100644

board/nvidia/cardhu/Makefile line 29

Quoted 6 lines
board/nvidia/cardhu/Makefile renamed from board/nvidia/whistler/Makefile +3 -0
@@ -24,6 +24,10 @@
 
 include $(TOPDIR)/config.mk
 
+ifneq ($(OBJTREE),$(SRCTREE))
+$(shell mkdir -p $(obj)../common)
+endif

Hmm. Surely both or neither Whistler and Cardhu need this? Either this isn't needed, or it's wrong in Whistler before this series.

include/configs/cardhu.h

Quoted 5 lines
include/configs/cardhu.h renamed from arch/arm/include/asm/arch-tegra/gp_padctrl.h +0 -0
similarity index 55%
copy from arch/arm/include/asm/arch-tegra/gp_padctrl.h
copy to include/configs/cardhu.h
index d347e97..bfadbff 100644

Uggh. git format-patch is certainly being over-zealous there, and equally failing to find the presumably much more familiar other Tegra config files:-(

include/configs/tegra30-common.h

Quoted 4 lines
include/configs/tegra30-common.h renamed from include/configs/tegra20-common.h +0 -0
similarity index 77%
copy from include/configs/tegra20-common.h
copy to include/configs/tegra30-common.h

Rather than duplicating this whole file, I wonder if it wouldn't be better to have tegra*-common.h include tegra-common.h with all the common stuff, and factor it out.

include/configs/tegra30-common.h line 99

Quoted 2 lines
include/configs/tegra30-common.h renamed from include/configs/tegra20-common.h +0 -2
-#define CONFIG_SYS_BAUDRATE_TABLE	{4800, 9600, 19200, 38400, 57600,\
-					115200}

We should remove that from tegra20-common.h

include/configs/tegra30-common.h line 117

Quoted 4 lines

/* include default commands */
#include <config_cmd_default.h>

include/configs/tegra30-common.h renamed from include/configs/tegra20-common.h +0 -2
-#define CONFIG_PARTITION_UUIDS
-#define CONFIG_CMD_PART

Seems like this should be the same on all Tegra.

include/configs/tegra30-common.h

Quoted 5 lines
include/configs/tegra30-common.h renamed from include/configs/tegra20-common.h +2 -2
-#define CONFIG_LOADADDR		0x408000	/* def. location for kernel */
+#define CONFIG_LOADADDR		0x80408000	/* def. location for kernel */
 
-#define CONFIG_SYS_LOAD_ADDR		(0xA00800)	/* default */
+#define CONFIG_SYS_LOAD_ADDR		(0x80A00800)	/* default */

Should LOADADDR and SYS_LOAD_ADDR match? Is only one of those useful?

include/configs/tegra30-common.h line 142

Quoted 2 lines
include/configs/tegra30-common.h renamed from include/configs/tegra20-common.h +1 -1
-#define CONFIG_STACKBASE	0x2800000	/* 40MB */
+#define CONFIG_STACKBASE	0x82800000	/* 40MB */

Oh, how long is that used for? I hope the stack is dynamically allocated during relocation... That (existing Tegra20) value clashes with the ramdisk_addr_r I picked in my recent patch "ARM: tegra: use standard variables to define load addresses".

include/configs/tegra30-common.h line 151

Quoted 2 lines
include/configs/tegra30-common.h renamed from include/configs/tegra20-common.h +1 -1
-#define CONFIG_SYS_TEXT_BASE	0x0010c000
+#define CONFIG_SYS_TEXT_BASE	0x8010e000

Why not 8010c0000? Is the SPL so large it doesn't fit? I suppose it's fine to have different SPL sizes on the two SoCs.

author
#27 lore raw

PATCH 7/7 Tegra30: Add/enable Cardhu build (T30 reference board)

Stephen,

Quoted 13 lines · Stephen Warren
Quoted 12 lines · Tom Warren

This build is stripped down. It boots to the command prompt. GPIO is the only peripheral supported. Others TBD.

board/nvidia/cardhu/Makefile renamed from board/nvidia/whistler/Makefile +0 -0
similarity index 94%
copy from board/nvidia/whistler/Makefile
copy to board/nvidia/cardhu/Makefile
index 913f1ce..a910577 100644
@@ -24,6 +24,10 @@
 
Quoted 8 lines

board/nvidia/cardhu/Makefile line 29

Quoted 5 lines
board/nvidia/cardhu/Makefile renamed from board/nvidia/whistler/Makefile +3 -0
 include $(TOPDIR)/config.mk
 
+ifneq ($(OBJTREE),$(SRCTREE))
+$(shell mkdir -p $(obj)../common)
+endif

Hmm. Surely both or neither Whistler and Cardhu need this? Either this isn't needed, or it's wrong in Whistler before this series.

This work was done on current u-boot-tegra/next (actually on next-before-last, then rebased before creating the patches), but this is git-format being overzealous with -C -C - I got this Makefile from our internal repo, IIRC. The ..common stuff isn't needed, as you say. I'll remove it in v2. Whistler's Makefile in current /next is OK.

Quoted 10 lines

include/configs/cardhu.h

Quoted 6 lines
include/configs/cardhu.h renamed from arch/arm/include/asm/arch-tegra/gp_padctrl.h +0 -0
similarity index 55%
copy from arch/arm/include/asm/arch-tegra/gp_padctrl.h
copy to include/configs/cardhu.h
index d347e97..bfadbff 100644

Uggh. git format-patch is certainly being over-zealous there, and equally failing to find the presumably much more familiar other Tegra config files:-(

Yep. I wanted to use -C -C because it did get the closest source right most of the time - without it every file just looks like a new file w/gazillions of new lines. In this case, though (and in cardhu.c), it got it wrong.

Quoted 9 lines

include/configs/tegra30-common.h

Quoted 5 lines
include/configs/tegra30-common.h renamed from include/configs/tegra20-common.h +0 -0
similarity index 77%
copy from include/configs/tegra20-common.h
copy to include/configs/tegra30-common.h

Rather than duplicating this whole file, I wonder if it wouldn't be better to have tegra*-common.h include tegra-common.h with all the common stuff, and factor it out.

It would be better, but something I was hoping to leave til later. But I'll do it in v2 of this patch series.

Quoted 5 lines

include/configs/tegra30-common.h line 99

Quoted 3 lines
include/configs/tegra30-common.h renamed from include/configs/tegra20-common.h +0 -2
-#define CONFIG_SYS_BAUDRATE_TABLE    {4800, 9600, 19200, 38400, 57600,\
-                                     115200}

We should remove that from tegra20-common.h

I tried to avoid T20-only edits because I wanted this series to be T30-only as much as possible. But if I'm gonna merge 'em, I can take it out then.

Quoted 8 lines

include/configs/tegra30-common.h line 117

Quoted 5 lines

/* include default commands */
#include <config_cmd_default.h>

include/configs/tegra30-common.h renamed from include/configs/tegra20-common.h +0 -2
-#define CONFIG_PARTITION_UUIDS
-#define CONFIG_CMD_PART

Seems like this should be the same on all Tegra.

Quoted 7 lines

include/configs/tegra30-common.h

Quoted 5 lines
include/configs/tegra30-common.h renamed from include/configs/tegra20-common.h +2 -2
-#define CONFIG_LOADADDR              0x408000        /* def. location for kernel */
+#define CONFIG_LOADADDR              0x80408000      /* def. location for kernel */
 
-#define CONFIG_SYS_LOAD_ADDR         (0xA00800)      /* default */
+#define CONFIG_SYS_LOAD_ADDR         (0x80A00800)    /* default */

Should LOADADDR and SYS_LOAD_ADDR match? Is only one of those useful?

I grepped around a bit and it seems some code uses LOADADDR and some uses SYS_LOAD_ADDR, and some config files make one == the other. So I left 'em both in, with new T30-compatible addresses. If someone wants to see if one can be dropped at a later date, that's cool.

Quoted 8 lines

include/configs/tegra30-common.h line 142

Quoted 3 lines
include/configs/tegra30-common.h renamed from include/configs/tegra20-common.h +1 -1
-#define CONFIG_STACKBASE     0x2800000       /* 40MB */
+#define CONFIG_STACKBASE     0x82800000      /* 40MB */

Oh, how long is that used for? I hope the stack is dynamically allocated during relocation... That (existing Tegra20) value clashes with the ramdisk_addr_r I picked in my recent patch "ARM: tegra: use standard variables to define load addresses".

Don't know how/when it's used, just ported it to T30 addressing. I can look into it in V2.

Quoted 6 lines

include/configs/tegra30-common.h line 151

Quoted 3 lines
include/configs/tegra30-common.h renamed from include/configs/tegra20-common.h +1 -1
-#define CONFIG_SYS_TEXT_BASE 0x0010c000
+#define CONFIG_SYS_TEXT_BASE 0x8010e000

Why not 8010c0000? Is the SPL so large it doesn't fit? I suppose it's fine to have different SPL sizes on the two SoCs.

Yep, in my initial porting to T30, SPL was too big to fit into 16K, so I bumped it to 24K. I'll revisit the SPL size after commonizing cpu.c to see if it's shrunk enough to fit now.

Thanks,

Tom

#28 lore raw

cover Add T30 Cardhu support

In reply to Tom Warren
Quoted 7 lines · Tom Warren

This patch series adds basic (boot to cmd prompt) support for Tegra30. This is based on the Tegra20 SPL, which inits the AVP (ARM7TDMI boot proc) first, then control is transferred to the CPU (A9 quad core). It is based on current u-boot-tegra/next.

Future patches will add support/drivers for MMC/USB/I2C/SPI/etc. The Cardhu T30 board is supported initially.

The series,

I'll provide review comments later.