summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-10-06spl: dm: Make it possible for the SPL to pick its own DTB from a FITJean-Jacques Hiblot
u-boot can be embedded within a FIT image with multiple DTBs. It then selects at run-time which one is best suited for the platform. Use the same principle here for the SPL: put the DTBs in a FIT image, compress it (LZO, GZIP, or no compression) and append it at the end of the SPL. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> [trini: Move default y of SPL_MULTI_DTB_FIT_DYN_ALLOC to it being the default choice if SYS_MALLOC_F, drop spl.h include from lib/fdtdec.c it's unused.] Signed-off-by Tom Rini <trini@konsulko.com>
2017-10-05fdtdec: sort include filesJean-Jacques Hiblot
Sort include files in accordance to U-Boot coding style. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2017-10-05lib: allow building lzo for the SPLJean-Jacques Hiblot
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-10-05gzip: add a function to parse the headerJean-Jacques Hiblot
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-10-05lzo: add a function to check the validity of the headerJean-Jacques Hiblot
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-10-05fit: If no matching config is found in fit_find_config_node(), use the ↵Jean-Jacques Hiblot
default one If board_fit_config_name_match() doesn't match any configuration node, then use the default one (if provided). Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-10-05fit: fixed bug in locate_dtb_in_fit()Jean-Jacques Hiblot
If the dtb is the first data of the FIT, the its offset is 0x0. Change the test to '<' instead of '<=' Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-10-05fit: use 'const' for the input of fdt_offset() and locate_dtb_in_fit()Jean-Jacques Hiblot
Those 2 functions don't modify their input, we can mark it const. This prevents compilation warnings when they are provided const input. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-10-05dts: renamed FIT_EMBED to MULTI_DTB_FIT and moved it to the dts KconfigJean-Jacques Hiblot
CONFIG_FIT_EMBED might be confused with CONFIG_OF_EMBED, rename it MULTI_DTB_FIT as it is able to get a DTB from a FIT image containing multiple DTBs. Also move the option to the Kconfig dedicated to the DTS options and create a README for this feature. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-10-05linux/kernel.h: import DIV_ROUND_{DOWN, UP}_ULL from LinuxMasahiro Yamada
These macros are useful to avoid link error on 32-bit systems. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-10-05disk: part_dos: Use the original allocation scheme for the SPL caseFabio Estevam
Since commit ff98cb90514d ("part: extract MBR signature from partitions") SPL boot on i.MX6 starts to fail: U-Boot SPL 2017.09-00221-g0d6ab32 (Oct 02 2017 - 15:13:19) Trying to boot from MMC1 (keep in loop) Use the original allocation scheme for the SPL case, so that MX6 boards can boot again. This is a temporary solution to avoid the boot regression. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Acked-by: Rob Clark <robdclark@gmail.com> Tested-by: Peter Robinson <pbrobinson@gmail.com>
2017-10-05Merge git://git.denx.de/u-boot-sunxiTom Rini
2017-10-05common: Drop LOGLEVEL to 4Tom Rini
While this came in with a default value of 6 I am lowering this to 4. The MTD/UBI code has a large number of error messages that we include now. In addition, "normally" warning messages are not included so this feels like a more natural level to have. Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-04dm: replace dm_dbg() with pr_debug()Masahiro Yamada
As we discussed before in ML, dm_dbg() causes undefined reference error if #define DEBUG is added to users, but not drivers/core/util.c We do not need this macro because we can use pr_debug() instead, and it is pretty easy to enable it for the DM core by using ccflags-y. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-10-04linux/bitfield.h: import <linux/bitfield.h> from Linux 4.13Masahiro Yamada
Copied from Linux 4.13. Commit log of 3e9b3112ec74 of Linux explains well why this header is useful. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-10-04dm: define dev_*() log functions in DM headerMasahiro Yamada
Many drivers had started to use dev_err, dev_info, etc. for log functions. Currently, we are relying on <linux/compat.h>, but I guess the best home is <dm/device.h>, taking into account that Linux defines them in <linux/device.h>. For now, I am leaving the ones in <linux/compat.h> because lots of Linux-originated code uses dev_*(), but the first argument is not struct udevice, so we need to ignore the bogus argument. More efforts are needed to iron out the issues. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-10-04bug.h: move runtime BUG/WARN macros into <linux/bug.h>Masahiro Yamada
Collect runtime BUG/WARN into a self-contained header <linux/bug.h> to make these macros easier to use. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-10-04bug.h: sync BUILD_BUG stuff with Linux 4.13Masahiro Yamada
As commit 84b8bf6d5d2a ("bug.h: move BUILD_BUG_* defines to include/linux/bug.h") noted, include/linux/bug.h was locally modified for U-Boot because the name conflict of error() caused build errors at that time. Now error() is gone, so we can fully sync BUILD_BUG* with Linux. These macros are just compile-time utilities. Nothing depends on platform code, so it should make sense to simply copy Linux's ones. Please note Linux split BUILD_BUG stuff out into <linux/build_bug.h> by commit bc6245e5efd7. Let's follow it. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-10-04vsprintf.h: include <linux/types.h>Masahiro Yamada
This header uses ulong, size_t, loff_t. Include <linux/types.h> to make this header self-contained. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-10-04common.h: remove error()Masahiro Yamada
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. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-10-04treewide: replace with error() with pr_err()Masahiro Yamada
U-Boot widely uses error() as a bit noisier variant of printf(). This macro causes name conflict with the following line in include/linux/compiler-gcc.h: # define __compiletime_error(message) __attribute__((error(message))) This prevents us from using __compiletime_error(), and makes it difficult to fully sync BUILD_BUG macros with Linux. (Notice Linux's BUILD_BUG_ON_MSG is implemented by using compiletime_assert().) Let's convert error() into now treewide-available pr_err(). Done with the help of Coccinelle, excluing tools/ directory. The semantic patch I used is as follows: // <smpl> @@@@ -error +pr_err (...) // </smpl> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org> [trini: Re-run Coccinelle] Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-04printk: collect printk stuff into <linux/printk.h> with loglevel supportMasahiro Yamada
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. 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>
2017-10-04stdio.h: move printf() stuff from <common.h> to <stdio.h>Masahiro Yamada
<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>. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-10-03sunxi: only init USB Ethernet gadget when it's enabledIcenowy Zheng
If the USB Ethernet gadget is not yet enabled, the call of usb_ether_init in board/sunxi/board.c will lead to undefined reference error when building. Fix this problem. Fixes: 50ddbf1199a0 ("sunxi: Register usb_ether") Signed-off-by: Icenowy Zheng <icenowy@aosc.io> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03sunxi: usb_phy: invert the USB phy_ctl conditionMaxime Ripard
All the new SoCs from Allwinner since the A33 have had the phy_ctl offset at 0x410 instead of 0x404 that was used on the previous SoCs. Instead of adding more and more special cases as the number of SoCs grow, let's invert the test to have 0x410 by default, and the (hopefully) fixed number of old SoCs being the exception. Suggested-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Suggested-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Reviewed-by: Jagan Teki <jagan@openedev.com>
2017-10-03sun7i: a20: Add Bananapi M1 Plus supportJagan Teki
Banana Pi M1 Plus is an open-source single-board computer that adds more connectivity to the classic board using Allwinner A20 SOC. Bananapi M1-Plus features: - A20 Dual-core 1.0GHz - 1 GB DDR3 SDRAM - MicroSD - 10/100/1000 Ethernet RJ45 - WiFi b/g/n - 5V DC Micro USB power-supply For dts file, Sync with Linux commit f92ca09("Merge branch 'akpm/master'"). Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
2017-10-03sunxi: defaultly enable SPL for Lichee Pi ZeroIcenowy Zheng
As we have already DRAM initialization code for V3s SoC, we can defaultly enable SPL now on Lichee Pi Zero. Add CONFIG_SPL in Lichee Pi Zero defconfig. Signed-off-by: Icenowy Zheng <icenowy@aosc.io> Reviewed-by: Jagan Teki <jagan@openedev.com>
2017-10-03sunxi: Enable eMMC on Cubietruck PlusChen-Yu Tsai
Set CONFIG_MMC_SUNXI_SLOT_EXTRA=2 to enable the eMMC controller to access eMMC on the board. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03sunxi: rename Bananapi M3 dts file nameChen-Yu Tsai
The upstream (Linux) device tree file for the Bananapi M3 follows the convention of using the well known brand name, instead of the vendor name, for naming. The file was recently added to upstream in commit 359b5a1e1c2d ("ARM: sun8i: a83t: Add device tree for Sinovoip Bananapi BPI-M3") Rename the device tree file in U-boot to match. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03sunxi: Fix USB_GADGET implicationMaxime Ripard
USB_GADGET will fail to compile if USB_MUSB_GADGET is not defined. Make sure we have that condition right. Fixes: e0ea88042d51 ("sunxi: Imply USB_ETHER") Suggested-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03sunxi: Remove the MMC index hackMaxime Ripard
The current code, if there's both an eMMC and an MMC slot available on the board, will swap the MMC indices based on whether we booted from the eMMC or the MMC. This way, the MMC we're supposed to boot on will always have the index 0. However, this causes various issues, for example when using other components that base their behaviour on the MMC index, such as fastboot. Let's remove that hack, and take the opposite approach. The MMC will always have the same index, but the bootcmd will pick the same device than the one we booted from. This is done through the introduction of the mmc_bootdev environment variable that will be filled by the board code based on the boot device informations we can get from the SoC. In order to not introduce regressions, we also need to adjust the fastboot MMC device and the environment device in order to set it to the eMMC, over the MMC, like it used to be the case. Tested-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03sunxi: Use sunxi_get_boot_deviceMaxime Ripard
Our current board code duplicates a bit the sunxi_get_boot_device logic. Now that we can use that function in the full-flavoured U-Boot, remove that duplication and call the function instead. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03arm: sunxi: Move spl_boot_device in a separate functionMaxime Ripard
U-Boot itself might need to identify the boot device, for example to be able to tell where to load the kernel from when several options are possible. Move the logic of spl_boot_device to a function that is compiled both for the SPL and the main binary. Tested-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03sunxi: Add support for A20-OLinuXino-MICRO-eMMCStefan Mavrodiev
From rev.J A20-OLinuXino-MICRO has eMMC option. For now this is only 4GB, but in the future size may increase. The dts file is the same from mainline kernel. Signed-off-by: Stefan Mavrodiev <stefan@olimex.com> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03sunxi: Enable CMD_GPT by defaultMaxime Ripard
GPT is pretty common these days and can be useful for things like fastboot. Add a platform imply, so that users can still opt out if they wish so. Reviewed-by: Jagan Teki <jagan@openedev.com> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03cmd: Move CONFIG_RANDOM_UUID to KconfigMaxime Ripard
CONFIG_RANDOM_UUID is used by the GPT command to generate random UUID when none are provided. Move that option to Kconfig. Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Jagan Teki <jagan@openedev.com> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03sunxi: sina33: Sync the device tree with the kernelMaxime Ripard
The kernel DT of the SinA33 has evolved quite a bit. Make sure we sync it and its upstream DTSI to be able to use the OTG. The DTs were taken from the 4.13 kernel release. Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03sunxi: Imply USB_ETHERMaxime Ripard
Now that we can enable the usb_ether gadget, do it. This will be especially useful for boards that don't have any ethernet controller, such as the ones based on the A13 or A33. Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03sunxi: Register usb_etherMaxime Ripard
Call the function to register the usb_ether gadget in the board. Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03musb: sunxi: switch to the device modelMaxime Ripard
The device model was implemented so far using a hook that needed to be called from the board support, without DT support and only for the host. Switch to probing both in peripheral and host mode through the DT. Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03cmd: fastboot: Rework fastboot dependencyMaxime Ripard
Fastboot need a bunch of options to be operating properly, such as the g_dnl gadget, the fastboot command, and some options that make sense. Since fastboot is now part of Kconfig, make sure we have them right. That will also reduce the boilerplate in the defconfigs. Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03sunxi: imply USB_GADGETMaxime Ripard
A good number of our boards have USB_GADGET enabled. Imply it so that all the boards can benefit from it, and remove some boilerplate from our defconfigs. Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03sunxi: provide default USB gadget setupMaxime Ripard
All the Allwinner boards use the same manufacturer, VID and PID for the gadgets. Make them the defaults to remove some boilerplate from our defconfigs. Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03usb: gadget: usb_ether: Move settings to commonMaxime Ripard
The usb_ether gadget duplicates the USB settings for the manufacturer, product ID and vendor ID. Make sure we use the common option so that we can expect a single VID/PID couple for a single device. Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Lukasz Majewski <lukma@denx.de> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03usb: gadget: Make g_dnl USB settings commonMaxime Ripard
The g_dnl USB settings for the vendor ID, product ID and manufacturer are actually common settings that can and should be shared by all the gadgets. Make them common by renaming them, and convert all the users. Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Lukasz Majewski <lukma@denx.de> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03usb: gadget: usb_ether: Move the interfaces to KconfigMaxime Ripard
We need to select an interface for the usb_ether gadget, and they haven't been converted to Kconfig yet. Add a choice to make sure we have an option selected, and convert all the users. Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03usb: gadget: Convert USB_ETHER to KconfigMaxime Ripard
The USB Ethernet gadget option has not yet been moved to Kconfig, let's deal with that. Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03usb: gadget: Move USBNET_HOST_ADDR to KconfigMaxime Ripard
While the USB Ethernet device address is already defined in Kconfig, the host address isn't. Convert it. Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03usb: gadget: Document USBNET_DEVADDRMaxime Ripard
Add an help about the USBNET_DEVADDR Kconfig option to make it clearer what it's about. Acked-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-03usb: gadget: Move USBNET_DEVADDR option out of g_dnlMaxime Ripard
The USBNET_DEVADDR has nothing to do with the USB download gadget, but rather with the USB Ethernet gadget. Move it out of the if statement. Acked-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>