summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-08-08 12:37:17 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-08-08 12:37:17 +0000
commit9aa9eb41942b918f385ccabd2efdd6e7e4232165 (patch)
tree20bec7da036d31ec185dfc1dcc00753c7ac9b170 /drivers/usb
parent87075e049581f880f01eb0b41aa6ac807b299e35 (diff)
Merge with Linux 2.4.0-test6-pre1.
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/acm.c3
-rw-r--r--drivers/usb/audio.c2
-rw-r--r--drivers/usb/dabusb.c1
-rw-r--r--drivers/usb/dsbr100.c3
-rw-r--r--drivers/usb/evdev.c3
-rw-r--r--drivers/usb/hid.c3
-rw-r--r--drivers/usb/ibmcam.c15
-rw-r--r--drivers/usb/iforce.c1
-rw-r--r--drivers/usb/input.c1
-rw-r--r--drivers/usb/joydev.c1
-rw-r--r--drivers/usb/keybdev.c3
-rw-r--r--drivers/usb/microtek.c3
-rw-r--r--drivers/usb/mousedev.c3
-rw-r--r--drivers/usb/ov511.c11
-rw-r--r--drivers/usb/pegasus.c2
-rw-r--r--drivers/usb/printer.c3
-rw-r--r--drivers/usb/rio500.c2
-rw-r--r--drivers/usb/serial/Makefile8
-rw-r--r--drivers/usb/serial/digi_acceleport.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.c2
-rw-r--r--drivers/usb/serial/keyspan.c2
-rw-r--r--drivers/usb/serial/keyspan_pda.c2
-rw-r--r--drivers/usb/serial/visor.c2
-rw-r--r--drivers/usb/serial/whiteheat.c2
-rw-r--r--drivers/usb/storage/Makefile7
-rw-r--r--drivers/usb/storage/scsiglue.c17
-rw-r--r--drivers/usb/storage/scsiglue.h3
-rw-r--r--drivers/usb/storage/sddr09.c635
-rw-r--r--drivers/usb/storage/sddr09.h31
-rw-r--r--drivers/usb/storage/shuttle_usbat.c (renamed from drivers/usb/storage/scm.c)651
-rw-r--r--drivers/usb/storage/shuttle_usbat.h (renamed from drivers/usb/storage/scm.h)60
-rw-r--r--drivers/usb/storage/transport.c34
-rw-r--r--drivers/usb/storage/transport.h9
-rw-r--r--drivers/usb/storage/usb.c44
-rw-r--r--drivers/usb/uhci.c4
-rw-r--r--drivers/usb/usb-ohci.c59
-rw-r--r--drivers/usb/usb-uhci.c2
-rw-r--r--drivers/usb/usbkbd.c1
-rw-r--r--drivers/usb/usbmouse.c1
-rw-r--r--drivers/usb/wacom.c1
40 files changed, 1159 insertions, 480 deletions
diff --git a/drivers/usb/acm.c b/drivers/usb/acm.c
index b60733b4a..49f881a8c 100644
--- a/drivers/usb/acm.c
+++ b/drivers/usb/acm.c
@@ -689,3 +689,6 @@ static void __exit acm_exit(void)
module_init(acm_init);
module_exit(acm_exit);
+
+MODULE_AUTHOR("Armin Fuerst, Pavel Machek, Johannes Erdfelt, Vojtech Pavlik");
+MODULE_DESCRIPTION("USB Abstract Control Model driver for USB modems and ISDN adapters");
diff --git a/drivers/usb/audio.c b/drivers/usb/audio.c
index 4560ad602..5d6def562 100644
--- a/drivers/usb/audio.c
+++ b/drivers/usb/audio.c
@@ -3732,4 +3732,6 @@ void cleanup_module(void)
usb_deregister(&usb_audio_driver);
}
+MODULE_AUTHOR("Alan Cox <alan@lxorguk.ukuu.org.uk>, Thomas Sailer (sailer@ife.ee.ethz.ch)");
+MODULE_DESCRIPTION("USB Audio Class driver");
#endif
diff --git a/drivers/usb/dabusb.c b/drivers/usb/dabusb.c
index 7b19729a9..d04d3eaaa 100644
--- a/drivers/usb/dabusb.c
+++ b/drivers/usb/dabusb.c
@@ -841,6 +841,7 @@ void __exit dabusb_cleanup (void)
MODULE_AUTHOR ("Deti Fliegl, deti@fliegl.de");
MODULE_DESCRIPTION ("DAB-USB Interface Driver for Linux (c)1999");
MODULE_PARM (buffers, "i");
+MODULE_PARM_DESC (buffers, "Number of buffers (default=256)");
int __init init_module (void)
{
diff --git a/drivers/usb/dsbr100.c b/drivers/usb/dsbr100.c
index e2056a2e3..6ffffdc6f 100644
--- a/drivers/usb/dsbr100.c
+++ b/drivers/usb/dsbr100.c
@@ -347,6 +347,9 @@ void cleanup_module(void)
usb_deregister(&usb_dsbr100_driver);
}
+MODULE_AUTHOR("Markus Demleitner <msdemlei@tucana.harvard.edu>");
+MODULE_DESCRIPTION("D-Link DSB-R100 USB radio driver");
+
/*
vi: ts=8
Sigh. Of course, I am one of the ts=2 heretics, but Linus' wish is
diff --git a/drivers/usb/evdev.c b/drivers/usb/evdev.c
index e11327cef..65109e9ca 100644
--- a/drivers/usb/evdev.c
+++ b/drivers/usb/evdev.c
@@ -351,3 +351,6 @@ static void __exit evdev_exit(void)
module_init(evdev_init);
module_exit(evdev_exit);
+
+MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
+MODULE_DESCRIPTION("Event character device driver");
diff --git a/drivers/usb/hid.c b/drivers/usb/hid.c
index ae529b746..68a981e27 100644
--- a/drivers/usb/hid.c
+++ b/drivers/usb/hid.c
@@ -1524,3 +1524,6 @@ static void __exit hid_exit(void)
module_init(hid_init);
module_exit(hid_exit);
+
+MODULE_AUTHOR("Andreas Gal, Vojtech Pavlik <vojtech@suse.cz>");
+MODULE_DESCRIPTION("USB HID support drivers");
diff --git a/drivers/usb/ibmcam.c b/drivers/usb/ibmcam.c
index d70c99ddf..6b85a15f0 100644
--- a/drivers/usb/ibmcam.c
+++ b/drivers/usb/ibmcam.c
@@ -127,21 +127,36 @@ static int init_model2_sat = -1;
static int init_model2_yb = -1;
MODULE_PARM(debug, "i");
+MODULE_PARM_DESC(debug, "Debug level: 0-9 (default=0)");
MODULE_PARM(flags, "i");
+MODULE_PARM_DESC(flags, "Bitfield: 0=VIDIOCSYNC, 1=B/W, 2=show hints, 3=show stats, 4=test pattern, 5=seperate frames, 6=clean frames");
MODULE_PARM(framerate, "i");
+MODULE_PARM_DESC(framerate, "Framerate setting: 0=slowest, 6=fastest (default=2)");
MODULE_PARM(lighting, "i");
+MODULE_PARM_DESC(lighting, "Photosensitivity: 0=bright, 1=medium (default), 2=low light");
MODULE_PARM(sharpness, "i");
+MODULE_PARM_DESC(sharpness, "Model1 noise reduction: 0=smooth, 6=sharp (default=4)");
MODULE_PARM(videosize, "i");
+MODULE_PARM_DESC(videosize, "Image size: 0=128x96, 1=176x144, 2=352x288, 3=320x240, 4=352x240 (default=1)");
MODULE_PARM(init_brightness, "i");
+MODULE_PARM_DESC(init_brightness, "Brightness preconfiguration: 0-255 (default=128)");
MODULE_PARM(init_contrast, "i");
+MODULE_PARM_DESC(init_contrast, "Contrast preconfiguration: 0-255 (default=192)");
MODULE_PARM(init_color, "i");
+MODULE_PARM_DESC(init_color, "Dolor preconfiguration: 0-255 (default=128)");
MODULE_PARM(init_hue, "i");
+MODULE_PARM_DESC(init_hue, "Hue preconfiguration: 0-255 (default=128)");
MODULE_PARM(hue_correction, "i");
+MODULE_PARM_DESC(hue_correction, "YUV colorspace regulation: 0-255 (default=128)");
MODULE_PARM(init_model2_rg, "i");
+MODULE_PARM_DESC(init_model2_rg, "Model2 preconfiguration: 0-255 (default=112)");
MODULE_PARM(init_model2_rg2, "i");
+MODULE_PARM_DESC(init_model2_rg2, "Model2 preconfiguration: 0-255 (default=47)");
MODULE_PARM(init_model2_sat, "i");
+MODULE_PARM_DESC(init_model2_sat, "Model2 preconfiguration: 0-255 (default=52)");
MODULE_PARM(init_model2_yb, "i");
+MODULE_PARM_DESC(init_model2_yb, "Model2 preconfiguration: 0-255 (default=160)");
MODULE_AUTHOR ("module author");
MODULE_DESCRIPTION ("IBM/Xirlink C-it USB Camera Driver for Linux (c) 2000");
diff --git a/drivers/usb/iforce.c b/drivers/usb/iforce.c
index a61b7801f..d70bfd90e 100644
--- a/drivers/usb/iforce.c
+++ b/drivers/usb/iforce.c
@@ -38,6 +38,7 @@
#include <linux/config.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
+MODULE_DESCRIPTION("USB/RS232 I-Force joysticks and wheels driver");
#define USB_VENDOR_ID_LOGITECH 0x046d
#define USB_DEVICE_ID_LOGITECH_WMFORCE 0xc281
diff --git a/drivers/usb/input.c b/drivers/usb/input.c
index 98f1a1109..f3701965e 100644
--- a/drivers/usb/input.c
+++ b/drivers/usb/input.c
@@ -34,6 +34,7 @@
#include <linux/random.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
+MODULE_DESCRIPTION("Input layer module");
EXPORT_SYMBOL(input_register_device);
EXPORT_SYMBOL(input_unregister_device);
diff --git a/drivers/usb/joydev.c b/drivers/usb/joydev.c
index 2210ad0d1..99b17a3cd 100644
--- a/drivers/usb/joydev.c
+++ b/drivers/usb/joydev.c
@@ -83,6 +83,7 @@ struct joydev_list {
static struct joydev *joydev_table[JOYDEV_MINORS];
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
+MODULE_DESCRIPTION("Joystick device driver");
MODULE_SUPPORTED_DEVICE("input/js");
static int joydev_correct(int value, struct js_corr *corr)
diff --git a/drivers/usb/keybdev.c b/drivers/usb/keybdev.c
index 76496349b..95fce5e80 100644
--- a/drivers/usb/keybdev.c
+++ b/drivers/usb/keybdev.c
@@ -195,3 +195,6 @@ static void __exit keybdev_exit(void)
module_init(keybdev_init);
module_exit(keybdev_exit);
+
+MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
+MODULE_DESCRIPTION("Input driver to keyboard driver binding");
diff --git a/drivers/usb/microtek.c b/drivers/usb/microtek.c
index a3de2b732..b8eb74c77 100644
--- a/drivers/usb/microtek.c
+++ b/drivers/usb/microtek.c
@@ -1050,3 +1050,6 @@ void __exit microtek_drv_exit(void)
module_init(microtek_drv_init);
module_exit(microtek_drv_exit);
+
+MODULE_AUTHOR("John Fremlin <vii@penguinpowered.com>, Oliver Neukum <Oliver.Neukum@lrz.uni-muenchen.de>");
+MODULE_DESCRIPTION("Microtek Scanmaker X6 USB scanner driver");
diff --git a/drivers/usb/mousedev.c b/drivers/usb/mousedev.c
index ea5ad301b..ccb118520 100644
--- a/drivers/usb/mousedev.c
+++ b/drivers/usb/mousedev.c
@@ -481,3 +481,6 @@ static void __exit mousedev_exit(void)
module_init(mousedev_init);
module_exit(mousedev_exit);
+
+MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
+MODULE_DESCRIPTION("Input driver to PS/2 or ImPS/2 device driver");
diff --git a/drivers/usb/ov511.c b/drivers/usb/ov511.c
index 462a49957..73e3a5be1 100644
--- a/drivers/usb/ov511.c
+++ b/drivers/usb/ov511.c
@@ -108,16 +108,27 @@ static int cams = 1;
static int retry_sync = 0;
MODULE_PARM(autoadjust, "i");
+MODULE_PARM_DESC(autoadjust, "CCD dynamically changes exposure");
MODULE_PARM(debug, "i");
+MODULE_PARM_DESC(debug, "Debug level: 0=none, 1=init/detection, 2=warning, 3=config/control, 4=function call, 5=max");
MODULE_PARM(fix_rgb_offset, "i");
+MODULE_PARM_DESC(fix_rgb_offset, "Fix vertical misalignment of red and blue at 640x480");
MODULE_PARM(snapshot, "i");
+MODULE_PARM_DESC(snapshot, "Enable snapshot mode");
MODULE_PARM(sensor, "i");
+MODULE_PARM_DESC(sensor, "Override sensor detection");
MODULE_PARM(i2c_detect_tries, "i");
+MODULE_PARM_DESC(i2c_detect_tries, "Number of tries to detect sensor");
MODULE_PARM(aperture, "i");
+MODULE_PARM_DESC(aperture, "Read the OV7610/7620 specs");
MODULE_PARM(force_rgb, "i");
+MODULE_PARM_DESC(force_rgb, "Read RBG instead of BGR");
MODULE_PARM(buf_timeout, "i");
+MODULE_PARM_DESC(buf_timeout, "Number of seconds before buffer deallocation");
MODULE_PARM(cams, "i");
+MODULE_PARM_DESC(cams, "Number of simultaneous cameras");
MODULE_PARM(retry_sync, "i");
+MODULE_PARM_DESC(retry_sync, "Prevent apps from timing out");
MODULE_AUTHOR("Mark McClelland <mmcclelland@delphi.com> & Bret Wallach & Orion Sky Lawlor <olawlor@acm.org> & Kevin Moore & Charl P. Botha <cpbotha@ieee.org> & Claudio Matsuoka <claudio@conectiva.com>");
MODULE_DESCRIPTION("OV511 USB Camera Driver");
diff --git a/drivers/usb/pegasus.c b/drivers/usb/pegasus.c
index 8c588f79e..0a264faaf 100644
--- a/drivers/usb/pegasus.c
+++ b/drivers/usb/pegasus.c
@@ -103,7 +103,7 @@ static int multicast_filter_limit = 32;
MODULE_AUTHOR("Petko Manolov <petkan@spct.net>");
MODULE_DESCRIPTION("ADMtek AN986 Pegasus USB Ethernet driver");
MODULE_PARM(loopback, "i");
-
+MODULE_PARM_DESC(loopback, "Enable loopback mode (Bit 0) and ??? (Bit 1)");
static struct usb_eth_dev usb_dev_id[] = {
{"Billionton USB-100", 0x08dd, 0x0986, NULL},
diff --git a/drivers/usb/printer.c b/drivers/usb/printer.c
index 987f1a8b5..96fa971d8 100644
--- a/drivers/usb/printer.c
+++ b/drivers/usb/printer.c
@@ -527,3 +527,6 @@ static void __exit usblp_exit(void)
module_init(usblp_init);
module_exit(usblp_exit);
+
+MODULE_AUTHOR("Michael Gee, Pavel Machek, Vojtech Pavlik, Randy Dunlap");
+MODULE_DESCRIPTION("USB Printer Device Class driver");
diff --git a/drivers/usb/rio500.c b/drivers/usb/rio500.c
index 011f853f6..c84a01fa6 100644
--- a/drivers/usb/rio500.c
+++ b/drivers/usb/rio500.c
@@ -445,3 +445,5 @@ void usb_rio_cleanup(void)
module_init(usb_rio_init);
module_exit(usb_rio_cleanup);
+MODULE_AUTHOR("Cesar Miquel <miquel@df.uba.ar>");
+MODULE_DESCRIPTION("USB Rio 500 driver");
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index 146090ab2..31f913ff9 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -14,13 +14,7 @@ obj-m :=
obj-n :=
obj- :=
-ifeq ($(CONFIG_USB_SERIAL),y)
- obj-y += usbserial.o
-endif
-ifeq ($(CONFIG_USB_SERIAL),m)
- obj-m += usbserial.o
-endif
-
+obj-$(CONFIG_USB_SERIAL) += usbserial.o
obj-$(CONFIG_USB_SERIAL_VISOR) += visor.o
obj-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat.o
obj-$(CONFIG_USB_SERIAL_FTDI_SIO) += ftdi_sio.o
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index 9ecd1370b..c5c403b2b 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -1768,4 +1768,6 @@ void digi_exit (void)
module_init(digi_init);
module_exit(digi_exit);
+MODULE_AUTHOR("Peter Berger <pberger@brimson.com>, Al Borchers <borchers@steinerpoint.com>");
+MODULE_DESCRIPTION("Digi AccelePort USB-4 Serial Converter driver");
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index f78ff752b..aa156ba8d 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -741,3 +741,5 @@ void ftdi_sio_exit (void)
module_init(ftdi_sio_init);
module_exit(ftdi_sio_exit);
+MODULE_AUTHOR("Greg Kroah-Hartman <greg@kroah.com>, Bill Ryder <bryder@sgi.com>");
+MODULE_DESCRIPTION("USB FTDI SIO driver");
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 2fecdca12..64a1f709e 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -721,3 +721,5 @@ void keyspan_exit (void)
module_init(keyspan_init);
module_exit(keyspan_exit);
+MODULE_AUTHOR("Hugh Blemings <hugh@linuxcare.com>");
+MODULE_DESCRIPTION("Keyspan USB to Serial Converter driver");
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index aca2a38c5..675764ad4 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -720,3 +720,5 @@ void keyspan_pda_exit (void)
module_init(keyspan_pda_init);
module_exit(keyspan_pda_exit);
+MODULE_AUTHOR("Brian Warner <warner@lothar.com>");
+MODULE_DESCRIPTION("USB Keyspan PDA Converter driver");
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index f8145c37f..568f2b5cd 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -434,3 +434,5 @@ void visor_exit (void)
module_init(visor_init);
module_exit(visor_exit);
+MODULE_AUTHOR("Greg Kroah-Hartman <greg@kroah.com>");
+MODULE_DESCRIPTION("USB HandSpring Visor driver");
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index a6ca6ebcb..7ec405501 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -549,3 +549,5 @@ void whiteheat_exit (void)
module_init(whiteheat_init);
module_exit(whiteheat_exit);
+MODULE_AUTHOR("Greg Kroah-Hartman <greg@kroah.com>");
+MODULE_DESCRIPTION("USB ConnectTech WhiteHEAT driver");
diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile
index aaf1072db..1b204ab28 100644
--- a/drivers/usb/storage/Makefile
+++ b/drivers/usb/storage/Makefile
@@ -12,18 +12,19 @@ CFLAGS_protocol.o:= -I../../scsi/
CFLAGS_transport.o:= -I../../scsi/
CFLAGS_debug.o:= -I../../scsi/
CFLAGS_usb.o:= -I../../scsi/
-CFLAGS_scm.o:= -I../../scsi/
+CFLAGS_shuttle_usbat.o:= -I../../scsi/
+CFLAGS_sddr09.o:= -I../../scsi/
ifeq ($(CONFIG_USB_STORAGE_DEBUG),y)
O_OBJS += debug.o
endif
ifeq ($(CONFIG_USB_STORAGE_HP8200e),y)
- O_OBJS += scm.o
+ O_OBJS += shuttle_usbat.o
endif
ifeq ($(CONFIG_USB_STORAGE_SDDR09),y)
- O_OBJS += scm.o
+ O_OBJS += sddr09.o
endif
ifeq ($(CONFIG_USB_STORAGE_FREECOM),y)
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 21fe3ec97..25328669b 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -1,7 +1,7 @@
/* Driver for USB Mass Storage compliant devices
* SCSI layer glue code
*
- * $Id: scsiglue.c,v 1.5 2000/07/24 18:55:39 mdharm Exp $
+ * $Id: scsiglue.c,v 1.6 2000/07/25 23:04:47 mdharm Exp $
*
* Current development and maintainance by:
* (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
@@ -49,21 +49,6 @@
#include <linux/malloc.h>
-/* direction table -- this indicates the direction of the data
- * transfer for each command code -- a 1 indicates input
- */
-/* FIXME: we need to use the new direction indicators in the Scsi_Cmnd
- * structure, not this table. First we need to evaluate if it's being set
- * correctly for us, though
- */
-unsigned char us_direction[256/8] = {
- 0x28, 0x81, 0x14, 0x14, 0x20, 0x01, 0x90, 0x77,
- 0x0C, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-
/*
* kernel thread actions
*/
diff --git a/drivers/usb/storage/scsiglue.h b/drivers/usb/storage/scsiglue.h
index e9da1bcc0..f81787678 100644
--- a/drivers/usb/storage/scsiglue.h
+++ b/drivers/usb/storage/scsiglue.h
@@ -1,7 +1,7 @@
/* Driver for USB Mass Storage compliant devices
* SCSI Connecting Glue Header File
*
- * $Id: scsiglue.h,v 1.2 2000/07/19 22:12:07 mdharm Exp $
+ * $Id: scsiglue.h,v 1.3 2000/07/25 23:04:47 mdharm Exp $
*
* Current development and maintainance by:
* (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
@@ -46,7 +46,6 @@
#include "hosts.h"
extern unsigned char usb_stor_sense_notready[18];
-extern unsigned char us_direction[256/8];
extern Scsi_Host_Template usb_stor_host_template;
extern int usb_stor_scsiSense10to6(Scsi_Cmnd*);
extern int usb_stor_scsiSense6to10(Scsi_Cmnd*);
diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
new file mode 100644
index 000000000..275712961
--- /dev/null
+++ b/drivers/usb/storage/sddr09.c
@@ -0,0 +1,635 @@
+/* Driver for SanDisk SDDR-09 SmartMedia reader
+ *
+ * SDDR09 driver v0.1:
+ *
+ * First release
+ *
+ * Current development and maintainance by:
+ * (c) 2000 Robert Baruch (autophile@dol.net)
+ *
+ * The SanDisk SDDR-09 SmartMedia reader uses the Shuttle EUSB-01 chip.
+ * This chip is a programmable USB controller. In the SDDR-09, it has
+ * been programmed to obey a certain limited set of SCSI commands. This
+ * driver translates the "real" SCSI commands to the SDDR-09 SCSI
+ * commands.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "transport.h"
+#include "protocol.h"
+#include "usb.h"
+#include "debug.h"
+#include "sddr09.h"
+
+#include <linux/sched.h>
+#include <linux/errno.h>
+#include <linux/malloc.h>
+
+extern int usb_stor_control_msg(struct us_data *us, unsigned int pipe,
+ u8 request, u8 requesttype, u16 value, u16 index,
+ void *data, u16 size);
+extern int usb_stor_bulk_msg(struct us_data *us, void *data, int pipe,
+ unsigned int len, unsigned int *act_len);
+
+#define short_pack(b1,b2) ( ((u16)(b1)) | ( ((u16)(b2))<<8 ) )
+#define LSB_of(s) ((s)&0xFF)
+#define MSB_of(s) ((s)>>8)
+
+/*
+ * Send a control message and wait for the response.
+ *
+ * us - the pointer to the us_data structure for the device to use
+ *
+ * request - the URB Setup Packet's first 6 bytes. The first byte always
+ * corresponds to the request type, and the second byte always corresponds
+ * to the request. The other 4 bytes do not correspond to value and index,
+ * since they are used in a custom way by the SCM protocol.
+ *
+ * xfer_data - a buffer from which to get, or to which to store, any data
+ * that gets send or received, respectively, with the URB. Even though
+ * it looks like we allocate a buffer in this code for the data, xfer_data
+ * must contain enough allocated space.
+ *
+ * xfer_len - the number of bytes to send or receive with the URB.
+ *
+ */
+
+static int sddr09_send_control(struct us_data *us,
+ int pipe,
+ unsigned char request,
+ unsigned char requesttype,
+ unsigned short value,
+ unsigned short index,
+ unsigned char *xfer_data,
+ unsigned int xfer_len) {
+
+ int result;
+
+ // If data is going to be sent or received with the URB,
+ // then allocate a buffer for it. If data is to be sent,
+ // copy the data into the buffer.
+/*
+ if (xfer_len > 0) {
+ buffer = kmalloc(xfer_len, GFP_KERNEL);
+ if (!(command[0] & USB_DIR_IN))
+ memcpy(buffer, xfer_data, xfer_len);
+ }
+*/
+ // Send the URB to the device and wait for a response.
+
+ /* Why are request and request type reversed in this call? */
+
+ result = usb_stor_control_msg(us, pipe,
+ request, requesttype, value, index,
+ xfer_data, xfer_len);
+
+
+ // If data was sent or received with the URB, free the buffer we
+ // allocated earlier, but not before reading the data out of the
+ // buffer if we wanted to receive data.
+/*
+ if (xfer_len > 0) {
+ if (command[0] & USB_DIR_IN)
+ memcpy(xfer_data, buffer, xfer_len);
+ kfree(buffer);
+ }
+*/
+ // Check the return code for the command.
+
+ if (result < 0) {
+ /* if the command was aborted, indicate that */
+ if (result == -ENOENT)
+ return USB_STOR_TRANSPORT_ABORTED;
+
+ /* a stall is a fatal condition from the device */
+ if (result == -EPIPE) {
+ US_DEBUGP("-- Stall on control pipe. Clearing\n");
+ result = usb_clear_halt(us->pusb_dev, pipe);
+ US_DEBUGP("-- usb_clear_halt() returns %d\n", result);
+ return USB_STOR_TRANSPORT_FAILED;
+ }
+
+ /* Uh oh... serious problem here */
+ return USB_STOR_TRANSPORT_ERROR;
+ }
+
+ return USB_STOR_TRANSPORT_GOOD;
+}
+
+static int sddr09_raw_bulk(struct us_data *us,
+ int direction,
+ unsigned char *data,
+ unsigned short len) {
+
+ int result;
+ int act_len;
+ int pipe;
+
+ if (direction == SCSI_DATA_READ)
+ pipe = usb_rcvbulkpipe(us->pusb_dev, us->ep_in);
+ else
+ pipe = usb_sndbulkpipe(us->pusb_dev, us->ep_out);
+
+ result = usb_stor_bulk_msg(us, data, pipe, len, &act_len);
+
+ /* if we stall, we need to clear it before we go on */
+ if (result == -EPIPE) {
+ US_DEBUGP("EPIPE: clearing endpoint halt for"
+ " pipe 0x%x, stalled at %d bytes\n",
+ pipe, act_len);
+ usb_clear_halt(us->pusb_dev, pipe);
+ }
+
+ if (result) {
+
+ /* NAK - that means we've retried a few times already */
+ if (result == -ETIMEDOUT) {
+ US_DEBUGP("usbat_raw_bulk():"
+ " device NAKed\n");
+ return US_BULK_TRANSFER_FAILED;
+ }
+
+ /* -ENOENT -- we canceled this transfer */
+ if (result == -ENOENT) {
+ US_DEBUGP("usbat_raw_bulk():"
+ " transfer aborted\n");
+ return US_BULK_TRANSFER_ABORTED;
+ }
+
+ if (result == -EPIPE) {
+ US_DEBUGP("usbat_raw_bulk():"
+ " output pipe stalled\n");
+ return USB_STOR_TRANSPORT_FAILED;
+ }
+
+ /* the catch-all case */
+ US_DEBUGP("us_transfer_partial(): unknown error\n");
+ return US_BULK_TRANSFER_FAILED;
+ }
+
+ if (act_len != len) {
+ US_DEBUGP("Warning: Transferred only %d bytes\n",
+ act_len);
+ return US_BULK_TRANSFER_SHORT;
+ }
+
+ US_DEBUGP("Transfered %d of %d bytes\n", act_len, len);
+
+ return US_BULK_TRANSFER_GOOD;
+}
+
+/*
+ * Note: direction must be set if command_len == 0.
+ */
+
+static int sddr09_bulk_transport(struct us_data *us,
+ unsigned char *command,
+ unsigned short command_len,
+ int direction,
+ unsigned char *data,
+ unsigned short len,
+ int use_sg) {
+
+ int result = USB_STOR_TRANSPORT_GOOD;
+ int transferred = 0;
+ unsigned char execute[8] = {
+ 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ int i;
+ struct scatterlist *sg;
+ char string[64];
+/*
+ if (command_len != 0) {
+
+ // Fix up the command's data length
+
+ command[6] = len&0xFF;
+ command[7] = (len>>8)&0xFF;
+
+ result = sddr09_send_control(us,
+ execute,
+ command,
+ command_len);
+
+ if (result != USB_STOR_TRANSPORT_GOOD)
+ return result;
+ }
+*/
+ if (len==0)
+ return USB_STOR_TRANSPORT_GOOD;
+
+
+ /* transfer the data payload for the command, if there is any */
+
+
+ if (command_len != 0)
+ direction = (command[0]&0x80) ? SCSI_DATA_READ :
+ SCSI_DATA_WRITE;
+
+ if (direction == SCSI_DATA_WRITE) {
+
+ /* Debug-print the first 48 bytes of the write transfer */
+
+ if (!use_sg) {
+ string[0] = 0;
+ for (i=0; i<len && i<48; i++) {
+ sprintf(string+strlen(string), "%02X ",
+ data[i]);
+ if ((i%16)==15) {
+ US_DEBUGP("%s\n", string);
+ string[0] = 0;
+ }
+ }
+ if (string[0]!=0)
+ US_DEBUGP("%s\n", string);
+ }
+ }
+
+
+ US_DEBUGP("SCM data %s transfer %d sg buffers %d\n",
+ ( direction==SCSI_DATA_READ ? "in" : "out"),
+ len, use_sg);
+
+ if (!use_sg)
+ result = sddr09_raw_bulk(us, direction, data, len);
+ else {
+ sg = (struct scatterlist *)data;
+ for (i=0; i<use_sg && transferred<len; i++) {
+ result = sddr09_raw_bulk(us, direction,
+ sg[i].address,
+ len-transferred > sg[i].length ?
+ sg[i].length : len-transferred);
+ if (result!=US_BULK_TRANSFER_GOOD)
+ break;
+ transferred += sg[i].length;
+ }
+ }
+
+ return result;
+}
+
+int sddr09_read_data(struct us_data *us,
+ unsigned long address,
+ unsigned short sectors,
+ unsigned char *content,
+ int use_sg) {
+
+ int result;
+ unsigned char command[12] = {
+ 0xe8, 0x20, MSB_of(address>>16),
+ LSB_of(address>>16), MSB_of(address&0xFFFF),
+ LSB_of(address&0xFFFF), 0, 0, 0, 0,
+ MSB_of(sectors), LSB_of(sectors)
+ };
+
+ result = sddr09_send_control(us,
+ usb_sndctrlpipe(us->pusb_dev,0),
+ 0,
+ 0x41,
+ 0,
+ 0,
+ command,
+ 12);
+
+ if (result != USB_STOR_TRANSPORT_GOOD)
+ return result;
+
+ result = sddr09_bulk_transport(us,
+ NULL, 0, SCSI_DATA_READ, content,
+ sectors*512, use_sg);
+
+ return result;
+}
+
+int sddr09_read_control(struct us_data *us,
+ unsigned long address,
+ unsigned short sectors,
+ unsigned char *content,
+ int use_sg) {
+
+ int result;
+ unsigned char command[12] = {
+ 0xe8, 0x21, MSB_of(address>>16),
+ LSB_of(address>>16), MSB_of(address&0xFFFF),
+ LSB_of(address&0xFFFF), 0, 0, 0, 0,
+ MSB_of(sectors), LSB_of(sectors)
+ };
+
+ result = sddr09_send_control(us,
+ usb_sndctrlpipe(us->pusb_dev,0),
+ 0,
+ 0x41,
+ 0,
+ 0,
+ command,
+ 12);
+
+ if (result != USB_STOR_TRANSPORT_GOOD)
+ return result;
+
+ result = sddr09_bulk_transport(us,
+ NULL, 0, SCSI_DATA_READ, content,
+ sectors*64, use_sg);
+
+ return result;
+}
+
+int sddr09_read_deviceID(struct us_data *us,
+ unsigned char *manufacturerID,
+ unsigned char *deviceID) {
+
+ int result;
+ unsigned char command[12] = {
+ 0xed, 0x20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ unsigned char content[64];
+
+ result = sddr09_send_control(us,
+ usb_sndctrlpipe(us->pusb_dev,0),
+ 0,
+ 0x41,
+ 0,
+ 0,
+ command,
+ 12);
+
+ US_DEBUGP("Result of send_control for device ID is %d\n",
+ result);
+
+ if (result != USB_STOR_TRANSPORT_GOOD)
+ return result;
+
+ result = sddr09_bulk_transport(us,
+ NULL, 0, SCSI_DATA_READ, content,
+ 64, 0);
+
+ *manufacturerID = content[0];
+ *deviceID = content[1];
+
+ return result;
+}
+
+int sddr09_read_status(struct us_data *us,
+ unsigned char *status) {
+
+ int result;
+ unsigned char command[12] = {
+ 0xec, 0x20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ unsigned char content[2];
+
+ result = sddr09_send_control(us,
+ usb_sndctrlpipe(us->pusb_dev,0),
+ 0,
+ 0x41,
+ 0,
+ 0,
+ command,
+ 12);
+
+ if (result != USB_STOR_TRANSPORT_GOOD)
+ return result;
+
+ result = sddr09_bulk_transport(us,
+ NULL, 0, SCSI_DATA_READ, status,
+ 1, 0);
+
+ return result;
+}
+
+int sddr09_reset(struct us_data *us) {
+
+ int result;
+ unsigned char command[12] = {
+ 0xeb, 0x20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+
+ result = sddr09_send_control(us,
+ usb_sndctrlpipe(us->pusb_dev,0),
+ 0,
+ 0x41,
+ 0,
+ 0,
+ command,
+ 12);
+
+ return result;
+}
+
+/*
+static int init_sddr09(struct us_data *us) {
+
+ int result;
+ unsigned char data[14];
+ unsigned char command[8] = {
+ 0xc1, 0x01, 0, 0, 0, 0, 0, 0
+ };
+ unsigned char command2[8] = {
+ 0x41, 0, 0, 0, 0, 0, 0, 0
+ };
+ unsigned char tur[12] = {
+ 0x03, 0x20, 0, 0, 0x0e, 0, 0, 0, 0, 0, 0, 0
+ };
+
+ if ( (result = sddr09_send_control(us, command, data, 2)) !=
+ USB_STOR_TRANSPORT_GOOD)
+ return result;
+
+ US_DEBUGP("SDDR09: %02X %02X\n", data[0], data[1]);
+
+ command[1] = 0x08;
+
+ if ( (result = sddr09_send_control(us, command, data, 2)) !=
+ USB_STOR_TRANSPORT_GOOD)
+ return result;
+
+ US_DEBUGP("SDDR09: %02X %02X\n", data[0], data[1]);
+
+ if ( (result = sddr09_send_control(us, command2, tur, 12)) !=
+ USB_STOR_TRANSPORT_GOOD) {
+ US_DEBUGP("SDDR09: request sense failed\n");
+ return result;
+ }
+
+ if ( (result = sddr09_raw_bulk(
+ us, SCSI_DATA_READ, data, 14)) !=
+ USB_STOR_TRANSPORT_GOOD) {
+ US_DEBUGP("SDDR09: request sense bulk in failed\n");
+ return result;
+ }
+
+ US_DEBUGP("SDDR09: request sense worked\n");
+
+ return result;
+}
+*/
+
+/*
+ * Transport for the Sandisk SDDR-09
+ */
+int sddr09_transport(Scsi_Cmnd *srb, struct us_data *us)
+{
+ int result;
+ unsigned char send_scsi_command[8] = {
+ 0x41, 0, 0, 0, 0, 0, 0, 0
+ };
+ int i;
+ char string[64];
+ unsigned char inquiry_response[36] = {
+ 0x00, 0x80, 0x00, 0x02, 0x1F, 0x00, 0x00, 0x00,
+ 'S', 'a', 'n', 'D', 'i', 's', 'k', ' ',
+ 'I', 'm', 'a', 'g', 'e', 'M', 'a', 't',
+ 'e', ' ', 'S', 'D', 'D', 'R', '0', '9',
+ ' ', ' ', ' ', ' '
+ };
+ unsigned char deviceID;
+ unsigned char manufacturerID;
+ unsigned char *ptr;
+
+/*
+ if (us->flags & US_FL_NEED_INIT) {
+ US_DEBUGP("SDDR-09: initializing\n");
+ init_sddr09(us);
+ us->flags &= ~US_FL_NEED_INIT;
+ }
+*/
+
+ ptr = (unsigned char *)srb->request_buffer;
+
+ /* Dummy up a response for INQUIRY since SDDR09 doesn't
+ respond to INQUIRY commands */
+
+ if (srb->cmnd[0] == INQUIRY) {
+ memcpy(srb->request_buffer, inquiry_response, 36);
+ return USB_STOR_TRANSPORT_GOOD;
+ }
+
+ if (srb->cmnd[0] == READ_CAPACITY) {
+
+ US_DEBUGP("Reading capacity...\n");
+
+ result = sddr09_read_deviceID(us,
+ &manufacturerID,
+ &deviceID);
+
+ US_DEBUGP("Result of read_deviceID is %d\n",
+ result);
+
+ if (result != USB_STOR_TRANSPORT_GOOD)
+ return result;
+
+ US_DEBUGP("Device ID = %02X\n", deviceID);
+ US_DEBUGP("Manuf ID = %02X\n", manufacturerID);
+
+ ptr[0] = 0;
+ ptr[1] = 0;
+ ptr[2] = 0;
+ ptr[3] = 0;
+
+ switch (deviceID) {
+
+ case 0x6e: // 1MB
+ case 0xe8:
+ case 0xec:
+ ptr[4] = 0;
+ ptr[5] = 0x10;
+ break;
+
+ case 0xea: // 2MB
+ case 0x64:
+ case 0x5d:
+ ptr[4] = 0;
+ ptr[5] = 0x20;
+ break;
+
+ case 0xe3: // 4MB
+ case 0xe5:
+ case 0x6b:
+ case 0xd5:
+ ptr[4] = 0;
+ ptr[5] = 0x40;
+ break;
+
+ case 0xe6: // 8MB
+ case 0xd6:
+ ptr[4] = 0;
+ ptr[5] = 0x80;
+ break;
+
+ case 0x75: // 32MB
+ ptr[4] = 0x02;
+ ptr[5] = 0;
+ break;
+
+ default: // unknown
+ ptr[4] = 0;
+ ptr[5] = 0;
+
+ }
+
+ ptr[6] = 0;
+ ptr[7] = 0;
+
+ return USB_STOR_TRANSPORT_GOOD;
+ }
+
+ for (; srb->cmd_len<12; srb->cmd_len++)
+ srb->cmnd[srb->cmd_len] = 0;
+
+ srb->cmnd[1] = 0x20;
+
+ string[0] = 0;
+ for (i=0; i<12; i++)
+ sprintf(string+strlen(string), "%02X ", srb->cmnd[i]);
+
+ US_DEBUGP("SDDR09: Send control for command %s\n",
+ string);
+
+ if ( (result = sddr09_send_control(us,
+ usb_sndctrlpipe(us->pusb_dev,0),
+ 0,
+ 0x41,
+ 0,
+ 0,
+ srb->cmnd,
+ 12)) != USB_STOR_TRANSPORT_GOOD)
+ return result;
+
+ US_DEBUGP("SDDR09: Control for command OK\n");
+
+ if (srb->request_bufflen == 0)
+ return USB_STOR_TRANSPORT_GOOD;
+
+ if (srb->sc_data_direction == SCSI_DATA_WRITE ||
+ srb->sc_data_direction == SCSI_DATA_READ) {
+
+ US_DEBUGP("SDDR09: %s %d bytes\n",
+ srb->sc_data_direction==SCSI_DATA_WRITE ?
+ "sending" : "receiving",
+ srb->request_bufflen);
+
+ result = sddr09_bulk_transport(us,
+ NULL, 0, srb->sc_data_direction,
+ srb->request_buffer,
+ srb->request_bufflen, srb->use_sg);
+
+ return result;
+
+ }
+
+ return USB_STOR_TRANSPORT_GOOD;
+}
+
diff --git a/drivers/usb/storage/sddr09.h b/drivers/usb/storage/sddr09.h
new file mode 100644
index 000000000..76a749528
--- /dev/null
+++ b/drivers/usb/storage/sddr09.h
@@ -0,0 +1,31 @@
+/* Driver for SanDisk SDDR-09 SmartMedia reader
+ * Header File
+ *
+ * Current development and maintainance by:
+ * (c) 2000 Robert Baruch (autophile@dol.net)
+ *
+ * See sddr09.c for more explanation
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _USB_SHUTTLE_EUSB_SDDR09_H
+#define _USB_SHUTTLE_EUSB_SDDR09_H
+
+/* Sandisk SDDR-09 stuff */
+
+extern int sddr09_transport(Scsi_Cmnd *srb, struct us_data *us);
+
+#endif
diff --git a/drivers/usb/storage/scm.c b/drivers/usb/storage/shuttle_usbat.c
index 7bae5e623..f68595c47 100644
--- a/drivers/usb/storage/scm.c
+++ b/drivers/usb/storage/shuttle_usbat.c
@@ -1,7 +1,5 @@
/* Driver for SCM Microsystems USB-ATAPI cable
*
- * $Id: scm.c,v 1.4 2000/07/24 19:19:52 mdharm Exp $
- *
* SCM driver v0.2:
*
* Removed any reference to maxlen for bulk transfers.
@@ -52,7 +50,7 @@
#include "protocol.h"
#include "usb.h"
#include "debug.h"
-#include "scm.h"
+#include "shuttle_usbat.h"
#include <linux/sched.h>
#include <linux/errno.h>
@@ -64,6 +62,10 @@ extern int usb_stor_control_msg(struct us_data *us, unsigned int pipe,
extern int usb_stor_bulk_msg(struct us_data *us, void *data, int pipe,
unsigned int len, unsigned int *act_len);
+#define short_pack(b1,b2) ( ((u16)(b1)) | ( ((u16)(b2))<<8 ) )
+#define LSB_of(s) ((s)&0xFF)
+#define MSB_of(s) ((s)>>8)
+
/*
* Send a control message and wait for the response.
*
@@ -83,62 +85,53 @@ extern int usb_stor_bulk_msg(struct us_data *us, void *data, int pipe,
*
*/
-static int scm_send_control(struct us_data *us,
- unsigned char command[8],
- unsigned char *xfer_data,
- unsigned int xfer_len) {
+static int usbat_send_control(struct us_data *us,
+ int pipe,
+ unsigned char request,
+ unsigned char requesttype,
+ unsigned short value,
+ unsigned short index,
+ unsigned char *xfer_data,
+ unsigned int xfer_len) {
int result;
- int pipe;
- void *buffer = NULL;
-
- command[6] = xfer_len&0xFF;
- command[7] = (xfer_len>>8)&0xFF;
-
- // Get the receive or send control pipe number, based on
- // the direction indicated by the request type.
-
- if (command[0] & USB_DIR_IN)
- pipe = usb_rcvctrlpipe(us->pusb_dev,0);
- else
- pipe = usb_sndctrlpipe(us->pusb_dev,0);
-
// If data is going to be sent or received with the URB,
// then allocate a buffer for it. If data is to be sent,
// copy the data into the buffer.
-
+/*
if (xfer_len > 0) {
buffer = kmalloc(xfer_len, GFP_KERNEL);
if (!(command[0] & USB_DIR_IN))
memcpy(buffer, xfer_data, xfer_len);
}
-
+*/
// Send the URB to the device and wait for a response.
/* Why are request and request type reversed in this call? */
result = usb_stor_control_msg(us, pipe,
- command[1], command[0],
- (((unsigned short)command[3])<<8) | command[2],
- (((unsigned short)command[5])<<8) | command[3],
- buffer,
- xfer_len);
+ request, requesttype, value, index,
+ xfer_data, xfer_len);
// If data was sent or received with the URB, free the buffer we
// allocated earlier, but not before reading the data out of the
// buffer if we wanted to receive data.
-
+/*
if (xfer_len > 0) {
if (command[0] & USB_DIR_IN)
memcpy(xfer_data, buffer, xfer_len);
kfree(buffer);
}
-
+*/
// Check the return code for the command.
if (result < 0) {
+ /* if the command was aborted, indicate that */
+ if (result == -ENOENT)
+ return USB_STOR_TRANSPORT_ABORTED;
+
/* a stall is a fatal condition from the device */
if (result == -EPIPE) {
US_DEBUGP("-- Stall on control pipe. Clearing\n");
@@ -154,7 +147,7 @@ static int scm_send_control(struct us_data *us,
return USB_STOR_TRANSPORT_GOOD;
}
-static int scm_raw_bulk(struct us_data *us,
+static int usbat_raw_bulk(struct us_data *us,
int direction,
unsigned char *data,
unsigned short len) {
@@ -182,20 +175,20 @@ static int scm_raw_bulk(struct us_data *us,
/* NAK - that means we've retried a few times already */
if (result == -ETIMEDOUT) {
- US_DEBUGP("scm_raw_bulk():"
+ US_DEBUGP("usbat_raw_bulk():"
" device NAKed\n");
return US_BULK_TRANSFER_FAILED;
}
/* -ENOENT -- we canceled this transfer */
if (result == -ENOENT) {
- US_DEBUGP("scm_raw_bulk():"
+ US_DEBUGP("usbat_raw_bulk():"
" transfer aborted\n");
return US_BULK_TRANSFER_ABORTED;
}
if (result == -EPIPE) {
- US_DEBUGP("scm_raw_bulk():"
+ US_DEBUGP("usbat_raw_bulk():"
" output pipe stalled\n");
return USB_STOR_TRANSPORT_FAILED;
}
@@ -220,7 +213,7 @@ static int scm_raw_bulk(struct us_data *us,
* Note: direction must be set if command_len == 0.
*/
-static int scm_bulk_transport(struct us_data *us,
+static int usbat_bulk_transport(struct us_data *us,
unsigned char *command,
unsigned short command_len,
int direction,
@@ -236,15 +229,19 @@ static int scm_bulk_transport(struct us_data *us,
int i;
struct scatterlist *sg;
char string[64];
+ int pipe;
+/*
if (command_len != 0) {
- /* Fix up the command's data length */
+ // Fix up the command's data length
command[6] = len&0xFF;
command[7] = (len>>8)&0xFF;
- result = scm_send_control(us,
+
+
+ result = usbat_send_control(us,
execute,
command,
command_len);
@@ -252,7 +249,7 @@ static int scm_bulk_transport(struct us_data *us,
if (result != USB_STOR_TRANSPORT_GOOD)
return result;
}
-
+*/
if (len==0)
return USB_STOR_TRANSPORT_GOOD;
@@ -289,11 +286,11 @@ static int scm_bulk_transport(struct us_data *us,
len, use_sg);
if (!use_sg)
- result = scm_raw_bulk(us, direction, data, len);
+ result = usbat_raw_bulk(us, direction, data, len);
else {
sg = (struct scatterlist *)data;
for (i=0; i<use_sg && transferred<len; i++) {
- result = scm_raw_bulk(us, direction,
+ result = usbat_raw_bulk(us, direction,
sg[i].address,
len-transferred > sg[i].length ?
sg[i].length : len-transferred);
@@ -306,7 +303,7 @@ static int scm_bulk_transport(struct us_data *us,
return result;
}
-int scm_read(struct us_data *us,
+int usbat_read(struct us_data *us,
unsigned char access,
unsigned char reg,
unsigned char *content) {
@@ -316,17 +313,21 @@ int scm_read(struct us_data *us,
0xC0, access, reg, 0x00, 0x00, 0x00, 0x00, 0x00
};
- result = scm_send_control(us, command, content, 1);
-
- if (result != USB_STOR_TRANSPORT_GOOD)
- return result;
-
- // US_DEBUGP("SCM: Reg %d -> %02X\n", reg, *content);
+ result = usbat_send_control(us,
+ usb_rcvctrlpipe(us->pusb_dev,0),
+ access,
+ 0xC0,
+ (u16)reg,
+ 0,
+ content,
+ 1);
+
+ // result = usbat_send_control(us, command, content, 1);
return result;
}
-int scm_write(struct us_data *us,
+int usbat_write(struct us_data *us,
unsigned char access,
unsigned char reg,
unsigned char content) {
@@ -336,17 +337,21 @@ int scm_write(struct us_data *us,
0x40, access|0x01, reg, content, 0x00, 0x00, 0x00, 0x00
};
- result = scm_send_control(us, command, NULL, 0);
-
- if (result != USB_STOR_TRANSPORT_GOOD)
- return result;
-
- // US_DEBUGP("SCM: Reg %d <- %02X\n", reg, content);
+ result = usbat_send_control(us,
+ usb_sndctrlpipe(us->pusb_dev,0),
+ access|0x01,
+ 0x40,
+ short_pack(reg, content),
+ 0,
+ NULL,
+ 0);
+
+ // result = usbat_send_control(us, command, NULL, 0);
return result;
}
-int scm_set_shuttle_features(struct us_data *us,
+int usbat_set_shuttle_features(struct us_data *us,
unsigned char external_trigger,
unsigned char epp_control,
unsigned char mask_byte,
@@ -360,15 +365,21 @@ int scm_set_shuttle_features(struct us_data *us,
test_pattern, mask_byte, subcountL, subcountH
};
- result = scm_bulk_transport(us, command, 8, 0, NULL, 0, 0);
-
- if (result != USB_STOR_TRANSPORT_GOOD)
- return result;
+ result = usbat_send_control(us,
+ usb_sndctrlpipe(us->pusb_dev,0),
+ 0x80,
+ 0x40,
+ 0,
+ 0,
+ command,
+ 8);
+
+ // result = usbat_bulk_transport(us, command, 8, 0, NULL, 0, 0);
return result;
}
-int scm_read_block(struct us_data *us,
+int usbat_read_block(struct us_data *us,
unsigned char access,
unsigned char reg,
unsigned char *content,
@@ -377,16 +388,27 @@ int scm_read_block(struct us_data *us,
int result;
unsigned char command[8] = {
- 0xC0, access|0x02, reg, 0x00, 0x00, 0x00, 0x00, 0x00
+ 0xC0, access|0x02, reg, 0x00, 0x00, 0x00,
+ LSB_of(len), MSB_of(len)
};
- result = scm_bulk_transport(us,
- command, 8, 0, content, len, use_sg);
+ result = usbat_send_control(us,
+ usb_sndctrlpipe(us->pusb_dev,0),
+ 0x80,
+ 0x40,
+ 0,
+ 0,
+ command,
+ 8);
if (result != USB_STOR_TRANSPORT_GOOD)
return result;
- // US_DEBUGP("SCM: Read data, result %d\n", result);
+ result = usbat_bulk_transport(us,
+ NULL, 0, SCSI_DATA_READ, content, len, use_sg);
+
+ // result = usbat_bulk_transport(us,
+ // command, 8, 0, content, len, use_sg);
return result;
}
@@ -396,7 +418,7 @@ int scm_read_block(struct us_data *us,
* an error condition.
*/
-int scm_wait_not_busy(struct us_data *us) {
+int usbat_wait_not_busy(struct us_data *us) {
int i;
int result;
@@ -406,7 +428,7 @@ int scm_wait_not_busy(struct us_data *us) {
but probably not more than 15 minutes or so */
for (i=0; i<500; i++) {
- result = scm_read(us, SCM_ATA, 0x17, &status);
+ result = usbat_read(us, USBAT_ATA, 0x17, &status);
US_DEBUGP("SCM: Write ATA data status is %02X\n", status);
if (result!=USB_STOR_TRANSPORT_GOOD)
return result;
@@ -432,7 +454,7 @@ int scm_wait_not_busy(struct us_data *us) {
return USB_STOR_TRANSPORT_GOOD;
}
-int scm_write_block(struct us_data *us,
+int usbat_write_block(struct us_data *us,
unsigned char access,
unsigned char reg,
unsigned char *content,
@@ -441,19 +463,35 @@ int scm_write_block(struct us_data *us,
int result;
unsigned char command[8] = {
- 0x40, access|0x03, reg, 0x00, 0x00, 0x00, 0x00, 0x00
+ 0x40, access|0x03, reg, 0x00, 0x00, 0x00,
+ LSB_of(len), MSB_of(len)
};
- result = scm_bulk_transport(us,
- command, 8, 0, content, len, use_sg);
+ result = usbat_send_control(us,
+ usb_sndctrlpipe(us->pusb_dev,0),
+ 0x80,
+ 0x40,
+ 0,
+ 0,
+ command,
+ 8);
- if (result!=USB_STOR_TRANSPORT_GOOD)
+ if (result != USB_STOR_TRANSPORT_GOOD)
+ return result;
+
+ result = usbat_bulk_transport(us,
+ NULL, 0, SCSI_DATA_WRITE, content, len, use_sg);
+
+ if (result != USB_STOR_TRANSPORT_GOOD)
return result;
- return scm_wait_not_busy(us);
+ // result = usbat_bulk_transport(us,
+ // command, 8, 0, content, len, use_sg);
+
+ return usbat_wait_not_busy(us);
}
-int scm_write_block_test(struct us_data *us,
+int usbat_write_block_test(struct us_data *us,
unsigned char access,
unsigned char *registers,
unsigned char *data_out,
@@ -467,10 +505,15 @@ int scm_write_block_test(struct us_data *us,
int use_sg) {
int result;
+
+ // Not really sure the 0x07, 0x17, 0xfc, 0xe7 is necessary here,
+ // but that's what came out of the trace.
+
unsigned char command[16] = {
- 0x40, access|0x07, 0x07, 0x17, 0xfc, 0xe7, 0x00, 0x00,
+ 0x40, access|0x07, 0x07, 0x17, 0xfc, 0xe7,
+ LSB_of(num_registers*2), MSB_of(num_registers*2),
0x40, access|0x05, data_reg, status_reg,
- qualifier, timeout, 0x00, 0x00
+ qualifier, timeout, LSB_of(len), MSB_of(len)
};
int i;
unsigned char data[num_registers*2];
@@ -478,28 +521,44 @@ int scm_write_block_test(struct us_data *us,
struct scatterlist *sg;
char string[64];
- command[14] = len&0xFF;
- command[15] = (len>>8)&0xFF;
-
for (i=0; i<num_registers; i++) {
data[i<<1] = registers[i];
data[1+(i<<1)] = data_out[i];
}
- result = scm_bulk_transport(us,
- command, 16, 0, data, num_registers*2, 0);
+ result = usbat_send_control(us,
+ usb_sndctrlpipe(us->pusb_dev,0),
+ 0x80,
+ 0x40,
+ 0,
+ 0,
+ command,
+ 16);
+
+ if (result != USB_STOR_TRANSPORT_GOOD)
+ return result;
+
+ result = usbat_bulk_transport(us,
+ NULL, 0, SCSI_DATA_WRITE, data, num_registers*2, 0);
+
+ // result = usbat_bulk_transport(us,
+ // command, 16, 0, data, num_registers*2, 0);
if (result!=USB_STOR_TRANSPORT_GOOD)
return result;
- transferred = 0;
+ // transferred = 0;
US_DEBUGP("Transfer out %d bytes, sg buffers %d\n",
len, use_sg);
+ result = usbat_bulk_transport(us,
+ NULL, 0, SCSI_DATA_WRITE, content, len, use_sg);
+
+/*
if (!use_sg) {
- /* Debug-print the first 48 bytes of the transfer */
+ // Debug-print the first 48 bytes of the transfer
string[0] = 0;
for (i=0; i<len && i<48; i++) {
@@ -513,13 +572,13 @@ int scm_write_block_test(struct us_data *us,
if (string[0]!=0)
US_DEBUGP("%s\n", string);
- result = scm_raw_bulk(us, SCSI_DATA_WRITE, content, len);
+ result = usbat_raw_bulk(us, SCSI_DATA_WRITE, content, len);
} else {
sg = (struct scatterlist *)content;
for (i=0; i<use_sg && transferred<len; i++) {
- result = scm_raw_bulk(us, SCSI_DATA_WRITE,
+ result = usbat_raw_bulk(us, SCSI_DATA_WRITE,
sg[i].address,
len-transferred > sg[i].length ?
sg[i].length : len-transferred);
@@ -528,14 +587,14 @@ int scm_write_block_test(struct us_data *us,
transferred += sg[i].length;
}
}
-
+*/
if (result!=USB_STOR_TRANSPORT_GOOD)
return result;
- return scm_wait_not_busy(us);
+ return usbat_wait_not_busy(us);
}
-int scm_multiple_write(struct us_data *us,
+int usbat_multiple_write(struct us_data *us,
unsigned char access,
unsigned char *registers,
unsigned char *data_out,
@@ -544,8 +603,9 @@ int scm_multiple_write(struct us_data *us,
int result;
unsigned char data[num_registers*2];
int i;
- unsigned char cmd[8] = {
- 0x40, access|0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ unsigned char command[8] = {
+ 0x40, access|0x07, 0x00, 0x00, 0x00, 0x00,
+ LSB_of(num_registers*2), MSB_of(num_registers*2)
};
for (i=0; i<num_registers; i++) {
@@ -553,12 +613,73 @@ int scm_multiple_write(struct us_data *us,
data[1+(i<<1)] = data_out[i];
}
- result = scm_bulk_transport(us, cmd, 8, 0, data, num_registers*2, 0);
+ result = usbat_send_control(us,
+ usb_sndctrlpipe(us->pusb_dev,0),
+ 0x80,
+ 0x40,
+ 0,
+ 0,
+ command,
+ 8);
+
+ if (result != USB_STOR_TRANSPORT_GOOD)
+ return result;
+
+ result = usbat_bulk_transport(us,
+ NULL, 0, SCSI_DATA_WRITE, data, num_registers*2, 0);
+
+ // result = usbat_bulk_transport(us, cmd, 8, 0,
+ // data, num_registers*2, 0);
if (result!=USB_STOR_TRANSPORT_GOOD)
return result;
- return scm_wait_not_busy(us);
+ return usbat_wait_not_busy(us);
+}
+
+int usbat_read_user_io(struct us_data *us,
+ unsigned char *data_flags) {
+
+ unsigned char command[8] = {
+ 0xC0, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ int result;
+
+ result = usbat_send_control(us,
+ usb_rcvctrlpipe(us->pusb_dev,0),
+ 0x82,
+ 0xC0,
+ 0,
+ 0,
+ data_flags,
+ 1);
+
+ // result = usbat_send_control(us, command, data_flags, 1);
+
+ return result;
+}
+
+int usbat_write_user_io(struct us_data *us,
+ unsigned char enable_flags,
+ unsigned char data_flags) {
+
+ unsigned char command[8] = {
+ 0x40, 0x82, enable_flags, data_flags, 0x00, 0x00, 0x00, 0x00
+ };
+ int result;
+
+ result = usbat_send_control(us,
+ usb_sndctrlpipe(us->pusb_dev,0),
+ 0x82,
+ 0x40,
+ short_pack(enable_flags, data_flags),
+ 0,
+ NULL,
+ 0);
+
+ // result = usbat_send_control(us, command, NULL, 0);
+
+ return result;
}
static int hp_8200e_select_and_test_registers(struct us_data *us) {
@@ -571,39 +692,39 @@ static int hp_8200e_select_and_test_registers(struct us_data *us) {
for (selector = 0xA0; selector <= 0xB0; selector += 0x10) {
- if ( (result = scm_write(us, SCM_ATA, 0x16, selector)) !=
+ if ( (result = usbat_write(us, USBAT_ATA, 0x16, selector)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
- if ( (result = scm_read(us, SCM_ATA, 0x17, &status)) !=
+ if ( (result = usbat_read(us, USBAT_ATA, 0x17, &status)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
- if ( (result = scm_read(us, SCM_ATA, 0x16, &status)) !=
+ if ( (result = usbat_read(us, USBAT_ATA, 0x16, &status)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
- if ( (result = scm_read(us, SCM_ATA, 0x14, &status)) !=
+ if ( (result = usbat_read(us, USBAT_ATA, 0x14, &status)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
- if ( (result = scm_read(us, SCM_ATA, 0x15, &status)) !=
+ if ( (result = usbat_read(us, USBAT_ATA, 0x15, &status)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
- if ( (result = scm_write(us, SCM_ATA, 0x14, 0x55)) !=
+ if ( (result = usbat_write(us, USBAT_ATA, 0x14, 0x55)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
- if ( (result = scm_write(us, SCM_ATA, 0x15, 0xAA)) !=
+ if ( (result = usbat_write(us, USBAT_ATA, 0x15, 0xAA)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
- if ( (result = scm_read(us, SCM_ATA, 0x14, &status)) !=
+ if ( (result = usbat_read(us, USBAT_ATA, 0x14, &status)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
- if ( (result = scm_read(us, SCM_ATA, 0x15, &status)) !=
+ if ( (result = usbat_read(us, USBAT_ATA, 0x15, &status)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
}
@@ -611,89 +732,6 @@ static int hp_8200e_select_and_test_registers(struct us_data *us) {
return result;
}
-int scm_read_user_io(struct us_data *us,
- unsigned char *data_flags) {
-
- unsigned char command[8] = {
- 0xC0, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
- int result;
-
- result = scm_send_control(us, command, data_flags, 1);
-
- if (result != USB_STOR_TRANSPORT_GOOD)
- return result;
-
- // US_DEBUGP("SCM: User I/O flags -> %02X\n", *data_flags);
-
- return result;
-}
-
-int scm_write_user_io(struct us_data *us,
- unsigned char enable_flags,
- unsigned char data_flags) {
-
- unsigned char command[8] = {
- 0x40, 0x82, enable_flags, data_flags, 0x00, 0x00, 0x00, 0x00
- };
- int result;
-
- result = scm_send_control(us, command, NULL, 0);
-
- if (result != USB_STOR_TRANSPORT_GOOD)
- return result;
-
- // US_DEBUGP("SCM: User I/O flags <- %02X\n", data_flags);
-
- return result;
-}
-
-static int init_sddr09(struct us_data *us) {
-
- int result;
- unsigned char data[14];
- unsigned char command[8] = {
- 0xc1, 0x01, 0, 0, 0, 0, 0, 0
- };
- unsigned char command2[8] = {
- 0x41, 0, 0, 0, 0, 0, 0, 0
- };
- unsigned char tur[12] = {
- 0x03, 0x20, 0, 0, 0x0e, 0, 0, 0, 0, 0, 0, 0
- };
-
- if ( (result = scm_send_control(us, command, data, 2)) !=
- USB_STOR_TRANSPORT_GOOD)
- return result;
-
- US_DEBUGP("SDDR09: %02X %02X\n", data[0], data[1]);
-
- command[1] = 0x08;
-
- if ( (result = scm_send_control(us, command, data, 2)) !=
- USB_STOR_TRANSPORT_GOOD)
- return result;
-
- US_DEBUGP("SDDR09: %02X %02X\n", data[0], data[1]);
-/*
- if ( (result = scm_send_control(us, command2, tur, 12)) !=
- USB_STOR_TRANSPORT_GOOD) {
- US_DEBUGP("SDDR09: request sense failed\n");
- return result;
- }
-
- if ( (result = scm_raw_bulk(
- us, SCSI_DATA_READ, data, 14)) !=
- USB_STOR_TRANSPORT_GOOD) {
- US_DEBUGP("SDDR09: request sense bulk in failed\n");
- return result;
- }
-
- US_DEBUGP("SDDR09: request sense worked\n");
-*/
- return result;
-}
-
static int init_8200e(struct us_data *us) {
int result;
@@ -701,89 +739,119 @@ static int init_8200e(struct us_data *us) {
// Enable peripheral control signals
- if ( (result = scm_write_user_io(us,
- SCM_UIO_OE1 | SCM_UIO_OE0,
- SCM_UIO_EPAD | SCM_UIO_1)) != USB_STOR_TRANSPORT_GOOD)
+ if ( (result = usbat_write_user_io(us,
+ USBAT_UIO_OE1 | USBAT_UIO_OE0,
+ USBAT_UIO_EPAD | USBAT_UIO_1)) != USB_STOR_TRANSPORT_GOOD)
return result;
+ US_DEBUGP("INIT 1\n");
+
wait_ms(2000);
- if ( (result = scm_read_user_io(us, &status)) !=
+ if ( (result = usbat_read_user_io(us, &status)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
- if ( (result = scm_read_user_io(us, &status)) !=
+ US_DEBUGP("INIT 2\n");
+
+ if ( (result = usbat_read_user_io(us, &status)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
+ US_DEBUGP("INIT 3\n");
+
// Reset peripheral, enable periph control signals
// (bring reset signal up)
- if ( (result = scm_write_user_io(us,
- SCM_UIO_DRVRST | SCM_UIO_OE1 | SCM_UIO_OE0,
- SCM_UIO_EPAD | SCM_UIO_1)) != USB_STOR_TRANSPORT_GOOD)
+ if ( (result = usbat_write_user_io(us,
+ USBAT_UIO_DRVRST | USBAT_UIO_OE1 | USBAT_UIO_OE0,
+ USBAT_UIO_EPAD | USBAT_UIO_1)) != USB_STOR_TRANSPORT_GOOD)
return result;
+ US_DEBUGP("INIT 4\n");
+
// Enable periph control signals
// (bring reset signal down)
- if ( (result = scm_write_user_io(us,
- SCM_UIO_OE1 | SCM_UIO_OE0,
- SCM_UIO_EPAD | SCM_UIO_1)) != USB_STOR_TRANSPORT_GOOD)
+ if ( (result = usbat_write_user_io(us,
+ USBAT_UIO_OE1 | USBAT_UIO_OE0,
+ USBAT_UIO_EPAD | USBAT_UIO_1)) != USB_STOR_TRANSPORT_GOOD)
return result;
+ US_DEBUGP("INIT 5\n");
+
wait_ms(250);
// Write 0x80 to ISA port 0x3F
- if ( (result = scm_write(us, SCM_ISA, 0x3F, 0x80)) !=
+ if ( (result = usbat_write(us, USBAT_ISA, 0x3F, 0x80)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
+ US_DEBUGP("INIT 6\n");
+
// Read ISA port 0x27
- if ( (result = scm_read(us, SCM_ISA, 0x27, &status)) !=
+ if ( (result = usbat_read(us, USBAT_ISA, 0x27, &status)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
- if ( (result = scm_read_user_io(us, &status)) !=
+ US_DEBUGP("INIT 7\n");
+
+ if ( (result = usbat_read_user_io(us, &status)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
+ US_DEBUGP("INIT 8\n");
+
if ( (result = hp_8200e_select_and_test_registers(us)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
- if ( (result = scm_read_user_io(us, &status)) !=
+ US_DEBUGP("INIT 9\n");
+
+ if ( (result = usbat_read_user_io(us, &status)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
+ US_DEBUGP("INIT 10\n");
+
// Enable periph control signals and card detect
- if ( (result = scm_write_user_io(us,
- SCM_UIO_ACKD |SCM_UIO_OE1 | SCM_UIO_OE0,
- SCM_UIO_EPAD | SCM_UIO_1)) != USB_STOR_TRANSPORT_GOOD)
+ if ( (result = usbat_write_user_io(us,
+ USBAT_UIO_ACKD |USBAT_UIO_OE1 | USBAT_UIO_OE0,
+ USBAT_UIO_EPAD | USBAT_UIO_1)) != USB_STOR_TRANSPORT_GOOD)
return result;
- if ( (result = scm_read_user_io(us, &status)) !=
+ US_DEBUGP("INIT 11\n");
+
+ if ( (result = usbat_read_user_io(us, &status)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
+ US_DEBUGP("INIT 12\n");
+
wait_ms(1400);
- if ( (result = scm_read_user_io(us, &status)) !=
+ if ( (result = usbat_read_user_io(us, &status)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
+ US_DEBUGP("INIT 13\n");
+
if ( (result = hp_8200e_select_and_test_registers(us)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
- if ( (result = scm_set_shuttle_features(us,
+ US_DEBUGP("INIT 14\n");
+
+ if ( (result = usbat_set_shuttle_features(us,
0x83, 0x00, 0x88, 0x08, 0x15, 0x14)) !=
USB_STOR_TRANSPORT_GOOD)
return result;
+ US_DEBUGP("INIT 15\n");
+
return result;
}
@@ -923,7 +991,7 @@ int hp8200e_transport(Scsi_Cmnd *srb, struct us_data *us)
data[i] = (i-7 >= srb->cmd_len) ? 0 : srb->cmnd[i-7];
}
- result = scm_write_block_test(us, SCM_ATA,
+ result = usbat_write_block_test(us, USBAT_ATA,
registers, data, 19,
0x10, 0x17, 0xFD, 0x30,
srb->request_buffer,
@@ -932,16 +1000,16 @@ int hp8200e_transport(Scsi_Cmnd *srb, struct us_data *us)
return result;
}
- if ( (result = scm_multiple_write(us,
- SCM_ATA,
+ if ( (result = usbat_multiple_write(us,
+ USBAT_ATA,
registers, data, 7)) != USB_STOR_TRANSPORT_GOOD) {
return result;
}
// Write the 12-byte command header.
- if ( (result = scm_write_block(us,
- SCM_ATA, 0x10, srb->cmnd, 12, 0)) !=
+ if ( (result = usbat_write_block(us,
+ USBAT_ATA, 0x10, srb->cmnd, 12, 0)) !=
USB_STOR_TRANSPORT_GOOD) {
return result;
}
@@ -953,14 +1021,15 @@ int hp8200e_transport(Scsi_Cmnd *srb, struct us_data *us)
// How many bytes to read in? Check cylL register
- if ( (result = scm_read(us, SCM_ATA, 0x14, &status)) !=
+ if ( (result = usbat_read(us, USBAT_ATA, 0x14, &status)) !=
USB_STOR_TRANSPORT_GOOD) {
return result;
}
if (len>0xFF) { // need to read cylH also
len = status;
- if ( (result = scm_read(us, SCM_ATA, 0x15, &status)) !=
+ if ( (result = usbat_read(us, USBAT_ATA, 0x15,
+ &status)) !=
USB_STOR_TRANSPORT_GOOD) {
return result;
}
@@ -970,7 +1039,7 @@ int hp8200e_transport(Scsi_Cmnd *srb, struct us_data *us)
len = status;
- result = scm_read_block(us, SCM_ATA, 0x10,
+ result = usbat_read_block(us, USBAT_ATA, 0x10,
srb->request_buffer, len, srb->use_sg);
/* Debug-print the first 32 bytes of the transfer */
@@ -996,161 +1065,3 @@ int hp8200e_transport(Scsi_Cmnd *srb, struct us_data *us)
}
-/*
- * Transport for the Sandisk SDDR-09
- */
-int sddr09_transport(Scsi_Cmnd *srb, struct us_data *us)
-{
- int result;
- unsigned int len;
- unsigned char send_scsi_command[8] = {
- 0x41, 0, 0, 0, 0, 0, 0, 0
- };
- int i;
- char string[64];
- unsigned char *ptr;
- unsigned char inquiry_response[36] = {
- 0x00, 0x80, 0x00, 0x02, 0x1F, 0x00, 0x00, 0x00,
- 'S', 'a', 'n', 'D', 'i', 's', 'k', ' ',
- 'I', 'm', 'a', 'g', 'e', 'M', 'a', 't',
- 'e', ' ', 'S', 'D', 'D', 'R', '0', '9',
- ' ', ' ', ' ', ' '
- };
-
- /* This table tells us:
- X = command not supported
- L = return length in cmnd[4] (8 bits).
- H = return length in cmnd[7] and cmnd[8] (16 bits).
- D = return length in cmnd[6] to cmnd[9] (32 bits).
- B = return length/blocksize in cmnd[6] to cmnd[8].
- T = return length in cmnd[6] to cmnd[8] (24 bits).
- 0-9 = fixed return length
- W = 24 bytes
- h = return length/2048 in cmnd[7-8].
- */
-
- static char *lengths =
-
- /* 0123456789ABCDEF 0123456789ABCDEF */
-
- "0XXL0XXXXXXXXXXX" "XXLXXXXXXXX0XX0X" /* 00-1F */
- "XXXXX8XXhXH0XXX0" "XXXXX0XXXXXXXXXX" /* 20-3F */
- "XXHHL0X0XXH0XX0X" "XHH00HXX0TH0H0XX" /* 40-5F */
- "XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* 60-7F */
- "XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* 80-9F */
- "X0XXX0XXDXDXXXXX" "XXXXXXXXX000XHBX" /* A0-BF */
- "XXXXXXXXXXXXXXXX" "XXXXXXXXXXXXXXXX" /* C0-DF */
- "XDXXXXXXXXXXXXXX" "XXW00HXXXXXXXXXX"; /* E0-FF */
-
- if (us->flags & US_FL_NEED_INIT) {
- US_DEBUGP("SDDR-09: initializing\n");
- init_sddr09(us);
- us->flags &= ~US_FL_NEED_INIT;
- }
-
- /* if (srb->sc_data_direction == SCSI_DATA_WRITE) */
- len = srb->request_bufflen;
- /* else {
-
- switch (lengths[srb->cmnd[0]]) {
-
- case 'L':
- len = srb->cmnd[4];
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- len = lengths[srb->cmnd[0]]-'0';
- break;
- case 'H':
- len = (((unsigned int)srb->cmnd[7])<<8) | srb->cmnd[8];
- break;
- case 'h':
- len = (((unsigned int)srb->cmnd[7])<<8) | srb->cmnd[8];
- len <<= 11; // *2048
- break;
- case 'T':
- len = (((unsigned int)srb->cmnd[6])<<16) |
- (((unsigned int)srb->cmnd[7])<<8) |
- srb->cmnd[8];
- break;
- case 'D':
- len = (((unsigned int)srb->cmnd[6])<<24) |
- (((unsigned int)srb->cmnd[7])<<16) |
- (((unsigned int)srb->cmnd[8])<<8) |
- srb->cmnd[9];
- break;
- case 'W':
- len = 24;
- break;
- case 'B':
- // Let's try using the command structure's
- // request_bufflen here
- len = srb->request_bufflen;
- break;
- default:
- US_DEBUGP("Error: UNSUPPORTED COMMAND %02X\n",
- srb->cmnd[0]);
- return USB_STOR_TRANSPORT_ERROR;
- }
- } */
-
- if (srb->request_bufflen > 0xFFFF) {
- US_DEBUGP("Error: len = %08X... what do I do now?\n",
- len);
- return USB_STOR_TRANSPORT_ERROR;
- }
-
- /* Dummy up a response for INQUIRY since SDDR09 doesn't
- respond to INQUIRY commands */
-
- if (srb->cmnd[0] == INQUIRY) {
- memcpy(srb->request_buffer, inquiry_response, 36);
- return USB_STOR_TRANSPORT_GOOD;
- }
-
- for (; srb->cmd_len<12; srb->cmd_len++)
- srb->cmnd[srb->cmd_len] = 0;
-
- srb->cmnd[1] = 0x20;
-
- string[0] = 0;
- for (i=0; i<12; i++)
- sprintf(string+strlen(string), "%02X ", srb->cmnd[i]);
-
- US_DEBUGP("SDDR09: Send control for command %s\n",
- string);
-
- if ( (result = scm_send_control(us, send_scsi_command,
- srb->cmnd, 12)) != USB_STOR_TRANSPORT_GOOD)
- return result;
-
- US_DEBUGP("SDDR09: Control for command OK\n");
-
- if (srb->sc_data_direction == SCSI_DATA_WRITE ||
- srb->sc_data_direction == SCSI_DATA_READ) {
-
- US_DEBUGP("SDDR09: %s %d bytes\n",
- srb->sc_data_direction==SCSI_DATA_WRITE ?
- "sending" : "receiving",
- len);
-
- result = scm_bulk_transport(us,
- NULL, 0, srb->sc_data_direction,
- srb->request_buffer,
- len, srb->use_sg);
-
- return result;
-
- }
-
- return result;
-}
-
diff --git a/drivers/usb/storage/scm.h b/drivers/usb/storage/shuttle_usbat.h
index f57463a1e..eede2651f 100644
--- a/drivers/usb/storage/scm.h
+++ b/drivers/usb/storage/shuttle_usbat.h
@@ -1,8 +1,6 @@
/* Driver for SCM Microsystems USB-ATAPI cable
* Header File
*
- * $Id: scm.h,v 1.3 2000/07/24 19:19:52 mdharm Exp $
- *
* Current development and maintainance by:
* (c) 2000 Robert Baruch (autophile@dol.net)
*
@@ -23,60 +21,56 @@
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifndef _USB_SCM_H
-#define _USB_SCM_H
+#ifndef _USB_SHUTTLE_USBAT_H
+#define _USB_SHUTTLE_USBAT_H
-#define SCM_EPP_PORT 0x10
-#define SCM_EPP_REGISTER 0x30
-#define SCM_ATA 0x40
-#define SCM_ISA 0x50
+#define USBAT_EPP_PORT 0x10
+#define USBAT_EPP_REGISTER 0x30
+#define USBAT_ATA 0x40
+#define USBAT_ISA 0x50
/* SCM User I/O Data registers */
-#define SCM_UIO_EPAD 0x80 // Enable Peripheral Control Signals
-#define SCM_UIO_CDT 0x40 // Card Detect (Read Only)
+#define USBAT_UIO_EPAD 0x80 // Enable Peripheral Control Signals
+#define USBAT_UIO_CDT 0x40 // Card Detect (Read Only)
// CDT = ACKD & !UI1 & !UI0
-#define SCM_UIO_1 0x20 // I/O 1
-#define SCM_UIO_0 0x10 // I/O 0
-#define SCM_UIO_EPP_ATA 0x08 // 1=EPP mode, 0=ATA mode
-#define SCM_UIO_UI1 0x04 // Input 1
-#define SCM_UIO_UI0 0x02 // Input 0
-#define SCM_UIO_INTR_ACK 0x01 // Interrupt (ATA & ISA)/Acknowledge (EPP)
+#define USBAT_UIO_1 0x20 // I/O 1
+#define USBAT_UIO_0 0x10 // I/O 0
+#define USBAT_UIO_EPP_ATA 0x08 // 1=EPP mode, 0=ATA mode
+#define USBAT_UIO_UI1 0x04 // Input 1
+#define USBAT_UIO_UI0 0x02 // Input 0
+#define USBAT_UIO_INTR_ACK 0x01 // Interrupt (ATA & ISA)/Acknowledge (EPP)
/* SCM User I/O Enable registers */
-#define SCM_UIO_DRVRST 0x80 // Reset Peripheral
-#define SCM_UIO_ACKD 0x40 // Enable Card Detect
-#define SCM_UIO_OE1 0x20 // I/O 1 set=output/clr=input
+#define USBAT_UIO_DRVRST 0x80 // Reset Peripheral
+#define USBAT_UIO_ACKD 0x40 // Enable Card Detect
+#define USBAT_UIO_OE1 0x20 // I/O 1 set=output/clr=input
// If ACKD=1, set OE1 to 1 also.
-#define SCM_UIO_OE0 0x10 // I/O 0 set=output/clr=input
-#define SCM_UIO_ADPRST 0x01 // Reset SCM chip
+#define USBAT_UIO_OE0 0x10 // I/O 0 set=output/clr=input
+#define USBAT_UIO_ADPRST 0x01 // Reset SCM chip
-/* SCM-specific commands */
+/* USBAT-specific commands */
-extern int scm_read(struct us_data *us, unsigned char access,
+extern int usbat_read(struct us_data *us, unsigned char access,
unsigned char reg, unsigned char *content);
-extern int scm_write(struct us_data *us, unsigned char access,
+extern int usbat_write(struct us_data *us, unsigned char access,
unsigned char reg, unsigned char content);
-extern int scm_read_block(struct us_data *us, unsigned char access,
+extern int usbat_read_block(struct us_data *us, unsigned char access,
unsigned char reg, unsigned char *content, unsigned short len,
int use_sg);
-extern int scm_write_block(struct us_data *us, unsigned char access,
+extern int usbat_write_block(struct us_data *us, unsigned char access,
unsigned char reg, unsigned char *content, unsigned short len,
int use_sg);
-extern int scm_multiple_write(struct us_data *us, unsigned char access,
+extern int usbat_multiple_write(struct us_data *us, unsigned char access,
unsigned char *registers, unsigned char *data_out,
unsigned short num_registers);
-extern int scm_read_user_io(struct us_data *us, unsigned char *data_flags);
-extern int scm_write_user_io(struct us_data *us,
+extern int usbat_read_user_io(struct us_data *us, unsigned char *data_flags);
+extern int usbat_write_user_io(struct us_data *us,
unsigned char enable_flags, unsigned char data_flags);
/* HP 8200e stuff */
extern int hp8200e_transport(Scsi_Cmnd *srb, struct us_data *us);
-/* Sandisk SDDR-09 stuff */
-
-extern int sddr09_transport(Scsi_Cmnd *srb, struct us_data *us);
-
#endif
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index 88c847641..69dfcfde8 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -1,6 +1,6 @@
/* Driver for USB Mass Storage compliant devices
*
- * $Id: transport.c,v 1.3 2000/07/20 01:06:40 mdharm Exp $
+ * $Id: transport.c,v 1.4 2000/07/25 23:04:47 mdharm Exp $
*
* Current development and maintainance by:
* (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
@@ -203,7 +203,7 @@ static int us_transfer_partial(struct us_data *us, char *buf, int length)
int pipe;
/* calculate the appropriate pipe information */
- if (US_DIRECTION(us->srb->cmnd[0]))
+ if (us->srb->sc_data_direction == SCSI_DATA_READ)
pipe = usb_rcvbulkpipe(us->pusb_dev, us->ep_in);
else
pipe = usb_sndbulkpipe(us->pusb_dev, us->ep_out);
@@ -258,7 +258,7 @@ static int us_transfer_partial(struct us_data *us, char *buf, int length)
* function simply determines if we're going to use scatter-gather or not,
* and acts appropriately. For now, it also re-interprets the error codes.
*/
-static void us_transfer(Scsi_Cmnd *srb, struct us_data* us, int dir_in)
+static void us_transfer(Scsi_Cmnd *srb, struct us_data* us)
{
int i;
int result = -1;
@@ -414,8 +414,9 @@ void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us)
if (need_auto_sense) {
int temp_result;
void* old_request_buffer;
- int old_sg;
- int old_request_bufflen;
+ unsigned short old_sg;
+ unsigned old_request_bufflen;
+ unsigned char old_sc_data_direction;
unsigned char old_cmnd[MAX_COMMAND_SIZE];
US_DEBUGP("Issuing auto-REQUEST_SENSE\n");
@@ -431,13 +432,21 @@ void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us)
srb->cmnd[4] = 18;
srb->cmnd[5] = 0;
- /* set the buffer length for transfer */
+ /* set the transfer direction */
+ old_sc_data_direction = srb->sc_data_direction;
+ srb->sc_data_direction = SCSI_DATA_READ;
+
+ /* use the new buffer we have */
old_request_buffer = srb->request_buffer;
+ srb->request_buffer = srb->sense_buffer;
+
+ /* set the buffer length for transfer */
old_request_bufflen = srb->request_bufflen;
+ srb->request_bufflen = 18;
+
+ /* set up for no scatter-gather use */
old_sg = srb->use_sg;
srb->use_sg = 0;
- srb->request_bufflen = 18;
- srb->request_buffer = srb->sense_buffer;
/* issue the auto-sense command */
temp_result = us->transport(us->srb, us);
@@ -462,6 +471,7 @@ void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us)
srb->request_buffer = old_request_buffer;
srb->request_bufflen = old_request_bufflen;
srb->use_sg = old_sg;
+ srb->sc_data_direction = old_sc_data_direction;
memcpy(srb->cmnd, old_cmnd, MAX_COMMAND_SIZE);
/* If things are really okay, then let's show that */
@@ -555,7 +565,7 @@ int usb_stor_CBI_transport(Scsi_Cmnd *srb, struct us_data *us)
/* DATA STAGE */
/* transfer the data payload for this command, if one exists*/
if (us_transfer_length(srb, us)) {
- us_transfer(srb, us, US_DIRECTION(srb->cmnd[0]));
+ us_transfer(srb, us);
US_DEBUGP("CBI data stage result is 0x%x\n", srb->result);
/* if it was aborted, we need to indicate that */
@@ -656,7 +666,7 @@ int usb_stor_CB_transport(Scsi_Cmnd *srb, struct us_data *us)
/* DATA STAGE */
/* transfer the data payload for this command, if one exists*/
if (us_transfer_length(srb, us)) {
- us_transfer(srb, us, US_DIRECTION(srb->cmnd[0]));
+ us_transfer(srb, us);
US_DEBUGP("CB data stage result is 0x%x\n", srb->result);
/* if it was aborted, we need to indicate that */
@@ -718,7 +728,7 @@ int usb_stor_Bulk_transport(Scsi_Cmnd *srb, struct us_data *us)
/* set up the command wrapper */
bcb.Signature = cpu_to_le32(US_BULK_CB_SIGN);
bcb.DataTransferLength = cpu_to_le32(us_transfer_length(srb, us));
- bcb.Flags = US_DIRECTION(srb->cmnd[0]) << 7;
+ bcb.Flags = srb->sc_data_direction == SCSI_DATA_READ ? 1 << 7 : 0;
bcb.Tag = srb->serial_number;
bcb.Lun = srb->cmnd[1] >> 5;
bcb.Length = srb->cmd_len;
@@ -755,7 +765,7 @@ int usb_stor_Bulk_transport(Scsi_Cmnd *srb, struct us_data *us)
if (result == 0) {
/* send/receive data payload, if there is any */
if (bcb.DataTransferLength) {
- us_transfer(srb, us, bcb.Flags);
+ us_transfer(srb, us);
US_DEBUGP("Bulk data transfer result 0x%x\n",
srb->result);
diff --git a/drivers/usb/storage/transport.h b/drivers/usb/storage/transport.h
index 55e12f79f..9d0993c1e 100644
--- a/drivers/usb/storage/transport.h
+++ b/drivers/usb/storage/transport.h
@@ -1,7 +1,7 @@
/* Driver for USB Mass Storage compliant devices
* Transport Functions Header File
*
- * $Id: transport.h,v 1.4 2000/07/23 18:40:38 groovyjava Exp $
+ * $Id: transport.h,v 1.6 2000/07/27 14:42:43 groovyjava Exp $
*
* Current development and maintainance by:
* (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
@@ -46,10 +46,6 @@
#include "usb.h"
#include "scsi.h"
-/* bit set if input */
-extern unsigned char us_direction[256/8];
-#define US_DIRECTION(x) ((us_direction[x>>3] >> (x & 7)) & 1)
-
/* Protocols */
#define US_PR_CBI 0x00 /* Control/Bulk/Interrupt */
@@ -59,7 +55,8 @@ extern unsigned char us_direction[256/8];
#define US_PR_SCM_ATAPI 0x80 /* SCM-ATAPI bridge */
#endif
#ifdef CONFIG_USB_STORAGE_SDDR09
-#define US_PR_SCM_SCSI 0x81 /* SCM-SCSI bridge */
+#define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for
+ SDDR-09 */
#endif
/*
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 99986371f..c82d7e914 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -1,6 +1,6 @@
/* Driver for USB Mass Storage compliant devices
*
- * $Id: usb.c,v 1.11 2000/07/24 20:37:24 mdharm Exp $
+ * $Id: usb.c,v 1.14 2000/07/27 14:42:43 groovyjava Exp $
*
* Current development and maintainance by:
* (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
@@ -50,8 +50,11 @@
#include "transport.h"
#include "protocol.h"
#include "debug.h"
-#if defined(CONFIG_USB_STORAGE_HP8200e) || defined(CONFIG_USB_STORAGE_SDDR09)
-#include "scm.h"
+#ifdef CONFIG_USB_STORAGE_HP8200e
+#include "shuttle_usbat.h"
+#endif
+#ifdef CONFIG_USB_STORAGE_SDDR09
+#include "sddr09.h"
#endif
#include <linux/module.h>
@@ -117,9 +120,9 @@ static int usb_stor_control_thread(void * __us)
/* signal that we've started the thread */
up(&(us->notify));
+ set_current_state(TASK_INTERRUPTIBLE);
for(;;) {
- set_current_state(TASK_INTERRUPTIBLE);
US_DEBUGP("*** thread sleeping.\n");
schedule();
US_DEBUGP("*** thread awakened.\n");
@@ -137,15 +140,27 @@ static int usb_stor_control_thread(void * __us)
switch (action) {
case US_ACT_COMMAND:
+ /* reject the command if the direction indicator
+ * is UNKNOWN
+ */
+ if (us->srb->sc_data_direction == SCSI_DATA_UNKNOWN) {
+ US_DEBUGP("UNKNOWN data direction\n");
+ us->srb->result = DID_ERROR;
+ set_current_state(TASK_INTERRUPTIBLE);
+ us->srb->scsi_done(us->srb);
+ us->srb = NULL;
+ break;
+ }
+
/* reject if target != 0 or if LUN is higher than
* the maximum known LUN
*/
if (us->srb->target || (us->srb->lun > us->max_lun)) {
US_DEBUGP("Bad device number (%d/%d)\n",
us->srb->target, us->srb->lun);
-
us->srb->result = DID_BAD_TARGET << 16;
+ set_current_state(TASK_INTERRUPTIBLE);
us->srb->scsi_done(us->srb);
us->srb = NULL;
break;
@@ -155,6 +170,8 @@ static int usb_stor_control_thread(void * __us)
if ((us->srb->cmnd[0] == START_STOP) &&
(us->flags & US_FL_START_STOP)) {
us->srb->result = GOOD;
+
+ set_current_state(TASK_INTERRUPTIBLE);
us->srb->scsi_done(us->srb);
us->srb = NULL;
break;
@@ -194,9 +211,11 @@ static int usb_stor_control_thread(void * __us)
if (us->srb->result != DID_ABORT << 16) {
US_DEBUGP("scsi cmd done, result=0x%x\n",
us->srb->result);
+ set_current_state(TASK_INTERRUPTIBLE);
us->srb->scsi_done(us->srb);
} else {
US_DEBUGP("scsi command aborted\n");
+ set_current_state(TASK_INTERRUPTIBLE);
up(&(us->notify));
}
us->srb = NULL;
@@ -253,12 +272,12 @@ static struct us_unusual_dev us_unusual_dev_list[] = {
US_SC_UFI, US_PR_CBI, US_FL_SINGLE_LUN},
{ 0x0693, 0x0002, 0x0100, 0x0100, "Hagiwara FlashGate SmartMedia",
US_SC_SCSI, US_PR_BULK, US_FL_ALT_LENGTH},
- { 0x0781, 0x0001, 0x0200, 0x0200, "Sandisk ImageMate (SDDR-01)",
+ { 0x0781, 0x0001, 0x0200, 0x0200, "Sandisk ImageMate (SDDR-05a)",
US_SC_SCSI, US_PR_CB, US_FL_SINGLE_LUN | US_FL_START_STOP},
#ifdef CONFIG_USB_STORAGE_SDDR09
{ 0x0781, 0x0200, 0x0100, 0x0100, "Sandisk ImageMate (SDDR-09)",
- US_SC_SCSI, US_PR_SCM_SCSI,
- US_FL_SINGLE_LUN | US_FL_START_STOP | US_FL_NEED_INIT},
+ US_SC_SCSI, US_PR_EUSB_SDDR09,
+ US_FL_SINGLE_LUN | US_FL_START_STOP},
#endif
{ 0x0781, 0x0002, 0x0009, 0x0009, "Sandisk Imagemate (SDDR-31)",
US_SC_SCSI, US_PR_BULK, US_FL_IGNORE_SER},
@@ -447,7 +466,7 @@ static void * storage_probe(struct usb_device *dev, unsigned int ifnum)
/* set the interface -- STALL is an acceptable response here */
#ifdef CONFIG_USB_STORAGE_SDDR09
- if (protocol != US_PR_SCM_SCSI)
+ if (protocol != US_PR_EUSB_SDDR09)
result = usb_set_interface(dev,
altsetting->bInterfaceNumber, 0);
else
@@ -631,8 +650,8 @@ static void * storage_probe(struct usb_device *dev, unsigned int ifnum)
#endif
#ifdef CONFIG_USB_STORAGE_SDDR09
- case US_PR_SCM_SCSI:
- ss->transport_name = "SCM/SCSI";
+ case US_PR_EUSB_SDDR09:
+ ss->transport_name = "EUSB/SDDR09";
ss->transport = sddr09_transport;
ss->transport_reset = usb_stor_CB_reset;
ss->max_lun = 1;
@@ -855,3 +874,6 @@ void __exit usb_stor_exit(void)
module_init(usb_stor_init) ;
module_exit(usb_stor_exit) ;
+
+MODULE_AUTHOR("Michael Gee <michael@linuxspecific.com>, David L. Brown, Jr. <usb-storage@davidb.org>, Matthew Dharm <mdharm-usb@one-eyed-alien.net>");
+MODULE_DESCRIPTION("USB Mass Storage driver");
diff --git a/drivers/usb/uhci.c b/drivers/usb/uhci.c
index 31be1c0e2..8423b448a 100644
--- a/drivers/usb/uhci.c
+++ b/drivers/usb/uhci.c
@@ -49,6 +49,7 @@ static int handle_pm_event(struct pm_dev *dev, pm_request_t rqst, void *data);
static int debug = 1;
MODULE_PARM(debug, "i");
+MODULE_PARM_DESC(debug, "Debug level");
static kmem_cache_t *uhci_td_cachep;
static kmem_cache_t *uhci_qh_cachep;
@@ -2541,5 +2542,8 @@ void cleanup_module(void)
pm_unregister_all(handle_pm_event);
uhci_cleanup();
}
+
+MODULE_AUTHOR("Linus Torvalds, Johannes Erdfelt, Randy Dunlap, Georg Acher, Deti Fliegl, Thomas Sailer, Roman Weissgaerber");
+MODULE_DESCRIPTION("USB Universal Host Controller Interface driver");
#endif //MODULE
diff --git a/drivers/usb/usb-ohci.c b/drivers/usb/usb-ohci.c
index 48a5df48e..cfa871503 100644
--- a/drivers/usb/usb-ohci.c
+++ b/drivers/usb/usb-ohci.c
@@ -65,6 +65,9 @@
*/
#include <linux/adb.h>
#include <linux/pmu.h>
+#ifndef CONFIG_PM
+#define CONFIG_PM
+#endif
#endif
@@ -415,9 +418,11 @@ static int sohci_submit_urb (urb_t * urb)
int i, size = 0;
unsigned long flags;
- if (!urb->dev || !urb->dev->bus) return -EINVAL;
+ if (!urb->dev || !urb->dev->bus)
+ return -EINVAL;
- if (urb->hcpriv) return -EINVAL; /* urb already in use */
+ if (urb->hcpriv) /* urb already in use */
+ return -EINVAL;
// if(usb_endpoint_halted (urb->dev, usb_pipeendpoint (pipe), usb_pipeout (pipe)))
// return -EPIPE;
@@ -435,8 +440,10 @@ static int sohci_submit_urb (urb_t * urb)
/* when controller's hung, permit only roothub cleanup attempts
* such as powering down ports */
- if (ohci->disabled)
+ if (ohci->disabled) {
+ usb_dec_dev_use (urb->dev);
return -ESHUTDOWN;
+ }
/* every endpoint has a ed, locate and fill it */
if (!(ed = ep_add_ed (urb->dev, pipe, urb->interval, 1))) {
@@ -1730,7 +1737,9 @@ static int rh_submit_urb (urb_t * urb)
urb_print (urb, "RET(rh)", usb_pipeout (urb->pipe));
#endif
- if (urb->complete) urb->complete (urb);
+ if (urb->complete)
+ urb->complete (urb);
+ usb_dec_dev_use (urb->dev);
return 0;
}
@@ -1880,7 +1889,9 @@ static void hc_interrupt (int irq, void * __ohci, struct pt_regs * r)
ohci->ohci_dev->slot_name);
// e.g. due to PCI Master/Target Abort
-#ifndef DEBUG
+#ifdef DEBUG
+ ohci_dump (ohci, 1);
+#else
// FIXME: be optimistic, hope that bug won't repeat often.
// Make some non-interrupt context restart the controller.
// Count and limit the retries though; either hardware or
@@ -1910,6 +1921,8 @@ static void hc_interrupt (int irq, void * __ohci, struct pt_regs * r)
}
writel (ints, &regs->intrstatus);
writel (OHCI_INTR_MIE, &regs->intrenable);
+
+ /* FIXME: check URB timeouts */
}
/*-------------------------------------------------------------------------*/
@@ -1921,7 +1934,7 @@ static ohci_t * __devinit hc_alloc_ohci (void * mem_base)
ohci_t * ohci;
struct usb_bus * bus;
- ohci = (ohci_t *) __get_free_pages (GFP_KERNEL, 1);
+ ohci = (ohci_t *) kmalloc (sizeof *ohci, GFP_KERNEL);
if (!ohci)
return NULL;
@@ -1932,7 +1945,7 @@ static ohci_t * __devinit hc_alloc_ohci (void * mem_base)
bus = usb_alloc_bus (&sohci_device_operations);
if (!bus) {
- free_pages ((unsigned long) ohci, 1);
+ kfree (ohci);
return NULL;
}
@@ -1974,7 +1987,7 @@ static void hc_release_ohci (ohci_t * ohci)
/* unmap the IO address space */
iounmap (ohci->regs);
- free_pages ((unsigned long) ohci, 1);
+ kfree (ohci);
}
/*-------------------------------------------------------------------------*/
@@ -2085,13 +2098,27 @@ static void hc_restart (ohci_t *ohci)
static int __devinit
ohci_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
{
- unsigned long mem_resource;
+ unsigned long mem_resource, mem_len;
u8 latency, limit;
void *mem_base;
if (pci_enable_device(dev) < 0)
return -ENODEV;
+ /* we read its hardware registers as memory */
+ mem_resource = pci_resource_start(dev, 0);
+ mem_len = pci_resource_len(dev, 0);
+ if (!request_mem_region (mem_resource, mem_len, ohci_pci_driver.name)) {
+ dbg ("controller already in use");
+ return -EBUSY;
+ }
+
+ mem_base = ioremap_nocache (mem_resource, mem_len);
+ if (!mem_base) {
+ err("Error mapping OHCI memory");
+ return -EFAULT;
+ }
+
/* controller writes into our memory */
pci_set_master (dev);
pci_read_config_byte (dev, PCI_LATENCY_TIMER, &latency);
@@ -2103,15 +2130,6 @@ ohci_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
}
}
- /* we read its hardware registers as memory */
- mem_resource = pci_resource_start(dev, 0);
- /* request_mem_region ... */
- mem_base = ioremap_nocache (mem_resource, 4096);
- if (!mem_base) {
- err("Error mapping OHCI memory");
- return -EFAULT;
- }
-
return hc_found_ohci (dev, dev->irq, mem_base);
}
@@ -2145,6 +2163,8 @@ ohci_pci_remove (struct pci_dev *dev)
&ohci->regs->control);
hc_release_ohci (ohci);
+
+ release_mem_region (pci_resource_start (dev, 0), pci_resource_len (dev, 0));
}
@@ -2233,7 +2253,7 @@ ohci_pci_resume (struct pci_dev *dev)
/*-------------------------------------------------------------------------*/
-static const struct __devinitdata pci_device_id ohci_pci_ids [] = { {
+static const struct pci_device_id __devinitdata ohci_pci_ids [] = { {
/* handle any USB OHCI controller */
class: ((PCI_CLASS_SERIAL_USB << 8) | 0x10),
@@ -2328,4 +2348,5 @@ module_exit (ohci_hcd_cleanup);
#endif /* MODULE */
+MODULE_AUTHOR ("Roman Weissgaerber <weissg@vienna.at>");
MODULE_DESCRIPTION ("USB OHCI Host Controller Driver");
diff --git a/drivers/usb/usb-uhci.c b/drivers/usb/usb-uhci.c
index 626bfc93c..e82fa78a0 100644
--- a/drivers/usb/usb-uhci.c
+++ b/drivers/usb/usb-uhci.c
@@ -2885,4 +2885,6 @@ void cleanup_module (void)
uhci_cleanup ();
}
+MODULE_AUTHOR("Georg Acher, Deti Fliegl, Thomas Sailer, Roman Weissgaerber");
+MODULE_DESCRIPTION("USB Universal Host Controller Interface driver");
#endif //MODULE
diff --git a/drivers/usb/usbkbd.c b/drivers/usb/usbkbd.c
index 42f82604e..89cc76537 100644
--- a/drivers/usb/usbkbd.c
+++ b/drivers/usb/usbkbd.c
@@ -36,6 +36,7 @@
#include <linux/usb.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
+MODULE_DESCRIPTION("USB HID Boot Protocol keyboard driver");
static unsigned char usb_kbd_keycode[256] = {
0, 0, 0, 0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38,
diff --git a/drivers/usb/usbmouse.c b/drivers/usb/usbmouse.c
index 55bd14fdb..39df8e5e0 100644
--- a/drivers/usb/usbmouse.c
+++ b/drivers/usb/usbmouse.c
@@ -36,6 +36,7 @@
#include <linux/usb.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
+MODULE_DESCRIPTION("USB HID Boot Protocol mouse driver");
struct usb_mouse {
signed char data[8];
diff --git a/drivers/usb/wacom.c b/drivers/usb/wacom.c
index de2821e47..b74a003e8 100644
--- a/drivers/usb/wacom.c
+++ b/drivers/usb/wacom.c
@@ -51,6 +51,7 @@
#include <linux/usb.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
+MODULE_DESCRIPTION("USB Wacom Graphire and Wacom Intuos tablet driver");
/*
* Wacom Graphire packet: