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 13 #include <mmc.h> 14 #include <linux/usb/composite.h> 15 16 struct ums_device { 17 struct mmc *mmc; 18 int dev_num; 19 int offset; 20 int part_size; 21 }; 22 23 struct ums_board_info { 24 int (*read_sector)(struct ums_device *ums_dev, 25 ulong start, lbaint_t blkcnt, void *buf); 26 int (*write_sector)(struct ums_device *ums_dev, 27 ulong start, lbaint_t blkcnt, const void *buf); 28 void (*get_capacity)(struct ums_device *ums_dev, 29 long long int *capacity); 30 const char *name; 31 struct ums_device ums_dev; 32 }; 33 34 int fsg_init(struct ums_board_info *); 35 void fsg_cleanup(void); 36 struct ums_board_info *board_ums_init(unsigned int, unsigned int, 37 unsigned int); 38 int fsg_main_thread(void *); 39 40 #ifdef CONFIG_USB_GADGET_MASS_STORAGE 41 int fsg_add(struct usb_configuration *c); 42 #else 43 int fsg_add(struct usb_configuration *c) 44 { 45 return 0; 46 } 47 #endif 48 #endif /* __USB_MASS_STORAGE_H__ */ 49