2 * Linux CAN-bus device driver.
3 * Written by Jan Kriz email:johen@post.cz
4 * This software is released under the GPL-License.
5 * Version lincan-0.3 17 Jun 2004
8 * USB Skeleton driver - 2.2
10 * Copyright (C) 2001-2004 Greg Kroah-Hartman (greg@kroah.com)
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation, version 2.
16 * This driver is based on the 2.6.3 version of drivers/usb/usb-skeleton.c
17 * but has been rewritten to be easier to read and use.
21 #include "./can/ul_usb1.h"
22 #include "./can/can.h"
23 #include "./can/can_sysdep.h"
24 #include "./can/main.h"
25 #include "./can/devcommon.h"
26 #include "./can/setup.h"
27 // #include "./can/finish.h"
28 #include "./can/i82527.h"
29 //#include "../include/sja1000.h"
30 #include "./can/sja1000p.h"
32 #include "./can/errno.h"
34 /* Get a minor range for your devices from the usb maintainer */
35 #define USB_SKEL_MINOR_BASE 192
37 #define CAN_OP_MASK 0x80
38 #define CAN_OP_READ 0x80
39 #define CAN_OP_WRITE 0x00
42 /* our private defines. if this grows any larger, use your own .h file */
43 #define MAX_TRANSFER (PAGE_SIZE - 512)
44 /* MAX_TRANSFER is chosen so that the VM is not stressed by
45 allocations > PAGE_SIZE and the number of packets in a page
46 is an integer 512 is the largest possible packet on EHCI */
47 #define WRITES_IN_FLIGHT 8
48 /* arbitrarily chosen */
50 /* Define these values to match your devices */
51 #define USB_SKEL_VENDOR_ID 0xDEAD
52 #define USB_SKEL_PRODUCT_ID 0x1001
54 /* table of devices that work with this driver */
55 // static struct usb_device_id ul_usb1_table [] = {
56 // { USB_DEVICE(USB_SKEL_VENDOR_ID, USB_SKEL_PRODUCT_ID) },
57 // { } /* Terminating entry */
59 // MODULE_DEVICE_TABLE(usb, ul_usb1_table);
61 // extern struct file_operations can_fops;
63 // struct ul_usb1_combo {
64 // struct usb_ul_usb1 * dev;
69 * IO_RANGE is the io-memory range that gets reserved, please adjust according
70 * your hardware. Example: #define IO_RANGE 0x100 for i82527 chips or
71 * #define IO_RANGE 0x20 for sja1000 chips in basic CAN mode.
73 #define IO_RANGE 0x100
75 /* Structure to hold all of our device specific stuff */
76 // struct usb_ul_usb1 {
77 // struct usb_device *udev; /* the usb device for this device */
78 // struct usb_interface *interface; /* the interface for this device */
79 // struct semaphore limit_sem; /* limiting the number of writes in progress */
80 // struct usb_anchor submitted; /* in case we need to retract our submissions */
81 // unsigned char *bulk_in_buffer; /* the buffer to receive data */
82 // size_t bulk_in_size; /* the size of the receive buffer */
83 // unsigned char *int_in_buffer; /* the buffer to receive data */
84 // size_t int_in_size; /* the size of the receive buffer */
85 // __u8 bulk_in_endpointAddr; /* the address of the bulk in endpoint */
86 // __u8 bulk_out_endpointAddr; /* the address of the bulk out endpoint */
87 // __u8 int_in_endpointAddr; /* the address of the interrupt in endpoint */
88 // int int_in_interval;
89 // int errors; /* the last request tanked */
90 // int open_count; /* count the number of openers */
91 // spinlock_t err_lock; /* lock for errors */
92 // struct mutex io_mutex; /* synchronize I/O with disconnect */
94 // struct candevice_t *candev;
97 // static struct usb_driver ul_usb1_driver;
99 /** ul_usb1_request_io
100 * ul_usb1_request_io: - reserve io or memory range for can board
101 * @candev: pointer to candevice/board which asks for io. Field @io_addr
102 * of @candev is used in most cases to define start of the range
104 * The function ul_usb1_request_io() is used to reserve the io-memory. If your
105 * hardware uses a dedicated memory range as hardware control registers you
106 * will have to add the code to reserve this memory as well.
107 * %IO_RANGE is the io-memory range that gets reserved, please adjust according
108 * your hardware. Example: #define IO_RANGE 0x100 for i82527 chips or
109 * #define IO_RANGE 0x20 for sja1000 chips in basic CAN mode.
110 * Return Value: The function returns zero on success or %-ENODEV on failure
111 * File: src/ul_usb1.c
113 int ul_usb1_request_io(struct candevice_t *candev)
115 // ((struct usb_ul_usb1*)candev->sysdevptr.anydev)->candev=candev;
119 /** ul_usb1_release_io
120 * ul_usb1_release_io - free reserved io memory range
121 * @candev: pointer to candevice/board which releases io
123 * The function ul_usb1_release_io() is used to free reserved io-memory.
124 * In case you have reserved more io memory, don't forget to free it here.
125 * IO_RANGE is the io-memory range that gets released, please adjust according
126 * your hardware. Example: #define IO_RANGE 0x100 for i82527 chips or
127 * #define IO_RANGE 0x20 for sja1000 chips in basic CAN mode.
128 * Return Value: The function always returns zero
129 * File: src/ul_usb1.c
131 int ul_usb1_release_io(struct candevice_t *candev)
133 /* struct usb_ul_usb1 *dev;
134 if (candev->sysdevptr.anydev){
135 dev=(struct usb_ul_usb1*) candev->sysdevptr.anydev;
136 usb_put_dev(dev->udev);
137 usb_kill_urb(dev->irq);
138 usb_free_urb(dev->irq);
139 kfree(dev->bulk_in_buffer);
140 kfree(dev->int_in_buffer);
142 dev->candev->sysdevptr.anydev=NULL;
143 //cleanup_usbdev(dev->candev);
151 * ul_usb1_reset - hardware reset routine
152 * @candev: Pointer to candevice/board structure
154 * The function ul_usb1_reset() is used to give a hardware reset. This is
155 * rather hardware specific so I haven't included example code. Don't forget to
156 * check the reset status of the chip before returning.
157 * Return Value: The function returns zero on success or %-ENODEV on failure
158 * File: src/ul_usb1.c
160 int ul_usb1_reset(struct candevice_t *candev)
165 #define RESET_ADDR 0x0
169 /** ul_usb1_init_hw_data
170 * ul_usb1_init_hw_data - Initialize hardware cards
171 * @candev: Pointer to candevice/board structure
173 * The function ul_usb1_init_hw_data() is used to initialize the hardware
174 * structure containing information about the installed CAN-board.
175 * %RESET_ADDR represents the io-address of the hardware reset register.
176 * %NR_82527 represents the number of Intel 82527 chips on the board.
177 * %NR_SJA1000 represents the number of Philips sja1000 chips on the board.
178 * The flags entry can currently only be %CANDEV_PROGRAMMABLE_IRQ to indicate that
179 * the hardware uses programmable interrupts.
180 * Return Value: The function always returns zero
181 * File: src/ul_usb1.c
183 int ul_usb1_init_hw_data(struct candevice_t *candev)
185 candev->res_addr=RESET_ADDR;
186 candev->nr_82527_chips=NR_82527;
187 candev->nr_sja1000_chips=NR_SJA1000;
188 candev->nr_all_chips=NR_82527+NR_SJA1000;
189 candev->flags |= CANDEV_PROGRAMMABLE_IRQ*0;
194 /** ul_usb1_init_chip_data
195 * ul_usb1_init_chip_data - Initialize chips
196 * @candev: Pointer to candevice/board structure
197 * @chipnr: Number of the CAN chip on the hardware card
199 * The function ul_usb1_init_chip_data() is used to initialize the hardware
200 * structure containing information about the CAN chips.
201 * %CHIP_TYPE represents the type of CAN chip. %CHIP_TYPE can be "i82527" or
203 * The @chip_base_addr entry represents the start of the 'official' memory map
204 * of the installed chip. It's likely that this is the same as the @io_addr
205 * argument supplied at module loading time.
206 * The @clock entry holds the chip clock value in Hz.
207 * The entry @sja_cdr_reg holds hardware specific options for the Clock Divider
208 * register. Options defined in the %sja1000.h file:
209 * %sjaCDR_CLKOUT_MASK, %sjaCDR_CLK_OFF, %sjaCDR_RXINPEN, %sjaCDR_CBP, %sjaCDR_PELICAN
210 * The entry @sja_ocr_reg holds hardware specific options for the Output Control
211 * register. Options defined in the %sja1000.h file:
212 * %sjaOCR_MODE_BIPHASE, %sjaOCR_MODE_TEST, %sjaOCR_MODE_NORMAL, %sjaOCR_MODE_CLOCK,
213 * %sjaOCR_TX0_LH, %sjaOCR_TX1_ZZ.
214 * The entry @int_clk_reg holds hardware specific options for the Clock Out
215 * register. Options defined in the %i82527.h file:
216 * %iCLK_CD0, %iCLK_CD1, %iCLK_CD2, %iCLK_CD3, %iCLK_SL0, %iCLK_SL1.
217 * The entry @int_bus_reg holds hardware specific options for the Bus
218 * Configuration register. Options defined in the %i82527.h file:
219 * %iBUS_DR0, %iBUS_DR1, %iBUS_DT1, %iBUS_POL, %iBUS_CBY.
220 * The entry @int_cpu_reg holds hardware specific options for the cpu interface
221 * register. Options defined in the %i82527.h file:
222 * %iCPU_CEN, %iCPU_MUX, %iCPU_SLP, %iCPU_PWD, %iCPU_DMC, %iCPU_DSC, %iCPU_RST.
223 * Return Value: The function always returns zero
224 * File: src/ul_usb1.c
226 int ul_usb1_init_chip_data(struct candevice_t *candev, int chipnr)
228 /*i82527_fill_chipspecops(candev->chip[chipnr]);*/
229 /*sja1000_fill_chipspecops(candev->chip[chipnr]);*/
230 sja1000p_fill_chipspecops(candev->chip[chipnr]);
232 candev->chip[chipnr]->flags|= CHIP_IRQ_CUSTOM;
234 candev->chip[chipnr]->chip_base_addr=0;
235 candev->chip[chipnr]->clock = 24000000;
236 candev->chip[chipnr]->int_cpu_reg = iCPU_DSC;
237 candev->chip[chipnr]->int_clk_reg = iCLK_SL1;
238 candev->chip[chipnr]->int_bus_reg = iBUS_CBY;
239 candev->chip[chipnr]->sja_cdr_reg = sjaCDR_CBP | sjaCDR_CLK_OFF;
240 candev->chip[chipnr]->sja_ocr_reg = sjaOCR_MODE_NORMAL |
243 candev->chip[chipnr]->chip_data=(void *)malloc(sizeof(struct ul_usb1_chip_data));
244 if (candev->chip[chipnr]->chip_data==NULL)
249 /** ul_usb1_init_obj_data
250 * ul_usb1_init_obj_data - Initialize message buffers
251 * @chip: Pointer to chip specific structure
252 * @objnr: Number of the message buffer
254 * The function ul_usb1_init_obj_data() is used to initialize the hardware
255 * structure containing information about the different message objects on the
256 * CAN chip. In case of the sja1000 there's only one message object but on the
257 * i82527 chip there are 15.
258 * The code below is for a i82527 chip and initializes the object base addresses
259 * The entry @obj_base_addr represents the first memory address of the message
260 * object. In case of the sja1000 @obj_base_addr is taken the same as the chips
262 * Unless the hardware uses a segmented memory map, flags can be set zero.
263 * Return Value: The function always returns zero
264 * File: src/ul_usb1.c
266 int ul_usb1_init_obj_data(struct canchip_t *chip, int objnr)
268 chip->msgobj[objnr]->obj_base_addr=chip->chip_base_addr+(objnr+1)*0x10;
273 /** ul_usb1_program_irq
274 * ul_usb1_program_irq - program interrupts
275 * @candev: Pointer to candevice/board structure
277 * The function ul_usb1_program_irq() is used for hardware that uses
278 * programmable interrupts. If your hardware doesn't use programmable interrupts
279 * you should not set the @candevices_t->flags entry to %CANDEV_PROGRAMMABLE_IRQ and
280 * leave this function unedited. Again this function is hardware specific so
281 * there's no example code.
282 * Return value: The function returns zero on success or %-ENODEV on failure
283 * File: src/ul_usb1.c
285 int ul_usb1_program_irq(struct candevice_t *candev)
290 /** ul_usb1_write_register
291 * ul_usb1_write_register - Low level write register routine
292 * @data: data to be written
293 * @address: memory address to write to
295 * The function ul_usb1_write_register() is used to write to hardware registers
296 * on the CAN chip. You should only have to edit this function if your hardware
297 * uses some specific write process.
298 * Return Value: The function does not return a value
299 * File: src/ul_usb1.c
301 void ul_usb1_write_register(unsigned data, unsigned long address)
303 IO1DIR|=0x00FF0000; // Port as output to send data
304 IO1CLR=0x00FF0000; // Clear all data on port
306 SET_OUT_PIN(IO0,P0_SJA1000_RD_PIN); // Stays high on write
307 SET_OUT_PIN(IO0,P0_SJA1000_WR_PIN); // Stays high on address write
308 SET_OUT_PIN(IO0,P0_SJA1000_CS_PIN); // Sets output buffers to third state
309 for (slowdown=0;slowdown<SJA1000_SCLK;slowdown++);
310 //SET_OUT_PIN(IO0,P0_SJA1000_ALE_PIN); // Start command
312 // Set memory address
313 IO1SET=__val2mfld(0x00FF0000,address&0xFF); // Shift data to SJA pins and output them
314 for (slowdown=0;slowdown<SJA1000_SCLK;slowdown++);
315 //CLR_OUT_PIN(IO0,P0_SJA1000_ALE_PIN); // Makes address active
316 CLR_OUT_PIN(IO0,P0_SJA1000_CS_PIN);
317 for (slowdown=0;slowdown<SJA1000_SCLK;slowdown++);
320 CLR_OUT_PIN(IO0,P0_SJA1000_WR_PIN);
323 IO1SET=__val2mfld(0x00FF0000,data&0xFF);
324 for (slowdown=0;slowdown<SJA1000_SCLK;slowdown++);
325 SET_OUT_PIN(IO0,P0_SJA1000_WR_PIN); // Data should be accepted by now
326 SET_OUT_PIN(IO0,P0_SJA1000_CS_PIN);
327 for (slowdown=0;slowdown<SJA1000_SCLK;slowdown++);
329 // struct usb_ul_usb1 *dev;
331 // int bytes_transferred;
332 // unsigned char buffer[2];
333 // buffer[0]=((unsigned char)address & ~CAN_OP_MASK)+CAN_OP_WRITE;
334 // buffer[1]=(unsigned char)data;
336 // dev = (struct usb_ul_usb1 *)candev->sysdevptr.anydev;
338 // mutex_lock(&dev->io_mutex);
339 // if (!dev) { /* disconnect() was called */
340 // CANMSG("Sending %lu:%X : ERR No device\n",address,(uint8_t)data);
344 // if (!dev->interface) { /* disconnect() was called */
345 // CANMSG("Sending %lu:%X : ERR No interface\n",address,(uint8_t)data);
350 /* do a blocking bulk write to send data to the device */
351 /* retval = usb_bulk_msg(dev->udev,
352 usb_sndbulkpipe(dev->udev, dev->bulk_out_endpointAddr),
355 &bytes_transferred, 10000);
356 CANMSG("Sending %lu:%X : retval %d, transferred %d bytes\n",address,(uint8_t)data,retval,bytes_transferred);
359 mutex_unlock(&dev->io_mutex);*/
362 /** ul_usb1_read_register
363 * ul_usb1_read_register - Low level read register routine
364 * @address: memory address to read from
366 * The function ul_usb1_read_register() is used to read from hardware registers
367 * on the CAN chip. You should only have to edit this function if your hardware
368 * uses some specific read process.
369 * Return Value: The function returns the value stored in @address
370 * File: src/ul_usb1.c
372 unsigned ul_usb1_read_register(unsigned long address)
375 IO1DIR|=0x00FF0000; // Port as output to set address
376 IO1CLR=0x00FF0000; // Clear all data
378 SET_OUT_PIN(IO0,P0_SJA1000_WR_PIN); // Stays high on read
379 SET_OUT_PIN(IO0,P0_SJA1000_RD_PIN); // Stays high while entering address
380 SET_OUT_PIN(IO0,P0_SJA1000_CS_PIN);
381 for (slowdown=0;slowdown<SJA1000_SCLK;slowdown++);
382 //SET_OUT_PIN(IO0,P0_SJA1000_ALE_PIN);
384 // Request memory address
385 IO1SET=__val2mfld(0x00FF0000,address&0xFF);
386 for (slowdown=0;slowdown<SJA1000_SCLK;slowdown++);
387 //CLR_OUT_PIN(IO0,P0_SJA1000_ALE_PIN);
388 CLR_OUT_PIN(IO0,P0_SJA1000_CS_PIN);
392 IO1DIR&=~0x00FF0000; // Sets port as input
393 CLR_OUT_PIN(IO0,P0_SJA1000_RD_PIN);
394 for (slowdown=0;slowdown<SJA1000_SCLK;slowdown++);
395 data=__mfld2val(0x00FF0000,IO1PIN);
396 SET_OUT_PIN(IO0,P0_SJA1000_RD_PIN);
397 SET_OUT_PIN(IO0,P0_SJA1000_CS_PIN);
398 for (slowdown=0;slowdown<SJA1000_SCLK;slowdown++);
401 // struct usb_ul_usb1 *dev;
403 // int bytes_transferred;
404 // unsigned char buffer[2];
405 // buffer[0]=((unsigned char)address & ~CAN_OP_MASK)+CAN_OP_READ;
408 // dev = (struct usb_ul_usb1 *)candev->sysdevptr.anydev;
410 // mutex_lock(&dev->io_mutex);
411 // if (!dev) { /* disconnect() was called */
415 // if (!dev->interface) { /* disconnect() was called */
420 /* do a blocking bulk write to send data to the device */
421 /* retval = usb_bulk_msg(dev->udev,
422 usb_sndbulkpipe(dev->udev, dev->bulk_out_endpointAddr),
425 &bytes_transferred, 10000);
427 CANMSG("Requested: %ld : retval %d, transferred %d bytes\n",address,retval,bytes_transferred);
428 if ((retval)||(bytes_transferred!=2)){
433 /* do a blocking bulk read to get data from the device */
434 // retval = usb_bulk_msg(dev->udev,
435 // usb_rcvbulkpipe(dev->udev, dev->bulk_in_endpointAddr),
436 // dev->bulk_in_buffer,
437 // dev->bulk_in_size,
438 // &bytes_transferred, 10000);
440 /* if the read was successful, copy the data to userspace */
441 /* CANMSG("Received %d bytes : %u:%X\n",bytes_transferred,(dev->bulk_in_buffer[0] & 0x7F),dev->bulk_in_buffer[1]);
443 if (bytes_transferred!=2)
446 retval = dev->bulk_in_buffer[1];
450 mutex_unlock(&dev->io_mutex);
454 /* !!! Don't change this function !!! */
455 int ul_usb1_register(struct hwspecops_t *hwspecops)
457 hwspecops->request_io = ul_usb1_request_io;
458 hwspecops->release_io = ul_usb1_release_io;
459 hwspecops->reset = ul_usb1_reset;
460 hwspecops->init_hw_data = ul_usb1_init_hw_data;
461 hwspecops->init_chip_data = ul_usb1_init_chip_data;
462 hwspecops->init_obj_data = ul_usb1_init_obj_data;
463 hwspecops->write_register = ul_usb1_write_register;
464 hwspecops->read_register = ul_usb1_read_register;
465 hwspecops->program_irq = ul_usb1_program_irq;
472 /* --------------------------------------------------------------------------------------------------- */
475 // static void ul_usb1_irq(struct urb *urb)
477 // struct usb_ul_usb1 *dev = urb->context;
478 // struct ul_usb1_combo devc;
481 // CANMSG("Interrupt poll\n");
483 // switch (urb->status) {
490 // /* this urb is terminated, clean up */
491 // CANMSG("%s - urb shutting down with status: %d\n", __FUNCTION__, urb->status);
494 // CANMSG("%s - nonzero urb status received: %d\n", __FUNCTION__, urb->status);
501 // dev->candev->chip[0]->chipspecops->irq_handler(0,dev->candev->chip[0]);
502 // CANMSG("Interrupt caught\n");
505 // retval = usb_submit_urb (urb, GFP_ATOMIC);
507 // CANMSG("%s - usb_submit_urb failed with result %d\n",
508 // __FUNCTION__, retval);
511 // static void ul_usb1_delete(struct usb_ul_usb1 *dev)
513 // usb_put_dev(dev->udev);
514 // usb_kill_urb(dev->irq);
515 // usb_free_urb(dev->irq);
516 // kfree(dev->bulk_in_buffer);
517 // kfree(dev->int_in_buffer);
519 // dev->candev->sysdevptr.anydev=NULL;
520 // cleanup_usbdev(dev->candev);
525 // static int ul_usb1_probe(struct usb_interface *interface, const struct usb_device_id *id)
527 // struct usb_ul_usb1 *dev;
528 // struct usb_host_interface *iface_desc;
529 // struct usb_endpoint_descriptor *endpoint;
530 // struct candevice_t *candev;
531 // size_t buffer_size;
533 // int retval = -ENOMEM;
535 // /* allocate memory for our device state and initialize it */
536 // dev = kzalloc(sizeof(*dev), GFP_KERNEL);
538 // err("Out of memory");
541 // sema_init(&dev->limit_sem, WRITES_IN_FLIGHT);
542 // mutex_init(&dev->io_mutex);
543 // spin_lock_init(&dev->err_lock);
544 // init_usb_anchor(&dev->submitted);
546 // // dev->udev = usb_get_dev(interface_to_usbdev(interface));
547 // dev->udev = interface_to_usbdev(interface);
548 // dev->interface = interface;
550 // /* set up the endpoint information */
551 // /* use only the first bulk-in and bulk-out endpoints */
552 // iface_desc = interface->cur_altsetting;
553 // for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
554 // endpoint = &iface_desc->endpoint[i].desc;
556 // if (!dev->bulk_in_endpointAddr &&
557 // usb_endpoint_is_bulk_in(endpoint)) {
558 // /* we found a bulk in endpoint */
559 // buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
560 // dev->bulk_in_size = buffer_size;
561 // dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
562 // dev->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
563 // if (!dev->bulk_in_buffer) {
564 // err("Could not allocate bulk_in_buffer");
569 // if (!dev->bulk_out_endpointAddr &&
570 // usb_endpoint_is_bulk_out(endpoint)) {
571 // /* we found a bulk out endpoint */
572 // dev->bulk_out_endpointAddr = endpoint->bEndpointAddress;
575 // if (!dev->int_in_endpointAddr &&
576 // usb_endpoint_is_int_in(endpoint)) {
577 // /* we found an interrupt in endpoint */
578 // buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
579 // dev->int_in_size = buffer_size;
580 // dev->int_in_endpointAddr = endpoint->bEndpointAddress;
581 // dev->int_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
582 // dev->int_in_interval = endpoint->bInterval;
583 // if (!dev->int_in_buffer) {
584 // err("Could not allocate int_in_buffer");
589 // if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr && dev->int_in_endpointAddr)) {
590 // err("Could not find all bulk-in, bulk-out and interrupt endpoints");
594 // /* save our data pointer in this interface device */
595 // usb_set_intfdata(interface, dev);
597 // if (main_init_done==1)
598 // register_usbdev("ul_usb1",(void *) dev);
600 // mutex_lock(&usbdev_reg_mutex);
601 // if (main_init_done==1)
602 // register_usbdev("ul_usb1",(void *) dev);
604 // for (i=0;i<MAX_HW_CARDS;i++){
605 // if (usbregq[i]==NULL){
606 // usbregq[i]=(struct usbdev_reg_query *)can_checked_malloc(sizeof(struct usbdev_reg_query));
608 // CANMSG("Error allocating usbdev_reg_query");
609 // mutex_unlock(&usbdev_reg_mutex);
612 // sprintf (usbregq[i]->hwname,"ul_usb1");
613 // usbregq[i]->anydev=(void *) dev;
617 // if (i==MAX_HW_CARDS){
618 // CANMSG("No free space to register new card");
619 // mutex_unlock(&usbdev_reg_mutex);
623 // mutex_unlock(&usbdev_reg_mutex);
626 // dev->irq = usb_alloc_urb(0, GFP_KERNEL);
628 // CANMSG("Error allocating usb urb\n");
631 // dev->irq->dev = dev->udev;
632 // usb_fill_int_urb(dev->irq, dev->udev,
633 // usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr),
634 // dev->int_in_buffer, dev->int_in_size,
635 // ul_usb1_irq, dev, dev->int_in_interval);
636 // /* usb_fill_bulk_urb(dev->irq, dev->udev,
637 // usb_rcvbulkpipe(dev->udev, dev->bulk_in_endpointAddr),
638 // dev->int_in_buffer, dev->int_in_size,
639 // ul_usb1_irq, dev);*/
641 // /* dev->irq->transfer_dma = wacom->data_dma;
642 // dev->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;*/
643 // retval=usb_submit_urb(dev->irq, GFP_KERNEL);
645 // CANMSG("INT URB %d\n",retval);
648 // CANMSG("INT URB SUCCCESS\n");
650 // /* let the user know what node this device is now attached to */
651 // info("USB Skeleton device now attached");
655 // ul_usb1_delete(dev);
659 // static void ul_usb1_disconnect(struct usb_interface *interface)
661 // struct usb_ul_usb1 *dev;
662 // int minor = interface->minor;
664 // dev = usb_get_intfdata(interface);
665 // usb_set_intfdata(interface, NULL);
667 // /* prevent more I/O from starting */
668 // mutex_lock(&dev->io_mutex);
669 // dev->interface = NULL;
670 // mutex_unlock(&dev->io_mutex);
672 // //usb_kill_anchored_urbs(&dev->submitted);
674 // ul_usb1_delete(dev);
676 // info("USB Skeleton now disconnected");
679 // static struct usb_driver ul_usb1_driver = {
680 // .name = "ul_usb1-can",
681 // .id_table = ul_usb1_table,
682 // .probe = ul_usb1_probe,
683 // .disconnect = ul_usb1_disconnect,
684 // .id_table = ul_usb1_table,
687 // int ul_usb1_init(void){
688 // return usb_register(&ul_usb1_driver);
691 // void ul_usb1_exit(void){
692 // usb_deregister(&ul_usb1_driver);