The nWKRQ pin supports an output voltage of either the internal reference
voltage (3.6V) or the reference voltage of
the digital interface 0-6V (VIO).
Add the devicetree option ti,nwkrq-voltage-vio to set it to VIO.
If this property is omitted the reset default, the internal reference
voltage, is used.
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Reviewed-by: Marc Kleine-Budde <mkl@pengutronix.de>
Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
drivers/net/can/m_can/tcan4x5x-core.c | 20 ++++++++++++++++++++
drivers/net/can/m_can/tcan4x5x.h | 2 ++
2 files changed, 22 insertions(+)
diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/tcan4x5x-core.c
index 2f73bf3abad889c222f15c39a3d43de1a1cf5fbb..7213d9894c82d079bf92f1ec62d4eebb500cdfa4 100644
--- a/drivers/net/can/m_can/tcan4x5x-core.c
+++ b/drivers/net/can/m_can/tcan4x5x-core.c
@@ -92,6 +92,8 @@
#define TCAN4X5X_MODE_STANDBY BIT(6)
#define TCAN4X5X_MODE_NORMAL BIT(7)
+#define TCAN4X5X_NWKRQ_VOLTAGE_VIO BIT(19)
+
#define TCAN4X5X_DISABLE_WAKE_MSK (BIT(31) | BIT(30))
#define TCAN4X5X_DISABLE_INH_MSK BIT(9)
@@ -267,6 +269,13 @@ static int tcan4x5x_init(struct m_can_classdev *cdev)
if (ret)
return ret;
+ if (tcan4x5x->nwkrq_voltage_vio) {
+ ret = regmap_set_bits(tcan4x5x->regmap, TCAN4X5X_CONFIG,
+ TCAN4X5X_NWKRQ_VOLTAGE_VIO);
+ if (ret)
+ return ret;
+ }
+
return ret;
}
@@ -318,6 +327,15 @@ static const struct tcan4x5x_version_info
return &tcan4x5x_versions[TCAN4X5X];
}
+static void tcan4x5x_get_dt_data(struct m_can_classdev *cdev)
+{
+ struct tcan4x5x_priv *tcan4x5x = cdev_to_priv(cdev);
+ struct device_node *np = cdev->dev->of_node;
+
+ tcan4x5x->nwkrq_voltage_vio =
+ of_property_read_bool(cdev->dev->of_node, "ti,nwkrq-voltage-vio");
+}
+
static int tcan4x5x_get_gpios(struct m_can_classdev *cdev,
const struct tcan4x5x_version_info *version_info)
{
@@ -453,6 +471,8 @@ static int tcan4x5x_can_probe(struct spi_device *spi)
goto out_power;
}
+ tcan4x5x_get_dt_data(mcan_class);
+
tcan4x5x_check_wake(priv);
ret = tcan4x5x_write_tcan_reg(mcan_class, TCAN4X5X_INT_EN, 0);
diff --git a/drivers/net/can/m_can/tcan4x5x.h b/drivers/net/can/m_can/tcan4x5x.h
index e62c030d3e1e5a713c997e7c8ecad4a44aff4e6a..203399d5e8ccf3fd7a26b54d8356fca9d398524c 100644
--- a/drivers/net/can/m_can/tcan4x5x.h
+++ b/drivers/net/can/m_can/tcan4x5x.h
@@ -42,6 +42,8 @@ struct tcan4x5x_priv {
struct tcan4x5x_map_buf map_buf_rx;
struct tcan4x5x_map_buf map_buf_tx;
+
+ bool nwkrq_voltage_vio;
};
static inline void
--
2.46.2
Hi Marc,
On Thu, Nov 14, 2024 at 10:14:50AM +0100, Sean Nyekjaer wrote:
> The nWKRQ pin supports an output voltage of either the internal reference
> voltage (3.6V) or the reference voltage of
> the digital interface 0-6V (VIO).
> Add the devicetree option ti,nwkrq-voltage-vio to set it to VIO.
>
> If this property is omitted the reset default, the internal reference
> voltage, is used.
>
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> Reviewed-by: Marc Kleine-Budde <mkl@pengutronix.de>
> Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> ---
> drivers/net/can/m_can/tcan4x5x-core.c | 20 ++++++++++++++++++++
> drivers/net/can/m_can/tcan4x5x.h | 2 ++
> 2 files changed, 22 insertions(+)
>
> diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/tcan4x5x-core.c
> index 2f73bf3abad889c222f15c39a3d43de1a1cf5fbb..7213d9894c82d079bf92f1ec62d4eebb500cdfa4 100644
> --- a/drivers/net/can/m_can/tcan4x5x-core.c
> +++ b/drivers/net/can/m_can/tcan4x5x-core.c
> @@ -92,6 +92,8 @@
> #define TCAN4X5X_MODE_STANDBY BIT(6)
> #define TCAN4X5X_MODE_NORMAL BIT(7)
>
> +#define TCAN4X5X_NWKRQ_VOLTAGE_VIO BIT(19)
> +
> #define TCAN4X5X_DISABLE_WAKE_MSK (BIT(31) | BIT(30))
> #define TCAN4X5X_DISABLE_INH_MSK BIT(9)
>
> @@ -267,6 +269,13 @@ static int tcan4x5x_init(struct m_can_classdev *cdev)
> if (ret)
> return ret;
>
> + if (tcan4x5x->nwkrq_voltage_vio) {
> + ret = regmap_set_bits(tcan4x5x->regmap, TCAN4X5X_CONFIG,
> + TCAN4X5X_NWKRQ_VOLTAGE_VIO);
> + if (ret)
> + return ret;
> + }
> +
> return ret;
> }
>
> @@ -318,6 +327,15 @@ static const struct tcan4x5x_version_info
> return &tcan4x5x_versions[TCAN4X5X];
> }
>
> +static void tcan4x5x_get_dt_data(struct m_can_classdev *cdev)
> +{
> + struct tcan4x5x_priv *tcan4x5x = cdev_to_priv(cdev);
> + struct device_node *np = cdev->dev->of_node;
Guess we can remove this line. Sorry
> +
> + tcan4x5x->nwkrq_voltage_vio =
> + of_property_read_bool(cdev->dev->of_node, "ti,nwkrq-voltage-vio");
> +}
> +
> static int tcan4x5x_get_gpios(struct m_can_classdev *cdev,
> const struct tcan4x5x_version_info *version_info)
> {
> @@ -453,6 +471,8 @@ static int tcan4x5x_can_probe(struct spi_device *spi)
> goto out_power;
> }
>
> + tcan4x5x_get_dt_data(mcan_class);
> +
> tcan4x5x_check_wake(priv);
>
> ret = tcan4x5x_write_tcan_reg(mcan_class, TCAN4X5X_INT_EN, 0);
> diff --git a/drivers/net/can/m_can/tcan4x5x.h b/drivers/net/can/m_can/tcan4x5x.h
> index e62c030d3e1e5a713c997e7c8ecad4a44aff4e6a..203399d5e8ccf3fd7a26b54d8356fca9d398524c 100644
> --- a/drivers/net/can/m_can/tcan4x5x.h
> +++ b/drivers/net/can/m_can/tcan4x5x.h
> @@ -42,6 +42,8 @@ struct tcan4x5x_priv {
>
> struct tcan4x5x_map_buf map_buf_rx;
> struct tcan4x5x_map_buf map_buf_tx;
> +
> + bool nwkrq_voltage_vio;
> };
>
> static inline void
>
> --
> 2.46.2
>
/Sean
On 18.11.2024 16:05:42, Sean Nyekjaer wrote:
> Hi Marc,
>
> On Thu, Nov 14, 2024 at 10:14:50AM +0100, Sean Nyekjaer wrote:
> > The nWKRQ pin supports an output voltage of either the internal reference
> > voltage (3.6V) or the reference voltage of
> > the digital interface 0-6V (VIO).
> > Add the devicetree option ti,nwkrq-voltage-vio to set it to VIO.
> >
> > If this property is omitted the reset default, the internal reference
> > voltage, is used.
> >
> > Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> > Reviewed-by: Marc Kleine-Budde <mkl@pengutronix.de>
> > Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> > ---
> > drivers/net/can/m_can/tcan4x5x-core.c | 20 ++++++++++++++++++++
> > drivers/net/can/m_can/tcan4x5x.h | 2 ++
> > 2 files changed, 22 insertions(+)
> >
> > diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/tcan4x5x-core.c
> > index 2f73bf3abad889c222f15c39a3d43de1a1cf5fbb..7213d9894c82d079bf92f1ec62d4eebb500cdfa4 100644
> > --- a/drivers/net/can/m_can/tcan4x5x-core.c
> > +++ b/drivers/net/can/m_can/tcan4x5x-core.c
> > @@ -92,6 +92,8 @@
> > #define TCAN4X5X_MODE_STANDBY BIT(6)
> > #define TCAN4X5X_MODE_NORMAL BIT(7)
> >
> > +#define TCAN4X5X_NWKRQ_VOLTAGE_VIO BIT(19)
> > +
> > #define TCAN4X5X_DISABLE_WAKE_MSK (BIT(31) | BIT(30))
> > #define TCAN4X5X_DISABLE_INH_MSK BIT(9)
> >
> > @@ -267,6 +269,13 @@ static int tcan4x5x_init(struct m_can_classdev *cdev)
> > if (ret)
> > return ret;
> >
> > + if (tcan4x5x->nwkrq_voltage_vio) {
> > + ret = regmap_set_bits(tcan4x5x->regmap, TCAN4X5X_CONFIG,
> > + TCAN4X5X_NWKRQ_VOLTAGE_VIO);
> > + if (ret)
> > + return ret;
> > + }
> > +
> > return ret;
> > }
> >
> > @@ -318,6 +327,15 @@ static const struct tcan4x5x_version_info
> > return &tcan4x5x_versions[TCAN4X5X];
> > }
> >
> > +static void tcan4x5x_get_dt_data(struct m_can_classdev *cdev)
> > +{
> > + struct tcan4x5x_priv *tcan4x5x = cdev_to_priv(cdev);
> > + struct device_node *np = cdev->dev->of_node;
>
> Guess we can remove this line. Sorry
ACK. Will fixup here.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
On Mon, Nov 18, 2024 at 04:14:09PM +0100, Marc Kleine-Budde wrote:
> On 18.11.2024 16:05:42, Sean Nyekjaer wrote:
> > Hi Marc,
> >
> > On Thu, Nov 14, 2024 at 10:14:50AM +0100, Sean Nyekjaer wrote:
> > > The nWKRQ pin supports an output voltage of either the internal reference
> > > voltage (3.6V) or the reference voltage of
> > > the digital interface 0-6V (VIO).
> > > Add the devicetree option ti,nwkrq-voltage-vio to set it to VIO.
> > >
> > > If this property is omitted the reset default, the internal reference
> > > voltage, is used.
> > >
> > > Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> > > Reviewed-by: Marc Kleine-Budde <mkl@pengutronix.de>
> > > Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> > > ---
> > > drivers/net/can/m_can/tcan4x5x-core.c | 20 ++++++++++++++++++++
> > > drivers/net/can/m_can/tcan4x5x.h | 2 ++
> > > 2 files changed, 22 insertions(+)
> > >
> > > diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/tcan4x5x-core.c
> > > index 2f73bf3abad889c222f15c39a3d43de1a1cf5fbb..7213d9894c82d079bf92f1ec62d4eebb500cdfa4 100644
> > > --- a/drivers/net/can/m_can/tcan4x5x-core.c
> > > +++ b/drivers/net/can/m_can/tcan4x5x-core.c
> > > @@ -92,6 +92,8 @@
> > > #define TCAN4X5X_MODE_STANDBY BIT(6)
> > > #define TCAN4X5X_MODE_NORMAL BIT(7)
> > >
> > > +#define TCAN4X5X_NWKRQ_VOLTAGE_VIO BIT(19)
> > > +
> > > #define TCAN4X5X_DISABLE_WAKE_MSK (BIT(31) | BIT(30))
> > > #define TCAN4X5X_DISABLE_INH_MSK BIT(9)
> > >
> > > @@ -267,6 +269,13 @@ static int tcan4x5x_init(struct m_can_classdev *cdev)
> > > if (ret)
> > > return ret;
> > >
> > > + if (tcan4x5x->nwkrq_voltage_vio) {
> > > + ret = regmap_set_bits(tcan4x5x->regmap, TCAN4X5X_CONFIG,
> > > + TCAN4X5X_NWKRQ_VOLTAGE_VIO);
> > > + if (ret)
> > > + return ret;
> > > + }
> > > +
> > > return ret;
> > > }
> > >
> > > @@ -318,6 +327,15 @@ static const struct tcan4x5x_version_info
> > > return &tcan4x5x_versions[TCAN4X5X];
> > > }
> > >
> > > +static void tcan4x5x_get_dt_data(struct m_can_classdev *cdev)
> > > +{
> > > + struct tcan4x5x_priv *tcan4x5x = cdev_to_priv(cdev);
> > > + struct device_node *np = cdev->dev->of_node;
> >
> > Guess we can remove this line. Sorry
>
> ACK. Will fixup here.
Remenber to do the fixup :)
Sorry for the extra work
/Sean
© 2016 - 2026 Red Hat, Inc.