summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Majewski <l.majewski@samsung.com>2013-03-05 12:10:18 +0100
committerMarek Vasut <marex@denx.de>2013-03-18 18:58:53 +0100
commit83301b4f8bfac09f7e13bd38613e1a223bf8b1df (patch)
tree8693af726415d8686b31f094ebc3567950ed9c7a
parentb528f71394038e593a116bd70f6409fabd147ea6 (diff)
downloadu-boot-imx-83301b4f8bfac09f7e13bd38613e1a223bf8b1df.zip
u-boot-imx-83301b4f8bfac09f7e13bd38613e1a223bf8b1df.tar.gz
u-boot-imx-83301b4f8bfac09f7e13bd38613e1a223bf8b1df.tar.bz2
arm:trats: Use new ums command
This patch enables new "ums" command on Trats board Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> CC: Minkyu Kang <mk7.kang@samsung.com>
-rw-r--r--board/samsung/trats/trats.c63
-rw-r--r--include/configs/trats.h5
2 files changed, 68 insertions, 0 deletions
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 88d193d..9207646 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -42,6 +42,7 @@
#include <power/max8997_muic.h>
#include <power/battery.h>
#include <power/max17042_fg.h>
+#include <usb_mass_storage.h>
#include "setup.h"
@@ -791,3 +792,65 @@ void init_panel_info(vidinfo_t *vid)
setenv("lcdinfo", "lcd=s6e8ax0");
}
+
+#ifdef CONFIG_USB_GADGET_MASS_STORAGE
+static int ums_read_sector(struct ums_device *ums_dev,
+ ulong start, lbaint_t blkcnt, void *buf)
+{
+ if (ums_dev->mmc->block_dev.block_read(ums_dev->dev_num,
+ start + ums_dev->offset, blkcnt, buf) != blkcnt)
+ return -1;
+
+ return 0;
+}
+
+static int ums_write_sector(struct ums_device *ums_dev,
+ ulong start, lbaint_t blkcnt, const void *buf)
+{
+ if (ums_dev->mmc->block_dev.block_write(ums_dev->dev_num,
+ start + ums_dev->offset, blkcnt, buf) != blkcnt)
+ return -1;
+
+ return 0;
+}
+
+static void ums_get_capacity(struct ums_device *ums_dev,
+ long long int *capacity)
+{
+ long long int tmp_capacity;
+
+ tmp_capacity = (long long int) ((ums_dev->offset + ums_dev->part_size)
+ * SECTOR_SIZE);
+ *capacity = ums_dev->mmc->capacity - tmp_capacity;
+}
+
+static struct ums_board_info ums_board = {
+ .read_sector = ums_read_sector,
+ .write_sector = ums_write_sector,
+ .get_capacity = ums_get_capacity,
+ .name = "TRATS UMS disk",
+ .ums_dev = {
+ .mmc = NULL,
+ .dev_num = 0,
+ .offset = 0,
+ .part_size = 0.
+ },
+};
+
+struct ums_board_info *board_ums_init(unsigned int dev_num, unsigned int offset,
+ unsigned int part_size)
+{
+ struct mmc *mmc;
+
+ mmc = find_mmc_device(dev_num);
+ if (!mmc)
+ return NULL;
+
+ ums_board.ums_dev.mmc = mmc;
+ ums_board.ums_dev.dev_num = dev_num;
+ ums_board.ums_dev.offset = offset;
+ ums_board.ums_dev.part_size = part_size;
+
+ return &ums_board;
+}
+#endif
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 63745ac..31d8190 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -316,4 +316,9 @@
#define CONFIG_VIDEO_BMP_GZIP
#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((500 * 120 * 4) + (1 << 12))
+#define CONFIG_CMD_USB_MASS_STORAGE
+#if defined(CONFIG_CMD_USB_MASS_STORAGE)
+#define CONFIG_USB_GADGET_MASS_STORAGE
+#endif
+
#endif /* __CONFIG_H */