From 84c6edd247a03bd447df541ccdcd23d8ecc6d717 Mon Sep 17 00:00:00 2001 From: Glauber Maroto Ferreira Date: Mon, 7 Mar 2022 14:31:08 -0300 Subject: [PATCH] esp32: driver: pinmux: driver removal Removal of ESP32's pinmux driver since it was deprecated by pinctrl. Signed-off-by: Glauber Maroto Ferreira --- drivers/pinmux/CMakeLists.txt | 1 - drivers/pinmux/Kconfig | 2 - drivers/pinmux/Kconfig.esp32 | 10 --- drivers/pinmux/pinmux_esp32.c | 146 ---------------------------------- 4 files changed, 159 deletions(-) delete mode 100644 drivers/pinmux/Kconfig.esp32 delete mode 100644 drivers/pinmux/pinmux_esp32.c diff --git a/drivers/pinmux/CMakeLists.txt b/drivers/pinmux/CMakeLists.txt index 2a6d33ed02b..cec7520d431 100644 --- a/drivers/pinmux/CMakeLists.txt +++ b/drivers/pinmux/CMakeLists.txt @@ -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) diff --git a/drivers/pinmux/Kconfig b/drivers/pinmux/Kconfig index 3d6fd2efaf1..a13c8d16f6f 100644 --- a/drivers/pinmux/Kconfig +++ b/drivers/pinmux/Kconfig @@ -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" diff --git a/drivers/pinmux/Kconfig.esp32 b/drivers/pinmux/Kconfig.esp32 deleted file mode 100644 index df62a785914..00000000000 --- a/drivers/pinmux/Kconfig.esp32 +++ /dev/null @@ -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. diff --git a/drivers/pinmux/pinmux_esp32.c b/drivers/pinmux/pinmux_esp32.c deleted file mode 100644 index 64d389cb580..00000000000 --- a/drivers/pinmux/pinmux_esp32.c +++ /dev/null @@ -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 -#include -#include -#include -#include - -#include -#include - -#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);