drivers: ps/2: Tune PS2 driver to support severval mice brands

The PS/2 driver was enabled with a single mouse and kb brand.
However, when plugging other mice brands, the interaction between the
driver and the device(mouse) was broken. A delay after inhibithing
the PS/2 instance helped the internal FSM to start the TX process.

Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@intel.com>
This commit is contained in:
Francisco Munoz 2020-04-28 15:00:48 -07:00 committed by Maureen Helm
commit 51e82855b7

View file

@ -86,7 +86,7 @@ static int ps2_xec_write(struct device *dev, u8_t value)
* FSM.
*/
while (((base->STATUS &
(MCHP_PS2_STATUS_RXD_RDY | MCHP_PS2_STATUS_TX_IDLE))
(MCHP_PS2_STATUS_RX_BUSY | MCHP_PS2_STATUS_TX_IDLE))
!= MCHP_PS2_STATUS_TX_IDLE) && (i < PS2_TIMEOUT)) {
k_busy_wait(50);
i++;
@ -102,8 +102,9 @@ static int ps2_xec_write(struct device *dev, u8_t value)
/* Read to clear data ready bit in the status register*/
dummy = base->TRX_BUFF;
k_sleep(K_MSEC(1));
base->STATUS = MCHP_PS2_STATUS_RW1C_MASK;
/* Switch the interface to TX mode and enable state machine */
base->CTRL = MCHP_PS2_CTRL_TR_TX | MCHP_PS2_CTRL_EN;
@ -169,7 +170,7 @@ static void ps2_xec_isr(void *arg)
(MCHP_PS2_STATUS_TX_TMOUT | MCHP_PS2_STATUS_TX_ST_TMOUT)) {
/* Clear sticky bits and go to read mode */
base->STATUS = MCHP_PS2_STATUS_RW1C_MASK;
LOG_ERR("TX time out");
LOG_ERR("TX time out: %0x", status);
}
/* The control register reverts to RX automatically after