Add basic NVIDIA Tegra2 SoC support
v5 cover Add basic NVIDIA Tegra2 SoC support
This series of patches adds preliminary/baseline support for NVIDIA's Tegra2 SoC. Basic CPU (AVP), RAM and UART init are covered so that the system (Harmony or Seaboard) can boot to the U-Boot serial cmd prompt.
Further support (for Cortex-A9 CPU(s), USB, SD/MMC, etc.) to follow.
Changes for V2:
- Coding style cleanup
- Remove mach-types.h change; wait for ARM kernel sync-up
- Move serial driver changes to separate patch
- Use board/nvidia/ instead of /board/tegra
- Remove TRUE/FALSE defines
- Use standard NS16550 register/bit defines in UART init
- Change nv-common.h config file to tegra2-common.h
Changes for V3:
- Use I/O accessors for Tegra2 HW MMIO register access
- Allow conditional compile of UARTA/UARTD code to save space
Changes for V4:
- Use address of HW structs (&pmc, etc.) in readl/writel
- Remove empty lines, fix mixed case hex #s & comments in header(s)
- Move board/nvidia/common/board.c UART code & header to arch/arm/cpu/armv7/tegra2/
- Declare internal functions as static in UART code
Changes for V5:
- Move arch/arm/cpu/armv7/uart.c & board.h to drivers/serial and rename to serial_tegra2.c
- Remove use of uart_num & UART_A/D in serial_tegra2, simplify code
Tom Warren (4):
arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
serial: Add Tegra2 serial port support
arm: Tegra2: Add support for NVIDIA Harmony board
arm: Tegra2: Add support for NVIDIA Seaboard board
MAINTAINERS | 5 + arch/arm/cpu/armv7/tegra2/Makefile | 48 ++++++ arch/arm/cpu/armv7/tegra2/board.c | 91 ++++++++++++ arch/arm/cpu/armv7/tegra2/config.mk | 28 ++++ arch/arm/cpu/armv7/tegra2/lowlevel_init.S | 65 ++++++++ arch/arm/cpu/armv7/tegra2/sys_info.c | 35 +++++ arch/arm/cpu/armv7/tegra2/timer.c | 122 +++++++++++++++ arch/arm/include/asm/arch-tegra2/clk_rst.h | 154 +++++++++++++++++++ arch/arm/include/asm/arch-tegra2/pinmux.h | 51 +++++++ arch/arm/include/asm/arch-tegra2/pmc.h | 124 ++++++++++++++++ arch/arm/include/asm/arch-tegra2/sys_proto.h | 33 ++++ arch/arm/include/asm/arch-tegra2/tegra2.h | 49 ++++++ arch/arm/include/asm/arch-tegra2/uart.h | 44 ++++++ board/nvidia/common/board.c | 57 +++++++ board/nvidia/harmony/Makefile | 50 +++++++ board/nvidia/seaboard/Makefile | 50 +++++++ boards.cfg | 2 + common/serial.c | 3 +- drivers/serial/Makefile | 1 + drivers/serial/serial_tegra2.c | 205 ++++++++++++++++++++++++++ drivers/serial/serial_tegra2.h | 49 ++++++ include/configs/harmony.h | 48 ++++++ include/configs/seaboard.h | 44 ++++++ include/configs/tegra2-common.h | 160 ++++++++++++++++++++ include/serial.h | 3 +- 25 files changed, 1519 insertions(+), 2 deletions(-) create mode 100644 arch/arm/cpu/armv7/tegra2/Makefile create mode 100644 arch/arm/cpu/armv7/tegra2/board.c create mode 100644 arch/arm/cpu/armv7/tegra2/config.mk create mode 100644 arch/arm/cpu/armv7/tegra2/lowlevel_init.S create mode 100644 arch/arm/cpu/armv7/tegra2/sys_info.c create mode 100644 arch/arm/cpu/armv7/tegra2/timer.c create mode 100644 arch/arm/include/asm/arch-tegra2/clk_rst.h create mode 100644 arch/arm/include/asm/arch-tegra2/pinmux.h create mode 100644 arch/arm/include/asm/arch-tegra2/pmc.h create mode 100644 arch/arm/include/asm/arch-tegra2/sys_proto.h create mode 100644 arch/arm/include/asm/arch-tegra2/tegra2.h create mode 100644 arch/arm/include/asm/arch-tegra2/uart.h create mode 100644 board/nvidia/common/board.c create mode 100644 board/nvidia/harmony/Makefile create mode 100644 board/nvidia/seaboard/Makefile create mode 100644 drivers/serial/serial_tegra2.c create mode 100644 drivers/serial/serial_tegra2.h create mode 100644 include/configs/harmony.h create mode 100644 include/configs/seaboard.h create mode 100644 include/configs/tegra2-common.h
Signature · 1 line
1.7.3.5
PATCH v5 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
---
Changes for V2:
- Coding style cleanup
- Move serial driver changes to separate patch
- Use board/nvidia instead of board/tegra
- Remove TRUE/FALSE defines
- Use standard NS16550 registers/bit defines in UART init
Changes for V3:
- Use I/O accessors for Tegra2 HW MMIO register access
- Allow conditional compile of UARTA/UARTD code to save space
Changes for V4:
- Use address of HW structs (&pmc, etc.) in readl/writel
- Remove empty lines, fix mixed case hex #s & comments in header(s)
- Move board/nvidia/common/board.c UART code & header to arch/arm/cpu/armv7/tegra2/
- Declare internal functions as static in UART code
arch/arm/cpu/armv7/tegra2/Makefile | 48 ++++++ arch/arm/cpu/armv7/tegra2/board.c | 91 +++++++++++ arch/arm/cpu/armv7/tegra2/board.h | 58 +++++++ arch/arm/cpu/armv7/tegra2/config.mk | 28 ++++ arch/arm/cpu/armv7/tegra2/lowlevel_init.S | 65 ++++++++ arch/arm/cpu/armv7/tegra2/sys_info.c | 35 ++++ arch/arm/cpu/armv7/tegra2/timer.c | 122 +++++++++++++++ arch/arm/cpu/armv7/tegra2/uart.c | 216 ++++++++++++++++++++++++++ arch/arm/include/asm/arch-tegra2/clk_rst.h | 154 ++++++++++++++++++ arch/arm/include/asm/arch-tegra2/pinmux.h | 51 ++++++ arch/arm/include/asm/arch-tegra2/pmc.h | 124 +++++++++++++++ arch/arm/include/asm/arch-tegra2/sys_proto.h | 33 ++++ arch/arm/include/asm/arch-tegra2/tegra2.h | 49 ++++++ arch/arm/include/asm/arch-tegra2/uart.h | 44 ++++++ board/nvidia/common/board.c | 57 +++++++ 15 files changed, 1175 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/armv7/tegra2/Makefile create mode 100644 arch/arm/cpu/armv7/tegra2/board.c create mode 100644 arch/arm/cpu/armv7/tegra2/board.h create mode 100644 arch/arm/cpu/armv7/tegra2/config.mk create mode 100644 arch/arm/cpu/armv7/tegra2/lowlevel_init.S create mode 100644 arch/arm/cpu/armv7/tegra2/sys_info.c create mode 100644 arch/arm/cpu/armv7/tegra2/timer.c create mode 100644 arch/arm/cpu/armv7/tegra2/uart.c create mode 100644 arch/arm/include/asm/arch-tegra2/clk_rst.h create mode 100644 arch/arm/include/asm/arch-tegra2/pinmux.h create mode 100644 arch/arm/include/asm/arch-tegra2/pmc.h create mode 100644 arch/arm/include/asm/arch-tegra2/sys_proto.h create mode 100644 arch/arm/include/asm/arch-tegra2/tegra2.h create mode 100644 arch/arm/include/asm/arch-tegra2/uart.h create mode 100644 board/nvidia/common/board.c
arch/arm/cpu/armv7/tegra2/Makefile new file +48 -0
@@ -0,0 +1,48 @@ +# +# (C) Copyright 2010,2011 Nvidia Corporation. +# +# (C) Copyright 2000-2003 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(SOC).o + +SOBJS := lowlevel_init.o +COBJS := board.o sys_info.o timer.o uart.o + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) + +all: $(obj).depend $(LIB) + +$(LIB): $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
arch/arm/cpu/armv7/tegra2/board.c new file +91 -0
91 lines not on this page · raw message
arch/arm/cpu/armv7/tegra2/board.h new file +58 -0
58 lines not on this page · raw message
arch/arm/cpu/armv7/tegra2/config.mk new file +28 -0
@@ -0,0 +1,28 @@ +# +# (C) Copyright 2010,2011 +# NVIDIA Corporation <www.nvidia.com> +# +# (C) Copyright 2002 +# Gary Jennejohn, DENX Software Engineering, <[email protected]> +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +# Use ARMv4 for Tegra2 - initial code runs on the AVP, which is an ARM7TDI. +PLATFORM_CPPFLAGS += -march=armv4
arch/arm/cpu/armv7/tegra2/lowlevel_init.S new file +65 -0
65 lines not on this page · raw message
arch/arm/cpu/armv7/tegra2/sys_info.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* (C) Copyright 2010,2011 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#include <common.h> + +#ifdef CONFIG_DISPLAY_CPUINFO +/* Print CPU information */ +int print_cpuinfo (void ) +{ +puts ("TEGRA2\n" ); + +/* TBD: Add printf of major/minor rev info, stepping, etc. */ +return 0 ; +} +#endif /* CONFIG_DISPLAY_CPUINFO */
arch/arm/cpu/armv7/tegra2/timer.c new file +122 -0
122 lines not on this page · raw message
arch/arm/cpu/armv7/tegra2/uart.c new file +216 -0
216 lines not on this page · raw message
arch/arm/include/asm/arch-tegra2/clk_rst.h new file +154 -0
154 lines not on this page · raw message
arch/arm/include/asm/arch-tegra2/pinmux.h new file +51 -0
51 lines not on this page · raw message
arch/arm/include/asm/arch-tegra2/pmc.h new file +124 -0
124 lines not on this page · raw message
arch/arm/include/asm/arch-tegra2/sys_proto.h new file +33 -0
@@ -0,0 +1,33 @@ +/* +* (C) Copyright 2010,2011 +* NVIDIA Corporation <www.nvidia.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _SYS_PROTO_H_ +#define _SYS_PROTO_H_ + +typedef struct { +char *board_string; +}tegra2_sysinfo ; + +void invalidate_dcache (void ); + +#endif
arch/arm/include/asm/arch-tegra2/tegra2.h new file +49 -0
49 lines not on this page · raw message
arch/arm/include/asm/arch-tegra2/uart.h new file +44 -0
44 lines not on this page · raw message
board/nvidia/common/board.c new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v5 1/4 arm: Tegra2: Add basic NVIDIA Tegra2 SoC support
Dear Tom Warren,
Quoted 2 lines · In message <[email protected]> you wrote:
Signed-off-by Tom Warren <[email protected]>...
...
Quoted 2 lines
arch/arm/include/asm/arch-tegra2/clk_rst.h new file +2
-0+/* Clock/Reset Controller (CLK_RST_CONTROLLER_) regs */ +typedef volatile struct clk_rst_ctlr {
...
Quoted 2 lines
arch/arm/include/asm/arch-tegra2/pinmux.h new file +2
-0+/* APB MISC Pin Mux and Tristate (APB_MISC_PP_) registers */ +typedef volatile struct pinmux_tri_ctlr {
...
Quoted 2 lines
arch/arm/include/asm/arch-tegra2/pmc.h new file +2
-0+/* Power Management Controller (APBDEV_PMC_) registers */ +typedef volatile struct pmc_ctlr {
...
Quoted 4 lines
arch/arm/include/asm/arch-tegra2/tegra2.h new file +4
-0+#ifndef __ASSEMBLY__ +typedef volatile struct timerus { +unsigned int cntr_1us; +}timerus_t ;
...
arch/arm/include/asm/arch-tegra2/uart.h line 28
Quoted 2 lines
arch/arm/include/asm/arch-tegra2/uart.h new file +2
-0+/* UART registers */ +typedef volatile struct uart_ctlr {
Please drop the "typedef" and the "volatile" from all these (and all other, similar) declarations.
See linux/Documentation/CodingStyle:
It's a _mistake_ to use typedef for structures and pointers.
See Documentation/volatile-considered-harmful.txt
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de I am a computer. I am dumber than any human and smarter than any ad- ministrator.
PATCH v5 2/4 serial: Add Tegra2 serial port support
In reply to Tom Warren---
Changes for V2:
- Move serial driver to separate patch
Changes for V5:
- Move arch/arm/cpu/armv7/uart.c & board.h to drivers/serial and rename to serial_tegra2.c
- Remove use of uart_num & UART_A/D in serial_tegra2, simplify code
arch/arm/cpu/armv7/tegra2/Makefile | 2 +- arch/arm/cpu/armv7/tegra2/board.c | 2 +- arch/arm/cpu/armv7/tegra2/board.h | 58 ---------- arch/arm/cpu/armv7/tegra2/uart.c | 216 ------------------------------------ common/serial.c | 3 +- drivers/serial/Makefile | 1 + drivers/serial/serial_tegra2.c | 205 ++++++++++++++++++++++++++++++++++ drivers/serial/serial_tegra2.h | 49 ++++++++ include/serial.h | 3 +- 9 files changed, 261 insertions(+), 278 deletions(-) delete mode 100644 arch/arm/cpu/armv7/tegra2/board.h delete mode 100644 arch/arm/cpu/armv7/tegra2/uart.c create mode 100644 drivers/serial/serial_tegra2.c create mode 100644 drivers/serial/serial_tegra2.h
arch/arm/cpu/armv7/tegra2/Makefile +1 -1
@@ -28,7 +28,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).o SOBJS := lowlevel_init.o -COBJS := board.o sys_info.o timer.o uart.o +COBJS := board.o sys_info.o timer.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
arch/arm/cpu/armv7/tegra2/board.c +1 -1
@@ -25,7 +25,7 @@#include <asm/io.h> #include <asm/arch/sys_proto.h> #include <asm/arch/tegra2.h> -#include "board.h" +#include <asm/arch/pmc.h> DECLARE_GLOBAL_DATA_PTR ;
arch/arm/cpu/armv7/tegra2/board.h deleted +0 -58
58 lines not on this page · raw message
arch/arm/cpu/armv7/tegra2/uart.c deleted +0 -216
216 lines not on this page · raw message
common/serial.c +2 -1
@@ -41,7 +41,8 @@ struct serial_device *__default_serial_console (void)#elif defined(CONFIG_4xx) \ || defined(CONFIG_MB86R0x) || defined(CONFIG_MPC5xxx) \ || defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) \ - || defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520 ) + || defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520 ) \ + || defined(CONFIG_TEGRA2 )#if defined(CONFIG_CONS_INDEX ) && defined(CONFIG_SYS_NS16550_SERIAL )#if (CONFIG_CONS_INDEX ==1 )return &eserial1_device;
drivers/serial/Makefile +1 -0
@@ -55,6 +55,7 @@ COBJS-$(CONFIG_S3C24X0_SERIAL) += serial_s3c24x0.o COBJS-$(CONFIG_S3C44B0_SERIAL) += serial_s3c44b0.o COBJS-$(CONFIG_XILINX_UARTLITE) += serial_xuartlite.o COBJS-$(CONFIG_SCIF_CONSOLE) += serial_sh.o +COBJS-$(CONFIG_TEGRA2) += serial_tegra2.o COBJS-$(CONFIG_USB_TTY) += usbtty.o COBJS := $(sort $(COBJS-y))
drivers/serial/serial_tegra2.c new file +205 -0
205 lines not on this page · raw message
drivers/serial/serial_tegra2.h new file +49 -0
49 lines not on this page · raw message
include/serial.h +2 -1
@@ -27,7 +27,8 @@ extern struct serial_device * default_serial_console (void);defined (CONFIG_405EP ) ||defined (CONFIG_405EZ ) ||defined (CONFIG_405EX ) || \defined (CONFIG_MB86R0x) ||defined (CONFIG_MPC5xxx) || \defined (CONFIG_MPC83xx) ||defined (CONFIG_MPC85xx) || \ - defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520) +defined (CONFIG_MPC86xx) ||defined (CONFIG_SYS_SC520 ) || \ + defined(CONFIG_TEGRA2)extern struct serial_device serial0_device;extern struct serial_device serial1_device;#if defined(CONFIG_SYS_NS16550_SERIAL )
Signature · 1 line
1.7.3.5
PATCH v5 2/4 serial: Add Tegra2 serial port support
Hi Tom,
Quoted 10 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>---
Changes for V2:
- Move serial driver to separate patchChanges for V5:
- Movearch/arm/cpu/armv7/uart.c&board.htodrivers/serialand rename toserial_tegra2.c
- Remove use ofuart_num& UART_A/D inserial_tegra2, simplify code
Quoted 14 lines
arch/arm/cpu/armv7/tegra2/Makefile | 2 +- arch/arm/cpu/armv7/tegra2/board.c | 2 +- arch/arm/cpu/armv7/tegra2/board.h | 58 ---------- arch/arm/cpu/armv7/tegra2/uart.c | 216 ------------------------------------ common/serial.c | 3 +- drivers/serial/Makefile | 1 + drivers/serial/serial_tegra2.c | 205 ++++++++++++++++++++++++++++++++++ drivers/serial/serial_tegra2.h | 49 ++++++++ include/serial.h | 3 +- 9 files changed, 261 insertions(+), 278 deletions(-) delete mode 100644 arch/arm/cpu/armv7/tegra2/board.h delete mode 100644 arch/arm/cpu/armv7/tegra2/uart.c create mode 100644 drivers/serial/serial_tegra2.c create mode 100644 drivers/serial/serial_tegra2.h
It looks like arch/arm/cpu/armv7/tegra2/board.h and arch/arm/cpu/armv7/tegra2/uart.c are added in the first patch, then moved in this patch. It'd be ideal to just add them once in the proper location.
On a side note, if you pass "git format-patch" the -M and -C options it will make pretty diffs that only show what lines changed during a move. In the case that you do move files in the future its nice to use those options to ease review.
<snip>
+void uart_init(void)
drivers/serial/serial_tegra2.c line 205
Quoted 9 lines
drivers/serial/serial_tegra2.c new file +9
-0+{ +/* Init each UART - there may be more than 1 on a board/build */ +#if (CONFIG_TEGRA2_ENABLE_UARTA ) +init_uart (); +#endif +#if (CONFIG_TEGRA2_ENABLE_UARTD ) +init_uart (); +#endif +}
How about:
#if defined(CONFIG_TEGRA2_ENABLE_UARTA) || defined(CONFIG_TEGRA2_ENABLE_UARTD) init_uart();
#endif
Best,
Peter
PATCH v5 2/4 serial: Add Tegra2 serial port support
Peter,
Quoted 33 lines · Peter Tyser
Hi Tom,
Quoted 19 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>---
Changes for V2:
? ? ? - Move serial driver to separate patchChanges for V5:
? ? ? - Movearch/arm/cpu/armv7/uart.c&board.htodrivers/serialand ? ? ? ? ? ? ? rename toserial_tegra2.c
? ? ? - Remove use ofuart_num& UART_A/D inserial_tegra2, simplify code?arch/arm/cpu/armv7/tegra2/Makefile | ? ?2 +- ?arch/arm/cpu/armv7/tegra2/board.c ?| ? ?2 +- ?arch/arm/cpu/armv7/tegra2/board.h ?| ? 58 ---------- ?arch/arm/cpu/armv7/tegra2/uart.c ? | ?216 ------------------------------------ ?common/serial.c ? ? ? ? ? ? ? ? ? ?| ? ?3 +- ?drivers/serial/Makefile ? ? ? ? ? ?| ? ?1 + ?drivers/serial/serial_tegra2.c ? ? | ?205 ++++++++++++++++++++++++++++++++++ ?drivers/serial/serial_tegra2.h ? ? | ? 49 ++++++++ ?include/serial.h ? ? ? ? ? ? ? ? ? | ? ?3 +-Quoted 5 lines
?9 files changed, 261 insertions(+), 278 deletions(-) ?delete mode 100644
arch/arm/cpu/armv7/tegra2/board.h?delete mode 100644arch/arm/cpu/armv7/tegra2/uart.c?create mode 100644drivers/serial/serial_tegra2.c?create mode 100644drivers/serial/serial_tegra2.hIt looks like
arch/arm/cpu/armv7/tegra2/board.handarch/arm/cpu/armv7/tegra2/uart.care added in the first patch, then moved in this patch. ?It'd be ideal to just add them once in the proper location.
Quoted 5 lines
On a side note, if you pass "git format-patch" the -M and -C options it will make pretty diffs that only show what lines changed during a move. In the case that you do move files in the future its nice to use those options to ease review.
I'll use those options in the future (thanks!) to keep things cleaner. Hopefully we can just go with this set of patches so I can get to the other, more interesting code (drivers, A9 CPU init, etc.).
Quoted 17 lines
<snip>
+void
uart_init(void)drivers/serial/serial_tegra2.c line 205
Quoted 9 lines
drivers/serial/serial_tegra2.c new file +9
-0+{ + ? ? /* Init each UART - there may be more than 1 on a board/build */ +#if (CONFIG_TEGRA2_ENABLE_UARTA ) + ? ? init_uart(); +#endif +#if (CONFIG_TEGRA2_ENABLE_UARTD ) + ? ? init_uart(); +#endif +}How about:
#ifdefined(CONFIG_TEGRA2_ENABLE_UARTA)||defined(CONFIG_TEGRA2_ENABLE_UARTD)? ? ? ?init_uart();
#endif
That won't work for a board like Harmony where the developer wants both UARTs active, since uart_init is only called once.
Quoted 3 lines
Best,
Peter
Thanks,
Tom
Quoted 2 lines
PATCH v5 2/4 serial: Add Tegra2 serial port support
<snip>
Quoted 5 lines
Quoted 5 lines
It looks like
arch/arm/cpu/armv7/tegra2/board.handarch/arm/cpu/armv7/tegra2/uart.care added in the first patch, then moved in this patch. It'd be ideal to just add them once in the proper location.
Quoted 8 lines
Quoted 5 lines
On a side note, if you pass "git format-patch" the -M and -C options it will make pretty diffs that only show what lines changed during a move. In the case that you do move files in the future its nice to use those options to ease review.
I'll use those options in the future (thanks!) to keep things cleaner. Hopefully we can just go with this set of patches so I can get to the other, more interesting code (drivers, A9 CPU init, etc.).
Its up to the ARM maintainer and Wolfgang to decide if adding code in one patch just to move it around in the 2nd is acceptable. I'm guess it won't be acceptable since its considered "bad form", and its unclear what patch in this series contains what functionality. Eg this isn't really meant to "Add Tegra2 serial port support", it moves existing serial port code around? And more? Its not really just adding serial port support as the patch title states in any case.
Quoted 17 lines
Quoted 14 lines
<snip>
+void
uart_init(void)drivers/serial/serial_tegra2.c line 205
Quoted 9 lines
drivers/serial/serial_tegra2.c new file +9
-0+{ +/* Init each UART - there may be more than 1 on a board/build */ +#if (CONFIG_TEGRA2_ENABLE_UARTA ) +init_uart (); +#endif +#if (CONFIG_TEGRA2_ENABLE_UARTD ) +init_uart (); +#endif +}How about:
Quoted 3 lines
#if defined(CONFIG_TEGRA2_ENABLE_UARTA) || defined(CONFIG_TEGRA2_ENABLE_UARTD) init_uart();#endif
Quoted 2 lines
That won't work for a board like Harmony where the developer wants both UARTs active, since
uart_initis only called once.
Why should init_uart() be called two times? It looks to initialize both ports, meaning it should only be called once, right?
Also, just noticed:
+static void init_uart(void)
+{
+#if CONFIG_TEGRA2_ENABLE_UARTA
+ uart_ctlr *const uart = (uart_ctlr *)NV_PA_APB_UARTA_BASE;
+
+ uart_clock_init();
+
+ /* Enable UARTA - uses config 0 */
+ pin_mux_uart();
+
+ setup_uart(uart);
+#endif /* CONFIG_TEGRA2_ENABLE_UARTD */
+#if CONFIG_TEGRA2_ENABLE_UARTD
+ uart_ctlr *const uart = (uart_ctlr *)NV_PA_APB_UARTD_BASE;
+
Have you compiled with both UARTA and UARTD enabled? Redeclaring 'uart' in the middle of the function should throw an error or warning.
+ uart_clock_init();
+
+ /* Enable UARTD - uses config 0 */
+ pin_mux_uart();
+
+ setup_uart(uart);
+#endif /* CONFIG_TEGRA2_ENABLE_UARTD */
+}
Best,
Peter
PATCH v5 2/4 serial: Add Tegra2 serial port support
Peter,
Quoted 16 lines · Peter Tyser
<snip>
Quoted 5 lines
Quoted 5 lines
It looks like
arch/arm/cpu/armv7/tegra2/board.handarch/arm/cpu/armv7/tegra2/uart.care added in the first patch, then moved in this patch. ?It'd be ideal to just add them once in the proper location.Quoted 8 lines
Quoted 5 lines
On a side note, if you pass "git format-patch" the -M and -C options it will make pretty diffs that only show what lines changed during a move. In the case that you do move files in the future its nice to use those options to ease review.
I'll use those options in the future (thanks!) to keep things cleaner. Hopefully we can just go with this set of patches so I can get to the other, more interesting code (drivers, A9 CPU init, etc.).
Quoted 7 lines
Its up to the ARM maintainer and Wolfgang to decide if adding code in one patch just to move it around in the 2nd is acceptable. ?I'm guess it won't be acceptable since its considered "bad form", and its unclear what patch in this series contains what functionality. ?Eg this isn't really meant to "Add Tegra2 serial port support", it moves existing serial port code around? ?And more? ?Its not really just adding serial port support as the patch title states in any case.
I see what you're talking about now - I've got uart.c in 2 patch files - created in 0001 and then moved in 0002. My bad - that wasn't the intent, just what happened when I applied my V4 patches to a new branch to get the V5 patchset built. I'll fix it and resubmit.
As to 0002 not adding serial port support for Tegra2, that's all it does - adds TEGRA2 defines to serial.h/serial.c for the eserial* tables, and then adds code to turn on Tegra2-specific UART HW. If I remove any mention of uart.c in patch 0001 (add basic Tegra2 support), then does patch 0002 make sense to you?
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
<snip>
+void
uart_init(void)drivers/serial/serial_tegra2.c line 205
Quoted 9 lines
drivers/serial/serial_tegra2.c new file +9
-0+{ + ? ? /* Init each UART - there may be more than 1 on a board/build */ +#if (CONFIG_TEGRA2_ENABLE_UARTA ) + ? ? init_uart(); +#endif +#if (CONFIG_TEGRA2_ENABLE_UARTD ) + ? ? init_uart(); +#endif +}How about:
#ifdefined(CONFIG_TEGRA2_ENABLE_UARTA)||defined(CONFIG_TEGRA2_ENABLE_UARTD)? ? ? ?init_uart();
#endif
Quoted 5 lines
Quoted 2 lines
That won't work for a board like Harmony where the developer wants both UARTs active, since
uart_initis only called once.Why should
init_uart()be called two times? ?It looks to initialize both ports, meaning it should only be called once, right?
Correct, again (need more coffee!) Your if defined construct wouldn't work as written, though, because CONFIG_TEGRA2_ENABLE_UARTx is always defined (as 0 or 1). I'd have to rework it.
Quoted 18 lines
Also, just noticed:
drivers/serial/serial_tegra2.c new file +15
-0+static void init_uart (void ) +{ +#if CONFIG_TEGRA2_ENABLE_UARTA + ? ? ? ? ? ? ? uart_ctlr *const uart = (uart_ctlr *)NV_PA_APB_UARTA_BASE; + + ? ? ? ? ? ? ? uart_clock_init(); + + ? ? ? ? ? ? ? /* Enable UARTA - uses config 0 */ + ? ? ? ? ? ? ? pin_mux_uart(); + + ? ? ? ? ? ? ? setup_uart(uart); +#endif /* CONFIG_TEGRA2_ENABLE_UARTD */ +#if CONFIG_TEGRA2_ENABLE_UARTD + ? ? ? ? ? ? ? uart_ctlr *const uart = (uart_ctlr *)NV_PA_APB_UARTD_BASE; +
Quoted 2 lines
Have you compiled with both UARTA and UARTD enabled? ?Redeclaring 'uart' in the middle of the function should throw an error or warning.
I'd tested with both enabled earlier, but maybe not since the rewrite. I'll check & resubmit.
Quoted 10 lines
+ ? ? ? ? ? ? ?
uart_clock_init();drivers/serial/serial_tegra2.c new file +7
-0+ + ? ? ? ? ? ? ? /* Enable UARTD - uses config 0 */ + ? ? ? ? ? ? ? pin_mux_uart(); + + ? ? ? ? ? ? ? setup_uart(uart); +#endif /* CONFIG_TEGRA2_ENABLE_UARTD */ +}
Quoted 2 lines
Best,
Peter
Thanks, again, for your thoroughness!
Tom
Quoted 2 lines
PATCH v5 2/4 serial: Add Tegra2 serial port support
Dear Tom Warren,
Quoted 4 lines · In message <[email protected]> you…
Correct, again (need more coffee!) Your if defined construct wouldn't work as written, though, because
CONFIG_TEGRA2_ENABLE_UARTxis always defined (as 0 or 1). I'd have to rework it.
Please try and avoid relying on specific values.
Rather use "#if defined".
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "We have the right to survive!" "Not be killing others." -- Deela and Kirk, "Wink of An Eye", stardate 5710.5
PATCH v5 2/4 serial: Add Tegra2 serial port support
In reply to Tom Warren<snip>
Quoted 10 lines
I see what you're talking about now - I've got
uart.cin 2 patch files - created in 0001 and then moved in 0002. My bad - that wasn't the intent, just what happened when I applied my V4 patches to a new branch to get the V5 patchset built. I'll fix it and resubmit.As to 0002 not adding serial port support for Tegra2, that's all it does - adds TEGRA2 defines to
serial.h/serial.cfor the eserial* tables, and then adds code to turn on Tegra2-specific UART HW. If I remove any mention ofuart.cin patch 0001 (add basic Tegra2 support), then does patch 0002 make sense to you?
Yeah, that'd make more sense. Patch 2 would just contain:
common/serial.c | 3 +- drivers/serial/Makefile | 1 + drivers/serial/serial_tegra2.c | 205 ++++++++++++++++++++++++++++++++++ drivers/serial/serial_tegra2.h | 49 ++++++++ include/serial.h | 3 +-
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
<snip>
+void
uart_init(void)drivers/serial/serial_tegra2.c line 205
Quoted 9 lines
drivers/serial/serial_tegra2.c new file +9
-0+{ +/* Init each UART - there may be more than 1 on a board/build */ +#if (CONFIG_TEGRA2_ENABLE_UARTA ) +init_uart (); +#endif +#if (CONFIG_TEGRA2_ENABLE_UARTD ) +init_uart (); +#endif +}How about:
#if defined(CONFIG_TEGRA2_ENABLE_UARTA) || defined(CONFIG_TEGRA2_ENABLE_UARTD) init_uart();#endif
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
That won't work for a board like Harmony where the developer wants both UARTs active, since
uart_initis only called once.Why should
init_uart()be called two times? It looks to initialize both ports, meaning it should only be called once, right?Correct, again (need more coffee!) Your if defined construct wouldn't work as written, though, because
CONFIG_TEGRA2_ENABLE_UARTxis always defined (as 0 or 1). I'd have to rework it.
You could also just get rid of uart_init() altogether and rename init_uart() to uart_init(). That would get rid of some idefs and simplify the flow.
Best,
Peter
PATCH v5 2/4 serial: Add Tegra2 serial port support
Peter,
Quoted 13 lines · Peter Tyser
<snip>
Quoted 10 lines
I see what you're talking about now - I've got
uart.cin 2 patch files - created in 0001 and then moved in 0002. My bad - that wasn't the intent, just what happened when I applied my V4 patches to a new branch to get the V5 patchset built. ?I'll fix it and resubmit.As to 0002 not adding serial port support for Tegra2, that's all it does - adds TEGRA2 defines to
serial.h/serial.cfor the eserial* tables, and then adds code to turn on Tegra2-specific UART HW. ?If I remove any mention ofuart.cin patch 0001 (add basic Tegra2 support), then does patch 0002 make sense to you?
Quoted 7 lines
Yeah, that'd make more sense. ?Patch 2 would just contain:
?common/serial.c ? ? ? ? ? ? ? ? ? ?| ? ?3 +- ?drivers/serial/Makefile ? ? ? ? ? ?| ? ?1 + ?drivers/serial/serial_tegra2.c ? ? | ?205 ++++++++++++++++++++++++++++++++++ ?drivers/serial/serial_tegra2.h ? ? | ? 49 ++++++++ ?include/serial.h ? ? ? ? ? ? ? ? ? | ? ?3 +-
Exactly what I was thinking. I'll try to get it right in patch V6.
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 17 lines
Quoted 17 lines
<snip>
+void
uart_init(void)drivers/serial/serial_tegra2.c line 205
Quoted 9 lines
drivers/serial/serial_tegra2.c new file +9
-0+{ + ? ? /* Init each UART - there may be more than 1 on a board/build */ +#if (CONFIG_TEGRA2_ENABLE_UARTA ) + ? ? init_uart(); +#endif +#if (CONFIG_TEGRA2_ENABLE_UARTD ) + ? ? init_uart(); +#endif +}How about:
#ifdefined(CONFIG_TEGRA2_ENABLE_UARTA)||defined(CONFIG_TEGRA2_ENABLE_UARTD)? ? ? ?init_uart();
#endifQuoted 2 lines
That won't work for a board like Harmony where the developer wants both UARTs active, since
uart_initis only called once.Why should
init_uart()be called two times? ?It looks to initialize both ports, meaning it should only be called once, right?
Quoted 7 lines
Quoted 3 lines
Correct, again (need more coffee!) ?Your if defined construct wouldn't work as written, though, because
CONFIG_TEGRA2_ENABLE_UARTxis always defined (as 0 or 1). I'd have to rework it.You could also just get rid of
uart_init()altogether and renameinit_uart()touart_init(). ?That would get rid of some idefs and simplify the flow.
Yeah, I saw that as I was cleaning up the indentation & reworking the code to compile
with both UARTs defined. I'll get rid of uart_init (renamed to init_uart). Thanks.
Quoted 3 lines
Best,
Peter
Thanks,
Tom
Quoted 2 lines
PATCH v5 2/4 serial: Add Tegra2 serial port support
In reply to Peter TyserDear Peter Tyser,
Quoted 7 lines · In message <1295891506.2045.146.camel@petert> you wrote:
Quoted 4 lines
I'll use those options in the future (thanks!) to keep things cleaner. Hopefully we can just go with this set of patches so I can get to the other, more interesting code (drivers, A9 CPU init, etc.).
Its up to the ARM maintainer and Wolfgang to decide if adding code in one patch just to move it around in the 2nd is acceptable. I'm guess it
No, it is not acceptable. This should be fixed. Thanks for pointing out.
Quoted 17 lines
Also, just noticed:
drivers/serial/serial_tegra2.c new file +15
-0+static void init_uart (void ) +{ +#if CONFIG_TEGRA2_ENABLE_UARTA +uart_ctlr *const uart = (uart_ctlr *)NV_PA_APB_UARTA_BASE ; + +uart_clock_init (); + +/* Enable UARTA - uses config 0 */ +pin_mux_uart (); + +setup_uart (uart); +#endif /* CONFIG_TEGRA2_ENABLE_UARTD */ +#if CONFIG_TEGRA2_ENABLE_UARTD +uart_ctlr *const uart = (uart_ctlr *)NV_PA_APB_UARTD_BASE ; +
Quoted 2 lines
Have you compiled with both UARTA and UARTD enabled? Redeclaring 'uart' in the middle of the function should throw an error or warning.
Even if the compiler should accept it (which I hpe not), then I will not accept this ;-) Thanks for pointing out.
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de There is an old custom among my people. When a woman saves a man's life, he is grateful. -- Nona, the Kanuto which woman, "A Private Little War", stardate 4211.8.
PATCH v5 2/4 serial: Add Tegra2 serial port support
In reply to Tom WarrenQuoted 2 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>---
[ snip ]
Quoted 18 lines
drivers/serial/serial_tegra2.c new file +18
-0+/* +* Routine: pin_mux_uart +* Description: setup the pin muxes/tristate values for a UART +*/ +static void pin_mux_uart (void ) +{ +pinmux_tri_ctlr *const pmt = (pinmux_tri_ctlr *)NV_PA_APB_MISC_BASE ; +u32 reg; + +#if CONFIG_TEGRA2_ENABLE_UARTA + reg =readl (&pmt->pmt_ctl_c); + reg &=0xFFF0FFFF ;/* IRRX_/IRTX_SEL [19:16] = 00 UARTA */ +writel (reg, &pmt->pmt_ctl_c); + + reg =readl (&pmt->pmt_tri_a); + reg &= ~Z_IRRX ;/* Z_IRRX = normal (0) */ + reg &= ~Z_IRTX ;/* Z_IRTX = normal (0) */ +writel (reg, &pmt->pmt_tri_a);
drivers/serial/serial_tegra2.c line 133
Quoted 10 lines
drivers/serial/serial_tegra2.c new file +10
-0+#endif /* CONFIG_TEGRA2_ENABLE_UARTA */ +#if CONFIG_TEGRA2_ENABLE_UARTD + reg =readl (&pmt->pmt_ctl_b); + reg &=0xFFFFFFF3 ;/* GMC_SEL [3:2] = 00, UARTD */ +writel (reg, &pmt->pmt_ctl_b); + + reg =readl (&pmt->pmt_tri_a); + reg &= ~Z_GMC ;/* Z_GMC = normal (0) */ +writel (reg, &pmt->pmt_tri_a); +#endif /* CONFIG_TEGRA2_ENABLE_UARTD */
As I've already pointed out (1) this covers only one possibility of UART pin muxing options. I agree that it makes sense when this is a part of the board-specific code. However, forcing specific pins configuration in the generic driver seems problematic to me, even if most Tegra2 boards use the same configuration.
As a side note, I'd prefer to have all the pin multiplexing defined in one place in board file rather than scattered among different drivers.
(1) http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/92887/focus=93233
Signature · 2 lines
Sincerely yours, Mike.
PATCH v5 2/4 serial: Add Tegra2 serial port support
Mike,
Quoted 35 lines · Mike Rapoport
Quoted 2 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>---
[ snip ]
Quoted 18 lines
(quoted diff) +18
-0+/* + * Routine: pin_mux_uart + * Description: setup the pin muxes/tristate values for a UART + */ +static void pin_mux_uart(void) +{ + ? ? pinmux_tri_ctlr *const pmt = (pinmux_tri_ctlr *)NV_PA_APB_MISC_BASE; + ? ? u32 reg; + +#if CONFIG_TEGRA2_ENABLE_UARTA + ? ? ? ? ? ? reg = readl(&pmt->pmt_ctl_c); + ? ? ? ? ? ? reg &= 0xFFF0FFFF; ? ? ?/* IRRX_/IRTX_SEL [19:16] = 00 UARTA */ + ? ? ? ? ? ? writel(reg, &pmt->pmt_ctl_c); + + ? ? ? ? ? ? reg = readl(&pmt->pmt_tri_a); + ? ? ? ? ? ? reg &= ~Z_IRRX; ? ? ? ? /* Z_IRRX = normal (0) */ + ? ? ? ? ? ? reg &= ~Z_IRTX; ? ? ? ? /* Z_IRTX = normal (0) */ + ? ? ? ? ? ? writel(reg, &pmt->pmt_tri_a);Review
Quoted 10 lines
(quoted diff) +10
-0+#endif ? ? ? /* CONFIG_TEGRA2_ENABLE_UARTA */ +#if CONFIG_TEGRA2_ENABLE_UARTD + ? ? ? ? ? ? reg = readl(&pmt->pmt_ctl_b); + ? ? ? ? ? ? reg &= 0xFFFFFFF3; ? ? ?/* GMC_SEL [3:2] = 00, UARTD */ + ? ? ? ? ? ? writel(reg, &pmt->pmt_ctl_b); + + ? ? ? ? ? ? reg = readl(&pmt->pmt_tri_a); + ? ? ? ? ? ? reg &= ~Z_GMC; ? ? ? ? ?/* Z_GMC = normal (0) */ + ? ? ? ? ? ? writel(reg, &pmt->pmt_tri_a); +#endif ? ? ? /* CONFIG_TEGRA2_ENABLE_UARTD */
Quoted 8 lines
As I've already pointed out (1) this covers only one possibility of UART pin muxing options. I agree that it makes sense when this is a part of the board-specific code. However, forcing specific pins configuration in the generic driver seems problematic to me, even if most Tegra2 boards use the same configuration.
As a side note, I'd prefer to have all the pin multiplexing defined in one place in board file rather than scattered among different drivers.
Alright. I'd like to get this wrapped up and accepted before the merge window closes so I can get on with the important bits (drivers, etc.). What would you like
here? A generic function like 'pinmux_set_config(reg, val, bit)' that lives in the board
files and gets called from the driver code with specifics of that board's/drivers pinmux
config? Or do you see the pinmux code living entirely in the board files, and being done
as part of board init? That's where it was before, BTW.
If there are examples that you approve of in any extant U-Boot code (omap, ti91, davinci, etc.), please point them out. I'd really like to finalize this patch series.
Quoted 6 lines
(1) http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/92887/focus=93233
--
Sincerely yours,
Mike.
Thanks,
Tom
Quoted 1 line
PATCH v5 2/4 serial: Add Tegra2 serial port support
Quoted 46 lines · Tom Warren
Mike,
Quoted 35 lines · Mike Rapoport
Quoted 2 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>---
[ snip ]
Quoted 18 lines
drivers/serial/serial_tegra2.c new file +18
-0+/* +* Routine: pin_mux_uart +* Description: setup the pin muxes/tristate values for a UART +*/ +static void pin_mux_uart (void ) +{ +pinmux_tri_ctlr *const pmt = (pinmux_tri_ctlr *)NV_PA_APB_MISC_BASE ; +u32 reg; + +#if CONFIG_TEGRA2_ENABLE_UARTA + reg =readl (&pmt->pmt_ctl_c); + reg &=0xFFF0FFFF ;/* IRRX_/IRTX_SEL [19:16] = 00 UARTA */ +writel (reg, &pmt->pmt_ctl_c); + + reg =readl (&pmt->pmt_tri_a); + reg &= ~Z_IRRX ;/* Z_IRRX = normal (0) */ + reg &= ~Z_IRTX ;/* Z_IRTX = normal (0) */ +writel (reg, &pmt->pmt_tri_a);drivers/serial/serial_tegra2.c line 133
Quoted 10 lines
drivers/serial/serial_tegra2.c new file +10
-0+#endif /* CONFIG_TEGRA2_ENABLE_UARTA */ +#if CONFIG_TEGRA2_ENABLE_UARTD + reg =readl (&pmt->pmt_ctl_b); + reg &=0xFFFFFFF3 ;/* GMC_SEL [3:2] = 00, UARTD */ +writel (reg, &pmt->pmt_ctl_b); + + reg =readl (&pmt->pmt_tri_a); + reg &= ~Z_GMC ;/* Z_GMC = normal (0) */ +writel (reg, &pmt->pmt_tri_a); +#endif /* CONFIG_TEGRA2_ENABLE_UARTD */ Quoted 8 lines
As I've already pointed out (1) this covers only one possibility of UART pin muxing options. I agree that it makes sense when this is a part of the board-specific code. However, forcing specific pins configuration in the generic driver seems problematic to me, even if most Tegra2 boards use the same configuration.
As a side note, I'd prefer to have all the pin multiplexing defined in one place in board file rather than scattered among different drivers.
Quoted 10 lines
Alright. I'd like to get this wrapped up and accepted before the merge window closes so I can get on with the important bits (drivers, etc.). What would you like
here? A generic function like 'pinmux_set_config(reg, val, bit)' that lives in the board
files and gets called from the driver code with specifics of that board's/drivers pinmux
config? Or do you see the pinmux code living entirely in the board files, and being done
as part of board init? That's where it was before, BTW.
I think that the pinmux code should live entirely in the board file and performed as part of board init. The drivers than can assume that the pins are configured properly.
Quoted 3 lines
If there are examples that you approve of in any extant U-Boot code (omap, ti91, davinci, etc.), please point them out. I'd really like to finalize this patch series.
I think OMAP is a good example. There's set_muxconf_regs function in each board file that is responsible for configuration of all the pins.
Quoted 10 lines
Quoted 6 lines
(1) http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/92887/focus=93233
--
Sincerely yours,
Mike.Thanks,
Tom
Quoted 1 line
Signature · 2 lines
Sincerely yours, Mike.
PATCH v5 2/4 serial: Add Tegra2 serial port support
Mike,
Quoted 58 lines · Mike Rapoport
Quoted 46 lines · Tom Warren
Mike,
Quoted 35 lines · Mike Rapoport
Quoted 2 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>---
[ snip ]
Quoted 18 lines
(quoted diff) +18
-0+/* + * Routine: pin_mux_uart + * Description: setup the pin muxes/tristate values for a UART + */ +static void pin_mux_uart(void) +{ + ? ? pinmux_tri_ctlr *const pmt = (pinmux_tri_ctlr *)NV_PA_APB_MISC_BASE; + ? ? u32 reg; + +#if CONFIG_TEGRA2_ENABLE_UARTA + ? ? ? ? ? ? reg = readl(&pmt->pmt_ctl_c); + ? ? ? ? ? ? reg &= 0xFFF0FFFF; ? ? ?/* IRRX_/IRTX_SEL [19:16] = 00 UARTA */ + ? ? ? ? ? ? writel(reg, &pmt->pmt_ctl_c); + + ? ? ? ? ? ? reg = readl(&pmt->pmt_tri_a); + ? ? ? ? ? ? reg &= ~Z_IRRX; ? ? ? ? /* Z_IRRX = normal (0) */ + ? ? ? ? ? ? reg &= ~Z_IRTX; ? ? ? ? /* Z_IRTX = normal (0) */ + ? ? ? ? ? ? writel(reg, &pmt->pmt_tri_a);Review
Quoted 10 lines
(quoted diff) +10
-0+#endif ? ? ? /* CONFIG_TEGRA2_ENABLE_UARTA */ +#if CONFIG_TEGRA2_ENABLE_UARTD + ? ? ? ? ? ? reg = readl(&pmt->pmt_ctl_b); + ? ? ? ? ? ? reg &= 0xFFFFFFF3; ? ? ?/* GMC_SEL [3:2] = 00, UARTD */ + ? ? ? ? ? ? writel(reg, &pmt->pmt_ctl_b); + + ? ? ? ? ? ? reg = readl(&pmt->pmt_tri_a); + ? ? ? ? ? ? reg &= ~Z_GMC; ? ? ? ? ?/* Z_GMC = normal (0) */ + ? ? ? ? ? ? writel(reg, &pmt->pmt_tri_a); +#endif ? ? ? /* CONFIG_TEGRA2_ENABLE_UARTD */Quoted 8 lines
As I've already pointed out (1) this covers only one possibility of UART pin muxing options. I agree that it makes sense when this is a part of the board-specific code. However, forcing specific pins configuration in the generic driver seems problematic to me, even if most Tegra2 boards use the same configuration.
As a side note, I'd prefer to have all the pin multiplexing defined in one place in board file rather than scattered among different drivers.Quoted 10 lines
Alright. I'd like to get this wrapped up and accepted before the merge window closes so I can get on with the important bits (drivers, etc.). What would you like
here? A generic function like 'pinmux_set_config(reg, val, bit)' that lives in the board
files and gets called from the driver code with specifics of that board's/drivers pinmux
config? Or do you see the pinmux code living entirely in the board files, and being done
as part of board init? That's where it was before, BTW.
Quoted 3 lines
I think that the pinmux code should live entirely in the board file and performed as part of board init. The drivers than can assume that the pins are configured properly.
OK. I'll move the clock/pinmux init code into armv7/tegra/board.c (since it's SoC-centric),
and call it during board_init().
Quoted 7 lines
Quoted 4 lines
If there are examples that you approve of in any extant U-Boot code (omap, ti91, davinci, etc.), please point them out. ?I'd really like to finalize this patch series.
I think OMAP is a good example. There's
set_muxconf_regsfunction in each board file that is responsible for configuration of all the pins.
I'll take a look. Thanks.
Quoted 17 lines
Quoted 11 lines
Quoted 7 lines
(1) http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/92887/focus=93233
--
Sincerely yours,
Mike.Thanks,
Tom
Quoted 1 line
--
Sincerely yours,
Mike.
PATCH v5 2/4 serial: Add Tegra2 serial port support
Mike et al,
Quoted 61 lines · Tom Warren
Mike,
Quoted 58 lines · Mike Rapoport
Quoted 56 lines · Tom Warren
Mike,
Quoted 35 lines · Mike Rapoport
Quoted 2 lines · Tom Warren
Signed-off-by Tom Warren <[email protected]>---
[ snip ]
Quoted 18 lines
(quoted diff) +18
-0+/* + * Routine: pin_mux_uart + * Description: setup the pin muxes/tristate values for a UART + */ +static void pin_mux_uart(void) +{ + ? ? pinmux_tri_ctlr *const pmt = (pinmux_tri_ctlr *)NV_PA_APB_MISC_BASE; + ? ? u32 reg; + +#if CONFIG_TEGRA2_ENABLE_UARTA + ? ? ? ? ? ? reg = readl(&pmt->pmt_ctl_c); + ? ? ? ? ? ? reg &= 0xFFF0FFFF; ? ? ?/* IRRX_/IRTX_SEL [19:16] = 00 UARTA */ + ? ? ? ? ? ? writel(reg, &pmt->pmt_ctl_c); + + ? ? ? ? ? ? reg = readl(&pmt->pmt_tri_a); + ? ? ? ? ? ? reg &= ~Z_IRRX; ? ? ? ? /* Z_IRRX = normal (0) */ + ? ? ? ? ? ? reg &= ~Z_IRTX; ? ? ? ? /* Z_IRTX = normal (0) */ + ? ? ? ? ? ? writel(reg, &pmt->pmt_tri_a);Review
Quoted 10 lines
(quoted diff) +10
-0+#endif ? ? ? /* CONFIG_TEGRA2_ENABLE_UARTA */ +#if CONFIG_TEGRA2_ENABLE_UARTD + ? ? ? ? ? ? reg = readl(&pmt->pmt_ctl_b); + ? ? ? ? ? ? reg &= 0xFFFFFFF3; ? ? ?/* GMC_SEL [3:2] = 00, UARTD */ + ? ? ? ? ? ? writel(reg, &pmt->pmt_ctl_b); + + ? ? ? ? ? ? reg = readl(&pmt->pmt_tri_a); + ? ? ? ? ? ? reg &= ~Z_GMC; ? ? ? ? ?/* Z_GMC = normal (0) */ + ? ? ? ? ? ? writel(reg, &pmt->pmt_tri_a); +#endif ? ? ? /* CONFIG_TEGRA2_ENABLE_UARTD */Quoted 8 lines
As I've already pointed out (1) this covers only one possibility of UART pin muxing options. I agree that it makes sense when this is a part of the board-specific code. However, forcing specific pins configuration in the generic driver seems problematic to me, even if most Tegra2 boards use the same configuration.
As a side note, I'd prefer to have all the pin multiplexing defined in one place in board file rather than scattered among different drivers.Alright. I'd like to get this wrapped up and accepted before the merge window closes so I can get on with the important bits (drivers, etc.). What would you like
here? A generic function like 'pinmux_set_config(reg, val, bit)' that lives in the board
files and gets called from the driver code with specifics of that board's/drivers pinmux
config? Or do you see the pinmux code living entirely in the board files, and being done
as part of board init? That's where it was before, BTW.
Quoted 6 lines
Quoted 3 lines
I think that the pinmux code should live entirely in the board file and performed as part of board init. The drivers than can assume that the pins are configured properly.
OK. I'll move the clock/pinmux init code into
armv7/tegra/board.c(since it's SoC-centric),
and call it duringboard_init().
Actually, I think it makes more sense to move pinmux_init_uart and clock_init_uart to board/nvidia/common/board.c.
These routines are more board-specific than SoC-specific - they depend on how the UART is routed on a board.
Let me do that & gen up a new patchset.
Quoted 27 lines
Quoted 8 lines
Quoted 5 lines
If there are examples that you approve of in any extant U-Boot code (omap, ti91, davinci, etc.), please point them out. ?I'd really like to finalize this patch series.
I think OMAP is a good example. There's
set_muxconf_regsfunction in each board file that is responsible for configuration of all the pins.I'll take a look. Thanks.
Quoted 17 lines
Quoted 11 lines
Quoted 7 lines
(1) http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/92887/focus=93233
--
Sincerely yours,
Mike.Thanks,
Tom
Quoted 1 line
--
Sincerely yours,
Mike.
PATCH v5 2/4 serial: Add Tegra2 serial port support
Quoted 53 lines
Quoted 53 lines
Quoted 53 lines
Quoted 39 lines
Quoted 31 lines
[ snip ]
Quoted 18 lines
drivers/serial/serial_tegra2.c new file +18
-0+/* +* Routine: pin_mux_uart +* Description: setup the pin muxes/tristate values for a UART +*/ +static void pin_mux_uart (void ) +{ +pinmux_tri_ctlr *const pmt = (pinmux_tri_ctlr *)NV_PA_APB_MISC_BASE ; +u32 reg; + +#if CONFIG_TEGRA2_ENABLE_UARTA + reg =readl (&pmt->pmt_ctl_c); + reg &=0xFFF0FFFF ;/* IRRX_/IRTX_SEL [19:16] = 00 UARTA */ +writel (reg, &pmt->pmt_ctl_c); + + reg =readl (&pmt->pmt_tri_a); + reg &= ~Z_IRRX ;/* Z_IRRX = normal (0) */ + reg &= ~Z_IRTX ;/* Z_IRTX = normal (0) */ +writel (reg, &pmt->pmt_tri_a);drivers/serial/serial_tegra2.c line 133
Quoted 10 lines
drivers/serial/serial_tegra2.c new file +10
-0+#endif /* CONFIG_TEGRA2_ENABLE_UARTA */ +#if CONFIG_TEGRA2_ENABLE_UARTD + reg =readl (&pmt->pmt_ctl_b); + reg &=0xFFFFFFF3 ;/* GMC_SEL [3:2] = 00, UARTD */ +writel (reg, &pmt->pmt_ctl_b); + + reg =readl (&pmt->pmt_tri_a); + reg &= ~Z_GMC ;/* Z_GMC = normal (0) */ +writel (reg, &pmt->pmt_tri_a); +#endif /* CONFIG_TEGRA2_ENABLE_UARTD */ Quoted 8 lines
As I've already pointed out (1) this covers only one possibility of UART pin muxing options. I agree that it makes sense when this is a part of the board-specific code. However, forcing specific pins configuration in the generic driver seems problematic to me, even if most Tegra2 boards use the same configuration.
As a side note, I'd prefer to have all the pin multiplexing defined in one place in board file rather than scattered among different drivers.Quoted 10 lines
Alright. I'd like to get this wrapped up and accepted before the merge window closes so I can get on with the important bits (drivers, etc.). What would you like
here? A generic function like 'pinmux_set_config(reg, val, bit)' that lives in the board
files and gets called from the driver code with specifics of that board's/drivers pinmux
config? Or do you see the pinmux code living entirely in the board files, and being done
as part of board init? That's where it was before, BTW.I think that the pinmux code should live entirely in the board file and performed as part of board init. The drivers than can assume that the pins are configured properly.
Quoted 8 lines
Quoted 3 lines
OK. I'll move the clock/pinmux init code into
armv7/tegra/board.c(since it's SoC-centric),
and call it duringboard_init().Actually, I think it makes more sense to move
pinmux_init_uartandclock_init_uarttoboard/nvidia/common/board.c.
These routines are more board-specific than SoC-specific - they depend on how the UART is routed on a board.
Let me do that & gen up a new patchset.
You previously mentioned that "To date, all of our Tegra boards use these pinmux options for both UARTs. If a board vendor chooses to use different pinmuxes, then they can override these funcs in their board files, or use their own code triggered by their own defines. But according to our HW guys, the vast majority will use these pins"
If the vast majority of boards really will use the same pinmuxing, it would be nice to provide that common muxing as a default which can be overridden. Perhaps moving pinmux_init_uart() and uart_clock_init() into armv7/tegra/*, and making them weak functions would make everyone happy.
Or could you make default defines that board's could override as needed? eg in pin_mux_uart():
#ifndef CONFIG_TEGRA2_PMT_CTLC_MASK
#define CONFIG_TEGRA2_PMC_CTLC_MASK 0xfff0ffff
#endif
#ifndef CONFIG_TEGRA2_PMT_TRI_A_MASK
#define CONFIG_TEGRA2_PMC_TRI_A_MASK ~(Z_IRRX | Z_IRTX) #endif
pin_mux_uart() {
reg = readl(&pmt->pmt_ctl_c);
reg &= CONFIG_TEGRA2_PMT_CTLC_MASK;
writel(reg, &pmt->pmt_ctl_c);
reg = readl(&pmt->pmt_tri_a);
reg &= CONFIG_TEGRA2_PMC_TRI_A_MASK;
writel(reg, &pmt->pmt_tri_a);
}Or make the functions table driven so each board would define a pinmux/clock configuration table?
I think its worthwhile to try and reduce duplicated code whenever possible.
Best,
Peter
PATCH v5 2/4 serial: Add Tegra2 serial port support
Quoted 37 lines · Peter Tyser
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 8 lines
Quoted 8 lines
As I've already pointed out (1) this covers only one possibility of UART pin muxing options. I agree that it makes sense when this is a part of the board-specific code. However, forcing specific pins configuration in the generic driver seems problematic to me, even if most Tegra2 boards use the same configuration.
As a side note, I'd prefer to have all the pin multiplexing defined in one place in board file rather than scattered among different drivers.Quoted 10 lines
Alright. I'd like to get this wrapped up and accepted before the merge window closes so I can get on with the important bits (drivers, etc.). What would you like
here? A generic function like 'pinmux_set_config(reg, val, bit)' that lives in the board
files and gets called from the driver code with specifics of that board's/drivers pinmux
config? Or do you see the pinmux code living entirely in the board files, and being done
as part of board init? That's where it was before, BTW.I think that the pinmux code should live entirely in the board file and performed as part of board init. The drivers than can assume that the pins are configured properly.
Quoted 8 lines
Quoted 3 lines
OK. I'll move the clock/pinmux init code into
armv7/tegra/board.c(since it's SoC-centric),
and call it duringboard_init().Actually, I think it makes more sense to move
pinmux_init_uartandclock_init_uarttoboard/nvidia/common/board.c.
These routines are more board-specific than SoC-specific - they depend on how the UART is routed on a board.
Let me do that & gen up a new patchset.You previously mentioned that "To date, all of our Tegra boards use these pinmux options for both UARTs. If a board vendor chooses to use different pinmuxes, then they can override these funcs in their board files, or use their own code triggered by their own defines. But according to our HW guys, the vast majority will use these pins"
Quoted 5 lines
If the vast majority of boards really will use the same pinmuxing, it would be nice to provide that common muxing as a default which can be overridden. Perhaps moving
pinmux_init_uart()anduart_clock_init()into armv7/tegra/*, and making them weak functions would make everyone happy.
My point was that pin muxing belongs to the board code rather than to the driver. Driver should just assume that pins are configured elsewhere and it does not need to deal with pin muxing at all.
Moreover, I'd prefer to see pinmux_board_init or something similar that configures all the pins at once rather than collection of pinmux_init_uart, pinmux_init_sdmmc, pinmux_init_gmi etc that will grow as more drivers are added.
Quoted 27 lines
Or could you make default defines that board's could override as needed? eg in
pin_mux_uart():
#ifndefCONFIG_TEGRA2_PMT_CTLC_MASK
#defineCONFIG_TEGRA2_PMC_CTLC_MASK0xfff0ffff
#endif
#ifndefCONFIG_TEGRA2_PMT_TRI_A_MASK
#defineCONFIG_TEGRA2_PMC_TRI_A_MASK~(Z_IRRX |Z_IRTX) #endifpin_mux_uart() { reg = readl(&pmt->pmt_ctl_c); reg &= CONFIG_TEGRA2_PMT_CTLC_MASK; writel(reg, &pmt->pmt_ctl_c); reg = readl(&pmt->pmt_tri_a); reg &= CONFIG_TEGRA2_PMC_TRI_A_MASK; writel(reg, &pmt->pmt_tri_a); }Or make the functions table driven so each board would define a pinmux/clock configuration table?
I think its worthwhile to try and reduce duplicated code whenever possible.
Best,
Peter
Signature · 2 lines
Sincerely yours, Mike.
PATCH v5 2/4 serial: Add Tegra2 serial port support
Quoted 44 lines · Mike Rapoport
Quoted 37 lines · Peter Tyser
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 8 lines
Quoted 8 lines
As I've already pointed out (1) this covers only one possibility of UART pin muxing options. I agree that it makes sense when this is a part of the board-specific code. However, forcing specific pins configuration in the generic driver seems problematic to me, even if most Tegra2 boards use the same configuration.
As a side note, I'd prefer to have all the pin multiplexing defined in one place in board file rather than scattered among different drivers.Quoted 10 lines
Alright. I'd like to get this wrapped up and accepted before the merge window closes so I can get on with the important bits (drivers, etc.). What would you like
here? A generic function like 'pinmux_set_config(reg, val, bit)' that lives in the board
files and gets called from the driver code with specifics of that board's/drivers pinmux
config? Or do you see the pinmux code living entirely in the board files, and being done
as part of board init? That's where it was before, BTW.I think that the pinmux code should live entirely in the board file and performed as part of board init. The drivers than can assume that the pins are configured properly.
Quoted 8 lines
Quoted 3 lines
OK. I'll move the clock/pinmux init code into
armv7/tegra/board.c(since it's SoC-centric),
and call it duringboard_init().Actually, I think it makes more sense to move
pinmux_init_uartandclock_init_uarttoboard/nvidia/common/board.c.
These routines are more board-specific than SoC-specific - they depend on how the UART is routed on a board.
Let me do that & gen up a new patchset.You previously mentioned that "To date, all of our Tegra boards use these pinmux options for both UARTs. If a board vendor chooses to use different pinmuxes, then they can override these funcs in their board files, or use their own code triggered by their own defines. But according to our HW guys, the vast majority will use these pins"
Quoted 5 lines
If the vast majority of boards really will use the same pinmuxing, it would be nice to provide that common muxing as a default which can be overridden. Perhaps moving
pinmux_init_uart()anduart_clock_init()into armv7/tegra/*, and making them weak functions would make everyone happy.
Quoted 3 lines
My point was that pin muxing belongs to the board code rather than to the driver. Driver should just assume that pins are configured elsewhere and it does not need to deal with pin muxing at all.
I understand your point, but think if 9/10 boards use the same pin muxing its good to provide a default so we don't have 9 chunks of duplicate code floating around in board/*. What's the harm in providing a default? It can be overridden if needed.
Quoted 3 lines
Moreover, I'd prefer to see
pinmux_board_initor something similar that configures all the pins at once rather than collection ofpinmux_init_uart,pinmux_init_sdmmc,pinmux_init_gmietc that will grow as more drivers are added.
I can see that point but its a different discussion. I don't know enough about the Tegra2 to comment on this, but it seems like a good idea based on previous experiences with boards with similar pinmuxing (eg mpc8260). In my last email I mentioned a table-driven approach (similar to the mpc8260 implementation?) which sounds somewhat like you're proposing.
Best,
Peter
PATCH v5 2/4 serial: Add Tegra2 serial port support
Quoted 7 lines · Peter Tyser
Quoted 5 lines · Mike Rapoport
On 01/26/11 00:24, Peter Tyser wrote:
Moreover, I'd prefer to see
pinmux_board_initor something similar that configures all the pins at once rather than collection ofpinmux_init_uart,pinmux_init_sdmmc,pinmux_init_gmietc that will grow as more drivers are added.
Quoted 6 lines
I can see that point but its a different discussion. I don't know enough about the Tegra2 to comment on this, but it seems like a good idea based on previous experiences with boards with similar pinmuxing (eg mpc8260). In my last email I mentioned a table-driven approach (similar to the mpc8260 implementation?) which sounds somewhat like you're proposing.
Yes, I was thinking about table-driven approach, though slightly more complicated than in mpc8260 :)
I think we can mostly reuse the Linux implementation of Tegra2 pinmux (1 and 2):
However, the pinmuxing API can be added after the basic Tegra2 support is merged, IMO.
(1)
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=arch/arm/mach-tegra/pinmux.c;h=f80d507671bc1b22921ab2821c8a2cde427f1b5f;hb=HEAD
(2)
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=arch/arm/mach-tegra/pinmux-t2-tables.c;h=a6ea34e782dc339091b49e54871f953048651ad3;hb=HEAD
Quoted 3 lines
Best,
Peter
Signature · 2 lines
Sincerely yours, Mike.
PATCH v5 2/4 serial: Add Tegra2 serial port support
In reply to Mike RapoportMike,
Quoted 44 lines · Mike Rapoport
Quoted 37 lines · Peter Tyser
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 8 lines
Quoted 8 lines
As I've already pointed out (1) this covers only one possibility of UART pin muxing options. I agree that it makes sense when this is a part of the board-specific code. However, forcing specific pins configuration in the generic driver seems problematic to me, even if most Tegra2 boards use the same configuration.
As a side note, I'd prefer to have all the pin multiplexing defined in one place in board file rather than scattered among different drivers.Quoted 10 lines
Alright. I'd like to get this wrapped up and accepted before the merge window closes so I can get on with the important bits (drivers, etc.). What would you like
here? A generic function like 'pinmux_set_config(reg, val, bit)' that lives in the board
files and gets called from the driver code with specifics of that board's/drivers pinmux
config? Or do you see the pinmux code living entirely in the board files, and being done
as part of board init? That's where it was before, BTW.I think that the pinmux code should live entirely in the board file and performed as part of board init. The drivers than can assume that the pins are configured properly.
Quoted 8 lines
Quoted 3 lines
OK. I'll move the clock/pinmux init code into
armv7/tegra/board.c(since it's SoC-centric),
and call it duringboard_init().Actually, I think it makes more sense to move
pinmux_init_uartandclock_init_uarttoboard/nvidia/common/board.c.
These routines are more board-specific than SoC-specific - they depend on how the UART is routed on a board.
Let me do that & gen up a new patchset.You previously mentioned that "To date, all of our Tegra boards use these pinmux options for both UARTs. ?If a board vendor chooses to use different pinmuxes, then they can override these funcs in their board files, or use their own code triggered by their own defines. But according to our HW guys, the vast majority will use these pins"
Quoted 5 lines
If the vast majority of boards really will use the same pinmuxing, it would be nice to provide that common muxing as a default which can be overridden. ?Perhaps moving
pinmux_init_uart()anduart_clock_init()into armv7/tegra/*, and making them weak functions would make everyone happy.
Quoted 3 lines
My point was that pin muxing belongs to the board code rather than to the driver. Driver should just assume that pins are configured elsewhere and it does not need to deal with pin muxing at all.
I understand that point - sorry if I wasn't clear. No objection to having pinmux code in board files.
Quoted 4 lines
Moreover, I'd prefer to see
pinmux_board_initor something similar that configures all the pins at once rather than collection ofpinmux_init_uart,pinmux_init_sdmmc,pinmux_init_gmietc that will grow as more drivers are added.
I see a couple of reasons not to do it that way. First, I don't know at this time what all the pinmux settings will be, since I haven't ported all the periph driver code yet. It's vastly different from what's acceptable in U-Boot, and will all need significant rewrite. It'd take me a week to gather all that info, and I'm not at full BW on this project (one of 4 on my plate right now).
Second, I've been chastised before for including code/features in this initial patchset that aren't needed or used. I'm trying to keep the code as simple as possible to make it easier on reviewers and get through the review in as short a time as possible. This has already dragged on far longer than I thought it would.
I'm willing to change the pinmux code to make it as generic as possible, but only if there's a consensus on the list that it has to be that way to get accepted & pushed.
Quoted 24 lines
Quoted 24 lines
Or could you make default defines that board's could override as needed? eg in
pin_mux_uart():
#ifndefCONFIG_TEGRA2_PMT_CTLC_MASK
#defineCONFIG_TEGRA2_PMC_CTLC_MASK0xfff0ffff
#endif
#ifndefCONFIG_TEGRA2_PMT_TRI_A_MASK
#defineCONFIG_TEGRA2_PMC_TRI_A_MASK~(Z_IRRX |Z_IRTX) #endifpin_mux_uart(){
? ? ? reg =readl(&pmt->pmt_ctl_c);
? ? ? reg &=CONFIG_TEGRA2_PMT_CTLC_MASK;
? ? ?writel(reg, &pmt->pmt_ctl_c);? ? ? reg =
readl(&pmt->pmt_tri_a);
? ? ? reg &=CONFIG_TEGRA2_PMC_TRI_A_MASK;
? ? ?writel(reg, &pmt->pmt_tri_a);
}Or make the functions table driven so each board would define a pinmux/clock configuration table?
I think its worthwhile to try and reduce duplicated code whenever possible.
Quoted 8 lines
Quoted 3 lines
Best,
Peter--
Sincerely yours,
Mike.
Thanks,
Tom
PATCH v5 2/4 serial: Add Tegra2 serial port support
Tom,
Quoted 13 lines · Tom Warren
Mike,
Quoted 3 lines · Mike Rapoport
My point was that pin muxing belongs to the board code rather than to the driver. Driver should just assume that pins are configured elsewhere and it does not need to deal with pin muxing at all.
I understand that point - sorry if I wasn't clear. No objection to having pinmux code in board files.
Quoted 4 lines
Moreover, I'd prefer to see
pinmux_board_initor something similar that configures all the pins at once rather than collection ofpinmux_init_uart,pinmux_init_sdmmc,pinmux_init_gmietc that will grow as more drivers are added.
Quoted 14 lines
I see a couple of reasons not to do it that way. First, I don't know at this time what all the pinmux settings will be, since I haven't ported all the periph driver code yet. It's vastly different from what's acceptable in U-Boot, and will all need significant rewrite. It'd take me a week to gather all that info, and I'm not at full BW on this project (one of 4 on my plate right now).
Second, I've been chastised before for including code/features in this initial patchset that aren't needed or used. I'm trying to keep the code as simple as possible to make it easier on reviewers and get through the review in as short a time as possible. This has already dragged on far longer than I thought it would.
I'm willing to change the pinmux code to make it as generic as possible, but only if there's a consensus on the list that it has to be that way to get accepted & pushed.
I'm Ok with pinmux_init_uart in the board code for now. I think that the generic pinmux functionality can be added afterwards.
Quoted 3 lines
Quoted 1 line
Thanks,
Tom
Signature · 2 lines
Sincerely yours, Mike.
PATCH v5 2/4 serial: Add Tegra2 serial port support
Mike,
Quoted 31 lines · Mike Rapoport
Tom,
Quoted 13 lines · Tom Warren
Mike,
Quoted 3 lines · Mike Rapoport
My point was that pin muxing belongs to the board code rather than to the driver. Driver should just assume that pins are configured elsewhere and it does not need to deal with pin muxing at all.
I understand that point - sorry if I wasn't clear. No objection to having pinmux code in board files.
Quoted 4 lines
Moreover, I'd prefer to see
pinmux_board_initor something similar that configures all the pins at once rather than collection ofpinmux_init_uart,pinmux_init_sdmmc,pinmux_init_gmietc that will grow as more drivers are added.Quoted 14 lines
I see a couple of reasons not to do it that way. First, I don't know at this time what all the pinmux settings will be, since I haven't ported all the periph driver code yet. It's vastly different from what's acceptable in U-Boot, and will all need significant rewrite. It'd take me a week to gather all that info, and I'm not at full BW on this project (one of 4 on my plate right now).
Second, I've been chastised before for including code/features in this initial patchset that aren't needed or used. ?I'm trying to keep the code as simple as possible to make it easier on reviewers and get through the review in as short a time as possible. This has already dragged on far longer than I thought it would.
I'm willing to change the pinmux code to make it as generic as possible, but only if there's a consensus on the list that it has to be that way to get accepted & pushed.
Quoted 3 lines
I'm Ok with
pinmux_init_uartin the board code for now. I think that the generic pinmux functionality can be added afterwards.
Great. My main goal is to get the baseline Tegra2 support in upstream U-Boot. I'm happy to refine the pinmux approach in the next patchset. Either a generic pinmux as you propose, or a set of weak pinmux configs that can be overridden by another board design, etc. as Peter proposes.
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
Thanks,
Tom--
Sincerely yours,
Mike.
Thanks,
Tom
PATCH v5 3/4 arm: Tegra2: Add support for NVIDIA Harmony board
In reply to Tom Warren---
Changes for V2:
- Use board/nvidia/ instead of /board/tegra
- Change nv-common.h config file to tegra2-common.h
MAINTAINERS | 4 + board/nvidia/harmony/Makefile | 50 ++++++++++++ boards.cfg | 1 + include/configs/harmony.h | 48 ++++++++++++ include/configs/tegra2-common.h | 160 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 263 insertions(+), 0 deletions(-) create mode 100644 board/nvidia/harmony/Makefile create mode 100644 include/configs/harmony.h create mode 100644 include/configs/tegra2-common.h
MAINTAINERS +4 -0
@@ -841,6 +841,10 @@ Prafulla Wadaskar <[email protected]> rd6281a ARM926EJS (Kirkwood SoC) sheevaplug ARM926EJS (Kirkwood SoC) +Tom Warren <[email protected]> + + harmony Tegra2 (ARM7 & A9 Dual Core) + Matthias Weisser <[email protected]> jadecpu ARM926EJS (MB86R01 SoC)
board/nvidia/harmony/Makefile new file +50 -0
50 lines not on this page · raw message
boards.cfg +1 -0
@@ -122,6 +122,7 @@ omap4_panda arm armv7 panda ti omap4_sdp4430 arm armv7 sdp4430 ti omap4 s5p_goni arm armv7 goni samsung s5pc1xx smdkc100 arm armv7 smdkc100 samsung s5pc1xx +harmony arm armv7 harmony nvidia tegra2 actux1 arm ixp actux2 arm ixp actux3 arm ixp
include/configs/harmony.h new file +48 -0
48 lines not on this page · raw message
include/configs/tegra2-common.h new file +160 -0
160 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v5 4/4 arm: Tegra2: Add support for NVIDIA Seaboard board
In reply to Tom Warren---
Changes for V2:
- Remove mach-types.h change; wait for ARM kernel sync-up
- Use board/nvidia instead of board/tegra
MAINTAINERS | 1 + board/nvidia/seaboard/Makefile | 50 ++++++++++++++++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/seaboard.h | 44 +++++++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 0 deletions(-) create mode 100644 board/nvidia/seaboard/Makefile create mode 100644 include/configs/seaboard.h
MAINTAINERS +1 -0
@@ -844,6 +844,7 @@ Prafulla Wadaskar <[email protected]> Tom Warren <[email protected]> harmony Tegra2 (ARM7 & A9 Dual Core) + seaboard Tegra2 (ARM7 & A9 Dual Core) Matthias Weisser <[email protected]>
board/nvidia/seaboard/Makefile new file +50 -0
50 lines not on this page · raw message
boards.cfg +1 -0
@@ -123,6 +123,7 @@ omap4_sdp4430 arm armv7 sdp4430 ti s5p_goni arm armv7 goni samsung s5pc1xx smdkc100 arm armv7 smdkc100 samsung s5pc1xx harmony arm armv7 harmony nvidia tegra2 +seaboard arm armv7 seaboard nvidia tegra2 actux1 arm ixp actux2 arm ixp actux3 arm ixp
include/configs/seaboard.h new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
1.7.3.5