Skip to content

espi_it8xxx2_send_vwire() is NOT waiting till completion of VW send to eSPI master #89298

@NagarajuGundimi

Description

@NagarajuGundimi

Is your enhancement proposal related to a problem? Please describe.
espi_it8xxx2_send_vwire() is NOT waiting till completion of VW send to eSPI master. Major concern here is let us assume application code sends back to back VW signals with out any delays in between. Then how the driver will behave/respond to these back to back VW signals. Driver has to ensure successful transmission of previous VW and doesn’t allow next VW transmission until previous VW transmission is completed.

Describe the solution you'd like
Our team is working on identifying eSPI driver improvements and as part of this we identified one to add to this list is optimizing sending VWs.

MCHP eSPI driver assures the successful transmission of VW state change. ITE drivers don’t.
As part of eSPI driver standardization, this improvement should be carried to ITE drivers.

MCHP:

static int espi_xec_send_vwire(const struct device *dev,
enum espi_vwire_signal signal, uint8_t level)
{

    if (dir == ESPI_SLAVE_TO_MASTER) {
            regaddr = xec_smvw_addr(dev, xec_id);

            sys_write8(level, regaddr + SMVW_BI_SRC0 + src_id);

            /* Ensure eSPI virtual wire packet is transmitted
             * There is no interrupt, so need to poll register
             */
            uint8_t rd_cnt = ESPI_XEC_VWIRE_SEND_TIMEOUT;

            while (sys_read8(regaddr + SMVW_BI_SRC_CHG) && rd_cnt--) {
                    k_busy_wait(100);
            }
    }

}

On a separate note, this k_busy_wait(100) should be reduced to a smaller number, say 1.

ITE:

static int espi_it8xxx2_send_vwire(const struct device *dev,
enum espi_vwire_signal signal, uint8_t level)
{

    if (level) {
            vw_reg->VW_INDEX[vw_index] |= level_mask;
    } else {
            vw_reg->VW_INDEX[vw_index] &= ~level_mask;
    }

    return 0;

}

There is already VWCNTRL8 register, I think this register can help to ensure successful transmission of VW state change
This can help optimizing delays associated with VW.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions