diff options
author | Zhou Jingyu <b02241@freescale.com> | 2010-03-11 10:08:32 +0800 |
---|---|---|
committer | Alejandro Gonzalez <alex.gonzalez@digi.com> | 2010-05-25 11:17:21 +0200 |
commit | 262ad3d751730da9801fdf450c108d57bbe107fd (patch) | |
tree | a2fe61f38151cdc65859df262b1a7c68dae15a34 /drivers/power | |
parent | b75491caed15403f20612902bb9ed6b6782178fe (diff) |
ENGR00121496: mx23 battery driver restructure
mx23 battery driver restructure
Signed-off-by: Zhou Jingyu <Jingyu.Zhou@freescale.com>
Signed-off-by: Alejandro Gonzalez <alex.gonzalez@digi.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/mxs/ddi_power_battery.c | 7 | ||||
-rw-r--r-- | drivers/power/mxs/linux.c | 86 |
2 files changed, 29 insertions, 64 deletions
diff --git a/drivers/power/mxs/ddi_power_battery.c b/drivers/power/mxs/ddi_power_battery.c index 2da4f4e826bb..d19b6633950a 100644 --- a/drivers/power/mxs/ddi_power_battery.c +++ b/drivers/power/mxs/ddi_power_battery.c @@ -91,6 +91,10 @@ /* to be re-enabled once FIQ functionality is added */ #define DISABLE_VDDIO_BO_PROTECTION +#ifdef CONFIG_ARCH_MX28 +#define BM_POWER_STS_VBUSVALID BM_POWER_STS_VBUSVALID0 +#endif + /* Globals & Variables */ @@ -1374,13 +1378,14 @@ uint16_t ddi_power_ExpressibleCurrent(uint16_t u16Current) /* */ /* brief */ + bool ddi_power_Get5vPresentFlag(void) { switch (DetectionMethod) { case DDI_POWER_5V_VBUSVALID: /* Check VBUSVALID for 5V present */ return ((__raw_readl(REGS_POWER_BASE + HW_POWER_STS) & - BM_POWER_STS_VBUSVALID0) != 0); + BM_POWER_STS_VBUSVALID) != 0); case DDI_POWER_5V_VDD5V_GT_VDDIO: /* Check VDD5V_GT_VDDIO for 5V present */ return ((__raw_readl(REGS_POWER_BASE + HW_POWER_STS) & diff --git a/drivers/power/mxs/linux.c b/drivers/power/mxs/linux.c index 5025e8a618a9..f878f8ebd456 100644 --- a/drivers/power/mxs/linux.c +++ b/drivers/power/mxs/linux.c @@ -24,9 +24,8 @@ #include <linux/regulator/driver.h> #include <mach/regulator.h> #include <mach/regs-power.h> -#include <mach/mx28.h> +#include <mach/hardware.h> #include <mach/irqs.h> -#include <mach/regs-icoll.h> #include <linux/delay.h> #include <linux/proc_fs.h> #include <linux/interrupt.h> @@ -97,10 +96,12 @@ struct mxs_info { #define OS_SHUTDOWN_BATTERY_VOLTAGE_THRESHOLD_MV 3350 #endif -#ifdef CONFIG_ARCH_STMP3XXX -#define POWER_FIQ +#ifdef CONFIG_ARCH_MX23 +#define IRQ_DCDC4P2_BRNOUT IRQ_DCDC4P2_BO #endif +/* #define POWER_FIQ */ + /* #define DEBUG_IRQS */ /* There is no direct way to detect wall power presence, so assume the AC @@ -126,7 +127,7 @@ void init_protection(struct mxs_info *info) battery_voltage = ddi_power_GetBattery(); /* InitializeFiqSystem(); */ -#ifdef POWER_FIQ +#ifdef CONFIG_ARCH_MX23 ddi_power_InitOutputBrownouts(); #endif @@ -1082,80 +1083,39 @@ static int __init mxs_bat_init(void) lock_vector_tlb(REGS_POWER_BASE); /* disable interrupts to be configured as FIQs */ - __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, - REGS_ICOLL_BASE + - HW_ICOLL_INTERRUPTn_CLR(IRQ_DCDC4P2_BRNOUT)); - - __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, - REGS_ICOLL_BASE + - HW_ICOLL_INTERRUPTn_CLR(IRQ_BATT_BRNOUT)); - - __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, - REGS_ICOLL_BASE + - HW_ICOLL_INTERRUPTn_CLR(IRQ_VDDD_BRNOUT)); - + disable_irq(IRQ_DCDC4P2_BRNOUT); + disable_irq(IRQ_BATT_BRNOUT); + disable_irq(IRQ_VDDD_BRNOUT); #ifndef CONFIG_ARCH_MX28 - __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, - REGS_ICOLL_BASE + - HW_ICOLL_INTERRUPTn_CLR(IRQ_VDD18_BRNOUT)); + disable_irq(IRQ_VDD18_BRNOUT); #endif + disable_irq(IRQ_VDD5V_DROOP); - __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, - REGS_ICOLL_BASE + - HW_ICOLL_INTERRUPTn_CLR(IRQ_VDD5V_DROOP)); /* Enable these interrupts as FIQs */ - __raw_writel(BM_ICOLL_INTERRUPTn_ENFIQ, - REGS_ICOLL_BASE + - HW_ICOLL_INTERRUPTn_SET(IRQ_DCDC4P2_BRNOUT)); - - __raw_writel(BM_ICOLL_INTERRUPTn_ENFIQ, - REGS_ICOLL_BASE + - HW_ICOLL_INTERRUPTn_SET(IRQ_BATT_BRNOUT)); - - __raw_writel(BM_ICOLL_INTERRUPTn_ENFIQ, - REGS_ICOLL_BASE + - HW_ICOLL_INTERRUPTn_SET(IRQ_VDDD_BRNOUT)); - + mxs_set_irq_fiq(IRQ_DCDC4P2_BRNOUT, 1); + mxs_set_irq_fiq(IRQ_BATT_BRNOUT, 1); + mxs_set_irq_fiq(IRQ_VDDD_BRNOUT, 1); #ifndef CONFIG_ARCH_MX28 - __raw_writel(BM_ICOLL_INTERRUPTn_ENFIQ, - REGS_ICOLL_BASE + - HW_ICOLL_INTERRUPTn_SET(IRQ_VDD18_BRNOUT)); + mxs_set_irq_fiq(IRQ_VDD18_BRNOUT, 1); #endif + mxs_set_irq_fiq(IRQ_VDD5V_DROOP, 1); - __raw_writel(BM_ICOLL_INTERRUPTn_ENFIQ, - REGS_ICOLL_BASE + - HW_ICOLL_INTERRUPTn_SET(IRQ_VDD5V_DROOP)); /* enable FIQ functionality */ - __raw_writel(BM_ICOLL_CTRL_FIQ_FINAL_ENABLE, - REGS_ICOLL_BASE + HW_ICOLL_CTRL_SET); - - /* enable these interrupts */ - __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, - REGS_ICOLL_BASE + - HW_ICOLL_INTERRUPTn_SET(IRQ_DCDC4P2_BRNOUT)); - - __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, - REGS_ICOLL_BASE + - HW_ICOLL_INTERRUPTn_SET(IRQ_BATT_BRNOUT)); - - __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, - REGS_ICOLL_BASE + - HW_ICOLL_INTERRUPTn_SET(IRQ_VDDD_BRNOUT)); + mxs_enable_fiq_functionality(1); + enable_irq(IRQ_DCDC4P2_BRNOUT); + enable_irq(IRQ_BATT_BRNOUT); + enable_irq(IRQ_VDDD_BRNOUT); #ifndef CONFIG_ARCH_MX28 - __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, - REGS_ICOLL_BASE + - HW_ICOLL_INTERRUPTn_SET(IRQ_VDD18_BRNOUT)); + enable_irq(IRQ_VDD18_BRNOUT); #endif - - __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, - REGS_ICOLL_BASE + - HW_ICOLL_INTERRUPTn_SET(IRQ_VDD5V_DROOP)); + enable_irq(IRQ_VDD5V_DROOP); } #endif + return platform_driver_register(&mxs_batdrv); } |