Add basic support for Telechips TCC8xxx SoCs
Subsystems (2)
v6 cover Add basic support for Telechips TCC8xxx SoCs
I'll reply to this mail with a series of 7 patches that add support for Telechips TCC8xxx ARM9-based SoCs.
Changes since v5:
- Removed UART support and register definitions since the TCC8000 has 8250-compatible UARTs built in. No need to reinvent the wheel.
- Fixed a wrong use of unreachable().
- Fixed a clock refcounting bug.
- Rebased against 2.6.34
Thanks,
Hans
PATCH v6 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 | 19 + arch/arm/plat-tcc/include/mach/system.h | 31 + arch/arm/plat-tcc/include/mach/tcc8k-regs.h | 796 ++++++++++++++++++++++++++ arch/arm/plat-tcc/include/mach/uncompress.h | 34 ++ arch/arm/plat-tcc/include/mach/vmalloc.h | 11 + arch/arm/plat-tcc/system.c | 26 + 14 files changed, 1103 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
@@ -724,6 +724,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
@@ -888,6 +897,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 +19 -0
@@ -0,0 +1,19 @@ +/* +* Copyright (C) 1999 ARM Limited +* Copyright (C) 2000 RidgeRun, Inc. +* Copyright (C) 2008-2009 Telechips +* Copyright (C) 2010 Hans J. Koch <[email protected]> +* +* 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) + +#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 +796 -0
796 lines not on this page · raw message
arch/arm/plat-tcc/include/mach/uncompress.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Copyright (C) 2009 Hans J. Koch <[email protected]> +* +* This file is licensed under the terms of the GPL version 2. +*/ + +#include <linux/serial_reg.h> +#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 <<2 )); +u32 *uart_tx = (u32 *)(UART_BASE_PHYS + (UART_TX <<2 )); + +while (!(*uart_lsr &UART_LSR_THRE )) +barrier (); + *uart_tx = 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 0xf0000000UL +
arch/arm/plat-tcc/system.c new file +26 -0
@@ -0,0 +1,26 @@ +/* +* System functions for Telechips TCCxxxx SoCs +* +* Copyright (C) Hans J. Koch <[email protected]> +* +* Licensed under the terms of the GPL v2. +* +*/ + +#include <linux/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 */ +while (1 ) + ; +} +
Signature · 1 line
1.6.3.3
PATCH v6 2/7 Add the clock framework for Telechips TCC8xxx processors.
In reply to Hans J. KochThis adds definitions and low-level functions to handle clocks in TCC8xxx processors.
--- arch/arm/mach-tcc8k/Makefile | 6 + arch/arm/mach-tcc8k/clock.c | 578 +++++++++++++++++++++++++++ arch/arm/plat-tcc/Makefile | 2 +- arch/arm/plat-tcc/clock.c | 180 +++++++++ arch/arm/plat-tcc/include/mach/clkdev.h | 7 + arch/arm/plat-tcc/include/mach/clock.h | 48 +++ arch/arm/plat-tcc/include/mach/tcc8k-regs.h | 17 +- 7 files changed, 828 insertions(+), 10 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 +578 -0
578 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 +180 -0
180 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
arch/arm/plat-tcc/include/mach/tcc8k-regs.h +8 -9
@@ -30,13 +30,13 @@#define EXT_MEM_CTRL_BASE 0xf0000000#define EXT_MEM_CTRL_SIZE SZ_4K -#define CS1_BASE_VIRT 0xf7000000 -#define AHB_PERI_BASE_VIRT 0xf4000000 -#define APB0_PERI_BASE_VIRT 0xf1000000 -#define APB1_PERI_BASE_VIRT 0xf2000000 -#define EXT_MEM_CTRL_BASE_VIRT 0xf3000000 -#define INT_SRAM_BASE_VIRT 0xf5000000 -#define DATA_TCM_BASE_VIRT 0xf6000000 +#define CS1_BASE_VIRT (void __iomem *)0xf7000000 +#define AHB_PERI_BASE_VIRT (void __iomem *)0xf4000000 +#define APB0_PERI_BASE_VIRT (void __iomem *)0xf1000000 +#define APB1_PERI_BASE_VIRT (void __iomem *)0xf2000000 +#define EXT_MEM_CTRL_BASE_VIRT (void __iomem *)0xf3000000 +#define INT_SRAM_BASE_VIRT (void __iomem *)0xf5000000 +#define DATA_TCM_BASE_VIRT (void __iomem *)0xf6000000#define __REG (x) (*((volatile u32 *)(x)))
@@ -649,8 +649,7 @@#define PMGPIO_APB_OFFS 0x800/* Clock controller registers */ -#define CKC_BASE (APB1_PERI_BASE_VIRT + 0x6000) -#define CKC_BASE_PHYS (APB1_PERI_BASE + 0x6000) +#define CKC_BASE ((void __iomem *)(APB1_PERI_BASE_VIRT + 0x6000))#define CLKCTRL_OFFS 0x00#define PLL0CFG_OFFS 0x04
Signature · 1 line
1.6.3.3
PATCH v6 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 | 110 +++++++++++++++++++++++++++++++++ arch/arm/plat-tcc/include/mach/irqs.h | 84 +++++++++++++++++++++++++ 3 files changed, 196 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 +110 -0
110 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 v6 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 | 147 ++++++++++++++++++++++++++++++++ arch/arm/plat-tcc/include/mach/timex.h | 5 + 4 files changed, 154 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
@@ -729,6 +729,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 +147 -0
147 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 v6 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 | 63 +++++++++++++++++++++++++++++++++++ arch/arm/plat-tcc/include/mach/io.h | 23 +++++++++++++ 3 files changed, 87 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 +63 -0
63 lines not on this page · raw message
arch/arm/plat-tcc/include/mach/io.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* IO definitions for TCC8000 processors and boards +* +* Copyright (C) 1997-1999 Russell King +* Copyright (C) 2008-2009 Telechips +* Copyright (C) 2010 Hans J. Koch <[email protected]> +* +* Licensed under the terms of the GNU Public License version 2. +*/ + +#ifndef __ASM_ARM_ARCH_IO_H +#define __ASM_ARM_ARCH_IO_H + +#define IO_SPACE_LIMIT 0xffffffff + +/* +* We don't actually have real ISA nor PCI buses, but there is so many +* drivers out there that might just work if we fake them... +*/ +#define __io (a) __typesafe_io(a) +#define __mem_pci (a) (a) + +#endif
Signature · 1 line
1.6.3.3
PATCH v6 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 | 238 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 239 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 +238 -0
238 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH v6 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 v6 2/7 Add the clock framework for Telechips TCC8xxx processors.
In reply to Hans J. KochThe previous implementation contains a rather confusing handling of (struct clk)->root_id, adding and subtracting 1 all the time. This is a clearer version of the patch for adding the clock framework for Telechips TCC8xxx processors.
--- arch/arm/mach-tcc8k/Makefile | 6 + arch/arm/mach-tcc8k/clock.c | 571 +++++++++++++++++++++++++++ arch/arm/plat-tcc/Makefile | 2 +- arch/arm/plat-tcc/clock.c | 180 +++++++++ arch/arm/plat-tcc/include/mach/clkdev.h | 7 + arch/arm/plat-tcc/include/mach/clock.h | 48 +++ arch/arm/plat-tcc/include/mach/tcc8k-regs.h | 31 +- 7 files changed, 834 insertions(+), 11 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 +571 -0
571 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 +180 -0
180 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
arch/arm/plat-tcc/include/mach/tcc8k-regs.h +21 -10
@@ -30,13 +30,13 @@#define EXT_MEM_CTRL_BASE 0xf0000000#define EXT_MEM_CTRL_SIZE SZ_4K -#define CS1_BASE_VIRT 0xf7000000 -#define AHB_PERI_BASE_VIRT 0xf4000000 -#define APB0_PERI_BASE_VIRT 0xf1000000 -#define APB1_PERI_BASE_VIRT 0xf2000000 -#define EXT_MEM_CTRL_BASE_VIRT 0xf3000000 -#define INT_SRAM_BASE_VIRT 0xf5000000 -#define DATA_TCM_BASE_VIRT 0xf6000000 +#define CS1_BASE_VIRT (void __iomem *)0xf7000000 +#define AHB_PERI_BASE_VIRT (void __iomem *)0xf4000000 +#define APB0_PERI_BASE_VIRT (void __iomem *)0xf1000000 +#define APB1_PERI_BASE_VIRT (void __iomem *)0xf2000000 +#define EXT_MEM_CTRL_BASE_VIRT (void __iomem *)0xf3000000 +#define INT_SRAM_BASE_VIRT (void __iomem *)0xf5000000 +#define DATA_TCM_BASE_VIRT (void __iomem *)0xf6000000#define __REG (x) (*((volatile u32 *)(x)))
@@ -649,8 +649,7 @@#define PMGPIO_APB_OFFS 0x800/* Clock controller registers */ -#define CKC_BASE (APB1_PERI_BASE_VIRT + 0x6000) -#define CKC_BASE_PHYS (APB1_PERI_BASE + 0x6000) +#define CKC_BASE ((void __iomem *)(APB1_PERI_BASE_VIRT + 0x6000))#define CLKCTRL_OFFS 0x00#define PLL0CFG_OFFS 0x04
@@ -724,8 +723,20 @@/* SWRESET1 bits */ #define SWRESET1_USBH1 (1 << 20) -/* System clock sources */ +/* System clock sources. +* Note: These are the clock sources that serve as parents for +* all other clocks. They have no parents themselves. +* +* These values are used for struct clk->root_id. All clocks +* that are not system clock sources have this value set to +* CLK_SRC_NOROOT. +* The values for system clocks start with CLK_SRC_PLL0 == 0 +* because this gives us exactly the values needed for the lower +* 4 bits of ACLK_* registers. Therefore, CLK_SRC_NOROOT is +* defined as -1 to not disturb the order. +*/ enum root_clks { +CLK_SRC_NOROOT =-1 ,CLK_SRC_PLL0 =0 ,CLK_SRC_PLL1 ,CLK_SRC_PLL0DIV ,
Signature · 1 line
1.6.3.3
PATCH v6 2/7 Add the clock framework for Telechips TCC8xxx processors.
(The last patch had one unneeded forward declaration left over and produced a compiler warning, here's the correct version.)
This adds definitions and low-level functions to handle clocks in TCC8xxx processors.
--- arch/arm/mach-tcc8k/Makefile | 6 + arch/arm/mach-tcc8k/clock.c | 571 +++++++++++++++++++++++++++ arch/arm/plat-tcc/Makefile | 2 +- arch/arm/plat-tcc/clock.c | 180 +++++++++ arch/arm/plat-tcc/include/mach/clkdev.h | 7 + arch/arm/plat-tcc/include/mach/clock.h | 48 +++ arch/arm/plat-tcc/include/mach/tcc8k-regs.h | 31 +- 7 files changed, 834 insertions(+), 11 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 +571 -0
571 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 +180 -0
180 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
arch/arm/plat-tcc/include/mach/tcc8k-regs.h +21 -10
@@ -30,13 +30,13 @@#define EXT_MEM_CTRL_BASE 0xf0000000#define EXT_MEM_CTRL_SIZE SZ_4K -#define CS1_BASE_VIRT 0xf7000000 -#define AHB_PERI_BASE_VIRT 0xf4000000 -#define APB0_PERI_BASE_VIRT 0xf1000000 -#define APB1_PERI_BASE_VIRT 0xf2000000 -#define EXT_MEM_CTRL_BASE_VIRT 0xf3000000 -#define INT_SRAM_BASE_VIRT 0xf5000000 -#define DATA_TCM_BASE_VIRT 0xf6000000 +#define CS1_BASE_VIRT (void __iomem *)0xf7000000 +#define AHB_PERI_BASE_VIRT (void __iomem *)0xf4000000 +#define APB0_PERI_BASE_VIRT (void __iomem *)0xf1000000 +#define APB1_PERI_BASE_VIRT (void __iomem *)0xf2000000 +#define EXT_MEM_CTRL_BASE_VIRT (void __iomem *)0xf3000000 +#define INT_SRAM_BASE_VIRT (void __iomem *)0xf5000000 +#define DATA_TCM_BASE_VIRT (void __iomem *)0xf6000000#define __REG (x) (*((volatile u32 *)(x)))
@@ -649,8 +649,7 @@#define PMGPIO_APB_OFFS 0x800/* Clock controller registers */ -#define CKC_BASE (APB1_PERI_BASE_VIRT + 0x6000) -#define CKC_BASE_PHYS (APB1_PERI_BASE + 0x6000) +#define CKC_BASE ((void __iomem *)(APB1_PERI_BASE_VIRT + 0x6000))#define CLKCTRL_OFFS 0x00#define PLL0CFG_OFFS 0x04
@@ -724,8 +723,20 @@/* SWRESET1 bits */ #define SWRESET1_USBH1 (1 << 20) -/* System clock sources */ +/* System clock sources. +* Note: These are the clock sources that serve as parents for +* all other clocks. They have no parents themselves. +* +* These values are used for struct clk->root_id. All clocks +* that are not system clock sources have this value set to +* CLK_SRC_NOROOT. +* The values for system clocks start with CLK_SRC_PLL0 == 0 +* because this gives us exactly the values needed for the lower +* 4 bits of ACLK_* registers. Therefore, CLK_SRC_NOROOT is +* defined as -1 to not disturb the order. +*/ enum root_clks { +CLK_SRC_NOROOT =-1 ,CLK_SRC_PLL0 =0 ,CLK_SRC_PLL1 ,CLK_SRC_PLL0DIV ,
Signature · 1 line
1.6.3.3