diff mbox

reboot command fails with low frequency

Message ID CAOf5uwmyOZOTMBGnQU38-D=Emo6Rdrd8fDW9Hk+_r4RG4=+nrA@mail.gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Michael Nazzareno Trimarchi March 5, 2015, 10:58 a.m. UTC
Hi

You should find the twl4030 power script and you should have something like this

static struct twl4030_ins wrst_seq[] __initdata = {
        {MSG_SINGULAR(DEV_GRP_NULL, 0x1b, RES_STATE_OFF), 2},
        {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_WRST), 15},
        {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_WRST), 15},
        {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_WRST), 0x60},
        {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 2},
        {MSG_SINGULAR(DEV_GRP_NULL, 0x1b, RES_STATE_ACTIVE), 2},
};

static struct twl4030_script wrst_script __initdata = {
        .script = wrst_seq,
        .size   = ARRAY_SIZE(wrst_seq),
        .flags  = TWL4030_WRST_SCRIPT,
};

static struct twl4030_script *omap3_power_scripts[] __initdata = {
        &wrst_script,
};

If I remember it was solved by some change here. In my old kernel I
have this commit

 Fix the reboot at lower frequency

    Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>


But this apply on an old device with a newer kernel and I don't
remember now the reason ;) Sorry.

Is this an android device? (2.6.37??? is really old)

Michael

On Thu, Mar 5, 2015 at 10:29 AM, Ran Shalit <ranshalit@gmail.com> wrote:
>>> We observer that with highest available frequency (600000) reboot
>>> command is OK, but when frequency is changed to lower value, the
>>> reboot command fails.
>>> Has anyone observed such behaviour ?
>>
>> I remember some commit for this problem. What version of the linux are
>> you running?
>
> I use Linux version 2.6.37 #36 PREEMPT Thu Mar 5 10:56:04 IST 2015
> armv7l GNU/Linux
>
> Do you know how I can find this fix ?
>
> Thanks!
> Ran

Comments

Ran Shalit March 5, 2015, 12:25 p.m. UTC | #1
On Thu, Mar 5, 2015 at 12:58 PM, Michael Trimarchi
<michael@amarulasolutions.com> wrote:
> Hi
>
> You should find the twl4030 power script and you should have something like this
>
> static struct twl4030_ins wrst_seq[] __initdata = {
>         {MSG_SINGULAR(DEV_GRP_NULL, 0x1b, RES_STATE_OFF), 2},
>         {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_WRST), 15},
>         {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_WRST), 15},
>         {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_WRST), 0x60},
>         {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 2},
>         {MSG_SINGULAR(DEV_GRP_NULL, 0x1b, RES_STATE_ACTIVE), 2},
> };
>
> static struct twl4030_script wrst_script __initdata = {
>         .script = wrst_seq,
>         .size   = ARRAY_SIZE(wrst_seq),
>         .flags  = TWL4030_WRST_SCRIPT,
> };
>
> static struct twl4030_script *omap3_power_scripts[] __initdata = {
>         &wrst_script,
> };
>
> If I remember it was solved by some change here. In my old kernel I
> have this commit
>
>  Fix the reboot at lower frequency
>
>     Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
>
> diff --git a/arch/arm/mach-omap2/board-panther.c
> b/arch/arm/mach-omap2/board-panther.c
> index ad2adf3..c71fdd9 100644
> --- a/arch/arm/mach-omap2/board-panther.c
> +++ b/arch/arm/mach-omap2/board-panther.c
> @@ -368,7 +368,7 @@ static int __init panther_i2c_init(void)
>  {
>         omap3_pmic_get_config(&panther_twldata,
>                         TWL_COMMON_PDATA_MADC |
> -                       TWL_COMMON_PDATA_AUDIO,
> +                       TWL_COMMON_PDATA_AUDIO | TWL_COMMON_PDATA_POWER,
>                         TWL_COMMON_REGULATOR_VDAC);
>
>         omap3_pmic_init("twl4030", &panther_twldata);
>
> But this apply on an old device with a newer kernel and I don't
> remember now the reason ;) Sorry.
>
> Is this an android device? (2.6.37??? is really old)
>
I have something quite different in my code:

static int __init twl4030_config_warmreset_sequence(u8 address)
{
int err;
u8 rd_data;

/* Set WARM RESET SEQ address for P1 */
err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, address,
R_SEQ_ADD_WARM);
if (err)
goto out;

/* P1/P2/P3 enable WARMRESET */
err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &rd_data,
R_P1_SW_EVENTS);
if (err)
goto out;

rd_data |= ENABLE_WARMRESET;
err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, rd_data,
R_P1_SW_EVENTS);
if (err)
goto out;

err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &rd_data,
R_P2_SW_EVENTS);
if (err)
goto out;

rd_data |= ENABLE_WARMRESET;
err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, rd_data,
R_P2_SW_EVENTS);
if (err)
goto out;

err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &rd_data,
R_P3_SW_EVENTS);
if (err)
goto out;

rd_data |= ENABLE_WARMRESET;
err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, rd_data,
R_P3_SW_EVENTS);
out:
if (err)
pr_err("TWL4030 warmreset seq config error\n");
return err;
}

And the board is TI's board_omap3evm.c.

Ran
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ran Shalit March 5, 2015, 12:29 p.m. UTC | #2
I think I can also do some workaround if I set the frequency to the
highest level just before doing reset. The thing is that I mustn't use
sysfs in my system. Is there some way to set frequency without using
sysfs ?
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/board-panther.c
b/arch/arm/mach-omap2/board-panther.c
index ad2adf3..c71fdd9 100644
--- a/arch/arm/mach-omap2/board-panther.c
+++ b/arch/arm/mach-omap2/board-panther.c
@@ -368,7 +368,7 @@  static int __init panther_i2c_init(void)
 {
        omap3_pmic_get_config(&panther_twldata,
                        TWL_COMMON_PDATA_MADC |
-                       TWL_COMMON_PDATA_AUDIO,
+                       TWL_COMMON_PDATA_AUDIO | TWL_COMMON_PDATA_POWER,
                        TWL_COMMON_REGULATOR_VDAC);

        omap3_pmic_init("twl4030", &panther_twldata);