Skip to content

Commit 1114be1

Browse files
Stephane Grosjeanmarckleinebudde
authored andcommitted
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 <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 2b0861e commit 1114be1

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

drivers/net/can/usb/peak_usb/pcan_usb_pro.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@
2727

2828
MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB Pro adapter");
2929

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-
3830
#define PCAN_USBPRO_CHANNEL_COUNT 2
3931

4032
/* PCAN-USB Pro adapter internal clock (MHz) */
@@ -322,8 +314,8 @@ static int pcan_usb_pro_wait_rsp(struct peak_usb_device *dev,
322314
return (i >= PCAN_USBPRO_RSP_SUBMIT_MAX) ? -ERANGE : err;
323315
}
324316

325-
static int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
326-
int req_value, void *req_addr, int req_size)
317+
int pcan_usb_pro_send_req(struct peak_usb_device *dev, int req_id,
318+
int req_value, void *req_addr, int req_size)
327319
{
328320
int err;
329321
u8 req_type;
@@ -475,7 +467,7 @@ static int pcan_usb_pro_set_bittiming(struct peak_usb_device *dev,
475467
return pcan_usb_pro_set_bitrate(dev, ccbt);
476468
}
477469

478-
static void pcan_usb_pro_restart_complete(struct urb *urb)
470+
void pcan_usb_pro_restart_complete(struct urb *urb)
479471
{
480472
/* can delete usb resources */
481473
peak_usb_async_complete(urb);
@@ -978,7 +970,7 @@ static void pcan_usb_pro_free(struct peak_usb_device *dev)
978970
/*
979971
* probe function for new PCAN-USB Pro usb interface
980972
*/
981-
static int pcan_usb_pro_probe(struct usb_interface *intf)
973+
int pcan_usb_pro_probe(struct usb_interface *intf)
982974
{
983975
struct usb_host_interface *if_desc;
984976
int i;

drivers/net/can/usb/peak_usb/pcan_usb_pro.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@
2727
#define PCAN_USBPRO_INFO_BL 0
2828
#define PCAN_USBPRO_INFO_FW 1
2929

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+
3038
/* Vendor Request value for XXX_FCT */
3139
#define PCAN_USBPRO_FCT_DRVLD 5 /* tell device driver is loaded */
3240
#define PCAN_USBPRO_FCT_DRVLD_REQ_LEN 16
@@ -176,4 +184,9 @@ union pcan_usb_pro_rec {
176184
struct pcan_usb_pro_txmsg tx_msg;
177185
};
178186

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+
179192
#endif

0 commit comments

Comments
 (0)