1. 25 7月, 2016 3 次提交
    • A
      mmc: sdhci: Tidy caps variables in sdhci_setup_host() · 28da3589
      Adrian Hunter 提交于
      In preparation for adding a function to read the capability registers.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      28da3589
    • A
      mmc: sdhci: Make signal voltage support explicit · 8cb851a4
      Adrian Hunter 提交于
      Signal voltage support is not a quirk, it is a capability. According to the
      SDHCI specification, support for 1.8V signaling is determined by the
      presence of one of the capability bits SDHCI_SUPPORT_SDR50,
      SDHCI_SUPPORT_SDR104, or SDHCI_SUPPORT_DDR50. This is complicated by also
      supporting eMMC which has 1.8V modes and 1.2V modes. It would be possible
      to use the transfer mode to determine signal voltage support, except for
      eMMC DDR52 mode which uses the same capability (MMC_CAP_1_8V_DDR) for 1.8V
      signaling and 3V signaling.
      
      In addition, the mmc core will fail over from one signaling voltage to the
      next (refer mmc_power_up()) which means SDHCI really needs to validate
      which voltages are actually supported.
      
      Introduce SDHCI flags for signal voltage support and set them based on the
      supported transfer modes. In general, drivers should prefer to set the
      supported transfer modes correctly rather than change the signal voltage
      capability, except in the case where 3V DDR52 is supported but 1.8V is
      not.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      8cb851a4
    • A
      mmc: sdhci: Split sdhci_add_host() · 52f5336d
      Adrian Hunter 提交于
      Split sdhci-add_host() in order to further our objective to make
      sdhci into a library.
      
      The split divides code that sets up mmc and sdhci parameters, from
      code that actually activates things - such as tasklet initialization,
      requesting the irq, and adding (and starting) the host.
      
      This gives drivers an opportunity to change various settings before
      committing to start the host.
      
      Drivers can continue to call sdhci_add_host() but drivers that want
      to take advantage of the split instead call sdhci_setup_host() followed
      by __sdhci_add_host().
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      52f5336d
  2. 02 5月, 2016 4 次提交
  3. 29 3月, 2016 1 次提交
    • A
      mmc: sdhci: Fix regression setting power on Trats2 board · 1dceb041
      Adrian Hunter 提交于
      Several commits relating to setting power have been introducing
      problems by putting driver-specific rules into generic SDHCI code.
      
      Krzysztof Kozlowski reported that after commit 918f4cbd ("mmc:
      sdhci: restore behavior when setting VDD via external regulator")
      on Trats2 board there are warnings for invalid VDD  value (2.8V):
      
      [    3.119656] ------------[ cut here ]------------
      [    3.119666] WARNING: CPU: 3 PID: 90 at
      ../drivers/mmc/host/sdhci.c:1234 sdhci_do_set_ios+0x4cc/0x5e0
      [    3.119669] mmc0: Invalid vdd 0x10
      [    3.119673] Modules linked in:
      [    3.119679] CPU: 3 PID: 90 Comm: kworker/3:1 Tainted: G        W
         4.5.0-next-20160324 #23
      [    3.119681] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      [    3.119690] Workqueue: events_freezable mmc_rescan
      [    3.119708] [<c010e0ac>] (unwind_backtrace) from [<c010ae10>]
      (show_stack+0x10/0x14)
      [    3.119719] [<c010ae10>] (show_stack) from [<c0323260>]
      (dump_stack+0x88/0x9c)
      [    3.119728] [<c0323260>] (dump_stack) from [<c011b754>] (__warn+0xe8/0x100)
      [    3.119734] [<c011b754>] (__warn) from [<c011b7a4>]
      (warn_slowpath_fmt+0x38/0x48)
      [    3.119740] [<c011b7a4>] (warn_slowpath_fmt) from [<c0527d28>]
      (sdhci_do_set_ios+0x4cc/0x5e0)
      [    3.119748] [<c0527d28>] (sdhci_do_set_ios) from [<c0528018>]
      (sdhci_runtime_resume_host+0x60/0x114)
      [    3.119758] [<c0528018>] (sdhci_runtime_resume_host) from
      [<c0402570>] (__rpm_callback+0x2c/0x60)
      [    3.119767] [<c0402570>] (__rpm_callback) from [<c04025c4>]
      (rpm_callback+0x20/0x80)
      [    3.119773] [<c04025c4>] (rpm_callback) from [<c04034b8>]
      (rpm_resume+0x36c/0x558)
      [    3.119780] [<c04034b8>] (rpm_resume) from [<c04036f0>]
      (__pm_runtime_resume+0x4c/0x64)
      [    3.119788] [<c04036f0>] (__pm_runtime_resume) from [<c0512728>]
      (__mmc_claim_host+0x170/0x1b0)
      [    3.119795] [<c0512728>] (__mmc_claim_host) from [<c0514e2c>]
      (mmc_rescan+0x54/0x348)
      [    3.119807] [<c0514e2c>] (mmc_rescan) from [<c0130dac>]
      (process_one_work+0x120/0x3f4)
      [    3.119815] [<c0130dac>] (process_one_work) from [<c01310b8>]
      (worker_thread+0x38/0x554)
      [    3.119823] [<c01310b8>] (worker_thread) from [<c01365a4>]
      (kthread+0xdc/0xf4)
      [    3.119831] [<c01365a4>] (kthread) from [<c0107878>]
      (ret_from_fork+0x14/0x3c)
      [    3.119834] ---[ end trace a22d652aa3276886 ]---
      
      Fix by adding a 'set_power' callback and restoring the default
      behaviour prior to commit 918f4cbd ("mmc: sdhci: restore
      behavior when setting VDD via external regulator").  The desired
      behaviour of that commit is gotten by having sdhci-pxav3 provide
      its own set_power callback.
      Reported-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Link: http://lkml.kernel.org/r/CAJKOXPcGDnPm-Ykh6wHqV1YxfTaov5E8iVqBoBn4OJc7BnhgEQ@mail.gmail.com
      Fixes: 918f4cbd ("mmc: sdhci: restore behavior when setting VDD...)
      Tested-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Tested-by: NLudovic Desroches <ludovic.desroches@atmel.com>
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org # v4.5+
      Reviewed-by: NJisheng Zhang <jszhang@marvell.com>
      Tested-by: NJisheng Zhang <jszhang@marvell.com>
      Tested-by: NJaehoon Chung <jh80.chung@samsung.com>
      Tested-by: NAnand Moon <linux.amoon@gmail.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      1dceb041
  4. 29 2月, 2016 1 次提交
    • R
      mmc: sdhci: clean up host cookie handling · 94538e51
      Russell King 提交于
      Commit d31911b9 ("mmc: sdhci: fix dma memory leak in sdhci_pre_req()")
      added a complicated method to manage the DMA map state for the data
      transfer, but this complexity is not required.
      
      There are three states:
      * Unmapped
      * Mapped by sdhci_pre_req()
      * Mapped by sdhci_prepare_data()
      
      sdhci_prepare_data() needs to know when the data buffers have been
      successfully mapped by sdhci_pre_req(), and if so, there is no need to
      map them a second time.
      
      When we come to tear down the mapping, we want to know whether
      sdhci_post_req() will be called (which is determined by sdhci_pre_req()
      having been previously called) so that we can postpone the unmap
      operation.
      
      Hence, it makes sense to simply record when the successful DMA map
      happened (via COOKIE_PRE_MAPPED vs COOKIE_MAPPED) rather than having
      the complex mechanics involving COOKIE_MAPPED vs COOKIE_GIVEN.
      
      If a mapping is created by sdhci_prepare_data(), we must tear it down
      ourselves, without waiting for sdhci_post_req() (hence, the new
      COOKIE_MAPPED case).  If the mapping is created by sdhci_pre_req()
      then sdhci_post_req() is responsible for tearing the mapping down.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NGregory CLEMENT <gregory.clement@free-electrons.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      94538e51
  5. 11 2月, 2016 1 次提交
    • A
      mmc: sdhci: Allow override of mmc host operations · bf60e592
      Adrian Hunter 提交于
      In the past, fixes for specific hardware devices were implemented
      in sdhci using quirks.  That approach is no longer accepted because
      the growing number of quirks was starting to make the code difficult
      to understand and maintain.
      
      One alternative to quirks, is to allow drivers to override the default
      mmc host operations.  This patch makes it easy to do that, and it is
      needed for a subsequent bug fix, for which separate patches are
      provided.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org # v4.4+
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      bf60e592
  6. 22 12月, 2015 1 次提交
    • A
      mmc: sdhci: 64-bit DMA actually has 4-byte alignment · 04a5ae6f
      Adrian Hunter 提交于
      The version 3.00 SDHCI spec. was a bit unclear about the
      required data alignment for 64-bit DMA, whereas the version
      4.10 spec. uses different language and indicates that only
      4-byte alignment is required rather than the 8-byte alignment
      currently implemented.  That make no difference to SD and EMMC
      which invariably transfer data in sector-aligned blocks.
      However with SDIO, it results in using more DMA descriptors
      than necessary.  Theoretically that slows DMA slightly although
      DMA is not the limiting factor for throughput, so there is no
      discernable impact on performance.  Nevertheless, the driver
      should follw the spec unless there is good reason not to, so
      this patch corrects the alignment criterion.
      
      There is a more complicated criterion for the DMA descriptor
      table itself.  However the table is allocated by dma_alloc_coherent()
      which allocates pages (i.e. aligned to a page boundary).
      For simplicity just check it is 8-byte aligned, but add a comment
      that some Intel controllers actually require 8-byte alignment
      even when using 32-bit DMA.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      04a5ae6f
  7. 09 10月, 2015 1 次提交
  8. 27 8月, 2015 1 次提交
    • H
      mmc: sdhci: fix dma memory leak in sdhci_pre_req() · d31911b9
      Haibo Chen 提交于
      Currently one mrq->data maybe execute dma_map_sg() twice
      when mmc subsystem prepare over one new request, and the
      following log show up:
      	sdhci[sdhci_pre_dma_transfer] invalid cookie: 24, next-cookie 25
      
      In this condition, mrq->date map a dma-memory(1) in sdhci_pre_req
      for the first time, and map another dma-memory(2) in sdhci_prepare_data
      for the second time. But driver only unmap the dma-memory(2), and
      dma-memory(1) never unmapped, which cause the dma memory leak issue.
      
      This patch use another method to map the dma memory for the mrq->data
      which can fix this dma memory leak issue.
      
      Fixes: 348487cb ("mmc: sdhci: use pipeline mmc requests to improve performance")
      Reported-and-tested-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NHaibo Chen <haibo.chen@freescale.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      d31911b9
  9. 17 8月, 2015 1 次提交
  10. 01 6月, 2015 2 次提交
  11. 23 3月, 2015 1 次提交
  12. 20 1月, 2015 1 次提交
  13. 05 12月, 2014 1 次提交
  14. 26 11月, 2014 2 次提交
    • A
      mmc: sdhci: Add HS400 support to SDHCI driver · e9fb05d5
      Adrian Hunter 提交于
      MMC core already has support for HS400.  Add HS400
      support to SDHCI driver.  The SDHC Standard specification
      does not define HS400 so consequently HS400 support is
      non-standard.  However HS400 is not selected without
      the host controller setting the corresponding capability
      flags so host controllers not yet supporting HS400
      will not be affected.  To support that, a quirk
      SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400 is introduced to
      enable the use of capabilities register reserved bit-63
      to indicate HS400 support.
      
      Because HS400 is non-standard for SDHCI, it is possible
      that different vendors will do things in different ways.
      However HS200 support faced the same issue but currently
      there is only one solution.  As such, no attempt has
      been made to provide for alternate HS400 solutions except
      for SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      e9fb05d5
    • A
      mmc: sdhci: Remove unused SDHCI_CTRL_HS_SDR200 · 04834a78
      Adrian Hunter 提交于
      SDHCI_CTRL_HS_SDR200 is unused.  Remove it.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      04834a78
  15. 10 11月, 2014 4 次提交
  16. 24 9月, 2014 1 次提交
  17. 09 9月, 2014 2 次提交
  18. 22 5月, 2014 7 次提交
  19. 26 9月, 2013 2 次提交
  20. 06 7月, 2013 1 次提交
  21. 25 2月, 2013 2 次提交
    • K
      mmc: sdhci: enhance preset value function · 52983382
      Kevin Liu 提交于
      4d55c5a1 ("mmc: sdhci: enable preset value after uhs initialization")
      added preset value support and enabled it by default during sd card init.
      
      Below are the enhancements introduced by this patch:
      
      1. In current code, preset value is enabled after setting clock finished,
      which means the clock is manually set by driver firstly and then suddenly
      switched to preset value at this point. So the first setting is useless
      and unnecessary. What's more, the first clock setting may differ from the
      preset one.  The better way is enable preset value just after switch to
      UHS mode so the preset value can take effect immediately. So move preset
      value enable from mmc_sd_init_card to sdhci_set_ios which will be called
      during set timing.
      
      2. In current code, preset value is disabled at the beginning of
      mmc_attach_sd.  It's too late since low freq (400khz) should be set in
      mmc_power_up.  So move preset value disable to sdhci_set_ios which will
      be called during power up.
      
      3. host->clock and ios->drv_type should also be updated according to the
      preset value if it's enabled. Current code missed this.
      
      4. This patch also introduce a quirk to disable preset value in case
      preset value doesn't work.
      
      This patch has been verified on sdhci-pxav3 platform with both preset
      enabled and disabled.
      Signed-off-by: NKevin Liu <kliu5@marvell.com>
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NChris Ball <cjb@laptop.org>
      52983382
    • S
      mmc: sdhci: rename platform_8bit_width to platform_bus_width · 7bc088d3
      Sascha Hauer 提交于
      The 8bit in the function name is misleading. When set, it will be
      used to set the bus width, regardless of whether 8bit or another
      bus width is requested, so change the function name to
      platform_bus_width.
      Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de>
      Signed-off-by: NShawn Guo <shawn.guo@linaro.org>
      Tested-by: NDirk Behme <dirk.behme@de.bosch.com>
      Signed-off-by: NChris Ball <cjb@laptop.org>
      7bc088d3