u-boot.git
7 years agoMA-10337-3 Add ATX support for i.MX6UL and i.MX7D
ji.luo [Wed, 6 Sep 2017 10:53:56 +0000 (18:53 +0800)]
MA-10337-3 Add ATX support for i.MX6UL and i.MX7D

Change-Id: Id2518949d6379a901f6db2044d9d2a59e119d6c4
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMA-10338-4 Correct 'fastboot getvar current-slot' command
ji.luo [Tue, 12 Sep 2017 08:06:49 +0000 (16:06 +0800)]
MA-10338-4 Correct 'fastboot getvar current-slot' command

Remove the underscore prefix of current slot.

Change-Id: I07a0513dfcfbf395087d57e3680c8d662ec827aa
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMA-10338-3 Refine misc local variables in get_single_var()
ji.luo [Thu, 14 Sep 2017 02:32:59 +0000 (10:32 +0800)]
MA-10338-3 Refine misc local variables in get_single_var()

Change-Id: I0b57cae7a172d906bf7d43f19e938a72c74b3b16
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMA-10337-2 Integrate ATX code into u-boot and fix build error
ji.luo [Sat, 2 Sep 2017 09:05:22 +0000 (17:05 +0800)]
MA-10337-2 Integrate ATX code into u-boot and fix build error

Change-Id: I6ab29f86df748d173954400d534f1fb3c990f5b9
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMA-10338-2 Add support for some fastboot getvar command
ji.luo [Tue, 12 Sep 2017 08:56:22 +0000 (16:56 +0800)]
MA-10338-2 Add support for some fastboot getvar command

Add support for fastboot getvar command:
fastboot getvar erase-block-size
fastboot getvar logical-block-size

Change-Id: Id1410d46307e67342e5489a26a96725e1d6a259e
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMA-10338-1 Correct 'fastboot getvar partition-type' command
ji.luo [Tue, 12 Sep 2017 07:34:59 +0000 (15:34 +0800)]
MA-10338-1 Correct 'fastboot getvar partition-type' command

Correct some partition file system type from 'emmc' to 'raw'.

Change-Id: If417ab9f14abfe27b4d5da5f7354922a80c4df18
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMA-10337-1 Support ATX in u-boot
ji.luo [Sat, 2 Sep 2017 09:55:12 +0000 (17:55 +0800)]
MA-10337-1 Support ATX in u-boot

This patch did:
1.Hard code the permanent attribute into u-boot.
2.Store first 112 bits of sha256(permanent attribute) hash into fuse.
(CONFIG_AVB_FUSE was removed because it's an irreversible operation)
3.Implement platform-specific operations defined in avb_atx_ops.h.

Change-Id: I65de9860e7c5ca1f7ebfbd87300faee0ccacaac3
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMA-9478-3 [iot] Enable Trusty for pico-imx6ul
Haoran.Wang [Tue, 29 Aug 2017 08:53:29 +0000 (16:53 +0800)]
MA-9478-3 [iot] Enable Trusty for pico-imx6ul

Duplicate defconfig for pico-imx6ul
by picosom-imx6ul-trusty_defconfig.

Change-Id: I559124e8e94eb40f943e0c4d68b9a6da821c6f41
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
(cherry picked from commit f019c752e4ac1ab210b9a09a00d48a6eaf3fefb3)

7 years agoMA-10336-2 Add new avb method support for i.MX6UL and i.MX7D
ji.luo [Wed, 23 Aug 2017 07:53:08 +0000 (15:53 +0800)]
MA-10336-2 Add new avb method support for i.MX6UL and i.MX7D

Change-Id: I8f5b69043a63034ab53d5926de0469a29132659f
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMA-10336-1 Take new AVB method
ji.luo [Tue, 22 Aug 2017 12:09:46 +0000 (20:09 +0800)]
MA-10336-1 Take new AVB method

Use hard code public key instead of reading it from RPMB.
Read RPMB key from last block of BOOT1 instead of fuse.

Change-Id: Icddd0bc45af8f9a9b222d54e16a7dfc6efa6c8b2
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMA-10335 Fix problems in read_keyslot_package()
ji.luo [Tue, 22 Aug 2017 08:14:51 +0000 (16:14 +0800)]
MA-10335 Fix problems in read_keyslot_package()

Change-Id: I052314f2304a93a79fa912125c555cae173d8749
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMA-10334 Rename Aquila board name to spriot board name
ji.luo [Wed, 2 Aug 2017 05:05:11 +0000 (13:05 +0800)]
MA-10334 Rename Aquila board name to spriot board name

Change-Id: Iee122d36d83bc6e1ae007fb2f2053c6e9e7fc2a2
Signed-off-by: ji.luo <ji.luo@nxp.com>
7 years agoMA-9478-2 [iot] Support keyslot package function
Haoran.Wang [Wed, 19 Jul 2017 10:36:51 +0000 (18:36 +0800)]
MA-9478-2 [iot] Support keyslot package function

RPMB keyblob stored in the last block of boot1
partition of MMC1. It will be load into
CAAM SEC_RAM and format into "keyslot" package.

This is enabled on pico7d and iopb6ul.

Change-Id: I5d9ab12e7d14945ebd8f926e20bed19b02e65009
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
7 years agoMA-9478-1 [iot] Enable Trusty for iopb6ul and pico7d
Haoran.Wang [Wed, 12 Jul 2017 12:01:15 +0000 (20:01 +0800)]
MA-9478-1 [iot] Enable Trusty for iopb6ul and pico7d

Change-Id: I0aa12c5092953804e724c0534f2e81abd9ee47d5
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
7 years agoMA-9478 [iot] Add boot Trusty OS codes for imx6 and imx7
Haoran.Wang [Thu, 29 Jun 2017 08:05:51 +0000 (16:05 +0800)]
MA-9478 [iot] Add boot Trusty OS codes for imx6 and imx7

Use trusty_os_init to load Trusty OS from CONFIG_TRUSTY_OS_ENTRY
before u-boot ready.

Add "tos" partition following the Android bootloader requirement.

Change-Id: I294df0ea1b44ffd12135a8325a73d1ac9399b5f5
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
7 years agoMLK-16587-2 imx8qm/qxp: Change to use SCFW API to get boot device
Ye Li [Fri, 13 Oct 2017 09:23:20 +0000 (04:23 -0500)]
MLK-16587-2 imx8qm/qxp: Change to use SCFW API to get boot device

Since SCFW has implemented a new API sc_misc_get_boot_dev to get boot device,
change u-boot to use this API for QM/QXP, not use ROM INFO.

Signed-off-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16587-1 imx8qm/qxp: Sync SCFW API to latest
Ye Li [Fri, 13 Oct 2017 08:34:25 +0000 (03:34 -0500)]
MLK-16587-1 imx8qm/qxp: Sync SCFW API to latest

Sync SCFW API to commit a6fd9a48626ef8c93a798c5fb984898b2017bf16.
It adds a API to get boot device.

Signed-off-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16562 imx8qxp: Fix MAC fuse address for QXP
Ye Li [Tue, 10 Oct 2017 08:42:34 +0000 (03:42 -0500)]
MLK-16562 imx8qxp: Fix MAC fuse address for QXP

Since i.MX8QXP only use one 16K fuse array, it has different fuse address for
2nd half 256 fuse words with QM. According to its fuse map, the fuse addresses
for MAC1 and MAC2 are 708-711.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16560-4: imx8: Remove hardcoded sids for sdhc/fec
Leonard Crestez [Wed, 4 Oct 2017 13:15:04 +0000 (16:15 +0300)]
MLK-16560-4: imx8: Remove hardcoded sids for sdhc/fec

This is better done through dts.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16560-3: imx8: config_smmu_fdt: Support mmu-masters binding
Leonard Crestez [Wed, 27 Sep 2017 16:28:05 +0000 (19:28 +0300)]
MLK-16560-3: imx8: config_smmu_fdt: Support mmu-masters binding

This is deprecated in favor of the generic iommus binding but xen only
supports this older version.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16560-2: imx8: Use fsl,sc_rsrc_id binding to map device to rsrc
Leonard Crestez [Wed, 27 Sep 2017 16:55:56 +0000 (19:55 +0300)]
MLK-16560-2: imx8: Use fsl,sc_rsrc_id binding to map device to rsrc

Using the SMMU for some devices (like dpu) requires a streamid to be
assigned to multiple resources.

Determining the resource ids for a device is a problem that occurs in
multiple contexts. So far uboot deals with this by parsing the
power-domain node which is insufficient here.

Add a new devicetree property called fsl,sc_rsrc_id which lists the
resource ids associated by a certain device.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16560-1: imx8: Configure sids based on iommu properties in dtb
Leonard Crestez [Wed, 27 Sep 2017 16:27:05 +0000 (19:27 +0300)]
MLK-16560-1: imx8: Configure sids based on iommu properties in dtb

Use streamids specified in dtb because they need to match anyway. This
removes the need to rebuild uboot for stream id assignments.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16535 net: fec: Fix issue in DM probe function
Ye Li [Tue, 26 Sep 2017 05:44:47 +0000 (00:44 -0500)]
MLK-16535 net: fec: Fix issue in DM probe function

Met a problem that mii command fails to work after u-boot booting up.
The root cause is the fec_probe function initializes ethernet PHY first,
then reset the FEC controller. This causes the mii_speed register reset
to 0 and lead mdio can't work.
Change the flow to reset FEC controller prior than setup PHY.

Signed-off-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16503 imx8qm_mek: Add support for QM MEK board
Ye Li [Wed, 20 Sep 2017 05:58:49 +0000 (00:58 -0500)]
MLK-16503 imx8qm_mek: Add support for QM MEK board

Add build config, dts and board codes for i.MX8QM MEK board. Supported
peripherals: UART, eMMC/SD, ENET, I2C, USB TYPEC DFP mode, flexspi.

DTS is ported from kernel commit a4fff857ea5f0a6513b943e0b0b842d5008785f1,
and enable more peripherals.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16499-2 mmc: fsl_esdhc: Remove duplicated clock settings
Ye Li [Wed, 20 Sep 2017 09:27:09 +0000 (04:27 -0500)]
MLK-16499-2 mmc: fsl_esdhc: Remove duplicated clock settings

In esdhc_set_ios, the clock has been setup before calling esdhc_set_timing.
So no need to call set_sysctl more.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16499-1 mmc: Add support for HS400
Ye Li [Wed, 20 Sep 2017 09:22:40 +0000 (04:22 -0500)]
MLK-16499-1 mmc: Add support for HS400

The HS400 ES (Enhanced Strobe) has been added. This patch addes support
for HS400 for eMMC 5.0 devices. It needs tuning at HS200 to synchronize
command response.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16496-2 mmc: fsl_esdhc: add hs400 es mode support
Peng Fan [Wed, 20 Sep 2017 07:05:47 +0000 (15:05 +0800)]
MLK-16496-2 mmc: fsl_esdhc: add hs400 es mode support

Add HS400 ES mode support.

The flow is same as mmc_select_hs400es in kernel drivers/mmc/core/mmc.c.
With HS400 ES, there is no tuning needed.

With Toshiba 32GB Automotive eMMC5.1 on 8QXP ARM2 board, speed test:
'time mmc read 0x90000000 0 0x200000' shows that speed is 282MB/s.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16496-1 imx8qm/qxp: set usdhc clock to 400M
Peng Fan [Wed, 20 Sep 2017 07:07:53 +0000 (15:07 +0800)]
MLK-16496-1 imx8qm/qxp: set usdhc clock to 400M

Set usdhc clock to 400M. When enabling HS400 ES, DDR EN is enabled,
if we still have input clock as 200M, the real output clock will be 100M.

So set clock to 400M to get real 200M output when enabling HS400/ES.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16431-3 imx8qxp_mek: Enable the USB3.0 XHCI driver
Ye Li [Tue, 12 Sep 2017 09:41:45 +0000 (04:41 -0500)]
MLK-16431-3 imx8qxp_mek: Enable the USB3.0 XHCI driver

Enable the USB3.0 XHCI driver to support host mode on MEK board.
The USB3.0 typec on MEK board uses PTN5110 TCPC as cc logic and power control. Different like
the device on ARM2 board, this IC needs driver to control and get status through I2C bus.

In this patch, we simply call the TCPC API to set to DFP mode, check the CC status for SS MUX select
and enable source VBUS power. When the USB host is shutdown, disable the VBUS power.

Signed-off-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16431-2 imx8qxp_mek: Add driver for USB typec port controller (TCPC)
Ye Li [Tue, 12 Sep 2017 09:38:00 +0000 (04:38 -0500)]
MLK-16431-2 imx8qxp_mek: Add driver for USB typec port controller (TCPC)

Add an simple driver for USB typec port controller in freescale common codes.
The functions in this driver help to initialize the TCPC, set and work with
fixed DFP role.

Will improve it later to support UFP and move to driver directory.

Signed-off-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16431-1 xhci-imx8: call board_usb_cleanup when xhci stop
Ye Li [Mon, 11 Sep 2017 03:31:03 +0000 (22:31 -0500)]
MLK-16431-1 xhci-imx8: call board_usb_cleanup when xhci stop

Call the board_usb_cleanup in xhci_imx8_remove (DM) and xhci_hcd_stop (non-DM) to
execute some board level usb stop in cc logic and ss mux.

Signed-off-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16465: fine tune build info to find it easily.
Frank Li [Wed, 13 Sep 2017 16:06:47 +0000 (11:06 -0500)]
MLK-16465: fine tune build info to find it easily.

Find buildinfo easily and copy everything just one click

U-Boot 2017.03-00031-g0596078-dirty (Sep 13 2017 - 10:59:41 -0500)

CPU:   Freescale i.MX8QXP revA A35 at 1200 MHz at 6C
Model: Freescale i.MX8QXP LPDDR4 ARM2
Board: iMX8QXP LPDDR4 ARM2
Boot:  SD1
DRAM:  3 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
[pcie_ctrlb_sata_phy_init_rc] LNK DOWN 8600000
In:    serial
Out:   serial
Err:   serial

 BuildInfo:
  - SCFW f0cb8b8e, IMX-MKIMAGE cc994971, ATF 0
  - U-Boot 2017.03-00031-g0596078-dirty

switch to partitions

Signed-off-by: Frank Li <Frank.Li@nxp.com>
7 years agoMLK-16467 serial_lpuart: Fix FIFO_RXFE definition in LPUART driver
Ye Li [Thu, 14 Sep 2017 02:48:28 +0000 (21:48 -0500)]
MLK-16467 serial_lpuart: Fix FIFO_RXFE definition in LPUART driver

Accroding to RM, the Receive FIFO Enable (RXFE) field in LPUART FIFO register
is bit 3, so the definition should change to 0x08 not 0x40.
Otherwise the Receive FIFO is not disabled.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoimx8: add board_name and board_rev
Adrian Negreanu [Mon, 11 Sep 2017 13:51:41 +0000 (16:51 +0300)]
imx8: add board_name and board_rev

Export the board_name and board_rev for these boards:
- 8MQ EVK
- 8QM ARM2
- 8QXP ARM2
- 8QXP MEK

These two variables are used by an autotest u-boot script,
to request the needed BSP files.

Signed-off-by: Adrian Negreanu <adrian.negreanu@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
7 years agoMLK-16451 imx8qm/qxp: Enable PSCI reset
Ye Li [Wed, 13 Sep 2017 09:06:08 +0000 (04:06 -0500)]
MLK-16451 imx8qm/qxp: Enable PSCI reset

Since the arm trusted firmware has implemented the system reset in PSCI.
We can enable the CONFIG_PSCI_RESET to call PSCI API to reset the u-boot.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16443 imx8qm/qxp: Fix UART pad setting
Ye Li [Wed, 13 Sep 2017 06:25:15 +0000 (01:25 -0500)]
MLK-16443 imx8qm/qxp: Fix UART pad setting

Found kernel won't be loaded when UART does not connect to the board. This is
because UART received one data with frame error in this case, and stop in
u-boot console.
The root cause is we set wrong pad setting for UART. The pad should be set
to pull up not pull down. The pull down will cause problem to UART START bit.

This patch fix the UART pad to 0x600020 (input and output, high drive strength,
and pull up).

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16441-2 imx8qm/qxp: print commit hash for SCFW, IMX-MKIMAGE and ATF
Ye Li [Mon, 11 Sep 2017 09:27:13 +0000 (04:27 -0500)]
MLK-16441-2 imx8qm/qxp: print commit hash for SCFW, IMX-MKIMAGE and ATF

Since we have many software running on QM/QXP, it is better to print their
commit ids in u-boot to know their versions.

This patch enables the CONFIG_ARCH_MISC_INIT. In arch_misc_init to gets the
commit ids for SCFW and ATF via their APIs and get the commit for imx-mkimage
at the end of u-boot.bin loading address.

Once the commit ids are acquired, show them in console like:
    BuildInfo: SCFW 45c567e8, IMX-MKIMAGE cc994971, ATF 0a9efa7

and set them to environment variables like:
    commit_atf=0a9efa7
    commit_mkimage=cc994971
    commit_scfw=45c567e8

If old software are running which does not support provide commit it, the patch
use 0 instead.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16441-1 imx8qm/qxp: Update scfw api
Ye Li [Mon, 11 Sep 2017 10:59:01 +0000 (05:59 -0500)]
MLK-16441-1 imx8qm/qxp: Update scfw api

Update SCFW API to latest commit 45c567e830b2b915982ea5f2fcd60d235991a415
which contains new API to get build info for SCFW.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
7 years agoMA-10217 bootloader mode not function if there is a unknown cmd in misc
guoyin.chen [Tue, 12 Sep 2017 11:22:59 +0000 (19:22 +0800)]
MA-10217 bootloader mode not function if there is a unknown cmd in misc

System cannot run into bootloader/recovery mode once there is unknown cmd
in misc partition as:
1. uboot will never clean the unknown cmd.
2. init will never overwrite the unknown cmd.

arm2_8q:/ # reboot bootloader
init: [libfs_mgr]fs_mgr_read_fstab_dt(): failed to read fstab from dt
init: reboot-bootloader: Error writing bootloader_message: Bootloader command pending.
init: Reboot start, reason: reboot,bootloader, rebootTarget: bootloader

Change-Id: I51043e7cbde3f3e508c5fe99e9dba27e5f99f443
Signed-off-by: guoyin.chen <guoyin.chen@nxp.com>
7 years agoMA-9554[Android_6DL_SD]RTC: Sometimes the RTC reset to the initial time 1970 after...
Zhang Bo [Thu, 7 Sep 2017 10:57:57 +0000 (18:57 +0800)]
MA-9554[Android_6DL_SD]RTC: Sometimes the RTC reset to the initial time 1970 after softare reboot the first time. 40%

RTC timer is default disabled after power off and bootup again. it will be
enabled in kernel rtc driver init. But rtc time is shorter than system clock,
so rtc time cannot update to system clock in rtc_hctosys(), and the sysfs
file /sys/class/rtc/rtc0/hctosys cat result is 0. Android AlarmManagerService
cannot work normally when hctosys is 0.
Enable RTC in u-boot so the time in RTC timer is longer than system clock.

Change-Id: Ie8b1c1b36e5ab48031efe44dd06468ac35ca3d3b
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
7 years agoMA-10167 Add soc_type to be imx8mq to align the init.imx8mq.rc
guoyin.chen [Thu, 7 Sep 2017 13:32:35 +0000 (21:32 +0800)]
MA-10167 Add soc_type to be imx8mq to align the init.imx8mq.rc

It will be used by android init to load the init.imx8mq.rc

Change-Id: Id157cfe6952c9ccf4021d9098e25d9e9d545859f
Signed-off-by: guoyin.chen <guoyin.chen@nxp.com>
7 years agoMLK-16369 eth: fec: Fix DM driver issue in recv
Ye Li [Tue, 5 Sep 2017 06:45:21 +0000 (01:45 -0500)]
MLK-16369 eth: fec: Fix DM driver issue in recv

When using ethernet DM driver, the recv interface has a change with non-DM
interface, that driver needs to set the packet pointer and provide it to upper
layer to process.
In fec driver, the fecmxc_recv functions does not handle the packet pointer parameter.
This may cause crash in upper layer processing because the packet pointer is not set.

This patch allocates a buffer for the packet pointer and free it through free_pkt interface.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16365 mmc: add sd/mmc legacy capability
Peng Fan [Tue, 5 Sep 2017 03:16:06 +0000 (11:16 +0800)]
MLK-16365 mmc: add sd/mmc legacy capability

Add SD/MMC legacy capability. Otherwise the legacy cards supports will
be broken.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16361-2 imx8qm/qxp: Use sw_info for USB boot check
Ye Li [Mon, 4 Sep 2017 02:11:39 +0000 (21:11 -0500)]
MLK-16361-2 imx8qm/qxp: Use sw_info for USB boot check

The sw_info in handover structure has included the boot device info
provided by SC ROM. We can exploit this info, no need to check the
USB2 PHY PWD register.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16361-1 imx8qm/qxp: Send boot status to SCFW if booted by SC ROM
Ye Li [Fri, 1 Sep 2017 10:26:58 +0000 (05:26 -0500)]
MLK-16361-1 imx8qm/qxp: Send boot status to SCFW if booted by SC ROM

We met u-boot hang when booting from eMMC fastboot on QM/QXP boards.
The hang happens on u-boot accessing USB2 PHY for checking USB boot.
The root cause is when putting AP image (u-boot-atf.bin) in first container,
the USB2 PHY reset bit won’t be set in CONN SS by SCFW, because this SS has been
powered on by SC ROM.

In normal boot case, we won't meet such issue. Because we put u-boot-atf.bin in second
container and AP ROM will boot up for loading this binary. When AP ROM completes the
loading, it calls “misc_boot_status” API to power off the boot device and also power
off the CONN SS. Then when u-boot enables any the module in CONN, the CONN SS will power
on again by SCFW and set the USB2 PHY reset bit.

Since the clock settings are different in SC ROM and SCFW, so it is suggested to power off
CONN SS when booting is completed. In this patch, we check the g_ap_mu field in pass over
structure which is used to pass into from SC ROM to AP ROM. This field is set only when AP
image is included in the second container. If this field is not set, we suppose the booting
only uses SC ROM, then u-boot calls "misc_boot_status" at early stage to power off
boot device.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
7 years agoMA-10118-1[Android EVK-8MQ] realize the get_board_serial function which read unique...
Zhang Bo [Thu, 31 Aug 2017 10:36:20 +0000 (18:36 +0800)]
MA-10118-1[Android EVK-8MQ] realize the get_board_serial function which read unique id from ocopt

Correct fuse_bank0_regs structure to make bank register be match with fuse map.

Change-Id: I023c7d57b9fe1d57b0c2735f058714e9f25dca56
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
7 years agoMLK-16333 imx8qm/qxp: Change memory region 0x0-0x1c000000 to strongly order
Ye Li [Thu, 31 Aug 2017 02:58:03 +0000 (21:58 -0500)]
MLK-16333 imx8qm/qxp: Change memory region 0x0-0x1c000000 to strongly order

This memory region is for LSIO subsystem, including OCRAM, AP ROM,
flexspi0 mapped memory and flexspi1 buffer. If we set it to cachable,
the AHB read in flexspi driver will have coherence problem.

This patch set this memory region to strongly order to avoid any issue
in driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16326 imx8qxp_mek: Add LVDS0 display support for splash screen
Ye Li [Wed, 30 Aug 2017 10:18:37 +0000 (05:18 -0500)]
MLK-16326 imx8qxp_mek: Add LVDS0 display support for splash screen

The MEK board has two display ports, we enable the LVDS0 as default display. User
needs to connect miniSAS LVDS to HDMI card on the CPU board and set "panel" env variable
to "IT6263" to enable the display.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMA-10118[Android EVK-8MQ] realize the get_board_serial function which read unique...
Zhang Bo [Wed, 30 Aug 2017 09:51:36 +0000 (17:51 +0800)]
MA-10118[Android EVK-8MQ] realize the get_board_serial function which read unique id from ocopt

Read the unique id directly from the ocopt register.

Change-Id: I6cfb246153812709ea98edd5b9a85aff4714a329
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
7 years agoMLK-16288 fsl_esdhc: Workaround for eMMC HS200 and SD SDR104 switch fail issue
Ye Li [Tue, 29 Aug 2017 07:18:55 +0000 (02:18 -0500)]
MLK-16288 fsl_esdhc: Workaround for eMMC HS200 and SD SDR104 switch fail issue

Met randomly switch fail (60%) on 8QXP ARM2 A1 board, when entering eMMC HS200 or SD SDR104 mode.
The failure happens on the first command (CMD55 for SD,  CMD8 for eMMC) after the tuning process
is done.  The failure error is CTOE (command timeout).  Can't reproduce it on QXP MEK.

This patch addes a workaround to send CMD12 after tuning process is done.  This helps to stop any
transmission that device may involve during tuning. The stress test is passed on QXP ARM A1 with
this workaround added.

Also this patch fixes a issue for tuning parameter "tuning_start_tap".

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16292 DTS: imx8qm/qxp: Update usdhc pad settings to fix DSE issue
Ye Li [Tue, 29 Aug 2017 09:35:27 +0000 (04:35 -0500)]
MLK-16292 DTS: imx8qm/qxp: Update usdhc pad settings to fix DSE issue

Sychronize the usdhc pad settings from kernel DTS file to
fix DSE setting problem. For dual voltage pads, only bits[0]
is defined for DSE.
0: high drive strength
1: low drive strength

Kernel commit: 7084cf02e6cc2c9fb7f474f6cc1ba8f8d00793c7

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16247 imx8/imx8m: Rename env variable fdtaddr to fdt_addr
Ye Li [Tue, 29 Aug 2017 07:53:54 +0000 (02:53 -0500)]
MLK-16247 imx8/imx8m: Rename env variable fdtaddr to fdt_addr

i.MX6/7 uses fdt_addr while all i.MX8/8M uses fdtaddr, this causes
the env is inconsistent for the autotest u-boot scripts. So rename
the fdtaddr to fdt_addr.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16249 mx6dlsabresd: Fix the VDD ARM voltage for 396MHz CPU freq
Ye Li [Tue, 29 Aug 2017 07:36:52 +0000 (02:36 -0500)]
MLK-16249 mx6dlsabresd: Fix the VDD ARM voltage for 396MHz CPU freq

According to the MX6DL datasheet (IMX6SDLCEC Rev. 5, 06/2015)
"LDO Output Set Point (VDD_ARM_CAP) = 1.125 V minimum for operation
up to 396 MHz."

So change the VDD ARM to 1.15V (with 25mv margin).

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Robin Gong <yibin.gong@nxp.com>
7 years agoMLK-16289 pca953x_gpio: Fix build warning
Ye Li [Tue, 29 Aug 2017 07:26:12 +0000 (02:26 -0500)]
MLK-16289 pca953x_gpio: Fix build warning

Fix uild warning below introduced by
commit: cb20ff23c83b80b4115c8a44ea436cb6b40429f1

drivers/gpio/pca953x_gpio.c: In function ‘pca953x_probe’:
drivers/gpio/pca953x_gpio.c:325:48: warning: passing argument 3 of
‘pca953x_write_regs’ from incompatible pointer type [-Wincompatible-pointer-types]
  ret = pca953x_write_regs(dev, PCA953X_INVERT, &val);
                                                ^
drivers/gpio/pca953x_gpio.c:135:12: note: expected ‘u8 * {aka unsigned char *}’
but argument is of type ‘u8 (*)[5] {aka unsigned char (*)[5]}’
 static int pca953x_write_regs(struct udevice *dev, int reg, u8 *val)

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16287 imx8qxp_arm2: increase the off-on-delay for usdhc2 vmmc supply
Ye Li [Tue, 29 Aug 2017 07:00:31 +0000 (02:00 -0500)]
MLK-16287 imx8qxp_arm2: increase the off-on-delay for usdhc2 vmmc supply

Current value of "off-on-delay-us" is 3500us for usdhc2 vmmc regulator,
this is measured value but not have margin added. We found QXP ARM2
RevA1 board can't work with this value. So increase it to 5000us with
1500us margin added.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMA-10079 [Android] enable fastboot for imx8mq
zhang sanshan [Tue, 29 Aug 2017 02:23:51 +0000 (10:23 +0800)]
MA-10079 [Android] enable fastboot for imx8mq

enable CONFIG_CMD_FASTBOOT which support command:"fastboot 0"
enable CONFIG_FASTBOOT_FLASH wihch support commands:"fastboot flash XXX"

Change-Id: I514e2d5ea221a8551f4afa799fa5b48e4373fca4
Signed-off-by: zhang sanshan <sanshan.zhang@nxp.com>
7 years agoMLK-16273-3 imx8mq: evk: enable usb gadget drivers
Li Jun [Fri, 25 Aug 2017 18:13:05 +0000 (02:13 +0800)]
MLK-16273-3 imx8mq: evk: enable usb gadget drivers

Enable dwc3 controller driver and gadget mass storage drivers.

Acked-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
7 years agoMLK-16273-2 imx8mq: evk: add usb init for USB0 device mode
Li Jun [Fri, 25 Aug 2017 18:10:50 +0000 (02:10 +0800)]
MLK-16273-2 imx8mq: evk: add usb init for USB0 device mode

Add USB0(type-c) config and PHY init to enable device mode.

Acked-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
7 years agoMLK-16273-1 usb: dwc3: add suspend clock setting interface
Li Jun [Fri, 25 Aug 2017 17:49:51 +0000 (01:49 +0800)]
MLK-16273-1 usb: dwc3: add suspend clock setting interface

Some dwc3 based USB3 IP may have a wrong default suspend clk
setting, so add an interface to correct it by board setting.

Acked-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
7 years agousb: gadget: g_dnl: only set iSerialNumber if we have a serial#
Felipe Balbi [Wed, 22 Feb 2017 15:12:40 +0000 (17:12 +0200)]
usb: gadget: g_dnl: only set iSerialNumber if we have a serial#

We don't want to claim that we support a serial number string and
later return nothing. Because of that, if g_dnl_serial is an empty
string, let's skip setting iSerialNumber to a valid number.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
(cherry picked from commit 842778a091047b0c868efa12229633959f711152)

7 years agousb: gadget: g_dnl: don't set iProduct nor iSerialNumber
Felipe Balbi [Wed, 22 Feb 2017 15:12:41 +0000 (17:12 +0200)]
usb: gadget: g_dnl: don't set iProduct nor iSerialNumber

Both these numbers are calculated in runtime and dynamically assigned
to the device descriptor during bind().

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
(cherry picked from commit 207835b13feeae15db0555574d89352a4e5379a4)

7 years agousb: dwc3: gadget: make cache-maintenance on event buffers more robust
Philipp Tomsich [Thu, 6 Apr 2017 14:58:53 +0000 (16:58 +0200)]
usb: dwc3: gadget: make cache-maintenance on event buffers more robust

Merely using dma_alloc_coherent does not ensure that there is no stale
data left in the caches for the allocated DMA buffer (i.e. that the
affected cacheline may still be dirty).

The original code was doing the following (on AArch64, which
translates a 'flush' into a 'clean + invalidate'):
  # during initialisation:
      1. allocate buffers via memalign
        => buffers may still be modified (cached, dirty)
  # during interrupt processing
      2. clean + invalidate buffers
        => may commit stale data from a modified cacheline
      3. read from buffers

This could lead to garbage info being written to buffers before
reading them during even-processing.

To make the event processing more robust, we use the following sequence
for the cache-maintenance:
  # during initialisation:
      1. allocate buffers via memalign
      2. clean + invalidate buffers
        (we only need the 'invalidate' part, but dwc3_flush_cache()
  always performs a 'clean + invalidate')
  # during interrupt processing
      3. read the buffers
        (we know these lines are not cached, due to the previous
  invalidation and no other code touching them in-between)
      4. clean + invalidate buffers
        => writes back any modification we may have made during event
    processing and ensures that the lines are not in the cache
    the next time we enter interrupt processing

Note that with the original sequence, we observe reproducible
(depending on the cache state: i.e. running dhcp/usb start before will
upset caches to get us around this) issues in the event processing (a
fatal synchronous abort in dwc3_gadget_uboot_handle_interrupt on the
first time interrupt handling is invoked) when running USB mass
storage emulation on our RK3399-Q7 with data-caches on.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
(cherry picked from commit 889239d6b5c15c82d507498ded5e3b8fea2d44cf)

7 years agousb: dwc3: ensure consistent types for dwc3_flush_cache
Philipp Tomsich [Thu, 6 Apr 2017 14:58:52 +0000 (16:58 +0200)]
usb: dwc3: ensure consistent types for dwc3_flush_cache

The dwc3_flush_cache() call was declared and used inconsistently:
 * The declaration assumed 'int' for addresses (a potential issue
   when running in a LP64 memory model).
 * The invocation cast the address to 'long'.

This change ensures that both the declaration and usage of this
function consistently uses 'uintptr_t' for correct behaviour even
when the allocated buffers (to be flushed) reside outside of the
lower 32bits of memory.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
(cherry picked from commit b7bf4a95922c3e1a4974aa34ebb714ac2eb89937)

7 years agoMLK16263 - Update uboot to the latest SCFW API
Ranjani Vaidyanathan [Thu, 24 Aug 2017 22:40:45 +0000 (17:40 -0500)]
MLK16263 - Update uboot to the latest SCFW API

Update uboot to the latest SCFW based on commit:
"
commit 129c16e312334af7b07d71d6dccac1cda1808b93
Author: Ranjani Vaidyanathan <ranjani.vaidyanathan@nxp.com>
Date:   Thu Aug 24 16:50:59 2017 -0500

    Add support to change DRC clock rate.
"
Signed-off-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@nxp.com>
7 years agoMLK-16268 arm: dts: 8qxp: add delay-us for usdhc2
Peng Fan [Fri, 25 Aug 2017 06:35:39 +0000 (14:35 +0800)]
MLK-16268 arm: dts: 8qxp: add delay-us for usdhc2

Measured signal using oscilloscope.
Add startup delay and off-on-delay-us to make usdhc2 vmmc
supply work properly. Otherwise, the delay between power
off/on is short and power actully not off, then card report
S18A as 0 and could not switch voltage to 1.8V.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16246 imx8mq_evk: Update DTB to disable DCSS and HDMI for mfgtool
Ye Li [Wed, 23 Aug 2017 09:40:58 +0000 (04:40 -0500)]
MLK-16246 imx8mq_evk: Update DTB to disable DCSS and HDMI for mfgtool

When booting for mfgtool, we need to disable DCSS and HDMI since the HDMI
firmware won't be loaded by mfgtool. Add the detect in u-boot and update the
DTB.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16238-3 imx8m_evk: Update codes to enable TMU
Ye Li [Tue, 22 Aug 2017 02:03:35 +0000 (21:03 -0500)]
MLK-16238-3 imx8m_evk: Update codes to enable TMU

Update SoC codes, DTSi and defconfig to enable TMU for i.MX8M EVK board.
Also implement functions to get speed grade and market segment info from fuse.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16238-2 imx: Update CPU info print to support TMU
Ye Li [Tue, 22 Aug 2017 01:43:55 +0000 (20:43 -0500)]
MLK-16238-2 imx: Update CPU info print to support TMU

Current cpu info common function in imx-common only supports imx-thermal, update
the codes to also support TMU.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16238-1 thermal: Add TMU driver for i.MX8M
Ye Li [Mon, 21 Aug 2017 10:41:12 +0000 (05:41 -0500)]
MLK-16238-1 thermal: Add TMU driver for i.MX8M

Porting the TMU driver from kernel and supporting DM in the driver.
Users need to provide the TMU node and sensors nodes in DTB.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16219 pca953x_gpio: Clear the polarity invert register at init
Ye Li [Fri, 18 Aug 2017 06:57:43 +0000 (01:57 -0500)]
MLK-16219 pca953x_gpio: Clear the polarity invert register at init

The pca953x_gpio driver uses default value of polarity inversion register.
For some devices like PCA9557 and MAX7310, their polarity inversion register
default value is 0xf0. So for high 4 ports, when reading their values,
the values are inverted as the actual level.

This patch clears the polarity inversion register to 0 at init. So that the port read
and write values are aligned.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16208-3 imx8qm/qxp: Enable the CPU thermal sensor to get temperature
Ye Li [Wed, 16 Aug 2017 13:41:50 +0000 (08:41 -0500)]
MLK-16208-3 imx8qm/qxp: Enable the CPU thermal sensor to get temperature

Add "u-boot,dm-pre-reloc" to thermal node in QM and QXP DTSi files, and
enable the thermal driver in relevant build targets.

In SoC level, will get and print the CPU temperature at booting.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16208-2 imx8qm/qxp: add function to read ARM core part number
Ye Li [Thu, 17 Aug 2017 06:24:39 +0000 (01:24 -0500)]
MLK-16208-2 imx8qm/qxp: add function to read ARM core part number

Add a function to read the MIDR_EL1 register from ARM to get its
part number. This is used to distinguish the A53/A35/A72.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16208-1 thermal: Add driver to support i.MX8QM/QXP CPU thermal sensor
Ye Li [Wed, 16 Aug 2017 13:37:13 +0000 (08:37 -0500)]
MLK-16208-1 thermal: Add driver to support i.MX8QM/QXP CPU thermal sensor

Add the DM thermal driver for i.MX8QM and QXP. The driver depends on DTB thermal
sensor nodes. Will create device for each thermal in thermal-zones. User can
use the thermal name to get the device from UCLASS_THERMAL.

The driver flag is set to DM_FLAG_PRE_RELOC, to support run it at early stage,
need add "u-boot,dm-pre-reloc" property to the thermal node.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
7 years agommc: fsl_esdhc: fix build issue
Peng Fan [Fri, 18 Aug 2017 02:50:18 +0000 (10:50 +0800)]
mmc: fsl_esdhc: fix build issue

Fix the following build issue:
"
 In function ‘esdhc_set_ios’:
 warning: unused variable ‘ret’ [-Wunused-variable]
 int ret;
 ^~~
 At top level:
 warning: ‘usdhc_imx8qm_data’ defined but not used [-Wunused-variable]
 static struct esdhc_soc_data usdhc_imx8qm_data = {
                               ^~~~~~~~~~~~~~~~~
To qxp nand boot defconfig:
 error: ‘esdhc_set_vdd’ undeclared here (not in a function)
 .set_vdd = esdhc_set_vdd,
               ^~~~~~~~~~~~~
"

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16198-4 imx8qm/qxp: Update ARM2 boards to support xhci and ehci at same time
Ye Li [Wed, 16 Aug 2017 05:58:29 +0000 (00:58 -0500)]
MLK-16198-4 imx8qm/qxp: Update ARM2 boards to support xhci and ehci at same time

When using DM xhci and ehci drivers, we can support both two controllers
(OTG and USB3) at same time. Refactor the QM and QXP ARM2 board codes and
configurations to enable them.

Because the xhci-imx8 driver will initialize the clock, and DM framework
will enable power domains, so only keep the power up in board level codes
for non-DM driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng@nxp.com>
7 years agoMLK-16198-3 usb: xhci-imx8: Add core reset function
Ye Li [Wed, 16 Aug 2017 04:05:06 +0000 (23:05 -0500)]
MLK-16198-3 usb: xhci-imx8: Add core reset function

Found a problem that after "usb stop" command, the next "usb start" can't enumerate
any devices. Need to put the xhci core to reset status in stop.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng@nxp.com>
7 years agoMLK-16198-2 usb: xhci-imx8: Add clock init interface
Ye Li [Wed, 16 Aug 2017 05:48:22 +0000 (00:48 -0500)]
MLK-16198-2 usb: xhci-imx8: Add clock init interface

Introduce a clock init interface for xhci-imx8 to initialize its clocks
in SoC level. Also implement it for i.MX8QM/QXP.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng@nxp.com>
7 years agoMLK-16198-1 usb: xhci-imx8: Add basic DM support
Ye Li [Wed, 16 Aug 2017 05:40:44 +0000 (00:40 -0500)]
MLK-16198-1 usb: xhci-imx8: Add basic DM support

Add basic DM support to the xhci-imx8 driver, which only probes the
USB3 node, but won't parse any properties from node in DTS.

The registers address are still hard coded, that share with non-DM codes.
Will improve it to get from the "reg" property in future.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng@nxp.com>
7 years agoMLK-16188-5 dts: imx8qxp arm2: add off-on-delay-us
Peng Fan [Wed, 16 Aug 2017 10:32:59 +0000 (18:32 +0800)]
MLK-16188-5 dts: imx8qxp arm2: add off-on-delay-us

Add off-on-delay-us to make regulator off/on work stably.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16188-4: drivers: regulator: fixed: add off-on-delay-us
Peng Fan [Wed, 16 Aug 2017 23:55:53 +0000 (07:55 +0800)]
MLK-16188-4: drivers: regulator: fixed: add off-on-delay-us

Add off-on-delay-us for fixed regulator.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16188-3 mmc: fsl_esdhc: support tuning for hs200 and sdr104
Peng Fan [Wed, 16 Aug 2017 10:47:43 +0000 (18:47 +0800)]
MLK-16188-3 mmc: fsl_esdhc: support tuning for hs200 and sdr104

Support tuning for HS200 and SDR104. Now only 8QM/QXP are supported.
Some code is imported/modified from kernel sdhci-esdhc-imx.c.

On i.MX8QM LPDDR4 ARM2 board, emmc hs200:
Read speed: ~87MB/s
Write speed: ~67MB/s

Original data, emmc hs:
Read speed: ~43MB/s
Write speed: ~40.5MB/s

On i.MX8QM LPDDR4 ARM2 board, SDR104:
Read speed: ~44MB/s
Write speed: ~9.4MB/s

Original data, SD HS:
Read speed: ~22MB/s
Write speed: ~8.5MB/s

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16188-2 dts: imx8qm/qxp: sync usdhc from kernel
Peng Fan [Fri, 11 Aug 2017 08:52:03 +0000 (16:52 +0800)]
MLK-16188-2 dts: imx8qm/qxp: sync usdhc from kernel

Sync usdhc from kernel commit 9fe23191af2ab03
("MLK-16174: ASoC: fsl_hifi4: load firmware in device open phase.")

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agoMLK-16188-1 mmc: add mmc_send_tuning function
Peng Fan [Sat, 12 Aug 2017 05:00:10 +0000 (13:00 +0800)]
MLK-16188-1 mmc: add mmc_send_tuning function

Add mmc_send_tuning function. tuning_blk_patter imported from Linux Kernel.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
7 years agommc: Retry some MMC cmds on failure
Vignesh R [Fri, 12 May 2017 18:16:40 +0000 (20:16 +0200)]
mmc: Retry some MMC cmds on failure

With certain SD cards like Kingston 8GB/16GB UHS card, it is seen that
MMC_CMD_ALL_SEND_CID cmd fails on first attempt, but succeeds
subsequently. Therefore, retry MMC_CMD_ALL_SEND_CID cmd at least thrice
as done in Linux kernel.
Similarly, it is seen that MMC_CMD_SET_BLOCKLEN may fail on first
attempt, therefore retry this cmd five times as done in kernel.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agommc: Change mode when switching to a boot partition
Jean-Jacques Hiblot [Fri, 12 May 2017 18:16:39 +0000 (20:16 +0200)]
mmc: Change mode when switching to a boot partition

Boot partitions do not support HS200. Changing to a lower performance mode
is required to access them.
mmc_select_mode_and_width() and sd_select_mode_and_width() are modified to
make it easier to call them outside of the initialization context.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agommc: Add support for UHS modes
Jean-Jacques Hiblot [Fri, 12 May 2017 18:16:38 +0000 (20:16 +0200)]
mmc: Add support for UHS modes

Add UHS modes to the list of supported modes, get the UHS capabilites of
the SDcard and implement the procedure to switch the voltage (UHS modes
use 1v8 IO lines)
During the voltage switch procedure, DAT0 is used by the card to signal
when it's ready. The optional card_busy() callback can be used to get this
information from the host driver.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agommc: Add a new callback function to check if the card is busy
Jean-Jacques Hiblot [Fri, 12 May 2017 18:16:37 +0000 (20:16 +0200)]
mmc: Add a new callback function to check if the card is busy

Add a new callback function *card_busy* which can be used to check if the
card is busy. This is useful during UHS voltage switching to check if the
switch was successful. Not all controllers may support this, so it's
optional and when not provided the card is deemed ready.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
7 years agommc: add HS200 support in MMC core
Jean-Jacques Hiblot [Fri, 12 May 2017 18:16:36 +0000 (20:16 +0200)]
mmc: add HS200 support in MMC core

Add HS200 to the list of supported modes and introduce tuning in the MMC
startup process.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agommc: Add a execute_tuning() callback to the mmc operations.
Jean-Jacques Hiblot [Fri, 12 May 2017 18:16:35 +0000 (20:16 +0200)]
mmc: Add a execute_tuning() callback to the mmc operations.

Tuning is a mandatory step in the initialization of SDR104 and HS200 modes.
This callback execute the tuning process.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
7 years agommc: disable the mmc clock during power off
Kishon Vijay Abraham I [Fri, 12 May 2017 18:16:34 +0000 (20:16 +0200)]
mmc: disable the mmc clock during power off

There is no point in having the mmc clock enabled during
power off. Disable the mmc clock. This is similar to how it's
programmed in Linux Kernel.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agommc: add a new mmc parameter to disable mmc clock
Jean-Jacques Hiblot [Fri, 12 May 2017 18:16:33 +0000 (20:16 +0200)]
mmc: add a new mmc parameter to disable mmc clock

mmc clock has to be disabled in certain cases like during
the voltage switch sequence. Modify mmc_set_clock function
to take disable as an argument that signifies if the
clock has to be enabled or disabled.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
7 years agommc: add power cyle support in mmc core
Jean-Jacques Hiblot [Fri, 12 May 2017 18:16:32 +0000 (20:16 +0200)]
mmc: add power cyle support in mmc core

mmc/sd specification requires vdd to be disabled for 1 ms
and then enabled again during power cycle. Add a
function in mmc core to perform power cycle and set
the io signal to it's initial state.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
7 years agommc: Add a new callback function to enable/disable vdd
Kishon Vijay Abraham I [Fri, 12 May 2017 18:16:31 +0000 (20:16 +0200)]
mmc: Add a new callback function to enable/disable vdd

Add a new callback function *set_vdd* which can be used
by the platform mmc driver to enable or disable vdd.
The mmc core can use *mmc_set_vdd* in order to invoke
the callback function. This will be used during power cycle
where the specification requires vdd to be disabled for
1ms and enabled again.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
7 years agommc: Enable signal voltage to be selected from mmc core
Kishon Vijay Abraham I [Fri, 12 May 2017 18:16:30 +0000 (20:16 +0200)]
mmc: Enable signal voltage to be selected from mmc core

Add a new function *mmc_set_signal_voltage* in mmc core
which can be used during mmc initialization to select the
signal voltage. Platform driver should use the set_ios
callback function to select the signal voltage.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
7 years agommc: make mmc_set_ios() return status
Jean-Jacques Hiblot [Fri, 12 May 2017 18:16:29 +0000 (20:16 +0200)]
mmc: make mmc_set_ios() return status

set_ios callback has a return value of 'int' but the mmc_set_ios()
function ignore this. Modify mmc_set_ios() and the callers of mmc_set_ios() to
to return the error status.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agommc: refactor MMC startup to make it easier to support new modes
Jean-Jacques Hiblot [Fri, 12 May 2017 18:16:28 +0000 (20:16 +0200)]
mmc: refactor MMC startup to make it easier to support new modes

The MMC startup process currently handles 4 modes. To make it easier to
add support for more modes, let's make the process more generic and use a
list of the modes to try.
The major functional change is that when a mode fails we try the next one.
Not all modes are tried, only those supported by the card and the host.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agommc: refactor SD startup to make it easier to support new modes
Jean-Jacques Hiblot [Fri, 12 May 2017 18:16:27 +0000 (20:16 +0200)]
mmc: refactor SD startup to make it easier to support new modes

The SDcard startup process currently handles only 2 modes. To make it
easier to add support for more modes, let's make the process more generic
and use a list of the modes to try.
The major functional change is that when a mode fails we try the next one.
Not all modes are tried, only those supported by the card and the host.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agocmd: mmc: display the mode name and current bus speed in the mmc info
Jean-Jacques Hiblot [Fri, 12 May 2017 18:16:26 +0000 (20:16 +0200)]
cmd: mmc: display the mode name and current bus speed in the mmc info

Display the mode name when the user execute 'mmc info'. Also instead of
displaying tran_speed, display the actual bus speed.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agommc: use mmc modes to select the correct bus speed
Jean-Jacques Hiblot [Fri, 12 May 2017 18:16:25 +0000 (20:16 +0200)]
mmc: use mmc modes to select the correct bus speed

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agommc: Add a fonction to dump the mmc capabilities
Jean-Jacques Hiblot [Fri, 12 May 2017 18:16:24 +0000 (20:16 +0200)]
mmc: Add a fonction to dump the mmc capabilities

This adds a simple helper function to display information (bus width and
mode) based on a capability mask. Useful for debug.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>