blob: 08ccc97cf22494a930974b24d37c09455c97446d [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Lukasz Majewski44a6ac92013-03-05 12:10:17 +01002/*
3 * Copyright (C) 2011 Samsung Electrnoics
4 * Lukasz Majewski <l.majewski@samsung.com>
Lukasz Majewski44a6ac92013-03-05 12:10:17 +01005 */
6
7#ifndef __USB_MASS_STORAGE_H__
8#define __USB_MASS_STORAGE_H__
9
10#define SECTOR_SIZE 0x200
Stephen Warren59ab2d22014-05-05 10:40:11 -060011#include <part.h>
Lukasz Majewski0c635232013-09-17 15:58:21 +020012#include <linux/usb/composite.h>
Lukasz Majewski44a6ac92013-03-05 12:10:17 +010013
Przemyslaw Marczake92cc562014-01-07 15:08:37 +010014/* Wait at maximum 60 seconds for cable connection */
15#define UMS_CABLE_READY_TIMEOUT 60
16
Przemyslaw Marczak674b1a62013-10-23 14:30:42 +020017struct ums {
18 int (*read_sector)(struct ums *ums_dev,
Lukasz Majewski44a6ac92013-03-05 12:10:17 +010019 ulong start, lbaint_t blkcnt, void *buf);
Przemyslaw Marczak674b1a62013-10-23 14:30:42 +020020 int (*write_sector)(struct ums *ums_dev,
Lukasz Majewski44a6ac92013-03-05 12:10:17 +010021 ulong start, lbaint_t blkcnt, const void *buf);
Przemyslaw Marczak3dab7302013-10-23 14:30:44 +020022 unsigned int start_sector;
23 unsigned int num_sectors;
Lukasz Majewski44a6ac92013-03-05 12:10:17 +010024 const char *name;
Simon Glasse3394752016-02-29 15:25:34 -070025 struct blk_desc block_dev;
Lukasz Majewski44a6ac92013-03-05 12:10:17 +010026};
27
Ye Libe30ec12020-06-29 10:12:26 +080028int fsg_init(struct ums *ums_devs, int count, unsigned int controller_idx);
Mateusz Zalegad862f892013-10-04 19:22:26 +020029void fsg_cleanup(void);
Mateusz Zalegad862f892013-10-04 19:22:26 +020030int fsg_main_thread(void *);
Lukasz Majewski0c635232013-09-17 15:58:21 +020031int fsg_add(struct usb_configuration *c);
Lukasz Majewski44a6ac92013-03-05 12:10:17 +010032#endif /* __USB_MASS_STORAGE_H__ */