diff options
author | Simon Arlott <simon@fire.lp0.eu> | 2009-11-21 10:15:47 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-02 17:53:01 -0500 |
commit | 817db5b34e70650c488f22b072b7efb950812adb (patch) | |
tree | 058facd7c16a943cdcafa26d600e057cdb244213 | |
parent | 4ac37208e9b30b36b615ed22a79b4ee787fdc9b5 (diff) |
USB: cxacru: remove cxacru-cf.bin loader
This has never worked properly because wsize passed to
cxacru_cm() is incorrectly set to the number of values
instead of the data bytes. The maximum number of values
that can be set at once is 7 which means the device will
not get enough data to work with and none of the
configuration values will be used.
At least one existing cxacru-cf.bin file contains invalid
data which will prevent the modem from syncing properly.
Fixing it is likely to break existing systems, and the
new sysfs interface for setting configuration parameters
can provide the same functionality. A script is provided
to convert from the original format.
Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | Documentation/networking/00-INDEX | 2 | ||||
-rw-r--r-- | Documentation/networking/cxacru-cf.py | 48 | ||||
-rw-r--r-- | Documentation/networking/cxacru.txt | 6 | ||||
-rw-r--r-- | drivers/usb/atm/cxacru.c | 31 |
4 files changed, 59 insertions, 28 deletions
diff --git a/Documentation/networking/00-INDEX b/Documentation/networking/00-INDEX index 50189bf07d53..fe5c099b8fc8 100644 --- a/Documentation/networking/00-INDEX +++ b/Documentation/networking/00-INDEX | |||
@@ -32,6 +32,8 @@ cs89x0.txt | |||
32 | - the Crystal LAN (CS8900/20-based) Ethernet ISA adapter driver | 32 | - the Crystal LAN (CS8900/20-based) Ethernet ISA adapter driver |
33 | cxacru.txt | 33 | cxacru.txt |
34 | - Conexant AccessRunner USB ADSL Modem | 34 | - Conexant AccessRunner USB ADSL Modem |
35 | cxacru-cf.py | ||
36 | - Conexant AccessRunner USB ADSL Modem configuration file parser | ||
35 | de4x5.txt | 37 | de4x5.txt |
36 | - the Digital EtherWORKS DE4?? and DE5?? PCI Ethernet driver | 38 | - the Digital EtherWORKS DE4?? and DE5?? PCI Ethernet driver |
37 | decnet.txt | 39 | decnet.txt |
diff --git a/Documentation/networking/cxacru-cf.py b/Documentation/networking/cxacru-cf.py new file mode 100644 index 000000000000..b41d298398c8 --- /dev/null +++ b/Documentation/networking/cxacru-cf.py | |||
@@ -0,0 +1,48 @@ | |||
1 | #!/usr/bin/env python | ||
2 | # Copyright 2009 Simon Arlott | ||
3 | # | ||
4 | # This program is free software; you can redistribute it and/or modify it | ||
5 | # under the terms of the GNU General Public License as published by the Free | ||
6 | # Software Foundation; either version 2 of the License, or (at your option) | ||
7 | # any later version. | ||
8 | # | ||
9 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | # more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License along with | ||
15 | # this program; if not, write to the Free Software Foundation, Inc., 59 | ||
16 | # Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
17 | # | ||
18 | # Usage: cxacru-cf.py < cxacru-cf.bin | ||
19 | # Output: values string suitable for the sysfs adsl_config attribute | ||
20 | # | ||
21 | # Warning: cxacru-cf.bin with MD5 hash cdbac2689969d5ed5d4850f117702110 | ||
22 | # contains mis-aligned values which will stop the modem from being able | ||
23 | # to make a connection. If the first and last two bytes are removed then | ||
24 | # the values become valid, but the modulation will be forced to ANSI | ||
25 | # T1.413 only which may not be appropriate. | ||
26 | # | ||
27 | # The original binary format is a packed list of le32 values. | ||
28 | |||
29 | import sys | ||
30 | import struct | ||
31 | |||
32 | i = 0 | ||
33 | while True: | ||
34 | buf = sys.stdin.read(4) | ||
35 | |||
36 | if len(buf) == 0: | ||
37 | break | ||
38 | elif len(buf) != 4: | ||
39 | sys.stdout.write("\n") | ||
40 | sys.stderr.write("Error: read {0} not 4 bytes\n".format(len(buf))) | ||
41 | sys.exit(1) | ||
42 | |||
43 | if i > 0: | ||
44 | sys.stdout.write(" ") | ||
45 | sys.stdout.write("{0:x}={1}".format(i, struct.unpack("<I", buf)[0])) | ||
46 | i += 1 | ||
47 | |||
48 | sys.stdout.write("\n") | ||
diff --git a/Documentation/networking/cxacru.txt b/Documentation/networking/cxacru.txt index f4fbf4cd592c..2cce04457b4d 100644 --- a/Documentation/networking/cxacru.txt +++ b/Documentation/networking/cxacru.txt | |||
@@ -4,6 +4,12 @@ While it is capable of managing/maintaining the ADSL connection without the | |||
4 | module loaded, the device will sometimes stop responding after unloading the | 4 | module loaded, the device will sometimes stop responding after unloading the |
5 | driver and it is necessary to unplug/remove power to the device to fix this. | 5 | driver and it is necessary to unplug/remove power to the device to fix this. |
6 | 6 | ||
7 | Note: support for cxacru-cf.bin has been removed. It was not loaded correctly | ||
8 | so it had no effect on the device configuration. Fixing it could have stopped | ||
9 | existing devices working when an invalid configuration is supplied. | ||
10 | |||
11 | There is a script cxacru-cf.py to convert an existing file to the sysfs form. | ||
12 | |||
7 | Detected devices will appear as ATM devices named "cxacru". In /sys/class/atm/ | 13 | Detected devices will appear as ATM devices named "cxacru". In /sys/class/atm/ |
8 | these are directories named cxacruN where N is the device number. A symlink | 14 | these are directories named cxacruN where N is the device number. A symlink |
9 | named device points to the USB interface device's directory which contains | 15 | named device points to the USB interface device's directory which contains |
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index c2163d0826e3..2490c81138ce 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c | |||
@@ -978,11 +978,9 @@ cleanup: | |||
978 | 978 | ||
979 | static void cxacru_upload_firmware(struct cxacru_data *instance, | 979 | static void cxacru_upload_firmware(struct cxacru_data *instance, |
980 | const struct firmware *fw, | 980 | const struct firmware *fw, |
981 | const struct firmware *bp, | 981 | const struct firmware *bp) |
982 | const struct firmware *cf) | ||
983 | { | 982 | { |
984 | int ret; | 983 | int ret; |
985 | int off; | ||
986 | struct usbatm_data *usbatm = instance->usbatm; | 984 | struct usbatm_data *usbatm = instance->usbatm; |
987 | struct usb_device *usb_dev = usbatm->usb_dev; | 985 | struct usb_device *usb_dev = usbatm->usb_dev; |
988 | __le16 signature[] = { usb_dev->descriptor.idVendor, | 986 | __le16 signature[] = { usb_dev->descriptor.idVendor, |
@@ -1066,24 +1064,6 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
1066 | usb_err(usbatm, "modem failed to initialize: %d\n", ret); | 1064 | usb_err(usbatm, "modem failed to initialize: %d\n", ret); |
1067 | return; | 1065 | return; |
1068 | } | 1066 | } |
1069 | |||
1070 | /* Load config data (le32), doing one packet at a time */ | ||
1071 | if (cf) | ||
1072 | for (off = 0; off < cf->size / 4; ) { | ||
1073 | __le32 buf[CMD_PACKET_SIZE / 4 - 1]; | ||
1074 | int i, len = min_t(int, cf->size / 4 - off, CMD_PACKET_SIZE / 4 / 2 - 1); | ||
1075 | buf[0] = cpu_to_le32(len); | ||
1076 | for (i = 0; i < len; i++, off++) { | ||
1077 | buf[i * 2 + 1] = cpu_to_le32(off); | ||
1078 | memcpy(buf + i * 2 + 2, cf->data + off * 4, 4); | ||
1079 | } | ||
1080 | ret = cxacru_cm(instance, CM_REQUEST_CARD_DATA_SET, | ||
1081 | (u8 *) buf, len, NULL, 0); | ||
1082 | if (ret < 0) { | ||
1083 | usb_err(usbatm, "load config data failed: %d\n", ret); | ||
1084 | return; | ||
1085 | } | ||
1086 | } | ||
1087 | } | 1067 | } |
1088 | 1068 | ||
1089 | static int cxacru_find_firmware(struct cxacru_data *instance, | 1069 | static int cxacru_find_firmware(struct cxacru_data *instance, |
@@ -1109,7 +1089,7 @@ static int cxacru_find_firmware(struct cxacru_data *instance, | |||
1109 | static int cxacru_heavy_init(struct usbatm_data *usbatm_instance, | 1089 | static int cxacru_heavy_init(struct usbatm_data *usbatm_instance, |
1110 | struct usb_interface *usb_intf) | 1090 | struct usb_interface *usb_intf) |
1111 | { | 1091 | { |
1112 | const struct firmware *fw, *bp, *cf; | 1092 | const struct firmware *fw, *bp; |
1113 | struct cxacru_data *instance = usbatm_instance->driver_data; | 1093 | struct cxacru_data *instance = usbatm_instance->driver_data; |
1114 | 1094 | ||
1115 | int ret = cxacru_find_firmware(instance, "fw", &fw); | 1095 | int ret = cxacru_find_firmware(instance, "fw", &fw); |
@@ -1127,13 +1107,8 @@ static int cxacru_heavy_init(struct usbatm_data *usbatm_instance, | |||
1127 | } | 1107 | } |
1128 | } | 1108 | } |
1129 | 1109 | ||
1130 | if (cxacru_find_firmware(instance, "cf", &cf)) /* optional */ | 1110 | cxacru_upload_firmware(instance, fw, bp); |
1131 | cf = NULL; | ||
1132 | |||
1133 | cxacru_upload_firmware(instance, fw, bp, cf); | ||
1134 | 1111 | ||
1135 | if (cf) | ||
1136 | release_firmware(cf); | ||
1137 | if (instance->modem_type->boot_rom_patch) | 1112 | if (instance->modem_type->boot_rom_patch) |
1138 | release_firmware(bp); | 1113 | release_firmware(bp); |
1139 | release_firmware(fw); | 1114 | release_firmware(fw); |