Commit 5a1f8f5e authored by Dan Murphy's avatar Dan Murphy Committed by Marc Kleine-Budde

can: tcan4x5x: tcan4x5x_parse_config(): Disable the INH pin device-state GPIO is unavailable

If the device state GPIO is not connected to the host then disable the
INH output from the TCAN device per section 8.3.5 of the data sheet.
Signed-off-by: default avatarDan Murphy <dmurphy@ti.com>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent c3083124
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
#define TCAN4X5X_MODE_NORMAL BIT(7) #define TCAN4X5X_MODE_NORMAL BIT(7)
#define TCAN4X5X_DISABLE_WAKE_MSK (BIT(31) | BIT(30)) #define TCAN4X5X_DISABLE_WAKE_MSK (BIT(31) | BIT(30))
#define TCAN4X5X_DISABLE_INH_MSK BIT(9)
#define TCAN4X5X_SW_RESET BIT(2) #define TCAN4X5X_SW_RESET BIT(2)
...@@ -370,6 +371,14 @@ static int tcan4x5x_disable_wake(struct m_can_classdev *cdev) ...@@ -370,6 +371,14 @@ static int tcan4x5x_disable_wake(struct m_can_classdev *cdev)
TCAN4X5X_DISABLE_WAKE_MSK, 0x00); TCAN4X5X_DISABLE_WAKE_MSK, 0x00);
} }
static int tcan4x5x_disable_state(struct m_can_classdev *cdev)
{
struct tcan4x5x_priv *tcan4x5x = cdev->device_data;
return regmap_update_bits(tcan4x5x->regmap, TCAN4X5X_CONFIG,
TCAN4X5X_DISABLE_INH_MSK, 0x01);
}
static int tcan4x5x_parse_config(struct m_can_classdev *cdev) static int tcan4x5x_parse_config(struct m_can_classdev *cdev)
{ {
struct tcan4x5x_priv *tcan4x5x = cdev->device_data; struct tcan4x5x_priv *tcan4x5x = cdev->device_data;
...@@ -396,8 +405,10 @@ static int tcan4x5x_parse_config(struct m_can_classdev *cdev) ...@@ -396,8 +405,10 @@ static int tcan4x5x_parse_config(struct m_can_classdev *cdev)
tcan4x5x->device_state_gpio = devm_gpiod_get_optional(cdev->dev, tcan4x5x->device_state_gpio = devm_gpiod_get_optional(cdev->dev,
"device-state", "device-state",
GPIOD_IN); GPIOD_IN);
if (IS_ERR(tcan4x5x->device_state_gpio)) if (IS_ERR(tcan4x5x->device_state_gpio)) {
tcan4x5x->device_state_gpio = NULL; tcan4x5x->device_state_gpio = NULL;
tcan4x5x_disable_state(cdev);
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment