esp32: driver: pinmux: driver removal
Removal of ESP32's pinmux driver since it was deprecated by pinctrl. Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
This commit is contained in:
parent
d99f01808a
commit
84c6edd247
4 changed files with 0 additions and 159 deletions
|
@ -1,7 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Board initialization
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_ESP32 pinmux_esp32.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_HSDK pinmux_hsdk.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_INTEL_S1000 pinmux_intel_s1000.c)
|
||||
zephyr_sources_ifdef(CONFIG_PINMUX_ITE_IT8XXX2 pinmux_ite_it8xxx2.c)
|
||||
|
|
|
@ -26,8 +26,6 @@ config PINMUX_INIT_PRIORITY
|
|||
|
||||
source "drivers/pinmux/Kconfig.beetle"
|
||||
|
||||
source "drivers/pinmux/Kconfig.esp32"
|
||||
|
||||
source "drivers/pinmux/Kconfig.hsdk"
|
||||
|
||||
source "drivers/pinmux/Kconfig.intel_s1000"
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
# ESP32 Pin mux configuration options
|
||||
|
||||
# Copyright (c) 2017 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config PINMUX_ESP32
|
||||
bool "ESP32 Pin multiplexer driver"
|
||||
depends on SOC_ESP32 || SOC_ESP32S2 || SOC_ESP32C3
|
||||
help
|
||||
Enable driver for ESP32 Pin multiplexer.
|
|
@ -1,146 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017 Intel Corporation
|
||||
* Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define DT_DRV_COMPAT espressif_esp32_pinmux
|
||||
|
||||
/* Include esp-idf headers first to avoid redefining BIT() macro */
|
||||
#include <soc/soc.h>
|
||||
#include <hal/gpio_types.h>
|
||||
#include <hal/gpio_ll.h>
|
||||
#include <hal/rtc_io_hal.h>
|
||||
#include <soc.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <drivers/pinmux.h>
|
||||
|
||||
#ifndef SOC_GPIO_SUPPORT_RTC_INDEPENDENT
|
||||
#define SOC_GPIO_SUPPORT_RTC_INDEPENDENT 0
|
||||
#endif
|
||||
|
||||
static inline bool rtc_gpio_is_valid_gpio(uint32_t gpio_num)
|
||||
{
|
||||
#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
|
||||
return (gpio_num < SOC_GPIO_PIN_COUNT && rtc_io_num_map[gpio_num] >= 0);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int pinmux_set(const struct device *dev, uint32_t pin, uint32_t func)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
if ((func > PINMUX_FUNC_G) || (pin >= GPIO_NUM_MAX)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
gpio_ll_iomux_func_sel(GPIO_PIN_MUX_REG[pin], func);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pinmux_get(const struct device *dev, uint32_t pin, uint32_t *func)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
if (pin >= GPIO_NUM_MAX) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
*func = REG_GET_FIELD(GPIO_PIN_MUX_REG[pin], MCU_SEL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pinmux_pullup(const struct device *dev, uint32_t pin, uint8_t func)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
switch (func) {
|
||||
case PINMUX_PULLUP_DISABLE:
|
||||
if (!rtc_gpio_is_valid_gpio(pin) || SOC_GPIO_SUPPORT_RTC_INDEPENDENT) {
|
||||
gpio_ll_pullup_dis(&GPIO, pin);
|
||||
gpio_ll_pulldown_en(&GPIO, pin);
|
||||
} else {
|
||||
#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
|
||||
int rtcio_num = rtc_io_num_map[pin];
|
||||
|
||||
rtcio_hal_pulldown_enable(rtc_io_num_map[pin]);
|
||||
|
||||
if (rtc_io_desc[rtcio_num].pullup) {
|
||||
rtcio_hal_pullup_disable(rtc_io_num_map[pin]);
|
||||
} else {
|
||||
return -ENOTSUP;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case PINMUX_PULLUP_ENABLE:
|
||||
if (!rtc_gpio_is_valid_gpio(pin) || SOC_GPIO_SUPPORT_RTC_INDEPENDENT) {
|
||||
gpio_ll_pulldown_dis(&GPIO, pin);
|
||||
gpio_ll_pullup_en(&GPIO, pin);
|
||||
} else {
|
||||
#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
|
||||
int rtcio_num = rtc_io_num_map[pin];
|
||||
|
||||
rtcio_hal_pulldown_disable(rtc_io_num_map[pin]);
|
||||
|
||||
if (rtc_io_desc[rtcio_num].pullup) {
|
||||
rtcio_hal_pullup_enable(rtc_io_num_map[pin]);
|
||||
} else {
|
||||
return -ENOTSUP;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pinmux_input(const struct device *dev, uint32_t pin, uint8_t func)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
switch (func) {
|
||||
case PINMUX_INPUT_ENABLED:
|
||||
gpio_ll_input_enable(&GPIO, pin);
|
||||
break;
|
||||
case PINMUX_OUTPUT_ENABLED:
|
||||
gpio_ll_output_enable(&GPIO, pin);
|
||||
esp_rom_gpio_matrix_out(pin, SIG_GPIO_OUT_IDX, false, false);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct pinmux_driver_api api_funcs = {
|
||||
.set = pinmux_set,
|
||||
.get = pinmux_get,
|
||||
.pullup = pinmux_pullup,
|
||||
.input = pinmux_input
|
||||
};
|
||||
|
||||
static int pinmux_initialize(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialize using PRE_KERNEL_1 priority so that GPIO can use the pin
|
||||
* mux driver.
|
||||
*/
|
||||
DEVICE_DT_INST_DEFINE(0, &pinmux_initialize,
|
||||
NULL, NULL, NULL,
|
||||
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&api_funcs);
|
Loading…
Add table
Add a link
Reference in a new issue