Lukasz Majewski | 44a6ac9 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 Samsung Electrnoics |
| 3 | * Lukasz Majewski <l.majewski@samsung.com> |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Lukasz Majewski | 44a6ac9 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 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> |
Lukasz Majewski | 0c63523 | 2013-09-17 15:58:21 +0200 | [diff] [blame^] | 14 | #include <linux/usb/composite.h> |
Lukasz Majewski | 44a6ac9 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 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 | extern void board_usb_init(void); |
| 35 | |
| 36 | extern int fsg_init(struct ums_board_info *); |
| 37 | extern void fsg_cleanup(void); |
| 38 | extern struct ums_board_info *board_ums_init(unsigned int, |
| 39 | unsigned int, unsigned int); |
| 40 | extern int usb_gadget_handle_interrupts(void); |
| 41 | extern int fsg_main_thread(void *); |
| 42 | |
Lukasz Majewski | 0c63523 | 2013-09-17 15:58:21 +0200 | [diff] [blame^] | 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 |
Lukasz Majewski | 44a6ac9 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 51 | #endif /* __USB_MASS_STORAGE_H__ */ |