diff options
| author | Sam Protsenko <[email protected]> | 2025-11-18 17:21:17 -0600 |
|---|---|---|
| committer | Minkyu Kang <[email protected]> | 2025-11-26 17:55:57 +0900 |
| commit | 3d9115a045d2d48c28019b3d6673ab30271819f5 (patch) | |
| tree | ff4f905ed07d191c40c97bc902f506f2cf185720 /board | |
| parent | 3d1ae437a66795c34604a61104b2ff92ab493b9c (diff) | |
board: samsung: e850-96: Add routine for loading images over USB
During USB boot U-Boot is supposed to download some firmware over USB.
It's done by EL3 software, so it has to be requested via corresponding
SMC call. Implement a routine for doing that.
No functional change.
Signed-off-by: Sam Protsenko <[email protected]>
Signed-off-by: Minkyu Kang <[email protected]>
Diffstat (limited to 'board')
| -rw-r--r-- | board/samsung/e850-96/fw.c | 39 | ||||
| -rw-r--r-- | board/samsung/e850-96/fw.h | 7 |
2 files changed, 39 insertions, 7 deletions
diff --git a/board/samsung/e850-96/fw.c b/board/samsung/e850-96/fw.c index 2d52433e38a..576167122ec 100644 --- a/board/samsung/e850-96/fw.c +++ b/board/samsung/e850-96/fw.c @@ -11,14 +11,19 @@ #include <linux/arm-smccc.h> #include "fw.h" -#define LDFW_RAW_PART "ldfw" -#define LDFW_FAT_PATH "/EFI/firmware/ldfw.bin" +#define LDFW_RAW_PART "ldfw" +#define LDFW_FAT_PATH "/EFI/firmware/ldfw.bin" +#define LDFW_MAGIC 0x10adab1e -#define LDFW_MAGIC 0x10adab1e -#define SMC_CMD_LOAD_LDFW -0x500 -#define SDM_HW_RESET_STATUS 0x1230 -#define SDM_SW_RESET_STATUS 0x1231 -#define SB_ERROR_PREFIX 0xfdaa0000 +/* SMC command for providing LDFW to EL3 monitor */ +#define SMC_CMD_LOAD_LDFW -0x500 +/* SMC command for loading some binary over USB */ +#define SMC_CMD_LOAD_IMAGE_BY_USB -0x512 + +/* Error codes for SMC_CMD_LOAD_LDFW */ +#define SDM_HW_RESET_STATUS 0x1230 +#define SDM_SW_RESET_STATUS 0x1231 +#define SB_ERROR_PREFIX 0xfdaa0000 struct ldfw_header { u32 magic; @@ -94,6 +99,26 @@ static int read_fw_from_raw(const char *ifname, int dev, const char *part_name, } /** + * load_image_usb - Load some binary over USB during USB boot + * @type: Image type + * @addr: Memory address where the image should be downloaded to + * @size: Image size + * + * Return: 0 on success or a negative value on error. + */ +int load_image_usb(enum usb_dn_image type, phys_addr_t addr, phys_size_t size) +{ + struct arm_smccc_res res; + + arm_smccc_smc(SMC_CMD_LOAD_IMAGE_BY_USB, (u64)type, addr, size, + 0, 0, 0, 0, &res); + if (res.a0) + return -EIO; + + return 0; +} + +/** * load_ldfw_from_blk - Load the loadable firmware (LDFW) from block device * @ifname: Interface name of the block device to load the firmware from * @dev: Device number diff --git a/board/samsung/e850-96/fw.h b/board/samsung/e850-96/fw.h index b061abc4df6..68f943e8bbc 100644 --- a/board/samsung/e850-96/fw.h +++ b/board/samsung/e850-96/fw.h @@ -9,6 +9,13 @@ #include <asm/types.h> +/* Image types for downloading over USB */ +enum usb_dn_image { + USB_DN_IMAGE_LDFW = 1, /* Loadable Firmware */ + USB_DN_IMAGE_SP = 2, /* Secure Payload (tzsw.img) */ +}; + +int load_image_usb(enum usb_dn_image type, phys_addr_t addr, phys_size_t size); int load_ldfw_from_blk(const char *ifname, int dev, int part, phys_addr_t addr); int init_ldfw(phys_addr_t addr); |
