From 970ad9daac8bc926312c99446bb64c86dcd35a10 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Thu, 27 May 2010 14:33:31 +0000 Subject: [PATCH] rm msm code and arch_idle use cpu_do_idle --- arch/arm/mach-rk2818/Makefile | 4 +- arch/arm/mach-rk2818/idle.S | 35 ----- arch/arm/mach-rk2818/include/mach/system.h | 5 +- arch/arm/mach-rk2818/proc_comm.c | 110 ---------------- arch/arm/mach-rk2818/vreg.c | 142 --------------------- 5 files changed, 5 insertions(+), 291 deletions(-) delete mode 100644 arch/arm/mach-rk2818/idle.S delete mode 100644 arch/arm/mach-rk2818/proc_comm.c delete mode 100644 arch/arm/mach-rk2818/vreg.c diff --git a/arch/arm/mach-rk2818/Makefile b/arch/arm/mach-rk2818/Makefile index 33f25d53c7c0..376889f5b972 100644 --- a/arch/arm/mach-rk2818/Makefile +++ b/arch/arm/mach-rk2818/Makefile @@ -1,7 +1,5 @@ -obj-y += io.o idle.o irq.o timer.o iomux.o gpio.o +obj-y += io.o irq.o timer.o iomux.o gpio.o obj-y += devices.o -obj-y += proc_comm.o -obj-y += vreg.o obj-y += clock.o obj-$(CONFIG_CPU_FREQ) += cpufreq.o obj-y += ddr.o diff --git a/arch/arm/mach-rk2818/idle.S b/arch/arm/mach-rk2818/idle.S deleted file mode 100644 index 4cc2c11aab91..000000000000 --- a/arch/arm/mach-rk2818/idle.S +++ /dev/null @@ -1,35 +0,0 @@ -/* arch/arm/mach-rk2818/include/mach/idle.S - * - * Idle processing for MSM7K - work around bugs with SWFI. - * - * Copyright (C) 2010 ROCKCHIP, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that 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. - * - */ - -#include -#include - -ENTRY(arch_idle) -#ifdef CONFIG_RK2818_IDLE - mrc p15, 0, r1, c1, c0, 0 /* read current CR */ - bic r0, r1, #(1 << 2) /* clear dcache bit */ - bic r0, r0, #(1 << 12) /* clear icache bit */ - mcr p15, 0, r0, c1, c0, 0 /* disable d/i cache */ - - mov r0, #0 /* prepare wfi value */ - mcr p15, 0, r0, c7, c10, 0 /* flush the cache */ - mcr p15, 0, r0, c7, c10, 4 /* memory barrier */ - mcr p15, 0, r0, c7, c0, 4 /* wait for interrupt */ - - mcr p15, 0, r1, c1, c0, 0 /* restore d/i cache */ -#endif - mov pc, lr diff --git a/arch/arm/mach-rk2818/include/mach/system.h b/arch/arm/mach-rk2818/include/mach/system.h index 7e7d0c27956a..7baec047d6a7 100644 --- a/arch/arm/mach-rk2818/include/mach/system.h +++ b/arch/arm/mach-rk2818/include/mach/system.h @@ -15,7 +15,10 @@ #include -void arch_idle(void); +static inline void arch_idle(void) +{ + cpu_do_idle(); +} static inline void arch_reset(char mode, const char *cmd) { diff --git a/arch/arm/mach-rk2818/proc_comm.c b/arch/arm/mach-rk2818/proc_comm.c deleted file mode 100644 index 28c35cfb62d3..000000000000 --- a/arch/arm/mach-rk2818/proc_comm.c +++ /dev/null @@ -1,110 +0,0 @@ -/* arch/arm/mach-rk2818/proc_comm.c - * - * Copyright (C) 2010 ROCKCHIP, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that 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. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "proc_comm.h" - -//#define MSM_A2M_INT(n) (MSM_CSR_BASE + 0x400 + (n) * 4) - -static inline void notify_other_proc_comm(void) -{ - //writel(1, MSM_A2M_INT(6)); -} - -#define APP_COMMAND 0x00 -#define APP_STATUS 0x04 -#define APP_DATA1 0x08 -#define APP_DATA2 0x0C - -#define MDM_COMMAND 0x10 -#define MDM_STATUS 0x14 -#define MDM_DATA1 0x18 -#define MDM_DATA2 0x1C - -static DEFINE_SPINLOCK(proc_comm_lock); - -/* The higher level SMD support will install this to - * provide a way to check for and handle modem restart. - */ -int (*rk2818_check_for_modem_crash)(void); - -/* Poll for a state change, checking for possible - * modem crashes along the way (so we don't wait - * forever while the ARM9 is blowing up). - * - * Return an error in the event of a modem crash and - * restart so the msm_proc_comm() routine can restart - * the operation from the beginning. - */ -static int proc_comm_wait_for(void __iomem *addr, unsigned value) -{ - for (;;) { - if (readl(addr) == value) - return 0; - - if (rk2818_check_for_modem_crash) - if (rk2818_check_for_modem_crash()) - return -EAGAIN; - } -} - -int rk2818_proc_comm(unsigned cmd, unsigned *data1, unsigned *data2) -{ - - //void __iomem *base = MSM_SHARED_RAM_BASE; - unsigned long flags; - int ret=0; - - spin_lock_irqsave(&proc_comm_lock, flags); - #if 0 - for (;;) { - if (proc_comm_wait_for(base + MDM_STATUS, PCOM_READY)) - continue; - - writel(cmd, base + APP_COMMAND); - writel(data1 ? *data1 : 0, base + APP_DATA1); - writel(data2 ? *data2 : 0, base + APP_DATA2); - - notify_other_proc_comm(); - - if (proc_comm_wait_for(base + APP_COMMAND, PCOM_CMD_DONE)) - continue; - - if (readl(base + APP_STATUS) != PCOM_CMD_FAIL) { - if (data1) - *data1 = readl(base + APP_DATA1); - if (data2) - *data2 = readl(base + APP_DATA2); - ret = 0; - } else { - ret = -EIO; - } - break; - } - - writel(PCOM_CMD_IDLE, base + APP_COMMAND); - #endif - spin_unlock_irqrestore(&proc_comm_lock, flags); - - return ret; -} - - diff --git a/arch/arm/mach-rk2818/vreg.c b/arch/arm/mach-rk2818/vreg.c deleted file mode 100644 index 7afede9d491c..000000000000 --- a/arch/arm/mach-rk2818/vreg.c +++ /dev/null @@ -1,142 +0,0 @@ -/* arch/arm/mach-rk2818/vreg.c - * - * Copyright (C) 2010 ROCKCHIP, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that 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. - * - */ - -#include -#include -#include -#include -#include - -#include "proc_comm.h" - -struct vreg { - const char *name; - unsigned id; -}; - -#define VREG(_name, _id) { .name = _name, .id = _id, } - -static struct vreg vregs[] = { - VREG("msma", 0), - VREG("msmp", 1), - VREG("msme1", 2), - VREG("msmc1", 3), - VREG("msmc2", 4), - VREG("gp3", 5), - VREG("msme2", 6), - VREG("gp4", 7), - VREG("gp1", 8), - VREG("tcxo", 9), - VREG("pa", 10), - VREG("rftx", 11), - VREG("rfrx1", 12), - VREG("rfrx2", 13), - VREG("synt", 14), - VREG("wlan", 15), - VREG("usb", 16), - VREG("boost", 17), - VREG("mmc", 18), - VREG("ruim", 19), - VREG("msmc0", 20), - VREG("gp2", 21), - VREG("gp5", 22), - VREG("gp6", 23), - VREG("rf", 24), - VREG("rf_vco", 26), - VREG("mpll", 27), - VREG("s2", 28), - VREG("s3", 29), - VREG("rfubm", 30), - VREG("ncp", 31), -}; - -struct vreg *vreg_get(struct device *dev, const char *id) -{ - int n; - for (n = 0; n < ARRAY_SIZE(vregs); n++) { - if (!strcmp(vregs[n].name, id)) - return vregs + n; - } - return 0; -} - -void vreg_put(struct vreg *vreg) -{ -} - -int vreg_enable(struct vreg *vreg) -{ - unsigned id = vreg->id; - unsigned enable = 1; - return rk2818_proc_comm(PCOM_VREG_SWITCH, &id, &enable); -} - -void vreg_disable(struct vreg *vreg) -{ - unsigned id = vreg->id; - unsigned enable = 0; - rk2818_proc_comm(PCOM_VREG_SWITCH, &id, &enable); -} - -int vreg_set_level(struct vreg *vreg, unsigned mv) -{ - unsigned id = vreg->id; - return rk2818_proc_comm(PCOM_VREG_SET_LEVEL, &id, &mv); -} - -#if defined(CONFIG_DEBUG_FS) - -static int vreg_debug_set(void *data, u64 val) -{ - struct vreg *vreg = data; - switch (val) { - case 0: - vreg_disable(vreg); - break; - case 1: - vreg_enable(vreg); - break; - default: - vreg_set_level(vreg, val); - break; - } - return 0; -} - -static int vreg_debug_get(void *data, u64 *val) -{ - return -ENOSYS; -} - -DEFINE_SIMPLE_ATTRIBUTE(vreg_fops, vreg_debug_get, vreg_debug_set, "%llu\n"); - -static int __init vreg_debug_init(void) -{ - struct dentry *dent; - int n; - - dent = debugfs_create_dir("vreg", 0); - if (IS_ERR(dent)) - return 0; - - for (n = 0; n < ARRAY_SIZE(vregs); n++) - (void) debugfs_create_file(vregs[n].name, 0644, - dent, vregs + n, &vreg_fops); - - return 0; -} - -device_initcall(vreg_debug_init); -#endif -- 2.34.1