summaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)Author
2017-08-13boot_fit: Change return value from FDT_ERROR to -EINVAL in fdt_offset()Nobuhiro Iwamatsu
FDT_ERROR is defined as unsigned long. However, since the return value of fdt_offset() is int, a warning will occur when compiling. Also, it is better to use -EINVAL than FDT_ERROR. This fixes this problem by change return value from FDT_ERROR to -EINVAL. Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> CC: Franklin S Cooper Jr <fcooper@ti.com> Reviewed-by: Franklin S Cooper Jr <fcooper@ti.com>
2017-08-05common/env_embedded.c: rename PPCENV/PPCTEXT macrosThomas Petazzoni
The environment has pretty much nothing to do with just "PPC", so rename the macros to just __UBOOT_ENV_SECTION__ which is more readable. In addition, only a single macro is needed: the environment now goes either to the default section (USE_HOSTCC is defined) or in the .text section. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-08-05common/env_embedded.c: drop support for CONFIG_SYS_USE_PPCENVThomas Petazzoni
CONFIG_SYS_USE_PPCENV is no longer used anywhere. It was used to put the environment in the special .ppcenv section, but the last architecture using this section (SuperH) has been changed to not use it. Therefore, this commit drops support for CONFIG_SYS_USE_PPCENV entirely. We only handle two cases: - We're building the host tool tools/envcrc, in which case the environment is place with no special section attribute (so it depends up in .data) - We're building U-Boot itself, in which case the environnement is placed in the .text section. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-08-04Merge tag 'xilinx-for-v2017.09' of git://www.denx.de/git/u-boot-microblazeTom Rini
Xilinx changes for v2017.09 Zynq: - Add Z-Turn board support fpga: - Remove intermediate buffer from code Zynqmp: - dts cleanup - change psu_init handling - Add options to get silicon version - Fix time handling - Map OCM/TCM via MMU - Add new clock driver
2017-08-02common: board_f: Make reserve_mmu a weak functionSiva Durga Prasad Paladugu
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-01Merge git://git.denx.de/u-boot-x86Tom Rini
2017-08-01x86: kconfig: Select ARCH_EARLY_INIT_R in the platform KconfigBin Meng
This is architecture-dependent early initialization hence should be put in the platform Kconfig. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-08-01x86: kconfig: Let board select BOARD_EARLY_INIT_FBin Meng
CONFIG_BOARD_EARLY_INIT_F literally indicates board-specific codes and should be not 'default y' for all x86 boards. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-08-01fdt: Correct fdt_get_base_address()Simon Glass
This function appears to obtain the value of the 'ranges' property rather than 'reg'. As such it does not behave as documented or expected. In addition it picks up the second field of the property which is the size (with prop += naddr) rather than the first which is the address. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-01dm: mmc: Allow disabling driver model in SPLSimon Glass
At present if U-Boot proper uses driver model for MMC, then SPL has to also. While this is desirable, it places a significant barrier to moving to driver model in some cases. For example, with a space-constrained SPL it may be necessary to enable CONFIG_SPL_OF_PLATDATA which involves adjusting some drivers. Add new SPL versions of the options for DM_MMC, DM_MMC_OPS and BLK. By default these follow their non-SPL versions, but this can be changed by boards which need it. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-31dm: console: Check for serial devices properlySimon Glass
With driver model the serial device is often not called "serial". Mark driver-model stdio devices so that they can be detected and we can look up the uclass. This is a more reliable way of finding out whether the console is connected to a serial device or not. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-31console: Unify the check for a serial consoleSimon Glass
Put the check for whether a console is a serial device in a function so that we can share the code in the two places that use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-31env: Migrate CONFIG_ENV_IS_IN_FAT options to KconfigTom Rini
We rename the various FAT_ENV_xxx options to CONFIG_ENV_FAT_xxx so that they can be modified via Kconfig. Migrate all existing users to the new values. Signed-off-by: Tom Rini <trini@konsulko.com>
2017-07-29Merge git://git.denx.de/u-boot-usbTom Rini
2017-07-28usb: hub: Call usb_update_hub_device() after hub descriptor is fetchedBin Meng
After fetching hub descriptor, we need to call USB uclass operation update_hub_device() to notify HCD to do some preparation work. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-07-28usb: hub: Parse and save TT details from device descriptorBin Meng
A high speed hub has a special responsibility to handle full speed/ low speed devices connected on downstream ports. In this case, the hub must isolate the high speed signaling environment from the full speed/low speed signaling environment with the help of Transaction Translator (TT). TT details are provided by hub descriptors and we parse and save it to hub uclass_priv for later use. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-07-28usb: hub: Support 'set hub depth' request for USB 3.0 hubsBin Meng
USB 3.0 hub uses a hub depth value multiplied by four as an offset into the 'route string' to locate the bits it uses to determine the downstream port number. We shall set the hub depth value of a USB 3.0 hub after it is configured. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-07-28usb: hub: Translate USB 3.0 hub port status into old versionBin Meng
USB 3.0 hub port status field has different bit positions from 2.0 hubs. Since U-Boot only understands the old version, translate the new one into the old one. Since we are going to add USB 3.0 hub support, this feature is only available with driver model USB. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-07-28usb: hub: Add a new API to test if a hub device is root hubBin Meng
Sometimes we need know if a given hub device is root hub or not. Add a new API to test this. This removes the xHCI driver's own version is_root_hub() and change to use the new API. While we are here, remove the unused/commented out get_usb_device() in the xHCI driver too. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-07-28usb: hub: Remove hub_port_reset()Bin Meng
At present hub_port_reset() is defined in DM USB, but it is never called hence remove it (removing another ifdefs). While we are here, change legacy_hub_port_reset() name to usb_hub_port_reset() to better match other function names in the same hub module. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-07-28usb: hub: Use 'struct usb_hub_device' as hub device's uclass_privBin Meng
Use USB hub device's dev->uclass_priv to point to 'usb_hub_device' so that with driver model usb_hub_reset() and usb_hub_allocate() are no longer needed. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-07-28usb: hub: Change USB hub descriptor to match USB 3.0 hubsBin Meng
USB 3.0 hubs have a slightly different hub descriptor than USB 2.0 hubs, with a fixed (rather than variable length) size. Change the host controller drivers that access those last two fields (DeviceRemovable and PortPowerCtrlMask) to use the union. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de> Tested-by: Stefan Roese <sr@denx.de>
2017-07-28usb: hub: Revise wLength for 'get port status' requestBin Meng
For accuracy, we should use 'sizeof(struct usb_port_status)' as the wLength for 'get port status' request, although it happens to be equal to 'sizeof(struct usb_hub_status)'. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de> Tested-by: Stefan Roese <sr@denx.de>
2017-07-28usb: hub: Send correct wValue to get hub descriptor of a USB 3.0 hubBin Meng
Testing a USB 3.0 hub by connecting it to the xHCI port on Intel MinnowMax, when issuing 'get hub descriptor' to the hub, xHCI reports a transfer event TRB with a completion code 6 which means 'Stall Error'. In fact super speed USB hub descriptor type is 0x2a, not 0x29. Sending correct SETUP packet to the hub makes it not stall anymore. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de> Tested-by: Stefan Roese <sr@denx.de>
2017-07-28usb: hub: Update handling connect status/change in usb_scan_port()Bin Meng
It was observed that on Intel MinnowMax board, when xHCI is enabled in the BayTrail SoC, with a USB 3.0 device connected to the bottom USB 3.0 port (mapped to xHCI root port #7), its PORTSC register is always 0x201203 (CCS = 1, CSC = 0). The root cause of such behavior is unknown yet. Connect status change bit is set on the same port with a USB 2.0 device (mapped to xHCI port #1, which is a different port on the root hub). With current logic in usb_scan_port(), the enumeration process will abort if it does not detect a connect status change on a hub port. However since a device connection status is correctly reported, the enumeration process can still continue. With this change, USB device connected to the bottom blue port on MinnowMax board can be enumerated under either SS or HS mode. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de> Tested-by: Stefan Roese <sr@denx.de> Tested-by: Dinh Nguyen <dinguyen@kernel.org>
2017-07-28console: simplify puts()Masahiro Yamada
Current puts() and putc() have similar #ifdef / if() conditionals. Make puts() iterate over putc() to avoid code duplication. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-07-27spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LENAndy Yan
Some platforms have very limited SRAM to run SPL code, so there may not be the same amount space for a malloc pool before relocation in the SPL stage as the normal U-Boot stage. Make SPL and (the full) U-Boot stage use independent SYS_MALLOC_F_LEN, so the size of pre-relocation malloc pool can be configured memory space independently. Signed-off-by: Andy Yan <andy.yan@rock-chips.com> Reviewed-by: Tom Rini <trini@konsulko.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> [fixed up commit-message:] Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-07-26Merge git://git.denx.de/u-boot-mipsTom Rini
2017-07-26Convert CONFIG_ENV_IS_IN_ONENAND to KconfigSimon Glass
This converts the following to Kconfig: CONFIG_ENV_IS_IN_ONENAND Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-26Convert CONFIG_ENV_IS_IN_FAT to KconfigSimon Glass
This converts the following to Kconfig: CONFIG_ENV_IS_IN_FAT Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-26Convert CONFIG_ENV_IS_IN_REMOTE to KconfigSimon Glass
This converts the following to Kconfig: CONFIG_ENV_IS_IN_REMOTE Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-26Convert CONFIG_ENV_IS_IN_SPI_FLASH to KconfigSimon Glass
This converts the following to Kconfig: CONFIG_ENV_IS_IN_SPI_FLASH Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-26Convert CONFIG_ENV_IS_IN_DATAFLASH to KconfigSimon Glass
This converts the following to Kconfig: CONFIG_ENV_IS_IN_DATAFLASH Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-26Convert CONFIG_ENV_IS_IN_EEPROM to KconfigSimon Glass
This converts the following to Kconfig: CONFIG_ENV_IS_IN_EEPROM Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-26Convert CONFIG_ENV_IS_IN_NVRAM to KconfigSimon Glass
This converts the following to Kconfig: CONFIG_ENV_IS_IN_NVRAM Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-26Convert CONFIG_ENV_IS_IN_FLASH to KconfigSimon Glass
This converts the following to Kconfig: CONFIG_ENV_IS_IN_FLASH Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-26env: Move help from README to KconfigSimon Glass
The CONFIG_ENV_IS_IN_... options which have already been converted to Kconfig only have a small amount of help. Move the rest of it over from the README. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-26Convert CONFIG_ENV_IS_IN_MMC/NAND/UBI and NOWHERE to KconfigSimon Glass
This converts the following to Kconfig: CONFIG_ENV_IS_IN_MMC CONFIG_ENV_IS_IN_NAND CONFIG_ENV_IS_IN_UBI CONFIG_ENV_IS_NOWHERE In fact this already exists for sunxi as a 'choice' config. However not all the choices are available in Kconfig yet so we cannot use that. It would lead to more than one option being set. In addition, one purpose of this series is to allow the environment to be stored in more than one place. So the existing choice is converted to a normal config allowing each option to be set independently. There are not many opportunities for Kconfig updates to reduce the size of this patch. This was tested with ./tools/moveconfig.py -i CONFIG_ENV_IS_IN_MMC And then manual updates. This is because for CHAIN_OF_TRUST boards they can only have ENV_IS_NOWHERE set, so we enforce that via Kconfig logic now. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2017-07-25MIPS: Stop building position independent codePaul Burton
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> Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Cc: u-boot@lists.denx.de Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
2017-07-22env: Switch env_nand, env_mmc and env_ubi to env_import_redundFiach Antaw
The env_nand, env_mmc and env_ubi implementations all implement redundancy using an identical serial-number scheme. This commit migrates them to use the implementation in env_common, which is functionally identical. Signed-off-by: Fiach Antaw <fiach.antaw@uqconnect.edu.au> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-07-22env: Add generic redundant environment implementationFiach Antaw
All current environments that implement redundancy use almost identical implementations. This patch implements the env_nand implementation as a function in env_common, and updates the env_export function to export an env_nand-style 'flags' field by default. Signed-off-by: Fiach Antaw <fiach.antaw@uqconnect.edu.au> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-07-19mmc: add static to spl_mmc_get_device_index()Masahiro Yamada
This function is only used in common/spl/spl_mmc.c[ Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2017-07-12common: use get_nand_dev_by_index()Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
2017-07-12common: env_nand: use get_nand_dev_by_index()Grygorii Strashko
As part of preparation for nand DM conversion the new API has been introduced to remove direct access to nand_info array. So, use it here instead of accessing to nand_info array directly. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
2017-07-11sandbox: Drop special case console code for sandboxSimon Glass
At present sandbox has a special case where it directly calls os_putc() when it does not have a console yet. Now that we have the pre-console buffer enabled we can drop this. Any early characters will be buffered and output later. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2017-07-11sandbox: Enable more console optionsSimon Glass
Enable the pre-console buffer, displaying the model and post-relocation console announce on sandbox. Also add a model name to the device tree. This allows testing of these features. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2017-07-11console: Use map_sysmem() for the pre-relocation consoleSimon Glass
At present this feature casts the address to a pointer. Use the map_sysmem() function so that it will work correctly on sandbox. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2017-07-11Allow displaying the U-Boot banner on a video displaySimon Glass
At present the U-Boot banner is only displayed on the serial console. If this is not visible to the user, the banner does not show. Some devices have a video display which can usefully display this information. Add a banner which is printed after relocation only on non-serial devices if CONFIG_DISPLAY_BOARDINFO_LATE is defined. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2017-07-11dm: scsi: Document and rename the scsi_scan() parameterSimon Glass
The 'mode' parameter is actually a flag to determine whether to display a list of devices found during the scan. Rename it to reflect this, add a function comment and adjust callers to use a boolean. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2017-07-11dm: scsi: Drop the ccb typedefSimon Glass
We should not be using typedefs in U-Boot and 'ccb' is a pretty short name. It is also used with variables. Drop the typedef and use 'struct' instead. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>