1. 27 9月, 2016 2 次提交
  2. 25 7月, 2016 5 次提交
  3. 23 5月, 2016 1 次提交
  4. 02 5月, 2016 2 次提交
  5. 29 2月, 2016 5 次提交
  6. 28 12月, 2015 1 次提交
    • U
      mmc: core: Optimize boot time by detecting cards simultaneously · 520bd7a8
      Ulf Hansson 提交于
      The mmc workqueue is an ordered workqueue, allowing only one work to
      execute per given time. As this workqueue is used for card detection, the
      conseqeunce is that cards will be detected one by one waiting for each
      other.
      
      Moreover, most of the time spent during card initialization is waiting for
      the card's internal firmware to be ready. From a CPU perspective this
      typically means waiting for a completion variable to be kicked via an
      IRQ-handler or waiting for a sleep timer to finish.
      
      This behaviour of detecting/initializing cards is sub-optimal, especially
      for SOCs having several controllers/cards.
      
      Let's convert to use the system_freezable_wq for the mmc detect works.
      This enables several works to be executed simultaneously and thus also
      cards to be detected like so.
      
      Tests on UX500, which holds two eMMC cards and an SD-card (actually also
      an SDIO card, currently not detected), shows a significant improved
      behaviour due to this change.
      
      Before this change, both the eMMC cards waited for the SD card to be
      initialized as its detect work entered the workqueue first. In some cases,
      depending on the characteristic of the SD-card, they got delayed 1-1.5 s.
      
      Additionally for the second eMMC, it needed to wait for the first eMMC to
      be initialized which added another 120-190 ms.
      
      Converting to the system_freezable_wq, removed these delays and made both
      the eMMC cards available far earlier in the boot sequence.
      
      Selecting the system_freezable_wq, in favour of for example the system_wq,
      is because we need card detection mechanism to be disabled once userspace
      are frozen during system PM. Currently the mmc core deal with this via PM
      notifiers, but following patches may utilize the behaviour of the
      system_freezable_wq, to simplify the use of the PM notifiers.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Tested-by: NAlan Cooper <alcooperx@gmail.com>
      Tested-by: NShawn Lin <shawn.lin@rock-chips.com>
      520bd7a8
  7. 22 12月, 2015 6 次提交
  8. 26 10月, 2015 5 次提交
    • D
      mmc: core: Add mmc_regulator_set_vqmmc() · 2086f801
      Douglas Anderson 提交于
      This adds logic to the MMC core to set VQMMC.  This is expected to be
      called by MMC drivers like dw_mmc as part of (or instead of) their
      start_signal_voltage_switch() callback.
      
      A few notes:
      
      * When setting the signal voltage to 3.3V we do our best to make VQMMC
        and VMMC match.  It's been reported that this makes some old cards
        happy since they were tested back in the day before UHS when VQMMC
        and VMMC were provided by the same regulator.  A nice side effect of
        this is that we don't end up on the hairy edge of VQMMC (2.7V),
        which some EEs claim is a little too close to the minimum for
        comfort.
        This is done in two steps. At first we try to find a VQMMC within
        a 0.3V tolerance of VMMC and if this is not supported by the
        supplying regulator we try to find a suitable voltage within the
        whole 2.7V-3.6V area of the spec.
      
      * The two step approach is currently necessary, as the used
        regulator_set_voltage_triplet(min, target, max) uses a simple
        implementation that just tries two basic steps:
      	regulator_set_voltage(target, max);
      	regulator_set_voltage(min, target);
        So with only one step with 2.7-3.6V borders, if a suitable voltage
        is a bit below VMMC, we would directly get the lowest 2.7V
        which some boards (like Rockchips) don't like at all.
      
      * When setting the signal voltage to 1.8V or 1.2V we aim for that
        specific voltage instead of picking the lowest one in the range.
      
      * We very purposely don't print errors in mmc_regulator_set_vqmmc().
        There are cases where the MMC core will try several different
        voltages and we don't want to pollute the logs.
      Signed-off-by: NDouglas Anderson <dianders@chromium.org>
      Signed-off-by: NHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      2086f801
    • H
      mmc: core: move ocr-bit to voltage translation into separate function · 310c805e
      Heiko Stuebner 提交于
      We will shortly need the calculation of an ocr-bit to the actual
      voltage in a second place too, so move it from mmc_regulator_set_ocr
      to a common function mmc_ocrbitnum_to_vdd to make that possible.
      Signed-off-by: NHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      310c805e
    • U
      mmc: core: Remove MMC_CLKGATE · 9eadcc05
      Ulf Hansson 提交于
      MMC_CLKGATE was once invented to save power by gating the bus clock at
      request inactivity. At that time it served its purpose. The modern way to
      deal with power saving for these scenarios, is by using runtime PM.
      
      Nowadays, several host drivers have deployed runtime PM, but for those
      that haven't and which still cares power saving at request inactivity,
      it's certainly time to deploy runtime PM as it has been around for several
      years now.
      
      To simplify code to mmc core and thus decrease maintenance efforts, this
      patch removes all code related to MMC_CLKGATE.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
      9eadcc05
    • H
      mmc: Wait for card_busy before starting sdio requests · 5d3f6ef0
      Hans de Goede 提交于
      Some sdio wifi chips will not work properly if we try to start new
      sdio-rw requests while the device is signalling that it is busy.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      5d3f6ef0
    • U
      mmc: core: Keep host claimed while invoking mmc_power_off|up() · 8d1ffc8c
      Ulf Hansson 提交于
      As mmc_claim_host() invokes pm_runtime_get_sync() for the mmc host device,
      it's important that the host is kept claimed for *all* accesses to it via
      the host_ops callbacks.
      
      In some code paths for SDIO, particularly related to the PM support,
      mmc_power_off|up() is invoked without keeping the host claimed. Let's fix
      these.
      
      Moreover, mmc_start|stop_host() also invokes mmc_power_off|up() without
      claiming the host, let's fix these as well.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Acked-by: NKishon Vijay Abraham I <kishon@ti.com>
      8d1ffc8c
  9. 30 9月, 2015 1 次提交
  10. 31 8月, 2015 1 次提交
    • J
      mmc: core: fix race condition in mmc_wait_data_done · 71f8a4b8
      Jialing Fu 提交于
      The following panic is captured in ker3.14, but the issue still exists
      in latest kernel.
      ---------------------------------------------------------------------
      [   20.738217] c0 3136 (Compiler) Unable to handle kernel NULL pointer dereference
      at virtual address 00000578
      ......
      [   20.738499] c0 3136 (Compiler) PC is at _raw_spin_lock_irqsave+0x24/0x60
      [   20.738527] c0 3136 (Compiler) LR is at _raw_spin_lock_irqsave+0x20/0x60
      [   20.740134] c0 3136 (Compiler) Call trace:
      [   20.740165] c0 3136 (Compiler) [<ffffffc0008ee900>] _raw_spin_lock_irqsave+0x24/0x60
      [   20.740200] c0 3136 (Compiler) [<ffffffc0000dd024>] __wake_up+0x1c/0x54
      [   20.740230] c0 3136 (Compiler) [<ffffffc000639414>] mmc_wait_data_done+0x28/0x34
      [   20.740262] c0 3136 (Compiler) [<ffffffc0006391a0>] mmc_request_done+0xa4/0x220
      [   20.740314] c0 3136 (Compiler) [<ffffffc000656894>] sdhci_tasklet_finish+0xac/0x264
      [   20.740352] c0 3136 (Compiler) [<ffffffc0000a2b58>] tasklet_action+0xa0/0x158
      [   20.740382] c0 3136 (Compiler) [<ffffffc0000a2078>] __do_softirq+0x10c/0x2e4
      [   20.740411] c0 3136 (Compiler) [<ffffffc0000a24bc>] irq_exit+0x8c/0xc0
      [   20.740439] c0 3136 (Compiler) [<ffffffc00008489c>] handle_IRQ+0x48/0xac
      [   20.740469] c0 3136 (Compiler) [<ffffffc000081428>] gic_handle_irq+0x38/0x7c
      ----------------------------------------------------------------------
      Because in SMP, "mrq" has race condition between below two paths:
      path1: CPU0: <tasklet context>
        static void mmc_wait_data_done(struct mmc_request *mrq)
        {
           mrq->host->context_info.is_done_rcv = true;
           //
           // If CPU0 has just finished "is_done_rcv = true" in path1, and at
           // this moment, IRQ or ICache line missing happens in CPU0.
           // What happens in CPU1 (path2)?
           //
           // If the mmcqd thread in CPU1(path2) hasn't entered to sleep mode:
           // path2 would have chance to break from wait_event_interruptible
           // in mmc_wait_for_data_req_done and continue to run for next
           // mmc_request (mmc_blk_rw_rq_prep).
           //
           // Within mmc_blk_rq_prep, mrq is cleared to 0.
           // If below line still gets host from "mrq" as the result of
           // compiler, the panic happens as we traced.
           wake_up_interruptible(&mrq->host->context_info.wait);
        }
      
      path2: CPU1: <The mmcqd thread runs mmc_queue_thread>
        static int mmc_wait_for_data_req_done(...
        {
           ...
           while (1) {
                 wait_event_interruptible(context_info->wait,
                         (context_info->is_done_rcv ||
                          context_info->is_new_req));
           	   static void mmc_blk_rw_rq_prep(...
                 {
                 ...
                 memset(brq, 0, sizeof(struct mmc_blk_request));
      
      This issue happens very coincidentally; however adding mdelay(1) in
      mmc_wait_data_done as below could duplicate it easily.
      
         static void mmc_wait_data_done(struct mmc_request *mrq)
         {
           mrq->host->context_info.is_done_rcv = true;
      +    mdelay(1);
           wake_up_interruptible(&mrq->host->context_info.wait);
          }
      
      At runtime, IRQ or ICache line missing may just happen at the same place
      of the mdelay(1).
      
      This patch gets the mmc_context_info at the beginning of function, it can
      avoid this race condition.
      Signed-off-by: NJialing Fu <jlfu@marvell.com>
      Tested-by: NShawn Lin <shawn.lin@rock-chips.com>
      Fixes: 2220eedf ("mmc: fix async request mechanism ....")
      Signed-off-by: NShawn Lin <shawn.lin@rock-chips.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      71f8a4b8
  11. 27 8月, 2015 2 次提交
  12. 17 8月, 2015 1 次提交
  13. 01 6月, 2015 8 次提交