Commit Graph

474 Commits

Author SHA1 Message Date
Joseph Chen 034db99592 dm: serial: support always use uart debug mode
In this mode, uart debug is initialized depends on
configuration from pre-loader or CONFIG_UART_DEBUG_.

The serial is not care about dts "stdout-path" and
not register into console framework any more. It's
nice to use pre-loader serial and make serial easy
to configure.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: If4c68229d76b6f1710a35e3ef9a2a91cb306fa9c
2020-11-02 18:34:22 +08:00
Joseph Chen 912fa0754a common: board_f.c: add fpga init call
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I5fb507094207b14ad64cf3dee646aaac177bf43d
2020-11-02 16:39:14 +08:00
Joseph Chen 7fc773a76d common: add autoboot_command_fail_handle() callback
Maybe user need to do some job when bootcmd failed, they
could override it.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I1c32c1ad37700e66d45fe033fbfa46d3f350205d
2020-03-28 18:21:16 +08:00
Joseph Chen 9b4285f197 common.h: include stacktrace.h
dump_stack() is a common function for all modules, place head
file in common.h is convenient for them.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ic36c826617116f204e6e416f09b00a8a2061a93f
2019-12-11 11:17:36 +08:00
Adam Ford 1490eb89f4 UPSTREAM: Convert CONFIG_SPI to Kconfig
This converts the following to Kconfig:
   CONFIG_SPI

This partly involves updating code that assumes that CONFIG_SPI implies
things that are specific to the MPC8xx SPI driver.  For now, just update
the CONFIG tests.  This also involves reworking the default for
CONFIG_SYS_DEF_EEPROM_ADDR so that we don't set it when we cannot make a
reasonable default, as it does not cause any compile failures.

Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
(cherry picked from commit f1b1f77060beadbfe9f42a3be00019bd025afbd6)
Change-Id: Ie9f15ada869105eb407f41d4df7eecbaa916b940
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2019-07-23 17:15:32 +08:00
Joseph Chen c1e72b20c9 dm: console/serial: add flushc() support
Flush console data.

Change-Id: If347b6c8d1126452a1f6386040693b30c66eb5fb
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-05-09 16:23:55 +08:00
Joseph Chen bc04a3dd9a rockchip: fixup "kernel_addr_r" when bl32 is disabled
some platform which is not determined to enable bl32,
we had better choose kernel load address dynamically in
order to make full use of memory for kernel.

Change-Id: If5c15a3755dabfff8d3cce8dec38c9215c464ed2
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-12-10 14:51:17 +08:00
Joseph Chen 064eb49314 serial: ns16550: support using pre-loader serial
- pass pre-loader serial configure by rk atags;
- it depends on serial aliases to find uart port;
- enabled by CONFIG_ROCKCHIP_USING_PRELOADER_SERIAL;

Change-Id: I6723cccc5e1f3dac77203b4cc19cdac631f5133b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-10-19 17:40:56 +08:00
Joseph Chen f81a9e78e7 env: fix env_exist/append/update() words match issue
solve some words match mistakes due to strstr().

Change-Id: I79ca9bc9ed1e9aeb5472e158650890023afa3da3
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-08-08 11:53:05 +08:00
Andy Yan 008aee876a boot_android: add runtime compatible for un/compressed kernel image
This patch add auto parse the compress format of kernel image.
Then decompress the compressed kernel image for arm64, as for
arm32 zImage, we only need to load it to a higher memory, then
the kernel will handle the decompress itself.

Test on RK3308 AARCH64 mode (Cortex A35 816 MHZ) boot with eMMC:

------------------------------------------------------------------
Format    |  Size(Byte) | Ratio | Decomp time(ms) | Boot time(ms) |
-------------------------------------------------------------------
Image     | 7720968     |       |                 |     488       |
-------------------------------------------------------------------
Image.lz4 | 4119448     | 53%   |       59        |     455       |
-------------------------------------------------------------------
Image.lzo | 3858322     | 49%   |       141       |     536       |
-------------------------------------------------------------------
Image.gz  | 3529108     | 45%   |       222       |     609       |
-------------------------------------------------------------------
Image.bz2 | 3295914     | 42%   |       2940      |               |
-------------------------------------------------------------------
Image.lzma| 2683750     | 34%   |                 |               |
-------------------------------------------------------------------

Note: the boot time is counted from first ddr init log to first Kernel log.

Change-Id: I73b12ec944fbc8238b0e061a37e2f31aa3093231
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2018-07-14 11:39:04 +08:00
Joseph Chen 00129fb35e env: add env_update_filter()
provide ignore option to filter unused key words from a
list of new string which is ready to be appended.

Change-Id: I82d61ee21ec658e73549de42ad94ed259582cb7a
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-09 14:18:03 +08:00
Joseph Chen 3c9ee70130 env: add env_delete()
Change-Id: I3a94942b1670e641c8558c64dabca0155e53e2ea
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-01-31 18:13:53 +08:00
Joseph Chen 046a931055 env: add env_exist()
Change-Id: I153c700ff45a678832b72031787531efadcdb47b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-01-29 17:29:55 +08:00
Goldschmidt Simon 6222c40124 spl: make CONFIG_OF_EMBED pass dts through fdtgrep
Building spl with CONFIG_OF_EMBED enabled results in an error message
on my board: "SPL image too big". This is because the fdtgrep build
step is only executed for CONFIG_OF_SEPARATE.

Fix this by moving the fdtgrep build step ('cmd_fdtgreo') from
scripts/Makefile.spl to dts/Makefile so that the reduced dtb is
available for all kinds of spl builds.

The resulting variable name for the embedded device tree blob changes,
too, which is why common.h and fdtdec.c have tiny changes.

Change-Id: I2bf2d9780a544ac602752527d17f14aa6b12c5a2
Signed-off-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-01-26 16:40:36 +08:00
Simon Glass 44aaaed168 UPSTREAM: Move debug and logging support to a separate header
Before adding new features, move these definitions to a separate header
to avoid further cluttering common.h.

Change-Id: Ib4be207f2536b4e9f12f32033c6034cb9fe4ccd7
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 0e98b0a65092d6573eb17d07e04455f9cf545b21)
2018-01-17 15:27:28 +08:00
Diego Dorta e33953082a UPSTREAM: common: Add a prototype for s_init()
When compiling with W=1 the following warning is observed:

arch/arm/mach-imx/mx6/soc.c:590:6: warning: no previous prototype for ‘s_init’ [-Wmissing-prototypes] void s_init(void)

Remove this warning by adding the function prototype into include/common.h file.

Change-Id: Id85724ae2fee5e38816467b8a8e25ca9f238eda7
Signed-off-by: Diego Dorta <diego.dorta@nxp.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 026d7958ba6dc5ed4cd2c5ff507f55f3897cf41a)
2018-01-17 15:27:28 +08:00
Jean-Jacques Hiblot 194712615e UPSTREAM: gzip: add a function to parse the header
Change-Id: I9829ad25a955eb4764ae2e66f1c32751703d9ae6
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 376ddf9d4a21d0af4c70e97c52e5f0854fb2d696)
2018-01-17 15:27:28 +08:00
Masahiro Yamada 046a6e2a9a bug.h: move runtime BUG/WARN macros into <linux/bug.h>
Collect runtime BUG/WARN into a self-contained header <linux/bug.h>
to make these macros easier to use.

Change-Id: If924684bdab99d2c8fe0b4b3755d0ee5291d11be
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 0a70fb4c1c180d6ad6cd4c1dcd3fae8c5d4dd62e)
2018-01-17 15:27:28 +08:00
Masahiro Yamada 5b496fa1af common.h: remove error()
This macro prevents us from using compiletime_error/assert defined
in <linux/compiler.h>.

Now we can remove it, then we will be able to import more BUILD_BUG
macros from Linux.

Change-Id: Ib744c3a718ac71a7d49d14d84cd075695c2c43d8
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 5a719f921871d852a83870b12158e00e8715647e)
2018-01-17 15:27:28 +08:00
Masahiro Yamada a9a4552a1c UPSTREAM: printk: collect printk stuff into <linux/printk.h> with loglevel support
When we import code from Linux, with regular re-sync planned, we want
to use printk() and pr_*().  U-Boot does not support them in a clean
way.  So, people end up with local macros, or compat headers here and
there, then we occasionally see build errors of definition conflicts.

We have include/linux/compat.h, but putting all sorts of unrelated
things into a single header is just a temporal workaround.  Hence this
patch, to find the best home for all printk variants.  If you want to
use printk() and friends, please include <linux/printk.h>.  This header
is self-contained, and pulls in only a few headers.

When I was testing this clean-up, I noticed the image size exceeded
its platform limit on some boards.  This is because all pr_*() that
were previously defined as no-op in include/linux/mtd/mtd.h (unless
CONFIG_MTD_DEBUG is set), are now enabled.

To make such boards happy, this commit also implements CONFIG_LOGLEVEL.
The concept is similar to the kernel parameter "loglevel".  (Actually,
the Kconfig help message was taken from kernel-paremeter.txt of Linux)
Messages with a loglevel smaller than console loglevel will be printed.

The difference is the loglevel is build-time determined.  To save the
image size, lower priority pr_*() are compiled out.  I set the default
of CONFIG_LOGLEVEL to 6, i.e. pr_notice and higher priority messages
are compiled in.

I adjusted CONFIG_LOGLEVEL to avoid build error for some boards.

Change-Id: I997d8bbeedd48777be87472df8ed126181fc4b8e
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Add in SPL_LOGLEVEL that is the same as LOGLEVEL]
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit b44b30260ffa3dc82f4bb98b022483bb09e95353)
2018-01-17 15:27:28 +08:00
Masahiro Yamada 50f8c1b1d6 UPSTREAM: stdio.h: move printf() stuff from <common.h> to <stdio.h>
<common.h> pulls in a lot of headers.  Including it from every .c
file is a bad idea.  We need to remove contents until it contains
nothing.

Move printf() and friends to <stdio.h>.

Change-Id: I7f64296fe6e08bf695e9e274ab0f21e72e36ec48
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 7fea7b1a37ad2b1c1e92bd87f7c6a1877d70e579)
2018-01-17 15:27:28 +08:00
Kever Yang 03204b06ff common: support static_assert()
The static_assert() is support in C11, which may used in source code,
use _Static_assert for it.

Change-Id: Id029c4db3a899c9531c481e55541090e0b92e2b6
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2017-11-14 10:55:48 +08:00
Joseph Chen 533c9f30f7 env: set env_update() parameter 'varvalue' as 'const char *'
Change-Id: I1591fd507363545af5f56a83e0932c317ae7b915
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-10-23 17:20:42 +08:00
Joseph Chen 42865eb5ad drivers: irq: deliver both irq and private data to irq handler
gic irq handler only need private data, while gpio irq(parent bank)
handler needs private data and irq number for getting gpio bank and
pin information. So we need deliver both of them to the irq handler.

This patch fixes the legacy code issue.

Change-Id: I1917b588a867e807cbd15e2e4101ae259cf4a40f
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-10-12 09:41:08 +08:00
Joseph Chen 64c74e0b2d env: add env_update()
This add/append/replace the sub value of an environment variable.

Change-Id: I0fcda0a1c631013eb9458a04a09546ba1c643db3
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-10-12 09:41:08 +08:00
Simon Glass 723806cc5b env: Rename some other getenv()-related functions
We are now using an env_ prefix for environment functions. Rename these
other functions as well, for consistency:

   getenv_vlan()
   getenv_bootm_size()
   getenv_bootm_low()
   getenv_bootm_mapsize()
   env_get_default()

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-16 08:31:11 -04:00
Simon Glass bfebc8c965 env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()
We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-16 08:30:32 -04:00
Simon Glass 00caae6d47 env: Rename getenv/_f() to env_get()
We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-16 08:30:24 -04:00
Simon Glass 018f530323 env: Rename common functions related to setenv()
We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-16 08:23:32 -04:00
Simon Glass 382bee57f1 env: Rename setenv() to env_set()
We are now using an env_ prefix for environment functions. Rename setenv()
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-16 08:22:18 -04:00
Simon Glass 01510091de env: Drop saveenv() in favour of env_save()
Use the env_save() function directly now that there is only one
implementation of saveenv().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Denk <wd@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
2017-08-15 20:50:30 -04:00
Siva Durga Prasad Paladugu 60873f736e common: board_f: Make reserve_mmu a weak function
Make reserve_mmu a weak so that it provides an option
to customize this routine as per platform need

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-08-02 09:11:52 +02:00
Cooper Jr., Franklin af9e6ad4ab board_f: Add new function to allow runtime DTB selection
Runtime U-boot dtb selection is generally a two step process. First step
is to simply use an initial generic dtb. The second step is to select
the dtb and perhaps execute additional code ones U-boot knows what board
it is running on. Embedded_dtb_select handles the second step by allowing
board specific code to run and perform what ever necessary configuration
that is needed.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2017-07-10 14:25:54 -04:00
Masahiro Yamada 49ddcf3e0e serial: make serial_stub_* to static functions
Add missing static to serial_stub_puts().

Unexport serial_stub_{getc,tstc} because they are used locally.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-07-06 13:09:35 -04:00
Simon Glass d757975737 common: microblaze: Drop arch-specific declarations
These are not needed and should not be in common.h. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05 14:13:00 -04:00
Simon Glass 457e51cffd common: arm: freescale: layerscape: Move header files out of common.h
We should not have an arch-specific header file in common.h. Adjust the
board files a little so it is not needed, and drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05 14:12:59 -04:00
Simon Glass 89f5eaa1ee common: arm: davinci: Move header file out of common
We should not have an arch-specific header file in common.h. Instead, use
the asm/hardware.h header to provide the required declarations, and drop
the common.h changes.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2017-06-05 12:31:23 -04:00
Simon Glass 1c16d2e248 common: ep93xx: Move arch-specific declarations out of common
These declarations should not be in common. Remove those that are not
needed and move the others to an arch-specific location.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05 12:31:22 -04:00
Simon Glass 68994b98fc common: freescale: Move arch-specific imx code to arch-imx
These declarations should not be in common.h. Move them to an
arch-specific header.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05 12:31:22 -04:00
Simon Glass 6e2941d787 common: freescale: Move arch-specific declarations
The declarations should not be in common.h. Move them to the arch-specific
headers.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Fixup thinko defined(FSL_LSCH3) -> defined(CONFIG_FSL_LSCH3)]
Signed-off-by: Tom Rini <trini@konsulko.com>
2017-06-05 12:30:55 -04:00
Simon Glass 850431590c common: powerpc: Move arch-specific headers
Set up a new asm/ppc.h header file to hold this arch-specific stuff. It
should not be in common.h. It probably should be refactored to use
asm/arch instead, but that is a job for the maintainer.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05 11:02:40 -04:00
Simon Glass 8fb69c1654 common: Move PPC4xx_SYS_INFO() et al to arch-specific header
These definitions should not be in common.h. Move them to an arch-specific
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05 11:02:40 -04:00
Simon Glass a2038d7b1e common: Drop determine_sysper() and determine_pci_clock_per()
These arch-specific declarations should not be in common.h. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05 11:02:39 -04:00
Simon Glass e8c8f48dd2 common: Drop cpu_init_f() declarations
These arch-specific functions are not needed here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05 11:02:39 -04:00
Simon Glass b885d02e2c arm: Remove include files from common.h
With a small tweak we can avoid including these files for all boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2017-06-05 11:02:38 -04:00
Simon Glass 3a53e99c7d nds32: Remove include files from common.h
With a few tweaks we can avoid including these files, which are only
needed by two C files.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05 11:02:36 -04:00
Simon Glass 3ff240c92f x86: Don't include asm/u-boot.h in common
With a small fixup to u-boot-x86.h, this is not actually needed anywhere,
so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05 11:02:35 -04:00
Simon Glass 587b6226aa sandbox: Don't include asm/u-boot.h in common
This is not actually needed anywhere, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05 11:02:35 -04:00
Simon Glass 5c73f01218 mips: Don't include asm/u-boot.h in common
This is not actually needed anywhere, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
2017-06-05 11:02:34 -04:00
Simon Glass b5e7bd44e7 arc: Don't include asm/u-boot.h in common
This is not actually needed anywhere, so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-05 11:02:34 -04:00