Lines Matching full:can

3  * CAN driver for EMS Dr. Thomas Wuensche CPC-USB/ARM7
14 #include <linux/can.h>
15 #include <linux/can/dev.h>
16 #include <linux/can/error.h>
19 MODULE_DESCRIPTION("CAN driver for EMS Dr. Thomas Wuensche CAN/USB interfaces");
33 #define CPC_MSG_TYPE_CAN_FRAME 1 /* CAN data frame */
34 #define CPC_MSG_TYPE_RTR_FRAME 8 /* CAN remote frame */
35 #define CPC_MSG_TYPE_CAN_PARAMS 12 /* Actual CAN parameters */
36 #define CPC_MSG_TYPE_CAN_STATE 14 /* CAN state message */
37 #define CPC_MSG_TYPE_EXT_CAN_FRAME 16 /* Extended CAN data frame */
46 #define CPC_CMD_TYPE_CAN_FRAME 1 /* CAN data frame */
48 #define CPC_CMD_TYPE_CAN_PARAMS 6 /* set CAN parameters */
49 #define CPC_CMD_TYPE_RTR_FRAME 13 /* CAN remote frame */
50 #define CPC_CMD_TYPE_CAN_STATE 14 /* CAN state message */
51 #define CPC_CMD_TYPE_EXT_CAN_FRAME 15 /* Extended CAN data frame */
52 #define CPC_CMD_TYPE_EXT_RTR_FRAME 16 /* Extended CAN remote frame */
53 #define CPC_CMD_TYPE_CAN_EXIT 200 /* exit the CAN */
55 #define CPC_CMD_TYPE_INQ_ERR_COUNTER 25 /* request the CAN error counters */
59 #define CPC_CC_TYPE_SJA1000 2 /* Philips basic CAN controller */
69 * If the CAN controller lost a message we indicate it with the highest bit
83 /* Mode register NXP LPC2119/SJA1000 CAN Controller */
87 /* ECC register NXP LPC2119/SJA1000 CAN Controller */
103 * The device actually uses a 16MHz clock to generate the CAN clock
113 * CAN-Message representation in a CPC_MSG. Message object type is
123 /* Representation of the CAN parameters for the SJA1000 controller */
139 /* CAN params message representation */
143 /* Will support M16C CAN controller in the future */
160 /* SJA1000 CAN errors (compatible to NXP LPC2119) */
167 /* structure for CAN error conditions */
183 * the values of the CAN controllers TX and RX error counter.
237 struct can_priv can; /* must be the first member */ member
343 dev->can.state = CAN_STATE_BUS_OFF; in ems_usb_rx_err()
347 dev->can.can_stats.bus_off++; in ems_usb_rx_err()
350 dev->can.state = CAN_STATE_ERROR_WARNING; in ems_usb_rx_err()
351 dev->can.can_stats.error_warning++; in ems_usb_rx_err()
353 dev->can.state = CAN_STATE_ERROR_ACTIVE; in ems_usb_rx_err()
354 dev->can.can_stats.error_passive++; in ems_usb_rx_err()
362 dev->can.can_stats.bus_error++; in ems_usb_rx_err()
392 if (skb && (dev->can.state == CAN_STATE_ERROR_WARNING || in ems_usb_rx_err()
393 dev->can.state == CAN_STATE_ERROR_PASSIVE)) { in ems_usb_rx_err()
452 /* Process CAN state changes */ in ems_usb_read_bulk_callback()
557 * Change CAN controllers' mode register
567 * Send a CPC_Control command to change behaviour when interface receives a CAN
568 * message, bus error or CAN state changed notifications.
669 /* CPC-USB will transfer CAN state changes to host */ in ems_usb_start()
683 dev->can.state = CAN_STATE_ERROR_ACTIVE; in ems_usb_start()
875 /* Set CAN controller to reset mode */ in ems_usb_close()
930 struct can_bittiming *bt = &dev->can.bittiming; in ems_usb_set_bittiming()
936 if (dev->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) in ems_usb_set_bittiming()
998 dev->can.state = CAN_STATE_STOPPED; in ems_usb_probe()
999 dev->can.clock.freq = EMS_USB_ARM7_CLOCK; in ems_usb_probe()
1000 dev->can.bittiming_const = &ems_usb_bittiming_const; in ems_usb_probe()
1001 dev->can.do_set_bittiming = ems_usb_set_bittiming; in ems_usb_probe()
1002 dev->can.do_set_mode = ems_usb_set_mode; in ems_usb_probe()
1003 dev->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES; in ems_usb_probe()
1045 netdev_err(netdev, "couldn't register CAN device: %d\n", err); in ems_usb_probe()