This patch introduces some cleanups to ums code. Changes: ums common: - introduce UMS_START_SECTOR and UMS_NUM_SECTORS as defined in usb_mass_storage.h both default values as 0 if board config doesn't define them common cleanup changes: - change name of struct "ums_board_info" to "ums" - "ums_device" fields are moved to struct ums and "dev_num" is removed - change function name: board_ums_init to ums_init - remove "extern" prefixes from usb_mass_storage.h cmd_usb_mass_storage: - change error() to printf() if need to print info message - change return values to command_ret_t type at ums command code - add command usage string Changes v2: ums common: - always returns number of read/write sectors - coding style clean-up ums gadget: - calculate amount of read/write from device returned value. Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Cc: Marek Vasut <marek.vasut@gmail.com>
51 lines
1 KiB
C
51 lines
1 KiB
C
/*
|
|
* Copyright (C) 2011 Samsung Electrnoics
|
|
* Lukasz Majewski <l.majewski@samsung.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
#ifndef __USB_MASS_STORAGE_H__
|
|
#define __USB_MASS_STORAGE_H__
|
|
|
|
#define SECTOR_SIZE 0x200
|
|
#include <mmc.h>
|
|
#include <linux/usb/composite.h>
|
|
|
|
#ifndef UMS_START_SECTOR
|
|
#define UMS_START_SECTOR 0
|
|
#endif
|
|
|
|
#ifndef UMS_NUM_SECTORS
|
|
#define UMS_NUM_SECTORS 0
|
|
#endif
|
|
|
|
struct ums {
|
|
int (*read_sector)(struct ums *ums_dev,
|
|
ulong start, lbaint_t blkcnt, void *buf);
|
|
int (*write_sector)(struct ums *ums_dev,
|
|
ulong start, lbaint_t blkcnt, const void *buf);
|
|
void (*get_capacity)(struct ums *ums_dev,
|
|
long long int *capacity);
|
|
const char *name;
|
|
struct mmc *mmc;
|
|
int offset;
|
|
int part_size;
|
|
};
|
|
|
|
extern struct ums *ums;
|
|
|
|
int fsg_init(struct ums *);
|
|
void fsg_cleanup(void);
|
|
struct ums *ums_init(unsigned int);
|
|
int fsg_main_thread(void *);
|
|
|
|
#ifdef CONFIG_USB_GADGET_MASS_STORAGE
|
|
int fsg_add(struct usb_configuration *c);
|
|
#else
|
|
int fsg_add(struct usb_configuration *c)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif
|
|
#endif /* __USB_MASS_STORAGE_H__ */
|