James has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34884 )
Change subject: superio/ite/it8728f: hook up power_on_after_fail ......................................................................
superio/ite/it8728f: hook up power_on_after_fail
Set the Super IO registers to power the system on if power_on_after_fail is set.
Change-Id: Ia06dbbbed32ba13c2d91efa6377986db8452b3f4 Signed-off-by: James Ye jye836@gmail.com --- M src/superio/ite/it8728f/it8728f.h M src/superio/ite/it8728f/superio.c 2 files changed, 37 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/34884/1
diff --git a/src/superio/ite/it8728f/it8728f.h b/src/superio/ite/it8728f/it8728f.h index 19a04de..36fd94e 100644 --- a/src/superio/ite/it8728f/it8728f.h +++ b/src/superio/ite/it8728f/it8728f.h @@ -28,6 +28,10 @@ #define IT8728F_GPIO 0x07 /* GPIO */ #define IT8728F_IR 0x0a /* Consumer IR */
+/* Registers in LDNs */ +#define IT8728F_EC_PCR1 0xf2 +#define IT8728F_EC_PCR2 0xf4 + /* Global configuration registers. */ #define IT8728F_CONFIG_REG_CC 0x02 /* Configure Control (write-only). */ #define IT8728F_CONFIG_REG_LDN 0x07 /* Logical Device Number. */ diff --git a/src/superio/ite/it8728f/superio.c b/src/superio/ite/it8728f/superio.c index 7107bb4..d05be54 100644 --- a/src/superio/ite/it8728f/superio.c +++ b/src/superio/ite/it8728f/superio.c @@ -20,10 +20,42 @@ #include <pc80/keyboard.h> #include <stdlib.h> #include <superio/ite/common/env_ctrl.h> +#include <option.h>
#include "chip.h" #include "it8728f.h"
+#define MAINBOARD_POWER_OFF 0 +#define MAINBOARD_POWER_ON 1 +#define MAINBOARD_POWER_KEEP 2 + +static void power_control_init(struct device *dev) +{ + int power_on = MAINBOARD_POWER_OFF; + u8 value; + + get_option(&power_on, "power_on_after_fail"); + + pnp_enter_conf_mode(dev); + pnp_set_logical_device(dev); + + value = pnp_read_config(dev, IT8728F_EC_PCR1); + if (power_on == MAINBOARD_POWER_KEEP) + value |= (1 << 5); + else + value &= ~(1 << 5); + pnp_write_config(dev, IT8728F_EC_PCR1, value); + + value = pnp_read_config(dev, IT8728F_EC_PCR2); + if (power_on == MAINBOARD_POWER_ON) + value |= (1 << 5); + else + value &= ~(1 << 5); + pnp_write_config(dev, IT8728F_EC_PCR2, value); + + pnp_exit_conf_mode(dev); +} + static void it8728f_init(struct device *dev) { const struct superio_ite_it8728f_config *conf = dev->chip_info; @@ -39,6 +71,7 @@ if (!conf || !res) break; ite_ec_init(res->base, &conf->ec); + power_control_init(dev); break; case IT8728F_KBCK: set_kbc_ps2_mode();
James has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34884 )
Change subject: superio/ite/it8728f: hook up power_on_after_fail ......................................................................
Patch Set 1:
(1 comment)
This is copied from it8720f, the registers are the same. Tested with GA-P67A-UD3R (out-of-tree at this time).
https://review.coreboot.org/c/coreboot/+/34884/1/src/superio/ite/it8728f/sup... File src/superio/ite/it8728f/superio.c:
https://review.coreboot.org/c/coreboot/+/34884/1/src/superio/ite/it8728f/sup... PS1, Line 30: #define MAINBOARD_POWER_KEEP 2 These defines are currently scattered all around the source tree. It would be better if they could be moved into a single header file, given they're not exclusive to any particular hardware configuration?
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34884 )
Change subject: superio/ite/it8728f: hook up power_on_after_fail ......................................................................
Patch Set 1: Code-Review+1
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34884 )
Change subject: superio/ite/it8728f: hook up power_on_after_fail ......................................................................
Patch Set 1: Code-Review+1
(1 comment)
https://review.coreboot.org/c/coreboot/+/34884/1/src/superio/ite/it8728f/sup... File src/superio/ite/it8728f/superio.c:
https://review.coreboot.org/c/coreboot/+/34884/1/src/superio/ite/it8728f/sup... PS1, Line 30: #define MAINBOARD_POWER_KEEP 2
These defines are currently scattered all around the source tree. […]
this could also be changed into an enum instead of a number of defines
Stefan Reinauer has abandoned this change. ( https://review.coreboot.org/c/coreboot/+/34884?usp=email )
Change subject: superio/ite/it8728f: hook up power_on_after_fail ......................................................................
Abandoned