diff mbox

[U-Boot,9/9] Tegra30: Enable Cardhu build (SPL)

Message ID 1347487855-27077-10-git-send-email-twarren@nvidia.com
State Changes Requested
Delegated to: Tom Rini
Headers show

Commit Message

Tom Warren Sept. 12, 2012, 10:10 p.m. UTC
This builds & boots to the command prompt on a Cardhu (T30) board.
This is a barebones binary - no I2C, USB, MMC, SPI, etc.
Drivers for those peripherals to follow.

Signed-off-by: Tom Warren <twarren@nvidia.com>
---
 Makefile                    |   23 +++++++++++++++++++++++
 arch/arm/cpu/armv7/Makefile |    2 +-
 arch/arm/cpu/armv7/start.S  |    4 ++--
 boards.cfg                  |    1 +
 drivers/gpio/tegra_gpio.c   |    4 ++++
 include/serial.h            |    3 ++-
 spl/Makefile                |    3 +++
 7 files changed, 36 insertions(+), 4 deletions(-)

Comments

Tom Rini Sept. 13, 2012, 6 p.m. UTC | #1
On 09/12/2012 03:10 PM, Tom Warren wrote:
> This builds & boots to the command prompt on a Cardhu (T30) board.
> This is a barebones binary - no I2C, USB, MMC, SPI, etc.
> Drivers for those peripherals to follow.
> 
> Signed-off-by: Tom Warren <twarren@nvidia.com>
[snip]
> -ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20),)
> +ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20)$(CONFIG_TEGRA30),)
[snip]
> -	defined(CONFIG_TEGRA20) || defined(CONFIG_SYS_COREBOOT)
> +	defined(CONFIG_TEGRA20) || defined(CONFIG_SYS_COREBOOT) || \
> +	defined(CONFIG_TEGRA30)

In both of these cases I think you should just switch to CONFIG_TEGRA
rather than TEGRA20 || TEGRA30 and if TEGRA40 somehow invalidates this
logic we can deal with it then but assume it won't.
Tom Warren Sept. 13, 2012, 8:02 p.m. UTC | #2
Tom,

On Thu, Sep 13, 2012 at 11:00 AM, Tom Rini <trini@ti.com> wrote:
> On 09/12/2012 03:10 PM, Tom Warren wrote:
>> This builds & boots to the command prompt on a Cardhu (T30) board.
>> This is a barebones binary - no I2C, USB, MMC, SPI, etc.
>> Drivers for those peripherals to follow.
>>
>> Signed-off-by: Tom Warren <twarren@nvidia.com>
> [snip]
>> -ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20),)
>> +ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20)$(CONFIG_TEGRA30),)
> [snip]
>> -     defined(CONFIG_TEGRA20) || defined(CONFIG_SYS_COREBOOT)
>> +     defined(CONFIG_TEGRA20) || defined(CONFIG_SYS_COREBOOT) || \
>> +     defined(CONFIG_TEGRA30)
>
> In both of these cases I think you should just switch to CONFIG_TEGRA
> rather than TEGRA20 || TEGRA30 and if TEGRA40 somehow invalidates this
> logic we can deal with it then but assume it won't.

Done, will be in V2. Thanks.

Tom
>
> --
> Tom
Stephen Warren Sept. 13, 2012, 10:47 p.m. UTC | #3
On 09/12/2012 04:10 PM, Tom Warren wrote:
> This builds & boots to the command prompt on a Cardhu (T30) board.
> This is a barebones binary - no I2C, USB, MMC, SPI, etc.
> Drivers for those peripherals to follow.

> diff --git a/Makefile b/Makefile

>  ifeq ($(SOC),tegra20)
>  LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o
>  endif
> +ifeq ($(SOC),tegra30)
> +LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o
> +endif

To avoid adding more and more copies of that assignment, how about:

ifneq ($(filter $(SOC),tegra20 tegra30),)
LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o
endif

The same trick can be applied to the other two changes in this file, and
spl/Makefile.

Or perhaps you can just use:

ifneq ($(CONFIG_TEGRA),)

> diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c

> +#if defined(CONFIG_TEGRA20)
>  #include <asm/arch/tegra20.h>
> +#else	/* Tegra30 */
> +#include <asm/arch/tegra30.h>
> +#endif

If that file got renamed to tegra.h in both places, you wouldn't need
ifdefs around the include.
diff mbox

Patch

diff --git a/Makefile b/Makefile
index d6d8ab2..13f4850 100644
--- a/Makefile
+++ b/Makefile
@@ -322,6 +322,9 @@  endif
 ifeq ($(SOC),tegra20)
 LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o
 endif
+ifeq ($(SOC),tegra30)
+LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o
+endif
 
 LIBS := $(addprefix $(obj),$(sort $(LIBS-y)))
 .PHONY : $(LIBS)
@@ -389,6 +392,13 @@  else
 ALL-y += $(obj)u-boot-nodtb-tegra.bin
 endif
 endif
+ifeq ($(SOC),tegra30)
+ifeq ($(CONFIG_OF_SEPARATE),y)
+ALL-y += $(obj)u-boot-dtb-tegra.bin
+else
+ALL-y += $(obj)u-boot-nodtb-tegra.bin
+endif
+endif
 
 all:		$(ALL-y) $(SUBDIR_EXAMPLES)
 
@@ -497,6 +507,19 @@  $(obj)u-boot-nodtb-tegra.bin:	$(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 		rm $(obj)spl/u-boot-spl-pad.bin
 endif
 endif
+ifeq ($(SOC),tegra30)
+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
+		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin $(obj)u-boot.dtb > $@
+		rm $(obj)spl/u-boot-spl-pad.bin
+else
+$(obj)u-boot-nodtb-tegra.bin:	$(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
+		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@
+		rm $(obj)spl/u-boot-spl-pad.bin
+endif
+endif
 
 ifeq ($(CONFIG_SANDBOX),y)
 GEN_UBOOT = \
diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile
index 4fdbee4..6389d52 100644
--- a/arch/arm/cpu/armv7/Makefile
+++ b/arch/arm/cpu/armv7/Makefile
@@ -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_TEGRA20)$(CONFIG_TEGRA30),)
 SOBJS	+= lowlevel_init.o
 endif
 
diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
index 32658eb..b2bac3e 100644
--- a/arch/arm/cpu/armv7/start.S
+++ b/arch/arm/cpu/armv7/start.S
@@ -280,14 +280,14 @@  jump_2_ram:
 /*
  * Move vector table
  */
-#if !defined(CONFIG_TEGRA20)
+#if !defined(CONFIG_TEGRA)
 #if !(defined(CONFIG_OMAP44XX) && defined(CONFIG_SPL_BUILD))
 	/* Set vector address in CP15 VBAR register */
 	ldr     r0, =_start
 	add     r0, r0, r9
 	mcr     p15, 0, r0, c12, c0, 0  @Set VBAR
 #endif
-#endif /* !Tegra20 */
+#endif /* !Tegra20 or 30 */
 
 	ldr	r0, _board_init_r_ofs
 	adr	r1, _start
diff --git a/boards.cfg b/boards.cfg
index 613d6b2..8da07ea 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -271,6 +271,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
diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c
index 747f4cf..6f6dceb 100644
--- a/drivers/gpio/tegra_gpio.c
+++ b/drivers/gpio/tegra_gpio.c
@@ -30,7 +30,11 @@ 
 #include <common.h>
 #include <asm/io.h>
 #include <asm/bitops.h>
+#if defined(CONFIG_TEGRA20)
 #include <asm/arch/tegra20.h>
+#else	/* Tegra30 */
+#include <asm/arch/tegra30.h>
+#endif
 #include <asm/gpio.h>
 
 enum {
diff --git a/include/serial.h b/include/serial.h
index cbdf8a9..acb13de 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -31,7 +31,8 @@  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_TEGRA20) || defined(CONFIG_SYS_COREBOOT) || \
+	defined(CONFIG_TEGRA30)
 extern struct serial_device serial0_device;
 extern struct serial_device serial1_device;
 #if defined(CONFIG_SYS_NS16550_SERIAL)
diff --git a/spl/Makefile b/spl/Makefile
index 476a5e6..a94d381 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -64,6 +64,9 @@  endif
 ifeq ($(SOC),tegra20)
 LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o
 endif
+ifeq ($(SOC),tegra30)
+LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o
+endif
 
 # Add GCC lib
 ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")