Lowlevel Tegra3 support
Subsystems (4)
cover Lowlevel Tegra3 support
This is the very basic Tegra3 support. All highlevel things like pinmux and other drivers still missing.
Allows to start the high performance CPU cluster on Tegra3 and start executing code there.
Lucas Stach (7):
tegra: add -fno-jump-tables to lowlevel code
tegra: add break to switch statements
tegra: add lowlevel delay function
tegra: add Tegra3 to relevant lowlevel functions
tegra: add lowlevel DVC
tegra: set AHB clock rate early
tegra: add Tegra3 startup
arch/arm/mach-tegra/Makefile | 4 +- arch/arm/mach-tegra/include/mach/lowlevel-dvc.h | 71 +++++++++++++++++++++++++ arch/arm/mach-tegra/include/mach/lowlevel.h | 68 ++++++++++++++++++++++- arch/arm/mach-tegra/include/mach/tegra20-car.h | 12 +++++ arch/arm/mach-tegra/include/mach/tegra30-car.h | 31 +++++++++++ arch/arm/mach-tegra/include/mach/tegra30-flow.h | 23 ++++++++ arch/arm/mach-tegra/tegra_avp_init.c | 46 +++++++++++++++- 7 files changed, 251 insertions(+), 4 deletions(-) create mode 100644 arch/arm/mach-tegra/include/mach/lowlevel-dvc.h create mode 100644 arch/arm/mach-tegra/include/mach/tegra30-car.h create mode 100644 arch/arm/mach-tegra/include/mach/tegra30-flow.h
Signature · 7 lines
1.8.5.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/7 tegra: add -fno-jump-tables to lowlevel code
Lowlevel code runs when not relocated yet, so we have to make extra sure not to emit jump-tables with absolute adresses when evaluating switch statements.
--- arch/arm/mach-tegra/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-tegra/Makefile +2 -2
@@ -1,5 +1,5 @@ -CFLAGS_tegra_avp_init.o := -mcpu=arm7tdmi -march=armv4t -CFLAGS_pbl-tegra_avp_init.o := -mcpu=arm7tdmi -march=armv4t +CFLAGS_tegra_avp_init.o := -mcpu=arm7tdmi -march=armv4t -fno-jump-tables +CFLAGS_pbl-tegra_avp_init.o := -mcpu=arm7tdmi -march=armv4t -fno-jump-tables lwl-y += tegra_avp_init.o lwl-y += tegra_maincomplex_init.o obj-y += tegra20.o
Signature · 7 lines
1.8.5.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/7 tegra: add break to switch statements
In reply to Lucas StachAvoids a possible miscompilation.
--- arch/arm/mach-tegra/include/mach/lowlevel.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/mach-tegra/include/mach/lowlevel.h +10 -0
@@ -73,8 +73,10 @@ enum tegra_chiptype tegra_get_chiptype(void)switch ((hidrev &HIDREV_CHIPID_MASK ) >>HIDREV_CHIPID_SHIFT ) {case 0x20 :return TEGRA20 ; +break ;default :return TEGRA_UNK_REV ; +break ; } }
@@ -109,11 +111,14 @@ uint32_t tegra20_get_ramsize(void) T20_ODMDATA_RAMSIZE_SHIFT) {case 1 :return SZ_256M ; +break ;default :case 2 :return SZ_512M ; +break ;case 3 :return SZ_1G ; +break ; } }
@@ -161,14 +166,19 @@ int tegra_get_osc_clock(void) CRC_OSC_CTRL_OSC_FREQ_SHIFT) {case 0 :return 13000000 ; +break ;case 1 :return 19200000 ; +break ;case 2 :return 12000000 ; +break ;case 3 :return 26000000 ; +break ;default :return 0 ; +break ; } }
Signature · 7 lines
1.8.5.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/7] tegra: add break to switch statements
Quoted 12 lines · Lucas Stach
Avoids a possible miscompilation.
Signed-off-by Lucas Stach <[email protected]>--- arch/arm/mach-tegra/include/mach/lowlevel.h | 10 ++++++++++ 1 file changed, 10 insertions(+)arch/arm/mach-tegra/include/mach/lowlevel.h +0
-0
arch/arm/mach-tegra/include/mach/lowlevel.h enum tegra_chiptype tegra_get_chiptype(void) · line 79
Quoted 7 lines
arch/arm/mach-tegra/include/mach/lowlevel.h +2
-0@@ -73,8 +73,10 @@ enum tegra_chiptype tegra_get_chiptype(void)switch ((hidrev &HIDREV_CHIPID_MASK ) >>HIDREV_CHIPID_SHIFT ) {case 0x20 :return TEGRA20 ; +break ;default :return TEGRA_UNK_REV ; +break ;
What kind of miscompilation other than a compiler bug are you thinking of? Have you seen that this patch changes anything?
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 2/7] tegra: add break to switch statements
Am Montag, den 17.02.2014, 07:53 +0100 schrieb Sascha Hauer:
Quoted 8 lines · Lucas Stach
Quoted 7 lines
Avoids a possible miscompilation.
Signed-off-by Lucas Stach <[email protected]>--- arch/arm/mach-tegra/include/mach/lowlevel.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
Quoted 16 lines
arch/arm/mach-tegra/include/mach/lowlevel.h enum tegra_chiptype tegra_get_chiptype(void) · line 79
Quoted 12 lines
arch/arm/mach-tegra/include/mach/lowlevel.h +2
-0@@ -73,8 +73,10 @@ enum tegra_chiptype tegra_get_chiptype(void)switch ((hidrev &HIDREV_CHIPID_MASK ) >>HIDREV_CHIPID_SHIFT ) {case 0x20 :return TEGRA20 ; +break ;default :return TEGRA_UNK_REV ; +break ;What kind of miscompilation other than a compiler bug are you thinking of? Have you seen that this patch changes anything?
I have to admit that I haven't investigated the issue closely, but this actually makes the difference between working and nonworking when adding in the Tegra3 case later on.
Signature · 10 lines
Pengutronix e.K. | Lucas Stach | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5076 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/7 tegra: add lowlevel delay function
In reply to Lucas StachFor proper startup we need to give clocks and IO signals some time to stabilize. Tegra2 got away without them, but Tegra3 seems to be a bit pickier.
--- arch/arm/mach-tegra/include/mach/lowlevel.h | 44 +++++++++++++++++++++++++++++ arch/arm/mach-tegra/tegra_avp_init.c | 5 ++++ 2 files changed, 49 insertions(+)
arch/arm/mach-tegra/include/mach/lowlevel.h +44 -0
@@ -182,6 +182,49 @@ int tegra_get_osc_clock(void) } } +#define TIMER_CNTR_1US 0x00 +#define TIMER_USEC_CFG 0x04 + +static inline __attribute__((always_inline)) +void tegra_ll_delay_setup (void ) +{ +u32 reg; + +/* +* calibrate timer to run at 1MHz +* TIMERUS_USEC_CFG selects the scale down factor with bits [0:7] +* representing the divisor and bits [8:15] representing the dividend +* each in n+1 form. +*/ +switch (tegra_get_osc_clock ()) { +case 12000000 : + reg =0x000b ; +break ; +case 13000000 : + reg =0x000c ; +break ; +case 19200000 : + reg =0x045f ; +break ; +case 26000000 : + reg =0x0019 ; +break ; +default : + reg =0 ; +break ; + } + +writel (reg,TEGRA_TMRUS_BASE +TIMER_USEC_CFG ); +} + +static inline __attribute__((always_inline)) +void tegra_ll_delay_usec (int delay) +{ +int timeout = (int )readl (TEGRA_TMRUS_BASE +TIMER_CNTR_1US ) + delay; + +while ((int )readl (TEGRA_TMRUS_BASE +TIMER_CNTR_1US ) - timeout <0 ); +} +static inline __attribute__((always_inline))void tegra_cpu_lowlevel_setup (void ) {
@@ -192,6 +235,7 @@ void tegra_cpu_lowlevel_setup(void) r &= ~0x1f ; r |=0xd3 ; __asm__ __volatile__("msr cpsr, %0" : :"r" (r)); +tegra_ll_delay_setup (); }/* reset vector for the AVP, to be called from board reset vector */
arch/arm/mach-tegra/tegra_avp_init.c +5 -0
@@ -158,6 +158,9 @@ static void start_cpu0_clocks(void) reg =readl (TEGRA_CLK_RESET_BASE +CRC_CLK_OUT_ENB_L ); reg |=CRC_CLK_OUT_ENB_L_CPU ;writel (reg,TEGRA_CLK_RESET_BASE +CRC_CLK_OUT_ENB_L ); + +/* give clocks some time to settle */ +tegra_ll_delay_usec (300 ); }static void maincomplex_powerup (void )
@@ -175,6 +178,8 @@ static void maincomplex_powerup(void) reg =readl (TEGRA_PMC_BASE +PMC_REMOVE_CLAMPING_CMD ); reg |=PMC_REMOVE_CLAMPING_CMD_CPU ;writel (reg,TEGRA_PMC_BASE +PMC_REMOVE_CLAMPING_CMD ); + +tegra_ll_delay_usec (1000 ); } }void tegra_avp_reset_vector (uint32_t boarddata)
Signature · 7 lines
1.8.5.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 4/7 tegra: add Tegra3 to relevant lowlevel functions
In reply to Lucas Stach--- arch/arm/mach-tegra/include/mach/lowlevel.h | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/mach-tegra/include/mach/lowlevel.h +7 -0
@@ -61,6 +61,7 @@ u32 tegra_get_odmdata(void)enum tegra_chiptype {TEGRA_UNK_REV =-1 ,TEGRA20 =0 , +TEGRA30 =1 , }; static inline __attribute__((always_inline))
@@ -74,6 +75,9 @@ enum tegra_chiptype tegra_get_chiptype(void)case 0x20 :return TEGRA20 ;break ; +case 0x30 : +return TEGRA30 ; +break ;default :return TEGRA_UNK_REV ;break ;
@@ -87,6 +91,9 @@ int tegra_get_num_cores(void)case TEGRA20 :return 2 ;break ; +case TEGRA30 : +return 4 ; +break ;default :return 0 ;break ;
Signature · 7 lines
1.8.5.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 5/7 tegra: add lowlevel DVC
In reply to Lucas StachAllows to talk to external PMIC devices to bring up CPU rail.
--- arch/arm/mach-tegra/include/mach/lowlevel-dvc.h | 71 +++++++++++++++++++++++++ arch/arm/mach-tegra/include/mach/lowlevel.h | 7 ++- arch/arm/mach-tegra/include/mach/tegra20-car.h | 8 +++ 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-tegra/include/mach/lowlevel-dvc.h
arch/arm/mach-tegra/include/mach/lowlevel-dvc.h new file +71 -0
@@ -0,0 +1,71 @@ +/* +* Copyright (C) 2014 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 "mach/tegra20-car.h" +#include "mach/lowlevel.h" + +static inline __attribute__((always_inline)) +void tegra_dvc_init (void ) +{ +int div; +u32 reg; + +/* reset DVC controller and enable clock */ +writel (CRC_RST_DEV_H_DVC ,TEGRA_CLK_RESET_BASE +CRC_RST_DEV_H_SET ); + reg =readl (TEGRA_CLK_RESET_BASE +CRC_CLK_OUT_ENB_H ); + reg |=CRC_CLK_OUT_ENB_H_DVC ; +writel (reg,TEGRA_CLK_RESET_BASE +CRC_CLK_OUT_ENB_H ); + +/* set DVC I2C clock source to CLK_M and aim for 100kHz I2C clock */ + div = ((tegra_get_osc_clock () *3 ) >>22 ) -1 ; +writel ((div) | (3 <<30 ), +TEGRA_CLK_RESET_BASE +CRC_CLK_SOURCE_DVC ); + +/* clear DVC reset */ +tegra_ll_delay_usec (3 ); +writel (CRC_RST_DEV_H_DVC ,TEGRA_CLK_RESET_BASE +CRC_RST_DEV_H_CLR ); +} + +#define TEGRA_I2C_CNFG 0x00 +#define TEGRA_I2C_CMD_ADDR0 0x04 +#define TEGRA_I2C_CMD_DATA1 0x0c +#define TEGRA_I2C_SEND_2_BYTES 0x0a02 + +static inline __attribute__((always_inline)) +void tegra_dvc_write_addr (u32 addr,u32 config) +{ +writel (addr,TEGRA_DVC_BASE +TEGRA_I2C_CMD_ADDR0 ); +writel (config,TEGRA_DVC_BASE +TEGRA_I2C_CNFG ); +} + +static inline __attribute__((always_inline)) +void tegra_dvc_write_data (u32 data,u32 config) +{ +writel (data,TEGRA_DVC_BASE +TEGRA_I2C_CMD_DATA1 ); +writel (config,TEGRA_DVC_BASE +TEGRA_I2C_CNFG ); +} + +static inline __attribute__((always_inline)) +void tegra30_tps65911_cpu_rail_enable (void ) +{ +tegra_dvc_write_addr (0x5a ,2 ); +/* reg 28, 600mV + (35-3) * 12,5mV = 1,0V */ +tegra_dvc_write_data (0x2328 ,TEGRA_I2C_SEND_2_BYTES ); +tegra_ll_delay_usec (1000 ); +/* reg 27, VDDctrl enable */ +tegra_dvc_write_data (0x0127 ,TEGRA_I2C_SEND_2_BYTES ); +tegra_ll_delay_usec (3 *1000 ); +}
arch/arm/mach-tegra/include/mach/lowlevel.h +6 -1
@@ -1,5 +1,5 @@/* -* Copyright (C) 2013 Lucas Stach <[email protected]> +* Copyright (C) 2013-2014 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,
@@ -21,6 +21,9 @@* be used by both the main CPU complex (ARMv7) and the AVP (ARMv4). */ +#ifndef __TEGRA_LOWLEVEL_H +#define __TEGRA_LOWLEVEL_H +#include <sizes.h> #include <io.h> #include <mach/iomap.h>
@@ -250,3 +253,5 @@ void tegra_avp_reset_vector(uint32_t boarddata);/* reset vector for the main CPU complex */ void tegra_maincomplex_entry (void ); + +#endif /* __TEGRA_LOWLEVEL_H */
arch/arm/mach-tegra/include/mach/tegra20-car.h +8 -0
@@ -46,6 +46,9 @@#define CRC_CLK_OUT_ENB_L_AC97 (1 << 3)#define CRC_CLK_OUT_ENB_L_CPU (1 << 0) +#define CRC_CLK_OUT_ENB_H 0x014 +#define CRC_CLK_OUT_ENB_H_DVC (1 << 15) +#define CRC_CCLK_BURST_POLICY 0x020#define CRC_CCLK_BURST_POLICY_SYS_STATE_SHIFT 28#define CRC_CCLK_BURST_POLICY_SYS_STATE_FIQ 8
@@ -273,6 +276,11 @@#define CRC_RST_DEV_L_CLR 0x304 +#define CRC_RST_DEV_H_SET 0x308 +#define CRC_RST_DEV_H_DVC (1 << 15) + +#define CRC_RST_DEV_H_CLR 0x30c +#define CRC_RST_CPU_CMPLX_SET 0x340#define CRC_RST_CPU_CMPLX_CLR 0x344
Signature · 7 lines
1.8.5.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 5/7] tegra: add lowlevel DVC
Quoted 28 lines · Lucas Stach
Allows to talk to external PMIC devices to bring up CPU rail.
Signed-off-by Lucas Stach <[email protected]>--- arch/arm/mach-tegra/include/mach/lowlevel-dvc.h | 71 +++++++++++++++++++++++++ arch/arm/mach-tegra/include/mach/lowlevel.h | 7 ++- arch/arm/mach-tegra/include/mach/tegra20-car.h | 8 +++ 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-tegra/include/mach/lowlevel-dvc.harch/arm/mach-tegra/include/mach/lowlevel-dvc.h new file +12
-0@@ -0,0 +1,71 @@ +/* +* Copyright (C) 2014 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. +*
arch/arm/mach-tegra/include/mach/lowlevel-dvc.h line 22
Quoted 10 lines
arch/arm/mach-tegra/include/mach/lowlevel-dvc.h new file +10
-0+* 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 "mach/tegra20-car.h" +#include "mach/lowlevel.h" + +static inline __attribute__((always_inline)) +void tegra_dvc_init (void ) +{
We have a __always_inline define. You should probably use it.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 6/7 tegra: set AHB clock rate early
In reply to Lucas StachAvoids glitches in later starup phases.
--- arch/arm/mach-tegra/include/mach/tegra20-car.h | 4 ++++ arch/arm/mach-tegra/tegra_avp_init.c | 3 +++ 2 files changed, 7 insertions(+)
arch/arm/mach-tegra/include/mach/tegra20-car.h +4 -0
@@ -112,6 +112,10 @@#define CRC_SUPER_SDIV_DIVISOR_SHIFT 0#define CRC_SUPER_SDIV_DIVISOR_MASK (0xff << CRC_SUPER_SDIV_DIVISOR_SHIFT) +#define CRC_CLK_SYSTEM_RATE 0x030 +#define CRC_CLK_SYSTEM_RATE_AHB_SHIFT 4 +#define CRC_CLK_SYSTEM_RATE_APB_SHIFT 0 +#define CRC_CLK_CPU_CMPLX 0x04c#define CRC_CLK_CPU_CMPLX_CPU3_CLK_STP (1 << 11)#define CRC_CLK_CPU_CMPLX_CPU2_CLK_STP (1 << 10)
arch/arm/mach-tegra/tegra_avp_init.c +3 -0
@@ -149,6 +149,9 @@ static void start_cpu0_clocks(void) TEGRA_CLK_RESET_BASE + CRC_SCLK_BURST_POLICY);writel (CRC_SUPER_SDIV_ENB ,TEGRA_CLK_RESET_BASE +CRC_SUPER_SCLK_DIV ); +writel (1 <<CRC_CLK_SYSTEM_RATE_AHB_SHIFT , +TEGRA_CLK_RESET_BASE +CRC_CLK_SYSTEM_RATE ); +/* deassert clock stop for cpu 0 */ reg =readl (TEGRA_CLK_RESET_BASE +CRC_CLK_CPU_CMPLX ); reg &= ~CRC_CLK_CPU_CMPLX_CPU0_CLK_STP ;
Signature · 7 lines
1.8.5.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 7/7 tegra: add Tegra3 startup
In reply to Lucas StachSets up MSELECT to let main CPUs talk to peripheral devices and starts high performance A9 CPU cluster.
--- arch/arm/mach-tegra/include/mach/tegra30-car.h | 31 ++++++++++++++++++++ arch/arm/mach-tegra/include/mach/tegra30-flow.h | 23 +++++++++++++++ arch/arm/mach-tegra/tegra_avp_init.c | 38 ++++++++++++++++++++++++- 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-tegra/include/mach/tegra30-car.h create mode 100644 arch/arm/mach-tegra/include/mach/tegra30-flow.h
arch/arm/mach-tegra/include/mach/tegra30-car.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* Copyright (C) 2014 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_CLK_OUT_ENB_V 0x360 +#define CRC_CLK_OUT_ENB_V_MSELECT (1 << 3) + +#define CRC_CLK_SOURCE_MSEL 0x3b4 +#define CRC_CLK_SOURCE_MSEL_SRC_SHIFT 30 +#define CRC_CLK_SOURCE_MSEL_SRC_PLLP 0 +#define CRC_CLK_SOURCE_MSEL_SRC_PLLC 1 +#define CRC_CLK_SOURCE_MSEL_SRC_PLLM 2 +#define CRC_CLK_SOURCE_MSEL_SRC_CLKM 3 + +#define CRC_RST_DEV_V_SET 0x430 +#define CRC_RST_DEV_V_MSELECT (1 << 3) + +#define CRC_RST_DEV_V_CLR 0x434
arch/arm/mach-tegra/include/mach/tegra30-flow.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* Copyright (C) 2014 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/>. +*/ + +#define FLOW_HALT_CPU_EVENTS 0x000 +#define FLOW_MODE_NONE 0 +#define FLOW_MODE_STOP 2 + +#define FLOW_CLUSTER_CONTROL 0x02c +#define FLOW_CLUSTER_CONTROL_ACTIVE_G (0 << 0) +#define FLOW_CLUSTER_CONTROL_ACTIVE_LP (1 << 0)
arch/arm/mach-tegra/tegra_avp_init.c +37 -1
@@ -1,5 +1,5 @@/* -* Copyright (C) 2013 Lucas Stach <[email protected]> +* Copyright (C) 2013-2014 Lucas Stach <[email protected]> * * Partly based on code (C) Copyright 2010-2011 * NVIDIA Corporation <www.nvidia.com>
@@ -23,6 +23,8 @@#include <mach/lowlevel.h> #include <mach/tegra20-car.h> #include <mach/tegra20-pmc.h> +#include <mach/tegra30-car.h> +#include <mach/tegra30-flow.h> /* instruct the PMIC to enable the CPU power rail */ static void enable_maincomplex_powerrail (void )
@@ -84,6 +86,12 @@ static struct pll_config pllx_config_table[][4] = { {1000, 12, 0, 12}, /* OSC 12.0 MHz */ {1000, 26, 0, 12}, /* OSC 26.0 MHz */ }, /* TEGRA 20 */ + { + {862, 8, 0, 8}, + {583, 8, 0, 4}, + {700, 6, 0, 8}, + {700, 13, 0, 8}, + }, /* TEGRA 30 */ };static void init_pllx (void )
@@ -152,6 +160,20 @@ static void start_cpu0_clocks(void)writel (1 <<CRC_CLK_SYSTEM_RATE_AHB_SHIFT ,TEGRA_CLK_RESET_BASE +CRC_CLK_SYSTEM_RATE ); +if (tegra_get_chiptype () >=TEGRA30 ) { +/* init MSELECT */ +writel (CRC_RST_DEV_V_MSELECT , +TEGRA_CLK_RESET_BASE +CRC_RST_DEV_V_SET ); +writel ((CRC_CLK_SOURCE_MSEL_SRC_PLLP << +CRC_CLK_SOURCE_MSEL_SRC_SHIFT ) |2 , +TEGRA_CLK_RESET_BASE +CRC_CLK_SOURCE_MSEL ); +writel (CRC_CLK_OUT_ENB_V_MSELECT , +TEGRA_CLK_RESET_BASE +CRC_CLK_OUT_ENB_V ); +tegra_ll_delay_usec (3 ); +writel (CRC_RST_DEV_V_MSELECT , +TEGRA_CLK_RESET_BASE +CRC_RST_DEV_V_CLR ); + } +/* deassert clock stop for cpu 0 */ reg =readl (TEGRA_CLK_RESET_BASE +CRC_CLK_CPU_CMPLX ); reg &= ~CRC_CLK_CPU_CMPLX_CPU0_CLK_STP ;
@@ -185,10 +207,24 @@ static void maincomplex_powerup(void)tegra_ll_delay_usec (1000 ); } } + +static void tegra_cluster_switch_hp (void ) +{ +u32 reg; + + reg =readl (TEGRA_FLOW_CTRL_BASE +FLOW_CLUSTER_CONTROL ); + reg &= ~FLOW_CLUSTER_CONTROL_ACTIVE_LP ; +writel (reg,TEGRA_FLOW_CTRL_BASE +FLOW_CLUSTER_CONTROL ); +} +void tegra_avp_reset_vector (uint32_t boarddata) {int num_cores; +/* we want to bring up the high performance CPU complex */ +if (tegra_get_chiptype () ==TEGRA30 ) +tegra_cluster_switch_hp (); +/* get the number of cores in the main CPU complex of the current SoC */ num_cores =tegra_get_num_cores ();
Signature · 7 lines
1.8.5.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox