21 Feb, 2012

1 commit

  • commit f9c2a0dc42a6938ff2a80e55ca2bbd1d5581c72e upstream.

    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 : [] lr : [] 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:
    [] (dw_mci_pull_data32+0x0/0x9c) from [] (dw_mci_read_data_pio+0x54/0x1f0)
    r6:00000200 r5:e1a4f000 r4:e1dd3100
    [] (dw_mci_read_data_pio+0x0/0x1f0) from [] (dw_mci_interrupt+0xfc/0x4a4)
    [] (dw_mci_interrupt+0x0/0x4a4) from [] (handle_irq_event_percpu+0x7c/0x1b4)
    [] (handle_irq_event_percpu+0x0/0x1b4) from [] (handle_irq_event+0x44/0x64)
    [] (handle_irq_event+0x0/0x64) from [] (handle_fasteoi_irq+0xb4/0x124)
    r7:ffffed68 r6:c061e7cc r5:c00423ac r4:c061e780
    [] (handle_fasteoi_irq+0x0/0x124) from [] (generic_handle_irq+0x30/0x38)
    r7:ffffed68 r6:c0618000 r5:ffffee38 r4:0000008d
    [] (generic_handle_irq+0x0/0x38) from [] (asm_do_IRQ+0x64/0xe0)
    r5:ffffee38 r4:c00423ac
    [] (asm_do_IRQ+0x0/0xe0) from [] (__irq_svc+0x80/0x14c)
    Exception stack(0xc0619ed0 to 0xc0619f18)

    Signed-off-by: Seungwon Jeon
    Acked-by: Will Newton
    Signed-off-by: Chris Ball
    Signed-off-by: Greg Kroah-Hartman

    Seungwon Jeon
     

11 Dec, 2011

1 commit

  • Adds a quirk that sets the data read timeout to a fixed value instead
    of relying on the information in the CSD. The timeout value chosen
    is 300ms since that has proven enough for the problematic cards found,
    but could be increased if other cards require this.

    This patch also enables this quirk for certain Micron cards known to
    have this problem.

    Signed-off-by: Stefan Nilsson XK
    Signed-off-by: Ulf Hansson
    Acked-by: Linus Walleij
    Cc:
    Signed-off-by: Chris Ball

    Stefan Nilsson XK
     

27 Oct, 2011

20 commits

  • 'DISK_NAME_LEN' is undeclared when CONFIG_BLOCK is disabled; its use was
    introduced via genhd.h by the general purpose partition patch.

    To fix, we just add our own MAX_MMC_PART_NAME_LEN macro instead of using
    DISK_NAME_LEN.

    Reported-by: Randy Dunlap
    Signed-off-by: Namjae Jeon
    Acked-by: Randy Dunlap
    Acked-by: Andrei Warkentin
    Signed-off-by: Chris Ball

    Namjae Jeon
     
  • Due to hardware bugs, some MMC host controllers don't support
    multiple-block reads[1]. To resolve, add a new MMC capability flag,
    MMC_CAP2_NO_MULTI_READ, which can be set by affected host controller
    drivers. When this capability is set, all reads will be issued one
    sector at a time.

    1. See for example Advisory 2.1.1.128 "MMC: Multiple Block Read
    Operation Issue" in _OMAP3530/3525/3515/3503 Silicon Errata_
    Revision F (October 2010) (SPRZ278F), available from
    http://focus.ti.com/lit/er/sprz278f/sprz278f.pdf

    Signed-off-by: Paul Walmsley
    Cc: Dave Hylands
    Tested-by: Steve Sakoman
    Signed-off-by: Chris Ball

    Paul Walmsley
     
  • Table 6-2: CCCR bit Definitions, address 00h. Part E1 SDIO Simplified
    Specification Version 3.00, Feb. 25, 2011.

    This patch has been tested with Marvell WLAN device SD8797.

    Signed-off-by: Bing Zhao
    Signed-off-by: Chris Ball

    Bing Zhao
     
  • HPI command is defined in eMMC4.41.
    This feature is important for eMMC4.5 devices.

    Signed-off-by: Jaehoon Chung
    Signed-off-by: Chris Ball

    Jaehoon Chung
     
  • This patch adds cache feature of eMMC4.5 Spec.
    If device supports cache capability, host can utilize some specific
    operations.

    Signed-off-by: Seungwon Jeon
    Signed-off-by: Jaehoon Chung
    Signed-off-by: Chris Ball

    Seungwon Jeon
     
  • MMC v4.5 supports the DISCARD feature (CMD38). It's different from
    trim and there's no check bit. Currently it's only supported at v4.5.

    Signed-off-by: Kyungmin Park
    Signed-off-by: Jaehoon Chung
    Signed-off-by: Chris Ball

    Kyungmin Park
     
  • In the v4.5, there's no secure erase & trim support.
    Instead it supports the sanitize feature.

    Signed-off-by: Kyungmin Park
    Signed-off-by: Jaehoon Chung
    Signed-off-by: Chris Ball

    Kyungmin Park
     
  • In dw_mmc 2.40a spec, Data register's offset is changed.
    Before we used Data register offset 0x100. but if somebody uses a
    2.40a controller, we must use 0x200 for Data register.

    This patch adds a version-id checking point and uses SDMMC_DATA(x)
    instead of SDMMC_DATA. It assumes 2.40a is the latest version.

    Signed-off-by: Jaehoon Chung
    Signed-off-by: Kyungmin Park
    Acked-by: James Hogan
    Signed-off-by: Chris Ball

    Jaehoon Chung
     
  • This patch adds support for the power off notify feature, available in
    eMMC 4.5 devices. If the host has support for this feature, then the
    mmc core will notify the device by setting the POWER_OFF_NOTIFICATION
    byte in the extended csd register with a value of 1 (POWER_ON).

    For suspend mode short timeout is used, whereas for the normal poweroff
    long timeout is used.

    Signed-off-by: Girish K S
    Signed-off-by: Jaehoon Chung
    Signed-off-by: Chris Ball

    Girish K S
     
  • EXT_CSD[248] includes the default maximum timeout for CMD6.
    This field is added at eMMC4.5 Spec. And it can be used for default
    timeout except for some operations which don't define the timeout
    (i.e. background operation, sanitize, flush cache) in eMMC4.5 Spec.

    Signed-off-by: Seungwon Jeon
    Signed-off-by: Jaehoon Chung
    Signed-off-by: Chris Ball

    Seungwon Jeon
     
  • Ths patch allows runtime PM for sdhci-pci, runtime suspending after
    inactivity of 50ms and ensuring runtime resume before SDHC registers
    are accessed. During runtime suspend, interrupts are masked.
    The host controller state is restored at runtime resume.

    For Medfield, the host controller's card detect mechanism is
    supplanted by an always-on GPIO which provides for card detect wake-up.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Chris Ball

    Adrian Hunter
     
  • It allows gerneral purpose partitions in MMC Device. And I try to simply
    make mmc_blk_alloc_parts using mmc_part structure suggested by Andrei
    Warkentin. After patching, we see general purpose partitions like this:
    > cat /proc/partitions
    179 0 847872 mmcblk0
    179 192 4096 mmcblk0gp3
    179 160 4096 mmcblk0gp2
    179 128 4096 mmcblk0gp1
    179 96 1052672 mmcblk0gp0
    179 64 1024 mmcblk0boot1
    179 32 1024 mmcblk0boot0

    Signed-off-by: Namjae Jeon
    Acked-by: Andrei Warkentin
    Signed-off-by: Chris Ball

    Namjae Jeon
     
  • Intel Medfield platform blocks access to eMMC boot partitions which
    results in switch errors. Since there is no access, mmcboot0/1
    devices should not be created. Add a host capability to reflect that.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Chris Ball

    Adrian Hunter
     
  • This patch adds the power class selection feature available for mmc
    versions 4.0 and above. During the enumeration stage before switching
    to the lower data bus, check if the power class is supported for the
    current bus width. If the power class is available then switch to the
    power class and use the higher data bus. If power class is not supported
    then switch to the lower data bus in a worst case.

    Signed-off-by: Girish K S
    Signed-off-by: Chris Ball

    Girish K S
     
  • Provide platforms with a simplified way to specify MMCIF DMA slave IDs in
    a way, similar to SDHI and other sh_dma clients.

    Signed-off-by: Guennadi Liakhovetski
    Signed-off-by: Chris Ball

    Guennadi Liakhovetski
     
  • eMMC's may have a hardware reset line. This patch provides a
    host controller operation to implement hardware reset and
    a function to reset and reinitialize the card. Also, for MMC,
    the reset is always performed before initialization.

    The host must set the new host capability MMC_CAP_HW_RESET
    to enable hardware reset.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Chris Ball

    Adrian Hunter
     
  • The err condition in post_req() is set to undo a call made to pre_req()
    that hasn't been started yet. The err condition is not set if an MMC
    request returns an error.

    Signed-off-by: Per Forlin
    Acked-by: Linus Walleij
    Signed-off-by: Chris Ball

    Per Forlin
     
  • Adds a quirk which can be turned on for SDIO devices that do not support
    512 byte requests in byte mode during CMD53. These requests will always
    be sent in block mode instead.

    This patch also enables this quirk for ST-Ericsson CW1200 WLAN device.

    Signed-off-by: Stefan Nilsson XK
    Signed-off-by: Ulf HANSSON
    Acked-by: Linus Walleij
    Signed-off-by: Chris Ball

    Stefan Nilsson XK
     
  • Allow named IRQs to use corresponding specific handlers. If named IRQs are
    used, at least an "sdcard" IRQ has to be specified by the platform. If
    names are not used, an arbitrary number of IRQs can be provided by the
    platform, in which case the generic ISR will be used for each of them.

    Cc: Guennadi Liakhovetski
    Acked-by: Magnus Damm
    Signed-off-by: Simon Horman
    [g.liakhovetski@gmx.de: style and typo corrections, platform data check]
    Signed-off-by: Guennadi Liakhovetski
    Signed-off-by: Chris Ball

    Simon Horman
     
  • This adds support to inject data errors after a completed host transfer.
    The mmc core will return error even though the host transfer is successful.
    This simple fault injection proved to be very useful to test the
    non-blocking error handling in the mmc_blk_issue_rw_rq().
    Random faults can also test how the host driver handles pre_req()
    and post_req() in case of errors.

    Signed-off-by: Per Forlin
    Acked-by: Akinobu Mita
    Reviewed-by: Linus Walleij
    Signed-off-by: Chris Ball

    Per Forlin
     

14 Aug, 2011

1 commit


21 Jul, 2011

13 commits

  • Non default Drive Strength cannot be set automatically. It is a function
    of the board design and only if there is a specific platform handler can
    it be set. The platform handler needs to take into account the board
    design. Pass to the platform code the necessary information.

    For example: The card and host controller may indicate they support HIGH
    and LOW drive strength. There is no way to know what should be chosen
    without specific board knowledge. Setting HIGH may lead to reflections
    and setting LOW may not suffice. There is no mechanism (like ethernet
    duplex or speed pulses) to determine what should be done automatically.

    If no platform handler is defined -- use the default value.

    Signed-off-by: Philip Rakity
    Reviewed-by: Arindam Nath
    Signed-off-by: Chris Ball

    Philip Rakity
     
  • Previously there has only been one function mmc_wait_for_req()
    to start and wait for a request. This patch adds:

    * mmc_start_req() - starts a request wihtout waiting
    If there is on ongoing request wait for completion
    of that request and start the new one and return.
    Does not wait for the new command to complete.

    This patch also adds new function members in struct mmc_host_ops
    only called from core.c:

    * pre_req - asks the host driver to prepare for the next job
    * post_req - asks the host driver to clean up after a completed job

    The intention is to use pre_req() and post_req() to do cache maintenance
    while a request is active. pre_req() can be called while a request is
    active to minimize latency to start next job. post_req() can be used after
    the next job is started to clean up the request. This will minimize the
    host driver request end latency. post_req() is typically used before
    ending the block request and handing over the buffer to the block layer.

    Add a host-private member in mmc_data to be used by pre_req to mark the
    data. The host driver will then check this mark to see if the data is
    prepared or not.

    Signed-off-by: Per Forlin
    Acked-by: Kyungmin Park
    Acked-by: Arnd Bergmann
    Reviewed-by: Venkatraman S
    Tested-by: Sourav Poddar
    Tested-by: Linus Walleij
    Signed-off-by: Chris Ball

    Per Forlin
     
  • 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: James Hogan
    Acked-by: Will Newton
    Tested-by: Jaehoon Chung
    Signed-off-by: Chris Ball

    James Hogan
     
  • Some host controllers will not operate without a hardware
    timeout that is limited in value. However large discards
    require large timeouts, so there needs to be a way to
    specify the maximum discard size.

    A host controller driver may now specify the maximum discard
    timeout possible so that max_discard_sectors can be calculated.

    However, for eMMC when the High Capacity Erase Group Size
    is not in use, the timeout calculation depends on clock
    rate which may change. For that case Preferred Erase Size
    is used instead.

    Signed-off-by: Adrian Hunter
    Signed-off-by: Chris Ball

    Adrian Hunter
     
  • 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: James Hogan
    Acked-by: Will Newton
    Signed-off-by: Chris Ball

    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: James Hogan
    Acked-by: Will Newton
    Signed-off-by: Chris Ball

    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: James Hogan
    Acked-by: Will Newton
    Signed-off-by: Chris Ball

    James Hogan
     
  • Some controllers require waiting for the bus to become idle
    before writing to some registers. I have implemented this
    by adding a hook to sd_ctrl_write16() and implementing
    a hook for SDHI which waits for the bus to become idle.

    Cc: Guennadi Liakhovetski
    Cc: Magnus Damm
    Signed-off-by: Simon Horman
    Signed-off-by: Chris Ball

    Simon Horman
     
  • This reflects at least the current usage of this register
    and I think it improves the readability of the code ever so slightly.

    Cc: Guennadi Liakhovetski
    Cc: Magnus Damm
    Signed-off-by: Simon Horman
    Signed-off-by: Chris Ball

    Simon Horman
     
  • If the MMC_SEND_STATUS command is not successful, we should not return
    a zero status word, but instead allow the caller to know positively
    that an error occurred.

    Convert the open-coded get_card_status() to use the helper function,
    and provide definitions for the card state field.

    Signed-off-by: Russell King
    Acked-by: Linus Walleij
    Tested-by: Pawel Moll
    Signed-off-by: Chris Ball

    Russell King - ARM Linux
     
  • Standardize the checks for multiple MMC header file inclusion,
    including adding comments to terminating #endif's, and fixing
    one incorrect comment.

    Signed-off-by: Robert P. J. Day
    Signed-off-by: Chris Ball

    Robert P. J. Day
     
  • The structure sdhci_pltfm_data is not necessarily to be in a public
    header like include/linux/mmc/sdhci-pltfm.h, so the patch moves it
    into drivers/mmc/host/sdhci-pltfm.h and eliminates the former one.

    Signed-off-by: Shawn Guo
    Reviewed-by: Grant Likely
    Reviewed-by: Wolfram Sang
    Signed-off-by: Chris Ball

    Shawn Guo
     
  • The patch turns the common stuff in sdhci-pltfm.c into functions, and
    add device drivers their own .probe and .remove which in turn call
    into the common functions, so that those sdhci-pltfm device drivers
    register itself and keep all device specific things away from common
    sdhci-pltfm file.

    Signed-off-by: Shawn Guo
    Reviewed-by: Grant Likely
    Acked-by: Arnd Bergmann
    Acked-by: Anton Vorontsov
    Signed-off-by: Chris Ball

    Shawn Guo
     

14 Jul, 2011

1 commit

  • On reading the ext_csd for the first time (in 1 bit mode), save the
    ext_csd information needed for bus width compare.

    On every pass we make re-reading the ext_csd, compare the data
    against the saved ext_csd data.

    This fixes a regression introduced in 3.0-rc1 by 08ee80cc397ac1a3
    ("mmc: core: eMMC bus width may not work on all platforms"), which
    incorrectly assumed we would be re-reading the ext_csd at resume-
    time.

    Signed-off-by: Philip Rakity
    Tested-by: Jaehoon Chung
    Signed-off-by: Chris Ball

    Philip Rakity
     

26 May, 2011

3 commits

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: (75 commits)
    mmc: core: eMMC bus width may not work on all platforms
    mmc: sdhci: Auto-CMD23 fixes.
    mmc: sdhci: Auto-CMD23 support.
    mmc: core: Block CMD23 support for UHS104/SDXC cards.
    mmc: sdhci: Implement MMC_CAP_CMD23 for SDHCI.
    mmc: core: Use CMD23 for multiblock transfers when we can.
    mmc: quirks: Add/remove quirks conditional support.
    mmc: Add new VUB300 USB-to-SD/SDIO/MMC driver
    mmc: sdhci-pxa: Add quirks for DMA/ADMA to match h/w
    mmc: core: duplicated trial with same freq in mmc_rescan_try_freq()
    mmc: core: add support for eMMC Dual Data Rate
    mmc: core: eMMC signal voltage does not use CMD11
    mmc: sdhci-pxa: add platform code for UHS signaling
    mmc: sdhci: add hooks for setting UHS in platform specific code
    mmc: core: clear MMC_PM_KEEP_POWER flag on resume
    mmc: dw_mmc: fixed wrong regulator_enable in suspend/resume
    mmc: sdhi: allow powering down controller with no card inserted
    mmc: tmio: runtime suspend the controller, where possible
    mmc: sdhi: support up to 3 interrupt sources
    mmc: sdhi: print physical base address and clock rate
    ...

    Linus Torvalds
     
  • Enables Auto-CMD23 support where available (SDHCI 3.0 controllers)

    Signed-off-by: Andrei Warkentin
    Tested-by: Arindam Nath
    Signed-off-by: Chris Ball

    Andrei Warkentin
     
  • SD cards operating at UHS104 or better support SET_BLOCK_COUNT.

    Signed-off-by: Andrei Warkentin
    Reviewed-by: Arindam Nath
    Signed-off-by: Chris Ball

    Andrei Warkentin