summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDong Aisheng <aisheng.dong@nxp.com>2017-12-15 18:38:15 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commit6d6a3dc6c369d061c667652e3889f618f82494fe (patch)
treea9b7bac3879e4c33d71b6e414570c2e8660837a2
parent1c949dd2d6863cd94987c3df1c27153e6a54d632 (diff)
MLK-16879-2 can: flexcan: allow user to disable can fd mode from device tree
Normally CAN FD capable device must work on FD mode as it has different statically claimed bittiming capability. This patch provides users to disable CAN FD capability if users want to only work at normal mode. Acked-by: Jason Liu <jason.hui.liu@nxp.com> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
-rw-r--r--Documentation/devicetree/bindings/net/can/fsl-flexcan.txt1
-rw-r--r--drivers/net/can/flexcan.c17
2 files changed, 11 insertions, 7 deletions
diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
index 00ff7d6c9f64..797e5ed5e413 100644
--- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
+++ b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
@@ -27,6 +27,7 @@ Optional properties:
- trx_en_gpio : enable gpio
- trx_stby_gpio : standby gpio
- trx_nerr_gpio : NERR gpio
+- disable-fd-mode : disable CAN FD mode support. Valid since i.MX8 series.
Example:
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 90b6c69ef770..278f53c24b71 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -1518,6 +1518,7 @@ static int flexcan_probe(struct platform_device *pdev)
{
const struct of_device_id *of_id;
const struct flexcan_devtype_data *devtype_data;
+ struct device_node *np = pdev->dev.of_node;
struct net_device *dev;
struct flexcan_priv *priv;
struct regulator *reg_xceiver;
@@ -1613,13 +1614,15 @@ static int flexcan_probe(struct platform_device *pdev)
}
if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SUPPORT_CANFD) {
- priv->can.ctrlmode_supported |= CAN_CTRLMODE_FD;
- priv->can.bittiming_const = &flexcan_fd_bittiming_const;
- if (!(priv->devtype_data->quirks &
- FLEXCAN_QUIRK_DISABLE_RX_FIFO)) {
- dev_err(&pdev->dev, "canfd mode can't work on fifo mode\n");
- err = -EINVAL;
- goto failed_register;
+ if (!(of_find_property(np, "disable-fd-mode", NULL))) {
+ priv->can.ctrlmode_supported |= CAN_CTRLMODE_FD;
+ priv->can.bittiming_const = &flexcan_fd_bittiming_const;
+ if (!(priv->devtype_data->quirks &
+ FLEXCAN_QUIRK_DISABLE_RX_FIFO)) {
+ dev_err(&pdev->dev, "canfd mode can't work on fifo mode\n");
+ err = -EINVAL;
+ goto failed_register;
+ }
}
}