X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=common%2Fspl%2Fspl_mmc.c;h=324d91c88404b6e86d4e58f5ee0b77c8e00300b4;hb=d5974af7f7626777b5c41894f75c813ff35c1793;hp=e780b82fd2bfa0bfc1dd95d797fe60886aaa32dd;hpb=abeb9d7897510533ce3a0a9515cac16db5bed834;p=oweals%2Fu-boot.git diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index e780b82fd2..324d91c884 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -1,10 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2010 * Texas Instruments, * * Aneesh V - * - * SPDX-License-Identifier: GPL-2.0+ */ #include #include @@ -56,13 +55,13 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image, { unsigned long count; struct image_header *header; + struct blk_desc *bd = mmc_get_blk_desc(mmc); int ret = 0; - header = (struct image_header *)(CONFIG_SYS_TEXT_BASE - - sizeof(struct image_header)); + header = spl_get_load_buffer(-sizeof(*header), bd->blksz); /* read image header to find the image size & load address */ - count = blk_dread(mmc_get_blk_desc(mmc), sector, 1, header); + count = blk_dread(bd, sector, 1, header); debug("hdr read sector %lx, count=%lu\n", sector, count); if (count == 0) { ret = -EIO; @@ -141,7 +140,8 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device) #endif if (err) { #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT - printf("spl: could not find mmc device. error: %d\n", err); + printf("spl: could not find mmc device %d. error: %d\n", + mmc_dev, err); #endif return err; } @@ -192,9 +192,11 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image, static int mmc_load_image_raw_os(struct spl_image_info *spl_image, struct mmc *mmc) { - unsigned long count; int ret; +#if defined(CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR) + unsigned long count; + count = blk_dread(mmc_get_blk_desc(mmc), CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR, CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS, @@ -205,6 +207,7 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image, #endif return -1; } +#endif /* CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR */ ret = mmc_load_image_raw_sector(spl_image, mmc, CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR); @@ -235,7 +238,7 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc) { int err = -ENOSYS; -#ifdef CONFIG_SPL_FAT_SUPPORT +#ifdef CONFIG_SPL_FS_FAT if (!spl_start_uboot()) { err = spl_load_image_fat_os(spl_image, mmc_get_blk_desc(mmc), CONFIG_SYS_MMCSD_FS_BOOT_PARTITION); @@ -250,7 +253,7 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc) return err; #endif #endif -#ifdef CONFIG_SPL_EXT_SUPPORT +#ifdef CONFIG_SPL_FS_EXT4 if (!spl_start_uboot()) { err = spl_load_image_ext_os(spl_image, mmc_get_blk_desc(mmc), CONFIG_SYS_MMCSD_FS_BOOT_PARTITION); @@ -266,7 +269,7 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc) #endif #endif -#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT) +#if defined(CONFIG_SPL_FS_FAT) || defined(CONFIG_SPL_FS_EXT4) err = -ENOENT; #endif @@ -281,7 +284,7 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc) u32 __weak spl_boot_mode(const u32 boot_device) { -#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT) +#if defined(CONFIG_SPL_FS_FAT) || defined(CONFIG_SPL_FS_EXT4) return MMCSD_MODE_FS; #elif defined(CONFIG_SUPPORT_EMMC_BOOT) return MMCSD_MODE_EMMCBOOT;