History log of /u-boot/board/gateworks/gw_ventana/gw_ventana_spl.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 5b1d20b5 30-Apr-2024 Tom Rini <trini@konsulko.com>

board: gateworks: Remove <common.h> and add needed includes

Remove <common.h> from this board vendor directory and when needed
add missing include files directly.

Acked-By: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa3efb6c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_POWER_PFUZE100_I2C_ADDR to CFG

Perform a simple rename of CONFIG_POWER_PFUZE100_I2C_ADDR to CFG_POWER_PFUZE100_I2C_ADDR

Signed-off-by: Tom Rini <trini@konsulko.com>

# 6d38c69e 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_POWER_LTC3676_I2C_ADDR to CFG

Perform a simple rename of CONFIG_POWER_LTC3676_I2C_ADDR to CFG_POWER_LTC3676_I2C_ADDR

Signed-off-by: Tom Rini <trini@konsulko.com>

# 61cf2250 13-Apr-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: use comomn GSC driver

Use the common GSC driver.

This allows us to do some additional cleanup:
- use the GSC driver functions
- move waiting for the EEPROM to the SPL int (it will always be ready
after this)
- move eeprom functions into eeprom file and elimate GSC_I2C_BUS
- eliminate some redundant EEPROM reads (the EEPROM must be read in
SPL before relocation, in SPL after relocation, and in U-Boot init.
All subsequent uses can use the global structure)
- remove unnecessary header files and alphabatize includes

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 6bec6c16 07-Mar-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: move ft_early_fixups out of common

DM is not used for the SPL and a generic DT is used in the SPL
which requires no fixups. Remove the call in the SPL and move the function
into the U-Boot code.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d169313d 07-Mar-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: move SPL uart config out of common

Since DM_SERIAL is used for U-Boot we no longer need legacy UART code in
common.c shared by the SPL and U-Boot. Move the legacy UART config to
the non-DM SPL.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# cb339a00 07-Mar-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: convert to DM_I2C

convert to DM_I2C for U-Boot while leaving SPL legacy I2C:
- Move I2C config from common to SPL
- Move PMIC config from common to SPL (no need to re-configure pmic)
- add DM_I2C support to eeprom/gsc functions shared by SPL and U-Boot

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 45c902c4 24-Jul-2021 Tim Harvey <tharvey@gateworks.com>

imx: ventana: move wdog/uhs-i board/revision dt fixups

Move board/revision specific dt fixups for WDOG and UHS-I features
so that we can call them early for U-Boot control dt as well.

Additionally drop a deprected non-mainline dt-prop fixup regarding
HDMI input format.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d863d054 01-Mar-2021 Tim Harvey <tharvey@gateworks.com>

imx: ventana: convert U-Boot to OF_CONTROL using FIT image

In preparation for dm conversion convert to OF_CONTROL by adding FIT image
support and multi dtb.

Add a board_fit_config_name_match to match the dtb based off of EEPROM
model.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 691d719d 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop init.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# e7dcf564 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Drop environment.h header file where not needed

This header file is now only used by files that access internal
environment features. Drop it from various places where it is not needed.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 6bf6dbee 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get_yesno() to env.h

Move env_get_yesno() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 0ab327a7 21-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: added support for 16bit 8Gb density (1GiB) DRAM

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ebe07ef7 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5908

The GW5908 is a small single board computer based on the i.MX6DL SoC
with the same peripheral set as the GW530x but with 1GiB density DRAM
(64bit 512MiB).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d1c3867a 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5905

The GW5905 is single-board tablet computer based on the i.MX6 SoC with the
following peripheral set:
- eMMC flash (boot device)
- microSD expansion
- LVDS display connector for off-board 3D+1C with PWM backlight
and I2C based touch controller
- MIPI camera connector supporting the TRULY CM8487-B500SA-E (OV5640)
- ublox EMMY-W1 WiFi/Bluetooth/NFC module (SDIO/UART)
- ublox ZOE-M8Q GPS
- LSM9DS1 9-DOF IMU
- 1x 1-lane miniPCIe socket with USB 2.0
- Gateworks System Controller
- Audio jack with TLV320AIC Audio Codec, Speaker AMP
and TSA227E Headphone detect
- MAX8607 3-mode LED camera flash
- DECT ULE module
- FUSB302 USB-C PD and ISL9238 Battery charger

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3f0da874 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove setup of I2C3 from SPL

Do not setup I2C3 in the SPL for Ventana as some devices on that bus
(aic3x codecs) can hang the bus causing i2c_setup to spin endlessly until
they are put into reset. Removing the setup of I2C3 from the SPL allows
the board-specific GPIO to be configured to take care of putting codecs
in reset prior to U-Boot setting up I2C3.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

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

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

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

Signed-off-by: Tom Rini <trini@konsulko.com>

# d024236e 18-Apr-2018 Tom Rini <trini@konsulko.com>

Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTR

We have a large number of places where while we historically referenced
gd in the code we no longer do, as well as cases where the code added
that line "just in case" during development and never dropped it.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 30df9f77 28-Aug-2017 Anatolij Gustschin <agust@denx.de>

imx6: drop duplicated bss memset and board_init_r() call

bss section is cleared in crt0.S. board_init_r() is also
entered from crt0 code.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# 3aa4b703 24-Aug-2017 Breno Lima <breno.lima@nxp.com>

imx: imx6: Move gpr_init() function to soc.c

Since the gpr_init() function is common for boards using MX6S, MX6DL, MX6D,
MX6Q and MX6QP processors move it to the soc.c file.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 310fb14b 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Drop env_relocate_spec() in favour of env_load()

This is a strange name for a function that loads the environment. There is
now only one implementation of this function, so use the new env_load()
function directly instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 552a848e 29-Jun-2017 Stefano Babic <sbabic@denx.de>

imx: reorganize IMX code as other SOCs

Change is consistent with other SOCs and it is in preparation
for adding SOMs. SOC's related files are moved from cpu/ to
mach-imx/<SOC>.

This change is also coherent with the structure in kernel.

Signed-off-by: Stefano Babic <sbabic@denx.de>

CC: Fabio Estevam <fabio.estevam@nxp.com>
CC: Akshay Bhat <akshaybhat@timesys.com>
CC: Ken Lin <Ken.Lin@advantech.com.tw>
CC: Marek Vasut <marek.vasut@gmail.com>
CC: Heiko Schocher <hs@denx.de>
CC: "Sébastien Szymanski" <sebastien.szymanski@armadeus.com>
CC: Christian Gmeiner <christian.gmeiner@gmail.com>
CC: Stefan Roese <sr@denx.de>
CC: Patrick Bruenn <p.bruenn@beckhoff.com>
CC: Troy Kisky <troy.kisky@boundarydevices.com>
CC: Nikita Kiryanov <nikita@compulab.co.il>
CC: Otavio Salvador <otavio@ossystems.com.br>
CC: "Eric Bénard" <eric@eukrea.com>
CC: Jagan Teki <jagan@amarulasolutions.com>
CC: Ye Li <ye.li@nxp.com>
CC: Peng Fan <peng.fan@nxp.com>
CC: Adrian Alonso <adrian.alonso@nxp.com>
CC: Alison Wang <b18965@freescale.com>
CC: Tim Harvey <tharvey@gateworks.com>
CC: Martin Donnelly <martin.donnelly@ge.com>
CC: Marcin Niestroj <m.niestroj@grinn-global.com>
CC: Lukasz Majewski <lukma@denx.de>
CC: Adam Ford <aford173@gmail.com>
CC: "Albert ARIBAUD (3ADEV)" <albert.aribaud@3adev.fr>
CC: Boris Brezillon <boris.brezillon@free-electrons.com>
CC: Soeren Moch <smoch@web.de>
CC: Richard Hu <richard.hu@technexion.com>
CC: Wig Cheng <wig.cheng@technexion.com>
CC: Vanessa Maegima <vanessa.maegima@nxp.com>
CC: Max Krummenacher <max.krummenacher@toradex.com>
CC: Stefan Agner <stefan.agner@toradex.com>
CC: Markus Niebel <Markus.Niebel@tq-group.com>
CC: Breno Lima <breno.lima@nxp.com>
CC: Francesco Montefoschi <francesco.montefoschi@udoo.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Scott Wood <oss@buserror.net>
CC: Joe Hershberger <joe.hershberger@ni.com>
CC: Anatolij Gustschin <agust@denx.de>
CC: Simon Glass <sjg@chromium.org>
CC: "Andrew F. Davis" <afd@ti.com>
CC: "Łukasz Majewski" <l.majewski@samsung.com>
CC: Patrice Chotard <patrice.chotard@st.com>
CC: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
CC: Hans de Goede <hdegoede@redhat.com>
CC: Masahiro Yamada <yamada.masahiro@socionext.com>
CC: Stephen Warren <swarren@nvidia.com>
CC: Andre Przywara <andre.przywara@arm.com>
CC: "Álvaro Fernández Rojas" <noltari@gmail.com>
CC: York Sun <york.sun@nxp.com>
CC: Xiaoliang Yang <xiaoliang.yang@nxp.com>
CC: Chen-Yu Tsai <wens@csie.org>
CC: George McCollister <george.mccollister@gmail.com>
CC: Sven Ebenfeld <sven.ebenfeld@gmail.com>
CC: Filip Brozovic <fbrozovic@gmail.com>
CC: Petr Kulhavy <brain@jikos.cz>
CC: Eric Nelson <eric@nelint.com>
CC: Bai Ping <ping.bai@nxp.com>
CC: Anson Huang <Anson.Huang@nxp.com>
CC: Sanchayan Maity <maitysanchayan@gmail.com>
CC: Lokesh Vutla <lokeshvutla@ti.com>
CC: Patrick Delaunay <patrick.delaunay@st.com>
CC: Gary Bisson <gary.bisson@boundarydevices.com>
CC: Alexander Graf <agraf@suse.de>
CC: u-boot@lists.denx.de
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>

# 214fb19b 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5903 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 8d1a6ff8 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5904 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ad68d7b8 13-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add additional DRAM configurations

- 64bit 8gB density (4GiB) IMX6DQ
- 64bit 4gB density (2GiB) IMX6SDL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>

# edf00937 29-Aug-2016 Fabio Estevam <fabio.estevam@nxp.com>

mx6: ddr: Allow changing REFSEL and REFR fields

Currently MX6 SPL DDR initialization hardcodes the REF_SEL and
REFR fields of the MDREF register as 1 and 7, respectively for
DDR3 and 0 and 3 for LPDDR2.

Looking at the MDREF initialization done via DCD we see that
boards do need to initialize these fields differently:

$ git grep 0x021b0020 board/
board/bachmann/ot1200/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/ccv/xpress/imximage.cfg:DATA 4 0x021b0020 0x00000800 /* MMDC0_MDREF */
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x7800
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6qp.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6dlsabresd.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6slevk/imximage.cfg:DATA 4 0x021b0020 0x00001800
board/freescale/mx6sxsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/freescale/mx6sxsabresd/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/warp/imximage.cfg:DATA 4 0x021b0020 0x00001800

So introduce a mechanism for users to be able to configure
REFSEL and REFR fields as needed.

Keep all the mx6 SPL users in their current REF_SEL and REFR values,
so no functional changes for the existing users.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Eric Nelson <eric@nelint.com>

# 6052b1c6 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: added support for 32bit IMX6DQ 8Gb density DRAM config

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 1b99103f 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: only disable boot watchdog if Falcon mode

If not booting Falcon mode, leave the boot watchdog enabled as a work-around
for other non-resolved bootloader hangs.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3c0fd17f 23-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use EEPROM register for falcon boot mode

NAND+MMC env support costs 12KB in the SPL which is fairly expensive just
for the ability to specify whether or not to boot to uboot or directly
to linux. The Ventana boards have plenty of EEPROM storage so we will use
a byte there to signify if we should boot to the bootloader or to the OS.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 346d106d 03-Nov-2015 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Remove empty reset_cpu()

There is really no need to provide an empty reset_cpu() implementation,
so just remove it.

Cc: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# f2ff8343 17-Aug-2015 Peng Fan <Peng.Fan@freescale.com>

imx: mx6: ddr init MMDC according to ddr_type

To i.MX6, DDR3 and LPDDR2 is supported, so rename function mx6_dram_cfg
to mx6_ddr3_cfg and the original mx6_dram_cfg function only is a wrapper.
The new reimplemented function mx6_dram_cfg only invokes mx6_ddr3_cfg
when ddr_type is for DDR3. Later we can use ddr_type to initialize
MMDC for LPDDR2.

Initialize ddr_type for different boards which enable SPL.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# fdead4be 26-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: hang if board model could not be determined

If the EEPROM could not be read or is corrupt we always want to hang.
Note that an error message will have been displayed by read_eeprom in this
case.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 53940a50 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: config: enable Falcon mode

Falcon mode entails the SPL booting the OS directly instead of U-Boot.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# e06a0362 15-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add pmic_setup to SPL

We need to do any PMIC setup in the SPL if we are to bypass U-Boot for
falcon mode.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# af1db4a3 14-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use stack relocation

Certain features we desire require a larger stack than is available by using
iRAM (most notably for us, env_mmc). Relocate the stack to DRAM so that
we can use these features.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ea7a3c44 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GSC boot watchdog disable to SPL

If the SPL is to be used for Falcon mode then we need to make sure the SPL
disable the GSC boot watchdog.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# c4b44d76 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add gpio setup to SPL

If the SPL is to be used for Falcon mode then we need to make sure it
configures basic GPIO (iomux, padconf, and default output levels).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 2089b7be 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use common uart and i2c setup functions in SPL

Now that uart and i2c setup functions have been moved to common.c we can
use these and remove code duplication.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06c3564d 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: display SPL boot device

Display what device the SPL will fetch uboot.img from

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d783c274 06-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: fix boot to SD

This fixes a regression caused by e25fbe3fe531029dc7b100ea4c79dbc802e17fc2
(gw_ventana: Move the DCD settings to spl code)

The clock gating must be setup prior to calling arch_cpu_init(). Without this
booting to SD (directly via eFuse or via bmode) will hang.

Cc: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# 9e2b0c2d 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Update missing memory/calib handling

This commit combines catching missing memory and calibration data into
one if() block. It further prints pertinent information in determining
why the failure occurred.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 767d88b0 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Add new memory configuration

Add memory configuration for an IMX6SDL + 1GB density DRAM.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 7f14c31b 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove 128x16 calibration (share with 128x32)

The calibration data for dual 2Gb density chips can be used for a single 2Gb
density chip.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06edcb9d 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: updated 16bit DDR calibration

Updated 16bit DDR calibration using values obtained from running the
i.MX6 DDR Stress Test tool over a set of boards over full operationg
temperature.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 75f21e31 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: Add support for GW551x

The GW551x is a small form factor board based on the IMX6 SoC that includes:
* up to 512MB DDR3 memory
* up to 2GB NAND flash
* 1x miniPCIe socket (with USB)
* HDMI out (micro-HDMI)
* HDMI in (micro-HDMI)
* TTL level I/O (supported by GW16111 breakout board):
* I2C
* 2x UART
* CAN
* 2x DIO (GPIO/PWM)
* USB OTG

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# b0b83347 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for 4Gb density mem devices with IMX6DL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 29f0d6b1 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: enable precharge power-down fast-exit mode

Enable fast-exit precharge mode necessary for some DDR3 devices being
used on Ventana boards.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 576cd6b3 04-Dec-2014 Stefan Roese <sr@denx.de>

arm: mx6: gw_ventana: Change clock init to enable NAND related clocks

Otherwise NAND booting is likely to fail. Since this disables the NAND related
clocks and SPL can't load the main U-Boot from NAND.

This problem was introduced with this patch:

e25fbe3f (gw_ventana: Move the DCD settings to spl code)

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# e25fbe3f 14-Nov-2014 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Move the DCD settings to spl code

mx6sabresd_spl.cfg configures CCM registers, GPR registers and CCM_CCOSR.

Move the configuration to the spl code.

CCM_CCOSR setting is no longer required to get audio functionality in the
kernel, so remove such setting.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

# 1dd42e31 29-Sep-2014 Stefan Roese <sr@denx.de>

ARM: mx6: gw_ventana: Remove superfluous memset of GD in board_init_f

Zeroing GD in board_init_f() is not needed any more. As its now done in
crt0.S. The patch that clears the GD in crt0.S is this one:

aae2aef9 [arm: Set up global data before board_init_f()] from Simon.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# c91e4b8b 21-Aug-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: base SPL MMDC calibration on width and size not board

The IMX6 MMDC calibration registers depend on propagation delay and capacitive
loading between the SoC's MMDC and the DDR3 chips. On the Ventana boards the
board layout varies little in trace-lengths such that propagation delays are
irrelevant thus we can simply things by using calibration values obtained
from various board layouts based on a common SoC and DDR chip configuration.

This eliminates board-model from being needed allowing more flexibility. These
values were tested on a large sample size of Gateworks Ventana boards ranging
in layout, and memory configuration over the entire temperature range supported.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 0cc11dea 02-Jun-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: switch to SPL

Switch to an SPL image. The SPL for Ventana does the following:
- setup i2c and read the factory programmed EEPROM to obtain DRAM config
and model for board-specific calibration data
- configure DRAM per CPU/size/layout/devices/calibration
- load u-boot.img from NAND and jump to it

This allows for a single SPL+u-boot.img to replace the previous multiple boa
configurations.

Cc: Stefan Roese <sr@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Andy Ng <andreas2025@gmail.com>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Tapani Utriainen <tapani@technexion.com>
Cc: Tom Rini <trini@ti.com>

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 5b1d20b5 30-Apr-2024 Tom Rini <trini@konsulko.com>

board: gateworks: Remove <common.h> and add needed includes

Remove <common.h> from this board vendor directory and when needed
add missing include files directly.

Acked-By: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa3efb6c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_POWER_PFUZE100_I2C_ADDR to CFG

Perform a simple rename of CONFIG_POWER_PFUZE100_I2C_ADDR to CFG_POWER_PFUZE100_I2C_ADDR

Signed-off-by: Tom Rini <trini@konsulko.com>

# 6d38c69e 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_POWER_LTC3676_I2C_ADDR to CFG

Perform a simple rename of CONFIG_POWER_LTC3676_I2C_ADDR to CFG_POWER_LTC3676_I2C_ADDR

Signed-off-by: Tom Rini <trini@konsulko.com>

# 61cf2250 13-Apr-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: use comomn GSC driver

Use the common GSC driver.

This allows us to do some additional cleanup:
- use the GSC driver functions
- move waiting for the EEPROM to the SPL int (it will always be ready
after this)
- move eeprom functions into eeprom file and elimate GSC_I2C_BUS
- eliminate some redundant EEPROM reads (the EEPROM must be read in
SPL before relocation, in SPL after relocation, and in U-Boot init.
All subsequent uses can use the global structure)
- remove unnecessary header files and alphabatize includes

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 6bec6c16 07-Mar-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: move ft_early_fixups out of common

DM is not used for the SPL and a generic DT is used in the SPL
which requires no fixups. Remove the call in the SPL and move the function
into the U-Boot code.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d169313d 07-Mar-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: move SPL uart config out of common

Since DM_SERIAL is used for U-Boot we no longer need legacy UART code in
common.c shared by the SPL and U-Boot. Move the legacy UART config to
the non-DM SPL.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# cb339a00 07-Mar-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: convert to DM_I2C

convert to DM_I2C for U-Boot while leaving SPL legacy I2C:
- Move I2C config from common to SPL
- Move PMIC config from common to SPL (no need to re-configure pmic)
- add DM_I2C support to eeprom/gsc functions shared by SPL and U-Boot

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 45c902c4 24-Jul-2021 Tim Harvey <tharvey@gateworks.com>

imx: ventana: move wdog/uhs-i board/revision dt fixups

Move board/revision specific dt fixups for WDOG and UHS-I features
so that we can call them early for U-Boot control dt as well.

Additionally drop a deprected non-mainline dt-prop fixup regarding
HDMI input format.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d863d054 01-Mar-2021 Tim Harvey <tharvey@gateworks.com>

imx: ventana: convert U-Boot to OF_CONTROL using FIT image

In preparation for dm conversion convert to OF_CONTROL by adding FIT image
support and multi dtb.

Add a board_fit_config_name_match to match the dtb based off of EEPROM
model.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 691d719d 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop init.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# e7dcf564 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Drop environment.h header file where not needed

This header file is now only used by files that access internal
environment features. Drop it from various places where it is not needed.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 6bf6dbee 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get_yesno() to env.h

Move env_get_yesno() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 0ab327a7 21-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: added support for 16bit 8Gb density (1GiB) DRAM

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ebe07ef7 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5908

The GW5908 is a small single board computer based on the i.MX6DL SoC
with the same peripheral set as the GW530x but with 1GiB density DRAM
(64bit 512MiB).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d1c3867a 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5905

The GW5905 is single-board tablet computer based on the i.MX6 SoC with the
following peripheral set:
- eMMC flash (boot device)
- microSD expansion
- LVDS display connector for off-board 3D+1C with PWM backlight
and I2C based touch controller
- MIPI camera connector supporting the TRULY CM8487-B500SA-E (OV5640)
- ublox EMMY-W1 WiFi/Bluetooth/NFC module (SDIO/UART)
- ublox ZOE-M8Q GPS
- LSM9DS1 9-DOF IMU
- 1x 1-lane miniPCIe socket with USB 2.0
- Gateworks System Controller
- Audio jack with TLV320AIC Audio Codec, Speaker AMP
and TSA227E Headphone detect
- MAX8607 3-mode LED camera flash
- DECT ULE module
- FUSB302 USB-C PD and ISL9238 Battery charger

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3f0da874 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove setup of I2C3 from SPL

Do not setup I2C3 in the SPL for Ventana as some devices on that bus
(aic3x codecs) can hang the bus causing i2c_setup to spin endlessly until
they are put into reset. Removing the setup of I2C3 from the SPL allows
the board-specific GPIO to be configured to take care of putting codecs
in reset prior to U-Boot setting up I2C3.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

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

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

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

Signed-off-by: Tom Rini <trini@konsulko.com>

# d024236e 18-Apr-2018 Tom Rini <trini@konsulko.com>

Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTR

We have a large number of places where while we historically referenced
gd in the code we no longer do, as well as cases where the code added
that line "just in case" during development and never dropped it.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 30df9f77 28-Aug-2017 Anatolij Gustschin <agust@denx.de>

imx6: drop duplicated bss memset and board_init_r() call

bss section is cleared in crt0.S. board_init_r() is also
entered from crt0 code.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# 3aa4b703 24-Aug-2017 Breno Lima <breno.lima@nxp.com>

imx: imx6: Move gpr_init() function to soc.c

Since the gpr_init() function is common for boards using MX6S, MX6DL, MX6D,
MX6Q and MX6QP processors move it to the soc.c file.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 310fb14b 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Drop env_relocate_spec() in favour of env_load()

This is a strange name for a function that loads the environment. There is
now only one implementation of this function, so use the new env_load()
function directly instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 552a848e 29-Jun-2017 Stefano Babic <sbabic@denx.de>

imx: reorganize IMX code as other SOCs

Change is consistent with other SOCs and it is in preparation
for adding SOMs. SOC's related files are moved from cpu/ to
mach-imx/<SOC>.

This change is also coherent with the structure in kernel.

Signed-off-by: Stefano Babic <sbabic@denx.de>

CC: Fabio Estevam <fabio.estevam@nxp.com>
CC: Akshay Bhat <akshaybhat@timesys.com>
CC: Ken Lin <Ken.Lin@advantech.com.tw>
CC: Marek Vasut <marek.vasut@gmail.com>
CC: Heiko Schocher <hs@denx.de>
CC: "Sébastien Szymanski" <sebastien.szymanski@armadeus.com>
CC: Christian Gmeiner <christian.gmeiner@gmail.com>
CC: Stefan Roese <sr@denx.de>
CC: Patrick Bruenn <p.bruenn@beckhoff.com>
CC: Troy Kisky <troy.kisky@boundarydevices.com>
CC: Nikita Kiryanov <nikita@compulab.co.il>
CC: Otavio Salvador <otavio@ossystems.com.br>
CC: "Eric Bénard" <eric@eukrea.com>
CC: Jagan Teki <jagan@amarulasolutions.com>
CC: Ye Li <ye.li@nxp.com>
CC: Peng Fan <peng.fan@nxp.com>
CC: Adrian Alonso <adrian.alonso@nxp.com>
CC: Alison Wang <b18965@freescale.com>
CC: Tim Harvey <tharvey@gateworks.com>
CC: Martin Donnelly <martin.donnelly@ge.com>
CC: Marcin Niestroj <m.niestroj@grinn-global.com>
CC: Lukasz Majewski <lukma@denx.de>
CC: Adam Ford <aford173@gmail.com>
CC: "Albert ARIBAUD (3ADEV)" <albert.aribaud@3adev.fr>
CC: Boris Brezillon <boris.brezillon@free-electrons.com>
CC: Soeren Moch <smoch@web.de>
CC: Richard Hu <richard.hu@technexion.com>
CC: Wig Cheng <wig.cheng@technexion.com>
CC: Vanessa Maegima <vanessa.maegima@nxp.com>
CC: Max Krummenacher <max.krummenacher@toradex.com>
CC: Stefan Agner <stefan.agner@toradex.com>
CC: Markus Niebel <Markus.Niebel@tq-group.com>
CC: Breno Lima <breno.lima@nxp.com>
CC: Francesco Montefoschi <francesco.montefoschi@udoo.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Scott Wood <oss@buserror.net>
CC: Joe Hershberger <joe.hershberger@ni.com>
CC: Anatolij Gustschin <agust@denx.de>
CC: Simon Glass <sjg@chromium.org>
CC: "Andrew F. Davis" <afd@ti.com>
CC: "Łukasz Majewski" <l.majewski@samsung.com>
CC: Patrice Chotard <patrice.chotard@st.com>
CC: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
CC: Hans de Goede <hdegoede@redhat.com>
CC: Masahiro Yamada <yamada.masahiro@socionext.com>
CC: Stephen Warren <swarren@nvidia.com>
CC: Andre Przywara <andre.przywara@arm.com>
CC: "Álvaro Fernández Rojas" <noltari@gmail.com>
CC: York Sun <york.sun@nxp.com>
CC: Xiaoliang Yang <xiaoliang.yang@nxp.com>
CC: Chen-Yu Tsai <wens@csie.org>
CC: George McCollister <george.mccollister@gmail.com>
CC: Sven Ebenfeld <sven.ebenfeld@gmail.com>
CC: Filip Brozovic <fbrozovic@gmail.com>
CC: Petr Kulhavy <brain@jikos.cz>
CC: Eric Nelson <eric@nelint.com>
CC: Bai Ping <ping.bai@nxp.com>
CC: Anson Huang <Anson.Huang@nxp.com>
CC: Sanchayan Maity <maitysanchayan@gmail.com>
CC: Lokesh Vutla <lokeshvutla@ti.com>
CC: Patrick Delaunay <patrick.delaunay@st.com>
CC: Gary Bisson <gary.bisson@boundarydevices.com>
CC: Alexander Graf <agraf@suse.de>
CC: u-boot@lists.denx.de
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>

# 214fb19b 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5903 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 8d1a6ff8 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5904 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ad68d7b8 13-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add additional DRAM configurations

- 64bit 8gB density (4GiB) IMX6DQ
- 64bit 4gB density (2GiB) IMX6SDL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>

# edf00937 29-Aug-2016 Fabio Estevam <fabio.estevam@nxp.com>

mx6: ddr: Allow changing REFSEL and REFR fields

Currently MX6 SPL DDR initialization hardcodes the REF_SEL and
REFR fields of the MDREF register as 1 and 7, respectively for
DDR3 and 0 and 3 for LPDDR2.

Looking at the MDREF initialization done via DCD we see that
boards do need to initialize these fields differently:

$ git grep 0x021b0020 board/
board/bachmann/ot1200/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/ccv/xpress/imximage.cfg:DATA 4 0x021b0020 0x00000800 /* MMDC0_MDREF */
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x7800
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6qp.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6dlsabresd.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6slevk/imximage.cfg:DATA 4 0x021b0020 0x00001800
board/freescale/mx6sxsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/freescale/mx6sxsabresd/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/warp/imximage.cfg:DATA 4 0x021b0020 0x00001800

So introduce a mechanism for users to be able to configure
REFSEL and REFR fields as needed.

Keep all the mx6 SPL users in their current REF_SEL and REFR values,
so no functional changes for the existing users.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Eric Nelson <eric@nelint.com>

# 6052b1c6 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: added support for 32bit IMX6DQ 8Gb density DRAM config

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 1b99103f 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: only disable boot watchdog if Falcon mode

If not booting Falcon mode, leave the boot watchdog enabled as a work-around
for other non-resolved bootloader hangs.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3c0fd17f 23-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use EEPROM register for falcon boot mode

NAND+MMC env support costs 12KB in the SPL which is fairly expensive just
for the ability to specify whether or not to boot to uboot or directly
to linux. The Ventana boards have plenty of EEPROM storage so we will use
a byte there to signify if we should boot to the bootloader or to the OS.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 346d106d 03-Nov-2015 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Remove empty reset_cpu()

There is really no need to provide an empty reset_cpu() implementation,
so just remove it.

Cc: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# f2ff8343 17-Aug-2015 Peng Fan <Peng.Fan@freescale.com>

imx: mx6: ddr init MMDC according to ddr_type

To i.MX6, DDR3 and LPDDR2 is supported, so rename function mx6_dram_cfg
to mx6_ddr3_cfg and the original mx6_dram_cfg function only is a wrapper.
The new reimplemented function mx6_dram_cfg only invokes mx6_ddr3_cfg
when ddr_type is for DDR3. Later we can use ddr_type to initialize
MMDC for LPDDR2.

Initialize ddr_type for different boards which enable SPL.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# fdead4be 26-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: hang if board model could not be determined

If the EEPROM could not be read or is corrupt we always want to hang.
Note that an error message will have been displayed by read_eeprom in this
case.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 53940a50 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: config: enable Falcon mode

Falcon mode entails the SPL booting the OS directly instead of U-Boot.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# e06a0362 15-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add pmic_setup to SPL

We need to do any PMIC setup in the SPL if we are to bypass U-Boot for
falcon mode.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# af1db4a3 14-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use stack relocation

Certain features we desire require a larger stack than is available by using
iRAM (most notably for us, env_mmc). Relocate the stack to DRAM so that
we can use these features.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ea7a3c44 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GSC boot watchdog disable to SPL

If the SPL is to be used for Falcon mode then we need to make sure the SPL
disable the GSC boot watchdog.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# c4b44d76 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add gpio setup to SPL

If the SPL is to be used for Falcon mode then we need to make sure it
configures basic GPIO (iomux, padconf, and default output levels).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 2089b7be 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use common uart and i2c setup functions in SPL

Now that uart and i2c setup functions have been moved to common.c we can
use these and remove code duplication.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06c3564d 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: display SPL boot device

Display what device the SPL will fetch uboot.img from

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d783c274 06-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: fix boot to SD

This fixes a regression caused by e25fbe3fe531029dc7b100ea4c79dbc802e17fc2
(gw_ventana: Move the DCD settings to spl code)

The clock gating must be setup prior to calling arch_cpu_init(). Without this
booting to SD (directly via eFuse or via bmode) will hang.

Cc: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# 9e2b0c2d 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Update missing memory/calib handling

This commit combines catching missing memory and calibration data into
one if() block. It further prints pertinent information in determining
why the failure occurred.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 767d88b0 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Add new memory configuration

Add memory configuration for an IMX6SDL + 1GB density DRAM.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 7f14c31b 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove 128x16 calibration (share with 128x32)

The calibration data for dual 2Gb density chips can be used for a single 2Gb
density chip.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06edcb9d 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: updated 16bit DDR calibration

Updated 16bit DDR calibration using values obtained from running the
i.MX6 DDR Stress Test tool over a set of boards over full operationg
temperature.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 75f21e31 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: Add support for GW551x

The GW551x is a small form factor board based on the IMX6 SoC that includes:
* up to 512MB DDR3 memory
* up to 2GB NAND flash
* 1x miniPCIe socket (with USB)
* HDMI out (micro-HDMI)
* HDMI in (micro-HDMI)
* TTL level I/O (supported by GW16111 breakout board):
* I2C
* 2x UART
* CAN
* 2x DIO (GPIO/PWM)
* USB OTG

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# b0b83347 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for 4Gb density mem devices with IMX6DL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 29f0d6b1 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: enable precharge power-down fast-exit mode

Enable fast-exit precharge mode necessary for some DDR3 devices being
used on Ventana boards.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 576cd6b3 04-Dec-2014 Stefan Roese <sr@denx.de>

arm: mx6: gw_ventana: Change clock init to enable NAND related clocks

Otherwise NAND booting is likely to fail. Since this disables the NAND related
clocks and SPL can't load the main U-Boot from NAND.

This problem was introduced with this patch:

e25fbe3f (gw_ventana: Move the DCD settings to spl code)

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# e25fbe3f 14-Nov-2014 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Move the DCD settings to spl code

mx6sabresd_spl.cfg configures CCM registers, GPR registers and CCM_CCOSR.

Move the configuration to the spl code.

CCM_CCOSR setting is no longer required to get audio functionality in the
kernel, so remove such setting.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

# 1dd42e31 29-Sep-2014 Stefan Roese <sr@denx.de>

ARM: mx6: gw_ventana: Remove superfluous memset of GD in board_init_f

Zeroing GD in board_init_f() is not needed any more. As its now done in
crt0.S. The patch that clears the GD in crt0.S is this one:

aae2aef9 [arm: Set up global data before board_init_f()] from Simon.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# c91e4b8b 21-Aug-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: base SPL MMDC calibration on width and size not board

The IMX6 MMDC calibration registers depend on propagation delay and capacitive
loading between the SoC's MMDC and the DDR3 chips. On the Ventana boards the
board layout varies little in trace-lengths such that propagation delays are
irrelevant thus we can simply things by using calibration values obtained
from various board layouts based on a common SoC and DDR chip configuration.

This eliminates board-model from being needed allowing more flexibility. These
values were tested on a large sample size of Gateworks Ventana boards ranging
in layout, and memory configuration over the entire temperature range supported.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 0cc11dea 02-Jun-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: switch to SPL

Switch to an SPL image. The SPL for Ventana does the following:
- setup i2c and read the factory programmed EEPROM to obtain DRAM config
and model for board-specific calibration data
- configure DRAM per CPU/size/layout/devices/calibration
- load u-boot.img from NAND and jump to it

This allows for a single SPL+u-boot.img to replace the previous multiple boa
configurations.

Cc: Stefan Roese <sr@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Andy Ng <andreas2025@gmail.com>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Tapani Utriainen <tapani@technexion.com>
Cc: Tom Rini <trini@ti.com>

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# aa3efb6c 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_POWER_PFUZE100_I2C_ADDR to CFG

Perform a simple rename of CONFIG_POWER_PFUZE100_I2C_ADDR to CFG_POWER_PFUZE100_I2C_ADDR

Signed-off-by: Tom Rini <trini@konsulko.com>

# 6d38c69e 04-Dec-2022 Tom Rini <trini@konsulko.com>

global: Migrate CONFIG_POWER_LTC3676_I2C_ADDR to CFG

Perform a simple rename of CONFIG_POWER_LTC3676_I2C_ADDR to CFG_POWER_LTC3676_I2C_ADDR

Signed-off-by: Tom Rini <trini@konsulko.com>

# 61cf2250 13-Apr-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: use comomn GSC driver

Use the common GSC driver.

This allows us to do some additional cleanup:
- use the GSC driver functions
- move waiting for the EEPROM to the SPL int (it will always be ready
after this)
- move eeprom functions into eeprom file and elimate GSC_I2C_BUS
- eliminate some redundant EEPROM reads (the EEPROM must be read in
SPL before relocation, in SPL after relocation, and in U-Boot init.
All subsequent uses can use the global structure)
- remove unnecessary header files and alphabatize includes

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 6bec6c16 07-Mar-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: move ft_early_fixups out of common

DM is not used for the SPL and a generic DT is used in the SPL
which requires no fixups. Remove the call in the SPL and move the function
into the U-Boot code.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d169313d 07-Mar-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: move SPL uart config out of common

Since DM_SERIAL is used for U-Boot we no longer need legacy UART code in
common.c shared by the SPL and U-Boot. Move the legacy UART config to
the non-DM SPL.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# cb339a00 07-Mar-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: convert to DM_I2C

convert to DM_I2C for U-Boot while leaving SPL legacy I2C:
- Move I2C config from common to SPL
- Move PMIC config from common to SPL (no need to re-configure pmic)
- add DM_I2C support to eeprom/gsc functions shared by SPL and U-Boot

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 45c902c4 24-Jul-2021 Tim Harvey <tharvey@gateworks.com>

imx: ventana: move wdog/uhs-i board/revision dt fixups

Move board/revision specific dt fixups for WDOG and UHS-I features
so that we can call them early for U-Boot control dt as well.

Additionally drop a deprected non-mainline dt-prop fixup regarding
HDMI input format.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d863d054 01-Mar-2021 Tim Harvey <tharvey@gateworks.com>

imx: ventana: convert U-Boot to OF_CONTROL using FIT image

In preparation for dm conversion convert to OF_CONTROL by adding FIT image
support and multi dtb.

Add a board_fit_config_name_match to match the dtb based off of EEPROM
model.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 691d719d 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop init.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# e7dcf564 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Drop environment.h header file where not needed

This header file is now only used by files that access internal
environment features. Drop it from various places where it is not needed.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 6bf6dbee 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get_yesno() to env.h

Move env_get_yesno() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 0ab327a7 21-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: added support for 16bit 8Gb density (1GiB) DRAM

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ebe07ef7 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5908

The GW5908 is a small single board computer based on the i.MX6DL SoC
with the same peripheral set as the GW530x but with 1GiB density DRAM
(64bit 512MiB).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d1c3867a 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5905

The GW5905 is single-board tablet computer based on the i.MX6 SoC with the
following peripheral set:
- eMMC flash (boot device)
- microSD expansion
- LVDS display connector for off-board 3D+1C with PWM backlight
and I2C based touch controller
- MIPI camera connector supporting the TRULY CM8487-B500SA-E (OV5640)
- ublox EMMY-W1 WiFi/Bluetooth/NFC module (SDIO/UART)
- ublox ZOE-M8Q GPS
- LSM9DS1 9-DOF IMU
- 1x 1-lane miniPCIe socket with USB 2.0
- Gateworks System Controller
- Audio jack with TLV320AIC Audio Codec, Speaker AMP
and TSA227E Headphone detect
- MAX8607 3-mode LED camera flash
- DECT ULE module
- FUSB302 USB-C PD and ISL9238 Battery charger

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3f0da874 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove setup of I2C3 from SPL

Do not setup I2C3 in the SPL for Ventana as some devices on that bus
(aic3x codecs) can hang the bus causing i2c_setup to spin endlessly until
they are put into reset. Removing the setup of I2C3 from the SPL allows
the board-specific GPIO to be configured to take care of putting codecs
in reset prior to U-Boot setting up I2C3.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

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

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

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

Signed-off-by: Tom Rini <trini@konsulko.com>

# d024236e 18-Apr-2018 Tom Rini <trini@konsulko.com>

Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTR

We have a large number of places where while we historically referenced
gd in the code we no longer do, as well as cases where the code added
that line "just in case" during development and never dropped it.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 30df9f77 28-Aug-2017 Anatolij Gustschin <agust@denx.de>

imx6: drop duplicated bss memset and board_init_r() call

bss section is cleared in crt0.S. board_init_r() is also
entered from crt0 code.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# 3aa4b703 24-Aug-2017 Breno Lima <breno.lima@nxp.com>

imx: imx6: Move gpr_init() function to soc.c

Since the gpr_init() function is common for boards using MX6S, MX6DL, MX6D,
MX6Q and MX6QP processors move it to the soc.c file.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 310fb14b 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Drop env_relocate_spec() in favour of env_load()

This is a strange name for a function that loads the environment. There is
now only one implementation of this function, so use the new env_load()
function directly instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 552a848e 29-Jun-2017 Stefano Babic <sbabic@denx.de>

imx: reorganize IMX code as other SOCs

Change is consistent with other SOCs and it is in preparation
for adding SOMs. SOC's related files are moved from cpu/ to
mach-imx/<SOC>.

This change is also coherent with the structure in kernel.

Signed-off-by: Stefano Babic <sbabic@denx.de>

CC: Fabio Estevam <fabio.estevam@nxp.com>
CC: Akshay Bhat <akshaybhat@timesys.com>
CC: Ken Lin <Ken.Lin@advantech.com.tw>
CC: Marek Vasut <marek.vasut@gmail.com>
CC: Heiko Schocher <hs@denx.de>
CC: "Sébastien Szymanski" <sebastien.szymanski@armadeus.com>
CC: Christian Gmeiner <christian.gmeiner@gmail.com>
CC: Stefan Roese <sr@denx.de>
CC: Patrick Bruenn <p.bruenn@beckhoff.com>
CC: Troy Kisky <troy.kisky@boundarydevices.com>
CC: Nikita Kiryanov <nikita@compulab.co.il>
CC: Otavio Salvador <otavio@ossystems.com.br>
CC: "Eric Bénard" <eric@eukrea.com>
CC: Jagan Teki <jagan@amarulasolutions.com>
CC: Ye Li <ye.li@nxp.com>
CC: Peng Fan <peng.fan@nxp.com>
CC: Adrian Alonso <adrian.alonso@nxp.com>
CC: Alison Wang <b18965@freescale.com>
CC: Tim Harvey <tharvey@gateworks.com>
CC: Martin Donnelly <martin.donnelly@ge.com>
CC: Marcin Niestroj <m.niestroj@grinn-global.com>
CC: Lukasz Majewski <lukma@denx.de>
CC: Adam Ford <aford173@gmail.com>
CC: "Albert ARIBAUD (3ADEV)" <albert.aribaud@3adev.fr>
CC: Boris Brezillon <boris.brezillon@free-electrons.com>
CC: Soeren Moch <smoch@web.de>
CC: Richard Hu <richard.hu@technexion.com>
CC: Wig Cheng <wig.cheng@technexion.com>
CC: Vanessa Maegima <vanessa.maegima@nxp.com>
CC: Max Krummenacher <max.krummenacher@toradex.com>
CC: Stefan Agner <stefan.agner@toradex.com>
CC: Markus Niebel <Markus.Niebel@tq-group.com>
CC: Breno Lima <breno.lima@nxp.com>
CC: Francesco Montefoschi <francesco.montefoschi@udoo.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Scott Wood <oss@buserror.net>
CC: Joe Hershberger <joe.hershberger@ni.com>
CC: Anatolij Gustschin <agust@denx.de>
CC: Simon Glass <sjg@chromium.org>
CC: "Andrew F. Davis" <afd@ti.com>
CC: "Łukasz Majewski" <l.majewski@samsung.com>
CC: Patrice Chotard <patrice.chotard@st.com>
CC: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
CC: Hans de Goede <hdegoede@redhat.com>
CC: Masahiro Yamada <yamada.masahiro@socionext.com>
CC: Stephen Warren <swarren@nvidia.com>
CC: Andre Przywara <andre.przywara@arm.com>
CC: "Álvaro Fernández Rojas" <noltari@gmail.com>
CC: York Sun <york.sun@nxp.com>
CC: Xiaoliang Yang <xiaoliang.yang@nxp.com>
CC: Chen-Yu Tsai <wens@csie.org>
CC: George McCollister <george.mccollister@gmail.com>
CC: Sven Ebenfeld <sven.ebenfeld@gmail.com>
CC: Filip Brozovic <fbrozovic@gmail.com>
CC: Petr Kulhavy <brain@jikos.cz>
CC: Eric Nelson <eric@nelint.com>
CC: Bai Ping <ping.bai@nxp.com>
CC: Anson Huang <Anson.Huang@nxp.com>
CC: Sanchayan Maity <maitysanchayan@gmail.com>
CC: Lokesh Vutla <lokeshvutla@ti.com>
CC: Patrick Delaunay <patrick.delaunay@st.com>
CC: Gary Bisson <gary.bisson@boundarydevices.com>
CC: Alexander Graf <agraf@suse.de>
CC: u-boot@lists.denx.de
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>

# 214fb19b 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5903 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 8d1a6ff8 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5904 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ad68d7b8 13-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add additional DRAM configurations

- 64bit 8gB density (4GiB) IMX6DQ
- 64bit 4gB density (2GiB) IMX6SDL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>

# edf00937 29-Aug-2016 Fabio Estevam <fabio.estevam@nxp.com>

mx6: ddr: Allow changing REFSEL and REFR fields

Currently MX6 SPL DDR initialization hardcodes the REF_SEL and
REFR fields of the MDREF register as 1 and 7, respectively for
DDR3 and 0 and 3 for LPDDR2.

Looking at the MDREF initialization done via DCD we see that
boards do need to initialize these fields differently:

$ git grep 0x021b0020 board/
board/bachmann/ot1200/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/ccv/xpress/imximage.cfg:DATA 4 0x021b0020 0x00000800 /* MMDC0_MDREF */
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x7800
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6qp.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6dlsabresd.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6slevk/imximage.cfg:DATA 4 0x021b0020 0x00001800
board/freescale/mx6sxsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/freescale/mx6sxsabresd/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/warp/imximage.cfg:DATA 4 0x021b0020 0x00001800

So introduce a mechanism for users to be able to configure
REFSEL and REFR fields as needed.

Keep all the mx6 SPL users in their current REF_SEL and REFR values,
so no functional changes for the existing users.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Eric Nelson <eric@nelint.com>

# 6052b1c6 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: added support for 32bit IMX6DQ 8Gb density DRAM config

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 1b99103f 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: only disable boot watchdog if Falcon mode

If not booting Falcon mode, leave the boot watchdog enabled as a work-around
for other non-resolved bootloader hangs.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3c0fd17f 23-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use EEPROM register for falcon boot mode

NAND+MMC env support costs 12KB in the SPL which is fairly expensive just
for the ability to specify whether or not to boot to uboot or directly
to linux. The Ventana boards have plenty of EEPROM storage so we will use
a byte there to signify if we should boot to the bootloader or to the OS.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 346d106d 03-Nov-2015 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Remove empty reset_cpu()

There is really no need to provide an empty reset_cpu() implementation,
so just remove it.

Cc: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# f2ff8343 17-Aug-2015 Peng Fan <Peng.Fan@freescale.com>

imx: mx6: ddr init MMDC according to ddr_type

To i.MX6, DDR3 and LPDDR2 is supported, so rename function mx6_dram_cfg
to mx6_ddr3_cfg and the original mx6_dram_cfg function only is a wrapper.
The new reimplemented function mx6_dram_cfg only invokes mx6_ddr3_cfg
when ddr_type is for DDR3. Later we can use ddr_type to initialize
MMDC for LPDDR2.

Initialize ddr_type for different boards which enable SPL.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# fdead4be 26-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: hang if board model could not be determined

If the EEPROM could not be read or is corrupt we always want to hang.
Note that an error message will have been displayed by read_eeprom in this
case.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 53940a50 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: config: enable Falcon mode

Falcon mode entails the SPL booting the OS directly instead of U-Boot.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# e06a0362 15-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add pmic_setup to SPL

We need to do any PMIC setup in the SPL if we are to bypass U-Boot for
falcon mode.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# af1db4a3 14-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use stack relocation

Certain features we desire require a larger stack than is available by using
iRAM (most notably for us, env_mmc). Relocate the stack to DRAM so that
we can use these features.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ea7a3c44 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GSC boot watchdog disable to SPL

If the SPL is to be used for Falcon mode then we need to make sure the SPL
disable the GSC boot watchdog.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# c4b44d76 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add gpio setup to SPL

If the SPL is to be used for Falcon mode then we need to make sure it
configures basic GPIO (iomux, padconf, and default output levels).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 2089b7be 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use common uart and i2c setup functions in SPL

Now that uart and i2c setup functions have been moved to common.c we can
use these and remove code duplication.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06c3564d 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: display SPL boot device

Display what device the SPL will fetch uboot.img from

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d783c274 06-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: fix boot to SD

This fixes a regression caused by e25fbe3fe531029dc7b100ea4c79dbc802e17fc2
(gw_ventana: Move the DCD settings to spl code)

The clock gating must be setup prior to calling arch_cpu_init(). Without this
booting to SD (directly via eFuse or via bmode) will hang.

Cc: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# 9e2b0c2d 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Update missing memory/calib handling

This commit combines catching missing memory and calibration data into
one if() block. It further prints pertinent information in determining
why the failure occurred.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 767d88b0 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Add new memory configuration

Add memory configuration for an IMX6SDL + 1GB density DRAM.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 7f14c31b 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove 128x16 calibration (share with 128x32)

The calibration data for dual 2Gb density chips can be used for a single 2Gb
density chip.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06edcb9d 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: updated 16bit DDR calibration

Updated 16bit DDR calibration using values obtained from running the
i.MX6 DDR Stress Test tool over a set of boards over full operationg
temperature.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 75f21e31 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: Add support for GW551x

The GW551x is a small form factor board based on the IMX6 SoC that includes:
* up to 512MB DDR3 memory
* up to 2GB NAND flash
* 1x miniPCIe socket (with USB)
* HDMI out (micro-HDMI)
* HDMI in (micro-HDMI)
* TTL level I/O (supported by GW16111 breakout board):
* I2C
* 2x UART
* CAN
* 2x DIO (GPIO/PWM)
* USB OTG

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# b0b83347 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for 4Gb density mem devices with IMX6DL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 29f0d6b1 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: enable precharge power-down fast-exit mode

Enable fast-exit precharge mode necessary for some DDR3 devices being
used on Ventana boards.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 576cd6b3 04-Dec-2014 Stefan Roese <sr@denx.de>

arm: mx6: gw_ventana: Change clock init to enable NAND related clocks

Otherwise NAND booting is likely to fail. Since this disables the NAND related
clocks and SPL can't load the main U-Boot from NAND.

This problem was introduced with this patch:

e25fbe3f (gw_ventana: Move the DCD settings to spl code)

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# e25fbe3f 14-Nov-2014 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Move the DCD settings to spl code

mx6sabresd_spl.cfg configures CCM registers, GPR registers and CCM_CCOSR.

Move the configuration to the spl code.

CCM_CCOSR setting is no longer required to get audio functionality in the
kernel, so remove such setting.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

# 1dd42e31 29-Sep-2014 Stefan Roese <sr@denx.de>

ARM: mx6: gw_ventana: Remove superfluous memset of GD in board_init_f

Zeroing GD in board_init_f() is not needed any more. As its now done in
crt0.S. The patch that clears the GD in crt0.S is this one:

aae2aef9 [arm: Set up global data before board_init_f()] from Simon.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# c91e4b8b 21-Aug-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: base SPL MMDC calibration on width and size not board

The IMX6 MMDC calibration registers depend on propagation delay and capacitive
loading between the SoC's MMDC and the DDR3 chips. On the Ventana boards the
board layout varies little in trace-lengths such that propagation delays are
irrelevant thus we can simply things by using calibration values obtained
from various board layouts based on a common SoC and DDR chip configuration.

This eliminates board-model from being needed allowing more flexibility. These
values were tested on a large sample size of Gateworks Ventana boards ranging
in layout, and memory configuration over the entire temperature range supported.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 0cc11dea 02-Jun-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: switch to SPL

Switch to an SPL image. The SPL for Ventana does the following:
- setup i2c and read the factory programmed EEPROM to obtain DRAM config
and model for board-specific calibration data
- configure DRAM per CPU/size/layout/devices/calibration
- load u-boot.img from NAND and jump to it

This allows for a single SPL+u-boot.img to replace the previous multiple boa
configurations.

Cc: Stefan Roese <sr@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Andy Ng <andreas2025@gmail.com>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Tapani Utriainen <tapani@technexion.com>
Cc: Tom Rini <trini@ti.com>

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 61cf2250 13-Apr-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: use comomn GSC driver

Use the common GSC driver.

This allows us to do some additional cleanup:
- use the GSC driver functions
- move waiting for the EEPROM to the SPL int (it will always be ready
after this)
- move eeprom functions into eeprom file and elimate GSC_I2C_BUS
- eliminate some redundant EEPROM reads (the EEPROM must be read in
SPL before relocation, in SPL after relocation, and in U-Boot init.
All subsequent uses can use the global structure)
- remove unnecessary header files and alphabatize includes

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 6bec6c16 07-Mar-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: move ft_early_fixups out of common

DM is not used for the SPL and a generic DT is used in the SPL
which requires no fixups. Remove the call in the SPL and move the function
into the U-Boot code.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d169313d 07-Mar-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: move SPL uart config out of common

Since DM_SERIAL is used for U-Boot we no longer need legacy UART code in
common.c shared by the SPL and U-Boot. Move the legacy UART config to
the non-DM SPL.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# cb339a00 07-Mar-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: convert to DM_I2C

convert to DM_I2C for U-Boot while leaving SPL legacy I2C:
- Move I2C config from common to SPL
- Move PMIC config from common to SPL (no need to re-configure pmic)
- add DM_I2C support to eeprom/gsc functions shared by SPL and U-Boot

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 45c902c4 24-Jul-2021 Tim Harvey <tharvey@gateworks.com>

imx: ventana: move wdog/uhs-i board/revision dt fixups

Move board/revision specific dt fixups for WDOG and UHS-I features
so that we can call them early for U-Boot control dt as well.

Additionally drop a deprected non-mainline dt-prop fixup regarding
HDMI input format.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d863d054 01-Mar-2021 Tim Harvey <tharvey@gateworks.com>

imx: ventana: convert U-Boot to OF_CONTROL using FIT image

In preparation for dm conversion convert to OF_CONTROL by adding FIT image
support and multi dtb.

Add a board_fit_config_name_match to match the dtb based off of EEPROM
model.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 691d719d 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop init.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# e7dcf564 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Drop environment.h header file where not needed

This header file is now only used by files that access internal
environment features. Drop it from various places where it is not needed.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 6bf6dbee 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get_yesno() to env.h

Move env_get_yesno() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 0ab327a7 21-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: added support for 16bit 8Gb density (1GiB) DRAM

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ebe07ef7 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5908

The GW5908 is a small single board computer based on the i.MX6DL SoC
with the same peripheral set as the GW530x but with 1GiB density DRAM
(64bit 512MiB).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d1c3867a 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5905

The GW5905 is single-board tablet computer based on the i.MX6 SoC with the
following peripheral set:
- eMMC flash (boot device)
- microSD expansion
- LVDS display connector for off-board 3D+1C with PWM backlight
and I2C based touch controller
- MIPI camera connector supporting the TRULY CM8487-B500SA-E (OV5640)
- ublox EMMY-W1 WiFi/Bluetooth/NFC module (SDIO/UART)
- ublox ZOE-M8Q GPS
- LSM9DS1 9-DOF IMU
- 1x 1-lane miniPCIe socket with USB 2.0
- Gateworks System Controller
- Audio jack with TLV320AIC Audio Codec, Speaker AMP
and TSA227E Headphone detect
- MAX8607 3-mode LED camera flash
- DECT ULE module
- FUSB302 USB-C PD and ISL9238 Battery charger

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3f0da874 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove setup of I2C3 from SPL

Do not setup I2C3 in the SPL for Ventana as some devices on that bus
(aic3x codecs) can hang the bus causing i2c_setup to spin endlessly until
they are put into reset. Removing the setup of I2C3 from the SPL allows
the board-specific GPIO to be configured to take care of putting codecs
in reset prior to U-Boot setting up I2C3.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

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

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

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

Signed-off-by: Tom Rini <trini@konsulko.com>

# d024236e 18-Apr-2018 Tom Rini <trini@konsulko.com>

Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTR

We have a large number of places where while we historically referenced
gd in the code we no longer do, as well as cases where the code added
that line "just in case" during development and never dropped it.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 30df9f77 28-Aug-2017 Anatolij Gustschin <agust@denx.de>

imx6: drop duplicated bss memset and board_init_r() call

bss section is cleared in crt0.S. board_init_r() is also
entered from crt0 code.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# 3aa4b703 24-Aug-2017 Breno Lima <breno.lima@nxp.com>

imx: imx6: Move gpr_init() function to soc.c

Since the gpr_init() function is common for boards using MX6S, MX6DL, MX6D,
MX6Q and MX6QP processors move it to the soc.c file.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 310fb14b 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Drop env_relocate_spec() in favour of env_load()

This is a strange name for a function that loads the environment. There is
now only one implementation of this function, so use the new env_load()
function directly instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 552a848e 29-Jun-2017 Stefano Babic <sbabic@denx.de>

imx: reorganize IMX code as other SOCs

Change is consistent with other SOCs and it is in preparation
for adding SOMs. SOC's related files are moved from cpu/ to
mach-imx/<SOC>.

This change is also coherent with the structure in kernel.

Signed-off-by: Stefano Babic <sbabic@denx.de>

CC: Fabio Estevam <fabio.estevam@nxp.com>
CC: Akshay Bhat <akshaybhat@timesys.com>
CC: Ken Lin <Ken.Lin@advantech.com.tw>
CC: Marek Vasut <marek.vasut@gmail.com>
CC: Heiko Schocher <hs@denx.de>
CC: "Sébastien Szymanski" <sebastien.szymanski@armadeus.com>
CC: Christian Gmeiner <christian.gmeiner@gmail.com>
CC: Stefan Roese <sr@denx.de>
CC: Patrick Bruenn <p.bruenn@beckhoff.com>
CC: Troy Kisky <troy.kisky@boundarydevices.com>
CC: Nikita Kiryanov <nikita@compulab.co.il>
CC: Otavio Salvador <otavio@ossystems.com.br>
CC: "Eric Bénard" <eric@eukrea.com>
CC: Jagan Teki <jagan@amarulasolutions.com>
CC: Ye Li <ye.li@nxp.com>
CC: Peng Fan <peng.fan@nxp.com>
CC: Adrian Alonso <adrian.alonso@nxp.com>
CC: Alison Wang <b18965@freescale.com>
CC: Tim Harvey <tharvey@gateworks.com>
CC: Martin Donnelly <martin.donnelly@ge.com>
CC: Marcin Niestroj <m.niestroj@grinn-global.com>
CC: Lukasz Majewski <lukma@denx.de>
CC: Adam Ford <aford173@gmail.com>
CC: "Albert ARIBAUD (3ADEV)" <albert.aribaud@3adev.fr>
CC: Boris Brezillon <boris.brezillon@free-electrons.com>
CC: Soeren Moch <smoch@web.de>
CC: Richard Hu <richard.hu@technexion.com>
CC: Wig Cheng <wig.cheng@technexion.com>
CC: Vanessa Maegima <vanessa.maegima@nxp.com>
CC: Max Krummenacher <max.krummenacher@toradex.com>
CC: Stefan Agner <stefan.agner@toradex.com>
CC: Markus Niebel <Markus.Niebel@tq-group.com>
CC: Breno Lima <breno.lima@nxp.com>
CC: Francesco Montefoschi <francesco.montefoschi@udoo.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Scott Wood <oss@buserror.net>
CC: Joe Hershberger <joe.hershberger@ni.com>
CC: Anatolij Gustschin <agust@denx.de>
CC: Simon Glass <sjg@chromium.org>
CC: "Andrew F. Davis" <afd@ti.com>
CC: "Łukasz Majewski" <l.majewski@samsung.com>
CC: Patrice Chotard <patrice.chotard@st.com>
CC: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
CC: Hans de Goede <hdegoede@redhat.com>
CC: Masahiro Yamada <yamada.masahiro@socionext.com>
CC: Stephen Warren <swarren@nvidia.com>
CC: Andre Przywara <andre.przywara@arm.com>
CC: "Álvaro Fernández Rojas" <noltari@gmail.com>
CC: York Sun <york.sun@nxp.com>
CC: Xiaoliang Yang <xiaoliang.yang@nxp.com>
CC: Chen-Yu Tsai <wens@csie.org>
CC: George McCollister <george.mccollister@gmail.com>
CC: Sven Ebenfeld <sven.ebenfeld@gmail.com>
CC: Filip Brozovic <fbrozovic@gmail.com>
CC: Petr Kulhavy <brain@jikos.cz>
CC: Eric Nelson <eric@nelint.com>
CC: Bai Ping <ping.bai@nxp.com>
CC: Anson Huang <Anson.Huang@nxp.com>
CC: Sanchayan Maity <maitysanchayan@gmail.com>
CC: Lokesh Vutla <lokeshvutla@ti.com>
CC: Patrick Delaunay <patrick.delaunay@st.com>
CC: Gary Bisson <gary.bisson@boundarydevices.com>
CC: Alexander Graf <agraf@suse.de>
CC: u-boot@lists.denx.de
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>

# 214fb19b 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5903 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 8d1a6ff8 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5904 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ad68d7b8 13-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add additional DRAM configurations

- 64bit 8gB density (4GiB) IMX6DQ
- 64bit 4gB density (2GiB) IMX6SDL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>

# edf00937 29-Aug-2016 Fabio Estevam <fabio.estevam@nxp.com>

mx6: ddr: Allow changing REFSEL and REFR fields

Currently MX6 SPL DDR initialization hardcodes the REF_SEL and
REFR fields of the MDREF register as 1 and 7, respectively for
DDR3 and 0 and 3 for LPDDR2.

Looking at the MDREF initialization done via DCD we see that
boards do need to initialize these fields differently:

$ git grep 0x021b0020 board/
board/bachmann/ot1200/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/ccv/xpress/imximage.cfg:DATA 4 0x021b0020 0x00000800 /* MMDC0_MDREF */
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x7800
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6qp.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6dlsabresd.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6slevk/imximage.cfg:DATA 4 0x021b0020 0x00001800
board/freescale/mx6sxsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/freescale/mx6sxsabresd/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/warp/imximage.cfg:DATA 4 0x021b0020 0x00001800

So introduce a mechanism for users to be able to configure
REFSEL and REFR fields as needed.

Keep all the mx6 SPL users in their current REF_SEL and REFR values,
so no functional changes for the existing users.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Eric Nelson <eric@nelint.com>

# 6052b1c6 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: added support for 32bit IMX6DQ 8Gb density DRAM config

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 1b99103f 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: only disable boot watchdog if Falcon mode

If not booting Falcon mode, leave the boot watchdog enabled as a work-around
for other non-resolved bootloader hangs.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3c0fd17f 23-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use EEPROM register for falcon boot mode

NAND+MMC env support costs 12KB in the SPL which is fairly expensive just
for the ability to specify whether or not to boot to uboot or directly
to linux. The Ventana boards have plenty of EEPROM storage so we will use
a byte there to signify if we should boot to the bootloader or to the OS.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 346d106d 03-Nov-2015 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Remove empty reset_cpu()

There is really no need to provide an empty reset_cpu() implementation,
so just remove it.

Cc: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# f2ff8343 17-Aug-2015 Peng Fan <Peng.Fan@freescale.com>

imx: mx6: ddr init MMDC according to ddr_type

To i.MX6, DDR3 and LPDDR2 is supported, so rename function mx6_dram_cfg
to mx6_ddr3_cfg and the original mx6_dram_cfg function only is a wrapper.
The new reimplemented function mx6_dram_cfg only invokes mx6_ddr3_cfg
when ddr_type is for DDR3. Later we can use ddr_type to initialize
MMDC for LPDDR2.

Initialize ddr_type for different boards which enable SPL.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# fdead4be 26-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: hang if board model could not be determined

If the EEPROM could not be read or is corrupt we always want to hang.
Note that an error message will have been displayed by read_eeprom in this
case.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 53940a50 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: config: enable Falcon mode

Falcon mode entails the SPL booting the OS directly instead of U-Boot.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# e06a0362 15-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add pmic_setup to SPL

We need to do any PMIC setup in the SPL if we are to bypass U-Boot for
falcon mode.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# af1db4a3 14-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use stack relocation

Certain features we desire require a larger stack than is available by using
iRAM (most notably for us, env_mmc). Relocate the stack to DRAM so that
we can use these features.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ea7a3c44 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GSC boot watchdog disable to SPL

If the SPL is to be used for Falcon mode then we need to make sure the SPL
disable the GSC boot watchdog.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# c4b44d76 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add gpio setup to SPL

If the SPL is to be used for Falcon mode then we need to make sure it
configures basic GPIO (iomux, padconf, and default output levels).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 2089b7be 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use common uart and i2c setup functions in SPL

Now that uart and i2c setup functions have been moved to common.c we can
use these and remove code duplication.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06c3564d 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: display SPL boot device

Display what device the SPL will fetch uboot.img from

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d783c274 06-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: fix boot to SD

This fixes a regression caused by e25fbe3fe531029dc7b100ea4c79dbc802e17fc2
(gw_ventana: Move the DCD settings to spl code)

The clock gating must be setup prior to calling arch_cpu_init(). Without this
booting to SD (directly via eFuse or via bmode) will hang.

Cc: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# 9e2b0c2d 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Update missing memory/calib handling

This commit combines catching missing memory and calibration data into
one if() block. It further prints pertinent information in determining
why the failure occurred.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 767d88b0 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Add new memory configuration

Add memory configuration for an IMX6SDL + 1GB density DRAM.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 7f14c31b 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove 128x16 calibration (share with 128x32)

The calibration data for dual 2Gb density chips can be used for a single 2Gb
density chip.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06edcb9d 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: updated 16bit DDR calibration

Updated 16bit DDR calibration using values obtained from running the
i.MX6 DDR Stress Test tool over a set of boards over full operationg
temperature.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 75f21e31 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: Add support for GW551x

The GW551x is a small form factor board based on the IMX6 SoC that includes:
* up to 512MB DDR3 memory
* up to 2GB NAND flash
* 1x miniPCIe socket (with USB)
* HDMI out (micro-HDMI)
* HDMI in (micro-HDMI)
* TTL level I/O (supported by GW16111 breakout board):
* I2C
* 2x UART
* CAN
* 2x DIO (GPIO/PWM)
* USB OTG

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# b0b83347 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for 4Gb density mem devices with IMX6DL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 29f0d6b1 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: enable precharge power-down fast-exit mode

Enable fast-exit precharge mode necessary for some DDR3 devices being
used on Ventana boards.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 576cd6b3 04-Dec-2014 Stefan Roese <sr@denx.de>

arm: mx6: gw_ventana: Change clock init to enable NAND related clocks

Otherwise NAND booting is likely to fail. Since this disables the NAND related
clocks and SPL can't load the main U-Boot from NAND.

This problem was introduced with this patch:

e25fbe3f (gw_ventana: Move the DCD settings to spl code)

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# e25fbe3f 14-Nov-2014 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Move the DCD settings to spl code

mx6sabresd_spl.cfg configures CCM registers, GPR registers and CCM_CCOSR.

Move the configuration to the spl code.

CCM_CCOSR setting is no longer required to get audio functionality in the
kernel, so remove such setting.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

# 1dd42e31 29-Sep-2014 Stefan Roese <sr@denx.de>

ARM: mx6: gw_ventana: Remove superfluous memset of GD in board_init_f

Zeroing GD in board_init_f() is not needed any more. As its now done in
crt0.S. The patch that clears the GD in crt0.S is this one:

aae2aef9 [arm: Set up global data before board_init_f()] from Simon.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# c91e4b8b 21-Aug-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: base SPL MMDC calibration on width and size not board

The IMX6 MMDC calibration registers depend on propagation delay and capacitive
loading between the SoC's MMDC and the DDR3 chips. On the Ventana boards the
board layout varies little in trace-lengths such that propagation delays are
irrelevant thus we can simply things by using calibration values obtained
from various board layouts based on a common SoC and DDR chip configuration.

This eliminates board-model from being needed allowing more flexibility. These
values were tested on a large sample size of Gateworks Ventana boards ranging
in layout, and memory configuration over the entire temperature range supported.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 0cc11dea 02-Jun-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: switch to SPL

Switch to an SPL image. The SPL for Ventana does the following:
- setup i2c and read the factory programmed EEPROM to obtain DRAM config
and model for board-specific calibration data
- configure DRAM per CPU/size/layout/devices/calibration
- load u-boot.img from NAND and jump to it

This allows for a single SPL+u-boot.img to replace the previous multiple boa
configurations.

Cc: Stefan Roese <sr@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Andy Ng <andreas2025@gmail.com>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Tapani Utriainen <tapani@technexion.com>
Cc: Tom Rini <trini@ti.com>

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 6bec6c16 07-Mar-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: move ft_early_fixups out of common

DM is not used for the SPL and a generic DT is used in the SPL
which requires no fixups. Remove the call in the SPL and move the function
into the U-Boot code.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d169313d 07-Mar-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: move SPL uart config out of common

Since DM_SERIAL is used for U-Boot we no longer need legacy UART code in
common.c shared by the SPL and U-Boot. Move the legacy UART config to
the non-DM SPL.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# cb339a00 07-Mar-2022 Tim Harvey <tharvey@gateworks.com>

board: gateworks: gw_ventana: convert to DM_I2C

convert to DM_I2C for U-Boot while leaving SPL legacy I2C:
- Move I2C config from common to SPL
- Move PMIC config from common to SPL (no need to re-configure pmic)
- add DM_I2C support to eeprom/gsc functions shared by SPL and U-Boot

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 45c902c4 24-Jul-2021 Tim Harvey <tharvey@gateworks.com>

imx: ventana: move wdog/uhs-i board/revision dt fixups

Move board/revision specific dt fixups for WDOG and UHS-I features
so that we can call them early for U-Boot control dt as well.

Additionally drop a deprected non-mainline dt-prop fixup regarding
HDMI input format.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d863d054 01-Mar-2021 Tim Harvey <tharvey@gateworks.com>

imx: ventana: convert U-Boot to OF_CONTROL using FIT image

In preparation for dm conversion convert to OF_CONTROL by adding FIT image
support and multi dtb.

Add a board_fit_config_name_match to match the dtb based off of EEPROM
model.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 691d719d 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop init.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# e7dcf564 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Drop environment.h header file where not needed

This header file is now only used by files that access internal
environment features. Drop it from various places where it is not needed.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 6bf6dbee 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get_yesno() to env.h

Move env_get_yesno() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 0ab327a7 21-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: added support for 16bit 8Gb density (1GiB) DRAM

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ebe07ef7 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5908

The GW5908 is a small single board computer based on the i.MX6DL SoC
with the same peripheral set as the GW530x but with 1GiB density DRAM
(64bit 512MiB).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d1c3867a 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5905

The GW5905 is single-board tablet computer based on the i.MX6 SoC with the
following peripheral set:
- eMMC flash (boot device)
- microSD expansion
- LVDS display connector for off-board 3D+1C with PWM backlight
and I2C based touch controller
- MIPI camera connector supporting the TRULY CM8487-B500SA-E (OV5640)
- ublox EMMY-W1 WiFi/Bluetooth/NFC module (SDIO/UART)
- ublox ZOE-M8Q GPS
- LSM9DS1 9-DOF IMU
- 1x 1-lane miniPCIe socket with USB 2.0
- Gateworks System Controller
- Audio jack with TLV320AIC Audio Codec, Speaker AMP
and TSA227E Headphone detect
- MAX8607 3-mode LED camera flash
- DECT ULE module
- FUSB302 USB-C PD and ISL9238 Battery charger

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3f0da874 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove setup of I2C3 from SPL

Do not setup I2C3 in the SPL for Ventana as some devices on that bus
(aic3x codecs) can hang the bus causing i2c_setup to spin endlessly until
they are put into reset. Removing the setup of I2C3 from the SPL allows
the board-specific GPIO to be configured to take care of putting codecs
in reset prior to U-Boot setting up I2C3.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

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

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

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

Signed-off-by: Tom Rini <trini@konsulko.com>

# d024236e 18-Apr-2018 Tom Rini <trini@konsulko.com>

Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTR

We have a large number of places where while we historically referenced
gd in the code we no longer do, as well as cases where the code added
that line "just in case" during development and never dropped it.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 30df9f77 28-Aug-2017 Anatolij Gustschin <agust@denx.de>

imx6: drop duplicated bss memset and board_init_r() call

bss section is cleared in crt0.S. board_init_r() is also
entered from crt0 code.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# 3aa4b703 24-Aug-2017 Breno Lima <breno.lima@nxp.com>

imx: imx6: Move gpr_init() function to soc.c

Since the gpr_init() function is common for boards using MX6S, MX6DL, MX6D,
MX6Q and MX6QP processors move it to the soc.c file.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 310fb14b 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Drop env_relocate_spec() in favour of env_load()

This is a strange name for a function that loads the environment. There is
now only one implementation of this function, so use the new env_load()
function directly instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 552a848e 29-Jun-2017 Stefano Babic <sbabic@denx.de>

imx: reorganize IMX code as other SOCs

Change is consistent with other SOCs and it is in preparation
for adding SOMs. SOC's related files are moved from cpu/ to
mach-imx/<SOC>.

This change is also coherent with the structure in kernel.

Signed-off-by: Stefano Babic <sbabic@denx.de>

CC: Fabio Estevam <fabio.estevam@nxp.com>
CC: Akshay Bhat <akshaybhat@timesys.com>
CC: Ken Lin <Ken.Lin@advantech.com.tw>
CC: Marek Vasut <marek.vasut@gmail.com>
CC: Heiko Schocher <hs@denx.de>
CC: "Sébastien Szymanski" <sebastien.szymanski@armadeus.com>
CC: Christian Gmeiner <christian.gmeiner@gmail.com>
CC: Stefan Roese <sr@denx.de>
CC: Patrick Bruenn <p.bruenn@beckhoff.com>
CC: Troy Kisky <troy.kisky@boundarydevices.com>
CC: Nikita Kiryanov <nikita@compulab.co.il>
CC: Otavio Salvador <otavio@ossystems.com.br>
CC: "Eric Bénard" <eric@eukrea.com>
CC: Jagan Teki <jagan@amarulasolutions.com>
CC: Ye Li <ye.li@nxp.com>
CC: Peng Fan <peng.fan@nxp.com>
CC: Adrian Alonso <adrian.alonso@nxp.com>
CC: Alison Wang <b18965@freescale.com>
CC: Tim Harvey <tharvey@gateworks.com>
CC: Martin Donnelly <martin.donnelly@ge.com>
CC: Marcin Niestroj <m.niestroj@grinn-global.com>
CC: Lukasz Majewski <lukma@denx.de>
CC: Adam Ford <aford173@gmail.com>
CC: "Albert ARIBAUD (3ADEV)" <albert.aribaud@3adev.fr>
CC: Boris Brezillon <boris.brezillon@free-electrons.com>
CC: Soeren Moch <smoch@web.de>
CC: Richard Hu <richard.hu@technexion.com>
CC: Wig Cheng <wig.cheng@technexion.com>
CC: Vanessa Maegima <vanessa.maegima@nxp.com>
CC: Max Krummenacher <max.krummenacher@toradex.com>
CC: Stefan Agner <stefan.agner@toradex.com>
CC: Markus Niebel <Markus.Niebel@tq-group.com>
CC: Breno Lima <breno.lima@nxp.com>
CC: Francesco Montefoschi <francesco.montefoschi@udoo.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Scott Wood <oss@buserror.net>
CC: Joe Hershberger <joe.hershberger@ni.com>
CC: Anatolij Gustschin <agust@denx.de>
CC: Simon Glass <sjg@chromium.org>
CC: "Andrew F. Davis" <afd@ti.com>
CC: "Łukasz Majewski" <l.majewski@samsung.com>
CC: Patrice Chotard <patrice.chotard@st.com>
CC: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
CC: Hans de Goede <hdegoede@redhat.com>
CC: Masahiro Yamada <yamada.masahiro@socionext.com>
CC: Stephen Warren <swarren@nvidia.com>
CC: Andre Przywara <andre.przywara@arm.com>
CC: "Álvaro Fernández Rojas" <noltari@gmail.com>
CC: York Sun <york.sun@nxp.com>
CC: Xiaoliang Yang <xiaoliang.yang@nxp.com>
CC: Chen-Yu Tsai <wens@csie.org>
CC: George McCollister <george.mccollister@gmail.com>
CC: Sven Ebenfeld <sven.ebenfeld@gmail.com>
CC: Filip Brozovic <fbrozovic@gmail.com>
CC: Petr Kulhavy <brain@jikos.cz>
CC: Eric Nelson <eric@nelint.com>
CC: Bai Ping <ping.bai@nxp.com>
CC: Anson Huang <Anson.Huang@nxp.com>
CC: Sanchayan Maity <maitysanchayan@gmail.com>
CC: Lokesh Vutla <lokeshvutla@ti.com>
CC: Patrick Delaunay <patrick.delaunay@st.com>
CC: Gary Bisson <gary.bisson@boundarydevices.com>
CC: Alexander Graf <agraf@suse.de>
CC: u-boot@lists.denx.de
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>

# 214fb19b 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5903 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 8d1a6ff8 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5904 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ad68d7b8 13-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add additional DRAM configurations

- 64bit 8gB density (4GiB) IMX6DQ
- 64bit 4gB density (2GiB) IMX6SDL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>

# edf00937 29-Aug-2016 Fabio Estevam <fabio.estevam@nxp.com>

mx6: ddr: Allow changing REFSEL and REFR fields

Currently MX6 SPL DDR initialization hardcodes the REF_SEL and
REFR fields of the MDREF register as 1 and 7, respectively for
DDR3 and 0 and 3 for LPDDR2.

Looking at the MDREF initialization done via DCD we see that
boards do need to initialize these fields differently:

$ git grep 0x021b0020 board/
board/bachmann/ot1200/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/ccv/xpress/imximage.cfg:DATA 4 0x021b0020 0x00000800 /* MMDC0_MDREF */
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x7800
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6qp.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6dlsabresd.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6slevk/imximage.cfg:DATA 4 0x021b0020 0x00001800
board/freescale/mx6sxsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/freescale/mx6sxsabresd/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/warp/imximage.cfg:DATA 4 0x021b0020 0x00001800

So introduce a mechanism for users to be able to configure
REFSEL and REFR fields as needed.

Keep all the mx6 SPL users in their current REF_SEL and REFR values,
so no functional changes for the existing users.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Eric Nelson <eric@nelint.com>

# 6052b1c6 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: added support for 32bit IMX6DQ 8Gb density DRAM config

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 1b99103f 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: only disable boot watchdog if Falcon mode

If not booting Falcon mode, leave the boot watchdog enabled as a work-around
for other non-resolved bootloader hangs.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3c0fd17f 23-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use EEPROM register for falcon boot mode

NAND+MMC env support costs 12KB in the SPL which is fairly expensive just
for the ability to specify whether or not to boot to uboot or directly
to linux. The Ventana boards have plenty of EEPROM storage so we will use
a byte there to signify if we should boot to the bootloader or to the OS.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 346d106d 03-Nov-2015 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Remove empty reset_cpu()

There is really no need to provide an empty reset_cpu() implementation,
so just remove it.

Cc: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# f2ff8343 17-Aug-2015 Peng Fan <Peng.Fan@freescale.com>

imx: mx6: ddr init MMDC according to ddr_type

To i.MX6, DDR3 and LPDDR2 is supported, so rename function mx6_dram_cfg
to mx6_ddr3_cfg and the original mx6_dram_cfg function only is a wrapper.
The new reimplemented function mx6_dram_cfg only invokes mx6_ddr3_cfg
when ddr_type is for DDR3. Later we can use ddr_type to initialize
MMDC for LPDDR2.

Initialize ddr_type for different boards which enable SPL.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# fdead4be 26-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: hang if board model could not be determined

If the EEPROM could not be read or is corrupt we always want to hang.
Note that an error message will have been displayed by read_eeprom in this
case.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 53940a50 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: config: enable Falcon mode

Falcon mode entails the SPL booting the OS directly instead of U-Boot.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# e06a0362 15-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add pmic_setup to SPL

We need to do any PMIC setup in the SPL if we are to bypass U-Boot for
falcon mode.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# af1db4a3 14-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use stack relocation

Certain features we desire require a larger stack than is available by using
iRAM (most notably for us, env_mmc). Relocate the stack to DRAM so that
we can use these features.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ea7a3c44 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GSC boot watchdog disable to SPL

If the SPL is to be used for Falcon mode then we need to make sure the SPL
disable the GSC boot watchdog.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# c4b44d76 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add gpio setup to SPL

If the SPL is to be used for Falcon mode then we need to make sure it
configures basic GPIO (iomux, padconf, and default output levels).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 2089b7be 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use common uart and i2c setup functions in SPL

Now that uart and i2c setup functions have been moved to common.c we can
use these and remove code duplication.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06c3564d 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: display SPL boot device

Display what device the SPL will fetch uboot.img from

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d783c274 06-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: fix boot to SD

This fixes a regression caused by e25fbe3fe531029dc7b100ea4c79dbc802e17fc2
(gw_ventana: Move the DCD settings to spl code)

The clock gating must be setup prior to calling arch_cpu_init(). Without this
booting to SD (directly via eFuse or via bmode) will hang.

Cc: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# 9e2b0c2d 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Update missing memory/calib handling

This commit combines catching missing memory and calibration data into
one if() block. It further prints pertinent information in determining
why the failure occurred.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 767d88b0 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Add new memory configuration

Add memory configuration for an IMX6SDL + 1GB density DRAM.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 7f14c31b 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove 128x16 calibration (share with 128x32)

The calibration data for dual 2Gb density chips can be used for a single 2Gb
density chip.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06edcb9d 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: updated 16bit DDR calibration

Updated 16bit DDR calibration using values obtained from running the
i.MX6 DDR Stress Test tool over a set of boards over full operationg
temperature.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 75f21e31 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: Add support for GW551x

The GW551x is a small form factor board based on the IMX6 SoC that includes:
* up to 512MB DDR3 memory
* up to 2GB NAND flash
* 1x miniPCIe socket (with USB)
* HDMI out (micro-HDMI)
* HDMI in (micro-HDMI)
* TTL level I/O (supported by GW16111 breakout board):
* I2C
* 2x UART
* CAN
* 2x DIO (GPIO/PWM)
* USB OTG

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# b0b83347 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for 4Gb density mem devices with IMX6DL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 29f0d6b1 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: enable precharge power-down fast-exit mode

Enable fast-exit precharge mode necessary for some DDR3 devices being
used on Ventana boards.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 576cd6b3 04-Dec-2014 Stefan Roese <sr@denx.de>

arm: mx6: gw_ventana: Change clock init to enable NAND related clocks

Otherwise NAND booting is likely to fail. Since this disables the NAND related
clocks and SPL can't load the main U-Boot from NAND.

This problem was introduced with this patch:

e25fbe3f (gw_ventana: Move the DCD settings to spl code)

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# e25fbe3f 14-Nov-2014 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Move the DCD settings to spl code

mx6sabresd_spl.cfg configures CCM registers, GPR registers and CCM_CCOSR.

Move the configuration to the spl code.

CCM_CCOSR setting is no longer required to get audio functionality in the
kernel, so remove such setting.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

# 1dd42e31 29-Sep-2014 Stefan Roese <sr@denx.de>

ARM: mx6: gw_ventana: Remove superfluous memset of GD in board_init_f

Zeroing GD in board_init_f() is not needed any more. As its now done in
crt0.S. The patch that clears the GD in crt0.S is this one:

aae2aef9 [arm: Set up global data before board_init_f()] from Simon.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# c91e4b8b 21-Aug-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: base SPL MMDC calibration on width and size not board

The IMX6 MMDC calibration registers depend on propagation delay and capacitive
loading between the SoC's MMDC and the DDR3 chips. On the Ventana boards the
board layout varies little in trace-lengths such that propagation delays are
irrelevant thus we can simply things by using calibration values obtained
from various board layouts based on a common SoC and DDR chip configuration.

This eliminates board-model from being needed allowing more flexibility. These
values were tested on a large sample size of Gateworks Ventana boards ranging
in layout, and memory configuration over the entire temperature range supported.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 0cc11dea 02-Jun-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: switch to SPL

Switch to an SPL image. The SPL for Ventana does the following:
- setup i2c and read the factory programmed EEPROM to obtain DRAM config
and model for board-specific calibration data
- configure DRAM per CPU/size/layout/devices/calibration
- load u-boot.img from NAND and jump to it

This allows for a single SPL+u-boot.img to replace the previous multiple boa
configurations.

Cc: Stefan Roese <sr@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Andy Ng <andreas2025@gmail.com>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Tapani Utriainen <tapani@technexion.com>
Cc: Tom Rini <trini@ti.com>

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 45c902c4 24-Jul-2021 Tim Harvey <tharvey@gateworks.com>

imx: ventana: move wdog/uhs-i board/revision dt fixups

Move board/revision specific dt fixups for WDOG and UHS-I features
so that we can call them early for U-Boot control dt as well.

Additionally drop a deprected non-mainline dt-prop fixup regarding
HDMI input format.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d863d054 01-Mar-2021 Tim Harvey <tharvey@gateworks.com>

imx: ventana: convert U-Boot to OF_CONTROL using FIT image

In preparation for dm conversion convert to OF_CONTROL by adding FIT image
support and multi dtb.

Add a board_fit_config_name_match to match the dtb based off of EEPROM
model.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 691d719d 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop init.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# e7dcf564 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Drop environment.h header file where not needed

This header file is now only used by files that access internal
environment features. Drop it from various places where it is not needed.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 6bf6dbee 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get_yesno() to env.h

Move env_get_yesno() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 0ab327a7 21-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: added support for 16bit 8Gb density (1GiB) DRAM

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ebe07ef7 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5908

The GW5908 is a small single board computer based on the i.MX6DL SoC
with the same peripheral set as the GW530x but with 1GiB density DRAM
(64bit 512MiB).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d1c3867a 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5905

The GW5905 is single-board tablet computer based on the i.MX6 SoC with the
following peripheral set:
- eMMC flash (boot device)
- microSD expansion
- LVDS display connector for off-board 3D+1C with PWM backlight
and I2C based touch controller
- MIPI camera connector supporting the TRULY CM8487-B500SA-E (OV5640)
- ublox EMMY-W1 WiFi/Bluetooth/NFC module (SDIO/UART)
- ublox ZOE-M8Q GPS
- LSM9DS1 9-DOF IMU
- 1x 1-lane miniPCIe socket with USB 2.0
- Gateworks System Controller
- Audio jack with TLV320AIC Audio Codec, Speaker AMP
and TSA227E Headphone detect
- MAX8607 3-mode LED camera flash
- DECT ULE module
- FUSB302 USB-C PD and ISL9238 Battery charger

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3f0da874 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove setup of I2C3 from SPL

Do not setup I2C3 in the SPL for Ventana as some devices on that bus
(aic3x codecs) can hang the bus causing i2c_setup to spin endlessly until
they are put into reset. Removing the setup of I2C3 from the SPL allows
the board-specific GPIO to be configured to take care of putting codecs
in reset prior to U-Boot setting up I2C3.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

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

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

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

Signed-off-by: Tom Rini <trini@konsulko.com>

# d024236e 18-Apr-2018 Tom Rini <trini@konsulko.com>

Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTR

We have a large number of places where while we historically referenced
gd in the code we no longer do, as well as cases where the code added
that line "just in case" during development and never dropped it.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 30df9f77 28-Aug-2017 Anatolij Gustschin <agust@denx.de>

imx6: drop duplicated bss memset and board_init_r() call

bss section is cleared in crt0.S. board_init_r() is also
entered from crt0 code.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# 3aa4b703 24-Aug-2017 Breno Lima <breno.lima@nxp.com>

imx: imx6: Move gpr_init() function to soc.c

Since the gpr_init() function is common for boards using MX6S, MX6DL, MX6D,
MX6Q and MX6QP processors move it to the soc.c file.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 310fb14b 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Drop env_relocate_spec() in favour of env_load()

This is a strange name for a function that loads the environment. There is
now only one implementation of this function, so use the new env_load()
function directly instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 552a848e 29-Jun-2017 Stefano Babic <sbabic@denx.de>

imx: reorganize IMX code as other SOCs

Change is consistent with other SOCs and it is in preparation
for adding SOMs. SOC's related files are moved from cpu/ to
mach-imx/<SOC>.

This change is also coherent with the structure in kernel.

Signed-off-by: Stefano Babic <sbabic@denx.de>

CC: Fabio Estevam <fabio.estevam@nxp.com>
CC: Akshay Bhat <akshaybhat@timesys.com>
CC: Ken Lin <Ken.Lin@advantech.com.tw>
CC: Marek Vasut <marek.vasut@gmail.com>
CC: Heiko Schocher <hs@denx.de>
CC: "Sébastien Szymanski" <sebastien.szymanski@armadeus.com>
CC: Christian Gmeiner <christian.gmeiner@gmail.com>
CC: Stefan Roese <sr@denx.de>
CC: Patrick Bruenn <p.bruenn@beckhoff.com>
CC: Troy Kisky <troy.kisky@boundarydevices.com>
CC: Nikita Kiryanov <nikita@compulab.co.il>
CC: Otavio Salvador <otavio@ossystems.com.br>
CC: "Eric Bénard" <eric@eukrea.com>
CC: Jagan Teki <jagan@amarulasolutions.com>
CC: Ye Li <ye.li@nxp.com>
CC: Peng Fan <peng.fan@nxp.com>
CC: Adrian Alonso <adrian.alonso@nxp.com>
CC: Alison Wang <b18965@freescale.com>
CC: Tim Harvey <tharvey@gateworks.com>
CC: Martin Donnelly <martin.donnelly@ge.com>
CC: Marcin Niestroj <m.niestroj@grinn-global.com>
CC: Lukasz Majewski <lukma@denx.de>
CC: Adam Ford <aford173@gmail.com>
CC: "Albert ARIBAUD (3ADEV)" <albert.aribaud@3adev.fr>
CC: Boris Brezillon <boris.brezillon@free-electrons.com>
CC: Soeren Moch <smoch@web.de>
CC: Richard Hu <richard.hu@technexion.com>
CC: Wig Cheng <wig.cheng@technexion.com>
CC: Vanessa Maegima <vanessa.maegima@nxp.com>
CC: Max Krummenacher <max.krummenacher@toradex.com>
CC: Stefan Agner <stefan.agner@toradex.com>
CC: Markus Niebel <Markus.Niebel@tq-group.com>
CC: Breno Lima <breno.lima@nxp.com>
CC: Francesco Montefoschi <francesco.montefoschi@udoo.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Scott Wood <oss@buserror.net>
CC: Joe Hershberger <joe.hershberger@ni.com>
CC: Anatolij Gustschin <agust@denx.de>
CC: Simon Glass <sjg@chromium.org>
CC: "Andrew F. Davis" <afd@ti.com>
CC: "Łukasz Majewski" <l.majewski@samsung.com>
CC: Patrice Chotard <patrice.chotard@st.com>
CC: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
CC: Hans de Goede <hdegoede@redhat.com>
CC: Masahiro Yamada <yamada.masahiro@socionext.com>
CC: Stephen Warren <swarren@nvidia.com>
CC: Andre Przywara <andre.przywara@arm.com>
CC: "Álvaro Fernández Rojas" <noltari@gmail.com>
CC: York Sun <york.sun@nxp.com>
CC: Xiaoliang Yang <xiaoliang.yang@nxp.com>
CC: Chen-Yu Tsai <wens@csie.org>
CC: George McCollister <george.mccollister@gmail.com>
CC: Sven Ebenfeld <sven.ebenfeld@gmail.com>
CC: Filip Brozovic <fbrozovic@gmail.com>
CC: Petr Kulhavy <brain@jikos.cz>
CC: Eric Nelson <eric@nelint.com>
CC: Bai Ping <ping.bai@nxp.com>
CC: Anson Huang <Anson.Huang@nxp.com>
CC: Sanchayan Maity <maitysanchayan@gmail.com>
CC: Lokesh Vutla <lokeshvutla@ti.com>
CC: Patrick Delaunay <patrick.delaunay@st.com>
CC: Gary Bisson <gary.bisson@boundarydevices.com>
CC: Alexander Graf <agraf@suse.de>
CC: u-boot@lists.denx.de
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>

# 214fb19b 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5903 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 8d1a6ff8 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5904 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ad68d7b8 13-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add additional DRAM configurations

- 64bit 8gB density (4GiB) IMX6DQ
- 64bit 4gB density (2GiB) IMX6SDL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>

# edf00937 29-Aug-2016 Fabio Estevam <fabio.estevam@nxp.com>

mx6: ddr: Allow changing REFSEL and REFR fields

Currently MX6 SPL DDR initialization hardcodes the REF_SEL and
REFR fields of the MDREF register as 1 and 7, respectively for
DDR3 and 0 and 3 for LPDDR2.

Looking at the MDREF initialization done via DCD we see that
boards do need to initialize these fields differently:

$ git grep 0x021b0020 board/
board/bachmann/ot1200/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/ccv/xpress/imximage.cfg:DATA 4 0x021b0020 0x00000800 /* MMDC0_MDREF */
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x7800
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6qp.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6dlsabresd.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6slevk/imximage.cfg:DATA 4 0x021b0020 0x00001800
board/freescale/mx6sxsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/freescale/mx6sxsabresd/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/warp/imximage.cfg:DATA 4 0x021b0020 0x00001800

So introduce a mechanism for users to be able to configure
REFSEL and REFR fields as needed.

Keep all the mx6 SPL users in their current REF_SEL and REFR values,
so no functional changes for the existing users.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Eric Nelson <eric@nelint.com>

# 6052b1c6 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: added support for 32bit IMX6DQ 8Gb density DRAM config

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 1b99103f 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: only disable boot watchdog if Falcon mode

If not booting Falcon mode, leave the boot watchdog enabled as a work-around
for other non-resolved bootloader hangs.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3c0fd17f 23-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use EEPROM register for falcon boot mode

NAND+MMC env support costs 12KB in the SPL which is fairly expensive just
for the ability to specify whether or not to boot to uboot or directly
to linux. The Ventana boards have plenty of EEPROM storage so we will use
a byte there to signify if we should boot to the bootloader or to the OS.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 346d106d 03-Nov-2015 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Remove empty reset_cpu()

There is really no need to provide an empty reset_cpu() implementation,
so just remove it.

Cc: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# f2ff8343 17-Aug-2015 Peng Fan <Peng.Fan@freescale.com>

imx: mx6: ddr init MMDC according to ddr_type

To i.MX6, DDR3 and LPDDR2 is supported, so rename function mx6_dram_cfg
to mx6_ddr3_cfg and the original mx6_dram_cfg function only is a wrapper.
The new reimplemented function mx6_dram_cfg only invokes mx6_ddr3_cfg
when ddr_type is for DDR3. Later we can use ddr_type to initialize
MMDC for LPDDR2.

Initialize ddr_type for different boards which enable SPL.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# fdead4be 26-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: hang if board model could not be determined

If the EEPROM could not be read or is corrupt we always want to hang.
Note that an error message will have been displayed by read_eeprom in this
case.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 53940a50 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: config: enable Falcon mode

Falcon mode entails the SPL booting the OS directly instead of U-Boot.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# e06a0362 15-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add pmic_setup to SPL

We need to do any PMIC setup in the SPL if we are to bypass U-Boot for
falcon mode.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# af1db4a3 14-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use stack relocation

Certain features we desire require a larger stack than is available by using
iRAM (most notably for us, env_mmc). Relocate the stack to DRAM so that
we can use these features.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ea7a3c44 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GSC boot watchdog disable to SPL

If the SPL is to be used for Falcon mode then we need to make sure the SPL
disable the GSC boot watchdog.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# c4b44d76 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add gpio setup to SPL

If the SPL is to be used for Falcon mode then we need to make sure it
configures basic GPIO (iomux, padconf, and default output levels).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 2089b7be 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use common uart and i2c setup functions in SPL

Now that uart and i2c setup functions have been moved to common.c we can
use these and remove code duplication.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06c3564d 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: display SPL boot device

Display what device the SPL will fetch uboot.img from

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d783c274 06-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: fix boot to SD

This fixes a regression caused by e25fbe3fe531029dc7b100ea4c79dbc802e17fc2
(gw_ventana: Move the DCD settings to spl code)

The clock gating must be setup prior to calling arch_cpu_init(). Without this
booting to SD (directly via eFuse or via bmode) will hang.

Cc: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# 9e2b0c2d 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Update missing memory/calib handling

This commit combines catching missing memory and calibration data into
one if() block. It further prints pertinent information in determining
why the failure occurred.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 767d88b0 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Add new memory configuration

Add memory configuration for an IMX6SDL + 1GB density DRAM.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 7f14c31b 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove 128x16 calibration (share with 128x32)

The calibration data for dual 2Gb density chips can be used for a single 2Gb
density chip.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06edcb9d 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: updated 16bit DDR calibration

Updated 16bit DDR calibration using values obtained from running the
i.MX6 DDR Stress Test tool over a set of boards over full operationg
temperature.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 75f21e31 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: Add support for GW551x

The GW551x is a small form factor board based on the IMX6 SoC that includes:
* up to 512MB DDR3 memory
* up to 2GB NAND flash
* 1x miniPCIe socket (with USB)
* HDMI out (micro-HDMI)
* HDMI in (micro-HDMI)
* TTL level I/O (supported by GW16111 breakout board):
* I2C
* 2x UART
* CAN
* 2x DIO (GPIO/PWM)
* USB OTG

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# b0b83347 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for 4Gb density mem devices with IMX6DL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 29f0d6b1 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: enable precharge power-down fast-exit mode

Enable fast-exit precharge mode necessary for some DDR3 devices being
used on Ventana boards.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 576cd6b3 04-Dec-2014 Stefan Roese <sr@denx.de>

arm: mx6: gw_ventana: Change clock init to enable NAND related clocks

Otherwise NAND booting is likely to fail. Since this disables the NAND related
clocks and SPL can't load the main U-Boot from NAND.

This problem was introduced with this patch:

e25fbe3f (gw_ventana: Move the DCD settings to spl code)

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# e25fbe3f 14-Nov-2014 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Move the DCD settings to spl code

mx6sabresd_spl.cfg configures CCM registers, GPR registers and CCM_CCOSR.

Move the configuration to the spl code.

CCM_CCOSR setting is no longer required to get audio functionality in the
kernel, so remove such setting.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

# 1dd42e31 29-Sep-2014 Stefan Roese <sr@denx.de>

ARM: mx6: gw_ventana: Remove superfluous memset of GD in board_init_f

Zeroing GD in board_init_f() is not needed any more. As its now done in
crt0.S. The patch that clears the GD in crt0.S is this one:

aae2aef9 [arm: Set up global data before board_init_f()] from Simon.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# c91e4b8b 21-Aug-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: base SPL MMDC calibration on width and size not board

The IMX6 MMDC calibration registers depend on propagation delay and capacitive
loading between the SoC's MMDC and the DDR3 chips. On the Ventana boards the
board layout varies little in trace-lengths such that propagation delays are
irrelevant thus we can simply things by using calibration values obtained
from various board layouts based on a common SoC and DDR chip configuration.

This eliminates board-model from being needed allowing more flexibility. These
values were tested on a large sample size of Gateworks Ventana boards ranging
in layout, and memory configuration over the entire temperature range supported.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 0cc11dea 02-Jun-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: switch to SPL

Switch to an SPL image. The SPL for Ventana does the following:
- setup i2c and read the factory programmed EEPROM to obtain DRAM config
and model for board-specific calibration data
- configure DRAM per CPU/size/layout/devices/calibration
- load u-boot.img from NAND and jump to it

This allows for a single SPL+u-boot.img to replace the previous multiple boa
configurations.

Cc: Stefan Roese <sr@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Andy Ng <andreas2025@gmail.com>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Tapani Utriainen <tapani@technexion.com>
Cc: Tom Rini <trini@ti.com>

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d863d054 01-Mar-2021 Tim Harvey <tharvey@gateworks.com>

imx: ventana: convert U-Boot to OF_CONTROL using FIT image

In preparation for dm conversion convert to OF_CONTROL by adding FIT image
support and multi dtb.

Add a board_fit_config_name_match to match the dtb based off of EEPROM
model.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 691d719d 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop init.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# e7dcf564 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Drop environment.h header file where not needed

This header file is now only used by files that access internal
environment features. Drop it from various places where it is not needed.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 6bf6dbee 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get_yesno() to env.h

Move env_get_yesno() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 0ab327a7 21-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: added support for 16bit 8Gb density (1GiB) DRAM

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ebe07ef7 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5908

The GW5908 is a small single board computer based on the i.MX6DL SoC
with the same peripheral set as the GW530x but with 1GiB density DRAM
(64bit 512MiB).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d1c3867a 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5905

The GW5905 is single-board tablet computer based on the i.MX6 SoC with the
following peripheral set:
- eMMC flash (boot device)
- microSD expansion
- LVDS display connector for off-board 3D+1C with PWM backlight
and I2C based touch controller
- MIPI camera connector supporting the TRULY CM8487-B500SA-E (OV5640)
- ublox EMMY-W1 WiFi/Bluetooth/NFC module (SDIO/UART)
- ublox ZOE-M8Q GPS
- LSM9DS1 9-DOF IMU
- 1x 1-lane miniPCIe socket with USB 2.0
- Gateworks System Controller
- Audio jack with TLV320AIC Audio Codec, Speaker AMP
and TSA227E Headphone detect
- MAX8607 3-mode LED camera flash
- DECT ULE module
- FUSB302 USB-C PD and ISL9238 Battery charger

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3f0da874 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove setup of I2C3 from SPL

Do not setup I2C3 in the SPL for Ventana as some devices on that bus
(aic3x codecs) can hang the bus causing i2c_setup to spin endlessly until
they are put into reset. Removing the setup of I2C3 from the SPL allows
the board-specific GPIO to be configured to take care of putting codecs
in reset prior to U-Boot setting up I2C3.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

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

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

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

Signed-off-by: Tom Rini <trini@konsulko.com>

# d024236e 18-Apr-2018 Tom Rini <trini@konsulko.com>

Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTR

We have a large number of places where while we historically referenced
gd in the code we no longer do, as well as cases where the code added
that line "just in case" during development and never dropped it.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 30df9f77 28-Aug-2017 Anatolij Gustschin <agust@denx.de>

imx6: drop duplicated bss memset and board_init_r() call

bss section is cleared in crt0.S. board_init_r() is also
entered from crt0 code.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# 3aa4b703 24-Aug-2017 Breno Lima <breno.lima@nxp.com>

imx: imx6: Move gpr_init() function to soc.c

Since the gpr_init() function is common for boards using MX6S, MX6DL, MX6D,
MX6Q and MX6QP processors move it to the soc.c file.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 310fb14b 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Drop env_relocate_spec() in favour of env_load()

This is a strange name for a function that loads the environment. There is
now only one implementation of this function, so use the new env_load()
function directly instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 552a848e 29-Jun-2017 Stefano Babic <sbabic@denx.de>

imx: reorganize IMX code as other SOCs

Change is consistent with other SOCs and it is in preparation
for adding SOMs. SOC's related files are moved from cpu/ to
mach-imx/<SOC>.

This change is also coherent with the structure in kernel.

Signed-off-by: Stefano Babic <sbabic@denx.de>

CC: Fabio Estevam <fabio.estevam@nxp.com>
CC: Akshay Bhat <akshaybhat@timesys.com>
CC: Ken Lin <Ken.Lin@advantech.com.tw>
CC: Marek Vasut <marek.vasut@gmail.com>
CC: Heiko Schocher <hs@denx.de>
CC: "Sébastien Szymanski" <sebastien.szymanski@armadeus.com>
CC: Christian Gmeiner <christian.gmeiner@gmail.com>
CC: Stefan Roese <sr@denx.de>
CC: Patrick Bruenn <p.bruenn@beckhoff.com>
CC: Troy Kisky <troy.kisky@boundarydevices.com>
CC: Nikita Kiryanov <nikita@compulab.co.il>
CC: Otavio Salvador <otavio@ossystems.com.br>
CC: "Eric Bénard" <eric@eukrea.com>
CC: Jagan Teki <jagan@amarulasolutions.com>
CC: Ye Li <ye.li@nxp.com>
CC: Peng Fan <peng.fan@nxp.com>
CC: Adrian Alonso <adrian.alonso@nxp.com>
CC: Alison Wang <b18965@freescale.com>
CC: Tim Harvey <tharvey@gateworks.com>
CC: Martin Donnelly <martin.donnelly@ge.com>
CC: Marcin Niestroj <m.niestroj@grinn-global.com>
CC: Lukasz Majewski <lukma@denx.de>
CC: Adam Ford <aford173@gmail.com>
CC: "Albert ARIBAUD (3ADEV)" <albert.aribaud@3adev.fr>
CC: Boris Brezillon <boris.brezillon@free-electrons.com>
CC: Soeren Moch <smoch@web.de>
CC: Richard Hu <richard.hu@technexion.com>
CC: Wig Cheng <wig.cheng@technexion.com>
CC: Vanessa Maegima <vanessa.maegima@nxp.com>
CC: Max Krummenacher <max.krummenacher@toradex.com>
CC: Stefan Agner <stefan.agner@toradex.com>
CC: Markus Niebel <Markus.Niebel@tq-group.com>
CC: Breno Lima <breno.lima@nxp.com>
CC: Francesco Montefoschi <francesco.montefoschi@udoo.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Scott Wood <oss@buserror.net>
CC: Joe Hershberger <joe.hershberger@ni.com>
CC: Anatolij Gustschin <agust@denx.de>
CC: Simon Glass <sjg@chromium.org>
CC: "Andrew F. Davis" <afd@ti.com>
CC: "Łukasz Majewski" <l.majewski@samsung.com>
CC: Patrice Chotard <patrice.chotard@st.com>
CC: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
CC: Hans de Goede <hdegoede@redhat.com>
CC: Masahiro Yamada <yamada.masahiro@socionext.com>
CC: Stephen Warren <swarren@nvidia.com>
CC: Andre Przywara <andre.przywara@arm.com>
CC: "Álvaro Fernández Rojas" <noltari@gmail.com>
CC: York Sun <york.sun@nxp.com>
CC: Xiaoliang Yang <xiaoliang.yang@nxp.com>
CC: Chen-Yu Tsai <wens@csie.org>
CC: George McCollister <george.mccollister@gmail.com>
CC: Sven Ebenfeld <sven.ebenfeld@gmail.com>
CC: Filip Brozovic <fbrozovic@gmail.com>
CC: Petr Kulhavy <brain@jikos.cz>
CC: Eric Nelson <eric@nelint.com>
CC: Bai Ping <ping.bai@nxp.com>
CC: Anson Huang <Anson.Huang@nxp.com>
CC: Sanchayan Maity <maitysanchayan@gmail.com>
CC: Lokesh Vutla <lokeshvutla@ti.com>
CC: Patrick Delaunay <patrick.delaunay@st.com>
CC: Gary Bisson <gary.bisson@boundarydevices.com>
CC: Alexander Graf <agraf@suse.de>
CC: u-boot@lists.denx.de
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>

# 214fb19b 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5903 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 8d1a6ff8 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5904 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ad68d7b8 13-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add additional DRAM configurations

- 64bit 8gB density (4GiB) IMX6DQ
- 64bit 4gB density (2GiB) IMX6SDL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>

# edf00937 29-Aug-2016 Fabio Estevam <fabio.estevam@nxp.com>

mx6: ddr: Allow changing REFSEL and REFR fields

Currently MX6 SPL DDR initialization hardcodes the REF_SEL and
REFR fields of the MDREF register as 1 and 7, respectively for
DDR3 and 0 and 3 for LPDDR2.

Looking at the MDREF initialization done via DCD we see that
boards do need to initialize these fields differently:

$ git grep 0x021b0020 board/
board/bachmann/ot1200/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/ccv/xpress/imximage.cfg:DATA 4 0x021b0020 0x00000800 /* MMDC0_MDREF */
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x7800
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6qp.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6dlsabresd.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6slevk/imximage.cfg:DATA 4 0x021b0020 0x00001800
board/freescale/mx6sxsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/freescale/mx6sxsabresd/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/warp/imximage.cfg:DATA 4 0x021b0020 0x00001800

So introduce a mechanism for users to be able to configure
REFSEL and REFR fields as needed.

Keep all the mx6 SPL users in their current REF_SEL and REFR values,
so no functional changes for the existing users.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Eric Nelson <eric@nelint.com>

# 6052b1c6 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: added support for 32bit IMX6DQ 8Gb density DRAM config

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 1b99103f 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: only disable boot watchdog if Falcon mode

If not booting Falcon mode, leave the boot watchdog enabled as a work-around
for other non-resolved bootloader hangs.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3c0fd17f 23-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use EEPROM register for falcon boot mode

NAND+MMC env support costs 12KB in the SPL which is fairly expensive just
for the ability to specify whether or not to boot to uboot or directly
to linux. The Ventana boards have plenty of EEPROM storage so we will use
a byte there to signify if we should boot to the bootloader or to the OS.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 346d106d 03-Nov-2015 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Remove empty reset_cpu()

There is really no need to provide an empty reset_cpu() implementation,
so just remove it.

Cc: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# f2ff8343 17-Aug-2015 Peng Fan <Peng.Fan@freescale.com>

imx: mx6: ddr init MMDC according to ddr_type

To i.MX6, DDR3 and LPDDR2 is supported, so rename function mx6_dram_cfg
to mx6_ddr3_cfg and the original mx6_dram_cfg function only is a wrapper.
The new reimplemented function mx6_dram_cfg only invokes mx6_ddr3_cfg
when ddr_type is for DDR3. Later we can use ddr_type to initialize
MMDC for LPDDR2.

Initialize ddr_type for different boards which enable SPL.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# fdead4be 26-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: hang if board model could not be determined

If the EEPROM could not be read or is corrupt we always want to hang.
Note that an error message will have been displayed by read_eeprom in this
case.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 53940a50 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: config: enable Falcon mode

Falcon mode entails the SPL booting the OS directly instead of U-Boot.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# e06a0362 15-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add pmic_setup to SPL

We need to do any PMIC setup in the SPL if we are to bypass U-Boot for
falcon mode.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# af1db4a3 14-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use stack relocation

Certain features we desire require a larger stack than is available by using
iRAM (most notably for us, env_mmc). Relocate the stack to DRAM so that
we can use these features.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ea7a3c44 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GSC boot watchdog disable to SPL

If the SPL is to be used for Falcon mode then we need to make sure the SPL
disable the GSC boot watchdog.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# c4b44d76 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add gpio setup to SPL

If the SPL is to be used for Falcon mode then we need to make sure it
configures basic GPIO (iomux, padconf, and default output levels).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 2089b7be 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use common uart and i2c setup functions in SPL

Now that uart and i2c setup functions have been moved to common.c we can
use these and remove code duplication.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06c3564d 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: display SPL boot device

Display what device the SPL will fetch uboot.img from

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d783c274 06-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: fix boot to SD

This fixes a regression caused by e25fbe3fe531029dc7b100ea4c79dbc802e17fc2
(gw_ventana: Move the DCD settings to spl code)

The clock gating must be setup prior to calling arch_cpu_init(). Without this
booting to SD (directly via eFuse or via bmode) will hang.

Cc: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# 9e2b0c2d 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Update missing memory/calib handling

This commit combines catching missing memory and calibration data into
one if() block. It further prints pertinent information in determining
why the failure occurred.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 767d88b0 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Add new memory configuration

Add memory configuration for an IMX6SDL + 1GB density DRAM.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 7f14c31b 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove 128x16 calibration (share with 128x32)

The calibration data for dual 2Gb density chips can be used for a single 2Gb
density chip.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06edcb9d 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: updated 16bit DDR calibration

Updated 16bit DDR calibration using values obtained from running the
i.MX6 DDR Stress Test tool over a set of boards over full operationg
temperature.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 75f21e31 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: Add support for GW551x

The GW551x is a small form factor board based on the IMX6 SoC that includes:
* up to 512MB DDR3 memory
* up to 2GB NAND flash
* 1x miniPCIe socket (with USB)
* HDMI out (micro-HDMI)
* HDMI in (micro-HDMI)
* TTL level I/O (supported by GW16111 breakout board):
* I2C
* 2x UART
* CAN
* 2x DIO (GPIO/PWM)
* USB OTG

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# b0b83347 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for 4Gb density mem devices with IMX6DL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 29f0d6b1 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: enable precharge power-down fast-exit mode

Enable fast-exit precharge mode necessary for some DDR3 devices being
used on Ventana boards.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 576cd6b3 04-Dec-2014 Stefan Roese <sr@denx.de>

arm: mx6: gw_ventana: Change clock init to enable NAND related clocks

Otherwise NAND booting is likely to fail. Since this disables the NAND related
clocks and SPL can't load the main U-Boot from NAND.

This problem was introduced with this patch:

e25fbe3f (gw_ventana: Move the DCD settings to spl code)

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# e25fbe3f 14-Nov-2014 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Move the DCD settings to spl code

mx6sabresd_spl.cfg configures CCM registers, GPR registers and CCM_CCOSR.

Move the configuration to the spl code.

CCM_CCOSR setting is no longer required to get audio functionality in the
kernel, so remove such setting.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

# 1dd42e31 29-Sep-2014 Stefan Roese <sr@denx.de>

ARM: mx6: gw_ventana: Remove superfluous memset of GD in board_init_f

Zeroing GD in board_init_f() is not needed any more. As its now done in
crt0.S. The patch that clears the GD in crt0.S is this one:

aae2aef9 [arm: Set up global data before board_init_f()] from Simon.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# c91e4b8b 21-Aug-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: base SPL MMDC calibration on width and size not board

The IMX6 MMDC calibration registers depend on propagation delay and capacitive
loading between the SoC's MMDC and the DDR3 chips. On the Ventana boards the
board layout varies little in trace-lengths such that propagation delays are
irrelevant thus we can simply things by using calibration values obtained
from various board layouts based on a common SoC and DDR chip configuration.

This eliminates board-model from being needed allowing more flexibility. These
values were tested on a large sample size of Gateworks Ventana boards ranging
in layout, and memory configuration over the entire temperature range supported.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 0cc11dea 02-Jun-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: switch to SPL

Switch to an SPL image. The SPL for Ventana does the following:
- setup i2c and read the factory programmed EEPROM to obtain DRAM config
and model for board-specific calibration data
- configure DRAM per CPU/size/layout/devices/calibration
- load u-boot.img from NAND and jump to it

This allows for a single SPL+u-boot.img to replace the previous multiple boa
configurations.

Cc: Stefan Roese <sr@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Andy Ng <andreas2025@gmail.com>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Tapani Utriainen <tapani@technexion.com>
Cc: Tom Rini <trini@ti.com>

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 691d719d 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop init.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# e7dcf564 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Drop environment.h header file where not needed

This header file is now only used by files that access internal
environment features. Drop it from various places where it is not needed.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 6bf6dbee 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get_yesno() to env.h

Move env_get_yesno() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 0ab327a7 21-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: added support for 16bit 8Gb density (1GiB) DRAM

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ebe07ef7 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5908

The GW5908 is a small single board computer based on the i.MX6DL SoC
with the same peripheral set as the GW530x but with 1GiB density DRAM
(64bit 512MiB).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d1c3867a 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5905

The GW5905 is single-board tablet computer based on the i.MX6 SoC with the
following peripheral set:
- eMMC flash (boot device)
- microSD expansion
- LVDS display connector for off-board 3D+1C with PWM backlight
and I2C based touch controller
- MIPI camera connector supporting the TRULY CM8487-B500SA-E (OV5640)
- ublox EMMY-W1 WiFi/Bluetooth/NFC module (SDIO/UART)
- ublox ZOE-M8Q GPS
- LSM9DS1 9-DOF IMU
- 1x 1-lane miniPCIe socket with USB 2.0
- Gateworks System Controller
- Audio jack with TLV320AIC Audio Codec, Speaker AMP
and TSA227E Headphone detect
- MAX8607 3-mode LED camera flash
- DECT ULE module
- FUSB302 USB-C PD and ISL9238 Battery charger

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3f0da874 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove setup of I2C3 from SPL

Do not setup I2C3 in the SPL for Ventana as some devices on that bus
(aic3x codecs) can hang the bus causing i2c_setup to spin endlessly until
they are put into reset. Removing the setup of I2C3 from the SPL allows
the board-specific GPIO to be configured to take care of putting codecs
in reset prior to U-Boot setting up I2C3.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

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

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

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

Signed-off-by: Tom Rini <trini@konsulko.com>

# d024236e 18-Apr-2018 Tom Rini <trini@konsulko.com>

Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTR

We have a large number of places where while we historically referenced
gd in the code we no longer do, as well as cases where the code added
that line "just in case" during development and never dropped it.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 30df9f77 28-Aug-2017 Anatolij Gustschin <agust@denx.de>

imx6: drop duplicated bss memset and board_init_r() call

bss section is cleared in crt0.S. board_init_r() is also
entered from crt0 code.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# 3aa4b703 24-Aug-2017 Breno Lima <breno.lima@nxp.com>

imx: imx6: Move gpr_init() function to soc.c

Since the gpr_init() function is common for boards using MX6S, MX6DL, MX6D,
MX6Q and MX6QP processors move it to the soc.c file.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 310fb14b 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Drop env_relocate_spec() in favour of env_load()

This is a strange name for a function that loads the environment. There is
now only one implementation of this function, so use the new env_load()
function directly instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 552a848e 29-Jun-2017 Stefano Babic <sbabic@denx.de>

imx: reorganize IMX code as other SOCs

Change is consistent with other SOCs and it is in preparation
for adding SOMs. SOC's related files are moved from cpu/ to
mach-imx/<SOC>.

This change is also coherent with the structure in kernel.

Signed-off-by: Stefano Babic <sbabic@denx.de>

CC: Fabio Estevam <fabio.estevam@nxp.com>
CC: Akshay Bhat <akshaybhat@timesys.com>
CC: Ken Lin <Ken.Lin@advantech.com.tw>
CC: Marek Vasut <marek.vasut@gmail.com>
CC: Heiko Schocher <hs@denx.de>
CC: "Sébastien Szymanski" <sebastien.szymanski@armadeus.com>
CC: Christian Gmeiner <christian.gmeiner@gmail.com>
CC: Stefan Roese <sr@denx.de>
CC: Patrick Bruenn <p.bruenn@beckhoff.com>
CC: Troy Kisky <troy.kisky@boundarydevices.com>
CC: Nikita Kiryanov <nikita@compulab.co.il>
CC: Otavio Salvador <otavio@ossystems.com.br>
CC: "Eric Bénard" <eric@eukrea.com>
CC: Jagan Teki <jagan@amarulasolutions.com>
CC: Ye Li <ye.li@nxp.com>
CC: Peng Fan <peng.fan@nxp.com>
CC: Adrian Alonso <adrian.alonso@nxp.com>
CC: Alison Wang <b18965@freescale.com>
CC: Tim Harvey <tharvey@gateworks.com>
CC: Martin Donnelly <martin.donnelly@ge.com>
CC: Marcin Niestroj <m.niestroj@grinn-global.com>
CC: Lukasz Majewski <lukma@denx.de>
CC: Adam Ford <aford173@gmail.com>
CC: "Albert ARIBAUD (3ADEV)" <albert.aribaud@3adev.fr>
CC: Boris Brezillon <boris.brezillon@free-electrons.com>
CC: Soeren Moch <smoch@web.de>
CC: Richard Hu <richard.hu@technexion.com>
CC: Wig Cheng <wig.cheng@technexion.com>
CC: Vanessa Maegima <vanessa.maegima@nxp.com>
CC: Max Krummenacher <max.krummenacher@toradex.com>
CC: Stefan Agner <stefan.agner@toradex.com>
CC: Markus Niebel <Markus.Niebel@tq-group.com>
CC: Breno Lima <breno.lima@nxp.com>
CC: Francesco Montefoschi <francesco.montefoschi@udoo.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Scott Wood <oss@buserror.net>
CC: Joe Hershberger <joe.hershberger@ni.com>
CC: Anatolij Gustschin <agust@denx.de>
CC: Simon Glass <sjg@chromium.org>
CC: "Andrew F. Davis" <afd@ti.com>
CC: "Łukasz Majewski" <l.majewski@samsung.com>
CC: Patrice Chotard <patrice.chotard@st.com>
CC: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
CC: Hans de Goede <hdegoede@redhat.com>
CC: Masahiro Yamada <yamada.masahiro@socionext.com>
CC: Stephen Warren <swarren@nvidia.com>
CC: Andre Przywara <andre.przywara@arm.com>
CC: "Álvaro Fernández Rojas" <noltari@gmail.com>
CC: York Sun <york.sun@nxp.com>
CC: Xiaoliang Yang <xiaoliang.yang@nxp.com>
CC: Chen-Yu Tsai <wens@csie.org>
CC: George McCollister <george.mccollister@gmail.com>
CC: Sven Ebenfeld <sven.ebenfeld@gmail.com>
CC: Filip Brozovic <fbrozovic@gmail.com>
CC: Petr Kulhavy <brain@jikos.cz>
CC: Eric Nelson <eric@nelint.com>
CC: Bai Ping <ping.bai@nxp.com>
CC: Anson Huang <Anson.Huang@nxp.com>
CC: Sanchayan Maity <maitysanchayan@gmail.com>
CC: Lokesh Vutla <lokeshvutla@ti.com>
CC: Patrick Delaunay <patrick.delaunay@st.com>
CC: Gary Bisson <gary.bisson@boundarydevices.com>
CC: Alexander Graf <agraf@suse.de>
CC: u-boot@lists.denx.de
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>

# 214fb19b 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5903 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 8d1a6ff8 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5904 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ad68d7b8 13-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add additional DRAM configurations

- 64bit 8gB density (4GiB) IMX6DQ
- 64bit 4gB density (2GiB) IMX6SDL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>

# edf00937 29-Aug-2016 Fabio Estevam <fabio.estevam@nxp.com>

mx6: ddr: Allow changing REFSEL and REFR fields

Currently MX6 SPL DDR initialization hardcodes the REF_SEL and
REFR fields of the MDREF register as 1 and 7, respectively for
DDR3 and 0 and 3 for LPDDR2.

Looking at the MDREF initialization done via DCD we see that
boards do need to initialize these fields differently:

$ git grep 0x021b0020 board/
board/bachmann/ot1200/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/ccv/xpress/imximage.cfg:DATA 4 0x021b0020 0x00000800 /* MMDC0_MDREF */
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x7800
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6qp.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6dlsabresd.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6slevk/imximage.cfg:DATA 4 0x021b0020 0x00001800
board/freescale/mx6sxsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/freescale/mx6sxsabresd/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/warp/imximage.cfg:DATA 4 0x021b0020 0x00001800

So introduce a mechanism for users to be able to configure
REFSEL and REFR fields as needed.

Keep all the mx6 SPL users in their current REF_SEL and REFR values,
so no functional changes for the existing users.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Eric Nelson <eric@nelint.com>

# 6052b1c6 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: added support for 32bit IMX6DQ 8Gb density DRAM config

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 1b99103f 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: only disable boot watchdog if Falcon mode

If not booting Falcon mode, leave the boot watchdog enabled as a work-around
for other non-resolved bootloader hangs.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3c0fd17f 23-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use EEPROM register for falcon boot mode

NAND+MMC env support costs 12KB in the SPL which is fairly expensive just
for the ability to specify whether or not to boot to uboot or directly
to linux. The Ventana boards have plenty of EEPROM storage so we will use
a byte there to signify if we should boot to the bootloader or to the OS.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 346d106d 03-Nov-2015 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Remove empty reset_cpu()

There is really no need to provide an empty reset_cpu() implementation,
so just remove it.

Cc: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# f2ff8343 17-Aug-2015 Peng Fan <Peng.Fan@freescale.com>

imx: mx6: ddr init MMDC according to ddr_type

To i.MX6, DDR3 and LPDDR2 is supported, so rename function mx6_dram_cfg
to mx6_ddr3_cfg and the original mx6_dram_cfg function only is a wrapper.
The new reimplemented function mx6_dram_cfg only invokes mx6_ddr3_cfg
when ddr_type is for DDR3. Later we can use ddr_type to initialize
MMDC for LPDDR2.

Initialize ddr_type for different boards which enable SPL.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# fdead4be 26-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: hang if board model could not be determined

If the EEPROM could not be read or is corrupt we always want to hang.
Note that an error message will have been displayed by read_eeprom in this
case.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 53940a50 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: config: enable Falcon mode

Falcon mode entails the SPL booting the OS directly instead of U-Boot.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# e06a0362 15-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add pmic_setup to SPL

We need to do any PMIC setup in the SPL if we are to bypass U-Boot for
falcon mode.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# af1db4a3 14-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use stack relocation

Certain features we desire require a larger stack than is available by using
iRAM (most notably for us, env_mmc). Relocate the stack to DRAM so that
we can use these features.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ea7a3c44 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GSC boot watchdog disable to SPL

If the SPL is to be used for Falcon mode then we need to make sure the SPL
disable the GSC boot watchdog.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# c4b44d76 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add gpio setup to SPL

If the SPL is to be used for Falcon mode then we need to make sure it
configures basic GPIO (iomux, padconf, and default output levels).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 2089b7be 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use common uart and i2c setup functions in SPL

Now that uart and i2c setup functions have been moved to common.c we can
use these and remove code duplication.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06c3564d 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: display SPL boot device

Display what device the SPL will fetch uboot.img from

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d783c274 06-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: fix boot to SD

This fixes a regression caused by e25fbe3fe531029dc7b100ea4c79dbc802e17fc2
(gw_ventana: Move the DCD settings to spl code)

The clock gating must be setup prior to calling arch_cpu_init(). Without this
booting to SD (directly via eFuse or via bmode) will hang.

Cc: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# 9e2b0c2d 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Update missing memory/calib handling

This commit combines catching missing memory and calibration data into
one if() block. It further prints pertinent information in determining
why the failure occurred.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 767d88b0 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Add new memory configuration

Add memory configuration for an IMX6SDL + 1GB density DRAM.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 7f14c31b 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove 128x16 calibration (share with 128x32)

The calibration data for dual 2Gb density chips can be used for a single 2Gb
density chip.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06edcb9d 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: updated 16bit DDR calibration

Updated 16bit DDR calibration using values obtained from running the
i.MX6 DDR Stress Test tool over a set of boards over full operationg
temperature.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 75f21e31 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: Add support for GW551x

The GW551x is a small form factor board based on the IMX6 SoC that includes:
* up to 512MB DDR3 memory
* up to 2GB NAND flash
* 1x miniPCIe socket (with USB)
* HDMI out (micro-HDMI)
* HDMI in (micro-HDMI)
* TTL level I/O (supported by GW16111 breakout board):
* I2C
* 2x UART
* CAN
* 2x DIO (GPIO/PWM)
* USB OTG

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# b0b83347 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for 4Gb density mem devices with IMX6DL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 29f0d6b1 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: enable precharge power-down fast-exit mode

Enable fast-exit precharge mode necessary for some DDR3 devices being
used on Ventana boards.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 576cd6b3 04-Dec-2014 Stefan Roese <sr@denx.de>

arm: mx6: gw_ventana: Change clock init to enable NAND related clocks

Otherwise NAND booting is likely to fail. Since this disables the NAND related
clocks and SPL can't load the main U-Boot from NAND.

This problem was introduced with this patch:

e25fbe3f (gw_ventana: Move the DCD settings to spl code)

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# e25fbe3f 14-Nov-2014 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Move the DCD settings to spl code

mx6sabresd_spl.cfg configures CCM registers, GPR registers and CCM_CCOSR.

Move the configuration to the spl code.

CCM_CCOSR setting is no longer required to get audio functionality in the
kernel, so remove such setting.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

# 1dd42e31 29-Sep-2014 Stefan Roese <sr@denx.de>

ARM: mx6: gw_ventana: Remove superfluous memset of GD in board_init_f

Zeroing GD in board_init_f() is not needed any more. As its now done in
crt0.S. The patch that clears the GD in crt0.S is this one:

aae2aef9 [arm: Set up global data before board_init_f()] from Simon.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# c91e4b8b 21-Aug-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: base SPL MMDC calibration on width and size not board

The IMX6 MMDC calibration registers depend on propagation delay and capacitive
loading between the SoC's MMDC and the DDR3 chips. On the Ventana boards the
board layout varies little in trace-lengths such that propagation delays are
irrelevant thus we can simply things by using calibration values obtained
from various board layouts based on a common SoC and DDR chip configuration.

This eliminates board-model from being needed allowing more flexibility. These
values were tested on a large sample size of Gateworks Ventana boards ranging
in layout, and memory configuration over the entire temperature range supported.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 0cc11dea 02-Jun-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: switch to SPL

Switch to an SPL image. The SPL for Ventana does the following:
- setup i2c and read the factory programmed EEPROM to obtain DRAM config
and model for board-specific calibration data
- configure DRAM per CPU/size/layout/devices/calibration
- load u-boot.img from NAND and jump to it

This allows for a single SPL+u-boot.img to replace the previous multiple boa
configurations.

Cc: Stefan Roese <sr@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Andy Ng <andreas2025@gmail.com>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Tapani Utriainen <tapani@technexion.com>
Cc: Tom Rini <trini@ti.com>

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# db41d65a 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move hang() to the same header as panic()

At present panic() is in the vsprintf.h header file. That does not seem
like an obvious choice for hang(), even though it relates to panic(). So
let's put hang() in its own header.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Migrate a few more files]
Signed-off-by: Tom Rini <trini@konsulko.com>

# e7dcf564 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Drop environment.h header file where not needed

This header file is now only used by files that access internal
environment features. Drop it from various places where it is not needed.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 6bf6dbee 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get_yesno() to env.h

Move env_get_yesno() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 0ab327a7 21-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: added support for 16bit 8Gb density (1GiB) DRAM

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ebe07ef7 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5908

The GW5908 is a small single board computer based on the i.MX6DL SoC
with the same peripheral set as the GW530x but with 1GiB density DRAM
(64bit 512MiB).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d1c3867a 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5905

The GW5905 is single-board tablet computer based on the i.MX6 SoC with the
following peripheral set:
- eMMC flash (boot device)
- microSD expansion
- LVDS display connector for off-board 3D+1C with PWM backlight
and I2C based touch controller
- MIPI camera connector supporting the TRULY CM8487-B500SA-E (OV5640)
- ublox EMMY-W1 WiFi/Bluetooth/NFC module (SDIO/UART)
- ublox ZOE-M8Q GPS
- LSM9DS1 9-DOF IMU
- 1x 1-lane miniPCIe socket with USB 2.0
- Gateworks System Controller
- Audio jack with TLV320AIC Audio Codec, Speaker AMP
and TSA227E Headphone detect
- MAX8607 3-mode LED camera flash
- DECT ULE module
- FUSB302 USB-C PD and ISL9238 Battery charger

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3f0da874 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove setup of I2C3 from SPL

Do not setup I2C3 in the SPL for Ventana as some devices on that bus
(aic3x codecs) can hang the bus causing i2c_setup to spin endlessly until
they are put into reset. Removing the setup of I2C3 from the SPL allows
the board-specific GPIO to be configured to take care of putting codecs
in reset prior to U-Boot setting up I2C3.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

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

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

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

Signed-off-by: Tom Rini <trini@konsulko.com>

# d024236e 18-Apr-2018 Tom Rini <trini@konsulko.com>

Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTR

We have a large number of places where while we historically referenced
gd in the code we no longer do, as well as cases where the code added
that line "just in case" during development and never dropped it.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 30df9f77 28-Aug-2017 Anatolij Gustschin <agust@denx.de>

imx6: drop duplicated bss memset and board_init_r() call

bss section is cleared in crt0.S. board_init_r() is also
entered from crt0 code.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# 3aa4b703 24-Aug-2017 Breno Lima <breno.lima@nxp.com>

imx: imx6: Move gpr_init() function to soc.c

Since the gpr_init() function is common for boards using MX6S, MX6DL, MX6D,
MX6Q and MX6QP processors move it to the soc.c file.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 310fb14b 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Drop env_relocate_spec() in favour of env_load()

This is a strange name for a function that loads the environment. There is
now only one implementation of this function, so use the new env_load()
function directly instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 552a848e 29-Jun-2017 Stefano Babic <sbabic@denx.de>

imx: reorganize IMX code as other SOCs

Change is consistent with other SOCs and it is in preparation
for adding SOMs. SOC's related files are moved from cpu/ to
mach-imx/<SOC>.

This change is also coherent with the structure in kernel.

Signed-off-by: Stefano Babic <sbabic@denx.de>

CC: Fabio Estevam <fabio.estevam@nxp.com>
CC: Akshay Bhat <akshaybhat@timesys.com>
CC: Ken Lin <Ken.Lin@advantech.com.tw>
CC: Marek Vasut <marek.vasut@gmail.com>
CC: Heiko Schocher <hs@denx.de>
CC: "Sébastien Szymanski" <sebastien.szymanski@armadeus.com>
CC: Christian Gmeiner <christian.gmeiner@gmail.com>
CC: Stefan Roese <sr@denx.de>
CC: Patrick Bruenn <p.bruenn@beckhoff.com>
CC: Troy Kisky <troy.kisky@boundarydevices.com>
CC: Nikita Kiryanov <nikita@compulab.co.il>
CC: Otavio Salvador <otavio@ossystems.com.br>
CC: "Eric Bénard" <eric@eukrea.com>
CC: Jagan Teki <jagan@amarulasolutions.com>
CC: Ye Li <ye.li@nxp.com>
CC: Peng Fan <peng.fan@nxp.com>
CC: Adrian Alonso <adrian.alonso@nxp.com>
CC: Alison Wang <b18965@freescale.com>
CC: Tim Harvey <tharvey@gateworks.com>
CC: Martin Donnelly <martin.donnelly@ge.com>
CC: Marcin Niestroj <m.niestroj@grinn-global.com>
CC: Lukasz Majewski <lukma@denx.de>
CC: Adam Ford <aford173@gmail.com>
CC: "Albert ARIBAUD (3ADEV)" <albert.aribaud@3adev.fr>
CC: Boris Brezillon <boris.brezillon@free-electrons.com>
CC: Soeren Moch <smoch@web.de>
CC: Richard Hu <richard.hu@technexion.com>
CC: Wig Cheng <wig.cheng@technexion.com>
CC: Vanessa Maegima <vanessa.maegima@nxp.com>
CC: Max Krummenacher <max.krummenacher@toradex.com>
CC: Stefan Agner <stefan.agner@toradex.com>
CC: Markus Niebel <Markus.Niebel@tq-group.com>
CC: Breno Lima <breno.lima@nxp.com>
CC: Francesco Montefoschi <francesco.montefoschi@udoo.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Scott Wood <oss@buserror.net>
CC: Joe Hershberger <joe.hershberger@ni.com>
CC: Anatolij Gustschin <agust@denx.de>
CC: Simon Glass <sjg@chromium.org>
CC: "Andrew F. Davis" <afd@ti.com>
CC: "Łukasz Majewski" <l.majewski@samsung.com>
CC: Patrice Chotard <patrice.chotard@st.com>
CC: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
CC: Hans de Goede <hdegoede@redhat.com>
CC: Masahiro Yamada <yamada.masahiro@socionext.com>
CC: Stephen Warren <swarren@nvidia.com>
CC: Andre Przywara <andre.przywara@arm.com>
CC: "Álvaro Fernández Rojas" <noltari@gmail.com>
CC: York Sun <york.sun@nxp.com>
CC: Xiaoliang Yang <xiaoliang.yang@nxp.com>
CC: Chen-Yu Tsai <wens@csie.org>
CC: George McCollister <george.mccollister@gmail.com>
CC: Sven Ebenfeld <sven.ebenfeld@gmail.com>
CC: Filip Brozovic <fbrozovic@gmail.com>
CC: Petr Kulhavy <brain@jikos.cz>
CC: Eric Nelson <eric@nelint.com>
CC: Bai Ping <ping.bai@nxp.com>
CC: Anson Huang <Anson.Huang@nxp.com>
CC: Sanchayan Maity <maitysanchayan@gmail.com>
CC: Lokesh Vutla <lokeshvutla@ti.com>
CC: Patrick Delaunay <patrick.delaunay@st.com>
CC: Gary Bisson <gary.bisson@boundarydevices.com>
CC: Alexander Graf <agraf@suse.de>
CC: u-boot@lists.denx.de
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>

# 214fb19b 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5903 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 8d1a6ff8 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5904 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ad68d7b8 13-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add additional DRAM configurations

- 64bit 8gB density (4GiB) IMX6DQ
- 64bit 4gB density (2GiB) IMX6SDL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>

# edf00937 29-Aug-2016 Fabio Estevam <fabio.estevam@nxp.com>

mx6: ddr: Allow changing REFSEL and REFR fields

Currently MX6 SPL DDR initialization hardcodes the REF_SEL and
REFR fields of the MDREF register as 1 and 7, respectively for
DDR3 and 0 and 3 for LPDDR2.

Looking at the MDREF initialization done via DCD we see that
boards do need to initialize these fields differently:

$ git grep 0x021b0020 board/
board/bachmann/ot1200/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/ccv/xpress/imximage.cfg:DATA 4 0x021b0020 0x00000800 /* MMDC0_MDREF */
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x7800
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6qp.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6dlsabresd.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6slevk/imximage.cfg:DATA 4 0x021b0020 0x00001800
board/freescale/mx6sxsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/freescale/mx6sxsabresd/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/warp/imximage.cfg:DATA 4 0x021b0020 0x00001800

So introduce a mechanism for users to be able to configure
REFSEL and REFR fields as needed.

Keep all the mx6 SPL users in their current REF_SEL and REFR values,
so no functional changes for the existing users.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Eric Nelson <eric@nelint.com>

# 6052b1c6 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: added support for 32bit IMX6DQ 8Gb density DRAM config

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 1b99103f 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: only disable boot watchdog if Falcon mode

If not booting Falcon mode, leave the boot watchdog enabled as a work-around
for other non-resolved bootloader hangs.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3c0fd17f 23-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use EEPROM register for falcon boot mode

NAND+MMC env support costs 12KB in the SPL which is fairly expensive just
for the ability to specify whether or not to boot to uboot or directly
to linux. The Ventana boards have plenty of EEPROM storage so we will use
a byte there to signify if we should boot to the bootloader or to the OS.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 346d106d 03-Nov-2015 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Remove empty reset_cpu()

There is really no need to provide an empty reset_cpu() implementation,
so just remove it.

Cc: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# f2ff8343 17-Aug-2015 Peng Fan <Peng.Fan@freescale.com>

imx: mx6: ddr init MMDC according to ddr_type

To i.MX6, DDR3 and LPDDR2 is supported, so rename function mx6_dram_cfg
to mx6_ddr3_cfg and the original mx6_dram_cfg function only is a wrapper.
The new reimplemented function mx6_dram_cfg only invokes mx6_ddr3_cfg
when ddr_type is for DDR3. Later we can use ddr_type to initialize
MMDC for LPDDR2.

Initialize ddr_type for different boards which enable SPL.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# fdead4be 26-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: hang if board model could not be determined

If the EEPROM could not be read or is corrupt we always want to hang.
Note that an error message will have been displayed by read_eeprom in this
case.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 53940a50 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: config: enable Falcon mode

Falcon mode entails the SPL booting the OS directly instead of U-Boot.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# e06a0362 15-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add pmic_setup to SPL

We need to do any PMIC setup in the SPL if we are to bypass U-Boot for
falcon mode.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# af1db4a3 14-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use stack relocation

Certain features we desire require a larger stack than is available by using
iRAM (most notably for us, env_mmc). Relocate the stack to DRAM so that
we can use these features.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ea7a3c44 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GSC boot watchdog disable to SPL

If the SPL is to be used for Falcon mode then we need to make sure the SPL
disable the GSC boot watchdog.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# c4b44d76 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add gpio setup to SPL

If the SPL is to be used for Falcon mode then we need to make sure it
configures basic GPIO (iomux, padconf, and default output levels).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 2089b7be 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use common uart and i2c setup functions in SPL

Now that uart and i2c setup functions have been moved to common.c we can
use these and remove code duplication.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06c3564d 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: display SPL boot device

Display what device the SPL will fetch uboot.img from

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d783c274 06-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: fix boot to SD

This fixes a regression caused by e25fbe3fe531029dc7b100ea4c79dbc802e17fc2
(gw_ventana: Move the DCD settings to spl code)

The clock gating must be setup prior to calling arch_cpu_init(). Without this
booting to SD (directly via eFuse or via bmode) will hang.

Cc: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# 9e2b0c2d 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Update missing memory/calib handling

This commit combines catching missing memory and calibration data into
one if() block. It further prints pertinent information in determining
why the failure occurred.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 767d88b0 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Add new memory configuration

Add memory configuration for an IMX6SDL + 1GB density DRAM.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 7f14c31b 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove 128x16 calibration (share with 128x32)

The calibration data for dual 2Gb density chips can be used for a single 2Gb
density chip.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06edcb9d 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: updated 16bit DDR calibration

Updated 16bit DDR calibration using values obtained from running the
i.MX6 DDR Stress Test tool over a set of boards over full operationg
temperature.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 75f21e31 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: Add support for GW551x

The GW551x is a small form factor board based on the IMX6 SoC that includes:
* up to 512MB DDR3 memory
* up to 2GB NAND flash
* 1x miniPCIe socket (with USB)
* HDMI out (micro-HDMI)
* HDMI in (micro-HDMI)
* TTL level I/O (supported by GW16111 breakout board):
* I2C
* 2x UART
* CAN
* 2x DIO (GPIO/PWM)
* USB OTG

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# b0b83347 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for 4Gb density mem devices with IMX6DL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 29f0d6b1 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: enable precharge power-down fast-exit mode

Enable fast-exit precharge mode necessary for some DDR3 devices being
used on Ventana boards.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 576cd6b3 04-Dec-2014 Stefan Roese <sr@denx.de>

arm: mx6: gw_ventana: Change clock init to enable NAND related clocks

Otherwise NAND booting is likely to fail. Since this disables the NAND related
clocks and SPL can't load the main U-Boot from NAND.

This problem was introduced with this patch:

e25fbe3f (gw_ventana: Move the DCD settings to spl code)

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# e25fbe3f 14-Nov-2014 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Move the DCD settings to spl code

mx6sabresd_spl.cfg configures CCM registers, GPR registers and CCM_CCOSR.

Move the configuration to the spl code.

CCM_CCOSR setting is no longer required to get audio functionality in the
kernel, so remove such setting.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

# 1dd42e31 29-Sep-2014 Stefan Roese <sr@denx.de>

ARM: mx6: gw_ventana: Remove superfluous memset of GD in board_init_f

Zeroing GD in board_init_f() is not needed any more. As its now done in
crt0.S. The patch that clears the GD in crt0.S is this one:

aae2aef9 [arm: Set up global data before board_init_f()] from Simon.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# c91e4b8b 21-Aug-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: base SPL MMDC calibration on width and size not board

The IMX6 MMDC calibration registers depend on propagation delay and capacitive
loading between the SoC's MMDC and the DDR3 chips. On the Ventana boards the
board layout varies little in trace-lengths such that propagation delays are
irrelevant thus we can simply things by using calibration values obtained
from various board layouts based on a common SoC and DDR chip configuration.

This eliminates board-model from being needed allowing more flexibility. These
values were tested on a large sample size of Gateworks Ventana boards ranging
in layout, and memory configuration over the entire temperature range supported.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 0cc11dea 02-Jun-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: switch to SPL

Switch to an SPL image. The SPL for Ventana does the following:
- setup i2c and read the factory programmed EEPROM to obtain DRAM config
and model for board-specific calibration data
- configure DRAM per CPU/size/layout/devices/calibration
- load u-boot.img from NAND and jump to it

This allows for a single SPL+u-boot.img to replace the previous multiple boa
configurations.

Cc: Stefan Roese <sr@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Andy Ng <andreas2025@gmail.com>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Tapani Utriainen <tapani@technexion.com>
Cc: Tom Rini <trini@ti.com>

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# e7dcf564 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Drop environment.h header file where not needed

This header file is now only used by files that access internal
environment features. Drop it from various places where it is not needed.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 6bf6dbee 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_get_yesno() to env.h

Move env_get_yesno() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 4bfd1f5d 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_init() to env.h

Move env_init() over to the new header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 0ab327a7 21-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: added support for 16bit 8Gb density (1GiB) DRAM

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ebe07ef7 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5908

The GW5908 is a small single board computer based on the i.MX6DL SoC
with the same peripheral set as the GW530x but with 1GiB density DRAM
(64bit 512MiB).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d1c3867a 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for GW5905

The GW5905 is single-board tablet computer based on the i.MX6 SoC with the
following peripheral set:
- eMMC flash (boot device)
- microSD expansion
- LVDS display connector for off-board 3D+1C with PWM backlight
and I2C based touch controller
- MIPI camera connector supporting the TRULY CM8487-B500SA-E (OV5640)
- ublox EMMY-W1 WiFi/Bluetooth/NFC module (SDIO/UART)
- ublox ZOE-M8Q GPS
- LSM9DS1 9-DOF IMU
- 1x 1-lane miniPCIe socket with USB 2.0
- Gateworks System Controller
- Audio jack with TLV320AIC Audio Codec, Speaker AMP
and TSA227E Headphone detect
- MAX8607 3-mode LED camera flash
- DECT ULE module
- FUSB302 USB-C PD and ISL9238 Battery charger

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3f0da874 04-Feb-2019 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove setup of I2C3 from SPL

Do not setup I2C3 in the SPL for Ventana as some devices on that bus
(aic3x codecs) can hang the bus causing i2c_setup to spin endlessly until
they are put into reset. Removing the setup of I2C3 from the SPL allows
the board-specific GPIO to be configured to take care of putting codecs
in reset prior to U-Boot setting up I2C3.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

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

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

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

Signed-off-by: Tom Rini <trini@konsulko.com>

# d024236e 18-Apr-2018 Tom Rini <trini@konsulko.com>

Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTR

We have a large number of places where while we historically referenced
gd in the code we no longer do, as well as cases where the code added
that line "just in case" during development and never dropped it.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 30df9f77 28-Aug-2017 Anatolij Gustschin <agust@denx.de>

imx6: drop duplicated bss memset and board_init_r() call

bss section is cleared in crt0.S. board_init_r() is also
entered from crt0 code.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# 3aa4b703 24-Aug-2017 Breno Lima <breno.lima@nxp.com>

imx: imx6: Move gpr_init() function to soc.c

Since the gpr_init() function is common for boards using MX6S, MX6DL, MX6D,
MX6Q and MX6QP processors move it to the soc.c file.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 310fb14b 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Drop env_relocate_spec() in favour of env_load()

This is a strange name for a function that loads the environment. There is
now only one implementation of this function, so use the new env_load()
function directly instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 552a848e 29-Jun-2017 Stefano Babic <sbabic@denx.de>

imx: reorganize IMX code as other SOCs

Change is consistent with other SOCs and it is in preparation
for adding SOMs. SOC's related files are moved from cpu/ to
mach-imx/<SOC>.

This change is also coherent with the structure in kernel.

Signed-off-by: Stefano Babic <sbabic@denx.de>

CC: Fabio Estevam <fabio.estevam@nxp.com>
CC: Akshay Bhat <akshaybhat@timesys.com>
CC: Ken Lin <Ken.Lin@advantech.com.tw>
CC: Marek Vasut <marek.vasut@gmail.com>
CC: Heiko Schocher <hs@denx.de>
CC: "Sébastien Szymanski" <sebastien.szymanski@armadeus.com>
CC: Christian Gmeiner <christian.gmeiner@gmail.com>
CC: Stefan Roese <sr@denx.de>
CC: Patrick Bruenn <p.bruenn@beckhoff.com>
CC: Troy Kisky <troy.kisky@boundarydevices.com>
CC: Nikita Kiryanov <nikita@compulab.co.il>
CC: Otavio Salvador <otavio@ossystems.com.br>
CC: "Eric Bénard" <eric@eukrea.com>
CC: Jagan Teki <jagan@amarulasolutions.com>
CC: Ye Li <ye.li@nxp.com>
CC: Peng Fan <peng.fan@nxp.com>
CC: Adrian Alonso <adrian.alonso@nxp.com>
CC: Alison Wang <b18965@freescale.com>
CC: Tim Harvey <tharvey@gateworks.com>
CC: Martin Donnelly <martin.donnelly@ge.com>
CC: Marcin Niestroj <m.niestroj@grinn-global.com>
CC: Lukasz Majewski <lukma@denx.de>
CC: Adam Ford <aford173@gmail.com>
CC: "Albert ARIBAUD (3ADEV)" <albert.aribaud@3adev.fr>
CC: Boris Brezillon <boris.brezillon@free-electrons.com>
CC: Soeren Moch <smoch@web.de>
CC: Richard Hu <richard.hu@technexion.com>
CC: Wig Cheng <wig.cheng@technexion.com>
CC: Vanessa Maegima <vanessa.maegima@nxp.com>
CC: Max Krummenacher <max.krummenacher@toradex.com>
CC: Stefan Agner <stefan.agner@toradex.com>
CC: Markus Niebel <Markus.Niebel@tq-group.com>
CC: Breno Lima <breno.lima@nxp.com>
CC: Francesco Montefoschi <francesco.montefoschi@udoo.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Scott Wood <oss@buserror.net>
CC: Joe Hershberger <joe.hershberger@ni.com>
CC: Anatolij Gustschin <agust@denx.de>
CC: Simon Glass <sjg@chromium.org>
CC: "Andrew F. Davis" <afd@ti.com>
CC: "Łukasz Majewski" <l.majewski@samsung.com>
CC: Patrice Chotard <patrice.chotard@st.com>
CC: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
CC: Hans de Goede <hdegoede@redhat.com>
CC: Masahiro Yamada <yamada.masahiro@socionext.com>
CC: Stephen Warren <swarren@nvidia.com>
CC: Andre Przywara <andre.przywara@arm.com>
CC: "Álvaro Fernández Rojas" <noltari@gmail.com>
CC: York Sun <york.sun@nxp.com>
CC: Xiaoliang Yang <xiaoliang.yang@nxp.com>
CC: Chen-Yu Tsai <wens@csie.org>
CC: George McCollister <george.mccollister@gmail.com>
CC: Sven Ebenfeld <sven.ebenfeld@gmail.com>
CC: Filip Brozovic <fbrozovic@gmail.com>
CC: Petr Kulhavy <brain@jikos.cz>
CC: Eric Nelson <eric@nelint.com>
CC: Bai Ping <ping.bai@nxp.com>
CC: Anson Huang <Anson.Huang@nxp.com>
CC: Sanchayan Maity <maitysanchayan@gmail.com>
CC: Lokesh Vutla <lokeshvutla@ti.com>
CC: Patrick Delaunay <patrick.delaunay@st.com>
CC: Gary Bisson <gary.bisson@boundarydevices.com>
CC: Alexander Graf <agraf@suse.de>
CC: u-boot@lists.denx.de
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>

# 214fb19b 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5903 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 8d1a6ff8 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5904 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# ad68d7b8 13-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add additional DRAM configurations

- 64bit 8gB density (4GiB) IMX6DQ
- 64bit 4gB density (2GiB) IMX6SDL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>

# edf00937 29-Aug-2016 Fabio Estevam <fabio.estevam@nxp.com>

mx6: ddr: Allow changing REFSEL and REFR fields

Currently MX6 SPL DDR initialization hardcodes the REF_SEL and
REFR fields of the MDREF register as 1 and 7, respectively for
DDR3 and 0 and 3 for LPDDR2.

Looking at the MDREF initialization done via DCD we see that
boards do need to initialize these fields differently:

$ git grep 0x021b0020 board/
board/bachmann/ot1200/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/ccv/xpress/imximage.cfg:DATA 4 0x021b0020 0x00000800 /* MMDC0_MDREF */
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x7800
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6qp.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6dlsabresd.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6slevk/imximage.cfg:DATA 4 0x021b0020 0x00001800
board/freescale/mx6sxsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/freescale/mx6sxsabresd/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/warp/imximage.cfg:DATA 4 0x021b0020 0x00001800

So introduce a mechanism for users to be able to configure
REFSEL and REFR fields as needed.

Keep all the mx6 SPL users in their current REF_SEL and REFR values,
so no functional changes for the existing users.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Eric Nelson <eric@nelint.com>

# 6052b1c6 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: added support for 32bit IMX6DQ 8Gb density DRAM config

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 1b99103f 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: only disable boot watchdog if Falcon mode

If not booting Falcon mode, leave the boot watchdog enabled as a work-around
for other non-resolved bootloader hangs.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 3c0fd17f 23-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use EEPROM register for falcon boot mode

NAND+MMC env support costs 12KB in the SPL which is fairly expensive just
for the ability to specify whether or not to boot to uboot or directly
to linux. The Ventana boards have plenty of EEPROM storage so we will use
a byte there to signify if we should boot to the bootloader or to the OS.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 346d106d 03-Nov-2015 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Remove empty reset_cpu()

There is really no need to provide an empty reset_cpu() implementation,
so just remove it.

Cc: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# f2ff8343 17-Aug-2015 Peng Fan <Peng.Fan@freescale.com>

imx: mx6: ddr init MMDC according to ddr_type

To i.MX6, DDR3 and LPDDR2 is supported, so rename function mx6_dram_cfg
to mx6_ddr3_cfg and the original mx6_dram_cfg function only is a wrapper.
The new reimplemented function mx6_dram_cfg only invokes mx6_ddr3_cfg
when ddr_type is for DDR3. Later we can use ddr_type to initialize
MMDC for LPDDR2.

Initialize ddr_type for different boards which enable SPL.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# fdead4be 26-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: hang if board model could not be determined

If the EEPROM could not be read or is corrupt we always want to hang.
Note that an error message will have been displayed by read_eeprom in this
case.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 53940a50 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: config: enable Falcon mode

Falcon mode entails the SPL booting the OS directly instead of U-Boot.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# e06a0362 15-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add pmic_setup to SPL

We need to do any PMIC setup in the SPL if we are to bypass U-Boot for
falcon mode.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# af1db4a3 14-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use stack relocation

Certain features we desire require a larger stack than is available by using
iRAM (most notably for us, env_mmc). Relocate the stack to DRAM so that
we can use these features.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ea7a3c44 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GSC boot watchdog disable to SPL

If the SPL is to be used for Falcon mode then we need to make sure the SPL
disable the GSC boot watchdog.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# c4b44d76 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add gpio setup to SPL

If the SPL is to be used for Falcon mode then we need to make sure it
configures basic GPIO (iomux, padconf, and default output levels).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 2089b7be 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use common uart and i2c setup functions in SPL

Now that uart and i2c setup functions have been moved to common.c we can
use these and remove code duplication.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06c3564d 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: display SPL boot device

Display what device the SPL will fetch uboot.img from

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# d783c274 06-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: fix boot to SD

This fixes a regression caused by e25fbe3fe531029dc7b100ea4c79dbc802e17fc2
(gw_ventana: Move the DCD settings to spl code)

The clock gating must be setup prior to calling arch_cpu_init(). Without this
booting to SD (directly via eFuse or via bmode) will hang.

Cc: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# 9e2b0c2d 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Update missing memory/calib handling

This commit combines catching missing memory and calibration data into
one if() block. It further prints pertinent information in determining
why the failure occurred.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 767d88b0 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Add new memory configuration

Add memory configuration for an IMX6SDL + 1GB density DRAM.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 7f14c31b 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove 128x16 calibration (share with 128x32)

The calibration data for dual 2Gb density chips can be used for a single 2Gb
density chip.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 06edcb9d 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: updated 16bit DDR calibration

Updated 16bit DDR calibration using values obtained from running the
i.MX6 DDR Stress Test tool over a set of boards over full operationg
temperature.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 75f21e31 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: Add support for GW551x

The GW551x is a small form factor board based on the IMX6 SoC that includes:
* up to 512MB DDR3 memory
* up to 2GB NAND flash
* 1x miniPCIe socket (with USB)
* HDMI out (micro-HDMI)
* HDMI in (micro-HDMI)
* TTL level I/O (supported by GW16111 breakout board):
* I2C
* 2x UART
* CAN
* 2x DIO (GPIO/PWM)
* USB OTG

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# b0b83347 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for 4Gb density mem devices with IMX6DL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 29f0d6b1 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: enable precharge power-down fast-exit mode

Enable fast-exit precharge mode necessary for some DDR3 devices being
used on Ventana boards.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 576cd6b3 04-Dec-2014 Stefan Roese <sr@denx.de>

arm: mx6: gw_ventana: Change clock init to enable NAND related clocks

Otherwise NAND booting is likely to fail. Since this disables the NAND related
clocks and SPL can't load the main U-Boot from NAND.

This problem was introduced with this patch:

e25fbe3f (gw_ventana: Move the DCD settings to spl code)

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>

# e25fbe3f 14-Nov-2014 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Move the DCD settings to spl code

mx6sabresd_spl.cfg configures CCM registers, GPR registers and CCM_CCOSR.

Move the configuration to the spl code.

CCM_CCOSR setting is no longer required to get audio functionality in the
kernel, so remove such setting.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

# 1dd42e31 29-Sep-2014 Stefan Roese <sr@denx.de>

ARM: mx6: gw_ventana: Remove superfluous memset of GD in board_init_f

Zeroing GD in board_init_f() is not needed any more. As its now done in
crt0.S. The patch that clears the GD in crt0.S is this one:

aae2aef9 [arm: Set up global data before board_init_f()] from Simon.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Tim Harvey <tharvey@gateworks.com>

# c91e4b8b 21-Aug-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: base SPL MMDC calibration on width and size not board

The IMX6 MMDC calibration registers depend on propagation delay and capacitive
loading between the SoC's MMDC and the DDR3 chips. On the Ventana boards the
board layout varies little in trace-lengths such that propagation delays are
irrelevant thus we can simply things by using calibration values obtained
from various board layouts based on a common SoC and DDR chip configuration.

This eliminates board-model from being needed allowing more flexibility. These
values were tested on a large sample size of Gateworks Ventana boards ranging
in layout, and memory configuration over the entire temperature range supported.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 0cc11dea 02-Jun-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: switch to SPL

Switch to an SPL image. The SPL for Ventana does the following:
- setup i2c and read the factory programmed EEPROM to obtain DRAM config
and model for board-specific calibration data
- configure DRAM per CPU/size/layout/devices/calibration
- load u-boot.img from NAND and jump to it

This allows for a single SPL+u-boot.img to replace the previous multiple boa
configurations.

Cc: Stefan Roese <sr@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Andy Ng <andreas2025@gmail.com>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Tapani Utriainen <tapani@technexion.com>
Cc: Tom Rini <trini@ti.com>

Signed-off-by: Tim Harvey <tharvey@gateworks.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

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

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

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

Signed-off-by: Tom Rini <trini@konsulko.com>


# d024236e 18-Apr-2018 Tom Rini <trini@konsulko.com>

Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTR

We have a large number of places where while we historically referenced
gd in the code we no longer do, as well as cases where the code added
that line "just in case" during development and never dropped it.

Signed-off-by: Tom Rini <trini@konsulko.com>


# 30df9f77 28-Aug-2017 Anatolij Gustschin <agust@denx.de>

imx6: drop duplicated bss memset and board_init_r() call

bss section is cleared in crt0.S. board_init_r() is also
entered from crt0 code.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>


# 3aa4b703 24-Aug-2017 Breno Lima <breno.lima@nxp.com>

imx: imx6: Move gpr_init() function to soc.c

Since the gpr_init() function is common for boards using MX6S, MX6DL, MX6D,
MX6Q and MX6QP processors move it to the soc.c file.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>


# bfebc8c9 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()

We are now using an env_ prefix for environment functions. Rename these
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>


# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>


# 310fb14b 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Drop env_relocate_spec() in favour of env_load()

This is a strange name for a function that loads the environment. There is
now only one implementation of this function, so use the new env_load()
function directly instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>


# 552a848e 29-Jun-2017 Stefano Babic <sbabic@denx.de>

imx: reorganize IMX code as other SOCs

Change is consistent with other SOCs and it is in preparation
for adding SOMs. SOC's related files are moved from cpu/ to
mach-imx/<SOC>.

This change is also coherent with the structure in kernel.

Signed-off-by: Stefano Babic <sbabic@denx.de>

CC: Fabio Estevam <fabio.estevam@nxp.com>
CC: Akshay Bhat <akshaybhat@timesys.com>
CC: Ken Lin <Ken.Lin@advantech.com.tw>
CC: Marek Vasut <marek.vasut@gmail.com>
CC: Heiko Schocher <hs@denx.de>
CC: "Sébastien Szymanski" <sebastien.szymanski@armadeus.com>
CC: Christian Gmeiner <christian.gmeiner@gmail.com>
CC: Stefan Roese <sr@denx.de>
CC: Patrick Bruenn <p.bruenn@beckhoff.com>
CC: Troy Kisky <troy.kisky@boundarydevices.com>
CC: Nikita Kiryanov <nikita@compulab.co.il>
CC: Otavio Salvador <otavio@ossystems.com.br>
CC: "Eric Bénard" <eric@eukrea.com>
CC: Jagan Teki <jagan@amarulasolutions.com>
CC: Ye Li <ye.li@nxp.com>
CC: Peng Fan <peng.fan@nxp.com>
CC: Adrian Alonso <adrian.alonso@nxp.com>
CC: Alison Wang <b18965@freescale.com>
CC: Tim Harvey <tharvey@gateworks.com>
CC: Martin Donnelly <martin.donnelly@ge.com>
CC: Marcin Niestroj <m.niestroj@grinn-global.com>
CC: Lukasz Majewski <lukma@denx.de>
CC: Adam Ford <aford173@gmail.com>
CC: "Albert ARIBAUD (3ADEV)" <albert.aribaud@3adev.fr>
CC: Boris Brezillon <boris.brezillon@free-electrons.com>
CC: Soeren Moch <smoch@web.de>
CC: Richard Hu <richard.hu@technexion.com>
CC: Wig Cheng <wig.cheng@technexion.com>
CC: Vanessa Maegima <vanessa.maegima@nxp.com>
CC: Max Krummenacher <max.krummenacher@toradex.com>
CC: Stefan Agner <stefan.agner@toradex.com>
CC: Markus Niebel <Markus.Niebel@tq-group.com>
CC: Breno Lima <breno.lima@nxp.com>
CC: Francesco Montefoschi <francesco.montefoschi@udoo.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Scott Wood <oss@buserror.net>
CC: Joe Hershberger <joe.hershberger@ni.com>
CC: Anatolij Gustschin <agust@denx.de>
CC: Simon Glass <sjg@chromium.org>
CC: "Andrew F. Davis" <afd@ti.com>
CC: "Łukasz Majewski" <l.majewski@samsung.com>
CC: Patrice Chotard <patrice.chotard@st.com>
CC: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
CC: Hans de Goede <hdegoede@redhat.com>
CC: Masahiro Yamada <yamada.masahiro@socionext.com>
CC: Stephen Warren <swarren@nvidia.com>
CC: Andre Przywara <andre.przywara@arm.com>
CC: "Álvaro Fernández Rojas" <noltari@gmail.com>
CC: York Sun <york.sun@nxp.com>
CC: Xiaoliang Yang <xiaoliang.yang@nxp.com>
CC: Chen-Yu Tsai <wens@csie.org>
CC: George McCollister <george.mccollister@gmail.com>
CC: Sven Ebenfeld <sven.ebenfeld@gmail.com>
CC: Filip Brozovic <fbrozovic@gmail.com>
CC: Petr Kulhavy <brain@jikos.cz>
CC: Eric Nelson <eric@nelint.com>
CC: Bai Ping <ping.bai@nxp.com>
CC: Anson Huang <Anson.Huang@nxp.com>
CC: Sanchayan Maity <maitysanchayan@gmail.com>
CC: Lokesh Vutla <lokeshvutla@ti.com>
CC: Patrick Delaunay <patrick.delaunay@st.com>
CC: Gary Bisson <gary.bisson@boundarydevices.com>
CC: Alexander Graf <agraf@suse.de>
CC: u-boot@lists.denx.de
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>


# 214fb19b 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5903 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# 8d1a6ff8 17-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GW5904 support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# ad68d7b8 13-Mar-2017 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add additional DRAM configurations

- 64bit 8gB density (4GiB) IMX6DQ
- 64bit 4gB density (2GiB) IMX6SDL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>


# edf00937 29-Aug-2016 Fabio Estevam <fabio.estevam@nxp.com>

mx6: ddr: Allow changing REFSEL and REFR fields

Currently MX6 SPL DDR initialization hardcodes the REF_SEL and
REFR fields of the MDREF register as 1 and 7, respectively for
DDR3 and 0 and 3 for LPDDR2.

Looking at the MDREF initialization done via DCD we see that
boards do need to initialize these fields differently:

$ git grep 0x021b0020 board/
board/bachmann/ot1200/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/ccv/xpress/imximage.cfg:DATA 4 0x021b0020 0x00000800 /* MMDC0_MDREF */
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x7800
board/freescale/mx6qarm2/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qarm2/imximage_mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6dl.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6qsabreauto/mx6qp.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6dlsabresd.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6sabresd/mx6q_4x_mt41j128.cfg:DATA 4 0x021b0020 0x00005800
board/freescale/mx6slevk/imximage.cfg:DATA 4 0x021b0020 0x00001800
board/freescale/mx6sxsabreauto/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/freescale/mx6sxsabresd/imximage.cfg:DATA 4 0x021b0020 0x00000800
board/warp/imximage.cfg:DATA 4 0x021b0020 0x00001800

So introduce a mechanism for users to be able to configure
REFSEL and REFR fields as needed.

Keep all the mx6 SPL users in their current REF_SEL and REFR values,
so no functional changes for the existing users.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Eric Nelson <eric@nelint.com>


# 6052b1c6 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: added support for 32bit IMX6DQ 8Gb density DRAM config

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# 1b99103f 24-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: SPL: only disable boot watchdog if Falcon mode

If not booting Falcon mode, leave the boot watchdog enabled as a work-around
for other non-resolved bootloader hangs.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# 3c0fd17f 23-May-2016 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use EEPROM register for falcon boot mode

NAND+MMC env support costs 12KB in the SPL which is fairly expensive just
for the ability to specify whether or not to boot to uboot or directly
to linux. The Ventana boards have plenty of EEPROM storage so we will use
a byte there to signify if we should boot to the bootloader or to the OS.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# 346d106d 03-Nov-2015 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Remove empty reset_cpu()

There is really no need to provide an empty reset_cpu() implementation,
so just remove it.

Cc: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Tim Harvey <tharvey@gateworks.com>


# f2ff8343 17-Aug-2015 Peng Fan <Peng.Fan@freescale.com>

imx: mx6: ddr init MMDC according to ddr_type

To i.MX6, DDR3 and LPDDR2 is supported, so rename function mx6_dram_cfg
to mx6_ddr3_cfg and the original mx6_dram_cfg function only is a wrapper.
The new reimplemented function mx6_dram_cfg only invokes mx6_ddr3_cfg
when ddr_type is for DDR3. Later we can use ddr_type to initialize
MMDC for LPDDR2.

Initialize ddr_type for different boards which enable SPL.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Stefan Roese <sr@denx.de>


# fdead4be 26-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: hang if board model could not be determined

If the EEPROM could not be read or is corrupt we always want to hang.
Note that an error message will have been displayed by read_eeprom in this
case.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# 53940a50 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: config: enable Falcon mode

Falcon mode entails the SPL booting the OS directly instead of U-Boot.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# e06a0362 15-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add pmic_setup to SPL

We need to do any PMIC setup in the SPL if we are to bypass U-Boot for
falcon mode.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# af1db4a3 14-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use stack relocation

Certain features we desire require a larger stack than is available by using
iRAM (most notably for us, env_mmc). Relocate the stack to DRAM so that
we can use these features.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# ea7a3c44 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add GSC boot watchdog disable to SPL

If the SPL is to be used for Falcon mode then we need to make sure the SPL
disable the GSC boot watchdog.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# c4b44d76 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add gpio setup to SPL

If the SPL is to be used for Falcon mode then we need to make sure it
configures basic GPIO (iomux, padconf, and default output levels).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# 2089b7be 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: use common uart and i2c setup functions in SPL

Now that uart and i2c setup functions have been moved to common.c we can
use these and remove code duplication.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# 06c3564d 08-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: display SPL boot device

Display what device the SPL will fetch uboot.img from

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# d783c274 06-May-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: fix boot to SD

This fixes a regression caused by e25fbe3fe531029dc7b100ea4c79dbc802e17fc2
(gw_ventana: Move the DCD settings to spl code)

The clock gating must be setup prior to calling arch_cpu_init(). Without this
booting to SD (directly via eFuse or via bmode) will hang.

Cc: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>


# 9e2b0c2d 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Update missing memory/calib handling

This commit combines catching missing memory and calibration data into
one if() block. It further prints pertinent information in determining
why the failure occurred.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# 767d88b0 08-Apr-2015 Pushpal Sidhu <psidhu@gateworks.com>

imx: ventana: Add new memory configuration

Add memory configuration for an IMX6SDL + 1GB density DRAM.

Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# 7f14c31b 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: remove 128x16 calibration (share with 128x32)

The calibration data for dual 2Gb density chips can be used for a single 2Gb
density chip.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# 06edcb9d 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: updated 16bit DDR calibration

Updated 16bit DDR calibration using values obtained from running the
i.MX6 DDR Stress Test tool over a set of boards over full operationg
temperature.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# 75f21e31 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: Add support for GW551x

The GW551x is a small form factor board based on the IMX6 SoC that includes:
* up to 512MB DDR3 memory
* up to 2GB NAND flash
* 1x miniPCIe socket (with USB)
* HDMI out (micro-HDMI)
* HDMI in (micro-HDMI)
* TTL level I/O (supported by GW16111 breakout board):
* I2C
* 2x UART
* CAN
* 2x DIO (GPIO/PWM)
* USB OTG

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# b0b83347 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: add support for 4Gb density mem devices with IMX6DL

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# 29f0d6b1 08-Apr-2015 Tim Harvey <tharvey@gateworks.com>

imx: ventana: enable precharge power-down fast-exit mode

Enable fast-exit precharge mode necessary for some DDR3 devices being
used on Ventana boards.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# 576cd6b3 04-Dec-2014 Stefan Roese <sr@denx.de>

arm: mx6: gw_ventana: Change clock init to enable NAND related clocks

Otherwise NAND booting is likely to fail. Since this disables the NAND related
clocks and SPL can't load the main U-Boot from NAND.

This problem was introduced with this patch:

e25fbe3f (gw_ventana: Move the DCD settings to spl code)

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>


# e25fbe3f 14-Nov-2014 Fabio Estevam <fabio.estevam@freescale.com>

gw_ventana: Move the DCD settings to spl code

mx6sabresd_spl.cfg configures CCM registers, GPR registers and CCM_CCOSR.

Move the configuration to the spl code.

CCM_CCOSR setting is no longer required to get audio functionality in the
kernel, so remove such setting.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>


# 1dd42e31 29-Sep-2014 Stefan Roese <sr@denx.de>

ARM: mx6: gw_ventana: Remove superfluous memset of GD in board_init_f

Zeroing GD in board_init_f() is not needed any more. As its now done in
crt0.S. The patch that clears the GD in crt0.S is this one:

aae2aef9 [arm: Set up global data before board_init_f()] from Simon.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Tim Harvey <tharvey@gateworks.com>


# c91e4b8b 21-Aug-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: base SPL MMDC calibration on width and size not board

The IMX6 MMDC calibration registers depend on propagation delay and capacitive
loading between the SoC's MMDC and the DDR3 chips. On the Ventana boards the
board layout varies little in trace-lengths such that propagation delays are
irrelevant thus we can simply things by using calibration values obtained
from various board layouts based on a common SoC and DDR chip configuration.

This eliminates board-model from being needed allowing more flexibility. These
values were tested on a large sample size of Gateworks Ventana boards ranging
in layout, and memory configuration over the entire temperature range supported.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>


# 0cc11dea 02-Jun-2014 Tim Harvey <tharvey@gateworks.com>

imx: ventana: switch to SPL

Switch to an SPL image. The SPL for Ventana does the following:
- setup i2c and read the factory programmed EEPROM to obtain DRAM config
and model for board-specific calibration data
- configure DRAM per CPU/size/layout/devices/calibration
- load u-boot.img from NAND and jump to it

This allows for a single SPL+u-boot.img to replace the previous multiple boa
configurations.

Cc: Stefan Roese <sr@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Andy Ng <andreas2025@gmail.com>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Tapani Utriainen <tapani@technexion.com>
Cc: Tom Rini <trini@ti.com>

Signed-off-by: Tim Harvey <tharvey@gateworks.com>