aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-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 9660ab6f671..c17b2da86ff 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 f878f8ebd45..ce8b0e3ed75 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)
{