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 <b29396@freescale.com> In 4.14 upstream deleted flexcan_priv->pdata, add that back as well. Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>pull/10/head
parent
29dc2b4005
commit
915efcd127
|
@ -26,6 +26,7 @@
|
|||
#include <linux/can/error.h>
|
||||
#include <linux/can/led.h>
|
||||
#include <linux/can/rx-offload.h>
|
||||
#include <linux/can/platform/flexcan.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
@ -277,6 +278,7 @@ struct flexcan_priv {
|
|||
|
||||
struct clk *clk_ipg;
|
||||
struct clk *clk_per;
|
||||
struct flexcan_platform_data *pdata;
|
||||
const struct flexcan_devtype_data *devtype_data;
|
||||
struct regulator *reg_xceiver;
|
||||
};
|
||||
|
@ -358,6 +360,11 @@ static inline void flexcan_error_irq_disable(const struct flexcan_priv *priv)
|
|||
|
||||
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;
|
||||
|
||||
|
@ -366,6 +373,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;
|
||||
|
||||
|
@ -1324,6 +1336,7 @@ static int flexcan_probe(struct platform_device *pdev)
|
|||
priv->regs = regs;
|
||||
priv->clk_ipg = clk_ipg;
|
||||
priv->clk_per = clk_per;
|
||||
priv->pdata = dev_get_platdata(&pdev->dev);
|
||||
priv->devtype_data = devtype_data;
|
||||
priv->reg_xceiver = reg_xceiver;
|
||||
|
||||
|
|
|
@ -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 */
|
Loading…
Reference in New Issue