Skip to content

Commit

Permalink
drivers: ps2: Microchip XEC PS2 add MEC172x support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jvasanth1 authored and MaureenHelm committed May 3, 2022
1 parent bacf4ff commit 60a41f6
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
3 changes: 2 additions & 1 deletion drivers/ps2/Kconfig.xec
Original file line number Diff line number Diff line change
Expand Up @@ -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.
27 changes: 27 additions & 0 deletions drivers/ps2/ps2_mchp_xec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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;
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion dts/arm/microchip/mec172xnsz.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,8 @@
#size-cells = <0>;
status = "disabled";
};
/* uarts were here */
ps2_0: ps2@40009000 {
compatible = "microchip,xec-ps2";
reg = <0x40009000 0x40>;
interrupts = <100 1>;
girqs = <18 10>;
Expand Down
4 changes: 4 additions & 0 deletions soc/arm/microchip_mec/mec172x/Kconfig.defconfig.series
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@ config CLOCK_CONTROL_MCHP_XEC
config MCHP_ECIA_XEC
default y

config PS2_XEC
default y
depends on PS2

endif # SOC_SERIES_MEC172X

0 comments on commit 60a41f6

Please sign in to comment.