[U-Boot] [Example 3/3] fastboot: add board specific implementation
Sebastian Andrzej Siewior
bigeasy at linutronix.de
Fri Sep 16 18:51:19 CEST 2011
This is just an example how the board specific implementation can look
like. Not for merging.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
---
board/ti/sdp4430/Makefile | 7 ++++---
board/ti/sdp4430/fastboot.c | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 3 deletions(-)
create mode 100644 board/ti/sdp4430/fastboot.c
diff --git a/board/ti/sdp4430/Makefile b/board/ti/sdp4430/Makefile
index 12f2743..89226ab 100644
--- a/board/ti/sdp4430/Makefile
+++ b/board/ti/sdp4430/Makefile
@@ -26,11 +26,12 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(BOARD).o
ifndef CONFIG_SPL_BUILD
-COBJS := sdp.o cmd_bat.o
+COBJS-y := sdp.o cmd_bat.o
+COBJS-$(CONFIG_CMD_FASTBOOT) += fastboot.o
endif
-SRCS := $(COBJS:.o=.c)
-OBJS := $(addprefix $(obj),$(COBJS))
+SRCS := $(COBJS-y:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS-y))
$(LIB): $(obj).depend $(OBJS)
$(call cmd_link_o_target, $(OBJS))
diff --git a/board/ti/sdp4430/fastboot.c b/board/ti/sdp4430/fastboot.c
new file mode 100644
index 0000000..9f2c0d4
--- /dev/null
+++ b/board/ti/sdp4430/fastboot.c
@@ -0,0 +1,36 @@
+#include <common.h>
+#include <usb/fastboot.h>
+#include <linux/usb/ch9.h>
+#include <linux/usb/gadget.h>
+
+static struct usb_string def_usb_fb_strings[] = {
+ { FB_STR_SERIAL_IDX, "abcd+efg" },
+ { FB_STR_PROC_REV_IDX, "ES0.0" },
+ { FB_STR_PROC_TYPE_IDX, "VirtIO" },
+ { }
+};
+
+static struct usb_gadget_strings def_fb_strings = {
+ .language = 0x0409, /* en-us */
+ .strings = def_usb_fb_strings,
+};
+
+/*
+ * Hardcoded memory region to stash data which comes over USB before it is
+ * stored on media
+ */
+DECLARE_GLOBAL_DATA_PTR;
+#define SZ_16M 0x01000000
+#define SZ_128M 0x08000000
+#define CFG_FASTBOOT_TRANSFER_BUFFER (void *)(gd->bd->bi_dram[0].start + SZ_16M)
+#define CFG_FASTBOOT_TRANSFER_BUFFER_SIZE (SZ_128M - SZ_16M)
+
+int fastboot_board_init(struct fastboot_config *interface,
+ struct usb_gadget_strings **str) {
+
+ interface->transfer_buffer = CFG_FASTBOOT_TRANSFER_BUFFER;
+ interface->transfer_buffer_size = CFG_FASTBOOT_TRANSFER_BUFFER_SIZE;
+
+ *str = &def_fb_strings;
+ return 0;
+}
--
1.7.5.4
More information about the U-Boot
mailing list