Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * flexcop-usb.c - covers the USB part
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * see flexcop.c for copyright information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #define FC_LOG_PREFIX "flexcop_usb"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include "flexcop-usb.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include "flexcop-common.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) /* Version information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #define DRIVER_VERSION "0.1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #define DRIVER_NAME "Technisat/B2C2 FlexCop II/IIb/III Digital TV USB Driver"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #define DRIVER_AUTHOR "Patrick Boettcher <patrick.boettcher@posteo.de>"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) /* debug */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #ifdef CONFIG_DVB_B2C2_FLEXCOP_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define dprintk(level,args...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	do { if ((debug & level)) printk(args); } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #define debug_dump(b, l, method) do {\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	int i; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	for (i = 0; i < l; i++) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 		method("%02x ", b[i]); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	method("\n"); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #define DEBSTATUS ""
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #define dprintk(level, args...)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #define debug_dump(b, l, method)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define DEBSTATUS " (debugging is not enabled)"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) static int debug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) module_param(debug, int, 0644);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) MODULE_PARM_DESC(debug, "set debugging level (1=info,ts=2,ctrl=4,i2c=8,v8mem=16 (or-able))." DEBSTATUS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #undef DEBSTATUS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #define deb_info(args...) dprintk(0x01, args)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define deb_ts(args...) dprintk(0x02, args)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define deb_ctrl(args...) dprintk(0x04, args)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #define deb_i2c(args...) dprintk(0x08, args)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #define deb_v8(args...) dprintk(0x10, args)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) /* JLP 111700: we will include the 1 bit gap between the upper and lower 3 bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  * in the IBI address, to make the V8 code simpler.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * PCI ADDRESS FORMAT: 0x71C -> 0000 0111 0001 1100 (the six bits used)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  *                  in general: 0000 0HHH 000L LL00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  * IBI ADDRESS FORMAT:                    RHHH BLLL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)  * where R is the read(1)/write(0) bit, B is the busy bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)  * and HHH and LLL are the two sets of three bits from the PCI address.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #define B2C2_FLEX_PCIOFFSET_TO_INTERNALADDR(usPCI) (u8) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	(((usPCI >> 2) & 0x07) + ((usPCI >> 4) & 0x70))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #define B2C2_FLEX_INTERNALADDR_TO_PCIOFFSET(ucAddr) (u16) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	(((ucAddr & 0x07) << 2) + ((ucAddr & 0x70) << 4))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  * DKT 020228
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  * - forget about this VENDOR_BUFFER_SIZE, read and write register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  *   deal with DWORD or 4 bytes, that should be should from now on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  * - from now on, we don't support anything older than firm 1.00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  *   I eliminated the write register as a 2 trip of writing hi word and lo word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  *   and force this to write only 4 bytes at a time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)  *   NOTE: this should work with all the firmware from 1.00 and newer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) static int flexcop_usb_readwrite_dw(struct flexcop_device *fc, u16 wRegOffsPCI, u32 *val, u8 read)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	struct flexcop_usb *fc_usb = fc->bus_specific;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	u8 request = read ? B2C2_USB_READ_REG : B2C2_USB_WRITE_REG;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	u8 request_type = (read ? USB_DIR_IN : USB_DIR_OUT) | USB_TYPE_VENDOR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	u8 wAddress = B2C2_FLEX_PCIOFFSET_TO_INTERNALADDR(wRegOffsPCI) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		(read ? 0x80 : 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	mutex_lock(&fc_usb->data_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	if (!read)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		memcpy(fc_usb->data, val, sizeof(*val));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	ret = usb_control_msg(fc_usb->udev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 			read ? B2C2_USB_CTRL_PIPE_IN : B2C2_USB_CTRL_PIPE_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 			request,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 			request_type, /* 0xc0 read or 0x40 write */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 			wAddress,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 			0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 			fc_usb->data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 			sizeof(u32),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 			B2C2_WAIT_FOR_OPERATION_RDW);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	if (ret != sizeof(u32)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		err("error while %s dword from %d (%d).", read ? "reading" :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 				"writing", wAddress, wRegOffsPCI);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		if (ret >= 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 			ret = -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	if (read && ret >= 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		memcpy(val, fc_usb->data, sizeof(*val));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	mutex_unlock(&fc_usb->data_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)  * DKT 010817 - add support for V8 memory read/write and flash update
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) static int flexcop_usb_v8_memory_req(struct flexcop_usb *fc_usb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		flexcop_usb_request_t req, u8 page, u16 wAddress,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		u8 *pbBuffer, u32 buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	u8 request_type = USB_TYPE_VENDOR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	u16 wIndex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	int nWaitTime, pipe, ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	wIndex = page << 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	if (buflen > sizeof(fc_usb->data)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		err("Buffer size bigger than max URB control message\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		return -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	switch (req) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	case B2C2_USB_READ_V8_MEM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		nWaitTime = B2C2_WAIT_FOR_OPERATION_V8READ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		request_type |= USB_DIR_IN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		pipe = B2C2_USB_CTRL_PIPE_IN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	case B2C2_USB_WRITE_V8_MEM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		wIndex |= pbBuffer[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		request_type |= USB_DIR_OUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		nWaitTime = B2C2_WAIT_FOR_OPERATION_V8WRITE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		pipe = B2C2_USB_CTRL_PIPE_OUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	case B2C2_USB_FLASH_BLOCK:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		request_type |= USB_DIR_OUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 		nWaitTime = B2C2_WAIT_FOR_OPERATION_V8FLASH;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 		pipe = B2C2_USB_CTRL_PIPE_OUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		deb_info("unsupported request for v8_mem_req %x.\n", req);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	deb_v8("v8mem: %02x %02x %04x %04x, len: %d\n", request_type, req,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 			wAddress, wIndex, buflen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	mutex_lock(&fc_usb->data_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	if ((request_type & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		memcpy(fc_usb->data, pbBuffer, buflen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	ret = usb_control_msg(fc_usb->udev, pipe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 			req,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 			request_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 			wAddress,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 			wIndex,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 			fc_usb->data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 			buflen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 			nWaitTime);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	if (ret != buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 		ret = -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	if (ret >= 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 		ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 		if ((request_type & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 			memcpy(pbBuffer, fc_usb->data, buflen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	mutex_unlock(&fc_usb->data_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	debug_dump(pbBuffer, ret, deb_v8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) #define bytes_left_to_read_on_page(paddr,buflen) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	((V8_MEMORY_PAGE_SIZE - (paddr & V8_MEMORY_PAGE_MASK)) > buflen \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	 ? buflen : (V8_MEMORY_PAGE_SIZE - (paddr & V8_MEMORY_PAGE_MASK)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) static int flexcop_usb_memory_req(struct flexcop_usb *fc_usb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		flexcop_usb_request_t req, flexcop_usb_mem_page_t page_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		u32 addr, int extended, u8 *buf, u32 len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	int i,ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	u16 wMax;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	u32 pagechunk = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	switch(req) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	case B2C2_USB_READ_V8_MEM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 		wMax = USB_MEM_READ_MAX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	case B2C2_USB_WRITE_V8_MEM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 		wMax = USB_MEM_WRITE_MAX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	case B2C2_USB_FLASH_BLOCK:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 		wMax = USB_FLASH_MAX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	for (i = 0; i < len;) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 		pagechunk =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 			wMax < bytes_left_to_read_on_page(addr, len) ?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 				wMax :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 				bytes_left_to_read_on_page(addr, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		deb_info("%x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 			(addr & V8_MEMORY_PAGE_MASK) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 				(V8_MEMORY_EXTENDED*extended));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 		ret = flexcop_usb_v8_memory_req(fc_usb, req,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 			page_start + (addr / V8_MEMORY_PAGE_SIZE),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 			(addr & V8_MEMORY_PAGE_MASK) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 				(V8_MEMORY_EXTENDED*extended),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 			&buf[i], pagechunk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 			return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 		addr += pagechunk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 		len -= pagechunk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) static int flexcop_usb_get_mac_addr(struct flexcop_device *fc, int extended)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	return flexcop_usb_memory_req(fc->bus_specific, B2C2_USB_READ_V8_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 		V8_MEMORY_PAGE_FLASH, 0x1f010, 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 		fc->dvb_adapter.proposed_mac, 6);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) /* usb i2c stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 		flexcop_usb_request_t req, flexcop_usb_i2c_function_t func,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 		u8 chipaddr, u8 addr, u8 *buf, u8 buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	struct flexcop_usb *fc_usb = i2c->fc->bus_specific;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	u16 wValue, wIndex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	int nWaitTime, pipe, ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	u8 request_type = USB_TYPE_VENDOR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	if (buflen > sizeof(fc_usb->data)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 		err("Buffer size bigger than max URB control message\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 		return -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	switch (func) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	case USB_FUNC_I2C_WRITE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	case USB_FUNC_I2C_MULTIWRITE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	case USB_FUNC_I2C_REPEATWRITE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 		/* DKT 020208 - add this to support special case of DiSEqC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	case USB_FUNC_I2C_CHECKWRITE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 		pipe = B2C2_USB_CTRL_PIPE_OUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 		nWaitTime = 2000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 		request_type |= USB_DIR_OUT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	case USB_FUNC_I2C_READ:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	case USB_FUNC_I2C_REPEATREAD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 		pipe = B2C2_USB_CTRL_PIPE_IN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 		nWaitTime = 2000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 		request_type |= USB_DIR_IN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 		deb_info("unsupported function for i2c_req %x\n", func);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	wValue = (func << 8) | (i2c->port << 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	wIndex = (chipaddr << 8 ) | addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	deb_i2c("i2c %2d: %02x %02x %02x %02x %02x %02x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 			func, request_type, req,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 			wValue & 0xff, wValue >> 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 			wIndex & 0xff, wIndex >> 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	mutex_lock(&fc_usb->data_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	if ((request_type & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 		memcpy(fc_usb->data, buf, buflen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	ret = usb_control_msg(fc_usb->udev, pipe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 			req,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 			request_type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 			wValue,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 			wIndex,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 			fc_usb->data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 			buflen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 			nWaitTime);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 	if (ret != buflen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 		ret = -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 	if (ret >= 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 		ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 		if ((request_type & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 			memcpy(buf, fc_usb->data, buflen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	mutex_unlock(&fc_usb->data_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) /* actual bus specific access functions,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)    make sure prototype are/will be equal to pci */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) static flexcop_ibi_value flexcop_usb_read_ibi_reg(struct flexcop_device *fc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 	flexcop_ibi_register reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	flexcop_ibi_value val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 	val.raw = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 	flexcop_usb_readwrite_dw(fc, reg, &val.raw, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 	return val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) static int flexcop_usb_write_ibi_reg(struct flexcop_device *fc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 		flexcop_ibi_register reg, flexcop_ibi_value val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 	return flexcop_usb_readwrite_dw(fc, reg, &val.raw, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) static int flexcop_usb_i2c_request(struct flexcop_i2c_adapter *i2c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 		flexcop_access_op_t op, u8 chipaddr, u8 addr, u8 *buf, u16 len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 	if (op == FC_READ)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 		return flexcop_usb_i2c_req(i2c, B2C2_USB_I2C_REQUEST,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 				USB_FUNC_I2C_READ, chipaddr, addr, buf, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 		return flexcop_usb_i2c_req(i2c, B2C2_USB_I2C_REQUEST,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 				USB_FUNC_I2C_WRITE, chipaddr, addr, buf, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) static void flexcop_usb_process_frame(struct flexcop_usb *fc_usb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 	u8 *buffer, int buffer_length)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 	u8 *b;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	int l;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	deb_ts("tmp_buffer_length=%d, buffer_length=%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 		fc_usb->tmp_buffer_length, buffer_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	if (fc_usb->tmp_buffer_length > 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 		memcpy(fc_usb->tmp_buffer+fc_usb->tmp_buffer_length, buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 				buffer_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 		fc_usb->tmp_buffer_length += buffer_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 		b = fc_usb->tmp_buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 		l = fc_usb->tmp_buffer_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 		b=buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 		l=buffer_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	while (l >= 190) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 		if (*b == 0xff) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 			switch (*(b+1) & 0x03) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 			case 0x01: /* media packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 				if (*(b+2) == 0x47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 					flexcop_pass_dmx_packets(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 							fc_usb->fc_dev, b+2, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 				else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 					deb_ts("not ts packet %*ph\n", 4, b+2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 				b += 190;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 				l -= 190;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 			default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 				deb_ts("wrong packet type\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 				l = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 			deb_ts("wrong header\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 			l = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 	if (l>0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 		memcpy(fc_usb->tmp_buffer, b, l);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 	fc_usb->tmp_buffer_length = l;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) static void flexcop_usb_urb_complete(struct urb *urb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 	struct flexcop_usb *fc_usb = urb->context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	if (urb->actual_length > 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 		deb_ts("urb completed, bufsize: %d actlen; %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 			urb->transfer_buffer_length, urb->actual_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 	for (i = 0; i < urb->number_of_packets; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 		if (urb->iso_frame_desc[i].status < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 			err("iso frame descriptor %d has an error: %d\n", i,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 				urb->iso_frame_desc[i].status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 		} else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 			if (urb->iso_frame_desc[i].actual_length > 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 				deb_ts("passed %d bytes to the demux\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 					urb->iso_frame_desc[i].actual_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 				flexcop_usb_process_frame(fc_usb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 					urb->transfer_buffer +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 						urb->iso_frame_desc[i].offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 					urb->iso_frame_desc[i].actual_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 		urb->iso_frame_desc[i].status = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 		urb->iso_frame_desc[i].actual_length = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	usb_submit_urb(urb,GFP_ATOMIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) static int flexcop_usb_stream_control(struct flexcop_device *fc, int onoff)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 	/* submit/kill iso packets */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) static void flexcop_usb_transfer_exit(struct flexcop_usb *fc_usb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	for (i = 0; i < B2C2_USB_NUM_ISO_URB; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 		if (fc_usb->iso_urb[i] != NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 			deb_ts("unlinking/killing urb no. %d\n",i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 			usb_kill_urb(fc_usb->iso_urb[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 			usb_free_urb(fc_usb->iso_urb[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 	usb_free_coherent(fc_usb->udev, fc_usb->buffer_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 			  fc_usb->iso_buffer, fc_usb->dma_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 	u16 frame_size = le16_to_cpu(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 		fc_usb->uintf->cur_altsetting->endpoint[0].desc.wMaxPacketSize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 	int bufsize = B2C2_USB_NUM_ISO_URB * B2C2_USB_FRAMES_PER_ISO *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 		frame_size, i, j, ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 	int buffer_offset = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 	deb_ts("creating %d iso-urbs with %d frames each of %d bytes size = %d.\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 	       B2C2_USB_NUM_ISO_URB,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 			B2C2_USB_FRAMES_PER_ISO, frame_size, bufsize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 	fc_usb->iso_buffer = usb_alloc_coherent(fc_usb->udev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 			bufsize, GFP_KERNEL, &fc_usb->dma_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 	if (fc_usb->iso_buffer == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 	memset(fc_usb->iso_buffer, 0, bufsize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 	fc_usb->buffer_size = bufsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 	/* creating iso urbs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 	for (i = 0; i < B2C2_USB_NUM_ISO_URB; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 		fc_usb->iso_urb[i] = usb_alloc_urb(B2C2_USB_FRAMES_PER_ISO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 			GFP_ATOMIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 		if (fc_usb->iso_urb[i] == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 			ret = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 			goto urb_error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 	/* initialising and submitting iso urbs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 	for (i = 0; i < B2C2_USB_NUM_ISO_URB; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 		int frame_offset = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 		struct urb *urb = fc_usb->iso_urb[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 		deb_ts("initializing and submitting urb no. %d (buf_offset: %d).\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) 		       i, buffer_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 		urb->dev = fc_usb->udev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 		urb->context = fc_usb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) 		urb->complete = flexcop_usb_urb_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) 		urb->pipe = B2C2_USB_DATA_PIPE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 		urb->transfer_flags = URB_ISO_ASAP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 		urb->interval = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) 		urb->number_of_packets = B2C2_USB_FRAMES_PER_ISO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 		urb->transfer_buffer_length = frame_size * B2C2_USB_FRAMES_PER_ISO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) 		urb->transfer_buffer = fc_usb->iso_buffer + buffer_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) 		buffer_offset += frame_size * B2C2_USB_FRAMES_PER_ISO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) 		for (j = 0; j < B2C2_USB_FRAMES_PER_ISO; j++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 			deb_ts("urb no: %d, frame: %d, frame_offset: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) 					i, j, frame_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) 			urb->iso_frame_desc[j].offset = frame_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) 			urb->iso_frame_desc[j].length = frame_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) 			frame_offset += frame_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) 		if ((ret = usb_submit_urb(fc_usb->iso_urb[i],GFP_ATOMIC))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) 			err("submitting urb %d failed with %d.", i, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) 			goto urb_error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) 		deb_ts("submitted urb no. %d.\n",i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) 	/* SRAM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) 	flexcop_sram_set_dest(fc_usb->fc_dev, FC_SRAM_DEST_MEDIA |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) 			FC_SRAM_DEST_NET | FC_SRAM_DEST_CAO | FC_SRAM_DEST_CAI,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) 			FC_SRAM_DEST_TARGET_WAN_USB);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) 	flexcop_wan_set_speed(fc_usb->fc_dev, FC_WAN_SPEED_8MBITS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) 	flexcop_sram_ctrl(fc_usb->fc_dev, 1, 1, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) urb_error:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) 	flexcop_usb_transfer_exit(fc_usb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) static int flexcop_usb_init(struct flexcop_usb *fc_usb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) 	/* use the alternate setting with the larges buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 	int ret = usb_set_interface(fc_usb->udev, 0, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 		err("set interface failed.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) 	if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 	if (!usb_endpoint_is_isoc_in(&fc_usb->uintf->cur_altsetting->endpoint[1].desc))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) 	switch (fc_usb->udev->speed) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 	case USB_SPEED_LOW:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) 		err("cannot handle USB speed because it is too slow.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 	case USB_SPEED_FULL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) 		info("running at FULL speed.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) 	case USB_SPEED_HIGH:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) 		info("running at HIGH speed.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) 	case USB_SPEED_UNKNOWN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) 		err("cannot handle USB speed because it is unknown.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) 	usb_set_intfdata(fc_usb->uintf, fc_usb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) static void flexcop_usb_exit(struct flexcop_usb *fc_usb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 	usb_set_intfdata(fc_usb->uintf, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) static int flexcop_usb_probe(struct usb_interface *intf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) 		const struct usb_device_id *id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) 	struct usb_device *udev = interface_to_usbdev(intf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) 	struct flexcop_usb *fc_usb = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) 	struct flexcop_device *fc = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) 	if ((fc = flexcop_device_kmalloc(sizeof(struct flexcop_usb))) == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) 		err("out of memory\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) 	/* general flexcop init */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) 	fc_usb = fc->bus_specific;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) 	fc_usb->fc_dev = fc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) 	mutex_init(&fc_usb->data_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) 	fc->read_ibi_reg  = flexcop_usb_read_ibi_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) 	fc->write_ibi_reg = flexcop_usb_write_ibi_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) 	fc->i2c_request = flexcop_usb_i2c_request;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) 	fc->get_mac_addr = flexcop_usb_get_mac_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 	fc->stream_control = flexcop_usb_stream_control;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 	fc->pid_filtering = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) 	fc->bus_type = FC_USB;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 	fc->dev = &udev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) 	fc->owner = THIS_MODULE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) 	/* bus specific part */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) 	fc_usb->udev = udev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) 	fc_usb->uintf = intf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) 	if ((ret = flexcop_usb_init(fc_usb)) != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) 		goto err_kfree;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) 	/* init flexcop */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) 	if ((ret = flexcop_device_initialize(fc)) != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) 		goto err_usb_exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) 	/* xfer init */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) 	if ((ret = flexcop_usb_transfer_init(fc_usb)) != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) 		goto err_fc_exit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) 	info("%s successfully initialized and connected.", DRIVER_NAME);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) err_fc_exit:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) 	flexcop_device_exit(fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) err_usb_exit:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) 	flexcop_usb_exit(fc_usb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) err_kfree:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) 	flexcop_device_kfree(fc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) static void flexcop_usb_disconnect(struct usb_interface *intf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) 	struct flexcop_usb *fc_usb = usb_get_intfdata(intf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) 	flexcop_usb_transfer_exit(fc_usb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) 	flexcop_device_exit(fc_usb->fc_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) 	flexcop_usb_exit(fc_usb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) 	flexcop_device_kfree(fc_usb->fc_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) 	info("%s successfully deinitialized and disconnected.", DRIVER_NAME);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) static const struct usb_device_id flexcop_usb_table[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) 	{ USB_DEVICE(0x0af7, 0x0101) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) 	{ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) MODULE_DEVICE_TABLE (usb, flexcop_usb_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) /* usb specific object needed to register this driver with the usb subsystem */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) static struct usb_driver flexcop_usb_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) 	.name		= "b2c2_flexcop_usb",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) 	.probe		= flexcop_usb_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) 	.disconnect = flexcop_usb_disconnect,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) 	.id_table	= flexcop_usb_table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) module_usb_driver(flexcop_usb_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) MODULE_AUTHOR(DRIVER_AUTHOR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) MODULE_DESCRIPTION(DRIVER_NAME);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) MODULE_LICENSE("GPL");