oweals/u-boot.git
4 years agoboard: ti: am654: Use EEPROM-based board detection
Andreas Dannenberg [Tue, 4 Jun 2019 23:08:26 +0000 (18:08 -0500)]
board: ti: am654: Use EEPROM-based board detection

The TI AM654x EVM base board and the associated daughtercards have on-
board I2C-based EEPROMs containing board configuration data. Use the
board detection infrastructure introduced earlier to do the following:

1) Parse the AM654x EVM base board EEPROM and populate items like board
   name and MAC addresses into the TI common EEPROM data structure
   residing in SRAM scratch space
2) Check for presence of daughter card(s) by probing the associated
   presence signals via an I2C-based GPIO expander. Then, if such a
   card is found, parse the data such as additional Ethernet MAC
   addresses from its on-board EEPROM and populate into U-Boot
   accordingly
3) Dynamically create an U-Boot ENV variable called overlay_files
   containing a list of daugherboard-specific DTB overlays based on
   daughercards found.

This patch adds support for the AM654x base board ("AM6-COMPROCEVM")
as well as for the IDK ("AM6-IDKAPPEVM"), OLDI LCD ("OLDI-LCD1EVM")
PCIe/USB3.0 ("SER-PCIEUSBEVM"), 2 Lane PCIe/USB2.0 ("SER-PCIE2LEVM"),
and general purpuse ("AM6-GPAPPEVM") daughtercards.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoti: common: am6: Add support for setting MAC addresses
Andreas Dannenberg [Tue, 4 Jun 2019 23:08:25 +0000 (18:08 -0500)]
ti: common: am6: Add support for setting MAC addresses

The AM654x EVM based on the TI K3 family of SoCs has an updated board
detection EEPROM structure that contains a TLV record of dedicated MAC
addresses rather than a range of MAC addresses as it was used on earlier
platforms such as DRA7. Add a basic function that allows us setting up
Ethernet MAC addresses into the U-Boot environment based on the MAC
address record contained in the common TI EEPROM structure.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoti: common: am6: Add support for board description EEPROM
Andreas Dannenberg [Tue, 4 Jun 2019 23:08:24 +0000 (18:08 -0500)]
ti: common: am6: Add support for board description EEPROM

The AM654x EVM based on the TI K3 family of SoCs have an updated board
detection EEPROM structure, now comprising variable-sized TLV-type
records, containing a superset of what is already being provided on
earlier platforms such as DRA7. Add basic support for parsing the new
data structures contained on the base board into the common TI EEPROM
structure while also providing infrastructure that can be used later on
to parse data from additional EEPROMs such as the ones that are used on
daughtercards for this platform.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoarm: K3: am654: Map common EEPROM data into SRAM scratch space
Andreas Dannenberg [Tue, 4 Jun 2019 23:08:23 +0000 (18:08 -0500)]
arm: K3: am654: Map common EEPROM data into SRAM scratch space

The board detection scheme employed on various TI EVMs makes use of
SRAM scratch space to share data read from an on-board EEPROM between
the different bootloading stages. Map the associated definition that's
used to locate this data into the SRAM scratch space we use on AM654x.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoconfigs: am65x_hs_evm_a53: Increase malloc pool before relocation
Andreas Dannenberg [Tue, 4 Jun 2019 23:08:22 +0000 (18:08 -0500)]
configs: am65x_hs_evm_a53: Increase malloc pool before relocation

The malloc pool used before relocation is getting tight leading to
out of memory errors doing certain DM-related calls. Since we are
running the A53 SPL out of DDR let's just go ahead and bump its size
as used in U-Boot proper as well as SPL (via Kconfig default value)
from 8KB to 32KB.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Acked-by: Andrew F. Davis <afd@ti.com>
4 years agoconfigs: am65x_evm_a53: Increase malloc pool before relocation
Andreas Dannenberg [Tue, 4 Jun 2019 23:08:21 +0000 (18:08 -0500)]
configs: am65x_evm_a53: Increase malloc pool before relocation

The malloc pool used before relocation is getting tight leading to
out of memory errors doing certain DM-related calls. Since we are
running the A53 SPL out of DDR let's just go ahead and bump its size
as used in U-Boot proper as well as SPL (via Kconfig default value)
from 8KB to 32KB.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoconfigs: am65x_hs_evm_a53: Enable PCA953X-type GPIO driver
Andreas Dannenberg [Tue, 4 Jun 2019 23:08:20 +0000 (18:08 -0500)]
configs: am65x_hs_evm_a53: Enable PCA953X-type GPIO driver

Enable GPIO driver for PCA953X-compatible I2C-based I/O expander
which includes support for the TCA9554/PCA9554-type expander found
on the AM654 EVM base board.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Acked-by: Andrew F. Davis <afd@ti.com>
4 years agoconfigs: am65x_evm_a53: Enable PCA953X-type GPIO driver
Andreas Dannenberg [Tue, 4 Jun 2019 23:08:19 +0000 (18:08 -0500)]
configs: am65x_evm_a53: Enable PCA953X-type GPIO driver

Enable GPIO driver for PCA953X-compatible I2C-based I/O expander
which includes support for the TCA9554/PCA9554-type expander found
on the AM654 EVM base board.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoarm64: dts: k3-am654-base-board: Add I2C GPIO expander @ 0x38
Andreas Dannenberg [Tue, 4 Jun 2019 23:08:18 +0000 (18:08 -0500)]
arm64: dts: k3-am654-base-board: Add I2C GPIO expander @ 0x38

The AM654 base board has a TCA9554/PCA9554-type GPIO expander on the
wkup_i2c0 bus at address 0x38 that is used to detect the presence of
daughter cards.  Add a respective DTS description of this expander
to enable its use.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoconfigs: am65x_hs_evm_defconfig: Enable I2C support
Andreas Dannenberg [Tue, 4 Jun 2019 23:08:17 +0000 (18:08 -0500)]
configs: am65x_hs_evm_defconfig: Enable I2C support

Enable I2C via driver model as well as the associated set of U-Boot
commands to allow us interacting with various I2C slave devices.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Acked-by: Andrew F. Davis <afd@ti.com>
4 years agoconfigs: am65x_evm_defconfig: Enable I2C support
Andreas Dannenberg [Tue, 4 Jun 2019 23:08:16 +0000 (18:08 -0500)]
configs: am65x_evm_defconfig: Enable I2C support

Enable I2C via driver model as well as the associated set of U-Boot
commands to allow us interacting with various I2C slave devices.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Vignesh R <vigneshr@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoarm: dts: k3-am654-base-board: Enable wkup_i2c0 across all boot stages
Andreas Dannenberg [Tue, 4 Jun 2019 23:08:15 +0000 (18:08 -0500)]
arm: dts: k3-am654-base-board: Enable wkup_i2c0 across all boot stages

To enable the use of an EEPROM-based board detection scheme we need to
be able to access the I2C bus associated with the EEPROMs across all
3 stages of U-Boot: R5 SPL, A53 SPL, and A53 U-Boot (proper). So go
ahead and add/update the wkup_i2c0 peripheral module DTS definitions
and its associated pinmux node accordingly.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoarm: dts: k3-am65: Add I2C nodes
Andreas Dannenberg [Tue, 4 Jun 2019 23:08:14 +0000 (18:08 -0500)]
arm: dts: k3-am65: Add I2C nodes

Add I2C DT nodes

Signed-off-by: Vignesh R <vigneshr@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoarm: dts: k3-am65: Move pinctrl nodes out of U-Boot specific dtsi
Andreas Dannenberg [Tue, 4 Jun 2019 23:08:13 +0000 (18:08 -0500)]
arm: dts: k3-am65: Move pinctrl nodes out of U-Boot specific dtsi

Only U-Boot specifc DT properties or overrides, must be in -u-boot.dtsi.
Pinctrl nodes does not belong here. Now that pinctrl nodes are in kernel
DT, there is no reason to be keep these in -u-boot.dtsi. Move them to
proper places so that it would ease copying DT entries from kernel DT.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoarm: omap_i2c: Remove unwanted header file inclusion
Vignesh R [Tue, 4 Jun 2019 23:08:12 +0000 (18:08 -0500)]
arm: omap_i2c: Remove unwanted header file inclusion

There is no need for to include this header here, so drop it.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoi2c: omap24xx_i2c: Adapt driver to support K3 devices
Vignesh R [Tue, 4 Jun 2019 23:08:11 +0000 (18:08 -0500)]
i2c: omap24xx_i2c: Adapt driver to support K3 devices

K3 devices have I2C IP that is same as OMAP2+ family. Allow driver to be
compiled for ARCH_K3.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoam65x: README: Add eMMC layout and flash instructions
Faiz Abbas [Tue, 4 Jun 2019 22:55:55 +0000 (17:55 -0500)]
am65x: README: Add eMMC layout and flash instructions

Add instructions for flashing boot images to the eMMC with a
layout of the address where each image needs to be flashed.

Also add instructions to flash filesystem partition in user
partition and boot kernel from the rootfs.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
4 years agoconfigs: am65x_hs_evm: Add Support for eMMC boot
Andreas Dannenberg [Tue, 4 Jun 2019 22:55:54 +0000 (17:55 -0500)]
configs: am65x_hs_evm: Add Support for eMMC boot

Add configs to support RAW boot mode in eMMC.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
4 years agoconfigs: am65x_evm: Add Support for eMMC boot
Faiz Abbas [Tue, 4 Jun 2019 22:55:53 +0000 (17:55 -0500)]
configs: am65x_evm: Add Support for eMMC boot

Add configs to support RAW boot mode in eMMC.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
4 years agoconfigs: am65x_hs_evm_r5: All sysfw to be loaded via MMC
Andreas Dannenberg [Tue, 4 Jun 2019 22:55:52 +0000 (17:55 -0500)]
configs: am65x_hs_evm_r5: All sysfw to be loaded via MMC

Enable all the relevant configs that enables support for loading
sysfw via MMC.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoconfigs: am65x_evm_r5: All sysfw to be loaded via MMC
Andreas Dannenberg [Tue, 4 Jun 2019 22:55:51 +0000 (17:55 -0500)]
configs: am65x_evm_r5: All sysfw to be loaded via MMC

Enable all the relevant configs that enables support for loading
sysfw via MMC.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
4 years agoarmV7R: K3: am654: Load SYSFW binary and config from boot media
Andreas Dannenberg [Tue, 4 Jun 2019 22:55:50 +0000 (17:55 -0500)]
armV7R: K3: am654: Load SYSFW binary and config from boot media

Use the System Firmware (SYSFW) loader framework to load and start
the SYSFW as part of the AM654 early initialization sequence. While
at it also initialize the WKUP_UART0 pinmux as it is used by SYSFW
to print diagnostic messages.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
4 years agoarmv7R: K3: am654: Use full malloc implementation in SPL
Andreas Dannenberg [Tue, 4 Jun 2019 22:55:49 +0000 (17:55 -0500)]
armv7R: K3: am654: Use full malloc implementation in SPL

Switch to using the full malloc scheme in post-relocation SPL to allow
better utilization of available memory for example by allowing memory
to get freed. Initially allocate a 16MB-sized region in DDR starting
at address 0x84000000 for this purpose.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
4 years agoarmV7R: K3: am654: Allow using SPL BSS pre-relocation
Andreas Dannenberg [Tue, 4 Jun 2019 22:55:48 +0000 (17:55 -0500)]
armV7R: K3: am654: Allow using SPL BSS pre-relocation

In order to be able to use more advanced driver functionality which often
relies on having BSS initialized during early boot prior to relocation
several things need to be in place:

1) Memory needs to be available for BSS to use. For this, we locate BSS
   at the top of the MCU SRAM area, with the stack starting right below
   it,
2) We need to move the initialization of BSS prior to entering
   board_init_f(). We will do this with a separate commit by turning on
   the respective CONFIG option.

In this commit we also clean up the assignment of the initial SP address
as part of the refactoring, taking into account the pre-decrement post-
increment nature in which the SP is used on ARM.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
4 years agoarm: K3: Introduce System Firmware loader framework
Andreas Dannenberg [Tue, 4 Jun 2019 22:55:47 +0000 (17:55 -0500)]
arm: K3: Introduce System Firmware loader framework

Introduce a framework that allows loading the System Firmware (SYSFW)
binary as well as the associated configuration data from an image tree
blob named "sysfw.itb" from an FS-based MMC boot media or from an MMC
RAW mode partition or sector.

To simplify the handling of and loading from the different boot media
we tap into the existing U-Boot SPL framework usually used for loading
U-Boot by building on an earlier commit that exposes some of that
functionality.

Note that this initial implementation only supports FS and RAW-based
eMMC/SD card boot.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agospl: Make image loader infrastructure more universal
Andreas Dannenberg [Tue, 4 Jun 2019 22:55:46 +0000 (17:55 -0500)]
spl: Make image loader infrastructure more universal

The current U-Boot SPL image loader infrastructure is very powerful,
able to initialize and load from a variety of boot media however it
is strongly geared towards loading specific types of images in a very
specific way. To address the need being able to use this infrastructure
to load arbitrary image files go ahead and refactor it as follows:

- Refactor existing spl_mmc_load_image function into superset function,
  accepting additional arguments such as filenames and media load offset
  (same concept can also be applied toother spl_XXX_load_image functions)
- Extend the loader function to "remember" their peripheral initialization
  status so that the init is only done once during the boot process,
- Extend the FIT image loading function to allow skipping the parsing/
  processing of the FIT contents (so that this can be done separately
  in a more customized fashion)
- Populate the SPL_LOAD_IMAGE_METHOD() list with a trampoline function,
  invoking the newly refactored superset functions in a way to maintain
  compatibility with the existing behavior

This refactoring initially covers MMC/SD card loading (RAW and FS-based).

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agospl: Allow performing BSS init early before board_init_f()
Andreas Dannenberg [Tue, 4 Jun 2019 22:55:45 +0000 (17:55 -0500)]
spl: Allow performing BSS init early before board_init_f()

On some platform we have sufficient memory available early on to allow
setting up and using a basic BSS prior to entering board_init_f(). Doing
so can for example be used to carry state over to board_init_r() without
having to resort to extending U-Boot's global data structure.

To support such scenarios add a Kconfig option called CONFIG_SPL_EARLY_BSS
to allow moving the initialization of BSS prior to entering board_init_f(),
if enabled. Note that using this option usually should go along with using
CONFIG_SPL_SEPARATE_BSS and configuring BSS to be located in memory
actually available prior to board_init_f().

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
4 years agommc: am654_sdhci: Allow driver to probe without PDs specified
Andreas Dannenberg [Tue, 4 Jun 2019 22:55:44 +0000 (17:55 -0500)]
mmc: am654_sdhci: Allow driver to probe without PDs specified

We would like to use the driver even without power domains being
specified for cases such as during early boot when the required power
domains have already gotten enabled by the SoC's boot ROM and such
explicit initialization is not needed and possible.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agoconfigs: am65x_evm_a53: Add Support for creating GPT partitions
Faiz Abbas [Mon, 10 Jun 2019 19:13:44 +0000 (00:43 +0530)]
configs: am65x_evm_a53: Add Support for creating GPT partitions

Add Support for creating GPT partitions in U-boot.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
4 years agoam65x_evm: Add Support for creating a filesystem GPT partition in eMMC
Faiz Abbas [Mon, 10 Jun 2019 19:13:43 +0000 (00:43 +0530)]
am65x_evm: Add Support for creating a filesystem GPT partition in eMMC

Add Support for creating a GPT partition for the filesystem in eMMC.
The filesystem is created in the user partition (partition 0).

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
4 years agoconfigs: am65x: Add configs to support environment in eMMC
Faiz Abbas [Mon, 10 Jun 2019 19:13:42 +0000 (00:43 +0530)]
configs: am65x: Add configs to support environment in eMMC

Add configs such that U-boot environment is in eMMC by default.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
4 years agommc: am654_sdhci: Add a platform specific set_control_reg() callback
Faiz Abbas [Mon, 10 Jun 2019 19:13:41 +0000 (00:43 +0530)]
mmc: am654_sdhci: Add a platform specific set_control_reg() callback

Add a platform specific set_control_reg() callback to help switch to
UHS speed modes.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agommc: sdhci: Add support for HOST_CONTROL2 and setting UHS timings
Faiz Abbas [Mon, 10 Jun 2019 19:13:40 +0000 (00:43 +0530)]
mmc: sdhci: Add support for HOST_CONTROL2 and setting UHS timings

The HOST_CONTROL2 register is a part of SDHC v3.00 and not just specific
to arasan/zynq controllers. Add the same to sdhci.h.

Also create a common API to set UHS timings in HOST_CONTROL2.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agoconfigs: am65x_evm: Enable CONFIG_REGMAP
Faiz Abbas [Mon, 10 Jun 2019 19:13:39 +0000 (00:43 +0530)]
configs: am65x_evm: Enable CONFIG_REGMAP

Add Support for CONFIG_REGMAP.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agommc: am654_sdhci: Add Support for PHY
Faiz Abbas [Mon, 10 Jun 2019 19:13:38 +0000 (00:43 +0530)]
mmc: am654_sdhci: Add Support for PHY

Add support in the driver for handling phy specific registers.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agommc: sdhci: Make set_ios_post() return int
Faiz Abbas [Mon, 10 Jun 2019 19:13:37 +0000 (00:43 +0530)]
mmc: sdhci: Make set_ios_post() return int

Make set_ios_post() return int to faciliate error handling in
platform drivers.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
4 years agoarm: dts: k3: Add phy specific properties to SD card node
Faiz Abbas [Mon, 10 Jun 2019 19:13:36 +0000 (00:43 +0530)]
arm: dts: k3: Add phy specific properties to SD card node

With changes in the driver requiring phy related properties,
add the same for the SD card node to prevent breaking boot with
the driver update.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agommc: sdhci: Make sdhci_set_clock() non static
Faiz Abbas [Mon, 10 Jun 2019 19:13:35 +0000 (00:43 +0530)]
mmc: sdhci: Make sdhci_set_clock() non static

The am654_sdhci driver needs to switch the clock off
before disabling its phy dll and needs to re-enable
the clock before enabling the phy again.

Therefore, make the sdhci_set_clock() function accessible
in the am654_sdhci driver.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agommc: sdhci: Add support for sdhci-caps-mask
Faiz Abbas [Mon, 10 Jun 2019 19:13:34 +0000 (00:43 +0530)]
mmc: sdhci: Add support for sdhci-caps-mask

Add Support for masking some bits in the capabilities
register of a host controller.

Also remove the redundant readl() into caps1.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agoregmap: Add API regmap_init_mem_index()
Faiz Abbas [Mon, 10 Jun 2019 19:13:33 +0000 (00:43 +0530)]
regmap: Add API regmap_init_mem_index()

In device nodes with more than one entry in the reg property,
it is sometimes useful to regmap only of the entries. Add an
API regmap_init_mem_index() to facilitate this.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agommc: am654_sdhci: Remove quirks
Faiz Abbas [Mon, 10 Jun 2019 19:13:32 +0000 (00:43 +0530)]
mmc: am654_sdhci: Remove quirks

The host controller works perfectly well without having to add any
quirks. Remove them.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agoarm64: dts: k3: Sync sdhci0 node from kernel and change driver name
Faiz Abbas [Mon, 10 Jun 2019 19:13:31 +0000 (00:43 +0530)]
arm64: dts: k3: Sync sdhci0 node from kernel and change driver name

Sync the sdhci0 node from kernel. This changes the compatible that is
required to be there in the driver. Change the same for the SD card node
which is not yet supported in kernel. This also syncs the main_pmx0 node
as a side effect.

Also change the name of the driver to match the compatible in kernel.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agoMerge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Tue, 16 Jul 2019 15:19:31 +0000 (11:19 -0400)]
Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi

- Beelink-x2 STB support (Marcus)
- H6 DDR3, LPDDR3 changes (Andre, Jernej)
- H6 pin controller, USB PHY (Andre)

4 years agosunxi: H6: Enable USB for existing boards
Andre Przywara [Sun, 23 Jun 2019 14:09:50 +0000 (15:09 +0100)]
sunxi: H6: Enable USB for existing boards

So far USB was not enabled for the Allwinner H6 boards, as the PHY
driver was not ready and the clock gates were missing. Since this is now
fixed, let's add the PHY and the OHCI/EHCI drivers to the build, for
all existing H6 boards.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com> # Pine-H64
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: phy: Add USB PHY support for Allwinner H6
Andre Przywara [Sun, 23 Jun 2019 14:09:49 +0000 (15:09 +0100)]
sunxi: phy: Add USB PHY support for Allwinner H6

The USB PHY used in the Allwinner H6 SoC has some pecularities (as usual),
which require a small addition to the USB PHY driver:
In this case the second PHY is PHY3, not PHY1, so we need to skip number
1 and 2 in the code. Just use the respective code from Linux for that.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com> # Pine-H64
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: clocks: Add H6 USB clock gates and resets
Andre Przywara [Sun, 23 Jun 2019 14:09:48 +0000 (15:09 +0100)]
sunxi: clocks: Add H6 USB clock gates and resets

To enable USB support in U-Boot, add the required clock and reset gates
to the H6 clock driver. Once enabled, the generic EHCI/OCHI drivers will
pick them up from there automatically.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com> # Pine-H64
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: gpio: Enable support for H6 pin controller
Andre Przywara [Sun, 23 Jun 2019 14:09:47 +0000 (15:09 +0100)]
sunxi: gpio: Enable support for H6 pin controller

The Allwinner H6 pin controller is not really special, at least not when
it comes to normal GPIO operation.

Add the H6 compatible strings to the list of recognised strings, to make
GPIOs work for H6 boards.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com> # Pine-H64
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: move SUNXI_GPIO to Kconfig
Andre Przywara [Sun, 23 Jun 2019 14:09:46 +0000 (15:09 +0100)]
sunxi: move SUNXI_GPIO to Kconfig

Probably for no particular reason SUNXI_GPIO was still defined the "old
way", in header files only.

Introduce SUNXI_GPIO to the Kconfig file in drivers/gpio to remove
another line from our dreadful config_whitelist.txt.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com> # Pine-H64
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: H6: Add DDR3 DRAM delay values
Jernej Skrabec [Mon, 15 Jul 2019 01:27:09 +0000 (02:27 +0100)]
sunxi: H6: Add DDR3 DRAM delay values

Add some basic line delay values to be used with DDR3 DRAM chips on
some H6 TV boxes.
Taken from a register dump after boot0 initialised the DRAM.
Put them as the default delay values for DDR3 DRAM until we know better.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: H6: Add DDR3-1333 timings
Andre Przywara [Mon, 15 Jul 2019 01:27:08 +0000 (02:27 +0100)]
sunxi: H6: Add DDR3-1333 timings

Add a routine to program the timing parameters for DDR3-1333 DRAM chips
connected to the H6 DRAM controller.

The values were gathered from doing back-calculations from a register
dump, trying to match them up with the official JEDEC DDDR3 spec.
If in doubt, the register dump values were taken for now, but the JEDEC
recommendation were added as a comment.

Many thanks to Jernej for contributing fixes!

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: H6: Add DDR3 support to DRAM controller driver
Andre Przywara [Mon, 15 Jul 2019 01:27:07 +0000 (02:27 +0100)]
sunxi: H6: Add DDR3 support to DRAM controller driver

At the moment the H6 DRAM driver only supports LPDDR3 DRAM.

Extend the driver to cover DDR3 DRAM as well.

The changes are partly motivated by looking at the ZynqMP register
documentation, partly by looking at register dumps after boot0/libdram
has initialised the controller.

Many thanks to Jernej for contributing some fixes!

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: H6: move LPDDR3 timing definition into separate file
Andre Przywara [Mon, 15 Jul 2019 01:27:06 +0000 (02:27 +0100)]
sunxi: H6: move LPDDR3 timing definition into separate file

Currently the H6 DRAM driver only supports one kind of LPDDR3 DRAM.
Split the timing parameters for this LPDDR3 configuration  into a
separate file, to allow selecting an alternative later at compile time
(as the sunxi-dw driver does).

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: H6: DRAM: follow recommended PHY init algorithm
Andre Przywara [Mon, 15 Jul 2019 01:27:05 +0000 (02:27 +0100)]
sunxi: H6: DRAM: follow recommended PHY init algorithm

The DRAM controller manual suggests to first program the PHY
initialisation parameters to the PHY_PIR register, and then set bit 0 to
trigger the initialisation. This is also used in boot0.

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

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: H6: DRAM: avoid memcpy() on MMIO registers
Andre Przywara [Mon, 15 Jul 2019 01:27:04 +0000 (02:27 +0100)]
sunxi: H6: DRAM: avoid memcpy() on MMIO registers

Using memcpy() is, however tempting, not a good idea: It depends on the
specific implementation of memcpy, also lacks barriers. In this
particular case the first registers were written using 64-bit writes,
and the last register using four separate single-byte writes.

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

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agoMerge branch 'master' of git://git.denx.de/u-boot-net
Tom Rini [Mon, 15 Jul 2019 22:56:24 +0000 (18:56 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-net

4 years agonet: macb: Add support for 1000-baseX
Radu Pirea [Fri, 7 Jun 2019 11:18:36 +0000 (14:18 +0300)]
net: macb: Add support for 1000-baseX

Macb can be used with Xilinx PCS/PMA PHY in fpga which is a 1000-baseX
phy(lpa 0x41e0). This patch adds checks for LPA_1000XFULL and
LPA_1000XHALF bits.

Signed-off-by: Radu Pirea <radu_nicolae.pirea@upb.ro>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: macb: Fixed reading MII_LPA register
Radu Pirea [Fri, 7 Jun 2019 11:18:35 +0000 (14:18 +0300)]
net: macb: Fixed reading MII_LPA register

If macb is gem and is gigabit capable, lpa value is not read from
the right register(MII_LPA) and is read from MII_STAT1000. This patch
fixes reading of the lpa value.

Signed-off-by: Radu Pirea <radu_nicolae.pirea@upb.ro>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agoconfigs: am65x_evm_a53: enable networking
Grygorii Strashko [Tue, 9 Jul 2019 05:00:37 +0000 (10:30 +0530)]
configs: am65x_evm_a53: enable networking

Enable TI K3 AM65x CPSW NUSS driver.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoarm64: dts: k3-am654-base-board: add mcu cpsw nuss pinmux and phy defs
Grygorii Strashko [Tue, 9 Jul 2019 05:00:36 +0000 (10:30 +0530)]
arm64: dts: k3-am654-base-board: add mcu cpsw nuss pinmux and phy defs

Add mcu cpsw nuss pinmux and phy defs required by cpsw.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agoarm64: dts: ti: k3-am65: add mcu cpsw node
Grygorii Strashko [Tue, 9 Jul 2019 05:00:35 +0000 (10:30 +0530)]
arm64: dts: ti: k3-am65: add mcu cpsw node

Add mcu cpsw and its components along with scm_conf node
to have ethernet functional.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: ethernet: ti: Introduce am654 gigabit eth switch subsystem driver
Keerthy [Tue, 9 Jul 2019 05:00:34 +0000 (10:30 +0530)]
net: ethernet: ti: Introduce am654 gigabit eth switch subsystem driver

Add new driver for the TI AM65x SoC Gigabit Ethernet Switch subsystem (CPSW
NUSS). It has two ports and provides Ethernet packet communication for the
device and can be configured as an Ethernet switch. CPSW NUSS features: the
Reduced Gigabit Media Independent Interface (RGMII), Reduced Media
Independent Interface (RMII), and the Management Data Input/Output (MDIO)
interface for physical layer device (PHY) management. The TI AM65x SoC has
integrated two-port Gigabit Ethernet Switch subsystem into device MCU
domain named MCU_CPSW0. One Ethernet port (port 1) with selectable RGMII
and RMII interfaces and an internal Communications Port Programming
Interface (CPPI) port (Host port 0).

Host Port 0 CPPI Packet Streaming Interface interface supports 8 TX
channels and on RX channels operating by TI am654 NAVSS Unified DMA
Peripheral Root Complex (UDMA-P) controller.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agodriver: net: ti: cpsw-mdio: use phys_addr_t for mdio_base addr
Keerthy [Tue, 9 Jul 2019 05:00:33 +0000 (10:30 +0530)]
driver: net: ti: cpsw-mdio: use phys_addr_t for mdio_base addr

Use phys_addr_t for mdio_base address to avoid build
warnings on arm64 and dra7. Cast it to uintprt_t before
assigning to regs.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: phy: cortina: Use block layer to read from mmc
Yinbo Zhu [Tue, 11 Jun 2019 06:29:03 +0000 (14:29 +0800)]
net: phy: cortina: Use block layer to read from mmc

This patch is to use block layer to read from mmc in cortina

Signed-off-by: Yinbo Zhu <yinbo.zhu@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: mscc: refactor mscc_miim
Horatiu Vultur [Sun, 9 Jun 2019 13:27:29 +0000 (15:27 +0200)]
net: mscc: refactor mscc_miim

Because all MSCC SoC use the same MDIO bus, put the implementation in
one common file(mscc_miim) and make all the other MSCC network drivers to
use these functions.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agotest: dm: add MDIO test
Alex Marginean [Mon, 3 Jun 2019 16:12:28 +0000 (19:12 +0300)]
test: dm: add MDIO test

A very simple test for DM_MDIO, mimicks a register write/read through the
sandbox bus to a dummy PHY.

Signed-off-by: Alex Marginean <alexm.osslist@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: introduce MDIO DM class for MDIO devices
Alex Marginean [Mon, 3 Jun 2019 16:10:30 +0000 (19:10 +0300)]
net: introduce MDIO DM class for MDIO devices

Adds UCLASS_MDIO DM class supporting MDIO buses that are probed as
stand-alone devices.  Useful in particular for systems that support
DM_ETH and have a stand-alone MDIO hardware block shared by multiple
Ethernet interfaces.

Signed-off-by: Alex Marginean <alexm.osslist@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: mscc: serval: Remove delay when serdes is configured
Horatiu Vultur [Thu, 23 May 2019 19:45:33 +0000 (21:45 +0200)]
net: mscc: serval: Remove delay when serdes is configured

When serdes configuration was written in hardware there was a delay
of 100ms to be sure that configuration was written. But the delay is not
needed because already the function serdes_write it is checking that the
operation finished.

Therefore remove the mdelay. This improves the speed of configuring the
network driver.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: phy: ti: Fix clock output DT property
Trent Piepho [Fri, 10 May 2019 17:49:08 +0000 (17:49 +0000)]
net: phy: ti: Fix clock output DT property

The code block reading the DT property for the clock output control was
before the phy's DT node pointer was set, so it could never work.  Move
it after the node pointer is set.

Also store the unsigned 32-bit property into an unsigned value, not a
signed value, as the former will cause a problem if value overflows.
For instance, if one were to add 0xffffffff as a code to mean the clock
output should be turned off.

Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Janine Hagemann <j.hagemann@phytec.de>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: phy: ti: Use default values for tx/rx delay and fifo size
Trent Piepho [Thu, 9 May 2019 19:41:51 +0000 (19:41 +0000)]
net: phy: ti: Use default values for tx/rx delay and fifo size

When not using DM_ETH, these PHY settings are programmed with default
values hardcoded into the driver.  When using DM_ETH, they should come
from the device tree.  However, if the device tree does not have the
properties, the driver will silent use -1.  Which is entirely out of
range, programs nonsense into the PHY's registers, and does not work.

Change this to use the same defaults as non-DM_ETH if the device tree is
lacking the properties.

As an alternative, the kernel driver for the phy will display an error
message and fail if the device tree is lacking.

Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Janine Hagemann <j.hagemann@phytec.de>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agocmd: mii: Add the standard 1000BASE-T registers
Trent Piepho [Thu, 9 May 2019 19:23:47 +0000 (19:23 +0000)]
cmd: mii: Add the standard 1000BASE-T registers

These are standard across gigabit phys.  These mostly extend the
auto-negotiation information with gigabit fields.

Signed-off-by: Trent Piepho <tpiepho@impinj.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agocmd: mii: Refactor some of the MII reg dump code
Trent Piepho [Thu, 9 May 2019 19:23:39 +0000 (19:23 +0000)]
cmd: mii: Refactor some of the MII reg dump code

Share the code that prints out a register field with the function that
prints out the "special" fields.

There were two arrays the register dump list, one with reg number and
name, another with a pointer to the field table and the table size.
These two arrays had have each entry match what register is referred to.
Combine them into just one table.  Now they can't not match and there is
just one table.

Add some missing consts to pointers to string literals.

The dump code was ignoring the regno field in the description table and
assuming register 0 was at index 0, etc.  Have it use the field.

Change reg > max+1 into reg >= max, which doesn't fail if max+1 could
overflow, besides just making more sense.

Signed-off-by: Trent Piepho <tpiepho@impinj.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agoMerge tag 'mmc-2019-7-15' of https://gitlab.denx.de/u-boot/custodians/u-boot-mmc
Tom Rini [Mon, 15 Jul 2019 13:42:41 +0000 (09:42 -0400)]
Merge tag 'mmc-2019-7-15' of https://gitlab.denx.de/u-boot/custodians/u-boot-mmc

- mmc spi driver model support
- drop mmc_spi command
- enhanced Strobe mmc HS400 support
- minor mmc bug/fixes and optimization
- omap hsmmc and mvbeu update
- sdhci card detect support

4 years agosun8i: h3: Add support for the Beelink-x2 STB
Marcus Cooper [Sun, 2 Jun 2019 06:38:40 +0000 (08:38 +0200)]
sun8i: h3: Add support for the Beelink-x2 STB

The Beelink X2 is an STB based on the Allwinner H3 SoC with a uSD slot,
2 USB ports( 1 * USB-2 Host, 1 USB OTG), a 10/100M ethernet port using the
SoC's integrated PHY, Wifi via an sdio wifi chip, HDMI, an IR receiver, a
dual colour LED and an optical S/PDIF connector.

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

Signed-off-by: Marcus Cooper <codekipper@gmail.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agosunxi: move CONFIG_SPL_TEXT_BASE from *_defconfig to Kconfig
Andre Przywara [Mon, 27 May 2019 00:45:11 +0000 (01:45 +0100)]
sunxi: move CONFIG_SPL_TEXT_BASE from *_defconfig to Kconfig

The choice of the SPL_TEXT_BASE is not really a decision that should be
specified by each board's defconfig, as this setting is actually
dictated by the SoC's memory map and the BootROM behaviour.

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

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agommc: fsl_esdhc_imx: enlarge mmc timeout
Peng Fan [Wed, 10 Jul 2019 09:35:30 +0000 (09:35 +0000)]
mmc: fsl_esdhc_imx: enlarge mmc timeout

Flash system partition with fastboot will earse the partition firstly
The 600ms timeout will fail on some SD Card. Enlarge it to 5s to make
it works for most of sdcard

Cc: guoyin.chen <guoyin.chen@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agommc: fsl_esdhc_imx: add i.MX8QM compatible
Peng Fan [Wed, 10 Jul 2019 09:35:28 +0000 (09:35 +0000)]
mmc: fsl_esdhc_imx: add i.MX8QM compatible

Add i.MX8QM compatible and soc data, the soc data is following Linux
i.MX SDHC driver.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agommc: fsl_esdhc_imx: add HS400 Enhanced strobe support
Peng Fan [Wed, 10 Jul 2019 09:35:26 +0000 (09:35 +0000)]
mmc: fsl_esdhc_imx: add HS400 Enhanced strobe support

Implement set_enhanced_strobe hook for fsl_esdhc_imx,
,in esdhc_set_timing and esdhc_change_pinstate, also handle HS400_ES.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agommc: fsl_esdhc_imx: use mmc_of_parse to set host_caps
Peng Fan [Wed, 10 Jul 2019 09:35:24 +0000 (09:35 +0000)]
mmc: fsl_esdhc_imx: use mmc_of_parse to set host_caps

Use mmc_of_parse to set host_caps.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agommc: Parse no-1-8-v DT property
Peng Fan [Wed, 10 Jul 2019 09:35:20 +0000 (09:35 +0000)]
mmc: Parse no-1-8-v DT property

Parse no-1-8-v DT

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
4 years agommc: Parse HS400 Enhanced strobe DT properties
Peng Fan [Wed, 10 Jul 2019 09:35:18 +0000 (09:35 +0000)]
mmc: Parse HS400 Enhanced strobe DT properties

Add HS400 Enhanced strobe properties parsing support to mmc_of_parse().

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
4 years agommc: support hs400 enhanced strobe mode
Peng Fan [Wed, 10 Jul 2019 06:43:07 +0000 (14:43 +0800)]
mmc: support hs400 enhanced strobe mode

eMMC 5.1+ supports HS400 Enhances Strobe mode without the need for
tuning procedure.
The flow is as following:
 - set HS_TIMIMG (Highspeed)
 - Host change freq to <= 52Mhz
 - set the bus width to Enhanced strobe and DDR8Bit(CMD6),
   EXT_CSD[183] = 0x86 instead of 0x80
 - set HS_TIMING to 0x3 (HS400)
 - Host change freq to <= 200Mhz
 - Host select HS400 enhanced strobe complete

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agommc: fsl_esdhc_imx: fix config check issue when building in SPL
Ye Li [Thu, 11 Jul 2019 03:29:02 +0000 (03:29 +0000)]
mmc: fsl_esdhc_imx: fix config check issue when building in SPL

Should use CONFIG_IS_ENABLED not IS_ENABLED for clock and regulator drivers,
CONFIG_IS_ENABLED will check the CONFIG_SPL_CLK and CONFIG_SPL_DM_REGULATOR
when building SPL.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agocmd: Remove mmc_spi command
Anup Patel [Mon, 8 Jul 2019 04:10:55 +0000 (04:10 +0000)]
cmd: Remove mmc_spi command

The mmc_spi command was added to manually setup MMC over SPI bus
using command. This was required by the legacy non-DM MMC_SPI driver.

With DM based MMC_SPI driver in-place, we can now use all general
storge commands and mmc command for MMC over SPI bus hence we remove
the mmc_spi command all it's references.

Suggested-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agommc: mmc_spi: Re-write driver using DM framework
Bhargav Shah [Mon, 8 Jul 2019 04:10:48 +0000 (04:10 +0000)]
mmc: mmc_spi: Re-write driver using DM framework

This patch rewrites MMC SPI driver using U-Boot DM
framework and get it's working on SiFive Unleashed
board.

Signed-off-by: Bhargav Shah <bhargavshah1988@gmail.com>
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
4 years agommc: skip select_mode_and_width for MMC SPI host
Anup Patel [Mon, 8 Jul 2019 04:10:43 +0000 (04:10 +0000)]
mmc: skip select_mode_and_width for MMC SPI host

The MMC mode and width are fixed for MMC SPI host hence we skip
sd_select_mode_and_width() and mmc_select_mode_and_width() for
MMC SPI host.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
4 years agommc: retry a few times if a partition switch failed
Jean-Jacques Hiblot [Tue, 2 Jul 2019 08:53:58 +0000 (10:53 +0200)]
mmc: retry a few times if a partition switch failed

This operation may fail. Retry it a few times before giving up and report
a failure.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
4 years agommc: do not change mode when accessing a boot partition
Jean-Jacques Hiblot [Tue, 2 Jul 2019 08:53:57 +0000 (10:53 +0200)]
mmc: do not change mode when accessing a boot partition

Accessing the boot partition had been error prone with HS200 and HS400 and
was disabled. The driver first switched to a lesser mode and then switched
the partition access. It was mostly due to a bad handling of the switch and
has been fixed, so let's remove this 'feature'

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
4 years agommc: During a switch, poll on dat0 if available and check the final status
Jean-Jacques Hiblot [Tue, 2 Jul 2019 08:53:56 +0000 (10:53 +0200)]
mmc: During a switch, poll on dat0 if available and check the final status

The switch operation can sometimes make the bus unreliable, in that case
the send_status parameter should be false to indicate not to poll using
CMD13. If polling on dat0 is possible, we should use it to detect the end
of the operation.
At the end of the operation it is safe to use CMD13 to get the status of
the card. It is important to do so because the operation may have failed.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
4 years agommc: When switching partition, use the timeout specified in the ext_csd
Jean-Jacques Hiblot [Tue, 2 Jul 2019 08:53:55 +0000 (10:53 +0200)]
mmc: When switching partition, use the timeout specified in the ext_csd

The e-MMC spec allows the e-MMC to specify a timeout for the partition
switch command. It can take up to 2550 ms. There is no lower limit to this
value in the spec, but do as the the linux driver does and force it to be
at least 300ms.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
4 years agommc: use the generic timeout for cmd6 (SWITCH) provided in the ext_csd
Jean-Jacques Hiblot [Tue, 2 Jul 2019 08:53:54 +0000 (10:53 +0200)]
mmc: use the generic timeout for cmd6 (SWITCH) provided in the ext_csd

Starting with rev 4.5, the eMMC can define a generic timeout for the
SWITCH command.

Following Linux Kernel code, the timeout also changed from 1000 -> 500

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
4 years agommc: if possible, poll the busy state using DAT0
Jean-Jacques Hiblot [Tue, 2 Jul 2019 08:53:53 +0000 (10:53 +0200)]
mmc: if possible, poll the busy state using DAT0

Using the DAT0 line as a rdy/busy line is an alternative to reading the
status register of the card. It especially useful in situation where the
bus is not in a good shape, like when modes are switched.
This is also how the linux driver behaves.

Note of warning: As per the specification, while polling on DAT0 the CLK
must not turned off: "[...] Without a clock edge the Device (unless
previously disconnected by a deselect command (CMD7)) will force the DAT0
line down, forever. [...]"

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
4 years agommc: add mmc_poll_for_busy() and change the purpose of mmc_send_status()
Jean-Jacques Hiblot [Tue, 2 Jul 2019 08:53:52 +0000 (10:53 +0200)]
mmc: add mmc_poll_for_busy() and change the purpose of mmc_send_status()

mmc_send_status() is currently used to poll the card until it is ready, not
actually returning the status of the card.
Make it return the status and add another function to poll the card.

Also remove the 'extern' declaration in the mmc-private.h header to comply
with the coding standard.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
4 years agommc: omap_hsmmc: provide wait_dat0 even if UHS modes are not supported
Jean-Jacques Hiblot [Tue, 2 Jul 2019 08:53:51 +0000 (10:53 +0200)]
mmc: omap_hsmmc: provide wait_dat0 even if UHS modes are not supported

This function can also be used for eMMC devices.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
4 years agoRevert "mmc: Add a new callback function to perform the 74 clocks cycle sequence"
Jean-Jacques Hiblot [Tue, 2 Jul 2019 08:53:50 +0000 (10:53 +0200)]
Revert "mmc: Add a new callback function to perform the 74 clocks cycle sequence"

This reverts commit 318a7a576bc49aa8b4207e694d3fbd48c663d6ac.

The last and only user of this callback had been the omap_hsmmc driver.
It is not used anymore. Removing the callback.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
4 years agommc: omap_hsmmc: don't fill the send_init_stream callback
Jean-Jacques Hiblot [Tue, 2 Jul 2019 08:53:49 +0000 (10:53 +0200)]
mmc: omap_hsmmc: don't fill the send_init_stream callback

This is not required. The MMC core sends CMD0 right after the
initialization and it serves the same purpose.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
4 years agommc: omap_hsmmc: reset FSM for DAT and CMD lines if needed before a new command
Jean-Jacques Hiblot [Tue, 2 Jul 2019 08:53:48 +0000 (10:53 +0200)]
mmc: omap_hsmmc: reset FSM for DAT and CMD lines if needed before a new command

It sometimes happen that the PSTATE register does not indicate that the
bus is ready when it really is. This usually happens after a mode switch.
In that case it makes sense to reset the FSM handling the CMD and DATA

Also reset the FSMs if the STATE register cannot be cleared. This also
sometimes happens after a mode switch.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
4 years agommc: rpmb: fix response type of CMD25
Akio Hirayama [Fri, 28 Jun 2019 12:16:25 +0000 (21:16 +0900)]
mmc: rpmb: fix response type of CMD25

The response type of CMD25 is R1 instead of R1b.

Signed-off-by: Akio Hirayama <hirayama.akio@socionext.com>
[masahiro: add log ]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agommc: sdhci: Implement SDHCI card detect
T Karthik Reddy [Tue, 25 Jun 2019 11:39:04 +0000 (13:39 +0200)]
mmc: sdhci: Implement SDHCI card detect

Card detect function implemented for SDHCI framework.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agommc: sdhci: Read cd-gpio from devicetree
T Karthik Reddy [Tue, 25 Jun 2019 11:39:03 +0000 (13:39 +0200)]
mmc: sdhci: Read cd-gpio from devicetree

This patch reads cd-gpio property from devicetree

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
4 years agommc: Read sd card detect properties from DT
T Karthik Reddy [Tue, 25 Jun 2019 11:39:02 +0000 (13:39 +0200)]
mmc: Read sd card detect properties from DT

This patch reads card detect properties from device tree &
added mmc capability macros in mmc.h.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>