Skip to content

Commit ad79f18

Browse files
Merge patch series "can: tcan4x5x: add option for selecting nWKRQ voltage"
Sean Nyekjaer <[email protected]> says: This series adds support for setting the nWKRQ voltage. Link: https://patch.msgid.link/[email protected] Signed-off-by: Marc Kleine-Budde <[email protected]>
2 parents 7919575 + 36131b7 commit ad79f18

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

Documentation/devicetree/bindings/net/can/ti,tcan4x5x.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ properties:
110110
Must be half or less of "clocks" frequency.
111111
maximum: 18000000
112112

113+
ti,nwkrq-voltage-vio:
114+
type: boolean
115+
description:
116+
nWKRQ Pin GPO buffer voltage configuration.
117+
Set nWKRQ to use VIO voltage rail.
118+
When not set nWKRQ will use internal voltage rail.
119+
113120
wakeup-source:
114121
$ref: /schemas/types.yaml#/definitions/flag
115122
description:
@@ -163,6 +170,7 @@ examples:
163170
device-state-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>;
164171
device-wake-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
165172
reset-gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>;
173+
ti,nwkrq-voltage-vio;
166174
wakeup-source;
167175
};
168176
};

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)