1. 29 Sep, 2014 1 commit
  2. 24 Sep, 2014 2 commits
  3. 09 Sep, 2014 3 commits
    • Chuanxiao Dong's avatar
      mmc: core: resolve divded by zero panic · cc8aa7de
      Chuanxiao Dong authored
      With one special SD card, below divide by zero error observed:
      ...
      [    2.144300] divide error: 0000 [#1] PREEMPT SMP
      [    2.148860] Modules linked in:
      [    2.151898]
      [    2.152685] Set up 4031 stolen pages starting at 0x0001f000, GTT offset 0K
      [    2.157330] Set up 0 CI stolen pages starting at 0x00000000, GTT offset 131072K
      [    2.167581] Pid: 5, comm: kworker/u:0 Not tainted 3.0.8-138216-g974a2aba #1
      [    2.169506] [drm] PSB GTT mem manager ready, tt_start 4031, tt_size 28737 pages
      [    2.169906] [drm] SGX core id = 0x00000000
      [    2.169920] [drm] SGX core rev major = 0x00, minor = 0x00
      [    2.169934] [drm] SGX core rev maintenance = 0x00, designer = 0x00
      [    2.197370]  Intel Corporation Medfield/iCDKB
      [    2.201716] EIP: 0060:[<c1697ca6>] EFLAGS: 00010246 CPU: 1
      [    2.207198] EIP is at mmc_init_erase+0x76/0x150
      [    2.211704] EAX: 00002000 EBX: dcd1b400 ECX: 00002000 EDX: 00000000
      [    2.217957] ESI: 00000000 EDI: dcd5c800 EBP: dd867e84 ESP: dd867e7c
      [    2.224214]  DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
      [    2.229605] Process kworker/u:0 (pid: 5, ti=dd866000 task=dd868000 task.ti=dd866000)
      [    2.237325] Stack:
      [    2.239322]  dcd1b400 00000000 dd867eb0 c16a06da c1ab7c44 dd995aa8 00000003 00000000
      [    2.247054]  00000000 00000000 dcd5c800 00000000 dcd1b400 dd867ef8 c16a1012 c1698b00
      [    2.254785]  00000029 00000001 c194eb80 dcd5c9ec dd867e00 c1239b00 00000000 00000000
      [    2.262519] Call Trace:
      [    2.264975]  [<c16a06da>] mmc_sd_setup_card+0x1da/0x4f0
      [    2.270183]  [<c16a1012>] mmc_sd_init_card+0x192/0xc40
      [    2.275304]  [<c1698b00>] ? __mmc_claim_host+0x160/0x160
      [    2.280610]  [<c1239b00>] ? __schedule_bug+0x50/0x80
      [    2.285556]  [<c16a1b89>] mmc_attach_sd+0xc9/0x230
      [    2.290333]  [<c169b6ef>] mmc_rescan+0x25f/0x2c0
      [    2.294943]  [<c1274223>] process_one_work+0x103/0x400
      [    2.300065]  [<c12670fd>] ? mod_timer+0x1ad/0x3c0
      [    2.304756]  [<c169b490>] ? mmc_suspend_host+0x1a0/0x1a0
      [    2.310056]  [<c127502d>] worker_thread+0x12d/0x4a0
      [    2.314921]  [<c18fcfbd>] ? preempt_schedule+0x2d/0x50
      [    2.320047]  [<c1274f00[    2.323976] ---[ end trace 5398ec2720494438 ]---
      ...
      
      So, seems this bad SD card does not set valid value in related SSR / CSD register fields.
      And then the driver will set card->erase_size to 0.
      Then it triggered this divided by zero error when calculate card->pref_erase.
      
      Submit this patch to fix the issue.
      Signed-off-by: default avatarYunpeng Gao <yunpeng.gao@intel.com>
      Signed-off-by: default avatarChuanxiao Dong <chuanxiao.dong@intel.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      cc8aa7de
    • Javier Martinez Canillas's avatar
      mmc: core: Use regulator_get_voltage() if OCR mask is empty. · 9ed7ca89
      Javier Martinez Canillas authored
      The operation conditions register (OCR) stores the voltage
      profile of the card, however the list of possible voltages
      is restricted by the voltage range supported by the supply
      used as VCC/VDD. So in mmc_vddrange_to_ocrmask() a OCR mask
      is obtained to filter the not supported voltages, from the
      value read in the host controller OCR register.
      
      For fixed regulators, regulator_list_voltage() returns the
      fixed output for the first selector but this doesn't happen
      for switch (FET) regulators that obtain their voltage from
      their parent supply. A call to regulator_get_voltage() is
      needed in this case so the regulator core can return the
      FET's parent supply voltage output.
      
      This change is consistent with the fact that for other
      fixed regulators (that are not FETs) the OCR mask is
      returned even when mmc_regulator_set_ocr() checks if the
      regulator is fixed before calling regulator_set_voltage().
      
      Without this patch, the following warning is reported when
      a FET is used as a vmmc-supply:
      
      dwmmc_exynos 12220000.mmc: Failed getting OCR mask: -22
      Signed-off-by: default avatarJavier Martinez Canillas <javier.martinez@collabora.co.uk>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      9ed7ca89
    • Tim Kryger's avatar
      mmc: core: Remove fixed voltage regulator logic · ca6429d4
      Tim Kryger authored
      There is no need for regulator consumers to include special logic for
      fixed voltage regulators as they support regulator_set_voltage() just
      like their non-fixed regulator counterparts.
      Signed-off-by: default avatarTim Kryger <tim.kryger@gmail.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      ca6429d4
  4. 26 Jul, 2014 1 commit
  5. 12 May, 2014 3 commits
  6. 22 Apr, 2014 2 commits
    • Stefan Wahren's avatar
      mmc: core: Use maximum timeout values in case TACC field is zero · f7bf11a3
      Stefan Wahren authored
      When plugging a specific micro SD card at MMC socket of a custom i.MX28 board,
      we get the following kernel warning:
      
      WARNING: CPU: 0 PID: 30 at drivers/mmc/host/mxs-mmc.c:342 mxs_mmc_start_cmd+0x34c/0x378()
      Modules linked in:
      CPU: 0 PID: 30 Comm: kworker/u2:1 Not tainted 3.14.0-rc5 #8
      Workqueue: kmmcd mmc_rescan
      [<c0015420>] (unwind_backtrace) from [<c0012cb0>] (show_stack+0x10/0x14)
      [<c0012cb0>] (show_stack) from [<c001daf8>] (warn_slowpath_common+0x6c/0x8c)
      [<c001daf8>] (warn_slowpath_common) from [<c001db34>] (warn_slowpath_null+0x1c/0x24)
      [<c001db34>] (warn_slowpath_null) from [<c0349478>] (mxs_mmc_start_cmd+0x34c/0x378)
      [<c0349478>] (mxs_mmc_start_cmd) from [<c0338fa0>] (mmc_start_request+0xc4/0xf4)
      [<c0338fa0>] (mmc_start_request) from [<c03390b4>] (mmc_wait_for_req+0x50/0x164)
      [<c03390b4>] (mmc_wait_for_req) from [<c03405b8>] (mmc_app_send_scr+0x158/0x1c8)
      [<c03405b8>] (mmc_app_send_scr) from [<c033ee1c>] (mmc_sd_setup_card+0x80/0x3c8)
      [<c033ee1c>] (mmc_sd_setup_card) from [<c033f788>] (mmc_sd_init_card+0x124/0x66c)
      [<c033f788>] (mmc_sd_init_card) from [<c033fd7c>] (mmc_attach_sd+0xac/0x174)
      [<c033fd7c>] (mmc_attach_sd) from [<c033a658>] (mmc_rescan+0x25c/0x2d8)
      [<c033a658>] (mmc_rescan) from [<c003597c>] (process_one_work+0x1b4/0x4ec)
      [<c003597c>] (process_one_work) from [<c0035de4>] (worker_thread+0x130/0x464)
      [<c0035de4>] (worker_thread) from [<c003c824>] (kthread+0xb4/0xd0)
      [<c003c824>] (kthread) from [<c000f420>] (ret_from_fork+0x14/0x34)
      
      The error is due to an invalid value in CSD register of a specific 2GB
      micro SD card. The CSD version of this card is 1.0 but the TACC field
      has the invalid value 0.
      
      cid:0000005553442020000000000000583f
      csd:00000032535a83bfedb7ffbf1680003f
      date:08/2005
      erase_size:512
      fwrev:0x0
      hwrev:0x0
      manfid:0x000000
      name:USD
      oemid:0x0000
      preferred_erase_size:4194304
      scr:0225000000000000
      serial:0x00000000
      type:SD
      
      Since the kernel is making use of this TACC field to calculate the SD
      card timeout, an invalid value 0 leads to a warning at
      mxs_ns_to_ssp_ticks() and later the following misleading error message
      appears in a loop:
      
      mxs-mmc 80010000.ssp: card claims to support voltages below defined range
      mxs-mmc 80010000.ssp: no support for card's volts
      mmc0: error -22 whilst initialising MMC card
      
      This error is only found on this 2GB SD card on mxs platform.
      On x86 this card works without any problems.
      
      The following patch based on the work of Peter Chan and Otavio Salvador.
      It catches the case that the determined timeout is still 0 and sets it
      to a valid value.
      
      Successful tested on a i.MX28 board.
      Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarChris Ball <chris@printf.net>
      f7bf11a3
    • Markus Mayer's avatar
      mmc: Delay the card_event callback into the mmc_rescan worker · fa372a51
      Markus Mayer authored
      This change removes the callback from atomic context which it doesn't
      need to be in, and puts it in line with the debounced rescan.
      
      This code is based on these e-mail threads with Christian Daudt:
      
        https://lkml.org/lkml/2013/8/19/539
        https://lkml.org/lkml/2014/3/19/79Signed-off-by: default avatarMarkus Mayer <markus.mayer@linaro.org>
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarChris Ball <chris@printf.net>
      fa372a51
  7. 17 Mar, 2014 1 commit
  8. 23 Feb, 2014 3 commits
  9. 13 Feb, 2014 4 commits
  10. 13 Jan, 2014 1 commit
  11. 30 Oct, 2013 8 commits
  12. 25 Sep, 2013 1 commit
  13. 26 Aug, 2013 1 commit
  14. 31 Jul, 2013 1 commit
  15. 27 Jun, 2013 4 commits
  16. 26 May, 2013 4 commits
    • Ulf Hansson's avatar
      mmc: core: Restructure and simplify code for mmc sleep|awake · 07a68216
      Ulf Hansson authored
      The mmc_card_sleep|awake APIs are not being used since the support is
      already properly encapsulated within the suspend sequence. Sleep|awake
      command is also specific for eMMC.
      
      We remove the sleep|awake bus_ops, the mmc_card_sleep|awake APIs and
      move the code into the mmc specific core instead. This also includes
      the mmc ops function, mmc_sleepawake. All releated functions have then
      become static and we have got far less code to maintain.
      
      Additionally this patch also simplifies the code from mmc_sleepawake,
      since it is only used to put the card to sleep and not awake.
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarChris Ball <cjb@laptop.org>
      07a68216
    • Ulf Hansson's avatar
      mmc: block: Enable runtime pm for mmc blkdevice · e94cfef6
      Ulf Hansson authored
      Once the mmc blkdevice is being probed, runtime pm will be enabled.
      By using runtime autosuspend, the power save operations can be done
      when request inactivity occurs for a certain time. Right now the
      selected timeout value is set to 3 s. Obviously this value will likely
      need to be configurable somehow since it needs to be trimmed depending
      on the power save algorithm.
      
      For SD-combo cards, we are still leaving the enablement of runtime PM
      to the SDIO init sequence since it depends on the capabilities of the
      SDIO func driver.
      
      Moreover, when the blk device is being suspended, we make sure the device
      will be runtime resumed. The reason for doing this is that we want the
      host suspend sequence to be unaware of any runtime power save operations
      done for the card in this phase. Thus it can just handle the suspend as
      the card is fully powered from a runtime perspective.
      
      Finally, this patch prepares to make it possible to move BKOPS handling
      into the runtime callbacks for the mmc bus_ops. Thus IDLE BKOPS can be
      accomplished.
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarChris Ball <cjb@laptop.org>
      e94cfef6
    • Ulf Hansson's avatar
      mmc: core: Add bus_ops for runtime pm callbacks · 12d01d0b
      Ulf Hansson authored
      SDIO is the only protocol that uses runtime pm for the card device
      right now. To provide the option for sd and mmc to use runtime pm as
      well the bus_ops callback are extended with two new functions. One for
      runtime_suspend and one for runtime_resume.
      
      This patch will also implement the callbacks for SDIO to make sure
      existing functionality is maintained. It also prepares to move
      away from using the mmc_power_restore_host API, since it is not
      needed when using runtime PM.
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarChris Ball <cjb@laptop.org>
      12d01d0b
    • Ulf Hansson's avatar
      mmc: core: Stop bkops for eMMC only from mmc suspend · 39b9431b
      Ulf Hansson authored
      Move mmc suspend specific operations to be executed from the .suspend
      callback in the mmc bus_ops. This simplifies the mmc_suspend_host
      function which is supposed to handle nothing but common suspend tasks.
      
      Since eMMC can be considered non-removable there are no need to check
      for ongoing bkops at PM_SUSPEND_PREPARE notification so remove it.
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarChris Ball <cjb@laptop.org>
      39b9431b