diff options
author | Stephane Grosjean <s.grosjean@peak-system.com> | 2015-01-23 05:31:23 -0500 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2015-01-28 08:47:06 -0500 |
commit | 1114be1e5ca43d465e2da95a2118672f7d4110fb (patch) | |
tree | 112cdda7f6f9578c381ae67f6b4950ef32c26e54 /drivers/net/can | |
parent | 2b0861e8cb51a6ace26da466d04eb5d535263cd4 (diff) |
can: peak_usb: export pcan_usb_pro functions
Add support for the following new PEAK-System technik CANFD USB adapters:
PCAN-USB FD single CANFD channel USB adapter
PCAN-USB Pro FD dual CANFD channels USB adapter
The communication protocol has been developed using some mechanisms that
did exist in the PCAN-USB Pro, thus, this patch also changes some
previously static functions and data into global ones.
Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/usb/peak_usb/pcan_usb_pro.c | 16 | ||||
-rw-r--r-- | drivers/net/can/usb/peak_usb/pcan_usb_pro.h | 13 |
2 files changed, 17 insertions, 12 deletions
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c index 03f517160a67..dec51717635e 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c | |||
@@ -27,14 +27,6 @@ | |||
27 | 27 | ||
28 | MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB Pro adapter"); | 28 | MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB Pro adapter"); |
29 | 29 | ||
30 | /* PCAN-USB Pro Endpoints */ | ||
31 | #define PCAN_USBPRO_EP_CMDOUT 1 | ||
32 | #define PCAN_USBPRO_EP_CMDIN (PCAN_USBPRO_EP_CMDOUT | USB_DIR_IN) | ||
33 | #define PCAN_USBPRO_EP_MSGOUT_0 2 | ||
34 | #define PCAN_USBPRO_EP_MSGIN (PCAN_USBPRO_EP_MSGOUT_0 | USB_DIR_IN) | ||
35 | #define PCAN_USBPRO_EP_MSGOUT_1 3 | ||
36 | #define PCAN_USBPRO_EP_UNUSED (PCAN_USBPRO_EP_MSGOUT_1 | USB_DIR_IN) | ||
37 | |||
38 | #define PCAN_USBPRO_CHANNEL_COUNT 2 | 30 | #define PCAN_USBPRO_CHANNEL_COUNT 2 |
39 | 31 | ||
40 | /* PCAN-USB Pro adapter internal clock (MHz) */ | 32 | /* PCAN-USB Pro adapter internal clock (MHz) */ |
@@ -322,8 +314,8 @@ static int pcan_usb_pro_wait_rsp(struct peak_usb_device *dev, | |||
322 | return (i >= PCAN_USBPRO_RSP_SUBMIT_MAX) ? -ERANGE : err; | 314 | return (i >= PCAN_USBPRO_RSP_SUBMIT_MAX) ? -ERANGE : err; |
323 | } | 315 | } |
324 | 316 | ||
325 | static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id, | 317 | int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id, |
326 | int req_value, void *req_addr, int req_size) | 318 | int req_value, void *req_addr, int req_size) |
327 | { | 319 | { |
328 | int err; | 320 | int err; |
329 | u8 req_type; | 321 | u8 req_type; |
@@ -475,7 +467,7 @@ static int pcan_usb_pro_set_bittiming(struct peak_usb_device *dev, | |||
475 | return pcan_usb_pro_set_bitrate(dev, ccbt); | 467 | return pcan_usb_pro_set_bitrate(dev, ccbt); |
476 | } | 468 | } |
477 | 469 | ||
478 | static void pcan_usb_pro_restart_complete(struct urb *urb) | 470 | void pcan_usb_pro_restart_complete(struct urb *urb) |
479 | { | 471 | { |
480 | /* can delete usb resources */ | 472 | /* can delete usb resources */ |
481 | peak_usb_async_complete(urb); | 473 | peak_usb_async_complete(urb); |
@@ -978,7 +970,7 @@ static void pcan_usb_pro_free(struct peak_usb_device *dev) | |||
978 | /* | 970 | /* |
979 | * probe function for new PCAN-USB Pro usb interface | 971 | * probe function for new PCAN-USB Pro usb interface |
980 | */ | 972 | */ |
981 | static int pcan_usb_pro_probe(struct usb_interface *intf) | 973 | int pcan_usb_pro_probe(struct usb_interface *intf) |
982 | { | 974 | { |
983 | struct usb_host_interface *if_desc; | 975 | struct usb_host_interface *if_desc; |
984 | int i; | 976 | int i; |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.h b/drivers/net/can/usb/peak_usb/pcan_usb_pro.h index 837cee267132..a62f7ab8980f 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.h +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.h | |||
@@ -27,6 +27,14 @@ | |||
27 | #define PCAN_USBPRO_INFO_BL 0 | 27 | #define PCAN_USBPRO_INFO_BL 0 |
28 | #define PCAN_USBPRO_INFO_FW 1 | 28 | #define PCAN_USBPRO_INFO_FW 1 |
29 | 29 | ||
30 | /* PCAN-USB Pro (FD) Endpoints */ | ||
31 | #define PCAN_USBPRO_EP_CMDOUT 1 | ||
32 | #define PCAN_USBPRO_EP_CMDIN (PCAN_USBPRO_EP_CMDOUT | USB_DIR_IN) | ||
33 | #define PCAN_USBPRO_EP_MSGOUT_0 2 | ||
34 | #define PCAN_USBPRO_EP_MSGIN (PCAN_USBPRO_EP_MSGOUT_0 | USB_DIR_IN) | ||
35 | #define PCAN_USBPRO_EP_MSGOUT_1 3 | ||
36 | #define PCAN_USBPRO_EP_UNUSED (PCAN_USBPRO_EP_MSGOUT_1 | USB_DIR_IN) | ||
37 | |||
30 | /* Vendor Request value for XXX_FCT */ | 38 | /* Vendor Request value for XXX_FCT */ |
31 | #define PCAN_USBPRO_FCT_DRVLD 5 /* tell device driver is loaded */ | 39 | #define PCAN_USBPRO_FCT_DRVLD 5 /* tell device driver is loaded */ |
32 | #define PCAN_USBPRO_FCT_DRVLD_REQ_LEN 16 | 40 | #define PCAN_USBPRO_FCT_DRVLD_REQ_LEN 16 |
@@ -176,4 +184,9 @@ union pcan_usb_pro_rec { | |||
176 | struct pcan_usb_pro_txmsg tx_msg; | 184 | struct pcan_usb_pro_txmsg tx_msg; |
177 | }; | 185 | }; |
178 | 186 | ||
187 | int pcan_usb_pro_probe(struct usb_interface *intf); | ||
188 | int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id, | ||
189 | int req_value, void *req_addr, int req_size); | ||
190 | void pcan_usb_pro_restart_complete(struct urb *urb); | ||
191 | |||
179 | #endif | 192 | #endif |