AnsweredAssumed Answered

Possible bug in mxs-regulator

Question asked by lategoodbye on Sep 20, 2014
Latest reply on Sep 24, 2014 by christian vieira

I think i've found a bug in the current mxs-regulator implementation ( imx_2.6.35_maintain ).

 

In the file root/arch/arm/mach-mx28/power.c the mode handling is only correct for vddio. The current implementation uses bit 17 for all regulators (vddio, vdda, vddd) to get and set regulator mode. But that's wrong, according to the reference manual DISABLE_STEPPING is different for each regulator.

 

static int set_mode(struct mxs_regulator *sreg, int mode)
{
 int ret = 0;
 u32 val;

 switch (mode) {
 case REGULATOR_MODE_FAST:
 val = __raw_readl(sreg->rdata->control_reg);
 __raw_writel(val | (1 << 17), sreg->rdata->control_reg);
 break;

 case REGULATOR_MODE_NORMAL:
 val = __raw_readl(sreg->rdata->control_reg);
 __raw_writel(val & ~(1<<17), sreg->rdata->control_reg);
 break;

 default:
 ret = -EINVAL;
 break;
 }
 return ret;
}

static int get_mode(struct mxs_regulator *sreg)
{
 u32 val = __raw_readl(sreg->rdata->control_reg) & (1 << 17);

 return val ? REGULATOR_MODE_FAST : REGULATOR_MODE_NORMAL;
}

 

Can anyone confirm?

Outcomes