1. 13 2月, 2017 3 次提交
  2. 16 1月, 2017 1 次提交
  3. 25 12月, 2016 1 次提交
  4. 21 12月, 2016 1 次提交
    • P
      mmc: sd: Meet alignment requirements for raw_ssr DMA · e85baa88
      Paul Burton 提交于
      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: NPaul Burton <paul.burton@imgtec.com>
      Fixes: 5275a652 ("mmc: sd: Export SD Status via “ssr” device attribute")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      e85baa88
  5. 20 12月, 2016 1 次提交
    • A
      mmc: core: Further fix thread wake-up · 15520111
      Adrian Hunter 提交于
      Commit e0097cf5 ("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: e0097cf5 ("mmc: queue: Fix queue thread wake-up")
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NHarjani Ritesh <riteshh@codeaurora.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      15520111
  6. 12 12月, 2016 1 次提交
    • U
      mmc: block: Move files to core · f397c8d8
      Ulf Hansson 提交于
      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: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
      f397c8d8
  7. 05 12月, 2016 9 次提交
  8. 29 11月, 2016 15 次提交
  9. 07 11月, 2016 1 次提交
    • U
      mmc: mmc: Use 500ms as the default generic CMD6 timeout · fe1b5700
      Ulf Hansson 提交于
      In the eMMC 4.51 version of the spec, an EXT_CSD field called
      GENERIC_CMD6_TIME[248] was added. This allows cards to specify the maximum
      time it may need to move out from its busy state, when a CMD6 command has
      been sent.
      
      In cases when the card is compliant to versions < 4.51 of the eMMC spec,
      obviously the core needs to use a fall-back value for this timeout, which
      currently is set to 10 minutes. This value is completely in the wrong range
      and importantly in some cases it causes a card initialization to take more
      than 10 minute to complete.
      
      Earlier this scenario was avoided as the mmc core used CMD13 to poll the
      card, to find out when it stopped signaling busy. Commit 08573eaf
      ("mmc: mmc: do not use CMD13 to get status after speed mode switch")
      changed this behavior.
      
      Instead of reverting that commit, which would cause other issues, let's
      instead start by picking a simple solution for the problem, by using a
      500ms default generic CMD6 timeout.
      
      The reason for using exactly 500ms, comes from observations that shows it's
      quite common for cards to specify 250ms. 500ms is two times that value so
      likely it should be enough for most cards.
      
      Cc: <stable@vger.kernel.org> # v4.8+
      Fixes: 08573eaf ("mmc: mmc: do not use CMD13 to get status after speed
      mode switch")
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Tested-by: NStephen Boyd <sboyd@codeaurora.org>
      Tested-by: NLinus Walleij <linus.walleij@linaro.org>
      fe1b5700
  10. 10 10月, 2016 2 次提交
  11. 27 9月, 2016 5 次提交
    • Z
      mmc: core: don't try to switch block size for dual rate mode · 1712c937
      Ziyuan Xu 提交于
      Per spec, block size should always be 512 bytes for dual rate mode,
      so any attempts to switch the block size under dual rate mode should
      be neglected.
      Signed-off-by: NZiyuan Xu <xzy.xu@rock-chips.com>
      Signed-off-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      1712c937
    • A
      mmc: core: Add support for sending commands during data transfer · 5163af5a
      Adrian Hunter 提交于
      A host controller driver exposes its capability using caps flag
      MMC_CAP_CMD_DURING_TFR. A driver with that capability can accept requests
      that are marked mrq->cap_cmd_during_tfr = true. Then the driver informs the
      upper layers when the command line is available for further commands by
      calling mmc_command_done(). Because of that, the driver will not then
      automatically send STOP commands, and it is the responsibility of the upper
      layer to send a STOP command if it is required.
      
      For requests submitted through the mmc_wait_for_req() interface, the caller
      sets mrq->cap_cmd_during_tfr = true which causes mmc_wait_for_req() in fact
      not to wait. The caller can then send commands that do not use the data
      lines. Finally the caller can wait for the transfer to complete by calling
      mmc_wait_for_req_done() which is now exported.
      
      For requests submitted through the mmc_start_req() interface, the caller
      again sets mrq->cap_cmd_during_tfr = true, but mmc_start_req() anyway does
      not wait. The caller can then send commands that do not use the data
      lines. Finally the caller can wait for the transfer to complete in the
      normal way i.e. calling mmc_start_req() again.
      
      Irrespective of how a cap_cmd_during_tfr request is started,
      mmc_is_req_done() can be called if the upper layer needs to determine if
      the request is done. However the appropriate waiting function (either
      mmc_wait_for_req_done() or mmc_start_req()) must still be called.
      
      The implementation consists primarily of a new completion
      mrq->cmd_completion which notifies when the command line is available for
      further commands. That completion is completed by mmc_command_done().
      When there is an ongoing data transfer, calls to mmc_wait_for_req() will
      automatically wait on that completion, so the caller does not have to do
      anything special.
      
      Note, in the case of errors, the driver may call mmc_request_done() without
      calling mmc_command_done() because mmc_request_done() always calls
      mmc_command_done().
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      5163af5a
    • B
      mmc: core: Optimize the mmc erase size alignment · 6c689886
      Baolin Wang 提交于
      In most cases the 'card->erase_size' is power of 2, then the round_up/down()
      function is more efficient than '%' operation when the 'card->erase_size' is
      power of 2.
      Signed-off-by: NBaolin Wang <baolin.wang@linaro.org>
      Tested-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      6c689886
    • B
      mmc: core: Factor out the alignment of erase size · 71085123
      Baolin Wang 提交于
      In order to clean up the mmc_erase() function and do some optimization
      for erase size alignment, factor out the guts of erase size alignment
      into mmc_align_erase_size() function.
      Signed-off-by: NBaolin Wang <baolin.wang@linaro.org>
      Tested-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      71085123
    • U
      mmc: core: Use a default maximum erase timeout · 12182aff
      Ulf Hansson 提交于
      In cases when the host->max_busy_timeout isn't specified, the calculated
      number of maximum discard sectors defaults to UINT_MAX. This may cause a
      too long timeout for a discard request.
      
      Avoid this by using a default maximum erase timeout of 60s, used when we
      calculate the maximum number of sectors that are allowed to be discarded
      per request.
      
      Do note that the minimum number of sectors to be discarded is still at
      least one "preferred erase size".
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NShawn Lin <shawn.lin@rock-chips.com>
      12182aff