1 /* 2 * Copyright (C) 2011 Samsung Electrnoics 3 * Lukasz Majewski <l.majewski@samsung.com> 4 * 5 * SPDX-License-Identifier: GPL-2.0+ 6 */ 7 8 #ifndef __USB_MASS_STORAGE_H__ 9 #define __USB_MASS_STORAGE_H__ 10 11 #define SECTOR_SIZE 0x200 12 #include <mmc.h> 13 #include <linux/usb/composite.h> 14 15 #ifndef UMS_START_SECTOR 16 #define UMS_START_SECTOR 0 17 #endif 18 19 #ifndef UMS_NUM_SECTORS 20 #define UMS_NUM_SECTORS 0 21 #endif 22 23 struct ums { 24 int (*read_sector)(struct ums *ums_dev, 25 ulong start, lbaint_t blkcnt, void *buf); 26 int (*write_sector)(struct ums *ums_dev, 27 ulong start, lbaint_t blkcnt, const void *buf); 28 void (*get_capacity)(struct ums *ums_dev, 29 long long int *capacity); 30 const char *name; 31 struct mmc *mmc; 32 int offset; 33 int part_size; 34 }; 35 36 extern struct ums *ums; 37 38 int fsg_init(struct ums *); 39 void fsg_cleanup(void); 40 struct ums *ums_init(unsigned int); 41 int fsg_main_thread(void *); 42 43 #ifdef CONFIG_USB_GADGET_MASS_STORAGE 44 int fsg_add(struct usb_configuration *c); 45 #else 46 int fsg_add(struct usb_configuration *c) 47 { 48 return 0; 49 } 50 #endif 51 #endif /* __USB_MASS_STORAGE_H__ */ 52