Felix Held has uploaded this change for review. ( https://review.coreboot.org/27648
Change subject: superio/ite/it8720f: fix power control init ......................................................................
superio/ite/it8720f: fix power control init
Change-Id: I3c26a2837e451dbfd3cee82e9beedc0f4a90af03 Signed-off-by: Felix Held felix-coreboot@felixheld.de --- M src/superio/ite/it8720f/it8720f.h M src/superio/ite/it8720f/superio.c 2 files changed, 21 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/27648/1
diff --git a/src/superio/ite/it8720f/it8720f.h b/src/superio/ite/it8720f/it8720f.h index f8b7efb..093e895 100644 --- a/src/superio/ite/it8720f/it8720f.h +++ b/src/superio/ite/it8720f/it8720f.h @@ -30,4 +30,8 @@ #define IT8720F_GPIO 0x07 /* GPIO (including SPI flash interface) */ #define IT8720F_CIR 0x0a /* Consumer IR */
+/* Registers in LDNs */ +#define IT8720F_EC_PCR1 0xf2 +#define IT8720F_EC_PCR2 0xf4 + #endif /* SUPERIO_ITE_IT8720F_H */ diff --git a/src/superio/ite/it8720f/superio.c b/src/superio/ite/it8720f/superio.c index 142686e..b3e5222 100644 --- a/src/superio/ite/it8720f/superio.c +++ b/src/superio/ite/it8720f/superio.c @@ -33,17 +33,27 @@ static void power_control_init(struct device *dev) { int power_on = MAINBOARD_POWER_OFF; - u8 addr, value; + u8 value;
get_option(&power_on, "power_on_after_fail"); - if (power_on == MAINBOARD_POWER_OFF) - return; + pnp_enter_conf_mode(dev); pnp_set_logical_device(dev); - addr = power_on == MAINBOARD_POWER_KEEP ? 0xf2 : 0xf4; - value = pnp_read_config(dev, addr); - value |= BIT(5); - pnp_write_config(dev, addr, value); + + value = pnp_read_config(dev, IT8720F_EC_PCR1); + if (power_on == MAINBOARD_POWER_KEEP) + value |= (1<<5); + else + value &= ~(1<<5); + pnp_write_config(dev, IT8720F_EC_PCR1, value); + + value = pnp_read_config(dev, IT8720F_EC_PCR2); + if (power_on == MAINBOARD_POWER_ON) + value |= (1<<5); + else + value &= ~(1<<5); + pnp_write_config(dev, IT8720F_EC_PCR2, value); + pnp_exit_conf_mode(dev); }