]> git.sur5r.net Git - u-boot/commitdiff
sniper: Fastboot support
authorPaul Kocialkowski <contact@paulk.fr>
Mon, 20 Jul 2015 13:17:15 +0000 (15:17 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 13 Aug 2015 00:47:38 +0000 (20:47 -0400)
This adds support for the fastboot USB gadget, including flashing to the
internal MMC and reboot to bootloader or not.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Reviewed-by: Tom Rini <trini@konsulko.com>
[trini: Update to use Kconfig for MUSB]
Signed-off-by: Tom Rini <trini@konsulko.com>
board/lge/sniper/sniper.c
configs/sniper_defconfig
include/configs/sniper.h

index b211528e2b550f4878d693743f2130c5d539edc3..2bfc9c5b4a2c30cfe11056f9422a9a8a3ef9734b 100644 (file)
@@ -10,6 +10,8 @@
 #include <common.h>
 #include <dm.h>
 #include <linux/ctype.h>
+#include <linux/usb/musb.h>
+#include <asm/omap_musb.h>
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/mem.h>
@@ -37,6 +39,25 @@ U_BOOT_DEVICE(sniper_serial) = {
        .platdata = &serial_omap_platdata
 };
 
+static struct musb_hdrc_config musb_config = {
+       .multipoint = 1,
+       .dyn_fifo = 1,
+       .num_eps = 16,
+       .ram_bits = 12
+};
+
+static struct omap_musb_board_data musb_board_data = {
+       .interface_type = MUSB_INTERFACE_ULPI,
+};
+
+static struct musb_hdrc_platform_data musb_platform_data = {
+       .mode = MUSB_PERIPHERAL,
+       .config = &musb_config,
+       .power = 100,
+       .platform_ops = &omap2430_ops,
+       .board_data = &musb_board_data,
+};
+
 #ifdef CONFIG_SPL_BUILD
 void get_board_mem_timings(struct board_sdrc_timings *timings)
 {
@@ -95,6 +116,10 @@ int misc_init_r(void)
                setenv("serial#", serial_string);
        }
 
+       /* MUSB */
+
+       musb_register(&musb_platform_data, &musb_board_data, (void *)MUSB_BASE);
+
        return 0;
 }
 
@@ -116,6 +141,11 @@ void get_board_serial(struct tag_serialnr *serialnr)
        }
 }
 
+int fb_set_reboot_flag(void)
+{
+       return omap_reboot_mode_store('b');
+}
+
 void set_muxconf_regs(void)
 {
        MUX_SNIPER();
index d2e10a9c0484c7a14bc4bf2a7303dde86a8b0499..44cf3595b3aff57a2cb8a19ba779d83490e7e9b0 100644 (file)
@@ -5,3 +5,5 @@ CONFIG_SPL=y
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
+CONFIG_USB=y
+CONFIG_USB_MUSB_GADGET=y
index f17bb0414906364033884effe32e44a0a3ea10f8..b40c4c0591fc173ed07e7c78639b2d3b3bd719e5 100644 (file)
 #define CONFIG_SYS_BAUDRATE_TABLE      { 4800, 9600, 19200, 38400, 57600, \
                                          115200 }
 
+/*
+ * USB gadget
+ */
+
+#define CONFIG_USB_MUSB_PIO_ONLY
+#define CONFIG_USB_MUSB_OMAP2PLUS
+#define CONFIG_TWL4030_USB
+
+#define CONFIG_USB_GADGET
+#define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_USB_GADGET_VBUS_DRAW    0
+
+/*
+ * Download
+ */
+
+#define CONFIG_USB_GADGET_DOWNLOAD
+
+#define CONFIG_G_DNL_VENDOR_NUM                0x0451
+#define CONFIG_G_DNL_PRODUCT_NUM       0xd022
+#define CONFIG_G_DNL_MANUFACTURER      "Texas Instruments"
+
+/*
+ * Fastboot
+ */
+
+#define CONFIG_USB_FUNCTION_FASTBOOT
+
+#define CONFIG_FASTBOOT_BUF_ADDR       CONFIG_SYS_LOAD_ADDR
+#define CONFIG_FASTBOOT_BUF_SIZE       0x2000000
+
+#define CONFIG_FASTBOOT_FLASH
+#define CONFIG_FASTBOOT_FLASH_MMC_DEV  0
+
+#define CONFIG_CMD_FASTBOOT
+
 /*
  * Environment
  */
        "setenv boot_mmc_part ${kernel_mmc_part}; " \
        "if test reboot-${reboot-mode} = reboot-r; then " \
        "echo recovery; setenv boot_mmc_part ${recovery_mmc_part}; fi; " \
+       "if test reboot-${reboot-mode} = reboot-b; then " \
+       "echo fastboot; fastboot 0; fi; " \
        "part start mmc ${boot_mmc_dev} ${boot_mmc_part} boot_mmc_start; " \
        "part size mmc ${boot_mmc_dev} ${boot_mmc_part} boot_mmc_size; " \
        "mmc dev ${boot_mmc_dev}; " \