33 #include <linux/module.h>
34 #include <linux/kernel.h>
35 #include <linux/slab.h>
39 #define DRIVER_DESC "Cypress CY7C63xxx USB driver"
41 #define CYPRESS_VENDOR_ID 0xa2c
42 #define CYPRESS_PRODUCT_ID 0x8
44 #define CYPRESS_READ_PORT 0x4
45 #define CYPRESS_WRITE_PORT 0x5
47 #define CYPRESS_READ_RAM 0x2
48 #define CYPRESS_WRITE_RAM 0x3
49 #define CYPRESS_READ_ROM 0x1
51 #define CYPRESS_READ_PORT_ID0 0
52 #define CYPRESS_WRITE_PORT_ID0 0
53 #define CYPRESS_READ_PORT_ID1 0x2
54 #define CYPRESS_WRITE_PORT_ID1 1
56 #define CYPRESS_MAX_REQSIZE 8
88 dev_dbg(&dev->
udev->dev,
"Sending usb_control_msg (data: %d)\n", data);
91 pipe = usb_rcvctrlpipe(dev->
udev, 0);
95 USB_CTRL_GET_TIMEOUT);
101 dev->
port[0] = iobuf[1];
103 "READ_PORT0 returned: %d\n",
107 dev->
port[1] = iobuf[1];
109 "READ_PORT1 returned: %d\n",
129 struct cypress *cyp = usb_get_intfdata(intf);
131 dev_dbg(&cyp->
udev->dev,
"WRITE_PORT%d called\n", port_num);
134 if (
sscanf(buf,
"%d", &value) < 1) {
138 if (value < 0 || value > 255) {
144 (
unsigned char)value);
146 dev_dbg(&cyp->
udev->dev,
"Result of vendor_command: %d\n\n", result);
148 return result < 0 ? result :
count;
154 const char *buf,
size_t count)
162 const char *buf,
size_t count)
169 char *buf,
int port_num,
int read_id)
174 struct cypress *cyp = usb_get_intfdata(intf);
176 dev_dbg(&cyp->
udev->dev,
"READ_PORT%d called\n", port_num);
180 dev_dbg(&cyp->
udev->dev,
"Result of vendor_command: %d\n\n", result);
213 dev_err(&interface->dev,
"Out of memory!\n");
220 usb_set_intfdata(interface, dev);
232 "Cypress CY7C63xxx device now attached\n");
238 usb_set_intfdata(interface,
NULL);
246 static void cypress_disconnect(
struct usb_interface *interface)
250 dev = usb_get_intfdata(interface);
257 usb_set_intfdata(interface,
NULL);
262 "Cypress CY7C63xxx device now disconnected\n");
267 static struct usb_driver cypress_driver = {
268 .name =
"cypress_cy7c63",
269 .probe = cypress_probe,
270 .disconnect = cypress_disconnect,
271 .id_table = cypress_table,