Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gnss: ubx: add support for the safeboot gpio

U-Blox M8/M9 chip have a pin to start it in safeboot mode, to be used
to recover from situations where the flash content has become
corrupted and needs to be restored. If this pin is asserted at power
up/reset, the receiver starts in safeboot mode and GNSS operation is
disabled.

Deassert the safeboot pin when probing this driver.

Signed-off-by: Alejandro Enrique <alejandroe1@geotab.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20250911-ubx-safeboot-v3-2-32fe6b882a3c@geotab.com
[ johan: deassert after requesting supplies ]
Signed-off-by: Johan Hovold <johan@kernel.org>

authored by

Alejandro Enrique and committed by
Johan Hovold
955cd054 0fc1b4b6

+8
+8
drivers/gnss/ubx.c
··· 66 66 static int ubx_probe(struct serdev_device *serdev) 67 67 { 68 68 struct gnss_serial *gserial; 69 + struct gpio_desc *safeboot; 69 70 struct gpio_desc *reset; 70 71 struct ubx_data *data; 71 72 int ret; ··· 92 91 ret = devm_regulator_get_enable_optional(&serdev->dev, "v-bckp"); 93 92 if (ret < 0 && ret != -ENODEV) 94 93 goto err_free_gserial; 94 + 95 + /* Deassert safeboot */ 96 + safeboot = devm_gpiod_get_optional(&serdev->dev, "safeboot", GPIOD_OUT_LOW); 97 + if (IS_ERR(safeboot)) { 98 + ret = PTR_ERR(safeboot); 99 + goto err_free_gserial; 100 + } 95 101 96 102 /* Deassert reset */ 97 103 reset = devm_gpiod_get_optional(&serdev->dev, "reset", GPIOD_OUT_LOW);