2013-03-05 11:10:17 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2011 Samsung Electrnoics
|
|
|
|
* Lukasz Majewski <l.majewski@samsung.com>
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2013-03-05 11:10:17 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __USB_MASS_STORAGE_H__
|
|
|
|
#define __USB_MASS_STORAGE_H__
|
|
|
|
|
|
|
|
#define SECTOR_SIZE 0x200
|
|
|
|
#include <mmc.h>
|
2013-09-17 13:58:21 +00:00
|
|
|
#include <linux/usb/composite.h>
|
2013-03-05 11:10:17 +00:00
|
|
|
|
2013-10-23 12:30:42 +00:00
|
|
|
#ifndef UMS_START_SECTOR
|
|
|
|
#define UMS_START_SECTOR 0
|
|
|
|
#endif
|
2013-03-05 11:10:17 +00:00
|
|
|
|
2013-10-23 12:30:42 +00:00
|
|
|
#ifndef UMS_NUM_SECTORS
|
|
|
|
#define UMS_NUM_SECTORS 0
|
|
|
|
#endif
|
|
|
|
|
2014-01-07 14:08:37 +00:00
|
|
|
/* Wait at maximum 60 seconds for cable connection */
|
|
|
|
#define UMS_CABLE_READY_TIMEOUT 60
|
|
|
|
|
2013-10-23 12:30:42 +00:00
|
|
|
struct ums {
|
|
|
|
int (*read_sector)(struct ums *ums_dev,
|
2013-03-05 11:10:17 +00:00
|
|
|
ulong start, lbaint_t blkcnt, void *buf);
|
2013-10-23 12:30:42 +00:00
|
|
|
int (*write_sector)(struct ums *ums_dev,
|
2013-03-05 11:10:17 +00:00
|
|
|
ulong start, lbaint_t blkcnt, const void *buf);
|
2013-10-23 12:30:44 +00:00
|
|
|
unsigned int start_sector;
|
|
|
|
unsigned int num_sectors;
|
2013-03-05 11:10:17 +00:00
|
|
|
const char *name;
|
2013-10-23 12:30:42 +00:00
|
|
|
struct mmc *mmc;
|
2013-03-05 11:10:17 +00:00
|
|
|
};
|
|
|
|
|
2013-10-23 12:30:42 +00:00
|
|
|
extern struct ums *ums;
|
|
|
|
|
|
|
|
int fsg_init(struct ums *);
|
2013-10-04 17:22:26 +00:00
|
|
|
void fsg_cleanup(void);
|
2013-10-23 12:30:42 +00:00
|
|
|
struct ums *ums_init(unsigned int);
|
2013-10-04 17:22:26 +00:00
|
|
|
int fsg_main_thread(void *);
|
2013-03-05 11:10:17 +00:00
|
|
|
|
2013-09-17 13:58:21 +00:00
|
|
|
#ifdef CONFIG_USB_GADGET_MASS_STORAGE
|
|
|
|
int fsg_add(struct usb_configuration *c);
|
|
|
|
#else
|
|
|
|
int fsg_add(struct usb_configuration *c)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
2013-03-05 11:10:17 +00:00
|
|
|
#endif /* __USB_MASS_STORAGE_H__ */
|