pinmux: Merge ksdk pinmux dev into regular ksdk pinmux driver
Merges the ksdk pinmux dev driver into the regular ksdk pinmux driver, which now exposes the public pinmux API. Removes the private ksdk pinmux API and converts the frdm_k64f and hexiwear_k64 boards to use the public pinmux API. Jira: ZEP-958, ZEP-1432 Change-Id: Ie5f60b604133093050b9c596050cad776d7b7cb3 Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
This commit is contained in:
parent
fabc001ff3
commit
acca033468
10 changed files with 222 additions and 275 deletions
|
@ -15,69 +15,88 @@
|
|||
*/
|
||||
|
||||
#include <init.h>
|
||||
#include <pinmux/pinmux_ksdk.h>
|
||||
#include <pinmux.h>
|
||||
#include <fsl_port.h>
|
||||
|
||||
static int frdm_k64f_pinmux_init(struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
pinmux_ksdk_init();
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTA
|
||||
struct device *porta =
|
||||
device_get_binding(CONFIG_PINMUX_KSDK_PORTA_NAME);
|
||||
#endif
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTB
|
||||
struct device *portb =
|
||||
device_get_binding(CONFIG_PINMUX_KSDK_PORTB_NAME);
|
||||
#endif
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTC
|
||||
struct device *portc =
|
||||
device_get_binding(CONFIG_PINMUX_KSDK_PORTC_NAME);
|
||||
#endif
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTD
|
||||
struct device *portd =
|
||||
device_get_binding(CONFIG_PINMUX_KSDK_PORTD_NAME);
|
||||
#endif
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTE
|
||||
struct device *porte =
|
||||
device_get_binding(CONFIG_PINMUX_KSDK_PORTE_NAME);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_UART_K20_PORT_3
|
||||
/* UART3 RX, TX */
|
||||
pinmux_ksdk_set(PORTC, 16, PORT_PCR_MUX(kPORT_MuxAlt3));
|
||||
pinmux_ksdk_set(PORTC, 17, PORT_PCR_MUX(kPORT_MuxAlt3));
|
||||
pinmux_pin_set(portc, 16, PORT_PCR_MUX(kPORT_MuxAlt3));
|
||||
pinmux_pin_set(portc, 17, PORT_PCR_MUX(kPORT_MuxAlt3));
|
||||
#endif
|
||||
/* SW2 / FXOS8700 INT1 */
|
||||
pinmux_ksdk_set(PORTC, 6, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
pinmux_pin_set(portc, 6, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
|
||||
/* SW3 */
|
||||
pinmux_ksdk_set(PORTA, 4, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
pinmux_pin_set(porta, 4, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
|
||||
/* Red, green, blue LEDs */
|
||||
pinmux_ksdk_set(PORTB, 22, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
pinmux_ksdk_set(PORTE, 26, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
pinmux_ksdk_set(PORTB, 21, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
pinmux_pin_set(portb, 22, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
pinmux_pin_set(porte, 26, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
pinmux_pin_set(portb, 21, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
|
||||
#ifdef CONFIG_SPI_0
|
||||
/* SPI0 CS0, SCK, SOUT, SIN */
|
||||
pinmux_ksdk_set(PORTD, 0, PORT_PCR_MUX(kPORT_MuxAlt2));
|
||||
pinmux_ksdk_set(PORTD, 1, PORT_PCR_MUX(kPORT_MuxAlt2));
|
||||
pinmux_ksdk_set(PORTD, 2, PORT_PCR_MUX(kPORT_MuxAlt2));
|
||||
pinmux_ksdk_set(PORTD, 3, PORT_PCR_MUX(kPORT_MuxAlt2));
|
||||
pinmux_pin_set(portd, 0, PORT_PCR_MUX(kPORT_MuxAlt2));
|
||||
pinmux_pin_set(portd, 1, PORT_PCR_MUX(kPORT_MuxAlt2));
|
||||
pinmux_pin_set(portd, 2, PORT_PCR_MUX(kPORT_MuxAlt2));
|
||||
pinmux_pin_set(portd, 3, PORT_PCR_MUX(kPORT_MuxAlt2));
|
||||
#endif
|
||||
|
||||
#if CONFIG_I2C_0
|
||||
/* I2C0 SCL, SDA */
|
||||
pinmux_ksdk_set(PORTE, 24, PORT_PCR_MUX(kPORT_MuxAlt5)
|
||||
pinmux_pin_set(porte, 24, PORT_PCR_MUX(kPORT_MuxAlt5)
|
||||
| PORT_PCR_ODE_MASK);
|
||||
pinmux_ksdk_set(PORTE, 25, PORT_PCR_MUX(kPORT_MuxAlt5)
|
||||
pinmux_pin_set(porte, 25, PORT_PCR_MUX(kPORT_MuxAlt5)
|
||||
| PORT_PCR_ODE_MASK);
|
||||
#endif
|
||||
|
||||
#if CONFIG_ETH_KSDK_0
|
||||
pinmux_ksdk_set(PORTA, 5, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_ksdk_set(PORTA, 12, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_ksdk_set(PORTA, 13, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_ksdk_set(PORTA, 14, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_ksdk_set(PORTA, 15, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_ksdk_set(PORTA, 16, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_ksdk_set(PORTA, 17, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_ksdk_set(PORTA, 28, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_pin_set(porta, 5, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_pin_set(porta, 12, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_pin_set(porta, 13, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_pin_set(porta, 14, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_pin_set(porta, 15, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_pin_set(porta, 16, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_pin_set(porta, 17, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_pin_set(porta, 28, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
|
||||
pinmux_ksdk_set(PORTB, 0, PORT_PCR_MUX(kPORT_MuxAlt4)
|
||||
pinmux_pin_set(portb, 0, PORT_PCR_MUX(kPORT_MuxAlt4)
|
||||
| PORT_PCR_ODE_MASK | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK);
|
||||
|
||||
pinmux_ksdk_set(PORTB, 1, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_pin_set(portb, 1, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
|
||||
pinmux_ksdk_set(PORTC, 16, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_ksdk_set(PORTC, 17, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_ksdk_set(PORTC, 18, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_ksdk_set(PORTC, 19, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_pin_set(portc, 16, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_pin_set(portc, 17, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_pin_set(portc, 18, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
pinmux_pin_set(portc, 19, PORT_PCR_MUX(kPORT_MuxAlt4));
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(frdm_k64f_pinmux_init, PRE_KERNEL_1,
|
||||
CONFIG_PINMUX_INIT_PRIORITY);
|
||||
SYS_INIT(frdm_k64f_pinmux_init, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY);
|
||||
|
|
|
@ -15,37 +15,56 @@
|
|||
*/
|
||||
|
||||
#include <init.h>
|
||||
#include <pinmux/pinmux_ksdk.h>
|
||||
#include <pinmux.h>
|
||||
#include <fsl_port.h>
|
||||
|
||||
static int hexiwear_k64_pinmux_init(struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
pinmux_ksdk_init();
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTA
|
||||
struct device *porta =
|
||||
device_get_binding(CONFIG_PINMUX_KSDK_PORTA_NAME);
|
||||
#endif
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTB
|
||||
struct device *portb =
|
||||
device_get_binding(CONFIG_PINMUX_KSDK_PORTB_NAME);
|
||||
#endif
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTC
|
||||
struct device *portc =
|
||||
device_get_binding(CONFIG_PINMUX_KSDK_PORTC_NAME);
|
||||
#endif
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTD
|
||||
struct device *portd =
|
||||
device_get_binding(CONFIG_PINMUX_KSDK_PORTD_NAME);
|
||||
#endif
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTE
|
||||
struct device *porte =
|
||||
device_get_binding(CONFIG_PINMUX_KSDK_PORTE_NAME);
|
||||
#endif
|
||||
|
||||
/* Red, green, blue LEDs */
|
||||
pinmux_ksdk_set(PORTC, 8, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
pinmux_ksdk_set(PORTC, 9, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
pinmux_ksdk_set(PORTD, 0, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
pinmux_pin_set(portc, 8, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
pinmux_pin_set(portc, 9, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
pinmux_pin_set(portd, 0, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
|
||||
#if CONFIG_I2C_1
|
||||
/* I2C1 SCL, SDA - accel/mag, gyro, pressure */
|
||||
pinmux_ksdk_set(PORTC, 10, PORT_PCR_MUX(kPORT_MuxAlt5)
|
||||
pinmux_pin_set(portc, 10, PORT_PCR_MUX(kPORT_MuxAlt5)
|
||||
| PORT_PCR_ODE_MASK);
|
||||
pinmux_ksdk_set(PORTC, 11, PORT_PCR_MUX(kPORT_MuxAlt5)
|
||||
pinmux_pin_set(portc, 11, PORT_PCR_MUX(kPORT_MuxAlt5)
|
||||
| PORT_PCR_ODE_MASK);
|
||||
#endif
|
||||
/* FXOS8700 INT1 */
|
||||
pinmux_ksdk_set(PORTC, 1, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
pinmux_pin_set(portc, 1, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
||||
|
||||
#ifdef CONFIG_UART_K20_PORT_4
|
||||
/* UART4 RX, TX - BLE */
|
||||
pinmux_ksdk_set(PORTE, 24, PORT_PCR_MUX(kPORT_MuxAlt3));
|
||||
pinmux_ksdk_set(PORTE, 25, PORT_PCR_MUX(kPORT_MuxAlt3));
|
||||
pinmux_pin_set(porte, 24, PORT_PCR_MUX(kPORT_MuxAlt3));
|
||||
pinmux_pin_set(porte, 25, PORT_PCR_MUX(kPORT_MuxAlt3));
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(hexiwear_k64_pinmux_init, PRE_KERNEL_1,
|
||||
CONFIG_PINMUX_INIT_PRIORITY);
|
||||
SYS_INIT(hexiwear_k64_pinmux_init, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY);
|
||||
|
|
|
@ -30,28 +30,53 @@ config PINMUX_KSDK_PORTA
|
|||
help
|
||||
Enable Port A.
|
||||
|
||||
config PINMUX_KSDK_PORTA_NAME
|
||||
string "Pinmux Port A driver name"
|
||||
depends on PINMUX_KSDK_PORTA
|
||||
default "porta"
|
||||
|
||||
config PINMUX_KSDK_PORTB
|
||||
bool "Port B"
|
||||
default n
|
||||
help
|
||||
Enable Port B.
|
||||
|
||||
config PINMUX_KSDK_PORTB_NAME
|
||||
string "Pinmux Port B driver name"
|
||||
depends on PINMUX_KSDK_PORTB
|
||||
default "portb"
|
||||
|
||||
config PINMUX_KSDK_PORTC
|
||||
bool "Port C"
|
||||
default n
|
||||
help
|
||||
Enable Port C.
|
||||
|
||||
config PINMUX_KSDK_PORTC_NAME
|
||||
string "Pinmux Port C driver name"
|
||||
depends on PINMUX_KSDK_PORTC
|
||||
default "portc"
|
||||
|
||||
config PINMUX_KSDK_PORTD
|
||||
bool "Port D"
|
||||
default n
|
||||
help
|
||||
Enable Port D.
|
||||
|
||||
config PINMUX_KSDK_PORTD_NAME
|
||||
string "Pinmux Port D driver name"
|
||||
depends on PINMUX_KSDK_PORTD
|
||||
default "portd"
|
||||
|
||||
config PINMUX_KSDK_PORTE
|
||||
bool "Port E"
|
||||
default n
|
||||
help
|
||||
Enable Port E.
|
||||
|
||||
config PINMUX_KSDK_PORTE_NAME
|
||||
string "Pinmux Port E driver name"
|
||||
depends on PINMUX_KSDK_PORTE
|
||||
default "porte"
|
||||
|
||||
endif # PINMUX_KSDK
|
||||
|
|
|
@ -75,5 +75,3 @@ config PINMUX_DEV_ARM_V2M_BEETLE
|
|||
Enables the pinmux dev driver for boards based on the
|
||||
ARM Beetle SoC MCUs.
|
||||
default n
|
||||
|
||||
source "drivers/pinmux/dev/Kconfig.ksdk"
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
# Kconfig - Kinetis SDK pinmux dev
|
||||
#
|
||||
# Copyright (c) 2016, Freescale Semiconductor, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
menuconfig PINMUX_DEV_KSDK
|
||||
bool "KSDK pinmux dev driver"
|
||||
depends on PINMUX_DEV && PINMUX_KSDK
|
||||
default n
|
||||
help
|
||||
Enable the KSDK pinmux dev driver.
|
||||
|
||||
if PINMUX_DEV_KSDK
|
||||
|
||||
config PINMUX_DEV_KSDK_PORTA_NAME
|
||||
string "Pinmux Dev Port A driver name"
|
||||
depends on PINMUX_KSDK_PORTA
|
||||
default "pinmux_dev_porta"
|
||||
|
||||
config PINMUX_DEV_KSDK_PORTB_NAME
|
||||
string "Pinmux Dev Port B driver name"
|
||||
depends on PINMUX_KSDK_PORTB
|
||||
default "pinmux_dev_portb"
|
||||
|
||||
config PINMUX_DEV_KSDK_PORTC_NAME
|
||||
string "Pinmux Dev Port C driver name"
|
||||
depends on PINMUX_KSDK_PORTC
|
||||
default "pinmux_dev_portc"
|
||||
|
||||
config PINMUX_DEV_KSDK_PORTD_NAME
|
||||
string "Pinmux Dev Port D driver name"
|
||||
depends on PINMUX_KSDK_PORTD
|
||||
default "pinmux_dev_portd"
|
||||
|
||||
config PINMUX_DEV_KSDK_PORTE_NAME
|
||||
string "Pinmux Dev Port E driver name"
|
||||
depends on PINMUX_KSDK_PORTE
|
||||
default "pinmux_dev_porte"
|
||||
|
||||
endif # PINMUX_DEV_KSDK
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <device.h>
|
||||
#include <pinmux.h>
|
||||
#include <pinmux/pinmux_ksdk.h>
|
||||
|
||||
struct pinmux_dev_ksdk_config {
|
||||
PORT_Type *base;
|
||||
};
|
||||
|
||||
static int pinmux_dev_ksdk_set(struct device *dev, uint32_t pin, uint32_t func)
|
||||
{
|
||||
const struct pinmux_dev_ksdk_config *config = dev->config->config_info;
|
||||
|
||||
return pinmux_ksdk_set(config->base, pin, func);
|
||||
}
|
||||
|
||||
static int pinmux_dev_ksdk_get(struct device *dev, uint32_t pin, uint32_t *func)
|
||||
{
|
||||
const struct pinmux_dev_ksdk_config *config = dev->config->config_info;
|
||||
|
||||
return pinmux_ksdk_get(config->base, pin, func);
|
||||
}
|
||||
|
||||
static int pinmux_dev_ksdk_pullup(struct device *dev, uint32_t pin,
|
||||
uint8_t func)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int pinmux_dev_ksdk_input(struct device *dev, uint32_t pin,
|
||||
uint8_t func)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static const struct pinmux_driver_api pinmux_dev_ksdk_driver_api = {
|
||||
.set = pinmux_dev_ksdk_set,
|
||||
.get = pinmux_dev_ksdk_get,
|
||||
.pullup = pinmux_dev_ksdk_pullup,
|
||||
.input = pinmux_dev_ksdk_input,
|
||||
};
|
||||
|
||||
static int pinmux_dev_ksdk_init(struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTA
|
||||
static const struct pinmux_dev_ksdk_config pinmux_dev_ksdk_porta_config = {
|
||||
.base = PORTA,
|
||||
};
|
||||
|
||||
DEVICE_AND_API_INIT(pinmux_dev_porta, CONFIG_PINMUX_DEV_KSDK_PORTA_NAME,
|
||||
&pinmux_dev_ksdk_init,
|
||||
NULL, &pinmux_dev_ksdk_porta_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&pinmux_dev_ksdk_driver_api);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTB
|
||||
static const struct pinmux_dev_ksdk_config pinmux_dev_ksdk_portb_config = {
|
||||
.base = PORTB,
|
||||
};
|
||||
|
||||
DEVICE_AND_API_INIT(pinmux_dev_portb, CONFIG_PINMUX_DEV_KSDK_PORTB_NAME,
|
||||
&pinmux_dev_ksdk_init,
|
||||
NULL, &pinmux_dev_ksdk_portb_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&pinmux_dev_ksdk_driver_api);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTC
|
||||
static const struct pinmux_dev_ksdk_config pinmux_dev_ksdk_portc_config = {
|
||||
.base = PORTC,
|
||||
};
|
||||
|
||||
DEVICE_AND_API_INIT(pinmux_dev_portc, CONFIG_PINMUX_DEV_KSDK_PORTC_NAME,
|
||||
&pinmux_dev_ksdk_init,
|
||||
NULL, &pinmux_dev_ksdk_portc_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&pinmux_dev_ksdk_driver_api);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTD
|
||||
static const struct pinmux_dev_ksdk_config pinmux_dev_ksdk_portd_config = {
|
||||
.base = PORTD,
|
||||
};
|
||||
|
||||
DEVICE_AND_API_INIT(pinmux_dev_portd, CONFIG_PINMUX_DEV_KSDK_PORTD_NAME,
|
||||
&pinmux_dev_ksdk_init,
|
||||
NULL, &pinmux_dev_ksdk_portd_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&pinmux_dev_ksdk_driver_api);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTE
|
||||
static const struct pinmux_dev_ksdk_config pinmux_dev_ksdk_porte_config = {
|
||||
.base = PORTE,
|
||||
};
|
||||
|
||||
DEVICE_AND_API_INIT(pinmux_dev_porte, CONFIG_PINMUX_DEV_KSDK_PORTE_NAME,
|
||||
&pinmux_dev_ksdk_init,
|
||||
NULL, &pinmux_dev_ksdk_porte_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&pinmux_dev_ksdk_driver_api);
|
||||
#endif
|
|
@ -14,26 +14,124 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <pinmux/pinmux_ksdk.h>
|
||||
#include <errno.h>
|
||||
#include <device.h>
|
||||
#include <pinmux.h>
|
||||
#include <fsl_common.h>
|
||||
#include <fsl_clock.h>
|
||||
|
||||
int pinmux_ksdk_init(void)
|
||||
struct pinmux_ksdk_config {
|
||||
clock_ip_name_t clock_ip_name;
|
||||
PORT_Type *base;
|
||||
};
|
||||
|
||||
static int pinmux_ksdk_set(struct device *dev, uint32_t pin, uint32_t func)
|
||||
{
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTA
|
||||
CLOCK_EnableClock(kCLOCK_PortA);
|
||||
#endif
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTB
|
||||
CLOCK_EnableClock(kCLOCK_PortB);
|
||||
#endif
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTC
|
||||
CLOCK_EnableClock(kCLOCK_PortC);
|
||||
#endif
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTD
|
||||
CLOCK_EnableClock(kCLOCK_PortD);
|
||||
#endif
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTE
|
||||
CLOCK_EnableClock(kCLOCK_PortE);
|
||||
#endif
|
||||
const struct pinmux_ksdk_config *config = dev->config->config_info;
|
||||
PORT_Type *base = config->base;
|
||||
|
||||
base->PCR[pin] = func;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pinmux_ksdk_get(struct device *dev, uint32_t pin, uint32_t *func)
|
||||
{
|
||||
const struct pinmux_ksdk_config *config = dev->config->config_info;
|
||||
PORT_Type *base = config->base;
|
||||
|
||||
*func = base->PCR[pin];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pinmux_ksdk_pullup(struct device *dev, uint32_t pin, uint8_t func)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int pinmux_ksdk_input(struct device *dev, uint32_t pin, uint8_t func)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int pinmux_ksdk_init(struct device *dev)
|
||||
{
|
||||
const struct pinmux_ksdk_config *config = dev->config->config_info;
|
||||
|
||||
CLOCK_EnableClock(config->clock_ip_name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct pinmux_driver_api pinmux_ksdk_driver_api = {
|
||||
.set = pinmux_ksdk_set,
|
||||
.get = pinmux_ksdk_get,
|
||||
.pullup = pinmux_ksdk_pullup,
|
||||
.input = pinmux_ksdk_input,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTA
|
||||
static const struct pinmux_ksdk_config pinmux_ksdk_porta_config = {
|
||||
.base = PORTA,
|
||||
.clock_ip_name = kCLOCK_PortA,
|
||||
};
|
||||
|
||||
DEVICE_AND_API_INIT(pinmux_porta, CONFIG_PINMUX_KSDK_PORTA_NAME,
|
||||
&pinmux_ksdk_init,
|
||||
NULL, &pinmux_ksdk_porta_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&pinmux_ksdk_driver_api);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTB
|
||||
static const struct pinmux_ksdk_config pinmux_ksdk_portb_config = {
|
||||
.base = PORTB,
|
||||
.clock_ip_name = kCLOCK_PortB,
|
||||
};
|
||||
|
||||
DEVICE_AND_API_INIT(pinmux_portb, CONFIG_PINMUX_KSDK_PORTB_NAME,
|
||||
&pinmux_ksdk_init,
|
||||
NULL, &pinmux_ksdk_portb_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&pinmux_ksdk_driver_api);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTC
|
||||
static const struct pinmux_ksdk_config pinmux_ksdk_portc_config = {
|
||||
.base = PORTC,
|
||||
.clock_ip_name = kCLOCK_PortC,
|
||||
};
|
||||
|
||||
DEVICE_AND_API_INIT(pinmux_portc, CONFIG_PINMUX_KSDK_PORTC_NAME,
|
||||
&pinmux_ksdk_init,
|
||||
NULL, &pinmux_ksdk_portc_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&pinmux_ksdk_driver_api);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTD
|
||||
static const struct pinmux_ksdk_config pinmux_ksdk_portd_config = {
|
||||
.base = PORTD,
|
||||
.clock_ip_name = kCLOCK_PortD,
|
||||
};
|
||||
|
||||
DEVICE_AND_API_INIT(pinmux_portd, CONFIG_PINMUX_KSDK_PORTD_NAME,
|
||||
&pinmux_ksdk_init,
|
||||
NULL, &pinmux_ksdk_portd_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&pinmux_ksdk_driver_api);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PINMUX_KSDK_PORTE
|
||||
static const struct pinmux_ksdk_config pinmux_ksdk_porte_config = {
|
||||
.base = PORTE,
|
||||
.clock_ip_name = kCLOCK_PortE,
|
||||
};
|
||||
|
||||
DEVICE_AND_API_INIT(pinmux_porte, CONFIG_PINMUX_KSDK_PORTE_NAME,
|
||||
&pinmux_ksdk_init,
|
||||
NULL, &pinmux_ksdk_porte_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&pinmux_ksdk_driver_api);
|
||||
#endif
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __INCLUDE_PINMUX_KSDK_H
|
||||
#define __INCLUDE_PINMUX_KSDK_H
|
||||
|
||||
#include <device.h>
|
||||
#include <fsl_port.h>
|
||||
|
||||
int pinmux_ksdk_init(void);
|
||||
|
||||
static inline int pinmux_ksdk_set(PORT_Type *base, uint32_t pin, uint32_t func)
|
||||
{
|
||||
base->PCR[pin] = func;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int pinmux_ksdk_get(PORT_Type *base, uint32_t pin, uint32_t *func)
|
||||
{
|
||||
*func = base->PCR[pin];
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* __INCLUDE_PINMUX_KSDK_H */
|
|
@ -1 +0,0 @@
|
|||
CONFIG_PINMUX_DEV=y
|
|
@ -1,4 +1,4 @@
|
|||
[test_pinmux_dev]
|
||||
build_only = true
|
||||
tags = drivers
|
||||
platform_whitelist = quark_se_c1000_devboard arduino_101 arduino_due frdm_k64f galileo nucleo_f103rb stm32_mini_a15 olimexino_stm32 quark_d2000_crb
|
||||
platform_whitelist = quark_se_c1000_devboard arduino_101 arduino_due galileo nucleo_f103rb stm32_mini_a15 olimexino_stm32 quark_d2000_crb
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue