From 5cfc1e70ad0550dd5d400b7f3bdeb4d726a756d5 Mon Sep 17 00:00:00 2001 From: Dong Aisheng Date: Wed, 10 Sep 2014 16:55:17 +0800 Subject: [PATCH] MLK-10131 ENGR00286724-4 can: flexcan: add platform_data for transceiver_switch It's used for transceiver_switch. NOTE: it's newly added since it's deleted by upstream before. However, the driver is still using it, so have to add it. Signed-off-by: Dong Aisheng (cherry picked from commit 53109634188e672b807a7256afbf10db0d9a6574) --- drivers/net/can/flexcan.c | 11 +++++++++++ include/linux/can/platform/flexcan.h | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 include/linux/can/platform/flexcan.h diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 47f43bdecd51..7836cf670395 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -317,6 +318,11 @@ static inline void flexcan_write(u32 val, void __iomem *addr) static inline int flexcan_transceiver_enable(const struct flexcan_priv *priv) { + if (priv->pdata && priv->pdata->transceiver_switch) { + priv->pdata->transceiver_switch(1); + return 0; + } + if (!priv->reg_xceiver) return 0; @@ -325,6 +331,11 @@ static inline int flexcan_transceiver_enable(const struct flexcan_priv *priv) static inline int flexcan_transceiver_disable(const struct flexcan_priv *priv) { + if (priv->pdata && priv->pdata->transceiver_switch) { + priv->pdata->transceiver_switch(0); + return 0; + } + if (!priv->reg_xceiver) return 0; diff --git a/include/linux/can/platform/flexcan.h b/include/linux/can/platform/flexcan.h new file mode 100644 index 000000000000..fdfe76f16ea7 --- /dev/null +++ b/include/linux/can/platform/flexcan.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2014 Freescale Semiconductor, Inc. + * + * This file is released under the GPLv2 + * + */ + +#ifndef __CAN_PLATFORM_FLEXCAN_H +#define __CAN_PLATFORM_FLEXCAN_H + +/** + * struct flexcan_platform_data - flex CAN controller platform data + * @transceiver_enable: - called to power on/off the transceiver + * + */ +struct flexcan_platform_data { + void (*transceiver_switch)(int enable); +}; + +#endif /* __CAN_PLATFORM_FLEXCAN_H */ -- 2.17.1