diff options
Diffstat (limited to 'include/linux/can')
| -rw-r--r-- | include/linux/can/core.h | 2 | ||||
| -rw-r--r-- | include/linux/can/dev.h | 20 | ||||
| -rw-r--r-- | include/linux/can/platform/mcp251x.h | 36 | ||||
| -rw-r--r-- | include/linux/can/platform/ti_hecc.h | 40 |
4 files changed, 88 insertions, 10 deletions
diff --git a/include/linux/can/core.h b/include/linux/can/core.h index 25085cbadcfc..6c507bea275f 100644 --- a/include/linux/can/core.h +++ b/include/linux/can/core.h | |||
| @@ -32,14 +32,12 @@ | |||
| 32 | * struct can_proto - CAN protocol structure | 32 | * struct can_proto - CAN protocol structure |
| 33 | * @type: type argument in socket() syscall, e.g. SOCK_DGRAM. | 33 | * @type: type argument in socket() syscall, e.g. SOCK_DGRAM. |
| 34 | * @protocol: protocol number in socket() syscall. | 34 | * @protocol: protocol number in socket() syscall. |
| 35 | * @capability: capability needed to open the socket, or -1 for no restriction. | ||
| 36 | * @ops: pointer to struct proto_ops for sock->ops. | 35 | * @ops: pointer to struct proto_ops for sock->ops. |
| 37 | * @prot: pointer to struct proto structure. | 36 | * @prot: pointer to struct proto structure. |
| 38 | */ | 37 | */ |
| 39 | struct can_proto { | 38 | struct can_proto { |
| 40 | int type; | 39 | int type; |
| 41 | int protocol; | 40 | int protocol; |
| 42 | int capability; | ||
| 43 | struct proto_ops *ops; | 41 | struct proto_ops *ops; |
| 44 | struct proto *prot; | 42 | struct proto *prot; |
| 45 | }; | 43 | }; |
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 5824b20b5fcb..1ed2a5cc03f5 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h | |||
| @@ -29,8 +29,6 @@ enum can_mode { | |||
| 29 | /* | 29 | /* |
| 30 | * CAN common private data | 30 | * CAN common private data |
| 31 | */ | 31 | */ |
| 32 | #define CAN_ECHO_SKB_MAX 4 | ||
| 33 | |||
| 34 | struct can_priv { | 32 | struct can_priv { |
| 35 | struct can_device_stats can_stats; | 33 | struct can_device_stats can_stats; |
| 36 | 34 | ||
| @@ -44,15 +42,16 @@ struct can_priv { | |||
| 44 | int restart_ms; | 42 | int restart_ms; |
| 45 | struct timer_list restart_timer; | 43 | struct timer_list restart_timer; |
| 46 | 44 | ||
| 47 | struct sk_buff *echo_skb[CAN_ECHO_SKB_MAX]; | ||
| 48 | |||
| 49 | int (*do_set_bittiming)(struct net_device *dev); | 45 | int (*do_set_bittiming)(struct net_device *dev); |
| 50 | int (*do_set_mode)(struct net_device *dev, enum can_mode mode); | 46 | int (*do_set_mode)(struct net_device *dev, enum can_mode mode); |
| 51 | int (*do_get_state)(const struct net_device *dev, | 47 | int (*do_get_state)(const struct net_device *dev, |
| 52 | enum can_state *state); | 48 | enum can_state *state); |
| 49 | |||
| 50 | unsigned int echo_skb_max; | ||
| 51 | struct sk_buff **echo_skb; | ||
| 53 | }; | 52 | }; |
| 54 | 53 | ||
| 55 | struct net_device *alloc_candev(int sizeof_priv); | 54 | struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max); |
| 56 | void free_candev(struct net_device *dev); | 55 | void free_candev(struct net_device *dev); |
| 57 | 56 | ||
| 58 | int open_candev(struct net_device *dev); | 57 | int open_candev(struct net_device *dev); |
| @@ -64,8 +63,13 @@ void unregister_candev(struct net_device *dev); | |||
| 64 | int can_restart_now(struct net_device *dev); | 63 | int can_restart_now(struct net_device *dev); |
| 65 | void can_bus_off(struct net_device *dev); | 64 | void can_bus_off(struct net_device *dev); |
| 66 | 65 | ||
| 67 | void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, int idx); | 66 | void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, |
| 68 | void can_get_echo_skb(struct net_device *dev, int idx); | 67 | unsigned int idx); |
| 69 | void can_free_echo_skb(struct net_device *dev, int idx); | 68 | void can_get_echo_skb(struct net_device *dev, unsigned int idx); |
| 69 | void can_free_echo_skb(struct net_device *dev, unsigned int idx); | ||
| 70 | |||
| 71 | struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf); | ||
| 72 | struct sk_buff *alloc_can_err_skb(struct net_device *dev, | ||
| 73 | struct can_frame **cf); | ||
| 70 | 74 | ||
| 71 | #endif /* CAN_DEV_H */ | 75 | #endif /* CAN_DEV_H */ |
diff --git a/include/linux/can/platform/mcp251x.h b/include/linux/can/platform/mcp251x.h new file mode 100644 index 000000000000..1448177d86d5 --- /dev/null +++ b/include/linux/can/platform/mcp251x.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | #ifndef __CAN_PLATFORM_MCP251X_H__ | ||
| 2 | #define __CAN_PLATFORM_MCP251X_H__ | ||
| 3 | |||
| 4 | /* | ||
| 5 | * | ||
| 6 | * CAN bus driver for Microchip 251x CAN Controller with SPI Interface | ||
| 7 | * | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include <linux/spi/spi.h> | ||
| 11 | |||
| 12 | /** | ||
| 13 | * struct mcp251x_platform_data - MCP251X SPI CAN controller platform data | ||
| 14 | * @oscillator_frequency: - oscillator frequency in Hz | ||
| 15 | * @model: - actual type of chip | ||
| 16 | * @board_specific_setup: - called before probing the chip (power,reset) | ||
| 17 | * @transceiver_enable: - called to power on/off the transceiver | ||
| 18 | * @power_enable: - called to power on/off the mcp *and* the | ||
| 19 | * transceiver | ||
| 20 | * | ||
| 21 | * Please note that you should define power_enable or transceiver_enable or | ||
| 22 | * none of them. Defining both of them is no use. | ||
| 23 | * | ||
| 24 | */ | ||
| 25 | |||
| 26 | struct mcp251x_platform_data { | ||
| 27 | unsigned long oscillator_frequency; | ||
| 28 | int model; | ||
| 29 | #define CAN_MCP251X_MCP2510 0 | ||
| 30 | #define CAN_MCP251X_MCP2515 1 | ||
| 31 | int (*board_specific_setup)(struct spi_device *spi); | ||
| 32 | int (*transceiver_enable)(int enable); | ||
| 33 | int (*power_enable) (int enable); | ||
| 34 | }; | ||
| 35 | |||
| 36 | #endif /* __CAN_PLATFORM_MCP251X_H__ */ | ||
diff --git a/include/linux/can/platform/ti_hecc.h b/include/linux/can/platform/ti_hecc.h new file mode 100644 index 000000000000..4688c7bb1bd1 --- /dev/null +++ b/include/linux/can/platform/ti_hecc.h | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | /* | ||
| 2 | * TI HECC (High End CAN Controller) driver platform header | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU General Public License as | ||
| 8 | * published by the Free Software Foundation version 2. | ||
| 9 | * | ||
| 10 | * This program is distributed as is WITHOUT ANY WARRANTY of any | ||
| 11 | * kind, whether express or implied; without even the implied warranty | ||
| 12 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | |||
| 17 | /** | ||
| 18 | * struct hecc_platform_data - HECC Platform Data | ||
| 19 | * | ||
| 20 | * @scc_hecc_offset: mostly 0 - should really never change | ||
| 21 | * @scc_ram_offset: SCC RAM offset | ||
| 22 | * @hecc_ram_offset: HECC RAM offset | ||
| 23 | * @mbx_offset: Mailbox RAM offset | ||
| 24 | * @int_line: Interrupt line to use - 0 or 1 | ||
| 25 | * @version: version for future use | ||
| 26 | * | ||
| 27 | * Platform data structure to get all platform specific settings. | ||
| 28 | * this structure also accounts the fact that the IP may have different | ||
| 29 | * RAM and mailbox offsets for different SOC's | ||
| 30 | */ | ||
| 31 | struct ti_hecc_platform_data { | ||
| 32 | u32 scc_hecc_offset; | ||
| 33 | u32 scc_ram_offset; | ||
| 34 | u32 hecc_ram_offset; | ||
| 35 | u32 mbx_offset; | ||
| 36 | u32 int_line; | ||
| 37 | u32 version; | ||
| 38 | }; | ||
| 39 | |||
| 40 | |||
