Add basic support for Telechips TCC8xxx SoCs
Subsystems (2)
cover Add basic support for Telechips TCC8xxx SoCs
Telechips' TCC8xxx SoCs are ARM9-based processors, mainly for automotive and multimedia applications. I'll reply to this mail with a series of 7 patches that implement basic support for these chips.
These patches were tested on a Telechips-TCC8000-SDK development board. Support for this board is also included.
I've also got drivers for some on-chip peripherals (UART, MMC, NAND, USB host and gadget). I'll post these in a second step. Board support is already prepared to use them.
@Russell: Do you want me to post the drivers on linux-arm-kernel, or on the appropriate subsystem mailing list?
The whole tree is also available here:
git://git.linutronix.de/users/hjk/linux-tcc.git
The "devel" branch contains all I've got ATM, including experimental stuff not yet ready for mainline.
@Russell: As soon as the review process stabilizes, I can set up a "for-rmk" branch, if that's what you wish.
Thanks,
Hans
PATCH 1/7 Introduce plat-tcc
This patch introduces support for the tcc platform by creating an arch/arm/plat-tcc and arch/arm/mach-tcc8k directories and adding basic include files plus Kconfig and Makefile.
--- arch/arm/Kconfig | 11 + arch/arm/Makefile | 2 + arch/arm/mach-tcc8k/Kconfig | 5 + arch/arm/plat-tcc/Kconfig | 20 + arch/arm/plat-tcc/Makefile | 3 + arch/arm/plat-tcc/include/mach/debug-macro.S | 33 + arch/arm/plat-tcc/include/mach/entry-macro.S | 69 ++ arch/arm/plat-tcc/include/mach/hardware.h | 43 ++ arch/arm/plat-tcc/include/mach/memory.h | 29 + arch/arm/plat-tcc/include/mach/system.h | 31 + arch/arm/plat-tcc/include/mach/tcc8k-regs.h | 855 ++++++++++++++++++++++++++ arch/arm/plat-tcc/include/mach/uncompress.h | 32 + arch/arm/plat-tcc/include/mach/vmalloc.h | 11 + arch/arm/plat-tcc/system.c | 24 + 14 files changed, 1168 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-tcc8k/Kconfig create mode 100644 arch/arm/plat-tcc/Kconfig create mode 100644 arch/arm/plat-tcc/Makefile create mode 100644 arch/arm/plat-tcc/include/mach/debug-macro.S create mode 100644 arch/arm/plat-tcc/include/mach/entry-macro.S create mode 100644 arch/arm/plat-tcc/include/mach/hardware.h create mode 100644 arch/arm/plat-tcc/include/mach/memory.h create mode 100644 arch/arm/plat-tcc/include/mach/system.h create mode 100644 arch/arm/plat-tcc/include/mach/tcc8k-regs.h create mode 100644 arch/arm/plat-tcc/include/mach/uncompress.h create mode 100644 arch/arm/plat-tcc/include/mach/vmalloc.h create mode 100644 arch/arm/plat-tcc/system.c
arch/arm/Kconfig +11 -0
@@ -723,6 +723,15 @@ config ARCH_SHARK Support for the StrongARM based Digital DNARD machine, also known as "Shark" (<http://www.shark-linux.de/shark.html>). +config ARCH_TCC_926 + bool "Telechips TCC ARM926-based systems" + select CPU_ARM926T + select HAVE_CLK + select COMMON_CLKDEV + select GENERIC_CLOCKEVENTS + help + Support for Telechips TCC ARM926-based systems. + config ARCH_LH7A40X bool "Sharp LH7A40X" select CPU_ARM922T
@@ -887,6 +896,8 @@ source "arch/arm/plat-s3c24xx/Kconfig" source "arch/arm/plat-s5p/Kconfig" source "arch/arm/plat-s5pc1xx/Kconfig" +source "arch/arm/plat-tcc/Kconfig" + if ARCH_S3C2410 source "arch/arm/mach-s3c2400/Kconfig" source "arch/arm/mach-s3c2410/Kconfig"
arch/arm/Makefile +2 -0
@@ -172,6 +172,7 @@ machine-$(CONFIG_ARCH_SHARK) := shark machine-$(CONFIG_ARCH_SHMOBILE) := shmobile machine-$(CONFIG_ARCH_STMP378X) := stmp378x machine-$(CONFIG_ARCH_STMP37XX) := stmp37xx +machine-$(CONFIG_ARCH_TCC8K) := tcc8k machine-$(CONFIG_ARCH_U300) := u300 machine-$(CONFIG_ARCH_U8500) := ux500 machine-$(CONFIG_ARCH_VERSATILE) := versatile
@@ -192,6 +193,7 @@ plat-$(CONFIG_PLAT_PXA) := pxa plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx samsung plat-$(CONFIG_PLAT_S5PC1XX) := s5pc1xx samsung plat-$(CONFIG_PLAT_S5P) := s5p samsung +plat-$(CONFIG_ARCH_TCC_926) := tcc ifeq ($(CONFIG_ARCH_EBSA110),y) # This is what happens if you forget the IOCS16 line.
arch/arm/mach-tcc8k/Kconfig new file +5 -0
@@ -0,0 +1,5 @@ +if ARCH_TCC8K + +comment "TCC8000 systems:" + +endif
arch/arm/plat-tcc/Kconfig new file +20 -0
@@ -0,0 +1,20 @@ +if ARCH_TCC_926 + +menu "Telechips ARM926-based CPUs" + +choice + prompt "Telechips CPU type:" + default ARCH_TCC8K + +config ARCH_TCC8K + bool TCC8000 + select USB_ARCH_HAS_OHCI + help + Support for Telechips TCC8000 systems + +endchoice + +source "arch/arm/mach-tcc8k/Kconfig" + +endmenu +endif
arch/arm/plat-tcc/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# "Telechips Platform Common Modules" + +obj-y := system.o
arch/arm/plat-tcc/include/mach/debug-macro.S new file +33 -0
@@ -0,0 +1,33 @@ +/* + * Copyright (C) 1994-1999 Russell King + * Copyright (C) 2008-2009 Telechips + * Copyright (C) 2009 Hans J. Koch <[email protected]> + * + * 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. + * + */ + + .macro addruart,rx,tmp + mrc p15, 0, \rx, c1, c0 + tst \rx, #1 @ MMU enabled? + moveq \rx, #0x90000000 @ physical base address + movne \rx, #0xF1000000 @ virtual base + orr \rx, \rx, #0x00007000 @ UART0 + .endm + + .macro senduart,rd,rx + strb \rd, [\rx, #0x44] + .endm + + .macro waituart,rd,rx + .endm + + .macro busyuart,rd,rx +1001: + ldr \rd, [\rx, #0x14] + tst \rd, #0x20 + + beq 1001b + .endm
arch/arm/plat-tcc/include/mach/entry-macro.S new file +69 -0
69 lines not on this page · raw message
arch/arm/plat-tcc/include/mach/hardware.h new file +43 -0
43 lines not on this page · raw message
arch/arm/plat-tcc/include/mach/memory.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Based on: linux/include/asm-arm/arch-intergrator/memory.h +* Author: Greg Lonnon <[email protected]> +* Rewritten by: <[email protected]> +* Modified: June 10, 2008 +* Description: Memory map for TCC8300 +* +* Copyright (C) 1999 ARM Limited +* Copyright (C) 2000 RidgeRun, Inc. +* Copyright (C) 2008-2009 Telechips +* +* Licensed under the terms of the GPL v2. +*/ + +#ifndef __ASM_ARCH_MEMORY_H +#define __ASM_ARCH_MEMORY_H + +/* +* Physical DRAM offset. +*/ +#define PHYS_OFFSET UL(0x20000000) + +#define __virt_to_bus (x) __virt_to_phys(x) +#define __bus_to_virt (x) __phys_to_virt(x) +#define __pfn_to_bus (x) __pfn_to_phys(x) +#define __bus_to_pfn (x) __phys_to_pfn(x) + +#endif +
arch/arm/plat-tcc/include/mach/system.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* Author: <[email protected]> +* Created: June 10, 2008 +* Description: LINUX SYSTEM FUNCTIONS for TCC83x +* +* Copyright (C) 2008-2009 Telechips +* +* Licensed under the terms of the GPL v2. +* +*/ + +#ifndef __ASM_ARCH_SYSTEM_H +#define __ASM_ARCH_SYSTEM_H +#include <linux/clk.h> + +#include <asm/mach-types.h> +#include <mach/hardware.h> + +extern void plat_tcc_reboot (void ); + +static inline void arch_idle (void ) +{ +cpu_do_idle (); +} + +static inline void arch_reset (char mode,const char *cmd) +{ +plat_tcc_reboot (); +} + +#endif
arch/arm/plat-tcc/include/mach/tcc8k-regs.h new file +855 -0
855 lines not on this page · raw message
arch/arm/plat-tcc/include/mach/uncompress.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Copyright (C) 2009 Hans J. Koch <[email protected]> +* +* This file is licensed under the terms of the GPL version 2. +*/ + +#include <linux/types.h> +#include <mach/tcc8k-regs.h> + +unsigned int system_rev; + +#define ID_MASK 0x7fff + +static void putc (int c) +{ +u32 *uart_lsr = (u32 *)(UART_BASE_PHYS +UART_LSR_OFFS ); +u32 *uart_thr = (u32 *)(UART_BASE_PHYS +UART_THR_OFFS ); + +while (!(*uart_lsr &UART_LSR_THRE )) +barrier (); + *uart_thr = c; +} + +static inline void flush (void ) +{ +} + +/* +* nothing to do +*/ +#define arch_decomp_setup () +#define arch_decomp_wdog ()
arch/arm/plat-tcc/include/mach/vmalloc.h new file +11 -0
@@ -0,0 +1,11 @@ +/* +* Author: <[email protected]> +* Created: June 10, 2008 +* +* Copyright (C) 2000 Russell King. +* Copyright (C) 2008-2009 Telechips +* +* Licensed under the terms of the GPL v2. +*/ +#define VMALLOC_END (PAGE_OFFSET + 0x10000000) +
arch/arm/plat-tcc/system.c new file +24 -0
@@ -0,0 +1,24 @@ +/* +* System functions for Telechips TCCxxxx SoCs +* +* Copyright (C) Hans J. Koch <[email protected]> +* +* Licensed under the terms of the GPL v2. +* +*/ + +#include <asm/io.h> +#include <mach/tcc8k-regs.h> + +/* System reboot */ +void plat_tcc_reboot (void ) +{ +/* Make sure clocks are on */ +__raw_writel (0xffffffff ,CKC_BASE +BCLKCTR0_OFFS ); + +/* Enable watchdog reset */ +__raw_writel (0x49 ,TIMER_BASE +TWDCFG_OFFS ); +/* Wait for reset */ +unreachable (); +} +
Signature · 1 line
1.6.3.3
PATCH 2/7 Add clock framework for plat-tcc
In reply to Hans J. KochAdd the clock framework for Telechips TCC8xxx processors.
--- arch/arm/mach-tcc8k/Makefile | 6 + arch/arm/mach-tcc8k/clock.c | 589 +++++++++++++++++++++++++++++++ arch/arm/plat-tcc/Makefile | 2 +- arch/arm/plat-tcc/clock.c | 170 +++++++++ arch/arm/plat-tcc/include/mach/clkdev.h | 7 + arch/arm/plat-tcc/include/mach/clock.h | 48 +++ 6 files changed, 821 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-tcc8k/Makefile create mode 100644 arch/arm/mach-tcc8k/clock.c create mode 100644 arch/arm/plat-tcc/clock.c create mode 100644 arch/arm/plat-tcc/include/mach/clkdev.h create mode 100644 arch/arm/plat-tcc/include/mach/clock.h
arch/arm/mach-tcc8k/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# +# Makefile for TCC8K boards and common files. +# + +# Common support +obj-y += clock.o
arch/arm/mach-tcc8k/clock.c new file +589 -0
589 lines not on this page · raw message
arch/arm/plat-tcc/Makefile +1 -1
@@ -1,3 +1,3 @@ # "Telechips Platform Common Modules" -obj-y := system.o +obj-y := clock.o system.o
arch/arm/plat-tcc/clock.c new file +170 -0
170 lines not on this page · raw message
arch/arm/plat-tcc/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/plat-tcc/include/mach/clock.h new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 3/7 Introduce plat-tcc irq framework
In reply to Hans J. KochIntroduce lowlevel interrupt routines.
--- arch/arm/mach-tcc8k/Makefile | 3 +- arch/arm/mach-tcc8k/irq.c | 113 +++++++++++++++++++++++++++++++++ arch/arm/plat-tcc/include/mach/irqs.h | 84 ++++++++++++++++++++++++ 3 files changed, 199 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-tcc8k/irq.c create mode 100644 arch/arm/plat-tcc/include/mach/irqs.h
arch/arm/mach-tcc8k/Makefile +2 -1
@@ -3,4 +3,5 @@ # # Common support -obj-y += clock.o +obj-y += clock.o irq.o +
arch/arm/mach-tcc8k/irq.c new file +113 -0
113 lines not on this page · raw message
arch/arm/plat-tcc/include/mach/irqs.h new file +84 -0
84 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 4/7 Add TCC8xxx system timer
In reply to Hans J. KochAdd the system timer using clockevents with the internal TC32 timer. This also adds a clocksource using the same timer.
--- arch/arm/Kconfig | 1 + arch/arm/mach-tcc8k/Makefile | 2 +- arch/arm/mach-tcc8k/time.c | 150 ++++++++++++++++++++++++++++++++ arch/arm/plat-tcc/include/mach/timex.h | 5 + 4 files changed, 157 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-tcc8k/time.c create mode 100644 arch/arm/plat-tcc/include/mach/timex.h
arch/arm/Kconfig +1 -0
@@ -728,6 +728,7 @@ config ARCH_TCC_926 select CPU_ARM926T select HAVE_CLK select COMMON_CLKDEV + select GENERIC_TIME select GENERIC_CLOCKEVENTS help Support for Telechips TCC ARM926-based systems.
arch/arm/mach-tcc8k/Makefile +1 -1
@@ -3,5 +3,5 @@ # # Common support -obj-y += clock.o irq.o +obj-y += clock.o irq.o time.o
arch/arm/mach-tcc8k/time.c new file +150 -0
150 lines not on this page · raw message
arch/arm/plat-tcc/include/mach/timex.h new file +5 -0
@@ -0,0 +1,5 @@ +/* +* A definition needed by arch core code. +* +*/ +#define CLOCK_TICK_RATE (HZ * 100000UL)
Signature · 1 line
1.6.3.3
PATCH 5/7 Basic IO mappings for mach-tcc8k
In reply to Hans J. KochMap the IO ranges of TCC8xxx peripherals.
--- arch/arm/mach-tcc8k/Makefile | 2 +- arch/arm/mach-tcc8k/io.c | 82 +++++++++++++++++++++++++++++++++++ arch/arm/plat-tcc/include/mach/io.h | 53 ++++++++++++++++++++++ 3 files changed, 136 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-tcc8k/io.c create mode 100644 arch/arm/plat-tcc/include/mach/io.h
arch/arm/mach-tcc8k/Makefile +1 -1
@@ -3,5 +3,5 @@ # # Common support -obj-y += clock.o irq.o time.o +obj-y += clock.o irq.o time.o io.o
arch/arm/mach-tcc8k/io.c new file +82 -0
82 lines not on this page · raw message
arch/arm/plat-tcc/include/mach/io.h new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 6/7 Add common platform devices for TCC8xxx SoCs
In reply to Hans J. KochThis patch introduces a first set of platform devices for integrated peripherals of TCC8xxx processors. Drivers for these devices are available and will be posted in a second step.
--- arch/arm/mach-tcc8k/Makefile | 2 +- arch/arm/mach-tcc8k/devices.c | 274 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 275 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-tcc8k/devices.c
arch/arm/mach-tcc8k/Makefile +1 -1
@@ -3,5 +3,5 @@ # # Common support -obj-y += clock.o irq.o time.o io.o +obj-y += clock.o irq.o time.o io.o devices.o
arch/arm/mach-tcc8k/devices.c new file +274 -0
274 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 7/7 Add board support for Telechips TCC8000-SDK board
In reply to Hans J. KochAdd support for the Telechips TCC8000-SDK development board.
--- arch/arm/mach-tcc8k/Kconfig | 6 +++ arch/arm/mach-tcc8k/Makefile | 3 ++ arch/arm/mach-tcc8k/Makefile.boot | 3 ++ arch/arm/mach-tcc8k/board-tcc8000-sdk.c | 59 +++++++++++++++++++++++++++++++ arch/arm/mach-tcc8k/board-tcc8000-sdk.h | 18 +++++++++ 5 files changed, 89 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-tcc8k/Makefile.boot create mode 100644 arch/arm/mach-tcc8k/board-tcc8000-sdk.c create mode 100644 arch/arm/mach-tcc8k/board-tcc8000-sdk.h
arch/arm/mach-tcc8k/Kconfig +6 -0
@@ -2,4 +2,10 @@ if ARCH_TCC8K comment "TCC8000 systems:" +config MACH_TCC8000_SDK + bool "Telechips TCC8000-SDK development kit" + default y + help + Support for the Telechips TCC8000-SDK board. + endif
arch/arm/mach-tcc8k/Makefile +3 -0
@@ -5,3 +5,6 @@ # Common support obj-y += clock.o irq.o time.o io.o devices.o +# Specific board support +obj-$(CONFIG_MACH_TCC8000_SDK) += board-tcc8000-sdk.o +
arch/arm/mach-tcc8k/Makefile.boot new file +3 -0
@@ -0,0 +1,3 @@ + zreladdr-y := 0x20008000 +params_phys-y := 0x20000100 +initrd_phys-y := 0x20800000
arch/arm/mach-tcc8k/board-tcc8000-sdk.c new file +59 -0
59 lines not on this page · raw message
arch/arm/mach-tcc8k/board-tcc8000-sdk.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* Some defines for arch/arm/mach-tcc8k/board-tcc8000-sdk.c +* +*/ + +#ifndef _BOARD_TCC_8000_SDK_H_ +#define _BOARD_TCC_8000_SDK_H_ + +extern void __init tcc8k_init_irq (void ); +extern void __init tcc8k_map_common_io (void ); +extern int __init tcc_clocks_init (unsigned long xi_freq, +unsigned long xti_freq); +extern struct platform_device tcc_nand_device; + +#define XI_FREQUENCY 12000000 +#define XTI_FREQUENCY 32768 + +#endif
Signature · 1 line
1.6.3.3
PATCH 5/7 Basic IO mappings for mach-tcc8k
In reply to Hans J. Koch2010/3/22 Hans J. Koch <[email protected]>:
Quoted 8 lines
Map the IO ranges of TCC8xxx peripherals.
(...)
+ ? ? ? {
+ ? ? ? ? ? ? ? .virtual ? ? ? ?=DATA_TCM_BASE_VIRT, ? /* Data TCM */
+ ? ? ? ? ? ? ? .pfn ? ? ? ? ? ?=__phys_to_pfn(DATA_TCM_BASE),
+ ? ? ? ? ? ? ? .length ? ? ? ? =DATA_TCM_SIZE,
+ ? ? ? ? ? ? ? .type ? ? ? ? ? =MT_DEVICE
+ ? ? ? },
Hey, that no peripheral, that's onchip TCM memory, MT_DEVICE is very inappropriate since it will cause readthrough/writethrough.
Please use the generic TCM memory support as described in Documentation/arm/tcm.txt for your TCM memory, example of a platform using this can be found in arch/arm/mach-u300, just grep -r for TCM. Note the flag in arch/arm/Kconfig as well.
Any problems, ask.
Yours,
Linus Walleij
PATCH 5/7 Basic IO mappings for mach-tcc8k
Quoted 11 lines · Linus Walleij
2010/3/22 Hans J. Koch <[email protected]>:
Quoted 8 lines
Map the IO ranges of TCC8xxx peripherals.
(...)
+ ? ? ? {
+ ? ? ? ? ? ? ? .virtual ? ? ? ?=DATA_TCM_BASE_VIRT, ? /* Data TCM */
+ ? ? ? ? ? ? ? .pfn ? ? ? ? ? ?=__phys_to_pfn(DATA_TCM_BASE),
+ ? ? ? ? ? ? ? .length ? ? ? ? =DATA_TCM_SIZE,
+ ? ? ? ? ? ? ? .type ? ? ? ? ? =MT_DEVICE
+ ? ? ? },
Quoted 7 lines
Hey, that no peripheral, that's onchip TCM memory,
MT_DEVICEis very inappropriate since it will cause readthrough/writethrough.Please use the generic TCM memory support as described in
Documentation/arm/tcm.txtfor your TCM memory, example of a platform using this can be found inarch/arm/mach-u300, just grep -r for TCM. Note the flag inarch/arm/Kconfigas well.
Thanks for that hint. Will fix.
Hans
Quoted 5 lines
Any problems, ask.
Yours,
Linus Walleij
PATCH 5/7 Basic IO mappings for mach-tcc8k
In reply to Hans J. KochQuoted 27 lines · Hans J. Koch
Map the IO ranges of TCC8xxx peripherals.
Signed-off-by "Hans J. Koch" <[email protected]>--- arch/arm/mach-tcc8k/Makefile | 2 +- arch/arm/mach-tcc8k/io.c | 82 +++++++++++++++++++++++++++++++++++ arch/arm/plat-tcc/include/mach/io.h | 53 ++++++++++++++++++++++ 3 files changed, 136 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-tcc8k/io.c create mode 100644 arch/arm/plat-tcc/include/mach/io.harch/arm/mach-tcc8k/Makefile +1
-1@@ -3,5 +3,5 @@ # # Common support -obj-y += clock.o irq.o time.o +obj-y += clock.o irq.o time.o io.oarch/arm/mach-tcc8k/io.c new file +0
-0
[...]
arch/arm/mach-tcc8k/io.c line 80
Quoted 10 lines
arch/arm/mach-tcc8k/io.c new file +10
-0+ +/* +* Maps common IO regions for tcc8k. +* +*/ +void __init tcc8k_map_common_io (void ) +{ +iotable_init (tcc8k_io_desc,ARRAY_SIZE (tcc8k_io_desc)); +local_flush_tlb_all (); +flush_cache_all ();
Reviewing my own patch...
These last to "flush" lines are probably crap, at least unneeded. I thought I threw them out, but somehow they crept in again. Will test and fix.
Hans
Quoted 1 line
+}
PATCH 5/7 Basic IO mappings for mach-tcc8k
In reply to Hans J. Koch2010/3/22 Hans J. Koch <[email protected]>:
Quoted 7 lines
Map the IO ranges of TCC8xxx peripherals.
+ ? ? ? {
+ ? ? ? ? ? ? ? .virtual ? ? ? ?=INT_SRAM_BASE_VIRT, ? /* Internal SRAM */
+ ? ? ? ? ? ? ? .pfn ? ? ? ? ? ?=__phys_to_pfn(INT_SRAM_BASE),
+ ? ? ? ? ? ? ? .length ? ? ? ? =INT_SRAM_SIZE,
+ ? ? ? ? ? ? ? .type ? ? ? ? ? =MT_DEVICE
+ ? ? ? },
MT_DEVICE is probably inappropriate here as well.
Quoted 6 lines
+ ? ? ? {
+ ? ? ? ? ? ? ? .virtual ? ? ? ?=DATA_TCM_BASE_VIRT, ? /* Data TCM */
+ ? ? ? ? ? ? ? .pfn ? ? ? ? ? ?=__phys_to_pfn(DATA_TCM_BASE),
+ ? ? ? ? ? ? ? .length ? ? ? ? =DATA_TCM_SIZE,
+ ? ? ? ? ? ? ? .type ? ? ? ? ? =MT_DEVICE
+ ? ? ? },
Actually, look close at your specs here, because you seem to have both SRAM and TCM, usually you have ITCM+DTCM, so the thing that is called SRAM may be something else.
Looking at the .h file:
+#define INT_SRAM_BASE 0x30000000
+#define INT_SRAM_SIZE SZ_32K
(...)
+#define DATA_TCM_BASE 0xa0000000
+#define DATA_TCM_SIZE SZ_8K
Check if the SRAM is really an SRAM and not ITCM (which can be suspected). Also check that the DTCM is really such a thing. (The code in arch/arm/kernel/tcm.c does this once you enable it, it will scream if the config of the system does not match what the CPU register is saying about ITCM+DTCM.)
If the DTCM is really an embedded TCM you can move it wherever you want, even i physical memory space. It doesn't have to be on 0xa0000000, this is probably only the place where your boot code locates it.
Yours,
Linus Walleij
PATCH 5/7 Basic IO mappings for mach-tcc8k
Quoted 31 lines · Linus Walleij
2010/3/22 Hans J. Koch <[email protected]>:
Quoted 7 lines
Map the IO ranges of TCC8xxx peripherals.
+ ? ? ? {
+ ? ? ? ? ? ? ? .virtual ? ? ? ?=INT_SRAM_BASE_VIRT, ? /* Internal SRAM */
+ ? ? ? ? ? ? ? .pfn ? ? ? ? ? ?=__phys_to_pfn(INT_SRAM_BASE),
+ ? ? ? ? ? ? ? .length ? ? ? ? =INT_SRAM_SIZE,
+ ? ? ? ? ? ? ? .type ? ? ? ? ? =MT_DEVICE
+ ? ? ? },
MT_DEVICEis probably inappropriate here as well.Quoted 6 lines
+ ? ? ? {
+ ? ? ? ? ? ? ? .virtual ? ? ? ?=DATA_TCM_BASE_VIRT, ? /* Data TCM */
+ ? ? ? ? ? ? ? .pfn ? ? ? ? ? ?=__phys_to_pfn(DATA_TCM_BASE),
+ ? ? ? ? ? ? ? .length ? ? ? ? =DATA_TCM_SIZE,
+ ? ? ? ? ? ? ? .type ? ? ? ? ? =MT_DEVICE
+ ? ? ? },Actually, look close at your specs here, because you seem to have both SRAM and TCM, usually you have ITCM+DTCM, so the thing that is called SRAM may be something else.
Looking at the .h file:
(quoted diff) +4
-0+#define INT_SRAM_BASE 0x30000000 +#define INT_SRAM_SIZE SZ_32K +#define DATA_TCM_BASE 0xa0000000 +#define DATA_TCM_SIZE SZ_8K
Quoted 2 lines
Check if the SRAM is really an SRAM and not ITCM (which can be suspected).
I'm quite sure it's normal SRAM. I've got the boot ROM code sources, they use it for both code and variables, like any standard SRAM.
Quoted 1 line
Also check that the DTCM is really such a thing.
Yep, I'll do this.
Quoted 3 lines
(The code in
arch/arm/kernel/tcm.cdoes this once you enable it, it will scream if the config of the system does not match what the CPU register is saying about ITCM+DTCM.)
OK, will try.
Quoted 5 lines
If the DTCM is really an embedded TCM you can move it wherever you want, even i physical memory space. It doesn't have to be on
0xa0000000, this is probably only the place where your boot code locates it.
Thanks a lot for your detailed review and your hints.
Hans
Quoted 3 lines
Yours,
Linus Walleij
PATCH 5/7 Basic IO mappings for mach-tcc8k
2010/3/23 Hans J. Koch <[email protected]>:
Quoted 5 lines · Linus Walleij
Quoted 2 lines
2010/3/22 Hans J. Koch <[email protected]>:
Also check that the DTCM is really such a thing.Yep, I'll do this.
If you really have a system with *only* DTCM and no ITCM, I don't know if the TCM support in the kernel works with that right now, I've never seen a system with just ITCM or just DTCM, but if you can help me testing I will try to fix it up.
Linus
PATCH 5/7 Basic IO mappings for mach-tcc8k
Quoted 9 lines · Linus Walleij
2010/3/23 Hans J. Koch <[email protected]>:
Quoted 5 lines · Linus Walleij
Quoted 2 lines
2010/3/22 Hans J. Koch <[email protected]>:
Also check that the DTCM is really such a thing.Yep, I'll do this.
If you really have a system with *only* DTCM and no ITCM, I don't know if the TCM support in the kernel works with that right now,
It won't, AFAICT. I removed TCM from the mappings in v2. Unfortunately, the Telechips manual doesn't say much about it, but always calls it "DTCM" or "Data TCM". I'll try to get more information, and come up with a patch later. It's not really important ATM.
Quoted 2 lines
I've never seen a system with just ITCM or just DTCM, but if you can help me testing I will try to fix it up.
If I change things in arch/arm/kernel/tcm.c, I'll Cc: you anyway since you're mentioned in the header. The code itself seems quite clear.
Thanks,
Hans
Quoted 2 lines
Linus
PATCH 5/7 Basic IO mappings for mach-tcc8k
2010/3/26 Hans J. Koch <[email protected]>:
Quoted 7 lines
Quoted 2 lines
If you really have a system with *only* DTCM and no ITCM, I don't know if the TCM support in the kernel works with that right now,
It won't, AFAICT. I removed TCM from the mappings in v2. Unfortunately, the Telechips manual doesn't say much about it, but always calls it "DTCM" or "Data TCM". I'll try to get more information, and come up with a patch later. It's not really important ATM.
You really only need to include a call to
u32 tcm_status = read_cpuid_tcmstatus();pr_info("TCM status 0x%08x", tcm_status);
To find out what kind of TCMs you have on your system, if they are true TCMs!
Bit 1 is set if you have some ITCM, bit 16 is set if you have some DTCM. Else it's something custom.
Linus
PATCH 5/7 Basic IO mappings for mach-tcc8k
Quoted 14 lines · Linus Walleij
2010/3/26 Hans J. Koch <[email protected]>:
Quoted 7 lines
Quoted 2 lines
If you really have a system with *only* DTCM and no ITCM, I don't know if the TCM support in the kernel works with that right now,
It won't, AFAICT. I removed TCM from the mappings in v2. Unfortunately, the Telechips manual doesn't say much about it, but always calls it "DTCM" or "Data TCM". I'll try to get more information, and come up with a patch later. It's not really important ATM.
You really only need to include a call to
u32tcm_status=read_cpuid_tcmstatus();pr_info("TCM status 0x%08x", tcm_status);
Quoted 5 lines
To find out what kind of TCMs you have on your system, if they are true TCMs!
Bit 1 is set if you have some ITCM, bit 16 is set if you have some DTCM. Else it's something custom.
Yep, that's what I saw in your code. I'll try that as soon as I've got the time.
Thanks,
Hans
Quoted 2 lines
Linus