summaryrefslogtreecommitdiffstats
path: root/common/spl/spl_mmc.c
Commit message (Collapse)AuthorAgeFilesLines
* spl: mmc: move fs boot into its own functionNikita Kiryanov2015-11-181-30/+51
| | | | | | | | | | | | | | | | Move the code that handles fs boot out of spl_mmc_load_image() and into its own function to reduce the #ifdef complexity of spl_mmc_load_image(). No functional changes. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Cc: Igor Grinberg <grinberg@compulab.co.il> Cc: Paul Kocialkowski <contact@paulk.fr> Cc: Pantelis Antoniou <panto@antoniou-consulting.com> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* spl: mmc: get rid of #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION checkNikita Kiryanov2015-11-181-4/+9
| | | | | | | | | | | | | | | | | | Implement defaults for the raw partition image loading so that the #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION in spl_mmc_load_image() will no longer be necessary. This change makes it possible for mmc_load_image_raw_partition() and mmc_load_image_raw_sector() to coexist. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Cc: Igor Grinberg <grinberg@compulab.co.il> Cc: Paul Kocialkowski <contact@paulk.fr> Cc: Pantelis Antoniou <panto@antoniou-consulting.com> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* spl: mmc: remove #ifdef CONFIG_SPL_OS_BOOT checkNikita Kiryanov2015-11-181-8/+9
| | | | | | | | | | | | | | | | | | | Implement default versions of falcon mode functions to make the CONFIG_SPL_OS_BOOT check in spl_mmc_load_image() unnecessary, thus reducing its #ifdef complexity. No functional changes. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Cc: Igor Grinberg <grinberg@compulab.co.il> Cc: Paul Kocialkowski <contact@paulk.fr> Cc: Pantelis Antoniou <panto@antoniou-consulting.com> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Cc: Guillaume GARDET <guillaume.gardet@free.fr> Cc: Suriyan Ramasami <suriyan.r@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* spl: mmc: refactor device location code to its own functionNikita Kiryanov2015-11-181-22/+55
| | | | | | | | | | | | | | | | | | | Simplify spl_mmc_load_image() code by moving the part that finds the mmc device into its own function spl_mmc_find_device(), available in two flavors: DM and non-DM. This refactor fixes a bug in which an error in the device location sequence does not necessarily aborts the rest of the code. With this refactor, we fail the moment there is an error. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Cc: Igor Grinberg <grinberg@compulab.co.il> Cc: Paul Kocialkowski <contact@paulk.fr> Cc: Pantelis Antoniou <panto@antoniou-consulting.com> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* spl: mmc: add break statements in spl_mmc_load_image()Nikita Kiryanov2015-11-181-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original intention of the mmc load_image() function was to try multiple boot modes before failing. This is evident by the lack of break statements in the switch, and the following line in the default case: puts("spl: mmc: no boot mode left to try\n"); This implementation is problematic because: - The availability of alternative boot modes is very arbitrary since it depends on the specific order of the switch cases. If your boot mode happens to be the first case, then you'll have a bunch of other boot modes as alternatives. If it happens to be the last case, then you have none. - Opting in/out is tied to config options, so the only way for you to prevent an alternative boot mode from being attempted is to give up on the feature completely. - This implementation makes the code more complicated and difficult to understand. Address these issues by inserting a break statements between the cases to make the function try only one boot mode. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Cc: Igor Grinberg <grinberg@compulab.co.il> Cc: Paul Kocialkowski <contact@paulk.fr> Cc: Pantelis Antoniou <panto@antoniou-consulting.com> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* spl: Fix compile warning for arm64Gong Qianyu2015-08-121-1/+1
| | | | | | Make the cast explicit for "warning: cast to pointer from integer of different size". Signed-off-by: Gong Qianyu <Qianyu.Gong@freescale.com>
* spl: spl_mmc: Add option to boot from a MMC partition with offsetStefan Roese2015-07-241-0/+5
| | | | | | | | | | | | | | | | This patch introduces the option to boot from a MMC card parition with an offset. This can be done by using both defines together: define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION 1 define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR ((160 << 10) / 512) The example above loads the main U-Boot at offset 160KiB from the MMC partition 1. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Luka Perkov <luka.perkov@sartura.hr> Cc: Dirk Eibach <eibach@gdsys.de> Cc: Tom Rini <trini@konsulko.com>
* dm: mmc: Allow driver model to be used for MMC in SPLSimon Glass2015-07-211-2/+15
| | | | | | Enable MMC using driver model in SPL for consistency with U-Boot proper. Signed-off-by: Simon Glass <sjg@chromium.org>
* spl: Add debugging info for spl_mmc bootSimon Glass2015-07-211-2/+7
| | | | | | Add a few messages to indicate progress and failure. Signed-off-by: Simon Glass <sjg@chromium.org>
* spl: spl_mmc: MMC boot mode provisions checksPaul Kocialkowski2015-06-181-7/+15
| | | | | | | | | | | This allows using only one of either raw or fs mode for SPL mmc boot, without the need to have provisions for the other. In particular, a device may have U-Boot installed on a file system on the mmc, without ever needing to read U-Boot from raw memory. Thus, there is no reason to provide a sector or partition for raw mode. This allows this behaviour and still provides a robust fallback mechanism in case provisions for both modes are defined. Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* spl: spl_mmc: Minor cosmeticsPaul Kocialkowski2015-06-181-6/+5
| | | | | | This switches some printf calls to puts and avoids a test repetition. Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* spl: spl_mmc: Error and count distinctionPaul Kocialkowski2015-05-281-14/+19
| | | | | | | | | This introduces a distinction between return codes that are read bytes counts and errors. Read bytes counts are erroneous when null (no data was read) while errors are erroneous when non-null. Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Tested-by: Tim Harvey <tharvey@gateworks.com>
* spl: spl_mmc: fix mmc Falcon mode regressionTim Harvey2015-05-261-1/+1
| | | | | | | | | | | 91199f4a5a21a7cf9dd9e7c05e295a042f8c2b7e broke mmc based Falcon mode. The block_read function returns the number of blocks read thus the error check needs to look for a return of 0 blocks read. Cc: Paul Kocialkowski <contact@paulk.fr> Signed-off-by: Tim Harvey <tharvey@gateworks.com> Acked-by: Paul Kocialkowski <contact@paulk.fr>
* spl: spl_mmc: Partition raw boot mode for eMMCPaul Kocialkowski2015-05-101-0/+5
| | | | | | This adds support for providing a partition number instead of a sector for eMMC. Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
* spl: spl_mmc: Clearer structure in spl_mmc_load_image and cosmeticsPaul Kocialkowski2015-05-101-55/+73
| | | | | | | | | | | | | | This refactors spl_mmc_load_image to use a switch/case structure and easier to understand spl_start_uboot checks. This also introduces some more automatic fallback on the next mmc boot mode as long as it keeps failing. Lines that go beyond 80 chars are also reduced by reducing the number of tabs. Debug and error strings are refctored to match a common style. Signed-off-by: Paul Kocialkowski <contact@paulk.fr> [trini: Fix a thinko in the SPL_EXT_SUPPORT + SPL_OS conversion, make part be __maybe_unused] Signed-off-by: Tom Rini <trini@konsulko.com>
* remove unnecessary version.h includesRob Herring2015-03-241-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Various files are needlessly rebuilt every time due to the version and build time changing. As version.h is not actually needed, remove the include. Signed-off-by: Rob Herring <robh@kernel.org> Cc: Albert Aribaud <albert.u.boot@aribaud.net> Cc: Stefano Babic <sbabic@denx.de> Cc: Minkyu Kang <mk7.kang@samsung.com> Cc: Marek Vasut <marex@denx.de> Cc: Tom Warren <twarren@nvidia.com> Cc: Michal Simek <monstr@monstr.eu> Cc: Macpaul Lin <macpaul@andestech.com> Cc: Wolfgang Denk <wd@denx.de> Cc: York Sun <yorksun@freescale.com> Cc: Stefan Roese <sr@denx.de> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Cc: Simon Glass <sjg@chromium.org> Cc: Philippe Reynes <tremyfr@yahoo.fr> Cc: Eric Jarrige <eric.jarrige@armadeus.org> Cc: "David Müller" <d.mueller@elsoft.ch> Cc: Phil Edworthy <phil.edworthy@renesas.com> Cc: Robert Baldyga <r.baldyga@samsung.com> Cc: Torsten Koschorrek <koschorrek@synertronixx.de> Cc: Anatolij Gustschin <agust@denx.de> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Łukasz Majewski <l.majewski@samsung.com>
* spl: mmc: Fix raw boot mode (related to commit ↵Guillaume GARDET2015-01-061-3/+16
| | | | | | | | | | | | | | | | | 4c5bbc2328a24f5e1ee990c9a9527e48e5fb3b5f) As reported by Robert Nelson, commit 4c5bbc2328a24f5e1ee990c9a9527e48e5fb3b5f may break MMC RAW boot mode. This patch fixes the check path to fix MMC Raw boot mode. Tested raw boot mode and FS boot mode on a pandaboard (rev. A3). Reported-by: Robert Nelson <robertcnelson@gmail.com> Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr> Cc: Tom Rini <trini@ti.com> Cc: Robert Nelson <robertcnelson@gmail.com> Tested-by: Robert Nelson <robertcnelson@gmail.com>
* spl: if MMCSD_MODE_RAW fails, try MMCSD_MODE_FS, if availableGuillaume GARDET2014-12-081-1/+2
| | | | | | | | | | In SPL MMC, boot modes are exclusive. So, if MMCSD_MODE_RAW fails, the board hangs. This patch allows to try MMCSD_MODE_FS then, if available. It has been tested on a pandaboard (rev. A3). Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr> Cc: Tom Rini <trini@ti.com>
* spl: MMC U-Boot image load from raw partitionPaul Kocialkowski2014-12-081-4/+26
| | | | | | | | | | | | | Raw images of U-Boot can be stored inside MMC partitions, so it makes sense to read the partition table, looking for a partition number instead of using a fixed sector address. Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Reviewed-by: Tom Rini <trini@ti.com> [trini: Only add mmc_load_image_raw_partition() when CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION to avoid warning, add missing conversion in spl_mmc_load_image()] Signed-off-by: Tom Rini <trini@ti.com>
* MMC SD fs boot partition config coding style and proper descriptionPaul Kocialkowski2014-12-041-4/+4
| | | | | | | | | | | CONFIG_SYS_MMC_SD_FS_BOOT_PARTITION ought to be called CONFIG_SYS_MMCSD_FS_BOOT_PARTITION to keep it consistent with other config options such as: CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR. In addition, it is not related to raw mode booting but to fs mode instead. Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Reviewed-by: Tom Rini <trini@ti.com>
* spl: Add EXT support to SPLGuillaume GARDET2014-10-271-2/+16
| | | | | | | | Add EXT filesystem support to SPL. Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr> [trini: Fix a warning and checkpatch problems] Signed-off-by: Tom Rini <trini@ti.com>
* Rename some defines containing FAT in their name to be filesystem genericGuillaume GARDET2014-10-271-4/+4
| | | | | | | | | | | Rename some defines containing FAT in their name to be filesystem generic: MMCSD_MODE_FAT => MMCSD_MODE_FS CONFIG_SPL_FAT_LOAD_ARGS_NAME => CONFIG_SPL_FS_LOAD_ARGS_NAME CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME => CONFIG_SPL_FS_LOAD_PAYLOAD_NAME CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION => CONFIG_SYS_MMC_SD_FS_BOOT_PARTITION Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr> Cc: Tom Rini <trini@ti.com>
* SPL: Add CONFIG_SUPPORT_EMMC_BOOT support to CONFIG_SPL_FRAMEWORKTom Rini2014-02-071-0/+24
| | | | | | | | | | | We use the switch CONFIG_SUPPORT_EMMC_BOOT today to enable some additional features of the eMMC boot partitions. Add support for being told that we have booted from one of these partitions to the spl framework and implement this on TI OMAP/related. Cc: Pantelis Antoniou <panto@antoniou-consulting.com> Signed-off-by: Tom Rini <trini@ti.com> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
* spl: common: Move FAT funcs to a common fileDan Murphy2014-01-241-62/+6
| | | | | | Move the FAT functions to a common location for reuse. Signed-off-by: Dan Murphy <dmurphy@ti.com>
* spl_mmc: only call printf or puts with CONFIG_SPL_LIBCOMMON_SUPPORTPaul Burton2013-09-171-0/+16
| | | | | | | If we don't have CONFIG_SPL_LIBCOMMON_SUPPORT defined then stdio functions are unavailable & calling them will cause a link failure. Signed-off-by: Paul Burton <paul.burton@imgtec.com>
* spl: remove unnecessary (& ARM specific) include of asm/utils.hPaul Burton2013-09-171-1/+0
| | | | | | | ARM is the only architecture which includes this header and nothing in spl_mmc.c makes use of it. Remove the include. Signed-off-by: Paul Burton <paul.burton@imgtec.com>
* spl_mmc.c: Detect missing kernel image in RAW MMCTom Rini2013-07-261-0/+4
| | | | | | | | | Currently, we assume that if we can read from MMC correctly, we have found a valid image. This is not the case as an empty area will read just fine. Add a check for a valid IH_MAGIC. Signed-off-by: Tom Rini <trini@ti.com> Reviewed-by: Peter Korsgaard <jacmet@sunsite.dk>
* Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-241-17/+1
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* spl_mmc: add Falcon mode support for raw variantPeter Korsgaard2013-06-071-0/+18
| | | | | | | | | | If Falcon mode support is enabled (and the system isn't directed into booting u-boot), it will instead try to load kernel from sector CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR and CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS of kernel argument parameters starting from sector CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR. Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
* spl_mmc: mmc_load_image_raw(): Add sector argumentPeter Korsgaard2013-06-071-9/+6
| | | | | | So we can use it for falcon mode as well. Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
* spl_mmc: add Falcon mode support for FAT variantPeter Korsgaard2013-06-071-0/+21
| | | | | | | | | If Falcon mode support is enabled (and the system isn't directed into booting u-boot), it will instead try to load kernel from CONFIG_SPL_FAT_LOAD_KERNEL_NAME file and kernel argument parameters from CONFIG_SPL_FAT_LOAD_ARGS_NAME, both from the same partition as u-boot. Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
* spl_mmc: mmc_load_image_fat(): Add filename argument and move fat init outPeter Korsgaard2013-06-071-14/+13
| | | | | | So we can use it for falcon mode as well. Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
* spl_mmc: return error from mmc_load_image_{raw, fat} rather than hangingPeter Korsgaard2013-06-071-10/+14
| | | | | | So we can instead fallback to doing something else on errors. Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
* drivers/mmc: move spl_mmc.c to common/splYing Zhang2013-05-151-0/+137
The mpc85xx repuires a special layout on the memory device that is connected to the eSDHC controller interface. But the file spl_mmc.c didn't handle this specfic case, there needs a special treatmen, in the powerpc drictory. So, there is no longer to keep spl_mmc.c on mpc85xx, CONFIG_SPL_FRAMEWORK is not set. When CONFIG_SPL_MMC_SUPPORT is set and CONFIG_SPL_FRAMEWORK is not set, there was an error in drivers/mmc/spl_mmc.c: drivers/mmc/libmmc.o:(.got2+0x8): undefined reference to `spl_image'. Now, the solution is to move the file "spl_mmc.c" to directory "common/spl". Signed-off-by: Ying Zhang <b40530@freescale.com>
OpenPOWER on IntegriCloud