From b6c80d16a1ce9195dfeae62b237df9a2b270dd54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20Weinholt?= Date: Mon, 17 Apr 2023 19:12:20 +0200 Subject: [PATCH] boards: particle_boron: Fix init of modem pins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Boron has a power switch that controls power to a level shifter for the modem's serial line. Previously, this switch was being enabled after the modem driver had already started. It is now controlled using a fixed regulator. The board initialization was also configuring the V_INT_DETECT pin. However, this pin is already handled as mdm-vint-gpios in the dts when the ublox-sara-r4 driver is used. Since it is not used otherwise, there is no need to configure it in the board init. Fixes: #56883 Signed-off-by: Göran Weinholt --- boards/arm/particle_boron/board.c | 24 +------------------ boards/arm/particle_boron/board.h | 19 --------------- boards/arm/particle_boron/particle_boron.dts | 8 +++++++ .../particle_boron/particle_boron_defconfig | 5 ++++ 4 files changed, 14 insertions(+), 42 deletions(-) delete mode 100644 boards/arm/particle_boron/board.h diff --git a/boards/arm/particle_boron/board.c b/boards/arm/particle_boron/board.c index 7f313336c112..ff66c633ae35 100644 --- a/boards/arm/particle_boron/board.c +++ b/boards/arm/particle_boron/board.c @@ -7,7 +7,6 @@ #include #include -#include "board.h" #define ANT_UFLn_GPIO_SPEC GPIO_DT_SPEC_GET(DT_NODELABEL(sky13351), vctl1_gpios) @@ -29,30 +28,9 @@ static inline void external_antenna(bool on) static int board_particle_boron_init(void) { - external_antenna(false); -#if defined(CONFIG_MODEM_UBLOX_SARA) - const struct device *gpio_dev; - - /* Enable the serial buffer for SARA-R4 modem */ - gpio_dev = DEVICE_DT_GET(SERIAL_BUFFER_ENABLE_GPIO_NODE); - if (!device_is_ready(gpio_dev)) { - return -ENODEV; - } - - gpio_pin_configure(gpio_dev, V_INT_DETECT_GPIO_PIN, - GPIO_INPUT | V_INT_DETECT_GPIO_FLAGS); - - gpio_pin_configure(gpio_dev, SERIAL_BUFFER_ENABLE_GPIO_PIN, - GPIO_OUTPUT_ACTIVE - | SERIAL_BUFFER_ENABLE_GPIO_FLAGS); -#endif - return 0; } -/* needs to be done after GPIO driver init, which is at - * POST_KERNEL:KERNEL_INIT_PRIORITY_DEFAULT. - */ -SYS_INIT(board_particle_boron_init, POST_KERNEL, 99); +SYS_INIT(board_particle_boron_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); diff --git a/boards/arm/particle_boron/board.h b/boards/arm/particle_boron/board.h deleted file mode 100644 index 3c57614eb8c9..000000000000 --- a/boards/arm/particle_boron/board.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2019 Foundries.io - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef __INC_BOARD_H -#define __INC_BOARD_H - -/* pin used to enable the buffer power */ -#define SERIAL_BUFFER_ENABLE_GPIO_NODE DT_INST(0, nordic_nrf_gpio) -#define SERIAL_BUFFER_ENABLE_GPIO_PIN 25 -#define SERIAL_BUFFER_ENABLE_GPIO_FLAGS GPIO_ACTIVE_LOW - -/* pin used to detect V_INT (buffer power) */ -#define V_INT_DETECT_GPIO_PIN 2 -#define V_INT_DETECT_GPIO_FLAGS GPIO_ACTIVE_HIGH - -#endif /* __INC_BOARD_H */ diff --git a/boards/arm/particle_boron/particle_boron.dts b/boards/arm/particle_boron/particle_boron.dts index e59853bf8095..3e20eddb94f0 100644 --- a/boards/arm/particle_boron/particle_boron.dts +++ b/boards/arm/particle_boron/particle_boron.dts @@ -23,6 +23,14 @@ vctl2-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; }; + /* Power to the level shifter for uart1 */ + en_buff_pwr: enable-buff-pwr { + compatible = "regulator-fixed"; + regulator-name = "en_buff_pwr"; + enable-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; + regulator-boot-on; + }; + aliases { watchdog0 = &wdt0; }; diff --git a/boards/arm/particle_boron/particle_boron_defconfig b/boards/arm/particle_boron/particle_boron_defconfig index 1e6e784b0970..6963e9d9393d 100644 --- a/boards/arm/particle_boron/particle_boron_defconfig +++ b/boards/arm/particle_boron/particle_boron_defconfig @@ -24,3 +24,8 @@ CONFIG_UART_CONSOLE=y CONFIG_GPIO_AS_PINRESET=y CONFIG_PINCTRL=y + +# Fix the priority to enable the modem line's serial buffer +# before the modem driver starts (gsm_ppp or ublox-sara-r4). +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_INIT_PRIORITY=41