1. 09 4月, 2015 1 次提交
  2. 31 3月, 2015 1 次提交
  3. 19 1月, 2015 1 次提交
    • D
      mmc: dw_mmc: Protect read-modify-write of INTMASK with a lock · f8c58c11
      Doug Anderson 提交于
      We're running into cases where our enabling of the SDIO interrupt in
      dw_mmc doesn't actually take effect.  Specifically, adding patch like
      this:
      
       +++ b/drivers/mmc/host/dw_mmc.c
       @@ -1076,6 +1076,9 @@ static void dw_mci_enable_sdio_irq(struct mmc_host *mmc, int enb)
      
            mci_writel(host, INTMASK,
                 (int_mask | SDMMC_INT_SDIO(slot->id)));
       +    int_mask = mci_readl(host, INTMASK);
       +    if (!(int_mask & SDMMC_INT_SDIO(slot->id)))
       +      dev_err(&mmc->class_dev, "failed to enable sdio irq\n");
          } else {
      
      ...actually triggers the error message.  That's because the
      dw_mci_enable_sdio_irq() unsafely does a read-modify-write of the
      INTMASK register.
      
      We can't just use the standard host->lock since that lock is not irq
      safe and mmc_signal_sdio_irq() (called from interrupt context) calls
      dw_mci_enable_sdio_irq().  Add a new irq-safe lock to protect INTMASK.
      
      An alternate solution to this is to punt mmc_signal_sdio_irq() to the
      tasklet and then protect INTMASK modifications by the standard host
      lock.  This seemed like a bit more of a high-latency change.
      Reported-by: NBing Zhao <bzhao@marvell.com>
      Signed-off-by: NDoug Anderson <dianders@chromium.org>
      Reviewed-by: NJames Hogan <james.hogan@imgtec.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      f8c58c11
  4. 26 11月, 2014 2 次提交
  5. 10 11月, 2014 1 次提交
    • D
      mmc: dw_mmc: Remove old card detect infrastructure · 6130e7a9
      Doug Anderson 提交于
      The dw_mmc driver had a bunch of code that ran whenever a card was
      ejected and inserted.  However, this code was old and crufty and
      should be removed.  Some evidence that it's really not needed:
      
      1. Is is supposed to be legal to use 'cd-gpio' on dw_mmc instead of
         using the built-in card detect mechanism.  The 'cd-gpio' code
         doesn't run any of the crufty old code but yet still works.
      
      2. While looking at this, I realized that my old change (369ac861 mmc:
         dw_mmc: don't queue up a card detect at slot startup) actually
         castrated the old code a little bit already and nobody noticed.
         Specifically "last_detect_state" was left as 0 at bootup.  That
         means that on the first card removal none of the crufty code ran.
      
      3. I can run "while true; do dd if=/dev/mmcblk1 of=/dev/null; done"
         while ejecting and inserting an SD Card and the world doesn't
         explode.
      
      If some of the crufty old code is actually needed, we should justify
      it and also put it in some place where it will be run even with
      "cd-gpio".
      
      Note that in my case I'm using the "cd-gpio" mechanism but for various
      reasons the hardware triggers a dw_mmc "card detect" at bootup.  That
      was actually causing a real bug.  The card detect workqueue was
      running while the system was trying to enumerate the card.  The
      "present != slot->last_detect_state" triggered and we were doing all
      kinds of crazy stuff and messing up enumeration.  The new mechanism of
      just asking the core to check the card is much safer and then the
      bogus interrupt doesn't hurt.
      Signed-off-by: NDoug Anderson <dianders@chromium.org>
      Tested-by: NJaehoon Chung <jh80.chung@samsung.com>
      Acked-by: NJaehoon Chung <jh80.chung@samsung.com>
      Tested-by: Nalim.akhtar <alim.akhtar@samsung.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      6130e7a9
  6. 09 9月, 2014 2 次提交
  7. 11 8月, 2014 1 次提交
  8. 13 5月, 2014 1 次提交
  9. 26 9月, 2013 3 次提交
  10. 25 2月, 2013 2 次提交
  11. 07 12月, 2012 2 次提交
  12. 08 11月, 2012 2 次提交
  13. 03 10月, 2012 5 次提交
  14. 09 5月, 2012 1 次提交
  15. 26 3月, 2012 1 次提交
  16. 14 2月, 2012 1 次提交
    • S
      mmc: dw_mmc: Fix PIO mode with support of highmem · f9c2a0dc
      Seungwon Jeon 提交于
      Current PIO mode makes a kernel crash with CONFIG_HIGHMEM.
      Highmem pages have a NULL from sg_virt(sg).
      This patch fixes the following problem.
      
      Unable to handle kernel NULL pointer dereference at virtual address 00000000
      pgd = c0004000
      [00000000] *pgd=00000000
      Internal error: Oops: 817 [#1] PREEMPT SMP
      Modules linked in:
      CPU: 0    Not tainted  (3.0.15-01423-gdbf465f #589)
      PC is at dw_mci_pull_data32+0x4c/0x9c
      LR is at dw_mci_read_data_pio+0x54/0x1f0
      pc : [<c0358824>]    lr : [<c035988c>]    psr: 20000193
      sp : c0619d48  ip : c0619d70  fp : c0619d6c
      r10: 00000000  r9 : 00000002  r8 : 00001000
      r7 : 00000200  r6 : 00000000  r5 : e1dd3100  r4 : 00000000
      r3 : 65622023  r2 : 0000007f  r1 : eeb96000  r0 : e1dd3100
      Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment
      xkernel
      Control: 10c5387d  Table: 61e2004a  DAC: 00000015
      Process swapper (pid: 0, stack limit = 0xc06182f0)
      Stack: (0xc0619d48 to 0xc061a000)
      9d40:                   e1dd3100 e1a4f000 00000000 e1dd3100 e1a4f000 00000200
      9d60: c0619da4 c0619d70 c035988c c03587e4 c0619d9c e18158f4 e1dd3100 e1dd3100
      9d80: 00000020 00000000 00000000 00000020 c06e8a84 00000000 c0619e04 c0619da8
      9da0: c0359b24 c0359844 e18158f4 e1dd3164 e1dd3168 e1dd3150 3d02fc79 e1dd3154
      9dc0: e1dd3178 00000000 00000020 00000000 e1dd3150 00000000 c10dd7e8 e1a84900
      9de0: c061e7cc 00000000 00000000 0000008d c06e8a84 c061e780 c0619e4c c0619e08
      9e00: c00c4738 c0359a34 3d02fc79 00000000 c0619e4c c05a1698 c05a1670 c05a165c
      9e20: c04de8b0 c061e780 c061e7cc e1a84900 ffffed68 0000008d c0618000 00000000
      9e40: c0619e6c c0619e50 c00c48b4 c00c46c8 c061e780 c00423ac c061e7cc ffffed68
      9e60: c0619e8c c0619e70 c00c7358 c00c487c 0000008d ffffee38 c0618000 ffffed68
      9e80: c0619ea4 c0619e90 c00c4258 c00c72b0 c00423ac ffffee38 c0619ecc c0619ea8
      9ea0: c004241c c00c4234 ffffffff f8810000 0000006d 00000002 00000001 7fffffff
      9ec0: c0619f44 c0619ed0 c0048bc0 c00423c4 220ae7a9 00000000 386f0d30 0005d3a4
      9ee0: c00423ac c10dd0b8 c06f2cd8 c0618000 c0594778 c003a674 7fffffff c0619f44
      9f00: 386f0d30 c0619f18 c00a6f94 c005be3c 80000013 ffffffff 386f0d30 0005d3a4
      9f20: 386f0d30 0005d2d1 c10dd0a8 c10dd0b8 c06f2cd8 c0618000 c0619f74 c0619f48
      9f40: c0345858 c005be00 c00a2440 c0618000 c0618000 c00410d8 c06c1944 c00410fc
      9f60: c0594778 c003a674 c0619f9c c0619f78 c004a7e8 c03457b4 c0618000 c06c18f8
      9f80: 00000000 c0039c70 c06c18d4 c003a674 c0619fb4 c0619fa0 c04ceafc c004a714
      9fa0: c06287b4 c06c18f8 c0619ff4 c0619fb8 c0008b68 c04cea68 c0008578 00000000
      9fc0: 00000000 c003a674 00000000 10c5387d c0628658 c003aa78 c062f1c4 4000406a
      9fe0: 413fc090 00000000 00000000 c0619ff8 40008044 c0008858 00000000 00000000
      Backtrace:
      [<c03587d8>] (dw_mci_pull_data32+0x0/0x9c) from [<c035988c>] (dw_mci_read_data_pio+0x54/0x1f0)
       r6:00000200 r5:e1a4f000 r4:e1dd3100
       [<c0359838>] (dw_mci_read_data_pio+0x0/0x1f0) from [<c0359b24>] (dw_mci_interrupt+0xfc/0x4a4)
      [<c0359a28>] (dw_mci_interrupt+0x0/0x4a4) from [<c00c4738>] (handle_irq_event_percpu+0x7c/0x1b4)
      [<c00c46bc>] (handle_irq_event_percpu+0x0/0x1b4) from [<c00c48b4>] (handle_irq_event+0x44/0x64)
      [<c00c4870>] (handle_irq_event+0x0/0x64) from [<c00c7358>] (handle_fasteoi_irq+0xb4/0x124)
       r7:ffffed68 r6:c061e7cc r5:c00423ac r4:c061e780
       [<c00c72a4>] (handle_fasteoi_irq+0x0/0x124) from [<c00c4258>] (generic_handle_irq+0x30/0x38)
       r7:ffffed68 r6:c0618000 r5:ffffee38 r4:0000008d
       [<c00c4228>] (generic_handle_irq+0x0/0x38) from [<c004241c>] (asm_do_IRQ+0x64/0xe0)
       r5:ffffee38 r4:c00423ac
       [<c00423b8>] (asm_do_IRQ+0x0/0xe0) from [<c0048bc0>] (__irq_svc+0x80/0x14c)
      Exception stack(0xc0619ed0 to 0xc0619f18)
      Signed-off-by: NSeungwon Jeon <tgih.jun@samsung.com>
      Acked-by: NWill Newton <will.newton@imgtec.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NChris Ball <cjb@laptop.org>
      f9c2a0dc
  17. 12 1月, 2012 1 次提交
  18. 27 10月, 2011 1 次提交
  19. 21 7月, 2011 5 次提交
    • J
      mmc: dw_mmc: fix stop when fallen back to PIO · 03e8cb53
      James Hogan 提交于
      There are several situations when dw_mci_submit_data_dma() decides to
      fall back to PIO mode instead of using DMA, due to a short (to avoid
      overhead) or "complex" (e.g. with unaligned buffers) transaction, even
      though host->use_dma is set. However dw_mci_stop_dma() decides whether
      to stop DMA or set the EVENT_XFER_COMPLETE event based on host->use_dma.
      When falling back to PIO mode this results in data timeout errors
      getting missed and the driver locking up.
      
      Therefore add host->using_dma to indicate whether the current
      transaction is using dma or not, and adjust dw_mci_stop_dma() to use
      that instead.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NWill Newton <will.newton@imgtec.com>
      Tested-by: NJaehoon Chung <jh80.chung@samsung.com>
      Signed-off-by: NChris Ball <cjb@laptop.org>
      03e8cb53
    • J
      mmc: dw_mmc: handle unaligned buffers and sizes · 34b664a2
      James Hogan 提交于
      Update functions for PIO pushing and pulling data to and from the FIFO
      so that they can handle unaligned output buffers and unaligned buffer
      lengths. This makes more of the tests in mmc_test pass.
      
      Unaligned lengths in pulls are handled by reading the full FIFO item,
      and storing the remaining bytes in a small internal buffer (part_buf).
      The next data pull will copy data out of this buffer first before
      accessing the FIFO again. Similarly, for pushes the final bytes that
      don't fill a FIFO item are stored in the part_buf (or sent anyway if
      it's the last transfer), and then the part_buf is included at the
      beginning of the next buffer pushed.
      
      Unaligned buffers in pulls are handled specially if the architecture
      cannot do efficient unaligned accesses, by reading FIFO items into a
      aligned local buffer, and memcpy'ing them into the output buffer, again
      storing any remaining bytes in the internal buffer. Similarly for pushes
      the buffer is memcpy'd into an aligned local buffer then written to the
      FIFO.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NWill Newton <will.newton@imgtec.com>
      Signed-off-by: NChris Ball <cjb@laptop.org>
      34b664a2
    • J
      mmc: dw_mmc: don't hard code fifo depth, fix usage · b86d8253
      James Hogan 提交于
      The FIFO_DEPTH hardware configuration parameter can be found from the
      power-on value of RX_WMark in the FIFOTH register. This is used to
      initialise the watermarks, but when calculating the number of free fifo
      spaces a preprocessor definition is used which is hard coded to 32.
      
      Fix reading the value out of FIFOTH (the default value in the RX_WMark
      field is FIFO_DEPTH-1 not FIFO_DEPTH). Allow the fifo depth to be
      overriden by platform data (since a bootloader may have changed FIFOTH
      making auto-detection unreliable). Store the fifo_depth for later use.
      Also fix the calculation to find the number of free bytes in the fifo to
      include the fifo depth in the left shift by the data shift, since the
      fifo depth is measured in fifo items not bytes.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NWill Newton <will.newton@imgtec.com>
      Signed-off-by: NChris Ball <cjb@laptop.org>
      b86d8253
    • J
      mmc: dw_mmc: convert card tasklet to workqueue · 1791b13e
      James Hogan 提交于
      Convert the card insert/remove tasklet to a workqueue, and call the
      setpower platform specific callback without the spinlock held. This
      means neither of the setpower or get_cd callbacks are called from atomic
      context which allows them to sleep.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Acked-by: NWill Newton <will.newton@imgtec.com>
      Signed-off-by: NChris Ball <cjb@laptop.org>
      1791b13e
    • R
      mmc: Standardize header file inclusion checks. · 100e9186
      Robert P. J. Day 提交于
      Standardize the checks for multiple MMC header file inclusion,
      including adding comments to terminating #endif's, and fixing
      one incorrect comment.
      Signed-off-by: NRobert P. J. Day <rpjday@crashcourse.ca>
      Signed-off-by: NChris Ball <cjb@laptop.org>
      100e9186
  20. 31 3月, 2011 1 次提交
  21. 18 3月, 2011 3 次提交
  22. 16 3月, 2011 1 次提交
  23. 09 1月, 2011 1 次提交