From ce19d974018273c8f69d98b7139e7fef822cc02a Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 5 May 2014 10:40:11 -0600 Subject: ums: support block devices not MMC devices The USB Mass Storage function could equally well support a SATA device as support an MMC device. Update struct ums to contain a block device descriptor, not an MMC device descriptor. Cc: Lukasz Majewski Signed-off-by: Stephen Warren Acked-by: Przemyslaw Marczak --- include/usb_mass_storage.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h index ed46064..e3eb1eb 100644 --- a/include/usb_mass_storage.h +++ b/include/usb_mass_storage.h @@ -9,7 +9,7 @@ #define __USB_MASS_STORAGE_H__ #define SECTOR_SIZE 0x200 -#include +#include #include #ifndef UMS_START_SECTOR @@ -31,7 +31,7 @@ struct ums { unsigned int start_sector; unsigned int num_sectors; const char *name; - struct mmc *mmc; + block_dev_desc_t *block_dev; }; extern struct ums *ums; -- cgit v1.1 From c2474d9c718dea4f26067e85d356644a3aed26c2 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 5 May 2014 10:40:12 -0600 Subject: ums: remove UMS_{NUM,START}_SECTORS + UMS_START_SECTOR These values aren't set anywhere at present, and hence have no effect. The concept of a single global offset/number of sectors to expose through USB Mass Storage doesn't even make sense in the face of multiple storage devices. Remove these defines to simplify the code. Cc: Lukasz Majewski Signed-off-by: Stephen Warren Acked-by: Przemyslaw Marczak --- include/usb_mass_storage.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'include') diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h index e3eb1eb..2b959ec 100644 --- a/include/usb_mass_storage.h +++ b/include/usb_mass_storage.h @@ -12,14 +12,6 @@ #include #include -#ifndef UMS_START_SECTOR -#define UMS_START_SECTOR 0 -#endif - -#ifndef UMS_NUM_SECTORS -#define UMS_NUM_SECTORS 0 -#endif - /* Wait at maximum 60 seconds for cable connection */ #define UMS_CABLE_READY_TIMEOUT 60 -- cgit v1.1 From abfe8afe88d6d8219602659f44981411e1daeb1d Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 5 May 2014 10:40:15 -0600 Subject: ums: move IO support code to common location There's nothing Samsung-/board-specfic about the implementation of ums_init(). Move the code into cmd_usb_mass_storage.c, so that it can be shared by any user of that command. Cc: Lukasz Majewski Signed-off-by: Stephen Warren Acked-by: Przemyslaw Marczak --- include/usb_mass_storage.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h index 2b959ec..69b80cd 100644 --- a/include/usb_mass_storage.h +++ b/include/usb_mass_storage.h @@ -30,7 +30,6 @@ extern struct ums *ums; int fsg_init(struct ums *); void fsg_cleanup(void); -struct ums *ums_init(unsigned int); int fsg_main_thread(void *); int fsg_add(struct usb_configuration *c); #endif /* __USB_MASS_STORAGE_H__ */ -- cgit v1.1 From 9ace3fc81427f6a4036718c2daff9d6f8ee7b69a Mon Sep 17 00:00:00 2001 From: Sebastian Siewior Date: Mon, 5 May 2014 15:08:09 -0500 Subject: image: add support for Android's boot image format This patch adds support for the Android boot-image format. The header file is from the Android project and got slightly alterted so the struct + its defines are not generic but have something like a namespace. The header file is from bootloader/legacy/include/boot/bootimg.h. The header parsing has been written from scratch and I looked at bootloader/legacy/usbloader/usbloader.c for some details. The image contains the physical address (load address) of the kernel and ramdisk. This address is considered only for the kernel image. The "second image" defined in the image header is currently not supported. I haven't found anything that is creating this. v3 (Rob Herring): This is based on http://patchwork.ozlabs.org/patch/126797/ with the following changes: - Rebased to current mainline - Moved android image handling to separate functions in common/image-android.c - s/u8/char/ in header to fix string function warnings - Use SPDX identifiers for licenses - Cleaned-up file source information: android_image.h is from file include/boot/bootimg.h in repository: https://android.googlesource.com/platform/bootable/bootloader/legacy The git commit hash is 4205b865141ff2e255fe1d3bd16de18e217ef06a usbloader.c would be from the same commit, but it does not appear to have been used for any actual code. v4: - s/andriod/android/ - Use a separate flag ep_found to track if the entry point has been set rather than using a magic value. Cc: Wolfgang Denk Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Rob Herring Reviewed-by: Tom Rini Reviewed-by: Lukasz Majewski --- include/android_image.h | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ include/image.h | 13 ++++++++++ 2 files changed, 82 insertions(+) create mode 100644 include/android_image.h (limited to 'include') diff --git a/include/android_image.h b/include/android_image.h new file mode 100644 index 0000000..094d60a --- /dev/null +++ b/include/android_image.h @@ -0,0 +1,69 @@ +/* + * This is from the Android Project, + * Repository: https://android.googlesource.com/platform/bootable/bootloader/legacy + * File: include/boot/bootimg.h + * Commit: 4205b865141ff2e255fe1d3bd16de18e217ef06a + * + * Copyright (C) 2008 The Android Open Source Project + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#ifndef _ANDROID_IMAGE_H_ +#define _ANDROID_IMAGE_H_ + +#define ANDR_BOOT_MAGIC "ANDROID!" +#define ANDR_BOOT_MAGIC_SIZE 8 +#define ANDR_BOOT_NAME_SIZE 16 +#define ANDR_BOOT_ARGS_SIZE 512 + +struct andr_img_hdr { + char magic[ANDR_BOOT_MAGIC_SIZE]; + + u32 kernel_size; /* size in bytes */ + u32 kernel_addr; /* physical load addr */ + + u32 ramdisk_size; /* size in bytes */ + u32 ramdisk_addr; /* physical load addr */ + + u32 second_size; /* size in bytes */ + u32 second_addr; /* physical load addr */ + + u32 tags_addr; /* physical addr for kernel tags */ + u32 page_size; /* flash page size we assume */ + u32 unused[2]; /* future expansion: should be 0 */ + + char name[ANDR_BOOT_NAME_SIZE]; /* asciiz product name */ + + char cmdline[ANDR_BOOT_ARGS_SIZE]; + + u32 id[8]; /* timestamp / checksum / sha1 / etc */ +}; + +/* + * +-----------------+ + * | boot header | 1 page + * +-----------------+ + * | kernel | n pages + * +-----------------+ + * | ramdisk | m pages + * +-----------------+ + * | second stage | o pages + * +-----------------+ + * + * n = (kernel_size + page_size - 1) / page_size + * m = (ramdisk_size + page_size - 1) / page_size + * o = (second_size + page_size - 1) / page_size + * + * 0. all entities are page_size aligned in flash + * 1. kernel and ramdisk are required (size != 0) + * 2. second is optional (second_size == 0 -> no second) + * 3. load each element (kernel, ramdisk, second) at + * the specified physical address (kernel_addr, etc) + * 4. prepare tags at tag_addr. kernel_args[] is + * appended to the kernel commandline in the tags. + * 5. r0 = 0, r1 = MACHINE_TYPE, r2 = tags_addr + * 6. if second_size != 0: jump to second_addr + * else: jump to kernel_addr + */ +#endif diff --git a/include/image.h b/include/image.h index 2508d7d..e1f9297 100644 --- a/include/image.h +++ b/include/image.h @@ -412,6 +412,7 @@ enum fit_load_op { #define IMAGE_FORMAT_INVALID 0x00 #define IMAGE_FORMAT_LEGACY 0x01 /* legacy image_header based format */ #define IMAGE_FORMAT_FIT 0x02 /* new, libfdt based format */ +#define IMAGE_FORMAT_ANDROID 0x03 /* Android boot image */ int genimg_get_format(const void *img_addr); int genimg_has_config(bootm_headers_t *images); @@ -1030,4 +1031,16 @@ static inline int fit_image_check_target_arch(const void *fdt, int node) #endif /* CONFIG_FIT_VERBOSE */ #endif /* CONFIG_FIT */ +#if defined(CONFIG_ANDROID_BOOT_IMAGE) +struct andr_img_hdr; +int android_image_check_header(const struct andr_img_hdr *hdr); +int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify, + ulong *os_data, ulong *os_len); +int android_image_get_ramdisk(const struct andr_img_hdr *hdr, + ulong *rd_data, ulong *rd_len); +ulong android_image_get_end(const struct andr_img_hdr *hdr); +ulong android_image_get_kload(const struct andr_img_hdr *hdr); + +#endif /* CONFIG_ANDROID_BOOT_IMAGE */ + #endif /* __IMAGE_H__ */ -- cgit v1.1 From dd5b68fba74371b40963f02d4c237163baa94865 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Mon, 5 May 2014 15:08:11 -0500 Subject: arm: beagle: enable Android fastboot support Enable Android Fastboot support on omap3_beagle board. Signed-off-by: Rob Herring --- include/configs/omap3_beagle.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h index 0b57421..be39b7c 100644 --- a/include/configs/omap3_beagle.h +++ b/include/configs/omap3_beagle.h @@ -110,6 +110,16 @@ #define CONFIG_TWL4030_USB 1 #define CONFIG_USB_ETHER #define CONFIG_USB_ETHER_RNDIS +#define CONFIG_USB_GADGET +#define CONFIG_USB_GADGET_VBUS_DRAW 0 +#define CONFIG_USBDOWNLOAD_GADGET +#define CONFIG_G_DNL_VENDOR_NUM 0x0451 +#define CONFIG_G_DNL_PRODUCT_NUM 0xd022 +#define CONFIG_G_DNL_MANUFACTURER "TI" +#define CONFIG_CMD_FASTBOOT +#define CONFIG_ANDROID_BOOT_IMAGE +#define CONFIG_USB_FASTBOOT_BUF_ADDR CONFIG_SYS_LOAD_ADDR +#define CONFIG_USB_FASTBOOT_BUF_SIZE 0x07000000 /* USB EHCI */ #define CONFIG_CMD_USB -- cgit v1.1 From fc25fa27e5f439705e9ca42182014e2d75d9f0ae Mon Sep 17 00:00:00 2001 From: Heiko Schocher Date: Fri, 11 Apr 2014 07:59:47 +0200 Subject: dfu, nand: add medium specific polltimeout function add a possibility to add a medium specific polltimeout function. So it is possible to define different poll timeouts. Used on nand medium, for setting the DFU_MANIFEST_POLL_TIMEOUT only on nand ubi partitions, which is currently the only usecase. Change-Id: If1db5f49b32d93fefa7481e8dfe5b7ccc0e65af4 Signed-off-by: Heiko Schocher Cc: Kyungmin Park Cc: Marek Vasut Cc: Pantelis Antoniou Reviewed-by: Marek Vasut Acked-by: Lukasz Majewski --- include/dfu.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/dfu.h b/include/dfu.h index 2409168..986598e 100644 --- a/include/dfu.h +++ b/include/dfu.h @@ -100,6 +100,7 @@ struct dfu_entity { u64 offset, void *buf, long *len); int (*flush_medium)(struct dfu_entity *dfu); + unsigned int (*poll_timeout)(struct dfu_entity *dfu); struct list_head list; -- cgit v1.1