]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
5 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Tue, 8 Oct 2019 22:45:26 +0000 (18:45 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86

- Rename existing FSP code to fsp1
- Add fsp2 directory in preparation to support FSP 2.0
- Various x86 platform codes update
- Various bug fixes and updates in dm core, sandbox and spl

5 years agoMerge tag 'u-boot-atmel-2020.01-a' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Tue, 8 Oct 2019 22:43:56 +0000 (18:43 -0400)]
Merge tag 'u-boot-atmel-2020.01-a' of https://gitlab.denx.de/u-boot/custodians/u-boot-atmel

First set of u-boot-atmel features and fixes for 2020.01 cycle

The feature set includes support for two new boards from Microchip AT91:
The sama5d27_wlsom1_ek , an evaluation kit which includes the SAMA5D2
SOC packaged in a 256 MB LPDDR2 SIP, on a SOM including wireless, which
is placed on evaluation kit with sd-card, ethernet, LCD, Camera sensor,
QSPI, etc
The sam9x60ek, an evaluation kit for the new SoC based on ARM926j , the
SAM9X60 . The evaluation kit includes NAND flash, QSPI, Ethernet, Audio,
Camera sensor connector, etc.
The full support for sam9x60ek will come at a later time. There are
still missing bits regarding the clock support and power management
controller.

5 years agoMerge tag 'efi-2020-01-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Tue, 8 Oct 2019 22:43:37 +0000 (18:43 -0400)]
Merge tag 'efi-2020-01-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-01-rc1

The major corrections in this pull request are:

Fixes for the SetVariable() boot service.
Device path node for NVMe drives.
Disable CONFIG_CMD_NVEDIT by default.

5 years agoMerge branch '2019-10-08-master-imports'
Tom Rini [Tue, 8 Oct 2019 22:37:19 +0000 (18:37 -0400)]
Merge branch '2019-10-08-master-imports'

- Python3 conversion of genboardscfg.py
- Resync Kconfiglib.py
- Switch to running CI on Ubuntu "bionic" to facilitate Python 3.6 being
  the minimum we use and test.

5 years agotravis.yml: Switch to bionic for the host distribution
Tom Rini [Tue, 8 Oct 2019 12:39:26 +0000 (08:39 -0400)]
travis.yml: Switch to bionic for the host distribution

To match what we're doing in GitLab, move to 'bionic' for these builds
as well.

Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agogitlab-ci: Switch to Ubuntu 18.04 image
Tom Rini [Fri, 4 Oct 2019 16:12:54 +0000 (12:12 -0400)]
gitlab-ci: Switch to Ubuntu 18.04 image

In order to run all filesystem tests we need to have newer ext4 tools,
move up to Ubuntu 18.04 'bionic' for our base.  We need to change
slightly how we invoke the provided grub-mkimage.  This will also make
future python3 work easier.

Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agogitlab-ci: Have buildman use /tmp for output
Tom Rini [Fri, 4 Oct 2019 16:12:53 +0000 (12:12 -0400)]
gitlab-ci: Have buildman use /tmp for output

When running as another user we might not be able to use '..' for
certain directories and this is the default for buildman.  Specify an
output directory instead.

Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agobuildman: Perform tests in a temporary directory
Tom Rini [Mon, 7 Oct 2019 21:17:36 +0000 (17:17 -0400)]
buildman: Perform tests in a temporary directory

We may not always be able to write to the default output directory so
have a temporary directory for our output be created.

Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Stephen Warren <swarren@wwwdotorg.org>
Suggested-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agokconfiglib: Update to the 12.14.0 release
Tom Rini [Fri, 20 Sep 2019 21:42:09 +0000 (17:42 -0400)]
kconfiglib: Update to the 12.14.0 release

A large number of changes have happened upstream since our last sync
which was to 375506d.  The reason to do the upgrade at this point is for
improved Python 3 support.

As part of this upgrade we need to update moveconfig.py and
genboardscfg.py the current API.  This is:
- Change "kconfiglib.Config" calls to "kconfiglib.Kconfig"
- Change get_symbol() calls to syms.get().
- Change get_value() to str_value.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agogenboardscfg.py: Remove "warnings" print section
Tom Rini [Fri, 20 Sep 2019 21:42:08 +0000 (17:42 -0400)]
genboardscfg.py: Remove "warnings" print section

We tell kconfiglib to not print any warnings to us so drop this code as
it will be unused.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agogenboardscfg.py: Convert to Python 3
Tom Rini [Fri, 20 Sep 2019 21:42:07 +0000 (17:42 -0400)]
genboardscfg.py: Convert to Python 3

Convert this tool to requiring Python 3.  The bulk of this is done with
the 2to3 tool In addition, we need to use the '//' operator to have our
division result return an int rather than a float and ensure that we use
UTF-8 when reading/writing files.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agoconfigs: sam9x60ek: enable onewire support
Eugen Hristev [Mon, 30 Sep 2019 07:29:02 +0000 (07:29 +0000)]
configs: sam9x60ek: enable onewire support

Enable support for onewire memories and onewire commands.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoboard: atmel: sam9x60ek: add support for PDA detection
Eugen Hristev [Mon, 30 Sep 2019 07:29:01 +0000 (07:29 +0000)]
board: atmel: sam9x60ek: add support for PDA detection

Automatically detect PDA at boot.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoARM: dts: at91: sam9x60ek: add onewire support
Eugen Hristev [Mon, 30 Sep 2019 07:28:59 +0000 (07:28 +0000)]
ARM: dts: at91: sam9x60ek: add onewire support

Add support for onewire memory.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoARM: dts: at91: sam9x60: add onewire node
Eugen Hristev [Mon, 30 Sep 2019 07:28:58 +0000 (07:28 +0000)]
ARM: dts: at91: sam9x60: add onewire node

Add onewire node for w1 support.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoconfigs: Add sam9x60ek_qspiflash_defconfig
Tudor Ambarus [Fri, 27 Sep 2019 13:09:23 +0000 (13:09 +0000)]
configs: Add sam9x60ek_qspiflash_defconfig

Boot from QSPI nor flash.

The at91bootstrap, u-boot, u-boot env redundant, u-boot env,
device tree and kernel will reside in the QSPI nor flash.
The rootfs will reside in the NAND flash.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
5 years agoARM: dts: at91: sam9x60ek: Enable qspi node
Tudor Ambarus [Fri, 27 Sep 2019 13:09:19 +0000 (13:09 +0000)]
ARM: dts: at91: sam9x60ek: Enable qspi node

The sam9x60 qspi controller uses 2 clocks, one for the peripheral register
access, the other for the qspi core and phy. Both are mandatory.

Enable the qspi node together with the SST26VF064B qspi nor flash
memory. Booting from the QSPI NOR flash is now possible.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
5 years agoconfigs: sam9x60ek: Add QSPI_BOOT defines
Tudor Ambarus [Fri, 27 Sep 2019 13:09:15 +0000 (13:09 +0000)]
configs: sam9x60ek: Add QSPI_BOOT defines

Cope with the offsets defined at:
https://www.at91.com/linux4sam/pub/Linux4SAM/SambaSubsections/demo_nandflash_map_lnx4sam6x.png

The environment starts at 0x140000 and it's of size 0x20000.
The device tree starts at 0x180000 and it's of size 0x80000.
The zImage starts at 0x200000 and it's of size 0x600000.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
5 years agoconfigs: Add sam9x60ek_nandflash_defconfig
Tudor Ambarus [Fri, 27 Sep 2019 13:09:11 +0000 (13:09 +0000)]
configs: Add sam9x60ek_nandflash_defconfig

Boot from nand flash.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
5 years agoboard: sam9x60ek: Add NAND flash support
Tudor Ambarus [Fri, 27 Sep 2019 13:09:07 +0000 (13:09 +0000)]
board: sam9x60ek: Add NAND flash support

- EBI Chip Select Register is now in SFR,
- the pins are set to default values,
- timings are matching MT29F4G08BABWP's nand flash requirements.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
5 years agoARM: at91: Add SFR definitions
Tudor Ambarus [Fri, 27 Sep 2019 13:09:03 +0000 (13:09 +0000)]
ARM: at91: Add SFR definitions

sama5's SFR has at offset 0x04 the DDR Configuration Register,
while sam9x60's SFR contains the EBI Chip Select Register. Add
a union to reconcile both boards.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
5 years agoARM: at91: Rename sama5_sfr.h to at91_sfr.h
Tudor Ambarus [Fri, 27 Sep 2019 13:09:00 +0000 (13:09 +0000)]
ARM: at91: Rename sama5_sfr.h to at91_sfr.h

The Special Function Registers (SFR) are present in sam9x5 and
sam9x60 too, rename sama5_sfr to at91_sfr.h.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
5 years agoconfigs: Add sam9x60ek_mmc_defconfig
Sandeep Sheriker Mallikarjun [Fri, 27 Sep 2019 13:08:56 +0000 (13:08 +0000)]
configs: Add sam9x60ek_mmc_defconfig

add sam9x60ek_mmc_defconfig and for now only supports booting from
sdcard.

Signed-off-by: Sandeep Sheriker Mallikarjun <sandeepsheriker.mallikarjun@microchip.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
[nicolas.ferre@microchip.com: split patch, add Ethernet controller,
phy and tools]
[claudiu.beznea@microchip.com: add CONFIG_OF_LIBFDT_OVERLAY]
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
[tudor.ambarus@microchip.com: Fix number of DRAM banks:
One DDR2-SDRAM (W972GG6KB 2 Gbit = 16 Mbit x 16 x 8 banks]
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
5 years agoboard: atmel: Add sam9x60ek board
Sandeep Sheriker Mallikarjun [Fri, 27 Sep 2019 13:08:52 +0000 (13:08 +0000)]
board: atmel: Add sam9x60ek board

Add new board SAM9X60-EK using the ARM926 SAM9X60 SoC.

Signed-off-by: Sandeep Sheriker Mallikarjun <sandeepsheriker.mallikarjun@microchip.com>
[tudor.ambarus@microchip.com:
- fix number of DRAM banks:
  One DDR2-SDRAM (W972GG6KB 2 Gbit = 16 Mbit x 16 x 8 banks]
- drop SPL related macros
- drop memtest macros
- drop CONFIG_SPI_BOOT, CONFIG_SYS_USE_DATAFLASH related macros
- drop inclusion of asm/arch/at91sam9_smc.h]
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
5 years agoARM: dts: at91: sam9x60: Add macb0 Ethernet controller
Nicolas Ferre [Fri, 27 Sep 2019 13:08:48 +0000 (13:08 +0000)]
ARM: dts: at91: sam9x60: Add macb0 Ethernet controller

Add Ethernet controller to dtsi file and enable it on sam9x60ek
platform connected with rmii.

Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
5 years agoARM: dts: Add dts files for sam9x60ek
Sandeep Sheriker Mallikarjun [Fri, 27 Sep 2019 13:08:45 +0000 (13:08 +0000)]
ARM: dts: Add dts files for sam9x60ek

add device tree files for sam9x60ek board with below changes.

- Add initial device nodes (pmc, pinctrl, sdhc, dbgu & pit)
- Add the reg property for the pinctrl node.
- Add the "u-boot,dm-pre-reloc" property to determine which nodes
  are used by the board_init_f stage.

Signed-off-by: Sandeep Sheriker Mallikarjun <sandeepsheriker.mallikarjun@microchip.com>
[prasanthi.chellakumar@microchip.com: fix style/whitespace issues]
Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>
[nicolas.ferre@microchip.com:
- fix gclk,
- fix pio/pinctrl controller definition and allow to have more
  than only PIOA for this SoC,
- removing pinctrl address]
Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
[claudiu.beznea@microchip.com:
- use SAM9X60's compatible for pinctrl
- add drive strength and slew rate options for SDMMC0 pins.]
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
[tudor.ambarus@microchip.com:
- u-boot,dm-pre-reloc property in dedicated file,
- fix pit len, starts from 0xFFFFFE40 and it is of len 0x10]
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
5 years agoARM: at91: Add sam9x60 soc
Sandeep Sheriker Mallikarjun [Fri, 27 Sep 2019 13:08:40 +0000 (13:08 +0000)]
ARM: at91: Add sam9x60 soc

Add new Microchip sam9x60 SoC based on an ARM926.

Signed-off-by: Sandeep Sheriker Mallikarjun <sandeepsheriker.mallikarjun@microchip.com>
[tudor.ambarus@microchip.com: fix SFR definition]
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
5 years agommc: atmel_sdhci: Add sam9x60-sdhci compatibility string
Sandeep Sheriker Mallikarjun [Fri, 27 Sep 2019 13:08:36 +0000 (13:08 +0000)]
mmc: atmel_sdhci: Add sam9x60-sdhci compatibility string

Add new compatibility string for matching sam9x60 product.

Signed-off-by: Sandeep Sheriker Mallikarjun <sandeepsheriker.mallikarjun@microchip.com>
5 years agonet: macb: Add sam9x60-macb compatibility string
Nicolas Ferre [Fri, 27 Sep 2019 13:08:32 +0000 (13:08 +0000)]
net: macb: Add sam9x60-macb compatibility string

Add this new compatibility string for matching sam9x60 product
macb.

Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
5 years agoboard: atmel: sama5d27_wlsom1_ek: fix SPL OFFS on SPI
Eugen Hristev [Wed, 11 Sep 2019 13:02:28 +0000 (13:02 +0000)]
board: atmel: sama5d27_wlsom1_ek: fix SPL OFFS on SPI

Fixes redefinition of CONFIG_SYS_SPI_U_BOOT_OFFS
This is now a Kconfig

Fixes: e40a9ba6d2d5 ("board: atmel: sama5d2_wlsom1_ek: add qspi support and qspi boot config")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoconfigs: sama5d27_wlsom1_ek: add CONFIG_SPL_AT91_MCK_BYPASS
Eugen Hristev [Wed, 4 Sep 2019 08:19:43 +0000 (08:19 +0000)]
configs: sama5d27_wlsom1_ek: add CONFIG_SPL_AT91_MCK_BYPASS

This board has an external oscillator as MCK that does not need driving.
Bypass the driving for the main oscillator in SPL.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoboard: atmel: common: remove year from print message
Eugen Hristev [Wed, 28 Aug 2019 08:34:03 +0000 (08:34 +0000)]
board: atmel: common: remove year from print message

Remove 2017 from being printed at boot video console.
This is outdated.
To avoid this situation, remove the year completely.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoARM: dts: at91: sama5d27_wlsom1: add hlcdc node
Eugen Hristev [Mon, 26 Aug 2019 11:45:06 +0000 (11:45 +0000)]
ARM: dts: at91: sama5d27_wlsom1: add hlcdc node

Add node for hlcld for u-boot logo display at boot.
This is compatible with the Precision Design Associates (PDA) TM5000 screen.
Timings are compatible with simple panel from Linux, panel name is
pda_91_00156_a0

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoboard: atmel: sama5d27_wlsom1_ek: start green led in SPL
Eugen Hristev [Mon, 26 Aug 2019 06:47:09 +0000 (06:47 +0000)]
board: atmel: sama5d27_wlsom1_ek: start green led in SPL

When SPL boots, enable green led on the board.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoboard: atmel: sama5d2_wlsom1_ek: add qspi support and qspi boot config
Eugen Hristev [Mon, 26 Aug 2019 06:47:07 +0000 (06:47 +0000)]
board: atmel: sama5d2_wlsom1_ek: add qspi support and qspi boot config

Add support for qspi memory on board. Created boot support for QSPI
for both u-boot proper and SPL.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoARM: dts: at91: sama5d27_wlsom1_ek: add support for qspi
Eugen Hristev [Mon, 26 Aug 2019 06:47:06 +0000 (06:47 +0000)]
ARM: dts: at91: sama5d27_wlsom1_ek: add support for qspi

Add node for qspi1 memory connected on the wlsom

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoARM: dts: at91: sama5d2: add seq for qspi1
Eugen Hristev [Mon, 26 Aug 2019 06:47:03 +0000 (06:47 +0000)]
ARM: dts: at91: sama5d2: add seq for qspi1

qspi1 does not have an alias/seq number. This is required for
SPL default SF bus booting for the boards that have this SoC

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoboard: atmel: sama5d2_wlsom1_ek: add SPL support
Eugen Hristev [Thu, 8 Aug 2019 07:48:35 +0000 (07:48 +0000)]
board: atmel: sama5d2_wlsom1_ek: add SPL support

Add support for SPL for this board: DRAM initialization, PMC initialization,
MMC boot.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoARM: at91: mpddrc: add lpddr2 initialization procedure
Eugen Hristev [Thu, 8 Aug 2019 07:48:34 +0000 (07:48 +0000)]
ARM: at91: mpddrc: add lpddr2 initialization procedure

Implement the lpddr2 initialization procedure for at91 mpddrc multi-port
ddram controller.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoboard: laird: wb50n: use configure_ddrcfg_input_buffers
Eugen Hristev [Thu, 8 Aug 2019 07:48:31 +0000 (07:48 +0000)]
board: laird: wb50n: use configure_ddrcfg_input_buffers

Replace code with new function configure_ddrcfg_input_buffers from SFR
mach driver.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoARM: at91: sfr: implement DDR input buffers open function
Eugen Hristev [Thu, 8 Aug 2019 07:48:30 +0000 (07:48 +0000)]
ARM: at91: sfr: implement DDR input buffers open function

Add a function in SFR implementation that will open the DDR input
buffers.
This can be called at DRAM initialization time.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoARM: at91: sfr: convert to Kconfig
Eugen Hristev [Thu, 8 Aug 2019 07:48:28 +0000 (07:48 +0000)]
ARM: at91: sfr: convert to Kconfig

This converts the at91 sfr to Kconfig

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoboard: atmel: add sama5d27_wlsom1_ek board
Nicolas Ferre [Thu, 8 Aug 2019 07:48:26 +0000 (07:48 +0000)]
board: atmel: add sama5d27_wlsom1_ek board

Add support for the SAMA5D27-WLSOM1-EK. It's based on the Microchip
WireLess SoM which contains the SAMa5D27 LPDDR2 2Gbits SiP.

Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
[eugen.hristev@microchip.com]: added u-boot specific dtsi and ported to 2019.10
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
5 years agoARM: at91: Add the chip ID for SAMA5D2 LPDDR2 SiP
Nicolas Ferre [Thu, 8 Aug 2019 07:48:23 +0000 (07:48 +0000)]
ARM: at91: Add the chip ID for SAMA5D2 LPDDR2 SiP

The SAMA5D2 LPDDR2 SiP (System in Package) is added for SoC
identification.

Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
5 years agox86: Use mtrr_commit() with FSP2
Simon Glass [Wed, 25 Sep 2019 14:56:49 +0000 (08:56 -0600)]
x86: Use mtrr_commit() with FSP2

With FSP2 we use MTRRs in U-Boot proper even though the 32-bit init
happens in TPL. Enable this, using a variable to try to make the
conditions more palatable.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: cpu: Don't include the cpu driver in TPL
Simon Glass [Wed, 25 Sep 2019 14:56:48 +0000 (08:56 -0600)]
x86: cpu: Don't include the cpu driver in TPL

We don't need this driver very early in boot and it adds code size. Drop
it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Add a function to set variable MTRRs
Simon Glass [Wed, 25 Sep 2019 14:56:46 +0000 (08:56 -0600)]
x86: Add a function to set variable MTRRs

Normally U-Boot handles MTRRs through an add/commit process which
overwrites all MTRRs. But in very early boot it is not desirable to clear
the existing MTRRs since they may be in use and it can cause a hang.

Add a new mtrr_set_next_var() function which sets up the next available
MTRR to the required region.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: pass 'type' to set_var_mtrr() in mtrr_set_next_var()]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Refactor mtrr_commit() to allow for shared code
Simon Glass [Wed, 25 Sep 2019 14:56:45 +0000 (08:56 -0600)]
x86: Refactor mtrr_commit() to allow for shared code

Move the code that actually sets up the MTRR into another function so it
can be used elsewhere in the file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Allow the PCH and LPC uclasses to work with of-platdata
Simon Glass [Wed, 25 Sep 2019 14:56:43 +0000 (08:56 -0600)]
x86: Allow the PCH and LPC uclasses to work with of-platdata

At present these uclasses assumes that they are used with a device tree.
Update them to support of-platdata as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agosandbox: pci: Create a new sandbox_pci_read_bar() function
Simon Glass [Wed, 25 Sep 2019 14:56:42 +0000 (08:56 -0600)]
sandbox: pci: Create a new sandbox_pci_read_bar() function

The code in swapcase can be used by other sandbox drivers. Move it into a
common place to allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: remove inclusion of <asm/test.h> in pci_sandbox.c]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agodm: core: Drop fdtdec_get_pci_addr()
Simon Glass [Wed, 25 Sep 2019 14:56:41 +0000 (08:56 -0600)]
dm: core: Drop fdtdec_get_pci_addr()

This function ise effectively replaced by ofnode_read_pci_addr() which
works with flat tree. Delete it to avoid code duplication.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Add new common CPU functions for turbo/burst mode
Simon Glass [Wed, 25 Sep 2019 14:56:40 +0000 (08:56 -0600)]
x86: Add new common CPU functions for turbo/burst mode

Add a few more CPU functions that are common on Intel CPUs. Also add
attribution for the code source.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: add missing MSR_IA32_MISC_ENABLE write back in cpu_set_eist();
        fix 2 typos in cpu_get_burst_mode_state() comments]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Tidy up some duplicate MSR defines
Simon Glass [Wed, 25 Sep 2019 14:56:39 +0000 (08:56 -0600)]
x86: Tidy up some duplicate MSR defines

Some MSR registers are defined twice in different parts of the file. Move
them together and remove the duplicates. Also drop some thermal defines
which are not used.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Add common functions for TDP and perf control
Simon Glass [Wed, 25 Sep 2019 14:56:38 +0000 (08:56 -0600)]
x86: Add common functions for TDP and perf control

These functions are the same on modern Intel CPUs, so use common code to
set them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: return false instead of 0 in cpu_ivybridge_config_tdp_levels();
        fix 'muiltiplier' and 'desgn' typos]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Use a common bus clock for Intel CPUs
Simon Glass [Wed, 25 Sep 2019 14:56:37 +0000 (08:56 -0600)]
x86: Use a common bus clock for Intel CPUs

Modern Intel CPUs use a standard bus clock value of 100MHz, so put this in
a common file and tidy up the copies.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Add a common function to set CPU thermal target
Simon Glass [Wed, 25 Sep 2019 14:56:36 +0000 (08:56 -0600)]
x86: Add a common function to set CPU thermal target

This code appears in a few places, so move it to a common file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Use a common definition of MSR_IA32_PERF_CTL
Simon Glass [Wed, 25 Sep 2019 14:56:35 +0000 (08:56 -0600)]
x86: Use a common definition of MSR_IA32_PERF_CTL

Remove the duplicate definition as it is not needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: pci: Drop the first parameter in pci_x86_r/w_config()
Simon Glass [Sun, 1 Sep 2019 03:23:18 +0000 (21:23 -0600)]
x86: pci: Drop the first parameter in pci_x86_r/w_config()

This parameter is needed by the PCI driver-mode interface but is always
NULL on x86. There are a number of calls to this function so it makes
sense to minimise the parameters.

Adjust the x86 function to omit the first parameter, and introduce stub
functions to handle the conversion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: rebase the patch against u-boot-x86/next to get it applied cleanly]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Move acpi_s3.h to a common location
Simon Glass [Wed, 25 Sep 2019 14:56:32 +0000 (08:56 -0600)]
x86: Move acpi_s3.h to a common location

At present this hedaer is only available on x86. To allow sandbox to use
it for testing, move it to a common location.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agospl: Allow distinguishing between two phases in U-Boot
Simon Glass [Wed, 25 Sep 2019 14:56:30 +0000 (08:56 -0600)]
spl: Allow distinguishing between two phases in U-Boot

U-Boot has two distinct phases: before and after relocation. These are
commonly referred to as F (running from Flash) and R (Relocated and
running from RAM). Some drivers want to do different things in these
phases so update the SPL phase function to return a different value for
each.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agospl: Convert CONFIG_SPL_SIZE_LIMIT to hex
Simon Glass [Wed, 25 Sep 2019 14:56:28 +0000 (08:56 -0600)]
spl: Convert CONFIG_SPL_SIZE_LIMIT to hex

This is currently a decimal value which is not as convenient or
meaningful. Also U-Boot tends to use hex everywhere.

Convert this option to hex and add a comment for the size_check macro.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Acked-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: correct the typo in the commit title]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agospl: Allow tiny printf() to be controlled in SPL and TPL
Simon Glass [Wed, 25 Sep 2019 14:56:27 +0000 (08:56 -0600)]
spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agoarm: mxs: Correct CONFIG_SPL_NO_CPU_SUPPORT option
Simon Glass [Wed, 25 Sep 2019 14:56:26 +0000 (08:56 -0600)]
arm: mxs: Correct CONFIG_SPL_NO_CPU_SUPPORT option

At present this is defined in Kconfig but there is a separate one in the
CONFIG whitelist. It looks like these are duplicates.

Rename the non-Kconfig one and remove it from the whitelist.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agoiod: Enhance to support display of multiple values
Simon Glass [Wed, 25 Sep 2019 14:56:25 +0000 (08:56 -0600)]
iod: Enhance to support display of multiple values

At present the 'iod' command differs from 'md' in that it only shows a
single value. It is useful to see a dump of multiple values, particularly
when x86 peripherals contain register sets accessible via I/O ports.

Enhance the command to match md.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: correct multi-line comment format style]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agocros_ec: Add MEC_EMI_BASE and size to the header file
Simon Glass [Wed, 25 Sep 2019 14:56:24 +0000 (08:56 -0600)]
cros_ec: Add MEC_EMI_BASE and size to the header file

Provide these values which are part of the EC interface now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agolog: Add log_nop() to avoid unused-variable warnings
Simon Glass [Wed, 25 Sep 2019 14:56:23 +0000 (08:56 -0600)]
log: Add log_nop() to avoid unused-variable warnings

If a log statement includes a variable and logging is disabled, this can
generate warnings about unused variables. Add a bit more complexity to the
macros to avoid this for the common case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agobinman: Take account of skip-at-start with image-header
Simon Glass [Wed, 25 Sep 2019 14:56:22 +0000 (08:56 -0600)]
binman: Take account of skip-at-start with image-header

The image-header currently sets it offset assuming that skip-at-start is
zero. This does not work on x86 where offsets end at 4GB. Add in this
value so that the offset is correct.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Bin Meng <bmeng.cn@gmail.com>
5 years agobinman: Handle reading data for end-at-4gb sections
Simon Glass [Wed, 25 Sep 2019 14:56:21 +0000 (08:56 -0600)]
binman: Handle reading data for end-at-4gb sections

Some x86 sections have special offsets which currently result in empty
data being returned from the 'extract' command. Fix this by taking account
of the skip-at-start property.

Add a little more debugging while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Bin Meng <bmeng.cn@gmail.com>
5 years agobinman: Add a base implementation of Entry.ReadChildData()
Simon Glass [Wed, 25 Sep 2019 14:56:20 +0000 (08:56 -0600)]
binman: Add a base implementation of Entry.ReadChildData()

At present this function is not present in the Entry base class so it is
hard to find the documentation for it. Move the docs from the section
class and expand it a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agobinman: Allow verbose output with all commands
Simon Glass [Mon, 16 Sep 2019 00:10:36 +0000 (18:10 -0600)]
binman: Allow verbose output with all commands

At present the verbose flag only works for the 'build' command. This is
not intended, nor is it useful. Update the code to support the verbose
flag and make use of a command exception handler.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: rebase the patch against u-boot-x86/next to get it applied cleanly]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agoserial: ns16550: Add a PCI device/function field
Simon Glass [Wed, 25 Sep 2019 14:56:18 +0000 (08:56 -0600)]
serial: ns16550: Add a PCI device/function field

When this UART is used early in boot (before PCI is set up) it is
convenient to store the PCI BDF of the UART so that it can be manually
configured. This is useful when it is used as a debug UART, for example.

Add a new field to hold this information, so that drivers can simply use
the existing platform data.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agodm: pci: Add a function to read a PCI BAR
Simon Glass [Sun, 15 Sep 2019 18:08:58 +0000 (12:08 -0600)]
dm: pci: Add a function to read a PCI BAR

At present PCI address transaction is not supported so drivers must
manually read the correct BAR after reading the device tree info. The
ns16550 has a suitable implementation, so move this code into the core
DM support.

Note that there is no live-tree equivalent at present.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: correct the unclear comments in test.dts]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agopci: Show a message if PCI autoconfig fails
Simon Glass [Wed, 25 Sep 2019 14:56:16 +0000 (08:56 -0600)]
pci: Show a message if PCI autoconfig fails

At present this fails silently which can be confusing since some devices
on the PCI bus may not work correctly. Show a message in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: add a '\n' in the PCI autoconfig fail message]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agopci: Add more debug detail when resources are exhausted
Simon Glass [Wed, 25 Sep 2019 14:56:15 +0000 (08:56 -0600)]
pci: Add more debug detail when resources are exhausted

If PCI auto-config runs out of memory, show a few more details to help
diagnose the problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: change %x to %llx to avoid build warnings on some platforms]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agopci: Correct 'specifified' and 'Plese' typos
Simon Glass [Wed, 25 Sep 2019 14:56:14 +0000 (08:56 -0600)]
pci: Correct 'specifified' and 'Plese' typos

Fix these spelling errors the header file and documentation.

Fix a small typo in the PCI documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agopci: Disable autoconfig in SPL
Simon Glass [Wed, 25 Sep 2019 14:56:13 +0000 (08:56 -0600)]
pci: Disable autoconfig in SPL

At present U-Boot runs autoconfig in SPL but this is best left to U-Boot
proper. For TPL and SPL we can normally used fixed BARs and save code size
and time.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agopci: Show the result of binding a device
Simon Glass [Wed, 25 Sep 2019 14:56:12 +0000 (08:56 -0600)]
pci: Show the result of binding a device

Update the debugging info a little to show the result of trying to bind
a PCI device.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agopci: sandbox: Probe PCI emulation devices when used
Simon Glass [Sat, 31 Aug 2019 23:59:32 +0000 (17:59 -0600)]
pci: sandbox: Probe PCI emulation devices when used

At present PCI emulation devices are not probed before use, since they
used to be children of the device that used them, and children cannot be
probed before their parents.

Now that PCI emulation devices are attached to the root node, we can
simply probe them, and avoid using the internal function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: rebase the patch against u-boot-x86/next to get it applied cleanly]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agopci: sandbox: Move the emulators into their own node
Simon Glass [Wed, 25 Sep 2019 14:56:10 +0000 (08:56 -0600)]
pci: sandbox: Move the emulators into their own node

Sandbox pci works using emulation drivers which are currently children of
the pci device:

pci-controller {
pci@1f,0 {
compatible = "pci-generic";
reg = <0xf800 0 0 0 0>;
emul@1f,0 {
compatible = "sandbox,swap-case";
};
};
};

In this case the emulation device is attached to pci device on address
f800 (device 1f, function 0) and provides the swap-case functionality.

However this is not ideal, since every device on a PCI bus has a child
device. This is only really the case for sandbox, but we want to avoid
special-case code for sandbox.

Worse, child devices cannot be probed before their parents. This forces
us to use 'find' rather than 'get' to obtain the emulator device. In fact
the emulator devices are never probed. There is code in
sandbox_pci_emul_post_probe() which tries to track when emulators are
active, but at present this does not work.

A better approach seems to be to add a separate node elsewhere in the
device tree, an 'emulation parent'. This could be given a bogus address
(such as -1) to hide the emulators away from the 'pci' command, but it
seems better to keep it at the root node to avoid such hacks.

Then we can use a phandle to point from the device to the correct
emulator, and only on sandbox. The code to find an emulator does not
interfere with normal pci operation.

Add a new UCLASS_PCI_EMUL_PARENT uclass which allows finding an emulator
given a bus, and finding a bus given an emulator. Update the existing
device trees and the code for finding an emulator.

This brings PCI emulators more into line with I2C.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: fix 3 typos in the commit message;
        encode bus number in the labels of swap_case_emul nodes;
        mention commit 4345998ae9df in sandbox_pci_get_emul()]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agosandbox: Allow use of real I/O with readl(), etc.
Simon Glass [Wed, 25 Sep 2019 14:56:09 +0000 (08:56 -0600)]
sandbox: Allow use of real I/O with readl(), etc.

At present these functions are stubbed out. For more comprehensive testing
with PCI devices it is useful to be able to fully emulate I/O access. Add
simple implementations for these.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: change to use 'const void *' in sandbox_write();
        cast 'addr' in read/write macros in arch/sandbox/include/asm/io.h;
        remove the unnecessary cast in readq/writeq in nvme.h]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agosandbox: pci: Increase the memory space
Simon Glass [Wed, 25 Sep 2019 14:56:08 +0000 (08:56 -0600)]
sandbox: pci: Increase the memory space

Increase the memory space so we can support the p2sb bus which needs
multiples of 1MB.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agosandbox: Add a -T flag to use the test device tree
Simon Glass [Wed, 25 Sep 2019 14:56:07 +0000 (08:56 -0600)]
sandbox: Add a -T flag to use the test device tree

U-Boot already supports using -D to indicate that it should use the normal
device tree. It is sometimes useful to run with the test device tree, e.g.
when running a test. Add a -T option for this along with some
documentation.

It can be used like this:

   /tmp/b/sandbox/u-boot -T -c "ut dm pci_busdev"

(this will use /tmp/b/sandbox/arch/sandbox/dts/test.dtb as the DT)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
5 years agosandbox: pci: Move pci_offset_to_barnum() to pci.h
Simon Glass [Wed, 25 Sep 2019 14:56:06 +0000 (08:56 -0600)]
sandbox: pci: Move pci_offset_to_barnum() to pci.h

This function is useful in PCI emulators. More it into the header file to
avoid duplicating it in other drivers.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agosandbox: pci: Drop the get_devfn() method
Simon Glass [Wed, 25 Sep 2019 14:56:04 +0000 (08:56 -0600)]
sandbox: pci: Drop the get_devfn() method

This method is not used anymore since the bus/device/function of PCI
devices can be obtained from their (parent's per-child) platform data.
Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agosandbox: swap_case: Use statics where possible
Simon Glass [Wed, 25 Sep 2019 14:56:03 +0000 (08:56 -0600)]
sandbox: swap_case: Use statics where possible

Some functions and a struct should be marked static since they are not
used outside this file. Update them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agosandbox: Add support for clrsetio_32() and friends
Simon Glass [Wed, 25 Sep 2019 14:56:02 +0000 (08:56 -0600)]
sandbox: Add support for clrsetio_32() and friends

These functions are available on x86 but not sandbox. They are useful
shortcuts and clarify the code, so add them to sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agosandbox: Rename PCI ID for swap_case to be more specific
Simon Glass [Wed, 25 Sep 2019 14:56:01 +0000 (08:56 -0600)]
sandbox: Rename PCI ID for swap_case to be more specific

Rename this ID to SANDBOX_PCI_SWAP_CASE_EMUL_ID since it is more
descriptive and allows us to add new PCI emulators without any conflict or
confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agosandbox: mmc: Fix up MMC emulator for valgrind
Simon Glass [Wed, 25 Sep 2019 14:56:00 +0000 (08:56 -0600)]
sandbox: mmc: Fix up MMC emulator for valgrind

At present running sandbox with valgrind produces some warnings due to the
MMC emulator not filling in all the expected fields. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: use sizeof() instead of hardcoded 16]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agosandbox: spmi: Add ranges property for address translation
Simon Glass [Wed, 25 Sep 2019 14:55:59 +0000 (08:55 -0600)]
sandbox: spmi: Add ranges property for address translation

At present address translation does not work since there is no ranges
property in the spmi nodes. Add empty ranges properties and a little more
logging so that this shows the error:

   /tmp/b/sandbox/u-boot -d /tmp/b/sandbox/arch/sandbox/dts/test.dtb \
-c "ut dm spmi_access_peripheral" -L7 -v
   ...
   pm8916_gpio_probe() bad address: returning err=-22

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
5 years agodm: test: Correct a stray backslash in dm_test_destroy()
Simon Glass [Wed, 25 Sep 2019 14:55:57 +0000 (08:55 -0600)]
dm: test: Correct a stray backslash in dm_test_destroy()

This should perhaps be a period.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: add the ending period and reword the commit message]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agodm: core: Add device_foreach_child()
Simon Glass [Wed, 25 Sep 2019 14:55:56 +0000 (08:55 -0600)]
dm: core: Add device_foreach_child()

We have a 'safe' version of this function but sometimes it is not needed.
Add a normal version too and update a few places that can use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agodm: core: Correct the return value for uclass_find_first_device()
Simon Glass [Wed, 25 Sep 2019 14:55:55 +0000 (08:55 -0600)]
dm: core: Correct the return value for uclass_find_first_device()

This function returns -ENODEV when there is no device. This is
inconsistent with other functions, such as uclass_find_next_device(),
which returns 0.

Update it and tidy up the incorrect '-1' values in the comments.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
5 years agodm: core: Call ofdata_to_platdata() with of-platdata
Simon Glass [Wed, 25 Sep 2019 14:55:53 +0000 (08:55 -0600)]
dm: core: Call ofdata_to_platdata() with of-platdata

At present this function is never called when of-platdata is enabled since
we never have a device tree. However, this function is responsible for
copying over the of-platdata, so we must call it. Otherwise the probe()
method would have to be used.

Correct this and fix the sandbox serial driver to not read from the device
tree and try to write to what is read-only platdata on some platforms.

Fixes: 396e343b3d (dm: core: Allow binding a device from a live tree)
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agodm: test: Don't fail when tests are skipped due to build
Simon Glass [Wed, 25 Sep 2019 14:55:52 +0000 (08:55 -0600)]
dm: test: Don't fail when tests are skipped due to build

At present tests that are marked as only for livetree fail when executed
on sandbox_flattree. They cannot actually be executed, but we should not
resport them as 'not found', since this causes errors. Instead, they
should be silently skipped.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agodm: test: Fix running of multiple test from command line
Simon Glass [Wed, 25 Sep 2019 14:55:51 +0000 (08:55 -0600)]
dm: test: Fix running of multiple test from command line

At present when multiple 'ut dm' commands are executed, all but the first
is run with a flat tree, even if live tree is enabled. This is because the
live tree node pointer is set to NULL and never restored.

This does not affect normal test running, which just runs all the test in
one go, but can be confusing when several individual tests are run during
the same U-Boot run.

Correct this by restoring the pointer.

Fixes: c166c47ba3 (dm: test: Add support for running tests with livetree)
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
5 years agodm: core: Add documentation on how to debug driver model
Simon Glass [Wed, 25 Sep 2019 14:55:48 +0000 (08:55 -0600)]
dm: core: Add documentation on how to debug driver model

Sometimes devices don't appear and it can be confusing. Add a few notes to
help with this situation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: fix 2 issues in the doc and include the doc in the index.rst]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agodm: core: Drop a few early returns
Simon Glass [Wed, 25 Sep 2019 14:55:47 +0000 (08:55 -0600)]
dm: core: Drop a few early returns

Two functions in this file return early for no good reason. Adjust the
code to match the standard DM style of returning 0 at the end of the
function on success.

Oddly enough this save 12 bytes of code size on ARM.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agodm: core: Use U-Boot logging instead of pr_debug()
Simon Glass [Wed, 25 Sep 2019 14:55:45 +0000 (08:55 -0600)]
dm: core: Use U-Boot logging instead of pr_debug()

The pr_debug() functions do not response to setting the log level and in
fact have their own separate log level. Use U-Boot logging instead.

Perhaps we should make these options redirect to log_debug(), etc.?

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Rename turbo ratio MSR to MSR_TURBO_RATIO_LIMIT
Simon Glass [Wed, 25 Sep 2019 14:11:47 +0000 (08:11 -0600)]
x86: Rename turbo ratio MSR to MSR_TURBO_RATIO_LIMIT

This MSR number is used on most modern Intel processors, so drop the
confusing NHM prefix (which might mean Nehalem).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: drop MSR_IVT_TURBO_RATIO_LIMIT as no code uses it]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Add various MTRR indexes and values
Simon Glass [Wed, 25 Sep 2019 14:11:46 +0000 (08:11 -0600)]
x86: Add various MTRR indexes and values

Add some new MTRRs used by Apollolake as well as a mask for the MTRR
type.

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