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:
parent
dac1ea6c86
commit
51e82855b7
1 changed files with 4 additions and 3 deletions
|
@ -86,7 +86,7 @@ static int ps2_xec_write(struct device *dev, u8_t value)
|
||||||
* FSM.
|
* FSM.
|
||||||
*/
|
*/
|
||||||
while (((base->STATUS &
|
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)) {
|
!= MCHP_PS2_STATUS_TX_IDLE) && (i < PS2_TIMEOUT)) {
|
||||||
k_busy_wait(50);
|
k_busy_wait(50);
|
||||||
i++;
|
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*/
|
/* Read to clear data ready bit in the status register*/
|
||||||
dummy = base->TRX_BUFF;
|
dummy = base->TRX_BUFF;
|
||||||
|
k_sleep(K_MSEC(1));
|
||||||
base->STATUS = MCHP_PS2_STATUS_RW1C_MASK;
|
base->STATUS = MCHP_PS2_STATUS_RW1C_MASK;
|
||||||
|
|
||||||
/* Switch the interface to TX mode and enable state machine */
|
/* Switch the interface to TX mode and enable state machine */
|
||||||
base->CTRL = MCHP_PS2_CTRL_TR_TX | MCHP_PS2_CTRL_EN;
|
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)) {
|
(MCHP_PS2_STATUS_TX_TMOUT | MCHP_PS2_STATUS_TX_ST_TMOUT)) {
|
||||||
/* Clear sticky bits and go to read mode */
|
/* Clear sticky bits and go to read mode */
|
||||||
base->STATUS = MCHP_PS2_STATUS_RW1C_MASK;
|
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
|
/* The control register reverts to RX automatically after
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue