summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/boot.c
Commit message (Collapse)AuthorAgeFilesLines
* ARM: i.MX: boot: Detect boot instance on i.MX51Andrey Smirnov2018-09-241-0/+2
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: boot: Make use of FIELD_GET() in imx51_get_boot_source()Andrey Smirnov2018-09-241-7/+7
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: boot: Rework boot source detection for i.MX7 and i.MX8MQAndrey Smirnov2018-08-131-67/+30
| | | | | | | | | | | | | | | | | | | | | | For both SoCs data found in SBMR registers reflects only the boot source that was selected via pins of fuses and not the final boot source that ended up being used by MaskROM code. Original i.MX7 boot source detection implementation worked around that fact by having a special code to correctly handle "Manufacturing Mode". MaskROM in i.MX8MQ changed what SoC uses as recovery device and switched it to be USDHC2. It also made recovery device switch always enabled. Since correct actual boot source detection is important to being able to properly boot i.MX8MQ (due to not using DCD to initialize RAM), change the code to handle described exception. Instead of trying to adapt original i.MX7 code with yet another special case if(), change the whole thing to do what U-Boot does on i.MX7 and i.MX8MQ and use "Boot information for software" provided by recent (found in i.MX7 and i.MX8MQ) versions of MaskROM. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: boot: Fix accidental commaAndrey Smirnov2018-08-131-1/+1
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: boot: Add trivial i.MX8 supportAndrey Smirnov2018-06-111-0/+5
| | | | | | | | It appears that boot sources for i.MX8 are just a subset of those of i.MX7 and both can be handled by the same code. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: boot: Fix address casting on 64-bit platformsAndrey Smirnov2018-06-111-1/+2
| | | | | | | | Add an intermediary casting step in order to avoid casting 32-bit integer to 64-bit pointer on 64-bit platforms. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: boot: Coalesce copy-pasted codeAndrey Smirnov2018-04-251-49/+21
| | | | | | | | | | All of the instances of imx*_boot_save_loc() do exactly the same thing with the only difference being SoC-specific imx*_get_boot_source call. Convert the code into a generic function taking function pointer to perform SoC specific bits. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX6: boot: Return BOOTSOURCE_SPI_NOR, not BOOTSOURCE_SPIAndrey Smirnov2018-04-171-1/+1
| | | | | | | | | | | | | We use BOOTSOURCE_SPI to denote, among other things, QSPI on i.MX7 and VFxxx, whereas on i.MX6 it is used to mean SPI-NOR. To make functions like imx_xload() work consistently across various i.MX platforms use already existent BOOTSOURCE_SPI_NOR constant to mean booting from SPI-NOR on i.MX6 as well. Replace all in-tree code that relying on the old value as well. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: VFxxx: Implement code to detect bootsourceAndrey Smirnov2018-04-171-0/+101
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX7: boot: Move magic numbers into utility functionsAndrey Smirnov2018-04-171-2/+12
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX6: boot: Move magic numbers into utility functionsAndrey Smirnov2018-04-171-14/+53
| | | | | | | | | Move magic numbers and algorithm for determining Serial ROM bootsource and boot instance into utility functions. Add a comment on the logic behing the latter while at it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX53: boot: Move magic numbers info utility functionsAndrey Smirnov2018-04-171-6/+15
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: boot: Check for NAND boot only if necessary on i.MX53, 6Andrey Smirnov2018-04-171-7/+4
| | | | | | | | | | We don't need to check if the boot source is NAND in cases when we already know for a fact that we booted from something else. To avoid that, move the NAND check to be done inside of default branch of the preceeding switch statement. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: boot: Share code to detect NAND as a boot sourceAndrey Smirnov2018-04-171-3/+7
| | | | | | | | Share code to detect NAND as a boot source between i.MX53 and i.MX6 which behave the same in that aspect. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: boot: Move magic values into small functionsAndrey Smirnov2018-04-171-4/+40
| | | | | | | | | Move code to extract appropiate BOOT_CFG bits to decode bootsource on i.MX53, 6, and 7 into small functions for clarity and to allow sharing the code between i.MX53 and i.MX6. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: boot: Remove unnecessary returnsAndrey Smirnov2018-04-171-4/+0
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX7: boot: Fix SPI-NOR/QSPI boot source mixupAndrey Smirnov2018-04-171-2/+2
| | | | | | | | | | As per "Table 6-33. Boot device selection" from "i.MX 7Dual Applications Processor Reference Manual, Rev. 1, 01/2018" QSPI is encoded with 0b0100 and Serial ROM with 0b0110. Fix the original code to use correct values. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX7: boot: Remove incorrect NAND bootsource detectionAndrey Smirnov2018-04-171-4/+0
| | | | | | | | i.MX7 differs from i.MX6 and i.MX53 and bit 7 in SBMR is not used to signify boot from NAND. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX7: boot: Add code to handle SD/MMC manufacture modeAndrey Smirnov2018-04-171-0/+40
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: Account for unprogrammed fuses on i.MX6 and i.MX7Andrey Smirnov2018-04-171-1/+10
| | | | | | | | | On both i.MX6 and i.MX7 (also true for VFxxx) there's an additional path that leads mask ROM to switch into serial bootloader mode. Add code to support it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: Simplify serial bootsource detection for i.MX6 and 7Andrey Smirnov2018-04-171-26/+24
| | | | | | | | | | | | The algorithm to detect serial mode can be shared between i.M6 and i.MX7 as wall as simplified a bit by replacing swich goto/break/return termination logic with more trivial if statements. This commit also sets the stage for additional improvements in the commits that follow. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: Add a function to extract BMOD valueAndrey Smirnov2018-04-171-11/+11
| | | | | | | | | The location of BMDO field in SBMR/SBMR2 registers is consistent across all i.MX SoCs starting from i.MX53. Add simple helper function imx53_get_bmod and use it to avoid code duplication. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: Add i.MX7 base architecture supportJuergen Borleis2017-01-201-0/+70
| | | | | Signed-off-by Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX25/35: Fix bootsource detectionDaniel Krüger2016-11-231-6/+6
| | | | | | | | This fixes commit 0b47f95340d801a26643e5e1f4ee05287e8ae90e for i.MX25/35. Otherwise the bootsource was just "unknown". Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX53: Detect booting from USBSascha Hauer2016-09-221-0/+6
| | | | | | | The USB download mode can be detected by reading the BMOD[0|1] bits. Add support for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: Provide bootsource functions for early boot codeSascha Hauer2016-09-221-23/+67
| | | | | | | | The regular bootsource functions only work in a running barebox, provide functions for early code. This has already been done for i.MX6, this patch adds the same functions for the other SoCs. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX53: do not pass base address to imx*_boot_save_locSascha Hauer2016-09-221-6/+14
| | | | | | | The functions can determine the necessary base addresses themselves since they are SoC specific anyway. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX6: add function to get bootsource in pblSascha Hauer2015-07-161-16/+22
| | | | | | | In the pbl the regular bootsource_get cannot be used. Add a function which returns the bootsource directly with values from the hardware. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX53: fix bootsource_instance detectionSascha Hauer2014-01-271-1/+1
| | | | | | | Bootsource instance is encoded in bit 21:20 of the SBMR register, not in bit 22:21. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM i.MX6: Fix bootsource detectionPhilipp Zabel2013-06-081-7/+19
| | | | | | | | | This patch fixes boot_mode detection for non-internal boot and bootsource detection for i2c boot. Further, the bootsouce_instance is now determined for spi, i2c, and mmc/sd boot. Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX53: Add bootsource instance informationSascha Hauer2013-04-041-2/+16
| | | | | | | | | The i.MX53 has the bootsource instance information stored in SBMR[21:22], expose it to the environment. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootsource: create arch independent bootsource frameworkMarc Kleine-Budde2013-04-041-44/+13
| | | | | | | | | | | | This patch seperates the imx independent from the arch independent code. The following functions and enums are renamed: - imx_bootsource() -> bootsource_get() - imx_set_bootsource() -> bootsource_set() - enum imx_bootsource -> enum bootsource Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: rename barebox_loc to bootsourceSascha Hauer2013-04-031-4/+4
| | | | | | | | | | | Rename the barebox_loc environment variable to bootsource, since - barebox_loc is a mixture between abbriviation and fulltext which is not nice - technically it describes the source the SoC has booted from. This is not necessarily barebox but could also be some other first stage loader. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM i.MX bootsource: add separate function for mx25 and mx35Marc Kleine-Budde2013-03-261-1/+21
| | | | | | | | This patch creates a seperate function for mx25 and mx35 to save it's bootsource. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM i.MX bootsource: rename imx_27_boot_save_loc -> imx27_boot_save_locMarc Kleine-Budde2013-03-261-1/+1
| | | | | | | | This patch renames imx_27_boot_save_loc() to imx27_boot_save_loc(), so that all imx*_boot_save_loc() functions follow the same nameing sheme. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM i.MX bootsource: imx_25_35_boot_save_loc: remove leftover do-nothing codeMarc Kleine-Budde2013-03-261-5/+0
| | | | | | | | | This patch removes some code leftover from: a029e32 ARM i.MX: rework bootsource setting which is now a no-op. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM i.MX bootsource: convert all imx*_boot_save_loc functions to voidMarc Kleine-Budde2013-03-261-12/+6
| | | | | | | This function gives all functions a common, i.e. void, return value. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM i.MX bootsource: convert enums from enum imx_bootsource to uppercaseMarc Kleine-Budde2013-03-261-45/+45
| | | | | | | Enums are in the same way as defines, so write them in uppercase. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM i.MX6: save boot locationSascha Hauer2012-12-061-0/+60
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mach-imx: Comment typo fix, "enviroment" -> "environment"Robert P. J. Day2012-11-191-1/+1
| | | | | | | A couple trivial spelling fixes. Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM i.MX53: set bootsource locationSascha Hauer2012-10-171-0/+35
| | | | | | | To be able to set the environment location based on the bootsource. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM i.MX: rework bootsource settingSascha Hauer2012-10-151-53/+125
| | | | | | | | | | This moves the known i.MX bootsource settings to a single file so that the code can be shared. Also we add a enum for the different boot sources so that it can be used in C Code and not only on the shell. The pcm038 board is changed to use it instead of digging in the registers manually. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-4/+0
| | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Define barebox_loc magic variable only onceAlexander Shiyan2012-04-101-3/+1
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i.MX27: Export boot source to magic variablesAlexander Shiyan2012-04-021-1/+26
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM i.MX boot: Add barebox_loc magicvarSascha Hauer2011-11-291-0/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* introduce io.hSascha Hauer2011-09-221-1/+1
| | | | | | | To allow for some generic io accessors introduce io.h and use this instead of asm/io.h throughout the tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM i.MX25/35: initialize barebox_loc earlierSascha Hauer2011-08-171-6/+2
| | | | | | | | Now that env_push_context is in a coredevice_initcall we can initialize barebox_loc earlier so that we can use it inside later initcalls. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imx(25,35): save boot location into $barebox_loc env.Marc Reilly2011-01-191-0/+95
Saves the boot source into an environment variable so env scripts can more easily use boot source information. Note only tested on imx35. I haven't added support for any other variants because I'm not familiar with them. (And can't test them anyway). Signed-off-by: Marc Reilly <marc@cpdesign.com.au> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>