drivers: gpio: remove altera gpio driver

Remove unsupported driver.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2019-10-29 04:31:21 -07:00
commit 7984f6c363
12 changed files with 0 additions and 356 deletions

View file

@ -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)

View file

@ -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"

View file

@ -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

View file

@ -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 <errno.h>
#include <kernel.h>
#include <device.h>
#include <init.h>
#include <soc.h>
#include <drivers/gpio.h>
#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 */

View file

@ -60,7 +60,3 @@ if(CONFIG_ALTERA_AVALON_QSPI)
)
endif()
if(CONFIG_ALTERA_AVALON_PIO)
zephyr_include_directories(drivers/altera_avalon_pio/inc)
endif()

View file

@ -1,10 +0,0 @@
.. _altera_max10_devkit-samples:
Altera MAX10 Development Kit Samples
#####################################
.. toctree::
:maxdepth: 1
:glob:
**/*

View file

@ -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)

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -1,83 +0,0 @@
/*
* Copyright (c) 2017 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
#include <device.h>
#include <drivers/gpio.h>
#include <sys/printk.h>
#include <sys/util.h>
/* 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");
}
}

View file

@ -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