diff options
author | Rene Buergel <rene.buergel@sohard.de> | 2012-09-18 03:00:41 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-18 12:23:47 -0400 |
commit | cc183e2a5ebfdddc8d3498149cae6b4c40551a68 (patch) | |
tree | c1e07cdd398ac4f535da041ada1cb9f145a36357 /drivers | |
parent | 9fa5780beea1274d498a224822397100022da7d4 (diff) |
USB: ezusb: add support for Cypress FX2LP
This Patch adds support for the newer Cypress FX2LP. It also adapts
three drivers currently using ezusb to the interface change. (whiteheat
and keyspan[_pda])
Signed-off-by: René Bürgel <rene.buergel@sohard.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/serial/ezusb.c | 37 | ||||
-rw-r--r-- | drivers/usb/serial/keyspan.c | 5 | ||||
-rw-r--r-- | drivers/usb/serial/keyspan_pda.c | 5 | ||||
-rw-r--r-- | drivers/usb/serial/whiteheat.c | 9 |
4 files changed, 42 insertions, 14 deletions
diff --git a/drivers/usb/serial/ezusb.c b/drivers/usb/serial/ezusb.c index a9b5263221fa..bc3076f2c066 100644 --- a/drivers/usb/serial/ezusb.c +++ b/drivers/usb/serial/ezusb.c | |||
@@ -14,11 +14,25 @@ | |||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/usb.h> | 15 | #include <linux/usb.h> |
16 | 16 | ||
17 | /* EZ-USB Control and Status Register. Bit 0 controls 8051 reset */ | 17 | struct ezusb_fx_type { |
18 | #define CPUCS_REG 0x7F92 | 18 | /* EZ-USB Control and Status Register. Bit 0 controls 8051 reset */ |
19 | unsigned short cpucs_reg; | ||
20 | unsigned short max_internal_adress; | ||
21 | }; | ||
19 | 22 | ||
20 | /* Command for writing to internal memory */ | 23 | struct ezusb_fx_type ezusb_fx1 = { |
24 | .cpucs_reg = 0x7F92, | ||
25 | .max_internal_adress = 0x1B3F, | ||
26 | }; | ||
27 | |||
28 | struct ezusb_fx_type ezusb_fx2 = { | ||
29 | .cpucs_reg = 0xE600, | ||
30 | .max_internal_adress = 0x3FFF, | ||
31 | }; | ||
32 | |||
33 | /* Commands for writing to memory */ | ||
21 | #define WRITE_INT_RAM 0xA0 | 34 | #define WRITE_INT_RAM 0xA0 |
35 | #define WRITE_EXT_RAM 0xA3 | ||
22 | 36 | ||
23 | int ezusb_writememory(struct usb_device *dev, int address, | 37 | int ezusb_writememory(struct usb_device *dev, int address, |
24 | unsigned char *data, int length, __u8 request) | 38 | unsigned char *data, int length, __u8 request) |
@@ -44,13 +58,24 @@ int ezusb_writememory(struct usb_device *dev, int address, | |||
44 | } | 58 | } |
45 | EXPORT_SYMBOL_GPL(ezusb_writememory); | 59 | EXPORT_SYMBOL_GPL(ezusb_writememory); |
46 | 60 | ||
47 | int ezusb_set_reset(struct usb_device *dev, unsigned char reset_bit) | 61 | int ezusb_set_reset(struct usb_device *dev, unsigned short cpucs_reg, |
62 | unsigned char reset_bit) | ||
48 | { | 63 | { |
49 | int response = ezusb_writememory(dev, CPUCS_REG, &reset_bit, 1, WRITE_INT_RAM); | 64 | int response = ezusb_writememory(dev, cpucs_reg, &reset_bit, 1, WRITE_INT_RAM); |
50 | if (response < 0) | 65 | if (response < 0) |
51 | dev_err(&dev->dev, "%s-%d failed: %d\n", | 66 | dev_err(&dev->dev, "%s-%d failed: %d\n", |
52 | __func__, reset_bit, response); | 67 | __func__, reset_bit, response); |
53 | return response; | 68 | return response; |
54 | } | 69 | } |
55 | EXPORT_SYMBOL_GPL(ezusb_set_reset); | ||
56 | 70 | ||
71 | int ezusb_fx1_set_reset(struct usb_device *dev, unsigned char reset_bit) | ||
72 | { | ||
73 | return ezusb_set_reset(dev, ezusb_fx1.cpucs_reg, reset_bit); | ||
74 | } | ||
75 | EXPORT_SYMBOL_GPL(ezusb_fx1_set_reset); | ||
76 | |||
77 | int ezusb_fx2_set_reset(struct usb_device *dev, unsigned char reset_bit) | ||
78 | { | ||
79 | return ezusb_set_reset(dev, ezusb_fx2.cpucs_reg, reset_bit); | ||
80 | } | ||
81 | EXPORT_SYMBOL_GPL(ezusb_fx2_set_reset); | ||
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 566056cb04dc..4f25849d343e 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/uaccess.h> | 43 | #include <linux/uaccess.h> |
44 | #include <linux/usb.h> | 44 | #include <linux/usb.h> |
45 | #include <linux/usb/serial.h> | 45 | #include <linux/usb/serial.h> |
46 | #include <linux/usb/ezusb.h> | ||
46 | #include "keyspan.h" | 47 | #include "keyspan.h" |
47 | 48 | ||
48 | /* | 49 | /* |
@@ -1245,7 +1246,7 @@ static int keyspan_fake_startup(struct usb_serial *serial) | |||
1245 | dev_dbg(&serial->dev->dev, "Uploading Keyspan %s firmware.\n", fw_name); | 1246 | dev_dbg(&serial->dev->dev, "Uploading Keyspan %s firmware.\n", fw_name); |
1246 | 1247 | ||
1247 | /* download the firmware image */ | 1248 | /* download the firmware image */ |
1248 | response = ezusb_set_reset(serial->dev, 1); | 1249 | response = ezusb_fx1_set_reset(serial->dev, 1); |
1249 | 1250 | ||
1250 | record = (const struct ihex_binrec *)fw->data; | 1251 | record = (const struct ihex_binrec *)fw->data; |
1251 | 1252 | ||
@@ -1264,7 +1265,7 @@ static int keyspan_fake_startup(struct usb_serial *serial) | |||
1264 | release_firmware(fw); | 1265 | release_firmware(fw); |
1265 | /* bring device out of reset. Renumeration will occur in a | 1266 | /* bring device out of reset. Renumeration will occur in a |
1266 | moment and the new device will bind to the real driver */ | 1267 | moment and the new device will bind to the real driver */ |
1267 | response = ezusb_set_reset(serial->dev, 0); | 1268 | response = ezusb_fx1_set_reset(serial->dev, 0); |
1268 | 1269 | ||
1269 | /* we don't want this device to have a driver assigned to it. */ | 1270 | /* we don't want this device to have a driver assigned to it. */ |
1270 | return 1; | 1271 | return 1; |
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index 124d4e5d3d10..39ab6687ce23 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/uaccess.h> | 30 | #include <linux/uaccess.h> |
31 | #include <linux/usb.h> | 31 | #include <linux/usb.h> |
32 | #include <linux/usb/serial.h> | 32 | #include <linux/usb/serial.h> |
33 | #include <linux/usb/ezusb.h> | ||
33 | 34 | ||
34 | /* make a simple define to handle if we are compiling keyspan_pda or xircom support */ | 35 | /* make a simple define to handle if we are compiling keyspan_pda or xircom support */ |
35 | #if defined(CONFIG_USB_SERIAL_KEYSPAN_PDA) || defined(CONFIG_USB_SERIAL_KEYSPAN_PDA_MODULE) | 36 | #if defined(CONFIG_USB_SERIAL_KEYSPAN_PDA) || defined(CONFIG_USB_SERIAL_KEYSPAN_PDA_MODULE) |
@@ -678,7 +679,7 @@ static int keyspan_pda_fake_startup(struct usb_serial *serial) | |||
678 | const struct firmware *fw; | 679 | const struct firmware *fw; |
679 | 680 | ||
680 | /* download the firmware here ... */ | 681 | /* download the firmware here ... */ |
681 | response = ezusb_set_reset(serial->dev, 1); | 682 | response = ezusb_fx1_set_reset(serial->dev, 1); |
682 | 683 | ||
683 | if (0) { ; } | 684 | if (0) { ; } |
684 | #ifdef KEYSPAN | 685 | #ifdef KEYSPAN |
@@ -718,7 +719,7 @@ static int keyspan_pda_fake_startup(struct usb_serial *serial) | |||
718 | release_firmware(fw); | 719 | release_firmware(fw); |
719 | /* bring device out of reset. Renumeration will occur in a moment | 720 | /* bring device out of reset. Renumeration will occur in a moment |
720 | and the new device will bind to the real driver */ | 721 | and the new device will bind to the real driver */ |
721 | response = ezusb_set_reset(serial->dev, 0); | 722 | response = ezusb_fx1_set_reset(serial->dev, 0); |
722 | 723 | ||
723 | /* we want this device to fail to have a driver assigned to it. */ | 724 | /* we want this device to fail to have a driver assigned to it. */ |
724 | return 1; | 725 | return 1; |
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 80555fc8c95d..8172ea3aead0 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/serial_reg.h> | 32 | #include <linux/serial_reg.h> |
33 | #include <linux/serial.h> | 33 | #include <linux/serial.h> |
34 | #include <linux/usb/serial.h> | 34 | #include <linux/usb/serial.h> |
35 | #include <linux/usb/ezusb.h> | ||
35 | #include <linux/firmware.h> | 36 | #include <linux/firmware.h> |
36 | #include <linux/ihex.h> | 37 | #include <linux/ihex.h> |
37 | #include "whiteheat.h" /* WhiteHEAT specific commands */ | 38 | #include "whiteheat.h" /* WhiteHEAT specific commands */ |
@@ -211,7 +212,7 @@ static int whiteheat_firmware_download(struct usb_serial *serial, | |||
211 | goto out; | 212 | goto out; |
212 | } | 213 | } |
213 | ret = 0; | 214 | ret = 0; |
214 | response = ezusb_set_reset(serial->dev, 1); | 215 | response = ezusb_fx1_set_reset(serial->dev, 1); |
215 | 216 | ||
216 | record = (const struct ihex_binrec *)loader_fw->data; | 217 | record = (const struct ihex_binrec *)loader_fw->data; |
217 | while (record) { | 218 | while (record) { |
@@ -228,7 +229,7 @@ static int whiteheat_firmware_download(struct usb_serial *serial, | |||
228 | record = ihex_next_binrec(record); | 229 | record = ihex_next_binrec(record); |
229 | } | 230 | } |
230 | 231 | ||
231 | response = ezusb_set_reset(serial->dev, 0); | 232 | response = ezusb_fx1_set_reset(serial->dev, 0); |
232 | 233 | ||
233 | record = (const struct ihex_binrec *)firmware_fw->data; | 234 | record = (const struct ihex_binrec *)firmware_fw->data; |
234 | while (record && be32_to_cpu(record->addr) < 0x1b40) | 235 | while (record && be32_to_cpu(record->addr) < 0x1b40) |
@@ -248,7 +249,7 @@ static int whiteheat_firmware_download(struct usb_serial *serial, | |||
248 | ++record; | 249 | ++record; |
249 | } | 250 | } |
250 | 251 | ||
251 | response = ezusb_set_reset(serial->dev, 1); | 252 | response = ezusb_fx1_set_reset(serial->dev, 1); |
252 | 253 | ||
253 | record = (const struct ihex_binrec *)firmware_fw->data; | 254 | record = (const struct ihex_binrec *)firmware_fw->data; |
254 | while (record && be32_to_cpu(record->addr) < 0x1b40) { | 255 | while (record && be32_to_cpu(record->addr) < 0x1b40) { |
@@ -266,7 +267,7 @@ static int whiteheat_firmware_download(struct usb_serial *serial, | |||
266 | ++record; | 267 | ++record; |
267 | } | 268 | } |
268 | ret = 0; | 269 | ret = 0; |
269 | response = ezusb_set_reset(serial->dev, 0); | 270 | response = ezusb_fx1_set_reset(serial->dev, 0); |
270 | out: | 271 | out: |
271 | release_firmware(loader_fw); | 272 | release_firmware(loader_fw); |
272 | release_firmware(firmware_fw); | 273 | release_firmware(firmware_fw); |