summaryrefslogtreecommitdiffstats
path: root/arch/mips/boot
Commit message (Collapse)AuthorAgeFilesLines
* MIPS: remove request_sdram_region "fdt"Oleksij Rempel2019-04-231-4/+0
| | | | | | | It is actually not needed at barebox runtime Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: relocation: do not use configurable memory layoutOleksij Rempel2019-04-232-4/+17
| | | | | | | | | The relocator is not able to patch properly new location of the stack. To make it work properly it is better to disable HAVE_CONFIGURABLE_MEMORY_LAYOUT. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: relocation: add relocation supportOleksij Rempel2019-04-232-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this patch i a port of following patch from u-boot with some additional integration changes and fixes of original code: | Subject: [PATCH] MIPS: Stop building position independent code | | U-Boot has up until now built with -fpic for the MIPS architecture, | producing position independent code which uses indirection through a | global offset table, making relocation fairly straightforward as it | simply involves patching up GOT entries. | | Using -fpic does however have some downsides. The biggest of these is | that generated code is bloated in various ways. For example, function | calls are indirected through the GOT & the t9 register: | | 8f998064 lw t9,-32668(gp) | 0320f809 jalr t9 | | Without -fpic the call is simply: | | 0f803f01 jal be00fc04 <puts> | | This is more compact & faster (due to the lack of the load & the | dependency the jump has on its result). It is also easier to read & | debug because the disassembly shows what function is being called, | rather than just an offset from gp which would then have to be looked up | in the ELF to discover the target function. | | Another disadvantage of -fpic is that each function begins with a | sequence to calculate the value of the gp register, for example: | | 3c1c0004 lui gp,0x4 | 279c3384 addiu gp,gp,13188 | 0399e021 addu gp,gp,t9 | | Without using -fpic this sequence no longer appears at the start of each | function, reducing code size considerably. | | This patch switches U-Boot from building with -fpic to building with | -fno-pic, in order to gain the benefits described above. The cost of | this is an extra step during the build process to extract relocation | data from the ELF & write it into a new .rel section in a compact | format, plus the added complexity of dealing with multiple types of | relocation rather than the single type that applied to the GOT. The | benefit is smaller, cleaner, more debuggable code. The relocate_code() | function is reimplemented in C to handle the new relocation scheme, | which also makes it easier to read & debug. | | Taking maltael_defconfig as an example the size of u-boot.bin built | using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils | 2.24.90) shrinks from 254KiB to 224KiB. | | Signed-off-by: Paul Burton <paul.burton@imgtec.com> Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: relocation: pass ram size to pbl_main_entryOleksij Rempel2019-04-231-2/+3
| | | | | | | | To make barebox dynamically relocatable it should know the RAM size to be able to calculate proper new location. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: migrate all files to SPDXOleksij Rempel2019-01-034-54/+4
| | | | | | Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Reviewed-by: Roland Hieber <r.hieber@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: port all mach* to multiimageOleksij Rempel2018-12-172-45/+1
| | | | | Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: put main_entry to __bare_init sectionOleksij Rempel2018-12-131-1/+2
| | | | | | | | | To make disassambly easier to read. With this patch main_entry will be at the start of the text section and not in the middle. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: mutliimage: pass devicetree from PBL to the main_entryOleksij Rempel2018-12-134-12/+31
| | | | | | | We need it for multiimage support. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: start: preserve DTB pointer for later useOleksij Rempel2018-12-131-0/+7
| | | | | | | | | We will get DTB pointer in a0 register. Since a0 is used as argument by other functions, we need to preserve it and then pass as argument to the main_entry(). Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: use CKSEG1 instead of KSEG1Peter Mamonov2018-05-241-2/+2
| | | | | | | | KSEG1 constant is defined for 32 bit MIPS only. Use CKSEG1 which is defined for both MIPS32 and MIPS64. Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: start.S: put entry code into the ".text_entry" sectionAntony Pavlov2017-05-081-1/+1
| | | | | | | | The ".text_bare_init" section is not intended to be used for storing entry code. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: start*.S: drop redundant .textAntony Pavlov2017-05-082-2/+0
| | | | | | | | | | `.text' is equivalent to the `.section .text' directive. The `.text' directive just before `.section ".text_bare_init"' or just before `.section ".text_head_entry"' is redundant so drop it. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: drop redundant start_barebox() declarationAntony Pavlov2016-11-081-1/+0
| | | | | | | The start_barebox() function is defined in the <common.h> header file. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of_unflatten_dtb(): Check return value with IS_ERRAndrey Smirnov2016-09-051-1/+1
| | | | | | | | Of_unflatten_dtb returns a ERR_PTR value so checking it against NULL is incorrect. Fix it in all of the places where this was happening. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: dtb: register only one memory bankPeter Mamonov2016-03-091-5/+7
| | | | | | Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: refactor SBL start.S codeAntony Pavlov2015-09-231-101/+7
| | | | | | | | | | | | This commit removes code duplication by using MIPS PBL macros in the SBL start.S file. One of the side effects of this patch is that the only <asm/pbl_macros.h> header file is depends on the <generated/utsrelease.h> header file. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sizes.h: move include/sizes.h to include/linux/sizes.hMasahiro Yamada2015-01-081-1/+1
| | | | | | | | | | | | | | This file originates in Linux. Linux has it under include/linux/ directory since commit dccd2304cc90. Let's move it to the same place as well in barebox. This commit was generated by the following commands: find -name '*.[chS]' | xargs sed -i -e 's:<sizes.h>:<linux/sizes.h>:' git mv include/sizes.h include/linux/ Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Drop devicetree merge supportSascha Hauer2014-05-221-1/+1
| | | | | | | | | | | | I assume I am the only person knowing that barebox is able to merge devicetrees. This feature seems broken for a while now since trying to merge devicetress results in: unflatten: too many end nodes Remove this feature to save the complexity. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rework debug_llSascha Hauer2013-09-051-1/+1
| | | | | | | | | | Convert to static inline functions and use lower case letters for function names. Also, include mach/debug_ll.h when an architecture provides support for debug_ll, not only when it's actually enabled. This allows architecures to put some UART initialization code into mach/debug_ll.h which is compiled out when debug_ll is disabled. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: pbl: remove extra copyrightsAntony Pavlov2013-06-181-1/+0
| | | | | | | | | Remove Shinya Kuribayashi's copyright on the ADR macro in start-pbl.S as we don't define this macro in this file or even use it where. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: add initial device tree supportAntony Pavlov2013-05-132-0/+63
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mips: initialize malloc pool before start_barebox()Sascha Hauer2013-03-141-0/+5
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pbl: factorise decompressorJean-Christophe PLAGNIOL-VILLARD2013-01-301-22/+2
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: add pre-bootloader (pbl) image supportAntony Pavlov2012-12-143-0/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is based on ARM pbl support and allows creating a pre-bootloader binary for compressed image. For different MIPS SoCs (or even for different boards based on the same SoC) the operations carried on in start-pbl.S can be very different. The additional constraints can be imposed on the size of the boot code or the special magic labels in the beginning of the boot code; In some cases it could be necessary to show CPU is alive as early as possible (transmit a char via UART or blink a LED). So the demands for pbl start operation can be very different. E.g. malta board store boot code at the NOR flash mapped to the MIPS power-on address (0xbfc00000); it is the most simple case: we need just copy pbl image from direct-mapped flash to RAM and jump there. The XBurst-powered boards store boot code in the beginning of a NAND flash or in the beginning of SD/MMC card. In this case we must use simple and short NAND or SD/MMC access routines to copy pbl image to RAM. To meet so different demands a simple technique is selected: * MIPS pbl entry point located in file arch/mips/boot/start-pbl.S. * MIPS pbl code (see start-pbl.S) assumes that every pbl-enabled board has a arch/mips/boards/<BOARD>/include/board/board_pbl_start.h header file. This file must contain definition of the board_pbl_start macro. This macro is used as start of pbl image; * the most popular asm routines (stack setup, relocation to link address, NS16550 initialization (WIP) and so on) are containt in the arch/mips/include/asm/pbl_macros.h header file. So board pbl macro can use it if necessary. It is possible to create similar headers with macros for each specific SoC; so even if we have many different boards based on the same SoC the board_pbl_start macro for every board can be short and clear. * after board-specific initialization the stack pointer is initialized and pbl C code is started. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: main_entry.c: fix typoAntony Pavlov2012-11-191-1/+0
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-172-7/+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>
* MIPS: add initial exceptions handlingAntony Pavlov2012-07-271-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | Checking exception handling: $ make qemu-malta_defconfig $ make ... $ qemu-system-mips -nodefaults -M malta -m 256 \ -nographic -serial stdio -bios ./barebox.bin ... barebox:/ md -l 0x03 Ooops, address error on load or ifetch! EPC = 0xa082783c CP0_STATUS = 0x00000006 CP0_CAUSE = 0x00000410 CP0_CONFIG = 0x80008482 ### ERROR ### Please RESET the board ### Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: import CPU and cache detection code from Linux 3.4Antony Pavlov2012-05-231-0/+9
| | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: introduce C architecture-specific low-level initAntony Pavlov2012-05-233-12/+46
| | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: start.S: add "barebox" label at _start + 0x10Antony Pavlov2012-05-111-0/+12
| | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: start.S: clean up whitespacesAntony Pavlov2012-04-261-1/+1
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: add common MIPS stuffAntony Pavlov2011-08-052-0/+144
Add start.S, CP0 clocksource, Makefile, linker script and memory layout function. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>