22 Feb, 2018

1 commit

  • commit fe0e58048f005fdce315eb4d185e5c160be4ac01 upstream.

    This reverts commit 0a44697627d17a66d7dc98f17aeca07ca79c5c20.

    This commit was initially intended to fix problems with hs200 and hs400
    on some boards, mainly the odroid-c2. The OC2 (Rev 0.2) I have performs
    well in this modes, so I could not confirm these issues.

    We've had several reports about the issues being still present on (some)
    OC2, so apparently, this change does not do what it was supposed to do.
    Maybe the eMMC signal quality is on the edge on the board. This may
    explain the variability we see in term of stability, but this is just a
    guess. Lowering the max_frequency to 100Mhz seems to do trick for those
    affected by the issue

    Worse, the commit created new issues (CRC errors and hangs) on other
    boards, such as the kvim 1 and 2, the p200 or the libretech-cc.

    According to amlogic, the Tx phase should not be tuned and left in its
    default configuration, so it is best to just revert the commit.

    Fixes: 0a44697627d1 ("mmc: meson-gx: include tx phase in the tuning process")
    Cc: # 4.14+
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Jerome Brunet
     

04 Oct, 2017

3 commits

  • It has been reported that some platforms (odroid-c2) may require
    a different tx phase setting to operate at high speed (hs200 and hs400)

    To improve the situation, this patch includes tx phase in the tuning
    process.

    Fixes: d341ca88eead ("mmc: meson-gx: rework tuning function")
    Reported-by: Heiner Kallweit
    Signed-off-by: Jerome Brunet
    Reviewed-by: Kevin Hilman
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • Resetting the phase when POWER_ON is set the set_ios() call means that the
    phase is reset almost every time the set_ios() is called, while the
    expected behavior was to reset the phase on a power cycle.

    This had gone unnoticed until now because in all mode (except hs400) the
    tuning is done after the last to set_ios(). In such case, the tuning
    result is used anyway. In HS400, there are a few calls to set_ios() after
    the tuning is done, overwriting the tuning result.

    Resetting the phase on POWER_UP instead of POWER_ON solve the problem.

    Fixes: d341ca88eead ("mmc: meson-gx: rework tuning function")
    Signed-off-by: Jerome Brunet
    Reviewed-by: Kevin Hilman
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • Using CLK_DIVIDER_ROUND_CLOSEST is unsafe as the mmc clock could be
    rounded to a rate higher the specified rate. Removing this flag ensure
    that, if the rate needs to be rounded, it will be rounded down.

    Fixes: 51c5d8447bd7 ("MMC: meson: initial support for GX platforms")
    Signed-off-by: Jerome Brunet
    Reviewed-by: Kevin Hilman
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     

31 Aug, 2017

1 commit

  • Using __bf_shf does not compile on arm 32 architecture.
    This has gone unnoticed till now cause the driver is only used on arm64.

    In addition, __bf_shf was already used in the driver without any issue.
    It was used on a constant value, so the call was probably optimized
    away.

    Replace __bf_shf by __ffs fixes the problem

    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     

30 Aug, 2017

16 commits

  • Rework tuning function of the rx phase. Now that the phase can be
    more precisely set using CCF, test more phase setting and find the
    largest working window. Then the tuning selected is the one at the
    center of the window.

    This rework allows to use new modes, such as UHS SDR50

    Reviewed-by: Kevin Hilman
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • Initial default tx phase was set to 0 while the datasheet recommends 270.
    Some cards fails to initialize with this setting and eMMC mode DDR52 does
    not work.

    Changing this setting to 270 fixes these issues, without any regression
    so far

    Reviewed-by: Kevin Hilman
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • Implement voltage switch callback (shamelessly copied from sunxi mmc
    driver). This allow, with the appropriate tuning function, to use
    SD ultra high speed modes.

    Reviewed-by: Kevin Hilman
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • Several phases can be controlled on the meson-gx controller, the core, tx
    and rx clock phase. The tx and rx uses delays to allow more fine grained
    setting of the phase. To properly compute the phase using delays,
    accessing the clock rate is necessary.

    Instead of ad-hoc functions, use the common clock framework to set the
    clock phases (and access the clock rate while doing it).

    Acked-by: Kevin Hilman
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • Implement the card_busy callback to be able to verify that the
    card is done dealing with voltage switch, when the support is
    added later on.

    Reviewed-by: Kevin Hilman
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • No functional change, just improve interrupt handler readability

    Reviewed-by: Kevin Hilman
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • It seems that the mmc clock is also used and required, somehow, by
    the controller itself.

    It is shown during init, when writing to CFG while the divider is set
    to 0 will crash the SoC. During a voltage switch, the controller may
    crash and the card may then fail to exit busy state if the clock is
    stopped.

    To avoid this, it is best to keep the clock running for the controller,
    except during rate change. However, we still need to be able to gate
    the clock out of the SoC. Let's use the pinmux for this, and fallback
    to gpio mode (pulled-down) when we need to gate the clock

    Reviewed-by: Kevin Hilman
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • In DDR modes, meson mmc controller requires an input rate twice as fast
    as the output rate

    Fixes: 51c5d8447bd7 ("MMC: meson: initial support for GX platforms")
    Reviewed-by: Kevin Hilman
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • Thanks to devm, carrying the clock structure around after init is not
    necessary. Rework the function to remove these from the controller host
    data.

    Finally, set initial mmc clock rate before enabling it, simplifying the
    exit condition.

    Reviewed-by: Kevin Hilman
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • Clean-up clk_set function to prepare the next changes (DDR and clk-stop)

    Reviewed-by: Kevin Hilman
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • Remove conditional write of cfg register. Warn if set_clk fails for some
    reason. Consistently use host->dev instead of mixing with mmc_dev(mmc)

    Reviewed-by: Kevin Hilman
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • cfg init function overwrite values set in the clk init function
    Remove the cfg pokes from the clk init. Actually, trying to use
    the CLK_AUTO, like initially tried in clk_init, would break
    the card initialization

    Reviewed-by: Kevin Hilman
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • On boot, the clock divider value is 0 which is a weird unsupported value.
    For example, accessing the cfg register with this value set would crash
    the SoC.

    Previous change removed 0 as possible value for CCF but forgot to properly
    initialize the register before registering the clock. This leads to the
    CCF finding an illegal value, which it complains about.

    Initialize the register properly in a standalone patch so the fix can be
    picked up if necessary. The change this fixed is: "mmc: meson-gx: remove
    CLK_DIVIDER_ALLOW_ZERO clock flag".

    Reported-by: Neil Armstrong
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • Remove unused clock rate defines. These should not be defined but
    requested from the clock framework.

    Also correct typo on the DELAY register

    Reviewed-by: Kevin Hilman
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • Remove CLK_DIVIDER_ALLOW_ZERO. This flag means that a 1 based divider
    with a 0 value will behave as a bypass clock

    The mmc divider does not behave like this, a 0 value disables the clock
    Remove this flag so CCF never allows a 0 value on this clock

    Fixes: 51c5d8447bd7 ("MMC: meson: initial support for GX platforms")
    Reviewed-by: Kevin Hilman
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     
  • CCF generic mux will shift the mask using the value defined in shift
    Define the mask accordingly

    Reviewed-by: Kevin Hilman
    Signed-off-by: Jerome Brunet
    Signed-off-by: Ulf Hansson

    Jerome Brunet
     

12 Jun, 2017

1 commit

  • There have been reports about SDIO failing with certain WiFi chips in
    descriptor chain mode. SD / eMMC are working fine.

    So let's fall back to bounce buffer mode for command SD_IO_RW_EXTENDED.
    This was reported to fix the error.

    Fixes: 79ed05e329c3 "mmc: meson-gx: add support for descriptor chain mode"
    Signed-off-by: Heiner Kallweit
    Tested-by: Martin Blumenstingl
    Signed-off-by: Ulf Hansson

    Heiner Kallweit
     

25 Apr, 2017

18 commits