mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-15 08:44:14 +08:00
usb-storage: make alauda a separate module
This patch (as1215) converts usb-storage's alauda subdriver into a separate module. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
a9fb6d05d5
commit
a74bba3bf9
@ -119,7 +119,7 @@ config USB_STORAGE_JUMPSHOT
|
||||
If this driver is compiled as a module, it will be named ums-jumpshot.
|
||||
|
||||
config USB_STORAGE_ALAUDA
|
||||
bool "Olympus MAUSB-10/Fuji DPC-R1 support"
|
||||
tristate "Olympus MAUSB-10/Fuji DPC-R1 support"
|
||||
depends on USB_STORAGE
|
||||
help
|
||||
Say Y here to include additional code to support the Olympus MAUSB-10
|
||||
@ -128,6 +128,8 @@ config USB_STORAGE_ALAUDA
|
||||
These devices are based on the Alauda chip and support both
|
||||
XD and SmartMedia cards.
|
||||
|
||||
If this driver is compiled as a module, it will be named ums-alauda.
|
||||
|
||||
config USB_STORAGE_ONETOUCH
|
||||
bool "Support OneTouch Button on Maxtor Hard Drives"
|
||||
depends on USB_STORAGE
|
||||
|
@ -10,7 +10,6 @@ EXTRA_CFLAGS := -Idrivers/scsi
|
||||
obj-$(CONFIG_USB_STORAGE) += usb-storage.o
|
||||
|
||||
usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG) += debug.o
|
||||
usb-storage-obj-$(CONFIG_USB_STORAGE_ALAUDA) += alauda.o
|
||||
usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o
|
||||
usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA) += karma.o
|
||||
|
||||
@ -23,6 +22,7 @@ else
|
||||
obj-$(CONFIG_USB) += libusual.o usual-tables.o
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_USB_STORAGE_ALAUDA) += ums-alauda.o
|
||||
obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += ums-cypress.o
|
||||
obj-$(CONFIG_USB_STORAGE_DATAFAB) += ums-datafab.o
|
||||
obj-$(CONFIG_USB_STORAGE_FREECOM) += ums-freecom.o
|
||||
@ -32,6 +32,7 @@ obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o
|
||||
obj-$(CONFIG_USB_STORAGE_SDDR55) += ums-sddr55.o
|
||||
obj-$(CONFIG_USB_STORAGE_USBAT) += ums-usbat.o
|
||||
|
||||
ums-alauda-objs := alauda.o
|
||||
ums-cypress-objs := cypress_atacb.o
|
||||
ums-datafab-objs := datafab.o
|
||||
ums-freecom-objs := freecom.o
|
||||
|
@ -31,6 +31,8 @@
|
||||
* 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <scsi/scsi.h>
|
||||
#include <scsi/scsi_cmnd.h>
|
||||
#include <scsi/scsi_device.h>
|
||||
@ -39,7 +41,75 @@
|
||||
#include "transport.h"
|
||||
#include "protocol.h"
|
||||
#include "debug.h"
|
||||
#include "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
|
||||
|
||||
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 */
|
||||
};
|
||||
|
||||
#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) )
|
||||
#define LSB_of(s) ((s)&0xFF)
|
||||
@ -52,6 +122,48 @@
|
||||
#define PBA_HI(pba) (pba >> 3)
|
||||
#define PBA_ZONE(pba) (pba >> 11)
|
||||
|
||||
static int init_alauda(struct us_data *us);
|
||||
|
||||
|
||||
/*
|
||||
* The table of devices
|
||||
*/
|
||||
#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
|
||||
vendorName, productName, useProtocol, useTransport, \
|
||||
initFunction, flags) \
|
||||
{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
|
||||
.driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
|
||||
|
||||
struct usb_device_id alauda_usb_ids[] = {
|
||||
# include "unusual_alauda.h"
|
||||
{ } /* Terminating entry */
|
||||
};
|
||||
MODULE_DEVICE_TABLE(usb, alauda_usb_ids);
|
||||
|
||||
#undef UNUSUAL_DEV
|
||||
|
||||
/*
|
||||
* The flags table
|
||||
*/
|
||||
#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
|
||||
vendor_name, product_name, use_protocol, use_transport, \
|
||||
init_function, Flags) \
|
||||
{ \
|
||||
.vendorName = vendor_name, \
|
||||
.productName = product_name, \
|
||||
.useProtocol = use_protocol, \
|
||||
.useTransport = use_transport, \
|
||||
.initFunction = init_function, \
|
||||
}
|
||||
|
||||
static struct us_unusual_dev alauda_unusual_dev_list[] = {
|
||||
# include "unusual_alauda.h"
|
||||
{ } /* Terminating entry */
|
||||
};
|
||||
|
||||
#undef UNUSUAL_DEV
|
||||
|
||||
|
||||
/*
|
||||
* Media handling
|
||||
*/
|
||||
@ -998,7 +1110,7 @@ static void alauda_info_destructor(void *extra)
|
||||
/*
|
||||
* Initialize alauda_info struct and find the data-write endpoint
|
||||
*/
|
||||
int init_alauda(struct us_data *us)
|
||||
static int init_alauda(struct us_data *us)
|
||||
{
|
||||
struct alauda_info *info;
|
||||
struct usb_host_interface *altsetting = us->pusb_intf->cur_altsetting;
|
||||
@ -1020,7 +1132,7 @@ int init_alauda(struct us_data *us)
|
||||
return USB_STOR_TRANSPORT_GOOD;
|
||||
}
|
||||
|
||||
int alauda_transport(struct scsi_cmnd *srb, struct us_data *us)
|
||||
static int alauda_transport(struct scsi_cmnd *srb, struct us_data *us)
|
||||
{
|
||||
int rc;
|
||||
struct alauda_info *info = (struct alauda_info *) us->extra;
|
||||
@ -1128,3 +1240,48 @@ int alauda_transport(struct scsi_cmnd *srb, struct us_data *us)
|
||||
return USB_STOR_TRANSPORT_FAILED;
|
||||
}
|
||||
|
||||
static int alauda_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
struct us_data *us;
|
||||
int result;
|
||||
|
||||
result = usb_stor_probe1(&us, intf, id,
|
||||
(id - alauda_usb_ids) + alauda_unusual_dev_list);
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
us->transport_name = "Alauda Control/Bulk";
|
||||
us->transport = alauda_transport;
|
||||
us->transport_reset = usb_stor_Bulk_reset;
|
||||
us->max_lun = 1;
|
||||
|
||||
result = usb_stor_probe2(us);
|
||||
return result;
|
||||
}
|
||||
|
||||
static struct usb_driver alauda_driver = {
|
||||
.name = "ums-alauda",
|
||||
.probe = alauda_probe,
|
||||
.disconnect = usb_stor_disconnect,
|
||||
.suspend = usb_stor_suspend,
|
||||
.resume = usb_stor_resume,
|
||||
.reset_resume = usb_stor_reset_resume,
|
||||
.pre_reset = usb_stor_pre_reset,
|
||||
.post_reset = usb_stor_post_reset,
|
||||
.id_table = alauda_usb_ids,
|
||||
.soft_unbind = 1,
|
||||
};
|
||||
|
||||
static int __init alauda_init(void)
|
||||
{
|
||||
return usb_register(&alauda_driver);
|
||||
}
|
||||
|
||||
static void __exit alauda_exit(void)
|
||||
{
|
||||
usb_deregister(&alauda_driver);
|
||||
}
|
||||
|
||||
module_init(alauda_init);
|
||||
module_exit(alauda_exit);
|
||||
|
@ -1,100 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
|
31
drivers/usb/storage/unusual_alauda.h
Normal file
31
drivers/usb/storage/unusual_alauda.h
Normal file
@ -0,0 +1,31 @@
|
||||
/* Unusual Devices File for the Alauda-based card readers
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_USB_STORAGE_ALAUDA) || \
|
||||
defined(CONFIG_USB_STORAGE_ALAUDA_MODULE)
|
||||
|
||||
UNUSUAL_DEV( 0x0584, 0x0008, 0x0102, 0x0102,
|
||||
"Fujifilm",
|
||||
"DPC-R1 (Alauda)",
|
||||
US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0),
|
||||
|
||||
UNUSUAL_DEV( 0x07b4, 0x010a, 0x0102, 0x0102,
|
||||
"Olympus",
|
||||
"MAUSB-10 (Alauda)",
|
||||
US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0),
|
||||
|
||||
#endif /* defined(CONFIG_USB_STORAGE_ALAUDA) || ... */
|
@ -692,13 +692,6 @@ 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
|
||||
|
||||
/* Reported by RTE <raszilki@yandex.ru> */
|
||||
UNUSUAL_DEV( 0x058f, 0x6387, 0x0141, 0x0141,
|
||||
"JetFlash",
|
||||
@ -977,13 +970,6 @@ UNUSUAL_DEV( 0x07af, 0x0006, 0x0100, 0x0100,
|
||||
US_FL_SINGLE_LUN ),
|
||||
#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
|
||||
|
||||
/* Datafab KECF-USB / Sagatek DCS-CF / Simpletech Flashlink UCF-100
|
||||
* Only revision 1.13 tested (same for all of the above devices,
|
||||
* based on the Datafab DF-UG-07 chip). Needed for US_FL_FIX_INQUIRY.
|
||||
|
@ -69,9 +69,6 @@
|
||||
#ifdef CONFIG_USB_STORAGE_ONETOUCH
|
||||
#include "onetouch.h"
|
||||
#endif
|
||||
#ifdef CONFIG_USB_STORAGE_ALAUDA
|
||||
#include "alauda.h"
|
||||
#endif
|
||||
#ifdef CONFIG_USB_STORAGE_KARMA
|
||||
#include "karma.h"
|
||||
#endif
|
||||
@ -598,15 +595,6 @@ static void get_transport(struct us_data *us)
|
||||
us->transport_reset = usb_stor_Bulk_reset;
|
||||
break;
|
||||
|
||||
#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
|
||||
|
||||
#ifdef CONFIG_USB_STORAGE_KARMA
|
||||
case US_PR_KARMA:
|
||||
us->transport_name = "Rio Karma/Bulk";
|
||||
|
@ -77,6 +77,7 @@ struct ignore_entry {
|
||||
}
|
||||
|
||||
static struct ignore_entry ignore_ids[] = {
|
||||
# include "unusual_alauda.h"
|
||||
# include "unusual_cypress.h"
|
||||
# include "unusual_datafab.h"
|
||||
# include "unusual_freecom.h"
|
||||
|
Loading…
Reference in New Issue
Block a user