summaryrefslogtreecommitdiff
path: root/common/board_f.c
AgeCommit message (Collapse)AuthorFilesLines
2020-08-06board_f: Remove setup_board_part1Ovidiu Panait1-11/+1
Now that all arch specific code was converted to setup_bdinfo, we can remove setup_board_part1. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2020-08-06board_f: ppc: Factor out ppc-specific bdinfo setupOvidiu Panait1-34/+2
Factor out ppc-specific bdinfo setup from generic init sequence to arch_setup_bdinfo in arch/powerpc/lib/bdinfo.c. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2020-08-06board_f: m68k: Factor out m68k-specific bdinfo setupOvidiu Panait1-15/+4
Factor out m68k-specific bdinfo setup to arch_setup_bdinfo in arch/m68k/lib/bdinfo.c. Also, use if(IS_ENABLED()) instead of #ifdef where possible. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2020-08-06board_f: Move sram bdinfo assignments to generic codeOvidiu Panait1-5/+5
Move sram related bdinfo from arch-specific setup_board_part1 to generic code in setup_bdinfo. Also use "if (IS_ENABLED(CONFIG_SYS_HAS_SRAM))" instead of "#ifdef CONFIG_SYS_SRAM_BASE". Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2020-08-06board_f: Factor out bdinfo bi_mem{start, size} to setup_bdinfoOvidiu Panait1-6/+5
Move all assignments to gd->bd->bi_mem{start,size} to generic code in setup_bdinfo. Xtensa architecture is special in this regard as it defines its own handling of gd->bd->bi_mem{start,size} fields. In order to avoid defining a weak SDRAM function, let arch_setup_bdinfo overwrite the generic flags. For ARC architecture, remove ARCH_EARLY_INIT_R from Kconfig since it is not needed anymore. Also, use gd->ram_base to populate bi_memstart to avoid an ifdef. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Acked-by: Alexey Brodkin <abrokdin@synopsys.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-08-06board_f: Introduce arch_setup_bdinfo initcallOvidiu Panait1-1/+6
Certain architectures (ppc, mips, sh, m68k) use setup board_part1 and setup_board_part2 calls during pre-relocation init to populate gd->bd boardinfo fields. This makes the generic init sequence cluttered with arch-specific ifdefs. In order to clean these arch-specific sequences from generic init, introduce arch_setup_bdinfo weak initcall so that everyone can define their own bdinfo setup routines. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2020-08-06board_f: Introduce setup_bdinfo initcallOvidiu Panait1-0/+6
Introduce setup_bdinfo initcall as a generic routine to populate bdinfo fields. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2020-07-17treewide: convert bd_t to struct bd_info by coccinelleMasahiro Yamada1-6/+7
The Linux coding style guide (Documentation/process/coding-style.rst) clearly says: It's a **mistake** to use typedef for structures and pointers. Besides, using typedef for structures is annoying when you try to make headers self-contained. Let's say you have the following function declaration in a header: void foo(bd_t *bd); This is not self-contained since bd_t is not defined. To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h> #include <asm/u-boot.h> void foo(bd_t *bd); Then, the include direcective pulls in more bloat needlessly. If you use 'struct bd_info' instead, it is enough to put a forward declaration as follows: struct bd_info; void foo(struct bd_info *bd); Right, typedef'ing bd_t is a mistake. I used coccinelle to generate this commit. The semantic patch that makes this change is as follows: <smpl> @@ typedef bd_t; @@ -bd_t +struct bd_info </smpl> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-07-07common/board_f: Respect original FDT size while relocatingOleksandr Andrushchenko1-1/+1
While relocating FDT we reserve some memory for the new FDT and set the size of the FDT with that respect. But FDT may be placed at the end of the RAM leading to memory access beyond it. Fix this by copying exact FDT size bytes, not the reserved size. Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-06-25common: fdt: Remove additional 4k space for fdt allocationAshok Reddy Soma1-1/+1
There is no technical reason to add additional 4k space for FDT. This space is completely unused and just increase memory requirements. This is problematic on systems with limited memory resources as Xilinx Zynq CSE/ZynqMP mini and Versal mini configurations. The patch is removing additional 4k space. EFI code is using copy_fdt() which copy FDT to different location. And all boot commands in case of using U-Boot's FDT pointed by $fdtcontroladdr are copying FDT to different locations by image_setup_libfdt(). That's why in proper flow none should modified DTB used by U-Boot that's why there is no need for additional space. Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Stephen Warren <swarren@nvidia.com>
2020-05-19common: Drop log.h from common headerSimon Glass1-0/+1
Move this header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-19common: Drop bootstage.h from common headerSimon Glass1-0/+1
Move this fairly uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-19bootstage: Use BOOTSTAGE instead of BOOTSTATESimon Glass1-2/+2
Some of the enum members are wrong. Fix them. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-19common: Drop net.h from common headerSimon Glass1-0/+1
Move this header out of the common header. Network support is used in quite a few places but it still does not warrant blanket inclusion. Note that this net.h header itself has quite a lot in it. It could be split into the driver-mode support, functions, structures, checksumming, etc. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-15common/board_f: avoid -Wtype-limits warningHeinrich Schuchardt1-1/+1
CONFIG_SYS_SDRAM_BASE maybe zero. Avoid a build warning when compiling with -Wtype-limits. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-05-03common: board_f: Use cpu_get_current_dev in print_cpuinfoYe Li1-5/+5
Current print_cpuinfo gets the first udevice in CPU class to return the cpu info. This has problem if the boot CPU is not fixed. Changing to use new API cpu_get_current_dev to fix the issue. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Ye Li <ye.li@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-24common/board_f: Make reserve_mmu genericOvidiu Panait1-3/+6
Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu routines. Also, define a weak nop stub for it. Signed-off-by: Ovidiu Panait <ovpanait@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-24common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.cOvidiu Panait1-28/+0
Move the ARM-specific reserve_mmu definition from common/board_f.c to arch/arm/lib/cache.c. Signed-off-by: Ovidiu Panait <ovpanait@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-17board_f.c: Ensure 16 alignment of start_addr_sp and reserved memoryPatrick Delaunay1-14/+18
Add a function reserve_stack_aligned() to reserved memory with 16 bits alignment after the stack pointer (gd->start_addr_sp) and use this new function in board_f.c to reserve all the memory area (malloc, board, gd, fdt, bootstage, stacks). This 16 byte alignment is needed for cast on struct pointer for the reserved memory, for example: + x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes + ARMv8 Instruction Set Overview: quad word, 16 bytes An other alignment value could be needed for other architecture. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Acked-by: Stephen Warren <swarren@nvidia.com>
2020-04-17board_f.c: Ensure gd->new_bootstage alignmentPatrice Chotard1-0/+5
In reserve_bootstage(), in case size is odd, gd->new_bootstage is not aligned. In bootstage_relocate(), the platform hangs when getting access to data->record[i].name. To avoid this issue, make gd->new_bootstage 16 byte aligned. To ensure that new_bootstage is 16 byte aligned (at least needed for x86_64 and ARMv8) and new_bootstage starts down to get enough space, ALIGN_DOWN macro is used. Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm") Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com> Tested-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-02-13board_f: Make clear_bss genericOvidiu Panait1-3/+5
clear_bss is already used by 3 arches (x86, arc, xtensa), so make it generic and provide a weak nop stub for it. This also removes arch-specific ifdef duplications around clear_bss. Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
2020-01-30common/board_f.c: Remove arch-specific checks for cpucheckOvidiu Panait1-2/+5
This removes the arch-specific checks for "checkcpu" function from the init sequence. Make "checkcpu" generic and provide a weak nop stub instead. Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
2020-01-18common: Move hang() to the same header as panic()Simon Glass1-0/+1
At present panic() is in the vsprintf.h header file. That does not seem like an obvious choice for hang(), even though it relates to panic(). So let's put hang() in its own header. Signed-off-by: Simon Glass <sjg@chromium.org> [trini: Migrate a few more files] Signed-off-by: Tom Rini <trini@konsulko.com>
2020-01-17common: Move clock functions into a new fileSimon Glass1-0/+1
These three clock functions don't use driver model and should be migrated. In the meantime, create a new file to hold them. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-12-03common: Move board_get_usable_ram_top() out of common.hSimon Glass1-0/+1
Move this function into init.h which seems to be designed for this sort of thing. Also update the header to declare struct global_data so that it can be included without global_data.h being needed. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-03common: Move checkcpu() out of common.hSimon Glass1-0/+1
This function belongs in cpu_func.h so move it over. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-12-03common: Move serial functions out of common.hSimon Glass1-0/+1
These functions belong in serial.h so move them over. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-10-27bootstage: Correct relocation algorithmSimon Glass1-0/+1
At present bootstage relocation assumes that it is possible to point back to memory available before relocation, so it does not relocate the strings. However this is not the case on some platforms, such as x86 which uses the cache as RAM and loses access to this when the cache is enabled. Move the relocation step to before U-Boot relocates, expand the allocated region to include space for the strings and relocate the strings at the same time as the bootstage records. This ensures that bootstage data can remain accessible from TPL through SPL to U-Boot before/after relocation. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-27bloblist: Reserve an aligned baseSimon Glass1-0/+1
Make sure that the bloblist starts on an aligned boundary. This protects against one of the early allocating causing the alignment to be lost. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-30board_f: fix noncached reservation calculationStephen Warren1-3/+12
The current code in reserve_noncached() has two issues: 1) The first update of gd->start_addr_sp always rounds down to a section start. However, the equivalent calculation in cache.c:noncached_init() always first rounds up to a section start, then subtracts a section size. These two calculations differ if the initial value is already rounded to section alignment. 2) The second update of gd->start_addr_sp subtracts exactly CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in cache.c:noncached_init() rounds the noncached size up to section alignment before subtracting it. The two calculations differ if the noncached region size is not a multiple of the MMU section size. In practice, one/both of those issues causes a practical problem on Jetson TX1; U-Boot triggers a synchronous abort during initialization, likely due to overlapping use of some memory region. This change fixes both these issues by duplicating the exact calculations from noncached_init() into reserve_noncached(). However, this fix assumes that gd->start_addr_sp on entry to reserve_noncached() exactly matches mem_malloc_start on entry to noncached_init(). I haven't traced the code to see whether it absolutely guarantees this in all (or indeed any!) cases. Consequently, I added some comments in the hope that this condition will continue to be true. Fixes: 5f7adb5b1c02 ("board_f: reserve noncached space below malloc area") Cc: Vikas Manocha <vikas.manocha@st.com> Signed-off-by: Stephen Warren <swarren@nvidia.com>
2019-08-26board_f: reserve noncached space below malloc areaVikas Manocha1-0/+17
Noncached area at present is being initialized to random space after malloc area. It works in most the cases as it goes to stack area & stack is not overwriting it being far from it. Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
2019-08-12env: Rename environment.h to env_internal.hSimon Glass1-1/+1
This file contains lots of internal details about the environment. Most code can include env.h instead, calling the functions there as needed. Rename this file and add a comment at the top to indicate its internal nature. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> [trini: Fixup apalis-tk1.c] Signed-off-by: Tom Rini <trini@konsulko.com>
2019-08-11env: Move env_init() to env.hSimon Glass1-0/+1
Move env_init() over to the new header file. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2019-08-11common: Remove video_setmem()Simon Glass1-7/+0
This function is no-longer defined in U-Boot. Drop the declaration from common.h Signed-off-by: Simon Glass <sjg@chromium.org>
2019-08-11common: Move lcd_setmem() to lcd.hSimon Glass1-0/+1
This function relates to lcd.h and is about to become obsolete with the driver-model conversion. Move it out of common.h Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-11trace: trace buffer may exceed 2GiBHeinrich Schuchardt1-2/+2
Correct the debug output for the trace buffer size to accommodate trace buffers exceeding 2GiB. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-07-11trace: undefined reference to `trace_early_init'Heinrich Schuchardt1-1/+1
Compiling with TRACE but without TRACE_EARLY results in an error aarch64-linux-gnu-ld.bfd: common/built-in.o:(.rodata.init_sequence_f+0x10): undefined reference to `trace_early_init' trace_early_init() should not be called if CONFIG_TRACE_EARLY is not defined. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-05-18CONFIG_SPL_SYS_[DI]CACHE_OFF: addTrevor Woerner1-1/+1
While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances where these configuration items are conditional on SPL. This commit adds SPL variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates the configurations as required. Acked-by: Alexey Brodkin <abrodkin@synopsys.com> Signed-off-by: Trevor Woerner <trevor@toganlabs.com> [trini: Make the default depend on the setting for full U-Boot, update more zynq hardware] Signed-off-by: Tom Rini <trini@konsulko.com>
2019-04-24sandbox: Improve debugging in initcall_run_list()Simon Glass1-1/+1
At present if one of the initcalls fails on sandbox the address printing is not help, e.g.: initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96) This is because U-Boot gets relocated high into memory and the relocation offset (gd->reloc_off) does not work correctly for sandbox. Add support for finding the base address of the text region (at least on Linux) and use that to set the relocation offset. This makes the output better: initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96) Then you use can use grep to see which init call failed, e.g.: $ grep 0000000000048134 u-boot.map stdio_add_devices Of course another option is to run it with a debugger such as gdb: $ gdb u-boot ... (gdb) br initcall.h:41 Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations) Note that two locations are reported, since this function is used in both board_init_f() and board_init_r(). (gdb) r Starting program: /tmp/b/sandbox/u-boot [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600) DRAM: 128 MiB MMC: Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>) at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41 41 printf("initcall sequence %p failed at call %p (err=%d)\n", (gdb) print *init_fnc_ptr $1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices> (gdb) Signed-off-by: Simon Glass <sjg@chromium.org>
2018-12-05Merge branch 'master' of git://git.denx.de/u-boot-spiTom Rini1-14/+0
- Various MTD fixes from Boris - Zap various unused / legacy paths. - pxa3xx NAND update from Miquel Signed-off-by: Tom Rini <trini@konsulko.com>
2018-11-27spi: Zap CONFIG_HARD_SPIJagan Teki1-12/+0
In legacy CONFIG_HARD_SPI initalizing spi_init code, which was removed during dm conversion cleanup. So remove the dead instances of CONFIG_HARD_SPI, and related code. Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
2018-11-27spi: Remove used spi_initJagan Teki1-2/+0
spi_init used in some areas in tree, but the respective drivers will remove in future patches. So remove the same instances. Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
2018-11-26spl: Add support for passing handoff info to U-Boot properSimon Glass1-0/+15
There is some basic informaton that SPL normally wants to pass through to U-Boot, such as the SDRAM size and bank information. Mkae use of the new bloblist structure for this. Add a new 'handoff' blob which is set up in SPL and passed to U-Boot proper. Also adda test for sandbox_spl that checks that this works correctly and a new 'sb' command to show the information passed from SPL. Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-26bloblist: Locate bloblist in U-BootSimon Glass1-0/+34
Add support for locating a bloblist in U-Boot that has been set up by SPL. It is copied into RAM during relocation. Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-16arm: at91: wdt: Convert watchdog driver to dm/dtPrasanthi Chellakumar1-1/+1
Convert the Watchdog driver for AT91SAM9x processors to support the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG" to new "CONFIG_WDT_AT91" Kconfig option. Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>
2018-11-14dm: cpu: Fix print_cpuinfo() outputBin Meng1-1/+1
It was observed that current output of print_cpuinfo() on QEMU x86 targets does not have an ending '\n', neither have a leading 'CPU:' any more. However it used to have these before. It turns out commit c0434407b595 introduced a unified DM version of print_cpuinfo() that exposed such issue on QEMU x86. Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active") Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-11-14board_f: Use static print_cpuinfo if CONFIG_CPU is activeMario Six1-0/+28
When the DM CPU drivers are active, printing information about a CPU should be delegated to a matching driver. Hence, add a static print_cpuinfo that implements this delegation when DM CPU drivers are active. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mario Six <mario.six@gdsys.cc> Changed condition to CONFIG_IS_ENABLED(CPU): Signed-off-by: Simon Glass <sjg@chromium.org>
2018-11-07Revert "board_f: Use static print_cpuinfo if CONFIG_CPU is active"Bin Meng1-28/+0
This reverts commit c0434407b595f785fc7401237896c48c791b45fd. It turns out commit c0434407b595 broke some boards which have DM CPU driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail to boot when print_cpuinfo() is called during boot. Fixes are already sent to ML and in u-boot-dm/next, however since we are getting close to the v2018.11 release, it's safer we revert the original commit. This commit should be reverted after v2018.11 release. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-18board_f: Use static print_cpuinfo if CONFIG_CPU is activeMario Six1-0/+28
When the DM CPU drivers are active, printing information about a CPU should be delegated to a matching driver. Hence, add a static print_cpuinfo that implements this delegation when DM CPU drivers are active. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mario Six <mario.six@gdsys.cc> Changed condition to CONFIG_IS_ENABLED(CPU): Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-18common: board_f: Sort includesMario Six1-1/+1
Includes should be sorted. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mario Six <mario.six@gdsys.cc>