Commit fbdd3299d2ce67aa04b62e44038dd355af349b7e

Authored by Paul Kocialkowski
Committed by Tom Rini
1 parent 9f4e1e94bb

sniper: Fastboot support

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>

Showing 3 changed files with 70 additions and 0 deletions Side-by-side Diff

board/lge/sniper/sniper.c
... ... @@ -10,6 +10,8 @@
10 10 #include <common.h>
11 11 #include <dm.h>
12 12 #include <linux/ctype.h>
  13 +#include <linux/usb/musb.h>
  14 +#include <asm/omap_musb.h>
13 15 #include <asm/arch/mmc_host_def.h>
14 16 #include <asm/arch/sys_proto.h>
15 17 #include <asm/arch/mem.h>
... ... @@ -37,6 +39,25 @@
37 39 .platdata = &serial_omap_platdata
38 40 };
39 41  
  42 +static struct musb_hdrc_config musb_config = {
  43 + .multipoint = 1,
  44 + .dyn_fifo = 1,
  45 + .num_eps = 16,
  46 + .ram_bits = 12
  47 +};
  48 +
  49 +static struct omap_musb_board_data musb_board_data = {
  50 + .interface_type = MUSB_INTERFACE_ULPI,
  51 +};
  52 +
  53 +static struct musb_hdrc_platform_data musb_platform_data = {
  54 + .mode = MUSB_PERIPHERAL,
  55 + .config = &musb_config,
  56 + .power = 100,
  57 + .platform_ops = &omap2430_ops,
  58 + .board_data = &musb_board_data,
  59 +};
  60 +
40 61 #ifdef CONFIG_SPL_BUILD
41 62 void get_board_mem_timings(struct board_sdrc_timings *timings)
42 63 {
... ... @@ -95,6 +116,10 @@
95 116 setenv("serial#", serial_string);
96 117 }
97 118  
  119 + /* MUSB */
  120 +
  121 + musb_register(&musb_platform_data, &musb_board_data, (void *)MUSB_BASE);
  122 +
98 123 return 0;
99 124 }
100 125  
... ... @@ -114,6 +139,11 @@
114 139 serialnr->high = 0;
115 140 serialnr->low = 0;
116 141 }
  142 +}
  143 +
  144 +int fb_set_reboot_flag(void)
  145 +{
  146 + return omap_reboot_mode_store('b');
117 147 }
118 148  
119 149 void set_muxconf_regs(void)
configs/sniper_defconfig
... ... @@ -5,4 +5,6 @@
5 5 # CONFIG_CMD_IMLS is not set
6 6 # CONFIG_CMD_FLASH is not set
7 7 # CONFIG_CMD_FPGA is not set
  8 +CONFIG_USB=y
  9 +CONFIG_USB_MUSB_GADGET=y
include/configs/sniper.h
... ... @@ -216,6 +216,42 @@
216 216 115200 }
217 217  
218 218 /*
  219 + * USB gadget
  220 + */
  221 +
  222 +#define CONFIG_USB_MUSB_PIO_ONLY
  223 +#define CONFIG_USB_MUSB_OMAP2PLUS
  224 +#define CONFIG_TWL4030_USB
  225 +
  226 +#define CONFIG_USB_GADGET
  227 +#define CONFIG_USB_GADGET_DUALSPEED
  228 +#define CONFIG_USB_GADGET_VBUS_DRAW 0
  229 +
  230 +/*
  231 + * Download
  232 + */
  233 +
  234 +#define CONFIG_USB_GADGET_DOWNLOAD
  235 +
  236 +#define CONFIG_G_DNL_VENDOR_NUM 0x0451
  237 +#define CONFIG_G_DNL_PRODUCT_NUM 0xd022
  238 +#define CONFIG_G_DNL_MANUFACTURER "Texas Instruments"
  239 +
  240 +/*
  241 + * Fastboot
  242 + */
  243 +
  244 +#define CONFIG_USB_FUNCTION_FASTBOOT
  245 +
  246 +#define CONFIG_FASTBOOT_BUF_ADDR CONFIG_SYS_LOAD_ADDR
  247 +#define CONFIG_FASTBOOT_BUF_SIZE 0x2000000
  248 +
  249 +#define CONFIG_FASTBOOT_FLASH
  250 +#define CONFIG_FASTBOOT_FLASH_MMC_DEV 0
  251 +
  252 +#define CONFIG_CMD_FASTBOOT
  253 +
  254 +/*
219 255 * Environment
220 256 */
221 257  
... ... @@ -255,6 +291,8 @@
255 291 "setenv boot_mmc_part ${kernel_mmc_part}; " \
256 292 "if test reboot-${reboot-mode} = reboot-r; then " \
257 293 "echo recovery; setenv boot_mmc_part ${recovery_mmc_part}; fi; " \
  294 + "if test reboot-${reboot-mode} = reboot-b; then " \
  295 + "echo fastboot; fastboot 0; fi; " \
258 296 "part start mmc ${boot_mmc_dev} ${boot_mmc_part} boot_mmc_start; " \
259 297 "part size mmc ${boot_mmc_dev} ${boot_mmc_part} boot_mmc_size; " \
260 298 "mmc dev ${boot_mmc_dev}; " \