Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sriramakrishnan and committed by
David S. Miller
773c3e75 738b0343

+22 -3
+16 -1
drivers/net/can/ti_hecc.c
··· 28 28 * .mbx_offset = 0x2000, 29 29 * .int_line = 0, 30 30 * .revision = 1, 31 + * .transceiver_switch = hecc_phy_control, 31 32 * }; 32 33 * 33 - * Please see include/can/platform/ti_hecc.h for description of above fields 34 + * Please see include/linux/can/platform/ti_hecc.h for description of 35 + * above fields. 34 36 * 35 37 */ 36 38 ··· 222 220 u32 tx_head; 223 221 u32 tx_tail; 224 222 u32 rx_next; 223 + void (*transceiver_switch)(int); 225 224 }; 226 225 227 226 static inline int get_tx_head_mb(struct ti_hecc_priv *priv) ··· 318 315 dev_info(priv->ndev->dev.parent, "setting CANBTC=%#x\n", can_btc); 319 316 320 317 return 0; 318 + } 319 + 320 + static void ti_hecc_transceiver_switch(const struct ti_hecc_priv *priv, 321 + int on) 322 + { 323 + if (priv->transceiver_switch) 324 + priv->transceiver_switch(on); 321 325 } 322 326 323 327 static void ti_hecc_reset(struct net_device *ndev) ··· 828 818 return err; 829 819 } 830 820 821 + ti_hecc_transceiver_switch(priv, 1); 822 + 831 823 /* Open common can device */ 832 824 err = open_candev(ndev); 833 825 if (err) { 834 826 dev_err(ndev->dev.parent, "open_candev() failed %d\n", err); 827 + ti_hecc_transceiver_switch(priv, 0); 835 828 free_irq(ndev->irq, ndev); 836 829 return err; 837 830 } ··· 855 842 ti_hecc_stop(ndev); 856 843 free_irq(ndev->irq, ndev); 857 844 close_candev(ndev); 845 + ti_hecc_transceiver_switch(priv, 0); 858 846 859 847 return 0; 860 848 } ··· 917 903 priv->hecc_ram_offset = pdata->hecc_ram_offset; 918 904 priv->mbx_offset = pdata->mbx_offset; 919 905 priv->int_line = pdata->int_line; 906 + priv->transceiver_switch = pdata->transceiver_switch; 920 907 921 908 priv->can.bittiming_const = &ti_hecc_bittiming_const; 922 909 priv->can.do_set_mode = ti_hecc_do_set_mode;
+6 -2
include/linux/can/platform/ti_hecc.h
··· 1 + #ifndef __CAN_PLATFORM_TI_HECC_H__ 2 + #define __CAN_PLATFORM_TI_HECC_H__ 3 + 1 4 /* 2 5 * TI HECC (High End CAN Controller) driver platform header 3 6 * ··· 26 23 * @mbx_offset: Mailbox RAM offset 27 24 * @int_line: Interrupt line to use - 0 or 1 28 25 * @version: version for future use 26 + * @transceiver_switch: platform specific callback fn for transceiver control 29 27 * 30 28 * Platform data structure to get all platform specific settings. 31 29 * this structure also accounts the fact that the IP may have different ··· 39 35 u32 mbx_offset; 40 36 u32 int_line; 41 37 u32 version; 38 + void (*transceiver_switch) (int); 42 39 }; 43 - 44 - 40 + #endif