2021-01-09 21:18:08 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020 Rafael Dias Menezes <rdmeneze@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2022-05-06 16:56:39 +08:00
|
|
|
#include <zephyr/init.h>
|
2021-01-09 21:18:08 +08:00
|
|
|
#include "board.h"
|
2022-05-06 16:56:39 +08:00
|
|
|
#include <zephyr/drivers/gpio.h>
|
|
|
|
#include <zephyr/sys/printk.h>
|
2021-01-09 21:18:08 +08:00
|
|
|
|
|
|
|
static int efm32pg_stk3401a_init(const struct device *dev)
|
|
|
|
{
|
|
|
|
const struct device *bce_dev; /* Board Controller Enable Gpio Device */
|
|
|
|
|
|
|
|
ARG_UNUSED(dev);
|
|
|
|
|
|
|
|
/* Enable the board controller to be able to use the serial port */
|
2022-07-27 21:01:52 +08:00
|
|
|
bce_dev = DEVICE_DT_GET(BC_ENABLE_GPIO_NODE);
|
2021-01-09 21:18:08 +08:00
|
|
|
|
2022-07-27 21:01:52 +08:00
|
|
|
if (!device_is_ready(bce_dev)) {
|
|
|
|
printk("Board controller gpio port is not ready!\n");
|
2021-01-09 21:18:08 +08:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
gpio_pin_configure(bce_dev, BC_ENABLE_GPIO_PIN, GPIO_OUTPUT_HIGH);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* needs to be done after GPIO driver init */
|
2021-03-24 19:09:43 +08:00
|
|
|
SYS_INIT(efm32pg_stk3401a_init, POST_KERNEL,
|
|
|
|
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
|