]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ENGR00286724-4 can: flexcan: add platform_data for transceiver_switch
authorDong Aisheng <b29396@freescale.com>
Wed, 10 Sep 2014 08:55:17 +0000 (16:55 +0800)
committerNitin Garg <nitin.garg@freescale.com>
Fri, 16 Jan 2015 03:17:29 +0000 (21:17 -0600)
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 <b29396@freescale.com>
drivers/net/can/flexcan.c
include/linux/can/platform/flexcan.h [new file with mode: 0644]

index 61376abdab395cd941f9a118c46e9912e17f4452..855ef8b32a3a5bb37bd184f674534f66175f9c10 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/can/dev.h>
 #include <linux/can/error.h>
 #include <linux/can/led.h>
+#include <linux/can/platform/flexcan.h>
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/if_arp.h>
@@ -266,6 +267,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;
 
@@ -274,6 +280,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 (file)
index 0000000..fdfe76f
--- /dev/null
@@ -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 */