23 Jan, 2017

1 commit

  • It's necessary to setup bus if any slots are present.
    - update clock after ctrl reset
    - if the host has genpd node, we can guarantee the clock is
    available before starting request. Otherwies, the clock register
    is reset once power off the pd, and host can't output the active
    clock during communication.

    Fixes: e9ed8835e990 ("mmc: dw_mmc: add runtime PM callback")
    Fixes: df9bcc2bc0a1 ("mmc: dw_mmc: add missing codes for runtime resume")
    cc:
    Reported-by: Randy Li
    Reported-by: S. Gilles
    Signed-off-by: Ziyuan Xu
    Signed-off-by: Shawn Lin
    Signed-off-by: Ulf Hansson

    Ziyuan Xu
     

16 Jan, 2017

1 commit

  • Regressions for not being able to detect an eMMC HS DDR mode card has been
    reported for the sdhci-esdhc-imx driver, but potentially other sdhci
    variants may suffer from the similar problem.

    The commit e173f8911f09 ("mmc: core: Update CMD13 polling policy when
    switch to HS DDR mode"), is causing the problem. It seems that change moved
    one step to far, regarding changing the host's timing before polling for a
    busy card.

    To fix this, let's move back to the behaviour when the host's timing is
    updated after the polling, but before the switch status is fetched and
    validated.

    In cases when polling with CMD13, we keep validating the switch status at
    each attempt. However, to align with the other card busy detections
    mechanism, let's fetch and validate the switch status also after the host's
    timing is updated.

    Reported-by: Clemens Gruber
    Reported-by: Gary Bisson
    Fixes: e173f8911f09 ("mmc: core: Update CMD13 polling policy when switch..")
    Cc: Shawn Lin
    Cc: Dong Aisheng
    Cc: Haibo Chen
    Signed-off-by: Ulf Hansson
    Tested-by: Clemens Gruber
    Tested-by: Jagan Teki
    Reviewed-by: Shawn Lin
    Tested-by: Haibo Chen
    Reviewed-by: Dong Aisheng

    Ulf Hansson
     

12 Jan, 2017

2 commits

  • According to the code the intention is to append 8 SCK cycles
    instead of 4 at end of a MMC_STOP_TRANSMISSION command. But this
    will never happened because it's an AC command not an ADTC command.
    So fix this by moving the statement into the right function.

    Signed-off-by: Stefan Wahren
    Fixes: e4243f13d10e (mmc: mxs-mmc: add mmc host driver for i.MX23/28)
    Cc:
    Signed-off-by: Ulf Hansson

    Stefan Wahren
     
  • Commit e5bbf30733f9 ("mmc: sdhci-acpi: Ensure connected devices are
    powered when probing") introduced code to powerup any acpi child
    nodes listed in the dstd. But some dstd-s list all possible devices
    used on some board variants, while reporting if the device is actually
    present and enabled in the status field of the device.

    So we end up calling the acpi _PS0 (power-on) method for devices which
    are not actually present. This does not always end well, e.g. on my
    cube iwork8 air tablet, this results in freezing the entire tablet as
    soon as the r8723bs module is loaded.

    This commit fixes this by checking the child device's status.present
    and status.enabled bits and only call acpi_device_fix_up_power()
    if both are set.

    Fixes: e5bbf30733f9 ("mmc: sdhci-acpi: Ensure connected devices are powered when probing")
    BugLink: https://github.com/hadess/rtl8723bs/issues/80
    Signed-off-by: Hans de Goede
    Acked-by: Adrian Hunter
    Cc:
    Signed-off-by: Ulf Hansson

    Hans de Goede
     

10 Jan, 2017

1 commit

  • No actual segmentation faults were observed but the coding is
    at least inconsistent.

    irqreturn_t meson_mmc_irq():

    We should not dereference host before checking it.

    meson_mmc_irq_thread():

    If cmd or mrq are NULL we should not dereference them after
    writing a warning.

    Fixes: 51c5d8447bd7 MMC: meson: initial support for GX platforms
    Signed-off-by: Heinrich Schuchardt
    Acked-by: Kevin Hilman
    Signed-off-by: Ulf Hansson

    Heinrich Schuchardt
     

25 Dec, 2016

1 commit


21 Dec, 2016

1 commit

  • The mmc_read_ssr() function results in DMA to the raw_ssr member of
    struct mmc_card, which is not guaranteed to be cache line aligned & thus
    might not meet the requirements set out in Documentation/DMA-API.txt:

    Warnings: Memory coherency operates at a granularity called the cache
    line width. In order for memory mapped by this API to operate
    correctly, the mapped region must begin exactly on a cache line
    boundary and end exactly on one (to prevent two separately mapped
    regions from sharing a single cache line). Since the cache line size
    may not be known at compile time, the API will not enforce this
    requirement. Therefore, it is recommended that driver writers who
    don't take special care to determine the cache line size at run time
    only map virtual regions that begin and end on page boundaries (which
    are guaranteed also to be cache line boundaries).

    On some systems where DMA is non-coherent this can lead to us losing
    data that shares cache lines with the raw_ssr array.

    Fix this by kmalloc'ing a temporary buffer to perform DMA into. kmalloc
    will ensure the buffer is suitably aligned, allowing the DMA to be
    performed without any loss of data.

    Signed-off-by: Paul Burton
    Fixes: 5275a652d296 ("mmc: sd: Export SD Status via “ssr” device attribute")
    Cc:
    Signed-off-by: Ulf Hansson

    Paul Burton
     

20 Dec, 2016

3 commits

  • Commit e0097cf5f2f1 ("mmc: queue: Fix queue thread wake-up") did not go far
    enough. mmc_wait_for_data_req_done() still contains some problems and can
    be further simplified. First it should not touch
    context_info->is_waiting_last_req because that is a wake-up control used by
    the owner of the context. Secondly, it should always return when one of its
    wake-up conditions is met because, again, that is contolled by the owner of
    the context.

    While the current block driver does not have an issue, these problems were
    exposed during testing of the Software Command Queue patches.

    Fixes: e0097cf5f2f1 ("mmc: queue: Fix queue thread wake-up")
    Signed-off-by: Adrian Hunter
    Tested-by: Harjani Ritesh
    Signed-off-by: Ulf Hansson

    Adrian Hunter
     
  • Since commit c2c24819b280 ("mmc: core: Don't power off the card when
    starting the host"), the power state can still be MMC_POWER_UNDEFINED after
    mmc_start_host() is called. That can trigger a warning in SDHCI during
    runtime resume as it tries to restore the I/O state. Handle
    MMC_POWER_UNDEFINED simply by not updating the I/O state in that case.

    Fixes: c2c24819b280 ("mmc: core: Don't power off the card when starting the host")
    Signed-off-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Adrian Hunter
     
  • Add a Socionext SoC specific compatible (suggested by Rob Herring).

    No SoC specific data are associated with the compatible strings for
    now, but other SoC vendors may use this IP and want to differentiate
    IP variants in the future.

    Signed-off-by: Masahiro Yamada
    Acked-by: Rob Herring
    Signed-off-by: Ulf Hansson

    Masahiro Yamada
     

15 Dec, 2016

1 commit

  • Pull another MMC update from Ulf Hansson:
    "Here's a second pull request for MMC for v4.10.

    As a matter of fact it's only one change that moves some mmc files
    around. I thought it was a good idea to get this into v4.10, as it
    gives us a nice and fresh base for v4.11. Summary:

    MMC core:

    - Move files from the card directory to the core directory to enable
    future clean-ups of the generic mmc header files and interfaces"

    * tag 'mmc-v4.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
    mmc: block: Move files to core

    Linus Torvalds
     

14 Dec, 2016

1 commit

  • Pull block layer updates from Jens Axboe:
    "This is the main block pull request this series. Contrary to previous
    release, I've kept the core and driver changes in the same branch. We
    always ended up having dependencies between the two for obvious
    reasons, so makes more sense to keep them together. That said, I'll
    probably try and keep more topical branches going forward, especially
    for cycles that end up being as busy as this one.

    The major parts of this pull request is:

    - Improved support for O_DIRECT on block devices, with a small
    private implementation instead of using the pig that is
    fs/direct-io.c. From Christoph.

    - Request completion tracking in a scalable fashion. This is utilized
    by two components in this pull, the new hybrid polling and the
    writeback queue throttling code.

    - Improved support for polling with O_DIRECT, adding a hybrid mode
    that combines pure polling with an initial sleep. From me.

    - Support for automatic throttling of writeback queues on the block
    side. This uses feedback from the device completion latencies to
    scale the queue on the block side up or down. From me.

    - Support from SMR drives in the block layer and for SD. From Hannes
    and Shaun.

    - Multi-connection support for nbd. From Josef.

    - Cleanup of request and bio flags, so we have a clear split between
    which are bio (or rq) private, and which ones are shared. From
    Christoph.

    - A set of patches from Bart, that improve how we handle queue
    stopping and starting in blk-mq.

    - Support for WRITE_ZEROES from Chaitanya.

    - Lightnvm updates from Javier/Matias.

    - Supoort for FC for the nvme-over-fabrics code. From James Smart.

    - A bunch of fixes from a whole slew of people, too many to name
    here"

    * 'for-4.10/block' of git://git.kernel.dk/linux-block: (182 commits)
    blk-stat: fix a few cases of missing batch flushing
    blk-flush: run the queue when inserting blk-mq flush
    elevator: make the rqhash helpers exported
    blk-mq: abstract out blk_mq_dispatch_rq_list() helper
    blk-mq: add blk_mq_start_stopped_hw_queue()
    block: improve handling of the magic discard payload
    blk-wbt: don't throttle discard or write zeroes
    nbd: use dev_err_ratelimited in io path
    nbd: reset the setup task for NBD_CLEAR_SOCK
    nvme-fabrics: Add FC LLDD loopback driver to test FC-NVME
    nvme-fabrics: Add target support for FC transport
    nvme-fabrics: Add host support for FC transport
    nvme-fabrics: Add FC transport LLDD api definitions
    nvme-fabrics: Add FC transport FC-NVME definitions
    nvme-fabrics: Add FC transport error codes to nvme.h
    Add type 0x28 NVME type code to scsi fc headers
    nvme-fabrics: patch target code in prep for FC transport support
    nvme-fabrics: set sqe.command_id in core not transports
    parser: add u64 number parser
    nvme-rdma: align to generic ib_event logging helper
    ...

    Linus Torvalds
     

12 Dec, 2016

1 commit

  • Once upon a time it made sense to keep the mmc block device driver and its
    related code, in its own directory called card. Over time, more an more
    functions/structures have become shared through generic mmc header files,
    between the core and the card directory. In other words, the relationship
    between them has become closer.

    By sharing functions/structures via generic header files, it becomes easy
    for outside users to abuse them. In a way to avoid that from happen, let's
    move the files from card directory into the core directory, as it enables
    us to move definitions of functions/structures into mmc core specific
    header files.

    Note, this is only the first step in providing a cleaner mmc interface for
    outside users. Following changes will do the actual cleanup, as that is not
    part of this change.

    Signed-off-by: Ulf Hansson
    Reviewed-by: Linus Walleij

    Ulf Hansson
     

08 Dec, 2016

2 commits

  • Add a driver for the Cadence SD4HC SD/SDIO/eMMC Controller.

    For SD, it basically relies on the SDHCI standard code.
    For eMMC, this driver provides some callbacks to support the
    hardware part that is specific to this IP design.

    Signed-off-by: Masahiro Yamada
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Masahiro Yamada
     
  • Some SDHCI-compat controllers support not only SD, but also eMMC,
    but they use different commands for tuning: CMD19 for SD, CMD21 for
    eMMC.

    Due to the difference of the underlying mechanism, some controllers
    (at least, the Cadence IP is the case) provide their own registers
    for the eMMC tuning.

    This commit will be useful when we want to override .execute_tuning
    callback (for eMMC HS200 tuning), but still let it fall back to
    sdhci_execute_tuning() for SD timing.

    Signed-off-by: Masahiro Yamada
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Masahiro Yamada
     

05 Dec, 2016

25 commits

  • Tidy the tuning loop by moving it to a separate function and making it a
    for-loop.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Adrian Hunter
     
  • There are only 2 possible block sizes, so simplify 2 if-statements into 1.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Adrian Hunter
     
  • Factor out some functions to tidy up the code in sdhci_execute_tuning.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Adrian Hunter
     
  • Use mmc_abort_tuning() instead of open-coding the stop command.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Adrian Hunter
     
  • If a tuning command times out, the card could still be processing it, which
    will cause problems for recovery. The eMMC specification says that CMD12
    can be used to stop CMD21, so add a function that does that.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Adrian Hunter
     
  • SDHCI falls back to fixed sampling if there is an error during tuning.
    However it also reports an error unless there is periodic re-tuning.
    That is not the best option because:
    a) there is a reasonable chance that fixed sampling will work, especially
    at room temperature.
    b) re-tuning will be done again anyway if there are CRC errors.
    Change to return no error always when falling back to fixed sampling.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Adrian Hunter
     
  • If the driver has exhausted the maximum number of tuning loops, then fixed
    sampling is used. To do that both SDHCI_CTRL_TUNED_CLK and
    SDHCI_CTRL_EXEC_TUNING must be reset to 0, but only SDHCI_CTRL_TUNED_CLK
    was being reset. Reset SDHCI_CTRL_EXEC_TUNING to 0 also.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Adrian Hunter
     
  • Clearing the tuning bits should reset the tuning circuit. However there is
    more to do. Reset the command and data lines for good measure, and then
    for eMMC ensure the card is not still trying to process a tuning command by
    sending a stop command.

    Note the JEDEC eMMC specification says the stop command (CMD12) can be used
    to stop a tuning command (CMD21) whereas the SD specification is silent on
    the subject with respect to the SD tuning command (CMD19). Considering that
    CMD12 is not a valid SDIO command, the stop command is sent only when the
    tuning command is CMD21 i.e. for eMMC. That addresses cases seen so far
    which have been on eMMC.

    Note that this replaces the commit fe5fb2e3b58f ("mmc: sdhci: Reset cmd and
    data circuits after tuning failure") which is being reverted for v4.9+.

    Signed-off-by: Adrian Hunter
    Tested-by: Dan O'Donovan
    Cc: stable@vger.kernel.org
    Signed-off-by: Ulf Hansson

    Adrian Hunter
     
  • This reverts commit fe5fb2e3b58f ("mmc: sdhci: Reset cmd and data circuits
    after tuning failure").

    A better fix is available, and it will be applied to older stable releases,
    so get this out of the way by reverting it.

    Signed-off-by: Adrian Hunter
    Cc: stable@vger.kernel.org # v4.9+
    Signed-off-by: Ulf Hansson

    Adrian Hunter
     
  • The JEDEC specification indicates CMD13 can be used after a HS200 switch
    to check for errors. However in practice some boards experience CRC errors
    in the CMD13 response. Consequently, for HS200, CRC errors are not a
    reliable way to know the switch failed. If there really is a problem, we
    would expect tuning will fail and the result ends up the same. So change
    the error condition to ignore CRC errors in that case.

    Signed-off-by: Adrian Hunter
    Acked-by: Jaehoon Chung
    Reviewed-by: Shawn Lin
    Signed-off-by: Ulf Hansson

    Adrian Hunter
     
  • Add an entry for the SDIO bus in the ECS EF20 cherry trail laptop:

    Device (SDHB) {
    Name (_ADR, 0x00110000)
    Name (_HID, "80860F14" /* Intel Baytrail SDIO/MMC Host Controller */)
    Name (_CID, "PNP0D40" /* SDA Standard Compliant SD Host Controller */)
    Name (_DDN, "Intel(R) SDIO Controller - 80862295")
    Name (_UID, 0x02)
    Name (_HRV, One)

    A SDHB device with the same _HID and _UID can also be found on other
    cherry trail products like Chuwi Hi10.

    Signed-off-by: Daniel Drake
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Daniel Drake
     
  • I see no override of read/write callbacks in sdhci-of-at91.c.

    Signed-off-by: Masahiro Yamada
    Acked-by: Ludovic Desroches
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Masahiro Yamada
     
  • On NI 9037 boards the max SDIO frequency is limited by trace lengths
    and other layout choices. The max SDIO frequency is stored in an ACPI
    table.

    The driver reads the ACPI entry MXFQ during sdio_probe_slot and sets the
    f_max field of the host.

    Signed-off-by: Nathan Sullivan
    Reviewed-by: Jaeden Amero
    Reviewed-by: Josh Cartwright
    Signed-off-by: Zach Brown
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Zach Brown
     
  • Add PCI ID for Intel byt sdio host controller sub-vended by NI.

    The controller has different behavior because of the board layout NI
    puts it on.

    Signed-off-by: Zach Brown
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Zach Brown
     
  • Before calling clk_round_rate(), put the spin_unlock_irq() in
    sdhci_s3c_consider_clock() function.

    Signed-off-by: Jaehoon Chung
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson

    Jaehoon Chung
     
  • When card is polling (broken-cd), there is a spamming messge related to
    clock.
    After applied this patch, display the message only one time at boot
    time. It's enough to check which clock values is used.
    Also prevent to display the spamming message.

    Signed-off-by: Jaehoon Chung
    Signed-off-by: Ulf Hansson

    Jaehoon Chung
     
  • If card is polling or non-removable, display the more exact message.
    It's helpful to debug which detecting scheme is using.

    Signed-off-by: Jaehoon Chung
    Signed-off-by: Ulf Hansson

    Jaehoon Chung
     
  • Before checking flags, it has to check "present" variable.
    Otherwise, flags should be cleared everytime.

    Signed-off-by: Jaehoon Chung
    Signed-off-by: Ulf Hansson

    Jaehoon Chung
     
  • The commit 64997de4fd17 ("mmc: dw_mmc: remove system PM callback") is
    missing to call dw_mci_ctrl_reset(). This adds to call
    dw_mci_ctrl_reset() and to handle error of clocks.

    Signed-off-by: Joonyoung Shim
    Signed-off-by: Jaehoon Chung
    Signed-off-by: Ulf Hansson

    Joonyoung Shim
     
  • The dw_mmc-exynos should be RPM_ACTIVE on probe() to call suspend
    callback of runtime PM in pm_runtime_force_suspend() during first system
    suspend. Also call pm_runtime_get_noresume() on probe() because it
    doesn't call suspend/resume callback by runtime PM now.

    Signed-off-by: Joonyoung Shim
    Signed-off-by: Jaehoon Chung
    Signed-off-by: Ulf Hansson

    Joonyoung Shim
     
  • It is unnecessary to panic the kernel when testing mmc. Instead,
    cast a warning for folkz to debug and return the error code to
    the caller to indicate the failure of this test should be enough.

    Signed-off-by: Shawn Lin
    Signed-off-by: Ulf Hansson

    Shawn Lin
     
  • bounce_sg for mqrq_cur and mqrq_pre are proper
    allocated when initializing the queue and will not
    be freed before explicitly cleaning the queue. So from
    the code itself it should be quite confident to remove
    this check. If that BUG_ON take effects, it is mostly
    likely the memory is randomly oopsing.

    Signed-off-by: Shawn Lin
    Signed-off-by: Ulf Hansson

    Shawn Lin
     
  • The code seems quite simple to maintain the sdio_uart_table,
    and the insert/remove port from the table are symmetric. If
    the BUG_ON occurs, which means serial_core modify the index
    or mess up the port sequence anyway.

    Signed-off-by: Shawn Lin
    Signed-off-by: Ulf Hansson

    Shawn Lin
     
  • BUG_ONs doesn't help anything except for stop the system from
    running. If it occurs, it implies we should deploy proper error
    handling for that. So this patch is gonna discard these meaningless
    BUG_ONs and deploy error handling if needed.

    Signed-off-by: Shawn Lin
    Signed-off-by: Ulf Hansson

    Shawn Lin
     
  • BUG_ONs doesn't help anything except for stop the system from
    running. If it occurs, it implies we should deploy proper error
    handling for that. So this patch is gonna discard these meaningless
    BUG_ONs and deploy error handling if needed.

    Signed-off-by: Shawn Lin
    Signed-off-by: Ulf Hansson

    Shawn Lin