summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2018-07-26 20:02:38 +0200
committerFelix Held <felix-coreboot@felixheld.de>2018-08-17 18:27:00 +0000
commite37d771001684246fa714873b37d65e7fe806fe2 (patch)
tree5a0fe2d4318ab4082ca0bbed5579ca0429543e34
parentb6f2e7bd4cdee7e91c3f380a25938f53f6d1c6fd (diff)
downloadcoreboot-e37d771001684246fa714873b37d65e7fe806fe2.tar.xz
superio/ite/it8720f: fix power control init
The existing code for modifying the power state after power loss of the system only implemented the transitions from power off to either power on or power keep properly. Since I don't have a board with this chip, I couldn't test the patch on real hardware. The two cases described above were tested before the original patch was merged, so I'd expect this to work. Change-Id: I3c26a2837e451dbfd3cee82e9beedc0f4a90af03 Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-on: https://review.coreboot.org/27648 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Martin Roth <martinroth@google.com>
-rw-r--r--src/superio/ite/it8720f/it8720f.h4
-rw-r--r--src/superio/ite/it8720f/superio.c24
2 files changed, 21 insertions, 7 deletions
diff --git a/src/superio/ite/it8720f/it8720f.h b/src/superio/ite/it8720f/it8720f.h
index f8b7efbc56..093e895821 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 142686e939..48bbfb2019 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);
}