static int __init load_triton_script(struct twl4030_script *tscript) { u8 address = triton_next_free_address; int err; err = twl4030_write_script(address, tscript->script, tscript->size); if (err) return err; triton_next_free_address += tscript->size; if (tscript->flags & TRITON_WRST_SCRIPT) err |= config_warmreset_sequence(address); if (tscript->flags & TRITON_WAKEUP12_SCRIPT) err |= config_wakeup12_sequence(address); if (tscript->flags & TRITON_WAKEUP3_SCRIPT) err |= config_wakeup3_sequence(address); if (tscript->flags & TRITON_SLEEP_SCRIPT) err |= config_sleep_sequence(address); return err; }
static int load_twl4030_script(struct twl4030_script *tscript, u8 address) { int err; static int order; /* Make sure the script isn't going beyond last valid address (0x3f) */ if ((address + tscript->size) > END_OF_SCRIPT) { pr_err("TWL4030 scripts too big error\n"); return -EINVAL; } err = twl4030_write_script(address, tscript->script, tscript->size); if (err) goto out; if (tscript->flags & TWL4030_WRST_SCRIPT) { err = twl4030_config_warmreset_sequence(address); if (err) goto out; } if (tscript->flags & TWL4030_WAKEUP12_SCRIPT) { /* Reset any existing sleep script to avoid hangs on reboot */ err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, END_OF_SCRIPT, R_SEQ_ADD_A2S); if (err) goto out; err = twl4030_config_wakeup12_sequence(address); if (err) goto out; order = 1; } if (tscript->flags & TWL4030_WAKEUP3_SCRIPT) { err = twl4030_config_wakeup3_sequence(address); if (err) goto out; } if (tscript->flags & TWL4030_SLEEP_SCRIPT) { if (!order) pr_warning("TWL4030: Bad order of scripts (sleep "\ "script before wakeup) Leads to boot"\ "failure on some boards\n"); err = twl4030_config_sleep_sequence(address); } out: return err; }
static int __init load_twl4030_script(struct twl4030_script *tscript, u8 address) { int err; static int order; /* Make sure the script isn't going beyond last valid address (0x3f) */ if ((address + tscript->size) > END_OF_SCRIPT) { pr_err("TWL4030 scripts too big error\n"); return -EINVAL; } err = twl4030_write_script(address, tscript->script, tscript->size); if (err) goto out; if (tscript->flags & TWL4030_WRST_SCRIPT) { err = twl4030_config_warmreset_sequence(address); if (err) goto out; } if (tscript->flags & TWL4030_WAKEUP12_SCRIPT) { err = twl4030_config_wakeup12_sequence(address); if (err) goto out; order = 1; } if (tscript->flags & TWL4030_WAKEUP3_SCRIPT) { err = twl4030_config_wakeup3_sequence(address); if (err) goto out; } if (tscript->flags & TWL4030_SLEEP_SCRIPT) { if (order) pr_warning("TWL4030: Bad order of scripts (sleep "\ "script before wakeup) Leads to boot"\ "failure on some boards\n"); err = twl4030_config_sleep_sequence(address); } out: return err; }