Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Lukasz Majewski | b528f71 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2011 Samsung Electrnoics |
| 4 | * Lukasz Majewski <l.majewski@samsung.com> |
Lukasz Majewski | b528f71 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __USB_MASS_STORAGE_H__ |
| 8 | #define __USB_MASS_STORAGE_H__ |
| 9 | |
| 10 | #define SECTOR_SIZE 0x200 |
Stephen Warren | ce19d97 | 2014-05-05 10:40:11 -0600 | [diff] [blame] | 11 | #include <part.h> |
Lukasz Majewski | ba4e95c | 2013-09-17 15:58:21 +0200 | [diff] [blame] | 12 | #include <linux/usb/composite.h> |
Lukasz Majewski | b528f71 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 13 | |
Przemyslaw Marczak | 3603e31 | 2014-01-07 15:08:37 +0100 | [diff] [blame] | 14 | /* Wait at maximum 60 seconds for cable connection */ |
| 15 | #define UMS_CABLE_READY_TIMEOUT 60 |
| 16 | |
Przemyslaw Marczak | 93c813b | 2013-10-23 14:30:42 +0200 | [diff] [blame] | 17 | struct ums { |
| 18 | int (*read_sector)(struct ums *ums_dev, |
| 19 | ulong start, lbaint_t blkcnt, void *buf); |
| 20 | int (*write_sector)(struct ums *ums_dev, |
| 21 | ulong start, lbaint_t blkcnt, const void *buf); |
Przemyslaw Marczak | 0697f20 | 2013-10-23 14:30:44 +0200 | [diff] [blame] | 22 | unsigned int start_sector; |
| 23 | unsigned int num_sectors; |
Przemyslaw Marczak | 93c813b | 2013-10-23 14:30:42 +0200 | [diff] [blame] | 24 | const char *name; |
Simon Glass | 4101f68 | 2016-02-29 15:25:34 -0700 | [diff] [blame] | 25 | struct blk_desc block_dev; |
Lukasz Majewski | b528f71 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 26 | }; |
| 27 | |
Stephen Warren | 02585eb | 2015-12-07 11:38:50 -0700 | [diff] [blame] | 28 | int fsg_init(struct ums *ums_devs, int count); |
Mateusz Zalega | 16297cf | 2013-10-04 19:22:26 +0200 | [diff] [blame] | 29 | void fsg_cleanup(void); |
Mateusz Zalega | 16297cf | 2013-10-04 19:22:26 +0200 | [diff] [blame] | 30 | int fsg_main_thread(void *); |
Lukasz Majewski | ba4e95c | 2013-09-17 15:58:21 +0200 | [diff] [blame] | 31 | int fsg_add(struct usb_configuration *c); |
Lukasz Majewski | b528f71 | 2013-03-05 12:10:17 +0100 | [diff] [blame] | 32 | #endif /* __USB_MASS_STORAGE_H__ */ |