From 0a9e8a5463dedd58bc08a911c8232c222281b1ad Mon Sep 17 00:00:00 2001 From: Filip Kokosinski Date: Tue, 22 Mar 2022 09:39:06 +0100 Subject: [PATCH] drivers: pinmux: remove SiFive pinmux driver After transitioning to the new pinctrl driver, it is now obsolete. Signed-off-by: Filip Kokosinski --- drivers/pinmux/CMakeLists.txt | 1 - drivers/pinmux/Kconfig | 2 - drivers/pinmux/Kconfig.sifive | 10 ---- drivers/pinmux/pinmux_sifive.c | 103 --------------------------------- 4 files changed, 116 deletions(-) delete mode 100644 drivers/pinmux/Kconfig.sifive delete mode 100644 drivers/pinmux/pinmux_sifive.c diff --git a/drivers/pinmux/CMakeLists.txt b/drivers/pinmux/CMakeLists.txt index 55fd58d73cb0e4..97212c1a14e423 100644 --- a/drivers/pinmux/CMakeLists.txt +++ b/drivers/pinmux/CMakeLists.txt @@ -11,6 +11,5 @@ zephyr_sources_ifdef(CONFIG_PINMUX_MCUX pinmux_mcux.c) zephyr_sources_ifdef(CONFIG_PINMUX_MCUX_LPC pinmux_mcux_lpc.c) zephyr_sources_ifdef(CONFIG_PINMUX_RV32M1 pinmux_rv32m1.c) zephyr_sources_ifdef(CONFIG_PINMUX_SAM0 pinmux_sam0.c) -zephyr_sources_ifdef(CONFIG_PINMUX_SIFIVE pinmux_sifive.c) zephyr_sources_ifdef(CONFIG_PINMUX_STM32 pinmux_stm32.c) zephyr_sources_ifdef(CONFIG_PINMUX_XEC pinmux_mchp_xec.c) diff --git a/drivers/pinmux/Kconfig b/drivers/pinmux/Kconfig index 9e28ea592125e5..9ceebade1e7bbc 100644 --- a/drivers/pinmux/Kconfig +++ b/drivers/pinmux/Kconfig @@ -44,8 +44,6 @@ source "drivers/pinmux/Kconfig.mcux_lpc" source "drivers/pinmux/Kconfig.rv32m1" -source "drivers/pinmux/Kconfig.sifive" - source "drivers/pinmux/Kconfig.sam0" source "drivers/pinmux/Kconfig.stm32" diff --git a/drivers/pinmux/Kconfig.sifive b/drivers/pinmux/Kconfig.sifive deleted file mode 100644 index 20786be2ce0bc7..00000000000000 --- a/drivers/pinmux/Kconfig.sifive +++ /dev/null @@ -1,10 +0,0 @@ -# PINMUX configuration options for SiFive Freedom SOC - -# Copyright (c) 2017 Jean-Paul Etienne -# SPDX-License-Identifier: Apache-2.0 - -config PINMUX_SIFIVE - bool "SiFive Freedom SOC pinmux driver" - depends on SOC_SERIES_RISCV_SIFIVE_FREEDOM - help - Enable driver for the SiFive Freedom SOC pinmux driver diff --git a/drivers/pinmux/pinmux_sifive.c b/drivers/pinmux/pinmux_sifive.c deleted file mode 100644 index 01201488ebb38c..00000000000000 --- a/drivers/pinmux/pinmux_sifive.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2017 Jean-Paul Etienne - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#define DT_DRV_COMPAT sifive_iof - -/** - * @brief PINMUX driver for the SiFive Freedom Processor - */ - -#include -#include -#include -#include - -struct pinmux_sifive_config { - uintptr_t base; -}; - -struct pinmux_sifive_regs_t { - uint32_t iof_en; - uint32_t iof_sel; -}; - -#define DEV_PINMUX(dev) \ - ((struct pinmux_sifive_regs_t *) \ - ((const struct pinmux_sifive_config * const)(dev->config))->base) - -static int pinmux_sifive_set(const struct device *dev, uint32_t pin, - uint32_t func) -{ - volatile struct pinmux_sifive_regs_t *pinmux = DEV_PINMUX(dev); - - if (func > SIFIVE_PINMUX_IOF1 || - pin >= SIFIVE_PINMUX_PINS) - return -EINVAL; - - if (func == SIFIVE_PINMUX_IOF1) - pinmux->iof_sel |= (SIFIVE_PINMUX_IOF1 << pin); - else - pinmux->iof_sel &= ~(SIFIVE_PINMUX_IOF1 << pin); - - /* Enable IO function for this pin */ - pinmux->iof_en |= (1 << pin); - - return 0; -} - -static int pinmux_sifive_get(const struct device *dev, uint32_t pin, - uint32_t *func) -{ - volatile struct pinmux_sifive_regs_t *pinmux = DEV_PINMUX(dev); - - if (pin >= SIFIVE_PINMUX_PINS || - func == NULL) - return -EINVAL; - - *func = (pinmux->iof_sel & (SIFIVE_PINMUX_IOF1 << pin)) ? - SIFIVE_PINMUX_IOF1 : SIFIVE_PINMUX_IOF0; - - return 0; -} - -static int pinmux_sifive_pullup(const struct device *dev, uint32_t pin, - uint8_t func) -{ - return -ENOTSUP; -} - -static int pinmux_sifive_input(const struct device *dev, uint32_t pin, - uint8_t func) -{ - return -ENOTSUP; -} - -static int pinmux_sifive_init(const struct device *dev) -{ - volatile struct pinmux_sifive_regs_t *pinmux = DEV_PINMUX(dev); - - /* Ensure that all pins are disabled initially */ - pinmux->iof_en = 0x0; - - return 0; -} - -static const struct pinmux_driver_api pinmux_sifive_driver_api = { - .set = pinmux_sifive_set, - .get = pinmux_sifive_get, - .pullup = pinmux_sifive_pullup, - .input = pinmux_sifive_input, -}; - -static const struct pinmux_sifive_config pinmux_sifive_0_config = { - .base = DT_INST_REG_ADDR(0), -}; - -DEVICE_DT_INST_DEFINE(0, - &pinmux_sifive_init, NULL, NULL, - &pinmux_sifive_0_config, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &pinmux_sifive_driver_api);