summaryrefslogtreecommitdiff
path: root/boards
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2017-01-25 09:00:55 -0500
committerAnas Nashif <nashif@linux.intel.com>2017-01-25 20:43:18 +0000
commit0a3738019ffba2072b5d53ca1afd30e57a72b4de (patch)
tree600a57a8c8baa242993a06f46d1138031ba43dab /boards
parent42e1c9ca34421a4c80f9e8d92c78d913dbcf112c (diff)
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>
Diffstat (limited to 'boards')
-rw-r--r--boards/x86/galileo/Makefile1
-rw-r--r--boards/x86/galileo/pinmux.c65
-rw-r--r--boards/x86/galileo/pinmux_dev.c102
3 files changed, 63 insertions, 105 deletions
diff --git a/boards/x86/galileo/Makefile b/boards/x86/galileo/Makefile
index 749ef5f0e..a6aa30f1c 100644
--- a/boards/x86/galileo/Makefile
+++ b/boards/x86/galileo/Makefile
@@ -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
diff --git a/boards/x86/galileo/pinmux.c b/boards/x86/galileo/pinmux.c
index e76da0b4d..317aee8de 100644
--- a/boards/x86/galileo/pinmux.c
+++ b/boards/x86/galileo/pinmux.c
@@ -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);
diff --git a/boards/x86/galileo/pinmux_dev.c b/boards/x86/galileo/pinmux_dev.c
deleted file mode 100644
index b64592565..000000000
--- a/boards/x86/galileo/pinmux_dev.c
+++ /dev/null
@@ -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);