summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin K Wong <kevin.k.wong@intel.com>2016-08-19 08:45:10 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-08-21 15:52:09 -0700
commit46dc1727111cf0e891982110f5feaed0acda08c3 (patch)
treec06daa2acec7c3b35b096f5e7e74ca61fe207c71
parentcc68693cda0d520229971b73c116d434c48bdd65 (diff)
downloadchrome-ec-46dc1727111cf0e891982110f5feaed0acda08c3.tar.gz
npcx: set the BUSY bit while handling ACPI command write.
BUG=chrome-os-partner:55583 BRANCH=none TEST=verified OBF status is cleared during idle without event which means kernel driver waited for the BUSY bit and read the data. Change-Id: I79357fea5483fe7a175c60f54235926e105ec832 Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-on: https://chromium-review.googlesource.com/373043 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
-rw-r--r--chip/npcx/lpc.c16
-rw-r--r--chip/npcx/registers.h7
2 files changed, 15 insertions, 8 deletions
diff --git a/chip/npcx/lpc.c b/chip/npcx/lpc.c
index 4523ff032a..7652b1bbeb 100644
--- a/chip/npcx/lpc.c
+++ b/chip/npcx/lpc.c
@@ -245,7 +245,7 @@ static void lpc_send_response(struct host_cmd_handler_args *args)
/* Write result to the data byte. This sets the TOH status bit. */
NPCX_HIPMDO(PMC_HOST_CMD) = args->result;
/* Clear processing flag */
- CLEAR_BIT(NPCX_HIPMST(PMC_HOST_CMD), 2);
+ CLEAR_BIT(NPCX_HIPMST(PMC_HOST_CMD), NPCX_HIPMST_F0);
}
static void lpc_send_response_packet(struct host_packet *pkt)
@@ -257,7 +257,7 @@ static void lpc_send_response_packet(struct host_packet *pkt)
/* Write result to the data byte. This sets the TOH status bit. */
NPCX_HIPMDO(PMC_HOST_CMD) = pkt->driver_result;
/* Clear processing flag */
- CLEAR_BIT(NPCX_HIPMST(PMC_HOST_CMD), 2);
+ CLEAR_BIT(NPCX_HIPMST(PMC_HOST_CMD), NPCX_HIPMST_F0);
}
int lpc_keyboard_has_char(void)
@@ -430,6 +430,9 @@ static void handle_acpi_write(int is_cmd)
{
uint8_t value, result;
+ /* Set processing flag before reading command byte */
+ SET_BIT(NPCX_HIPMST(PMC_ACPI), NPCX_HIPMST_F0);
+
/* Read command/data; this clears the FRMH status bit. */
value = NPCX_HIPMDI(PMC_ACPI);
@@ -437,6 +440,9 @@ static void handle_acpi_write(int is_cmd)
if (acpi_ap_to_ec(is_cmd, value, &result))
NPCX_HIPMDO(PMC_ACPI) = result;
+ /* Clear processing flag */
+ CLEAR_BIT(NPCX_HIPMST(PMC_ACPI), NPCX_HIPMST_F0);
+
/*
* ACPI 5.0-12.6.1: Generate SCI for Input Buffer Empty / Output Buffer
* Full condition on the kernel channel.
@@ -452,7 +458,7 @@ static void handle_acpi_write(int is_cmd)
static void handle_host_write(int is_cmd)
{
/* Set processing flag before reading command byte */
- SET_BIT(NPCX_HIPMST(PMC_HOST_CMD), 2);
+ SET_BIT(NPCX_HIPMST(PMC_HOST_CMD), NPCX_HIPMST_F0);
/*
* Read the command byte. This clears the FRMH bit in
* the status byte.
@@ -488,7 +494,7 @@ static void handle_host_write(int is_cmd)
int csum, i;
/* Clear processing flag */
- CLEAR_BIT(NPCX_HIPMST(PMC_HOST_CMD), 2);
+ CLEAR_BIT(NPCX_HIPMST(PMC_HOST_CMD), NPCX_HIPMST_F0);
host_cmd_args.version = lpc_host_args->command_version;
host_cmd_args.params = params_copy;
@@ -527,7 +533,7 @@ static void handle_host_write(int is_cmd)
/* Old style command, now unsupported */
host_cmd_args.result = EC_RES_INVALID_COMMAND;
/* Clear processing flag */
- CLEAR_BIT(NPCX_HIPMST(PMC_HOST_CMD), 2);
+ CLEAR_BIT(NPCX_HIPMST(PMC_HOST_CMD), NPCX_HIPMST_F0);
}
/* Hand off to host command handler */
diff --git a/chip/npcx/registers.h b/chip/npcx/registers.h
index 67fceaf5d4..78acaefbd5 100644
--- a/chip/npcx/registers.h
+++ b/chip/npcx/registers.h
@@ -948,9 +948,10 @@ enum NPCX_PMC_PWDWN_CTL_T {
#define NPCX_HIPMCTL_IBFIE 0
/* NPCX_HIPMST */
-#define NPCX_HIPMST_ST0 4
-#define NPCX_HIPMST_ST1 5
-#define NPCX_HIPMST_ST2 6
+#define NPCX_HIPMST_F0 2 /* EC_LPC_CMDR_BUSY */
+#define NPCX_HIPMST_ST0 4 /* EC_LPC_CMDR_ACPI_BRST */
+#define NPCX_HIPMST_ST1 5 /* EC_LPC_CMDR_SCI */
+#define NPCX_HIPMST_ST2 6 /* EC_LPC_CMDR_SMI */
/* NPCX_HIPMIC */
#define NPCX_HIPMIC_SMIB 1