From 650c2a2145981696c414be1d540a32447d0e353e Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Sun, 15 May 2011 22:53:56 +0200 Subject: [PATCH] mach-ux500: move the DB8500 PRCMU driver to MFD We have decided that this function arbiter fits better in the MFD subsystem. Since we need to concatenate the split header files we move it basically like this: mv mach-ux500/prcmu-db8500.c drivers/mfd/db8500-prcmu.c mv mach-ux500/include/mach/prcmu-defs.h include/linux/mfd/db8500-prcmu.h mv mach-ux500/include/mach/prcmu-regs.h drivers/mfd/db8500-prcmu-regs.h mach-ux500/include/mach/prcmu.h >> include/linux/mfd/db8500-prcmu.h rm arch/arm/mach-ux500/include/mach/prcmu.h Then we update different #include statements and Makefile orders etc to make the PRCMU driver compile, link and boot in the new place without really changing any code. Acked-by: Samuel Ortiz Signed-off-by: Linus Walleij --- arch/arm/mach-ux500/Kconfig | 1 + arch/arm/mach-ux500/Makefile | 2 +- arch/arm/mach-ux500/cpu.c | 2 +- arch/arm/mach-ux500/cpufreq.c | 3 +- arch/arm/mach-ux500/include/mach/prcmu-defs.h | 30 ---------------- drivers/mfd/Kconfig | 12 ++++++- drivers/mfd/Makefile | 4 ++- drivers/mfd/ab8500-i2c.c | 3 +- .../mfd/db8500-prcmu-regs.h | 0 .../mfd/db8500-prcmu.c | 5 +-- .../linux/mfd/db8500-prcmu.h | 34 +++++++++++++++++-- 11 files changed, 54 insertions(+), 42 deletions(-) delete mode 100644 arch/arm/mach-ux500/include/mach/prcmu-defs.h rename arch/arm/mach-ux500/include/mach/prcmu-regs.h => drivers/mfd/db8500-prcmu-regs.h (100%) rename arch/arm/mach-ux500/prcmu-db8500.c => drivers/mfd/db8500-prcmu.c (99%) rename arch/arm/mach-ux500/include/mach/prcmu.h => include/linux/mfd/db8500-prcmu.h (54%) diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig index 58626013aa32..8071d2746f70 100644 --- a/arch/arm/mach-ux500/Kconfig +++ b/arch/arm/mach-ux500/Kconfig @@ -15,6 +15,7 @@ config UX500_SOC_DB5500 config UX500_SOC_DB8500 bool "DB8500" + select MFD_DB8500_PRCMU endmenu diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index 2a08a10e09da..7a1d43e04f97 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile @@ -5,7 +5,7 @@ obj-y := clock.o cpu.o devices.o devices-common.o \ id.o usb.o obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o dma-db5500.o -obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o prcmu-db8500.o +obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o obj-$(CONFIG_MACH_U8500) += board-mop500.o board-mop500-sdi.o \ board-mop500-regulators.o \ board-mop500-uib.o board-mop500-stuib.o \ diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c index 0190e0e68b4d..11360f734cec 100644 --- a/arch/arm/mach-ux500/cpu.c +++ b/arch/arm/mach-ux500/cpu.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -19,7 +20,6 @@ #include #include #include -#include #include "clock.h" diff --git a/arch/arm/mach-ux500/cpufreq.c b/arch/arm/mach-ux500/cpufreq.c index 5c5b747f134d..d196939fcdb9 100644 --- a/arch/arm/mach-ux500/cpufreq.c +++ b/arch/arm/mach-ux500/cpufreq.c @@ -17,10 +17,9 @@ #include #include #include +#include #include -#include -#include #define DRIVER_NAME "cpufreq-u8500" #define CPUFREQ_NAME "u8500" diff --git a/arch/arm/mach-ux500/include/mach/prcmu-defs.h b/arch/arm/mach-ux500/include/mach/prcmu-defs.h deleted file mode 100644 index 848ba64b561f..000000000000 --- a/arch/arm/mach-ux500/include/mach/prcmu-defs.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) STMicroelectronics 2009 - * Copyright (C) ST-Ericsson SA 2010 - * - * Author: Sundar Iyer - * Author: Martin Persson - * - * License Terms: GNU General Public License v2 - * - * PRCM Unit definitions - */ - -#ifndef __MACH_PRCMU_DEFS_H -#define __MACH_PRCMU_DEFS_H - -enum prcmu_cpu_opp { - CPU_OPP_INIT = 0x00, - CPU_OPP_NO_CHANGE = 0x01, - CPU_OPP_100 = 0x02, - CPU_OPP_50 = 0x03, - CPU_OPP_MAX = 0x04, - CPU_OPP_EXT_CLK = 0x07 -}; -enum prcmu_ape_opp { - APE_OPP_NO_CHANGE = 0x00, - APE_OPP_100 = 0x02, - APE_OPP_50 = 0x03, -}; - -#endif /* __MACH_PRCMU_DEFS_H */ diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 3ed3ff06be5d..7eaeb9750793 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -538,7 +538,7 @@ config AB8500_CORE config AB8500_I2C_CORE bool "AB8500 register access via PRCMU I2C" - depends on AB8500_CORE && UX500_SOC_DB8500 + depends on AB8500_CORE && MFD_DB8500_PRCMU default y help This enables register access to the AB8500 chip via PRCMU I2C. @@ -575,6 +575,16 @@ config AB3550_CORE LEDs, vibrator, system power and temperature, power management and ALSA sound. +config MFD_DB8500_PRCMU + bool "ST-Ericsson DB8500 Power Reset Control Management Unit" + depends on UX500_SOC_DB8500 + select MFD_CORE + help + Select this option to enable support for the DB8500 Power Reset + and Control Management Unit. This is basically an autonomous + system controller running an XP70 microprocessor, which is accessed + through a register map. + config MFD_CS5535 tristate "Support for CS5535 and CS5536 southbridge core functions" select MFD_CORE diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 419caa9d7dcf..814c57a692a9 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -74,9 +74,11 @@ obj-$(CONFIG_AB3100_CORE) += ab3100-core.o obj-$(CONFIG_AB3100_OTP) += ab3100-otp.o obj-$(CONFIG_AB3550_CORE) += ab3550-core.o obj-$(CONFIG_AB8500_CORE) += ab8500-core.o ab8500-sysctrl.o -obj-$(CONFIG_AB8500_I2C_CORE) += ab8500-i2c.o obj-$(CONFIG_AB8500_DEBUG) += ab8500-debugfs.o obj-$(CONFIG_AB8500_GPADC) += ab8500-gpadc.o +obj-$(CONFIG_MFD_DB8500_PRCMU) += db8500-prcmu.o +# ab8500-i2c need to come after db8500-prcmu (which provides the channel) +obj-$(CONFIG_AB8500_I2C_CORE) += ab8500-i2c.o obj-$(CONFIG_MFD_TIMBERDALE) += timberdale.o obj-$(CONFIG_PMIC_ADP5520) += adp5520.o obj-$(CONFIG_LPC_SCH) += lpc_sch.o diff --git a/drivers/mfd/ab8500-i2c.c b/drivers/mfd/ab8500-i2c.c index 821e6b86afd2..9be541c6b004 100644 --- a/drivers/mfd/ab8500-i2c.c +++ b/drivers/mfd/ab8500-i2c.c @@ -11,8 +11,7 @@ #include #include #include - -#include +#include static int ab8500_i2c_write(struct ab8500 *ab8500, u16 addr, u8 data) { diff --git a/arch/arm/mach-ux500/include/mach/prcmu-regs.h b/drivers/mfd/db8500-prcmu-regs.h similarity index 100% rename from arch/arm/mach-ux500/include/mach/prcmu-regs.h rename to drivers/mfd/db8500-prcmu-regs.h diff --git a/arch/arm/mach-ux500/prcmu-db8500.c b/drivers/mfd/db8500-prcmu.c similarity index 99% rename from arch/arm/mach-ux500/prcmu-db8500.c rename to drivers/mfd/db8500-prcmu.c index c522d26ef348..31f18c8c6bf8 100644 --- a/arch/arm/mach-ux500/prcmu-db8500.c +++ b/drivers/mfd/db8500-prcmu.c @@ -20,10 +20,11 @@ #include #include #include +#include #include -#include -#include + +#include "db8500-prcmu-regs.h" /* Global var to runtime determine TCDM base for v2 or v1 */ static __iomem void *tcdm_base; diff --git a/arch/arm/mach-ux500/include/mach/prcmu.h b/include/linux/mfd/db8500-prcmu.h similarity index 54% rename from arch/arm/mach-ux500/include/mach/prcmu.h rename to include/linux/mfd/db8500-prcmu.h index c49e456162ef..d591d79aa6f0 100644 --- a/arch/arm/mach-ux500/include/mach/prcmu.h +++ b/include/linux/mfd/db8500-prcmu.h @@ -1,3 +1,34 @@ +/* + * Copyright (C) STMicroelectronics 2009 + * Copyright (C) ST-Ericsson SA 2010 + * + * Author: Sundar Iyer + * Author: Martin Persson + * + * License Terms: GNU General Public License v2 + * + * PRCM Unit definitions + */ + +#ifndef __MACH_PRCMU_DEFS_H +#define __MACH_PRCMU_DEFS_H + +enum prcmu_cpu_opp { + CPU_OPP_INIT = 0x00, + CPU_OPP_NO_CHANGE = 0x01, + CPU_OPP_100 = 0x02, + CPU_OPP_50 = 0x03, + CPU_OPP_MAX = 0x04, + CPU_OPP_EXT_CLK = 0x07 +}; +enum prcmu_ape_opp { + APE_OPP_NO_CHANGE = 0x00, + APE_OPP_100 = 0x02, + APE_OPP_50 = 0x03, +}; + +#endif /* __MACH_PRCMU_DEFS_H */ + /* * Copyright (C) STMicroelectronics 2009 * Copyright (C) ST-Ericsson SA 2010 @@ -12,7 +43,6 @@ */ #ifndef __MACH_PRCMU_H #define __MACH_PRCMU_H -#include void __init prcmu_early_init(void); int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); @@ -21,7 +51,7 @@ int prcmu_set_ape_opp(enum prcmu_ape_opp opp); int prcmu_set_cpu_opp(enum prcmu_cpu_opp opp); int prcmu_set_ape_cpu_opps(enum prcmu_ape_opp ape_opp, enum prcmu_cpu_opp cpu_opp); -int prcmu_get_ape_opp(void); +enum prcmu_ape_opp prcmu_get_ape_opp(void); int prcmu_get_cpu_opp(void); bool prcmu_has_arm_maxopp(void); -- 2.39.5