1. 21 7月, 2011 8 次提交
    • 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
    • J
      mmc: dw_mmc: fix race with request and removal · 7456caae
      James Hogan 提交于
      When a request is made, the card presence is checked and the request is
      queued. These two parts must be atomic with respect to card removal, or
      a card removal could be handled in between, and the new request wouldn't
      get cancelled until another card was inserted. Therefore move the
      spinlock protection from dw_mci_queue_request() up into dw_mci_request()
      to cover the presence check.
      
      Note that the test_bit() used for the presence check isn't atomic
      itself, so should have been protected by a spinlock anyway.
      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>
      7456caae
    • J
      mmc: dw_mmc: clear TXDR/RXDR ints before enabling · b40af3aa
      James Hogan 提交于
      DMA is only used for transactions exceeding a certain length, otherwise
      PIO is used. The TXDR and RXDR interrupts are masked when in DMA mode
      but still fire. When switching to PIO mode (e.g. to get SCR field when
      an SD card is inserted) these interrupts are not cleared and so they
      trigger the ISR as soon as they are unmasked. If the previous DMA did a
      write, then the ISR will handle the TXDR interrupt even if the
      transaction is a read, completing the transaction without modifying the
      read buffer.
      
      This is fixed primarily by clearing these two interrupts before
      unmasking them when setting up PIO mode, and also by making the ISR more
      robust by only handling TXDR/RXDR in the correct read/write direction.
      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>
      b40af3aa
    • S
      mmc: dw_mmc: protect a sequence of request and request-done. · 6e83e10d
      Seungwon Jeon 提交于
      Response timeout (RTO), Response crc error (RCRC) and Response error (RE)
      signals come with command done (CD) and can be raised preceding command
      done (CD). That is these error interrupts and CD can be handled in
      separate dw_mci_interrupt(). If mmc_request_done() is called because of
      a response timeout before command done has occured, we might send the
      next request before the CD of current request is finished. This can
      bring about a broken sequence of request and request-done.
      
      And Data error interrupt (DRTO, DCRC, SBE, EBE) and data transfer
      over (DTO) have the same problem.
      Signed-off-by: NSeungwon Jeon <tgih.jun@samsung.com>
      Acked-by: NWill Newton <will.newton@imgtec.com>
      Signed-off-by: NChris Ball <cjb@laptop.org>
      6e83e10d
    • S
      mmc: dw_mmc: set the card_width bit per card. · 1d56c453
      Seungwon Jeon 提交于
      This patch sets the card_width bit of CTYPE for the corresponding card.
      
      CTYPE[31] and CTYPE[16] correspond respectively to card[15] and card[0]
      for 8-bit mode. And CTYPE[15] and CTYPE[0] correspond respectively to
      card[15] and CTYPE[0] for 1-bit or 4-bit mode.
      Signed-off-by: NSeungwon Jeon <tgih.jun@samsung.com>
      Acked-by: NWill Newton <will.newton@imgtec.com>
      Signed-off-by: NChris Ball <cjb@laptop.org>
      1d56c453
  2. 25 5月, 2011 1 次提交
  3. 25 3月, 2011 1 次提交
  4. 18 3月, 2011 4 次提交
  5. 16 3月, 2011 4 次提交
  6. 09 1月, 2011 1 次提交