Skip to contentSkip to conversation

Tegra: Configure L2 cache control reg properly.

PATCH New Tom Warren 2 participants 3 messages Mar 29, 2013

Subsystems (2)
lore
Share & tools
lore

Tom Warren

author
#0 lore raw

PATCH 1/1 Tegra: Configure L2 cache control reg properly.

Without this change, kernel fails at calling function cache_clean_flush during kernel early boot.

Aprocryphally, intended for T114 only, so I check for a T114 SoC. Works (i.e. dalmore 3.8 kernel now starts printing to console).

---
 arch/arm/cpu/tegra-common/Makefile   |  2 +-
 arch/arm/cpu/tegra-common/ap.c       |  9 ++-----
 arch/arm/cpu/tegra-common/cache.c    | 48 ++++++++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-tegra/ap.h |  1 +
 4 files changed, 52 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/cpu/tegra-common/cache.c
arch/arm/cpu/tegra-common/Makefile +1 -1
index 8e95c7e..4e0301c 100644
@@ -28,7 +28,7 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)libcputegra-common.o
 
 SOBJS += lowlevel_init.o
-COBJS-y	+= ap.o board.o sys_info.o timer.o clock.o
+COBJS-y	+= ap.o board.o sys_info.o timer.o clock.o cache.o
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
 OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
arch/arm/cpu/tegra-common/ap.c +2 -7
index 3f30805..a739fe2 100644
@@ -139,11 +139,6 @@ void s_init(void)
 
 	enable_scu();
 
-	/* enable SMP mode and FW for CPU0, by writing to Auxiliary Ctl reg */
-	asm volatile(
-		"mrc	p15, 0, r0, c1, c0, 1\n"
-		"orr	r0, r0, #0x41\n"
-		"mcr	p15, 0, r0, c1, c0, 1\n");
-
-	/* FIXME: should have SoC's L2 disabled too? */
+	/* init the cache */
+	config_cache();
 }
arch/arm/cpu/tegra-common/cache.c new file +48 -0

48 lines not on this page · raw message

arch/arm/include/asm/arch-tegra/ap.h +1 -0
index 73dfd39..5999f55 100644
@@ -64,3 +64,4 @@ extern void _start(void);
  * @return	SOC type - see TEGRA_SOC...
  */
 int tegra_get_chip_type(void);
+void config_cache(void);
Signature · 1 line
1.8.1.5
#1 lore raw

PATCH 1/1 Tegra: Configure L2 cache control reg properly.

Quoted 5 lines · Tom Warren

Without this change, kernel fails at calling function cache_clean_flush during kernel early boot.

Aprocryphally, intended for T114 only, so I check for a T114 SoC. Works (i.e. dalmore 3.8 kernel now starts printing to console).

I don't know enough about the caches to really review this, but I have no particular objection to it. My one comment is ...

arch/arm/cpu/tegra-common/cache.c line 39

Quoted 8 lines
arch/arm/cpu/tegra-common/cache.c +5 -0
 
+void config_cache(void)
 
+	/* Currently, only T114 needs this L2 cache change to boot Linux */
+	reg = (readl(&gp->hidrev) & HIDREV_CHIPID_MASK);
+	if (reg != (CHIPID_TEGRA114 << HIDREV_CHIPID_SHIFT))
+		return;

Can we introduce a standard function for that instead? We already have tegra_get_chip_type() which returns a SKU-based ID. I think we need to introduce a tegra_get_soc_type() that returns a pure Tegra20/30/114 value, and probably use this in most places we currently use the result of tegra_get_chip_type(), since most care about SW-compatibility of features rather than SKU which drivers performance levels instead typically. Then, perhaps rename tegra_get_chip_type() to tegra_get_soc_sku() and re-write it to use tegra_get_soc_type()?

author
#2 lore raw

PATCH 1/1 Tegra: Configure L2 cache control reg properly.

Stephen,

Quoted 20 lines · Stephen Warren
Quoted 5 lines · Tom Warren

Without this change, kernel fails at calling function cache_clean_flush during kernel early boot.

Aprocryphally, intended for T114 only, so I check for a T114 SoC. Works (i.e. dalmore 3.8 kernel now starts printing to console).

I don't know enough about the caches to really review this, but I have no particular objection to it. My one comment is ...

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/cpu/tegra-common/cache.c

arch/arm/cpu/tegra-common/cache.c line 39

Quoted 6 lines
arch/arm/cpu/tegra-common/cache.c new file +5 -0
+void config_cache(void)
 
+     /* Currently, only T114 needs this L2 cache change to boot Linux */
+     reg = (readl(&gp->hidrev) & HIDREV_CHIPID_MASK);
+     if (reg != (CHIPID_TEGRA114 << HIDREV_CHIPID_SHIFT))
+             return;
Quoted 9 lines

Can we introduce a standard function for that instead? We already have tegra_get_chip_type() which returns a SKU-based ID. I think we need to introduce a tegra_get_soc_type() that returns a pure Tegra20/30/114 value, and probably use this in most places we currently use the result of tegra_get_chip_type(), since most care about SW-compatibility of features rather than SKU which drivers performance levels instead typically. Then, perhaps rename tegra_get_chip_type() to tegra_get_soc_sku() and re-write it to use tegra_get_soc_type()?

I can do that, but I'd prefer to do it as a separate patch since tegra_get_chip_type is used in a few other places.

This patch is needed by a customer to get their kernel loading (or at least past the 'Decompressing Linux...' part). I'll correct this patch later to use tegra_get_soc_type().

Thanks,

Tom