diff mbox series

[3/4] HID: intel-ish-hid: move doorbell writing before flush

Message ID 20190212120523.27463-3-hong.liu@intel.com (mailing list archive)
State Mainlined
Commit 7e06e0d5493b3e88016b247fe92f67a071d2c655
Delegated to: Jiri Kosina
Headers show
Series [1/4] HID: intel-ish-hid: avoid binding wrong ishtp_cl_device | expand

Commit Message

Hong Liu Feb. 12, 2019, 12:05 p.m. UTC
Reading of IPC_REG_ISH_HOST_FWSTS will flush both message register
and doorbell. So move the doorbell write before reading of
IPC_REG_ISH_HOST_FWSTS.

Signed-off-by: Hong Liu <hong.liu@intel.com>
Tested-by: Hongyan Song <hongyan.song@intel.com>
---
 drivers/hid/intel-ish-hid/ipc/ipc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

srinivas pandruvada Feb. 15, 2019, 1:47 p.m. UTC | #1
On Tue, 2019-02-12 at 20:05 +0800, Hong Liu wrote:
> Reading of IPC_REG_ISH_HOST_FWSTS will flush both message register
> and doorbell. So move the doorbell write before reading of
> IPC_REG_ISH_HOST_FWSTS.
> 
> Signed-off-by: Hong Liu <hong.liu@intel.com>
> Tested-by: Hongyan Song <hongyan.song@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

> ---
>  drivers/hid/intel-ish-hid/ipc/ipc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-
> ish-hid/ipc/ipc.c
> index ff8eca11ff73..30d8a639a5bb 100644
> --- a/drivers/hid/intel-ish-hid/ipc/ipc.c
> +++ b/drivers/hid/intel-ish-hid/ipc/ipc.c
> @@ -314,6 +314,8 @@ static int write_ipc_from_queue(struct
> ishtp_device *dev)
>  		memcpy(&reg, &r_buf[length >> 2], rem);
>  		ish_reg_write(dev, reg_addr, reg);
>  	}
> +	ish_reg_write(dev, IPC_REG_HOST2ISH_DRBL, doorbell_val);
> +
>  	/* Flush writes to msg registers and doorbell */
>  	ish_reg_read(dev, IPC_REG_ISH_HOST_FWSTS);
>  
> @@ -321,8 +323,6 @@ static int write_ipc_from_queue(struct
> ishtp_device *dev)
>  	++dev->ipc_tx_cnt;
>  	dev->ipc_tx_bytes_cnt += IPC_HEADER_GET_LENGTH(doorbell_val);
>  
> -	ish_reg_write(dev, IPC_REG_HOST2ISH_DRBL, doorbell_val);
> -
>  	ipc_send_compl = ipc_link->ipc_send_compl;
>  	ipc_send_compl_prm = ipc_link->ipc_send_compl_prm;
>  	list_del_init(&ipc_link->link);
diff mbox series

Patch

diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-ish-hid/ipc/ipc.c
index ff8eca11ff73..30d8a639a5bb 100644
--- a/drivers/hid/intel-ish-hid/ipc/ipc.c
+++ b/drivers/hid/intel-ish-hid/ipc/ipc.c
@@ -314,6 +314,8 @@  static int write_ipc_from_queue(struct ishtp_device *dev)
 		memcpy(&reg, &r_buf[length >> 2], rem);
 		ish_reg_write(dev, reg_addr, reg);
 	}
+	ish_reg_write(dev, IPC_REG_HOST2ISH_DRBL, doorbell_val);
+
 	/* Flush writes to msg registers and doorbell */
 	ish_reg_read(dev, IPC_REG_ISH_HOST_FWSTS);
 
@@ -321,8 +323,6 @@  static int write_ipc_from_queue(struct ishtp_device *dev)
 	++dev->ipc_tx_cnt;
 	dev->ipc_tx_bytes_cnt += IPC_HEADER_GET_LENGTH(doorbell_val);
 
-	ish_reg_write(dev, IPC_REG_HOST2ISH_DRBL, doorbell_val);
-
 	ipc_send_compl = ipc_link->ipc_send_compl;
 	ipc_send_compl_prm = ipc_link->ipc_send_compl_prm;
 	list_del_init(&ipc_link->link);