summaryrefslogtreecommitdiffstats
path: root/libopenbmc_intf
diff options
context:
space:
mode:
authorXo Wang <xow@google.com>2016-09-22 16:34:37 -0700
committerPatrick Williams <patrick@stwcx.xyz>2016-10-04 03:01:53 +0000
commitc1ce68b3df3e63a6eef2b9b3c0ff8b176a40df01 (patch)
tree196aec25a5a1e53368f96cbd3f0c990a99ddd5af /libopenbmc_intf
parent20a194169c527fbded95749acd29ef44dfbe70c7 (diff)
downloadblackbird-skeleton-c1ce68b3df3e63a6eef2b9b3c0ff8b176a40df01.tar.gz
blackbird-skeleton-c1ce68b3df3e63a6eef2b9b3c0ff8b176a40df01.zip
pwrctl: Add latch output to power control
On the Zaius machine, the BMC signals that power up the CPU are gated by a latch to protect against GPIO blips during BMC reset/power loss. This adds an optional power GPIO configuration that controls the latch's enable pin. Its behavior is to assert high when the op-pwrctl runs, allowing power_up lines to propagate past their latches. Signed-off-by: Xo Wang <xow@google.com> Change-Id: Ibf0d1db771033cb9bba82575cca1bd21cfb3ad3d
Diffstat (limited to 'libopenbmc_intf')
-rw-r--r--libopenbmc_intf/power_gpio.c10
-rw-r--r--libopenbmc_intf/power_gpio.h2
2 files changed, 10 insertions, 2 deletions
diff --git a/libopenbmc_intf/power_gpio.c b/libopenbmc_intf/power_gpio.c
index 3f4b5a8..543281f 100644
--- a/libopenbmc_intf/power_gpio.c
+++ b/libopenbmc_intf/power_gpio.c
@@ -28,6 +28,7 @@ gboolean read_power_gpio(GDBusConnection *connection, PowerGpio *power_gpio)
GError *error;
GVariant *value;
gchar *power_good_in_name;
+ gchar *latch_out_name;
GVariantIter *power_up_outs_iter;
GVariantIter *reset_outs_iter;
gchar *power_up_out_name;
@@ -66,9 +67,13 @@ gboolean read_power_gpio(GDBusConnection *connection, PowerGpio *power_gpio)
g_assert(value != NULL);
memset(power_gpio, 0, sizeof(*power_gpio));
- g_variant_get(value, "(&sa(sb)a(sb))", &power_good_in_name,
- &power_up_outs_iter, &reset_outs_iter);
+ g_variant_get(value, "(&s&sa(sb)a(sb))", &power_good_in_name, &latch_out_name,
+ &power_up_outs_iter, &reset_outs_iter);
+ g_print("Power GPIO latch output %s\n", latch_out_name);
+ if(*latch_out_name != '\0') { /* latch is optional */
+ power_gpio->latch_out.name = strdup(latch_out_name);
+ }
g_print("Power GPIO power good input %s\n", power_good_in_name);
power_gpio->power_good_in.name = g_strdup(power_good_in_name);
power_gpio->num_power_up_outs = g_variant_iter_n_children(
@@ -109,6 +114,7 @@ gboolean read_power_gpio(GDBusConnection *connection, PowerGpio *power_gpio)
void free_power_gpio(PowerGpio *power_gpio) {
int i;
+ g_free(power_gpio->latch_out.name);
g_free(power_gpio->power_good_in.name);
for(i = 0; i < power_gpio->num_power_up_outs; i++) {
g_free(power_gpio->power_up_outs[i].name);
diff --git a/libopenbmc_intf/power_gpio.h b/libopenbmc_intf/power_gpio.h
index f36a722..77e1c9c 100644
--- a/libopenbmc_intf/power_gpio.h
+++ b/libopenbmc_intf/power_gpio.h
@@ -23,6 +23,8 @@
#include "gpio.h"
typedef struct PowerGpio {
+ /* Optional active high pin enabling writes to latched power_up pins. */
+ GPIO latch_out; /* NULL name if not used. */
/* Active high pin that is asserted following successful host power up. */
GPIO power_good_in;
/* Selectable polarity pins enabling host power rails. */
OpenPOWER on IntegriCloud