1. 17 Feb, 2020 3 commits
  2. 16 Jan, 2020 1 commit
    • Joel Johnson's avatar
      mmc: add additional quirk for APP_CMD retry · d4a5fa31
      Joel Johnson authored and Peng Fan's avatar Peng Fan committed
      
      
      It was observed (on ClearFog Base) that sending MMC APP_CMD returned
      an error on the first attempt. The issue appears to be timing related
      since even inserting a puts() short debug entry before the execution
      added sufficient delay to receive success on first attempt.
      
      Follow the existing quirks pattern to retry if initial issuance
      failed so as to not introduce any delay unless needed.
      Signed-off-by: default avatarJoel Johnson <mrjoel@lixil.net>
      d4a5fa31
  3. 10 Oct, 2019 2 commits
    • Yann Gautier's avatar
      mmc: add a driver callback for power-cycle · 3602a56a
      Yann Gautier authored and Peng Fan's avatar Peng Fan committed
      Some MMC peripherals require specific power cycle sequence, where some
      registers need to be written between the regulator is turned off and then
      back on. This is the case for the MMC IP embedded in STM32MP1 SoC.
      
      In STM32MP157 reference manual [1], the power cycle sequence is:
      1. Reset the SDMMC with the RCC.SDMMCxRST register bit. This will reset
      the SDMMC to the reset state and the CPSM and DPSM to the Idle state.
      2. Disable the Vcc power to the card.
      3. Set the SDMMC in power-cycle state. This will make that the
      SDMMC_D[7:0], SDMMC_CMD and SDMMC_CK are driven low, to prevent the card
      from being supplied through the signal lines.
      4. After minimum 1ms enable the Vcc power to the card.
      5. After the power ramp period set the SDMMC to the power-off state for
      minimum 1ms. The SDMMC_D[7:0], SDMMC_CMD and SDMMC_CK are set to
      drive “1”.
      6. After the 1ms delay set the SDMMC to power-on state in which the
      SDMMC_CK clock will be enabled.
      7. After 74 SDMMC_CK cycles the first command can be sent to the card.
      
      The step 3. cannot be handled by the current framework implementation.
      A new callback (host_power_cycle) is created, and called in
      mmc_power_cycle(), after mmc_power_off().
      
      The incorrect power cycle sequence has shown some boot failures on
      STM32MP1 with some SD-cards, especially on cold boots when the input
      frequency is low (<= 25MHz).
      Those failures are no more seen with this correct power cycle sequence.
      
      [1] https://www.st.com/resource/en/reference_manual/DM00327659.pdf
      
      Signed-off-by: default avatarYann Gautier <yann.gautier@st.com>
      3602a56a
    • Lokesh Vutla's avatar
      spl: dm_mmc: Initialize only the required mmc device · 80f02019
      Lokesh Vutla authored and Peng Fan's avatar Peng Fan committed
      
      
      In SPL, all the available mmc devices gets initialized during boot.
      This might not work in cases where clocks are not available for
      certain mmc devices(other than boot device) and the support for
      enabling device might not be ready.
      
      Texas Instruments' K3 J721E device having a central system controller
      (dmsc) is one such example falling in this category. Below is the
      sequence for the failing scenario:
      - ROM comes up in SD mode and loads SPL by just initialing SD card.
      - SPL loads dmsc firmware from SD Card.
      Since ROM has enabled SD, SPL need not enable the SD, just need
      to re initialize the card. But SPL is trying to initialize other MMC
      instances which are in disabled state. Since dmsc firmware is not yet
      available, devices cannot be enabled. So in SPL, initialize only the
      mmc device that is needed.
      Signed-off-by: Lokesh Vutla's avatarLokesh Vutla <lokeshvutla@ti.com>
      Reviewed-by: Peng Fan's avatarPeng Fan <peng.fan@nxp.com>
      80f02019
  4. 08 Oct, 2019 1 commit
  5. 05 Sep, 2019 2 commits
  6. 31 Jul, 2019 1 commit
  7. 15 Jul, 2019 10 commits
  8. 19 Jun, 2019 1 commit
  9. 29 Mar, 2019 1 commit
    • BOUGH CHEN's avatar
      mmc: correct the HS400 initialization process · 5cf12031
      BOUGH CHEN authored and Tom Rini's avatar Tom Rini committed
      After the commit b9a2a0e2
      
       ("mmc: Add support for downgrading
      HS200/HS400 to HS mode"), it add a parameter in mmc_set_card_speed()
      which indicates that the HS200/HS400 to HS downgrade is happening.
      
      During the HS400 initialization, first select to HS200, and config
      the related clock rate, then downgrade to HS mode. So here also need
      to config the downgrade value to be true for two reasons. First,
      make sure in the function mmc_set_card_speed(), after switch to HS
      mode, first config the clock rate, then read the EXT_CSD, avoid
      receiving data of EXT_CSD in HS mode at 200MHz. Second, after issue
      the MMC_CMD_SWITCH command, it need to wait a bit then switch bus
      properties.
      
      Test on i.MX8QM MEK board, some Micron eMMC will stuck in transfer
      mode in this case, and USDHC will never get data transfer complete
      status, cause the uboot hang.
      Signed-off-by: default avatarHaibo Chen <haibo.chen@nxp.com>
      Acked-by: default avatarMarek Vasut <marek.vasut@gmail.com>
      5cf12031
  10. 25 Mar, 2019 1 commit
    • Marek Vasut's avatar
      mmc: Align MMC_TRACE with tiny printf · 7d5ccb1a
      Marek Vasut authored and Tom Rini's avatar Tom Rini committed
      
      
      The tiny printf implementation only supports %x format specifier,
      it does not support %X . Since it makes little difference whether
      the debug output prints hex numbers in capitals or not, change it
      to %x and make the MMC_TRACE output work with tiny printf too.
      Signed-off-by: Marek Vasut's avatarMarek Vasut <marex@denx.de>
      Cc: Jaehoon Chung <jh80.chung@samsung.com>
      Cc: Simon Glass <sjg@chromium.org>
      7d5ccb1a
  11. 16 Feb, 2019 1 commit
    • Marek Vasut's avatar
      mmc: Downgrade SD/MMC from UHS/HS200/HS400 modes before boot · fceea992
      Marek Vasut authored and Marek Vasut's avatar Marek Vasut committed
      
      
      Older kernel versions or systems which do not connect eMMC reset line
      properly may not be able to handle situations where either the eMMC
      is left in HS200/HS400 mode or SD card in UHS modes by the bootloader
      and may misbehave. Downgrade the eMMC to HS/HS52 mode and/or SD card
      to non-UHS mode before booting the kernel to allow such older kernels
      to work with modern U-Boot.
      Signed-off-by: default avatarMarek Vasut <marek.vasut+renesas@gmail.com>
      Cc: Tom Rini <trini@konsulko.com>
      fceea992
  12. 09 Feb, 2019 1 commit
    • Marek Vasut's avatar
      mmc: Do not poll using CMD13 when changing timing · 6892550c
      Marek Vasut authored and Marek Vasut's avatar Marek Vasut committed
      
      
      When using CMD6 to switch eMMC card timing from HS200/HS400 to HS/legacy,
      do not poll for the completion status using CMD13, but rather wait 50mS.
      
      Once the card receives the CMD6 and starts executing it, the bus is in
      undefined state until both the card finishes executing the command and
      until the controller switches the bus to matching timing configuration.
      During this time, it is not possible to transport any commands or data
      across the bus, which includes the CMD13.
      Signed-off-by: default avatarMarek Vasut <marek.vasut+renesas@gmail.com>
      Cc: Jaehoon Chung <jh80.chung@samsung.com>
      6892550c
  13. 15 Jan, 2019 1 commit
    • Marek Vasut's avatar
      mmc: Add support for downgrading HS200/HS400 to HS mode · b9a2a0e2
      Marek Vasut authored and Tom Rini's avatar Tom Rini committed
      
      
      The mmc_select_mode_and_width() function can be called while the card
      is in HS200/HS400 mode and can be used to downgrade the card to lower
      mode, e.g. HS. This is used for example by mmc_boot_part_access_chk()
      which cannot access the card in HS200/HS400 mode and which is in turn
      called by saveenv if env is in the MMC.
      
      In such case, forcing the card clock to legacy frequency cannot work.
      Instead, the card must be switched to HS mode first, from which it can
      then be reprogrammed as needed.
      
      However, this procedure needs additional code changes, since the current
      implementation checks whether the card correctly switched to HS mode in
      mmc_set_card_speed(). The check only expects that the card will be going
      to HS mode from lower modes, not from higher modes, hence add a parameter
      which indicates that the HS200/HS400 to HS downgrade is happening. This
      makes the code send the switch command first, reconfigure the controller
      next and finally perform the EXT_CSD readback check. The last two steps
      cannot be done in reverse order as the card is already in HS mode when
      the clock are being switched on the controller side.
      Signed-off-by: default avatarMarek Vasut <marek.vasut+renesas@gmail.com>
      Cc: Jaehoon Chung <jh80.chung@samsung.com>
      b9a2a0e2
  14. 09 Jan, 2019 1 commit
  15. 04 Dec, 2018 1 commit
    • Marek Vasut's avatar
      mmc: Do not issue CMD 6 on SD 1.00 and SD 1.01 · cf345760
      Marek Vasut authored and Marek Vasut's avatar Marek Vasut committed
      
      
      According to SD Specifications Part 1 Physical Layer Simplified Specification
      Version 6.00 August 29, 2018, section 4.3.10 (Switch Function Command) and
      section 5.6 (SCR register), SD cards version 1.00 and 1.01 do not support the
      SD CMD 6.
      
      Currently, U-Boot will issue CMD 6 unconditionally in sd_set_card_speed()
      while configuring the bus for selected frequency. This will make SD cards
      version 1.00 and 1.01 time out and thus fail detection altogether.
      
      Fix this by not sending CMD 6 on such cards. Tested on Matsushita Electric
      Industrial Co., Ltd. Japan RP-SD008B / Victor 8MB SD card, CU-SD008, which
      is correctly detected with this patch as:
      
      Device: sd@ee160000
      Manufacturer ID: 1
      OEM: 5041
      Name: S008B
      Bus Speed: 25000000
      Mode : SD Legacy
      Rd Block Len: 512
      SD version 1.0
      High Capacity: No
      Capacity: 6.5 MiB
      Bus Width: 4-bit
      Erase Group Size: 512 Bytes
      Signed-off-by: default avatarMarek Vasut <marek.vasut+renesas@gmail.com>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      cf345760
  16. 14 Nov, 2018 1 commit
  17. 11 Sep, 2018 1 commit
    • Peng Fan's avatar
      mmc: add HS400 support · 3dd2626f
      Peng Fan authored and Tom Rini's avatar Tom Rini committed
      
      
      Add HS400 support.
      Selecting HS400 needs first select HS200 according to spec, so use
      a dedicated function for HS400.
      Add HS400 related macros.
      Remove the restriction of only using the low 6 bits of
      EXT_CSD_CARD_TYPE, using all the 8 bits.
      Signed-off-by: Peng Fan's avatarPeng Fan <peng.fan@nxp.com>
      Cc: Jaehoon Chung <jh80.chung@samsung.com>
      Cc: Jean-Jacques Hiblot <jjhiblot@ti.com>
      Cc: Stefano Babic <sbabic@denx.de>
      Cc: Kishon Vijay Abraham I <kishon@ti.com>
      Cc: Faiz Abbas <faiz_abbas@ti.com>
      Cc: Marek Vasut <marex@denx.de>
      Signed-off-by: Peng Fan's avatarPeng Fan <peng.fan@nxp.com>
      3dd2626f
  18. 23 Jul, 2018 1 commit
  19. 13 May, 2018 1 commit
    • Marek Vasut's avatar
      mmc: Improve tinification · 62d77cea
      Marek Vasut authored and Tom Rini's avatar Tom Rini committed
      
      
      Drop all the extra content from the MMC core, so that tiny MMC support
      is really tiny, no fancy anything. That means the tiny MMC support does
      only 1-bit transfers at default speed settings. Moreover, this patch
      drops duplicate instance of struct mmc mmc_static, which wasted about
      360 bytes. Furthermore, since MMC tiny supports only one controller
      at all times, get rid of mallocating the ext csd backup and replace
      it with static array. All in all, this patch saves ~4 kiB of bloat
      from the MMC core, which on platforms with severe limitations can be
      beneficial.
      Signed-off-by: default avatarMarek Vasut <marek.vasut@gmail.com>
      Cc: Jaehoon Chung <jh80.chung@samsung.com>
      [trini: Fixup checkpatch.pl style warnings]
      Signed-off-by: Tom Rini's avatarTom Rini <trini@konsulko.com>
      62d77cea
  20. 11 May, 2018 1 commit
  21. 08 May, 2018 2 commits
  22. 07 May, 2018 1 commit
    • Tom Rini's avatar
      SPDX: Convert all of our single license tags to Linux Kernel style · 83d290c5
      Tom Rini authored
      
      
      When U-Boot started using SPDX tags we were among the early adopters and
      there weren't a lot of other examples to borrow from.  So we picked the
      area of the file that usually had a full license text and replaced it
      with an appropriate SPDX-License-Identifier: entry.  Since then, the
      Linux Kernel has adopted SPDX tags and they place it as the very first
      line in a file (except where shebangs are used, then it's second line)
      and with slightly different comment styles than us.
      
      In part due to community overlap, in part due to better tag visibility
      and in part for other minor reasons, switch over to that style.
      
      This commit changes all instances where we have a single declared
      license in the tag as both the before and after are identical in tag
      contents.  There's also a few places where I found we did not have a tag
      and have introduced one.
      Signed-off-by: Tom Rini's avatarTom Rini <trini@konsulko.com>
      83d290c5
  23. 02 May, 2018 1 commit
  24. 23 Apr, 2018 1 commit
  25. 23 Feb, 2018 2 commits