mirror of https://gitee.com/openkylin/linux.git
[PATCH] USB Storage: add alauda support
This patch adds another usb-storage subdriver, which supports two fairly old dual-XD/SmartMedia reader-writers (USB1.1 devices). This driver was written by Daniel Drake <dsd@gentoo.org> -- he notes that he wrote this driver without specs, however a vendor-supplied GPL driver for the previous generation of products ("sma03") did prove to be quite useful, as did the sddr09 driver which also has to deal with low-level physical block layout on SmartMedia. The original patch has been reformed by me, as it clashed with the libusual patches. We really need to consolidate some of this common SmartMedia code, and get together with the MTD guys to share it with them as well. Signed-off-by: Daniel Drake <dsd@gentoo.org> Signed-off-by: Matthew Dharm <mdharm-usb@one-eyed-alien.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
a6c976c6c4
commit
e80b0fade0
|
@ -112,6 +112,15 @@ config USB_STORAGE_JUMPSHOT
|
|||
Say Y here to include additional code to support the Lexar Jumpshot
|
||||
USB CompactFlash reader.
|
||||
|
||||
config USB_STORAGE_ALAUDA
|
||||
bool "Olympus MAUSB-10/Fuji DPC-R1 support (EXPERIMENTAL)"
|
||||
depends on USB_STORAGE && EXPERIMENTAL
|
||||
help
|
||||
Say Y here to include additional code to support the Olympus MAUSB-10
|
||||
and Fujifilm DPC-R1 USB Card reader/writer devices.
|
||||
|
||||
These devices are based on the Alauda chip and support support both
|
||||
XD and SmartMedia cards.
|
||||
|
||||
config USB_STORAGE_ONETOUCH
|
||||
bool "Support OneTouch Button on Maxtor Hard Drives (EXPERIMENTAL)"
|
||||
|
|
|
@ -18,6 +18,7 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_DPCM) += dpcm.o
|
|||
usb-storage-obj-$(CONFIG_USB_STORAGE_ISD200) += isd200.o
|
||||
usb-storage-obj-$(CONFIG_USB_STORAGE_DATAFAB) += datafab.o
|
||||
usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += jumpshot.o
|
||||
usb-storage-obj-$(CONFIG_USB_STORAGE_ALAUDA) += alauda.o
|
||||
usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o
|
||||
|
||||
usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Driver for Alauda-based card readers
|
||||
*
|
||||
* Current development and maintenance by:
|
||||
* (c) 2005 Daniel Drake <dsd@gentoo.org>
|
||||
*
|
||||
* See alauda.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_ALAUDA_H
|
||||
#define _USB_ALAUDA_H
|
||||
|
||||
/*
|
||||
* Status bytes
|
||||
*/
|
||||
#define ALAUDA_STATUS_ERROR 0x01
|
||||
#define ALAUDA_STATUS_READY 0x40
|
||||
|
||||
/*
|
||||
* Control opcodes (for request field)
|
||||
*/
|
||||
#define ALAUDA_GET_XD_MEDIA_STATUS 0x08
|
||||
#define ALAUDA_GET_SM_MEDIA_STATUS 0x98
|
||||
#define ALAUDA_ACK_XD_MEDIA_CHANGE 0x0a
|
||||
#define ALAUDA_ACK_SM_MEDIA_CHANGE 0x9a
|
||||
#define ALAUDA_GET_XD_MEDIA_SIG 0x86
|
||||
#define ALAUDA_GET_SM_MEDIA_SIG 0x96
|
||||
|
||||
/*
|
||||
* Bulk command identity (byte 0)
|
||||
*/
|
||||
#define ALAUDA_BULK_CMD 0x40
|
||||
|
||||
/*
|
||||
* Bulk opcodes (byte 1)
|
||||
*/
|
||||
#define ALAUDA_BULK_GET_REDU_DATA 0x85
|
||||
#define ALAUDA_BULK_READ_BLOCK 0x94
|
||||
#define ALAUDA_BULK_ERASE_BLOCK 0xa3
|
||||
#define ALAUDA_BULK_WRITE_BLOCK 0xb4
|
||||
#define ALAUDA_BULK_GET_STATUS2 0xb7
|
||||
#define ALAUDA_BULK_RESET_MEDIA 0xe0
|
||||
|
||||
/*
|
||||
* Port to operate on (byte 8)
|
||||
*/
|
||||
#define ALAUDA_PORT_XD 0x00
|
||||
#define ALAUDA_PORT_SM 0x01
|
||||
|
||||
/*
|
||||
* LBA and PBA are unsigned ints. Special values.
|
||||
*/
|
||||
#define UNDEF 0xffff
|
||||
#define SPARE 0xfffe
|
||||
#define UNUSABLE 0xfffd
|
||||
|
||||
int init_alauda(struct us_data *us);
|
||||
int alauda_transport(struct scsi_cmnd *srb, struct us_data *us);
|
||||
|
||||
struct alauda_media_info {
|
||||
unsigned long capacity; /* total media size in bytes */
|
||||
unsigned int pagesize; /* page size in bytes */
|
||||
unsigned int blocksize; /* number of pages per block */
|
||||
unsigned int uzonesize; /* number of usable blocks per zone */
|
||||
unsigned int zonesize; /* number of blocks per zone */
|
||||
unsigned int blockmask; /* mask to get page from address */
|
||||
|
||||
unsigned char pageshift;
|
||||
unsigned char blockshift;
|
||||
unsigned char zoneshift;
|
||||
|
||||
u16 **lba_to_pba; /* logical to physical block map */
|
||||
u16 **pba_to_lba; /* physical to logical block map */
|
||||
};
|
||||
|
||||
struct alauda_info {
|
||||
struct alauda_media_info port[2];
|
||||
int wr_ep; /* endpoint to write data out of */
|
||||
|
||||
unsigned char sense_key;
|
||||
unsigned long sense_asc; /* additional sense code */
|
||||
unsigned long sense_ascq; /* additional sense code qualifier */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -535,6 +535,13 @@ UNUSUAL_DEV( 0x057b, 0x0022, 0x0000, 0x9999,
|
|||
"Silicon Media R/W",
|
||||
US_SC_DEVICE, US_PR_DEVICE, NULL, 0),
|
||||
|
||||
#ifdef CONFIG_USB_STORAGE_ALAUDA
|
||||
UNUSUAL_DEV( 0x0584, 0x0008, 0x0102, 0x0102,
|
||||
"Fujifilm",
|
||||
"DPC-R1 (Alauda)",
|
||||
US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0 ),
|
||||
#endif
|
||||
|
||||
/* Fabrizio Fellini <fello@libero.it> */
|
||||
UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210,
|
||||
"Fujifilm",
|
||||
|
@ -784,6 +791,13 @@ UNUSUAL_DEV( 0x07af, 0x0006, 0x0100, 0x0100,
|
|||
US_SC_SCSI, US_PR_DPCM_USB, NULL, 0 ),
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_STORAGE_ALAUDA
|
||||
UNUSUAL_DEV( 0x07b4, 0x010a, 0x0102, 0x0102,
|
||||
"Olympus",
|
||||
"MAUSB-10 (Alauda)",
|
||||
US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0 ),
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_STORAGE_DATAFAB
|
||||
UNUSUAL_DEV( 0x07c4, 0xa000, 0x0000, 0x0015,
|
||||
"Datafab",
|
||||
|
|
|
@ -94,6 +94,9 @@
|
|||
#ifdef CONFIG_USB_STORAGE_ONETOUCH
|
||||
#include "onetouch.h"
|
||||
#endif
|
||||
#ifdef CONFIG_USB_STORAGE_ALAUDA
|
||||
#include "alauda.h"
|
||||
#endif
|
||||
|
||||
/* Some informational data */
|
||||
MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>");
|
||||
|
@ -644,6 +647,15 @@ static int get_protocol(struct us_data *us)
|
|||
break;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_STORAGE_ALAUDA
|
||||
case US_PR_ALAUDA:
|
||||
us->transport_name = "Alauda Control/Bulk";
|
||||
us->transport = alauda_transport;
|
||||
us->transport_reset = usb_stor_Bulk_reset;
|
||||
us->max_lun = 1;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
return -EIO;
|
||||
}
|
||||
|
|
|
@ -102,6 +102,9 @@ enum { US_DO_ALL_FLAGS };
|
|||
#ifdef CONFIG_USB_STORAGE_JUMPSHOT
|
||||
#define US_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */
|
||||
#endif
|
||||
#ifdef CONFIG_USB_STORAGE_ALAUDA
|
||||
#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */
|
||||
#endif
|
||||
|
||||
#define US_PR_DEVICE 0xff /* Use device's value */
|
||||
|
||||
|
|
Loading…
Reference in New Issue