Skip to content

Commit 36131b7

Browse files
sknseanmarckleinebudde
authored andcommitted
can: tcan4x5x: add option for selecting nWKRQ voltage
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 <[email protected]> Reviewed-by: Marc Kleine-Budde <[email protected]> Reviewed-by: Vincent Mailhol <[email protected]> Link: https://patch.msgid.link/[email protected] [mkl: remove unused variable in tcan4x5x_get_dt_data()] Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 6495567 commit 36131b7

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

drivers/net/can/m_can/tcan4x5x-core.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@
9292
#define TCAN4X5X_MODE_STANDBY BIT(6)
9393
#define TCAN4X5X_MODE_NORMAL BIT(7)
9494

95+
#define TCAN4X5X_NWKRQ_VOLTAGE_VIO BIT(19)
96+
9597
#define TCAN4X5X_DISABLE_WAKE_MSK (BIT(31) | BIT(30))
9698
#define TCAN4X5X_DISABLE_INH_MSK BIT(9)
9799

@@ -267,6 +269,13 @@ static int tcan4x5x_init(struct m_can_classdev *cdev)
267269
if (ret)
268270
return ret;
269271

272+
if (tcan4x5x->nwkrq_voltage_vio) {
273+
ret = regmap_set_bits(tcan4x5x->regmap, TCAN4X5X_CONFIG,
274+
TCAN4X5X_NWKRQ_VOLTAGE_VIO);
275+
if (ret)
276+
return ret;
277+
}
278+
270279
return ret;
271280
}
272281

@@ -318,6 +327,14 @@ static const struct tcan4x5x_version_info
318327
return &tcan4x5x_versions[TCAN4X5X];
319328
}
320329

330+
static void tcan4x5x_get_dt_data(struct m_can_classdev *cdev)
331+
{
332+
struct tcan4x5x_priv *tcan4x5x = cdev_to_priv(cdev);
333+
334+
tcan4x5x->nwkrq_voltage_vio =
335+
of_property_read_bool(cdev->dev->of_node, "ti,nwkrq-voltage-vio");
336+
}
337+
321338
static int tcan4x5x_get_gpios(struct m_can_classdev *cdev,
322339
const struct tcan4x5x_version_info *version_info)
323340
{
@@ -453,6 +470,8 @@ static int tcan4x5x_can_probe(struct spi_device *spi)
453470
goto out_power;
454471
}
455472

473+
tcan4x5x_get_dt_data(mcan_class);
474+
456475
tcan4x5x_check_wake(priv);
457476

458477
ret = tcan4x5x_write_tcan_reg(mcan_class, TCAN4X5X_INT_EN, 0);

drivers/net/can/m_can/tcan4x5x.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ struct tcan4x5x_priv {
4242

4343
struct tcan4x5x_map_buf map_buf_rx;
4444
struct tcan4x5x_map_buf map_buf_tx;
45+
46+
bool nwkrq_voltage_vio;
4547
};
4648

4749
static inline void

0 commit comments

Comments
 (0)