Merge patch series "can: tcan4x5x: add option for selecting nWKRQ voltage"

Sean Nyekjaer <sean@geanix.com> says:

This series adds support for setting the nWKRQ voltage.

Link: https://patch.msgid.link/20241114-tcan-wkrqv-v5-0-a2d50833ed71@geanix.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
Marc Kleine-Budde 2024-12-23 12:38:55 +01:00
commit ad79f18ba4
3 changed files with 29 additions and 0 deletions

View File

@ -110,6 +110,13 @@ properties:
Must be half or less of "clocks" frequency.
maximum: 18000000
ti,nwkrq-voltage-vio:
type: boolean
description:
nWKRQ Pin GPO buffer voltage configuration.
Set nWKRQ to use VIO voltage rail.
When not set nWKRQ will use internal voltage rail.
wakeup-source:
$ref: /schemas/types.yaml#/definitions/flag
description:
@ -163,6 +170,7 @@ examples:
device-state-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>;
device-wake-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>;
reset-gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>;
ti,nwkrq-voltage-vio;
wakeup-source;
};
};

View File

@ -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,14 @@ 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);
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 +470,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);

View File

@ -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