dm: usb: Move USB storage definitions to usb_defs.h
These are better off in a header file so they can be used by other code (e.g. the sandbox USB storage emulator). Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
This commit is contained in:
parent
054fe48eb2
commit
2e17c87ebb
|
@ -56,49 +56,8 @@ static const unsigned char us_direction[256/8] = {
|
||||||
#define US_DIRECTION(x) ((us_direction[x>>3] >> (x & 7)) & 1)
|
#define US_DIRECTION(x) ((us_direction[x>>3] >> (x & 7)) & 1)
|
||||||
|
|
||||||
static ccb usb_ccb __attribute__((aligned(ARCH_DMA_MINALIGN)));
|
static ccb usb_ccb __attribute__((aligned(ARCH_DMA_MINALIGN)));
|
||||||
|
|
||||||
/*
|
|
||||||
* CBI style
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define US_CBI_ADSC 0
|
|
||||||
|
|
||||||
/*
|
|
||||||
* BULK only
|
|
||||||
*/
|
|
||||||
#define US_BBB_RESET 0xff
|
|
||||||
#define US_BBB_GET_MAX_LUN 0xfe
|
|
||||||
|
|
||||||
/* Command Block Wrapper */
|
|
||||||
typedef struct {
|
|
||||||
__u32 dCBWSignature;
|
|
||||||
# define CBWSIGNATURE 0x43425355
|
|
||||||
__u32 dCBWTag;
|
|
||||||
__u32 dCBWDataTransferLength;
|
|
||||||
__u8 bCBWFlags;
|
|
||||||
# define CBWFLAGS_OUT 0x00
|
|
||||||
# define CBWFLAGS_IN 0x80
|
|
||||||
__u8 bCBWLUN;
|
|
||||||
__u8 bCDBLength;
|
|
||||||
# define CBWCDBLENGTH 16
|
|
||||||
__u8 CBWCDB[CBWCDBLENGTH];
|
|
||||||
} umass_bbb_cbw_t;
|
|
||||||
#define UMASS_BBB_CBW_SIZE 31
|
|
||||||
static __u32 CBWTag;
|
static __u32 CBWTag;
|
||||||
|
|
||||||
/* Command Status Wrapper */
|
|
||||||
typedef struct {
|
|
||||||
__u32 dCSWSignature;
|
|
||||||
# define CSWSIGNATURE 0x53425355
|
|
||||||
__u32 dCSWTag;
|
|
||||||
__u32 dCSWDataResidue;
|
|
||||||
__u8 bCSWStatus;
|
|
||||||
# define CSWSTATUS_GOOD 0x0
|
|
||||||
# define CSWSTATUS_FAILED 0x1
|
|
||||||
# define CSWSTATUS_PHASE 0x2
|
|
||||||
} umass_bbb_csw_t;
|
|
||||||
#define UMASS_BBB_CSW_SIZE 13
|
|
||||||
|
|
||||||
#define USB_MAX_STOR_DEV 5
|
#define USB_MAX_STOR_DEV 5
|
||||||
static int usb_max_devs; /* number of highest available usb device */
|
static int usb_max_devs; /* number of highest available usb device */
|
||||||
|
|
||||||
|
@ -494,7 +453,7 @@ static int usb_stor_BBB_comdat(ccb *srb, struct us_data *us)
|
||||||
int actlen;
|
int actlen;
|
||||||
int dir_in;
|
int dir_in;
|
||||||
unsigned int pipe;
|
unsigned int pipe;
|
||||||
ALLOC_CACHE_ALIGN_BUFFER(umass_bbb_cbw_t, cbw, 1);
|
ALLOC_CACHE_ALIGN_BUFFER(struct umass_bbb_cbw, cbw, 1);
|
||||||
|
|
||||||
dir_in = US_DIRECTION(srb->cmd[0]);
|
dir_in = US_DIRECTION(srb->cmd[0]);
|
||||||
|
|
||||||
|
@ -670,7 +629,7 @@ static int usb_stor_BBB_transport(ccb *srb, struct us_data *us)
|
||||||
int dir_in;
|
int dir_in;
|
||||||
int actlen, data_actlen;
|
int actlen, data_actlen;
|
||||||
unsigned int pipe, pipein, pipeout;
|
unsigned int pipe, pipein, pipeout;
|
||||||
ALLOC_CACHE_ALIGN_BUFFER(umass_bbb_csw_t, csw, 1);
|
ALLOC_CACHE_ALIGN_BUFFER(struct umass_bbb_csw, csw, 1);
|
||||||
#ifdef BBB_XPORT_TRACE
|
#ifdef BBB_XPORT_TRACE
|
||||||
unsigned char *ptr;
|
unsigned char *ptr;
|
||||||
int index;
|
int index;
|
||||||
|
|
|
@ -286,4 +286,46 @@
|
||||||
#define HUB_CHANGE_LOCAL_POWER 0x0001
|
#define HUB_CHANGE_LOCAL_POWER 0x0001
|
||||||
#define HUB_CHANGE_OVERCURRENT 0x0002
|
#define HUB_CHANGE_OVERCURRENT 0x0002
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CBI style
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define US_CBI_ADSC 0
|
||||||
|
|
||||||
|
/* Command Block Wrapper */
|
||||||
|
struct umass_bbb_cbw {
|
||||||
|
__u32 dCBWSignature;
|
||||||
|
# define CBWSIGNATURE 0x43425355
|
||||||
|
__u32 dCBWTag;
|
||||||
|
__u32 dCBWDataTransferLength;
|
||||||
|
__u8 bCBWFlags;
|
||||||
|
# define CBWFLAGS_OUT 0x00
|
||||||
|
# define CBWFLAGS_IN 0x80
|
||||||
|
# define CBWFLAGS_SBZ 0x7f
|
||||||
|
__u8 bCBWLUN;
|
||||||
|
__u8 bCDBLength;
|
||||||
|
# define CBWCDBLENGTH 16
|
||||||
|
__u8 CBWCDB[CBWCDBLENGTH];
|
||||||
|
};
|
||||||
|
#define UMASS_BBB_CBW_SIZE 31
|
||||||
|
|
||||||
|
/* Command Status Wrapper */
|
||||||
|
struct umass_bbb_csw {
|
||||||
|
__u32 dCSWSignature;
|
||||||
|
# define CSWSIGNATURE 0x53425355
|
||||||
|
__u32 dCSWTag;
|
||||||
|
__u32 dCSWDataResidue;
|
||||||
|
__u8 bCSWStatus;
|
||||||
|
# define CSWSTATUS_GOOD 0x0
|
||||||
|
# define CSWSTATUS_FAILED 0x1
|
||||||
|
# define CSWSTATUS_PHASE 0x2
|
||||||
|
};
|
||||||
|
#define UMASS_BBB_CSW_SIZE 13
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BULK only
|
||||||
|
*/
|
||||||
|
#define US_BBB_RESET 0xff
|
||||||
|
#define US_BBB_GET_MAX_LUN 0xfe
|
||||||
|
|
||||||
#endif /*_USB_DEFS_H_ */
|
#endif /*_USB_DEFS_H_ */
|
||||||
|
|
Loading…
Reference in New Issue