Subsystems (5)
From dc699f96a6f4305793f737c18ded63fea926b675 Mon Sep 17 00:00:00 2001
From: Lucas Stach <[email protected]>
Date: Tue, 2 Apr 2013 07:50:22 +0200
Subject: [PATCH v3 00/10] Rework current Tegra support
Round 3 of the Tegra rework. A bit beefier this time, as I folded in some real advancements. Most notable a working GPIO driver and the 1st stage loading support. Barebox is now aware of the CPU it's running on and boots the Tegra main CPU cluster if needed. Don't get too exited yet, you most likely won't see anything when running first stage, as the pinmux stays in reset state and there is no driver to switch it to the state needed for your board. 2nd stage loading should work as before from the same binary.
I've also converted Tegra to builtin DTB, as I would like to follow the kernel and go a DT only way. Let's see how this works out, but as U-Boot isn't far away from defining Tegra boards only through the DT I'm almost sure we can make it work in barebox.
A note for the review: I won't split patches just for the sake of it. I'm actively working on this code as long as it isn't pulled into the basebox repo and it's already hard enough to keep track of which hunks of code should go into the individual patches.
Antony: I've converted the serial and ramsize detection to the standard used in U-Boot and Linux. Please test if this works for your board. If not it's not really a barebox error, as your ODMdata is most likely wrong in this case, but please let me know anyway as I would like to avoid breaking existing boards.
Lucas Stach (10):
tegra: pull in iomap.h from the Linux kernel
tegra: define TEGRA20 arch type
tegra: switch to DT only
tegra: add driver for the clock and reset module
tegra: add T20 timer driver
tegra: add T20 power management controller driver
tegra: add common lowlevel startup
tegra: add generic debug UART support
tegra: add generic meminit
tegra: add GPIO controller driver
arch/arm/Kconfig | 10 +- arch/arm/boards/toshiba-ac100/Makefile | 2 - arch/arm/boards/toshiba-ac100/board.c | 8 - arch/arm/boards/toshiba-ac100/lowlevel.c | 10 -- arch/arm/boards/toshiba-ac100/serial.c | 39 ----- arch/arm/configs/toshiba_ac100_defconfig | 9 +- arch/arm/dts/tegra20-paz00.dts | 12 ++ arch/arm/dts/tegra20.dtsi | 41 +++++ arch/arm/mach-tegra/Kconfig | 20 ++- arch/arm/mach-tegra/Makefile | 8 +- arch/arm/mach-tegra/clock.c | 56 ------ arch/arm/mach-tegra/include/mach/clkdev.h | 7 + arch/arm/mach-tegra/include/mach/gpio.h | 1 + arch/arm/mach-tegra/include/mach/iomap.h | 65 +++---- arch/arm/mach-tegra/include/mach/lowlevel.h | 147 ++++++++++++++++ arch/arm/mach-tegra/include/mach/tegra20-car.h | 179 +++++++++++++++++++ arch/arm/mach-tegra/include/mach/tegra20-pmc.h | 67 ++++++++ arch/arm/mach-tegra/reset.c | 39 ----- arch/arm/mach-tegra/tegra20-car.c | 121 +++++++++++++ arch/arm/mach-tegra/tegra20-pmc.c | 68 ++++++++ arch/arm/mach-tegra/tegra20-timer.c | 120 +++++++++++++ arch/arm/mach-tegra/tegra20.c | 50 ++++++ arch/arm/mach-tegra/tegra_avp_init.c | 228 +++++++++++++++++++++++++ arch/arm/mach-tegra/tegra_maincomplex_init.c | 46 +++++ drivers/gpio/Kconfig | 7 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-tegra.c | 226 ++++++++++++++++++++++++ 27 files changed, 1380 insertions(+), 207 deletions(-) delete mode 100644 arch/arm/boards/toshiba-ac100/lowlevel.c delete mode 100644 arch/arm/boards/toshiba-ac100/serial.c create mode 100644 arch/arm/dts/tegra20-paz00.dts create mode 100644 arch/arm/dts/tegra20.dtsi delete mode 100644 arch/arm/mach-tegra/clock.c create mode 100644 arch/arm/mach-tegra/include/mach/clkdev.h create mode 100644 arch/arm/mach-tegra/include/mach/gpio.h create mode 100644 arch/arm/mach-tegra/include/mach/lowlevel.h create mode 100644 arch/arm/mach-tegra/include/mach/tegra20-car.h create mode 100644 arch/arm/mach-tegra/include/mach/tegra20-pmc.h delete mode 100644 arch/arm/mach-tegra/reset.c create mode 100644 arch/arm/mach-tegra/tegra20-car.c create mode 100644 arch/arm/mach-tegra/tegra20-pmc.c create mode 100644 arch/arm/mach-tegra/tegra20-timer.c create mode 100644 arch/arm/mach-tegra/tegra20.c create mode 100644 arch/arm/mach-tegra/tegra_avp_init.c create mode 100644 arch/arm/mach-tegra/tegra_maincomplex_init.c create mode 100644 drivers/gpio/gpio-tegra.c
Signature · 7 lines
1.8.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 1/10 tegra: pull in iomap.h from the Linux kernel
This synchronizes the Tegra iomap.h with the latest Linux kernel code.
--- arch/arm/mach-tegra/include/mach/iomap.h | 64 ++++++++++---------------------- 1 file changed, 19 insertions(+), 45 deletions(-)
arch/arm/mach-tegra/include/mach/iomap.h +19 -45
@@ -62,47 +62,35 @@#define TEGRA_RES_SEMA_BASE 0x60001000#define TEGRA_RES_SEMA_SIZE SZ_4K -#define TEGRA_HDMI_BASE 0x54280000 -#define TEGRA_HDMI_SIZE SZ_256K - -#define TEGRA_GART_BASE 0x58000000 -#define TEGRA_GART_SIZE SZ_32M - -#define TEGRA_RES_SEMA_BASE 0x60001000 -#define TEGRA_RES_SEMA_SIZE SZ_4K - -#define TEGRA_ARB_SEMA_BASE 0x60002000 -#define TEGRA_ARB_SEMA_SIZE SZ_4K -#define TEGRA_PRIMARY_ICTLR_BASE 0x60004000 -#define TEGRA_PRIMARY_ICTLR_SIZE 64 - -#define TEGRA_ARBGNT_ICTLR_BASE 0x60004040 -#define TEGRA_ARBGNT_ICTLR_SIZE 192 +#define TEGRA_PRIMARY_ICTLR_SIZE SZ_64#define TEGRA_SECONDARY_ICTLR_BASE 0x60004100 -#define TEGRA_SECONDARY_ICTLR_SIZE 64 +#define TEGRA_SECONDARY_ICTLR_SIZE SZ_64#define TEGRA_TERTIARY_ICTLR_BASE 0x60004200 -#define TEGRA_TERTIARY_ICTLR_SIZE 64 +#define TEGRA_TERTIARY_ICTLR_SIZE SZ_64#define TEGRA_QUATERNARY_ICTLR_BASE 0x60004300 -#define TEGRA_QUATERNARY_ICTLR_SIZE 64 +#define TEGRA_QUATERNARY_ICTLR_SIZE SZ_64 + +#define TEGRA_QUINARY_ICTLR_BASE 0x60004400 +#define TEGRA_QUINARY_ICTLR_SIZE SZ_64#define TEGRA_TMR1_BASE 0x60005000 -#define TEGRA_TMR1_SIZE 8 +#define TEGRA_TMR1_SIZE SZ_8#define TEGRA_TMR2_BASE 0x60005008 -#define TEGRA_TMR2_SIZE 8 +#define TEGRA_TMR2_SIZE SZ_8#define TEGRA_TMRUS_BASE 0x60005010 -#define TEGRA_TMRUS_SIZE 64 +#define TEGRA_TMRUS_SIZE SZ_64#define TEGRA_TMR3_BASE 0x60005050 -#define TEGRA_TMR3_SIZE 8 +#define TEGRA_TMR3_SIZE SZ_8#define TEGRA_TMR4_BASE 0x60005058 -#define TEGRA_TMR4_SIZE 8 +#define TEGRA_TMR4_SIZE SZ_8#define TEGRA_CLK_RESET_BASE 0x60006000#define TEGRA_CLK_RESET_SIZE SZ_4K
@@ -125,17 +113,17 @@#define TEGRA_AHB_GIZMO_BASE 0x6000C004#define TEGRA_AHB_GIZMO_SIZE 0x10C +#define TEGRA_SB_BASE 0x6000C200 +#define TEGRA_SB_SIZE 256 +#define TEGRA_STATMON_BASE 0x6000C400#define TEGRA_STATMON_SIZE SZ_1K#define TEGRA_GPIO_BASE 0x6000D000#define TEGRA_GPIO_SIZE SZ_4K -#define TEGRA_EXCEPTION_VECTORS_BASE 0x6000F000 -#define TEGRA_EXCEPTION_VECTORS_SIZE SZ_4K - -#define TEGRA_VDE_BASE 0x6001A000 -#define TEGRA_VDE_SIZE (SZ_8K + SZ_4K - SZ_256) +#define TEGRA_EXCEPTION_VECTORS_BASE 0x6000F000 +#define TEGRA_EXCEPTION_VECTORS_SIZE SZ_4K#define TEGRA_APB_MISC_BASE 0x70000000#define TEGRA_APB_MISC_SIZE SZ_4K
@@ -156,10 +144,10 @@#define TEGRA_I2S2_SIZE SZ_256#define TEGRA_UARTA_BASE 0x70006000 -#define TEGRA_UARTA_SIZE 64 +#define TEGRA_UARTA_SIZE SZ_64#define TEGRA_UARTB_BASE 0x70006040 -#define TEGRA_UARTB_SIZE 64 +#define TEGRA_UARTB_SIZE SZ_64#define TEGRA_UARTC_BASE 0x70006200#define TEGRA_UARTC_SIZE SZ_256
@@ -275,18 +263,4 @@#define TEGRA_SDMMC4_BASE 0xC8000600#define TEGRA_SDMMC4_SIZE SZ_512 -#if defined(CONFIG_TEGRA_DEBUG_UART_NONE ) -# define TEGRA_DEBUG_UART_BASE 0 -#elif defined(CONFIG_TEGRA_DEBUG_UARTA ) -# define TEGRA_DEBUG_UART_BASE TEGRA_UARTA_BASE -#elif defined(CONFIG_TEGRA_DEBUG_UARTB ) -# define TEGRA_DEBUG_UART_BASE TEGRA_UARTB_BASE -#elif defined(CONFIG_TEGRA_DEBUG_UARTC ) -# define TEGRA_DEBUG_UART_BASE TEGRA_UARTC_BASE -#elif defined(CONFIG_TEGRA_DEBUG_UARTD ) -# define TEGRA_DEBUG_UART_BASE TEGRA_UARTD_BASE -#elif defined(CONFIG_TEGRA_DEBUG_UARTE ) -# define TEGRA_DEBUG_UART_BASE TEGRA_UARTE_BASE -#endif -#endif
Signature · 7 lines
1.8.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 2/10 tegra: define TEGRA20 arch type
In reply to Lucas StachTegra is not a single arch type, but a collection of different generations. Define TEGAR20 arch type to differentiate between the generations. Switch to ARMv7 cpu type for all Tegras.
--- arch/arm/Kconfig | 4 ++-- arch/arm/mach-tegra/Kconfig | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-)
arch/arm/Kconfig +2 -2
@@ -136,8 +136,8 @@ config ARCH_VEXPRESS select COMMON_CLK config ARCH_TEGRA - bool "Nvidia Tegra-based boards" - select CPU_ARM926T + bool "Nvidia Tegra" + select CPU_V7 select HAS_DEBUG_LL config ARCH_ZYNQ
arch/arm/mach-tegra/Kconfig +18 -2
@@ -1,11 +1,23 @@ if ARCH_TEGRA + +choice + prompt "Tegra processor type" + +config MACH_TEGRA20 + bool "Tegra 20" + +endchoice + +# --------------------------------------------------------- + +if MACH_TEGRA20 config ARCH_TEXT_BASE hex - default 0x31fc0000 + default 0x00108000 choice - prompt "Tegra Board Type" + prompt "Tegra 20 Board Type" config MACH_TOSHIBA_AC100 bool "Toshiba AC100"
@@ -16,4 +28,8 @@ endchoice source arch/arm/boards/toshiba-ac100/Kconfig +endif #MACH_TEGRA20 + +# --------------------------------------------------------- + endif
Signature · 7 lines
1.8.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 02/10] tegra: define TEGRA20 arch type
Quoted 4 lines · Lucas Stach
Tegra is not a single arch type, but a collection of different generations. Define TEGAR20 arch type to differentiate between the generations. Switch to ARMv7 cpu type for all Tegras.
Actually you introduce at least four __INDEPENDENT___ changes in this patch:
1. CPU_ARM926T -> CPU_V7
2. bool "Nvidia Tegra-based boards" -> bool "Nvidia Tegra" (change comment, unifyx with linux kernel --- very good;
3. Define TEGAR20;
4. change default ARCH_TEXT_BASE.
Can you split this commit, please?
Also I propose to use ARCH_TEGRA_2x_SOC (like in Linux kernel) instead of MACH_TEGRA20.
Quoted 64 lines
Signed-off-by Lucas Stach <[email protected]>--- arch/arm/Kconfig | 4 ++-- arch/arm/mach-tegra/Kconfig | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-)arch/arm/Kconfig +2
-2@@ -136,8 +136,8 @@ config ARCH_VEXPRESS select COMMON_CLK config ARCH_TEGRA - bool "Nvidia Tegra-based boards" - select CPU_ARM926T + bool "Nvidia Tegra" + select CPU_V7 select HAS_DEBUG_LL config ARCH_ZYNQarch/arm/mach-tegra/Kconfig +18
-3@@ -1,11 +1,23 @@ if ARCH_TEGRA + +choice + prompt "Tegra processor type" + +config MACH_TEGRA20 + bool "Tegra 20" + +endchoice + +# --------------------------------------------------------- + +if MACH_TEGRA20 config ARCH_TEXT_BASE hex - default 0x31fc0000 + default 0x00108000 choice - prompt "Tegra Board Type" + prompt "Tegra 20 Board Type" config MACH_TOSHIBA_AC100 bool "Toshiba AC100"@@ -16,4 +28,8 @@ endchoice source arch/arm/boards/toshiba-ac100/Kconfig +endif #MACH_TEGRA20 + +# --------------------------------------------------------- + endif --1.8.1.4
Signature · 7 lines
Best regards, Antony Pavlov _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 02/10] tegra: define TEGRA20 arch type
In reply to Lucas StachQuoted 30 lines · On Tue, 2 Apr 2013 08:19:04 +0200 Lucas Stach <[email protected]> wrote:
Tegra is not a single arch type, but a collection of different generations. Define TEGAR20 arch type to differentiate between the generations. Switch to ARMv7 cpu type for all Tegras.
Signed-off-by Lucas Stach <[email protected]>--- arch/arm/Kconfig | 4 ++-- arch/arm/mach-tegra/Kconfig | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-)arch/arm/Kconfig +2
-2@@ -136,8 +136,8 @@ config ARCH_VEXPRESS select COMMON_CLK config ARCH_TEGRA - bool "Nvidia Tegra-based boards" - select CPU_ARM926T + bool "Nvidia Tegra" + select CPU_V7 select HAS_DEBUG_LL config ARCH_ZYNQarch/arm/mach-tegra/Kconfig +0
-0
arch/arm/mach-tegra/Kconfig line 2
Quoted 2 lines
arch/arm/mach-tegra/Kconfig +1
-0@@ -1,11 +1,23 @@ if ARCH_TEGRA +
Trailing whitespace here.
Quoted 35 lines
arch/arm/mach-tegra/Kconfig +17
-2+choice + prompt "Tegra processor type" + +config MACH_TEGRA20 + bool "Tegra 20" + +endchoice + +# --------------------------------------------------------- + +if MACH_TEGRA20 config ARCH_TEXT_BASE hex - default 0x31fc0000 + default 0x00108000 choice - prompt "Tegra Board Type" + prompt "Tegra 20 Board Type" config MACH_TOSHIBA_AC100 bool "Toshiba AC100"@@ -16,4 +28,8 @@ endchoice source arch/arm/boards/toshiba-ac100/Kconfig +endif #MACH_TEGRA20 + +# --------------------------------------------------------- + endifSignature · 1 line
1.8.1.4
Signature · 6 lines
[email protected] <[email protected]> _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 3/10 tegra: switch to DT only
In reply to Lucas StachWe will follow the Linux kernel and go devicetree only for Tegra. This doesn't prevent specific code for certain boards, but always requires a valid DTB for all boards.
Also regenerate the AC100 defconfig to reflect this change.
--- arch/arm/Kconfig | 2 ++ arch/arm/configs/toshiba_ac100_defconfig | 9 ++++++--- arch/arm/dts/tegra20-paz00.dts | 12 ++++++++++++ arch/arm/dts/tegra20.dtsi | 5 +++++ 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 arch/arm/dts/tegra20-paz00.dts create mode 100644 arch/arm/dts/tegra20.dtsi
arch/arm/Kconfig +2 -0
@@ -139,6 +139,8 @@ config ARCH_TEGRA bool "Nvidia Tegra" select CPU_V7 select HAS_DEBUG_LL + select BUILTIN_DTB + select OFTREE config ARCH_ZYNQ bool "Xilinx Zynq-based boards"
arch/arm/configs/toshiba_ac100_defconfig +6 -3
@@ -1,4 +1,5 @@ -CONFIG_ARCH_TEGRA=y +CONFIG_BUILTIN_DTB=y +CONFIG_BUILTIN_DTB_NAME="tegra20-paz00" CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y CONFIG_TEXT_BASE=0x01000000 CONFIG_BROKEN=y
@@ -14,6 +15,7 @@ CONFIG_ENABLE_DEVICE_NOISE=y CONFIG_CMD_SLEEP=y # CONFIG_CMD_TRUE is not set # CONFIG_CMD_FALSE is not set +CONFIG_CMD_TFTP=y CONFIG_CMD_LOADB=y CONFIG_CMD_LOADY=y CONFIG_CMD_LOADS=y
@@ -23,12 +25,12 @@ CONFIG_CMD_SHA1SUM=y CONFIG_CMD_BOOTM_SHOW_TYPE=y CONFIG_CMD_RESET=y CONFIG_CMD_GO=y +CONFIG_CMD_OFTREE=y CONFIG_NET=y CONFIG_NET_DHCP=y CONFIG_NET_PING=y -CONFIG_CMD_TFTP=y -CONFIG_FS_TFTP=y CONFIG_NET_NETCONSOLE=y +CONFIG_OFDEVICE=y CONFIG_DRIVER_SERIAL_NS16550=y CONFIG_NET_USB=y CONFIG_NET_USB_ASIX=y
@@ -36,4 +38,5 @@ CONFIG_NET_USB_ASIX=y CONFIG_USB=y CONFIG_USB_EHCI=y CONFIG_USB_STORAGE=y +CONFIG_FS_TFTP=y CONFIG_FS_FAT=y
arch/arm/dts/tegra20-paz00.dts new file +12 -0
@@ -0,0 +1,12 @@ +/dts-v1/; + +/include/ "tegra20.dtsi" + +/ { + model = "Toshiba AC100 / Dynabook AZ"; + compatible = "compal,paz00", "nvidia,tegra20"; + + memory { + reg = <0x00000000 0x20000000>; + }; +};
arch/arm/dts/tegra20.dtsi new file +5 -0
@@ -0,0 +1,5 @@ +/include/ "skeleton.dtsi" + +/ { + compatible = "nvidia,tegra20"; +};
Signature · 7 lines
1.8.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 03/10] tegra: switch to DT only
Quoted 21 lines · Lucas Stach
We will follow the Linux kernel and go devicetree only for Tegra. This doesn't prevent specific code for certain boards, but always requires a valid DTB for all boards.
Also regenerate the AC100 defconfig to reflect this change.
Signed-off-by Lucas Stach <[email protected]>--- arch/arm/Kconfig | 2 ++ arch/arm/configs/toshiba_ac100_defconfig | 9 ++++++--- arch/arm/dts/tegra20-paz00.dts | 12 ++++++++++++ arch/arm/dts/tegra20.dtsi | 5 +++++ 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 arch/arm/dts/tegra20-paz00.dts create mode 100644 arch/arm/dts/tegra20.dtsiarch/arm/Kconfig +0
-0
arch/arm/Kconfig config ARCH_TEGRA · line 142
Quoted 4 lines
arch/arm/Kconfig +1
-0@@ -139,6 +139,8 @@ config ARCH_TEGRA bool "Nvidia Tegra" select CPU_V7 select HAS_DEBUG_LL + select BUILTIN_DTB
where does this come from>?
Quoted 81 lines
arch/arm/Kconfig +1
-0+ select OFTREE config ARCH_ZYNQ bool "Xilinx Zynq-based boards"arch/arm/configs/toshiba_ac100_defconfig +6
-3@@ -1,4 +1,5 @@ -CONFIG_ARCH_TEGRA=y +CONFIG_BUILTIN_DTB=y +CONFIG_BUILTIN_DTB_NAME="tegra20-paz00" CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y CONFIG_TEXT_BASE=0x01000000 CONFIG_BROKEN=y@@ -14,6 +15,7 @@ CONFIG_ENABLE_DEVICE_NOISE=y CONFIG_CMD_SLEEP=y # CONFIG_CMD_TRUE is not set # CONFIG_CMD_FALSE is not set +CONFIG_CMD_TFTP=y CONFIG_CMD_LOADB=y CONFIG_CMD_LOADY=y CONFIG_CMD_LOADS=y@@ -23,12 +25,12 @@ CONFIG_CMD_SHA1SUM=y CONFIG_CMD_BOOTM_SHOW_TYPE=y CONFIG_CMD_RESET=y CONFIG_CMD_GO=y +CONFIG_CMD_OFTREE=y CONFIG_NET=y CONFIG_NET_DHCP=y CONFIG_NET_PING=y -CONFIG_CMD_TFTP=y -CONFIG_FS_TFTP=y CONFIG_NET_NETCONSOLE=y +CONFIG_OFDEVICE=y CONFIG_DRIVER_SERIAL_NS16550=y CONFIG_NET_USB=y CONFIG_NET_USB_ASIX=y@@ -36,4 +38,5 @@ CONFIG_NET_USB_ASIX=y CONFIG_USB=y CONFIG_USB_EHCI=y CONFIG_USB_STORAGE=y +CONFIG_FS_TFTP=y CONFIG_FS_FAT=yarch/arm/dts/tegra20-paz00.dts new file +12
-0@@ -0,0 +1,12 @@ +/dts-v1/; + +/include/ "tegra20.dtsi" + +/ { + model = "Toshiba AC100 / Dynabook AZ"; + compatible = "compal,paz00", "nvidia,tegra20"; + + memory { + reg = <0x00000000 0x20000000>; + }; +};arch/arm/dts/tegra20.dtsi new file +5
-0@@ -0,0 +1,5 @@ +/include/ "skeleton.dtsi" + +/ { + compatible = "nvidia,tegra20"; +};Signature · 7 lines
1.8.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 03/10] tegra: switch to DT only
In reply to Lucas StachQuoted 34 lines · On Tue, 2 Apr 2013 08:19:05 +0200 Lucas Stach <[email protected]> wrote:
We will follow the Linux kernel and go devicetree only for Tegra. This doesn't prevent specific code for certain boards, but always requires a valid DTB for all boards.
Also regenerate the AC100 defconfig to reflect this change.
Signed-off-by Lucas Stach <[email protected]>--- arch/arm/Kconfig | 2 ++ arch/arm/configs/toshiba_ac100_defconfig | 9 ++++++--- arch/arm/dts/tegra20-paz00.dts | 12 ++++++++++++ arch/arm/dts/tegra20.dtsi | 5 +++++ 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 arch/arm/dts/tegra20-paz00.dts create mode 100644 arch/arm/dts/tegra20.dtsiarch/arm/Kconfig +2
-0@@ -139,6 +139,8 @@ config ARCH_TEGRA bool "Nvidia Tegra" select CPU_V7 select HAS_DEBUG_LL + select BUILTIN_DTB + select OFTREE config ARCH_ZYNQ bool "Xilinx Zynq-based boards"arch/arm/configs/toshiba_ac100_defconfig +0
-0
arch/arm/configs/toshiba_ac100_defconfig line 1
Quoted 1 line
arch/arm/configs/toshiba_ac100_defconfig +0
-1@@ -1,4 +1,5 @@ -CONFIG_ARCH_TEGRA=y
Why?
We will get this after 'make toshiba_ac100_defconfig':
CONFIG_ARCH_AT91=y
...
# CONFIG_ARCH_TEGRA is not set
Quoted 66 lines
arch/arm/configs/toshiba_ac100_defconfig +6
-2+CONFIG_BUILTIN_DTB=y +CONFIG_BUILTIN_DTB_NAME="tegra20-paz00" CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y CONFIG_TEXT_BASE=0x01000000 CONFIG_BROKEN=y@@ -14,6 +15,7 @@ CONFIG_ENABLE_DEVICE_NOISE=y CONFIG_CMD_SLEEP=y # CONFIG_CMD_TRUE is not set # CONFIG_CMD_FALSE is not set +CONFIG_CMD_TFTP=y CONFIG_CMD_LOADB=y CONFIG_CMD_LOADY=y CONFIG_CMD_LOADS=y@@ -23,12 +25,12 @@ CONFIG_CMD_SHA1SUM=y CONFIG_CMD_BOOTM_SHOW_TYPE=y CONFIG_CMD_RESET=y CONFIG_CMD_GO=y +CONFIG_CMD_OFTREE=y CONFIG_NET=y CONFIG_NET_DHCP=y CONFIG_NET_PING=y -CONFIG_CMD_TFTP=y -CONFIG_FS_TFTP=y CONFIG_NET_NETCONSOLE=y +CONFIG_OFDEVICE=y CONFIG_DRIVER_SERIAL_NS16550=y CONFIG_NET_USB=y CONFIG_NET_USB_ASIX=y@@ -36,4 +38,5 @@ CONFIG_NET_USB_ASIX=y CONFIG_USB=y CONFIG_USB_EHCI=y CONFIG_USB_STORAGE=y +CONFIG_FS_TFTP=y CONFIG_FS_FAT=yarch/arm/dts/tegra20-paz00.dts new file +12
-0@@ -0,0 +1,12 @@ +/dts-v1/; + +/include/ "tegra20.dtsi" + +/ { + model = "Toshiba AC100 / Dynabook AZ"; + compatible = "compal,paz00", "nvidia,tegra20"; + + memory { + reg = <0x00000000 0x20000000>; + }; +};arch/arm/dts/tegra20.dtsi new file +5
-0@@ -0,0 +1,5 @@ +/include/ "skeleton.dtsi" + +/ { + compatible = "nvidia,tegra20"; +};Signature · 1 line
1.8.1.4
Signature · 6 lines
[email protected] <[email protected]> _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 4/10 tegra: add driver for the clock and reset module
In reply to Lucas StachOnly a basic set of clocks is supported. This is a temporary solution and will go away as soon as the port of the Tegra common clock code from the Linux kernel is ready to go.
--- arch/arm/Kconfig | 2 + arch/arm/dts/tegra20.dtsi | 6 ++ arch/arm/mach-tegra/Makefile | 1 + arch/arm/mach-tegra/include/mach/clkdev.h | 7 ++ arch/arm/mach-tegra/include/mach/tegra20-car.h | 22 +++++ arch/arm/mach-tegra/tegra20-car.c | 117 +++++++++++++++++++++++++ 6 files changed, 155 insertions(+) create mode 100644 arch/arm/mach-tegra/include/mach/clkdev.h create mode 100644 arch/arm/mach-tegra/include/mach/tegra20-car.h create mode 100644 arch/arm/mach-tegra/tegra20-car.c
arch/arm/Kconfig +2 -0
@@ -140,6 +140,8 @@ config ARCH_TEGRA select CPU_V7 select HAS_DEBUG_LL select BUILTIN_DTB + select COMMON_CLK + select CLKDEV_LOOKUP select OFTREE config ARCH_ZYNQ
arch/arm/dts/tegra20.dtsi +6 -0
@@ -2,4 +2,10 @@ / { compatible = "nvidia,tegra20"; + + tegra_car: clock { + compatible = "nvidia,tegra20-car"; + reg = <0x60006000 0x1000>; + #clock-cells = <1>; + }; };
arch/arm/mach-tegra/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-y += clock.o obj-y += reset.o +obj-y += tegra20-car.o
arch/arm/mach-tegra/include/mach/clkdev.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef __ASM_MACH_CLKDEV_H +#define __ASM_MACH_CLKDEV_H + +#define __clk_get (clk) ({ 1; }) +#define __clk_put (clk) do { } while (0) + +#endif
arch/arm/mach-tegra/include/mach/tegra20-car.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* Copyright (C) 2013 Lucas Stach <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* Register definitions */ +#define CRC_OSC_CTRL 0x050 +#define CRC_OSC_CTRL_OSC_FREQ_SHIFT 30 +#define CRC_OSC_CTRL_OSC_FREQ_MASK (0x3 << CRC_OSC_CTRL_OSC_FREQ_SHIFT) +#define CRC_OSC_CTRL_PLL_REF_DIV_SHIFT 28 +#define CRC_OSC_CTRL_PLL_REF_DIV_MASK (0x3 << CRC_OSC_CTRL_PLL_REF_DIV_SHIFT)
arch/arm/mach-tegra/tegra20-car.c new file +117 -0
117 lines not on this page · raw message
Signature · 7 lines
1.8.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 5/10 tegra: add T20 timer driver
In reply to Lucas StachReplace the ad-hoc clocksource implementation with a proper driver for the Tegra 20 timer. This driver is able to do the required hardware initialisation itself.
--- arch/arm/dts/tegra20.dtsi | 9 +++ arch/arm/mach-tegra/Makefile | 2 +- arch/arm/mach-tegra/clock.c | 56 ----------------- arch/arm/mach-tegra/tegra20-car.c | 4 ++ arch/arm/mach-tegra/tegra20-timer.c | 120 ++++++++++++++++++++++++++++++++++++ 5 files changed, 134 insertions(+), 57 deletions(-) delete mode 100644 arch/arm/mach-tegra/clock.c create mode 100644 arch/arm/mach-tegra/tegra20-timer.c
arch/arm/dts/tegra20.dtsi +9 -0
@@ -3,6 +3,15 @@ / { compatible = "nvidia,tegra20"; + timer@60005000 { + compatible = "nvidia,tegra20-timer"; + reg = <0x60005000 0x60>; + interrupts = <0 0 0x04 + 0 1 0x04 + 0 41 0x04 + 0 42 0x04>; + }; + tegra_car: clock { compatible = "nvidia,tegra20-car"; reg = <0x60006000 0x1000>;
arch/arm/mach-tegra/Makefile +1 -1
@@ -1,3 +1,3 @@ -obj-y += clock.o obj-y += reset.o obj-y += tegra20-car.o +obj-y += tegra20-timer.o
arch/arm/mach-tegra/clock.c deleted +0 -56
56 lines not on this page · raw message
arch/arm/mach-tegra/tegra20-car.c +4 -0
@@ -23,6 +23,7 @@#include <init.h> #include <io.h> #include <linux/clk.h> +#include <linux/clkdev.h> #include <linux/err.h> #include <mach/iomap.h>
@@ -93,6 +94,9 @@ static int tegra20_car_probe(struct device_d *dev)/* timer is a gate, but as it's enabled by BOOTROM we needn't worry */ clks[timer] =clk_fixed_factor ("timer" ,"clk_m" ,1 ,1 ); +/* device to clock links */ +clkdev_add_physbase (clks[timer],TEGRA_TMR1_BASE ,NULL ); +return 0 ; }
arch/arm/mach-tegra/tegra20-timer.c new file +120 -0
120 lines not on this page · raw message
Signature · 7 lines
1.8.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 6/10 tegra: add T20 power management controller driver
In reply to Lucas StachCurrently only implements system wide reset functionality.
--- arch/arm/dts/tegra20.dtsi | 5 ++ arch/arm/mach-tegra/Makefile | 2 +- arch/arm/mach-tegra/include/mach/tegra20-pmc.h | 37 ++++++++++++++ arch/arm/mach-tegra/reset.c | 39 --------------- arch/arm/mach-tegra/tegra20-pmc.c | 68 ++++++++++++++++++++++++++ 5 files changed, 111 insertions(+), 40 deletions(-) create mode 100644 arch/arm/mach-tegra/include/mach/tegra20-pmc.h delete mode 100644 arch/arm/mach-tegra/reset.c create mode 100644 arch/arm/mach-tegra/tegra20-pmc.c
arch/arm/dts/tegra20.dtsi +5 -0
@@ -17,4 +17,9 @@ reg = <0x60006000 0x1000>; #clock-cells = <1>; }; + + pmc { + compatible = "nvidia,tegra20-pmc"; + reg = <0x7000e400 0x400>; + }; };
arch/arm/mach-tegra/Makefile +1 -1
@@ -1,3 +1,3 @@ -obj-y += reset.o obj-y += tegra20-car.o +obj-y += tegra20-pmc.o obj-y += tegra20-timer.o
arch/arm/mach-tegra/include/mach/tegra20-pmc.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Copyright (C) 2013 Lucas Stach <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* register definitions */ +#define PMC_CNTRL 0x000 +#define PMC_CNTRL_FUSE_OVERRIDE (1 << 18) +#define PMC_CNTRL_INTR_POLARITY (1 << 17) +#define PMC_CNTRL_CPUPWRREQ_OE (1 << 16) +#define PMC_CNTRL_CPUPWRREQ_POLARITY (1 << 15) +#define PMC_CNTRL_SIDE_EFFECT_LP0 (1 << 14) +#define PMC_CNTRL_AOINIT (1 << 13) +#define PMC_CNTRL_PWRGATE_DIS (1 << 12) +#define PMC_CNTRL_SYSCLK_OE (1 << 11) +#define PMC_CNTRL_SYSCLK_POLARITY (1 << 10) +#define PMC_CNTRL_PWRREQ_OE (1 << 9) +#define PMC_CNTRL_PWRREQ_POLARITY (1 << 8) +#define PMC_CNTRL_BLINK_EN (1 << 7) +#define PMC_CNTRL_GLITCHDET_DIS (1 << 6) +#define PMC_CNTRL_LATCHWAKE_EN (1 << 5) +#define PMC_CNTRL_MAIN_RST (1 << 4) +#define PMC_CNTRL_KBC_RST (1 << 3) +#define PMC_CNTRL_RTC_RST (1 << 2) +#define PMC_CNTRL_RTC_CLK_DIS (1 << 1) +#define PMC_CNTRL_KBC_CLK_DIS (1 << 0)
arch/arm/mach-tegra/reset.c deleted +0 -39
@@ -1,39 +0,0 @@ -/* -* Copyright (C) 2011 Antony Pavlov <[email protected]> -* -* This file is part of barebox. -* 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 version 2 -* as published by the Free Software Foundation. -* -* 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. -* -*/ - -/** -* @file -* @brief Resetting an malta board -*/ - -#include <common.h> -#include <asm/io.h> -#include <mach/iomap.h> - -#define PRM_RSTCTRL TEGRA_PMC_BASE - -void __noreturn reset_cpu (ulong addr) -{ -int rstctrl; - - rstctrl =__raw_readl ((char *)PRM_RSTCTRL ); - rstctrl |=0x10 ; -__raw_writel (rstctrl, (char *)PRM_RSTCTRL ); - -unreachable (); -} -EXPORT_SYMBOL (reset_cpu);
arch/arm/mach-tegra/tegra20-pmc.c new file +68 -0
68 lines not on this page · raw message
Signature · 7 lines
1.8.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 7/10 tegra: add common lowlevel startup
In reply to Lucas StachAll Tegra20 boards have a common startup sequence. Also there is an agreement on how to find out about the installed amount of RAM and other information needed by early startup. So as there is really no need to do any lowlevel stuff per board, we can just do it at the ARCH level.
This also enables the first stage loading of barebox by detecting the currently running CPU and booting the main CPU cluster if neccesary.
--- arch/arm/boards/toshiba-ac100/Makefile | 1 - arch/arm/boards/toshiba-ac100/lowlevel.c | 10 -- arch/arm/mach-tegra/Makefile | 3 + arch/arm/mach-tegra/include/mach/iomap.h | 3 + arch/arm/mach-tegra/include/mach/lowlevel.h | 113 ++++++++++++ arch/arm/mach-tegra/include/mach/tegra20-car.h | 157 +++++++++++++++++ arch/arm/mach-tegra/include/mach/tegra20-pmc.h | 30 ++++ arch/arm/mach-tegra/tegra_avp_init.c | 228 +++++++++++++++++++++++++ arch/arm/mach-tegra/tegra_maincomplex_init.c | 46 +++++ 9 files changed, 580 insertions(+), 11 deletions(-) delete mode 100644 arch/arm/boards/toshiba-ac100/lowlevel.c create mode 100644 arch/arm/mach-tegra/include/mach/lowlevel.h create mode 100644 arch/arm/mach-tegra/tegra_avp_init.c create mode 100644 arch/arm/mach-tegra/tegra_maincomplex_init.c
arch/arm/boards/toshiba-ac100/Makefile +0 -1
@@ -1,3 +1,2 @@ obj-y += board.o obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial.o -lwl-y += lowlevel.o
arch/arm/boards/toshiba-ac100/lowlevel.c deleted +0 -10
@@ -1,10 +0,0 @@ -#include <common.h> -#include <sizes.h> -#include <asm/barebox-arm-head.h> -#include <asm/barebox-arm.h> - -void __naked barebox_arm_reset_vector (void ) -{ -arm_cpu_lowlevel_init (); -barebox_arm_entry (0x0 ,SZ_512M ,0 ); -}
arch/arm/mach-tegra/Makefile +3 -0
@@ -1,3 +1,6 @@ +CFLAGS_tegra_avp_init.o := -mcpu=arm7tdmi -march=armv4t +lwl-y += tegra_avp_init.o +lwl-y += tegra_maincomplex_init.o obj-y += tegra20-car.o obj-y += tegra20-pmc.o obj-y += tegra20-timer.o
arch/arm/mach-tegra/include/mach/iomap.h +3 -0
@@ -59,6 +59,9 @@#define TEGRA_GART_BASE 0x58000000#define TEGRA_GART_SIZE SZ_32M +#define TEGRA_UP_TAG_BASE 0x60000000 +#define TEGRA_UP_TAG_SIZE SZ_4K +#define TEGRA_RES_SEMA_BASE 0x60001000#define TEGRA_RES_SEMA_SIZE SZ_4K
arch/arm/mach-tegra/include/mach/lowlevel.h new file +113 -0
113 lines not on this page · raw message
arch/arm/mach-tegra/include/mach/tegra20-car.h +157 -0
165 lines not on this page · raw message
arch/arm/mach-tegra/include/mach/tegra20-pmc.h +30 -0
@@ -35,3 +35,33 @@#define PMC_CNTRL_RTC_RST (1 << 2)#define PMC_CNTRL_RTC_CLK_DIS (1 << 1)#define PMC_CNTRL_KBC_CLK_DIS (1 << 0) + +#define PMC_PWRGATE_TOGGLE 0x030 +#define PMC_PWRGATE_TOGGLE_PARTID_SHIFT 0 +#define PMC_PWRGATE_TOGGLE_PARTID_MASK (0x3 << PMC_PWRGATE_TOGGLE_PARTID_SHIFT) +#define PMC_PWRGATE_TOGGLE_PARTID_CPU 0 +#define PMC_PWRGATE_TOGGLE_PARTID_TD 1 +#define PMC_PWRGATE_TOGGLE_PARTID_VE 2 +#define PMC_PWRGATE_TOGGLE_PARTID_PCX 3 +#define PMC_PWRGATE_TOGGLE_PARTID_VDE 4 +#define PMC_PWRGATE_TOGGLE_PARTID_L2C 5 +#define PMC_PWRGATE_TOGGLE_PARTID_MPE 6 +#define PMC_PWRGATE_TOGGLE_START (1 << 8) + +#define PMC_REMOVE_CLAMPING_CMD 0x034 +#define PMC_REMOVE_CLAMPING_CMD_MPE (1 << 6) +#define PMC_REMOVE_CLAMPING_CMD_L2C (1 << 5) +#define PMC_REMOVE_CLAMPING_CMD_PCX (1 << 4) +#define PMC_REMOVE_CLAMPING_CMD_VDE (1 << 3) +#define PMC_REMOVE_CLAMPING_CMD_VE (1 << 2) +#define PMC_REMOVE_CLAMPING_CMD_TD (1 << 1) +#define PMC_REMOVE_CLAMPING_CMD_CPU (1 << 0) + +#define PMC_PWRGATE_STATUS 0x038 +#define PMC_PWRGATE_STATUS_MPE (1 << 6) +#define PMC_PWRGATE_STATUS_L2C (1 << 5) +#define PMC_PWRGATE_STATUS_VDE (1 << 4) +#define PMC_PWRGATE_STATUS_PCX (1 << 3) +#define PMC_PWRGATE_STATUS_VE (1 << 2) +#define PMC_PWRGATE_STATUS_TD (1 << 1) +#define PMC_PWRGATE_STATUS_CPU (1 << 0)
arch/arm/mach-tegra/tegra_avp_init.c new file +228 -0
228 lines not on this page · raw message
arch/arm/mach-tegra/tegra_maincomplex_init.c new file +46 -0
46 lines not on this page · raw message
Signature · 7 lines
1.8.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 8/10 tegra: add generic debug UART support
In reply to Lucas StachODMdata tells us which UART to use for debugging purposes. This is agreed upon in both the upstream Linux kernel and U-Boot, so do it the same way in barebox.
--- arch/arm/boards/toshiba-ac100/Makefile | 1 - arch/arm/boards/toshiba-ac100/serial.c | 39 --------------------------- arch/arm/mach-tegra/include/mach/lowlevel.h | 34 ++++++++++++++++++++++++ arch/arm/mach-tegra/tegra20.c | 41 +++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 40 deletions(-) delete mode 100644 arch/arm/boards/toshiba-ac100/serial.c create mode 100644 arch/arm/mach-tegra/tegra20.c
arch/arm/boards/toshiba-ac100/Makefile +0 -1
@@ -1,2 +1 @@ obj-y += board.o -obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial.o
arch/arm/boards/toshiba-ac100/serial.c deleted +0 -39
@@ -1,39 +0,0 @@ -/* -* Copyright (C) 2011 Antony Pavlov <[email protected]> -* -* This file is part of barebox. -* 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 version 2 -* as published by the Free Software Foundation. -* -* 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. -*/ - -#include <common.h> -#include <types.h> -#include <driver.h> -#include <init.h> -#include <ns16550.h> -#include <asm/io.h> -#include <asm/common.h> -#include <mach/iomap.h> - -static struct NS16550_plat serial_plat = { - .clock =0x75 *115200 *16 /* MODE_X_DIV */ , - .shift =2 , -}; - -static int ac100_serial_console_init (void ) -{ -/* Register the serial port */ -add_ns16550_device (DEVICE_ID_DYNAMIC ,TEGRA_UARTA_BASE ,8 << serial_plat.shift, -IORESOURCE_MEM_8BIT , &serial_plat); - -return 0 ; -} -console_initcall (ac100_serial_console_init);
arch/arm/mach-tegra/include/mach/lowlevel.h +34 -0
@@ -35,6 +35,10 @@#define T20_ODMDATA_RAMSIZE_SHIFT 28#define T20_ODMDATA_RAMSIZE_MASK (3 << T20_ODMDATA_RAMSIZE_SHIFT) +#define T20_ODMDATA_UARTTYPE_SHIFT 18 +#define T20_ODMDATA_UARTTYPE_MASK (3 << T20_ODMDATA_UARTTYPE_SHIFT) +#define T20_ODMDATA_UARTID_SHIFT 15 +#define T20_ODMDATA_UARTID_MASK (7 << T20_ODMDATA_UARTID_SHIFT)static inline u32 tegra_get_odmdata (void ) {
@@ -109,5 +113,35 @@ static inline uint32_t tegra20_get_ramsize(void) } } +static long uart_id_to_base[] = { +TEGRA_UARTA_BASE , +TEGRA_UARTB_BASE , +TEGRA_UARTC_BASE , +TEGRA_UARTD_BASE , +TEGRA_UARTE_BASE , +}; + +static inline long tegra20_get_debuguart_base (void ) +{ +u32 odmdata; +int id; + + odmdata =tegra_get_odmdata (); + +/* +* Get type, we accept both "2" and "3", as they both demark a UART, +* depending on the board type. +*/ +if (!(((odmdata &T20_ODMDATA_UARTTYPE_MASK ) >> +T20_ODMDATA_UARTTYPE_SHIFT ) &0x2 )) +return 0 ; + + id = (odmdata &T20_ODMDATA_UARTID_MASK ) >>T20_ODMDATA_UARTID_SHIFT ; +if (id >ARRAY_SIZE (uart_id_to_base)) +return 0 ; + +return uart_id_to_base[id]; +} +/* reset vector for the main CPU complex */ void tegra_maincomplex_entry (void );
arch/arm/mach-tegra/tegra20.c new file +41 -0
41 lines not on this page · raw message
Signature · 7 lines
1.8.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 08/10] tegra: add generic debug UART support
Quoted 3 lines · On Tue, 2 Apr 2013 08:19:10 +0200 Lucas Stach <[email protected]> wrote:
ODMdata tells us which UART to use for debugging purposes. This is agreed upon in both the upstream Linux kernel and U-Boot, so do it the same way in barebox.
This patch disables serial console on my Toshiba AC100.
Quoted 163 lines
Signed-off-by Lucas Stach <[email protected]>--- arch/arm/boards/toshiba-ac100/Makefile | 1 - arch/arm/boards/toshiba-ac100/serial.c | 39 --------------------------- arch/arm/mach-tegra/include/mach/lowlevel.h | 34 ++++++++++++++++++++++++ arch/arm/mach-tegra/tegra20.c | 41 +++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 40 deletions(-) delete mode 100644 arch/arm/boards/toshiba-ac100/serial.c create mode 100644 arch/arm/mach-tegra/tegra20.carch/arm/boards/toshiba-ac100/Makefile +0
-1@@ -1,2 +1 @@ obj-y += board.o -obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial.oarch/arm/boards/toshiba-ac100/serial.c deleted +0
-39@@ -1,39 +0,0 @@ -/* -* Copyright (C) 2011 Antony Pavlov <[email protected]> -* -* This file is part of barebox. -* 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 version 2 -* as published by the Free Software Foundation. -* -* 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. -*/ - -#include <common.h> -#include <types.h> -#include <driver.h> -#include <init.h> -#include <ns16550.h> -#include <asm/io.h> -#include <asm/common.h> -#include <mach/iomap.h> - -static struct NS16550_plat serial_plat = { - .clock =0x75 *115200 *16 /* MODE_X_DIV */ , - .shift =2 , -}; - -static int ac100_serial_console_init (void ) -{ -/* Register the serial port */ -add_ns16550_device (DEVICE_ID_DYNAMIC ,TEGRA_UARTA_BASE ,8 << serial_plat.shift, -IORESOURCE_MEM_8BIT , &serial_plat); - -return 0 ; -} -console_initcall (ac100_serial_console_init);arch/arm/mach-tegra/include/mach/lowlevel.h +34
-0@@ -35,6 +35,10 @@#define T20_ODMDATA_RAMSIZE_SHIFT 28#define T20_ODMDATA_RAMSIZE_MASK (3 << T20_ODMDATA_RAMSIZE_SHIFT) +#define T20_ODMDATA_UARTTYPE_SHIFT 18 +#define T20_ODMDATA_UARTTYPE_MASK (3 << T20_ODMDATA_UARTTYPE_SHIFT) +#define T20_ODMDATA_UARTID_SHIFT 15 +#define T20_ODMDATA_UARTID_MASK (7 << T20_ODMDATA_UARTID_SHIFT)static inline u32 tegra_get_odmdata (void ) {@@ -109,5 +113,35 @@ static inline uint32_t tegra20_get_ramsize(void) } } +static long uart_id_to_base[] = { +TEGRA_UARTA_BASE , +TEGRA_UARTB_BASE , +TEGRA_UARTC_BASE , +TEGRA_UARTD_BASE , +TEGRA_UARTE_BASE , +}; + +static inline long tegra20_get_debuguart_base (void ) +{ +u32 odmdata; +int id; + + odmdata =tegra_get_odmdata (); + +/* +* Get type, we accept both "2" and "3", as they both demark a UART, +* depending on the board type. +*/ +if (!(((odmdata &T20_ODMDATA_UARTTYPE_MASK ) >> +T20_ODMDATA_UARTTYPE_SHIFT ) &0x2 )) +return 0 ; + + id = (odmdata &T20_ODMDATA_UARTID_MASK ) >>T20_ODMDATA_UARTID_SHIFT ; +if (id >ARRAY_SIZE (uart_id_to_base)) +return 0 ; + +return uart_id_to_base[id]; +} +/* reset vector for the main CPU complex */ void tegra_maincomplex_entry (void );arch/arm/mach-tegra/tegra20.c new file +41
-0@@ -0,0 +1,41 @@ +/* +* Copyright (C) 2013 Lucas Stach <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <common.h> +#include <init.h> +#include <ns16550.h> +#include <mach/iomap.h> +#include <mach/lowlevel.h> + +static struct NS16550_plat debug_uart = { + .clock =216000000 ,/* pll_p rate */ + .shift =2 , +}; + +static int tegra20_add_debug_console (void ) +{ +unsigned long base; + + base =tegra20_get_debuguart_base (); +if (!base) +return -ENODEV ; + +add_ns16550_device (DEVICE_ID_DYNAMIC , base,TEGRA_UARTA_SIZE , +IORESOURCE_MEM_8BIT , &debug_uart); + +return 0 ; +} +console_initcall (tegra20_add_debug_console);Signature · 1 line
1.8.1.4
Signature · 6 lines
[email protected] <[email protected]> _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 08/10] tegra: add generic debug UART support
Hi Antony,
Am Freitag, den 05.04.2013, 00:32 +0400 schrieb [email protected]:
Quoted 9 lines
Quoted 3 lines · On Tue, 2 Apr 2013 08:19:10 +0200 Lucas Stach <[email protected]> wrote:
ODMdata tells us which UART to use for debugging purposes. This is agreed upon in both the upstream Linux kernel and U-Boot, so do it the same way in barebox.
This patch disables serial console on my Toshiba AC100.
Hm that's unfortunate, but I already suspected that your ODMdata might be wrong.
What happens if you don't remove the serial init in your board? Do you get a duplicate serial, or just your board defined one? If it still works for you this way, we might take this as a compromise for now.
Regards,
Lucas
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 08/10] tegra: add generic debug UART support
Quoted 10 lines · On Mon, 08 Apr 2013 12:57:26 +0200 Lucas Stach <[email protected]> wrote:
Hi Antony,
Am Freitag, den 05.04.2013, 00:32 +0400 schrieb [email protected]:
Quoted 7 lines
Quoted 3 lines · On Tue, 2 Apr 2013 08:19:10 +0200 Lucas Stach <[email protected]> wrote:
ODMdata tells us which UART to use for debugging purposes. This is agreed upon in both the upstream Linux kernel and U-Boot, so do it the same way in barebox.
Quoted 7 lines
Quoted 2 lines
This patch disables serial console on my Toshiba AC100.
Hm that's unfortunate, but I already suspected that your ODMdata might be wrong.
What happens if you don't remove the serial init in your board? Do you get a duplicate serial, or just your board defined one? If it still works for you this way, we might take this as a compromise for now.
IMHO, the right way is to get of_serial.c from linux and put some records like this
uarta: serial@70006000 {
compatible = "nvidia,tegra20-uart";
reg = <0x70006000 0x40>;
reg-shift = <2>;
interrupts = <0 36 0x04>;
nvidia,dma-request-selector = <&apbdma 8>;
clocks = <&tegra_car 6>;
status = "disabled";};
to arch/arm/dts/tegra20.dtsi.
Signature · 8 lines
-- Best regards, Antony Pavlov _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 08/10] tegra: add generic debug UART support
Am Montag, den 08.04.2013, 15:46 +0400 schrieb [email protected]:
Quoted 31 lines
Quoted 10 lines · On Mon, 08 Apr 2013 12:57:26 +0200 Lucas Stach <[email protected]> wrote:
Hi Antony,
Am Freitag, den 05.04.2013, 00:32 +0400 schrieb [email protected]:
Quoted 7 lines
Quoted 3 lines · On Tue, 2 Apr 2013 08:19:10 +0200 Lucas Stach <[email protected]> wrote:
ODMdata tells us which UART to use for debugging purposes. This is agreed upon in both the upstream Linux kernel and U-Boot, so do it the same way in barebox.
Quoted 7 lines
Quoted 2 lines
This patch disables serial console on my Toshiba AC100.
Hm that's unfortunate, but I already suspected that your ODMdata might be wrong.
What happens if you don't remove the serial init in your board? Do you get a duplicate serial, or just your board defined one? If it still works for you this way, we might take this as a compromise for now.IMHO, the right way is to get
of_serial.cfrom linux and put some records like thisuarta: serial@70006000 { compatible = "nvidia,tegra20-uart"; reg = <0x70006000 0x40>; reg-shift = <2>; interrupts = <0 36 0x04>; nvidia,dma-request-selector = <&apbdma 8>; clocks = <&tegra_car 6>; status = "disabled";
Quoted 4 lines
};
to
arch/arm/dts/tegra20.dtsi.
No, this doesn't help with the decision which UART barebox should use for it's output. This is a configuration option and therefore not allowed to reside in the DT, so NVIDIA decided to put this information into the ODMdata. Both U-Boot and the Linux kernel(for earlyconsole) use the information stored in this location.
You can always activate more consoles from board code or DT, but the first/debug console should IMHO be handled the same way it's done in Linux.
Regards,
Lucas
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 08/10] tegra: add generic debug UART support
Quoted 43 lines · On Mon, 08 Apr 2013 14:24:06 +0200 Lucas Stach <[email protected]> wrote:
Am Montag, den 08.04.2013, 15:46 +0400 schrieb [email protected]:
Quoted 31 lines
Quoted 10 lines · On Mon, 08 Apr 2013 12:57:26 +0200 Lucas Stach <[email protected]> wrote:
Hi Antony,
Am Freitag, den 05.04.2013, 00:32 +0400 schrieb [email protected]:
Quoted 7 lines
Quoted 3 lines · On Tue, 2 Apr 2013 08:19:10 +0200 Lucas Stach <[email protected]> wrote:
ODMdata tells us which UART to use for debugging purposes. This is agreed upon in both the upstream Linux kernel and U-Boot, so do it the same way in barebox.
Quoted 7 lines
Quoted 2 lines
This patch disables serial console on my Toshiba AC100.
Hm that's unfortunate, but I already suspected that your ODMdata might be wrong.
What happens if you don't remove the serial init in your board? Do you get a duplicate serial, or just your board defined one? If it still works for you this way, we might take this as a compromise for now.IMHO, the right way is to get
of_serial.cfrom linux and put some records like thisuarta: serial@70006000 { compatible = "nvidia,tegra20-uart"; reg = <0x70006000 0x40>; reg-shift = <2>; interrupts = <0 36 0x04>; nvidia,dma-request-selector = <&apbdma 8>; clocks = <&tegra_car 6>; status = "disabled";Quoted 4 lines
};
to
arch/arm/dts/tegra20.dtsi.No, this doesn't help with the decision which UART barebox should use for it's output. This is a configuration option and therefore not allowed to reside in the DT, so NVIDIA decided to put this information into the ODMdata. Both U-Boot and the Linux kernel(for earlyconsole) use the information stored in this location.
Quoted 3 lines
You can always activate more consoles from board code or DT, but the first/debug console should IMHO be handled the same way it's done in Linux.
Yes, this doesn't help to select the console UART, but it provide the information about platform available UARTs.
The selection of console port is board-dependent (e.g. the chip can have many UARTs, but the board can use only one of them), so let's move this selection to board configuration section.
Moreother, Toshiba AC100 is a netbook (or smartbook :), in normal mode it use keyboard and LCD screen for user interaction, not UART.
--
Best regards,
Antony Pavlov
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 08/10] tegra: add generic debug UART support
Am Montag, den 08.04.2013, 17:03 +0400 schrieb [email protected]:
Quoted 50 lines
Quoted 43 lines · On Mon, 08 Apr 2013 14:24:06 +0200 Lucas Stach <[email protected]> wrote:
Am Montag, den 08.04.2013, 15:46 +0400 schrieb [email protected]:
Quoted 31 lines
Quoted 10 lines · On Mon, 08 Apr 2013 12:57:26 +0200 Lucas Stach <[email protected]> wrote:
Hi Antony,
Am Freitag, den 05.04.2013, 00:32 +0400 schrieb [email protected]:
Quoted 7 lines
Quoted 3 lines · On Tue, 2 Apr 2013 08:19:10 +0200 Lucas Stach <[email protected]> wrote:
ODMdata tells us which UART to use for debugging purposes. This is agreed upon in both the upstream Linux kernel and U-Boot, so do it the same way in barebox.
Quoted 7 lines
Quoted 2 lines
This patch disables serial console on my Toshiba AC100.
Hm that's unfortunate, but I already suspected that your ODMdata might be wrong.
What happens if you don't remove the serial init in your board? Do you get a duplicate serial, or just your board defined one? If it still works for you this way, we might take this as a compromise for now.IMHO, the right way is to get
of_serial.cfrom linux and put some records like thisuarta: serial@70006000 { compatible = "nvidia,tegra20-uart"; reg = <0x70006000 0x40>; reg-shift = <2>; interrupts = <0 36 0x04>; nvidia,dma-request-selector = <&apbdma 8>; clocks = <&tegra_car 6>; status = "disabled";Quoted 4 lines
};
to
arch/arm/dts/tegra20.dtsi.No, this doesn't help with the decision which UART barebox should use for it's output. This is a configuration option and therefore not allowed to reside in the DT, so NVIDIA decided to put this information into the ODMdata. Both U-Boot and the Linux kernel(for earlyconsole) use the information stored in this location.
Quoted 3 lines
You can always activate more consoles from board code or DT, but the first/debug console should IMHO be handled the same way it's done in Linux.
Quoted 6 lines
Yes, this doesn't help to select the console UART, but it provide the information about platform available UARTs.
The selection of console port is board-dependent (e.g. the chip can have many UARTs, but the board can use only one of them), so let's move this selection to board configuration section.
I see your point. Still I would like to be able to use the ODMdata on boards that have a usable config there. I'll rework this patch to go the same route as Linux earlyconsole config with a Kconfig select for the DebugUART, where you can also opt to use the ODMdata defined one. I think this will make everyone happy.
Regards,
Lucas
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 08/10] tegra: add generic debug UART support
In reply to [email protected]Am Montag, den 08.04.2013, 17:03 +0400 schrieb [email protected]:
Quoted 50 lines
Quoted 43 lines · On Mon, 08 Apr 2013 14:24:06 +0200 Lucas Stach <[email protected]> wrote:
Am Montag, den 08.04.2013, 15:46 +0400 schrieb [email protected]:
Quoted 31 lines
Quoted 10 lines · On Mon, 08 Apr 2013 12:57:26 +0200 Lucas Stach <[email protected]> wrote:
Hi Antony,
Am Freitag, den 05.04.2013, 00:32 +0400 schrieb [email protected]:
Quoted 7 lines
Quoted 3 lines · On Tue, 2 Apr 2013 08:19:10 +0200 Lucas Stach <[email protected]> wrote:
ODMdata tells us which UART to use for debugging purposes. This is agreed upon in both the upstream Linux kernel and U-Boot, so do it the same way in barebox.
Quoted 7 lines
Quoted 2 lines
This patch disables serial console on my Toshiba AC100.
Hm that's unfortunate, but I already suspected that your ODMdata might be wrong.
What happens if you don't remove the serial init in your board? Do you get a duplicate serial, or just your board defined one? If it still works for you this way, we might take this as a compromise for now.IMHO, the right way is to get
of_serial.cfrom linux and put some records like thisuarta: serial@70006000 { compatible = "nvidia,tegra20-uart"; reg = <0x70006000 0x40>; reg-shift = <2>; interrupts = <0 36 0x04>; nvidia,dma-request-selector = <&apbdma 8>; clocks = <&tegra_car 6>; status = "disabled";Quoted 4 lines
};
to
arch/arm/dts/tegra20.dtsi.No, this doesn't help with the decision which UART barebox should use for it's output. This is a configuration option and therefore not allowed to reside in the DT, so NVIDIA decided to put this information into the ODMdata. Both U-Boot and the Linux kernel(for earlyconsole) use the information stored in this location.
Quoted 3 lines
You can always activate more consoles from board code or DT, but the first/debug console should IMHO be handled the same way it's done in Linux.
Quoted 9 lines
Yes, this doesn't help to select the console UART, but it provide the information about platform available UARTs.
The selection of console port is board-dependent (e.g. the chip can have many UARTs, but the board can use only one of them), so let's move this selection to board configuration section.Moreother, Toshiba AC100 is a netbook (or smartbook :), in normal mode it use keyboard and LCD screen for user interaction, not UART.
The generic serial patch in the series v4 now introduces a Kconfig to override the ODMdata value. I folded in the right config into the ac100 defconfig, so this patch should no longer break your console.
Also I fixed a bug that may lead to wrong ODMdata console detection, so could you please test if it maybe also works with the automatic detection for you now?
Regards,
Lucas
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 08/10] tegra: add generic debug UART support
Quoted 60 lines · On Wed, 10 Apr 2013 11:18:01 +0200 Lucas Stach <[email protected]> wrote:
Am Montag, den 08.04.2013, 17:03 +0400 schrieb [email protected]:
Quoted 50 lines
Quoted 43 lines · On Mon, 08 Apr 2013 14:24:06 +0200 Lucas Stach <[email protected]> wrote:
Am Montag, den 08.04.2013, 15:46 +0400 schrieb [email protected]:
Quoted 31 lines
Quoted 10 lines · On Mon, 08 Apr 2013 12:57:26 +0200 Lucas Stach <[email protected]> wrote:
Hi Antony,
Am Freitag, den 05.04.2013, 00:32 +0400 schrieb [email protected]:
Quoted 7 lines
Quoted 3 lines · On Tue, 2 Apr 2013 08:19:10 +0200 Lucas Stach <[email protected]> wrote:
ODMdata tells us which UART to use for debugging purposes. This is agreed upon in both the upstream Linux kernel and U-Boot, so do it the same way in barebox.
Quoted 7 lines
Quoted 2 lines
This patch disables serial console on my Toshiba AC100.
Hm that's unfortunate, but I already suspected that your ODMdata might be wrong.
What happens if you don't remove the serial init in your board? Do you get a duplicate serial, or just your board defined one? If it still works for you this way, we might take this as a compromise for now.IMHO, the right way is to get
of_serial.cfrom linux and put some records like thisuarta: serial@70006000 { compatible = "nvidia,tegra20-uart"; reg = <0x70006000 0x40>; reg-shift = <2>; interrupts = <0 36 0x04>; nvidia,dma-request-selector = <&apbdma 8>; clocks = <&tegra_car 6>; status = "disabled";Quoted 4 lines
};
to
arch/arm/dts/tegra20.dtsi.No, this doesn't help with the decision which UART barebox should use for it's output. This is a configuration option and therefore not allowed to reside in the DT, so NVIDIA decided to put this information into the ODMdata. Both U-Boot and the Linux kernel(for earlyconsole) use the information stored in this location.
Quoted 3 lines
You can always activate more consoles from board code or DT, but the first/debug console should IMHO be handled the same way it's done in Linux.
Quoted 9 lines
Yes, this doesn't help to select the console UART, but it provide the information about platform available UARTs.
The selection of console port is board-dependent (e.g. the chip can have many UARTs, but the board can use only one of them), so let's move this selection to board configuration section.Moreother, Toshiba AC100 is a netbook (or smartbook :), in normal mode it use keyboard and LCD screen for user interaction, not UART.
Quoted 7 lines
The generic serial patch in the series v4 now introduces a
Kconfigto override the ODMdata value. I folded in the right config into the ac100 defconfig, so this patch should no longer break your console.Also I fixed a bug that may lead to wrong ODMdata console detection, so could you please test if it maybe also works with the automatic detection for you now?
I have just checked your patches with
CONFIG_TEGRA_UART_ODMDATA=y
and with
CONFIG_TEGRA_UART_A=y
Both configurations work fine!
There is a very small issues (see my next messages), but IMHO, the patches are ready for commiting.
--
Best regards,
Antony Pavlov
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 9/10 tegra: add generic meminit
In reply to Lucas StachODMdata tells us how much RAM is installed, so no need to define this at the board level.
--- arch/arm/boards/toshiba-ac100/board.c | 8 -------- arch/arm/mach-tegra/tegra20.c | 9 +++++++++ 2 files changed, 9 insertions(+), 8 deletions(-)
arch/arm/boards/toshiba-ac100/board.c +0 -8
@@ -23,14 +23,6 @@#include <usb/ehci.h> #include <mach/iomap.h> -static int ac100_mem_init (void ) -{ -arm_add_mem_device ("ram0" ,0x0 ,SZ_512M ); - -return 0 ; -} -mem_initcall (ac100_mem_init); -static struct ehci_platform_data ehci_pdata = { .flags =EHCI_HAS_TT , };
arch/arm/mach-tegra/tegra20.c +9 -0
@@ -17,6 +17,7 @@#include <common.h> #include <init.h> #include <ns16550.h> +#include <asm/memory.h> #include <mach/iomap.h> #include <mach/lowlevel.h>
@@ -39,3 +40,11 @@ static int tegra20_add_debug_console(void)return 0 ; }console_initcall (tegra20_add_debug_console); + +static int tegra20_mem_init (void ) +{ +arm_add_mem_device ("ram0" ,0x0 ,tegra20_get_ramsize ()); + +return 0 ; +} +mem_initcall (tegra20_mem_init);
Signature · 7 lines
1.8.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 10/10 tegra: add GPIO controller driver
In reply to Lucas StachTaken from the Linux kernel, simplified and reworked to match barebox.
--- arch/arm/Kconfig | 2 + arch/arm/dts/tegra20.dtsi | 16 +++ arch/arm/mach-tegra/include/mach/gpio.h | 1 + drivers/gpio/Kconfig | 7 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-tegra.c | 226 ++++++++++++++++++++++++++++++++ 6 files changed, 253 insertions(+) create mode 100644 arch/arm/mach-tegra/include/mach/gpio.h create mode 100644 drivers/gpio/gpio-tegra.c
arch/arm/Kconfig +2 -0
@@ -142,6 +142,8 @@ config ARCH_TEGRA select BUILTIN_DTB select COMMON_CLK select CLKDEV_LOOKUP + select GPIOLIB + select GPIO_TEGRA select OFTREE config ARCH_ZYNQ
arch/arm/dts/tegra20.dtsi +16 -0
@@ -18,6 +18,22 @@ #clock-cells = <1>; }; + gpio: gpio { + compatible = "nvidia,tegra20-gpio"; + reg = <0x6000d000 0x1000>; + interrupts = <0 32 0x04 + 0 33 0x04 + 0 34 0x04 + 0 35 0x04 + 0 55 0x04 + 0 87 0x04 + 0 89 0x04>; + #gpio-cells = <2>; + gpio-controller; + #interrupt-cells = <2>; + interrupt-controller; + }; + pmc { compatible = "nvidia,tegra20-pmc"; reg = <0x7000e400 0x400>;
arch/arm/mach-tegra/include/mach/gpio.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/gpio.h>
drivers/gpio/Kconfig +7 -0
@@ -36,6 +36,13 @@ config GPIO_PL061 config GPIO_STMPE depends on MFD_STMPE bool "STMPE GPIO Expander" + +config GPIO_TEGRA + bool "GPIO support for the Tegra SoCs" + depends on ARCH_TEGRA + help + Say yes here to include the driver for the GPIO controller found on the + Tegra line of SoCs. endmenu endif
drivers/gpio/Makefile +1 -0
@@ -4,3 +4,4 @@ obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o obj-$(CONFIG_GPIO_GENERIC) += gpio-generic.o obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o +obj-$(CONFIG_GPIO_TEGRA) += gpio-tegra.o
drivers/gpio/gpio-tegra.c new file +226 -0
226 lines not on this page · raw message
Signature · 7 lines
1.8.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH v3 10/10] tegra: add GPIO controller driver
Quoted 273 lines · On Tue, 2 Apr 2013 08:19:12 +0200 Lucas Stach <[email protected]> wrote:
Taken from the Linux kernel, simplified and reworked to match barebox.
Signed-off-by Lucas Stach <[email protected]>--- arch/arm/Kconfig | 2 + arch/arm/dts/tegra20.dtsi | 16 +++ arch/arm/mach-tegra/include/mach/gpio.h | 1 + drivers/gpio/Kconfig | 7 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-tegra.c | 226 ++++++++++++++++++++++++++++++++ 6 files changed, 253 insertions(+) create mode 100644 arch/arm/mach-tegra/include/mach/gpio.h create mode 100644 drivers/gpio/gpio-tegra.carch/arm/Kconfig +2
-0@@ -142,6 +142,8 @@ config ARCH_TEGRA select BUILTIN_DTB select COMMON_CLK select CLKDEV_LOOKUP + select GPIOLIB + select GPIO_TEGRA select OFTREE config ARCH_ZYNQarch/arm/dts/tegra20.dtsi +16
-0@@ -18,6 +18,22 @@ #clock-cells = <1>; }; + gpio: gpio { + compatible = "nvidia,tegra20-gpio"; + reg = <0x6000d000 0x1000>; + interrupts = <0 32 0x04 + 0 33 0x04 + 0 34 0x04 + 0 35 0x04 + 0 55 0x04 + 0 87 0x04 + 0 89 0x04>; + #gpio-cells = <2>; + gpio-controller; + #interrupt-cells = <2>; + interrupt-controller; + }; + pmc { compatible = "nvidia,tegra20-pmc"; reg = <0x7000e400 0x400>;arch/arm/mach-tegra/include/mach/gpio.h new file +1
-0@@ -0,0 +1 @@ +#include <asm-generic/gpio.h> drivers/gpio/Kconfig +7
-0@@ -36,6 +36,13 @@ config GPIO_PL061 config GPIO_STMPE depends on MFD_STMPE bool "STMPE GPIO Expander" + +config GPIO_TEGRA + bool "GPIO support for the Tegra SoCs" + depends on ARCH_TEGRA + help + Say yes here to include the driver for the GPIO controller found on the + Tegra line of SoCs. endmenu endifdrivers/gpio/Makefile +1
-0@@ -4,3 +4,4 @@ obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o obj-$(CONFIG_GPIO_GENERIC) += gpio-generic.o obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o +obj-$(CONFIG_GPIO_TEGRA) += gpio-tegra.odrivers/gpio/gpio-tegra.c new file +179
-0@@ -0,0 +1,226 @@ +/* * +* Copyright (C) 2010 Erik Gilling <[email protected]>, Google, Inc +* Copyright (C) 2013 Lucas Stach <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <common.h> +#include <gpio.h> +#include <init.h> +#include <io.h> +#include <linux/err.h> + +#define GPIO_BANK (x) ((x) >> 5) +#define GPIO_PORT (x) (((x) >> 3) & 0x3) +#define GPIO_BIT (x) ((x) & 0x7) + +#define GPIO_REG (x) (GPIO_BANK(x) * config->bank_stride + \ + GPIO_PORT(x) * 4) + +#define GPIO_CNF (x) (GPIO_REG(x) + 0x00) +#define GPIO_OE (x) (GPIO_REG(x) + 0x10) +#define GPIO_OUT (x) (GPIO_REG(x) + 0x20) +#define GPIO_IN (x) (GPIO_REG(x) + 0x30) +#define GPIO_INT_ENB (x) (GPIO_REG(x) + 0x50) + +#define GPIO_MSK_CNF (x) (GPIO_REG(x) + config->upper_offset + 0x00) +#define GPIO_MSK_OE (x) (GPIO_REG(x) + config->upper_offset + 0x10) +#define GPIO_MSK_OUT (x) (GPIO_REG(x) + config->upper_offset + 0X20) + +struct tegra_gpio_bank { +int bank; +int irq; +}; + +struct tegra_gpio_soc_config { +u32 bank_stride; +u32 upper_offset; +u32 bank_count; +}; + +static void __iomem *gpio_base; +static struct tegra_gpio_soc_config *config; + +static inline void tegra_gpio_writel (u32 val,u32 reg) +{ +writel (val, gpio_base + reg); +} + +static inline u32 tegra_gpio_readl (u32 reg) +{ +return readl (gpio_base + reg); +} + +static int tegra_gpio_compose (int bank,int port,int bit) +{ +return (bank <<5 ) | ((port &0x3 ) <<3 ) | (bit &0x7 ); +} + +static void tegra_gpio_mask_write (u32 reg,int gpio,int value) +{ +u32 val; + + val =0x100 <<GPIO_BIT (gpio); +if (value) + val |=1 <<GPIO_BIT (gpio); +tegra_gpio_writel (val, reg); +} + +static void tegra_gpio_enable (int gpio) +{ +tegra_gpio_mask_write (GPIO_MSK_CNF (gpio), gpio,1 ); +} + +static void tegra_gpio_disable (int gpio) +{ +tegra_gpio_mask_write (GPIO_MSK_CNF (gpio), gpio,0 ); +} + +static int tegra_gpio_request (struct gpio_chip *chip,unsigned offset) +{ +return 0 ; +} + +static void tegra_gpio_free (struct gpio_chip *chip,unsigned offset) +{ +tegra_gpio_disable (offset); +} + +static void tegra_gpio_set (struct gpio_chip *chip,unsigned offset,int value) +{ +tegra_gpio_mask_write (GPIO_MSK_OUT (offset), offset, value); +} + +static int tegra_gpio_get (struct gpio_chip *chip,unsigned offset) +{ +/* If gpio is in output mode then read from the out value */ +if ((tegra_gpio_readl (GPIO_OE (offset)) >>GPIO_BIT (offset)) &1 ) { +printf ("GPIO output mode\n" ); +return (tegra_gpio_readl (GPIO_OUT (offset)) >> +GPIO_BIT (offset)) &0x1 ; + } + +printf ("GPIO input mode\n" ); +return (tegra_gpio_readl (GPIO_IN (offset)) >>GPIO_BIT (offset)) &0x1 ; +} + +static int tegra_gpio_direction_input (struct gpio_chip *chip,unsigned offset) +{ +tegra_gpio_mask_write (GPIO_MSK_OE (offset), offset,0 ); +tegra_gpio_enable (offset); +return 0 ; +} + +static int tegra_gpio_direction_output (struct gpio_chip *chip,unsigned offset, +int value) +{ +tegra_gpio_set (chip, offset, value); +tegra_gpio_mask_write (GPIO_MSK_OE (offset), offset,1 ); +tegra_gpio_enable (offset); +return 0 ; +} + +static struct gpio_ops tegra_gpio_ops = { + .request = tegra_gpio_request, + .free = tegra_gpio_free, + .direction_input = tegra_gpio_direction_input, + .direction_output = tegra_gpio_direction_output, + .get = tegra_gpio_get, + .set = tegra_gpio_set, +}; + +static struct gpio_chip tegra_gpio_chip = { + .ops = &tegra_gpio_ops, + .base =0 , +}; + +static int tegra_gpio_probe (struct device_d *dev) +{ +int i, j, ret; + + ret =dev_get_drvdata (dev, (unsigned long *)&config); +if (ret) { +dev_err (dev,"dev_get_drvdata failed: %d\n" , ret); +return ret; + } + + gpio_base =dev_request_mem_region (dev,0 ); +if (!gpio_base) { +dev_err (dev,"could not get memory region\n" ); +return -ENODEV ; + } + +for (i =0 ; i < config->bank_count; i++) { +for (j =0 ; j <4 ; j++) { +int gpio =tegra_gpio_compose (i, j,0 ); +tegra_gpio_writel (0x00 ,GPIO_INT_ENB (gpio)); + } + } + + tegra_gpio_chip.ngpio = config->bank_count *32 ; + tegra_gpio_chip.dev = dev; + +gpiochip_add (&tegra_gpio_chip); + +return 0 ; +} + +static struct tegra_gpio_soc_config tegra20_gpio_config = {
drivers/gpio/gpio-tegra.c line 189
Quoted 10 lines
drivers/gpio/gpio-tegra.c new file +10
-0+ .bank_stride = 0x80, + .upper_offset = 0x800, + .bank_count = 7, +}; + +static struct tegra_gpio_soc_config tegra30_gpio_config = { + .bank_stride =0x100 , + .upper_offset =0x80 , + .bank_count =8 , +};
Hmmm, tegra30 support here... But we don't have tegra30 boards yet.
drivers/gpio/gpio-tegra.c line 197
Quoted 8 lines
drivers/gpio/gpio-tegra.c new file +8
-0+ +static struct platform_device_id tegra_gpio_ids[] = { + { + .name ="tegra20-gpio" , + .driver_data = (unsigned long )&tegra20_gpio_config, + }, { + .name ="tegra30-gpio" , + .driver_data = (unsigned long )&tegra30_gpio_config,
and here ...
drivers/gpio/gpio-tegra.c line 207
Quoted 10 lines
drivers/gpio/gpio-tegra.c new file +10
-0+ }, { +/* sentinel */ + }, +}; + +static __maybe_unused struct of_device_id tegra_gpio_dt_ids[] = { + { + .compatible ="nvidia,tegra30-gpio" , + .data = (unsigned long )&tegra30_gpio_config + }, {
and here.
Quoted 22 lines
drivers/gpio/gpio-tegra.c new file +19
-0+ .compatible = "nvidia,tegra20-gpio", + .data = (unsigned long)&tegra20_gpio_config + }, { +/* sentinel */ + }, +}; + +static struct driver_d tegra_gpio_driver = { + .name ="tegra-gpio" , + .id_table = tegra_gpio_ids, + .of_compatible =DRV_OF_COMPAT (tegra_gpio_dt_ids), + .probe = tegra_gpio_probe, +}; + +static int __init tegra_gpio_init (void ) +{ +return platform_driver_register (&tegra_gpio_driver); +} +coredevice_initcall (tegra_gpio_init);Signature · 1 line
1.8.1.4
Signature · 8 lines
-- Best regards, Antony Pavlov _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox