Commit Graph

52988 Commits

Author SHA1 Message Date
Tom Rini
1c3b2f4ae1 efi_loader: Fix warning in efi_load_image()
As observed with clang:
lib/efi_loader/efi_boottime.c:1624:7: warning: variable 'info'
      is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
                if (ret != EFI_SUCCESS)
                    ^~~~~~~~~~~~~~~~~~
lib/efi_loader/efi_boottime.c:1653:7: note: uninitialized use
      occurs here
        free(info);
             ^~~~
lib/efi_loader/efi_boottime.c:1624:3: note: remove the 'if' if
      its condition is always false
                if (ret != EFI_SUCCESS)
                ^~~~~~~~~~~~~~~~~~~~~~~
lib/efi_loader/efi_boottime.c:1602:31: note: initialize the
      variable 'info' to silence this warning
        struct efi_loaded_image *info;
                                     ^
                                      = NULL

Rather than change how we unwind the function it makes the most sense to
initialize info to NULL so that we can continue to pass it to free().

Fixes: c982874e93 ("efi_loader: refactor efi_setup_loaded_image()")
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-10-16 16:41:18 +02:00
Heinrich Schuchardt
b417d475b2 arm: do not include efi_loader.h twice
We should not include the same include twice.

Fixes: 99b8db7291 ("arm: print information about loaded UEFI images")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-10-16 16:41:01 +02:00
Heinrich Schuchardt
891dacf673 efi_loader: remove lcd.h from efi_net.c
Remove superfluous include.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-10-16 16:40:45 +02:00
Heinrich Schuchardt
dadc2bddb0 efi_loader: memory leak in efi_set_variable()
Do not leak native_name if out of memory.

This addresses CoverityScan CID 184095.

Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-10-16 16:40:11 +02:00
Heinrich Schuchardt
2c61e0cc5c efi_loader: superfluous statement in is_dir()
When is_dir() is called we have already execute set_blk_dev(fh).
So don't call it again.

This fixes CoverityScan CID 184093.

Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-10-16 16:39:57 +02:00
Heinrich Schuchardt
6f566c231d efi_loader: return type efi_console_register()
Use a return type that can encompass the return value.

This fixes CoverityScan CID 184090.

Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-10-16 16:39:38 +02:00
Heinrich Schuchardt
60d7987656 efi_loader: error handling in read_console()
getc() might return an error code. Avoid an incorrect converison to
Unicode.

This addresses CoverityScan CID 184087.

Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-10-16 16:39:19 +02:00
Heinrich Schuchardt
eee6530ed1 efi_loader: efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, ...)
The first parameter of efi_allocate_pool is a memory type. It cannot be
EFI_ALLOCATE_ANY_PAGES. Use EFI_BOOT_SERVICES_DATA instead.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-10-16 16:16:49 +02:00
Heinrich Schuchardt
1e1e1c27c5 efi_loader: execute efi_save_gd() first
If DEBUG is defined we may be calling EFI_CALL already during the
initialization of the EFI subsystem. We must make sure efi_save_gd() has
already been called at that moment.

Anyway it is better to have this call in one location instead of three.

This fixes an illegal memory access occurring since 4e6b5d6503
("efi_loader: create root node") with DEBUG = 1.

Fixes: 4e6b5d6503 ("efi_loader: create root node")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-10-16 15:53:15 +02:00
Heinrich Schuchardt
0801d4d2fb efi_loader: correct signature of GetPosition, SetPosition
The UEFI spec requires that file positions are passed as u64 in
GetPosition() and SetPosition().

Check if the file handle points to a directory in GetPosition().

Provide a unit test for GetPosition() and SetPosition().

Fix Coverity warning CID 184079 (CONSTANT_EXPRESSION_RESULT).

Add comments.

Fixes: b6dd577737 ("efi_loader: use correct types in EFI_FILE_PROTOCOL")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-10-16 15:47:05 +02:00
Heinrich Schuchardt
3ce7829792 efi_loader: fix relocation on x86_64
Currently the relocation of the EFI runtime on x86_64 fails. This renders
the EFI subsystem unusable. The ELF relocation records for x86_64 contain
an addend field.

Always write the function name into error messages related to the EFI
runtime relocation.

Break an excessively long line.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-10-16 15:29:15 +02:00
Tom Rini
2364b70c87 Merge branch 'master' of git://git.denx.de/u-boot-i2c 2018-10-16 07:25:28 -04:00
Tom Rini
892f93de61 Prepare v2018.11-rc2
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-10-15 20:26:22 -04:00
Michal Simek
658954cb47 Revert "fdt: fdtdec_setup_memory_banksize() use livetree"
This reverts commit c35a7d375e.
This commit is breaking SPL on zc706.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Patrice Chotard <patrice.chotard@st.com> [on STM32F746-disco]
2018-10-15 16:22:49 -04:00
Tom Rini
6e7a186dc5 Merge tag 'arc-more-updates-for-2018.11-rc2-2' of git://git.denx.de/u-boot-arc
More fixes and improvements for ARC here:

Fixes (this time included for real):
 * Take care of global uninitialized variables
   They used to be put right after .bss section and were never
   zeroed as they should be. Now merged with normal .bss

Improvements:
 * Print more verbose CPU info for boards built on real silicon
 * Add support for SD-card detection on all ARC boards
 * Quite a few fixes for IoT DK
   - Support reset by command
   - Print of CPU freq on boot
   - Link for eFlash etc
2018-10-15 07:20:07 -04:00
Alexey Brodkin
6e63314f43 ARC: Don't use COMMON section for global not-initialized variables
By default GCC puts global non-initialized variables in COMMON section.
And we used to ignore existence of COMMON section in our linker
scripts though smart LD silently appended it right after .bss.

And the problem here is variables from COMMON section even though
require zeroing in run-time were not zeroed as they were placed
right after __bss_end symbol.

It was a pure luck we never faced serious problem due to this,
but now it is fixed.

Now as for some other architectures we'll just force GCC to put
those global variables in normal .bss section.

This solution is much nicer than adding COMMON section to each and
every linker script.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2018-10-15 13:35:17 +03:00
Tom Rini
19ca29f3ff Merge git://git.denx.de/u-boot-sunxi
[trini: Convert da850evm_nand defconfig now to to SPL_DM]
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-10-12 15:21:24 -04:00
Tom Rini
e6cd05e502 Merge branch 'master' of git://git.denx.de/u-boot-spi 2018-10-12 11:54:13 -04:00
Alexey Brodkin
a211091855 iot_dk: Link for eFlash
That's what we'll have in production.
But note it won't work for loading via JTAG as
eFlash is not directly writable, one needs to use
prebootloader to flash uboot.bin from SD-card into eFlash.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2018-10-12 15:14:41 +03:00
Alexey Brodkin
9f87d47088 axs10x/emdk/hsdk/iot_dk: Implement board_mmc_getcd()
So now we may detect MMC/SD-card existence and
instead of completely misleading message on missing card:
------------------------>8-----------------------
Loading Environment from FAT... Card did not respond to voltage select!
------------------------>8-----------------------

we now get very clear one:
------------------------>8-----------------------
Loading Environment from FAT... MMC: no card present
------------------------>8-----------------------

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2018-10-12 15:14:41 +03:00
Alexey Brodkin
8a8f32d8ff iot_dk: Save CPU clock value to gd->cpu_clk
Since gd->cpu_clk is a global item we may once populate it from .dtb
ans use it then in other places like for printing CPU info etc.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2018-10-12 15:14:41 +03:00
Alexey Brodkin
031154fe8f iot_dk: Add support of 136 MHz clock
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2018-10-12 15:14:41 +03:00
Alexey Brodkin
7d388add55 iot_dk: Implement board reset
It is done by writing some magic sequence in a special register.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2018-10-12 15:14:41 +03:00
Alexey Brodkin
5b86ca96d0 iot_dk/hsdk: Implement its own print_cpuinfo()
ARC IDENTITY register only encodes major architecture
type and version while for a particular board/silicon we
may know better which template was used and so we may identify
CPU more precise, which exactly we do here.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2018-10-12 15:14:41 +03:00
Alexey Brodkin
ba9f56f3d4 ARC: make generic print_cpuinfo() weak
This allows board to override print_cpuinfo() because
they might know better which ARChitect template was used.
This way we may not only derive base architecture type and
version but more meaningful things like "ARC EM7D" instead of
simple "ARC EM", "ARC HS36" instead of "ARC HS".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2018-10-12 15:14:40 +03:00
Alexey Brodkin
18e8923f6c iot_dk: Disable networking support
There's no Ethernet controller on the board so no point in having
networking support. This also saves us 5.5 kB of precious memory.

| # bloat-o-meter u-boot.net u-boot.no_net_regex | tail -1
| Total: Before=127892, After=122334, chg -4.35%

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2018-10-12 15:14:40 +03:00
Alexey Brodkin
8d0a4968d7 iot_dk: Add localversion string
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2018-10-12 15:14:40 +03:00
Tom Rini
15f22ac2ee ldpaa_eth.c: Fix warning when PHYLIB is not enabled
We need to #ifdef some variables to avoid warning about them being
unused.

Fixes: 1a048cd656 ("driver: net: fsl-mc: Add support of multiple phys for dpmac")
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-10-12 07:41:24 -04:00
Ashish Kumar
5c391486b4 sf: Add MICRON manufacturer id
NOR flash name MT35X_QLKA and MT25Q_** used on NXP board has
manufacturer id as 0x2C, which are rather for newer flashes
after the split of Micron from ST.

So macro for this micron manufacturer id.

Signed-off-by: Suresh Gupta <suresh.gupta@nxp.com>
Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>
Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
[jagan: updated commit message]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
2018-10-12 11:37:49 +05:30
Heiko Schocher
e3bc4bb861 i2c: fix: Add support for the Arm's Versatile Express I2C controller
accidentially while fixing merge errors for patch:
https://lists.denx.de/pipermail/u-boot/2018-September/342278.html

missed to add files:

MAINTAINERS
drivers/i2c/Kconfig
drivers/i2c/Makefile

add them with this patch.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Liviu Dudau <liviu.dudau@foss.arm.com>
2018-10-12 07:25:39 +02:00
Tom Rini
0223462b37 Merge branch 'master' of git://git.denx.de/u-boot-net 2018-10-11 15:28:32 -04:00
Pankaj Bansal
1a048cd656 driver: net: fsl-mc: Add support of multiple phys for dpmac
Till now we have had cases where we had one phy device per dpmac.
Now, with the upcoming products (LX2160AQDS), we have cases, where there
are sometimes two phy devices for one dpmac. One phy for TX lanes and
one phy for RX lanes. to handle such cases, add the support for multiple
phys in ethernet driver. The ethernet link is up if all the phy devices
connected to one dpmac report link up. also the link capabilities are
limited by the weakest phy device.

i.e. say if there are two phys for one dpmac. one operates at 10G without
autoneg and other operate at 1G with autoneg. Then the ethernet interface
will operate at 1G without autoneg.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2018-10-10 12:45:28 -05:00
Pankaj Bansal
1ed19a1421 driver: net: fsl-mc: initialize dpmac irrespective of phy
The dpmac initalization should not depend on phy.
As the phy is not necessary to be present for dpmac to function.
Therefore, remove dpmac initialization dependency from phy.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2018-10-10 12:45:23 -05:00
Pankaj Bansal
a3cb5340f1 driver: net: fsl-mc: Modify the dpmac link detection method
when there is no phy present for a dpmac, a dummy phy device is created.
when we move to multiple phy method, we need to create as many dummy phy
devices.

Change this method so that we don't need to create dummy phy devices.
We always report linkup if no phy is present.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2018-10-10 12:45:01 -05:00
Pankaj Bansal
f259c43d89 driver: net: fsl-mc: fix error handing in init_phy
if an error occurs during init_phy, we should free the phydev structure
which has been allocated by phy_connect.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2018-10-10 12:43:18 -05:00
Pankaj Bansal
d75e81d9e0 driver: net: fsl-mc: remove unused strcture elements
The phydev structure is present in both ldpaa_eth_priv and
wriop_dpmac_info. the phydev in wriop_dpmac_info is not being used

As the phydev is created based on phy_addr and bus members of
wriop_dpmac_info, it is appropriate to keep phydev in wriop_dpmac_info.

Also phy_regs is not being used, therefore remove it

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2018-10-10 12:36:34 -05:00
Tom Rini
3d5ced9e22 Test improvements to tidy up output and drop duplicate tests
Sandbox SPL/TPL support
 Various dm-related improvements
 -----BEGIN PGP SIGNATURE-----
 
 iQFFBAABCgAvFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAlu9RL4RHHNqZ0BjaHJv
 bWl1bS5vcmcACgkQfxc6PpAIreYd8gf+NYAGhpiEZZ5vc3DB4Xdn2okgakbbg0QQ
 /b0Lr9xQsKgZthK0rvPlH2dXxf+ViAm1iHTy8KBCFi0SHNder48Zui9uTrX0NRq8
 pLZGyJPXPYbiyc4pQTEJpTth4iShcphRVio0no4sLpNQqO4aQrialSLa9fnwd9Ra
 1l9mF91aaYw6cG+/ejg3UR1LfsDdQ5bjubt0Fw0wGX9UvQOAz5gz5+a17wrz6+Gx
 L0gzvyfbuLUhbWB36DXikrL14DAFys2uV9aHJ5zEd53l+F7ZHWsupCO0OtN66cV7
 KpPKoYG7vhLqBXKpyrW20T+BPeSyDKmDQE6wbpECmEDOvKzvW67O/w==
 =Bfjm
 -----END PGP SIGNATURE-----

Merge tag 'dm-9oct18' of git://git.denx.de/u-boot-dm

Test improvements to tidy up output and drop duplicate tests
Sandbox SPL/TPL support
Various dm-related improvements
2018-10-10 13:35:17 -04:00
Tom Rini
98068b3be5 Merge branch 'master' of git://git.denx.de/u-boot-sh 2018-10-10 13:35:14 -04:00
Patrick Delaunay
606f3a74e6 arm: remove duplicated prototypes in u-boot.arm.h
Remove the function prototypes duplicated between u-boot.arm.h
and init.h/common.h

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2018-10-10 13:35:10 -04:00
Patrick Delaunay
6180ea7e66 arm: remove prototype for get_timer_masked
The interruption support had be removed for ARM architecture and
the function get_timer_masked() is no more used except in some
the timer.c files.

This patch clean each timer.c which implement this function and
remove the associated prototype in u-boot-arm.h

For timer.c, I don't verify if the weak version of get_timer
(in lib/time.c) can be used

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2018-10-10 13:35:09 -04:00
Patrick Delaunay
aa33fe8695 arm: remove prototype for udelay_masked
The interruption support had be removed for ARM architecture and
the function udelay_masked() is no more used except in some timer.c
files  and have the same content than udelay() or __udelay().

This patch update each timer.c implementing this function and
remove the associated prototype in u-boot-arm.h.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2018-10-10 13:35:09 -04:00
Patrick Delaunay
aad5b4a351 arm: remove prototype for reset_timer_masked
Remove prototype for function only used in one file

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2018-10-10 13:35:09 -04:00
Patrick Delaunay
1c8e9fae16 arm: remove prototype for arch_interrupt_init
Remove prototype for no more existing function

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2018-10-10 13:35:09 -04:00
Marek Vasut
fd3d1212a2 bootm: Add board specific OS preboot hook
Add board-specific hook which is executed before the code hands over
control to the OS. This lets the board perform some last-minute clean
ups.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
2018-10-10 13:35:09 -04:00
Andrew F. Davis
81089a5430 arm: K3: am654: Add support for getting boot mode
Read the boot mode register to find the boot mode. Only use eMMC boot0
mode when the mode is eMMC boot (called BOOT_DEVICE_MMC1 currently due
to current conflating of boot mode and boot device), and not iff the
boot device is MMC port 0.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
2018-10-10 13:35:08 -04:00
Andrew F. Davis
b5700efbc8 arm: K3: am654: Choose MMC boot device based on boot port
For most devices the boot mode maps directly to the boot
device. For MMC this is not the case as we have two MMC
boot modes and two MMC boot devices (ports). Check the
boot port to determine which MMC device was our boot
device. Make this change for both primary and secondary
boot modes.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
2018-10-10 13:35:08 -04:00
Keerthy
0f3cf2b3e5 gpio: da8xx: Push generic defines of gpio.h out of mach-davinci
Push generic defines of gpio.h out of mach-davinci to drivers/gpio
now that non-davinci architectures are beginning to use this IP.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
[trini: Fix calimain build]
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-10-10 13:35:03 -04:00
Keerthy
401d74cb2c gpio: da8xx: Add k2g compatible
Add k2g compatible so that k3 SoCs can be supported

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2018-10-10 13:32:41 -04:00
Nicholas Faustini
442faf61ab board: ks2: move uinitrd fixup logic inside ft_board_setup_ex
The uinitrd fixup logic should be executed after the FDT /chosen
node has been properly populated by fdt_initrd()

Signed-off-by: Nicholas Faustini <nicholas.faustini@azcomtech.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2018-10-10 13:32:41 -04:00
Nicholas Faustini
2c76d311a4 fdt: add call to ft_board_setup_ex() for ks2 boards
When updating the board FDT, some of the operations
are performed by ft_board_setup_ex() and should be
executed also by the fdt command.

Signed-off-by: Nicholas Faustini <nicholas.faustini@azcomtech.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2018-10-10 13:32:41 -04:00