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>
This commit is contained in:
Kevin K Wong
2016-08-19 08:45:10 -07:00
committed by chrome-bot
parent cc68693cda
commit 46dc172711
2 changed files with 15 additions and 8 deletions

View File

@@ -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 */

View File

@@ -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