summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorZhou Jingyu <b02241@freescale.com>2010-03-26 14:52:10 +0800
committerAlejandro Gonzalez <alex.gonzalez@digi.com>2010-05-25 11:20:18 +0200
commitadc35bc6774be38f3dc3763c8f7b2ec58e020f2e (patch)
tree9ac20c9fbc327e9ce2fe2d61fada8ff7f6fd5161 /drivers/power
parentc3d20d0e8317f33d921700f442c698c190c4a4b3 (diff)
ENGR00122040 mxs battery driver: fix lradc conflict
use configurable lraadc channel for tempreture increase conditioning current fix build warnings 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.c39
-rw-r--r--drivers/power/mxs/linux.c2
2 files changed, 23 insertions, 18 deletions
diff --git a/drivers/power/mxs/ddi_power_battery.c b/drivers/power/mxs/ddi_power_battery.c
index 9660ab6f671b..c17b2da86ffa 100644
--- a/drivers/power/mxs/ddi_power_battery.c
+++ b/drivers/power/mxs/ddi_power_battery.c
@@ -965,73 +965,76 @@ int ddi_power_init_battery(void)
}
/*
- * Use the the lradc1 channel
+ * Use the the lradc channel
* get the die temperature from on-chip sensor.
*/
uint16_t MeasureInternalDieTemperature(void)
{
- uint32_t ch8Value, ch9Value;
+ uint32_t ch8Value, ch9Value, lradc_irq_mask, channel;
+
+ channel = g_ddi_bc_Configuration.u8BatteryTempChannel;
+ lradc_irq_mask = 1 << channel;
/* power up internal tep sensor block */
__raw_writel(BM_LRADC_CTRL2_TEMPSENSE_PWD,
REGS_LRADC_BASE + HW_LRADC_CTRL2_CLR);
/* mux to the lradc 8th temp channel */
- __raw_writel(BF_LRADC_CTRL4_LRADC1SELECT(0xF),
+ __raw_writel((0xF << (4 * channel)),
REGS_LRADC_BASE + HW_LRADC_CTRL4_CLR);
- __raw_writel(BF_LRADC_CTRL4_LRADC1SELECT(8),
+ __raw_writel((8 << (4 * channel)),
REGS_LRADC_BASE + HW_LRADC_CTRL4_SET);
/* Clear the interrupt flag */
- __raw_writel(BM_LRADC_CTRL1_LRADC1_IRQ,
+ __raw_writel(lradc_irq_mask,
REGS_LRADC_BASE + HW_LRADC_CTRL1_CLR);
- __raw_writel(BF_LRADC_CTRL0_SCHEDULE(1 << LRADC_CH1),
+ __raw_writel(BF_LRADC_CTRL0_SCHEDULE(1 << channel),
REGS_LRADC_BASE + HW_LRADC_CTRL0_SET);
/* Wait for conversion complete*/
while (!(__raw_readl(REGS_LRADC_BASE + HW_LRADC_CTRL1)
- & BM_LRADC_CTRL1_LRADC1_IRQ))
+ & lradc_irq_mask))
cpu_relax();
/* Clear the interrupt flag again */
- __raw_writel(BM_LRADC_CTRL1_LRADC1_IRQ,
+ __raw_writel(lradc_irq_mask,
REGS_LRADC_BASE + HW_LRADC_CTRL1_CLR);
/* read temperature value and clr lradc */
ch8Value = __raw_readl(REGS_LRADC_BASE +
- HW_LRADC_CHn(LRADC_CH1)) & BM_LRADC_CHn_VALUE;
+ HW_LRADC_CHn(channel)) & BM_LRADC_CHn_VALUE;
__raw_writel(BM_LRADC_CHn_VALUE,
- REGS_LRADC_BASE + HW_LRADC_CHn_CLR(LRADC_CH1));
+ REGS_LRADC_BASE + HW_LRADC_CHn_CLR(channel));
/* mux to the lradc 9th temp channel */
- __raw_writel(BF_LRADC_CTRL4_LRADC1SELECT(0xF),
+ __raw_writel((0xF << (4 * channel)),
REGS_LRADC_BASE + HW_LRADC_CTRL4_CLR);
- __raw_writel(BF_LRADC_CTRL4_LRADC1SELECT(9),
+ __raw_writel((9 << (4 * channel)),
REGS_LRADC_BASE + HW_LRADC_CTRL4_SET);
/* Clear the interrupt flag */
- __raw_writel(BM_LRADC_CTRL1_LRADC1_IRQ,
+ __raw_writel(lradc_irq_mask,
REGS_LRADC_BASE + HW_LRADC_CTRL1_CLR);
- __raw_writel(BF_LRADC_CTRL0_SCHEDULE(1 << LRADC_CH1),
+ __raw_writel(BF_LRADC_CTRL0_SCHEDULE(1 << channel),
REGS_LRADC_BASE + HW_LRADC_CTRL0_SET);
/* Wait for conversion complete */
while (!(__raw_readl(REGS_LRADC_BASE + HW_LRADC_CTRL1)
- & BM_LRADC_CTRL1_LRADC1_IRQ))
+ & lradc_irq_mask))
cpu_relax();
/* Clear the interrupt flag */
- __raw_writel(BM_LRADC_CTRL1_LRADC1_IRQ,
+ __raw_writel(lradc_irq_mask,
REGS_LRADC_BASE + HW_LRADC_CTRL1_CLR);
/* read temperature value */
ch9Value = __raw_readl(
- REGS_LRADC_BASE + HW_LRADC_CHn(LRADC_CH1))
+ REGS_LRADC_BASE + HW_LRADC_CHn(channel))
& BM_LRADC_CHn_VALUE;
__raw_writel(BM_LRADC_CHn_VALUE,
- REGS_LRADC_BASE + HW_LRADC_CHn_CLR(LRADC_CH1));
+ REGS_LRADC_BASE + HW_LRADC_CHn_CLR(channel));
/* power down temp sensor block */
__raw_writel(BM_LRADC_CTRL2_TEMPSENSE_PWD,
diff --git a/drivers/power/mxs/linux.c b/drivers/power/mxs/linux.c
index f878f8ebd456..ce8b0e3ed75f 100644
--- a/drivers/power/mxs/linux.c
+++ b/drivers/power/mxs/linux.c
@@ -1053,6 +1053,7 @@ static struct platform_driver mxs_batdrv = {
},
};
+#ifdef POWER_FIQ
static int power_relinquish(void *data, int relinquish)
{
return -1;
@@ -1068,6 +1069,7 @@ extern char power_fiq_start[], power_fiq_end[];
extern void lock_vector_tlb(void *);
extern long power_fiq_count;
static struct proc_dir_entry *power_fiq_proc;
+#endif
static int __init mxs_bat_init(void)
{