Skip to content

Commit

Permalink
boards: particle_boron: Fix init of modem pins
Browse files Browse the repository at this point in the history
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: zephyrproject-rtos#56883
Signed-off-by: Göran Weinholt <goran@weinholt.se>
  • Loading branch information
Göran Weinholt authored and nashif committed May 30, 2023
1 parent d69f763 commit b6c80d1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 42 deletions.
24 changes: 1 addition & 23 deletions boards/arm/particle_boron/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include <zephyr/init.h>
#include <zephyr/drivers/gpio.h>
#include "board.h"

#define ANT_UFLn_GPIO_SPEC GPIO_DT_SPEC_GET(DT_NODELABEL(sky13351), vctl1_gpios)

Expand All @@ -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);
19 changes: 0 additions & 19 deletions boards/arm/particle_boron/board.h

This file was deleted.

8 changes: 8 additions & 0 deletions boards/arm/particle_boron/particle_boron.dts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
5 changes: 5 additions & 0 deletions boards/arm/particle_boron/particle_boron_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b6c80d1

Please sign in to comment.