Skip to content

Commit b9d8e9a

Browse files
Dino-Lihenrikbrixandersen
authored andcommitted
it8xxx2/espi: disable IBF interrupt by calling interrupt controller API
Disable input buffer full interrupt for 60h/64h and 62h/66 ports by calling interrupt controller API. The API has barrier mechanism to ensure that a thread's requirement to disable peripheral interrupt takes effect before enabling CPU interrupt. Therefore, the disabling operation does not occur in ISR and results in interrupt 0 symptom. Signed-off-by: Dino Li <[email protected]>
1 parent 8575844 commit b9d8e9a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

drivers/espi/espi_it8xxx2.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,13 +855,14 @@ static int espi_it8xxx2_write_lpc_request(const struct device *dev,
855855
break;
856856
case E8042_RESUME_IRQ:
857857
/* Enable KBC IBF interrupt */
858-
kbc_reg->KBHICR |= KBC_KBHICR_IBFCIE;
858+
irq_enable(IT8XXX2_KBC_IBF_IRQ);
859859
break;
860860
case E8042_PAUSE_IRQ:
861861
/* Disable KBC IBF interrupt */
862-
kbc_reg->KBHICR &= ~KBC_KBHICR_IBFCIE;
862+
irq_disable(IT8XXX2_KBC_IBF_IRQ);
863863
break;
864864
case E8042_CLEAR_OBF:
865+
volatile uint8_t _kbhicr __unused;
865866
/*
866867
* After enabling IBF/OBF clear mode, we have to make
867868
* sure that IBF interrupt is not triggered before
@@ -878,6 +879,12 @@ static int espi_it8xxx2_write_lpc_request(const struct device *dev,
878879
kbc_reg->KBHICR &= ~KBC_KBHICR_COBF;
879880
/* Disable clear mode */
880881
kbc_reg->KBHICR &= ~KBC_KBHICR_IBFOBFCME;
882+
/*
883+
* I/O access synchronization, this load operation will
884+
* guarantee the above modification of SOC's register
885+
* can be seen by any following instructions.
886+
*/
887+
_kbhicr = kbc_reg->KBHICR;
881888
irq_unlock(key);
882889
break;
883890
case E8042_SET_FLAG:
@@ -913,9 +920,9 @@ static int espi_it8xxx2_write_lpc_request(const struct device *dev,
913920
/* Enable/Disable PMC1 (port 62h/66h) interrupt */
914921
case ECUSTOM_HOST_SUBS_INTERRUPT_EN:
915922
if (*data) {
916-
pmc_reg->PM1CTL |= PMC_PM1CTL_IBFIE;
923+
irq_enable(IT8XXX2_PMC1_IBF_IRQ);
917924
} else {
918-
pmc_reg->PM1CTL &= ~PMC_PM1CTL_IBFIE;
925+
irq_disable(IT8XXX2_PMC1_IBF_IRQ);
919926
}
920927
break;
921928
case ECUSTOM_HOST_CMD_SEND_RESULT:

0 commit comments

Comments
 (0)