pinmux: unify galileo pinmux driver

Remove dev driver and integrate it in the default pinmux driver.

Jira: ZEP-958
Change-Id: I55670240f8a21749d3a6ae22e300e16ba80a2fb6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2017-01-25 09:00:55 -05:00 committed by Anas Nashif
commit 0a3738019f
6 changed files with 64 additions and 115 deletions

View file

@ -3,4 +3,3 @@ ccflags-y += -I$(srctree)/drivers
asflags-y := ${ccflags-y}
obj-$(CONFIG_PINMUX) += pinmux.o
obj-$(CONFIG_PINMUX_DEV_GALILEO) += pinmux_dev.o

View file

@ -620,6 +620,67 @@ static struct pin_config mux_config[PINMUX_NUM_PINS] = {
{ 19, PINMUX_FUNC_C }, /* EXP2.P1_2 (out), ADC.IN5, I2C_SCL, NA */
};
static int pinmux_pullup(struct device *dev,
uint32_t pin,
uint8_t func)
{
/*
* Nothing to do.
* On Galileo the pullup operation is handled through the selection
* of an actual pin
*/
ARG_UNUSED(dev);
ARG_UNUSED(pin);
ARG_UNUSED(func);
return 0;
}
static int pinmux_input_enable(struct device *dev,
uint32_t pin,
uint8_t func)
{
/*
* Nothing to do.
* On Galileo select a pin for input enabling is handled through the
* selection of an actual pin user configuration.
*/
ARG_UNUSED(dev);
ARG_UNUSED(pin);
ARG_UNUSED(func);
return 0;
}
static int pinmux_set(struct device *dev,
uint32_t pin,
uint32_t func)
{
if (pin > PINMUX_NUM_PINS) {
return -EINVAL;
}
return _galileo_pinmux_set_pin(dev, pin, func);
}
static int pinmux_get(struct device *dev,
uint32_t pin,
uint32_t *func)
{
if (pin > PINMUX_NUM_PINS) {
return -EINVAL;
}
return _galileo_pinmux_get_pin(dev, pin, func);
}
static struct pinmux_driver_api api_funcs = {
.set = pinmux_set,
.get = pinmux_get,
.pullup = pinmux_pullup,
.input = pinmux_input_enable
};
struct galileo_data galileo_pinmux_driver = {
.exp0 = NULL,
.exp1 = NULL,
@ -685,6 +746,6 @@ static int pinmux_galileo_initialize(struct device *port)
* 1 - PCA9535 and PCAL9685
* 2 - pinmux
*/
DEVICE_INIT(pmux, CONFIG_PINMUX_NAME, &pinmux_galileo_initialize,
DEVICE_AND_API_INIT(pmux, CONFIG_PINMUX_NAME, &pinmux_galileo_initialize,
&galileo_pinmux_driver, NULL,
POST_KERNEL, CONFIG_PINMUX_INIT_PRIORITY);
POST_KERNEL, CONFIG_PINMUX_INIT_PRIORITY, &api_funcs);

View file

@ -1,102 +0,0 @@
/* pinmux_dev_galileo.c - pinmux_dev driver for Galileo */
/*
* Copyright (c) 2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <kernel.h>
#include <board.h>
#include <device.h>
#include <init.h>
#include <pinmux.h>
#include <i2c.h>
#include <gpio.h>
#include <pwm.h>
#include <pinmux/pinmux.h>
#include "pinmux_galileo.h"
static int galileo_dev_pullup(struct device *dev,
uint32_t pin,
uint8_t func)
{
/*
* Nothing to do.
* On Galileo the pullup operation is handled through the selection
* of an actual pin
*/
ARG_UNUSED(dev);
ARG_UNUSED(pin);
ARG_UNUSED(func);
return 0;
}
static int galileo_dev_input_enable(struct device *dev,
uint32_t pin,
uint8_t func)
{
/*
* Nothing to do.
* On Galileo select a pin for input enabling is handled through the
* selection of an actual pin user configuration.
*/
ARG_UNUSED(dev);
ARG_UNUSED(pin);
ARG_UNUSED(func);
return 0;
}
static int galileo_dev_set(struct device *dev,
uint32_t pin,
uint32_t func)
{
if (pin > PINMUX_NUM_PINS) {
return -EINVAL;
}
return _galileo_pinmux_set_pin(dev, pin, func);
}
static int galileo_dev_get(struct device *dev,
uint32_t pin,
uint32_t *func)
{
if (pin > PINMUX_NUM_PINS) {
return -EINVAL;
}
return _galileo_pinmux_get_pin(dev, pin, func);
}
static struct pinmux_driver_api api_funcs = {
.set = galileo_dev_set,
.get = galileo_dev_get,
.pullup = galileo_dev_pullup,
.input = galileo_dev_input_enable
};
static int pinmux_dev_galileo_initialize(struct device *port)
{
ARG_UNUSED(port);
return 0;
}
/*
* This needs to be a level 2 or later init process due to the following
* dependency chain:
* 0 - I2C
* 1 - PCA9535 and PCAL9685
* 2 - pinmux
*/
DEVICE_AND_API_INIT(pmux_dev, CONFIG_PINMUX_DEV_NAME,
&pinmux_dev_galileo_initialize,
&galileo_pinmux_driver, NULL,
POST_KERNEL, CONFIG_PINMUX_INIT_PRIORITY,
&api_funcs);

View file

@ -37,13 +37,6 @@ config PINMUX_DEV_K64
Enables the pinmux dev driver for Freescale K64.
default n
config PINMUX_DEV_GALILEO
bool "Enable pinmux dev driver for Galileo"
depends on PINMUX_DEV && BOARD_GALILEO
help
Enables the pinmux dev driver for the Galileo board.
default n
config PINMUX_DEV_STM32
bool "Enable pinmux dev driver for the ST STM32 family."
depends on PINMUX_DEV && SOC_FAMILY_STM32

View file

@ -1,2 +0,0 @@
CONFIG_PINMUX_DEV=y
CONFIG_PINMUX_DEV_GALILEO=y

View file

@ -1,4 +1,4 @@
[test_pinmux_dev]
build_only = true
tags = drivers
platform_whitelist = arduino_due galileo nucleo_f103rb stm32_mini_a15 olimexino_stm32
platform_whitelist = arduino_due nucleo_f103rb stm32_mini_a15 olimexino_stm32