platform/kernel/u-boot.git
5 years agomach-meson: g12a: add DWC2 peripheral mode support
Neil Armstrong [Tue, 19 Feb 2019 13:21:04 +0000 (14:21 +0100)]
mach-meson: g12a: add DWC2 peripheral mode support

Adds support for Amlogic G12A USB Device mode.

The DWC2 Controller behind the Glue can be connected to an OTG
capable PHY. The Glue setups the PHY mode.

This patch implements Device mode support by adding a board_usb_init/cleanup
setting up the DWC2 controller and switch the OTG capable port to Device
before starting the DWC2 controller in Device mode.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agophy: meson: add Amlogic G12A USB2 and USB3+PCIE PHY drivers
Neil Armstrong [Tue, 19 Feb 2019 14:17:29 +0000 (15:17 +0100)]
phy: meson: add Amlogic G12A USB2 and USB3+PCIE PHY drivers

This adds support for the USB PHYs found in the Amlogic G12A SoC Family.

The USB2 PHY supports Host and/or Peripheral mode, depending on it's position.
The first PHY is only used as Host, but the second supports Dual modes
defined by the USB Control Glue HW in front of the USB Controllers.

The second driver supports USB3 Host mode or PCIE 2.0 mode, depending on
the layout of the board.
Selection is done by the #phy-cells, making the mode static and exclusive.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agousb: dwc3: Add Meson G12A USB Glue
Neil Armstrong [Tue, 19 Feb 2019 12:42:01 +0000 (13:42 +0100)]
usb: dwc3: Add Meson G12A USB Glue

Adds support for Amlogic G12A USB Control Glue HW.

The Amlogic G12A SoC Family embeds 2 USB Controllers :
- a DWC3 IP configured as Host for USB2 and USB3
- a DWC2 IP configured as Peripheral USB2 Only

A glue connects these both controllers to 2 USB2 PHYs, and optionnally
to an USB3+PCIE Combo PHY shared with the PCIE controller.

The Glue configures the UTMI 8bit interfaces for the USB2 PHYs, including
routing of the OTG PHY between the DWC3 and DWC2 controllers, and
setups the on-chip OTG mode selection for this PHY.

This driver sets the OTG capable port as Host mode by default,
the switch to Device mode is to be done in a separate patch.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Marek Vasut <marex@denx.de>
5 years agoarm: mvebu: clearfog: add MMC to SPL DT
Baruch Siach [Wed, 8 May 2019 14:47:32 +0000 (17:47 +0300)]
arm: mvebu: clearfog: add MMC to SPL DT

This allows SPL to load the main U-Boot image from MMC once DM_MMC is
enabled.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: Add CRS305-1G-4S board
Luka Kovacic [Tue, 7 May 2019 17:35:55 +0000 (19:35 +0200)]
arm: mvebu: Add CRS305-1G-4S board

CRS305-1G-4S has a switch chip with an integrated CPU (98DX3236) and
like some of the other similar boards requires bin_hdr.
bin_hdr (DDR3 init stage) is currently retrieved from the stock
bootloader and compiled into the kwb image.

Adds support for U-Boot, enable UART, SPI, Winbond SPI flash chip
support and writing env to SPI flash.

Signed-off-by: Luka Kovacic <me@lukakovacic.xyz>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: db-88f6820-gp: Enable BLK and DM support
Stefan Roese [Fri, 3 May 2019 06:42:19 +0000 (08:42 +0200)]
arm: mvebu: db-88f6820-gp: Enable BLK and DM support

This patch enables CONFIG_BLK and some DM enabled drivers on
db-88f6820-gp to remove these compile warnings:

===================== WARNING ======================
This board does not use CONFIG_DM_MMC. Please update
the board to use CONFIG_DM_MMC before the v2019.04 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/MIGRATION.txt for more info.
====================================================
===================== WARNING ======================
This board does not use CONFIG_DM_USB. Please update
the board to use CONFIG_DM_USB before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/MIGRATION.txt for more info.
====================================================
===================== WARNING ======================
This board does use CONFIG_LIBATA but has CONFIG_AHCI not
enabled. Please update the storage controller driver to use
CONFIG_AHCI before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/MIGRATION.txt for more info.
====================================================

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
5 years agoarm: mvebu: db-88f6720: Enable CONFIG_BLK
Stefan Roese [Fri, 3 May 2019 06:42:18 +0000 (08:42 +0200)]
arm: mvebu: db-88f6720: Enable CONFIG_BLK

This patch enables CONFIG_BLK to remove this compile warning:

===================== WARNING ======================
This board does not use CONFIG_DM_USB. Please update
the board to use CONFIG_DM_USB before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/MIGRATION.txt for more info.
====================================================

Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: clearfog: Enable BLK and DM support
Stefan Roese [Fri, 3 May 2019 06:42:17 +0000 (08:42 +0200)]
arm: mvebu: clearfog: Enable BLK and DM support

This patch enables CONFIG_BLK and some DM enabled drivers on clearfog
to remove these compile warnings:

===================== WARNING ======================
This board does not use CONFIG_DM_MMC. Please update
the board to use CONFIG_DM_MMC before the v2019.04 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/MIGRATION.txt for more info.
====================================================
===================== WARNING ======================
This board does not use CONFIG_DM_USB. Please update
the board to use CONFIG_DM_USB before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/MIGRATION.txt for more info.
====================================================
===================== WARNING ======================
This board does use CONFIG_LIBATA but has CONFIG_AHCI not
enabled. Please update the storage controller driver to use
CONFIG_AHCI before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/MIGRATION.txt for more info.
====================================================

Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoMerge branch 'master' of git://git.denx.de/u-boot-net
Tom Rini [Thu, 9 May 2019 02:46:31 +0000 (22:46 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-net

- Various PHY fixes / enhancements.
- TI K2G fixes

5 years agonet: phy: micrel: Find Micrel PHY node correctly
James Byrne [Mon, 4 Mar 2019 17:40:34 +0000 (17:40 +0000)]
net: phy: micrel: Find Micrel PHY node correctly

In some of the device trees that specify skew values for KSZ90x1 PHYs
the values are stored (incorrectly) in the MAC node, whereas in others
it is in an 'ethernet-phy' subnode. Previously the code would fail to
find and program these skew values, so this commit changes it to look
for an "ethernet-phy" subnode first, and revert to looking in the MAC
node if there isn't one.

The device trees affected (where the skew values are in a subnode) are
imx6qdl-icore-rqs.dtsi, r8a77970-eagle.dts, r8a77990-ebisu.dts,
r8a77995-draak.dts, salvator-common.dtsi, sama5d3xcm.dtsi,
sama5d3xcm_cmp.dtsi, socfpga_cyclone5_vining_fpga.dts,
socfpga_stratix10_socdk.dts and ulcb.dtsi. Before this change the skew
values in these device trees would be ignored.

The device trees where the skew values are in the MAC node are
socfpga_arria10_socdk.dtsi, socfpga_arria5_socdk.dts,
socfpga_cyclone5_de0_nano_soc.dts, socfpga_cyclone5_de10_nano.dts,
socfpga_cyclone5_de1_soc.dts, socfpga_cyclone5_is1.dts,
socfpga_cyclone5_socdk.dts, socfpga_cyclone5_sockit.dts. These should be
unaffected by this change.

The changes were tested on a sama5d3xcm.

Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agonet: phy: micrel: Use correct skew values on KSZ9021
James Byrne [Mon, 4 Mar 2019 17:40:33 +0000 (17:40 +0000)]
net: phy: micrel: Use correct skew values on KSZ9021

Commit ff7bd212cb8a ("net: phy: micrel: fix divisor value for KSZ9031
phy skew") fixed the skew value divisor for the KSZ9031, but left the
code using the same divisor for the KSZ9021, which is incorrect.

The preceding commit c16e69f702b1 ("net: phy: micrel: add documentation
for Micrel KSZ90x1 binding") added the DTS documentation for the
KSZ90x1, changing it from the equivalent file in the Linux kernel to
correctly state that for this part the skew value is set in 120ps steps,
whereas the Linux documentation and driver continue to this day to use
the incorrect value of 200 that came from the original KSZ9021 datasheet
before it was corrected in revision 1.2 (Feb 2014).

This commit sorts out the resulting confusion in a consistent way by
making the following changes:

- Update the documentation to be clear about what the skew values mean,
in the same was as for the KSZ9031.

- Update the Micrel PHY driver to select the appropriate divisor for
both parts.

- Adjust all the device trees that state skew values for KSZ9021 PHYs to
use values based on 120ps steps instead of 200ps steps. This will result
in the same values being programmed into the skew registers as the
equivalent device trees in the Linux kernel do, where it incorrectly
uses 200ps steps (since that's where all these device trees were copied
from).

Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agonet: phy: aquantia: Set only autoneg on in register 4.c441
Valentin-catalin Neacsu [Wed, 13 Feb 2019 09:14:53 +0000 (09:14 +0000)]
net: phy: aquantia: Set only autoneg on in register 4.c441

For AQR405 in register 4.c441 bit 15 was override with 0. This caused the
phy to not negotiate at 2.5GB rate with mac. To avoid
this override it needed first to know the previous value of reg 4.c441
and set only bit 3.

Signed-off-by: Valentin Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agonet: phy: Fix return value check phy_probe
Siva Durga Prasad Paladugu [Mon, 4 Mar 2019 15:02:11 +0000 (16:02 +0100)]
net: phy: Fix return value check phy_probe

Don't ignore return value of phy_probe() call as
the probe may fail and it needs to be reported.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agonet: phy: Reloc next and prev pointers inside phy_drivers
Siva Durga Prasad Paladugu [Mon, 4 Mar 2019 15:01:30 +0000 (16:01 +0100)]
net: phy: Reloc next and prev pointers inside phy_drivers

This patch relocates the pointers inside phy_drivers incase
of manual reloc. Without this reloc, these points to invalid
pre relocation address and hence causes exception or hang.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agoARM: k2g-ice: Add pinmux support for rgmii interface
Murali Karicheri [Mon, 25 Feb 2019 20:27:34 +0000 (15:27 -0500)]
ARM: k2g-ice: Add pinmux support for rgmii interface

This add pinmux configuration for rgmii interface so that network
driver can be supported on K2G ICE boards. The pinmux configurations
for this are generated using the pinmux tool at
https://dev.ti.com/pinmux/app.html#/default

As this required some BUFFER_CLASS definitions, same is re-used
from the linux defnitions in include/dt-bindings/pinctrl/keystone.h

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agoARM: k2g-gp-evm: update to rgmii pinmux configuration
Murali Karicheri [Mon, 25 Feb 2019 20:27:33 +0000 (15:27 -0500)]
ARM: k2g-gp-evm: update to rgmii pinmux configuration

This patch updates pinmux configuration for K2G GP EVM based on
data generated by the pinmux tool at
https://dev.ti.com/pinmux/app.html#/default

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agodrivers: net: ldpaa_eth: fix resource leak
Pankaj Bansal [Fri, 8 Feb 2019 08:46:11 +0000 (08:46 +0000)]
drivers: net: ldpaa_eth: fix resource leak

if an error occurs in ldpaa_eth_init, need to free all resources
before returning the error.

Threfore, free net_dev before returning from ldpaa_eth_init.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agoMerge branch 'master' of git://git.denx.de/u-boot-sunxi
Tom Rini [Wed, 8 May 2019 20:21:43 +0000 (16:21 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-sunxi

- H6 Beelink GS1 board (ClĂ©ment)
- Olimex A64-Teres-I board (Jonas)
- sunxi build fix for CONFIG_CMD_PXE|DHCP (Ondrej)
- Change include order (Jagan)
- EPHY clock changes (Jagan)
- EMAC enablement on Cubietruck Plus, BPI-M3 (Chen-Yu Tsai)

5 years agosunxi: Enable EMAC on the Bananapi M3
Chen-Yu Tsai [Fri, 3 May 2019 02:27:41 +0000 (10:27 +0800)]
sunxi: Enable EMAC on the Bananapi M3

The Bananapi M3 has an RTL8211E PHY connected to the EMAC using
RGMII. The PHY is powered by DCDC1 through SW @ 3.3V.

The board is designed to use 3.3V with RGMII, instead of the standard
reduced voltage of 2.5V we see everywhere. DLDO3, which provides the
I/O voltages, is raised to match.

This patch enables the EMAC and Realtek PHY drivers in the defconfig.
The device tree file already has the EMAC enabled.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agosunxi: Enable EMAC on the Cubietruck Plus
Chen-Yu Tsai [Fri, 3 May 2019 02:27:40 +0000 (10:27 +0800)]
sunxi: Enable EMAC on the Cubietruck Plus

The Cubietruck Plus has an RTL8211E PHY connected to the EMAC using
RGMII. The PHY is powered by DLDO4 @ 3.3V, while the I/O pins are
powered by DLDO3 @ 2.5V.

This patch enables the EMAC and Realtek PHY drivers in the defconfig.
The device tree file already has the EMAC enabled.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agosun50i: a64: Add Olimex A64-Teres-I board initial support
Jonas Smedegaard [Sat, 20 Apr 2019 10:24:16 +0000 (18:24 +0800)]
sun50i: a64: Add Olimex A64-Teres-I board initial support

Olimex A64-Teres-I board is a mainboard (the only one so far)
for Olimex Teres-I DIY laptop kit.

Key features:
- Allwinner A64 Cortex-A53
- Mali-400MP2 GPU
- AXP803 PMIC
- 2GB DDR3 RAM
- MicroSD Slot
- 16GB eMMC Flash
- eDP LCD display
- HDMI
- USB Host
- Battery management
- 5V DC power supply
- Certified Open Source Hardware (OSHW)

Works:
- i2C
- MMC/SD
- PWM backlight

Known broken:
- Internal keyboard (seems to be because the keyboard firmware loads a
bootloader first, and then disconnects bootloader and connect real
keyboard). External ones connected to the USB port work fine.

This patch enables support for the A64-Teres-I board to u-boot,
including enabling screen backlight (lacking from Linux device-tree).

Linux commit details about the sun50i-a64-teres-i.dts sync:
"arm64: dts: allwinner: a64: Rename uart0_pins_a label to uart0_pb_pins"
(sha1: d91ebb95b96c8840932dc3a10c9f243712555467)

Cosmetic warnings regarding whitespace and placement of SPDX notice for
dts file was ignored.

config and .dtsi file are adapted from pinebook files.

Tested-by: Jonas Smedegaard <dr@jones.dk>
Signed-off-by: Jonas Smedegaard <dr@jones.dk>
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
[jagan: move board entry in MAINTAINERS file at proper position]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agonet: sun8i_emac: Add EPHY CLK and RESET support
Jagan Teki [Wed, 27 Feb 2019 18:57:00 +0000 (00:27 +0530)]
net: sun8i_emac: Add EPHY CLK and RESET support

Add EPHY CLK and RESET support for sun8i_emac driver to
enable EPHY TX clock and EPHY reset pins via CLK and RESET
framework.

Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Lothar Felten <lothar.felten@gmail.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agotest/dm: reset: Add reset_get_by_index[_nodev] test
Jagan Teki [Wed, 27 Feb 2019 18:56:56 +0000 (00:26 +0530)]
test/dm: reset: Add reset_get_by_index[_nodev] test

Add sample dm reset test for reset_get_by_index and
reset_get_by_index_nodev functionality code.

Cc: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoreset: Get the RESET by index without device
Jagan Teki [Wed, 27 Feb 2019 18:56:55 +0000 (00:26 +0530)]
reset: Get the RESET by index without device

Getting a RESET by index with device is not straight forward
for some use-cases like handling clock operations for child
node in parent driver. So we need to process the child node
in parent probe via ofnode and process RESET operation for child
without udevice but with ofnode.

So add reset_get_by_index_nodev() and move the common code
in reset_get_by_index_tail() to use for reset_get_by_index()

Cc: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agotest/dm: clk: Add clk_get_by_index[_nodev] test
Jagan Teki [Tue, 5 Mar 2019 14:12:44 +0000 (19:42 +0530)]
test/dm: clk: Add clk_get_by_index[_nodev] test

Add sample dm clk test for clk_get_by_index and
clk_get_by_index_nodev functionality code.

Cc: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoclk: Use clk_get_by_index_tail()
Jagan Teki [Wed, 27 Feb 2019 18:56:53 +0000 (00:26 +0530)]
clk: Use clk_get_by_index_tail()

clk_get_by_index_tail() now handle common clk get by index
code so use it from clk_get_by_indexed_prop().

Cc: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agoclk: Get the CLK by index without device
Jagan Teki [Wed, 27 Feb 2019 18:56:52 +0000 (00:26 +0530)]
clk: Get the CLK by index without device

Getting a CLK by index with device is not straight forward
for some use-cases like handling clock operations for child
node in parent driver. So we need to process the child node
in parent probe via ofnode and process CLK operation for child
without udevice but with ofnode.

So add clk_get_by_index_nodev() and move the common code
in clk_get_by_index_tail() to use for clk_get_by_index()

Cc: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoserial: sifive: Change include order
Jagan Teki [Wed, 8 May 2019 14:26:16 +0000 (19:56 +0530)]
serial: sifive: Change include order

Like clk_get_by_index, there is requirement for
clk_get_by_index_nodev. In this case to make common
code functionalities for dev and nodev, clk_get_by_index
is trying to get the index of clock by passing ofnode
instead of actual dev like current gpio uclass does.

In these scenarios with current order of include files
the serial_sifive driver is unable to find CONFIG_ENV_SIZE.

In file included from arch/riscv/include/asm/u-boot.h:23:0,
                 from include/dm/of.h:10,
                 from include/dm/ofnode.h:12,
                 from include/clk.h:11,
                 from drivers/serial/serial_sifive.c:6:
include/environment.h:145:19: error: 'CONFIG_ENV_SIZE'
undeclared here (not in a function); did you mean 'CONFIG_CMD_XIMG'?
 #define ENV_SIZE (CONFIG_ENV_SIZE - ENV_HEADER_SIZE)

So, fix consists of changing the order of include files
in serial_sifive.c to include first common.h file.

Cc: Anup Patel <Anup.Patel@wdc.com>
Cc: Rick Chen <rick@andestech.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agoclk: sifive: fu540-prci: Change include order
Jagan Teki [Wed, 8 May 2019 14:22:18 +0000 (19:52 +0530)]
clk: sifive: fu540-prci: Change include order

Like clk_get_by_index, there is requirement for
clk_get_by_index_nodev. In this case to make common
code functionalities for dev and nodev, clk_get_by_index
is trying to get the index of clock by passing ofnode
instead of actual dev like current gpio uclass does.

In these scenarios with current order of include files
the fu540-prci driver is unable to find CONFIG_ENV_SIZE.

In file included from arch/riscv/include/asm/u-boot.h:23:0,
                 from include/dm/of.h:10,
                 from include/dm/ofnode.h:12,
                 from include/clk.h:11,
                 from include/clk-uclass.h:13,
                 from drivers/clk/sifive/fu540-prci.c:32:
include/environment.h:145:19: error: 'CONFIG_ENV_SIZE'
undeclared here (not in a function); did you mean 'CONFIG_CMD_XIMG'?
 #define ENV_SIZE (CONFIG_ENV_SIZE - ENV_HEADER_SIZE)

So, fix consists of changing the order of include files
in fu540-prci.c to include first common.h file.

Cc: Anup Patel <Anup.Patel@wdc.com>
Cc: Rick Chen <rick@andestech.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agospi: atcspi200: Change include order
Jagan Teki [Wed, 8 May 2019 14:12:16 +0000 (19:42 +0530)]
spi: atcspi200: Change include order

Like clk_get_by_index, there is requirement for
clk_get_by_index_nodev. In this case to make common
code functionalities for dev and nodev, clk_get_by_index
is trying to get the index of clock by passing ofnode
instead of actual dev like current gpio uclass does.

In these scenarios with current order of include files
the atcspi200_spi driver is unable to find CONFIG_ENV_SIZE.

In file included from arch/nds32/include/asm/u-boot.h:24,
                 from include/dm/of.h:10,
                 from include/dm/ofnode.h:12,
                 from include/clk.h:11,
                 from drivers/spi/atcspi200_spi.c:9:
include/environment.h:145:19: error: 'CONFIG_ENV_SIZE'
undeclared here (not in a function); did you mean 'CONFIG_CMD_XIMG'?
 #define ENV_SIZE (CONFIG_ENV_SIZE - ENV_HEADER_SIZE)

So, fix consists of changing the order of include files
in atcspi200_spi.c to include first common.h file.

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agoMerge git://git.denx.de/u-boot-x86
Tom Rini [Wed, 8 May 2019 13:20:19 +0000 (09:20 -0400)]
Merge git://git.denx.de/u-boot-x86

- Allow x86 boards to use TPL, SPL and U-Boot proper
- Update sysreset x86 driver to utilize ACPI registers to do power off
- Add a new chromebook_samus_tpl board for TPL support
- Several minor changes in binman tool

5 years agoMerge tag 'efi-2019-07-rc2-2' of git://git.denx.de/u-boot-efi
Tom Rini [Wed, 8 May 2019 13:20:04 +0000 (09:20 -0400)]
Merge tag 'efi-2019-07-rc2-2' of git://git.denx.de/u-boot-efi

Pull request for UEFI sub-system for v2019.07-rc2 (2)

Fix a bunch of errors in the UEFI sub-system:

* implement missing UnloadImage(),
* implement missing RegisterProtocolNotify(),
* unload images in Exit(),
* parameter checks.

Provide a unit test for UnloadImage().
Remove a redundant function for unit tests.
Clean up the UEFI sub-system initialization

5 years agorockchip: dts: rk3399: Sync rk3399-nanopi4.dtsi from Linux
Jagan Teki [Wed, 8 May 2019 05:41:44 +0000 (11:11 +0530)]
rockchip: dts: rk3399: Sync rk3399-nanopi4.dtsi from Linux

Sync rk3399-nanopi4.dtsi from Linux 5.1-rc2 tag.

Linux commit details about the rk3399-nanopi4.dtsi sync:
"arm64: dts: rockchip: Add nanopi4 bluetooth"
(sha1: 3e2f0bb72be36aa6c14ee7f11ac4dd8014801030)

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
5 years agoarm: rockchip: rk3399: Move common configs in Kconfig
Jagan Teki [Wed, 8 May 2019 05:41:43 +0000 (11:11 +0530)]
arm: rockchip: rk3399: Move common configs in Kconfig

Few SPL and U-Boot proper configs are common to all rk3399 target
defconfigs, move them and select it from platform kconfig.

Moved configs:
-  SPL_ATF
-  SPL_ATF_NO_PLATFORM_PARAM if SPL_ATF
-  SPL_LOAD_FIT
-  SPL_CLK if SPL
-  SPL_PINCTRL if SPL
-  SPL_RAM if SPL
-  SPL_REGMAP if SPL
-  SPL_SYSCON if SPL
-  CLK
-  FIT
-  PINCTRL
-  RAM
-  REGMAP
-  SYSCON
-  DM_PMIC
-  DM_REGULATOR_FIXED

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
5 years agoKconfig: Add default SPL_FIT_GENERATOR for rockchip
Jagan Teki [Wed, 8 May 2019 05:41:42 +0000 (11:11 +0530)]
Kconfig: Add default SPL_FIT_GENERATOR for rockchip

Add default SPL_FIT_GENERATOR py script for rockchip platforms if
specific target enabled SPL_LOAD_FIT.

So, this would help get rid of explicitly mentioning the default
SPL FIT generator in defconfigs. however some targets, like puma_rk3399
still require their own FIT generator so in those cases the default will
override with defconfig defined generator.

Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: dts: rk3399: Sync pwm2_pin_pull_down from Linux 5.1-rc2
Jagan Teki [Wed, 8 May 2019 05:41:41 +0000 (11:11 +0530)]
rockchip: dts: rk3399: Sync pwm2_pin_pull_down from Linux 5.1-rc2

To make successful build with dts(i) files syncing from Linux 5.1-rc2
the rk3399.dtsi would require pwm2_pin_pull_down.

So, sync the pwm2_pin_pull_down node from Linux 5.1-rc2.  Since this
node is strictly not part of any commit alone, I have mentioned
Linux 5.1-rc2 tag for future reference of where would this sync
coming from.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3399: orangepi: Add SPL_TEXT_BASE
Jagan Teki [Tue, 7 May 2019 18:24:40 +0000 (23:54 +0530)]
rockchip: rk3399: orangepi: Add SPL_TEXT_BASE

CONFIG_SPL_TEXT_BASE was available in configs/rk3399_common.h
when the OrangePI rk3399 board supported during first
version patch.

But, later below change which move this config into Kconfig and
same has been merged in mainline tree.
"configs: move CONFIG_SPL_TEXT_BASE to Kconfig"
(sha1: f89d6133eef2e068f9c33853b6584d7fcbfa9d2e)

Unfortunately, the maintainer applied the initial version patch,
instead of looking for next version changes.

Fix it by adding SPL_TEXT_BASE in orangepi-rk3399 defconfig.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
5 years agoarm64: rockchip: dts: rk3399: Use rk3399-u-boot.dtsi
Jagan Teki [Tue, 7 May 2019 18:21:52 +0000 (23:51 +0530)]
arm64: rockchip: dts: rk3399: Use rk3399-u-boot.dtsi

Now we have
- board specific -u-boot.dtsi files for board specific u-boot
  dts changes.
- soc specific rk3399-u-boot.dtsi for soc specific u-boot
  dts changes.

So, include the rk3399-u-boot-dtsi on respective board -u-boot.dtsi
and drop the properties which are globally available in rk3399-u-boot.dtsi

Right now rk3399-u-boot.dtsi has sdmmc, spi1 u-boot,dm-pre-reloc
property and more properties and nodes can be move further based
on the requirements.

This would fix, the -u-boot.dtsi inclusion for evb, firefly, puma
boards that was accidentally merged on below commit.
"rockchip: dts: rk3399: Create initial rk3399-u-boot.dtsi"
(sha1: e05b4a4fa84b65a0c8873e8f34721741fe2bc09d)

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: dts: rk3399-u-boot: Add u-boot, dm-pre-reloc for spi1
Jagan Teki [Tue, 7 May 2019 18:21:51 +0000 (23:51 +0530)]
rockchip: dts: rk3399-u-boot: Add u-boot, dm-pre-reloc for spi1

Add u-boot,dm-pre-reloc property for spi1, so-that the
subsequent rk3399 boards which boot from SPI.

This help to separate the u-boot specific properties away
from base dts files so-that the Linux sync become easy and
meaningful.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
5 years agoarm64: rockchip: dts: rk3399: Add board -u-boot.dtsi files
Jagan Teki [Tue, 7 May 2019 18:21:50 +0000 (23:51 +0530)]
arm64: rockchip: dts: rk3399: Add board -u-boot.dtsi files

Devicetree files in RK3399 platform is synced from Linux, like other
platforms does. Apart from these u-boot in rk3399 would also require
some u-boot specific node like dmc.

dmc node has big chunk of DDR timing parameters which are specific
to specific board, and maintained with rk3399-sdram*.dtsi.

So, create board specific -u-boot.dtsi files and move these sdram dtsi
files accordingly. This would help of maintain u-boot specific changes
separately without touching Linux dts(i) files which indeed easy for
syncing from Linux between releases.

These board specific -u-boot.dtsi can be extendible to add more u-boot
specific nodes or properties in future.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
5 years agodts: Makefile: Build rockchip dtbs based on SoC types
Jagan Teki [Tue, 7 May 2019 18:21:49 +0000 (23:51 +0530)]
dts: Makefile: Build rockchip dtbs based on SoC types

- Sometimes u-boot specific dtsi files are included
  automatically which would build for entire rockchip SoC,
  even-though the respective dtsi should used it for specific
  family of rockchip SoC.
- Sometimes u-boot specific dts nodes or properties can use
  config macros from respective rockchip family include/configs
  files, example CONFIG_SPL_PAD_TO.

So, it's better to compile the dtbs based on the respective
rockchip family types rather than rockchip itself to avoid
compilation issues.

This patch organize the existing dtb's based on the rockchip
family types.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
5 years agopinctrl: rockchip: Also move common set_schmitter func into per Soc file
David Wu [Tue, 16 Apr 2019 13:58:13 +0000 (21:58 +0800)]
pinctrl: rockchip: Also move common set_schmitter func into per Soc file

Only some Soc need Schmitter feature, so move the
implementation into their own files.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agopinctrl: rockchip: Clean the unused type and label
David Wu [Tue, 16 Apr 2019 13:57:54 +0000 (21:57 +0800)]
pinctrl: rockchip: Clean the unused type and label

As the mux/pull/drive feature implement at own file,
the type and label are not necessary.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agopinctrl: rockchip: Special treatment for RK3288 gpio0 pins' pull
David Wu [Tue, 16 Apr 2019 13:57:28 +0000 (21:57 +0800)]
pinctrl: rockchip: Special treatment for RK3288 gpio0 pins' pull

RK3288 pmu_gpio0 pull setting have no higher 16 writing corresponding
bits, need to read before write the register.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agopinctrl: rockchip: Split the common set_pull() func into per Soc
David Wu [Tue, 16 Apr 2019 13:57:05 +0000 (21:57 +0800)]
pinctrl: rockchip: Split the common set_pull() func into per Soc

As the common set_mux func(), implement the feature at the own file
for each Soc.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agopinctrl: rockchip: Special treatment for RK3288 gpio0 pins' drive strength
David Wu [Tue, 16 Apr 2019 13:56:34 +0000 (21:56 +0800)]
pinctrl: rockchip: Special treatment for RK3288 gpio0 pins' drive strength

RK3288 pmu_gpio0 drive strength setting have no higher 16 writing
corresponding bits, need to read before write the register.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agopinctrl: rockchip: Split the common set_drive() func into per Soc
David Wu [Tue, 16 Apr 2019 13:55:26 +0000 (21:55 +0800)]
pinctrl: rockchip: Split the common set_drive() func into per Soc

As the common set_mux func(), implement the feature at the own file
for each Soc.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agopinctrl: rockchip: Special treatment for RK3288 gpio0 pins' iomux
David Wu [Tue, 16 Apr 2019 13:50:56 +0000 (21:50 +0800)]
pinctrl: rockchip: Special treatment for RK3288 gpio0 pins' iomux

RK3288 pmu_gpio0 iomux setting have no higher 16 writing corresponding
bits, need to read before write the register.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agopinctrl: rockchip: Split the common set_mux() into per Soc
David Wu [Tue, 16 Apr 2019 13:50:55 +0000 (21:50 +0800)]
pinctrl: rockchip: Split the common set_mux() into per Soc

Such as rk3288's pins of pmu_gpio0 are a special feature, which have no
higher 16 writing corresponding bits, use common set_mux() func would
introduce more code, so implement their set_mux() in each Soc's own
file to reduce the size of code.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agopinctrl: rockchip: Remove redundant spaces
David Wu [Tue, 16 Apr 2019 13:50:54 +0000 (21:50 +0800)]
pinctrl: rockchip: Remove redundant spaces

Some files have the redundant spaces, remove them.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agopinctrl: rockchip: Add pull-pin-default param and remove unused param
David Wu [Tue, 16 Apr 2019 13:50:53 +0000 (21:50 +0800)]
pinctrl: rockchip: Add pull-pin-default param and remove unused param

Some Socs use the pull-pin-default config param, need to add it.
And input-enable/disable config params are not necessary, remove it.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agoRevert "pinctrl: rockchip: Add 32bit writing function for rk3288 gpio0 pinctrl"
Kever Yang [Tue, 7 May 2019 01:36:32 +0000 (09:36 +0800)]
Revert "pinctrl: rockchip: Add 32bit writing function for rk3288 gpio0 pinctrl"

This reverts commit 502980914b2d6f9ee85a823aa3ef9ead76c0b7f2.
This is a superseded version, revert this to apply new patch set.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: chromebook_minnie: Enable sound
Simon Glass [Sat, 27 Apr 2019 01:03:39 +0000 (19:03 -0600)]
rockchip: chromebook_minnie: Enable sound

Enable sound for this board, which has the same codec as jerry.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3399: update defconfig for TPL
Kever Yang [Fri, 9 Nov 2018 03:21:38 +0000 (11:21 +0800)]
rockchip: rk3399: update defconfig for TPL

The SPL is now running at SDRAM, and 0x10000 is used by BL31,
and the ARM SPL do not support relocate now, we need reserved
0x50000 so that it won't overwrite the code when we load the
bl31 to target space.
We should remove this after we enable the relocate feature.

The SPL need malloc 0x9000 for MMC as buffer used for transfer
data to IRAM(The EMMC DMA can not transfer data to IRAM directly).

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: ram: rk3399: update for TPL
Kever Yang [Mon, 1 Apr 2019 09:20:53 +0000 (17:20 +0800)]
rockchip: ram: rk3399: update for TPL

Init the ddr sdram in TPL instead of SPL, update the code.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Andy Yan <andy.yan@rock-chips.com>
5 years agorockchip: rk3399: add tpl support
Kever Yang [Fri, 9 Nov 2018 03:18:15 +0000 (11:18 +0800)]
rockchip: rk3399: add tpl support

Rockchip platform suppose to use TPL(run in SRAM) as dram init and
SPL(run in DDR SDRAM) as pre-loader, so that the SPL would not be
limited by SRAM size.
This patch add rk3399-board-tpl.c and its common configs.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: add u-boot-tpl-v8.lds
Kever Yang [Mon, 1 Apr 2019 09:15:53 +0000 (17:15 +0800)]
rockchip: add u-boot-tpl-v8.lds

We don't have both sram and sdram in TPL, so update from:
arch/arm/cpu/armv8/u-boot-spl.lds

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agorockchip: px5: add timer0 dts node as tick timer
Kever Yang [Fri, 29 Mar 2019 14:48:31 +0000 (22:48 +0800)]
rockchip: px5: add timer0 dts node as tick timer

Let's use rockchip timer before stimer patches can be merged.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3368: remove uart iomux init in SPL
Kever Yang [Fri, 29 Mar 2019 14:48:30 +0000 (22:48 +0800)]
rockchip: rk3368: remove uart iomux init in SPL

The iomux should have been set in board_debug_uart_init(),
do not set in board_init_f(), remove it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: dmc: rk3368: update rank number for evb-px5
Kever Yang [Fri, 29 Mar 2019 14:48:29 +0000 (22:48 +0800)]
rockchip: dmc: rk3368: update rank number for evb-px5

evb-px5 has only 1 CS, update for it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Andy Yan <andy.yan@rock-chips.com>
5 years agorockchip: boot0: update CONFIG_ROCKCHIP_SPL_RESERVE_IRAM for SPL only
Kever Yang [Fri, 29 Mar 2019 14:48:28 +0000 (22:48 +0800)]
rockchip: boot0: update CONFIG_ROCKCHIP_SPL_RESERVE_IRAM for SPL only

The CONFIG_ROCKCHIP_SPL_RESERVE_IRAM is for SPL only, add
condition to limit it not affect TPL.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: px5: update defconfig for TPL/SPL
Kever Yang [Tue, 12 Feb 2019 07:19:07 +0000 (15:19 +0800)]
rockchip: px5: update defconfig for TPL/SPL

Add options to support TPL.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: px5: update SPL size for spl/tpl
Kever Yang [Fri, 29 Mar 2019 14:48:26 +0000 (22:48 +0800)]
rockchip: px5: update SPL size for spl/tpl

Use larger space for load bl31 in SPL

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Andy Yan <andy.yan@rock-chips.com>
5 years agorockchip: px5 update dts for spl/tpl
Kever Yang [Fri, 29 Mar 2019 14:48:25 +0000 (22:48 +0800)]
rockchip: px5 update dts for spl/tpl

TPL need dmc to init ddr sdram, and emmc, boot-order.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Andy Yan <andy.yan@rock-chips.com>
5 years agorockchip: rk3368: support UART2/4 in board_debug_uart_init()
Kever Yang [Fri, 29 Mar 2019 14:48:24 +0000 (22:48 +0800)]
rockchip: rk3368: support UART2/4 in board_debug_uart_init()

evb-rk3368 is using UART2 and PX5 evb is using UART4

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Andy Yan <andy.yan@rock-chips.com>
5 years agorockchip: evb-rk322x: update defconfig with tpl and optee support
Kever Yang [Wed, 6 Sep 2017 01:33:22 +0000 (09:33 +0800)]
rockchip: evb-rk322x: update defconfig with tpl and optee support

Enable all the options for TPL/SPL and OPTEE.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: evb-rk3229: add README file for OP-TEE support
Kever Yang [Tue, 2 Apr 2019 12:41:28 +0000 (20:41 +0800)]
rockchip: evb-rk3229: add README file for OP-TEE support

Detail of step by step to bring up the board with OP-TEE support.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: evb-rk3229: remove unnecessary defines
Kever Yang [Tue, 2 Apr 2019 12:41:27 +0000 (20:41 +0800)]
rockchip: evb-rk3229: remove unnecessary defines

Prefer to use default setting like other SoCs.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk322x: dts: enable uart2 for SPL/TPL
Kever Yang [Tue, 2 Apr 2019 12:41:26 +0000 (20:41 +0800)]
rockchip: rk322x: dts: enable uart2 for SPL/TPL

When we use DM_SERIAL for serial driver, we need enable the
dts node for the debug console.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agosysreset: enable driver support in SPL/TPL
Kever Yang [Tue, 2 Apr 2019 12:41:25 +0000 (20:41 +0800)]
sysreset: enable driver support in SPL/TPL

SPL/TPL also need use sysreset for some feature like panic callback.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk322x: add tpl support
Kever Yang [Tue, 2 Apr 2019 12:41:24 +0000 (20:41 +0800)]
rockchip: rk322x: add tpl support

Move original spl to tpl, and add spl to load next stage firmware,
adapt all the address and option for them.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: clk: rk322x: fix assert clock value
Kever Yang [Tue, 2 Apr 2019 12:41:23 +0000 (20:41 +0800)]
rockchip: clk: rk322x: fix assert clock value

BUS_PCLK_HZ and BUS_HCLK_HZ are from BUS_ACLK_HZ, not from GPLL_HZ.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk322x: add CLK_EMMC_SAMPLE clock support
Kever Yang [Tue, 2 Apr 2019 12:41:22 +0000 (20:41 +0800)]
rockchip: rk322x: add CLK_EMMC_SAMPLE clock support

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agoarm: add a separate stack for TPL
Kever Yang [Tue, 2 Apr 2019 12:41:21 +0000 (20:41 +0800)]
arm: add a separate stack for TPL

TPL stack may different from SPL and sys stack, add support for
separate one when the board defines it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agoarm: add option for TPL support in arm 32bit
Kever Yang [Tue, 2 Apr 2019 12:41:20 +0000 (20:41 +0800)]
arm: add option for TPL support in arm 32bit

Some options like TPL_SYS_THUMB_BUILD, TPL_USE_ARCH_MEMCPY
and TPL_USE_ARCH_MEMCPY are needed for TPL build in 32bit arm.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agoRevert "rockchip: rk322x: ram: enable DRAM init in SPL instead of TPL"
Kever Yang [Tue, 2 Apr 2019 12:41:19 +0000 (20:41 +0800)]
Revert "rockchip: rk322x: ram: enable DRAM init in SPL instead of TPL"

This reverts commit f338cca1d2bce906b049722d2fdbf527a4963b61.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agoarm: remove ARCH_ROCKCHIP macro in common code
Kever Yang [Mon, 6 May 2019 03:21:13 +0000 (11:21 +0800)]
arm: remove ARCH_ROCKCHIP macro in common code

This is fix to:
e2a12f590d rockchip: use 'arch-rockchip' as header file path

The V2 of origin patch set has fix this, but we merge V1 by
mistake, so lets correct it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: add common header boot0.h and gpio.h for soc
Kever Yang [Mon, 6 May 2019 03:21:12 +0000 (11:21 +0800)]
rockchip: add common header boot0.h and gpio.h for soc

boot0.h and gpio.h will be used by system and include by
'asm/arch/', each of them need of a copy from 'asm/arch-rockchip'.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agox86: samus: Add a target to boot through TPL
Simon Glass [Wed, 8 May 2019 03:41:16 +0000 (21:41 -0600)]
x86: samus: Add a target to boot through TPL

Add a version of samus which supports booting from TPL to SPL and then
to U-Boot. This allows TPL to select from an A or B SPL to support
verified boot with field upgrade.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: samus: Update device tree for verified boot
Simon Glass [Wed, 8 May 2019 03:41:14 +0000 (21:41 -0600)]
x86: samus: Update device tree for verified boot

Add nvdata drivers for the TPM and RTC as used on samus. These are needed
for Chromium OS verified boot on samus.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: samus: Update device tree for SPL
Simon Glass [Wed, 8 May 2019 03:41:13 +0000 (21:41 -0600)]
x86: samus: Update device tree for SPL

Add tags to allow required nodes to be present in SPL / TPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Add a simple TPL implementation
Simon Glass [Thu, 2 May 2019 16:52:12 +0000 (10:52 -0600)]
x86: Add a simple TPL implementation

Add the required CPU code so that TPL builds correctly. Also update the
SPL code to deal with being booted from TPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Add a way to jump from TPL to SPL
Simon Glass [Thu, 2 May 2019 16:52:27 +0000 (10:52 -0600)]
x86: Add a way to jump from TPL to SPL

When TPL finishes it needs to jump to SPL with the stack set up correctly.
Add a function to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: samus: Increase the pre-reloc memory again
Simon Glass [Thu, 2 May 2019 16:52:22 +0000 (10:52 -0600)]
x86: samus: Increase the pre-reloc memory again

This is again too small, so increase it slightly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: broadwell: Update PCH to work in TPL
Simon Glass [Thu, 2 May 2019 16:52:26 +0000 (10:52 -0600)]
x86: broadwell: Update PCH to work in TPL

The early init should only happen once. Update the probe method to
deal with TPL, SPL and U-Boot proper.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Enable the RTC on all boards
Simon Glass [Thu, 2 May 2019 16:52:24 +0000 (10:52 -0600)]
x86: Enable the RTC on all boards

With the move to Kconfig this option should be set in Kconfig, not in the
config header file. Move it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Fix device-tree indentation
Simon Glass [Thu, 2 May 2019 16:52:21 +0000 (10:52 -0600)]
x86: Fix device-tree indentation

With the use of a phandle we can outdent the device tree nodes a little.
Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Update device tree for Chromium OS verified boot
Simon Glass [Thu, 2 May 2019 16:52:20 +0000 (10:52 -0600)]
x86: Update device tree for Chromium OS verified boot

The standard image generated by U-Boot on x86 is u-boot.rom. Add a
separate image called image.bin for verified boot. This supports
verification in TPL of which SPL/U-Boot to start, then jumping to the
correct one, with SPL setting up the SDRAM and U-Boot proper providing
the user interface if needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Update device tree for TPL
Simon Glass [Thu, 2 May 2019 16:52:19 +0000 (10:52 -0600)]
x86: Update device tree for TPL

Add TPL binaries to the device x86 binman desciption. When enabled, TPL
will start first, doing the 16-bit init, then jump to SPL and finally
U-Boot proper.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Add documentation on the samus flashmap
Simon Glass [Thu, 2 May 2019 16:52:16 +0000 (10:52 -0600)]
x86: Add documentation on the samus flashmap

There are quite a few variables which control where things appear in the
final ROM image. Add a flashmap in the documentation to make this easier
to figure out.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed "x86: Update the memory map a little" in]
[bmeng: fixed typo of 'documentation' in the commit title]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Support PCI VGA ROM when TPL is used
Simon Glass [Fri, 26 Apr 2019 03:59:08 +0000 (21:59 -0600)]
x86: Support PCI VGA ROM when TPL is used

When TPL is in use, U-Boot proper should support initing the VGA ROM even
though the 32-bit init portion is in SPL. Update the condition to handle
this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Don't generate a bootstage report in SPL
Simon Glass [Fri, 26 Apr 2019 03:59:07 +0000 (21:59 -0600)]
x86: Don't generate a bootstage report in SPL

This report is normally generated by U-Boot proper. Correct the condition
here so that it respects the Kconfig options for bootstage.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Don't set up MTRRs in SPL
Simon Glass [Fri, 26 Apr 2019 03:59:06 +0000 (21:59 -0600)]
x86: Don't set up MTRRs in SPL

The MTRRs are normally set up in U-Boot proper, so avoid setting them up
in SPL as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Support TPL in Intel common code
Simon Glass [Fri, 26 Apr 2019 03:59:05 +0000 (21:59 -0600)]
x86: Support TPL in Intel common code

Update the Makefie rules to ensure that the correct files are built when
TPL is being used.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: sysreset: Implement the get_last() method
Simon Glass [Thu, 2 May 2019 16:52:15 +0000 (10:52 -0600)]
x86: sysreset: Implement the get_last() method

Add a default implementation of this method which always indicates that
the last reset was a power-on reset. This is the most likely type of reset
and without a PCH-specific driver we cannot determine any other type.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: sysreset: Implement power-off if available
Simon Glass [Thu, 2 May 2019 16:52:14 +0000 (10:52 -0600)]
x86: sysreset: Implement power-off if available

On modern x86 devices we can power the system off using the power-
management features of the PCH. Add an implementation for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: sysreset: Separate out the EFI code
Simon Glass [Thu, 2 May 2019 16:52:13 +0000 (10:52 -0600)]
x86: sysreset: Separate out the EFI code

The EFI implementation of reset sits inside the driver and is called
directly from outside the driver, breaking the normal driver-model
conventions. Worse, it passed NULL as the device pointer, hoping that
the called function won't use it, which breaks as soon as code is added
to use it.

Separate out the implementation to improve the situation enough to allow
a future patch to add new sysreset features.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: broadwell: Implement PCH_REQ_PMBASE_INFO
Simon Glass [Fri, 26 Apr 2019 03:59:03 +0000 (21:59 -0600)]
x86: broadwell: Implement PCH_REQ_PMBASE_INFO

Implement this ioctl() to support power off.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: ivybridge: Implement PCH_REQ_PMBASE_INFO
Simon Glass [Fri, 26 Apr 2019 03:59:02 +0000 (21:59 -0600)]
x86: ivybridge: Implement PCH_REQ_PMBASE_INFO

Implement this ioctl() to support power off.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: pch: Add an ioctl to read power-management info
Simon Glass [Fri, 26 Apr 2019 03:59:01 +0000 (21:59 -0600)]
x86: pch: Add an ioctl to read power-management info

Add a new ioctl() request to read information about the power-management
system. This can be used to power off the device.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>