drivers: ps2: Microchip XEC PS2 add MEC172x support

Update the Microchip XEC PS2 driver to support MEC172x.
NOTE: MEC15xx has two PS2 controllers and
MEC172x has one.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
This commit is contained in:
Jay Vasanth 2022-04-08 18:03:26 -04:00 committed by Maureen Helm
commit 60a41f6878
4 changed files with 34 additions and 2 deletions

View file

@ -8,4 +8,5 @@ config PS2_XEC
depends on SOC_FAMILY_MEC && ESPI_PERIPHERAL_8042_KBC
help
Enable the Microchip XEC PS2 IO driver. The driver also
depends on the KBC 8042 keyboard controller.
depends on the KBC 8042 keyboard controller. Note, MEC15xx
series has two controllers and MEC172x series has one.

View file

@ -10,6 +10,10 @@
#include <arch/arm/aarch32/cortex_m/cmsis.h>
#include <errno.h>
#include <device.h>
#ifdef CONFIG_SOC_SERIES_MEC172X
#include <drivers/clock_control/mchp_xec_clock_control.h>
#include <drivers/interrupt_controller/intc_mchp_xec_ecia.h>
#endif
#include <drivers/ps2.h>
#include <soc.h>
#include <logging/log.h>
@ -35,6 +39,28 @@ struct ps2_xec_data {
struct k_sem tx_lock;
};
#ifdef CONFIG_SOC_SERIES_MEC172X
static inline void ps2_xec_slp_en_clr(const struct device *dev)
{
const struct ps2_xec_config * const cfg = dev->config;
z_mchp_xec_pcr_periph_sleep(cfg->pcr_idx, cfg->pcr_pos, 0);
}
static inline void ps2_xec_girq_clr(const struct device *dev)
{
const struct ps2_xec_config * const cfg = dev->config;
mchp_soc_ecia_girq_src_clr(cfg->girq_id, cfg->girq_bit);
}
static inline void ps2_xec_girq_en(const struct device *dev)
{
const struct ps2_xec_config * const cfg = dev->config;
mchp_xec_ecia_girq_src_en(cfg->girq_id, cfg->girq_bit);
}
#else
static inline void ps2_xec_slp_en_clr(const struct device *dev)
{
const struct ps2_xec_config * const cfg = dev->config;
@ -59,6 +85,7 @@ static inline void ps2_xec_girq_en(const struct device *dev)
MCHP_GIRQ_ENSET(cfg->girq_id) = BIT(cfg->girq_bit);
}
#endif /* CONFIG_SOC_SERIES_MEC172X */
static int ps2_xec_configure(const struct device *dev,
ps2_callback_t callback_isr)