From: Alejandro Enrique <alejandroe1@geotab.com>
U-Blox 8/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.
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Alejandro Enrique <alejandroe1@geotab.com>
---
drivers/gnss/ubx.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/gnss/ubx.c b/drivers/gnss/ubx.c
index 92402f6082c415c7b9051338eef5406b09e09455..1d6acace84f76f8d5d2eacdbbf5ab7a934b33486 100644
--- a/drivers/gnss/ubx.c
+++ b/drivers/gnss/ubx.c
@@ -67,6 +67,7 @@ static int ubx_probe(struct serdev_device *serdev)
{
struct gnss_serial *gserial;
struct gpio_desc *reset;
+ struct gpio_desc *safeboot;
struct ubx_data *data;
int ret;
@@ -82,6 +83,13 @@ static int ubx_probe(struct serdev_device *serdev)
data = gnss_serial_get_drvdata(gserial);
+ /* Deassert safeboot */
+ safeboot = devm_gpiod_get_optional(&serdev->dev, "safeboot", GPIOD_OUT_LOW);
+ if (IS_ERR(safeboot)) {
+ ret = PTR_ERR(safeboot);
+ goto err_free_gserial;
+ }
+
data->vcc = devm_regulator_get(&serdev->dev, "vcc");
if (IS_ERR(data->vcc)) {
ret = PTR_ERR(data->vcc);
--
2.34.1
On Thu, Sep 11, 2025 at 02:58:29PM +0200, Alejandro Enrique via B4 Relay wrote:
> From: Alejandro Enrique <alejandroe1@geotab.com>
>
> U-Blox 8/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.
>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Alejandro Enrique <alejandroe1@geotab.com>
Sorry about the late feedback on this. I had to think about how best to
handle this, given that we don't have an interface yet to actually
assert these pins.
I guess we can go ahead and request them at probe as you're doing here
and add an interface for controlling them later if needed (instead of
not claiming them and allowing emergency control through gpiolib).
> @@ -82,6 +83,13 @@ static int ubx_probe(struct serdev_device *serdev)
>
> data = gnss_serial_get_drvdata(gserial);
>
> + /* Deassert safeboot */
> + safeboot = devm_gpiod_get_optional(&serdev->dev, "safeboot", GPIOD_OUT_LOW);
> + if (IS_ERR(safeboot)) {
> + ret = PTR_ERR(safeboot);
> + goto err_free_gserial;
> + }
> +
> data->vcc = devm_regulator_get(&serdev->dev, "vcc");
Note that the driver is not enabling the supply until open() so I moved
the deassert to after the supplies have been requested (but before reset
is deasserted).
Note however that both the RESET_N and SAFEBOOT_N pins should be
declared as open-drain to avoid driving them while the main supply is
off.
I added a comment about this to the commit message about this when
applying and will send a follow-on patch to update the binding example.
> if (IS_ERR(data->vcc)) {
> ret = PTR_ERR(data->vcc);
Johan
On Fri, Nov 14, 2025 at 03:59:24PM +0100, Johan Hovold wrote: > On Thu, Sep 11, 2025 at 02:58:29PM +0200, Alejandro Enrique via B4 Relay wrote: > > From: Alejandro Enrique <alejandroe1@geotab.com> > > > > U-Blox 8/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. > Note however that both the RESET_N and SAFEBOOT_N pins should be > declared as open-drain to avoid driving them while the main supply is > off. > > I added a comment about this to the commit message about this when > applying and will send a follow-on patch to update the binding example. I was playing with the idea of adding a warning about this to the driver when realised that there would typically be a level shifter for these signals that makes sure they are not driven while the supply is off so I dropped the comment instead. Johan
On Fri, Nov 14, 2025 at 3:59 PM Johan Hovold <johan@kernel.org> wrote:
>
> On Thu, Sep 11, 2025 at 02:58:29PM +0200, Alejandro Enrique via B4 Relay wrote:
> > From: Alejandro Enrique <alejandroe1@geotab.com>
> >
> > U-Blox 8/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.
> >
> > Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > Signed-off-by: Alejandro Enrique <alejandroe1@geotab.com>
>
> Sorry about the late feedback on this. I had to think about how best to
> handle this, given that we don't have an interface yet to actually
> assert these pins.
>
> I guess we can go ahead and request them at probe as you're doing here
> and add an interface for controlling them later if needed (instead of
> not claiming them and allowing emergency control through gpiolib).
>
> > @@ -82,6 +83,13 @@ static int ubx_probe(struct serdev_device *serdev)
> >
> > data = gnss_serial_get_drvdata(gserial);
> >
> > + /* Deassert safeboot */
> > + safeboot = devm_gpiod_get_optional(&serdev->dev, "safeboot", GPIOD_OUT_LOW);
> > + if (IS_ERR(safeboot)) {
> > + ret = PTR_ERR(safeboot);
> > + goto err_free_gserial;
> > + }
> > +
> > data->vcc = devm_regulator_get(&serdev->dev, "vcc");
>
> Note that the driver is not enabling the supply until open() so I moved
> the deassert to after the supplies have been requested (but before reset
> is deasserted).
>
> Note however that both the RESET_N and SAFEBOOT_N pins should be
> declared as open-drain to avoid driving them while the main supply is
> off.
I will keep that in mind.
Thank you for the note and your time in reviewing this.
>
>
> I added a comment about this to the commit message about this when
> applying and will send a follow-on patch to update the binding example.
>
> > if (IS_ERR(data->vcc)) {
> > ret = PTR_ERR(data->vcc);
>
> Johan
© 2016 - 2026 Red Hat, Inc.