aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/ezusb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/misc/ezusb.c')
-rw-r--r--drivers/usb/misc/ezusb.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/drivers/usb/misc/ezusb.c b/drivers/usb/misc/ezusb.c
index 6589268a6515..e712afed947c 100644
--- a/drivers/usb/misc/ezusb.c
+++ b/drivers/usb/misc/ezusb.c
@@ -15,6 +15,7 @@
15#include <linux/usb.h> 15#include <linux/usb.h>
16#include <linux/firmware.h> 16#include <linux/firmware.h>
17#include <linux/ihex.h> 17#include <linux/ihex.h>
18#include <linux/usb/ezusb.h>
18 19
19struct ezusb_fx_type { 20struct ezusb_fx_type {
20 /* EZ-USB Control and Status Register. Bit 0 controls 8051 reset */ 21 /* EZ-USB Control and Status Register. Bit 0 controls 8051 reset */
@@ -22,21 +23,16 @@ struct ezusb_fx_type {
22 unsigned short max_internal_adress; 23 unsigned short max_internal_adress;
23}; 24};
24 25
25struct ezusb_fx_type ezusb_fx1 = { 26static struct ezusb_fx_type ezusb_fx1 = {
26 .cpucs_reg = 0x7F92, 27 .cpucs_reg = 0x7F92,
27 .max_internal_adress = 0x1B3F, 28 .max_internal_adress = 0x1B3F,
28}; 29};
29 30
30struct ezusb_fx_type ezusb_fx2 = {
31 .cpucs_reg = 0xE600,
32 .max_internal_adress = 0x3FFF,
33};
34
35/* Commands for writing to memory */ 31/* Commands for writing to memory */
36#define WRITE_INT_RAM 0xA0 32#define WRITE_INT_RAM 0xA0
37#define WRITE_EXT_RAM 0xA3 33#define WRITE_EXT_RAM 0xA3
38 34
39int ezusb_writememory(struct usb_device *dev, int address, 35static int ezusb_writememory(struct usb_device *dev, int address,
40 unsigned char *data, int length, __u8 request) 36 unsigned char *data, int length, __u8 request)
41{ 37{
42 int result; 38 int result;
@@ -58,10 +54,9 @@ int ezusb_writememory(struct usb_device *dev, int address,
58 kfree(transfer_buffer); 54 kfree(transfer_buffer);
59 return result; 55 return result;
60} 56}
61EXPORT_SYMBOL_GPL(ezusb_writememory);
62 57
63int ezusb_set_reset(struct usb_device *dev, unsigned short cpucs_reg, 58static int ezusb_set_reset(struct usb_device *dev, unsigned short cpucs_reg,
64 unsigned char reset_bit) 59 unsigned char reset_bit)
65{ 60{
66 int response = ezusb_writememory(dev, cpucs_reg, &reset_bit, 1, WRITE_INT_RAM); 61 int response = ezusb_writememory(dev, cpucs_reg, &reset_bit, 1, WRITE_INT_RAM);
67 if (response < 0) 62 if (response < 0)
@@ -76,12 +71,6 @@ int ezusb_fx1_set_reset(struct usb_device *dev, unsigned char reset_bit)
76} 71}
77EXPORT_SYMBOL_GPL(ezusb_fx1_set_reset); 72EXPORT_SYMBOL_GPL(ezusb_fx1_set_reset);
78 73
79int ezusb_fx2_set_reset(struct usb_device *dev, unsigned char reset_bit)
80{
81 return ezusb_set_reset(dev, ezusb_fx2.cpucs_reg, reset_bit);
82}
83EXPORT_SYMBOL_GPL(ezusb_fx2_set_reset);
84
85static int ezusb_ihex_firmware_download(struct usb_device *dev, 74static int ezusb_ihex_firmware_download(struct usb_device *dev,
86 struct ezusb_fx_type fx, 75 struct ezusb_fx_type fx,
87 const char *firmware_path) 76 const char *firmware_path)
@@ -151,11 +140,28 @@ int ezusb_fx1_ihex_firmware_download(struct usb_device *dev,
151} 140}
152EXPORT_SYMBOL_GPL(ezusb_fx1_ihex_firmware_download); 141EXPORT_SYMBOL_GPL(ezusb_fx1_ihex_firmware_download);
153 142
143#if 0
144/*
145 * Once someone one needs these fx2 functions, uncomment them
146 * and add them to ezusb.h and all should be good.
147 */
148static struct ezusb_fx_type ezusb_fx2 = {
149 .cpucs_reg = 0xE600,
150 .max_internal_adress = 0x3FFF,
151};
152
153int ezusb_fx2_set_reset(struct usb_device *dev, unsigned char reset_bit)
154{
155 return ezusb_set_reset(dev, ezusb_fx2.cpucs_reg, reset_bit);
156}
157EXPORT_SYMBOL_GPL(ezusb_fx2_set_reset);
158
154int ezusb_fx2_ihex_firmware_download(struct usb_device *dev, 159int ezusb_fx2_ihex_firmware_download(struct usb_device *dev,
155 const char *firmware_path) 160 const char *firmware_path)
156{ 161{
157 return ezusb_ihex_firmware_download(dev, ezusb_fx2, firmware_path); 162 return ezusb_ihex_firmware_download(dev, ezusb_fx2, firmware_path);
158} 163}
159EXPORT_SYMBOL_GPL(ezusb_fx2_ihex_firmware_download); 164EXPORT_SYMBOL_GPL(ezusb_fx2_ihex_firmware_download);
165#endif
160 166
161MODULE_LICENSE("GPL"); 167MODULE_LICENSE("GPL");