summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* part:efi: add bootable parameter in gpt commandPatrick Delaunay2015-11-231-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The optional parameter bootable is added in gpt command to set the partition attribute flag "Legacy BIOS bootable" This flag is used in extlinux and so in with distro to select the boot partition where is located the configuration file (please check out doc/README.distro for details). With this parameter, U-Boot can be used to create the boot partition needed for device using distro. example of use: setenv partitions "name=u-boot,size=60MiB;name=boot,size=60Mib,bootable;\ name=rootfs,size=0" > gpt write mmc 0 $partitions > part list mmc 0 Partition Map for MMC device 0 -- Partition Type: EFI Part Start LBA End LBA Name Attributes Type GUID Partition GUID 1 0x00000022 0x0001e021 "u-boot" attrs: 0x0000000000000000 type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 guid: cceb0b18-39cb-d547-9db7-03b405fa77d4 2 0x0001e022 0x0003c021 "boot" attrs: 0x0000000000000004 type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 guid: d4981a2b-0478-544e-9607-7fd3c651068d 3 0x0003c022 0x003a9fde "rootfs" attrs: 0x0000000000000000 type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 guid: 6d6c9a36-e919-264d-a9ee-bd00379686c7 > part list mmc 0 -bootable devplist > printenv devplist devplist=2 Then the distro scripts will search extlinux in partition 2 and not in the first partition. Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com>
* gpt: command: Extend gpt command to support GPT table verificationLukasz Majewski2015-11-231-25/+67
| | | | | | | | | | | | | This commit adds support for "gpt verify" command, which verifies correctness of on-board stored GPT partition table. As the optional parameter one can provide '$partitons' environment variable to check if partition data (size, offset, name) is correct. This command should be regarded as complementary one to "gpt restore". Signed-off-by: Lukasz Majewski <l.majewski@majess.pl> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Przemyslaw Marczak <p.marczak@samsung.com>
* gpt: doc: Update gpt command's help descriptionLukasz Majewski2015-11-231-2/+5
| | | | | Signed-off-by: Lukasz Majewski <l.majewski@majess.pl> Reviewed-by: Tom Rini <trini@konsulko.com>
* gpt: command: Remove duplicated check for empty partition descriptionLukasz Majewski2015-11-231-3/+0
| | | | | | | | Exactly the same check is performed in set_gpt_info() function executed just after this check. Signed-off-by: Lukasz Majewski <l.majewski@majess.pl> Reviewed-by: Tom Rini <trini@konsulko.com>
* lib/tiny-printf.c: Add tiny printf function for space limited environmentsStefan Roese2015-11-231-36/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a small printf() version that supports all basic formats. Its intented to be used in U-Boot SPL versions on platforms with very limited internal RAM sizes. To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This will result in the SPL using this tiny function and the main U-Boot still using the full-blown printf() function. This code was copied from: http://www.sparetimelabs.com/printfrevisited With mostly only coding style related changes so that its checkpatch clean. The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp (Marvell AXP) SPL: Without this patch: 58963 18536 1928 79427 13643 ./spl/u-boot-spl With this patch: 56542 18536 1956 77034 12cea ./spl/u-boot-spl Note: To make it possible to compile tiny-printf.c instead of vsprintf.c when CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are moved from common/console.c into vsprintf.c in this patch. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Tom Rini <trini@konsulko.com> Cc: Albert Aribaud <albert.u.boot@aribaud.net>
* common/console.c: Small coding style cleanupStefan Roese2015-11-231-2/+4
| | | | | | | | Change some comments to match the U-Boot coding style rules. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
* common/console.c: Drop sandbox special-case console codeStefan Roese2015-11-231-5/+0
| | | | | | | | | | As done in commit da229e4e [sandbox: Drop special-case sandbox console code], this patch drops the sandbox special-case code in vprintf() that was missed by Simon at that time. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
* eeprom: Clean up checkpatch issuesMarek Vasut2015-11-211-9/+10
| | | | | | | | | | Cosmetic fixes to the file, make it checkpatch clean. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
* eeprom: Add support for selecting i2c busMarek Vasut2015-11-211-4/+11
| | | | | | | | | | | Add additional parameter into the eeprom command to select the I2C bus on which the eeprom resides. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
* eeprom: Add bus argument to eeprom_init()Marek Vasut2015-11-212-4/+8
| | | | | | | | | | | | | | | Add bus argument to eeprom_init(), so that it can select the I2C bus number on which the eeprom resides. Any negative value of the $bus argument will preserve the old behavior. This is in place so that old code does not randomly break. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de> [trini: Wrap i2c_set_bus_num() call with CONFIG_SYS_I2C test] Signed-off-by: Tom Rini <trini@konsulko.com>
* eeprom: Pull out the RW loopMarek Vasut2015-11-211-30/+21
| | | | | | | | | | | | Unify the code for doing read/write into single function, since the code for both the read and write is almost identical. This again trims down the code duplication. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
* eeprom: Pull out transfer length computationMarek Vasut2015-11-211-41/+25
| | | | | | | | | | | | Pull out the code which computes the length of the transfer into separate code and clean it up a little. This again trims down the code duplication. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
* eeprom: Pull out CONFIG_SYS_EEPROM_PAGE_WRITE_BITSMarek Vasut2015-11-211-8/+8
| | | | | | | | | | | | | Implement default value of 8 for this macro and pull out all of this macro out of the code. The default value of 8 actually does implement exactly the same behavior as the previous code which was in the #else clause of the ifdef. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
* eeprom: Suck the ifdef into eeprom_init()Marek Vasut2015-11-211-4/+2
| | | | | | | | | | | Just suck the ugly ifdef around eeprom_init() call into eeprom_init() function itself. This puts all of the ifdef mess into one place. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
* eeprom: Pull out CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MSMarek Vasut2015-11-211-2/+4
| | | | | | | | | | | | | Pull this macro to the beginning of the cmd_eeprom.c and remove another nasty ifdef from the code. Note that this is legal, since udelay(0) changes the behavior only such that it pings the WDT if WDT is enabled and otherwise does not wait. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
* eeprom: Make eeprom_write_enable() weakMarek Vasut2015-11-211-9/+9
| | | | | | | | | | | | Make this function weak and implement it's weak implementation so that the boards can just reimplement it. This zaps the horrid CONFIG_SYS_EEPROM_WREN macro. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
* eeprom: Pull out address computationMarek Vasut2015-11-211-38/+26
| | | | | | | | | | | Pull out the code computing the EEPROM address into separate function so that it's not duplicated. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
* eeprom: Pull out the I/O codeMarek Vasut2015-11-211-19/+31
| | | | | | | | | | | Pull out the code which does the I2C or SPI read/write, so that the beefy ifdef around it is contained in a single function. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
* eeprom: Zap CONFIG_SPI_XMarek Vasut2015-11-211-4/+4
| | | | | | | | | | This macro is no longer used, so just reap it. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
* eeprom: Zap eeprom_probe()Marek Vasut2015-11-211-19/+0
| | | | | | | | | | Remove this function as it's no longer used. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
* eeprom: Zap CONFIG_SYS_EEPROM_X40430Marek Vasut2015-11-211-94/+0
| | | | | | | | | | | Now that the only user of CONFIG_SYS_EEPROM_X40430 was removed, remove this unused code from cmd_eeprom.c Signed-off-by: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
* eeprom: Zap CONFIG_SYS_I2C_MULTI_EEPROMSMarek Vasut2015-11-211-39/+30
| | | | | | | | | | | | | | This option only complicates the code unnecessarily, just use CONFIG_SYS_DEF_EEPROM_ADDR as the default address if there are only five arguments to eeprom {read/write} if this is defined. If CONFIG_SYS_DEF_EEPROM_ADDR is not defined, we mandate all six arguments. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
* eeprom: Shuffle code aroundMarek Vasut2015-11-211-98/+70
| | | | | | | | | | | | | Just move the code around so that the forward declarations are not necessary. Also zap a few checkpatch issues where applicable and zap the use of #ifdef CONFIG_CMD_EEPROM in the code, since this is always true. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
* usb: Avoid open-coded USB constants in usb_kbd.cSimon Glass2015-11-191-5/+5
| | | | | | | Replace the open-coded values with constants to make it clearer what they mean. Signed-off-by: Simon Glass <sjg@chromium.org>
* usb: Drop unused code in usb_kbd.cSimon Glass2015-11-191-30/+0
| | | | | | This was missed in the conversion to driver model. Signed-off-by: Simon Glass <sjg@chromium.org>
* usb: Refactor USB tree output code for testingSimon Glass2015-11-191-25/+33
| | | | | | | Allow the 'usb tree' command to be used from test code, so that we can verify that it works correctly. Signed-off-by: Simon Glass <sjg@chromium.org>
* console: Add a console bufferSimon Glass2015-11-194-1/+97
| | | | | | | | | | | | | | | | | | | It is useful to be able to record console output and provide console input via a buffer. This provides sandbox with the ability to run a command and check its output. If the console is set to silent then no visible output is generated. This also provides a means to fix the problem where tests produce unwanted output, such as errors or warnings. This can be confusing. We can instead set the console to silent and record this output. It can be checked later in the test if required. It is possible that this may prove useful for non-test situations. For example the console output may be suppressed for normal operations, but recorded and stored for access by the OS. That feature is not implemented at present. Signed-off-by: Simon Glass <sjg@chromium.org>
* Move console definitions into a new console.h fileSimon Glass2015-11-1929-0/+30
| | | | | | | | The console includes a global variable and several functions that are only used by a small subset of U-Boot files. Before adding more functions, move the definitions into their own header file. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: usb: Avoid time delays in sandbox testsSimon Glass2015-11-191-1/+9
| | | | | | | Currently the USB tests take around two seconds to run. Remove these unnecessary time delays so that the tests run quickly. Signed-off-by: Simon Glass <sjg@chromium.org>
* common/board_f.c: move mark_bootstage after arch_cpu_init_dmThomas Chou2015-11-191-1/+1
| | | | | | | | | As mark_bootstage() uses timer, it should go after driver model is initialized. Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* dm: stdio: Plumb in the new keyboard uclassSimon Glass2015-11-191-1/+30
| | | | | | | | | | | When driver model is used for keyboards we must scan the available keyboards and register them with stdio. Add code to do this. At some point (once LCD/video is converted) we should be able to convert stdio to driver model and avoid these dual data structures. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: input: Create a keyboard uclassSimon Glass2015-11-191-6/+0
| | | | | | | | | Add a uclass for keyboard input, mirroring the existing stdio methods. This is enabled by a new CONFIG_DM_KEYBOARD option. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: usb: Add support for USB keyboards with driver modelSimon Glass2015-11-192-8/+56
| | | | | | | | Switch USB keyboards over to use driver model instead of scanning with the horrible usb_get_dev_index() function. This involves creating a new uclass for keyboards, although so far there is no API. Signed-off-by: Simon Glass <sjg@chromium.org>
* Merge branch 'zynq' of git://www.denx.de/git/u-boot-microblazeTom Rini2015-11-192-0/+6
|\
| * common: mii: Do not allow to exceed max phy limitMichal Simek2015-11-191-0/+5
| | | | | | | | | | | | | | | | Phy can have addresses 0-31. Check this boundary to ensure that user can't call commands on phy address 32 and more. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com>
| * tools: zynqimage: Add Xilinx Zynq boot header generation to mkimageNathan Rossi2015-11-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As with other platforms vendors love to create their own boot header formats. Xilinx is no different and for the Zynq platform/SoC there exists the "boot.bin" which is read by the platforms bootrom. This format is described to a useful extent within the Xilinx Zynq TRM. This implementation adds support for the 'zynqimage' to mkimage. The implementation only considers the most common boot header which is un-encrypted and packed directly after the boot header itself (no XIP, etc.). However this implementation does take into consideration the other fields of the header for image dumping use cases (vector table and register initialization). Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Cc: Michal Simek <michal.simek@xilinx.com> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* | env_ubi.c: Correct pointer error in env loadKevin Smith2015-11-191-2/+1
|/ | | | | | | | | | | | | | The variable "buf" in this function is a char array, and the function ubi_volume_read is expecting a char *. In the call, the address of the pointer is being taken, incorrectly passing a char **. The compiler warning was being silenced by the cast. Remove the address operator and the cast. Signed-off-by: Kevin Smith <kevin.smith@elecsyscorp.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Tom Rini <trini@konsulko.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Heiko Schocher <hs@denx.de>
* itest: add missing break statements to evalexp()Stephen Warren2015-11-181-3/+9
| | | | | | | | | | The commit mentioned below replaced return statements inside a switch so that other code could be called after the switch. However, it didn't add any break statements, causing the cases to run together. Fix this. Reported-by: Coverity (CID 132282, 132283) Fixes: 7861204c9af7 ("itest: make memory access work under sandbox") Signed-off-by: Stephen Warren <swarren@nvidia.com>
* common: add CMD_GPIO to KconfigThomas Chou2015-11-181-0/+6
| | | | | | | Add CMD_GPIO to Kconfig and run tools/moveconfig.py . Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Reviewed-by: Simon Glass <sjg@chromium.org>
* spl: mmc: add support for BOOT_DEVICE_MMC2Nikita Kiryanov2015-11-182-9/+34
| | | | | | | | | | | Currently the mmc device that SPL looks at is always mmc0, regardless of the BOOT_DEVICE_MMCx value. This forces some boards to implement hacks in order to boot from other mmc devices. Make SPL take into account the correct mmc device. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Reviewed-by: Tom Rini <trini@konsulko.com>
* spl: announce boot devicesNikita Kiryanov2015-11-181-0/+79
| | | | | | | | | | | | | Now that we support alternative boot devices, it can sometimes be unclear which boot devices was actually used. Provide a function to announce which boot devices are attempted during boot. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Cc: Igor Grinberg <grinberg@compulab.co.il> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* spl: add support for alternative boot deviceNikita Kiryanov2015-11-181-4/+29
| | | | | | | | | | | | | | Introduce spl_boot_list array, which defines a list of boot devices that SPL will try before hanging. By default this list will consist of only spl_boot_device(), but board_boot_order() can be overridden by board code to populate the array with custom values. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Cc: Igor Grinberg <grinberg@compulab.co.il> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* common: spl: move image load to its own functionNikita Kiryanov2015-11-181-67/+50
| | | | | | | | | | | | | Refactor spl image load code out of board_init_r and into its own function. This is a preparation for supporting alternative boot devices. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Cc: Igor Grinberg <grinberg@compulab.co.il> 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: change return values of spl_*_load_image()Nikita Kiryanov2015-11-189-48/+91
| | | | | | | | | | | | | | | | | | | | | | | Make spl_*_load_image() functions return a value instead of hanging if a problem is encountered. This enables main spl code to make the decision whether to hang or not, thus preparing it to support alternative boot devices. Some boot devices (namely nand and spi) do not hang on error. Instead, they return normally and SPL proceeds to boot the contents of the load address. This is considered a bug and is rectified by hanging on error for these devices as well. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Cc: Igor Grinberg <grinberg@compulab.co.il> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Cc: Ian Campbell <ijc@hellion.org.uk> Cc: Hans De Goede <hdegoede@redhat.com> Cc: Albert Aribaud <albert.u.boot@aribaud.net> Cc: Jagan Teki <jteki@openedev.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* spl: mmc: get rid of emmc boot code duplicationNikita Kiryanov2015-11-181-36/+18
| | | | | | | | | | | | | | | | | Get rid of emmc boot code duplication in spl_mmc_load_image() using a switch case fallthrough into MMCSD_MODE_RAW. Since the #ifdef CONFIG_SUPPORT_EMMC_BOOT check is not really necessary, remove it in the process. 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: 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-183-8/+21
| | | | | | | | | | | | | | | | | | | 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>
OpenPOWER on IntegriCloud