1. 01 8月, 2018 1 次提交
  2. 16 7月, 2018 3 次提交
    • U
      mmc: core: Drop the unused mmc_power_save|restore_host() · 29772f8a
      Ulf Hansson 提交于
      The last user of mmc_power_save|restore_host() APIs is gone, hence let's
      drop them. Drop also the corresponding bus_ops callback,
      ->power_save|restore() as those becomes redundant.
      
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Eyal Reizer <eyalreizer@gmail.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      29772f8a
    • S
      mmc: core: more fine-grained hooks for HS400 tuning · ba6c7ac3
      Simon Horman 提交于
      This adds two new HS400 tuning operations:
      * hs400_downgrade
      * hs400_complete
      
      These supplement the existing HS400 operation:
      * prepare_hs400_tuning
      
      This is motivated by a requirement of Renesas SDHI for the following:
      1. Disabling SCC before selecting to HS if selection of HS400 has occurred.
         This can be done in an implementation of prepare_hs400_tuning_downgrade
      2. Updating registers after switching to HS400
         This can be done in an implementation of complete_hs400_tuning
      
      If hs400_downgrade or hs400_complete are not implemented then they are not
      called. Thus means there should be no affect for existing drivers as none
      implemt these ops.
      Signed-off-by: NSimon Horman <horms+renesas@verge.net.au>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      ba6c7ac3
    • S
      mmc: core: Adjust and reuse the macro of R1_STATUS(x) · a94a7483
      Shawn Lin 提交于
      R1_STATUS(x) now is only used by ioctl_rpmb_card_status_poll(),
      which checks all bits as possible. But according to the spec,
      bit 17 and bit 18 should be ignored, as well bit 14 which is
      reserved(must be set to 0) quoting from the spec and these rule
      apply to all places checking the device status. So change
      its checking from 0xFFFFE000 to 0xFFF9A000.
      
      As a bonus, we reuse it for mmc_do_erase() as well as
      mmc_switch_status_error().
      (1) Currently mmc_switch_status_error() doesn't check bit 25, but
      it means device is locked but not unlocked by CMD42 prior to any
      operations which need check busy, which is also not allowed.
      (2) mmc_do_erase() also forgot to to check bit 15, WP_ERASE_SKIP.
      The spec says "Only partial address space was erased due to existing
      write protected blocks.", which obviously means we should fail this I/O.
      Otherwise, the partial erased data stored in nonvalatile flash violates
      the data integrity from the view of I/O owner, which probably confuse
      it when further used.
      
      So reusing R1_STATUS for them not only improve the readability but also
      slove real problems.
      Signed-off-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      a94a7483
  3. 03 7月, 2018 1 次提交
    • A
      mmc: core: cd_label must be last entry of mmc_gpio struct · 60feca8f
      Anson Huang 提交于
      commit bfd694d5 ("mmc: core: Add tunable delay
      before detecting card after card is inserted") adds
      "u32 cd_debounce_delay_ms" to the last of mmc_gpio
      struct and cause "char cd_label[0]" NOT work as string
      pointer of card detect label, when "cat /proc/interrupts",
      the devname for card detect gpio is incorrect as below:
      
      144:          0  gpio-mxc  22 Edge      ▒
      161:          0  gpio-mxc   7 Edge      ▒
      
      Move the cd_label field down to fix this, and drop the
      zero from the array size to prevent future similar bugs,
      the result is correct as below:
      
      144:          0  gpio-mxc  22 Edge      2198000.mmc cd
      161:          0  gpio-mxc   7 Edge      2190000.mmc cd
      
      Fixes: bfd694d5 ("mmc: core: Add tunable delay before detecting card after card is inserted")
      Signed-off-by: NAnson Huang <Anson.Huang@nxp.com>
      Tested-by: NFabio Estevam <fabio.estevam@nxp.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      60feca8f
  4. 29 5月, 2018 4 次提交
    • C
      mmc: complete requests from ->timeout · ad73d6fe
      Christoph Hellwig 提交于
      By completing the request entirely in the driver we can remove the
      BLK_EH_HANDLED return value and thus the split responsibility between the
      driver and the block layer that has been causing trouble.
      
      [While this keeps existing behavior it seems to mismatch the comment,
       maintainers please chime in!]
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      ad73d6fe
    • M
      mmc: Throttle calls to MMC_SEND_STATUS during mmc_do_erase() · 833b5117
      Martin Hicks 提交于
      This drastically reduces the rate at which the MMC_SEND_STATUS cmd polls
      for completion of the MMC Erase operation.  The patch does this by adding
      a backoff sleep that starts by sleeping for short intervals (128-256us),
      and ramps up to sleeping for 32-64ms.
      
      Even on very quickly completing erase operations, the loop iterates a few
      times, so not too much extra latency is added to these commands.
      
      For long running discard operarations, like a full-device secure discard,
      this change drops the interrupt rates on my single-core NXP I.MX6UL from
      45000/s to about 20/s, and greatly improves system responsiveness.
      Signed-off-by: NMartin Hicks <mort@bork.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      833b5117
    • E
      mmc: Allow non-sleeping GPIO cd · 52af318c
      Evan Green 提交于
      This change uses the appropriate _cansleep or non-sleeping API for
      reading GPIO card detect state. This allows users with GPIOs that
      never sleep to avoid a warning when certain quirks are present.
      
      The sdhci controller has an SDHCI_QUIRK_NO_CARD_NO_RESET, which
      indicates that a controller will not reset properly if no card is
      inserted. With this quirk enabled, mmc_get_cd_gpio is called in
      several places with a spinlock held and interrupts disabled.
      gpiod_get_raw_value_cansleep is not happy with this situation,
      and throws out a warning.
      
      For boards that a) use controllers that have this quirk, and b) wire
      card detect up to a GPIO that doesn't sleep, this is a spurious warning.
      This change silences that warning, at the cost of pushing this problem
      down to users that have sleeping GPIOs and controllers with this quirk.
      Signed-off-by: NEvan Green <evgreen@chromium.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      52af318c
    • U
      mmc: core: Move calls to ->prepare_hs400_tuning() closer to mmc code · c8a4e30d
      Ulf Hansson 提交于
      Move the calls to ->prepare_hs400_tuning(), from mmc_retune() into
      mmc_hs400_to_hs200(), as it better belongs there, rather than being generic
      to all type of cards.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NSimon Horman <horms+renesas@verge.net.au>
      c8a4e30d
  5. 21 5月, 2018 3 次提交
    • S
      mmc: block: Don't switch to the same partition type in mmc_blk_remove() · 65f9e20e
      Shawn Lin 提交于
      It's pointless to switch and trace partition type if the current
      selected device partition is the same with that one. Moreover, cycled
      claiming host associated with mmc_blk_part_switch() could make
      mmc_blk_remove() end up waiting for grabbing the context if it's
      occupied, which lead requests could still hit the low-level drivers,
      if an asynchronous unbind for host drivers happened, as the card hasn't
      been set removed in the remove path.
      
      So a simple dd in background:
      dd if=/dev/mmcblk0 of=/dev/null bs=512k count=100000 &
      
      and doing unbind then:
      echo fe320000.dwmmc > /sys/bus/platform/drivers/dwmmc_rockchip/unbind
      
      could make the console stuck for quite a while depending on the
      numbers of requests.
      Suggested-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      65f9e20e
    • M
      mmc: block: propagate correct returned value in mmc_rpmb_ioctl · b25b750d
      Mathieu Malaterre 提交于
      In commit 97548575 ("mmc: block: Convert RPMB to a character device") a
      new function `mmc_rpmb_ioctl` was added. The final return is simply
      returning a value of `0` instead of propagating the correct return code.
      
      Discovered during a compilation with W=1, silence the following gcc warning
      
      drivers/mmc/core/block.c:2470:6: warning: variable ‘ret’ set but not used
      [-Wunused-but-set-variable]
      Signed-off-by: NMathieu Malaterre <malat@debian.org>
      Reviewed-by: NShawn Lin <shawn.lin@rock-chips.com>
      Fixes: 97548575 ("mmc: block: Convert RPMB to a character device")
      Cc: stable@vger.kernel.org # v4.15+
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      b25b750d
    • S
      mmc: core: add tunable delay waiting for power to be stable · 6d796c68
      Shawn Lin 提交于
      The hard-coded 10ms delay in mmc_power_up came from
      commit 79bccc5a ("mmc: increase power up delay"), which said "The TI
      controller on Toshiba Tecra M5 needs more time to power up or the cards
      will init incorrectly or not at all." But it's too engineering solution
      for a special board but force all platforms to wait for that long time,
      especially painful for mmc_power_up for eMMC when booting.
      
      However, it's added since 2009, and we can't tell if other platforms
      benefit from it. But in practise, the modern hardware are most likely to
      have a stable power supply with 1ms after setting it for no matter PMIC
      or discrete power. And more importnatly, most regulators implement the
      callback of ->set_voltage_time_sel() for regulator core to wait for
      specific period of time for the power supply to be stable, which means
      once regulator_set_voltage_* return, the power should reach the the
      minimum voltage that works for initialization. Of course, if there
      are some other ways for host to power the card, we should allow them
      to argue a suitable delay as well.
      
      With this patch, we could assign the delay from firmware, or we could
      assigne it via ->set_ios() callback from host drivers.
      Signed-off-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      6d796c68
  6. 16 5月, 2018 1 次提交
  7. 15 5月, 2018 1 次提交
  8. 14 5月, 2018 1 次提交
  9. 08 5月, 2018 6 次提交
  10. 03 5月, 2018 1 次提交
  11. 02 5月, 2018 5 次提交
  12. 04 4月, 2018 1 次提交
  13. 23 3月, 2018 1 次提交
    • S
      mmc: block: Delete gendisk before cleaning up the request queue · 57678e5a
      Shawn Lin 提交于
      dd if=/dev/urandom of=/dev/mmcblk1 bs=4k count=10000
      with a SD card hotplug during transfer reports a warning below
      introduced by commit a063057d ("block: Fix a race between
      request queue removal and the block cgroup controller"). So we
      should now remove the disk, partition and bdi sysfs attributes
      before cleaning up the request queue associated with the disk.
      
      [  410.331226] mmc1: card 59b4 removed
      [  410.348583] WARNING: CPU: 0 PID: 5 at block/blk-core.c:785
      blk_cleanup_queue+0x138/0x140
      [  410.349294] Modules linked in:
      [  410.349570] CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted
      4.16.0-rc6-next-20180321-00004-gc2ad6a7 #263
      [  410.350363] Hardware name: Excavator-RK3399 Board (DT)
      [  410.350819] Workqueue: events_freezable mmc_rescan
      [  410.351242] pstate: 60000005 (nZCv daif -PAN -UAO)
      [  410.351663] pc : blk_cleanup_queue+0x138/0x140
      [  410.352054] lr : blk_cleanup_queue+0xac/0x140
      [  410.352436] sp : ffff0000092cbb90
      [  410.352727] x29: ffff0000092cbb90 x28: 0000000000000000
      [  410.353195] x27: ffff8000f6f23030 x26: ffff00000904e610
      [  410.353662] x25: ffff8000f17cc808 x24: ffff8000f1038200
      [  410.354128] x23: 0000000000000060 x22: 0000000000000000
      [  410.354595] x21: ffff8000f11748d8 x20: ffff8000f1038200
      [  410.355061] x19: ffff8000f1174200 x18: 0000ffff936347d8
      [  410.355528] x17: 0000ffff935b93c0 x16: ffff0000081263f8
      [  410.355994] x15: 0000000000000000 x14: 0000000000000400
      [  410.356461] x13: 0000000000000001 x12: 0000000000000001
      [  410.356927] x11: 0000000000000040 x10: ffff8000f2400028
      [  410.357393] x9 : ffff8000f2400040 x8 : 0000000000000000
      [  410.357860] x7 : ffff8000f6f3a340 x6 : ffff8000f6f3a340
      [  410.358326] x5 : ffff8000f2400000 x4 : ffff8000f6f3a340
      [  410.358792] x3 : 0000000000000000 x2 : 39c1333e45670800
      [  410.359259] x1 : 0000000000000000 x0 : 0000000000000003
      [  410.359726] Call trace:
      [  410.359943]  blk_cleanup_queue+0x138/0x140
      [  410.360305]  mmc_cleanup_queue+0x2c/0x48
      [  410.360652]  mmc_blk_remove_req+0x1c/0x98
      [  410.361005]  mmc_blk_remove+0x180/0x1c0
      [  410.361343]  mmc_bus_remove+0x1c/0x28
      [  410.361670]  device_release_driver_internal+0x154/0x1f0
      [  410.362128]  device_release_driver+0x14/0x20
      [  410.362504]  bus_remove_device+0xc8/0x108
      [  410.362858]  device_del+0x120/0x350
      [  410.363167]  mmc_remove_card+0x5c/0xb8
      [  410.363498]  mmc_sd_detect+0x40/0x78
      [  410.363813]  mmc_rescan+0x19c/0x368
      [  410.364123]  process_one_work+0x1ac/0x318
      [  410.364477]  worker_thread+0x50/0x450
      [  410.364801]  kthread+0xf8/0x128
      [  410.365081]  ret_from_fork+0x10/0x18
      [  410.365395] ---[ end trace 268e87a46c28968c ]---
      Reviewed-by: NBart Van Assche <bart.vanassche@wdc.com>
      Signed-off-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      57678e5a
  14. 22 3月, 2018 2 次提交
  15. 15 3月, 2018 9 次提交