Add basic NVIDIA Tegra2 SoC support
v3 cover Add basic NVIDIA Tegra2 SoC support
This series of patches adds preliminary/baseline support for NVIDIA's Tegra2 SoC. Basic CPU (AVP), RAM and UART init are covered so that the system (Harmony or Seaboard) can boot to the U-Boot serial cmd prompt.
Further support (for Cortex-A9 CPU(s), USB, SD/MMC, etc.) to follow.
Changes for V2:
- Coding style cleanup
- Remove mach-types.h change; wait for ARM kernel sync-up
- Move serial driver changes to separate patch
- Use board/nvidia/ instead of /board/tegra
- Remove TRUE/FALSE defines
- Use standard NS16550 register/bit defines in UART init
- Change nv-common.h config file to tegra2-common.h
Changes for V3:
- Use I/O accessors for Tegra2 HW MMIO register access
- Allow conditional compile of UARTA/UARTD code to save space
Tom Warren (4):
arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
serial: Add Tegra2 serial port support
arm: Tegra2: Add support for NVIDIA Harmony board
arm: Tegra2: Add support for NVIDIA Seaboard board
MAINTAINERS | 5 + arch/arm/cpu/armv7/tegra2/Makefile | 48 +++++ arch/arm/cpu/armv7/tegra2/board.c | 91 ++++++++++ arch/arm/cpu/armv7/tegra2/config.mk | 28 +++ arch/arm/cpu/armv7/tegra2/lowlevel_init.S | 66 +++++++ arch/arm/cpu/armv7/tegra2/sys_info.c | 35 ++++ arch/arm/cpu/armv7/tegra2/timer.c | 122 +++++++++++++ arch/arm/include/asm/arch-tegra2/clk_rst.h | 155 ++++++++++++++++ arch/arm/include/asm/arch-tegra2/pinmux.h | 52 ++++++ arch/arm/include/asm/arch-tegra2/pmc.h | 125 +++++++++++++ arch/arm/include/asm/arch-tegra2/sys_proto.h | 33 ++++ arch/arm/include/asm/arch-tegra2/tegra2.h | 49 +++++ arch/arm/include/asm/arch-tegra2/uart.h | 45 +++++ board/nvidia/common/board.c | 249 ++++++++++++++++++++++++++ board/nvidia/common/board.h | 57 ++++++ board/nvidia/harmony/Makefile | 50 +++++ board/nvidia/seaboard/Makefile | 50 +++++ boards.cfg | 2 + common/serial.c | 3 +- include/configs/harmony.h | 48 +++++ include/configs/seaboard.h | 44 +++++ include/configs/tegra2-common.h | 160 +++++++++++++++++ include/serial.h | 3 +- 23 files changed, 1518 insertions(+), 2 deletions(-) create mode 100644 arch/arm/cpu/armv7/tegra2/Makefile create mode 100644 arch/arm/cpu/armv7/tegra2/board.c create mode 100644 arch/arm/cpu/armv7/tegra2/config.mk create mode 100644 arch/arm/cpu/armv7/tegra2/lowlevel_init.S create mode 100644 arch/arm/cpu/armv7/tegra2/sys_info.c create mode 100644 arch/arm/cpu/armv7/tegra2/timer.c create mode 100644 arch/arm/include/asm/arch-tegra2/clk_rst.h create mode 100644 arch/arm/include/asm/arch-tegra2/pinmux.h create mode 100644 arch/arm/include/asm/arch-tegra2/pmc.h create mode 100644 arch/arm/include/asm/arch-tegra2/sys_proto.h create mode 100644 arch/arm/include/asm/arch-tegra2/tegra2.h create mode 100644 arch/arm/include/asm/arch-tegra2/uart.h create mode 100644 board/nvidia/common/board.c create mode 100644 board/nvidia/common/board.h create mode 100644 board/nvidia/harmony/Makefile create mode 100644 board/nvidia/seaboard/Makefile create mode 100644 include/configs/harmony.h create mode 100644 include/configs/seaboard.h create mode 100644 include/configs/tegra2-common.h
Signature · 1 line
1.7.3.5
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
---
Changes for V2:
- Coding style cleanup
- Move serial driver changes to separate patch
- Use board/nvidia/ instead of /board/tegra
- Remove TRUE/FALSE defines
- Use standard NS16550 register/bit defines in UART init
Changes for V3:
- Use I/O accessors for Tegra2 HW MMIO register access
- Allow conditional compile of UARTA/UARTD code to save space
arch/arm/cpu/armv7/tegra2/Makefile | 48 +++++ arch/arm/cpu/armv7/tegra2/board.c | 91 ++++++++++ arch/arm/cpu/armv7/tegra2/config.mk | 28 +++ arch/arm/cpu/armv7/tegra2/lowlevel_init.S | 66 +++++++ arch/arm/cpu/armv7/tegra2/sys_info.c | 35 ++++ arch/arm/cpu/armv7/tegra2/timer.c | 122 +++++++++++++ arch/arm/include/asm/arch-tegra2/clk_rst.h | 155 ++++++++++++++++ arch/arm/include/asm/arch-tegra2/pinmux.h | 52 ++++++ arch/arm/include/asm/arch-tegra2/pmc.h | 125 +++++++++++++ arch/arm/include/asm/arch-tegra2/sys_proto.h | 33 ++++ arch/arm/include/asm/arch-tegra2/tegra2.h | 49 +++++ arch/arm/include/asm/arch-tegra2/uart.h | 45 +++++ board/nvidia/common/board.c | 249 ++++++++++++++++++++++++++ board/nvidia/common/board.h | 57 ++++++ 14 files changed, 1155 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/armv7/tegra2/Makefile create mode 100644 arch/arm/cpu/armv7/tegra2/board.c create mode 100644 arch/arm/cpu/armv7/tegra2/config.mk create mode 100644 arch/arm/cpu/armv7/tegra2/lowlevel_init.S create mode 100644 arch/arm/cpu/armv7/tegra2/sys_info.c create mode 100644 arch/arm/cpu/armv7/tegra2/timer.c create mode 100644 arch/arm/include/asm/arch-tegra2/clk_rst.h create mode 100644 arch/arm/include/asm/arch-tegra2/pinmux.h create mode 100644 arch/arm/include/asm/arch-tegra2/pmc.h create mode 100644 arch/arm/include/asm/arch-tegra2/sys_proto.h create mode 100644 arch/arm/include/asm/arch-tegra2/tegra2.h create mode 100644 arch/arm/include/asm/arch-tegra2/uart.h create mode 100644 board/nvidia/common/board.c create mode 100644 board/nvidia/common/board.h
arch/arm/cpu/armv7/tegra2/Makefile new file +48 -0
@@ -0,0 +1,48 @@ +# +# (C) Copyright 2010,2011 Nvidia Corporation. +# +# (C) Copyright 2000-2003 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# 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 +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(SOC).o + +SOBJS := lowlevel_init.o +COBJS := sys_info.o board.o timer.o + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) + +all: $(obj).depend $(LIB) + +$(LIB): $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
arch/arm/cpu/armv7/tegra2/board.c new file +91 -0
91 lines not on this page · raw message
arch/arm/cpu/armv7/tegra2/config.mk new file +28 -0
@@ -0,0 +1,28 @@ +# +# (C) Copyright 2010,2011 +# NVIDIA Corporation <www.nvidia.com> +# +# (C) Copyright 2002 +# Gary Jennejohn, DENX Software Engineering, <[email protected]> +# +# 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 +# + +# Use ARMv4 for Tegra2 - initial code runs on the AVP, which is an ARM7TDI. +PLATFORM_CPPFLAGS += -march=armv4
arch/arm/cpu/armv7/tegra2/lowlevel_init.S new file +66 -0
66 lines not on this page · raw message
arch/arm/cpu/armv7/tegra2/sys_info.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* (C) Copyright 2010,2011 +* 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 +*/ + +#include <common.h> + +#ifdef CONFIG_DISPLAY_CPUINFO +/* Print CPU information */ +int print_cpuinfo (void ) +{ +puts ("TEGRA2\n" ); + +/* TBD: Add printf of major/minor rev info, stepping, etc. */ +return 0 ; +} +#endif /* CONFIG_DISPLAY_CPUINFO */
arch/arm/cpu/armv7/tegra2/timer.c new file +122 -0
122 lines not on this page · raw message
arch/arm/include/asm/arch-tegra2/clk_rst.h new file +155 -0
155 lines not on this page · raw message
arch/arm/include/asm/arch-tegra2/pinmux.h new file +52 -0
52 lines not on this page · raw message
arch/arm/include/asm/arch-tegra2/pmc.h new file +125 -0
125 lines not on this page · raw message
arch/arm/include/asm/arch-tegra2/sys_proto.h new file +33 -0
@@ -0,0 +1,33 @@ +/* +* (C) Copyright 2010,2011 +* 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 _SYS_PROTO_H_ +#define _SYS_PROTO_H_ + +typedef struct { +char *board_string; +}tegra2_sysinfo ; + +void invalidate_dcache (void ); + +#endif
arch/arm/include/asm/arch-tegra2/tegra2.h new file +49 -0
49 lines not on this page · raw message
arch/arm/include/asm/arch-tegra2/uart.h new file +45 -0
45 lines not on this page · raw message
board/nvidia/common/board.c new file +249 -0
249 lines not on this page · raw message
board/nvidia/common/board.h new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
Hi Tom,
Some last minutes nits:
It looks like some of the new functions can be declared statically. It'd be nice to do so where possible.
<snip>
arch/arm/cpu/armv7/tegra2/lowlevel_init.S line 2
Quoted 5 lines
arch/arm/cpu/armv7/tegra2/lowlevel_init.S new file +2
-0@@ -0,0 +1,66 @@ +/* + * Board specific setup info
This is CPU-specific code, correct?
Quoted 257 lines
arch/arm/cpu/armv7/tegra2/lowlevel_init.S new file +64
-0+ * + * (C) Copyright 2010,2011 + * 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 + */ + +#include <config.h> +#include <version.h> + +_TEXT_BASE: + .word CONFIG_SYS_TEXT_BASE @ sdram load addr from config file + +.global invalidate_dcache +invalidate_dcache: + mov pc, lr + + + .align 5 +.global reset_cpu +reset_cpu: + ldr r1, rstctl @ get addr for global reset + @ reg + ldr r3, [r1] + orr r3, r3, #0x10 + str r3, [r1] @ force reset + mov r0, r0 +_loop_forever: + b _loop_forever +rstctl: + .word PRM_RSTCTRL + +.globl lowlevel_init +lowlevel_init: + ldr sp, SRAM_STACK + str ip, [sp] + mov ip, lr + bl s_init @ go setup pll, mux & memory + ldr ip, [sp] + mov lr, ip + + mov pc, lr @ back to arch calling code + + @ the literal pools origin + .ltorg + +SRAM_STACK: + .word LOW_LEVEL_SRAM_STACKarch/arm/cpu/armv7/tegra2/sys_info.c new file +35
-0@@ -0,0 +1,35 @@ +/* +* (C) Copyright 2010,2011 +* 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 +*/ + +#include <common.h> + +#ifdef CONFIG_DISPLAY_CPUINFO +/* Print CPU information */ +int print_cpuinfo (void ) +{ +puts ("TEGRA2\n" ); + +/* TBD: Add printf of major/minor rev info, stepping, etc. */ +return 0 ; +} +#endif /* CONFIG_DISPLAY_CPUINFO */ arch/arm/cpu/armv7/tegra2/timer.c new file +122
-0@@ -0,0 +1,122 @@ +/* +* (C) Copyright 2010,2011 +* NVIDIA Corporation <www.nvidia.com> +* +* (C) Copyright 2008 +* Texas Instruments +* +* Richard Woodruff <[email protected]> +* Syed Moahmmed Khasim <[email protected]> +* +* (C) Copyright 2002 +* Sysgo Real-Time Solutions, GmbH <www.elinos.com> +* Marius Groeger <[email protected]> +* Alex Zuepke <[email protected]> +* +* (C) Copyright 2002 +* Gary Jennejohn, DENX Software Engineering, <[email protected]> +* +* 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 +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/tegra2.h> + +DECLARE_GLOBAL_DATA_PTR ; + +static timerus_t *timer_base = (timerus_t *)NV_PA_TMRUS_BASE ; + +/* counter runs at 1MHz */ +#define TIMER_CLK (1000000) +#define TIMER_LOAD_VAL 0xffffffff + +/* timer without interrupts */ +void reset_timer (void ) +{ +reset_timer_masked (); +} + +ulong get_timer (ulong base) +{ +return get_timer_masked () - base; +} + +void set_timer (ulong t) +{ + gd->tbl = t; +} + +/* delay x useconds */ +void __udelay (unsigned long usec) +{ +long tmo = usec * (TIMER_CLK /1000 ) /1000 ; +unsigned long now, last =readl (&timer_base->cntr_1us); + +while (tmo >0 ) { + now =readl (&timer_base->cntr_1us); +if (last > now)/* count up timer overflow */ + tmo -=TIMER_LOAD_VAL - last + now; +else + tmo -= now - last; + last = now; + } +} + +void reset_timer_masked (void ) +{ +/* reset time, capture current incrementer value time */ + gd->lastinc =readl (&timer_base->cntr_1us) / (TIMER_CLK /CONFIG_SYS_HZ ); + gd->tbl =0 ;/* start "advancing" time stamp from 0 */ +} + +ulong get_timer_masked (void ) +{ +ulong now; + +/* current tick value */ + now =readl (&timer_base->cntr_1us) / (TIMER_CLK /CONFIG_SYS_HZ ); + +if (now >= gd->lastinc)/* normal mode (non roll) */ +/* move stamp forward with absolute diff ticks */ + gd->tbl += (now - gd->lastinc); +else /* we have rollover of incrementer */ + gd->tbl += ((TIMER_LOAD_VAL / (TIMER_CLK /CONFIG_SYS_HZ )) + - gd->lastinc) + now; + gd->lastinc = now; +return gd->tbl; +} + +/* +* This function is derived from PowerPC code (read timebase as long long). +* On ARM it just returns the timer value. +*/ +unsigned long long get_ticks (void ) +{ +return get_timer (0 ); +} + +/* +* This function is derived from PowerPC code (timebase clock frequency). +* On ARM it returns the number of timer ticks per second. +*/ +ulong get_tbclk (void ) +{ +return CONFIG_SYS_HZ ; +}arch/arm/include/asm/arch-tegra2/clk_rst.h new file +18
-0@@ -0,0 +1,155 @@ +/* +* (C) Copyright 2010,2011 +* 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
arch/arm/include/asm/arch-tegra2/clk_rst.h line 28
Quoted 10 lines
arch/arm/include/asm/arch-tegra2/clk_rst.h new file +10
-0+* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _CLK_RST_H_ +#define _CLK_RST_H_ + +/* Clock/Reset Controller (CLK_RST_CONTROLLER_) regs */ +
There are a mixture of lower and upper case hex digits in the comments below - it'd be good to be consistent. And there should be a space before each '*/'. The newline above should be remove too.
Quoted 127 lines
arch/arm/include/asm/arch-tegra2/clk_rst.h new file +127
-0+typedef volatile struct clk_rst_ctlr { +uint crc_rst_src;/* _RST_SOURCE_0, 0x00*/ +uint crc_rst_dev_l;/* _RST_DEVICES_L_0, 0x04*/ +uint crc_rst_dev_h;/* _RST_DEVICES_H_0, 0x08*/ +uint crc_rst_dev_u;/* _RST_DEVICES_U_0, 0x0C*/ +uint crc_clk_out_enb_l;/* _CLK_OUT_ENB_L_0, 0x10*/ +uint crc_clk_out_enb_h;/* _CLK_OUT_ENB_H_0, 0x14*/ +uint crc_clk_out_enb_u;/* _CLK_OUT_ENB_U_0, 0x18*/ +uint crc_reserved0;/* reserved_0, 0x1c*/ +uint crc_cclk_brst_pol;/* _CCLK_BURST_POLICY_0,0x20*/ +uint crc_super_cclk_div;/* _SUPER_CCLK_DIVIDER_0,0x24*/ +uint crc_sclk_brst_pol;/* _SCLK_BURST_POLICY_0, 0x28*/ +uint crc_super_sclk_div;/* _SUPER_SCLK_DIVIDER_0,0x2C*/ +uint crc_clk_sys_rate;/* _CLK_SYSTEM_RATE_0, 0x30*/ +uint crc_prog_dly_clk;/* _PROG_DLY_CLK_0, 0x34*/ +uint crc_aud_sync_clk_rate;/* _AUDIO_SYNC_CLK_RATE_0,0x38*/ +uint crc_reserved1;/* reserved_1, 0x3c*/ +uint crc_cop_clk_skip_plcy;/* _COP_CLK_SKIP_POLICY_0,0x40*/ +uint crc_clk_mask_arm;/* _CLK_MASK_ARM_0, 0x44*/ +uint crc_misc_clk_enb;/* _MISC_CLK_ENB_0, 0x48*/ +uint crc_clk_cpu_cmplx;/* _CLK_CPU_CMPLX_0, 0x4C*/ +uint crc_osc_ctrl;/* _OSC_CTRL_0, 0x50*/ +uint crc_pll_lfsr;/* _PLL_LFSR_0, 0x54*/ +uint crc_osc_freq_det;/* _OSC_FREQ_DET_0, 0x58*/ +uint crc_osc_freq_det_stat;/* _OSC_FREQ_DET_STATUS_0,0x5C*/ +uint crc_reserved2[8 ];/* reserved_2[8], 0x60-7C*/ + +uint crc_pllc_base;/* _PLLC_BASE_0, 0x80*/ +uint crc_pllc_out;/* _PLLC_OUT_0, 0x84*/ +uint crc_reserved3;/* reserved_3, 0x88*/ +uint crc_pllc_misc;/* _PLLC_MISC_0, 0x8C*/ + +uint crc_pllm_base;/* _PLLM_BASE_0, 0x90*/ +uint crc_pllm_out;/* _PLLM_OUT_0, 0x94*/ +uint crc_reserved4;/* reserved_4, 0x98*/ +uint crc_pllm_misc;/* _PLLM_MISC_0, 0x9C*/ + +uint crc_pllp_base;/* _PLLP_BASE_0, 0xA0*/ +uint crc_pllp_outa;/* _PLLP_OUTA_0, 0xA4*/ +uint crc_pllp_outb;/* _PLLP_OUTB_0, 0xA8*/ +uint crc_pllp_misc;/* _PLLP_MISC_0, 0xAC*/ + +uint crc_plla_base;/* _PLLA_BASE_0, 0xB0*/ +uint crc_plla_out;/* _PLLA_OUT_0, 0xB4*/ +uint crc_reserved5;/* reserved_5, 0xB8*/ +uint crc_plla_misc;/* _PLLA_MISC_0, 0xBC*/ + +uint crc_pllu_base;/* _PLLU_BASE_0, 0xC0*/ +uint crc_reserved6;/* _reserved_6, 0xC4*/ +uint crc_reserved7;/* _reserved_7, 0xC8*/ +uint crc_pllu_misc;/* _PLLU_MISC_0, 0xCC*/ + +uint crc_plld_base;/* _PLLD_BASE_0, 0xD0*/ +uint crc_reserved8;/* _reserved_8, 0xD4*/ +uint crc_reserved9;/* _reserved_9, 0xD8*/ +uint crc_plld_misc;/* _PLLD_MISC_0, 0xDC*/ + +uint crc_pllx_base;/* _PLLX_BASE_0, 0xE0*/ +uint crc_pllx_misc;/* _PLLX_MISC_0, 0xE4*/ + +uint crc_plle_base;/* _PLLE_BASE_0, 0xE8*/ +uint crc_plle_misc;/* _PLLE_MISC_0, 0xEC*/ + +uint crc_plls_base;/* _PLLS_BASE_0, 0xF0*/ +uint crc_plls_misc;/* _PLLS_MISC_0, 0xF4*/ +uint crc_reserved10;/* _reserved_10, 0xF8*/ +uint crc_reserved11;/* _reserved_11, 0xFC*/ + +uint crc_clk_src_i2s1;/*_I2S1_0, 0x100*/ +uint crc_clk_src_i2s2;/*_I2S2_0, 0x104*/ +uint crc_clk_src_spdif_out;/*_SPDIF_OUT_0, 0x108*/ +uint crc_clk_src_spdif_in;/*_SPDIF_IN_0, 0x10C*/ +uint crc_clk_src_pwm;/*_PWM_0, 0x110*/ +uint crc_clk_src_spi1;/*_SPI1_0, 0x114*/ +uint crc_clk_src_sbc2;/*_SBC2_0, 0x118*/ +uint crc_clk_src_sbc3;/*_SBC3_0, 0x11C*/ +uint crc_clk_src_xio;/*_XIO_0, 0x120*/ +uint crc_clk_src_i2c1;/*_I2C1_0, 0x124*/ +uint crc_clk_src_dvc_i2c;/*_DVC_I2C_0, 0x128*/ +uint crc_clk_src_twc;/*_TWC_0, 0x12C*/ +uint crc_reserved12;/* 0x130*/ +uint crc_clk_src_sbc1;/*_SBC1_0, 0x134*/ +uint crc_clk_src_disp1;/*_DISP1_0, 0x138*/ +uint crc_clk_src_disp2;/*_DISP2_0, 0x13C*/ +uint crc_clk_src_cve;/*_CVE_0, 0x140*/ +uint crc_clk_src_ide;/*_IDE_0, 0x144*/ +uint crc_clk_src_vi;/*_VI_0, 0x148*/ +uint crc_reserved13;/* 0x14C*/ +uint crc_clk_src_sdmmc1;/*_SDMMC1_0, 0x150*/ +uint crc_clk_src_sdmmc2;/*_SDMMC2_0, 0x154*/ +uint crc_clk_src_g3d;/*_G3D_0, 0x158*/ +uint crc_clk_src_g2d;/*_G2D_0, 0x15C*/ +uint crc_clk_src_ndflash;/*_NDFLASH_0, 0x160*/ +uint crc_clk_src_sdmmc4;/*_SDMMC4_0, 0x164*/ +uint crc_clk_src_vfir;/*_VFIR_0, 0x168*/ +uint crc_clk_src_epp;/*_EPP_0, 0x16C*/ +uint crc_clk_src_mp3;/*_MPE_0, 0x170*/ +uint crc_clk_src_mipi;/*_MIPI_0, 0x174*/ +uint crc_clk_src_uarta;/*_UARTA_0, 0x178*/ +uint crc_clk_src_uartb;/*_UARTB_0, 0x17C*/ +uint crc_clk_src_host1x;/*_HOST1X_0, 0x180*/ +uint crc_reserved14;/* 0x184*/ +uint crc_clk_src_tvo;/*_TVO_0, 0x188*/ +uint crc_clk_src_hdmi;/*_HDMI_0, 0x18C*/ +uint crc_reserved15;/* 0x190*/ +uint crc_clk_src_tvdac;/*_TVDAC_0, 0x194*/ +uint crc_clk_src_i2c2;/*_I2C2_0, 0x198*/ +uint crc_clk_src_emc;/*_EMC_0, 0x19C*/ +uint crc_clk_src_uartc;/*_UARTC_0, 0x1A0*/ +uint crc_reserved16;/* 0x1A4*/ +uint crc_clk_src_vi_sensor;/*_VI_SENSOR_0, 0x1A8*/ +uint crc_reserved17;/* 0x1AC*/ +uint crc_reserved18;/* 0x1B0*/ +uint crc_clk_src_sbc4;/*_SBC4_0, 0x1B4*/ +uint crc_clk_src_i2c3;/*_I2C3_0, 0x1B8*/ +uint crc_clk_src_sdmmc3;/*_SDMMC3_0, 0x1BC*/ +uint crc_clk_src_uartd;/*_UARTD_0, 0x1C0*/ +uint crc_clk_src_uarte;/*_UARTE_0, 0x1C4*/ +uint crc_clk_src_vde;/*_VDE_0, 0x1C8*/ +uint crc_clk_src_owr;/*_OWR_0, 0x1CC*/ +uint crc_clk_src_nor;/*_NOR_0, 0x1D0*/ +uint crc_clk_src_csite;/*_CSITE_0, 0x1D4*/ +uint crc_reserved19[9 ];/* 0x1D8-1F8*/ +uint crc_clk_src_osc;/*_OSC_0, 0x1FC*/ +}clk_rst_ctlr ; + +#endif /* CLK_RST_H */
<snip>
Quoted 63 lines
board/nvidia/common/board.c new file +57
-0@@ -0,0 +1,249 @@ +/* +* (C) Copyright 2010,2011 +* 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 +*/ + +#include <common.h> +#include <ns16550.h> +#include <asm/io.h> +#include <asm/mach-types.h> +#include <asm/arch/tegra2.h> +#include <asm/arch/sys_proto.h> +#include "board.h" + +DECLARE_GLOBAL_DATA_PTR ; + +const tegra2_sysinfo sysinfo = { +CONFIG_TEGRA2_BOARD_STRING +}; + +/* +* Routine: board_init +* Description: Early hardware init. +*/ +int board_init (void ) +{ +/* boot param addr */ + gd->bd->bi_boot_params = (NV_PA_SDRAM_BASE +0x100 ); +/* board id for Linux */ + gd->bd->bi_arch_number =CONFIG_MACH_TYPE ; + +return 0 ; +} + +/* +* Routine: timer_init +* Description: init the timestamp and lastinc value +*/ +int timer_init (void ) +{
board/nvidia/common/board.c line 67
Quoted 10 lines
board/nvidia/common/board.c new file +10
-0+reset_timer (); +return 0 ; +} + +/* +* Routine: uart_clock_init +* Description: init the PLL and clock for the UART in uart_num +*/ +void uart_clock_init (int uart_num) +{
Are all these uart functions board-specific? They look more CPU-specific. If that's the case they should be moved somewhere in arch/arm/*. Other boards that use the Tegra2 don't want to duplicate this code or link into Nvidia's board/nvidia directory.
board/nvidia/common/board.c line 73
Quoted 6 lines
board/nvidia/common/board.c new file +6
-0+clk_rst_ctlr *const clkrst = (clk_rst_ctlr *)NV_PA_CLK_RST_BASE ; +static int pllp_init_done; +u32 reg; + +if (!pllp_init_done) { +
Remove newline above.
Quoted 229 lines
board/nvidia/common/board.c new file +176
-0+/* Override pllp setup for 216MHz operation. */ + reg = (PLL_BYPASS |PLL_BASE_OVRRIDE |PLL_DIVP ); + reg |= (((NVRM_PLLP_FIXED_FREQ_KHZ /500 ) <<8 ) |PLL_DIVM ); +writel (reg, clkrst->crc_pllp_base); + + reg |=PLL_ENABLE ; +writel (reg, clkrst->crc_pllp_base); + + reg &= ~PLL_BYPASS ; +writel (reg, clkrst->crc_pllp_base); + + pllp_init_done++; + } + +/* Now do the UART reset/clock enable based on uart_num */ +#if CONFIG_TEGRA2_ENABLE_UARTA +if (uart_num ==UART_A ) { +/* Assert Reset to UART */ + reg =readl (clkrst->crc_rst_dev_l); + reg |=SWR_UARTA_RST ;/* SWR_UARTA_RST = 1 */ +writel (reg, clkrst->crc_rst_dev_l); + +/* Enable clk to UART */ + reg =readl (clkrst->crc_clk_out_enb_l); + reg |=CLK_ENB_UARTA ;/* CLK_ENB_UARTA = 1 */ +writel (reg, clkrst->crc_clk_out_enb_l); + +/* Enable pllp_out0 to UART */ + reg =readl (clkrst->crc_clk_src_uarta); + reg &=0x3FFFFFFF ;/* UARTA_CLK_SRC = 00, PLLP_OUT0 */ +writel (reg, clkrst->crc_clk_src_uarta); + +/* wait for 2us */ +udelay (2 ); + +/* De-assert reset to UART */ + reg =readl (clkrst->crc_rst_dev_l); + reg &= ~SWR_UARTA_RST ;/* SWR_UARTA_RST = 0 */ +writel (reg, clkrst->crc_rst_dev_l); + } +#endif /* CONFIG_TEGRA2_ENABLE_UARTA */ +#if CONFIG_TEGRA2_ENABLE_UARTD +if (uart_num ==UART_D ) { +/* Assert Reset to UART */ + reg =readl (clkrst->crc_rst_dev_u); + reg |=SWR_UARTD_RST ;/* SWR_UARTD_RST = 1 */ +writel (reg, clkrst->crc_rst_dev_u); + +/* Enable clk to UART */ + reg =readl (clkrst->crc_clk_out_enb_u); + reg |=CLK_ENB_UARTD ;/* CLK_ENB_UARTD = 1 */ +writel (reg, clkrst->crc_clk_out_enb_u); + +/* Enable pllp_out0 to UART */ + reg =readl (clkrst->crc_clk_src_uartd); + reg &=0x3FFFFFFF ;/* UARTD_CLK_SRC = 00, PLLP_OUT0 */ +writel (reg, clkrst->crc_clk_src_uartd); + +/* wait for 2us */ +udelay (2 ); + +/* De-assert reset to UART */ + reg =readl (clkrst->crc_rst_dev_u); + reg &= ~SWR_UARTD_RST ;/* SWR_UARTD_RST = 0 */ +writel (reg, clkrst->crc_rst_dev_u); + } +#endif /* CONFIG_TEGRA2_ENABLE_UARTD */ +} + +/* +* Routine: pin_mux_uart +* Description: setup the pin muxes/tristate values for UART based on uart_num +*/ +void pin_mux_uart (int uart_num) +{ +pinmux_tri_ctlr *const pmt = (pinmux_tri_ctlr *)NV_PA_APB_MISC_BASE ; +u32 reg; + +#if CONFIG_TEGRA2_ENABLE_UARTA +if (uart_num ==UART_A ) { + reg =readl (pmt->pmt_ctl_c); + reg &=0xFFF0FFFF ;/* IRRX_/IRTX_SEL [19:16] = 00 UARTA */ +writel (reg, pmt->pmt_ctl_c); + + reg =readl (pmt->pmt_tri_a); + reg &= ~Z_IRRX ;/* Z_IRRX = normal (0) */ + reg &= ~Z_IRTX ;/* Z_IRTX = normal (0) */ +writel (reg, pmt->pmt_tri_a); + } +#endif /* CONFIG_TEGRA2_ENABLE_UARTA */ +#if CONFIG_TEGRA2_ENABLE_UARTD +if (uart_num ==UART_D ) { + reg =readl (pmt->pmt_ctl_b); + reg &=0xFFFFFFF3 ;/* GMC_SEL [3:2] = 00, UARTD */ +writel (reg, pmt->pmt_ctl_b); + + reg =readl (pmt->pmt_tri_a); + reg &= ~Z_GMC ;/* Z_GMC = normal (0) */ +writel (reg, pmt->pmt_tri_a); + } +#endif /* CONFIG_TEGRA2_ENABLE_UARTD */ +} + +void setup_uart (uart_ctlr *u) +{ +u32 reg; + +/* Prepare the divisor value */ + reg =NVRM_PLLP_FIXED_FREQ_KHZ *1000 /NV_DEFAULT_DEBUG_BAUD /16 ; + +/* Set up UART parameters */ +writel (UART_LCR_DLAB , u->uart_lcr); +writel (reg, u->uart_thr_dlab_0); +writel (0 , u->uart_ier_dlab_0); +writel (0 , u->uart_lcr);/* clear DLAB */ +writel ((UART_FCR_TRIGGER_3 |UART_FCR_FIFO_EN | \ +UART_FCR_CLEAR_XMIT |UART_FCR_CLEAR_RCVR ), u->uart_iir_fcr); +writel (0 , u->uart_ier_dlab_0); +writel (UART_LCR_WLS_8 , u->uart_lcr);/* 8N1 */ +writel (UART_MCR_RTS , u->uart_mcr); +writel (0 , u->uart_msr); +writel (0 , u->uart_spr); +writel (0 , u->uart_irda_csr); +writel (0 , u->uart_asr); +writel ((UART_FCR_TRIGGER_3 |UART_FCR_FIFO_EN ), u->uart_iir_fcr); + +/* Flush any old characters out of the RX FIFO */ + reg =readl (u->uart_lsr); + +while (reg &UART_LSR_DR ) { + reg =readl (u->uart_thr_dlab_0); + reg =readl (u->uart_lsr); + } +} + +/* +* Routine: init_uart +* Description: init the UART clocks, muxes, and baudrate/parity/etc. +*/ +void init_uart (int uart_num) +{ +#if CONFIG_TEGRA2_ENABLE_UARTA +if (uart_num ==UART_A ) { +uart_ctlr *const uart = (uart_ctlr *)NV_PA_APB_UARTA_BASE ; + +uart_clock_init (UART_A ); + +/* Enable UARTA - uses config 0 */ +pin_mux_uart (UART_A ); + +setup_uart (uart); + } +#endif /* CONFIG_TEGRA2_ENABLE_UARTD */ +#if CONFIG_TEGRA2_ENABLE_UARTD +if (uart_num ==UART_D ) { +uart_ctlr *const uart = (uart_ctlr *)NV_PA_APB_UARTD_BASE ; + +uart_clock_init (UART_D ); + +/* Enable UARTD - uses config 0 */ +pin_mux_uart (UART_D ); + +setup_uart (uart); + } +#endif /* CONFIG_TEGRA2_ENABLE_UARTD */ +} + +void uart_init (void ) +{ +#if (CONFIG_TEGRA2_ENABLE_UARTA ) +init_uart (UART_A ); +#endif +#if (CONFIG_TEGRA2_ENABLE_UARTD ) +init_uart (UART_D ); +#endif +}board/nvidia/common/board.h new file +47
-0@@ -0,0 +1,57 @@ +/* +* (C) Copyright 2010,2011 +* 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 _COMMON_BOARD_H_ +#define _COMMON_BOARD_H_ + +#include <asm/arch/clk_rst.h> +#include <asm/arch/pinmux.h> +#include <asm/arch/uart.h> + +#define NVRM_PLLP_FIXED_FREQ_KHZ 216000 +#define NV_DEFAULT_DEBUG_BAUD 115200 + +#define PLL_BYPASS (1 << 31) +#define PLL_ENABLE (1 << 30) +#define PLL_BASE_OVRRIDE (1 << 28) +#define PLL_DIVP (1 << 20)/* post divider, b22:20 */ +#define PLL_DIVM 0x0C/* input divider, b4:0 */ + +#define SWR_UARTD_RST (1 << 2) +#define CLK_ENB_UARTD (1 << 2) +#define SWR_UARTA_RST (1 << 6) +#define CLK_ENB_UARTA (1 << 6) + +#define Z_GMC (1 << 29) +#define Z_IRRX (1 << 20) +#define Z_IRTX (1 << 19)
board/nvidia/common/board.h line 57
Quoted 10 lines
board/nvidia/common/board.h new file +10
-0+ +enum { +UART_A =1 , +UART_B , +UART_C , +UART_D , +UART_E +}; + +#endif /* _COMMON_BOARD_H_ */
Same comment about this header. It looks CPU-specific? If so, it should be moved to somewhere in arch/arm.
Lastly, its generally good to CC people that have commented on your previous patches (eg Wolfgang and myself) as they are likely to provide more feedback and CC-ing them directly helps to ensure your re-submission doesn't get lost in their inboxes. I promise those are my last comments:)
Best,
Peter
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
Quoted 5 lines · Peter Tyser
Hi Tom,
Some last minutes nits:It looks like some of the new functions can be declared statically. It'd be nice to do so where possible.
Which functions, Peter? Please point them out specifically, thanks.
Quoted 10 lines
<snip>
arch/arm/cpu/armv7/tegra2/lowlevel_init.S line 2
Quoted 5 lines
arch/arm/cpu/armv7/tegra2/lowlevel_init.S new file +2
-0@@ -0,0 +1,66 @@ +/* + * Board specific setup infoThis is CPU-specific code, correct?
Yes - I'll change the comment.
Quoted 264 lines
Quoted 264 lines
arch/arm/cpu/armv7/tegra2/lowlevel_init.S new file +64
-0+ * + * (C) Copyright 2010,2011 + * 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 + */ + +#include <config.h> +#include <version.h> + +_TEXT_BASE: + ? ? .word ? CONFIG_SYS_TEXT_BASE ? ?@ sdram load addr from config file + +.global invalidate_dcache +invalidate_dcache: + ? ? mov pc, lr + + + ? ? .align ?5 +.global reset_cpu +reset_cpu: + ? ? ldr ? ? r1, rstctl ? ? ? ? ? ? ? ? ? ? ?@ get addr for global reset + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? @ reg + ? ? ldr ? ? r3, [r1] + ? ? orr ? ? r3, r3, #0x10 + ? ? str ? ? r3, [r1] ? ? ? ? ? ? ? ? ? ? ? ?@ force reset + ? ? mov ? ? r0, r0 +_loop_forever: + ? ? b ? ? ? _loop_forever +rstctl: + ? ? .word ? PRM_RSTCTRL + +.globl lowlevel_init +lowlevel_init: + ? ? ldr ? ? sp, SRAM_STACK + ? ? str ? ? ip, [sp] + ? ? mov ? ? ip, lr + ? ? bl ? ? ?s_init ? ? ? ? ? ? ? ? ? ? ? ? ?@ go setup pll, mux & memory + ? ? ldr ? ? ip, [sp] + ? ? mov ? ? lr, ip + + ? ? mov ? ? pc, lr ? ? ? ? ? ? ? ? ? ? ? ? ?@ back to arch calling code + + ? ? @ the literal pools origin + ? ? .ltorg + +SRAM_STACK: + ? ? .word LOW_LEVEL_SRAM_STACKarch/arm/cpu/armv7/tegra2/sys_info.c new file +35
-0@@ -0,0 +1,35 @@ +/* +* (C) Copyright 2010,2011 +* 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 +*/ + +#include <common.h> + +#ifdef CONFIG_DISPLAY_CPUINFO +/* Print CPU information */ +int print_cpuinfo (void ) +{ + ? ? puts("TEGRA2\n"); + + ? ? /* TBD: Add printf of major/minor rev info, stepping, etc. */ + ? ? return 0; +} +#endif ? ? ? /* CONFIG_DISPLAY_CPUINFO */arch/arm/cpu/armv7/tegra2/timer.c new file +122
-0@@ -0,0 +1,122 @@ +/* +* (C) Copyright 2010,2011 +* NVIDIA Corporation <www.nvidia.com> +* +* (C) Copyright 2008 +* Texas Instruments +* +* Richard Woodruff <[email protected]> +* Syed Moahmmed Khasim <[email protected]> +* +* (C) Copyright 2002 +* Sysgo Real-Time Solutions, GmbH <www.elinos.com> +* Marius Groeger <[email protected]> +* Alex Zuepke <[email protected]> +* +* (C) Copyright 2002 +* Gary Jennejohn, DENX Software Engineering, <[email protected]> +* +* 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 +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/tegra2.h> + +DECLARE_GLOBAL_DATA_PTR ; + +static timerus_t *timer_base = (timerus_t *)NV_PA_TMRUS_BASE ; + +/* counter runs at 1MHz */ +#define TIMER_CLK ? ?(1000000) +#define TIMER_LOAD_VAL ? ? ? 0xffffffff + +/* timer without interrupts */ +void reset_timer (void ) +{ + ? ? reset_timer_masked(); +} + +ulong get_timer (ulong base) +{ + ? ? return get_timer_masked() - base; +} + +void set_timer (ulong t) +{ + ? ? gd->tbl = t; +} + +/* delay x useconds */ +void __udelay (unsigned long usec) +{ + ? ? long tmo = usec * (TIMER_CLK / 1000) / 1000; + ? ? unsigned long now, last = readl(&timer_base->cntr_1us); + + ? ? while (tmo > 0) { + ? ? ? ? ? ? now = readl(&timer_base->cntr_1us); + ? ? ? ? ? ? if (last > now) /* count up timer overflow */ + ? ? ? ? ? ? ? ? ? ? tmo -= TIMER_LOAD_VAL - last + now; + ? ? ? ? ? ? else + ? ? ? ? ? ? ? ? ? ? tmo -= now - last; + ? ? ? ? ? ? last = now; + ? ? } +} + +void reset_timer_masked (void ) +{ + ? ? /* reset time, capture current incrementer value time */ + ? ? gd->lastinc = readl(&timer_base->cntr_1us) / (TIMER_CLK/CONFIG_SYS_HZ); + ? ? gd->tbl = 0; ? ? ? ? ? ?/* start "advancing" time stamp from 0 */ +} + +ulong get_timer_masked (void ) +{ + ? ? ulong now; + + ? ? /* current tick value */ + ? ? now = readl(&timer_base->cntr_1us) / (TIMER_CLK / CONFIG_SYS_HZ); + + ? ? if (now >= gd->lastinc) /* normal mode (non roll) */ + ? ? ? ? ? ? /* move stamp forward with absolute diff ticks */ + ? ? ? ? ? ? gd->tbl += (now - gd->lastinc); + ? ? else ? ?/* we have rollover of incrementer */ + ? ? ? ? ? ? gd->tbl += ((TIMER_LOAD_VAL / (TIMER_CLK / CONFIG_SYS_HZ)) + ? ? ? ? ? ? ? ? ? ? ? ? ? ? - gd->lastinc) + now; + ? ? gd->lastinc = now; + ? ? return gd->tbl; +} + +/* +* This function is derived from PowerPC code (read timebase as long long). +* On ARM it just returns the timer value. +*/ +unsigned long long get_ticks (void ) +{ + ? ? return get_timer(0); +} + +/* +* This function is derived from PowerPC code (timebase clock frequency). +* On ARM it returns the number of timer ticks per second. +*/ +ulong get_tbclk (void ) +{ + ? ? return CONFIG_SYS_HZ; +}arch/arm/include/asm/arch-tegra2/clk_rst.h new file +24
-0@@ -0,0 +1,155 @@ +/* +* ?(C) Copyright 2010,2011 +* ?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 _CLK_RST_H_
Quoted 9 lines
arch/arm/include/asm/arch-tegra2/clk_rst.h line 28
Quoted 4 lines
arch/arm/include/asm/arch-tegra2/clk_rst.h new file +4
-0+#define _CLK_RST_H_ + +/* Clock/Reset Controller (CLK_RST_CONTROLLER_) regs */ +There are a mixture of lower and upper case hex digits in the comments below - it'd be good to be consistent. ?And there should be a space before each '*/'. ?The newline above should be remove too.
Will do. I had changed this once already as per your previous comments, but it must have gotten lost in the V3 patching.
Quoted 200 lines
Quoted 127 lines
arch/arm/include/asm/arch-tegra2/clk_rst.h new file +127
-0+typedef volatile struct clk_rst_ctlr { + ? ? uint crc_rst_src; ? ? ? ? ? ? ? /* _RST_SOURCE_0, ? ? ? 0x00*/ + ? ? uint crc_rst_dev_l; ? ? ? ? ? ? /* _RST_DEVICES_L_0, ? ?0x04*/ + ? ? uint crc_rst_dev_h; ? ? ? ? ? ? /* _RST_DEVICES_H_0, ? ?0x08*/ + ? ? uint crc_rst_dev_u; ? ? ? ? ? ? /* _RST_DEVICES_U_0, ? ?0x0C*/ + ? ? uint crc_clk_out_enb_l; ? ? ? ? /* _CLK_OUT_ENB_L_0, ? ?0x10*/ + ? ? uint crc_clk_out_enb_h; ? ? ? ? /* _CLK_OUT_ENB_H_0, ? ?0x14*/ + ? ? uint crc_clk_out_enb_u; ? ? ? ? /* _CLK_OUT_ENB_U_0, ? ?0x18*/ + ? ? uint crc_reserved0; ? ? ? ? ? ? /* reserved_0, ? ? ? ? ?0x1c*/ + ? ? uint crc_cclk_brst_pol; ? ? ? ? /* _CCLK_BURST_POLICY_0,0x20*/ + ? ? uint crc_super_cclk_div; ? ? ? ?/* _SUPER_CCLK_DIVIDER_0,0x24*/ + ? ? uint crc_sclk_brst_pol; ? ? ? ? /* _SCLK_BURST_POLICY_0, 0x28*/ + ? ? uint crc_super_sclk_div; ? ? ? ?/* _SUPER_SCLK_DIVIDER_0,0x2C*/ + ? ? uint crc_clk_sys_rate; ? ? ? ? ?/* _CLK_SYSTEM_RATE_0, ?0x30*/ + ? ? uint crc_prog_dly_clk; ? ? ? ? ?/* _PROG_DLY_CLK_0, ? ? 0x34*/ + ? ? uint crc_aud_sync_clk_rate; ? ? /* _AUDIO_SYNC_CLK_RATE_0,0x38*/ + ? ? uint crc_reserved1; ? ? ? ? ? ? /* reserved_1, ? ? ? ? ?0x3c*/ + ? ? uint crc_cop_clk_skip_plcy; ? ? /* _COP_CLK_SKIP_POLICY_0,0x40*/ + ? ? uint crc_clk_mask_arm; ? ? ? ? ?/* _CLK_MASK_ARM_0, ? ? 0x44*/ + ? ? uint crc_misc_clk_enb; ? ? ? ? ?/* _MISC_CLK_ENB_0, ? ? 0x48*/ + ? ? uint crc_clk_cpu_cmplx; ? ? ? ? /* _CLK_CPU_CMPLX_0, ? ?0x4C*/ + ? ? uint crc_osc_ctrl; ? ? ? ? ? ? ?/* _OSC_CTRL_0, ? ? ? ? 0x50*/ + ? ? uint crc_pll_lfsr; ? ? ? ? ? ? ?/* _PLL_LFSR_0, ? ? ? ? 0x54*/ + ? ? uint crc_osc_freq_det; ? ? ? ? ?/* _OSC_FREQ_DET_0, ? ? 0x58*/ + ? ? uint crc_osc_freq_det_stat; ? ? /* _OSC_FREQ_DET_STATUS_0,0x5C*/ + ? ? uint crc_reserved2[8]; ? ? ? ? ?/* reserved_2[8], ? ? ? 0x60-7C*/ + + ? ? uint crc_pllc_base; ? ? ? ? ? ? /* _PLLC_BASE_0, ? ? ? ?0x80*/ + ? ? uint crc_pllc_out; ? ? ? ? ? ? ?/* _PLLC_OUT_0, ? ? ? ? 0x84*/ + ? ? uint crc_reserved3; ? ? ? ? ? ? /* reserved_3, ? ? ? ? ?0x88*/ + ? ? uint crc_pllc_misc; ? ? ? ? ? ? /* _PLLC_MISC_0, ? ? ? ?0x8C*/ + + ? ? uint crc_pllm_base; ? ? ? ? ? ? /* _PLLM_BASE_0, ? ? ? ?0x90*/ + ? ? uint crc_pllm_out; ? ? ? ? ? ? ?/* _PLLM_OUT_0, ? ? ? ? 0x94*/ + ? ? uint crc_reserved4; ? ? ? ? ? ? /* reserved_4, ? ? ? ? ?0x98*/ + ? ? uint crc_pllm_misc; ? ? ? ? ? ? /* _PLLM_MISC_0, ? ? ? ?0x9C*/ + + ? ? uint crc_pllp_base; ? ? ? ? ? ? /* _PLLP_BASE_0, ? ? ? ?0xA0*/ + ? ? uint crc_pllp_outa; ? ? ? ? ? ? /* _PLLP_OUTA_0, ? ? ? ?0xA4*/ + ? ? uint crc_pllp_outb; ? ? ? ? ? ? /* _PLLP_OUTB_0, ? ? ? ?0xA8*/ + ? ? uint crc_pllp_misc; ? ? ? ? ? ? /* _PLLP_MISC_0, ? ? ? ?0xAC*/ + + ? ? uint crc_plla_base; ? ? ? ? ? ? /* _PLLA_BASE_0, ? ? ? ?0xB0*/ + ? ? uint crc_plla_out; ? ? ? ? ? ? ?/* _PLLA_OUT_0, ? ? ? ? 0xB4*/ + ? ? uint crc_reserved5; ? ? ? ? ? ? /* reserved_5, ? ? ? ? ?0xB8*/ + ? ? uint crc_plla_misc; ? ? ? ? ? ? /* _PLLA_MISC_0, ? ? ? ?0xBC*/ + + ? ? uint crc_pllu_base; ? ? ? ? ? ? /* _PLLU_BASE_0, ? ? ? ?0xC0*/ + ? ? uint crc_reserved6; ? ? ? ? ? ? /* _reserved_6, ? ? ? ? 0xC4*/ + ? ? uint crc_reserved7; ? ? ? ? ? ? /* _reserved_7, ? ? ? ? 0xC8*/ + ? ? uint crc_pllu_misc; ? ? ? ? ? ? /* _PLLU_MISC_0, ? ? ? ?0xCC*/ + + ? ? uint crc_plld_base; ? ? ? ? ? ? /* _PLLD_BASE_0, ? ? ? ?0xD0*/ + ? ? uint crc_reserved8; ? ? ? ? ? ? /* _reserved_8, ? ? ? ? 0xD4*/ + ? ? uint crc_reserved9; ? ? ? ? ? ? /* _reserved_9, ? ? ? ? 0xD8*/ + ? ? uint crc_plld_misc; ? ? ? ? ? ? /* _PLLD_MISC_0, ? ? ? ?0xDC*/ + + ? ? uint crc_pllx_base; ? ? ? ? ? ? /* _PLLX_BASE_0, ? ? ? ?0xE0*/ + ? ? uint crc_pllx_misc; ? ? ? ? ? ? /* _PLLX_MISC_0, ? ? ? ?0xE4*/ + + ? ? uint crc_plle_base; ? ? ? ? ? ? /* _PLLE_BASE_0, ? ? ? ?0xE8*/ + ? ? uint crc_plle_misc; ? ? ? ? ? ? /* _PLLE_MISC_0, ? ? ? ?0xEC*/ + + ? ? uint crc_plls_base; ? ? ? ? ? ? /* _PLLS_BASE_0, ? ? ? ?0xF0*/ + ? ? uint crc_plls_misc; ? ? ? ? ? ? /* _PLLS_MISC_0, ? ? ? ?0xF4*/ + ? ? uint crc_reserved10; ? ? ? ? ? ?/* _reserved_10, ? ? ? ?0xF8*/ + ? ? uint crc_reserved11; ? ? ? ? ? ?/* _reserved_11, ? ? ? ?0xFC*/ + + ? ? uint crc_clk_src_i2s1; ? ? ? ? ?/*_I2S1_0, ? ? ? ? ? ? ?0x100*/ + ? ? uint crc_clk_src_i2s2; ? ? ? ? ?/*_I2S2_0, ? ? ? ? ? ? ?0x104*/ + ? ? uint crc_clk_src_spdif_out; ? ? /*_SPDIF_OUT_0, ? ? ? ? 0x108*/ + ? ? uint crc_clk_src_spdif_in; ? ? ?/*_SPDIF_IN_0, ? ? ? ? ?0x10C*/ + ? ? uint crc_clk_src_pwm; ? ? ? ? ? /*_PWM_0, ? ? ? ? ? ? ? 0x110*/ + ? ? uint crc_clk_src_spi1; ? ? ? ? ?/*_SPI1_0, ? ? ? ? ? ? ?0x114*/ + ? ? uint crc_clk_src_sbc2; ? ? ? ? ?/*_SBC2_0, ? ? ? ? ? ? ?0x118*/ + ? ? uint crc_clk_src_sbc3; ? ? ? ? ?/*_SBC3_0, ? ? ? ? ? ? ?0x11C*/ + ? ? uint crc_clk_src_xio; ? ? ? ? ? /*_XIO_0, ? ? ? ? ? ? ? 0x120*/ + ? ? uint crc_clk_src_i2c1; ? ? ? ? ?/*_I2C1_0, ? ? ? ? ? ? ?0x124*/ + ? ? uint crc_clk_src_dvc_i2c; ? ? ? /*_DVC_I2C_0, ? ? ? ? ? 0x128*/ + ? ? uint crc_clk_src_twc; ? ? ? ? ? /*_TWC_0, ? ? ? ? ? ? ? 0x12C*/ + ? ? uint crc_reserved12; ? ? ? ? ? ?/* ? ? ? ? ? ? ? ? ? ? ?0x130*/ + ? ? uint crc_clk_src_sbc1; ? ? ? ? ?/*_SBC1_0, ? ? ? ? ? ? ?0x134*/ + ? ? uint crc_clk_src_disp1; ? ? ? ? /*_DISP1_0, ? ? ? ? ? ? 0x138*/ + ? ? uint crc_clk_src_disp2; ? ? ? ? /*_DISP2_0, ? ? ? ? ? ? 0x13C*/ + ? ? uint crc_clk_src_cve; ? ? ? ? ? /*_CVE_0, ? ? ? ? ? ? ? 0x140*/ + ? ? uint crc_clk_src_ide; ? ? ? ? ? /*_IDE_0, ? ? ? ? ? ? ? 0x144*/ + ? ? uint crc_clk_src_vi; ? ? ? ? ? ?/*_VI_0, ? ? ? ? ? ? ? ?0x148*/ + ? ? uint crc_reserved13; ? ? ? ? ? ?/* ? ? ? ? ? ? ? ? ? ? ?0x14C*/ + ? ? uint crc_clk_src_sdmmc1; ? ? ? ?/*_SDMMC1_0, ? ? ? ? ? ?0x150*/ + ? ? uint crc_clk_src_sdmmc2; ? ? ? ?/*_SDMMC2_0, ? ? ? ? ? ?0x154*/ + ? ? uint crc_clk_src_g3d; ? ? ? ? ? /*_G3D_0, ? ? ? ? ? ? ? 0x158*/ + ? ? uint crc_clk_src_g2d; ? ? ? ? ? /*_G2D_0, ? ? ? ? ? ? ? 0x15C*/ + ? ? uint crc_clk_src_ndflash; ? ? ? /*_NDFLASH_0, ? ? ? ? ? 0x160*/ + ? ? uint crc_clk_src_sdmmc4; ? ? ? ?/*_SDMMC4_0, ? ? ? ? ? ?0x164*/ + ? ? uint crc_clk_src_vfir; ? ? ? ? ?/*_VFIR_0, ? ? ? ? ? ? ?0x168*/ + ? ? uint crc_clk_src_epp; ? ? ? ? ? /*_EPP_0, ? ? ? ? ? ? ? 0x16C*/ + ? ? uint crc_clk_src_mp3; ? ? ? ? ? /*_MPE_0, ? ? ? ? ? ? ? 0x170*/ + ? ? uint crc_clk_src_mipi; ? ? ? ? ?/*_MIPI_0, ? ? ? ? ? ? ?0x174*/ + ? ? uint crc_clk_src_uarta; ? ? ? ? /*_UARTA_0, ? ? ? ? ? ? 0x178*/ + ? ? uint crc_clk_src_uartb; ? ? ? ? /*_UARTB_0, ? ? ? ? ? ? 0x17C*/ + ? ? uint crc_clk_src_host1x; ? ? ? ?/*_HOST1X_0, ? ? ? ? ? ?0x180*/ + ? ? uint crc_reserved14; ? ? ? ? ? ?/* ? ? ? ? ? ? ? ? ? ? ?0x184*/ + ? ? uint crc_clk_src_tvo; ? ? ? ? ? /*_TVO_0, ? ? ? ? ? ? ? 0x188*/ + ? ? uint crc_clk_src_hdmi; ? ? ? ? ?/*_HDMI_0, ? ? ? ? ? ? ?0x18C*/ + ? ? uint crc_reserved15; ? ? ? ? ? ?/* ? ? ? ? ? ? ? ? ? ? ?0x190*/ + ? ? uint crc_clk_src_tvdac; ? ? ? ? /*_TVDAC_0, ? ? ? ? ? ? 0x194*/ + ? ? uint crc_clk_src_i2c2; ? ? ? ? ?/*_I2C2_0, ? ? ? ? ? ? ?0x198*/ + ? ? uint crc_clk_src_emc; ? ? ? ? ? /*_EMC_0, ? ? ? ? ? ? ? 0x19C*/ + ? ? uint crc_clk_src_uartc; ? ? ? ? /*_UARTC_0, ? ? ? ? ? ? 0x1A0*/ + ? ? uint crc_reserved16; ? ? ? ? ? ?/* ? ? ? ? ? ? ? ? ? ? ?0x1A4*/ + ? ? uint crc_clk_src_vi_sensor; ? ? /*_VI_SENSOR_0, ? ? ? ? 0x1A8*/ + ? ? uint crc_reserved17; ? ? ? ? ? ?/* ? ? ? ? ? ? ? ? ? ? ?0x1AC*/ + ? ? uint crc_reserved18; ? ? ? ? ? ?/* ? ? ? ? ? ? ? ? ? ? ?0x1B0*/ + ? ? uint crc_clk_src_sbc4; ? ? ? ? ?/*_SBC4_0, ? ? ? ? ? ? ?0x1B4*/ + ? ? uint crc_clk_src_i2c3; ? ? ? ? ?/*_I2C3_0, ? ? ? ? ? ? ?0x1B8*/ + ? ? uint crc_clk_src_sdmmc3; ? ? ? ?/*_SDMMC3_0, ? ? ? ? ? ?0x1BC*/ + ? ? uint crc_clk_src_uartd; ? ? ? ? /*_UARTD_0, ? ? ? ? ? ? 0x1C0*/ + ? ? uint crc_clk_src_uarte; ? ? ? ? /*_UARTE_0, ? ? ? ? ? ? 0x1C4*/ + ? ? uint crc_clk_src_vde; ? ? ? ? ? /*_VDE_0, ? ? ? ? ? ? ? 0x1C8*/ + ? ? uint crc_clk_src_owr; ? ? ? ? ? /*_OWR_0, ? ? ? ? ? ? ? 0x1CC*/ + ? ? uint crc_clk_src_nor; ? ? ? ? ? /*_NOR_0, ? ? ? ? ? ? ? 0x1D0*/ + ? ? uint crc_clk_src_csite; ? ? ? ? /*_CSITE_0, ? ? ? ? ? ? 0x1D4*/ + ? ? uint crc_reserved19[9]; ? ? ? ? /* ? ? ? ? ? ? ? ? ? ? ?0x1D8-1F8*/ + ? ? uint crc_clk_src_osc; ? ? ? ? ? /*_OSC_0, ? ? ? ? ? ? ? 0x1FC*/ +}clk_rst_ctlr ; + +#endif ? ? ? /* CLK_RST_H */<snip>
Quoted 70 lines
board/nvidia/common/board.c new file +64
-0@@ -0,0 +1,249 @@ +/* +* ?(C) Copyright 2010,2011 +* ?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 +*/ + +#include <common.h> +#include <ns16550.h> +#include <asm/io.h> +#include <asm/mach-types.h> +#include <asm/arch/tegra2.h> +#include <asm/arch/sys_proto.h> +#include "board.h" + +DECLARE_GLOBAL_DATA_PTR ; + +const tegra2_sysinfo sysinfo = { + ? ? CONFIG_TEGRA2_BOARD_STRING +}; + +/* +* Routine: board_init +* Description: Early hardware init. +*/ +int board_init (void ) +{ + ? ? /* boot param addr */ + ? ? gd->bd->bi_boot_params = (NV_PA_SDRAM_BASE + 0x100); + ? ? /* board id for Linux */ + ? ? gd->bd->bi_arch_number = CONFIG_MACH_TYPE; + + ? ? return 0; +} + +/* +* Routine: timer_init +* Description: init the timestamp and lastinc value +*/ +int timer_init (void ) +{ + ? ? reset_timer(); + ? ? return 0; +} + +/* +* Routine: uart_clock_init +* Description: init the PLL and clock for the UART in uart_num
Quoted 8 lines
board/nvidia/common/board.c line 67
Quoted 3 lines
board/nvidia/common/board.c new file +3
-0+*/ +void uart_clock_init (int uart_num) +{Are all these uart functions board-specific? ?They look more CPU-specific. ?If that's the case they should be moved somewhere in
arch/arm/*. ?Other boards that use the Tegra2 don't want to duplicate this code or link into Nvidia's board/nvidia directory.
It's Tegra2 SoC-specific - that's not the CPU, per se. I guess I could move it to arch/arm/cpu/armv7/tegra2, if you think it's important enough.
Quoted 9 lines
board/nvidia/common/board.c line 73
Quoted 7 lines
board/nvidia/common/board.c new file +6
-0+ ? ? clk_rst_ctlr *const clkrst = (clk_rst_ctlr *)NV_PA_CLK_RST_BASE; + ? ? static int pllp_init_done; + ? ? u32 reg; + + ? ? if (!pllp_init_done) { +Remove newline above.
OK.
Quoted 235 lines
Quoted 235 lines
board/nvidia/common/board.c new file +176
-0+ ? ? ? ? ? ? /* Override pllp setup for 216MHz operation. */ + ? ? ? ? ? ? reg = (PLL_BYPASS | PLL_BASE_OVRRIDE | PLL_DIVP); + ? ? ? ? ? ? reg |= (((NVRM_PLLP_FIXED_FREQ_KHZ/500) << 8) | PLL_DIVM); + ? ? ? ? ? ? writel(reg, clkrst->crc_pllp_base); + + ? ? ? ? ? ? reg |= PLL_ENABLE; + ? ? ? ? ? ? writel(reg, clkrst->crc_pllp_base); + + ? ? ? ? ? ? reg &= ~PLL_BYPASS; + ? ? ? ? ? ? writel(reg, clkrst->crc_pllp_base); + + ? ? ? ? ? ? pllp_init_done++; + ? ? } + + ? ? /* Now do the UART reset/clock enable based on uart_num */ +#if CONFIG_TEGRA2_ENABLE_UARTA + ? ? if (uart_num == UART_A) { + ? ? ? ? ? ? /* Assert Reset to UART */ + ? ? ? ? ? ? reg = readl(clkrst->crc_rst_dev_l); + ? ? ? ? ? ? reg |= SWR_UARTA_RST; ? ? ? ? ? /* SWR_UARTA_RST = 1 */ + ? ? ? ? ? ? writel(reg, clkrst->crc_rst_dev_l); + + ? ? ? ? ? ? /* Enable clk to UART */ + ? ? ? ? ? ? reg = readl(clkrst->crc_clk_out_enb_l); + ? ? ? ? ? ? reg |= CLK_ENB_UARTA; ? ? ? ? ? /* CLK_ENB_UARTA = 1 */ + ? ? ? ? ? ? writel(reg, clkrst->crc_clk_out_enb_l); + + ? ? ? ? ? ? /* Enable pllp_out0 to UART */ + ? ? ? ? ? ? reg = readl(clkrst->crc_clk_src_uarta); + ? ? ? ? ? ? reg &= 0x3FFFFFFF; ? ? ?/* UARTA_CLK_SRC = 00, PLLP_OUT0 */ + ? ? ? ? ? ? writel(reg, clkrst->crc_clk_src_uarta); + + ? ? ? ? ? ? /* wait for 2us */ + ? ? ? ? ? ? udelay(2); + + ? ? ? ? ? ? /* De-assert reset to UART */ + ? ? ? ? ? ? reg = readl(clkrst->crc_rst_dev_l); + ? ? ? ? ? ? reg &= ~SWR_UARTA_RST; ? ? ? ? ?/* SWR_UARTA_RST = 0 */ + ? ? ? ? ? ? writel(reg, clkrst->crc_rst_dev_l); + ? ? } +#endif ? ? ? /* CONFIG_TEGRA2_ENABLE_UARTA */ +#if CONFIG_TEGRA2_ENABLE_UARTD + ? ? if (uart_num == UART_D) { + ? ? ? ? ? ? /* Assert Reset to UART */ + ? ? ? ? ? ? reg = readl(clkrst->crc_rst_dev_u); + ? ? ? ? ? ? reg |= SWR_UARTD_RST; ? ? ? ? ? /* SWR_UARTD_RST = 1 */ + ? ? ? ? ? ? writel(reg, clkrst->crc_rst_dev_u); + + ? ? ? ? ? ? /* Enable clk to UART */ + ? ? ? ? ? ? reg = readl(clkrst->crc_clk_out_enb_u); + ? ? ? ? ? ? reg |= CLK_ENB_UARTD; ? ? ? ? ? /* CLK_ENB_UARTD = 1 */ + ? ? ? ? ? ? writel(reg, clkrst->crc_clk_out_enb_u); + + ? ? ? ? ? ? /* Enable pllp_out0 to UART */ + ? ? ? ? ? ? reg = readl(clkrst->crc_clk_src_uartd); + ? ? ? ? ? ? reg &= 0x3FFFFFFF; ? ? ?/* UARTD_CLK_SRC = 00, PLLP_OUT0 */ + ? ? ? ? ? ? writel(reg, clkrst->crc_clk_src_uartd); + + ? ? ? ? ? ? /* wait for 2us */ + ? ? ? ? ? ? udelay(2); + + ? ? ? ? ? ? /* De-assert reset to UART */ + ? ? ? ? ? ? reg = readl(clkrst->crc_rst_dev_u); + ? ? ? ? ? ? reg &= ~SWR_UARTD_RST; ? ? ? ? ?/* SWR_UARTD_RST = 0 */ + ? ? ? ? ? ? writel(reg, clkrst->crc_rst_dev_u); + ? ? } +#endif ? ? ? /* CONFIG_TEGRA2_ENABLE_UARTD */ +} + +/* + * Routine: pin_mux_uart + * Description: setup the pin muxes/tristate values for UART based on uart_num + */ +void pin_mux_uart(int uart_num) +{ + ? ? pinmux_tri_ctlr *const pmt = (pinmux_tri_ctlr *)NV_PA_APB_MISC_BASE; + ? ? u32 reg; + +#if CONFIG_TEGRA2_ENABLE_UARTA + ? ? if (uart_num ?== UART_A) { + ? ? ? ? ? ? reg = readl(pmt->pmt_ctl_c); + ? ? ? ? ? ? reg &= 0xFFF0FFFF; ? ? ?/* IRRX_/IRTX_SEL [19:16] = 00 UARTA */ + ? ? ? ? ? ? writel(reg, pmt->pmt_ctl_c); + + ? ? ? ? ? ? reg = readl(pmt->pmt_tri_a); + ? ? ? ? ? ? reg &= ~Z_IRRX; ? ? ? ? /* Z_IRRX = normal (0) */ + ? ? ? ? ? ? reg &= ~Z_IRTX; ? ? ? ? /* Z_IRTX = normal (0) */ + ? ? ? ? ? ? writel(reg, pmt->pmt_tri_a); + ? ? } +#endif ? ? ? /* CONFIG_TEGRA2_ENABLE_UARTA */ +#if CONFIG_TEGRA2_ENABLE_UARTD + ? ? if (uart_num == UART_D) { + ? ? ? ? ? ? reg = readl(pmt->pmt_ctl_b); + ? ? ? ? ? ? reg &= 0xFFFFFFF3; ? ? ?/* GMC_SEL [3:2] = 00, UARTD */ + ? ? ? ? ? ? writel(reg, pmt->pmt_ctl_b); + + ? ? ? ? ? ? reg = readl(pmt->pmt_tri_a); + ? ? ? ? ? ? reg &= ~Z_GMC; ? ? ? ? ?/* Z_GMC = normal (0) */ + ? ? ? ? ? ? writel(reg, pmt->pmt_tri_a); + ? ? } +#endif ? ? ? /* CONFIG_TEGRA2_ENABLE_UARTD */ +} + +void setup_uart(uart_ctlr *u) +{ + ? ? u32 reg; + + ? ? /* Prepare the divisor value */ + ? ? reg = NVRM_PLLP_FIXED_FREQ_KHZ * 1000 / NV_DEFAULT_DEBUG_BAUD / 16; + + ? ? /* Set up UART parameters */ + ? ? writel(UART_LCR_DLAB, u->uart_lcr); + ? ? writel(reg, u->uart_thr_dlab_0); + ? ? writel(0, u->uart_ier_dlab_0); + ? ? writel(0, u->uart_lcr); ? ? ? ? ? ? ? ? /* clear DLAB */ + ? ? writel((UART_FCR_TRIGGER_3 | UART_FCR_FIFO_EN | \ + ? ? ? ? ? ? UART_FCR_CLEAR_XMIT | UART_FCR_CLEAR_RCVR), u->uart_iir_fcr); + ? ? writel(0, u->uart_ier_dlab_0); + ? ? writel(UART_LCR_WLS_8, u->uart_lcr); ? ?/* 8N1 */ + ? ? writel(UART_MCR_RTS, u->uart_mcr); + ? ? writel(0, u->uart_msr); + ? ? writel(0, u->uart_spr); + ? ? writel(0, u->uart_irda_csr); + ? ? writel(0, u->uart_asr); + ? ? writel((UART_FCR_TRIGGER_3 | UART_FCR_FIFO_EN), u->uart_iir_fcr); + + ? ? /* Flush any old characters out of the RX FIFO */ + ? ? reg = readl(u->uart_lsr); + + ? ? while (reg & UART_LSR_DR) { + ? ? ? ? ? ? reg = readl(u->uart_thr_dlab_0); + ? ? ? ? ? ? reg = readl(u->uart_lsr); + ? ? } +} + +/* + * Routine: init_uart + * Description: init the UART clocks, muxes, and baudrate/parity/etc. + */ +void init_uart(int uart_num) +{ +#if CONFIG_TEGRA2_ENABLE_UARTA + ? ? if (uart_num == UART_A) { + ? ? ? ? ? ? uart_ctlr *const uart = (uart_ctlr *)NV_PA_APB_UARTA_BASE; + + ? ? ? ? ? ? uart_clock_init(UART_A); + + ? ? ? ? ? ? /* Enable UARTA - uses config 0 */ + ? ? ? ? ? ? pin_mux_uart(UART_A); + + ? ? ? ? ? ? setup_uart(uart); + ? ? } +#endif ? ? ? /* CONFIG_TEGRA2_ENABLE_UARTD */ +#if CONFIG_TEGRA2_ENABLE_UARTD + ? ? if (uart_num == UART_D) { + ? ? ? ? ? ? uart_ctlr *const uart = (uart_ctlr *)NV_PA_APB_UARTD_BASE; + + ? ? ? ? ? ? uart_clock_init(UART_D); + + ? ? ? ? ? ? /* Enable UARTD - uses config 0 */ + ? ? ? ? ? ? pin_mux_uart(UART_D); + + ? ? ? ? ? ? setup_uart(uart); + ? ? } +#endif ? ? ? /* CONFIG_TEGRA2_ENABLE_UARTD */ +} + +void uart_init(void) +{ +#if (CONFIG_TEGRA2_ENABLE_UARTA) + ? ? init_uart(UART_A); +#endif +#if (CONFIG_TEGRA2_ENABLE_UARTD) + ? ? init_uart(UART_D); +#endif +}board/nvidia/common/board.h new file +52
-0@@ -0,0 +1,57 @@ +/* +* ?(C) Copyright 2010,2011 +* ?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 _COMMON_BOARD_H_ +#define _COMMON_BOARD_H_ + +#include <asm/arch/clk_rst.h> +#include <asm/arch/pinmux.h> +#include <asm/arch/uart.h> + +#define NVRM_PLLP_FIXED_FREQ_KHZ ? ? 216000 +#define NV_DEFAULT_DEBUG_BAUD ? ? ? ? ? ? ? ?115200 + +#define PLL_BYPASS ? ? ? ? ? (1 << 31) +#define PLL_ENABLE ? ? ? ? ? (1 << 30) +#define PLL_BASE_OVRRIDE ? ? (1 << 28) +#define PLL_DIVP ? ? ? ? ? ? (1 << 20) ? ? ?/* post divider, b22:20 */ +#define PLL_DIVM ? ? ? ? ? ? 0x0C ? ? ? ? ? ?/* input divider, b4:0 */ + +#define SWR_UARTD_RST ? ? ? ? ? ? ? ?(1 << 2) +#define CLK_ENB_UARTD ? ? ? ? ? ? ? ?(1 << 2) +#define SWR_UARTA_RST ? ? ? ? ? ? ? ?(1 << 6) +#define CLK_ENB_UARTA ? ? ? ? ? ? ? ?(1 << 6) + +#define Z_GMC ? ? ? ? ? ? ? ? ? ? ? ?(1 << 29) +#define Z_IRRX ? ? ? ? ? ? ? ? ? ? ? (1 << 20) +#define Z_IRTX ? ? ? ? ? ? ? ? ? ? ? (1 << 19) + +enum { + ? ? UART_A = 1, + ? ? UART_B, + ? ? UART_C,
Quoted 8 lines
board/nvidia/common/board.h line 57
Quoted 5 lines
board/nvidia/common/board.h new file +5
-0+ ? ? UART_D, + ? ? UART_E +}; + +#endif /* _COMMON_BOARD_H_ */ Same comment about this header. ?It looks CPU-specific? ?If so, it should be moved to somewhere in
arch/arm.
If /nvidia/common/board.c moves, then I'll move this one, too.
Quoted 7 lines
Lastly, its generally good to CC people that have commented on your previous patches (eg Wolfgang and myself) as they are likely to provide more feedback and CC-ing them directly helps to ensure your re-submission doesn't get lost in their inboxes. ?I promise those are my last comments:)
I've added Wolfgang and Sandeep to the CC list. I'll try to keep it updated.
Quoted 3 lines
Best,
Peter
Thanks for all the feedback,
Tom
Quoted 2 lines
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
Quoted 7 lines · Tom Warren
Quoted 5 lines · Peter Tyser
Hi Tom,
Some last minutes nits:It looks like some of the new functions can be declared statically. It'd be nice to do so where possible.
Which functions, Peter? Please point them out specifically, thanks.
Any function that won't be called from outside the scope of the file. Eg it looks like init_uart() and setup_uart() are local functions and should be static. Those are the 2 that jumped out initially, but you should review to see if there are others.
<snip>
Quoted 11 lines
Quoted 11 lines
board/nvidia/common/board.c line 67
Quoted 6 lines
board/nvidia/common/board.c new file +6
-0+/* +* Routine: uart_clock_init +* Description: init the PLL and clock for the UART in uart_num +*/ +void uart_clock_init (int uart_num) +{Are all these uart functions board-specific? They look more CPU-specific. If that's the case they should be moved somewhere in
arch/arm/*. Other boards that use the Tegra2 don't want to duplicate this code or link into Nvidia's board/nvidia directory.
Quoted 2 lines
It's Tegra2 SoC-specific - that's not the CPU, per se. I guess I could move it to
arch/arm/cpu/armv7/tegra2, if you think it's important enough.
I think they should be moved. If they aren't, the next board vendor (eg my company) that uses the Tegra2 will copy your board.[ch] into their board/<vendor> directory and use them as a starting point, which is a large duplication of code. Moving it somewhere in arch/arm is the "right" thing to do and will make every future tegra2 board port cleaner and easier.
Best,
Peter
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
In reply to Tom WarrenDear Tom Warren,
In message <[email protected]> you wrote:
...
Quoted 6 lines
Quoted 4 lines
Are all these uart functions board-specific? They look more CPU-specific. If that's the case they should be moved somewhere in
arch/arm/*. Other boards that use the Tegra2 don't want to duplicate this code or link into Nvidia's board/nvidia directory.It's Tegra2 SoC-specific - that's not the CPU, per se. I guess I could move it to
arch/arm/cpu/armv7/tegra2, if you think it's important enough.
Yes, please do.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Q: How many DEC repairman does it take to fix a flat ? A: Five; four to hold the car up and one to swap tires.
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
In reply to Tom WarrenQuoted 10 lines · Tom Warren
board/nvidia/common/board.c new file +10
-0+ +/* +* Routine: uart_clock_init +* Description: init the PLL and clock for the UART in uart_num +*/ +void uart_clock_init (int uart_num) +{ + ? ? ? clk_rst_ctlr *const clkrst = (clk_rst_ctlr *)NV_PA_CLK_RST_BASE; + ? ? ? static int pllp_init_done; + ? ? ? u32 reg;
board/nvidia/common/board.c
Quoted 10 lines
board/nvidia/common/board.c new file +10
-0+ + ? ? ? if (!pllp_init_done) { + + ? ? ? ? ? ? ? /* Override pllp setup for 216MHz operation. */ + ? ? ? ? ? ? ? reg = (PLL_BYPASS | PLL_BASE_OVRRIDE | PLL_DIVP); + ? ? ? ? ? ? ? reg |= (((NVRM_PLLP_FIXED_FREQ_KHZ/500) << 8) | PLL_DIVM); + ? ? ? ? ? ? ? writel(reg, clkrst->crc_pllp_base); + + ? ? ? ? ? ? ? reg |= PLL_ENABLE; + ? ? ? ? ? ? ? writel(reg, clkrst->crc_pllp_base);
Is this correct? Should it not be writel(reg, &clkrst->crc_pllp_base);
Similarly for other readl()'s and writel()'s
Regards,
Graeme
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
Graeme,
Quoted 16 lines · Graeme Russ
Quoted 14 lines · Tom Warren
board/nvidia/common/board.c new file +14
-0+ +/* +* Routine: uart_clock_init +* Description: init the PLL and clock for the UART in uart_num +*/ +void uart_clock_init (int uart_num) +{ + ? ? ? clk_rst_ctlr *const clkrst = (clk_rst_ctlr *)NV_PA_CLK_RST_BASE; + ? ? ? static int pllp_init_done; + ? ? ? u32 reg; + + ? ? ? if (!pllp_init_done) { + + ? ? ? ? ? ? ? /* Override pllp setup for 216MHz operation. */
Quoted 8 lines
Quoted 6 lines
+ ? ? ? ? ? ? ? reg = (
PLL_BYPASS|PLL_BASE_OVRRIDE|PLL_DIVP);
+ ? ? ? ? ? ? ? reg |= (((NVRM_PLLP_FIXED_FREQ_KHZ/500) << 8) |PLL_DIVM);
+ ? ? ? ? ? ? ?writel(reg, clkrst->crc_pllp_base);
+
+ ? ? ? ? ? ? ? reg |=PLL_ENABLE;
+ ? ? ? ? ? ? ?writel(reg, clkrst->crc_pllp_base);Is this correct? Should it not be
writel(reg, &clkrst->crc_pllp_base);
Well, the PLLs, UART and device clocks that I'm writing all seem to work OK.
I'll take a look at the ARM asm code generated, but you are probably right. But shouldn't the compiler have complained if I wasn't passing the struct address?
Quoted 7 lines
Similarly for other readl()'s and writel()'s
Regards,
Graeme
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
Dear Tom Warren,
Quoted 4 lines · In message <[email protected]> you…
I'll take a look at the ARM asm code generated, but you are probably right. But shouldn't the compiler have complained if I wasn't passing the struct address?
I'm surprised about this, too. But then, current mainline code still has the horrible "(*(volatile unsigned int *)(a) = (v))" definition, so the cast will eat all potential warnings :-(
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "...all the good computer designs are bootlegged; the formally planned products, if they are built at all, are dogs!" - David E. Lundstrom, "A Few Good Men From Univac", MIT Press, 1987
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
Quoted 4 lines · Wolfgang Denk
Dear Tom Warren,
Quoted 1 line · In message <[email protected]> you…
Quoted 8 lines
Quoted 3 lines
I'll take a look at the ARM asm code generated, but you are probably right. But shouldn't the compiler have complained if I wasn't passing the struct address?
I'm surprised about this, too. ?But then, current mainline code still has the horrible "(*(volatile unsigned int *)(a) = (v))" definition, so the cast will eat all potential warnings :-(
Yes, I noticed this with x86 - I can do something like the following without the compiler warning me:
typdef struct blah {
u32 foo;
u16 bar;
} blah_t;
blah_t *fred = 0x00001000;
writel(1, &fred->foo);writel(1, &fred->bar);writew(1, &fred->foo);writew(1, &fred->bar);
This is particularly nasty with the sc520's Memory Mapped Control Registers - I have found a few here and there where longs were being written to words and visa-versa
Regards,
Graeme
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
In reply to Tom WarrenDear Tom Warren,
Quoted 1 line · In message <[email protected]> you wrote:
Signed-off-by Tom Warren <[email protected]>
checkpatch.pl reports:
total: 6 errors, 12 warnings, 1155 lines checked
/tmp/patch has style problems, please review.
Please clean up.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Where shall I begin, please your Majesty?" he asked. "Begin at the beginning," the King said, gravely, "and go on till you come to the end: then stop." - Alice's Adventures in Wonderland, Lewis Carroll
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
Wolfgang,
Quoted 5 lines · Wolfgang Denk
Dear Tom Warren,
Quoted 1 line · In message <[email protected]> you wrote:
Signed-off-by Tom Warren <[email protected]>
Quoted 7 lines
checkpatch.pl reports:
? ? ? ?total: 6 errors, 12 warnings, 1155 lines checked
? ? ? ?/tmp/patch has style problems, please review.
Please clean up.
I run checkpatch.pl (v 0.31) on every patch before I submit it, and I did see 12 warnings but
no errors. The warnings were minor - new typedefs and volatile structs. Could you please
provide the text of the checkpatch.pl output so I can see what the errors might be?
Thanks.
Quoted 13 lines
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Where shall I begin, please your Majesty?" he asked. "Begin ?at ?the beginning," ?the ?King said, gravely, "and go on till you come to the
end: then stop." ? ?- Alice's Adventures in Wonderland, Lewis Carroll
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
Dear Tom Warren,
Quoted 7 lines · In message <[email protected]> you…
I run checkpatch.pl (v 0.31) on every patch before I submit it, and I did see 12 warnings but
no errors. The warnings were minor - new typedefs and volatile structs. Could you please
provide the text of the checkpatch.pl output so I can see what the errors might be?
Sorry for the false alarms, I was using an older version of checkpatch.
Best regards,
Wolfgang Denk
Signature · 9 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de It took him several minutes to understand any new idea put to him, and this is a very valuable trait in a leader, because anything any- one is still trying to explain to you after two minutes is probably important and anything they give up after a mere minute or so is al- most certainly something they shouldn't have been bothering you with in the first place. - Terry Pratchett, _Reaper Man_
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
In reply to Tom WarrenQuoted 42 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>---
Changes for V2:
- Coding style cleanup
- Move serial driver changes to separate patch
- Use board/nvidia/ instead of /board/tegra
- Remove TRUE/FALSE defines
- Use standard NS16550 register/bit defines in UART initChanges for V3:
- Use I/O accessors for Tegra2 HW MMIO register access
- Allow conditional compile of UARTA/UARTD code to save spacearch/arm/cpu/armv7/tegra2/Makefile | 48 +++++ arch/arm/cpu/armv7/tegra2/board.c | 91 ++++++++++ arch/arm/cpu/armv7/tegra2/config.mk | 28 +++ arch/arm/cpu/armv7/tegra2/lowlevel_init.S | 66 +++++++ arch/arm/cpu/armv7/tegra2/sys_info.c | 35 ++++ arch/arm/cpu/armv7/tegra2/timer.c | 122 +++++++++++++ arch/arm/include/asm/arch-tegra2/clk_rst.h | 155 ++++++++++++++++ arch/arm/include/asm/arch-tegra2/pinmux.h | 52 ++++++ arch/arm/include/asm/arch-tegra2/pmc.h | 125 +++++++++++++ arch/arm/include/asm/arch-tegra2/sys_proto.h | 33 ++++ arch/arm/include/asm/arch-tegra2/tegra2.h | 49 +++++ arch/arm/include/asm/arch-tegra2/uart.h | 45 +++++ board/nvidia/common/board.c | 249 ++++++++++++++++++++++++++ board/nvidia/common/board.h | 57 ++++++ 14 files changed, 1155 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/armv7/tegra2/Makefile create mode 100644 arch/arm/cpu/armv7/tegra2/board.c create mode 100644 arch/arm/cpu/armv7/tegra2/config.mk create mode 100644 arch/arm/cpu/armv7/tegra2/lowlevel_init.S create mode 100644 arch/arm/cpu/armv7/tegra2/sys_info.c create mode 100644 arch/arm/cpu/armv7/tegra2/timer.c create mode 100644 arch/arm/include/asm/arch-tegra2/clk_rst.h create mode 100644 arch/arm/include/asm/arch-tegra2/pinmux.h create mode 100644 arch/arm/include/asm/arch-tegra2/pmc.h create mode 100644 arch/arm/include/asm/arch-tegra2/sys_proto.h create mode 100644 arch/arm/include/asm/arch-tegra2/tegra2.h create mode 100644 arch/arm/include/asm/arch-tegra2/uart.h create mode 100644 board/nvidia/common/board.c create mode 100644 board/nvidia/common/board.h
[ snip ]
arch/arm/include/asm/arch-tegra2/clk_rst.h line 29
Quoted 8 lines
+ */
arch/arm/include/asm/arch-tegra2/clk_rst.h new file +7
-0+ +#ifndef _CLK_RST_H_ +#define _CLK_RST_H_ + +/* Clock/Reset Controller (CLK_RST_CONTROLLER_) regs */ + +typedef volatile struct clk_rst_ctlr {
Is it necessary to use the structure to map the clocks and reset controller? Wouldn't be better to port Linux implementation of Tegra2 clocks to U-Boot as well? Besides, since you're using I/O accessors anyway, the struct can replaces with base address and offset definitions.
Quoted 6 lines
arch/arm/include/asm/arch-tegra2/clk_rst.h new file +6
-0+uint crc_rst_src;/* _RST_SOURCE_0, 0x00*/ +uint crc_rst_dev_l;/* _RST_DEVICES_L_0, 0x04*/ +uint crc_rst_dev_h;/* _RST_DEVICES_H_0, 0x08*/ +uint crc_rst_dev_u;/* _RST_DEVICES_U_0, 0x0C*/ +uint crc_clk_out_enb_l;/* _CLK_OUT_ENB_L_0, 0x10*/ +uint crc_clk_out_enb_h;/* _CLK_OUT_ENB_H_0, 0x14*/
[ snip ]
arch/arm/include/asm/arch-tegra2/pinmux.h line 29
Quoted 7 lines
arch/arm/include/asm/arch-tegra2/pinmux.h new file +7
-0+ +#ifndef _PINMUX_H_ +#define _PINMUX_H_ + +/* APB MISC Pin Mux and Tristate (APB_MISC_PP_) registers */ + +typedef volatile struct pinmux_tri_ctlr {
The same comment is valid also for the pin multiplexing registers...
arch/arm/include/asm/arch-tegra2/pmc.h line 29
Quoted 10 lines
arch/arm/include/asm/arch-tegra2/pmc.h new file +10
-0+uint pmt_reserved0;/* ABP_MISC_PP_ reserved offset 00 */ +uint pmt_reserved1;/* ABP_MISC_PP_ reserved offset 04 */ +uint pmt_strap_opt_a;/* _STRAPPING_OPT_A_0, offset 08 */ + +#ifndef _PMC_H_ +#define _PMC_H_ + +/* Power Management Controller (APBDEV_PMC_) registers */ + +typedef volatile struct pmc_ctlr {
And for the PMC registers as well.
Quoted 5 lines
arch/arm/include/asm/arch-tegra2/pmc.h new file +5
-0+uint pmc_cntrl;/* _CNTRL_0, offset 00 */ +uint pmc_sec_disable;/* _SEC_DISABLE_0, offset 04 */ +uint pmc_pmc_swrst;/* _PMC_SWRST_0, offset 08 */ +uint pmc_wake_mask;/* _WAKE_MASK_0, offset 0C */ +uint pmc_wake_lvl;/* _WAKE_LVL_0, offset 10 */
[ snip ]
arch/arm/include/asm/arch-tegra2/tegra2.h line 36
Quoted 13 lines
arch/arm/include/asm/arch-tegra2/tegra2.h new file +13
-0+#ifndef _TEGRA2_H_ +#define _TEGRA2_H_ + +#define NV_PA_SDRAM_BASE 0x00000000 +#define NV_PA_TMRUS_BASE 0x60005010 +#define NV_PA_CLK_RST_BASE 0x60006000 +#define NV_PA_APB_MISC_BASE 0x70000000 +#define NV_PA_APB_UARTA_BASE (NV_PA_APB_MISC_BASE + 0x6000) +#define NV_PA_APB_UARTB_BASE (NV_PA_APB_MISC_BASE + 0x6040) +#define NV_PA_APB_UARTC_BASE (NV_PA_APB_MISC_BASE + 0x6200) +#define NV_PA_APB_UARTD_BASE (NV_PA_APB_MISC_BASE + 0x6300) +#define NV_PA_APB_UARTE_BASE (NV_PA_APB_MISC_BASE + 0x6400) +#define NV_PA_PMC_BASE 0x7000E400
what is the purpose of NV_PA prefix here?
Quoted 6 lines
arch/arm/include/asm/arch-tegra2/tegra2.h new file +6
-0+#define TEGRA2_SDRC_CS0 NV_PA_SDRAM_BASE +#define LOW_LEVEL_SRAM_STACK 0x4000FFFC + +#ifndef __ASSEMBLY__ +typedef volatile struct timerus { + unsigned int cntr_1us;
[ snip ]
arch/arm/include/asm/arch-tegra2/uart.h line 29
Quoted 6 lines
arch/arm/include/asm/arch-tegra2/uart.h new file +6
-0+#ifndef _UART_H_ +#define _UART_H_ + +/* UART registers */ + +typedef volatile struct uart_ctlr {
The same comment as for the other struct *_ctrl...
board/nvidia/common/board.c
Quoted 21 lines
arch/arm/include/asm/arch-tegra2/uart.h new file +16
-0+uint uart_thr_dlab_0;/* UART_THR_DLAB_0_0, offset 00 */ +uint uart_ier_dlab_0;/* UART_IER_DLAB_0_0, offset 04 */ +uint uart_iir_fcr;/* UART_IIR_FCR_0, offset 08 */ +uint uart_lcr;/* UART_LCR_0, offset 0C */ +uint uart_mcr;/* UART_MCR_0, offset 10 */ +uint uart_lsr;/* UART_LSR_0, offset 14 */ +uint uart_msr;/* UART_MSR_0, offset 18 */ +uint uart_spr;/* UART_SPR_0, offset 1C */ +uint uart_irda_csr;/* UART_IRDA_CSR_0, offset 20 */ +uint uart_reserved[6 ];/* Reserved, unused */ + uint uart_asr; /* UART_ASR_0, offset 3C */ +} uart_ctlr; + +#define UART_FCR_TRIGGER_3 0x30/* Mask for trigger set at 3 */ + +#endif /* UART_H */ board/nvidia/common/board.c new file +0
-0
It seems that this file is supposed to include code common to all Tegra2 based boards and not only NVidia boards. I'd suggest moving its contents to the arch/arm/cpu/armv7/tegra2/board.c
Quoted 5 lines
board/nvidia/common/board.c new file +4
-0@@ -0,0 +1,249 @@ +/* +* (C) Copyright 2010,2011 +* NVIDIA Corporation <www.nvidia.com> +*
[ snip ]
Quoted 9 lines
board/nvidia/common/board.c new file +9
-0+/* +* Routine: pin_mux_uart +* Description: setup the pin muxes/tristate values for UART based on uart_num +*/ +void pin_mux_uart (int uart_num) +{ +pinmux_tri_ctlr *const pmt = (pinmux_tri_ctlr *)NV_PA_APB_MISC_BASE ; +u32 reg; +
board/nvidia/common/board.c line 161
Quoted 10 lines
board/nvidia/common/board.c new file +10
-0+#if CONFIG_TEGRA2_ENABLE_UARTA +if (uart_num ==UART_A ) { + reg =readl (pmt->pmt_ctl_c); + reg &=0xFFF0FFFF ;/* IRRX_/IRTX_SEL [19:16] = 00 UARTA */ +writel (reg, pmt->pmt_ctl_c); + + reg =readl (pmt->pmt_tri_a); + reg &= ~Z_IRRX ;/* Z_IRRX = normal (0) */ + reg &= ~Z_IRTX ;/* Z_IRTX = normal (0) */ +writel (reg, pmt->pmt_tri_a);
This covers only one possiblity of UART-A pin muxing options
board/nvidia/common/board.c line 173
Quoted 12 lines
board/nvidia/common/board.c new file +12
-0+ } +#endif /* CONFIG_TEGRA2_ENABLE_UARTA */ +#if CONFIG_TEGRA2_ENABLE_UARTD +if (uart_num ==UART_D ) { + reg =readl (pmt->pmt_ctl_b); + reg &=0xFFFFFFF3 ;/* GMC_SEL [3:2] = 00, UARTD */ +writel (reg, pmt->pmt_ctl_b); + + reg =readl (pmt->pmt_tri_a); + reg &= ~Z_GMC ;/* Z_GMC = normal (0) */ +writel (reg, pmt->pmt_tri_a); + }
ditto for UART-D
Quoted 139 lines
board/nvidia/common/board.c new file +76
-0+#endif /* CONFIG_TEGRA2_ENABLE_UARTD */ +} + +void setup_uart (uart_ctlr *u) +{ +u32 reg; + +/* Prepare the divisor value */ + reg =NVRM_PLLP_FIXED_FREQ_KHZ *1000 /NV_DEFAULT_DEBUG_BAUD /16 ; + +/* Set up UART parameters */ +writel (UART_LCR_DLAB , u->uart_lcr); +writel (reg, u->uart_thr_dlab_0); +writel (0 , u->uart_ier_dlab_0); +writel (0 , u->uart_lcr);/* clear DLAB */ +writel ((UART_FCR_TRIGGER_3 |UART_FCR_FIFO_EN | \ +UART_FCR_CLEAR_XMIT |UART_FCR_CLEAR_RCVR ), u->uart_iir_fcr); +writel (0 , u->uart_ier_dlab_0); +writel (UART_LCR_WLS_8 , u->uart_lcr);/* 8N1 */ +writel (UART_MCR_RTS , u->uart_mcr); +writel (0 , u->uart_msr); +writel (0 , u->uart_spr); +writel (0 , u->uart_irda_csr); +writel (0 , u->uart_asr); +writel ((UART_FCR_TRIGGER_3 |UART_FCR_FIFO_EN ), u->uart_iir_fcr); + +/* Flush any old characters out of the RX FIFO */ + reg =readl (u->uart_lsr); + +while (reg &UART_LSR_DR ) { + reg =readl (u->uart_thr_dlab_0); + reg =readl (u->uart_lsr); + } +} + +/* +* Routine: init_uart +* Description: init the UART clocks, muxes, and baudrate/parity/etc. +*/ +void init_uart (int uart_num) +{ +#if CONFIG_TEGRA2_ENABLE_UARTA +if (uart_num ==UART_A ) { +uart_ctlr *const uart = (uart_ctlr *)NV_PA_APB_UARTA_BASE ; + +uart_clock_init (UART_A ); + +/* Enable UARTA - uses config 0 */ +pin_mux_uart (UART_A ); + +setup_uart (uart); + } +#endif /* CONFIG_TEGRA2_ENABLE_UARTD */ +#if CONFIG_TEGRA2_ENABLE_UARTD +if (uart_num ==UART_D ) { +uart_ctlr *const uart = (uart_ctlr *)NV_PA_APB_UARTD_BASE ; + +uart_clock_init (UART_D ); + +/* Enable UARTD - uses config 0 */ +pin_mux_uart (UART_D ); + +setup_uart (uart); + } +#endif /* CONFIG_TEGRA2_ENABLE_UARTD */ +} + +void uart_init (void ) +{ +#if (CONFIG_TEGRA2_ENABLE_UARTA ) +init_uart (UART_A ); +#endif +#if (CONFIG_TEGRA2_ENABLE_UARTD ) +init_uart (UART_D ); +#endif +}board/nvidia/common/board.h new file +57
-0@@ -0,0 +1,57 @@ +/* +* (C) Copyright 2010,2011 +* 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 _COMMON_BOARD_H_ +#define _COMMON_BOARD_H_ + +#include <asm/arch/clk_rst.h> +#include <asm/arch/pinmux.h> +#include <asm/arch/uart.h> + +#define NVRM_PLLP_FIXED_FREQ_KHZ 216000 +#define NV_DEFAULT_DEBUG_BAUD 115200 + +#define PLL_BYPASS (1 << 31) +#define PLL_ENABLE (1 << 30) +#define PLL_BASE_OVRRIDE (1 << 28) +#define PLL_DIVP (1 << 20)/* post divider, b22:20 */ +#define PLL_DIVM 0x0C/* input divider, b4:0 */ + +#define SWR_UARTD_RST (1 << 2) +#define CLK_ENB_UARTD (1 << 2) +#define SWR_UARTA_RST (1 << 6) +#define CLK_ENB_UARTA (1 << 6) + +#define Z_GMC (1 << 29) +#define Z_IRRX (1 << 20) +#define Z_IRTX (1 << 19) + +enum { +UART_A =1 , +UART_B , +UART_C , +UART_D , +UART_E +}; + +#endif /* _COMMON_BOARD_H_ */
Signature · 2 lines
Sincerely yours, Mike.
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
Mike,
Quoted 46 lines · Mike Rapoport
Quoted 42 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>---
Changes for V2:
? ? ? ? - Coding style cleanup
? ? ? ? - Move serial driver changes to separate patch ? ? ? ? - Use board/nvidia/ instead of /board/tegra
? ? ? ? - Remove TRUE/FALSE defines
? ? ? ? - Use standard NS16550 register/bit defines in UART initChanges for V3:
? ? ? ? - Use I/O accessors for Tegra2 HW MMIO register access ? ? ? ? - Allow conditional compile of UARTA/UARTD code to save space?arch/arm/cpu/armv7/tegra2/Makefile ? ? ? ? ? | ? 48 +++++ ?arch/arm/cpu/armv7/tegra2/board.c ? ? ? ? ? ?| ? 91 ++++++++++ ?arch/arm/cpu/armv7/tegra2/config.mk ? ? ? ? ?| ? 28 +++ ?arch/arm/cpu/armv7/tegra2/lowlevel_init.S ? ?| ? 66 +++++++ ?arch/arm/cpu/armv7/tegra2/sys_info.c ? ? ? ? | ? 35 ++++ ?arch/arm/cpu/armv7/tegra2/timer.c ? ? ? ? ? ?| ?122 +++++++++++++ ?arch/arm/include/asm/arch-tegra2/clk_rst.h ? | ?155 ++++++++++++++++ ?arch/arm/include/asm/arch-tegra2/pinmux.h ? ?| ? 52 ++++++ ?arch/arm/include/asm/arch-tegra2/pmc.h ? ? ? | ?125 +++++++++++++ ?arch/arm/include/asm/arch-tegra2/sys_proto.h | ? 33 ++++ ?arch/arm/include/asm/arch-tegra2/tegra2.h ? ?| ? 49 +++++ ?arch/arm/include/asm/arch-tegra2/uart.h ? ? ?| ? 45 +++++ ?board/nvidia/common/board.c ? ? ? ? ? ? ? ? ?| ?249 ++++++++++++++++++++++++++ ?board/nvidia/common/board.h ? ? ? ? ? ? ? ? ?| ? 57 ++++++?14 files changed, 1155 insertions(+), 0 deletions(-) ?create mode 100644
arch/arm/cpu/armv7/tegra2/Makefile?create mode 100644arch/arm/cpu/armv7/tegra2/board.c?create mode 100644arch/arm/cpu/armv7/tegra2/config.mk?create mode 100644arch/arm/cpu/armv7/tegra2/lowlevel_init.S?create mode 100644arch/arm/cpu/armv7/tegra2/sys_info.c?create mode 100644arch/arm/cpu/armv7/tegra2/timer.c?create mode 100644arch/arm/include/asm/arch-tegra2/clk_rst.h?create mode 100644arch/arm/include/asm/arch-tegra2/pinmux.h?create mode 100644arch/arm/include/asm/arch-tegra2/pmc.h?create mode 100644arch/arm/include/asm/arch-tegra2/sys_proto.h?create mode 100644arch/arm/include/asm/arch-tegra2/tegra2.h?create mode 100644arch/arm/include/asm/arch-tegra2/uart.h?create mode 100644board/nvidia/common/board.c?create mode 100644board/nvidia/common/board.h[ snip ]
Quoted 13 lines
arch/arm/include/asm/arch-tegra2/clk_rst.h line 29
Quoted 8 lines
+ */
arch/arm/include/asm/arch-tegra2/clk_rst.h new file +7
-0+ +#ifndef _CLK_RST_H_ +#define _CLK_RST_H_ + +/* Clock/Reset Controller (CLK_RST_CONTROLLER_) regs */ + +typedef volatile struct clk_rst_ctlr {Is it necessary to use the structure to map the clocks and reset controller? Wouldn't be better to port Linux implementation of Tegra2 clocks to U-Boot as well? Besides, since you're using I/O accessors anyway, the struct can replaces with base address and offset definitions.
I asked Wolfgang to pre-review the original patch, and this is what he said about original
base+offset register access code:
Wolfgang> We do not allow this in U-Boot. Please turn all offset tables into C structs, and
Wolfgang> create a set of I/O accessor functions (or macros) as needed to provide the needed
Wolfgang> memory barriers on your architecture.
Using structs seems like a natural way to map HW MMIO regs, and is done throughout U-Boot.
The structs are already written, contain just the members needed for U-Boot (to a large degree),
and as Wolfgang has said in the past, U-Boot is not Linux, so I see no reason to bring in the
Linux Tegra2 structs for any of these HW blocks. When I start posting the drivers (SPI, USB,
etc.), then it might make sense to use (copy w/edits) the Linux data structs, etc.
Quoted 41 lines
Quoted 7 lines
+ ? ? uint
crc_rst_src; ? ? ? ? ? ? ? /*_RST_SOURCE_0, ? ? ? 0x00*/
+ ? ? uintcrc_rst_dev_l; ? ? ? ? ? ? /*_RST_DEVICES_L_0, ? ?0x04*/
+ ? ? uintcrc_rst_dev_h; ? ? ? ? ? ? /*_RST_DEVICES_H_0, ? ?0x08*/
+ ? ? uintcrc_rst_dev_u; ? ? ? ? ? ? /*_RST_DEVICES_U_0, ? ?0x0C*/
+ ? ? uintcrc_clk_out_enb_l; ? ? ? ? /*_CLK_OUT_ENB_L_0, ? ?0x10*/
+ ? ? uintcrc_clk_out_enb_h; ? ? ? ? /*_CLK_OUT_ENB_H_0, ? ?0x14*/[ snip ]
arch/arm/include/asm/arch-tegra2/pinmux.h line 29
Quoted 7 lines
arch/arm/include/asm/arch-tegra2/pinmux.h new file +7
-0+ +#ifndef _PINMUX_H_ +#define _PINMUX_H_ + +/* APB MISC Pin Mux and Tristate (APB_MISC_PP_) registers */ + +typedef volatile struct pinmux_tri_ctlr {The same comment is valid also for the pin multiplexing registers...
arch/arm/include/asm/arch-tegra2/pmc.h line 29
Quoted 10 lines
+ ? ? uint
pmt_reserved0; ? ? ? ? ? ? /*ABP_MISC_PP_reserved offset 00 */
+ ? ? uintpmt_reserved1; ? ? ? ? ? ? /*ABP_MISC_PP_reserved offset 04 */
+ ? ? uintpmt_strap_opt_a; ? ? ? ? ? /*_STRAPPING_OPT_A_0, offset 08 */arch/arm/include/asm/arch-tegra2/pmc.h new file +7
-0+ +#ifndef _PMC_H_ +#define _PMC_H_ + +/* Power Management Controller (APBDEV_PMC_) registers */ + +typedef volatile struct pmc_ctlr {And for the PMC registers as well.
Quoted 5 lines
+ ? ? uint
pmc_cntrl; ? ? ? ? ? ? ? ? /*_CNTRL_0, offset 00 */
+ ? ? uintpmc_sec_disable; ? ? ? ? ? /*_SEC_DISABLE_0, offset 04 */
+ ? ? uintpmc_pmc_swrst; ? ? ? ? ? ? /*_PMC_SWRST_0, offset 08 */
+ ? ? uintpmc_wake_mask; ? ? ? ? ? ? /*_WAKE_MASK_0, offset 0C */
+ ? ? uintpmc_wake_lvl; ? ? ? ? ? ? ?/*_WAKE_LVL_0, offset 10 */[ snip ]
Quoted 15 lines
arch/arm/include/asm/arch-tegra2/tegra2.h
Quoted 13 lines
arch/arm/include/asm/arch-tegra2/tegra2.h new file +13
-0+#ifndef _TEGRA2_H_ +#define _TEGRA2_H_ + +#define NV_PA_SDRAM_BASE ? ? 0x00000000 +#define NV_PA_TMRUS_BASE ? ? 0x60005010 +#define NV_PA_CLK_RST_BASE ? 0x60006000 +#define NV_PA_APB_MISC_BASE ?0x70000000 +#define NV_PA_APB_UARTA_BASE (NV_PA_APB_MISC_BASE + 0x6000) +#define NV_PA_APB_UARTB_BASE (NV_PA_APB_MISC_BASE + 0x6040) +#define NV_PA_APB_UARTC_BASE (NV_PA_APB_MISC_BASE + 0x6200) +#define NV_PA_APB_UARTD_BASE (NV_PA_APB_MISC_BASE + 0x6300) +#define NV_PA_APB_UARTE_BASE (NV_PA_APB_MISC_BASE + 0x6400) +#define NV_PA_PMC_BASE ? ? ? ? ? ? ? 0x7000E400what is the purpose of
NV_PAprefix here?
NV_Physical_Address - a base address of a HW block (Power Management Cntrlr, etc.)
Quoted 35 lines
Quoted 6 lines
arch/arm/include/asm/arch-tegra2/tegra2.h new file +6
-0+#define TEGRA2_SDRC_CS0 ? ? ? ? ? ? ?NV_PA_SDRAM_BASE +#define LOW_LEVEL_SRAM_STACK 0x4000FFFC + +#ifndef __ASSEMBLY__ +typedef volatile struct timerus { + ? ? unsigned int cntr_1us;[ snip ]
arch/arm/include/asm/arch-tegra2/uart.h line 29
Quoted 6 lines
arch/arm/include/asm/arch-tegra2/uart.h new file +6
-0+#ifndef _UART_H_ +#define _UART_H_ + +/* UART registers */ + +typedef volatile struct uart_ctlr {The same comment as for the other struct
*_ctrl...Quoted 17 lines
+ ? ? uint
uart_thr_dlab_0; ? ? ? ? ? /*UART_THR_DLAB_0_0, offset 00 */
+ ? ? uintuart_ier_dlab_0; ? ? ? ? ? /*UART_IER_DLAB_0_0, offset 04 */
+ ? ? uintuart_iir_fcr; ? ? ? ? ? ? ?/*UART_IIR_FCR_0, offset 08 */
+ ? ? uintuart_lcr; ? ? ? ? ? ? ? ? ?/*UART_LCR_0, offset 0C */
+ ? ? uintuart_mcr; ? ? ? ? ? ? ? ? ?/*UART_MCR_0, offset 10 */
+ ? ? uintuart_lsr; ? ? ? ? ? ? ? ? ?/*UART_LSR_0, offset 14 */
+ ? ? uintuart_msr; ? ? ? ? ? ? ? ? ?/*UART_MSR_0, offset 18 */
+ ? ? uintuart_spr; ? ? ? ? ? ? ? ? ?/*UART_SPR_0, offset 1C */
+ ? ? uintuart_irda_csr; ? ? ? ? ? ? /*UART_IRDA_CSR_0, offset 20 */
+ ? ? uint uart_reserved[6]; ? ? ? ? ?/* Reserved, unused */
+ ? ? uintuart_asr; ? ? ? ? ? ? ? ? ?/*UART_ASR_0, offset 3C */arch/arm/include/asm/arch-tegra2/uart.h new file +5
-0+} uart_ctlr; + +#define UART_FCR_TRIGGER_3 ? 0x30 ? ?/* Mask for trigger set at 3 */ + +#endif ? ? ?/* UART_H */ board/nvidia/common/board.c +0
-0
Quoted 8 lines
board/nvidia/common/board.c
Quoted 4 lines
new file mode 100644
index 0000000..876facbboard/nvidia/common/board.c new file +0
-0It seems that this file is supposed to include code common to all Tegra2 based boards and not only NVidia boards. I'd suggest moving its contents to the
arch/arm/cpu/armv7/tegra2/board.c
board_init and timer_init funcs are found mostly in board/xxxx files in U-Boot, with
a few instances (mostly timer_init) in arch/arm/cpu/xxx files. I'd prefe to leave this file
where it is.
Quoted 22 lines
Quoted 6 lines
board/nvidia/common/board.c new file +4
-0@@ -0,0 +1,249 @@ +/* +* ?(C) Copyright 2010,2011 +* ?NVIDIA Corporation <www.nvidia.com> +* [ snip ]
Quoted 13 lines
board/nvidia/common/board.c new file +13
-0+/* +* Routine: pin_mux_uart +* Description: setup the pin muxes/tristate values for UART based on uart_num +*/ +void pin_mux_uart (int uart_num) +{ + ? ? pinmux_tri_ctlr *const pmt = (pinmux_tri_ctlr *)NV_PA_APB_MISC_BASE; + ? ? u32 reg; + +#if CONFIG_TEGRA2_ENABLE_UARTA + ? ? if (uart_num ?== UART_A) { + ? ? ? ? ? ? reg = readl(pmt->pmt_ctl_c); + ? ? ? ? ? ? reg &= 0xFFF0FFFF; ? ? ?/* IRRX_/IRTX_SEL [19:16] = 00 UARTA */
Quoted 8 lines
Quoted 6 lines
+ ? ? ? ? ? ?
writel(reg, pmt->pmt_ctl_c);
+
+ ? ? ? ? ? ? reg =readl(pmt->pmt_tri_a);
+ ? ? ? ? ? ? reg &= ~Z_IRRX; ? ? ? ? /*Z_IRRX= normal (0) */
+ ? ? ? ? ? ? reg &= ~Z_IRTX; ? ? ? ? /*Z_IRTX= normal (0) */
+ ? ? ? ? ? ?writel(reg, pmt->pmt_tri_a);This covers only one possiblity of UART-A pin muxing options
True, and when this code was in the board/nvidia/xxx area it made sense. To date, all of our Tegra boards use these pinmux options for both UARTs. If a board vendor chooses to use different pinmuxes, then they can override these funcs in their board files, or use their own code triggered by their own defines. But according to our HW guys, the vast majority will use these pins.
Quoted 15 lines
board/nvidia/common/board.c
Quoted 13 lines
+ ? ? }
board/nvidia/common/board.c new file +11
-0+#endif ? ? ? /* CONFIG_TEGRA2_ENABLE_UARTA */ +#if CONFIG_TEGRA2_ENABLE_UARTD + ? ? if (uart_num == UART_D) { + ? ? ? ? ? ? reg = readl(pmt->pmt_ctl_b); + ? ? ? ? ? ? reg &= 0xFFFFFFF3; ? ? ?/* GMC_SEL [3:2] = 00, UARTD */ + ? ? ? ? ? ? writel(reg, pmt->pmt_ctl_b); + + ? ? ? ? ? ? reg = readl(pmt->pmt_tri_a); + ? ? ? ? ? ? reg &= ~Z_GMC; ? ? ? ? ?/* Z_GMC = normal (0) */ + ? ? ? ? ? ? writel(reg, pmt->pmt_tri_a); + ? ? }ditto for UART-D
See my comment above.
Quoted 137 lines
Quoted 137 lines
board/nvidia/common/board.c new file +76
-0+#endif ? ? ? /* CONFIG_TEGRA2_ENABLE_UARTD */ +} + +void setup_uart (uart_ctlr *u) +{ + ? ? u32 reg; + + ? ? /* Prepare the divisor value */ + ? ? reg = NVRM_PLLP_FIXED_FREQ_KHZ * 1000 / NV_DEFAULT_DEBUG_BAUD / 16; + + ? ? /* Set up UART parameters */ + ? ? writel(UART_LCR_DLAB, u->uart_lcr); + ? ? writel(reg, u->uart_thr_dlab_0); + ? ? writel(0, u->uart_ier_dlab_0); + ? ? writel(0, u->uart_lcr); ? ? ? ? ? ? ? ? /* clear DLAB */ + ? ? writel((UART_FCR_TRIGGER_3 | UART_FCR_FIFO_EN | \ + ? ? ? ? ? ? UART_FCR_CLEAR_XMIT | UART_FCR_CLEAR_RCVR), u->uart_iir_fcr); + ? ? writel(0, u->uart_ier_dlab_0); + ? ? writel(UART_LCR_WLS_8, u->uart_lcr); ? ?/* 8N1 */ + ? ? writel(UART_MCR_RTS, u->uart_mcr); + ? ? writel(0, u->uart_msr); + ? ? writel(0, u->uart_spr); + ? ? writel(0, u->uart_irda_csr); + ? ? writel(0, u->uart_asr); + ? ? writel((UART_FCR_TRIGGER_3 | UART_FCR_FIFO_EN), u->uart_iir_fcr); + + ? ? /* Flush any old characters out of the RX FIFO */ + ? ? reg = readl(u->uart_lsr); + + ? ? while (reg & UART_LSR_DR) { + ? ? ? ? ? ? reg = readl(u->uart_thr_dlab_0); + ? ? ? ? ? ? reg = readl(u->uart_lsr); + ? ? } +} + +/* +* Routine: init_uart +* Description: init the UART clocks, muxes, and baudrate/parity/etc. +*/ +void init_uart (int uart_num) +{ +#if CONFIG_TEGRA2_ENABLE_UARTA + ? ? if (uart_num == UART_A) { + ? ? ? ? ? ? uart_ctlr *const uart = (uart_ctlr *)NV_PA_APB_UARTA_BASE; + + ? ? ? ? ? ? uart_clock_init(UART_A); + + ? ? ? ? ? ? /* Enable UARTA - uses config 0 */ + ? ? ? ? ? ? pin_mux_uart(UART_A); + + ? ? ? ? ? ? setup_uart(uart); + ? ? } +#endif ? ? ? /* CONFIG_TEGRA2_ENABLE_UARTD */ +#if CONFIG_TEGRA2_ENABLE_UARTD + ? ? if (uart_num == UART_D) { + ? ? ? ? ? ? uart_ctlr *const uart = (uart_ctlr *)NV_PA_APB_UARTD_BASE; + + ? ? ? ? ? ? uart_clock_init(UART_D); + + ? ? ? ? ? ? /* Enable UARTD - uses config 0 */ + ? ? ? ? ? ? pin_mux_uart(UART_D); + + ? ? ? ? ? ? setup_uart(uart); + ? ? } +#endif ? ? ? /* CONFIG_TEGRA2_ENABLE_UARTD */ +} + +void uart_init (void ) +{ +#if (CONFIG_TEGRA2_ENABLE_UARTA ) + ? ? init_uart(UART_A); +#endif +#if (CONFIG_TEGRA2_ENABLE_UARTD ) + ? ? init_uart(UART_D); +#endif +}board/nvidia/common/board.h new file +54
-0@@ -0,0 +1,57 @@ +/* +* ?(C) Copyright 2010,2011 +* ?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 _COMMON_BOARD_H_ +#define _COMMON_BOARD_H_ + +#include <asm/arch/clk_rst.h> +#include <asm/arch/pinmux.h> +#include <asm/arch/uart.h> + +#define NVRM_PLLP_FIXED_FREQ_KHZ ? ? 216000 +#define NV_DEFAULT_DEBUG_BAUD ? ? ? ? ? ? ? ?115200 + +#define PLL_BYPASS ? ? ? ? ? (1 << 31) +#define PLL_ENABLE ? ? ? ? ? (1 << 30) +#define PLL_BASE_OVRRIDE ? ? (1 << 28) +#define PLL_DIVP ? ? ? ? ? ? (1 << 20) ? ? ?/* post divider, b22:20 */ +#define PLL_DIVM ? ? ? ? ? ? 0x0C ? ? ? ? ? ?/* input divider, b4:0 */ + +#define SWR_UARTD_RST ? ? ? ? ? ? ? ?(1 << 2) +#define CLK_ENB_UARTD ? ? ? ? ? ? ? ?(1 << 2) +#define SWR_UARTA_RST ? ? ? ? ? ? ? ?(1 << 6) +#define CLK_ENB_UARTA ? ? ? ? ? ? ? ?(1 << 6) + +#define Z_GMC ? ? ? ? ? ? ? ? ? ? ? ?(1 << 29) +#define Z_IRRX ? ? ? ? ? ? ? ? ? ? ? (1 << 20) +#define Z_IRTX ? ? ? ? ? ? ? ? ? ? ? (1 << 19) + +enum { + ? ? UART_A = 1, + ? ? UART_B, + ? ? UART_C, + ? ? UART_D, + ? ? UART_E
Quoted 8 lines
board/nvidia/common/board.h line 57
Quoted 3 lines
board/nvidia/common/board.h new file +3
-0+}; + +#endif /* _COMMON_BOARD_H_ */ --
Sincerely yours,
Mike.
Thanks,
Tom
Quoted 1 line
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
Dear Tom Warren,
Quoted 1 line · In message <[email protected]> you…
...
Quoted 7 lines
Quoted 5 lines
arch/arm/include/asm/arch-tegra2/tegra2.h line 36
Quoted 3 lines
arch/arm/include/asm/arch-tegra2/tegra2.h new file +3
-0+#define NV_PA_APB_UARTD_BASE (NV_PA_APB_MISC_BASE + 0x6300) +#define NV_PA_APB_UARTE_BASE (NV_PA_APB_MISC_BASE + 0x6400) +#define NV_PA_PMC_BASE 0x7000E400what is the purpose of
NV_PAprefix here?
NV_Physical_Address- a base address of a HW block (Power Management Cntrlr, etc.)
Well, the NV_ part is not needed, right?
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Writing a book is like washing an elephant: there's no good place to begin or end, and it's hard to keep track of what you've already covered.
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
Wolfgang (& Mike),
Quoted 10 lines · Wolfgang Denk
Dear Tom Warren,
Quoted 1 line · In message <[email protected]> you…
...
Quoted 5 lines
Quoted 5 lines
arch/arm/include/asm/arch-tegra2/tegra2.h
Quoted 3 lines
arch/arm/include/asm/arch-tegra2/tegra2.h new file +3
-0+#define NV_PA_APB_UARTD_BASE (NV_PA_APB_MISC_BASE + 0x6300) +#define NV_PA_APB_UARTE_BASE (NV_PA_APB_MISC_BASE + 0x6400) +#define NV_PA_PMC_BASE ? ? ? ? ? ? ? 0x7000E400what is the purpose of
NV_PAprefix here?
Quoted 4 lines
Quoted 2 lines
NV_Physical_Address- a base address of a HW block (Power Management Cntrlr, etc.)Well, the
NV_part is not needed, right?
True. I can remove it, but why? It designates this as a NVIDIA-specific define. I see the same thing in AT91, OMAP, NetARM, DaVinci, IMX files, etc. etc.
Quoted 5 lines
Best regards,
Wolfgang Denk
Thanks,
Tom
Quoted 9 lines
--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Writing a book is like washing an elephant: there's no good place ?to begin ?or ?end, ?and ?it's ?hard to keep track of what you've already covered.
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
Dear Tom Warren,
Quoted 6 lines · In message <[email protected]> you…
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
arch/arm/include/asm/arch-tegra2/tegra2.h line 36
Quoted 4 lines
arch/arm/include/asm/arch-tegra2/tegra2.h new file +3
-0+#define NV_PA_APB_UARTD_BASE (NV_PA_APB_MISC_BASE + 0x6300) +#define NV_PA_APB_UARTE_BASE (NV_PA_APB_MISC_BASE + 0x6400) +#define NV_PA_PMC_BASE 0x7000E400what is the purpose of
NV_PAprefix here?
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
NV_Physical_Address- a base address of a HW block (Power Management Cntrlr, etc.)Well, the
NV_part is not needed, right?True. I can remove it, but why? It designates this as a NVIDIA-specific define. I see the same thing in AT91, OMAP, NetARM, DaVinci, IMX files, etc. etc.
OK, I don't insist.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de A weak mind is like a microscope, which magnifies trifling things, but cannot receive great ones. -- Philip Earl of Chesterfield
PATCH v3 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
In reply to Mike RapoportDear Mike Rapoport,
Quoted 3 lines · In message <[email protected]> you wrote:
Besides, since you're using I/O accessors anyway, the struct can replaces with base address and offset definitions.
We do not allow such construtcs in U-Boot. With C structs, you can have proper type checking by the compiler (well, at least assuming you have proper I/O accessors in place).
Quoted 6 lines
arch/arm/include/asm/arch-tegra2/tegra2.h line 36
Quoted 4 lines
arch/arm/include/asm/arch-tegra2/tegra2.h new file +4
-0+#define NV_PA_APB_UARTC_BASE (NV_PA_APB_MISC_BASE + 0x6200) +#define NV_PA_APB_UARTD_BASE (NV_PA_APB_MISC_BASE + 0x6300) +#define NV_PA_APB_UARTE_BASE (NV_PA_APB_MISC_BASE + 0x6400) +#define NV_PA_PMC_BASE 0x7000E400what is the purpose of
NV_PAprefix here?
Good catch.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de When the bosses talk about improving productivity, they are never talking about themselves.
PATCH v3 2/4 serial: Add Tegra2 serial port support
In reply to Tom Warren---
Changes for V2:
- Move serial driver changes to separate patch
common/serial.c | 3 ++- include/serial.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
common/serial.c +2 -1
@@ -41,7 +41,8 @@ struct serial_device *__default_serial_console (void)#elif defined(CONFIG_4xx) \ || defined(CONFIG_MB86R0x) || defined(CONFIG_MPC5xxx) \ || defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) \ - || defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520 ) + || defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520 ) \ + || defined(CONFIG_TEGRA2 )#if defined(CONFIG_CONS_INDEX ) && defined(CONFIG_SYS_NS16550_SERIAL )#if (CONFIG_CONS_INDEX ==1 )return &eserial1_device;
include/serial.h +2 -1
@@ -27,7 +27,8 @@ extern struct serial_device * default_serial_console (void);defined (CONFIG_405EP ) ||defined (CONFIG_405EZ ) ||defined (CONFIG_405EX ) || \defined (CONFIG_MB86R0x) ||defined (CONFIG_MPC5xxx) || \defined (CONFIG_MPC83xx) ||defined (CONFIG_MPC85xx) || \ - defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520) +defined (CONFIG_MPC86xx) ||defined (CONFIG_SYS_SC520 ) || \ + defined(CONFIG_TEGRA2)extern struct serial_device serial0_device;extern struct serial_device serial1_device;#if defined(CONFIG_SYS_NS16550_SERIAL )
Signature · 1 line
1.7.3.5
PATCH v3 3/4 arm: Tegra2: Add support for NVIDIA Harmony board
In reply to Tom Warren---
Changes for V2:
- Use board/nvidia/ instead of /board/tegra
- Change nv-common.h config file to tegra2-common.h
MAINTAINERS | 4 + board/nvidia/harmony/Makefile | 50 ++++++++++++ boards.cfg | 1 + include/configs/harmony.h | 48 ++++++++++++ include/configs/tegra2-common.h | 160 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 263 insertions(+), 0 deletions(-) create mode 100644 board/nvidia/harmony/Makefile create mode 100644 include/configs/harmony.h create mode 100644 include/configs/tegra2-common.h
MAINTAINERS +4 -0
@@ -841,6 +841,10 @@ Prafulla Wadaskar <[email protected]> rd6281a ARM926EJS (Kirkwood SoC) sheevaplug ARM926EJS (Kirkwood SoC) +Tom Warren <[email protected]> + + harmony Tegra2 (ARM7 & A9 Dual Core) + Matthias Weisser <[email protected]> jadecpu ARM926EJS (MB86R01 SoC)
board/nvidia/harmony/Makefile new file +50 -0
50 lines not on this page · raw message
boards.cfg +1 -0
@@ -122,6 +122,7 @@ omap4_panda arm armv7 panda ti omap4_sdp4430 arm armv7 sdp4430 ti omap4 s5p_goni arm armv7 goni samsung s5pc1xx smdkc100 arm armv7 smdkc100 samsung s5pc1xx +harmony arm armv7 harmony nvidia tegra2 actux1 arm ixp actux2 arm ixp actux3 arm ixp
include/configs/harmony.h new file +48 -0
48 lines not on this page · raw message
include/configs/tegra2-common.h new file +160 -0
160 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v3 3/4 arm: Tegra2: Add support for NVIDIA Harmony board
Quoted 11 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>---
Changes for V2:
- Use board/nvidia/ instead of /board/tegra
- Changenv-common.hconfig file totegra2-common.hMAINTAINERS | 4 + board/nvidia/harmony/Makefile | 50 ++++++++++++ boards.cfg | 1 + include/configs/harmony.h | 48 ++++++++++++ include/configs/tegra2-common.h | 160 +++++++++++++++++++++++++++++++++++++++
What about board/nvidia/harmony/harmony.c?
Quoted 308 lines
5 files changed, 263 insertions(+), 0 deletions(-) create mode 100644 board/nvidia/harmony/Makefile create mode 100644 include/configs/harmony.h create mode 100644 include/configs/tegra2-common.hMAINTAINERS +4
-0@@ -841,6 +841,10 @@ Prafulla Wadaskar <[email protected]> rd6281a ARM926EJS (Kirkwood SoC) sheevaplug ARM926EJS (Kirkwood SoC) +Tom Warren <[email protected]> + + harmony Tegra2 (ARM7 & A9 Dual Core) + Matthias Weisser <[email protected]> jadecpu ARM926EJS (MB86R01 SoC)board/nvidia/harmony/Makefile new file +50
-0@@ -0,0 +1,50 @@ +# +# (C) Copyright 2010,2011 +# 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 +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS += ../common/board.o + +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +clean: + rm -f $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak $(obj).depend + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################boards.cfg +1
-0@@ -122,6 +122,7 @@ omap4_panda arm armv7 panda ti omap4_sdp4430 arm armv7 sdp4430 ti omap4 s5p_goni arm armv7 goni samsung s5pc1xx smdkc100 arm armv7 smdkc100 samsung s5pc1xx +harmony arm armv7 harmony nvidia tegra2 actux1 arm ixp actux2 arm ixp actux3 arm ixpinclude/configs/harmony.h new file +48
-0@@ -0,0 +1,48 @@ +/* +* (C) Copyright 2010,2011 +* 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 __CONFIG_H +#define __CONFIG_H + +#include <asm/sizes.h> +#include "tegra2-common.h" + +/* High-level configuration options */ +#define TEGRA2_SYSMEM "mem=384M at 0M nvmem=128M at 384M mem=512M at 512M" +#define V_PROMPT "Tegra2 (Harmony) # " +#define CONFIG_TEGRA2_BOARD_STRING "NVIDIA Harmony" + +/* Board-specific serial config */ +#define CONFIG_SERIAL_MULTI +#define CONFIG_TEGRA2_ENABLE_UARTD 1 +#define CONFIG_TEGRA2_ENABLE_UARTA 0 + +/* UARTD: keyboard satellite board uart, default */ +#define CONFIG_SYS_NS16550_COM1 NV_PA_APB_UARTD_BASE +/* UARTA: debug board uart */ +#define CONFIG_SYS_NS16550_COM2 NV_PA_APB_UARTA_BASE + +#define CONFIG_MACH_TYPE MACH_TYPE_HARMONY +#define CONFIG_SYS_BOARD_ODMDATA 0x300d8011/* lp1, 1GB */ + +#endif /* __CONFIG_H */ include/configs/tegra2-common.h new file +160
-0@@ -0,0 +1,160 @@ +/* +* (C) Copyright 2010,2011 +* 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 __TEGRA2_COMMON_H +#define __TEGRA2_COMMON_H +#include <asm/sizes.h> + +/* +* High Level Configuration Options +*/ +#define CONFIG_ARMCORTEXA9 /* This is an ARM V7 CPU core */ +#define CONFIG_TEGRA2 /* in a NVidia Tegra2 core */ +#define CONFIG_MACH_TEGRA_GENERIC /* which is a Tegra generic machine */ +#define CONFIG_L2_OFF /* No L2 cache */ + +#include <asm/arch/tegra2.h> /* get chip and board defs */ + +/* +* Display CPU and Board information +*/ +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO + +#define CONFIG_SKIP_RELOCATE_UBOOT +#define CONFIG_SKIP_LOWLEVEL_INIT + +#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ + +/* Environment */ +#define CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_SIZE 0x20000/* Total Size Environment */ + +/* +* Size of malloc() pool +*/ +#define CONFIG_SYS_MALLOC_LEN (4 << 20)/* 4MB */ + +/* +* PllX Configuration +*/ +#define CONFIG_SYS_CPU_OSC_FREQUENCY 1000000/* Set CPU clock to 1GHz */ + +/* +* NS16550 Configuration +*/ +#define V_NS16550_CLK 216000000/* 216MHz (pllp_out0) */ + +#define CONFIG_SYS_NS16550 +#define CONFIG_SYS_NS16550_SERIAL +#define CONFIG_SYS_NS16550_REG_SIZE (-4) +#define CONFIG_SYS_NS16550_CLK V_NS16550_CLK + +/* +* select serial console configuration +*/ +#define CONFIG_CONS_INDEX 1 + +/* allow to overwrite serial and ethaddr */ +#define CONFIG_ENV_OVERWRITE +#define CONFIG_BAUDRATE 115200 +#define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\ + 115200} + +/* include default commands */ +#include <config_cmd_default.h> + +/* remove unused commands */ +#undef CONFIG_CMD_FLASH/* flinfo, erase, protect */ +#undef CONFIG_CMD_FPGA/* FPGA configuration support */ +#undef CONFIG_CMD_IMI +#undef CONFIG_CMD_IMLS +#undef CONFIG_CMD_NFS/* NFS support */ +#undef CONFIG_CMD_NET/* network support */ + +/* turn on command-line edit/hist/auto */ +#define CONFIG_CMDLINE_EDITING +#define CONFIG_COMMAND_HISTORY +#define CONFIG_AUTOCOMPLETE + +#define CONFIG_SYS_NO_FLASH + +/* Environment information */ +#define CONFIG_EXTRA_ENV_SETTINGS \ + "console=ttyS0,115200n8\0" \ + "mem=" TEGRA2_SYSMEM "\0" \ + "smpflag=smp\0" \ + +#define CONFIG_LOADADDR 0x408000/* def. location for kernel */ +#define CONFIG_BOOTDELAY 2/* -1 to disable auto boot */ + +/* +* Miscellaneous configurable options +*/ +#define CONFIG_SYS_LONGHELP /* undef to save memory */ +#define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */ +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " +#define CONFIG_SYS_PROMPT V_PROMPT +/* +* Increasing the size of the IO buffer as default nfsargs size is more +* than 256 and so it is not possible to edit it +*/ +#define CONFIG_SYS_CBSIZE (256 * 2)/* Console I/O Buffer Size */ +/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_MAXARGS 16/* max number of command args */ +/* Boot Argument Buffer Size */ +#define CONFIG_SYS_BARGSIZE (CONFIG_SYS_CBSIZE) + +#define CONFIG_SYS_MEMTEST_START (TEGRA2_SDRC_CS0 + 0x600000) +#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 0x100000) + +#define CONFIG_SYS_LOAD_ADDR (0xA00800)/* default */ +#define CONFIG_SYS_HZ 1000 + +/*----------------------------------------------------------------------- +* Stack sizes +* +* The stack sizes are set up in start.S using the settings below +*/ +#define CONFIG_STACKBASE 0x2800000/* 40MB */ +#define CONFIG_STACKSIZE 0x20000/* 128K regular stack*/ + +/*----------------------------------------------------------------------- +* Physical Memory Map +*/ +#define CONFIG_NR_DRAM_BANKS 1 +#define PHYS_SDRAM_1 TEGRA2_SDRC_CS0 +#define PHYS_SDRAM_1_SIZE 0x20000000/* 512M */ + +#define CONFIG_SYS_TEXT_BASE 0x00E08000 +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 + +#define CONFIG_SYS_INIT_RAM_ADDR CONFIG_STACKBASE +#define CONFIG_SYS_INIT_RAM_SIZE CONFIG_SYS_MALLOC_LEN +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \ + CONFIG_SYS_INIT_RAM_SIZE - \ + GENERATED_GBL_DATA_SIZE) + +#endif /* __TEGRA2_COMMON_H */
Signature · 2 lines
Sincerely yours, Mike.
PATCH v3 3/4 arm: Tegra2: Add support for NVIDIA Harmony board
Mike,
Quoted 7 lines · Mike Rapoport
Quoted 6 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>---
Changes for V2:
? ? ? ? - Use board/nvidia/ instead of /board/tegra ? ? ? ? - Changenv-common.hconfig file totegra2-common.h
Quoted 7 lines
Quoted 5 lines
?MAINTAINERS ? ? ? ? ? ? ? ? ? ? | ? ?4 + ?board/nvidia/harmony/Makefile ? | ? 50 ++++++++++++ ?boards.cfg ? ? ? ? ? ? ? ? ? ? ?| ? ?1 + ?include/configs/harmony.h ? ? ? | ? 48 ++++++++++++ ?include/configs/tegra2-common.h | ?160 +++++++++++++++++++++++++++++++++++++++What about
board/nvidia/harmony/harmony.c?
There is no harmony.c file currently - that was whittled down in previous patch edits.
It'll be brought back in future patches as features are added that are board-specific.
Quoted 306 lines
Quoted 306 lines
?5 files changed, 263 insertions(+), 0 deletions(-) ?create mode 100644 board/nvidia/harmony/Makefile ?create mode 100644
include/configs/harmony.h?create mode 100644include/configs/tegra2-common.hMAINTAINERS +4
-0@@ -841,6 +841,10 @@ Prafulla Wadaskar <[email protected]> ? ? ? rd6281a ? ? ? ? ARM926EJS (Kirkwood SoC) ? ? ? sheevaplug ? ? ?ARM926EJS (Kirkwood SoC) +Tom Warren <[email protected]> + + ? ? harmony ? ? ? ? Tegra2 (ARM7 & A9 Dual Core) +?Matthias Weisser <[email protected]>
? ? ? jadecpu ? ? ? ? ARM926EJS (MB86R01 SoC)
board/nvidia/harmony/Makefile new file +50
-0@@ -0,0 +1,50 @@ +# +# ?(C) Copyright 2010,2011 +# ?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 +# + +include $(TOPDIR)/config.mk + +LIB ?= $(obj)lib$(BOARD).o + +COBJS ? ? ? ?+= ../common/board.o + +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +$(LIB): ? ? ?$(obj).depend $(OBJS) + ? ? $(AR) $(ARFLAGS) $@ $(OBJS) + +clean: + ? ? rm -f $(OBJS) + +distclean: ? clean + ? ? rm -f $(LIB) core *.bak $(obj).depend + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################boards.cfg +0
-0@@ -122,6 +122,7 @@ omap4_panda ? ? ? ? ? ? ? ? ?arm ? ? ? ? armv7 ? ? ? panda ? ? ? ? ? ? ? ti?omap4_sdp4430 ? ? ? ? ? ? ? ?arm ? ? ? ? armv7 ? ? ? sdp4430 ? ? ? ? ? ? ti ? ? ? ? ? ? omap4 ?s5p_goni ? ? ? ? ? ? ? ? ? ? arm ? ? ? ? armv7 ? ? ? goni ? ? ? ? ? ? ? ?samsung ? ? ? ?s5pc1xx ?smdkc100 ? ? ? ? ? ? ? ? ? ? arm ? ? ? ? armv7 ? ? ? smdkc100 ? ? ? ? ? ?samsung ? ? ? ?s5pc1xx +harmony ? ? ? ? ? ? ? ? ? ? ?arm ? ? ? ? armv7 ? ? ? harmony ? ? ? ? ? ? nvidia ? ? ? ? tegra2 ?actux1 ? ? ? ? ? ? ? ? ? ? ? arm ? ? ? ? ixp
?actux2 ? ? ? ? ? ? ? ? ? ? ? arm ? ? ? ? ixp
?actux3 ? ? ? ? ? ? ? ? ? ? ? arm ? ? ? ? ixpinclude/configs/harmony.h new file +48
-0@@ -0,0 +1,48 @@ +/* +* ?(C) Copyright 2010,2011 +* ?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 __CONFIG_H +#define __CONFIG_H + +#include <asm/sizes.h> +#include "tegra2-common.h" + +/* High-level configuration options */ +#define TEGRA2_SYSMEM ? ? ? ? ? ? ? ?"mem=384M at 0M nvmem=128M at 384M mem=512M at 512M" +#define V_PROMPT ? ? ? ? ? ? "Tegra2 (Harmony) # " +#define CONFIG_TEGRA2_BOARD_STRING ? "NVIDIA Harmony" + +/* Board-specific serial config */ +#define CONFIG_SERIAL_MULTI +#define CONFIG_TEGRA2_ENABLE_UARTD ? 1 +#define CONFIG_TEGRA2_ENABLE_UARTA ? 0 + +/* UARTD: keyboard satellite board uart, default */ +#define CONFIG_SYS_NS16550_COM1 ? ? ? ? ? ? ?NV_PA_APB_UARTD_BASE +/* UARTA: debug board uart */ +#define CONFIG_SYS_NS16550_COM2 ? ? ? ? ? ? ?NV_PA_APB_UARTA_BASE + +#define CONFIG_MACH_TYPE ? ? ? ? ? ? MACH_TYPE_HARMONY +#define CONFIG_SYS_BOARD_ODMDATA ? ? 0x300d8011/* lp1, 1GB */ + +#endif /* __CONFIG_H */ include/configs/tegra2-common.h new file +157
-0@@ -0,0 +1,160 @@ +/* +* ?(C) Copyright 2010,2011 +* ?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 __TEGRA2_COMMON_H +#define __TEGRA2_COMMON_H +#include <asm/sizes.h> + +/* +* High Level Configuration Options +*/ +#define CONFIG_ARMCORTEXA9 ? ? ? ? ?/* This is an ARM V7 CPU core */ +#define CONFIG_TEGRA2 ? ? ? ? ? ? ? ? ? ? ? ?/* in a NVidia Tegra2 core */ +#define CONFIG_MACH_TEGRA_GENERIC ? ?/* which is a Tegra generic machine */ +#define CONFIG_L2_OFF ? ? ? ? ? ? ? ? ? ? ? ?/* No L2 cache */ + +#include <asm/arch/tegra2.h> ? ? ? ? /* get chip and board defs */ + +/* +* Display CPU and Board information +*/ +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO + +#define CONFIG_SKIP_RELOCATE_UBOOT +#define CONFIG_SKIP_LOWLEVEL_INIT + +#define CONFIG_CMDLINE_TAG ? ? ? ? ?/* enable passing of ATAGs */ + +/* Environment */ +#define CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_SIZE ? ? ? ? ? ? ? ? ? ? ?0x20000/* Total Size Environment */ + +/* +* Size of malloc() pool +*/ +#define CONFIG_SYS_MALLOC_LEN ? ? ? ? ? ? ? ?(4 << 20) ? ? ?/* 4MB ?*/ + +/* +* PllX Configuration +*/ +#define CONFIG_SYS_CPU_OSC_FREQUENCY 1000000/* Set CPU clock to 1GHz */ + +/* +* NS16550 Configuration +*/ +#define V_NS16550_CLK ? ? ? ? ? ? ? ? ? ? ? ?216000000 ? ? ?/* 216MHz (pllp_out0) */ + +#define CONFIG_SYS_NS16550 +#define CONFIG_SYS_NS16550_SERIAL +#define CONFIG_SYS_NS16550_REG_SIZE ?(-4) +#define CONFIG_SYS_NS16550_CLK ? ? ? ? ? ? ? V_NS16550_CLK + +/* +* select serial console configuration +*/ +#define CONFIG_CONS_INDEX ? ?1 + +/* allow to overwrite serial and ethaddr */ +#define CONFIG_ENV_OVERWRITE +#define CONFIG_BAUDRATE ? ? ? ? ? ? ? ? ? ? ?115200 +#define CONFIG_SYS_BAUDRATE_TABLE ? ?{4800, 9600, 19200, 38400, 57600,\ + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 115200} + +/* include default commands */ +#include <config_cmd_default.h> + +/* remove unused commands */ +#undef CONFIG_CMD_FLASH ? ? ? ? ? ? ?/* flinfo, erase, protect */ +#undef CONFIG_CMD_FPGA ? ? ? ? ? ? ?/* FPGA configuration support */ +#undef CONFIG_CMD_IMI +#undef CONFIG_CMD_IMLS +#undef CONFIG_CMD_NFS ? ? ? ? ? ? ? ?/* NFS support */ +#undef CONFIG_CMD_NET ? ? ? ? ? ? ? ?/* network support */ + +/* turn on command-line edit/hist/auto */ +#define CONFIG_CMDLINE_EDITING +#define CONFIG_COMMAND_HISTORY +#define CONFIG_AUTOCOMPLETE + +#define CONFIG_SYS_NO_FLASH + +/* Environment information */ +#define CONFIG_EXTRA_ENV_SETTINGS \ + ? ? "console=ttyS0,115200n8\0" \ + ? ? "mem=" TEGRA2_SYSMEM "\0" \ + ? ? "smpflag=smp\0" \ + +#define CONFIG_LOADADDR ? ? ? ? ? ? ?0x408000 ? ? ? ?/* def. location for kernel */ +#define CONFIG_BOOTDELAY ? ? 2 ? ? ? ? ? ? ?/* -1 to disable auto boot */ + +/* +* Miscellaneous configurable options +*/ +#define CONFIG_SYS_LONGHELP ? ? ? ? ?/* undef to save memory */ +#define CONFIG_SYS_HUSH_PARSER ? ? ? ? ? ? ?/* use "hush" command parser */ +#define CONFIG_SYS_PROMPT_HUSH_PS2 ? "> " +#define CONFIG_SYS_PROMPT ? ? ? ? ? ?V_PROMPT +/* +* Increasing the size of the IO buffer as default nfsargs size is more +* ?than 256 and so it is not possible to edit it +*/ +#define CONFIG_SYS_CBSIZE ? ? ? ? ? ?(256 * 2)/* Console I/O Buffer Size */ +/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE ? ? ? ? ? ?(CONFIG_SYS_CBSIZE + \ + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_MAXARGS ? ? ? ? ? 16 ? ? ?/* max number of command args */ +/* Boot Argument Buffer Size */ +#define CONFIG_SYS_BARGSIZE ? ? ? ? ?(CONFIG_SYS_CBSIZE) + +#define CONFIG_SYS_MEMTEST_START ? ? (TEGRA2_SDRC_CS0 + 0x600000) +#define CONFIG_SYS_MEMTEST_END ? ? ? ? ? ? ? (CONFIG_SYS_MEMTEST_START + 0x100000) + +#define CONFIG_SYS_LOAD_ADDR ? ? ? ? (0xA00800) ? ? ?/* default */ +#define CONFIG_SYS_HZ ? ? ? ? ? ? ? ? ? ? ? ?1000 + +/*----------------------------------------------------------------------- +* Stack sizes +* +* The stack sizes are set up in start.S using the settings below +*/ +#define CONFIG_STACKBASE ? ? 0x2800000 ? ? ?/* 40MB */ +#define CONFIG_STACKSIZE ? ? 0x20000 ? ? ? ?/* 128K regular stack*/ + +/*----------------------------------------------------------------------- +* Physical Memory Map +*/ +#define CONFIG_NR_DRAM_BANKS 1 +#define PHYS_SDRAM_1 ? ? ? ? TEGRA2_SDRC_CS0 +#define PHYS_SDRAM_1_SIZE ? ?0x20000000 ? ? ?/* 512M */ + +#define CONFIG_SYS_TEXT_BASE 0x00E08000 +#define CONFIG_SYS_SDRAM_BASE ? ? ? ?PHYS_SDRAM_1 + +#define CONFIG_SYS_INIT_RAM_ADDR ? ? CONFIG_STACKBASE +#define CONFIG_SYS_INIT_RAM_SIZE ? ? CONFIG_SYS_MALLOC_LEN +#define CONFIG_SYS_INIT_SP_ADDR ? ? ? ? ? ? ?(CONFIG_SYS_INIT_RAM_ADDR + \ + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CONFIG_SYS_INIT_RAM_SIZE - \
Quoted 8 lines
include/configs/tegra2-common.h line 160
Quoted 3 lines
include/configs/tegra2-common.h new file +3
-0+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? GENERATED_GBL_DATA_SIZE) + +#endif /* __TEGRA2_COMMON_H */ --
Sincerely yours,
Mike.
Thanks,
Tom
Quoted 1 line
PATCH v3 4/4 arm: Tegra2: Add support for NVIDIA Seaboard board
In reply to Tom Warren---
Changes for V2:
- Remove mach-types.h change; wait for ARM kernel sync-up
- Use board/nvidia/ instead of /board/tegra
MAINTAINERS | 1 + board/nvidia/seaboard/Makefile | 50 ++++++++++++++++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/seaboard.h | 44 +++++++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 0 deletions(-) create mode 100644 board/nvidia/seaboard/Makefile create mode 100644 include/configs/seaboard.h
MAINTAINERS +1 -0
@@ -844,6 +844,7 @@ Prafulla Wadaskar <[email protected]> Tom Warren <[email protected]> harmony Tegra2 (ARM7 & A9 Dual Core) + seaboard Tegra2 (ARM7 & A9 Dual Core) Matthias Weisser <[email protected]>
board/nvidia/seaboard/Makefile new file +50 -0
50 lines not on this page · raw message
boards.cfg +1 -0
@@ -123,6 +123,7 @@ omap4_sdp4430 arm armv7 sdp4430 ti s5p_goni arm armv7 goni samsung s5pc1xx smdkc100 arm armv7 smdkc100 samsung s5pc1xx harmony arm armv7 harmony nvidia tegra2 +seaboard arm armv7 seaboard nvidia tegra2 actux1 arm ixp actux2 arm ixp actux3 arm ixp
include/configs/seaboard.h new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
1.7.3.5