diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-12-02 15:12:47 +0100 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2013-03-12 17:39:47 +0100 |
commit | a7ed099ffc8edf2a6dccd8a22469347f5cdcfa57 (patch) | |
tree | b56901430602574233ad23008cfd7c23babd20c3 /arch/arm/plat-spear | |
parent | 0ec05c3e4ac6548fcab4b6a74254a22ef251e1fd (diff) | |
download | linux-rt-a7ed099ffc8edf2a6dccd8a22469347f5cdcfa57.tar.gz |
ARM: spear: move all files to mach-spear
There are no conflicting files between the three mach-spear* directories
and plat-spear any more, so we can now move all file to a common
mach-spear directory.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'arch/arm/plat-spear')
-rw-r--r-- | arch/arm/plat-spear/Kconfig | 90 | ||||
-rw-r--r-- | arch/arm/plat-spear/Makefile | 9 | ||||
-rw-r--r-- | arch/arm/plat-spear/include/mach/debug-macro.S | 36 | ||||
-rw-r--r-- | arch/arm/plat-spear/include/mach/generic.h | 58 | ||||
-rw-r--r-- | arch/arm/plat-spear/include/mach/hardware.h | 1 | ||||
-rw-r--r-- | arch/arm/plat-spear/include/mach/irqs.h | 35 | ||||
-rw-r--r-- | arch/arm/plat-spear/include/mach/misc_regs.h | 22 | ||||
-rw-r--r-- | arch/arm/plat-spear/include/mach/spear.h | 101 | ||||
-rw-r--r-- | arch/arm/plat-spear/include/mach/timex.h | 19 | ||||
-rw-r--r-- | arch/arm/plat-spear/include/mach/uncompress.h | 42 | ||||
-rw-r--r-- | arch/arm/plat-spear/include/plat/pl080.h | 21 | ||||
-rw-r--r-- | arch/arm/plat-spear/pl080.c | 78 | ||||
-rw-r--r-- | arch/arm/plat-spear/restart.c | 33 | ||||
-rw-r--r-- | arch/arm/plat-spear/time.c | 245 |
14 files changed, 0 insertions, 790 deletions
diff --git a/arch/arm/plat-spear/Kconfig b/arch/arm/plat-spear/Kconfig deleted file mode 100644 index e288df90c746..000000000000 --- a/arch/arm/plat-spear/Kconfig +++ /dev/null @@ -1,90 +0,0 @@ -# -# SPEAr Platform configuration file -# - -if PLAT_SPEAR - -choice - prompt "ST SPEAr Family" - default ARCH_SPEAR3XX - -config ARCH_SPEAR13XX - bool "ST SPEAr13xx with Device Tree" - select ARCH_HAVE_CPUFREQ - select ARM_GIC - select CPU_V7 - select GPIO_SPEAR_SPICS - select HAVE_SMP - select MIGHT_HAVE_CACHE_L2X0 - select PINCTRL - select USE_OF - help - Supports for ARM's SPEAR13XX family - -config ARCH_SPEAR3XX - bool "ST SPEAr3xx with Device Tree" - select ARM_VIC - select CPU_ARM926T - select PINCTRL - select USE_OF - help - Supports for ARM's SPEAR3XX family - -config ARCH_SPEAR6XX - bool "SPEAr6XX" - select ARM_VIC - select CPU_ARM926T - help - Supports for ARM's SPEAR6XX family - -endchoice - -if ARCH_SPEAR13XX - -menu "SPEAr13xx Implementations" -config MACH_SPEAR1310 - bool "SPEAr1310 Machine support with Device Tree" - select PINCTRL_SPEAR1310 - help - Supports ST SPEAr1310 machine configured via the device-tree - -config MACH_SPEAR1340 - bool "SPEAr1340 Machine support with Device Tree" - select PINCTRL_SPEAR1340 - help - Supports ST SPEAr1340 machine configured via the device-tree -endmenu -endif #ARCH_SPEAR13XX - -if ARCH_SPEAR3XX - -menu "SPEAr3xx Implementations" -config MACH_SPEAR300 - bool "SPEAr300 Machine support with Device Tree" - select PINCTRL_SPEAR300 - help - Supports ST SPEAr300 machine configured via the device-tree - -config MACH_SPEAR310 - bool "SPEAr310 Machine support with Device Tree" - select PINCTRL_SPEAR310 - help - Supports ST SPEAr310 machine configured via the device-tree - -config MACH_SPEAR320 - bool "SPEAr320 Machine support with Device Tree" - select PINCTRL_SPEAR320 - help - Supports ST SPEAr320 machine configured via the device-tree -endmenu - -endif - -config MACH_SPEAR600 - def_bool y - depends on ARCH_SPEAR6XX - select USE_OF - help - Supports ST SPEAr600 boards configured via the device-treesource "arch/arm/mach-spear6xx/Kconfig" - -endif diff --git a/arch/arm/plat-spear/Makefile b/arch/arm/plat-spear/Makefile deleted file mode 100644 index 01e88532a5db..000000000000 --- a/arch/arm/plat-spear/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# -# SPEAr Platform specific Makefile -# - -# Common support -obj-y := restart.o time.o - -obj-$(CONFIG_ARCH_SPEAR3XX) += pl080.o -obj-$(CONFIG_ARCH_SPEAR6XX) += pl080.o diff --git a/arch/arm/plat-spear/include/mach/debug-macro.S b/arch/arm/plat-spear/include/mach/debug-macro.S deleted file mode 100644 index 75b05ad0fbad..000000000000 --- a/arch/arm/plat-spear/include/mach/debug-macro.S +++ /dev/null @@ -1,36 +0,0 @@ -/* - * arch/arm/plat-spear/include/plat/debug-macro.S - * - * Debugging macro include header for spear platform - * - * Copyright (C) 2009 ST Microelectronics - * Viresh Kumar <viresh.linux@gmail.com> - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#include <linux/amba/serial.h> -#include <mach/spear.h> - - .macro addruart, rp, rv, tmp - mov \rp, #SPEAR_DBG_UART_BASE @ Physical base - mov \rv, #VA_SPEAR_DBG_UART_BASE @ Virtual base - .endm - - .macro senduart, rd, rx - strb \rd, [\rx, #UART01x_DR] @ ASC_TX_BUFFER - .endm - - .macro waituart, rd, rx -1001: ldr \rd, [\rx, #UART01x_FR] @ FLAG REGISTER - tst \rd, #UART01x_FR_TXFF @ TX_FULL - bne 1001b - .endm - - .macro busyuart, rd, rx -1002: ldr \rd, [\rx, #UART01x_FR] @ FLAG REGISTER - tst \rd, #UART011_FR_TXFE @ TX_EMPTY - beq 1002b - .endm diff --git a/arch/arm/plat-spear/include/mach/generic.h b/arch/arm/plat-spear/include/mach/generic.h deleted file mode 100644 index af47d9b0d83d..000000000000 --- a/arch/arm/plat-spear/include/mach/generic.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * spear machine family generic header file - * - * Copyright (C) 2009-2012 ST Microelectronics - * Rajeev Kumar <rajeev-dlh.kumar@st.com> - * Viresh Kumar <viresh.linux@gmail.com> - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#ifndef __MACH_GENERIC_H -#define __MACH_GENERIC_H - -#include <linux/dmaengine.h> -#include <linux/amba/pl08x.h> -#include <linux/init.h> -#include <asm/mach/time.h> - -extern void spear13xx_timer_init(void); -extern void spear3xx_timer_init(void); -extern struct pl022_ssp_controller pl022_plat_data; -extern struct pl08x_platform_data pl080_plat_data; -extern struct dw_dma_platform_data dmac_plat_data; -extern struct dw_dma_slave cf_dma_priv; -extern struct dw_dma_slave nand_read_dma_priv; -extern struct dw_dma_slave nand_write_dma_priv; -bool dw_dma_filter(struct dma_chan *chan, void *slave); - -void __init spear_setup_of_timer(void); -void __init spear3xx_clk_init(void); -void __init spear3xx_map_io(void); -void __init spear3xx_dt_init_irq(void); -void __init spear6xx_clk_init(void); -void __init spear13xx_map_io(void); -void __init spear13xx_l2x0_init(void); - -void spear_restart(char, const char *); - -void spear13xx_secondary_startup(void); -void __cpuinit spear13xx_cpu_die(unsigned int cpu); - -extern struct smp_operations spear13xx_smp_ops; - -#ifdef CONFIG_MACH_SPEAR1310 -void __init spear1310_clk_init(void); -#else -static inline void spear1310_clk_init(void) {} -#endif - -#ifdef CONFIG_MACH_SPEAR1340 -void __init spear1340_clk_init(void); -#else -static inline void spear1340_clk_init(void) {} -#endif - -#endif /* __MACH_GENERIC_H */ diff --git a/arch/arm/plat-spear/include/mach/hardware.h b/arch/arm/plat-spear/include/mach/hardware.h deleted file mode 100644 index 40a8c178f10d..000000000000 --- a/arch/arm/plat-spear/include/mach/hardware.h +++ /dev/null @@ -1 +0,0 @@ -/* empty */ diff --git a/arch/arm/plat-spear/include/mach/irqs.h b/arch/arm/plat-spear/include/mach/irqs.h deleted file mode 100644 index 92da0a8c6bce..000000000000 --- a/arch/arm/plat-spear/include/mach/irqs.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * IRQ helper macros for spear machine family - * - * Copyright (C) 2009-2012 ST Microelectronics - * Rajeev Kumar <rajeev-dlh.kumar@st.com> - * Viresh Kumar <viresh.linux@gmail.com> - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#ifndef __MACH_IRQS_H -#define __MACH_IRQS_H - -#ifdef CONFIG_ARCH_SPEAR3XX -#define NR_IRQS 256 -#endif - -#ifdef CONFIG_ARCH_SPEAR6XX -/* IRQ definitions */ -/* VIC 1 */ -#define IRQ_VIC_END 64 - -/* GPIO pins virtual irqs */ -#define VIRTUAL_IRQS 24 -#define NR_IRQS (IRQ_VIC_END + VIRTUAL_IRQS) -#endif - -#ifdef CONFIG_ARCH_SPEAR13XX -#define IRQ_GIC_END 160 -#define NR_IRQS IRQ_GIC_END -#endif - -#endif /* __MACH_IRQS_H */ diff --git a/arch/arm/plat-spear/include/mach/misc_regs.h b/arch/arm/plat-spear/include/mach/misc_regs.h deleted file mode 100644 index 075812c4ca18..000000000000 --- a/arch/arm/plat-spear/include/mach/misc_regs.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * arch/arm/mach-spear3xx/include/mach/misc_regs.h - * - * Miscellaneous registers definitions for SPEAr3xx machine family - * - * Copyright (C) 2009 ST Microelectronics - * Viresh Kumar <viresh.linux@gmail.com> - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#ifndef __MACH_MISC_REGS_H -#define __MACH_MISC_REGS_H - -#include <mach/spear.h> - -#define MISC_BASE IOMEM(VA_SPEAR_ICM3_MISC_REG_BASE) -#define DMA_CHN_CFG (MISC_BASE + 0x0A0) - -#endif /* __MACH_MISC_REGS_H */ diff --git a/arch/arm/plat-spear/include/mach/spear.h b/arch/arm/plat-spear/include/mach/spear.h deleted file mode 100644 index 2198ab96df9d..000000000000 --- a/arch/arm/plat-spear/include/mach/spear.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * SPEAr3xx/6xx Machine family specific definition - * - * Copyright (C) 2009,2012 ST Microelectronics - * Rajeev Kumar<rajeev-dlh.kumar@st.com> - * Viresh Kumar <viresh.linux@gmail.com> - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#ifndef __MACH_SPEAR_H -#define __MACH_SPEAR_H - -#include <asm/memory.h> - -#if defined(CONFIG_ARCH_SPEAR3XX) || defined (CONFIG_ARCH_SPEAR6XX) - -/* ICM1 - Low speed connection */ -#define SPEAR_ICM1_2_BASE UL(0xD0000000) -#define VA_SPEAR_ICM1_2_BASE UL(0xFD000000) -#define SPEAR_ICM1_UART_BASE UL(0xD0000000) -#define VA_SPEAR_ICM1_UART_BASE (VA_SPEAR_ICM1_2_BASE | SPEAR_ICM1_UART_BASE) -#define SPEAR3XX_ICM1_SSP_BASE UL(0xD0100000) - -/* ML-1, 2 - Multi Layer CPU Subsystem */ -#define SPEAR_ICM3_ML1_2_BASE UL(0xF0000000) -#define VA_SPEAR6XX_ML_CPU_BASE UL(0xF0000000) - -/* ICM3 - Basic Subsystem */ -#define SPEAR_ICM3_SMI_CTRL_BASE UL(0xFC000000) -#define VA_SPEAR_ICM3_SMI_CTRL_BASE UL(0xFC000000) -#define SPEAR_ICM3_DMA_BASE UL(0xFC400000) -#define SPEAR_ICM3_SYS_CTRL_BASE UL(0xFCA00000) -#define VA_SPEAR_ICM3_SYS_CTRL_BASE (VA_SPEAR_ICM3_SMI_CTRL_BASE | SPEAR_ICM3_SYS_CTRL_BASE) -#define SPEAR_ICM3_MISC_REG_BASE UL(0xFCA80000) -#define VA_SPEAR_ICM3_MISC_REG_BASE (VA_SPEAR_ICM3_SMI_CTRL_BASE | SPEAR_ICM3_MISC_REG_BASE) - -/* Debug uart for linux, will be used for debug and uncompress messages */ -#define SPEAR_DBG_UART_BASE SPEAR_ICM1_UART_BASE -#define VA_SPEAR_DBG_UART_BASE VA_SPEAR_ICM1_UART_BASE - -/* Sysctl base for spear platform */ -#define SPEAR_SYS_CTRL_BASE SPEAR_ICM3_SYS_CTRL_BASE -#define VA_SPEAR_SYS_CTRL_BASE VA_SPEAR_ICM3_SYS_CTRL_BASE - -/* SPEAr320 Macros */ -#define SPEAR320_SOC_CONFIG_BASE UL(0xB3000000) -#define VA_SPEAR320_SOC_CONFIG_BASE UL(0xFE000000) -#define SPEAR320_CONTROL_REG IOMEM(VA_SPEAR320_SOC_CONFIG_BASE) -#define SPEAR320_EXT_CTRL_REG IOMEM(VA_SPEAR320_SOC_CONFIG_BASE + 0x0018) - #define SPEAR320_UARTX_PCLK_MASK 0x1 - #define SPEAR320_UART2_PCLK_SHIFT 8 - #define SPEAR320_UART3_PCLK_SHIFT 9 - #define SPEAR320_UART4_PCLK_SHIFT 10 - #define SPEAR320_UART5_PCLK_SHIFT 11 - #define SPEAR320_UART6_PCLK_SHIFT 12 - #define SPEAR320_RS485_PCLK_SHIFT 13 -#endif /* SPEAR3xx || SPEAR6XX */ - -#ifdef CONFIG_ARCH_SPEAR13XX - -#define PERIP_GRP2_BASE UL(0xB3000000) -#define VA_PERIP_GRP2_BASE IOMEM(0xFE000000) -#define MCIF_SDHCI_BASE UL(0xB3000000) -#define SYSRAM0_BASE UL(0xB3800000) -#define VA_SYSRAM0_BASE IOMEM(0xFE800000) -#define SYS_LOCATION (VA_SYSRAM0_BASE + 0x600) - -#define PERIP_GRP1_BASE UL(0xE0000000) -#define VA_PERIP_GRP1_BASE IOMEM(0xFD000000) -#define UART_BASE UL(0xE0000000) -#define VA_UART_BASE IOMEM(0xFD000000) -#define SSP_BASE UL(0xE0100000) -#define MISC_BASE UL(0xE0700000) -#define VA_MISC_BASE IOMEM(0xFD700000) - -#define A9SM_AND_MPMC_BASE UL(0xEC000000) -#define VA_A9SM_AND_MPMC_BASE IOMEM(0xFC000000) - -/* A9SM peripheral offsets */ -#define A9SM_PERIP_BASE UL(0xEC800000) -#define VA_A9SM_PERIP_BASE IOMEM(0xFC800000) -#define VA_SCU_BASE (VA_A9SM_PERIP_BASE + 0x00) - -#define L2CC_BASE UL(0xED000000) -#define VA_L2CC_BASE IOMEM(UL(0xFB000000)) - -/* others */ -#define DMAC0_BASE UL(0xEA800000) -#define DMAC1_BASE UL(0xEB000000) -#define MCIF_CF_BASE UL(0xB2800000) - -/* Debug uart for linux, will be used for debug and uncompress messages */ -#define SPEAR_DBG_UART_BASE UART_BASE -#define VA_SPEAR_DBG_UART_BASE VA_UART_BASE - -#endif /* SPEAR13XX */ - -#endif /* __MACH_SPEAR_H */ diff --git a/arch/arm/plat-spear/include/mach/timex.h b/arch/arm/plat-spear/include/mach/timex.h deleted file mode 100644 index ef95e5b780bd..000000000000 --- a/arch/arm/plat-spear/include/mach/timex.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * arch/arm/plat-spear/include/plat/timex.h - * - * SPEAr platform specific timex definitions - * - * Copyright (C) 2009 ST Microelectronics - * Viresh Kumar <viresh.linux@gmail.com> - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#ifndef __PLAT_TIMEX_H -#define __PLAT_TIMEX_H - -#define CLOCK_TICK_RATE 48000000 - -#endif /* __PLAT_TIMEX_H */ diff --git a/arch/arm/plat-spear/include/mach/uncompress.h b/arch/arm/plat-spear/include/mach/uncompress.h deleted file mode 100644 index 51b2dc93e4da..000000000000 --- a/arch/arm/plat-spear/include/mach/uncompress.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * arch/arm/plat-spear/include/plat/uncompress.h - * - * Serial port stubs for kernel decompress status messages - * - * Copyright (C) 2009 ST Microelectronics - * Viresh Kumar <viresh.linux@gmail.com> - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#include <linux/io.h> -#include <linux/amba/serial.h> -#include <mach/spear.h> - -#ifndef __PLAT_UNCOMPRESS_H -#define __PLAT_UNCOMPRESS_H -/* - * This does not append a newline - */ -static inline void putc(int c) -{ - void __iomem *base = (void __iomem *)SPEAR_DBG_UART_BASE; - - while (readl_relaxed(base + UART01x_FR) & UART01x_FR_TXFF) - barrier(); - - writel_relaxed(c, base + UART01x_DR); -} - -static inline void flush(void) -{ -} - -/* - * nothing to do - */ -#define arch_decomp_setup() - -#endif /* __PLAT_UNCOMPRESS_H */ diff --git a/arch/arm/plat-spear/include/plat/pl080.h b/arch/arm/plat-spear/include/plat/pl080.h deleted file mode 100644 index eb6590ded40d..000000000000 --- a/arch/arm/plat-spear/include/plat/pl080.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * arch/arm/plat-spear/include/plat/pl080.h - * - * DMAC pl080 definitions for SPEAr platform - * - * Copyright (C) 2012 ST Microelectronics - * Viresh Kumar <viresh.linux@gmail.com> - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#ifndef __PLAT_PL080_H -#define __PLAT_PL080_H - -struct pl08x_channel_data; -int pl080_get_signal(const struct pl08x_channel_data *cd); -void pl080_put_signal(const struct pl08x_channel_data *cd, int signal); - -#endif /* __PLAT_PL080_H */ diff --git a/arch/arm/plat-spear/pl080.c b/arch/arm/plat-spear/pl080.c deleted file mode 100644 index cfa1199d0f4a..000000000000 --- a/arch/arm/plat-spear/pl080.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * arch/arm/plat-spear/pl080.c - * - * DMAC pl080 definitions for SPEAr platform - * - * Copyright (C) 2012 ST Microelectronics - * Viresh Kumar <viresh.linux@gmail.com> - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#include <linux/amba/pl08x.h> -#include <linux/amba/bus.h> -#include <linux/bug.h> -#include <linux/err.h> -#include <linux/io.h> -#include <linux/spinlock_types.h> -#include <mach/spear.h> -#include <mach/misc_regs.h> - -static spinlock_t lock = __SPIN_LOCK_UNLOCKED(x); - -struct { - unsigned char busy; - unsigned char val; -} signals[16] = {{0, 0}, }; - -int pl080_get_signal(const struct pl08x_channel_data *cd) -{ - unsigned int signal = cd->min_signal, val; - unsigned long flags; - - spin_lock_irqsave(&lock, flags); - - /* Return if signal is already acquired by somebody else */ - if (signals[signal].busy && - (signals[signal].val != cd->muxval)) { - spin_unlock_irqrestore(&lock, flags); - return -EBUSY; - } - - /* If acquiring for the first time, configure it */ - if (!signals[signal].busy) { - val = readl(DMA_CHN_CFG); - - /* - * Each request line has two bits in DMA_CHN_CFG register. To - * goto the bits of current request line, do left shift of - * value by 2 * signal number. - */ - val &= ~(0x3 << (signal * 2)); - val |= cd->muxval << (signal * 2); - writel(val, DMA_CHN_CFG); - } - - signals[signal].busy++; - signals[signal].val = cd->muxval; - spin_unlock_irqrestore(&lock, flags); - - return signal; -} - -void pl080_put_signal(const struct pl08x_channel_data *cd, int signal) -{ - unsigned long flags; - - spin_lock_irqsave(&lock, flags); - - /* if signal is not used */ - if (!signals[signal].busy) - BUG(); - - signals[signal].busy--; - - spin_unlock_irqrestore(&lock, flags); -} diff --git a/arch/arm/plat-spear/restart.c b/arch/arm/plat-spear/restart.c deleted file mode 100644 index 7d4616d5df11..000000000000 --- a/arch/arm/plat-spear/restart.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * arch/arm/plat-spear/restart.c - * - * SPEAr platform specific restart functions - * - * Copyright (C) 2009 ST Microelectronics - * Viresh Kumar <viresh.linux@gmail.com> - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ -#include <linux/io.h> -#include <linux/amba/sp810.h> -#include <asm/system_misc.h> -#include <mach/spear.h> -#include <mach/generic.h> - -#define SPEAR13XX_SYS_SW_RES (VA_MISC_BASE + 0x204) -void spear_restart(char mode, const char *cmd) -{ - if (mode == 's') { - /* software reset, Jump into ROM at address 0 */ - soft_restart(0); - } else { - /* hardware reset, Use on-chip reset capability */ -#ifdef CONFIG_ARCH_SPEAR13XX - writel_relaxed(0x01, SPEAR13XX_SYS_SW_RES); -#else - sysctl_soft_reset((void __iomem *)VA_SPEAR_SYS_CTRL_BASE); -#endif - } -} diff --git a/arch/arm/plat-spear/time.c b/arch/arm/plat-spear/time.c deleted file mode 100644 index bd5c53cd6962..000000000000 --- a/arch/arm/plat-spear/time.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * arch/arm/plat-spear/time.c - * - * Copyright (C) 2010 ST Microelectronics - * Shiraz Hashim<shiraz.hashim@st.com> - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#include <linux/clk.h> -#include <linux/clockchips.h> -#include <linux/clocksource.h> -#include <linux/err.h> -#include <linux/init.h> -#include <linux/interrupt.h> -#include <linux/ioport.h> -#include <linux/io.h> -#include <linux/kernel.h> -#include <linux/of_irq.h> -#include <linux/of_address.h> -#include <linux/time.h> -#include <linux/irq.h> -#include <asm/mach/time.h> -#include <mach/generic.h> - -/* - * We would use TIMER0 and TIMER1 as clockevent and clocksource. - * Timer0 and Timer1 both belong to same gpt block in cpu subbsystem. Further - * they share same functional clock. Any change in one's functional clock will - * also affect other timer. - */ - -#define CLKEVT 0 /* gpt0, channel0 as clockevent */ -#define CLKSRC 1 /* gpt0, channel1 as clocksource */ - -/* Register offsets, x is channel number */ -#define CR(x) ((x) * 0x80 + 0x80) -#define IR(x) ((x) * 0x80 + 0x84) -#define LOAD(x) ((x) * 0x80 + 0x88) -#define COUNT(x) ((x) * 0x80 + 0x8C) - -/* Reg bit definitions */ -#define CTRL_INT_ENABLE 0x0100 -#define CTRL_ENABLE 0x0020 -#define CTRL_ONE_SHOT 0x0010 - -#define CTRL_PRESCALER1 0x0 -#define CTRL_PRESCALER2 0x1 -#define CTRL_PRESCALER4 0x2 -#define CTRL_PRESCALER8 0x3 -#define CTRL_PRESCALER16 0x4 -#define CTRL_PRESCALER32 0x5 -#define CTRL_PRESCALER64 0x6 -#define CTRL_PRESCALER128 0x7 -#define CTRL_PRESCALER256 0x8 - -#define INT_STATUS 0x1 - -/* - * Minimum clocksource/clockevent timer range in seconds - */ -#define SPEAR_MIN_RANGE 4 - -static __iomem void *gpt_base; -static struct clk *gpt_clk; - -static void clockevent_set_mode(enum clock_event_mode mode, - struct clock_event_device *clk_event_dev); -static int clockevent_next_event(unsigned long evt, - struct clock_event_device *clk_event_dev); - -static void spear_clocksource_init(void) -{ - u32 tick_rate; - u16 val; - - /* program the prescaler (/256)*/ - writew(CTRL_PRESCALER256, gpt_base + CR(CLKSRC)); - - /* find out actual clock driving Timer */ - tick_rate = clk_get_rate(gpt_clk); - tick_rate >>= CTRL_PRESCALER256; - - writew(0xFFFF, gpt_base + LOAD(CLKSRC)); - - val = readw(gpt_base + CR(CLKSRC)); - val &= ~CTRL_ONE_SHOT; /* autoreload mode */ - val |= CTRL_ENABLE ; - writew(val, gpt_base + CR(CLKSRC)); - - /* register the clocksource */ - clocksource_mmio_init(gpt_base + COUNT(CLKSRC), "tmr1", tick_rate, - 200, 16, clocksource_mmio_readw_up); -} - -static struct clock_event_device clkevt = { - .name = "tmr0", - .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, - .set_mode = clockevent_set_mode, - .set_next_event = clockevent_next_event, - .shift = 0, /* to be computed */ -}; - -static void clockevent_set_mode(enum clock_event_mode mode, - struct clock_event_device *clk_event_dev) -{ - u32 period; - u16 val; - - /* stop the timer */ - val = readw(gpt_base + CR(CLKEVT)); - val &= ~CTRL_ENABLE; - writew(val, gpt_base + CR(CLKEVT)); - - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - period = clk_get_rate(gpt_clk) / HZ; - period >>= CTRL_PRESCALER16; - writew(period, gpt_base + LOAD(CLKEVT)); - - val = readw(gpt_base + CR(CLKEVT)); - val &= ~CTRL_ONE_SHOT; - val |= CTRL_ENABLE | CTRL_INT_ENABLE; - writew(val, gpt_base + CR(CLKEVT)); - - break; - case CLOCK_EVT_MODE_ONESHOT: - val = readw(gpt_base + CR(CLKEVT)); - val |= CTRL_ONE_SHOT; - writew(val, gpt_base + CR(CLKEVT)); - - break; - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - case CLOCK_EVT_MODE_RESUME: - - break; - default: - pr_err("Invalid mode requested\n"); - break; - } -} - -static int clockevent_next_event(unsigned long cycles, - struct clock_event_device *clk_event_dev) -{ - u16 val = readw(gpt_base + CR(CLKEVT)); - - if (val & CTRL_ENABLE) - writew(val & ~CTRL_ENABLE, gpt_base + CR(CLKEVT)); - - writew(cycles, gpt_base + LOAD(CLKEVT)); - - val |= CTRL_ENABLE | CTRL_INT_ENABLE; - writew(val, gpt_base + CR(CLKEVT)); - - return 0; -} - -static irqreturn_t spear_timer_interrupt(int irq, void *dev_id) -{ - struct clock_event_device *evt = &clkevt; - - writew(INT_STATUS, gpt_base + IR(CLKEVT)); - - evt->event_handler(evt); - - return IRQ_HANDLED; -} - -static struct irqaction spear_timer_irq = { - .name = "timer", - .flags = IRQF_DISABLED | IRQF_TIMER, - .handler = spear_timer_interrupt -}; - -static void __init spear_clockevent_init(int irq) -{ - u32 tick_rate; - - /* program the prescaler */ - writew(CTRL_PRESCALER16, gpt_base + CR(CLKEVT)); - - tick_rate = clk_get_rate(gpt_clk); - tick_rate >>= CTRL_PRESCALER16; - - clkevt.cpumask = cpumask_of(0); - - clockevents_config_and_register(&clkevt, tick_rate, 3, 0xfff0); - - setup_irq(irq, &spear_timer_irq); -} - -const static struct of_device_id timer_of_match[] __initconst = { - { .compatible = "st,spear-timer", }, - { }, -}; - -void __init spear_setup_of_timer(void) -{ - struct device_node *np; - int irq, ret; - - np = of_find_matching_node(NULL, timer_of_match); - if (!np) { - pr_err("%s: No timer passed via DT\n", __func__); - return; - } - - irq = irq_of_parse_and_map(np, 0); - if (!irq) { - pr_err("%s: No irq passed for timer via DT\n", __func__); - return; - } - - gpt_base = of_iomap(np, 0); - if (!gpt_base) { - pr_err("%s: of iomap failed\n", __func__); - return; - } - - gpt_clk = clk_get_sys("gpt0", NULL); - if (!gpt_clk) { - pr_err("%s:couldn't get clk for gpt\n", __func__); - goto err_iomap; - } - - ret = clk_prepare_enable(gpt_clk); - if (ret < 0) { - pr_err("%s:couldn't prepare-enable gpt clock\n", __func__); - goto err_prepare_enable_clk; - } - - spear_clockevent_init(irq); - spear_clocksource_init(); - - return; - -err_prepare_enable_clk: - clk_put(gpt_clk); -err_iomap: - iounmap(gpt_base); -} |