aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEven Xu <even.xu@intel.com>2016-10-21 18:48:38 -0400
committerJiri Kosina <jkosina@suse.cz>2016-11-05 10:57:37 -0400
commitc2ed83f5426624beda0ecfcb17df033fe4bff7f7 (patch)
treef6c7926a7d9e908f48a42e7de0c6e3a5b76ae2bf
parentcf0ea4da4c7df11f7a508b2f37518e0f117f3791 (diff)
HID: intel-ish-hid: consolidate ish wake up operation
Same operations are done in ish_hw_start() and _ish_hw_reset() to wakeup ISH device. Consolidate them by introducing a new function ish_wakeup() and move the code there. Signed-off-by: Even Xu <even.xu@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/intel-ish-hid/ipc/ipc.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-ish-hid/ipc/ipc.c
index e2517c11e0ee..d4c57214ba6c 100644
--- a/drivers/hid/intel-ish-hid/ipc/ipc.c
+++ b/drivers/hid/intel-ish-hid/ipc/ipc.c
@@ -638,6 +638,28 @@ eoi:
638} 638}
639 639
640/** 640/**
641 * ish_wakeup() - wakeup ishfw from waiting-for-host state
642 * @dev: ishtp device pointer
643 *
644 * Set the dma enable bit and send a void message to FW,
645 * it wil wakeup FW from waiting-for-host state.
646 */
647static void ish_wakeup(struct ishtp_device *dev)
648{
649 /* Set dma enable bit */
650 ish_reg_write(dev, IPC_REG_ISH_RMP2, IPC_RMP2_DMA_ENABLED);
651
652 /*
653 * Send 0 IPC message so that ISH FW wakes up if it was already
654 * asleep.
655 */
656 ish_reg_write(dev, IPC_REG_HOST2ISH_DRBL, IPC_DRBL_BUSY_BIT);
657
658 /* Flush writes to doorbell and REMAP2 */
659 ish_reg_read(dev, IPC_REG_ISH_HOST_FWSTS);
660}
661
662/**
641 * _ish_hw_reset() - HW reset 663 * _ish_hw_reset() - HW reset
642 * @dev: ishtp device pointer 664 * @dev: ishtp device pointer
643 * 665 *
@@ -690,16 +712,8 @@ static int _ish_hw_reset(struct ishtp_device *dev)
690 csr |= PCI_D0; 712 csr |= PCI_D0;
691 pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, csr); 713 pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, csr);
692 714
693 ish_reg_write(dev, IPC_REG_ISH_RMP2, IPC_RMP2_DMA_ENABLED); 715 /* Now we can enable ISH DMA operation and wakeup ISHFW */
694 716 ish_wakeup(dev);
695 /*
696 * Send 0 IPC message so that ISH FW wakes up if it was already
697 * asleep
698 */
699 ish_reg_write(dev, IPC_REG_HOST2ISH_DRBL, IPC_DRBL_BUSY_BIT);
700
701 /* Flush writes to doorbell and REMAP2 */
702 ish_reg_read(dev, IPC_REG_ISH_HOST_FWSTS);
703 717
704 return 0; 718 return 0;
705} 719}
@@ -758,16 +772,9 @@ static int _ish_ipc_reset(struct ishtp_device *dev)
758int ish_hw_start(struct ishtp_device *dev) 772int ish_hw_start(struct ishtp_device *dev)
759{ 773{
760 ish_set_host_rdy(dev); 774 ish_set_host_rdy(dev);
761 /* After that we can enable ISH DMA operation */
762 ish_reg_write(dev, IPC_REG_ISH_RMP2, IPC_RMP2_DMA_ENABLED);
763 775
764 /* 776 /* After that we can enable ISH DMA operation and wakeup ISHFW */
765 * Send 0 IPC message so that ISH FW wakes up if it was already 777 ish_wakeup(dev);
766 * asleep
767 */
768 ish_reg_write(dev, IPC_REG_HOST2ISH_DRBL, IPC_DRBL_BUSY_BIT);
769 /* Flush write to doorbell */
770 ish_reg_read(dev, IPC_REG_ISH_HOST_FWSTS);
771 778
772 set_host_ready(dev); 779 set_host_ready(dev);
773 780