2016-03-22 04:21:03 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Open-RnD Sp. z o.o.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2016-03-22 04:21:03 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief
|
|
|
|
*
|
|
|
|
* A common driver for STM32 pinmux. Each SoC must implement a SoC
|
|
|
|
* specific part of the driver.
|
|
|
|
*/
|
|
|
|
|
2016-04-27 05:20:17 +08:00
|
|
|
#include <errno.h>
|
|
|
|
|
2016-12-05 04:59:37 +08:00
|
|
|
#include <kernel.h>
|
2016-03-22 04:21:03 +08:00
|
|
|
#include <device.h>
|
|
|
|
#include <soc.h>
|
|
|
|
#include "pinmux.h"
|
|
|
|
#include <pinmux.h>
|
|
|
|
#include <pinmux/stm32/pinmux_stm32.h>
|
|
|
|
|
|
|
|
static int pinmux_stm32_set(struct device *dev,
|
2017-04-21 23:03:20 +08:00
|
|
|
u32_t pin, u32_t func)
|
2016-03-22 04:21:03 +08:00
|
|
|
{
|
|
|
|
ARG_UNUSED(dev);
|
|
|
|
|
|
|
|
return _pinmux_stm32_set(pin, func, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int pinmux_stm32_get(struct device *dev,
|
2017-04-21 23:03:20 +08:00
|
|
|
u32_t pin, u32_t *func)
|
2016-03-22 04:21:03 +08:00
|
|
|
{
|
|
|
|
ARG_UNUSED(dev);
|
|
|
|
ARG_UNUSED(pin);
|
|
|
|
ARG_UNUSED(func);
|
|
|
|
|
|
|
|
return -ENOTSUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int pinmux_stm32_input(struct device *dev,
|
2017-04-21 23:03:20 +08:00
|
|
|
u32_t pin,
|
|
|
|
u8_t func)
|
2016-03-22 04:21:03 +08:00
|
|
|
{
|
|
|
|
ARG_UNUSED(dev);
|
|
|
|
ARG_UNUSED(pin);
|
|
|
|
ARG_UNUSED(func);
|
|
|
|
|
|
|
|
return -ENOTSUP;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int pinmux_stm32_pullup(struct device *dev,
|
2017-04-21 23:03:20 +08:00
|
|
|
u32_t pin,
|
|
|
|
u8_t func)
|
2016-03-22 04:21:03 +08:00
|
|
|
{
|
|
|
|
ARG_UNUSED(dev);
|
|
|
|
ARG_UNUSED(pin);
|
|
|
|
ARG_UNUSED(func);
|
|
|
|
|
|
|
|
return -ENOTSUP;
|
|
|
|
}
|
|
|
|
|
2016-10-24 15:27:56 +08:00
|
|
|
static const struct pinmux_driver_api pinmux_stm32_api = {
|
2016-03-22 04:21:03 +08:00
|
|
|
.set = pinmux_stm32_set,
|
|
|
|
.get = pinmux_stm32_get,
|
|
|
|
.pullup = pinmux_stm32_pullup,
|
|
|
|
.input = pinmux_stm32_input,
|
|
|
|
};
|
|
|
|
|
2016-10-26 15:45:46 +08:00
|
|
|
static int pinmux_stm32_init(struct device *port)
|
2016-03-22 04:21:03 +08:00
|
|
|
{
|
2016-12-03 08:21:17 +08:00
|
|
|
ARG_UNUSED(port);
|
|
|
|
|
2016-03-22 04:21:03 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-04-15 00:28:33 +08:00
|
|
|
DEVICE_AND_API_INIT(pmux_dev, CONFIG_PINMUX_DEV_NAME, &pinmux_stm32_init,
|
|
|
|
NULL, NULL,
|
2016-11-09 03:06:55 +08:00
|
|
|
PRE_KERNEL_1,
|
2016-04-15 00:28:33 +08:00
|
|
|
CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY,
|
|
|
|
&pinmux_stm32_api);
|