1. 29 11月, 2016 14 次提交
  2. 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
  3. 10 10月, 2016 2 次提交
  4. 27 9月, 2016 9 次提交
    • 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
    • S
      mmc: sdio: deploy error handling instead of triggering BUG_ON · 923dff87
      Shawn Lin 提交于
      When using mmc_io_rw_extended, it's intent to avoid null
      pointer of card and invalid func number. But actually it
      didn't prevent that as the seg_size already use the card.
      Currently the wrapper function sdio_io_rw_ext_helper already
      use card before calling mmc_io_rw_extended, so we should move
      this check to there. As to the func number, it was token from
      '(ocr & 0x70000000) >> 28' which should be enough to guarantee
      that it won't be larger than 7. But we should prevent the
      caller like wifi drivers modify this value. So let's move this
      check into sdio_io_rw_ext_helper either.
      
      Also we remove the BUG_ON for mmc_send_io_op_cond since all
      possible paths calling this function are protected by checking
      the arguments in advance. After deploying these changes, we
      could not see any panic within SDIO API even if func drivers
      abuse the SDIO func APIs.
      Signed-off-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      923dff87
    • J
      mmc: core: Add error message when switching fails in mmc_select_hs() · 67d35960
      Jungseung Lee 提交于
      The switch failure message in mmc_select_timing() had been removed
      since that is invalid: commit 0400ed0a ("mmc: core: remove the
      invalid message in mmc_select_timing")
      
      Now, in the case when mmc_select_hs() return error in mmc_select_timing(),
      there is nothing to print failure message.
      Let's make for mmc_select_hs() print message itself in the failure case.
      Signed-off-by: NJungseung Lee <js07.lee@samsung.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      67d35960
    • U
      mmc: sd: Export SD Status via “ssr” device attribute · 5275a652
      Uri Yanai 提交于
      The SD Status register contains several important fields related to the
      SD Card proprietary features.
      Those fields may be used by user space applications for vendor specific
      usage.
      None of those fields are exported today by the driver to user space.
      In this patch, we are reading the SD Status register and exporting
      (using MMC_DEV_ATTR) the SD Status register to the user space.
      Signed-off-by: NUri Yanai <uri.yanai@sandisk.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      5275a652
    • H
      mmc: pwrseq-simple: Add an optional post-power-on-delay · 721e0497
      Hans de Goede 提交于
      Some devices need a while to boot their firmware after providing clks /
      de-asserting resets before they are ready to receive sdio commands.
      
      This commits adds a post-power-on-delay-ms devicetree property to
      mmc-pwrseq-simple for use with such devices.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      721e0497
  5. 25 7月, 2016 14 次提交