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:
parent
42e1c9ca34
commit
0a3738019f
6 changed files with 64 additions and 115 deletions
|
@ -3,4 +3,3 @@ ccflags-y += -I$(srctree)/drivers
|
||||||
asflags-y := ${ccflags-y}
|
asflags-y := ${ccflags-y}
|
||||||
|
|
||||||
obj-$(CONFIG_PINMUX) += pinmux.o
|
obj-$(CONFIG_PINMUX) += pinmux.o
|
||||||
obj-$(CONFIG_PINMUX_DEV_GALILEO) += pinmux_dev.o
|
|
||||||
|
|
|
@ -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 */
|
{ 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 = {
|
struct galileo_data galileo_pinmux_driver = {
|
||||||
.exp0 = NULL,
|
.exp0 = NULL,
|
||||||
.exp1 = NULL,
|
.exp1 = NULL,
|
||||||
|
@ -685,6 +746,6 @@ static int pinmux_galileo_initialize(struct device *port)
|
||||||
* 1 - PCA9535 and PCAL9685
|
* 1 - PCA9535 and PCAL9685
|
||||||
* 2 - pinmux
|
* 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,
|
&galileo_pinmux_driver, NULL,
|
||||||
POST_KERNEL, CONFIG_PINMUX_INIT_PRIORITY);
|
POST_KERNEL, CONFIG_PINMUX_INIT_PRIORITY, &api_funcs);
|
||||||
|
|
|
@ -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);
|
|
|
@ -37,13 +37,6 @@ config PINMUX_DEV_K64
|
||||||
Enables the pinmux dev driver for Freescale K64.
|
Enables the pinmux dev driver for Freescale K64.
|
||||||
default n
|
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
|
config PINMUX_DEV_STM32
|
||||||
bool "Enable pinmux dev driver for the ST STM32 family."
|
bool "Enable pinmux dev driver for the ST STM32 family."
|
||||||
depends on PINMUX_DEV && SOC_FAMILY_STM32
|
depends on PINMUX_DEV && SOC_FAMILY_STM32
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
CONFIG_PINMUX_DEV=y
|
|
||||||
CONFIG_PINMUX_DEV_GALILEO=y
|
|
|
@ -1,4 +1,4 @@
|
||||||
[test_pinmux_dev]
|
[test_pinmux_dev]
|
||||||
build_only = true
|
build_only = true
|
||||||
tags = drivers
|
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue