1. 05 Oct, 2008 6 commits
    • Haavard Skinnemoen's avatar
      atmel-mci: Add experimental DMA support · 65e8b083
      Haavard Skinnemoen authored
      This adds support for DMA transfers through the generic DMA engine
      framework with the DMA slave extensions.
      The driver has been tested using mmc-block and ext3fs on several SD,
      SDHC and MMC+ cards. Reads and writes work fine, with read transfer
      rates up to 7.5 MiB/s on fast cards with debugging disabled.
      Unfortunately, the driver has been known to lock up from time to time
      with DMA enabled, so DMA support is currently optional and marked
      EXPERIMENTAL. However, I didn't see any problems while testing 13
      different cards (MMC, SD and SDHC of different brands and sizes), so I
      suspect the "Initialize BLKR before sending data transfer command" fix
      that was posted earlier fixed this as well.
      Signed-off-by: default avatarHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
    • Haavard Skinnemoen's avatar
      atmel-mci: support multiple mmc slots · 965ebf33
      Haavard Skinnemoen authored
      The Atmel MCI controller can drive multiple cards through separate sets
      of pins, but only one at a time. This patch adds support for
      multiplexing access to the controller so that multiple card slots can be
      used as if they were hooked up to separate mmc controllers.
      The atmel-mci driver registers each slot as a separate mmc_host. Both
      access the same common controller state, but they also have some state
      on their own for card detection/write protect handling, and separate
      shadows of the MR and SDCR registers.
      When one of the slots receives a request from the mmc core, the common
      controller state is checked. If it's idle, the request is submitted
      immediately. If not, the request is added to a queue. When a request is
      done, the queue is checked and if there is a queued request, it is
      submitted before the completion callback is called.
      This patch also includes a few cleanups and fixes, including a locking
      overhaul. I had to change the locking extensively in any case, so I
      might as well try to get it right. The driver no longer takes any
      irq-safe locks, which may or may not improve the overall system
      This patch also adds a bit of documentation of the internal data
      Signed-off-by: default avatarHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
    • Haavard Skinnemoen's avatar
      atmel-mci: Platform code for supporting multiple mmc slots · 6b918657
      Haavard Skinnemoen authored
      Add the necessary platform infrastructure to support multiple mmc/sdcard
      slots all at once through a single controller. Currently, the driver
      will use the first valid slot it finds and stick with that, but later
      patches will add support for switching between several slots on the fly.
      Extend the platform data structure with per-slot information: MMC/SDcard
      bus width and card detect/write protect pins. This will affect the pin
      muxing as well as the capabilities announced to the mmc core.
      Note that board code is now required to supply a mci_platform_data
      struct to at32_add_device_mci().
      Signed-off-by: default avatarHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
    • Haavard Skinnemoen's avatar
      atmel-mci: Don't stop the clock between transfers · 945533b5
      Haavard Skinnemoen authored
      Some cards might get upset if we turn off the clock for extended periods
      of time. So keep the clock running until the mmc core tells us to turn
      it off.
      Also, don't reset the controller between each transfer. That was an
      attempt to work around earlier bugs, and it never really worked very
      Signed-off-by: default avatarHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
    • Haavard Skinnemoen's avatar
      atmel-mci: Implement tasklet as a state machine · c06ad258
      Haavard Skinnemoen authored
      With the current system of completed/pending events, things may get
      handled in different order depending on which event triggers first. For
      example, if the data transfer is complete before the command, the stop
      command must be sent after the command is complete, not the data. This
      creates a bit of complexity around the stop command.
      By having the tasklet go through a sequence of clearly defined states,
      things always happen in a certain order even if the events come at
      different times, so the stop command can simply be sent when we exit the
      "sending data" state because we will never enter that state before the
      command has been sent successfully.
      Signed-off-by: default avatarHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
    • Haavard Skinnemoen's avatar
      atmel-mci: Initialize BLKR before sending data transfer command · a252e3e3
      Haavard Skinnemoen authored
      The atmel-mci driver sometimes fails data transfers like this:
         mmcblk0: error -5 transferring data
         end_request: I/O error, dev mmcblk0, sector 2749769
         end_request: I/O error, dev mmcblk0, sector 2749777
      It turns out that this might be caused by the BLKR register (which
      contains the block size and the number of blocks being transfered) being
      initialized too late. This patch moves the initialization of BLKR so
      that it contains the correct value before the block transfer command is
      This error is difficult to reproduce, but if you insert a long delay
      (mdelay(10) or thereabouts) between the calls to atmci_start_command()
      and atmci_submit_data(), all transfers seem to fail without this patch,
      while I haven't seen any failures with this patch.
      Reported-by: default avatarHein_Tibosch <hein_tibosch@yahoo.es>
      Signed-off-by: default avatarHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
  2. 04 Oct, 2008 3 commits
  3. 03 Oct, 2008 26 commits
  4. 02 Oct, 2008 5 commits