2016-11-24 06:08:37 +08:00
|
|
|
/*
|
|
|
|
* 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 <init.h>
|
2016-12-19 06:19:27 +08:00
|
|
|
#include <pinmux.h>
|
|
|
|
#include <fsl_port.h>
|
2016-11-24 06:08:37 +08:00
|
|
|
|
|
|
|
static int hexiwear_k64_pinmux_init(struct device *dev)
|
|
|
|
{
|
|
|
|
ARG_UNUSED(dev);
|
|
|
|
|
2017-01-03 05:07:42 +08:00
|
|
|
#ifdef CONFIG_PINMUX_MCUX_PORTA
|
2016-12-19 06:19:27 +08:00
|
|
|
struct device *porta =
|
2017-01-03 05:07:42 +08:00
|
|
|
device_get_binding(CONFIG_PINMUX_MCUX_PORTA_NAME);
|
2016-12-19 06:19:27 +08:00
|
|
|
#endif
|
2017-01-03 05:07:42 +08:00
|
|
|
#ifdef CONFIG_PINMUX_MCUX_PORTB
|
2016-12-19 06:19:27 +08:00
|
|
|
struct device *portb =
|
2017-01-03 05:07:42 +08:00
|
|
|
device_get_binding(CONFIG_PINMUX_MCUX_PORTB_NAME);
|
2016-12-19 06:19:27 +08:00
|
|
|
#endif
|
2017-01-03 05:07:42 +08:00
|
|
|
#ifdef CONFIG_PINMUX_MCUX_PORTC
|
2016-12-19 06:19:27 +08:00
|
|
|
struct device *portc =
|
2017-01-03 05:07:42 +08:00
|
|
|
device_get_binding(CONFIG_PINMUX_MCUX_PORTC_NAME);
|
2016-12-19 06:19:27 +08:00
|
|
|
#endif
|
2017-01-03 05:07:42 +08:00
|
|
|
#ifdef CONFIG_PINMUX_MCUX_PORTD
|
2016-12-19 06:19:27 +08:00
|
|
|
struct device *portd =
|
2017-01-03 05:07:42 +08:00
|
|
|
device_get_binding(CONFIG_PINMUX_MCUX_PORTD_NAME);
|
2016-12-19 06:19:27 +08:00
|
|
|
#endif
|
2017-01-03 05:07:42 +08:00
|
|
|
#ifdef CONFIG_PINMUX_MCUX_PORTE
|
2016-12-19 06:19:27 +08:00
|
|
|
struct device *porte =
|
2017-01-03 05:07:42 +08:00
|
|
|
device_get_binding(CONFIG_PINMUX_MCUX_PORTE_NAME);
|
2016-12-19 06:19:27 +08:00
|
|
|
#endif
|
2016-11-24 06:08:37 +08:00
|
|
|
|
|
|
|
/* Red, green, blue LEDs */
|
2016-12-19 06:19:27 +08:00
|
|
|
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));
|
2016-11-24 06:08:37 +08:00
|
|
|
|
|
|
|
#if CONFIG_I2C_1
|
|
|
|
/* I2C1 SCL, SDA - accel/mag, gyro, pressure */
|
2017-01-08 00:48:08 +08:00
|
|
|
pinmux_pin_set(portc, 10, PORT_PCR_MUX(kPORT_MuxAlt2)
|
2016-11-24 06:08:37 +08:00
|
|
|
| PORT_PCR_ODE_MASK);
|
2017-01-08 00:48:08 +08:00
|
|
|
pinmux_pin_set(portc, 11, PORT_PCR_MUX(kPORT_MuxAlt2)
|
2016-11-24 06:08:37 +08:00
|
|
|
| PORT_PCR_ODE_MASK);
|
|
|
|
#endif
|
|
|
|
/* FXOS8700 INT1 */
|
2016-12-19 06:19:27 +08:00
|
|
|
pinmux_pin_set(portc, 1, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
2016-11-24 06:08:37 +08:00
|
|
|
|
2017-01-07 23:32:57 +08:00
|
|
|
#ifdef CONFIG_UART_K20_PORT_0
|
|
|
|
/* UART0 RX, TX */
|
|
|
|
pinmux_pin_set(portb, 16, PORT_PCR_MUX(kPORT_MuxAlt3));
|
|
|
|
pinmux_pin_set(portb, 17, PORT_PCR_MUX(kPORT_MuxAlt3));
|
|
|
|
#endif
|
|
|
|
|
2016-11-24 06:08:37 +08:00
|
|
|
#ifdef CONFIG_UART_K20_PORT_4
|
|
|
|
/* UART4 RX, TX - BLE */
|
2016-12-19 06:19:27 +08:00
|
|
|
pinmux_pin_set(porte, 24, PORT_PCR_MUX(kPORT_MuxAlt3));
|
|
|
|
pinmux_pin_set(porte, 25, PORT_PCR_MUX(kPORT_MuxAlt3));
|
2016-11-24 06:08:37 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-12-19 06:19:27 +08:00
|
|
|
SYS_INIT(hexiwear_k64_pinmux_init, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY);
|