drivers: all: mchp_xec: remove conditional support for pinctrl
The Microchip XEC platform always uses pinctrl, there's no need to keep extra macrology around pinctrl. Also updated driver's Kconfig options to `select PINCTRL`. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
989d103d53
commit
b2d9212ea0
|
@ -7,5 +7,6 @@ config EEPROM_XEC
|
|||
bool "MCHP XEC EEPROM driver"
|
||||
default y
|
||||
depends on DT_HAS_MICROCHIP_XEC_EEPROM_ENABLED
|
||||
select PINCTRL
|
||||
help
|
||||
Enable support for Microchip XEC EEPROM driver.
|
||||
|
|
|
@ -11,9 +11,7 @@
|
|||
#include <zephyr/kernel.h>
|
||||
#include <soc.h>
|
||||
|
||||
#ifdef CONFIG_PINCTRL
|
||||
#include <zephyr/drivers/pinctrl.h>
|
||||
#endif
|
||||
|
||||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(eeprom_xec, CONFIG_EEPROM_LOG_LEVEL);
|
||||
|
@ -64,9 +62,7 @@ struct eeprom_xec_regs {
|
|||
struct eeprom_xec_config {
|
||||
struct eeprom_xec_regs * const regs;
|
||||
size_t size;
|
||||
#ifdef CONFIG_PINCTRL
|
||||
const struct pinctrl_dev_config *pcfg;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct eeprom_xec_data {
|
||||
|
@ -307,14 +303,12 @@ static int eeprom_xec_init(const struct device *dev)
|
|||
|
||||
k_mutex_init(&data->lock_mtx);
|
||||
|
||||
#ifdef CONFIG_PINCTRL
|
||||
int ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT);
|
||||
|
||||
if (ret != 0) {
|
||||
LOG_ERR("XEC EEPROM pinctrl init failed (%d)", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
regs->mode |= XEC_EEPROM_MODE_ACTIVATE;
|
||||
|
||||
|
@ -327,16 +321,12 @@ static const struct eeprom_driver_api eeprom_xec_api = {
|
|||
.size = eeprom_xec_size,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PINCTRL
|
||||
PINCTRL_DT_INST_DEFINE(0);
|
||||
#endif
|
||||
|
||||
static const struct eeprom_xec_config eeprom_config = {
|
||||
.regs = (struct eeprom_xec_regs * const)DT_INST_REG_ADDR(0),
|
||||
.size = DT_INST_REG_SIZE(0),
|
||||
#ifdef CONFIG_PINCTRL
|
||||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0),
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct eeprom_xec_data eeprom_data;
|
||||
|
|
|
@ -8,6 +8,7 @@ menuconfig KSCAN_XEC
|
|||
default y
|
||||
depends on DT_HAS_MICROCHIP_XEC_KSCAN_ENABLED
|
||||
select MULTITHREADING
|
||||
select PINCTRL
|
||||
help
|
||||
Enable the Microchip XEC Kscan IO driver.
|
||||
|
||||
|
|
|
@ -14,9 +14,7 @@
|
|||
#include <zephyr/drivers/interrupt_controller/intc_mchp_xec_ecia.h>
|
||||
#endif
|
||||
#include <zephyr/drivers/kscan.h>
|
||||
#ifdef CONFIG_PINCTRL
|
||||
#include <zephyr/drivers/pinctrl.h>
|
||||
#endif
|
||||
#include <zephyr/kernel.h>
|
||||
#include <soc.h>
|
||||
#include <zephyr/sys/atomic.h>
|
||||
|
@ -50,9 +48,7 @@ struct kscan_xec_config {
|
|||
uint8_t pcr_idx;
|
||||
uint8_t pcr_pos;
|
||||
uint8_t rsvd[3];
|
||||
#ifdef CONFIG_PINCTRL
|
||||
const struct pinctrl_dev_config *pcfg;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct kscan_xec_data {
|
||||
|
@ -465,14 +461,12 @@ static int kscan_xec_init(const struct device *dev)
|
|||
struct kscan_xec_data *const data = dev->data;
|
||||
struct kscan_regs *regs = cfg->regs;
|
||||
|
||||
#ifdef CONFIG_PINCTRL
|
||||
int ret = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT);
|
||||
|
||||
if (ret != 0) {
|
||||
LOG_ERR("XEC KSCAN pinctrl init failed (%d)", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
kscan_clr_slp_en(dev);
|
||||
|
||||
|
@ -509,9 +503,7 @@ static int kscan_xec_init(const struct device *dev)
|
|||
|
||||
static struct kscan_xec_data kbd_data;
|
||||
|
||||
#ifdef CONFIG_PINCTRL
|
||||
PINCTRL_DT_INST_DEFINE(0);
|
||||
#endif
|
||||
|
||||
static struct kscan_xec_config kscan_xec_cfg_0 = {
|
||||
.regs = (struct kscan_regs *)(DT_INST_REG_ADDR(0)),
|
||||
|
@ -519,9 +511,7 @@ static struct kscan_xec_config kscan_xec_cfg_0 = {
|
|||
.girq_pos = (uint8_t)(DT_INST_PROP_BY_IDX(0, girqs, 1)),
|
||||
.pcr_idx = (uint8_t)(DT_INST_PROP_BY_IDX(0, pcrs, 0)),
|
||||
.pcr_pos = (uint8_t)(DT_INST_PROP_BY_IDX(0, pcrs, 1)),
|
||||
#ifdef CONFIG_PINCTRL
|
||||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0),
|
||||
#endif
|
||||
};
|
||||
|
||||
DEVICE_DT_INST_DEFINE(0, kscan_xec_init,
|
||||
|
|
|
@ -7,5 +7,6 @@ config PECI_XEC
|
|||
bool "XEC Microchip PECI driver"
|
||||
default y
|
||||
depends on DT_HAS_MICROCHIP_XEC_PECI_ENABLED
|
||||
select PINCTRL
|
||||
help
|
||||
Enable the Microchip XEC PECI IO driver.
|
||||
|
|
|
@ -14,9 +14,7 @@
|
|||
#include <zephyr/drivers/interrupt_controller/intc_mchp_xec_ecia.h>
|
||||
#endif
|
||||
#include <zephyr/drivers/peci.h>
|
||||
#ifdef CONFIG_PINCTRL
|
||||
#include <zephyr/drivers/pinctrl.h>
|
||||
#endif
|
||||
#include <zephyr/pm/device.h>
|
||||
#include <zephyr/pm/policy.h>
|
||||
#include <soc.h>
|
||||
|
@ -52,9 +50,7 @@ struct peci_xec_config {
|
|||
uint8_t girq_pos;
|
||||
uint8_t pcr_idx;
|
||||
uint8_t pcr_pos;
|
||||
#ifdef CONFIG_PINCTRL
|
||||
const struct pinctrl_dev_config *pcfg;
|
||||
#endif
|
||||
};
|
||||
|
||||
enum peci_pm_policy_state_flag {
|
||||
|
@ -525,14 +521,12 @@ static int peci_xec_init(const struct device *dev)
|
|||
struct peci_regs * const regs = cfg->regs;
|
||||
struct ecs_regs * const ecs_regs = (struct ecs_regs *)(DT_REG_ADDR(DT_NODELABEL(ecs)));
|
||||
|
||||
#ifdef CONFIG_PINCTRL
|
||||
int ret = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT);
|
||||
|
||||
if (ret != 0) {
|
||||
LOG_ERR("XEC PECI pinctrl init failed (%d)", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PECI_INTERRUPT_DRIVEN
|
||||
k_sem_init(&data->tx_lock, 0, 1);
|
||||
|
@ -568,9 +562,7 @@ static int peci_xec_init(const struct device *dev)
|
|||
|
||||
static struct peci_xec_data peci_data;
|
||||
|
||||
#ifdef CONFIG_PINCTRL
|
||||
PINCTRL_DT_INST_DEFINE(0);
|
||||
#endif
|
||||
|
||||
static const struct peci_xec_config peci_xec_config = {
|
||||
.regs = (struct peci_regs * const)(DT_INST_REG_ADDR(0)),
|
||||
|
@ -579,9 +571,7 @@ static const struct peci_xec_config peci_xec_config = {
|
|||
.girq_pos = DT_INST_PROP_BY_IDX(0, girqs, 1),
|
||||
.pcr_idx = DT_INST_PROP_BY_IDX(0, pcrs, 0),
|
||||
.pcr_pos = DT_INST_PROP_BY_IDX(0, pcrs, 1),
|
||||
#ifdef CONFIG_PINCTRL
|
||||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0),
|
||||
#endif
|
||||
};
|
||||
|
||||
PM_DEVICE_DT_INST_DEFINE(0, peci_xec_pm_action);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
config PS2_XEC
|
||||
bool "XEC Microchip PS2 driver"
|
||||
depends on SOC_FAMILY_MEC && ESPI_PERIPHERAL_8042_KBC
|
||||
select PINCTRL
|
||||
help
|
||||
Enable the Microchip XEC PS2 IO driver. The driver also
|
||||
depends on the KBC 8042 keyboard controller. Note, MEC15xx
|
||||
|
|
|
@ -15,9 +15,7 @@
|
|||
#include <zephyr/drivers/clock_control/mchp_xec_clock_control.h>
|
||||
#include <zephyr/drivers/interrupt_controller/intc_mchp_xec_ecia.h>
|
||||
#endif
|
||||
#ifdef CONFIG_PINCTRL
|
||||
#include <zephyr/drivers/pinctrl.h>
|
||||
#endif
|
||||
#include <zephyr/drivers/ps2.h>
|
||||
#include <soc.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
|
@ -37,9 +35,7 @@ struct ps2_xec_config {
|
|||
uint8_t pcr_idx;
|
||||
uint8_t pcr_pos;
|
||||
void (*irq_config_func)(void);
|
||||
#ifdef CONFIG_PINCTRL
|
||||
const struct pinctrl_dev_config *pcfg;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct ps2_xec_data {
|
||||
|
@ -261,14 +257,12 @@ static int ps2_xec_init(const struct device *dev)
|
|||
const struct ps2_xec_config * const cfg = dev->config;
|
||||
struct ps2_xec_data * const data = dev->data;
|
||||
|
||||
#ifdef CONFIG_PINCTRL
|
||||
int ret = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT);
|
||||
|
||||
if (ret != 0) {
|
||||
LOG_ERR("XEC PS2 pinctrl init failed (%d)", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
ps2_xec_slp_en_clr(dev);
|
||||
|
||||
|
@ -279,8 +273,6 @@ static int ps2_xec_init(const struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PINCTRL
|
||||
#define XEC_PS2_PINCTRL_CFG(inst) PINCTRL_DT_INST_DEFINE(inst)
|
||||
#define XEC_PS2_CONFIG(inst) \
|
||||
static const struct ps2_xec_config ps2_xec_config_##inst = { \
|
||||
.regs = (struct ps2_regs * const)(DT_INST_REG_ADDR(inst)), \
|
||||
|
@ -292,19 +284,6 @@ static int ps2_xec_init(const struct device *dev)
|
|||
.irq_config_func = ps2_xec_irq_config_func_##inst, \
|
||||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \
|
||||
}
|
||||
#else
|
||||
#define XEC_PS2_PINCTRL_CFG(inst)
|
||||
#define XEC_PS2_CONFIG(inst) \
|
||||
static const struct ps2_xec_config ps2_xec_config_##inst = { \
|
||||
.regs = (struct ps2_regs * const)(DT_INST_REG_ADDR(inst)), \
|
||||
.isr_nvic = DT_INST_IRQN(inst), \
|
||||
.girq_id = (uint8_t)(DT_INST_PROP_BY_IDX(inst, girqs, 0)), \
|
||||
.girq_bit = (uint8_t)(DT_INST_PROP_BY_IDX(inst, girqs, 1)), \
|
||||
.pcr_idx = (uint8_t)(DT_INST_PROP_BY_IDX(inst, pcrs, 0)), \
|
||||
.pcr_pos = (uint8_t)(DT_INST_PROP_BY_IDX(inst, pcrs, 1)), \
|
||||
.irq_config_func = ps2_xec_irq_config_func_##inst, \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define PS2_XEC_DEVICE(i) \
|
||||
\
|
||||
|
@ -319,7 +298,7 @@ static int ps2_xec_init(const struct device *dev)
|
|||
\
|
||||
static struct ps2_xec_data ps2_xec_port_data_##i; \
|
||||
\
|
||||
XEC_PS2_PINCTRL_CFG(i); \
|
||||
PINCTRL_DT_INST_DEFINE(i); \
|
||||
\
|
||||
XEC_PS2_CONFIG(i); \
|
||||
\
|
||||
|
|
|
@ -7,6 +7,7 @@ config PWM_XEC
|
|||
bool "Microchip XEC PWM"
|
||||
default y
|
||||
depends on DT_HAS_MICROCHIP_XEC_PWM_ENABLED
|
||||
select PINCTRL
|
||||
help
|
||||
Enable driver to utilize PWM on the Microchip XEC IP block.
|
||||
|
||||
|
@ -14,6 +15,7 @@ config PWM_BBLED_XEC
|
|||
bool "Microchip XEC PWM-BBLED"
|
||||
default y
|
||||
depends on DT_HAS_MICROCHIP_XEC_PWMBBLED_ENABLED
|
||||
select PINCTRL
|
||||
help
|
||||
Enable driver to utilize the Microchip XEC Breathing-Blinking LED
|
||||
as a PWM
|
||||
|
|
|
@ -17,9 +17,7 @@
|
|||
#include <zephyr/drivers/clock_control/mchp_xec_clock_control.h>
|
||||
#include <zephyr/drivers/interrupt_controller/intc_mchp_xec_ecia.h>
|
||||
#endif
|
||||
#ifdef CONFIG_PINCTRL
|
||||
#include <zephyr/drivers/pinctrl.h>
|
||||
#endif
|
||||
#include <zephyr/logging/log.h>
|
||||
|
||||
#include <soc.h>
|
||||
|
@ -55,9 +53,7 @@ struct pwm_xec_config {
|
|||
struct pwm_regs * const regs;
|
||||
uint8_t pcr_idx;
|
||||
uint8_t pcr_pos;
|
||||
#ifdef CONFIG_PINCTRL
|
||||
const struct pinctrl_dev_config *pcfg;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct xec_params {
|
||||
|
@ -379,7 +375,6 @@ static const struct pwm_driver_api pwm_xec_driver_api = {
|
|||
|
||||
static int pwm_xec_init(const struct device *dev)
|
||||
{
|
||||
#ifdef CONFIG_PINCTRL
|
||||
const struct pwm_xec_config * const cfg = dev->config;
|
||||
int ret = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT);
|
||||
|
||||
|
@ -387,15 +382,10 @@ static int pwm_xec_init(const struct device *dev)
|
|||
LOG_ERR("XEC PWM pinctrl init failed (%d)", ret);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
ARG_UNUSED(dev);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PINCTRL
|
||||
#define XEC_PWM_PINCTRL_DEF(inst) PINCTRL_DT_INST_DEFINE(inst)
|
||||
#define XEC_PWM_CONFIG(inst) \
|
||||
static struct pwm_xec_config pwm_xec_config_##inst = { \
|
||||
.regs = (struct pwm_regs * const)DT_INST_REG_ADDR(inst), \
|
||||
|
@ -404,19 +394,9 @@ static int pwm_xec_init(const struct device *dev)
|
|||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \
|
||||
};
|
||||
|
||||
#else
|
||||
#define XEC_PWM_PINCTRL_DEF(inst)
|
||||
#define XEC_PWM_CONFIG(inst) \
|
||||
static struct pwm_xec_config pwm_xec_config_##inst = { \
|
||||
.regs = (struct pwm_regs * const)DT_INST_REG_ADDR(inst), \
|
||||
.pcr_idx = (uint8_t)DT_INST_PROP_BY_IDX(inst, pcrs, 0), \
|
||||
.pcr_pos = (uint8_t)DT_INST_PROP_BY_IDX(inst, pcrs, 1), \
|
||||
};
|
||||
#endif
|
||||
|
||||
#define XEC_PWM_DEVICE_INIT(index) \
|
||||
\
|
||||
XEC_PWM_PINCTRL_DEF(index); \
|
||||
PINCTRL_DT_INST_DEFINE(index); \
|
||||
\
|
||||
XEC_PWM_CONFIG(index); \
|
||||
\
|
||||
|
|
|
@ -123,9 +123,7 @@ struct pwm_bbled_xec_config {
|
|||
uint8_t pcr_idx;
|
||||
uint8_t pcr_pos;
|
||||
uint8_t clk_sel;
|
||||
#ifdef CONFIG_PINCTRL
|
||||
const struct pinctrl_dev_config *pcfg;
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Compute BBLED PWM delay factor to produce requested frequency.
|
||||
|
@ -346,8 +344,6 @@ static int pwm_bbled_xec_init(const struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define XEC_PWM_BBLED_PINCTRL_DEF(inst) PINCTRL_DT_INST_DEFINE(inst)
|
||||
|
||||
#define XEC_PWM_BBLED_CLKSEL(n) \
|
||||
COND_CODE_1(DT_INST_NODE_HAS_PROP(n, clock_select), \
|
||||
(DT_INST_ENUM_IDX(n, clock_select)), (0))
|
||||
|
@ -365,7 +361,7 @@ static int pwm_bbled_xec_init(const struct device *dev)
|
|||
|
||||
#define XEC_PWM_BBLED_DEVICE_INIT(index) \
|
||||
\
|
||||
XEC_PWM_BBLED_PINCTRL_DEF(index); \
|
||||
PINCTRL_DT_INST_DEFINE(index); \
|
||||
\
|
||||
XEC_PWM_BBLED_CONFIG(index); \
|
||||
\
|
||||
|
|
|
@ -8,6 +8,7 @@ config TACH_XEC
|
|||
default y
|
||||
depends on DT_HAS_MICROCHIP_XEC_TACH_ENABLED
|
||||
depends on SOC_FAMILY_MEC
|
||||
select PINCTRL
|
||||
help
|
||||
Enable the Microchip XEC tachometer sensor.
|
||||
|
||||
|
|
|
@ -15,9 +15,7 @@
|
|||
#include <zephyr/drivers/clock_control/mchp_xec_clock_control.h>
|
||||
#include <zephyr/drivers/interrupt_controller/intc_mchp_xec_ecia.h>
|
||||
#endif
|
||||
#ifdef CONFIG_PINCTRL
|
||||
#include <zephyr/drivers/pinctrl.h>
|
||||
#endif
|
||||
#include <zephyr/drivers/sensor.h>
|
||||
#include <soc.h>
|
||||
#include <zephyr/sys/sys_io.h>
|
||||
|
@ -31,9 +29,7 @@ struct tach_xec_config {
|
|||
uint8_t girq_pos;
|
||||
uint8_t pcr_idx;
|
||||
uint8_t pcr_pos;
|
||||
#ifdef CONFIG_PINCTRL
|
||||
const struct pinctrl_dev_config *pcfg;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct tach_xec_data {
|
||||
|
@ -126,14 +122,12 @@ static int tach_xec_init(const struct device *dev)
|
|||
const struct tach_xec_config * const cfg = dev->config;
|
||||
struct tach_regs * const tach = cfg->regs;
|
||||
|
||||
#ifdef CONFIG_PINCTRL
|
||||
int ret = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT);
|
||||
|
||||
if (ret != 0) {
|
||||
LOG_ERR("XEC TACH pinctrl init failed (%d)", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
tach_xec_sleep_clr(dev);
|
||||
|
||||
|
@ -150,8 +144,6 @@ static const struct sensor_driver_api tach_xec_driver_api = {
|
|||
.channel_get = tach_xec_channel_get,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PINCTRL
|
||||
#define XEC_TACH_PINCTRL_DEF(inst) PINCTRL_DT_INST_DEFINE(inst)
|
||||
#define XEC_TACH_CONFIG(inst) \
|
||||
static const struct tach_xec_config tach_xec_config_##inst = { \
|
||||
.regs = (struct tach_regs * const)DT_INST_REG_ADDR(inst), \
|
||||
|
@ -161,22 +153,11 @@ static const struct sensor_driver_api tach_xec_driver_api = {
|
|||
.pcr_pos = DT_INST_PROP_BY_IDX(inst, pcrs, 1), \
|
||||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \
|
||||
}
|
||||
#else
|
||||
#define XEC_TACH_PINCTRL_DEF(inst)
|
||||
#define XEC_TACH_CONFIG(inst) \
|
||||
static const struct tach_xec_config tach_xec_config_##inst = { \
|
||||
.regs = (struct tach_regs * const)DT_INST_REG_ADDR(inst), \
|
||||
.girq = DT_INST_PROP_BY_IDX(inst, girqs, 0), \
|
||||
.girq_pos = DT_INST_PROP_BY_IDX(inst, girqs, 1), \
|
||||
.pcr_idx = DT_INST_PROP_BY_IDX(inst, pcrs, 0), \
|
||||
.pcr_pos = DT_INST_PROP_BY_IDX(inst, pcrs, 1), \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define TACH_XEC_DEVICE(id) \
|
||||
static struct tach_xec_data tach_xec_data_##id; \
|
||||
\
|
||||
XEC_TACH_PINCTRL_DEF(id); \
|
||||
PINCTRL_DT_INST_DEFINE(id); \
|
||||
\
|
||||
XEC_TACH_CONFIG(id); \
|
||||
\
|
||||
|
|
Loading…
Reference in New Issue