blob: 9df3adcf2a8e042bcc3b953c0f357a9c5945d9d5 [file] [log] [blame]
Lukasz Majewskib528f712013-03-05 12:10:17 +01001/*
2 * Copyright (C) 2011 Samsung Electrnoics
3 * Lukasz Majewski <l.majewski@samsung.com>
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Lukasz Majewskib528f712013-03-05 12:10:17 +01006 */
7
8#ifndef __USB_MASS_STORAGE_H__
9#define __USB_MASS_STORAGE_H__
10
11#define SECTOR_SIZE 0x200
Lukasz Majewskib528f712013-03-05 12:10:17 +010012#include <mmc.h>
Lukasz Majewskiba4e95c2013-09-17 15:58:21 +020013#include <linux/usb/composite.h>
Lukasz Majewskib528f712013-03-05 12:10:17 +010014
Przemyslaw Marczak93c813b2013-10-23 14:30:42 +020015#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
23struct 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);
Przemyslaw Marczak0697f202013-10-23 14:30:44 +020028 unsigned int start_sector;
29 unsigned int num_sectors;
Przemyslaw Marczak93c813b2013-10-23 14:30:42 +020030 const char *name;
Lukasz Majewskib528f712013-03-05 12:10:17 +010031 struct mmc *mmc;
Lukasz Majewskib528f712013-03-05 12:10:17 +010032};
33
Przemyslaw Marczak93c813b2013-10-23 14:30:42 +020034extern struct ums *ums;
Lukasz Majewskib528f712013-03-05 12:10:17 +010035
Przemyslaw Marczak93c813b2013-10-23 14:30:42 +020036int fsg_init(struct ums *);
Mateusz Zalega16297cf2013-10-04 19:22:26 +020037void fsg_cleanup(void);
Przemyslaw Marczak93c813b2013-10-23 14:30:42 +020038struct ums *ums_init(unsigned int);
Mateusz Zalega16297cf2013-10-04 19:22:26 +020039int fsg_main_thread(void *);
Lukasz Majewskib528f712013-03-05 12:10:17 +010040
Lukasz Majewskiba4e95c2013-09-17 15:58:21 +020041#ifdef CONFIG_USB_GADGET_MASS_STORAGE
42int fsg_add(struct usb_configuration *c);
43#else
44int fsg_add(struct usb_configuration *c)
45{
46 return 0;
47}
48#endif
Lukasz Majewskib528f712013-03-05 12:10:17 +010049#endif /* __USB_MASS_STORAGE_H__ */