mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-10 02:58:04 +07:00
can: ti hecc module : add platform specific initialization callback.
CAN module on AM3517 requires programming of IO expander as part of init sequence - to enable CAN PHY. Added platform specific callback to handle phy control(switch on /off). Signed-off-by: Sriramakrishnan <srk@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
738b0343e7
commit
773c3e75d1
@ -28,9 +28,11 @@
|
|||||||
* .mbx_offset = 0x2000,
|
* .mbx_offset = 0x2000,
|
||||||
* .int_line = 0,
|
* .int_line = 0,
|
||||||
* .revision = 1,
|
* .revision = 1,
|
||||||
|
* .transceiver_switch = hecc_phy_control,
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* Please see include/can/platform/ti_hecc.h for description of above fields
|
* Please see include/linux/can/platform/ti_hecc.h for description of
|
||||||
|
* above fields.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -220,6 +222,7 @@ struct ti_hecc_priv {
|
|||||||
u32 tx_head;
|
u32 tx_head;
|
||||||
u32 tx_tail;
|
u32 tx_tail;
|
||||||
u32 rx_next;
|
u32 rx_next;
|
||||||
|
void (*transceiver_switch)(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline int get_tx_head_mb(struct ti_hecc_priv *priv)
|
static inline int get_tx_head_mb(struct ti_hecc_priv *priv)
|
||||||
@ -317,6 +320,13 @@ static int ti_hecc_set_btc(struct ti_hecc_priv *priv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ti_hecc_transceiver_switch(const struct ti_hecc_priv *priv,
|
||||||
|
int on)
|
||||||
|
{
|
||||||
|
if (priv->transceiver_switch)
|
||||||
|
priv->transceiver_switch(on);
|
||||||
|
}
|
||||||
|
|
||||||
static void ti_hecc_reset(struct net_device *ndev)
|
static void ti_hecc_reset(struct net_device *ndev)
|
||||||
{
|
{
|
||||||
u32 cnt;
|
u32 cnt;
|
||||||
@ -818,10 +828,13 @@ static int ti_hecc_open(struct net_device *ndev)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ti_hecc_transceiver_switch(priv, 1);
|
||||||
|
|
||||||
/* Open common can device */
|
/* Open common can device */
|
||||||
err = open_candev(ndev);
|
err = open_candev(ndev);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(ndev->dev.parent, "open_candev() failed %d\n", err);
|
dev_err(ndev->dev.parent, "open_candev() failed %d\n", err);
|
||||||
|
ti_hecc_transceiver_switch(priv, 0);
|
||||||
free_irq(ndev->irq, ndev);
|
free_irq(ndev->irq, ndev);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -842,6 +855,7 @@ static int ti_hecc_close(struct net_device *ndev)
|
|||||||
ti_hecc_stop(ndev);
|
ti_hecc_stop(ndev);
|
||||||
free_irq(ndev->irq, ndev);
|
free_irq(ndev->irq, ndev);
|
||||||
close_candev(ndev);
|
close_candev(ndev);
|
||||||
|
ti_hecc_transceiver_switch(priv, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -903,6 +917,7 @@ static int ti_hecc_probe(struct platform_device *pdev)
|
|||||||
priv->hecc_ram_offset = pdata->hecc_ram_offset;
|
priv->hecc_ram_offset = pdata->hecc_ram_offset;
|
||||||
priv->mbx_offset = pdata->mbx_offset;
|
priv->mbx_offset = pdata->mbx_offset;
|
||||||
priv->int_line = pdata->int_line;
|
priv->int_line = pdata->int_line;
|
||||||
|
priv->transceiver_switch = pdata->transceiver_switch;
|
||||||
|
|
||||||
priv->can.bittiming_const = &ti_hecc_bittiming_const;
|
priv->can.bittiming_const = &ti_hecc_bittiming_const;
|
||||||
priv->can.do_set_mode = ti_hecc_do_set_mode;
|
priv->can.do_set_mode = ti_hecc_do_set_mode;
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#ifndef __CAN_PLATFORM_TI_HECC_H__
|
||||||
|
#define __CAN_PLATFORM_TI_HECC_H__
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TI HECC (High End CAN Controller) driver platform header
|
* TI HECC (High End CAN Controller) driver platform header
|
||||||
*
|
*
|
||||||
@ -23,6 +26,7 @@
|
|||||||
* @mbx_offset: Mailbox RAM offset
|
* @mbx_offset: Mailbox RAM offset
|
||||||
* @int_line: Interrupt line to use - 0 or 1
|
* @int_line: Interrupt line to use - 0 or 1
|
||||||
* @version: version for future use
|
* @version: version for future use
|
||||||
|
* @transceiver_switch: platform specific callback fn for transceiver control
|
||||||
*
|
*
|
||||||
* Platform data structure to get all platform specific settings.
|
* Platform data structure to get all platform specific settings.
|
||||||
* this structure also accounts the fact that the IP may have different
|
* this structure also accounts the fact that the IP may have different
|
||||||
@ -35,6 +39,6 @@ struct ti_hecc_platform_data {
|
|||||||
u32 mbx_offset;
|
u32 mbx_offset;
|
||||||
u32 int_line;
|
u32 int_line;
|
||||||
u32 version;
|
u32 version;
|
||||||
|
void (*transceiver_switch) (int);
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user