Skip to content

Commit c0d973d

Browse files
JhanBoChao-Realtekjhedberg
authored andcommitted
drivers/espi: rts5912: handler all port 80 data until fifo is empty
The rts5912's port 80 has a FIFO. In the ISR (Interrupt Service Routine), extract the FIFO data until the FIFO is empty, otherwise port 80 data will be lost. Signed-off-by: jhan bo chao <[email protected]>
1 parent a7f3c1b commit c0d973d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/espi/espi_realtek_rts5912.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,8 @@ static void espi_periph_ch_setup(const struct device *dev)
684684

685685
#ifdef CONFIG_ESPI_PERIPHERAL_DEBUG_PORT_80
686686

687+
#define P80_MAX_ITEM 16
688+
687689
static void espi_port80_isr(const struct device *dev)
688690
{
689691
const struct espi_rts5912_config *const espi_config = dev->config;
@@ -693,8 +695,13 @@ static void espi_port80_isr(const struct device *dev)
693695
ESPI_PERIPHERAL_NODATA};
694696
volatile struct port80_reg *const port80_reg = espi_config->port80_reg;
695697

696-
evt.evt_data = port80_reg->DATA;
697-
espi_send_callbacks(&espi_data->callbacks, dev, evt);
698+
int i = 0;
699+
700+
while (!(port80_reg->STS & PORT80_STS_FIFOEM) && i < P80_MAX_ITEM) {
701+
evt.evt_data = port80_reg->DATA;
702+
espi_send_callbacks(&espi_data->callbacks, dev, evt);
703+
i++;
704+
}
698705
}
699706

700707
static int espi_peri_ch_port80_setup(const struct device *dev)

0 commit comments

Comments
 (0)