From 7984f6c3632f4e3add1ba919dac53e36bfc1bef9 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 29 Oct 2019 04:31:21 -0700 Subject: [PATCH] drivers: gpio: remove altera gpio driver Remove unsupported driver. Signed-off-by: Anas Nashif --- drivers/gpio/CMakeLists.txt | 1 - drivers/gpio/Kconfig | 2 - drivers/gpio/Kconfig.altera_nios2 | 29 ---- drivers/gpio/gpio_altera_nios2.c | 162 ------------------ ext/hal/altera/CMakeLists.txt | 4 - samples/boards/altera_max10/altera_max10.rst | 10 -- .../boards/altera_max10/pio/CMakeLists.txt | 7 - samples/boards/altera_max10/pio/README.rst | 39 ----- samples/boards/altera_max10/pio/prj.conf | 4 - samples/boards/altera_max10/pio/sample.yaml | 8 - samples/boards/altera_max10/pio/src/main.c | 83 --------- soc/nios2/nios2f-zephyr/Kconfig.defconfig | 7 - 12 files changed, 356 deletions(-) delete mode 100644 drivers/gpio/Kconfig.altera_nios2 delete mode 100644 drivers/gpio/gpio_altera_nios2.c delete mode 100644 samples/boards/altera_max10/altera_max10.rst delete mode 100644 samples/boards/altera_max10/pio/CMakeLists.txt delete mode 100644 samples/boards/altera_max10/pio/README.rst delete mode 100644 samples/boards/altera_max10/pio/prj.conf delete mode 100644 samples/boards/altera_max10/pio/sample.yaml delete mode 100644 samples/boards/altera_max10/pio/src/main.c diff --git a/drivers/gpio/CMakeLists.txt b/drivers/gpio/CMakeLists.txt index e8a2e99990b..e31795b6d7f 100644 --- a/drivers/gpio/CMakeLists.txt +++ b/drivers/gpio/CMakeLists.txt @@ -2,7 +2,6 @@ zephyr_library() -zephyr_library_sources_ifdef(CONFIG_GPIO_ALTERA_NIOS2 gpio_altera_nios2.c) zephyr_library_sources_ifdef(CONFIG_GPIO_CC13XX_CC26XX gpio_cc13xx_cc26xx.c) zephyr_library_sources_ifdef(CONFIG_GPIO_CC2650 gpio_cc2650.c) zephyr_library_sources_ifdef(CONFIG_GPIO_CC32XX gpio_cc32xx.c) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 6b04682e45f..815d31d1bca 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -49,8 +49,6 @@ source "drivers/gpio/Kconfig.esp32" source "drivers/gpio/Kconfig.gecko" -source "drivers/gpio/Kconfig.altera_nios2" - source "drivers/gpio/Kconfig.sam0" source "drivers/gpio/Kconfig.sam" diff --git a/drivers/gpio/Kconfig.altera_nios2 b/drivers/gpio/Kconfig.altera_nios2 deleted file mode 100644 index bd2599da8fa..00000000000 --- a/drivers/gpio/Kconfig.altera_nios2 +++ /dev/null @@ -1,29 +0,0 @@ -# Altera Nios-II GPIO configuration options - -# Copyright (c) 2017 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -menuconfig GPIO_ALTERA_NIOS2 - bool "Altera Nios-II PIO Controllers" - depends on HAS_ALTERA_HAL - help - Enable config options to support the PIO controllers - on Altera Nios-II family processors. - - Says n if not sure. - -if GPIO_ALTERA_NIOS2 - -config GPIO_ALTERA_NIOS2_OUTPUT - bool "Enable driver for Altera Nios-II PIO Output Port" - help - Build the driver to utilize PIO controller Output Port. - -config GPIO_ALTERA_NIOS2_OUTPUT_DEV_NAME - string "Device name for Output Port" - depends on GPIO_ALTERA_NIOS2_OUTPUT - default "PIO_OUTPUT" - help - Device name for Output Port. - -endif # GPIO_ALTERA_NIOS2 diff --git a/drivers/gpio/gpio_altera_nios2.c b/drivers/gpio/gpio_altera_nios2.c deleted file mode 100644 index 8a8a41e6701..00000000000 --- a/drivers/gpio/gpio_altera_nios2.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2017 Intel Corporation. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file Driver for the Altera Nios-II PIO Core. - */ - -#include -#include -#include -#include -#include -#include - -#include "gpio_utils.h" -#include "altera_avalon_pio_regs.h" - -typedef int (*config_func_t)(struct device *dev, int access_op, - u32_t pin, int flags); - -/* Configuration data */ -struct gpio_nios2_config { - u32_t pio_base; - config_func_t config_func; -}; - -static int gpio_nios2_config_oput_port(struct device *dev, int access_op, - u32_t pin, int flags) -{ - if (((flags & GPIO_DIR_MASK) == GPIO_DIR_IN) || (flags & GPIO_INT)) { - return -ENOTSUP; - } - - if (access_op == GPIO_ACCESS_BY_PIN) { - return -ENOTSUP; - } - - return 0; -} - -/** - * @brief Configure pin or port - * - * @param dev Device struct - * @param access_op Access operation (pin or port) - * @param pin The pin number - * @param flags Flags of pin or port - * - * @return 0 if successful, failed otherwise - */ -static int gpio_nios2_config(struct device *dev, int access_op, - u32_t pin, int flags) -{ - const struct gpio_nios2_config *cfg = dev->config->config_info; - - if (cfg->config_func) { - return cfg->config_func(dev, access_op, pin, flags); - } - - return 0; -} - -/** - * @brief Set the pin or port output - * - * @param dev Device struct - * @param access_op Access operation (pin or port) - * @param pin The pin number - * @param value Value to set (0 or 1) - * - * @return 0 if successful, failed otherwise - */ -static int gpio_nios2_write(struct device *dev, int access_op, - u32_t pin, u32_t value) -{ - const struct gpio_nios2_config *cfg = dev->config->config_info; - - switch (access_op) { - case GPIO_ACCESS_BY_PIN: - if (value) { - /* set the pin */ - IOWR_ALTERA_AVALON_PIO_SET_BITS(cfg->pio_base, - BIT(pin)); - } else { - /* clear the pin */ - IOWR_ALTERA_AVALON_PIO_CLEAR_BITS(cfg->pio_base, - BIT(pin)); - } - break; - case GPIO_ACCESS_BY_PORT: - IOWR_ALTERA_AVALON_PIO_DATA(cfg->pio_base, value); - break; - default: - return -ENOTSUP; - } - - return 0; -} - -/** - * @brief Read the pin or port status - * - * @param dev Device struct - * @param access_op Access operation (pin or port) - * @param pin The pin number - * @param value Value of input pin(s) - * - * @return 0 if successful, failed otherwise - */ -static int gpio_nios2_read(struct device *dev, int access_op, - u32_t pin, u32_t *value) -{ - const struct gpio_nios2_config *cfg = dev->config->config_info; - - *value = IORD_ALTERA_AVALON_PIO_DATA(cfg->pio_base); - - switch (access_op) { - case GPIO_ACCESS_BY_PIN: - *value = (*value >> pin) & 0x01; - break; - case GPIO_ACCESS_BY_PORT: - break; - default: - return -ENOTSUP; - } - - return 0; -} - -static const struct gpio_driver_api gpio_nios2_drv_api_funcs = { - .config = gpio_nios2_config, - .write = gpio_nios2_write, - .read = gpio_nios2_read, -}; - -/* Output only Port */ -#ifdef CONFIG_GPIO_ALTERA_NIOS2_OUTPUT -static const struct gpio_nios2_config gpio_nios2_oput_cfg = { - .pio_base = LED_BASE, - .config_func = gpio_nios2_config_oput_port, -}; - -/** - * @brief Initialization function of PIO - * - * @param dev Device struct - * @return 0 if successful, failed otherwise. - */ -static int gpio_nios2_oput_init(struct device *dev) -{ - return 0; -} - -DEVICE_AND_API_INIT(gpio_nios2_oput, CONFIG_GPIO_ALTERA_NIOS2_OUTPUT_DEV_NAME, - gpio_nios2_oput_init, NULL, &gpio_nios2_oput_cfg, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &gpio_nios2_drv_api_funcs); - -#endif /* CONFIG_GPIO_ALTERA_NIOS2_OUTPUT */ diff --git a/ext/hal/altera/CMakeLists.txt b/ext/hal/altera/CMakeLists.txt index ed79ce6e280..2a7f9949bcd 100644 --- a/ext/hal/altera/CMakeLists.txt +++ b/ext/hal/altera/CMakeLists.txt @@ -60,7 +60,3 @@ if(CONFIG_ALTERA_AVALON_QSPI) ) endif() -if(CONFIG_ALTERA_AVALON_PIO) - zephyr_include_directories(drivers/altera_avalon_pio/inc) -endif() - diff --git a/samples/boards/altera_max10/altera_max10.rst b/samples/boards/altera_max10/altera_max10.rst deleted file mode 100644 index 0735f96c070..00000000000 --- a/samples/boards/altera_max10/altera_max10.rst +++ /dev/null @@ -1,10 +0,0 @@ -.. _altera_max10_devkit-samples: - -Altera MAX10 Development Kit Samples -##################################### - -.. toctree:: - :maxdepth: 1 - :glob: - - **/* diff --git a/samples/boards/altera_max10/pio/CMakeLists.txt b/samples/boards/altera_max10/pio/CMakeLists.txt deleted file mode 100644 index c18c200d0ed..00000000000 --- a/samples/boards/altera_max10/pio/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.13.1) -include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) -project(pio) - -target_sources(app PRIVATE src/main.c) diff --git a/samples/boards/altera_max10/pio/README.rst b/samples/boards/altera_max10/pio/README.rst deleted file mode 100644 index a0f9f10276e..00000000000 --- a/samples/boards/altera_max10/pio/README.rst +++ /dev/null @@ -1,39 +0,0 @@ -.. _altera_max10_pio-sample: - -Altera Nios-II PIO sample -############################### - -Overview -******** -This sample application demonstrates the usage of Nios-II -Parallel Input/Output (PIO) soft IP by controlling the LEDs -on an Altera MAX10 board. - -Requirements -************ - -This application uses an Altera MAX10 development board for the demo. - -Building -******** - -.. zephyr-app-commands:: - :zephyr-app: samples/boards/altera_max10/pio - :board: altera_max10 - :goals: build - :compact: - -Sample Output -============= - -nios2 core output ------------------ - -.. code-block:: console - - Turning off all LEDs - Turn On LED[0] - Turn On LED[1] - Turn On LED[2] - Turn On LED[3] - Turning on all LEDs diff --git a/samples/boards/altera_max10/pio/prj.conf b/samples/boards/altera_max10/pio/prj.conf deleted file mode 100644 index bce1caff0e1..00000000000 --- a/samples/boards/altera_max10/pio/prj.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_GPIO=y -CONFIG_GPIO_ALTERA_NIOS2=y -CONFIG_GPIO_ALTERA_NIOS2_OUTPUT=y -CONFIG_GPIO_ALTERA_NIOS2_OUTPUT_DEV_NAME="PIO_OUTPUT" diff --git a/samples/boards/altera_max10/pio/sample.yaml b/samples/boards/altera_max10/pio/sample.yaml deleted file mode 100644 index 87d8fbd8d24..00000000000 --- a/samples/boards/altera_max10/pio/sample.yaml +++ /dev/null @@ -1,8 +0,0 @@ -sample: - description: Sample application to verify the Nios-II based - PIO soft IP block. - name: Nios-II Parallel Input/Output (PIO) -tests: - sample.board.altera_max10.pio: - platform_whitelist: altera_max10 - tags: pio diff --git a/samples/boards/altera_max10/pio/src/main.c b/samples/boards/altera_max10/pio/src/main.c deleted file mode 100644 index 98b56f29b3b..00000000000 --- a/samples/boards/altera_max10/pio/src/main.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2017 Intel Corporation - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include - -/* GPIO driver name */ -#define GPIO_DRV_NAME CONFIG_GPIO_ALTERA_NIOS2_OUTPUT_DEV_NAME - -/* PIO pins[0:3] are wired to LED's */ -#define LED_PINS_WIRED 4 - -static int write_all_leds(struct device *gpio_dev, u32_t value) -{ - int ret; - - for (int i = 0; i < LED_PINS_WIRED; i++) { - ret = gpio_pin_write(gpio_dev, i, value); - if (ret != 0) { - return ret; - } - } - - return 0; -} - -void main(void) -{ - struct device *gpio_dev; - int i, ret; - - gpio_dev = device_get_binding(GPIO_DRV_NAME); - if (!gpio_dev) { - printk("Cannot find %s!\n", GPIO_DRV_NAME); - return; - } - - /* Setup GPIO output */ - for (i = 0; i < LED_PINS_WIRED; i++) { - ret = gpio_pin_configure(gpio_dev, i, GPIO_DIR_OUT); - if (ret) { - printk("Error configuring GPIO PORT\n"); - return; - } - } - - /* - * Note: the LED's are connected in inverse logic - * to the Nios-II PIO core. - */ - printk("Turning off all LEDs\n"); - ret = write_all_leds(gpio_dev, 1); - if (ret) { - printk("Error set GPIO port\n"); - } - k_sleep(MSEC_PER_SEC * 5U); - - for (i = 0; i < LED_PINS_WIRED; i++) { - printk("Turn On LED[%d]\n", i); - ret = gpio_pin_write(gpio_dev, i, 0); - if (ret) { - printk("Error writing led pin\n"); - } - - k_sleep(MSEC_PER_SEC * 5U); - ret = gpio_pin_write(gpio_dev, i, 1); - if (ret) { - printk("Error writing led pin\n"); - } - } - - printk("Turning on all LEDs\n"); - ret = write_all_leds(gpio_dev, 0); - if (ret) { - printk("Error set GPIO port\n"); - } -} diff --git a/soc/nios2/nios2f-zephyr/Kconfig.defconfig b/soc/nios2/nios2f-zephyr/Kconfig.defconfig index 8d418f203e0..91f55eaf59e 100644 --- a/soc/nios2/nios2f-zephyr/Kconfig.defconfig +++ b/soc/nios2/nios2f-zephyr/Kconfig.defconfig @@ -11,13 +11,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC config ALTERA_AVALON_SYSID def_bool y -if GPIO_ALTERA_NIOS2 - -config ALTERA_AVALON_PIO - def_bool y - -endif # GPIO_ALTERA_NIOS2 - if SOC_FLASH_NIOS2_QSPI config ALTERA_AVALON_QSPI