oweals/u-boot.git
6 years agoadc: add Amlogic Meson SAR ADC driver
Neil Armstrong [Mon, 23 Apr 2018 14:19:23 +0000 (16:19 +0200)]
adc: add Amlogic Meson SAR ADC driver

This patch adds the driver for the Amlogic Meson Successive Approximation
Register (SAR) A/D Converter based on the Linux IIO driver thanks to the
great work of Martin Blumenstingl.
The driver has been adapted to U-Boot and the ADC UClass.

This patch depends on the regmap "regmap: add regmap_update_bits() helper"
patch and has been tested using the newly introducted "adc" CLI command
in the "cmd: add ADC cli commands" patch.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agotest: regmap: add read/modify/write test
Neil Armstrong [Fri, 27 Apr 2018 09:56:15 +0000 (11:56 +0200)]
test: regmap: add read/modify/write test

Add calls to regmap_read/modify_bits/write even if the proper memory
read/write calls are not executed in sandbox.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoregmap: add regmap_update_bits() helper
Neil Armstrong [Fri, 27 Apr 2018 09:56:14 +0000 (11:56 +0200)]
regmap: add regmap_update_bits() helper

Add the regmap_update_bits() to simply the read/modify/write of registers
in a single command. The function is taken from Linux regmap
implementation.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoARM: dts: stm32mp157: Add vrefbuf DT node
Patrice Chotard [Thu, 26 Apr 2018 15:00:49 +0000 (17:00 +0200)]
ARM: dts: stm32mp157: Add vrefbuf DT node

Add vrefbuf device tree node. This allows to get
a voltage reference for ADCs.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agoconfigs: stm32mp15: Enable STM32_VREFBUF flag
Fabrice Gasnier [Thu, 26 Apr 2018 15:00:48 +0000 (17:00 +0200)]
configs: stm32mp15: Enable STM32_VREFBUF flag

Enable vrefbuf on stm32mp15, to be used by ADC.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agoclk: stm32mp1: Add VREF clock gating
Fabrice Gasnier [Thu, 26 Apr 2018 15:00:47 +0000 (17:00 +0200)]
clk: stm32mp1: Add VREF clock gating

Add VREF clock gating, that may be used by STM32 VREFBUF regulator.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agopower: regulator: Add support for stm32-vrefbuf
Fabrice Gasnier [Thu, 26 Apr 2018 15:00:46 +0000 (17:00 +0200)]
power: regulator: Add support for stm32-vrefbuf

Add regulator driver for STM32 voltage reference buffer which can be
used as voltage reference for ADCs, DACs and external components through
dedicated VREF+ pin.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agoconfigs: stm32mp15_basic: Set regulator relative flags
Patrice Chotard [Thu, 26 Apr 2018 15:13:12 +0000 (17:13 +0200)]
configs: stm32mp15_basic: Set regulator relative flags

Enable DM_REGULATOR_STPMU1 flag to activate regulator
driver for STM32MP15 SoC and CMD_REGULATOR flag to be
able to set/get regulator state int U-boot command line.

Disable PMIC_CHILDREN as this flag is not needed in SPL
for STM32MP1.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agoARM: dts: stm32mp157c-ed1: Add regulator node
Patrice Chotard [Thu, 26 Apr 2018 15:13:11 +0000 (17:13 +0200)]
ARM: dts: stm32mp157c-ed1: Add regulator node

Add regulator nodes needed by stpmu1 regulator driver
Add vmmc-supply and vqmmc-supply regulator property for
sdmmc1 and sdmmc2.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agopower: pmic: stpmu1: Add regulator bindings
Patrice Chotard [Thu, 26 Apr 2018 15:13:10 +0000 (17:13 +0200)]
power: pmic: stpmu1: Add regulator bindings

Add regulator bindings to get access to regulator managed
by drivers/power/regulator/stpmu1.c regulator driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agopower: regulator: stpmu1: Introduce stpmu1 driver
Christophe Kerello [Thu, 26 Apr 2018 15:13:09 +0000 (17:13 +0200)]
power: regulator: stpmu1: Introduce stpmu1 driver

Enable support for the regulator functions of the STPMU1X PMIC. The
driver implements get/set api for the various BUCKS and LDOs supported
by the PMIC device. This driver is controlled by a device tree node
which includes voltage limits.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agoARM: dts: stm32mp157: Add SoC pwr regulator entry
Patrice Chotard [Thu, 26 Apr 2018 14:45:19 +0000 (16:45 +0200)]
ARM: dts: stm32mp157: Add SoC pwr regulator entry

Add SoC power regulator entry for reg11, reg18 and usb33
regulator.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agostm32mp: regulator: add SoC pwr regulator support
Patrick Delaunay [Thu, 26 Apr 2018 14:45:18 +0000 (16:45 +0200)]
stm32mp: regulator: add SoC pwr regulator support

This driver binds and manages the following regulator of
SoC's PWR block :
  - reg11
  - reg18
  - usb33

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agoarm: controlcenterdc: Add spi-flash compatible strings
Mario Six [Thu, 26 Apr 2018 08:10:59 +0000 (10:10 +0200)]
arm: controlcenterdc: Add spi-flash compatible strings

Since kirkwook SPI was recently converted to DM, add compatible strings
to the SPI flash devices to make them work with the new driver.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
6 years agoenv: ti: android: boot with FIT Image
Praneeth Bajjuri [Wed, 25 Apr 2018 21:03:24 +0000 (16:03 -0500)]
env: ti: android: boot with FIT Image

Boot android over emmc by default thru FIT image

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
6 years agoconfigs: TI: Enable FIT Library overlay support
Praneeth Bajjuri [Wed, 25 Apr 2018 21:03:23 +0000 (16:03 -0500)]
configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
6 years agoarm: dra76: fastboot: extend cpu type for getvar command
Praneeth Bajjuri [Wed, 25 Apr 2018 20:56:34 +0000 (15:56 -0500)]
arm: dra76: fastboot: extend cpu type for getvar command

'commit dda0bd674481 ("arm: dra762: Add support for device package identification")'
introduces ABZ and ACD package identification.

This patch is to extend usage of "fastboot getvar cpu" for
DRA76x ABZ and ACD devices.

Helps in fixing the boot warning.

Warning: fastboot.cpu: unknown CPU rev: 123863298
on
CPU  : DRA762-GP ES1.0 ABZ package
Model: TI AM5748 IDK
Board: AM574x IDK REV 1.0A

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agodefconfig: at91-sama5d2_ptc_ek: remove unused SYS_EXTRA_OPTIONS
Ludovic Desroches [Wed, 25 Apr 2018 09:22:41 +0000 (12:22 +0300)]
defconfig: at91-sama5d2_ptc_ek: remove unused SYS_EXTRA_OPTIONS

Remove SYS_USE_NANDFLASH, SYS_USE_MMC as they are deprecated and
unused.
The board configurations already use CONFIG_SD_BOOT and
CONFIG_NAND_BOOT respectively.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
[eugen.hristev@microchip.com: rework on latest u-boot]
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agoboard: sama5d27_som1_ek: Fix the USB vbus power
Eugen Hristev [Tue, 24 Apr 2018 11:36:28 +0000 (14:36 +0300)]
board: sama5d27_som1_ek: Fix the USB vbus power

According to the REVB schematic, fix the USB vbus power enable pin.

Based on original work by Wenyou Yang

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agoconfigs: at91: sama5: updated mtdparts variable in bootargs
Eugen Hristev [Tue, 24 Apr 2018 09:00:16 +0000 (12:00 +0300)]
configs: at91: sama5: updated mtdparts variable in bootargs

We have a new demo layout of our sama5 boards for the NAND Flash
memory.
According to this new layout, adjust the mtdparts variable in bootargs
to align with this, which is available at :
http://www.at91.com/linux4sam/bin/view/Linux4SAM/Sama5d3XplainedMainPage#NAND_Flash_demo_Memory_map,

Based on original work by Wenyou Yang

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agoboard: sama5d2_ptc_ek: adjust the smc timings of nand
Eugen Hristev [Tue, 24 Apr 2018 07:43:53 +0000 (10:43 +0300)]
board: sama5d2_ptc_ek: adjust the smc timings of nand

To fix the issue of write the rootfs.ubi, adjust the smc timings
configuration of the nand controller.

Based on original work by Wenyou Yang

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agogpio: atmel_pio4: give a full configuration when muxing pins
Ludovic Desroches [Tue, 24 Apr 2018 07:16:01 +0000 (10:16 +0300)]
gpio: atmel_pio4: give a full configuration when muxing pins

When a pin is muxed to a peripheral or as a GPIO, the only
configuration that can be set is the pullup. It is too restrictive
so this patch allows to give a full configuration.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
6 years agoboard: atmel: sama5d2_ptc_ek: update pin configuration for NAND
Ludovic Desroches [Mon, 23 Apr 2018 07:59:50 +0000 (10:59 +0300)]
board: atmel: sama5d2_ptc_ek: update pin configuration for NAND

The drive strength has to be set to medium for the NAND data lines.
With a low drive, we can get some data corruption.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
6 years agogpio: atmel_pio4: add drive strength macros
Ludovic Desroches [Mon, 23 Apr 2018 07:59:49 +0000 (10:59 +0300)]
gpio: atmel_pio4: add drive strength macros

Macros for drive strength configuration were missing.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
6 years agopci: intel: Add Intel FPGA PCIe controller driver
Ley Foon Tan [Fri, 20 Apr 2018 13:55:45 +0000 (21:55 +0800)]
pci: intel: Add Intel FPGA PCIe controller driver

Add PCIe driver for Intel FPGA PCIe IP. This driver operates the PCIe IP in
rootport mode only, the EP mode is not supported. The driver is tested
with the Intel e1000e NIC driver.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
6 years agoarm64: Add SMC and HVC commands
Michalis Pappas [Fri, 13 Apr 2018 07:40:57 +0000 (10:40 +0300)]
arm64: Add SMC and HVC commands

This patch adds smc and hvc commands, that allow issuing Secure Monitor
Calls and Hypervisor Calls conforming to the ARM SMC Calling Convention.

Add Kconfig items to allow each command can be individually enabled.

Signed-off-by: Michalis Pappas <mpappas@fastmail.fm>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agopinctrl: meson: Update pinmux with new Linux bindings
Neil Armstrong [Wed, 11 Apr 2018 15:40:41 +0000 (17:40 +0200)]
pinctrl: meson: Update pinmux with new Linux bindings

The pinctrl bindings has changed for Amlogic Meson SoCs since Linux 4.13,
update the pinctrl driver to take this in account.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoARM64: meson: Sync DT and Bindings with Linux 4.16
Neil Armstrong [Wed, 11 Apr 2018 15:40:40 +0000 (17:40 +0200)]
ARM64: meson: Sync DT and Bindings with Linux 4.16

Synchronize the Linux Device Tree for Amlogic Meson GX boards from Linux 4.16.0.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoARM: meson: rename GXBB to GX
Neil Armstrong [Wed, 11 Apr 2018 15:13:45 +0000 (17:13 +0200)]
ARM: meson: rename GXBB to GX

Taking into account the Amlogic Family name starts with GX, including
the GXBB, GXL and GXM SoCs.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoclk: clk_stm32f: Use PLLSAIP as USB 48MHz clock
Patrice Chotard [Wed, 11 Apr 2018 15:07:45 +0000 (17:07 +0200)]
clk: clk_stm32f: Use PLLSAIP as USB 48MHz clock

On all STM32F4 and F7 SoCs  family (except STM32F429), PLLSAI
output P can be used as 48MHz clock source for USB and SDMMC.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Tested By: Bruno Herrera <bruherrera@gmail.com>

6 years agodm: led: add testcase for "default-state" property
Patrick Bruenn [Wed, 11 Apr 2018 09:16:29 +0000 (11:16 +0200)]
dm: led: add testcase for "default-state" property

Add two more gpio-leds to sandbox test device tree with default-state
property set to "on"/"off".
Add dm_test_led_default_state() to check that these new LED's are set to
LEDST_ON and LEDST_OFF.

dm: led: add testcase for "default-state" property

Add two more gpio-leds to sandbox test device tree with default-state
property set to "on"/"off".
Add dm_test_led_default_state() to check that these new LED's are set to
LEDST_ON and LEDST_OFF.

Signed-off-by: Patrick Bruenn <p.bruenn@beckhoff.com>
6 years agodm: led: auto probe() LEDs with "default-state"
Patrick Bruenn [Wed, 11 Apr 2018 09:16:28 +0000 (11:16 +0200)]
dm: led: auto probe() LEDs with "default-state"

To avoid board specificy LED activation code, automatically
activate gpio-leds with "default-state" property during bind().

Signed-off-by: Patrick Bruenn <p.bruenn@beckhoff.com>
6 years agodm: led: Support "default-state" property
Patrick Bruenn [Wed, 11 Apr 2018 09:16:27 +0000 (11:16 +0200)]
dm: led: Support "default-state" property

Add support for the device tree property "default-state". This feature
might be useful for LEDs indicating "power on" or similar states.

Note: Even with this commit gpio-leds remain in reset state. That's
because the led_gpio is not probed until DM_FLAG_ACTIVATED is set.

Signed-off-by: Patrick Bruenn <p.bruenn@beckhoff.com>
6 years agommc: support writing sparse images
Jassi Brar [Fri, 6 Apr 2018 06:35:24 +0000 (12:05 +0530)]
mmc: support writing sparse images

Provide an alternate path for sparse-images to be
written to MMC. For example, via tftp on platforms
that don't support fastboot protocol. Or when an
image is to written at some offset, rather than the
start of a partition.

Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
[trini: Guard with CONFIG_FASTBOOT_FLASH tests, use LBAF for lbaint_t
        printing]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agofastboot: sparse: make write_sparse_image useable for non-fastboot
Jassi Brar [Fri, 6 Apr 2018 06:35:09 +0000 (12:05 +0530)]
fastboot: sparse: make write_sparse_image useable for non-fastboot

write_sparse_image could be useful for non-fastboot users.
For ex a platform, without usb-device/fastboot support, could
get sparse images over tftp and write using the mmc command.
Or non-android systems could also leverage the sparse format.

Towards that, this patch removes anything fastboot specific from
the write_sparse_image implementation. Which includes making the
function return integer as error code and calls for fastboot logging
via an optional callback function 'mssg'.

Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
6 years agofastboot: sparse: remove redundant argument to write_sparse_image
Jassi Brar [Fri, 6 Apr 2018 06:34:52 +0000 (12:04 +0530)]
fastboot: sparse: remove redundant argument to write_sparse_image

'sz' has no use for write_sparse_image, remove it simplifying the api.

Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
6 years agoarm: v7R: Add support for enabling caches
Lokesh Vutla [Thu, 26 Apr 2018 12:51:31 +0000 (18:21 +0530)]
arm: v7R: Add support for enabling caches

Cache maintenance procedure is same for v7A and v7R
processors. So re-use cache-cp15.c file except for
mmu parts.

Tested-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoarm: v7R: Add support for MPU
Lokesh Vutla [Thu, 26 Apr 2018 12:51:30 +0000 (18:21 +0530)]
arm: v7R: Add support for MPU

The Memory Protection Unit(MPU) allows to partition memory into regions
and set individual protection attributes for each region. In absence
of MPU a default map[1] will take effect. Add support for configuring
MPU on Cortex-R, by reusing the existing support for Cortex-M processor.

[1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0460d/I1002400.html

Tested-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoarm: v7R: Add initial support
Michal Simek [Thu, 26 Apr 2018 12:51:29 +0000 (18:21 +0530)]
arm: v7R: Add initial support

The Cortex-R* processors are a mid-range CPUs for use in deeply-embedded,
real-time systems. It implements the ARMv7-R architecture, and includes
Thumb-2 technology for optimum code density and processing throughput.

Except for MPU(Memory Protection Unit) and few CP15 registers, most of the
features are compatible with v7 architecture. So,reuse the same armv7
folder and introduce a new config CPU_V7R in order to differentiate
from v7 based platforms.

Tested-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
6 years agoarm: v7: Kconfig: Introduce SYS_ARM_CACHE_CP15
Lokesh Vutla [Thu, 26 Apr 2018 12:51:28 +0000 (18:21 +0530)]
arm: v7: Kconfig: Introduce SYS_ARM_CACHE_CP15

Certain ARM architectures like ARMv7-A, ARMv7-R has support for
enabling caches using CP15 registers. To have a common support
for all these architectures, introduce a Kconfig symbol
SYS_ARM_CACHE_CP15 that selects cache-cp15.c

Tested-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
6 years agoarm: v7: Kconfig: Add entry for MMU
Lokesh Vutla [Thu, 26 Apr 2018 12:51:27 +0000 (18:21 +0530)]
arm: v7: Kconfig: Add entry for MMU

Add a Kconfig entry for MMU and imply for all platforms using
cache-cp15.c containing MMU setup. Using imply instead of select so that
MMU can be disabled by defconfigs when not needed.

Tested-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
6 years agoarm: v7: Kconfig: Rename CPU_V7 as CPU_V7A
Lokesh Vutla [Thu, 26 Apr 2018 12:51:26 +0000 (18:21 +0530)]
arm: v7: Kconfig: Rename CPU_V7 as CPU_V7A

Currently CPU_V7 kconfig symbol supports only ARMv7A architectures under
armv7 folder. This led to a misconception of creating separate folders
for armv7m and armv7r. There is no reason to create separate folder for
other armv7 based architectures when it can co-exist with few Kconfig
symbols.

As a first step towards a common folder, rename CPU_V7 as CPUV7A. Later
separate Kconfig symbols can be added for CPU_V7R and CPU_V7M and
can co exist in the same folder.

Reviewed-by: Tom Rini <trini@konsulko.com>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Suggested-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
6 years agoarm: v7: Update VBAR only if available
Lokesh Vutla [Thu, 26 Apr 2018 12:51:25 +0000 (18:21 +0530)]
arm: v7: Update VBAR only if available

Not all ARM V7 based cpus has VBAR for remapping
vector base address. So, update VBAR only if it available.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
6 years agotest: ofnode: test ofnode_device_is_compatible()
Masahiro Yamada [Thu, 26 Apr 2018 16:02:02 +0000 (01:02 +0900)]
test: ofnode: test ofnode_device_is_compatible()

Test ofnode_device_is_compatible(), and also ofnode_path().

Requested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agotest: regmap: test Linux-compatible syscon_node_to_regmap()
Masahiro Yamada [Mon, 23 Apr 2018 04:26:53 +0000 (13:26 +0900)]
test: regmap: test Linux-compatible syscon_node_to_regmap()

Like Linux, syscon_node_to_regmap() allows a node to work as a syscon
provider without binding it to a syscon driver.  Test this.

Requested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agosyscon: add Linux-compatible syscon API
Masahiro Yamada [Thu, 19 Apr 2018 03:14:04 +0000 (12:14 +0900)]
syscon: add Linux-compatible syscon API

The syscon implementation in U-Boot is different from that in Linux.
Thus, DT files imported from Linux do not work for U-Boot.

In U-Boot driver model, each node is bound to a dedicated driver
that is the most compatible to it.  This design gets along with the
concept of DT, and the syscon in Linux originally worked like that.

However, Linux commit bdb0066df96e ("mfd: syscon: Decouple syscon
interface from platform devices") changed the behavior because it is
useful to let a device bind to another driver, but still work as a
syscon provider.

That change had happened before U-Boot initially supported the syscon
driver by commit 6f98b7504f70 ("dm: Add support for generic system
controllers (syscon)").  So, the U-Boot's syscon works differently
from the beginning.  I'd say this is mis-implementation given that
DT is not oriented to a particular project, but Linux is the canon
of DT in practice.

The problem typically arises in the combination of "syscon" and
"simple-mfd" compatibles.

In Linux, they are orthogonal, i.e., the order between "syscon" and
"simple-mfd" does not matter at all.

Assume the following compatible.

   compatible = "foo,bar-syscon", "syscon", "simple-mfd";

In U-Boot, this device node is bound to the syscon driver
(driver/core/syscon-uclass.c) since the "syscon" is found to be the
most compatible.  Then, syscon_get_regmap() succeeds.

However,

   compatible = "foo,bar-syscon", "simple-mfd", "syscon";

does not work because this node is bound to the simple-bus driver
(drivers/core/simple-bus.c) in favor of "simple-mfd" compatible.
The compatible string "syscon" is just dismissed.

Moreover,

   compatible = "foo,bar-syscon", "syscon";

works like the first case because the syscon driver populates the
child devices.  This is wrong because populating children is the job
of "simple-mfd" (or "simple-bus").

This commit ports syscon_node_to_regmap() from Linux.  This API
does not require the given node to be bound to a driver in any way.

Reported-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoregmap: change regmap_init_mem() to take ofnode instead udevice
Masahiro Yamada [Thu, 19 Apr 2018 03:14:03 +0000 (12:14 +0900)]
regmap: change regmap_init_mem() to take ofnode instead udevice

Currently, regmap_init_mem() takes a udevice. This requires the node
has already been associated with a device. It prevents syscon/regmap
from behaving like those in Linux.

Change the first argumenet to take a device node.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: ofnode: add ofnode_device_is_compatible() helper
Masahiro Yamada [Thu, 19 Apr 2018 03:14:02 +0000 (12:14 +0900)]
dm: ofnode: add ofnode_device_is_compatible() helper

device_is_compatible() takes udevice, but there is no such a helper
that takes ofnode.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoregmap: clean up regmap allocation
Masahiro Yamada [Thu, 19 Apr 2018 03:14:01 +0000 (12:14 +0900)]
regmap: clean up regmap allocation

Putting zero length array at the end of struct is a common technique
to embed arbitrary length of members.  There is no good reason to let
regmap_alloc_count() branch by "if (count <= 1)".

As far as I understood the code, regmap->base is an alias of
regmap->ranges[0].start, but it is not helpful but make the code
just ugly.

Rename regmap_alloc_count() to regmap_alloc() because the _count
suffix seems pointless.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: fixup cpu_info-rcar.c]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agopsci: arm: remove armv7 function psci_save_target_pc
Patrick Delaunay [Mon, 16 Apr 2018 08:15:12 +0000 (10:15 +0200)]
psci: arm: remove armv7 function psci_save_target_pc

This function is no more used, and replaced by psci_save
which save also context id as requested by PSCI requirements.

Even if the context id is not used by Linux, it should be saved
and restored in r0 when the CPU_ON is performed.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agosunxi: psci: save context id in cpu_on command
Patrick Delaunay [Mon, 16 Apr 2018 08:15:11 +0000 (10:15 +0200)]
sunxi: psci: save context id in cpu_on command

Replace the psci_save_target_pc call by the new function
psci_save(cpu, pc,context_id)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agouniphier: psci: save context id in cpu_on command
Patrick Delaunay [Mon, 16 Apr 2018 08:15:10 +0000 (10:15 +0200)]
uniphier: psci: save context id in cpu_on command

Replace the psci_save_target_pc call by the new function
psci_save(cpu, pc,context_id)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agotegra: psci: save context id in cpu_on command
Patrick Delaunay [Mon, 16 Apr 2018 08:15:09 +0000 (10:15 +0200)]
tegra: psci: save context id in cpu_on command

Replace the psci_save_target_pc call by the new function
psci_save(cpu, pc,context_id)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
6 years agoimx7: psci: save context id in cpu_on command
Patrick Delaunay [Mon, 16 Apr 2018 08:15:08 +0000 (10:15 +0200)]
imx7: psci: save context id in cpu_on command

Replace the psci_save_target_pc call by the new function
psci_save(cpu, pc,context_id)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agols102xa: psci: save context id in cpu_on command
Patrick Delaunay [Mon, 16 Apr 2018 08:15:07 +0000 (10:15 +0200)]
ls102xa: psci: save context id in cpu_on command

Replace the psci_save_target_pc call by the new function
psci_save(cpu, pc,context_id)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agoarm: stm32mp1: add PSCI support
Patrick Delaunay [Mon, 16 Apr 2018 08:13:24 +0000 (10:13 +0200)]
arm: stm32mp1: add PSCI support

Add PSCI v1.0 support for Linux and manage PSCI state
for each CPU (affinity 0 level) with all mandatory functions:
- PSCI_VERSION
- CPU_SUSPEND
- CPU_OFF
- CPU_ON
- AFFINITY_INFO
- SYSTEM_OFF
- SYSTEM_RESET
- PSCI_FEATURES
and 1 optional to avoid Linux warning
- MIGRATE_INFO_TYPE

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
6 years agoarm: psci: add a weak function psci_arch_cpu_entry
Patrick Delaunay [Mon, 16 Apr 2018 08:13:23 +0000 (10:13 +0200)]
arm: psci: add a weak function psci_arch_cpu_entry

The added function psci_arch_cpu_entry() is called
during psci_cpu_entry() and can be used by arch to handle
PSCI state transition from ON_PENDING to ON.

The default weak function is empty: not behavior change.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agoarm: psci: save context id for cpu_on PSCI command
Patrick Delaunay [Mon, 16 Apr 2018 08:13:22 +0000 (10:13 +0200)]
arm: psci: save context id for cpu_on PSCI command

Save and use the 3rd parameter of PSCI CPU_ON request: context_id.

The context_id parameter is only meaningful to the caller.
U-Boot PSCI preserves a copy of the value passed in this parameter.
Following wakeup from a  powerdown state, U-BOOT PSCI places
this value in R0 when it first enters the OS.

NB: this context id is not (yet?) used by Linux but it is mandatory
    to be PSCI compliant.

update armv7 psci functions:
- psci_save_target_pc(): keep for backward compatibility with
  current platform (only save PC and force context id to 0)
  => should be removed when all platform migrate to the new API

- psci_save(): new API to use by ARMv7 platform with PSCI,
  save pc (= entry_point_address) and context_id

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoPrepare v2018.05 v2018.05
Tom Rini [Mon, 7 May 2018 15:32:36 +0000 (11:32 -0400)]
Prepare v2018.05

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agogit-mailrc: Update some addresses and aliases
Tom Rini [Mon, 7 May 2018 15:03:13 +0000 (11:03 -0400)]
git-mailrc: Update some addresses and aliases

- Based on commit 08ae21af9671 ("MAINTAINERS: Switch nxp.com domain")
  update or drop some formerly Freescale addresses.
- Update a few aliases to reflect current custodians

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoSPDX: Convert all of our multiple license tags to Linux Kernel style
Tom Rini [Sun, 6 May 2018 22:27:01 +0000 (18:27 -0400)]
SPDX: Convert all of our multiple license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from.  So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry.  Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have multiple licenses (in
these cases, dual license) declared in the SPDX-License-Identifier tag.
In this case we change from listing "LICENSE-A LICENSE-B" or "LICENSE-A
or LICENSE-B" or "(LICENSE-A OR LICENSE-B)" to "LICENSE-A OR LICENSE-B"
as per the Linux Kernel style document.  Note that parenthesis are
allowed so when they were used before we continue to use them.

Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoSPDX: Convert all of our single license tags to Linux Kernel style
Tom Rini [Sun, 6 May 2018 21:58:06 +0000 (17:58 -0400)]
SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from.  So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry.  Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents.  There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoarm: mach-omap2: cache: Explicitly enable I cache
Lokesh Vutla [Thu, 3 May 2018 15:04:49 +0000 (20:34 +0530)]
arm: mach-omap2: cache: Explicitly enable I cache

omap-common cache enabling sequence relies on cpu_init_cp15()
(inside start.S) for enabling I-caches. But cpu_init_cp15()
can be skipped if CONFIG_SKIP_LOWLEVEL_INIT is defined. So
enable I-caches if not enabled already.

Debugged-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Tested-by: Steve Kipisz <s-kipisz2@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Tested-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoKconfig: Add dependency on HASH to verified boot
Kelvin Cheung [Wed, 2 May 2018 10:07:18 +0000 (18:07 +0800)]
Kconfig: Add dependency on HASH to verified boot

Building with verified boot support requires hash, add that
dependency here. Otherwise the following build error will come out
without crc command.

      LD      u-boot
lib/built-in.o: In function `hash_calculate':
lib/rsa/rsa-checksum.c:29: undefined reference to
`hash_progressive_lookup_algo'
...
make[1]: *** [u-boot] Error 1

Signed-off-by: Kelvin Cheung <keguang.zhang@gmail.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoboard: ti: am43: Fix DCDC3 voltage for epos-evm
Keerthy [Wed, 2 May 2018 09:36:31 +0000 (15:06 +0530)]
board: ti: am43: Fix DCDC3 voltage for epos-evm

A common voltage of 1.35V was being programmed for all am43 board
versions. EPOS-EVM Needs 1.20V for LPDDR2.

Fixes: fc69d472621b5 (“board: ti: AM43XX: Add ddr voltage rail configuration”)
Reported-by: James Doublesin <doublesin@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoREADME.sandbox: small typos
Trevor Woerner [Mon, 30 Apr 2018 23:13:05 +0000 (19:13 -0400)]
README.sandbox: small typos

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
6 years agostdio_names: Ensure MAX_NAMES is defined before use, don't use 3 directly
Tom Rini [Thu, 3 May 2018 13:12:26 +0000 (09:12 -0400)]
stdio_names: Ensure MAX_NAMES is defined before use, don't use 3 directly

With tighter build flags the fact that <stdio_dev.h> doesn't have a
reference back to MAX_NAMES causes an error.  Include <stdio.h> here and
then in common/console.c use MAX_NAMES rather than 3 when working with
stdio_names.

Reported-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
6 years agostdio_dev.h: Drop the video section as it is unused
Tom Rini [Thu, 3 May 2018 13:12:25 +0000 (09:12 -0400)]
stdio_dev.h: Drop the video section as it is unused

With tighter build flags the fact that this header referenced
uchar/ushort without including what typedefs it causes an error.  Rather
than add another include here, drop the section in question as it is
unused.

Reported-by: Peter Robinson <pbrobinson@gmail.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoMerge git://git.denx.de/u-boot-usb
Tom Rini [Thu, 3 May 2018 13:20:13 +0000 (09:20 -0400)]
Merge git://git.denx.de/u-boot-usb

6 years agoMerge git://git.denx.de/u-boot-sh
Tom Rini [Thu, 3 May 2018 13:20:02 +0000 (09:20 -0400)]
Merge git://git.denx.de/u-boot-sh

6 years agoARM: rmobile: Zap #undef DEBUG
Marek Vasut [Wed, 2 May 2018 09:55:56 +0000 (11:55 +0200)]
ARM: rmobile: Zap #undef DEBUG

The DEBUG macro is never defined unless explicitly enabled.
Drop useless #undef DEBUG in the board configs so it won't
spread any further.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: rmobile: Contain CONFIG_ARCH_RMOBILE_BOARD_STRING
Marek Vasut [Wed, 2 May 2018 09:51:46 +0000 (11:51 +0200)]
ARM: rmobile: Contain CONFIG_ARCH_RMOBILE_BOARD_STRING

Pull the symbol from the boards and zap struct rmobile_sysinfo as they
are rather useless. The entire purpose of that whole machinery was to
print board name in the CONFIG_ARCH_RMOBILE_BOARD_STRING. Do that in a
far simpler and more contained manner.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: rmobile: Convert CONFIG_ARCH_RMOBILE_BOARD_STRING to Kconfig
Marek Vasut [Wed, 2 May 2018 09:42:22 +0000 (11:42 +0200)]
ARM: rmobile: Convert CONFIG_ARCH_RMOBILE_BOARD_STRING to Kconfig

Convert the symbol to Kconfig, no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: rmobile: Fix CONFIG_RMOBILE_BOARD_STRING
Marek Vasut [Wed, 2 May 2018 09:41:17 +0000 (11:41 +0200)]
ARM: rmobile: Fix CONFIG_RMOBILE_BOARD_STRING

Rename CONFIG_RMOBILE_BOARD_STRING to CONFIG_ARCH_RMOBILE_BOARD_STRING
to make things consistent, no functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agodoc: rmobile: Update the README
Marek Vasut [Tue, 1 May 2018 07:28:29 +0000 (09:28 +0200)]
doc: rmobile: Update the README

Synchronize the README with the current state of U-Boot, unify
the build instructions to avoid duplication.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoclk: renesas: Drop USB extal from the R8A7792 clock driver
Marek Vasut [Wed, 2 May 2018 08:48:15 +0000 (10:48 +0200)]
clk: renesas: Drop USB extal from the R8A7792 clock driver

The R8A7792 does not have the USB extal, so drop it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoMerge git://git.denx.de/u-boot-mmc
Tom Rini [Wed, 2 May 2018 02:38:18 +0000 (22:38 -0400)]
Merge git://git.denx.de/u-boot-mmc

6 years agoMAINTAINERS: Switch nxp.com domain
Fabio Estevam [Tue, 1 May 2018 18:54:39 +0000 (15:54 -0300)]
MAINTAINERS: Switch nxp.com domain

freescale.com domain is no longer reachable, so switch the
maintainers' emails to nxp.com domain instead.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agodrivers:power:max77693: remove redundant logical constraint
Heinrich Schuchardt [Sun, 18 Mar 2018 10:52:45 +0000 (11:52 +0100)]
drivers:power:max77693: remove redundant logical constraint

As ret is not set when calling max77693_get_vcell() there is no
need to check ret again.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agommc: zynq_sdhci: use correct quirk if CONFIG_ZYNQ_HISPD_BROKEN is defined
Hannes Schmelzer [Wed, 7 Mar 2018 07:00:57 +0000 (08:00 +0100)]
mmc: zynq_sdhci: use correct quirk if CONFIG_ZYNQ_HISPD_BROKEN is defined

The 'SDHCI_QUIRK_NO_HISPD_BIT' is used wrong here. The purpose of this
quirk is to tell the sdhci-driver that the IP-core doesn't have a "high-
speed-enable" bit in its registers.

With this commit we change this to the correct quirk:
SDHCI_QUIRK_BROKEN_HISPD_MODE

Signed-off-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com>
6 years agommc: sdhci: add SDHCI_QUIRK_BROKEN_HISPD_MODE
Hannes Schmelzer [Wed, 7 Mar 2018 07:00:56 +0000 (08:00 +0100)]
mmc: sdhci: add SDHCI_QUIRK_BROKEN_HISPD_MODE

Some IP-core implementations of the SDHCI have different troubles on the
silicon where they are placed.

On ZYNQ platform for example Xilinx doesn't accept the hold timing of an
eMMC chip which operates in High-Speed mode and must be forced to
operate in non high-speed mode. To get rid of this
"SDHCI_QUIRK_BROKEN_HISPD_MODE" is introduced.

For more details about this refer to the Xilinx answer-recor #59999
https://www.xilinx.com/support/answers/59999.html

This commit:
- doesn't set HISPD bit on the host-conroller
- reflects this fact within the host-controller capabilities

Upon this the layer above (mmc-driver) can setup the card correctly.

Otherwise the MMC card will be switched into high-speed mode and causes
possible timing violation on the host-controller side.

Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
Signed-off-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com>
6 years agommc: fix return value check condition
Peng Fan [Mon, 5 Mar 2018 08:20:40 +0000 (16:20 +0800)]
mmc: fix return value check condition

sd_read_ssr returns 0, means no error.
Fixes: 5b2e72f32721484("mmc: read ssr only if MMC write support is enabled")

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Jean-Jacques Hiblot <jjhiblot@ti.com>
6 years agosamsung: board: init the s2mps11 pmic during booting time
Jaehoon Chung [Mon, 29 Jan 2018 04:53:19 +0000 (13:53 +0900)]
samsung: board: init the s2mps11 pmic during booting time

Exynos5422 board has s2mps11 pmic.
If CONFIG_PMIC_S2MPS11 is enabled, it can initialize PMIC and Regulators
during booting time.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Tested-by: Anand Moon <linux.amoon@gmail.com>
6 years agoPrepare v2018.05-rc3 v2018.05-rc3
Tom Rini [Tue, 1 May 2018 13:09:31 +0000 (09:09 -0400)]
Prepare v2018.05-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agousb: f_mass_storage: simplify logical expression
Heinrich Schuchardt [Sun, 18 Mar 2018 12:12:14 +0000 (13:12 +0100)]
usb: f_mass_storage: simplify logical expression

An unsigned int is always >= 0.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agousb: gadget: remove duplicate assignment.
Heinrich Schuchardt [Sun, 18 Mar 2018 12:05:58 +0000 (13:05 +0100)]
usb: gadget: remove duplicate assignment.

We should not make the same assignement twice.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agoMerge git://git.denx.de/u-boot-imx
Tom Rini [Mon, 30 Apr 2018 11:14:05 +0000 (07:14 -0400)]
Merge git://git.denx.de/u-boot-imx

6 years agoMerge git://git.denx.de/u-boot-sunxi
Tom Rini [Mon, 30 Apr 2018 10:52:32 +0000 (06:52 -0400)]
Merge git://git.denx.de/u-boot-sunxi

6 years agotools: mkimage: Check for datafile when type is script
Alex Kiernan [Sun, 22 Apr 2018 05:11:17 +0000 (05:11 +0000)]
tools: mkimage: Check for datafile when type is script

If generating a script image and no datafile has been passed in, mkimage
dies with SIGSEGV:

  #0  __strchr_sse2 () at ../sysdeps/x86_64/multiarch/../strchr.S:32
  #1  0x0000000000403818 in main
      at tools/mkimage.c:503

Add explicit test for datafile to fix this.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agotools: mkenvimage: Fix possible segfault on stdin input
Alexander Dahl [Fri, 20 Apr 2018 13:29:31 +0000 (15:29 +0200)]
tools: mkenvimage: Fix possible segfault on stdin input

The size of 'filebuf' was not increased as more and more bytes are read
from stdin, but 'filebuf' was always reallocated to the same fix size.
This works as long as only less bytes than the initial buffer size come
in, for more input this will segfault. (It actually does, I tested
that.) So for each loop cycle the buffer size has to be increased by the
number of bytes we want to read.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
6 years agotools: mkenvimage: Fix read() stdin error handling
Alexander Dahl [Fri, 20 Apr 2018 13:29:30 +0000 (15:29 +0200)]
tools: mkenvimage: Fix read() stdin error handling

On success read() returns the number of bytes read or zero for EOF. On
error -1 is returned and errno is set, so the right way to test if read
had failed is to test the return value instead of errno.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
6 years agoserial: serial_stm32: Rename status register flags
Patrice Chotard [Fri, 20 Apr 2018 06:59:07 +0000 (08:59 +0200)]
serial: serial_stm32: Rename status register flags

Uart status register is named USART_ISR on STM32F7, STM32H7
and STM32MP1 SoCs family, but USART_SR only on STM32F4 SoCs.

Use USART_ISR_ prefix instead of USART_SR_ .

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agoserial: serial_stm32: Enable overrun
Patrice Chotard [Fri, 20 Apr 2018 06:59:06 +0000 (08:59 +0200)]
serial: serial_stm32: Enable overrun

Enable uart overrun feature which allows to benefits of uart
FIFO usage.

Previously overrun management was disabled, this has to effect
to bypassed the uart FIFO usage even if FIFO was enabled.
In particular configuration, for example when video console is
enabled, copy/pasting a long command line in console results in
corruption. This is due to the fact that a lot of time is consumed
in flushing the cache during frame buffer update, so uart chars are
not read fast enough.

By using uart FIFO and managing overrun, long command line can by
copy/paste in console without being corrupted.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agospl: disk: usb: Add dependencies to sprintf/strto*
Alex Kiernan [Thu, 19 Apr 2018 04:32:57 +0000 (04:32 +0000)]
spl: disk: usb: Add dependencies to sprintf/strto*

If SPL serial support is disabled nothing brings in sprintf, snprintf
or simple_strtoul:

  env/built-in.o: In function `regex_callback':
  env/attr.c:128: undefined reference to `sprintf'
  disk/built-in.o: In function `blk_get_device_by_str':
  disk/part.c:386: undefined reference to `simple_strtoul'
  disk/part.c:395: undefined reference to `simple_strtoul'
  disk/built-in.o: In function `blk_get_device_part_str':
  disk/part.c:522: undefined reference to `simple_strtoul'
  disk/built-in.o: In function `part_set_generic_name':
  disk/part.c:704: undefined reference to `sprintf'
  drivers/built-in.o: In function `init_peripheral_ep':
  drivers/usb/musb-new/musb_gadget.c:1826: undefined reference to `sprintf'
  drivers/built-in.o: In function `musb_core_init':
  drivers/usb/musb-new/musb_core.c:1451: undefined reference to `snprintf'

Add those dependencies here.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agoConsolidate __assert_failed into one implementation
Alex Kiernan [Thu, 19 Apr 2018 04:32:56 +0000 (04:32 +0000)]
Consolidate __assert_failed into one implementation

We had two implementations of __assert_failed which were almost identical,
combine them into one.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agospl: Disable printf if not required
Alex Kiernan [Thu, 19 Apr 2018 04:32:55 +0000 (04:32 +0000)]
spl: Disable printf if not required

Now we have a guard for printf, disable it in the build if it's not
selected.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agospl: Split sprintf, strto* from SPL serial in Kconfig
Alex Kiernan [Thu, 19 Apr 2018 04:32:54 +0000 (04:32 +0000)]
spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agospl: ti: Avoid serial calls when serial support is disabled
Alex Kiernan [Thu, 19 Apr 2018 04:32:53 +0000 (04:32 +0000)]
spl: ti: Avoid serial calls when serial support is disabled

If CONFIG_SPL_SERIAL_SUPPORT is not set, then the build will fail:

board/ti/am335x/built-in.o: In function `spl_start_uboot':
board/ti/am335x/board.c:247: undefined reference to `serial_tstc'
board/ti/am335x/board.c:247: undefined reference to `serial_getc'

Avoid the calls to the serial functions in that case.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agospl: Add dependency on serial to Ymodem
Alex Kiernan [Thu, 19 Apr 2018 04:32:52 +0000 (04:32 +0000)]
spl: Add dependency on serial to Ymodem

Building with Ymodem support requires serial in SPL/TPL, add that
dependency here.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agoCleanup CONFIG_SPL_SERIAL_SUPPORT migration
Alex Kiernan [Thu, 19 Apr 2018 04:32:50 +0000 (04:32 +0000)]
Cleanup CONFIG_SPL_SERIAL_SUPPORT migration

CONFIG_SPL_SERIAL_SUPPORT had already been migrated to Kconfig, but
existed in some include files; fix those up here.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>