Commit Graph

58190 Commits

Author SHA1 Message Date
Andre Przywara
65f80f5804 sunxi: H6: DRAM: follow recommended PHY init algorithm
The DRAM controller manual suggests to first program the PHY
initialisation parameters to the PHY_PIR register, and then set bit 0 to
trigger the initialisation. This is also used in boot0.

Follow this recommendation by setting bit 0 in a separate step.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2019-07-16 17:09:19 +05:30
Andre Przywara
1a1d1df384 sunxi: H6: DRAM: avoid memcpy() on MMIO registers
Using memcpy() is, however tempting, not a good idea: It depends on the
specific implementation of memcpy, also lacks barriers. In this
particular case the first registers were written using 64-bit writes,
and the last register using four separate single-byte writes.

Replace the memcpy with a proper loop using the writel() accessor.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2019-07-16 17:09:06 +05:30
Marcus Cooper
a9e19b8ff7 sun8i: h3: Add support for the Beelink-x2 STB
The Beelink X2 is an STB based on the Allwinner H3 SoC with a uSD slot,
2 USB ports( 1 * USB-2 Host, 1 USB OTG), a 10/100M ethernet port using the
SoC's integrated PHY, Wifi via an sdio wifi chip, HDMI, an IR receiver, a
dual colour LED and an optical S/PDIF connector.

Linux commit details about the sun8i-h3-beelink-x2.dts sync:
"ARM: dts: sun8i: h3: Add ethernet0 alias to Beelink X2"
(sha1: cc4bddade114b696ab27c1a77cfc7040151306da)

Signed-off-by: Marcus Cooper <codekipper@gmail.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2019-07-15 12:25:32 +05:30
Andre Przywara
9340d8fe8b sunxi: move CONFIG_SPL_TEXT_BASE from *_defconfig to Kconfig
The choice of the SPL_TEXT_BASE is not really a decision that should be
specified by each board's defconfig, as this setting is actually
dictated by the SoC's memory map and the BootROM behaviour.

To make this obvious and reduce the clutter in the defconfig files,
let's specify the SoC constraints in the Kconfig stanza.
This allows us to remove these lines from the defconfig files again.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2019-07-15 12:25:32 +05:30
Tom Rini
6070ef409c Merge branch '2019-07-12-master-imports'
- First round of TI Davinci updates
- Some OMAP3 DM updates
- Other misc updates
2019-07-14 09:05:20 -04:00
Tom Rini
ae8d23a668 test: Disable pci_ep test for now
This test is currently broken so disable it for now.

Cc: Ramon Fried <ramon.fried@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2019-07-13 21:18:37 -04:00
Adam Ford
550eebcfb4 ARM: dts: logicpd som-lvs and torpedos: Shrink SPL DTB
Since we have limited resources in SPL, it is the best interest
to keep the SPL as small as possible and that includes the DTB.
There are a few items in the device tree that can be removed,
because these boards don't use them.

Signed-off-by: Adam Ford <aford173@gmail.com>
2019-07-13 11:11:31 -04:00
Sven Schwermer
1164c546d5 regulator: Allow autosetting fixed regulators
Fixed regulators don't have a set_value method. Therefore, trying to
set their value will always return -ENOSYS.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-07-13 11:11:31 -04:00
Heiko Schocher
5fc7cf8c8e gpio: add gpio-hog support
add gpio-hog support. GPIO hogging is a mechanism
providing automatic GPIO request and configuration
as part of the gpio-controller's driver probe function.

for more infos see:
doc/device-tree-bindings/gpio/gpio.txt

Signed-off-by: Heiko Schocher <hs@denx.de>
Tested-by: Michal Simek <michal.simek@xilinx.com> (zcu102)
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
2019-07-13 11:11:30 -04:00
Adam Ford
42f1539727 ARM: dts: logicpd-som-lv: Resync with Kernel 5.1.9
The MMC card-detect pin was incorrectly defined which was fixed.
This patch resync's the dts and removes the u-boot specific fix.

Signed-off-by: Adam Ford <aford173@gmail.com>
2019-07-13 11:11:30 -04:00
Adam Ford
4972a2a83f ARM: dts: da850: Resync with Linux 5.1.9
The da850.dtsi file had some changes.  This patch pulls in the
changes from Kernel 5.1.9

Signed-off-by: Adam Ford <aford173@gmail.com>
2019-07-13 11:11:30 -04:00
Adam Ford
877ab2423b ARM: davinci: da850: Manual pinmux only when PINCTRL not available
With a recent update to the pinctrl-single driver and the fact
that the da850evm has both DM and OF_CONTROL working in both SPL
and U-Boot, some of the manual pinmuxing can be setup to only
be activated when either the driver doesn't have DM for it, or
when CONFIG_PINMUX isn't available (only during SPL).  If the
code ever shrinks enough to support PINCTRL in SPL, a lot of this
can go away.  This also remove some manual pinmuxing not needed
by SPL to give SPL a little more breathing room.

Signed-off-by: Adam Ford <aford173@gmail.com>
2019-07-13 11:11:29 -04:00
Adam Ford
159a887e74 pinctrl: pinctrl-single: Add 'pinctrl-single, bits' support
The TI Davinci (da850/l138/am1808) use pinctrl-single,bits for
pinmuxing peripherals.  This patch allosw the pinctrl-single
driver to parse the pinctrl-single,bits options and correctly
setup devices.

Signed-off-by: Adam Ford <aford173@gmail.com>
2019-07-13 11:11:29 -04:00
Tom Rini
2a51e16bd5 configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default
The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support.  Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol.  Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>
2019-07-13 11:11:29 -04:00
Keerthy
28115e7bac power: regulator: Kconfig: Add SPL_DM_REGULATOR configs for palmas/lp873x/lp87565
Add SPL_DM_REGULATOR configs for palmas/lp873x/lp87565. These were missing
and the Makefile already assumes them to be defined. Add the corresponding
SPL config options. This enables the regulator support in SPL.

Signed-off-by: Keerthy <j-keerthy@ti.com>
2019-07-13 11:11:29 -04:00
Keerthy
2463874883 power: pmic: Kconfig: Add SPL_PMIC configs for palmas/lp873x/lp87565
Add SPL_PMIC configs for palmas/lp873x/lp87565. These were missing
and the Makefile already assumes them to be defined. Add the corresponding
SPL config options. This enables the pmics in SPL.

Signed-off-by: Keerthy <j-keerthy@ti.com>
2019-07-13 11:11:28 -04:00
Niel Fourie
6e171b661e ARM: am335x: Add phyCORE AM335x R2 support
Support for Phytech phyCORE AM335x R2 SOM (PCL060) on the Phytec
phyBOARD-Wega AM335x.

CPU  : AM335X-GP rev 2.1
Model: Phytec AM335x phyBOARD-WEGA
DRAM:  256 MiB
NAND:  256 MiB
MMC:   OMAP SD/MMC: 0
eth0: ethernet@4a100000

Working:
 - Eth0
 - i2C
 - MMC/SD
 - NAND
 - UART
 - USB (host)

Device trees were taken from Linux mainline:
commit 37624b58542f ("Linux 5.1-rc7")

Signed-off-by: Niel Fourie <lusus@denx.de>
Signed-off-by: Parthiban Nallathambi <pn@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Tested-by: Marek Vasut <marex@denx.de>
2019-07-13 11:11:28 -04:00
David Lechner
1d259e4d68 ARM: legoev3: convert to driver model
This converts LEGO MINDSTORMS EV3 to the driver model. MMC, SERIAL, SPI
and SPI_FLASH are converted.

The device tree contains only the minimal nodes required by U-Boot
since the size of U-Boot is limited to 256K on this device.

Signed-off-by: David Lechner <david@lechnology.com>
2019-07-13 11:11:28 -04:00
Michael Walle
fb9a1ffef3 rtc: add Microcrystal RV-8803 driver
Signed-off-by: Michael Walle <michael@walle.cc>
2019-07-13 11:11:28 -04:00
Derald D. Woods
9adaa039b6 usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET
This commit addresses the following warning, when _NOT_ USB_MUSB_HOST:

[...]
  CC      drivers/usb/gadget/f_mass_storage.o
  CC      drivers/usb/musb-new/omap2430.o
  CC      drivers/usb/gadget/f_fastboot.o
  CC      env/common.o
  CC      env/env.o
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c: In function ‘omap2430_musb_probe’:
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:239:6: warning: assignment to ‘int’ from ‘struct musb *’ makes integer from pointer without a cast [-Wint-conversion]
  ret = musb_register(&platdata->plat,
      ^
  LD      drivers/usb/host/built-in.o
  CC      drivers/usb/gadget/f_sdp.o
  CC      fs/ext4/ext4fs.o
[...]

Signed-off-by: Derald D. Woods <woods.technical@gmail.com>
2019-07-13 11:11:27 -04:00
Derald D. Woods
e74e9f620a ARM: omap3: evm: Enable DM_USB in defconfig
This addresses the following warning message:

===================== 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.
====================================================

As USB support for older OMAP3 SoC's improves, OMAP3 EVM can be
readily adapted. There is some additional 'gpio-hog' support
needed to fully setup USB in a similar manner to Linux.

Signed-off-by: Derald D. Woods <woods.technical@gmail.com>
2019-07-13 11:11:27 -04:00
Derald D. Woods
5579e73c8c ARM: dts: omap3-evm: Sync dts(i) files from Linux 5.1.5
Signed-off-by: Derald D. Woods <woods.technical@gmail.com>
2019-07-13 11:11:27 -04:00
Heiko Schocher
8dd6803ded rtc: ds1307: add support for m41t11
add m41t11 support in ds1307 driver. changes:

- add compatible string for m41t11
- check if RTC clock is running, if not
  enable the clock

Signed-off-by: Heiko Schocher <hs@denx.de>
2019-07-13 11:11:26 -04:00
Ezequiel Garcia
d66fb5b1f6 mmc: Register only the first MMC device on MMC_TINY
When MMC_TINY is enabled, support for only one MMC device
is provided. Boards that register more than one device,
will just write over mmc_static keeping only the last one
registered.

This commit prevents this, keeping only the first MMC
device created. A debug warning message is added, if nothing
else, as a hint/documentation for developers.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
2019-07-13 11:11:26 -04:00
Ezequiel Garcia
bf7c01d92b spl: Move SPL_MMC_TINY option to appear under SPL menu
The SPL_MMC_TINY implements feature-reduced MMC support
on SPL, and as such, it's more consistent and convenient
to find it as part of the SPL configuration.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
2019-07-13 11:11:26 -04:00
Leo Ruan
8e92120b32 cmd: nvedit: Add sub-command 'env info'
Add sub-command 'env info' to display environment information:
- env_valid : is environment valid
- env_ready : is environment imported into hash table
- env_use_default : is default environment using

This command can be optionally used for evaluation in scripts:
[-d] : evaluate whether default environment is used
[-p] : evaluate whether environment can be persisted
The result of multiple evaluations will be combined with AND.

Signed-off-by: Leo Ruan <tingquan.ruan@cn.bosch.com>
Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Do not enable by default]
Signed-off-by: Tom Rini <trini@konsulko.com>
2019-07-13 11:11:09 -04:00
Peng Fan
4213609cc7 drivers: core: use strcmp when find device by name
`if (!strncmp(dev->name, name, strlen(name)))` might find out
the wrong device, it might find out `dram_pll_ref_sel`, when name is
`dram_pll`. So use strcmp to avoid such issue.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-07-12 21:07:59 -04:00
Peng Fan
819ac50d2a test: dm: usb: use the real device name
"keyb" is not the real device name, "keyb@3" is.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-07-12 21:07:59 -04:00
Peng Fan
38ee9dfea9 test: dm: adc: use the real device name
"adc" is not the real device name, "adc@0" is.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-07-12 21:07:58 -04:00
Marek Behún
60ee60944b pci: ensure enumeration of all devices in pci_init
Use the uclass_first_device_check and uclass_next_device_check functions
instead of uclass_first_device and uclass_next_device in pci_init. This
ensures that all PCI devices are tried to be probed. Currently if a
device fails to probe, the enumeration stops and the devices which come
after the failed device are not probed.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Stefan Roese <sr@denx.de>
Cc: Anton Schubert <anton.schubert@gmx.de>
Cc: Dirk Eibach <dirk.eibach@gdsys.cc>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
Cc: Phil Sutter <phil@nwl.cc>
Cc: VlaoMao <vlaomao@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-07-12 21:07:58 -04:00
Ilko Iliev
26eff45737 board: pm9263: Convert to CONFIG_DM_USB and CONFIG_DM_VIDEO
Convert the board to support the USB and video driver model and remove
the unnecessary code.
2019-07-12 10:04:29 -04:00
Ilko Iliev
7a0b1f713e board: pm9261: Convert to CONFIG_DM_USB and CONFIG_DM_VIDEO
Convert the board to support the USB and video driver model and remove
the unnecessary code.
2019-07-12 10:04:29 -04:00
Tom Rini
a9758ece08 - Sandbox improvements including .dts refactor
- Minor tracing and PCI improvements
 - Various other minor fixes
 - Conversion of patman, dtoc and binman to support Python 3
 -----BEGIN PGP SIGNATURE-----
 
 iQFFBAABCgAvFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAl0nbDoRHHNqZ0BjaHJv
 bWl1bS5vcmcACgkQfxc6PpAIreZcBQgAn+ojgq/hD89bihuhz2oEe6rhzHB9OkcC
 sHrVL8Jbmby/BuzISGe4oeeM5yVygBVtUiN/72JiiAHLmykqc4CpRjNvgOOAgKCy
 Ml8UyiBNNVNfrD6f9PxAKvPZf6S0gfLnomGOQ/psdEojpY5AvQxQ36D+QFZ0AMP5
 67/xjSfN9bNPw8UbgE/VhJ+WFbU948BP2EBt6+NBAtv7HW4AX9vT0famJfWEjwq8
 ftmcFOSNGgYcDQ5BwQWX1sFhnwb9XSfurlQsVYBsFA4cx4gj0DfUm1Ugr4wDD+lo
 91P+76hSBQ+mHp1HJ90WMd2vAaElG7/SoaicXo9pW6Rc7WIgTjk7gg==
 =SdZy
 -----END PGP SIGNATURE-----

Merge tag 'dm-pull-9jul19-take2' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

- Sandbox improvements including .dts refactor
- Minor tracing and PCI improvements
- Various other minor fixes
- Conversion of patman, dtoc and binman to support Python 3
2019-07-11 18:10:11 -04:00
Tom Rini
68deea2308 Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
- SPL SATA enhancements to allow booting from RAW SATA device
  needed for Clearfog (Baruch)
- Enable SATA booting on Clearfog (Baruch)
- Misc changes to Turris Omnia (Marek)
- Enable CMD_BOOTZ and increase SYS_BOOTM_LEN on crs305-1g-4s
  (Luka)
- Enable FIT support for db-xc3-24g4xg (Chris)
- Enable DM_SPI on Keymile Kirkwood board with necessary changes
  for this (Pascal)
- Set 38x and 39x AVS on lower frequency (Baruch)
2019-07-11 18:09:38 -04:00
Tom Rini
79b8d3c285 UniPhier SoC updates for v2019.10
- import DT updates from Linux
 
 - add UniPhier SPI controller driver
 
 - make U-Boot image for 64bit SoCs position independent
 
 - tidy up various init code for next generation SoCs
 
 - misc cleanups
 -----BEGIN PGP SIGNATURE-----
 
 iQJSBAABCgA8FiEEbmPs18K1szRHjPqEPYsBB53g2wYFAl0nREIeHHlhbWFkYS5t
 YXNhaGlyb0Bzb2Npb25leHQuY29tAAoJED2LAQed4NsG2GMP/2n8xlbLvYKVI5nF
 NP7yn6ZI04pEliuthMZEHxUwOXx7O8luk1NGIOOoTjMJUEO+QGsh9GXwNnhfzL2P
 mtI3Vq5ZZvwpHJPYK9JKze3Dn0apEoUWaqyj2J6s/r3FUmm/k7Y5J3QHLP4fpNG+
 m5cMwxrIPT8oefM/lnF45YDA0VY84SWfHfI39o1qKL+av0VIsN/uzYBwm4uOEyh+
 ZWY4CfL362w6EW03mrTA0RoJUyFmI6Jpcj/dAyU8E4+Fxlu3ZeN9rkUdd6FgVujU
 +JFA/rl/M1iMOAjrkrsknJgTgAEBOXW8zfnflsQS/LXWigC6NgxEXtHg3loAqZQH
 rK+bhWWSbHMkSp4ek0l7owKVhWhiv4TjmStjpVO85Hw0L5hd+La3yv9jRJjjz7Ac
 J3/ROJb/QXItjJr/GU5N6UpBeyWkQXEmueNEKRm3VyQSOjyedFINQ+2hnafCFgcO
 /bJBZUZoNKgj5fK2zUfM/FOsuMGHDb06u3cJfEnS1s5YnDEl2Hr8r/WhUUnYyQZg
 fZP+J/gyZCogrNy/2ijEyPj75b9MQOV9RnatvbirastJNia9hAXI/d3FUCRzVwlp
 5glb84AuiqmFbtCjQZ0kSI8dZI4hwY262ksAPR+yEawNQTU9Ay5uEcYxUq+oj11U
 OWZf9BiDvhCNmHAlX70vWF+M/oYE
 =X9wS
 -----END PGP SIGNATURE-----

Merge tag 'uniphier-v2019.10' of https://gitlab.denx.de/u-boot/custodians/u-boot-uniphier

UniPhier SoC updates for v2019.10

- import DT updates from Linux

- add UniPhier SPI controller driver

- make U-Boot image for 64bit SoCs position independent

- tidy up various init code for next generation SoCs

- misc cleanups
2019-07-11 18:08:44 -04:00
Tom Rini
5acce685c9 Merge branch '2019-07-11-master-imports'
- spear platform improvements
- Android BCB support
- Cadence PCIe endpoint driver
2019-07-11 18:03:52 -04:00
Marek Vasut
4a09831ab2 gpio: pca953x: Add TI TCA9539 compatible string
Add TI TCA9539 compatible string for yet another I2C GPIO expander.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Peng Fan <van.freenix@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2019-07-11 14:11:20 -04:00
Marek Vasut
b2a2bf41ac arm: mach-omap2: am33xx: Init pinmux before clock
The board_early_init_f() inits clock before initing pinmux. However,
the clock configuration code might need to adjust PMIC settings of a
PMIC on I2C bus (e.g. board/ti/am335x/board.c does that). If the I2C
bus pin muxing is not configured before attempting to communicate
with the PMIC, the communication will silently fail and the prcm_init()
may configure fast enough CPU clock that the default voltage provided
by the PMIC would be insufficient and the platform would become
unstable.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jean-Jacques Hiblot <jjhiblot@ti.com>
Cc: Tom Rini <trini@konsulko.com>
2019-07-11 14:11:20 -04:00
Eugeniu Rosca
9bdf0e8fef doc: relocate/rename Android README and add BCB overview
Rename:
 - doc/{README.avb2 => android/avb2.txt}
 - doc/{README.android-fastboot => android/fastboot.txt}

Add a new file documenting the 'bcb' command:
 - doc/android/bcb.txt

The new directory structure has been reviewed by Simon in
https://patchwork.ozlabs.org/patch/1101107/#2176031 .

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-07-11 14:11:19 -04:00
Eugeniu Rosca
db7b7a05b2 cmd: Add 'bcb' command to read/modify/write BCB fields
'Bootloader Control Block' (BCB) is a well established term/acronym in
the Android namespace which refers to a location in a dedicated raw
(i.e. FS-unaware) flash (e.g. eMMC) partition, usually called "misc",
which is used as media for exchanging messages between Android userspace
(particularly recovery [1]) and an Android-capable bootloader.

On higher level, this allows implementing a subset of Android Bootloader
Requirements [2], amongst which is the Android-specific bootloader
flow [3]. Regardless how the latter is implemented in U-Boot ([3] being
the most memorable example), reading/writing/dumping the BCB fields in
the development process from inside the U-Boot is a convenient feature.
Hence, make it available to the users.

Some usage examples of the new command recorded on R-Car H3ULCB-KF
('>>>' is an overlay on top of the original console output):

=> bcb
bcb - Load/set/clear/test/dump/store Android BCB fields

Usage:
bcb load  <dev> <part>       - load  BCB from mmc <dev>:<part>
bcb set   <field> <val>      - set   BCB <field> to <val>
bcb clear [<field>]          - clear BCB <field> or all fields
bcb test  <field> <op> <val> - test  BCB <field> against <val>
bcb dump  <field>            - dump  BCB <field>
bcb store                    - store BCB back to mmc

Legend:
<dev>   - MMC device index containing the BCB partition
<part>  - MMC partition index or name containing the BCB
<field> - one of {command,status,recovery,stage,reserved}
<op>    - the binary operator used in 'bcb test':
          '=' returns true if <val> matches the string stored in <field>
          '~' returns true if <val> matches a subset of <field>'s string
<val>   - string/text provided as input to bcb {set,test}
          NOTE: any ':' character in <val> will be replaced by line feed
          during 'bcb set' and used as separator by upper layers

=> bcb dump command
Error: Please, load BCB first!
 >>> Users must specify mmc device and partition before any other call

=> bcb load 1 misc
=> bcb load 1 1
 >>> The two calls are equivalent (assuming "misc" has index 1)

=> bcb dump command
00000000: 62 6f 6f 74 6f 6e 63 65 2d 73 68 65 6c 6c 00 72    bootonce-shell.r
00000010: 79 00 72 00 00 00 00 00 00 00 00 00 00 00 00 00    y.r.............
 >>> The output is in binary/string format for convenience
 >>> The output size matches the size of inspected BCB field
 >>> (32 bytes in case of 'command')

=> bcb test command = bootonce-shell && echo true
true
=> bcb test command = bootonce-shell- && echo true
=> bcb test command = bootonce-shel && echo true
 >>> The '=' operator returns 'true' on perfect match

=> bcb test command ~ bootonce-shel && echo true
true
=> bcb test command ~ bootonce-shell && echo true
true
 >>> The '~' operator returns 'true' on substring match

=> bcb set command recovery
=> bcb dump command
00000000: 72 65 63 6f 76 65 72 79 00 73 68 65 6c 6c 00 72    recovery.shell.r
00000010: 79 00 72 00 00 00 00 00 00 00 00 00 00 00 00 00    y.r.............
 >>> The new value is NULL-terminated and stored in the BCB field

=> bcb set recovery "msg1:msg2:msg3"
=> bcb dump recovery
00000040: 6d 73 67 31 0a 6d 73 67 32 0a 6d 73 67 33 00 00    msg1.msg2.msg3..
00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
 >>> --- snip ---
 >>> Every ':' is replaced by line-feed '\n' (0xA). The latter is used
 >>> as separator between individual commands by Android userspace

=> bcb store
 >>> Flush/store the BCB structure to MMC

[1] https://android.googlesource.com/platform/bootable/recovery
[2] https://source.android.com/devices/bootloader
[3] https://patchwork.ozlabs.org/patch/746835/
    ("[U-Boot,5/6] Initial support for the Android Bootloader flow")

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
2019-07-11 14:11:19 -04:00
Eugeniu Rosca
0381b713d1 include: android_bootloader_message.h: Minimize the diff to AOSP
Perform the following updates:
 - Relocate the commit id from the file to the description of U-Boot
   commit. The AOSP commit is c784ce50e8c10eaf70e1f97e24e8324aef45faf5.
   This is done to avoid stale references in the file itself. The
   reasoning is in https://patchwork.ozlabs.org/patch/1098056/#2170209.
 - Minimize the diff to AOSP, to decrease the effort of the next AOSP
   backports. The background can be found in:
   https://patchwork.ozlabs.org/patch/1080394/#2168454.
 - Guard the static_assert() calls by #ifndef __UBOOT__ ... #endif,
   to avoid compilation failures of files including the header.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2019-07-11 14:11:19 -04:00
Tom Rini
11bd2fa197 SPL: Default to disabling legacy image support when using FIT
When we have a FIT image being used by SPL by default that means the
most common case is that we'll never run into a legacy image.  Disable
legacy image support by default in that case to reclaim space.

Signed-off-by: Tom Rini <trini@konsulko.com>
2019-07-11 14:11:19 -04:00
Tom Rini
c76c93a3d5 configs: Rename CONFIG_IMAGE_FORMAT_LEGACY to CONFIG_LEGACY_IMAGE_FORMAT
The name CONFIG_LEGACY_IMAGE_FORMAT reads slightly better along with
allowing us to avoid a rather nasty Kbuild/Kconfig issue down the line
with CONFIG_IS_ENABLED(IMAGE_FORMAT_LEGACY).  In a few places outside of
cmd/ switch to using CONFIG_IS_ENABLED() to test what is set.

Signed-off-by: Tom Rini <trini@konsulko.com>
2019-07-11 14:11:18 -04:00
Roman Kapl
27eb177b39 tpm: wait for valid status
The TPM specification says that the EXPECT_DATA bit is not valid until
the VALID bit is set. Wait for that bit to be set. Fixes problems with
Ifineon SPI TPM.

Signed-off-by: Roman Kapl <rka@sysgo.com>
2019-07-11 14:11:18 -04:00
Miquel Raynal
2e8a720246 arm: spear: Return to BootROM if failing to boot from the main device
Overload the weak function board_boot_order() so that besides choosing
the main boot device, we can fallback on USB boot by returning in the
BootROM, eg. if the NOR flash is empty while it was the primary boot
medium.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2019-07-11 10:05:15 -04:00
Miquel Raynal
6d09581f78 arm: spear: Do not link the _main branch
The _main call is not supposed to return at all: don't link the
branch.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2019-07-11 10:05:15 -04:00
Miquel Raynal
f78fdee9fc arm: spear: Support returning to BootROM
Implement the weak board_return_to_bootrom() function so that when
enabling the spl_bootrom.c driver, one can make use of usbboot on
spear platforms. All necessary information to return to the BootROM
are stored in the BootROM's stack. The SPL stack pointer is reset so
we save the BootROM's stack pointer into the SPL .data section.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2019-07-11 10:05:15 -04:00
Miquel Raynal
6a9d0e275f arm: spear: Simplify start.S organization
There is no reason to do the few spear-related initialization, in a
different procedure than 'reset'. Spare one branching and get a linear
code flow by removing this indirection.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2019-07-11 10:05:15 -04:00
Miquel Raynal
08ad72ae81 arm: spear: Reference the link register with LR instead of R14
The link register is stored in R14. ARM assembly code allows to use
the 'lr' name to reference it instead of 'r14' which is not very
meaningful. Do the substitution to ease the reading.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2019-07-11 10:05:15 -04:00
Miquel Raynal
f30765b748 arm: spear: Use PUSH/POP mnemonics when relevant
Quoting ARM "RealView Compilation Tools Assembler Guide v4.0":

        PUSH and POP are synonyms for STMDB and LDM (or LDMIA), with
        the base register sp (r13), and the adjusted address written
        back to the base register.
	PUSH and POP are the preferred mnemonic in these cases.

Let's follow this recommandation to ease the reading and substitute
LDMIA/STMDB operations with PUSH/POP mnemonics.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2019-07-11 10:05:15 -04:00