Add basic Tegra30 (T30) support
Subsystems (5)
cover Add basic Tegra30 (T30) support
This patch series adds basic (boot to cmd prompt) support for Tegra30. This is based on the Tegra20 SPL, which initializes the AVP (ARM7TDMI boot proc) first, then control is transferred to the CPU (A9 quad cluster). It is based on current u-boot-tegra/next.
Future patches will add support/drivers for MMC, USB, I2C, SPI, NAND, and other peripherals. The Cardhu T30 board is supported initially.
Tom Warren (9):
Tegra: T30: Add include files
Tegra: T30: Add AVP (arm720t) files
Tegra: T30: Add CPU (armv7) files
Tegra: T30: Add common Tegra30 CPU files
Tegra: DT: Add preliminary device tree files for T30 Cardhu
Tegra30: Add Cardhu board files
Tegra30: Add config files (common and Cardhu)
Tegra30: Add common pinmux config in board_early_init_f
Tegra30: Enable Cardhu build (SPL)
Makefile | 23 +
arch/arm/cpu/{armv7 => arm720t/tegra30}/Makefile | 27 +-
arch/arm/cpu/arm720t/tegra30/board.h | 25 +
arch/arm/cpu/arm720t/tegra30/config.mk | 26 +
arch/arm/cpu/arm720t/tegra30/cpu.c | 570 +++++++++++
arch/arm/cpu/arm720t/tegra30/cpu.h | 65 ++
arch/arm/cpu/arm720t/tegra30/spl.c | 132 +++
arch/arm/cpu/armv7/Makefile | 2 +-
arch/arm/cpu/armv7/start.S | 4 +-
arch/arm/cpu/armv7/{ => tegra30}/Makefile | 23 +-
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c | 65 ++
arch/arm/cpu/armv7/tegra30/config.mk | 26 +
arch/arm/cpu/{armv7 => tegra30-common}/Makefile | 28 +-
arch/arm/cpu/tegra30-common/ap30.c | 98 ++
arch/arm/cpu/tegra30-common/board.c | 141 +++
arch/arm/cpu/tegra30-common/clock.c | 1099 ++++++++++++++++++++++
arch/arm/cpu/tegra30-common/funcmux.c | 74 ++
arch/arm/cpu/tegra30-common/lowlevel_init.S | 42 +
arch/arm/cpu/tegra30-common/pinmux.c | 507 ++++++++++
arch/arm/cpu/tegra30-common/sys_info.c | 35 +
arch/arm/cpu/tegra30-common/timer.c | 111 +++
arch/arm/dts/tegra30.dtsi | 280 ++++++
arch/arm/include/asm/arch-tegra30/ap30.h | 99 ++
arch/arm/include/asm/arch-tegra30/board.h | 30 +
arch/arm/include/asm/arch-tegra30/clk_rst.h | 277 ++++++
arch/arm/include/asm/arch-tegra30/clock.h | 602 ++++++++++++
arch/arm/include/asm/arch-tegra30/emc.h | 113 +++
arch/arm/include/asm/arch-tegra30/flow.h | 42 +
arch/arm/include/asm/arch-tegra30/funcmux.h | 77 ++
arch/arm/include/asm/arch-tegra30/fuse.h | 39 +
arch/arm/include/asm/arch-tegra30/gp_padctrl.h | 73 ++
arch/arm/include/asm/arch-tegra30/gpio.h | 322 +++++++
arch/arm/include/asm/arch-tegra30/hardware.h | 29 +
arch/arm/include/asm/arch-tegra30/mmc.h | 28 +
arch/arm/include/asm/arch-tegra30/pinmux.h | 610 ++++++++++++
arch/arm/include/asm/arch-tegra30/pmc.h | 132 +++
arch/arm/include/asm/arch-tegra30/pmu.h | 30 +
arch/arm/include/asm/arch-tegra30/scu.h | 43 +
arch/arm/include/asm/arch-tegra30/sys_proto.h | 35 +
arch/arm/include/asm/arch-tegra30/tegra30.h | 109 +++
arch/arm/include/asm/arch-tegra30/tegra_i2c.h | 164 ++++
arch/arm/include/asm/arch-tegra30/timer.h | 31 +
arch/arm/include/asm/arch-tegra30/uart.h | 47 +
arch/arm/include/asm/arch-tegra30/usb.h | 253 +++++
arch/arm/include/asm/arch-tegra30/warmboot.h | 150 +++
board/nvidia/cardhu/Makefile | 48 +
board/nvidia/cardhu/cardhu.c | 87 ++
board/nvidia/cardhu/pinmux-config-common.h | 346 +++++++
board/nvidia/common/board.c | 27 +-
board/nvidia/dts/tegra30-cardhu.dts | 92 ++
boards.cfg | 1 +
drivers/gpio/tegra_gpio.c | 4 +
include/configs/cardhu.h | 52 +
include/configs/tegra30-common.h | 188 ++++
include/serial.h | 3 +-
spl/Makefile | 3 +
56 files changed, 7536 insertions(+), 53 deletions(-)
copy arch/arm/cpu/{armv7 => arm720t/tegra30}/Makefile (70%)
create mode 100644 arch/arm/cpu/arm720t/tegra30/board.h
create mode 100644 arch/arm/cpu/arm720t/tegra30/config.mk
create mode 100644 arch/arm/cpu/arm720t/tegra30/cpu.c
create mode 100644 arch/arm/cpu/arm720t/tegra30/cpu.h
create mode 100644 arch/arm/cpu/arm720t/tegra30/spl.c
copy arch/arm/cpu/armv7/{ => tegra30}/Makefile (76%)
create mode 100644 arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c
create mode 100644 arch/arm/cpu/armv7/tegra30/config.mk
copy arch/arm/cpu/{armv7 => tegra30-common}/Makefile (69%)
create mode 100644 arch/arm/cpu/tegra30-common/ap30.c
create mode 100644 arch/arm/cpu/tegra30-common/board.c
create mode 100644 arch/arm/cpu/tegra30-common/clock.c
create mode 100644 arch/arm/cpu/tegra30-common/funcmux.c
create mode 100644 arch/arm/cpu/tegra30-common/lowlevel_init.S
create mode 100644 arch/arm/cpu/tegra30-common/pinmux.c
create mode 100644 arch/arm/cpu/tegra30-common/sys_info.c
create mode 100644 arch/arm/cpu/tegra30-common/timer.c
create mode 100644 arch/arm/dts/tegra30.dtsi
create mode 100644 arch/arm/include/asm/arch-tegra30/ap30.h
create mode 100644 arch/arm/include/asm/arch-tegra30/board.h
create mode 100644 arch/arm/include/asm/arch-tegra30/clk_rst.h
create mode 100644 arch/arm/include/asm/arch-tegra30/clock.h
create mode 100644 arch/arm/include/asm/arch-tegra30/emc.h
create mode 100644 arch/arm/include/asm/arch-tegra30/flow.h
create mode 100644 arch/arm/include/asm/arch-tegra30/funcmux.h
create mode 100644 arch/arm/include/asm/arch-tegra30/fuse.h
create mode 100644 arch/arm/include/asm/arch-tegra30/gp_padctrl.h
create mode 100644 arch/arm/include/asm/arch-tegra30/gpio.h
create mode 100644 arch/arm/include/asm/arch-tegra30/hardware.h
create mode 100644 arch/arm/include/asm/arch-tegra30/mmc.h
create mode 100644 arch/arm/include/asm/arch-tegra30/pinmux.h
create mode 100644 arch/arm/include/asm/arch-tegra30/pmc.h
create mode 100644 arch/arm/include/asm/arch-tegra30/pmu.h
create mode 100644 arch/arm/include/asm/arch-tegra30/scu.h
create mode 100644 arch/arm/include/asm/arch-tegra30/sys_proto.h
create mode 100644 arch/arm/include/asm/arch-tegra30/tegra30.h
create mode 100644 arch/arm/include/asm/arch-tegra30/tegra_i2c.h
create mode 100644 arch/arm/include/asm/arch-tegra30/timer.h
create mode 100644 arch/arm/include/asm/arch-tegra30/uart.h
create mode 100644 arch/arm/include/asm/arch-tegra30/usb.h
create mode 100644 arch/arm/include/asm/arch-tegra30/warmboot.h
create mode 100644 board/nvidia/cardhu/Makefile
create mode 100644 board/nvidia/cardhu/cardhu.c
create mode 100644 board/nvidia/cardhu/pinmux-config-common.h
create mode 100644 board/nvidia/dts/tegra30-cardhu.dts
create mode 100644 include/configs/cardhu.h
create mode 100644 include/configs/tegra30-common.hPATCH 1/9 Tegra: T30: Add include files
--- arch/arm/include/asm/arch-tegra30/ap30.h | 99 ++++ arch/arm/include/asm/arch-tegra30/board.h | 30 ++ arch/arm/include/asm/arch-tegra30/clk_rst.h | 277 +++++++++++ arch/arm/include/asm/arch-tegra30/clock.h | 602 +++++++++++++++++++++++ arch/arm/include/asm/arch-tegra30/emc.h | 113 +++++ arch/arm/include/asm/arch-tegra30/flow.h | 42 ++ arch/arm/include/asm/arch-tegra30/funcmux.h | 77 +++ arch/arm/include/asm/arch-tegra30/fuse.h | 39 ++ arch/arm/include/asm/arch-tegra30/gp_padctrl.h | 73 +++ arch/arm/include/asm/arch-tegra30/gpio.h | 322 +++++++++++++ arch/arm/include/asm/arch-tegra30/hardware.h | 29 ++ arch/arm/include/asm/arch-tegra30/mmc.h | 28 ++ arch/arm/include/asm/arch-tegra30/pinmux.h | 610 ++++++++++++++++++++++++ arch/arm/include/asm/arch-tegra30/pmc.h | 132 +++++ arch/arm/include/asm/arch-tegra30/pmu.h | 30 ++ arch/arm/include/asm/arch-tegra30/scu.h | 43 ++ arch/arm/include/asm/arch-tegra30/sys_proto.h | 35 ++ arch/arm/include/asm/arch-tegra30/tegra30.h | 109 +++++ arch/arm/include/asm/arch-tegra30/tegra_i2c.h | 164 +++++++ arch/arm/include/asm/arch-tegra30/timer.h | 31 ++ arch/arm/include/asm/arch-tegra30/uart.h | 47 ++ arch/arm/include/asm/arch-tegra30/usb.h | 253 ++++++++++ arch/arm/include/asm/arch-tegra30/warmboot.h | 150 ++++++ 23 files changed, 3335 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-tegra30/ap30.h create mode 100644 arch/arm/include/asm/arch-tegra30/board.h create mode 100644 arch/arm/include/asm/arch-tegra30/clk_rst.h create mode 100644 arch/arm/include/asm/arch-tegra30/clock.h create mode 100644 arch/arm/include/asm/arch-tegra30/emc.h create mode 100644 arch/arm/include/asm/arch-tegra30/flow.h create mode 100644 arch/arm/include/asm/arch-tegra30/funcmux.h create mode 100644 arch/arm/include/asm/arch-tegra30/fuse.h create mode 100644 arch/arm/include/asm/arch-tegra30/gp_padctrl.h create mode 100644 arch/arm/include/asm/arch-tegra30/gpio.h create mode 100644 arch/arm/include/asm/arch-tegra30/hardware.h create mode 100644 arch/arm/include/asm/arch-tegra30/mmc.h create mode 100644 arch/arm/include/asm/arch-tegra30/pinmux.h create mode 100644 arch/arm/include/asm/arch-tegra30/pmc.h create mode 100644 arch/arm/include/asm/arch-tegra30/pmu.h create mode 100644 arch/arm/include/asm/arch-tegra30/scu.h create mode 100644 arch/arm/include/asm/arch-tegra30/sys_proto.h create mode 100644 arch/arm/include/asm/arch-tegra30/tegra30.h create mode 100644 arch/arm/include/asm/arch-tegra30/tegra_i2c.h create mode 100644 arch/arm/include/asm/arch-tegra30/timer.h create mode 100644 arch/arm/include/asm/arch-tegra30/uart.h create mode 100644 arch/arm/include/asm/arch-tegra30/usb.h create mode 100644 arch/arm/include/asm/arch-tegra30/warmboot.h
arch/arm/include/asm/arch-tegra30/ap30.h new file +99 -0
@@ -0,0 +1,99 @@ +/* +* (C) Copyright 2010-2012 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ +#include <asm/types.h> + +/* Stabilization delays, in usec */ +#define PLL_STABILIZATION_DELAY (300) +#define IO_STABILIZATION_DELAY (1000) + +#define NVBL_PLLP_KHZ (216000) + +#define PLLX_ENABLED (1 << 30) +#define CCLK_BURST_POLICY 0x20008888 +#define SUPER_CCLK_DIVIDER 0x80000000 + +/* Calculate clock fractional divider value from ref and target frequencies */ +#define CLK_DIVIDER (REF ,FREQ ) ((((REF) * 2) / FREQ) - 2) + +/* Calculate clock frequency value from reference and clock divider value */ +#define CLK_FREQUENCY (REF ,REG ) (((REF) * 2) / (REG + 2)) + +/* AVP/CPU ID */ +#define PG_UP_TAG_0_PID_CPU 0x55555555/* CPU aka "a9" aka "mpcore" */ +#define PG_UP_TAG_0 0x0 + +#define CORESIGHT_UNLOCK 0xC5ACCE55; + +/* T30-Specific Base Addresses */ + +/* T30 Base physical address of SDRAM. */ +#define T30_BASE_PA_SDRAM 0x00000000 +/* T30 Base physical address of internal SRAM. */ +#define T30_BASE_PA_SRAM 0x40000000 +/* T30 Size of internal SRAM (256KB). */ +#define T30_BASE_PA_SRAM_SIZE 0x00040000 +/* T30 Base physical address of flash. */ +#define T30_BASE_PA_NOR_FLASH 0xD0000000 +/* T30 Base physical address of boot information table. */ +#define T30_BASE_PA_BOOT_INFO T30_BASE_PA_SRAM + +/* +* Super-temporary stacks for EXTREMELY early startup. The values chosen for +* these addresses must be valid on ALL SOCs because this value is used before +* we are able to differentiate between the SOC types. +* +* NOTE: The since CPU's stack will eventually be moved from IRAM to SDRAM, its +* stack is placed below the AVP stack. Once the CPU stack has been moved, +* the AVP is free to use the IRAM the CPU stack previously occupied if +* it should need to do so. +* +* NOTE: In multi-processor CPU complex configurations, each processor will have +* its own stack of size CPU_EARLY_BOOT_STACK_SIZE. CPU 0 will have a +* limit of CPU_EARLY_BOOT_STACK_LIMIT. Each successive CPU will have a +* stack limit that is CPU_EARLY_BOOT_STACK_SIZE less then the previous +* CPU. +*/ + +/* Common AVP early boot stack limit */ +#define AVP_EARLY_BOOT_STACK_LIMIT \ + (T30_BASE_PA_SRAM + (T30_BASE_PA_SRAM_SIZE/2)) +/* Common AVP early boot stack size */ +#define AVP_EARLY_BOOT_STACK_SIZE 0x1000 +/* Common CPU early boot stack limit */ +#define CPU_EARLY_BOOT_STACK_LIMIT \ + (AVP_EARLY_BOOT_STACK_LIMIT - AVP_EARLY_BOOT_STACK_SIZE) +/* Common CPU early boot stack size */ +#define CPU_EARLY_BOOT_STACK_SIZE 0x1000 + +#define EXCEP_VECTOR_CPU_RESET_VECTOR (NV_PA_EVP_BASE + 0x100) +#define CSITE_CPU_DBG0_LAR (NV_PA_CSITE_BASE + 0x10FB0) +#define CSITE_CPU_DBG1_LAR (NV_PA_CSITE_BASE + 0x12FB0) + +#define FLOW_CTLR_HALT_COP_EVENTS (NV_PA_FLOW_BASE + 4) +#define FLOW_MODE_STOP 2 +#define HALT_COP_EVENT_JTAG (1 << 28) +#define HALT_COP_EVENT_IRQ_1 (1 << 11) +#define HALT_COP_EVENT_FIQ_1 (1 << 9) + +/* This is the main entry into U-Boot, used by the Cortex-A9 */ +extern void _start (void );
arch/arm/include/asm/arch-tegra30/board.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* (C) Copyright 2010-2012 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _TEGRA_BOARD_H_ +#define _TEGRA_BOARD_H_ + +/* Setup UARTs for the board according to the selected config */ +void board_init_uart_f (void ); + +#endif
arch/arm/include/asm/arch-tegra30/clk_rst.h new file +277 -0
277 lines not on this page · raw message
arch/arm/include/asm/arch-tegra30/clock.h new file +602 -0
602 lines not on this page · raw message
arch/arm/include/asm/arch-tegra30/emc.h new file +113 -0
113 lines not on this page · raw message
arch/arm/include/asm/arch-tegra30/flow.h new file +42 -0
42 lines not on this page · raw message
arch/arm/include/asm/arch-tegra30/funcmux.h new file +77 -0
77 lines not on this page · raw message
arch/arm/include/asm/arch-tegra30/fuse.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* (C) Copyright 2010-2012 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _FUSE_H_ +#define _FUSE_H_ + +/* FUSE registers */ +struct fuse_regs { +u32 reserved0[64 ];/* 0x00 - 0xFC: */ +u32 production_mode;/* 0x100: FUSE_PRODUCTION_MODE */ +u32 reserved1[3 ];/* 0x104 - 0x10c: */ +u32 sku_info;/* 0x110 */ +u32 reserved2[13 ];/* 0x114 - 0x144: */ +u32 fa;/* 0x148: FUSE_FA */ +u32 reserved3[21 ];/* 0x14C - 0x19C: */ +u32 security_mode;/* 0x1A0: FUSE_SECURITY_MODE */ +}; + +#endif /* _FUSE_H_ */
arch/arm/include/asm/arch-tegra30/gp_padctrl.h new file +73 -0
73 lines not on this page · raw message
arch/arm/include/asm/arch-tegra30/gpio.h new file +322 -0
322 lines not on this page · raw message
arch/arm/include/asm/arch-tegra30/hardware.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* (C) Copyright 2010-2012 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef __TEGRA_HW_H +#define __TEGRA_HW_H + +/* include tegra specific hardware definitions */ + +#endif /* __TEGRA_HW_H */
arch/arm/include/asm/arch-tegra30/mmc.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* Copyright (c) 2011, Google Inc. All rights reserved. +* Copyright (C) 2010-2012 NVIDIA Corporation <www.nvidia.com> +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _MMC_H_ +#define _MMC_H_ + +int tegra_mmc_init (int dev_index,int bus_width,int pwr_gpio,int cd_gpio); + +#endif /* _MMC_H_ */
arch/arm/include/asm/arch-tegra30/pinmux.h new file +610 -0
610 lines not on this page · raw message
arch/arm/include/asm/arch-tegra30/pmc.h new file +132 -0
132 lines not on this page · raw message
arch/arm/include/asm/arch-tegra30/pmu.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* (C) Copyright 2010-2012 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _ARCH_PMU_H_ +#define _ARCH_PMU_H_ + +/* Set core and CPU voltages to nominal levels */ +int pmu_set_nominal (void ); + +#endif /* _ARCH_PMU_H_ */
arch/arm/include/asm/arch-tegra30/scu.h new file +43 -0
43 lines not on this page · raw message
arch/arm/include/asm/arch-tegra30/sys_proto.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* (C) Copyright 2010-2012 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _SYS_PROTO_H_ +#define _SYS_PROTO_H_ + +struct tegra_sysinfo { +char *board_string; +}; + +void invalidate_dcache (void ); + +extern const struct tegra_sysinfo sysinfo; + +#endif
arch/arm/include/asm/arch-tegra30/tegra30.h new file +109 -0
109 lines not on this page · raw message
arch/arm/include/asm/arch-tegra30/tegra_i2c.h new file +164 -0
164 lines not on this page · raw message
arch/arm/include/asm/arch-tegra30/timer.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* Copyright (c) 2011 The Chromium OS Authors. +* Copyright (C) 2010-2012 NVIDIA Corporation <www.nvidia.com> +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +/* Tegra timer functions */ + +#ifndef _TEGRA_TIMER_H +#define _TEGRA_TIMER_H + +/* returns the current monotonic timer value in microseconds */ +unsigned long timer_get_us (void ); + +#endif /* _TEGRA_TIMER_H */
arch/arm/include/asm/arch-tegra30/uart.h new file +47 -0
47 lines not on this page · raw message
arch/arm/include/asm/arch-tegra30/usb.h new file +253 -0
68 lines not on this page · raw message
arch/arm/include/asm/arch-tegra30/warmboot.h new file +150 -0
150 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.0.4
Part of the diff is not shown here. View the raw message.
PATCH 1/9 Tegra: T30: Add include files
Quoted 1 line · Tom Warren
Signed-off-by Tom Warren <[email protected]>
A few things:
- I see some #define FOO[space][space]val that should be [tab]
- I didn't checkpatch.pl this (nor the whole series) but please do and let us know if it's clean or why the warnings are false positives.
- My preference is to bring in includes and C files and Makefiles and so on all at once, when each is needed / useful. YMMV and not a big deal.
- But please make sure that you aren't adding defines / structs / etc that aren't used at some point by the end of the series at least. Removing (and correcting!) structs and defines was one of the things I had to do on am33xx. If it wasn't added until the corresponding driver work was being pushed, it'd have saved me some time.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120913/1b9231ac/attachment.pgp>
PATCH 1/9 Tegra: T30: Add include files
Tom,
Quoted 6 lines · Tom Rini
Quoted 1 line · Tom Warren
Signed-off-by Tom Warren <[email protected]>A few things:
- I see some #define FOO[space][space]val that should be [tab]
Probably copied over from Tegra20 files. I'll turn on whitespace highlighting in my editor and fix 'em up.
Quoted 2 lines
- I didn't checkpatch.pl this (nor the whole series) but please do and let us know if it's clean or why the warnings are false positives.
I always run checkpath before submitting. I'll put a notice to that affect in the next version. Checkpatch ran clean w/only 1 false-positive about 'macros with complex values should be enclosed in parenthesis' for the "#define CONFIG_DEFAULT_DEVICE_TREE tegra30-cardhu" line in cardhu.h.
Quoted 9 lines
- My preference is to bring in includes and C files and Makefiles and so on all at once, when each is needed / useful. YMMV and not a big deal.
- But please make sure that you aren't adding defines / structs / etc that aren't used at some point by the end of the series at least. Removing (and correcting!) structs and defines was one of the things I had to do on am33xx. If it wasn't added until the corresponding driver work was being pushed, it'd have saved me some time.
Sure, and that's good advice. I took a couple of passes during the port to try and remove vestigial and/or useless/unsupported files, features, and code, but I'm sure I missed some (as Stephen has already pointed out). I'll address those in V2.
Thanks,
Tom
Quoted 2 lines
--
Tom
PATCH 1/9 Tegra: T30: Add include files
Hi Tom,
Quoted 32 lines · Tom Warren
Tom,
Quoted 6 lines · Tom Rini
Quoted 1 line · Tom Warren
Signed-off-by Tom Warren <[email protected]>A few things:
- I see some #define FOO[space][space]val that should be [tab]Probably copied over from Tegra20 files. I'll turn on whitespace highlighting in my editor and fix 'em up.
Quoted 2 lines
- I didn't checkpatch.pl this (nor the whole series) but please do and let us know if it's clean or why the warnings are false positives.
I always run checkpath before submitting. I'll put a notice to that affect in the next version. Checkpatch ran clean w/only 1 false-positive about 'macros with complex values should be enclosed in parenthesis' for the "#define
CONFIG_DEFAULT_DEVICE_TREEtegra30-cardhu" line incardhu.h.Quoted 9 lines
- My preference is to bring in includes and C files and Makefiles and so on all at once, when each is needed / useful. YMMV and not a big deal.
- But please make sure that you aren't adding defines / structs / etc that aren't used at some point by the end of the series at least. Removing (and correcting!) structs and defines was one of the things I had to do on am33xx. If it wasn't added until the corresponding driver work was being pushed, it'd have saved me some time.
Quoted 4 lines
Sure, and that's good advice. I took a couple of passes during the port to try and remove vestigial and/or useless/unsupported files, features, and code, but I'm sure I missed some (as Stephen has already pointed out). I'll address those in V2.
Congrats on getting this out. It is a lot of work!
In the Chromium tree, we have an arch-tegra directory where a lot of the common code lives. It sounds like you are going to split that out a bit which is good. I suspect you may also want a few patches to move quite a bit of the code in arch/arm/include/arch-tegra20 to arch/arm/include/arch-tegra.
Regards,
Simon
Quoted 10 lines
Thanks,
Tom
Quoted 2 lines
--
Tom_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 1/9 Tegra: T30: Add include files
Simon,
Quoted 40 lines · Simon Glass
Hi Tom,
Quoted 32 lines · Tom Warren
Tom,
Quoted 6 lines · Tom Rini
Quoted 1 line · Tom Warren
Signed-off-by Tom Warren <[email protected]>A few things:
- I see some #define FOO[space][space]val that should be [tab]Probably copied over from Tegra20 files. I'll turn on whitespace highlighting in my editor and fix 'em up.
Quoted 2 lines
- I didn't checkpatch.pl this (nor the whole series) but please do and let us know if it's clean or why the warnings are false positives.
I always run checkpath before submitting. I'll put a notice to that affect in the next version. Checkpatch ran clean w/only 1 false-positive about 'macros with complex values should be enclosed in parenthesis' for the "#define
CONFIG_DEFAULT_DEVICE_TREEtegra30-cardhu" line incardhu.h.Quoted 9 lines
- My preference is to bring in includes and C files and Makefiles and so on all at once, when each is needed / useful. YMMV and not a big deal.
- But please make sure that you aren't adding defines / structs / etc that aren't used at some point by the end of the series at least. Removing (and correcting!) structs and defines was one of the things I had to do on am33xx. If it wasn't added until the corresponding driver work was being pushed, it'd have saved me some time.Quoted 4 lines
Sure, and that's good advice. I took a couple of passes during the port to try and remove vestigial and/or useless/unsupported files, features, and code, but I'm sure I missed some (as Stephen has already pointed out). I'll address those in V2.
Quoted 7 lines
Congrats on getting this out. It is a lot of work!
In the Chromium tree, we have an arch-tegra directory where a lot of the common code lives. It sounds like you are going to split that out a bit which is good. I suspect you may also want a few patches to move quite a bit of the code in
arch/arm/include/arch-tegra20toarch/arm/include/arch-tegra.
As per a side-discussion with TomR and StephenW, I am in the process of recasting this T30 patchset as a move to common Tegra code. It'll mimic quite a lot of the Chromium U-Boot directory structure, I'm sure.
Thanks,
Tom
Quoted 14 lines
Regards,
SimonQuoted 10 lines
Thanks,
Tom
Quoted 2 lines
--
Tom_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 1/9 Tegra: T30: Add include files
In reply to Tom WarrenQuoted 1 line · Tom Warren
Signed-off-by Tom Warren <[email protected]>
Hmm. This is rather large to review, but I tried to at least glance through it all and spot obvious issues...
arch/arm/include/asm/arch-tegra30/ap30.h line 50
Quoted 4 lines
arch/arm/include/asm/arch-tegra30/ap30.h +2
-0+/* T30 Base physical address of SDRAM. */ +#define T30_BASE_PA_SDRAM 0x00000000
That should be 0x80000000. The fact anything still works with this issue implies this constant isn't used anywhere? Aha, I see NV_PA_SDRAM_BASE defined later with the correct value...
arch/arm/include/asm/arch-tegra30/ap30.h line 56
Quoted 2 lines
arch/arm/include/asm/arch-tegra30/ap30.h +2
-0+/* T30 Base physical address of flash. */ +#define T30_BASE_PA_NOR_FLASH 0xD0000000
I don't know where NOR actually is mapped, but it can't be there; that's in the middle of SDRAM (2G..4G-1)
arch/arm/include/asm/arch-tegra30/board.h line 25
Quoted 4 lines
arch/arm/include/asm/arch-tegra30/board.h +2
-0+#ifndef _TEGRA_BOARD_H_ +#define _TEGRA_BOARD_H_
I wonder if include guards shouldn't say TEGRA30 not just TEGRA. That would avoid any conflict between the different arch/arm/include/asm/arch-tegra* directories. Sure, that's unlikely right now, but if we really continue to push device tree, maybe we'll end up with a unified Tegra20/Tegra30 bootloader image, and need to include both.
arch/arm/include/asm/arch-tegra30/clk_rst.h line 25
Quoted 4 lines
arch/arm/include/asm/arch-tegra30/clk_rst.h +2
-0+#ifndef _CLK_RST_H_ +#define _CLK_RST_H_
Hmm, and the naming format isn't consistent.
Quoted 3 lines
arch/arm/include/asm/arch-tegra30/clk_rst.h +3
-0+/* The clocks supported by the hardware */ +enum periph_id { +PERIPH_ID_FIRST ,
...
Quoted 8 lines
arch/arm/include/asm/arch-tegra30/clk_rst.h +8
-0+/* +* Clock peripheral IDs which sadly don't match up with PERIPH_ID. we want +* callers to use the PERIPH_ID for all access to peripheral clocks to avoid +* confusion bewteen PERIPH_ID_... and PERIPHC_... +* +* We don't call this CLOCK_PERIPH_ID or PERIPH_CLOCK_ID as it would just be +* confusing. +*/
arch/arm/include/asm/arch-tegra30/clk_rst.h
Quoted 10 lines
arch/arm/include/asm/arch-tegra30/clk_rst.h +10
-0+enum periphc_internal_id { +/* 0x00 */ +PERIPHC_I2S1 , +PERIPHC_I2S2 , +PERIPHC_SPDIF_OUT , +PERIPHC_SPDIF_IN , +PERIPHC_PWM , + PERIPHC_05h, +PERIPHC_SBC2 , +PERIPHC_SBC3 ,
...
Can you make sure that one/both (whichever is appropriate) of these line up with the proposed Linux kernel Tegra30 clock binding clock IDs. I'm not sure if the Tegra30 proposed binding has been published yet, but Prashant Gaikwad can email you the patch off-list if you need.
Quoted 1 line
+void
clock_enable(enum periph_id clkid);
Hmm. I would have expected all the prototypes to be in a common header between Tegra20 and Tegra30?
Quoted 23 lines
arch/arm/include/asm/arch-tegra30/funcmux.h +21
-0+/* Configs supported by the func mux */ +enum { +FUNCMUX_DEFAULT =0 ,/* default config */ + +/* UART configs */ +FUNCMUX_UART1_ULPI_UART2 =0 , +FUNCMUX_UART2_IRDA =0 , +FUNCMUX_UART4_GMC =0 , + +/* I2C configs */ +FUNCMUX_DVC_I2CP =0 , +FUNCMUX_I2C1_RM =0 , +FUNCMUX_I2C2_DDC =0 , +FUNCMUX_I2C2_PTA , +FUNCMUX_I2C3_DTF =0 , + +/* SDMMC configs */ +FUNCMUX_SDMMC1_SDIO1_4BIT =0 , +FUNCMUX_SDMMC2_DTA_DTD_8BIT =0 , +FUNCMUX_SDMMC3_SDB_4BIT =0 , +FUNCMUX_SDMMC3_SDB_SLXA_8BIT ,
arch/arm/include/asm/arch-tegra30/funcmux.h line 58
Quoted 10 lines
arch/arm/include/asm/arch-tegra30/funcmux.h +10
-0+FUNCMUX_SDMMC4_ATC_ATD_8BIT =0 , +FUNCMUX_SDMMC4_ATB_GMA_4_BIT , +FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT , + +/* USB configs */ +FUNCMUX_USB2_ULPI =0 , + +/* Serial Flash configs */ + FUNCMUX_SPI1_GMC_GMD = 0, +};
Those all look like Tegra20 options. Tegra30 doesn't have mux pin groups (muxing is per-pin now), so names like DTA, DTD, SDB, SLXA, ATB, GMA, ... above don't make any sense (they're Tegra20 pin group names).
In turn, I wonder if a funcmux.h-style API even makes sense for Tegra30, since the number of legal configurations is probably too large to usefully enumerate, but that is perhaps another question.
Quoted 28 lines
arch/arm/include/asm/arch-tegra30/gp_padctrl.h +26
-0+/* APB_MISC_GP and padctrl registers */ +struct apb_misc_gp_ctlr { +u32 modereg;/* 0x00: APB_MISC_GP_MODEREG */ +u32 hidrev;/* 0x04: APB_MISC_GP_HIDREV */ +u32 reserved0[22 ];/* 0x08 - 0x5C: */ +u32 emu_revid;/* 0x60: APB_MISC_GP_EMU_REVID */ +u32 xactor_scratch;/* 0x64: APB_MISC_GP_XACTOR_SCRATCH */ +u32 aocfg1;/* 0x68: APB_MISC_GP_AOCFG1PADCTRL */ +u32 aocfg2;/* 0x6c: APB_MISC_GP_AOCFG2PADCTRL */ +u32 atcfg1;/* 0x70: APB_MISC_GP_ATCFG1PADCTRL */ +u32 atcfg2;/* 0x74: APB_MISC_GP_ATCFG2PADCTRL */ +u32 cdevcfg1;/* 0x78: APB_MISC_GP_CDEV1CFGPADCTRL */ +u32 cdevcfg2;/* 0x7C: APB_MISC_GP_CDEV2CFGPADCTRL */ +u32 csuscfg;/* 0x80: APB_MISC_GP_CSUSCFGPADCTRL */ +u32 dap1cfg;/* 0x84: APB_MISC_GP_DAP1CFGPADCTRL */ +u32 dap2cfg;/* 0x88: APB_MISC_GP_DAP2CFGPADCTRL */ +u32 dap3cfg;/* 0x8C: APB_MISC_GP_DAP3CFGPADCTRL */ +u32 dap4cfg;/* 0x90: APB_MISC_GP_DAP4CFGPADCTRL */ +u32 dbgcfg;/* 0x94: APB_MISC_GP_DBGCFGPADCTRL */ +u32 lcdcfg1;/* 0x98: APB_MISC_GP_LCDCFG1PADCTRL */ +u32 lcdcfg2;/* 0x9C: APB_MISC_GP_LCDCFG2PADCTRL */ +u32 sdmmc2_cfg;/* 0xA0: APB_MISC_GP_SDMMC2CFGPADCTRL */ +u32 sdmmc3_cfg;/* 0xA4: APB_MISC_GP_SDMMC3CFGPADCTRL */ +u32 spicfg;/* 0xA8: APB_MISC_GP_SPICFGPADCTRL */ +u32 uaacfg;/* 0xAC: APB_MISC_GP_UAACFGPADCTRL */ +u32 uabcfg;/* 0xB0: APB_MISC_GP_UABCFGPADCTRL */
arch/arm/include/asm/arch-tegra30/gp_padctrl.h line 62
Quoted 10 lines
arch/arm/include/asm/arch-tegra30/gp_padctrl.h +10
-0+u32 uart2cfg;/* 0xB4: APB_MISC_GP_UART2CFGPADCTRL */ +u32 uart3cfg;/* 0xB8: APB_MISC_GP_UART3CFGPADCTRL */ +u32 vicfg1;/* 0xBC: APB_MISC_GP_VICFG1PADCTRL */ +u32 vicfg2;/* 0xC0: APB_MISC_GP_VICFG2PADCTRL */ +u32 xm2cfga;/* 0xC4: APB_MISC_GP_XM2CFGAPADCTRL */ +u32 xm2cfgc;/* 0xC8: APB_MISC_GP_XM2CFGCPADCTRL */ +u32 xm2cfgd;/* 0xCC: APB_MISC_GP_XM2CFGDPADCTRL */ +u32 xm2clkcfg;/* 0xD0: APB_MISC_GP_XM2CLKCFGPADCTRL */ +u32 memcomp;/* 0xD4: APB_MISC_GP_MEMCOMPPADCTRL */ +};
That is the Tegra20 layout. It's change for Tegra30. The set of fields is probably even quite different.
arch/arm/include/asm/arch-tegra30/gp_padctrl.h line 71
Quoted 8 lines
arch/arm/include/asm/arch-tegra30/gp_padctrl.h +8
-0+/* bit fields definitions for APB_MISC_GP_HIDREV register */ +#define HIDREV_CHIPID_SHIFT 8 +#define HIDREV_CHIPID_MASK (0xff << HIDREV_CHIPID_SHIFT) +#define HIDREV_MAJORPREV_SHIFT 4 +#define HIDREV_MAJORPREV_MASK (0xf << HIDREV_MAJORPREV_SHIFT) + +/* CHIPID field returned from APB_MISC_GP_HIDREV register */ +#define CHIPID_TEGRA20 0x20
There should be a Tegra30 define here, and since that register is common between Tegra20 and Tegra30, I'd expect this to be in a common header.
arch/arm/include/asm/arch-tegra30/mmc.h
Quoted 3 lines
arch/arm/include/asm/arch-tegra30/mmc.h +1
-0+int tegra_mmc_init (int dev_index,int bus_width,int pwr_gpio,int cd_gpio);
Wouldn't this be common too?
Quoted 5 lines
arch/arm/include/asm/arch-tegra30/pinmux.h +3
-0+/* +* Pin groups which we adjust. There are three basic attributes of each pin +* group which use this enum:
arch/arm/include/asm/arch-tegra30/pinmux.h line 39
Quoted 10 lines
arch/arm/include/asm/arch-tegra30/pinmux.h +10
-0+* +* - function +* - pullup / pulldown +* - tristate or normal +*/ +enum pmux_pingrp { +PINGRP_ULPI_DATA0 =0 ,/* offset 0x3000 */ +PINGRP_ULPI_DATA1 , +PINGRP_ULPI_DATA2 , +PINGRP_ULPI_DATA3 ,
Hmmm. This enum appears to have been picked based on register order in the pin controller which I suppose is fine.
However, that order doesn't match the GPIO order, so if you ever want function gpio_request(n) to program both the GPIO controller and pin controller, then you'll need a table to convert between the two sets of IDs. For better or worse, the device tree binding for the Tegra30 pin controller lists the names based on GPIO ID order, and hence if the bindings are ever converted to integer-based rather than string-based, would probably number the pins based on GPIO order too.
I guess this means that either way you'll need a mapping table, either from gpio-or-binding-id to pinmux register, or from this enum to pinmux-register.
So I guess that means this enum is fine - it's just something to watch out for.
arch/arm/include/asm/arch-tegra30/pinmux.h line 352
Quoted 11 lines
arch/arm/include/asm/arch-tegra30/pinmux.h +11
-0+/* +* Functions which can be assigned to each of the pin groups. The values here +* bear no relation to the values programmed into pinmux registers and are +* purely a convenience. The translation is done through a table search. +*/ +enum pmux_func { +PMUX_FUNC_AHB_CLK , +PMUX_FUNC_APB_CLK , +PMUX_FUNC_AUDIO_SYNC , +PMUX_FUNC_CRT , +PMUX_FUNC_DAP1 ,
...
Could you possibly update the order of this enum to match the Linux kernel; see drivers/pinctrl/pinctrl-tegra30.c. Again, such an order would be more likely to match any integer-based device-tree pinmux binding.
Re-ordering this shouldn't be an issue since as the comment says there must be a conversion table anyway.
Quoted 9 lines
arch/arm/include/asm/arch-tegra30/pinmux.h +9
-0+/* t30 pin drive group and pin mux registers */ +#define PDRIVE_PINGROUP_OFFSET (0x868 >> 2) +#define PMUX_OFFSET ((0x3000 >> 2) - PDRIVE_PINGROUP_OFFSET - \ + PDRIVE_PINGROUP_COUNT) +struct pmux_tri_ctlr { +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 */ +uint pmt_reserved2;/* ABP_MISC_PP_ reserved offset 0C */
arch/arm/include/asm/arch-tegra30/pinmux.h line 562
Quoted 10 lines
arch/arm/include/asm/arch-tegra30/pinmux.h +10
-0+uint pmt_reserved3;/* ABP_MISC_PP_ reserved offset 10 */ +uint pmt_reserved4[4 ];/* _TRI_STATE_REG_A/B/C/D in t20 */ +uint pmt_cfg_ctl;/* _CONFIG_CTL_0, offset 24 */ + +uint pmt_reserved[528 ];/* ABP_MISC_PP_ reserved offs 28-864 */ + +uint pmt_drive[PDRIVE_PINGROUP_COUNT ];/* pin drive grps offs 868 */ +uint pmt_reserved5[PMUX_OFFSET ];/* offset 0x3000 */ +uint pmt_ctl[PINGRP_COUNT ];/* pin mux/pupd/tristate regs */ +};
Isn't pmc_ctrl at 0x3000; the second comment above appears misleading. Also, PMUX_OFFSET isn't right; the offset is 0x3000; it's more like RESERVED5_SIZE.
Quoted 2 lines
+/**
+ * Configuure a list of pin groups
Typo above.
arch/arm/include/asm/arch-tegra30/pmu.h line 28
Quoted 4 lines
arch/arm/include/asm/arch-tegra30/pmu.h +2
-0+/* Set core and CPU voltages to nominal levels */ +int pmu_set_nominal (void );
That also seems common. I'll stop pointing this issue out.
arch/arm/include/asm/arch-tegra30/tegra30.h line 86
Quoted 13 lines
arch/arm/include/asm/arch-tegra30/tegra30.h +11
-0+/* These are the available SKUs (product types) for Tegra */ +enum { +SKU_ID_T20 =0x8 , +SKU_ID_T25SE =0x14 , +SKU_ID_AP25 =0x17 , +SKU_ID_T25 =0x18 , +SKU_ID_AP25E =0x1b , +SKU_ID_T25E =0x1c , + +SKU_ID_T30 =0x81 ,/* Cardhu value */ +};
There's little point defining Tegra20-specific values unless this header is shared between the two SoCs. Same for:
arch/arm/include/asm/arch-tegra30/warmboot.h
Quoted 12 lines
arch/arm/include/asm/arch-tegra30/tegra30.h +10
-0+enum { +TEGRA_SOC_T20 , +TEGRA_SOC_T25 , +TEGRA_SOC_T30 , +TEGRA_SOC_T30_408MHZ ,/* A T30 with faster PLLP */ +TEGRA_SOC2_SLOW ,/* T2x needs to run at slow clock initially */ + +TEGRA_SOC_COUNT , +TEGRA_SOC_UNKNOWN =-1 , +};arch/arm/include/asm/arch-tegra30/warmboot.h +0
-0
At a quick glance, this header appears identical to Tegra20, yet given the differences between sleep modes on the two SoCs, I'd expect to see quite a few differences. I know a lot of extra PMC scratch registers were added on Tegra30 in order to support the sleep mode code, and hence it works quite differently...
Overall, it might help identify problems if you passed the "-C" option to "git format-patch"; that would show up any headers that had simply been copied from Tegra20 without necessary modifications.
PATCH 1/9 Tegra: T30: Add include files
Stephen,
Quoted 6 lines · Stephen Warren
Quoted 1 line · Tom Warren
Signed-off-by Tom Warren <[email protected]>Hmm. This is rather large to review, but I tried to at least glance through it all and spot obvious issues...
Quoted 8 lines
arch/arm/include/asm/arch-tegra30/ap30.h line 50
Quoted 4 lines
arch/arm/include/asm/arch-tegra30/ap30.h +2
-0+/* T30 Base physical address of SDRAM. */ +#define T30_BASE_PA_SDRAM 0x00000000That should be
0x80000000. The fact anything still works with this issue implies this constant isn't used anywhere? Aha, I seeNV_PA_SDRAM_BASEdefined later with the correct value...
Yep, T30_BASE_PA_SDRAM isn't used anywhere - just converted from AP20_BASE_PA_SDRAM when I created ap30.h. I'll delete it.
Quoted 6 lines
arch/arm/include/asm/arch-tegra30/ap30.h line 56
Quoted 3 lines
arch/arm/include/asm/arch-tegra30/ap30.h +2
-0+/* T30 Base physical address of flash. */ +#define T30_BASE_PA_NOR_FLASH 0xD0000000I don't know where NOR actually is mapped, but it can't be there; that's in the middle of SDRAM (2G..4G-1)
Again, copied when converting ap20.h to ap30.h. NOR Flash is @ 0x4800:0000 on T30. I'll just delete it, as no one uses it.
Quoted 12 lines
arch/arm/include/asm/arch-tegra30/board.h line 25
Quoted 5 lines
arch/arm/include/asm/arch-tegra30/board.h +2
-0+#ifndef _TEGRA_BOARD_H_ +#define _TEGRA_BOARD_H_I wonder if include guards shouldn't say TEGRA30 not just TEGRA. That would avoid any conflict between the different
arch/arm/include/asm/arch-tegra*directories. Sure, that's unlikely right now, but if we really continue to push device tree, maybe we'll end up with a unified Tegra20/Tegra30 bootloader image, and need to include both.
I could change it to _TEGRA30_BOARD_H_. I'd haven't considered ever including both arch board.h files in a single build - as you say, it's unlikely. But I'll change it.
Quoted 7 lines
arch/arm/include/asm/arch-tegra30/clk_rst.h line 25
Quoted 5 lines
arch/arm/include/asm/arch-tegra30/clk_rst.h +2
-0+#ifndef _CLK_RST_H_ +#define _CLK_RST_H_Hmm, and the naming format isn't consistent.
Copied from Tegra20. In the (near) future, I'll have a combined clk_rst.h include for Tegra20/Tegra30.
Quoted 25 lines
Quoted 4 lines
arch/arm/include/asm/arch-tegra30/clk_rst.h +3
-0+/* The clocks supported by the hardware */ +enum periph_id { +PERIPH_ID_FIRST ,...
Quoted 18 lines
arch/arm/include/asm/arch-tegra30/clk_rst.h +18
-0+/* +* Clock peripheral IDs which sadly don't match up with PERIPH_ID. we want +* callers to use the PERIPH_ID for all access to peripheral clocks to avoid +* confusion bewteen PERIPH_ID_... and PERIPHC_... +* +* We don't call this CLOCK_PERIPH_ID or PERIPH_CLOCK_ID as it would just be +* confusing. +*/ +enum periphc_internal_id { +/* 0x00 */ +PERIPHC_I2S1 , +PERIPHC_I2S2 , +PERIPHC_SPDIF_OUT , +PERIPHC_SPDIF_IN , +PERIPHC_PWM , + PERIPHC_05h, +PERIPHC_SBC2 , +PERIPHC_SBC3 ,...
Quoted 4 lines
Can you make sure that one/both (whichever is appropriate) of these line up with the proposed Linux kernel Tegra30 clock binding clock IDs. I'm not sure if the Tegra30 proposed binding has been published yet, but Prashant Gaikwad can email you the patch off-list if you need.
I'd rather leave it as is (copied from our internal T30 U-Boot code) for now, especially for a 'proposed' kernel change. Let's get a basic, working T30 build in there, and then we can make it match the kernel IDs as needed.
Quoted 5 lines
Quoted 2 lines
+void
clock_enable(enum periph_id clkid);Hmm. I would have expected all the prototypes to be in a common header between Tegra20 and Tegra30?
See my comment in another thread. My goal is to get a working T30 build in (to cmd prompt), and then I'll look at common-izing all of the TegraXX code.
Quoted 39 lines
Quoted 24 lines
arch/arm/include/asm/arch-tegra30/funcmux.h +21
-0+/* Configs supported by the func mux */ +enum { +FUNCMUX_DEFAULT =0 ,/* default config */ + +/* UART configs */ +FUNCMUX_UART1_ULPI_UART2 =0 , +FUNCMUX_UART2_IRDA =0 , +FUNCMUX_UART4_GMC =0 , + +/* I2C configs */ +FUNCMUX_DVC_I2CP =0 , +FUNCMUX_I2C1_RM =0 , +FUNCMUX_I2C2_DDC =0 , +FUNCMUX_I2C2_PTA , +FUNCMUX_I2C3_DTF =0 , + +/* SDMMC configs */ +FUNCMUX_SDMMC1_SDIO1_4BIT =0 , +FUNCMUX_SDMMC2_DTA_DTD_8BIT =0 , +FUNCMUX_SDMMC3_SDB_4BIT =0 , +FUNCMUX_SDMMC3_SDB_SLXA_8BIT ,arch/arm/include/asm/arch-tegra30/funcmux.h line 58
Quoted 10 lines
arch/arm/include/asm/arch-tegra30/funcmux.h +10
-0+FUNCMUX_SDMMC4_ATC_ATD_8BIT =0 , +FUNCMUX_SDMMC4_ATB_GMA_4_BIT , +FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT , + +/* USB configs */ +FUNCMUX_USB2_ULPI =0 , + +/* Serial Flash configs */ + FUNCMUX_SPI1_GMC_GMD = 0, +};Those all look like Tegra20 options. Tegra30 doesn't have mux pin groups (muxing is per-pin now), so names like DTA, DTD, SDB, SLXA, ATB, GMA, ... above don't make any sense (they're Tegra20 pin group names).
Quoted 3 lines
In turn, I wonder if a funcmux.h-style API even makes sense for Tegra30, since the number of legal configurations is probably too large to usefully enumerate, but that is perhaps another question.
Up to this point, there hasn't been much need for the funcmux stuff, so I haven't looked at it too thoroughly yet. The only pinmux I've messed with is the UART, since I've only been concerned with getting to the cmd prompt. I can take a look at converting this later, as part of the combo/common Tegra effort.
Quoted 34 lines
Quoted 34 lines
arch/arm/include/asm/arch-tegra30/gp_padctrl.h +31
-0+/* APB_MISC_GP and padctrl registers */ +struct apb_misc_gp_ctlr { +u32 modereg;/* 0x00: APB_MISC_GP_MODEREG */ +u32 hidrev;/* 0x04: APB_MISC_GP_HIDREV */ +u32 reserved0[22 ];/* 0x08 - 0x5C: */ +u32 emu_revid;/* 0x60: APB_MISC_GP_EMU_REVID */ +u32 xactor_scratch;/* 0x64: APB_MISC_GP_XACTOR_SCRATCH */ +u32 aocfg1;/* 0x68: APB_MISC_GP_AOCFG1PADCTRL */ +u32 aocfg2;/* 0x6c: APB_MISC_GP_AOCFG2PADCTRL */ +u32 atcfg1;/* 0x70: APB_MISC_GP_ATCFG1PADCTRL */ +u32 atcfg2;/* 0x74: APB_MISC_GP_ATCFG2PADCTRL */ +u32 cdevcfg1;/* 0x78: APB_MISC_GP_CDEV1CFGPADCTRL */ +u32 cdevcfg2;/* 0x7C: APB_MISC_GP_CDEV2CFGPADCTRL */ +u32 csuscfg;/* 0x80: APB_MISC_GP_CSUSCFGPADCTRL */ +u32 dap1cfg;/* 0x84: APB_MISC_GP_DAP1CFGPADCTRL */ +u32 dap2cfg;/* 0x88: APB_MISC_GP_DAP2CFGPADCTRL */ +u32 dap3cfg;/* 0x8C: APB_MISC_GP_DAP3CFGPADCTRL */ +u32 dap4cfg;/* 0x90: APB_MISC_GP_DAP4CFGPADCTRL */ +u32 dbgcfg;/* 0x94: APB_MISC_GP_DBGCFGPADCTRL */ +u32 lcdcfg1;/* 0x98: APB_MISC_GP_LCDCFG1PADCTRL */ +u32 lcdcfg2;/* 0x9C: APB_MISC_GP_LCDCFG2PADCTRL */ +u32 sdmmc2_cfg;/* 0xA0: APB_MISC_GP_SDMMC2CFGPADCTRL */ +u32 sdmmc3_cfg;/* 0xA4: APB_MISC_GP_SDMMC3CFGPADCTRL */ +u32 spicfg;/* 0xA8: APB_MISC_GP_SPICFGPADCTRL */ +u32 uaacfg;/* 0xAC: APB_MISC_GP_UAACFGPADCTRL */ +u32 uabcfg;/* 0xB0: APB_MISC_GP_UABCFGPADCTRL */ +u32 uart2cfg;/* 0xB4: APB_MISC_GP_UART2CFGPADCTRL */ +u32 uart3cfg;/* 0xB8: APB_MISC_GP_UART3CFGPADCTRL */ +u32 vicfg1;/* 0xBC: APB_MISC_GP_VICFG1PADCTRL */ +u32 vicfg2;/* 0xC0: APB_MISC_GP_VICFG2PADCTRL */ +u32 xm2cfga;/* 0xC4: APB_MISC_GP_XM2CFGAPADCTRL */
Quoted 8 lines
arch/arm/include/asm/arch-tegra30/gp_padctrl.h line 62
Quoted 5 lines
arch/arm/include/asm/arch-tegra30/gp_padctrl.h +5
-0+u32 xm2cfgc;/* 0xC8: APB_MISC_GP_XM2CFGCPADCTRL */ +u32 xm2cfgd;/* 0xCC: APB_MISC_GP_XM2CFGDPADCTRL */ +u32 xm2clkcfg;/* 0xD0: APB_MISC_GP_XM2CLKCFGPADCTRL */ +u32 memcomp;/* 0xD4: APB_MISC_GP_MEMCOMPPADCTRL */ +};That is the Tegra20 layout. It's change for Tegra30. The set of fields is probably even quite different.
Yeah, again not really used yet, just included in ap30.c - I'd made a couple of passes at removing unused include files during the bringup, but I must have missed this one. I'll remove it for now, and add it back in with the proper T30 layout/names when it's needed.
Quoted 12 lines
arch/arm/include/asm/arch-tegra30/gp_padctrl.h line 71
Quoted 9 lines
arch/arm/include/asm/arch-tegra30/gp_padctrl.h +8
-0+/* bit fields definitions for APB_MISC_GP_HIDREV register */ +#define HIDREV_CHIPID_SHIFT 8 +#define HIDREV_CHIPID_MASK (0xff << HIDREV_CHIPID_SHIFT) +#define HIDREV_MAJORPREV_SHIFT 4 +#define HIDREV_MAJORPREV_MASK (0xf << HIDREV_MAJORPREV_SHIFT) + +/* CHIPID field returned from APB_MISC_GP_HIDREV register */ +#define CHIPID_TEGRA20 0x20There should be a Tegra30 define here, and since that register is common between Tegra20 and Tegra30, I'd expect this to be in a common header.
Common will happen later, and this'll have the correct Tegra30 IDs when I replace this header.
Quoted 6 lines
arch/arm/include/asm/arch-tegra30/mmc.h
Quoted 4 lines
arch/arm/include/asm/arch-tegra30/mmc.h +1
-0+int tegra_mmc_init (int dev_index,int bus_width,int pwr_gpio,int cd_gpio);Wouldn't this be common too?
Yep, it's identical to the Tegra20 version. When I do the common-izing, it'll go in arch/arm/include/arch-tegra/, etc.
Quoted 28 lines
Quoted 6 lines
arch/arm/include/asm/arch-tegra30/pinmux.h +3
-0+/* +* Pin groups which we adjust. There are three basic attributes of each pin +* group which use this enum: arch/arm/include/asm/arch-tegra30/pinmux.h line 39
Quoted 10 lines
arch/arm/include/asm/arch-tegra30/pinmux.h +10
-0+* +* - function +* - pullup / pulldown +* - tristate or normal +*/ +enum pmux_pingrp { +PINGRP_ULPI_DATA0 =0 ,/* offset 0x3000 */ +PINGRP_ULPI_DATA1 , +PINGRP_ULPI_DATA2 , +PINGRP_ULPI_DATA3 ,Hmmm. This enum appears to have been picked based on register order in the pin controller which I suppose is fine.
However, that order doesn't match the GPIO order, so if you ever want function
gpio_request(n)to program both the GPIO controller and pin controller, then you'll need a table to convert between the two sets of IDs. For better or worse, the device tree binding for the Tegra30 pin controller lists the names based on GPIO ID order, and hence if the bindings are ever converted to integer-based rather than string-based, would probably number the pins based on GPIO order too.
Quoted 6 lines
I guess this means that either way you'll need a mapping table, either from gpio-or-binding-id to pinmux register, or from this enum to pinmux-register.
So I guess that means this enum is fine - it's just something to watch out for.
AFAIK, we don't change the pinmux on gpio_request calls in Tegra U-Boot. This may be a deficiency, but no ones mentioned the need for it before. We can certainly address that in a future patchset (for Tegra20 as well as Tegra30).
Quoted 14 lines
Quoted 12 lines
arch/arm/include/asm/arch-tegra30/pinmux.h +11
-0+/* +* Functions which can be assigned to each of the pin groups. The values here +* bear no relation to the values programmed into pinmux registers and are +* purely a convenience. The translation is done through a table search. +*/ +enum pmux_func { +PMUX_FUNC_AHB_CLK , +PMUX_FUNC_APB_CLK , +PMUX_FUNC_AUDIO_SYNC , +PMUX_FUNC_CRT , +PMUX_FUNC_DAP1 ,...
Quoted 7 lines
Could you possibly update the order of this enum to match the Linux kernel; see
drivers/pinctrl/pinctrl-tegra30.c. Again, such an order would be more likely to match any integer-based device-tree pinmux binding.Re-ordering this shouldn't be an issue since as the comment says there must be a conversion table anyway.
For now, I'd like to leave it as is. Perhaps after this patchset is in, we can revisit making it matchy-matchy with the kernel - certainly when we get around to using DT for all periph init, etc. That's still in my U-Boot task-list, albeit at a low priority (at least until T30 is upstreamed).
Quoted 15 lines
Quoted 15 lines
arch/arm/include/asm/arch-tegra30/pinmux.h +15
-0+/* t30 pin drive group and pin mux registers */ +#define PDRIVE_PINGROUP_OFFSET (0x868 >> 2) +#define PMUX_OFFSET ((0x3000 >> 2) - PDRIVE_PINGROUP_OFFSET - \ + PDRIVE_PINGROUP_COUNT) +struct pmux_tri_ctlr { +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 */ +uint pmt_reserved2;/* ABP_MISC_PP_ reserved offset 0C */ +uint pmt_reserved3;/* ABP_MISC_PP_ reserved offset 10 */ +uint pmt_reserved4[4 ];/* _TRI_STATE_REG_A/B/C/D in t20 */ +uint pmt_cfg_ctl;/* _CONFIG_CTL_0, offset 24 */ + +uint pmt_reserved[528 ];/* ABP_MISC_PP_ reserved offs 28-864 */ +
Quoted 8 lines
arch/arm/include/asm/arch-tegra30/pinmux.h line 562
Quoted 4 lines
arch/arm/include/asm/arch-tegra30/pinmux.h +4
-0+uint pmt_drive[PDRIVE_PINGROUP_COUNT ];/* pin drive grps offs 868 */ +uint pmt_reserved5[PMUX_OFFSET ];/* offset 0x3000 */ +uint pmt_ctl[PINGRP_COUNT ];/* pin mux/pupd/tristate regs */ +};Isn't
pmc_ctrlat0x3000; the second comment above appears misleading. Also,PMUX_OFFSETisn't right; the offset is0x3000; it's more likeRESERVED5_SIZE.
Yeah, that's odd. Must have missed it during the port. I'll take a look.
Quoted 5 lines
Quoted 3 lines
+/**
+ * Configuure a list of pin groupsTypo above.
Copied from tegra20/pinmux.h. I'll correct it.
Quoted 7 lines
arch/arm/include/asm/arch-tegra30/pmu.h line 28
Quoted 5 lines
arch/arm/include/asm/arch-tegra30/pmu.h +2
-0+/* Set core and CPU voltages to nominal levels */ +int pmu_set_nominal (void );That also seems common. I'll stop pointing this issue out.
Common/combined Tegra code will follow the acceptance of a working T30 build.
Quoted 18 lines
Quoted 4 lines
arch/arm/include/asm/arch-tegra30/tegra30.h +1
-0+/* These are the available SKUs (product types) for Tegra */ arch/arm/include/asm/arch-tegra30/tegra30.h line 86
Quoted 10 lines
arch/arm/include/asm/arch-tegra30/tegra30.h +10
-0+enum { +SKU_ID_T20 =0x8 , +SKU_ID_T25SE =0x14 , +SKU_ID_AP25 =0x17 , +SKU_ID_T25 =0x18 , +SKU_ID_AP25E =0x1b , +SKU_ID_T25E =0x1c , + +SKU_ID_T30 =0x81 ,/* Cardhu value */ +};There's little point defining Tegra20-specific values unless this header is shared between the two SoCs. Same for:
Quoted 11 lines
arch/arm/include/asm/arch-tegra30/tegra30.h line 103
Quoted 10 lines
arch/arm/include/asm/arch-tegra30/tegra30.h +10
-0+enum { +TEGRA_SOC_T20 , +TEGRA_SOC_T25 , +TEGRA_SOC_T30 , +TEGRA_SOC_T30_408MHZ ,/* A T30 with faster PLLP */ +TEGRA_SOC2_SLOW ,/* T2x needs to run at slow clock initially */ + +TEGRA_SOC_COUNT , +TEGRA_SOC_UNKNOWN =-1 , +};
Yep, I meant to scrub these during the port. Thanks, I'll clean 'em up.
Quoted 7 lines
arch/arm/include/asm/arch-tegra30/warmboot.h
Quoted 1 line
arch/arm/include/asm/arch-tegra30/warmboot.h +0
-0At a quick glance, this header appears identical to Tegra20, yet given the differences between sleep modes on the two SoCs, I'd expect to see quite a few differences. I know a lot of extra PMC scratch registers were added on Tegra30 in order to support the sleep mode code, and hence it works quite differently...
It's included in common/board.c, but not used unless CONFIG_TEGRA_LP0 is enabled, which it isn't on T30. I didn't want to pollute common code too much with #ifdefs, but I'll see if adding CONFIG_TEGRA_LP0 around it's include works, and then remove it from arch-tegra30 until we port LP0, which as you say is quite a bit different than T20.
Quoted 4 lines
Overall, it might help identify problems if you passed the "-C" option to "git format-patch"; that would show up any headers that had simply been copied from Tegra20 without necessary modifications.
I always try to use -C w/format-patch, and according to my bash history, I did. But since I copied most of these files over from my original porting/bringup branch, I don't think it helped much.
PATCH 2/9 Tegra: T30: Add AVP (arm720t) files
In reply to Tom Warren--- arch/arm/cpu/arm720t/tegra30/Makefile | 48 +++ arch/arm/cpu/arm720t/tegra30/board.h | 25 ++ arch/arm/cpu/arm720t/tegra30/config.mk | 26 ++ arch/arm/cpu/arm720t/tegra30/cpu.c | 570 ++++++++++++++++++++++++++++++++ arch/arm/cpu/arm720t/tegra30/cpu.h | 65 ++++ arch/arm/cpu/arm720t/tegra30/spl.c | 132 ++++++++ 6 files changed, 866 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/arm720t/tegra30/Makefile create mode 100644 arch/arm/cpu/arm720t/tegra30/board.h create mode 100644 arch/arm/cpu/arm720t/tegra30/config.mk create mode 100644 arch/arm/cpu/arm720t/tegra30/cpu.c create mode 100644 arch/arm/cpu/arm720t/tegra30/cpu.h create mode 100644 arch/arm/cpu/arm720t/tegra30/spl.c
arch/arm/cpu/arm720t/tegra30/Makefile new file +48 -0
@@ -0,0 +1,48 @@ +# +# (C) Copyright 2010-2012 Nvidia Corporation. +# +# (C) Copyright 2000-2008 +# 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 + +COBJS-y += cpu.o +COBJS-$(CONFIG_SPL_BUILD) += spl.o + +SRCS := $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS-y)) + +all: $(obj).depend $(LIB) + +$(LIB): $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
arch/arm/cpu/arm720t/tegra30/board.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* (C) Copyright 2010-2012 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +void board_init_uart_f (void ); +void gpio_config_uart (void );
arch/arm/cpu/arm720t/tegra30/config.mk new file +26 -0
@@ -0,0 +1,26 @@ +# +# (C) Copyright 2010-2012 +# 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_PRIVATE_LIBGCC = yes
arch/arm/cpu/arm720t/tegra30/cpu.c new file +570 -0
570 lines not on this page · raw message
arch/arm/cpu/arm720t/tegra30/cpu.h new file +65 -0
65 lines not on this page · raw message
arch/arm/cpu/arm720t/tegra30/spl.c new file +132 -0
132 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 2/9 Tegra: T30: Add AVP (arm720t) files
On 09/12/2012 04:10 PM, Tom Warren wrote:
Patch descriptions would be nice.
arch/arm/cpu/arm720t/tegra30/cpu.c
Quoted 1 line
arch/arm/cpu/arm720t/tegra30/cpu.c +0
-0
There's quite a bit of Tegra20-support in this file. Can this file be shared with Tegra20 rather than forked and enhanced?
arch/arm/cpu/arm720t/tegra30/cpu.c line 154
Quoted 6 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +6
-0+/* Returns 1 if the current CPU executing is a Cortex-A9, else 0 */ +int cpu_is_cortexa9 (void ) +{ +u32 id =readb (NV_PA_PG_UP_BASE +PG_UP_TAG_0 ); +return id == (PG_UP_TAG_0_PID_CPU &0xff ); +}
Hmm. Given this is support for the AVP/COP running SPL, shouldn't this always be true? I thought Allen's SPL patches had cleaned this up.
Quoted 9 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +9
-0+static void enable_cpu_power_rail (void ) +{ +struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE ; +u32 reg; + +debug ("enable_cpu_power_rail entry\n" ); + reg =readl (&pmc->pmc_cntrl); + reg |=CPUPWRREQ_OE ; +writel (reg, &pmc->pmc_cntrl);
arch/arm/cpu/arm720t/tegra30/cpu.c line 380
Quoted 10 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +10
-0+ +/* +* Pulse PWRREQ via I2C. We need to find out what this is +* doing, tidy up the code and maybe find a better place for it. +*/ +tegra_i2c_ll_write_addr (0x005a ,0x0002 ); +tegra_i2c_ll_write_data (0x2328 ,0x0a02 ); +udelay (1000 ); +tegra_i2c_ll_write_data (0x0127 ,0x0a02 ); +udelay (10 *1000 );
Those functions access the DVC I2C controller's register space, so presumably they're doing I2C accesses. Not all boards use the same PMIC, so it seems like we really do need to factor this out.
arch/arm/cpu/arm720t/tegra30/cpu.c line 390
Quoted 9 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +9
-0+/* +* The TI PMU65861C needs a 3.75ms delay between enabling +* the power rail and enabling the CPU clock. This delay +* between SM1EN and SM1 is for switching time + the ramp +* up of the voltage to the CPU (VDD_CPU from PMU). We use 0xf00 as +* is is ARM-friendly (can fit in a single ARMv4T mov immmediate +* instruction). +*/ +udelay (3840 );
The Cardhu board at least does not use the TPS65861. At the very least the comment isn't quite right. Is this code needed?
arch/arm/cpu/arm720t/tegra30/spl.c line 72
Quoted 12 lines
arch/arm/cpu/arm720t/tegra30/spl.c +10
-0+void board_init_f (ulong dummy) +{ +board_init_uart_f (); + +/* Initialize periph GPIOs */ +#ifdef CONFIG_SPI_UART_SWITCH +gpio_early_init_uart (); +#else +gpio_config_uart (); +#endif
Didn't we have patches to get rid of that mess and just use the same function consistently across all boards, or was that only discussed and never actually implemented?
PATCH 2/9 Tegra: T30: Add AVP (arm720t) files
Stephen,
Quoted 3 lines · Stephen Warren
On 09/12/2012 04:10 PM, Tom Warren wrote:
Patch descriptions would be nice.
Sure, sorry. Not sure how much more info I can add beyond what's in the commit msg, though, at least for this patch.
Quoted 6 lines
arch/arm/cpu/arm720t/tegra30/cpu.c
Quoted 2 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +0
-0There's quite a bit of Tegra20-support in this file. Can this file be shared with Tegra20 rather than forked and enhanced?
Quoted 9 lines
arch/arm/cpu/arm720t/tegra30/cpu.c line 154
Quoted 6 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +6
-0+/* Returns 1 if the current CPU executing is a Cortex-A9, else 0 */ +int cpu_is_cortexa9 (void ) +{ +u32 id =readb (NV_PA_PG_UP_BASE +PG_UP_TAG_0 ); +return id == (PG_UP_TAG_0_PID_CPU &0xff ); +}Hmm. Given this is support for the AVP/COP running SPL, shouldn't this always be true? I thought Allen's SPL patches had cleaned this up.
Copied from tegra20/cpu.c - didn't notice it never gets called (same for Tegra20). So it's vestigial and can be removed.
Quoted 16 lines
Quoted 16 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +15
-0+static void enable_cpu_power_rail (void ) +{ +struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE ; +u32 reg; + +debug ("enable_cpu_power_rail entry\n" ); + reg =readl (&pmc->pmc_cntrl); + reg |=CPUPWRREQ_OE ; +writel (reg, &pmc->pmc_cntrl); + +/* +* Pulse PWRREQ via I2C. We need to find out what this is +* doing, tidy up the code and maybe find a better place for it. +*/ +tegra_i2c_ll_write_addr (0x005a ,0x0002 );
Quoted 8 lines
arch/arm/cpu/arm720t/tegra30/cpu.c line 380
Quoted 4 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +4
-0+tegra_i2c_ll_write_data (0x2328 ,0x0a02 ); +udelay (1000 ); +tegra_i2c_ll_write_data (0x0127 ,0x0a02 ); +udelay (10 *1000 );Those functions access the DVC I2C controller's register space, so presumably they're doing I2C accesses. Not all boards use the same PMIC, so it seems like we really do need to factor this out.
It's in the original internal T30 repo for Cardhu, with a comment from Simon Glass that I edited somewhat. I haven't tried removing it to see if the board still boots.
Quoted 11 lines
arch/arm/cpu/arm720t/tegra30/cpu.c line 390
Quoted 10 lines
arch/arm/cpu/arm720t/tegra30/cpu.c +9
-0+/* +* The TI PMU65861C needs a 3.75ms delay between enabling +* the power rail and enabling the CPU clock. This delay +* between SM1EN and SM1 is for switching time + the ramp +* up of the voltage to the CPU (VDD_CPU from PMU). We use 0xf00 as +* is is ARM-friendly (can fit in a single ARMv4T mov immmediate +* instruction). +*/ +udelay (3840 );
Quoted 3 lines
The Cardhu board at least does not use the TPS65861. At the very least the comment isn't quite right. Is this code needed?
No idea - it's in our internal T30 bringup repo, as well as Simon's. I can try removing it and see if we power up consistently.
Quoted 16 lines
arch/arm/cpu/arm720t/tegra30/spl.c line 72
Quoted 12 lines
arch/arm/cpu/arm720t/tegra30/spl.c +10
-0+void board_init_f (ulong dummy) +{ +board_init_uart_f (); + +/* Initialize periph GPIOs */ +#ifdef CONFIG_SPI_UART_SWITCH +gpio_early_init_uart (); +#else +gpio_config_uart (); +#endif Didn't we have patches to get rid of that mess and just use the same function consistently across all boards, or was that only discussed and never actually implemented?
Someone on the list talked about a cleanup (Lucas? Thierry?), but, AFAIK, that never happened, or I would have put it in tegra/next. At the very least, it's not needed in Tegra30/spl.c, so I'll remove it/clean it up.
Thanks,
Tom
PATCH 2/9 Tegra: T30: Add AVP (arm720t) files
Hi Tom,
Am Donnerstag, den 13.09.2012, 14:00 -0700 schrieb Tom Warren:
[...]
Quoted 18 lines
Quoted 17 lines
arch/arm/cpu/arm720t/tegra30/spl.c line 72
Quoted 13 lines
arch/arm/cpu/arm720t/tegra30/spl.c +10
-0+void board_init_f (ulong dummy) +{ +board_init_uart_f (); + +/* Initialize periph GPIOs */ +#ifdef CONFIG_SPI_UART_SWITCH +gpio_early_init_uart (); +#else +gpio_config_uart (); +#endif Didn't we have patches to get rid of that mess and just use the same function consistently across all boards, or was that only discussed and never actually implemented?
Quoted 4 lines
Someone on the list talked about a cleanup (Lucas? Thierry?), but, AFAIK, that never happened, or I would have put it in tegra/next. At the very least, it's not needed in
Tegra30/spl.c, so I'll remove it/clean it up.
I did the cleanup and you in fact missed it in the last round of tegra/next. Patch is called "tegra20: rework UART GPIO handling" and is already acked-by Simon Glass.
Thanks,
Lucas
PATCH 2/9 Tegra: T30: Add AVP (arm720t) files
Lucas,
Quoted 22 lines · Lucas Stach
Hi Tom,
Am Donnerstag, den 13.09.2012, 14:00 -0700 schrieb Tom Warren:
[...]Quoted 18 lines
Quoted 17 lines
arch/arm/cpu/arm720t/tegra30/spl.c line 72
Quoted 13 lines
arch/arm/cpu/arm720t/tegra30/spl.c +10
-0+void board_init_f (ulong dummy) +{ +board_init_uart_f (); + +/* Initialize periph GPIOs */ +#ifdef CONFIG_SPI_UART_SWITCH +gpio_early_init_uart (); +#else +gpio_config_uart (); +#endif Didn't we have patches to get rid of that mess and just use the same function consistently across all boards, or was that only discussed and never actually implemented?
Quoted 8 lines
Quoted 4 lines
Someone on the list talked about a cleanup (Lucas? Thierry?), but, AFAIK, that never happened, or I would have put it in tegra/next. At the very least, it's not needed in
Tegra30/spl.c, so I'll remove it/clean it up.I did the cleanup and you in fact missed it in the last round of tegra/next. Patch is called "tegra20: rework UART GPIO handling" and is already acked-by Simon Glass.
Thanks, I see it. Now that I've re-read it, I'm remembering that I was waiting on Allen Martin to answer Stephen's question:
" .. it looks like both SPL and non-SPL end up calling gpio_early_init_uart(); is that duplication correct or problematic?"
I'll apply it to /next regardless, since Simon seems to think it's OK.
BTW, I'm not sure how patchwork is supposed to operate, but it appears that the originator of the patch needs to assign it to me, mark it as under review, etc. I don't seem to have that power for patches I haven't written. Is that how it works for other custodians? It would really help me keep track of Tegra patches if they could be marked/assigned to me so I can sort on 'em. Right now, I just use a filter with 'tegra' in it, which doesn't always find all the patches I need to know about.
Thanks,
Tom
Quoted 5 lines
Thanks,
Lucas
PATCH 2/9 Tegra: T30: Add AVP (arm720t) files
In reply to Tom WarrenHi Tom,
Quoted 8 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>--- arch/arm/cpu/arm720t/tegra30/Makefile | 48 +++ arch/arm/cpu/arm720t/tegra30/board.h | 25 ++ arch/arm/cpu/arm720t/tegra30/config.mk | 26 ++ arch/arm/cpu/arm720t/tegra30/cpu.c | 570 ++++++++++++++++++++++++++++++++ arch/arm/cpu/arm720t/tegra30/cpu.h | 65 ++++ arch/arm/cpu/arm720t/tegra30/spl.c | 132 ++++++++
It certainly has complicated your work, with the AVP arm720t refactor going in before these patches.
I feel that quite a bit of the code here should perhaps go to arch/arm/cpu/arm720t/tegra-common or similar, so that you can share it with tegra30.
Regards,
Simon
PATCH 2/9 Tegra: T30: Add AVP (arm720t) files
Simon,
Quoted 12 lines · Simon Glass
Hi Tom,
Quoted 8 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>--- arch/arm/cpu/arm720t/tegra30/Makefile | 48 +++ arch/arm/cpu/arm720t/tegra30/board.h | 25 ++ arch/arm/cpu/arm720t/tegra30/config.mk | 26 ++ arch/arm/cpu/arm720t/tegra30/cpu.c | 570 ++++++++++++++++++++++++++++++++ arch/arm/cpu/arm720t/tegra30/cpu.h | 65 ++++ arch/arm/cpu/arm720t/tegra30/spl.c | 132 ++++++++
Quoted 2 lines
It certainly has complicated your work, with the AVP arm720t refactor going in before these patches.
In some ways, yes. In others, it made it easy to first get a SPL (AVP) U-Boot up and printing its sign-on, and then having a base to work from/debug A9 code for the second, CPU-init half.
Quoted 4 lines
I feel that quite a bit of the code here should perhaps go to
arch/arm/cpu/arm720t/tegra-commonor similar, so that you can share it with tegra30.
WIP. There'll be an arch/arm/cpu/arm720t/tegra-common, an arch/arm/cpu/armv7/tegra-common, and even an arch/arm/cpu/tegra-common, plus an arch/arm/include/asm/arch-tegra to hold common code & include files.
How those changes will be captured in a patchset (or 2) that show the movement of the original Tegra20 files, then the copy/edit for Tegra30 is still to be seen.
Thanks,
Tom
Quoted 3 lines
Regards,
Simon
PATCH 3/9 Tegra: T30: Add CPU (armv7) files
In reply to Tom Warren--- arch/arm/cpu/armv7/tegra30/Makefile | 48 +++++++++++++++++++++ arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c | 65 +++++++++++++++++++++++++++++ arch/arm/cpu/armv7/tegra30/config.mk | 26 +++++++++++ 3 files changed, 139 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/armv7/tegra30/Makefile create mode 100644 arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c create mode 100644 arch/arm/cpu/armv7/tegra30/config.mk
arch/arm/cpu/armv7/tegra30/Makefile new file +48 -0
@@ -0,0 +1,48 @@ +# +# (C) Copyright 20102012 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 + +COBJS-$(CONFIG_CMD_ENTERRCM) += cmd_enterrcm.o + +COBJS := $(COBJS-y) +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +all: $(obj).depend $(LIB) + +$(LIB): $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c new file +65 -0
65 lines not on this page · raw message
arch/arm/cpu/armv7/tegra30/config.mk new file +26 -0
@@ -0,0 +1,26 @@ +# +# (C) Copyright 2010-2012 +# 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 +# +CONFIG_ARCH_DEVICE_TREE := tegra30
Signature · 1 line
1.7.0.4
PATCH 3/9 Tegra: T30: Add CPU (armv7) files
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c
Quoted 1 line · Tom Warren
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c +0
-0
This whole file is definitely common with Tegra20.
PATCH 3/9 Tegra: T30: Add CPU (armv7) files
Stephen,
Quoted 5 lines · Stephen Warren
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c
Quoted 1 line · Tom Warren
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c +0
-0This whole file is definitely common with Tegra20.
I'm going through your previous comments, but I'll just reply quickly to this one since it needs clearing up.
The intent of this first series of patches for Tegra30 was just to get to the command prompt on T30 in the quickest way, while impacting Tegra20 code as little as possible. Hence, I used Tegra20 files to create a Tegra30 build, and as I ported it to T30 HW, I tried to eliminate what I could that I knew for sure was T20-specific and not useful. But I've made no effort to combine common files/code in this initial pass. I think it's much easier to understand and review these files as a separate SoC build, rather than having to parse common/combined files and code. I intend to do the combination/common-izing of the TegraXX builds once I have a reasonable T30 build in u-boot-tegra, perhaps even before I start porting the drivers. But this is the initial approach I took. Hopefully it'll be an acceptable course - I'd hate to have to back-track.
Thanks for the thorough review,
Tom
PATCH 3/9 Tegra: T30: Add CPU (armv7) files
Quoted 12 lines · Tom Warren
Stephen,
Quoted 5 lines · Stephen Warren
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c
Quoted 1 line · Tom Warren
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c +0
-0This whole file is definitely common with Tegra20.
I'm going through your previous comments, but I'll just reply quickly to this one since it needs clearing up.
Quoted 14 lines
The intent of this first series of patches for Tegra30 was just to get to the command prompt on T30 in the quickest way, while impacting Tegra20 code as little as possible. Hence, I used Tegra20 files to create a Tegra30 build, and as I ported it to T30 HW, I tried to eliminate what I could that I knew for sure was T20-specific and not useful. But I've made no effort to combine common files/code in this initial pass. I think it's much easier to understand and review these files as a separate SoC build, rather than having to parse common/combined files and code. I intend to do the combination/common-izing of the TegraXX builds once I have a reasonable T30 build in u-boot-tegra, perhaps even before I start porting the drivers. But this is the initial approach I took. Hopefully it'll be an acceptable course - I'd hate to have to back-track.
To be honest, it seems like the patch to add the Tegra30 deltas to the existing Tegra20 code would be massively smaller than duplicating all of Tegra20 as Tegra30 and applying those same changes. In the kernel, we have both Tegra20 and Tegra30 support with run-time differentiation, and the number of places where we have to do something different is not that large at all. With the current patch series, there's a huge amount of code to wade through, so spotting any places that haven't been updated for Tegra30, or weren't intended to be updated yet, is somewhat painful.
PATCH 3/9 Tegra: T30: Add CPU (armv7) files
Quoted 28 lines · Stephen Warren
Quoted 12 lines · Tom Warren
Stephen,
Quoted 5 lines · Stephen Warren
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c
Quoted 1 line · Tom Warren
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c +0
-0This whole file is definitely common with Tegra20.
I'm going through your previous comments, but I'll just reply quickly to this one since it needs clearing up.
Quoted 14 lines
The intent of this first series of patches for Tegra30 was just to get to the command prompt on T30 in the quickest way, while impacting Tegra20 code as little as possible. Hence, I used Tegra20 files to create a Tegra30 build, and as I ported it to T30 HW, I tried to eliminate what I could that I knew for sure was T20-specific and not useful. But I've made no effort to combine common files/code in this initial pass. I think it's much easier to understand and review these files as a separate SoC build, rather than having to parse common/combined files and code. I intend to do the combination/common-izing of the TegraXX builds once I have a reasonable T30 build in u-boot-tegra, perhaps even before I start porting the drivers. But this is the initial approach I took. Hopefully it'll be an acceptable course - I'd hate to have to back-track.
Quoted 8 lines
To be honest, it seems like the patch to add the Tegra30 deltas to the existing Tegra20 code would be massively smaller than duplicating all of Tegra20 as Tegra30 and applying those same changes. In the kernel, we have both Tegra20 and Tegra30 support with run-time differentiation, and the number of places where we have to do something different is not that large at all. With the current patch series, there's a huge amount of code to wade through, so spotting any places that haven't been updated for Tegra30, or weren't intended to be updated yet, is somewhat painful.
Since we know that the delta can be small, yes, let's just do this right the first time (or so). incremental moves, additions and we can work out run-vs-build time a little further down the road.
Signature · 1 line
Tom
PATCH 3/9 Tegra: T30: Add CPU (armv7) files
Tom,
Quoted 38 lines · Tom Rini
Quoted 28 lines · Stephen Warren
Quoted 12 lines · Tom Warren
Stephen,
Quoted 5 lines · Stephen Warren
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c
Quoted 1 line · Tom Warren
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c +0
-0This whole file is definitely common with Tegra20.
I'm going through your previous comments, but I'll just reply quickly to this one since it needs clearing up.
Quoted 14 lines
The intent of this first series of patches for Tegra30 was just to get to the command prompt on T30 in the quickest way, while impacting Tegra20 code as little as possible. Hence, I used Tegra20 files to create a Tegra30 build, and as I ported it to T30 HW, I tried to eliminate what I could that I knew for sure was T20-specific and not useful. But I've made no effort to combine common files/code in this initial pass. I think it's much easier to understand and review these files as a separate SoC build, rather than having to parse common/combined files and code. I intend to do the combination/common-izing of the TegraXX builds once I have a reasonable T30 build in u-boot-tegra, perhaps even before I start porting the drivers. But this is the initial approach I took. Hopefully it'll be an acceptable course - I'd hate to have to back-track.
Quoted 8 lines
To be honest, it seems like the patch to add the Tegra30 deltas to the existing Tegra20 code would be massively smaller than duplicating all of Tegra20 as Tegra30 and applying those same changes. In the kernel, we have both Tegra20 and Tegra30 support with run-time differentiation, and the number of places where we have to do something different is not that large at all. With the current patch series, there's a huge amount of code to wade through, so spotting any places that haven't been updated for Tegra30, or weren't intended to be updated yet, is somewhat painful.
Quoted 3 lines
Since we know that the delta can be small, yes, let's just do this right the first time (or so). incremental moves, additions and we can work out run-vs-build time a little further down the road.
Sorry, Tom. I'm not clear on exactly which way you'd like to see this go.
Are you advising that I re-cast this patchset as a set of common Tegra files/code, with deltas/diffs for the Tegra30 changes? That implies, I think, that I first have to do a patchset that re-orgs Tegra20 code into common code, and then submit a smaller version of this patchset that is just deltas for Tegra30. That means that I'll be touching everyone's Tegra20 code, and will need Ack's from all the T20 vendors before I can move forward w/T30 code.
The other approach, which is still a 2-(or more)-patchset process, is to continue with this patchset for T30, with corrections as per review, and then immediately work on a 'merge-to-common-code' set of patches to common-ize Tegra20/30. That way Tegra20 is unaffected, I can keep moving forward, and I think the end result will be the same as the approach above.
I can see value in both approaches, and it shouldn't surprise you that I'd favor the 2nd approach, since it's less chaotic for me. Let me know what you think,
Tom
Quoted 3 lines
--
Tom
PATCH 3/9 Tegra: T30: Add CPU (armv7) files
Quoted 47 lines · Tom Warren
Tom,
Quoted 38 lines · Tom Rini
Quoted 28 lines · Stephen Warren
Quoted 12 lines · Tom Warren
Stephen,
Quoted 5 lines · Stephen Warren
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c
Quoted 1 line · Tom Warren
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c +0
-0This whole file is definitely common with Tegra20.
I'm going through your previous comments, but I'll just reply quickly to this one since it needs clearing up.
Quoted 14 lines
The intent of this first series of patches for Tegra30 was just to get to the command prompt on T30 in the quickest way, while impacting Tegra20 code as little as possible. Hence, I used Tegra20 files to create a Tegra30 build, and as I ported it to T30 HW, I tried to eliminate what I could that I knew for sure was T20-specific and not useful. But I've made no effort to combine common files/code in this initial pass. I think it's much easier to understand and review these files as a separate SoC build, rather than having to parse common/combined files and code. I intend to do the combination/common-izing of the TegraXX builds once I have a reasonable T30 build in u-boot-tegra, perhaps even before I start porting the drivers. But this is the initial approach I took. Hopefully it'll be an acceptable course - I'd hate to have to back-track.
Quoted 8 lines
To be honest, it seems like the patch to add the Tegra30 deltas to the existing Tegra20 code would be massively smaller than duplicating all of Tegra20 as Tegra30 and applying those same changes. In the kernel, we have both Tegra20 and Tegra30 support with run-time differentiation, and the number of places where we have to do something different is not that large at all. With the current patch series, there's a huge amount of code to wade through, so spotting any places that haven't been updated for Tegra30, or weren't intended to be updated yet, is somewhat painful.
Quoted 3 lines
Since we know that the delta can be small, yes, let's just do this right the first time (or so). incremental moves, additions and we can work out run-vs-build time a little further down the road.
Sorry, Tom. I'm not clear on exactly which way you'd like to see this go.
Quoted 7 lines
Are you advising that I re-cast this patchset as a set of common Tegra files/code, with deltas/diffs for the Tegra30 changes? That implies, I think, that I first have to do a patchset that re-orgs Tegra20 code into common code, and then submit a smaller version of this patchset that is just deltas for Tegra30. That means that I'll be touching everyone's Tegra20 code, and will need Ack's from all the T20 vendors before I can move forward w/T30 code.
As far as I'm conerend to do a:
git mv arch/arm/cpu/armv7/tegra20/cmd_enterrcm.c arch/arm/cpu/armv7/tegra-common/cmd_enterrcm.c (just looking at top of tree mainline) needs just the overall Tegra maintainer to Ack. The Custodians page says that's you, and so long as you MAKEALL -s tegra20 before and after, that's good to go. By that same token, breaking out a hypothetical set of common functions from tegra20/usb.c into tegra-common/usb.c and leaving the T20 specific bits in tegra20/usb.c and adding tegra30/usb.c later just needs you and MAKEALL happy.
Quoted 6 lines
The other approach, which is still a 2-(or more)-patchset process, is to continue with this patchset for T30, with corrections as per review, and then immediately work on a 'merge-to-common-code' set of patches to common-ize Tegra20/30. That way Tegra20 is unaffected, I can keep moving forward, and I think the end result will be the same as the approach above.
As has been noted, when you copy files you get a lot of re-review and it's hard to tell what's new and what's not. It IS good to post what you have posted and say "please check areas X/Y/Z, it's new code". But reviewing code that will be dropped as soon as you switch to the 'merge-to-common-code' branch being the reviewed one is hard, especially when folks with less Tegra background try and read the patches for general issues.
Quoted 3 lines
I can see value in both approaches, and it shouldn't surprise you that I'd favor the 2nd approach, since it's less chaotic for me. Let me know what you think,
Well, I'd argue that since you're going to need to do the 'merge-to-common-code' path at some point, it's going to save you work to do that now rather than fixup issues in two places. And again, if you don't change the code, just where the code is, MAKEALL will catch your problems for you.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120913/24873660/attachment.pgp>
PATCH 3/9 Tegra: T30: Add CPU (armv7) files
Tom,
Quoted 85 lines · Tom Rini
Quoted 47 lines · Tom Warren
Tom,
Quoted 38 lines · Tom Rini
Quoted 28 lines · Stephen Warren
Quoted 12 lines · Tom Warren
Stephen,
Quoted 5 lines · Stephen Warren
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c
Quoted 1 line · Tom Warren
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c +0
-0This whole file is definitely common with Tegra20.
I'm going through your previous comments, but I'll just reply quickly to this one since it needs clearing up.
Quoted 14 lines
The intent of this first series of patches for Tegra30 was just to get to the command prompt on T30 in the quickest way, while impacting Tegra20 code as little as possible. Hence, I used Tegra20 files to create a Tegra30 build, and as I ported it to T30 HW, I tried to eliminate what I could that I knew for sure was T20-specific and not useful. But I've made no effort to combine common files/code in this initial pass. I think it's much easier to understand and review these files as a separate SoC build, rather than having to parse common/combined files and code. I intend to do the combination/common-izing of the TegraXX builds once I have a reasonable T30 build in u-boot-tegra, perhaps even before I start porting the drivers. But this is the initial approach I took. Hopefully it'll be an acceptable course - I'd hate to have to back-track.
Quoted 8 lines
To be honest, it seems like the patch to add the Tegra30 deltas to the existing Tegra20 code would be massively smaller than duplicating all of Tegra20 as Tegra30 and applying those same changes. In the kernel, we have both Tegra20 and Tegra30 support with run-time differentiation, and the number of places where we have to do something different is not that large at all. With the current patch series, there's a huge amount of code to wade through, so spotting any places that haven't been updated for Tegra30, or weren't intended to be updated yet, is somewhat painful.
Quoted 3 lines
Since we know that the delta can be small, yes, let's just do this right the first time (or so). incremental moves, additions and we can work out run-vs-build time a little further down the road.
Sorry, Tom. I'm not clear on exactly which way you'd like to see this go.
Quoted 7 lines
Are you advising that I re-cast this patchset as a set of common Tegra files/code, with deltas/diffs for the Tegra30 changes? That implies, I think, that I first have to do a patchset that re-orgs Tegra20 code into common code, and then submit a smaller version of this patchset that is just deltas for Tegra30. That means that I'll be touching everyone's Tegra20 code, and will need Ack's from all the T20 vendors before I can move forward w/T30 code.
As far as I'm conerend to do a:
git mvarch/arm/cpu/armv7/tegra20/cmd_enterrcm.carch/arm/cpu/armv7/tegra-common/cmd_enterrcm.c(just looking at top of tree mainline) needs just the overall Tegra maintainer to Ack. The Custodians page says that's you, and so long as you MAKEALL -s tegra20 before and after, that's good to go. By that same token, breaking out a hypothetical set of common functions fromtegra20/usb.cintotegra-common/usb.cand leaving the T20 specific bits integra20/usb.cand addingtegra30/usb.clater just needs you and MAKEALL happy.Quoted 6 lines
The other approach, which is still a 2-(or more)-patchset process, is to continue with this patchset for T30, with corrections as per review, and then immediately work on a 'merge-to-common-code' set of patches to common-ize Tegra20/30. That way Tegra20 is unaffected, I can keep moving forward, and I think the end result will be the same as the approach above.
As has been noted, when you copy files you get a lot of re-review and it's hard to tell what's new and what's not. It IS good to post what you have posted and say "please check areas X/Y/Z, it's new code". But reviewing code that will be dropped as soon as you switch to the 'merge-to-common-code' branch being the reviewed one is hard, especially when folks with less Tegra background try and read the patches for general issues.
Quoted 3 lines
I can see value in both approaches, and it shouldn't surprise you that I'd favor the 2nd approach, since it's less chaotic for me. Let me know what you think,
Quoted 5 lines
Well, I'd argue that since you're going to need to do the 'merge-to-common-code' path at some point, it's going to save you work to do that now rather than fixup issues in two places. And again, if you don't change the code, just where the code is, MAKEALL will catch your problems for you.
Moving the code via git as you pointed out above is fine, but how do I hook 'tegra-common' into the boards.cfg/Makefile/MAKEALL process? I'd need a 'tegra-common' subdir for arm720t, armv7 and an 'arch-tegra' subdir for arch/arm/include/asm/. The arch-tegra common subdir is easy, as I can just have the <asm/arch/blah.h> file do an 'include <asm/arch-tegra/blah.h> when the include file is 100% common and flesh it out when it's SoC-specific. But I don't see how I can build the SPL and 'normal' U-Boot sections via boards.cfg w/common code, without having a SPL.C that says 'include ../tegra-common/spl.c', which seems messy. Not to mention that we have arch/arm/cpu/tegra20-common and ../tegra30-common, too. How do you do it on OMAP?
Tom
Quoted 3 lines
--
Tom
PATCH 3/9 Tegra: T30: Add CPU (armv7) files
Quoted 94 lines · Tom Warren
Tom,
Quoted 85 lines · Tom Rini
Quoted 47 lines · Tom Warren
Tom,
Quoted 38 lines · Tom Rini
Quoted 28 lines · Stephen Warren
Quoted 12 lines · Tom Warren
Stephen,
Quoted 5 lines · Stephen Warren
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c
Quoted 1 line · Tom Warren
arch/arm/cpu/armv7/tegra30/cmd_enterrcm.c +0
-0This whole file is definitely common with Tegra20.
I'm going through your previous comments, but I'll just reply quickly to this one since it needs clearing up.
Quoted 14 lines
The intent of this first series of patches for Tegra30 was just to get to the command prompt on T30 in the quickest way, while impacting Tegra20 code as little as possible. Hence, I used Tegra20 files to create a Tegra30 build, and as I ported it to T30 HW, I tried to eliminate what I could that I knew for sure was T20-specific and not useful. But I've made no effort to combine common files/code in this initial pass. I think it's much easier to understand and review these files as a separate SoC build, rather than having to parse common/combined files and code. I intend to do the combination/common-izing of the TegraXX builds once I have a reasonable T30 build in u-boot-tegra, perhaps even before I start porting the drivers. But this is the initial approach I took. Hopefully it'll be an acceptable course - I'd hate to have to back-track.
Quoted 8 lines
To be honest, it seems like the patch to add the Tegra30 deltas to the existing Tegra20 code would be massively smaller than duplicating all of Tegra20 as Tegra30 and applying those same changes. In the kernel, we have both Tegra20 and Tegra30 support with run-time differentiation, and the number of places where we have to do something different is not that large at all. With the current patch series, there's a huge amount of code to wade through, so spotting any places that haven't been updated for Tegra30, or weren't intended to be updated yet, is somewhat painful.
Quoted 3 lines
Since we know that the delta can be small, yes, let's just do this right the first time (or so). incremental moves, additions and we can work out run-vs-build time a little further down the road.
Sorry, Tom. I'm not clear on exactly which way you'd like to see this go.
Quoted 7 lines
Are you advising that I re-cast this patchset as a set of common Tegra files/code, with deltas/diffs for the Tegra30 changes? That implies, I think, that I first have to do a patchset that re-orgs Tegra20 code into common code, and then submit a smaller version of this patchset that is just deltas for Tegra30. That means that I'll be touching everyone's Tegra20 code, and will need Ack's from all the T20 vendors before I can move forward w/T30 code.
As far as I'm conerend to do a:
git mvarch/arm/cpu/armv7/tegra20/cmd_enterrcm.carch/arm/cpu/armv7/tegra-common/cmd_enterrcm.c(just looking at top of tree mainline) needs just the overall Tegra maintainer to Ack. The Custodians page says that's you, and so long as you MAKEALL -s tegra20 before and after, that's good to go. By that same token, breaking out a hypothetical set of common functions fromtegra20/usb.cintotegra-common/usb.cand leaving the T20 specific bits integra20/usb.cand addingtegra30/usb.clater just needs you and MAKEALL happy.Quoted 6 lines
The other approach, which is still a 2-(or more)-patchset process, is to continue with this patchset for T30, with corrections as per review, and then immediately work on a 'merge-to-common-code' set of patches to common-ize Tegra20/30. That way Tegra20 is unaffected, I can keep moving forward, and I think the end result will be the same as the approach above.
As has been noted, when you copy files you get a lot of re-review and it's hard to tell what's new and what's not. It IS good to post what you have posted and say "please check areas X/Y/Z, it's new code". But reviewing code that will be dropped as soon as you switch to the 'merge-to-common-code' branch being the reviewed one is hard, especially when folks with less Tegra background try and read the patches for general issues.
Quoted 3 lines
I can see value in both approaches, and it shouldn't surprise you that I'd favor the 2nd approach, since it's less chaotic for me. Let me know what you think,
Quoted 5 lines
Well, I'd argue that since you're going to need to do the 'merge-to-common-code' path at some point, it's going to save you work to do that now rather than fixup issues in two places. And again, if you don't change the code, just where the code is, MAKEALL will catch your problems for you.
Quoted 11 lines
Moving the code via git as you pointed out above is fine, but how do I hook 'tegra-common' into the boards.cfg/Makefile/MAKEALL process? I'd need a 'tegra-common' subdir for arm720t, armv7 and an 'arch-tegra' subdir for
arch/arm/include/asm/. The arch-tegra common subdir is easy, as I can just have the <asm/arch/blah.h> file do an 'include <asm/arch-tegra/blah.h> when the include file is 100% common and flesh it out when it's SoC-specific. But I don't see how I can build the SPL and 'normal' U-Boot sections via boards.cfg w/common code, without having a SPL.C that says 'include../tegra-common/spl.c', which seems messy. Not to mention that we havearch/arm/cpu/tegra20-commonand ../tegra30-common, too. How do you do it on OMAP?
I'd like to see <plat/blah.h> which goes to <plat/tegra/blah.h> or whatever, which is similar to what the kernel has nowadays. Solving this for TI parts (OMAP/AM33x and DaVinci share at times) is still on my TODO list. I could live with <asm/arch-foo/blah.h> or maybe even <asm/plat/blah.h> (I'm not awesome at naming things). For the C files, I thought the concensus ended up with arch/arm/cpu/tegra-common/ as the least-objectionable way to handle this problem in general. Then it's just a matter of adding a line or 5 to Makefile and spl/Makefile to say on tegra, also build in arch/arm/cpu/tegra-common. Note that on OMAP/AM33x we have arch/arm/cpu/armv7/omap-common and arch/arm/cpu/armv7/{omap3,omap4,omap5,am33xx} for armv7 but cross-SoC bits go and armv7 but SoC specific bits go. The rule for omap-common is two or more rather than all of the above.
Signature · 1 line
Tom
PATCH 4/9 Tegra: T30: Add common Tegra30 CPU files
In reply to Tom Warren--- arch/arm/cpu/tegra30-common/Makefile | 51 ++ arch/arm/cpu/tegra30-common/ap30.c | 98 +++ arch/arm/cpu/tegra30-common/board.c | 141 ++++ arch/arm/cpu/tegra30-common/clock.c | 1099 +++++++++++++++++++++++++++ arch/arm/cpu/tegra30-common/funcmux.c | 74 ++ arch/arm/cpu/tegra30-common/lowlevel_init.S | 42 + arch/arm/cpu/tegra30-common/pinmux.c | 507 ++++++++++++ arch/arm/cpu/tegra30-common/sys_info.c | 35 + arch/arm/cpu/tegra30-common/timer.c | 111 +++ 9 files changed, 2158 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/tegra30-common/Makefile create mode 100644 arch/arm/cpu/tegra30-common/ap30.c create mode 100644 arch/arm/cpu/tegra30-common/board.c create mode 100644 arch/arm/cpu/tegra30-common/clock.c create mode 100644 arch/arm/cpu/tegra30-common/funcmux.c create mode 100644 arch/arm/cpu/tegra30-common/lowlevel_init.S create mode 100644 arch/arm/cpu/tegra30-common/pinmux.c create mode 100644 arch/arm/cpu/tegra30-common/sys_info.c create mode 100644 arch/arm/cpu/tegra30-common/timer.c
arch/arm/cpu/tegra30-common/Makefile new file +51 -0
@@ -0,0 +1,51 @@ +# +# (C) Copyright 2010-2012 Nvidia Corporation. +# +# (C) Copyright 2000-2008 +# 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 + +# The AVP is ARMv4T architecture so we must use special compiler +# flags for any startup files it might use. + +LIB = $(obj)lib$(SOC)-common.o + +SOBJS += lowlevel_init.o +COBJS-y += ap30.o board.o clock.o funcmux.o pinmux.o sys_info.o timer.o + +SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y)) + +all: $(obj).depend $(LIB) + +$(LIB): $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
arch/arm/cpu/tegra30-common/ap30.c new file +98 -0
98 lines not on this page · raw message
arch/arm/cpu/tegra30-common/board.c new file +141 -0
141 lines not on this page · raw message
arch/arm/cpu/tegra30-common/clock.c new file +1099 -0
1,099 lines not on this page · raw message
arch/arm/cpu/tegra30-common/funcmux.c new file +74 -0
74 lines not on this page · raw message
arch/arm/cpu/tegra30-common/lowlevel_init.S new file +42 -0
42 lines not on this page · raw message
arch/arm/cpu/tegra30-common/pinmux.c new file +507 -0
507 lines not on this page · raw message
arch/arm/cpu/tegra30-common/sys_info.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* (C) Copyright 2010-2012 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#include <common.h> + +#ifdef CONFIG_DISPLAY_CPUINFO +/* Print CPU information */ +int print_cpuinfo (void ) +{ +puts ("TEGRA30\n" ); + +/* TBD: Add printf of major/minor rev info, stepping, etc. */ +return 0 ; +} +#endif /* CONFIG_DISPLAY_CPUINFO */
arch/arm/cpu/tegra30-common/timer.c new file +111 -0
111 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 4/9 Tegra: T30: Add common Tegra30 CPU files
Quoted 14 lines · Tom Warren
arch/arm/cpu/tegra30-common/board.c +12
-0+unsigned int query_sdram_size (void ) +{ +struct pmc_ctlr *const pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE ; +u32 reg; + + reg =readl (&pmc->pmc_scratch20); +debug ("pmc->pmc_scratch20 (ODMData) = 0x%08x\n" , reg); + +/* bits 31:28 in OdmData are used for RAM size */ +switch ((reg) >>28 ) { +case 1 : +return 0x10000000 ;/* 256 MB */
arch/arm/cpu/tegra30-common/board.c line 69
Quoted 10 lines
arch/arm/cpu/tegra30-common/board.c +10
-0+case 2 : +return 0x20000000 ;/* 512 MB */ +case 4 : +return 0x40000000 ;/* 1GB */ +case 8 : +return 0x7ff00000 ;/* 2GB - 1MB */ +default : +return 0x40000000 ;/* 1GB */ + } +}
According to our wiki, there's also a 3=768MB option here, although I have no idea if that's really true. I guess we can add it if we need it.
arch/arm/cpu/tegra30-common/board.c line 92
Quoted 7 lines
arch/arm/cpu/tegra30-common/board.c +7
-0+static int uart_configs[] = { +FUNCMUX_UART1_ULPI_UART2 ,/* UARTA */ +FUNCMUX_UART2_IRDA , +-1 , +FUNCMUX_UART4_GMC , +-1 , +};
I guess I'm repeating what I wrote for the funcmux.[ch] change, but those FUNCMUX_* enum names don't make sense on Tegra30.
Quoted 12 lines
arch/arm/cpu/tegra30-common/clock.c +10
-0+/* +* This array translates a periph_id to a periphc_internal_id +* +* Not present/matched up: +* uint vi_sensor; _VI_SENSOR_0, 0x1A8 +* SPDIF - which is both 0x08 and 0x0c +* +*/ +#define NONE (name) (-1) +#define OFFSET (name, value) PERIPHC_ ## name
arch/arm/cpu/tegra30-common/clock.c line 276
Quoted 10 lines
arch/arm/cpu/tegra30-common/clock.c +10
-0+static s8 periph_id_to_internal_id[PERIPH_ID_COUNT ] = { +/* Low word: 31:0 */ +NONE (CPU ), +NONE (COP ), +NONE (TRIGSYS ), +NONE (RESERVED3 ), +NONE (RESERVED4 ), +NONE (TMR ), +PERIPHC_UART1 , +PERIPHC_UART2 ,/* and vfir 0x68 */
Oh, there's a mapping table anyway. In that case, I would definitely recommend aligning the enum order with the kernel to allow easier DT handling in the future.
Still, as you mentioned in another email, this is something we can do later since it doesn't change any interface to anything outside U-Boot.
Quoted 30 lines
arch/arm/cpu/tegra30-common/clock.c +30
-0+#ifdef CONFIG_OF_CONTROL +/* +* Convert a device tree clock ID to our peripheral ID. They are mostly +* the same but we are very cautious so we check that a valid clock ID is +* provided. +* +* @param clk_id Clock ID according to tegra20 device tree binding +* @return peripheral ID, or PERIPH_ID_NONE if the clock ID is invalid +*/ +static enum periph_id clk_id_to_periph_id (int clk_id) +{ +if (clk_id >95 ) +return PERIPH_ID_NONE ; + +switch (clk_id) { +case 1 : +case 2 : +case 7 : +case 10 : +case 20 : +case 30 : +case 35 : +case 49 : +case 56 : +case 74 : +case 76 : +case 77 : +case 78 : +case 79 : +case 80 :
arch/arm/cpu/tegra30-common/clock.c line 1026
Quoted 10 lines
arch/arm/cpu/tegra30-common/clock.c +10
-0+case 81 : +case 82 : +case 83 : +case 91 : +case 95 : +return PERIPH_ID_NONE ; +default : +return clk_id; + } +}
This is something that would need to be validated against the Tegra30 device tree bindings for the clock module. I guess since CONFIG_OF_CONTROL isn't enabled now, it's somewhat OK to defer this until later, but a comment here indicating that fact would be useful.
Quoted 9 lines
arch/arm/cpu/tegra30-common/funcmux.c +7
-0+int funcmux_select (enum periph_id id,int config) +{ +int bad_config = config !=FUNCMUX_DEFAULT ; + +switch (id) { +case PERIPH_ID_UART1 : +switch (config) {
arch/arm/cpu/tegra30-common/funcmux.c
Quoted 10 lines
arch/arm/cpu/tegra30-common/funcmux.c +10
-0+case FUNCMUX_UART1_ULPI_UART2 : +pinmux_set_func (PINGRP_ULPI_DATA0 ,PMUX_FUNC_UARTA );txd +pinmux_set_func (PINGRP_ULPI_DATA1 ,PMUX_FUNC_UARTA );rxd +pinmux_set_func (PINGRP_ULPI_DATA2 ,PMUX_FUNC_UARTA );cts +pinmux_set_func (PINGRP_ULPI_DATA3 ,PMUX_FUNC_UARTA );rts +pinmux_set_func (PINGRP_ULPI_DATA4 ,PMUX_FUNC_UARTA );ri +pinmux_set_func (PINGRP_ULPI_DATA5 ,PMUX_FUNC_UARTA );dcd +pinmux_set_func (PINGRP_ULPI_DATA6 ,PMUX_FUNC_UARTA );dsr +pinmux_set_func (PINGRP_UART2_RTS_N ,PMUX_FUNC_UARTA );txd +pinmux_set_func (PINGRP_UART2_CTS_N ,PMUX_FUNC_UARTA ); rxd
I've augmented the lines above with comments re: what signals are selected onto each line when those functions are selected.
Note that RXD/TXD are duplicated. I suspect you're just getting lucky that when rxd is selected on both ULPI_DATA1 and UART2_CTS_N, that it happens to take the input from the correct one of those two pins.
Looking at the schematic for Cardhu A02, you only want to configure ULPI_DATA[3:0] for UARTA. All those other pins are used for purposes other than UART.
And somewhat as an aside, this is why I wonder if a funcmux-style API is still a good idea; you could easily have the following sets of UARTA signals in use:
RXD+TXD
RXD+TXD+RTS+CTS
RXD+TXD+RTS+CTS+RI+DCD+DSR+DTR (or perhaps subsets of those last 3?)
... and for each of those 3 sets of signals, any of the individual signals can actually be muxed onto one of n different pins, where n is at least 2, and up to 4 in many cases. That's perhaps thousands of combinations just for UARTA!
Calling pinmux.c APIs directly from the board file seems much simpler, and avoids a level of abstraction that doesn't really exist in HW.
PATCH 4/9 Tegra: T30: Add common Tegra30 CPU files
In reply to Tom WarrenHi Tom,
Quoted 6 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>--- arch/arm/cpu/tegra30-common/Makefile | 51 ++ arch/arm/cpu/tegra30-common/ap30.c | 98 +++ arch/arm/cpu/tegra30-common/board.c | 141 ++++ arch/arm/cpu/tegra30-common/clock.c | 1099 +++++++++++++++++++++++++++
Again I feel that a lot of the code here is common. We actually got away with identical code for T30 (even the tables!). Agreed that won't really work, but it should hows much can be common.
Regards,
Simon
PATCH 5/9 Tegra: DT: Add preliminary device tree files for T30 Cardhu
In reply to Tom Warren--- arch/arm/dts/tegra30.dtsi | 280 +++++++++++++++++++++++++++++++++++ board/nvidia/dts/tegra30-cardhu.dts | 92 ++++++++++++ 2 files changed, 372 insertions(+), 0 deletions(-) create mode 100644 arch/arm/dts/tegra30.dtsi create mode 100644 board/nvidia/dts/tegra30-cardhu.dts
arch/arm/dts/tegra30.dtsi new file +280 -0
@@ -0,0 +1,280 @@ +/include/ "skeleton.dtsi" + +/ { + model = "NVIDIA Tegra30"; + compatible = "nvidia,tegra30"; + interrupt-parent = <&intc>; + + tegra_car: clock at 60006000 { + compatible = "nvidia,tegra30-car"; + reg = <0x60006000 0x1000>; + #clock-cells = <1>; + }; + + clocks { + #address-cells = <1>; + #size-cells = <0>; + + osc: clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + }; + }; + + intc: interrupt-controller at 50041000 { + compatible = "nvidia,tegra30-gic"; + interrupt-controller; + #interrupt-cells = <1>; + reg = < 0x50041000 0x1000 >, + < 0x50040100 0x0100 >; + }; + + i2c at 7000c000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nvidia,tegra30-i2c"; + reg = <0x7000C000 0x100>; + interrupts = < 70 >; + /* PERIPH_ID_I2C1, PLL_P_OUT3 */ + clocks = <&tegra_car 12>, <&tegra_car 124>; + }; + + i2c at 7000c400 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nvidia,tegra30-i2c"; + reg = <0x7000C400 0x100>; + interrupts = < 116 >; + /* PERIPH_ID_I2C2, PLL_P_OUT3 */ + clocks = <&tegra_car 54>, <&tegra_car 124>; + }; + + i2c at 7000c500 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nvidia,tegra30-i2c"; + reg = <0x7000C500 0x100>; + interrupts = < 124 >; + /* PERIPH_ID_I2C3, PLL_P_OUT3 */ + clocks = <&tegra_car 67>, <&tegra_car 124>; + }; + + i2c at 7000d000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nvidia,tegra30-i2c-dvc"; + reg = <0x7000D000 0x200>; + interrupts = < 85 >; + /* PERIPH_ID_DVC_I2C, PLL_P_OUT3 */ + clocks = <&tegra_car 47>, <&tegra_car 124>; + }; + + i2s at 70002800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nvidia,tegra30-i2s"; + reg = <0x70002800 0x200>; + interrupts = < 45 >; + dma-channel = < 2 >; + }; + + i2s at 70002a00 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nvidia,tegra30-i2s"; + reg = <0x70002a00 0x200>; + interrupts = < 35 >; + dma-channel = < 1 >; + }; + + das at 70000c00 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nvidia,tegra30-das"; + reg = <0x70000c00 0x80>; + }; + + gpio: gpio at 6000d000 { + compatible = "nvidia,tegra30-gpio"; + reg = < 0x6000d000 0x1000 >; + interrupts = < 64 65 66 67 87 119 121 >; + #gpio-cells = <2>; + gpio-controller; + }; + + pinmux: pinmux at 70000000 { + compatible = "nvidia,tegra30-pinmux"; + reg = < 0x70000014 0x10 /* Tri-state registers */ + 0x70000080 0x20 /* Mux registers */ + 0x700000a0 0x14 /* Pull-up/down registers */ + 0x70000868 0xa8 >; /* Pad control registers */ + }; + + serial at 70006000 { + compatible = "nvidia,tegra30-uart"; + reg = <0x70006000 0x40>; + id = <0>; + reg-shift = <2>; + interrupts = < 68 >; + status = "disabled"; + }; + + serial at 70006040 { + compatible = "nvidia,tegra30-uart"; + reg = <0x70006040 0x40>; + id = <1>; + reg-shift = <2>; + interrupts = < 69 >; + status = "disabled"; + }; + + serial at 70006200 { + compatible = "nvidia,tegra30-uart"; + reg = <0x70006200 0x100>; + id = <2>; + reg-shift = <2>; + interrupts = < 78 >; + status = "disabled"; + }; + + serial at 70006300 { + compatible = "nvidia,tegra30-uart"; + reg = <0x70006300 0x100>; + id = <3>; + reg-shift = <2>; + interrupts = < 122 >; + status = "disabled"; + }; + + serial at 70006400 { + compatible = "nvidia,tegra30-uart"; + reg = <0x70006400 0x100>; + id = <4>; + reg-shift = <2>; + interrupts = < 123 >; + status = "disabled"; + }; + + sdhci at 78000000 { + compatible = "nvidia,tegra30-sdhci"; + reg = <0x78000000 0x200>; + interrupts = < 46 >; + periph-id = <14>; // PERIPH_ID_SDMMC1 + status = "disabled"; + }; + + sdhci at 78000200 { + compatible = "nvidia,tegra30-sdhci"; + reg = <0x78000200 0x200>; + interrupts = < 47 >; + periph-id = <9>; // PERIPH_ID_SDMMC2 + status = "disabled"; + }; + + sdhci at 78000400 { + compatible = "nvidia,tegra30-sdhci"; + reg = <0x78000400 0x200>; + interrupts = < 51 >; + periph-id = <69>; // PERIPH_ID_SDMMC3 + status = "disabled"; + }; + + sdhci at 78000600 { + compatible = "nvidia,tegra30-sdhci"; + reg = <0x78000600 0x200>; + interrupts = < 63 >; + periph-id = <15>; // PERIPH_ID_SDMMC4 + status = "disabled"; + }; + + pwfm0: pwm at 7000a000 { + compatible = "nvidia,tegra30-sdhci"; + reg = <0x7000a000 0x4>; + status = "disabled"; + }; + + pwfm1: pwm at 7000a010 { + compatible = "nvidia,tegra30-sdhci"; + reg = <0x7000a010 0x4>; + status = "disabled"; + }; + + pwfm2: pwm at 7000a020 { + compatible = "nvidia,tegra30-sdhci"; + reg = <0x7000a020 0x4>; + status = "disabled"; + }; + + pwfm3: pwm at 7000a030 { + compatible = "nvidia,tegra30-sdhci"; + reg = <0x7000a030 0x4>; + status = "disabled"; + }; + + display1: display at 0x54200000 { + compatible = "nvidia,tegra30-display"; + reg = <0x54200000 0x40000>; + status = "disabled"; + }; + + usb at c5000000 { + compatible = "nvidia,tegra30-ehci", "usb-ehci"; + reg = <0xc5000000 0x4000>; + interrupts = < 52 >; + phy_type = "utmi"; + clocks = <&tegra_car 22>; /* PERIPH_ID_USBD */ + nvidia,has-legacy-mode; + }; + + usbparams at 0 { + compatible = "nvidia,tegra30-usbparams"; + osc-frequency = <13000000>; + /* DivN, DivM, DivP, CPCON, LFCON, Delays Debounce, Bias */ + params = <0x3c0 0x0d 0x00 0xc 0 0x02 0x33 0x05 0x7f 0x7ef4 5>; + }; + + usbparams at 1 { + compatible = "nvidia,tegra30-usbparams"; + osc-frequency = <19200000>; + params = <0x0c8 0x04 0x00 0x3 0 0x03 0x4b 0x06 0xbb 0xbb80 7>; + }; + + usbparams at 2 { + compatible = "nvidia,tegra30-usbparams"; + osc-frequency = <12000000>; + params = <0x3c0 0x0c 0x00 0xc 0 0x02 0x2f 0x08 0x76 0x7530 5>; + }; + + usbparams at 3 { + compatible = "nvidia,tegra30-usbparams"; + osc-frequency = <26000000>; + params = <0x3c0 0x1a 0x00 0xc 0 0x04 0x66 0x11 0xfe 0xfde8 9>; + }; + + usb at 7d000000 { + compatible = "nvidia,tegra30-usb"; + reg = <0x7d000000 0x8000>; + interrupts = < 53 >; + phy_type = "ulpi"; + periph-id = <22>; /* PERIPH_ID_USBD */ + clocks = <&tegra_car 58>; + status = "disabled"; + }; + + usb at 7d008000 { + compatible = "nvidia,tegra30-ehci", "usb-ehci"; + reg = <0x7d008000 0x8000>; + interrupts = < 129 >; + phy_type = "utmi"; + periph-id = <59>; /* PERIPH_ID_USB3 */ + clocks = <&tegra_car 59>; + status = "disabled"; + }; + + emc at 7000f400 { + #address-cells = < 1 >; + #size-cells = < 0 >; + compatible = "nvidia,tegra30-emc"; + reg = <0x7000f400 0x200>; + }; +};
board/nvidia/dts/tegra30-cardhu.dts new file +92 -0
92 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 5/9 Tegra: DT: Add preliminary device tree files for T30 Cardhu
On 09/12/2012 04:10 PM, Tom Warren wrote:
Nitpick: I think there's a lot of mixing spaces/TABs for indentation; things don't align correctly when I view this.
For this patch in particular, I would strongly request that we either start with the bare minimum content, and add nodes as drivers require them, or import that latest Linux kernel's copy of these files. The reason being that many of the bindings used here aren't up-to-date, and there is at least some stale data from Tegra20 left over. It'd avoid any review issue at all if this patch was just a copy from the kernel.
PATCH 6/9 Tegra30: Add Cardhu board files
In reply to Tom Warren--- board/nvidia/cardhu/Makefile | 48 ++++ board/nvidia/cardhu/cardhu.c | 87 +++++++ board/nvidia/cardhu/pinmux-config-common.h | 346 ++++++++++++++++++++++++++++ 3 files changed, 481 insertions(+), 0 deletions(-) create mode 100644 board/nvidia/cardhu/Makefile create mode 100644 board/nvidia/cardhu/cardhu.c create mode 100644 board/nvidia/cardhu/pinmux-config-common.h
board/nvidia/cardhu/Makefile new file +48 -0
@@ -0,0 +1,48 @@ +# +# (C) Copyright 2010-2012 +# NVIDIA Corporation <www.nvidia.com> +# +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +ifneq ($(OBJTREE),$(SRCTREE)) +$(shell mkdir -p $(obj)../common) +endif + +LIB = $(obj)lib$(BOARD).o + +COBJS := $(BOARD).o + +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
board/nvidia/cardhu/cardhu.c new file +87 -0
87 lines not on this page · raw message
board/nvidia/cardhu/pinmux-config-common.h new file +346 -0
346 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 6/9 Tegra30: Add Cardhu board files
board/nvidia/cardhu/cardhu.c line 42
Quoted 9 lines · Tom Warren
board/nvidia/cardhu/cardhu.c +7
-0+/* +* Routine: gpio_config_uart +* Description: Does nothing on Cardhu - no conflict w/SPI. +*/ +void gpio_config_uart (void ) +{ +}
For reference, personally, I'd expect to see the UART pinmux set up there (at least after Lucas's cleanup of GPIO/UART/pinmux functions patch).
Quoted 9 lines
board/nvidia/cardhu/cardhu.c +9
-0+#ifdef CONFIG_TEGRA_MMC +/* +* Routine: pin_mux_mmc +* Description: setup the pin muxes/tristate values for the SDMMC(s) +*/ +static void pin_mux_mmc (void ) +{ +funcmux_select (PERIPH_ID_SDMMC4 ,FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT ); +funcmux_select (PERIPH_ID_SDMMC3 ,FUNCMUX_SDMMC3_SDB_4BIT );
...
board/nvidia/cardhu/cardhu.c line 87
Quoted 7 lines
board/nvidia/cardhu/cardhu.c +7
-0+#ifdef CONFIG_USB_EHCI_TEGRA +void pin_mux_usb (void ) +{ +/* For USB's GPIO PD0. For now, since we have no pinmux in fdt */ +pinmux_tristate_disable (PINGRP_SLXK ); +} +#endif
None of that would compile if the options were enabled. I'd definitely suggest removing since it needs to be completely re-written anyway. Otherwise, someone else isn't going to know and it'll seem like reference code.
board/nvidia/cardhu/pinmux-config-common.h
Quoted 1 line
board/nvidia/cardhu/pinmux-config-common.h +0
-0
I don't think anything in this file is actually used?
PATCH 6/9 Tegra30: Add Cardhu board files
In reply to Tom WarrenHi Tom,
Quoted 218 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>--- board/nvidia/cardhu/Makefile | 48 ++++ board/nvidia/cardhu/cardhu.c | 87 +++++++ board/nvidia/cardhu/pinmux-config-common.h | 346 ++++++++++++++++++++++++++++ 3 files changed, 481 insertions(+), 0 deletions(-) create mode 100644 board/nvidia/cardhu/Makefile create mode 100644 board/nvidia/cardhu/cardhu.c create mode 100644 board/nvidia/cardhu/pinmux-config-common.hboard/nvidia/cardhu/Makefile new file +48
-0@@ -0,0 +1,48 @@ +# +# (C) Copyright 2010-2012 +# NVIDIA Corporation <www.nvidia.com> +# +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +ifneq ($(OBJTREE),$(SRCTREE)) +$(shell mkdir -p $(obj)../common) +endif + +LIB = $(obj)lib$(BOARD).o + +COBJS := $(BOARD).o + +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################board/nvidia/cardhu/cardhu.c new file +87
-0@@ -0,0 +1,87 @@ +/* +* (C) Copyright 2010-2012 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/tegra30.h> +#include <asm/arch/clock.h> +#include <asm/arch/funcmux.h> +#include <asm/arch/pinmux.h> +#include <asm/arch/mmc.h> +#include <asm/gpio.h> +#ifdef CONFIG_TEGRA_MMC +#include <mmc.h> +#endif + +/* +* Routine: gpio_config_uart +* Description: Does nothing on Cardhu - no conflict w/SPI. +*/ +void gpio_config_uart (void ) +{ +} + +#ifdef CONFIG_TEGRA_MMC +/* +* Routine: pin_mux_mmc +* Description: setup the pin muxes/tristate values for the SDMMC(s) +*/ +static void pin_mux_mmc (void ) +{ +funcmux_select (PERIPH_ID_SDMMC4 ,FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT ); +funcmux_select (PERIPH_ID_SDMMC3 ,FUNCMUX_SDMMC3_SDB_4BIT ); + +/* For power GPIO PI6 */ +pinmux_tristate_disable (PINGRP_ATA ); +/* For CD GPIO PI5 */ +pinmux_tristate_disable (PINGRP_ATC ); +} + +/* this is a weak define that we are overriding */ +int board_mmc_init (bd_t *bd) +{ +debug ("board_mmc_init called\n" ); + +/* Enable muxes, etc. for SDMMC controllers */ +pin_mux_mmc (); + +debug ("board_mmc_init: init eMMC\n" ); +/* init dev 0, eMMC chip, with 4-bit bus */ +/* The board has an 8-bit bus, but 8-bit doesn't work yet */ +tegra_mmc_init (0 ,4 ,-1 ,-1 ); + +debug ("board_mmc_init: init SD slot\n" ); +/* init dev 1, SD slot, with 4-bit bus */ +tegra_mmc_init (1 ,4 ,GPIO_PI6 ,GPIO_PI5 ); + +return 0 ; +} +#endif + +#ifdef CONFIG_USB_EHCI_TEGRA +void pin_mux_usb (void ) +{ +/* For USB's GPIO PD0. For now, since we have no pinmux in fdt */ +pinmux_tristate_disable (PINGRP_SLXK ); +} +#endif board/nvidia/cardhu/pinmux-config-common.h new file +55
-0@@ -0,0 +1,346 @@ +/* +* (C) Copyright 2010-2012 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef PINMUX_CONFIG_COMMON_H +#define PINMUX_CONFIG_COMMON_H + +#define DEFAULT_PINMUX (_pingroup, _mux, _pull, _tri, _io) \ + { \ + .pingroup = PINGRP_##_pingroup, \ + .func = PMUX_FUNC_##_mux, \ + .pull = PMUX_PULL_##_pull, \ + .tristate = PMUX_TRI_##_tri, \ + .io = PMUX_PIN_##_io, \ + .lock = PMUX_PIN_LOCK_DEFAULT, \ + .od = PMUX_PIN_OD_DEFAULT, \ + .ioreset = PMUX_PIN_IO_RESET_DEFAULT, \ + } + +#define I2C_PINMUX (_pingroup, _mux, _pull, _tri, _io, _lock, _od) \ + { \ + .pingroup = PINGRP_##_pingroup, \ + .func = PMUX_FUNC_##_mux, \ + .pull = PMUX_PULL_##_pull, \ + .tristate = PMUX_TRI_##_tri, \ + .io = PMUX_PIN_##_io, \ + .lock = PMUX_PIN_LOCK_##_lock, \ + .od = PMUX_PIN_OD_##_od, \ + .ioreset = PMUX_PIN_IO_RESET_DEFAULT, \ + } + +#define LV_PINMUX (_pingroup, _mux, _pull, _tri, _io, _lock, _ioreset) \ + { \ + .pingroup = PINGRP_##_pingroup, \ + .func = PMUX_FUNC_##_mux, \ + .pull = PMUX_PULL_##_pull, \
board/nvidia/cardhu/pinmux-config-common.h line 65
Quoted 10 lines
board/nvidia/cardhu/pinmux-config-common.h new file +10
-0+ .tristate = PMUX_TRI_##_tri, \ + .io = PMUX_PIN_##_io, \ + .lock = PMUX_PIN_LOCK_##_lock, \ + .od = PMUX_PIN_OD_DEFAULT, \ + .ioreset = PMUX_PIN_IO_RESET_##_ioreset \ + } + +static struct pingroup_config tegra3_pinmux_common[] = { +/* SDMMC1 pinmux */ +DEFAULT_PINMUX (SDMMC1_CLK ,SDMMC1 ,NORMAL ,NORMAL ,INPUT ),
This is using a fixed table instead of selecting based on individual settings or the fdt, and presumably each board will need its own table. The funcmux approach is a half-way house towards the fdt. The intent with that was to define particular configurations for each peripheral, that board vendors can select from.
Regards,
Simon
PATCH 7/9 Tegra30: Add config files (common and Cardhu)
In reply to Tom Warren--- include/configs/cardhu.h | 52 +++++++++++ include/configs/tegra30-common.h | 188 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 240 insertions(+), 0 deletions(-) create mode 100644 include/configs/cardhu.h create mode 100644 include/configs/tegra30-common.h
include/configs/cardhu.h new file +52 -0
@@ -0,0 +1,52 @@ +/* +* (C) Copyright 2010-2012 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#include <asm/sizes.h> + +#include "tegra30-common.h" + +/* Enable fdt support for Cardhu. Flash the image in u-boot-dtb.bin */ +#define CONFIG_DEFAULT_DEVICE_TREE tegra30-cardhu +#define CONFIG_OF_CONTROL +#define CONFIG_OF_SEPARATE + +/* High-level configuration options */ +#define V_PROMPT "Tegra30 (Cardhu) # " +#define CONFIG_TEGRA_BOARD_STRING "NVIDIA Cardhu" + +/* Board-specific serial config */ +#define CONFIG_SERIAL_MULTI +#define CONFIG_TEGRA_ENABLE_UARTA +#define CONFIG_SYS_NS16550_COM1 NV_PA_APB_UARTA_BASE + +#define CONFIG_MACH_TYPE MACH_TYPE_CARDHU + +#define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_ENV_IS_NOWHERE + +#include "tegra-common-post.h" + +#endif /* __CONFIG_H */
include/configs/tegra30-common.h new file +188 -0
188 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 7/9 Tegra30: Add config files (common and Cardhu)
include/configs/tegra30-common.h line 34
Quoted 9 lines · Tom Warren
include/configs/tegra30-common.h +7
-0+/* +* QUOTE(m) will evaluate to a string version of the value of the macro m +* passed in. The extra level of indirection here is to first evaluate the +* macro m before applying the quoting operator. +*/ +#define QUOTE_ (m) #m +#define QUOTE (m) QUOTE_(m)
Seems like a good candidate for a common header (not Tegra-common, but across all of U-Boot).
include/configs/tegra30-common.h line 90
Quoted 2 lines
include/configs/tegra30-common.h +2
-0+#define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\ + 115200}
IIRC, that's the default now and can be removed. There may be other variables the comment applies to - Tom Rini would know better since he pointed them out in my RPi patches.
Quoted 1 line
+#define
CONFIG_SYS_LOAD_ADDR(0x80A00800) /* default */
Hmmm. I notice that both here and the equivalent Tegra20 file, we define both CONFIG_LOADADDR and CONFIG_SYS_LOAD_ADDR. Should we actually be defining both, and with different values (is one unused?).
PATCH 7/9 Tegra30: Add config files (common and Cardhu)
Quoted 4 lines · Stephen Warren
Quoted 1 line · Tom Warren
include/configs/tegra30-common.h +0
-0
Quoted 10 lines
include/configs/tegra30-common.h line 34
Quoted 7 lines
include/configs/tegra30-common.h +7
-0+/* +* QUOTE(m) will evaluate to a string version of the value of the macro m +* passed in. The extra level of indirection here is to first evaluate the +* macro m before applying the quoting operator. +*/ +#define QUOTE_ (m) #m +#define QUOTE (m) QUOTE_(m)Seems like a good candidate for a common header (not Tegra-common, but across all of U-Boot).
This is __stringify() that Marek needs to address Wolfgang's comment on still, iirc.
Quoted 6 lines
include/configs/tegra30-common.h line 90
Quoted 2 lines
include/configs/tegra30-common.h +2
-0+#define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\ + 115200}IIRC, that's the default now and can be removed. There may be other variables the comment applies to - Tom Rini would know better since he pointed them out in my RPi patches.
That and the hush prompt one if it's there need to go.
Signature · 1 line
Tom
PATCH 7/9 Tegra30: Add config files (common and Cardhu)
Dear Tom Rini,
Quoted 16 lines · Stephen Warren
Quoted 14 lines · Tom Warren
include/configs/tegra30-common.h line 34
Quoted 10 lines
include/configs/tegra30-common.h +2
-0+/* +* QUOTE(m) will evaluate to a string version of the value of the macro m + * passed in. The extra level of indirection here is to first evaluate the + * macro m before applying the quoting operator.
+ */include/configs/tegra30-common.h +2
-0+#define QUOTE_ (m) #m +#define QUOTE (m) QUOTE_(m)Seems like a good candidate for a common header (not Tegra-common, but across all of U-Boot).
Quoted 2 lines
This is
__stringify()that Marek needs to address Wolfgang's comment on still, iirc.
I need to roll out the stringify patches ... the issues should be fixed.
Quoted 8 lines
Quoted 6 lines
include/configs/tegra30-common.h line 90
Quoted 2 lines
include/configs/tegra30-common.h +2
-0+#define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\ + 115200}IIRC, that's the default now and can be removed. There may be other variables the comment applies to - Tom Rini would know better since he pointed them out in my RPi patches.
That and the hush prompt one if it's there need to go.
Best regards,
Marek Vasut
PATCH 7/9 Tegra30: Add config files (common and Cardhu)
In reply to Tom WarrenHi Tom,
Quoted 117 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>--- include/configs/cardhu.h | 52 +++++++++++ include/configs/tegra30-common.h | 188 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 240 insertions(+), 0 deletions(-) create mode 100644 include/configs/cardhu.h create mode 100644 include/configs/tegra30-common.hinclude/configs/cardhu.h new file +52
-0@@ -0,0 +1,52 @@ +/* +* (C) Copyright 2010-2012 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#include <asm/sizes.h> + +#include "tegra30-common.h" + +/* Enable fdt support for Cardhu. Flash the image in u-boot-dtb.bin */ +#define CONFIG_DEFAULT_DEVICE_TREE tegra30-cardhu +#define CONFIG_OF_CONTROL +#define CONFIG_OF_SEPARATE + +/* High-level configuration options */ +#define V_PROMPT "Tegra30 (Cardhu) # " +#define CONFIG_TEGRA_BOARD_STRING "NVIDIA Cardhu" + +/* Board-specific serial config */ +#define CONFIG_SERIAL_MULTI +#define CONFIG_TEGRA_ENABLE_UARTA +#define CONFIG_SYS_NS16550_COM1 NV_PA_APB_UARTA_BASE + +#define CONFIG_MACH_TYPE MACH_TYPE_CARDHU + +#define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_ENV_IS_NOWHERE + +#include "tegra-common-post.h" + +#endif /* __CONFIG_H */ include/configs/tegra30-common.h new file +45
-0@@ -0,0 +1,188 @@ +/* +* (C) Copyright 2010-2012 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef __TEGRA30_COMMON_H +#define __TEGRA30_COMMON_H +#include <asm/sizes.h> + +/* +* QUOTE(m) will evaluate to a string version of the value of the macro m +* passed in. The extra level of indirection here is to first evaluate the +* macro m before applying the quoting operator. +*/ +#define QUOTE_ (m) #m +#define QUOTE (m) QUOTE_(m) + +/* +* High Level Configuration Options +*/ +#define CONFIG_ARMCORTEXA9 /* This is an ARM V7 CPU core */ +#define CONFIG_TEGRA30 /* in a NVidia Tegra30 core */ +#define CONFIG_TEGRA /* which is a Tegra generic machine */ +#define CONFIG_SYS_L2CACHE_OFF /* No L2 cache */ + +#define CONFIG_SYS_CACHELINE_SIZE 32 +
include/configs/tegra30-common.h line 55
Quoted 10 lines
include/configs/tegra30-common.h new file +10
-0+#include <asm/arch/tegra30.h> /* get chip and board defs */ + +/* +* Display CPU and Board information +*/ +#define CONFIG_DISPLAY_CPUINFO +#define CONFIG_DISPLAY_BOARDINFO + +#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ +#define CONFIG_OF_LIBFDT /* enable passing of devicetree */
Do you think there should be a tegra-common.h, included by tegra20-common and tegra30-common? That was the approach we talk in the Chromium tree.
Regards,
Simon
PATCH 7/9 Tegra30: Add config files (common and Cardhu)
Simon,
Quoted 126 lines · Simon Glass
Hi Tom,
Quoted 123 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>--- include/configs/cardhu.h | 52 +++++++++++ include/configs/tegra30-common.h | 188 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 240 insertions(+), 0 deletions(-) create mode 100644 include/configs/cardhu.h create mode 100644 include/configs/tegra30-common.hinclude/configs/cardhu.h new file +52
-0@@ -0,0 +1,52 @@ +/* +* (C) Copyright 2010-2012 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#include <asm/sizes.h> + +#include "tegra30-common.h" + +/* Enable fdt support for Cardhu. Flash the image in u-boot-dtb.bin */ +#define CONFIG_DEFAULT_DEVICE_TREE tegra30-cardhu +#define CONFIG_OF_CONTROL +#define CONFIG_OF_SEPARATE + +/* High-level configuration options */ +#define V_PROMPT "Tegra30 (Cardhu) # " +#define CONFIG_TEGRA_BOARD_STRING "NVIDIA Cardhu" + +/* Board-specific serial config */ +#define CONFIG_SERIAL_MULTI +#define CONFIG_TEGRA_ENABLE_UARTA +#define CONFIG_SYS_NS16550_COM1 NV_PA_APB_UARTA_BASE + +#define CONFIG_MACH_TYPE MACH_TYPE_CARDHU + +#define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_ENV_IS_NOWHERE + +#include "tegra-common-post.h" + +#endif /* __CONFIG_H */ include/configs/tegra30-common.h new file +51
-0@@ -0,0 +1,188 @@ +/* +* (C) Copyright 2010-2012 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef __TEGRA30_COMMON_H +#define __TEGRA30_COMMON_H +#include <asm/sizes.h> + +/* +* QUOTE(m) will evaluate to a string version of the value of the macro m +* passed in. The extra level of indirection here is to first evaluate the +* macro m before applying the quoting operator. +*/ +#define QUOTE_ (m) #m +#define QUOTE (m) QUOTE_(m) + +/* +* High Level Configuration Options +*/ +#define CONFIG_ARMCORTEXA9 /* This is an ARM V7 CPU core */ +#define CONFIG_TEGRA30 /* in a NVidia Tegra30 core */ +#define CONFIG_TEGRA /* which is a Tegra generic machine */ +#define CONFIG_SYS_L2CACHE_OFF /* No L2 cache */ + +#define CONFIG_SYS_CACHELINE_SIZE 32 + +#include <asm/arch/tegra30.h> /* get chip and board defs */ + +/* +* Display CPU and Board information +*/ +#define CONFIG_DISPLAY_CPUINFO
Quoted 8 lines
include/configs/tegra30-common.h line 55
Quoted 4 lines
include/configs/tegra30-common.h new file +4
-0+#define CONFIG_DISPLAY_BOARDINFO + +#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ +#define CONFIG_OF_LIBFDT /* enable passing of devicetree */ Do you think there should be a
tegra-common.h, included by tegra20-common and tegra30-common? That was the approach we talk in the Chromium tree.
There can be. There's already a tegra-common-post.h header for boot stuff. I'll take a look.
Thanks
Quoted 3 lines
Regards,
Simon
PATCH 8/9 Tegra30: Add common pinmux config in board_early_init_f
In reply to Tom Warren--- board/nvidia/common/board.c | 27 ++++++++++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletions(-)
board/nvidia/common/board.c +26 -1
@@ -1,5 +1,5 @@/* -* (C) Copyright 2010,2011 +* (C) Copyright 2010-2012 * NVIDIA Corporation <www.nvidia.com> * * See file CREDITS for list of people who contributed to this
@@ -25,7 +25,11 @@#include <ns16550.h> #include <linux/compiler.h> #include <asm/io.h> +#if defined(CONFIG_TEGRA20 )#include <asm/arch/tegra20.h> +#else /* Tegra30 */ +#include <asm/arch/tegra30.h> +#endif #include <asm/arch/sys_proto.h> #include <asm/arch/board.h>
@@ -87,6 +91,25 @@ static void power_det_init(void)#endif } +#ifdef CONFIG_TEGRA30 +#include "../cardhu/pinmux-config-common.h" +#endif + +/* +* Routine: pinmux_init +* Description: Do individual peripheral pinmux configs +*/ +static void pinmux_init (void ) +{ +#if defined(CONFIG_TEGRA30 ) +pinmux_config_table (tegra3_pinmux_common, +ARRAY_SIZE (tegra3_pinmux_common)); + +pinmux_config_table (unused_pins_lowpower, +ARRAY_SIZE (unused_pins_lowpower)); +#endif +} +/* * Routine: board_init * Description: Early hardware init.
@@ -152,6 +175,8 @@ void gpio_early_init(void) __attribute__((weak, alias("__gpio_early_init")));int board_early_init_f (void ) { +pinmux_init (); +board_init_uart_f ();/* Initialize periph GPIOs */
Signature · 1 line
1.7.0.4
PATCH 8/9 Tegra30: Add common pinmux config in board_early_init_f
Quoted 4 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>--- board/nvidia/common/board.c | 27 ++++++++++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletions(-)
Common code:-) :-) But ...
board/nvidia/common/board.c static void power_det_init(void) · line 96
Quoted 5 lines
board/nvidia/common/board.c +3
-0+#ifdef CONFIG_TEGRA30 +#include "../cardhu/pinmux-config-common.h" +#endif
Not all Tegra30 will be Cardhu...
Given this is really board-specific, shouldn't the following be an empty weak definition:
Quoted 4 lines
board/nvidia/common/board.c +4
-0+/* +* Routine: pinmux_init +* Description: Do individual peripheral pinmux configs +*/
board/nvidia/common/board.c static void power_det_init(void) · line 111
Quoted 10 lines
board/nvidia/common/board.c +10
-0+static void pinmux_init (void ) +{ +#if defined(CONFIG_TEGRA30 ) +pinmux_config_table (tegra3_pinmux_common, +ARRAY_SIZE (tegra3_pinmux_common)); + +pinmux_config_table (unused_pins_lowpower, +ARRAY_SIZE (unused_pins_lowpower)); +#endif +}
... and the function be overridden in board files as needed?
If we are moving to a model of a single function that sets up the entire pin mux at boot (which seems fine to me, and could eventually be driven by DT if it happened late enough), then it seems like we wouldn't need e.g. pin_mux_mmc() or pin_mux_usb() any more.
PATCH 8/9 Tegra30: Add common pinmux config in board_early_init_f
Hi,
Quoted 36 lines · Stephen Warren
Quoted 4 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>--- board/nvidia/common/board.c | 27 ++++++++++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletions(-)Common code:-) :-) But ...
board/nvidia/common/board.c static void power_det_init(void) · line 96
Quoted 5 lines
board/nvidia/common/board.c +3
-0+#ifdef CONFIG_TEGRA30 +#include "../cardhu/pinmux-config-common.h" +#endif Not all Tegra30 will be Cardhu...
Given this is really board-specific, shouldn't the following be an empty weak definition:
Quoted 4 lines
board/nvidia/common/board.c +4
-0+/* +* Routine: pinmux_init +* Description: Do individual peripheral pinmux configs +*/ board/nvidia/common/board.c static void power_det_init(void) · line 111
Quoted 10 lines
board/nvidia/common/board.c +10
-0+static void pinmux_init (void ) +{ +#if defined(CONFIG_TEGRA30 ) +pinmux_config_table (tegra3_pinmux_common, +ARRAY_SIZE (tegra3_pinmux_common)); + +pinmux_config_table (unused_pins_lowpower, +ARRAY_SIZE (unused_pins_lowpower)); +#endif +}... and the function be overridden in board files as needed?
Quoted 4 lines
If we are moving to a model of a single function that sets up the entire pin mux at boot (which seems fine to me, and could eventually be driven by DT if it happened late enough), then it seems like we wouldn't need e.g.
pin_mux_mmc()orpin_mux_usb()any more.
While the fdt may eventually remove this discussion, I don't think forcing a one-time pinmux init is the best idea. Some peripherals will not be needed on every boot (e.g. normally boot from eMMC unless USB is available). Some peripherals may want to change their config based on run-time settings (although this is unlikely I suppose, particularly if we have the fdt).
Regards,
Simon
Quoted 4 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 8/9 Tegra30: Add common pinmux config in board_early_init_f
Simon,
Quoted 44 lines · Simon Glass
Hi,
Quoted 36 lines · Stephen Warren
Quoted 4 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>--- board/nvidia/common/board.c | 27 ++++++++++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletions(-)Common code:-) :-) But ...
board/nvidia/common/board.c static void power_det_init(void) · line 96
Quoted 5 lines
board/nvidia/common/board.c +3
-0+#ifdef CONFIG_TEGRA30 +#include "../cardhu/pinmux-config-common.h" +#endif Not all Tegra30 will be Cardhu...
Given this is really board-specific, shouldn't the following be an empty weak definition:
Quoted 4 lines
board/nvidia/common/board.c +4
-0+/* +* Routine: pinmux_init +* Description: Do individual peripheral pinmux configs +*/ board/nvidia/common/board.c static void power_det_init(void) · line 111
Quoted 10 lines
board/nvidia/common/board.c +10
-0+static void pinmux_init (void ) +{ +#if defined(CONFIG_TEGRA30 ) +pinmux_config_table (tegra3_pinmux_common, +ARRAY_SIZE (tegra3_pinmux_common)); + +pinmux_config_table (unused_pins_lowpower, +ARRAY_SIZE (unused_pins_lowpower)); +#endif +}... and the function be overridden in board files as needed?
Quoted 4 lines
If we are moving to a model of a single function that sets up the entire pin mux at boot (which seems fine to me, and could eventually be driven by DT if it happened late enough), then it seems like we wouldn't need e.g.
pin_mux_mmc()orpin_mux_usb()any more.
Quoted 6 lines
While the fdt may eventually remove this discussion, I don't think forcing a one-time pinmux init is the best idea. Some peripherals will not be needed on every boot (e.g. normally boot from eMMC unless USB is available). Some peripherals may want to change their config based on run-time settings (although this is unlikely I suppose, particularly if we have the fdt).
I've been basically adapting our internal T30 U-Boot code to fit within the framework of what's upstream, including Allen's SPL reorg. Pinmux on our T30 codebase (including the Chromium U-Boot code, I believe) was done in a single monolithic file, as demonstrated in this patch. The advantages are that you can construct the table to ensure there are no conflicts, no small task with 4 options per mux and over 100 muxes. Even the HW power-on defaults have conflicts. The only exception in this patchset was the UART muxing, so we can start putting out debug/status spew to the console as early as possible.
As far as I'm aware, an FDT pinmux for Tegra (which is on my plate, but quite a bit behind T30) would be essentially the same deal - one large list of mux settings per build/board.
Also, we've had bugs submitted by the kernel guys at times because U-Boot didn't do _enough_ init. While I agree with the U-Boot philosophy of doing just what's necessary to get a kernel loaded, I don't consider pinmux init from a table as a time-consuming or code-intensive operation, and see no harm in leaving it in. The driver can always remap the muxes as it chooses at a later date, based on what it discovers or knows from its config or the DT.
Thanks,
Tom
Quoted 8 lines
Regards,
SimonQuoted 4 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 8/9 Tegra30: Add common pinmux config in board_early_init_f
On 09/18/2012 03:32 PM, Tom Warren wrote:
...
Quoted 3 lines
As far as I'm aware, an FDT pinmux for Tegra (which is on my plate, but quite a bit behind T30) would be essentially the same deal - one large list of mux settings per build/board.
Initializing pinmux from DT can work either way, depending on how the DT author wrote the DT file.
The pinmux DT node can contain a pinmux configuration which is applied as soon as the pinmux driver loads. This configuration can contain as little as you want (even nothing) all the way through to containing the entire board's static pinmux configuration.
For portions of the pinmux settings which the pinmux driver's own DT node doesn't configure (if any, based on the above), the relevant individual driver DT node can configure the pinmux as required, and that configuration would be applied when the relevant driver loads and parses its DT node.
In practice, so far, all the kernel board files for Tegra almost exclusively use static muxing in the pinmux controller's own DT node. However, there are a couple small dynamic cases (e.g. Seaboard/Springbank's pinctrl-based I2C mux for example).
PATCH 9/9 Tegra30: Enable Cardhu build (SPL)
In reply to Tom WarrenThis builds & boots to the command prompt on a Cardhu (T30) board. This is a barebones binary - no I2C, USB, MMC, SPI, etc. Drivers for those peripherals to follow.
--- Makefile | 23 +++++++++++++++++++++++ arch/arm/cpu/armv7/Makefile | 2 +- arch/arm/cpu/armv7/start.S | 4 ++-- boards.cfg | 1 + drivers/gpio/tegra_gpio.c | 4 ++++ include/serial.h | 3 ++- spl/Makefile | 3 +++ 7 files changed, 36 insertions(+), 4 deletions(-)
Makefile +23 -0
@@ -322,6 +322,9 @@ endif ifeq ($(SOC),tegra20) LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o endif +ifeq ($(SOC),tegra30) +LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o +endif LIBS := $(addprefix $(obj),$(sort $(LIBS-y))) .PHONY : $(LIBS)
@@ -389,6 +392,13 @@ else ALL-y += $(obj)u-boot-nodtb-tegra.bin endif endif +ifeq ($(SOC),tegra30) +ifeq ($(CONFIG_OF_SEPARATE),y) +ALL-y += $(obj)u-boot-dtb-tegra.bin +else +ALL-y += $(obj)u-boot-nodtb-tegra.bin +endif +endif all: $(ALL-y) $(SUBDIR_EXAMPLES)
@@ -497,6 +507,19 @@ $(obj)u-boot-nodtb-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin rm $(obj)spl/u-boot-spl-pad.bin endif endif +ifeq ($(SOC),tegra30) +ifeq ($(CONFIG_OF_SEPARATE),y) +$(obj)u-boot-dtb-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin $(obj)u-boot.dtb + $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin + cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin $(obj)u-boot.dtb > $@ + rm $(obj)spl/u-boot-spl-pad.bin +else +$(obj)u-boot-nodtb-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin + $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin + cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@ + rm $(obj)spl/u-boot-spl-pad.bin +endif +endif ifeq ($(CONFIG_SANDBOX),y) GEN_UBOOT = \
arch/arm/cpu/armv7/Makefile +1 -1
@@ -32,7 +32,7 @@ COBJS += cache_v7.o COBJS += cpu.o COBJS += syslib.o -ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20),) +ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20)$(CONFIG_TEGRA30),) SOBJS += lowlevel_init.o endif
arch/arm/cpu/armv7/start.S +2 -2
@@ -280,14 +280,14 @@ jump_2_ram: /* * Move vector table */ -#if !defined(CONFIG_TEGRA20) +#if !defined(CONFIG_TEGRA) #if !(defined(CONFIG_OMAP44XX) && defined(CONFIG_SPL_BUILD)) /* Set vector address in CP15 VBAR register */ ldr r0, =_start add r0, r0, r9 mcr p15, 0, r0, c12, c0, 0 @Set VBAR #endif -#endif /* !Tegra20 */ +#endif /* !Tegra20 or 30 */ ldr r0, _board_init_r_ofs adr r1, _start
boards.cfg +1 -0
@@ -271,6 +271,7 @@ harmony arm armv7:arm720t harmony nvidia seaboard arm armv7:arm720t seaboard nvidia tegra20 ventana arm armv7:arm720t ventana nvidia tegra20 whistler arm armv7:arm720t whistler nvidia tegra20 +cardhu arm armv7:arm720t cardhu nvidia tegra30 u8500_href arm armv7 u8500 st-ericsson u8500 snowball arm armv7 snowball st-ericsson u8500 actux1_4_16 arm ixp actux1 - - actux1:FLASH2X2
drivers/gpio/tegra_gpio.c +4 -0
@@ -30,7 +30,11 @@#include <common.h> #include <asm/io.h> #include <asm/bitops.h> +#if defined(CONFIG_TEGRA20 )#include <asm/arch/tegra20.h> +#else /* Tegra30 */ +#include <asm/arch/tegra30.h> +#endif #include <asm/gpio.h> enum {
include/serial.h +2 -1
@@ -31,7 +31,8 @@ extern struct serial_device *default_serial_console(void);defined (CONFIG_MB86R0x) ||defined (CONFIG_MPC5xxx) || \defined (CONFIG_MPC83xx) ||defined (CONFIG_MPC85xx) || \defined (CONFIG_MPC86xx) ||defined (CONFIG_SYS_SC520 ) || \ - defined(CONFIG_TEGRA20) || defined(CONFIG_SYS_COREBOOT) +defined (CONFIG_TEGRA20 ) ||defined (CONFIG_SYS_COREBOOT ) || \ + defined(CONFIG_TEGRA30)extern struct serial_device serial0_device;extern struct serial_device serial1_device;#if defined(CONFIG_SYS_NS16550_SERIAL )
spl/Makefile +3 -0
@@ -64,6 +64,9 @@ endif ifeq ($(SOC),tegra20) LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o endif +ifeq ($(SOC),tegra30) +LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o +endif # Add GCC lib ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
Signature · 1 line
1.7.0.4
PATCH 9/9 Tegra30: Enable Cardhu build (SPL)
Quoted 5 lines · Tom Warren
This builds & boots to the command prompt on a Cardhu (T30) board. This is a barebones binary - no I2C, USB, MMC, SPI, etc. Drivers for those peripherals to follow.
Signed-off-by Tom Warren <[email protected]>
[snip]
Quoted 2 lines
arch/arm/cpu/armv7/Makefile +1
-1-ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20),) +ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20)$(CONFIG_TEGRA30),)
[snip]
include/serial.h extern struct serial_device *default_serial_console(void); · line 35
Quoted 3 lines
include/serial.h +2
-1-defined (CONFIG_TEGRA20 ) ||defined (CONFIG_SYS_COREBOOT ) +defined (CONFIG_TEGRA20 ) ||defined (CONFIG_SYS_COREBOOT ) || \ +defined (CONFIG_TEGRA30 )
In both of these cases I think you should just switch to CONFIG_TEGRA rather than TEGRA20 || TEGRA30 and if TEGRA40 somehow invalidates this logic we can deal with it then but assume it won't.
Signature · 1 line
Tom
PATCH 9/9 Tegra30: Enable Cardhu build (SPL)
Tom,
Quoted 10 lines · Tom Rini
Quoted 5 lines · Tom Warren
This builds & boots to the command prompt on a Cardhu (T30) board. This is a barebones binary - no I2C, USB, MMC, SPI, etc. Drivers for those peripherals to follow.
Signed-off-by Tom Warren <[email protected]>[snip]
Quoted 2 lines
arch/arm/cpu/armv7/Makefile +1
-1-ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20),) +ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20)$(CONFIG_TEGRA30),)[snip]
Quoted 7 lines
include/serial.h extern struct serial_device *default_serial_console(void); · line 35
Quoted 3 lines
include/serial.h +2
-1-defined (CONFIG_TEGRA20 ) ||defined (CONFIG_SYS_COREBOOT ) +defined (CONFIG_TEGRA20 ) ||defined (CONFIG_SYS_COREBOOT ) || \ +defined (CONFIG_TEGRA30 )In both of these cases I think you should just switch to
CONFIG_TEGRArather than TEGRA20 || TEGRA30 and if TEGRA40 somehow invalidates this logic we can deal with it then but assume it won't.
Done, will be in V2. Thanks.
Tom
Quoted 3 lines
--
Tom
PATCH 9/9 Tegra30: Enable Cardhu build (SPL)
In reply to Tom WarrenMakefile endif · line 327
Quoted 12 lines · Tom Warren
This builds & boots to the command prompt on a Cardhu (T30) board. This is a barebones binary - no I2C, USB, MMC, SPI, etc. Drivers for those peripherals to follow.
Makefile +3
-0ifeq ($(SOC),tegra20) LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o endif +ifeq ($(SOC),tegra30) +LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o +endif
To avoid adding more and more copies of that assignment, how about:
ifneq ($(filter $(SOC),tegra20 tegra30),)
LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o endif
The same trick can be applied to the other two changes in this file, and spl/Makefile.
Or perhaps you can just use:
ifneq ($(CONFIG_TEGRA),)
drivers/gpio/tegra_gpio.c line 37
Quoted 7 lines
drivers/gpio/tegra_gpio.c +4
-0+#if defined(CONFIG_TEGRA20 )#include <asm/arch/tegra20.h> +#else /* Tegra30 */ +#include <asm/arch/tegra30.h> +#endif
If that file got renamed to tegra.h in both places, you wouldn't need ifdefs around the include.
cover Add basic Tegra30 (T30) support
In reply to Tom WarrenQuoted 7 lines · Tom Warren
This patch series adds basic (boot to cmd prompt) support for Tegra30. This is based on the Tegra20 SPL, which initializes the AVP (ARM7TDMI boot proc) first, then control is transferred to the CPU (A9 quad cluster). It is based on current u-boot-tegra/next.
Future patches will add support/drivers for MMC, USB, I2C, SPI, NAND, and other peripherals. The Cardhu T30 board is supported initially.
I tested this on my Cardhu. I did notice one bug - the fdt_load and fdt_high environment variables (from include/configs/tegra20-common-post.h before this patch-set at least) aren't updated with correct values for Tegra30.
I did try booting a kernel (after downloading it over serial) and that didn't work, but it's quite plausible that's as much a kernel issue as a U-Boot issue, so I won't worry about that for now.
I will have some comments on the other patches in the series.
cover Add basic Tegra30 (T30) support
In reply to Tom WarrenQuoted 7 lines · Tom Warren
This patch series adds basic (boot to cmd prompt) support for Tegra30. This is based on the Tegra20 SPL, which initializes the AVP (ARM7TDMI boot proc) first, then control is transferred to the CPU (A9 quad cluster). It is based on current u-boot-tegra/next.
Future patches will add support/drivers for MMC, USB, I2C, SPI, NAND, and other peripherals. The Cardhu T30 board is supported initially.
Let me put my TI Custodian hat on and say, I've been where you are and I have some advice. Make a local branch (or 5) of your working but needs re-factoring and re-cleaning tree, and start fresh from u-boot-tegra/next. Move more tegra20 files to the tegra common area. Strip (#if 0) the "new" include files bare. Bring it up again. If you bring in the framework so we can have <plat/foo.h> (which is in turn arch/$(ARCH)/include/plat-vendor) I will be so happy you beat me to the punch and with something a bit more (IMHO) clean than how the kernel handles <plat/>. You're masking a way a lot of things that are either identical (which is duplication which is bad) or subtly different (and you haven't hit it, yet). However you migrate from the current tree to the new tree (I've done a lot of ugly steps when I've done this locally, but it keeps the board working from change to change), do it and do it sooner rather than later. You will thank yourself in the end.
Signature · 1 line
Tom
cover Add basic Tegra30 (T30) support
Tom,
Quoted 10 lines · Tom Rini
Quoted 7 lines · Tom Warren
This patch series adds basic (boot to cmd prompt) support for Tegra30. This is based on the Tegra20 SPL, which initializes the AVP (ARM7TDMI boot proc) first, then control is transferred to the CPU (A9 quad cluster). It is based on current u-boot-tegra/next.
Future patches will add support/drivers for MMC, USB, I2C, SPI, NAND, and other peripherals. The Cardhu T30 board is supported initially.
Quoted 15 lines
Let me put my TI Custodian hat on and say, I've been where you are and I have some advice. Make a local branch (or 5) of your working but needs re-factoring and re-cleaning tree, and start fresh from u-boot-tegra/next. Move more tegra20 files to the tegra common area. Strip (#if 0) the "new" include files bare. Bring it up again. If you bring in the framework so we can have <
plat/foo.h> (which is in turn arch/$(ARCH)/include/plat-vendor) I will be so happy you beat me to the punch and with something a bit more (IMHO) clean than how the kernel handles <plat/>. You're masking a way a lot of things that are either identical (which is duplication which is bad) or subtly different (and you haven't hit it, yet). However you migrate from the current tree to the new tree (I've done a lot of ugly steps when I've done this locally, but it keeps the board working from change to change), do it and do it sooner rather than later. You will thank yourself in the end.
Seems like good advice. I'm off tomorrow, so I'll take a look at your approach on Monday and see how it works for me.
Thanks,
Tom
Quoted 2 lines
--
Tom