1. 27 4月, 2019 1 次提交
  2. 20 4月, 2019 1 次提交
  3. 06 4月, 2019 1 次提交
    • A
      mmc: omap: fix the maximum timeout setting · 194b888a
      Aaro Koskinen 提交于
      [ Upstream commit a6327b5e57fdc679c842588c3be046c0b39cc127 ]
      
      When running OMAP1 kernel on QEMU, MMC access is annoyingly noisy:
      
      	MMC: CTO of 0xff and 0xfe cannot be used!
      	MMC: CTO of 0xff and 0xfe cannot be used!
      	MMC: CTO of 0xff and 0xfe cannot be used!
      	[ad inf.]
      
      Emulator warnings appear to be valid. The TI document SPRU680 [1]
      ("OMAP5910 Dual-Core Processor MultiMedia Card/Secure Data Memory Card
      (MMC/SD) Reference Guide") page 36 states that the maximum timeout is 253
      cycles and "0xff and 0xfe cannot be used".
      
      Fix by using 0xfd as the maximum timeout.
      
      Tested using QEMU 2.5 (Siemens SX1 machine, OMAP310), and also checked on
      real hardware using Palm TE (OMAP310), Nokia 770 (OMAP1710) and Nokia N810
      (OMAP2420) that MMC works as before.
      
      [1] http://www.ti.com/lit/ug/spru680/spru680.pdf
      
      Fixes: 730c9b7e ("[MMC] Add OMAP MMC host driver")
      Signed-off-by: NAaro Koskinen <aaro.koskinen@iki.fi>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      194b888a
  4. 27 3月, 2019 3 次提交
    • W
      mmc: renesas_sdhi: limit block count to 16 bit for old revisions · 42f358b2
      Wolfram Sang 提交于
      commit c9a9497ccef205ed4ed2e247011382627876d831 upstream.
      
      R-Car Gen2 has two different SDHI incarnations in the same chip. The
      older one does not support the recently introduced 32 bit register
      access to the block count register. Make sure we use this feature only
      after the first known version.
      
      Thanks to the Renesas Testing team for this bug report!
      
      Fixes: 5603731a15ef ("mmc: tmio: fix access width of Block Count Register")
      Reported-by: NYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: NWolfram Sang <wsa+renesas@sang-engineering.com>
      Reviewed-by: NSimon Horman <horms+renesas@verge.net.au>
      Tested-by: NPhong Hoang <phong.hoang.wz@renesas.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      42f358b2
    • A
      mmc: mxcmmc: "Revert mmc: mxcmmc: handle highmem pages" · 65a5c936
      Alexander Shiyan 提交于
      commit 2b77158ffa92b820a0c5da9a3c6ead7aa069c71c upstream.
      
      This reverts commit b189e758.
      
      Unable to handle kernel paging request at virtual address c8358000
      pgd = efa405c3
      [c8358000] *pgd=00000000
      Internal error: Oops: 805 [#1] PREEMPT ARM
      CPU: 0 PID: 711 Comm: kworker/0:2 Not tainted 4.20.0+ #30
      Hardware name: Freescale i.MX27 (Device Tree Support)
      Workqueue: events mxcmci_datawork
      PC is at mxcmci_datawork+0xbc/0x2ac
      LR is at mxcmci_datawork+0xac/0x2ac
      pc : [<c04e33c8>]    lr : [<c04e33b8>]    psr: 60000013
      sp : c6c93f08  ip : 24004180  fp : 00000008
      r10: c8358000  r9 : c78b3e24  r8 : c6c92000
      r7 : 00000000  r6 : c7bb8680  r5 : c7bb86d4  r4 : c78b3de0
      r3 : 00002502  r2 : c090b2e0  r1 : 00000880  r0 : 00000000
      Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
      Control: 0005317f  Table: a68a8000  DAC: 00000055
      Process kworker/0:2 (pid: 711, stack limit = 0x389543bc)
      Stack: (0xc6c93f08 to 0xc6c94000)
      3f00:                   c7bb86d4 00000000 00000000 c6cbfde0 c7bb86d4 c7ee4200
      3f20: 00000000 c0907ea8 00000000 c7bb86d8 c0907ea8 c012077c c6cbfde0 c7bb86d4
      3f40: c6cbfde0 c6c92000 c6cbfdf4 c09280ba c0907ea8 c090b2e0 c0907ebc c0120c18
      3f60: c6cbfde0 00000000 00000000 c6cbb580 c7ba7c40 c7837edc c6cbb598 00000000
      3f80: c6cbfde0 c01208f8 00000000 c01254fc c7ba7c40 c0125400 00000000 00000000
      3fa0: 00000000 00000000 00000000 c01010d0 00000000 00000000 00000000 00000000
      3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
      [<c04e33c8>] (mxcmci_datawork) from [<c012077c>] (process_one_work+0x1f0/0x338)
      [<c012077c>] (process_one_work) from [<c0120c18>] (worker_thread+0x320/0x474)
      [<c0120c18>] (worker_thread) from [<c01254fc>] (kthread+0xfc/0x118)
      [<c01254fc>] (kthread) from [<c01010d0>] (ret_from_fork+0x14/0x24)
      Exception stack(0xc6c93fb0 to 0xc6c93ff8)
      3fa0:                                     00000000 00000000 00000000 00000000
      3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      3fe0: 00000000 00000000 00000000 00000000 00000013 00000000
      Code: e3500000 1a000059 e5153050 e5933038 (e48a3004)
      ---[ end trace 54ca629b75f0e737 ]---
      note: kworker/0:2[711] exited with preempt_count 1
      Signed-off-by: NAlexander Shiyan <shc_work@mail.ru>
      Fixes: b189e758 ("mmc: mxcmmc: handle highmem pages")
      Cc: stable@vger.kernel.org
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      65a5c936
    • A
      mmc: pxamci: fix enum type confusion · 3b687015
      Arnd Bergmann 提交于
      commit e60a582bcde01158a64ff948fb799f21f5d31a11 upstream.
      
      clang points out several instances of mismatched types in this drivers,
      all coming from a single declaration:
      
      drivers/mmc/host/pxamci.c:193:15: error: implicit conversion from enumeration type 'enum dma_transfer_direction' to
            different enumeration type 'enum dma_data_direction' [-Werror,-Wenum-conversion]
                      direction = DMA_DEV_TO_MEM;
                                ~ ^~~~~~~~~~~~~~
      drivers/mmc/host/pxamci.c:212:62: error: implicit conversion from enumeration type 'enum dma_data_direction' to
            different enumeration type 'enum dma_transfer_direction' [-Werror,-Wenum-conversion]
              tx = dmaengine_prep_slave_sg(chan, data->sg, host->dma_len, direction,
      
      The behavior is correct, so this must be a simply typo from
      dma_data_direction and dma_transfer_direction being similarly named
      types with a similar purpose.
      
      Fixes: 6464b714 ("mmc: pxamci: switch over to dmaengine use")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Reviewed-by: NNathan Chancellor <natechancellor@gmail.com>
      Acked-by: NRobert Jarzmik <robert.jarzmik@free.fr>
      Cc: stable@vger.kernel.org
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3b687015
  5. 24 3月, 2019 1 次提交
  6. 06 3月, 2019 6 次提交
    • B
      mmc: sdhci-esdhc-imx: correct the fix of ERR004536 · ff86bb4d
      BOUGH CHEN 提交于
      commit e30be063d6dbcc0f18b1eb25fa709fdef89201fb upstream.
      
      Commit 18094430 ("mmc: sdhci-esdhc-imx: add ADMA Length
      Mismatch errata fix") involve the fix of ERR004536, but the
      fix is incorrect. Double confirm with IC, need to clear the
      bit 7 of register 0x6c rather than set this bit 7.
      Here is the definition of bit 7 of 0x6c:
          0: enable the new IC fix for ERR004536
          1: do not use the IC fix, keep the same as before
      
      Find this issue on i.MX845s-evk board when enable CMDQ, and
      let system in heavy loading.
      
      root@imx8mmevk:~# dd if=/dev/mmcblk2 of=/dev/null bs=1M &
      root@imx8mmevk:~# memtester 1000M > /dev/zero &
      root@imx8mmevk:~# [  139.897220] mmc2: cqhci: timeout for tag 16
      [  139.901417] mmc2: cqhci: ============ CQHCI REGISTER DUMP ===========
      [  139.907862] mmc2: cqhci: Caps:      0x0000310a | Version:  0x00000510
      [  139.914311] mmc2: cqhci: Config:    0x00001001 | Control:  0x00000000
      [  139.920753] mmc2: cqhci: Int stat:  0x00000000 | Int enab: 0x00000006
      [  139.927193] mmc2: cqhci: Int sig:   0x00000006 | Int Coal: 0x00000000
      [  139.933634] mmc2: cqhci: TDL base:  0x7809c000 | TDL up32: 0x00000000
      [  139.940073] mmc2: cqhci: Doorbell:  0x00030000 | TCN:      0x00000000
      [  139.946518] mmc2: cqhci: Dev queue: 0x00010000 | Dev Pend: 0x00010000
      [  139.952967] mmc2: cqhci: Task clr:  0x00000000 | SSC1:     0x00011000
      [  139.959411] mmc2: cqhci: SSC2:      0x00000001 | DCMD rsp: 0x00000000
      [  139.965857] mmc2: cqhci: RED mask:  0xfdf9a080 | TERRI:    0x00000000
      [  139.972308] mmc2: cqhci: Resp idx:  0x0000002e | Resp arg: 0x00000900
      [  139.978761] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========
      [  139.985214] mmc2: sdhci: Sys addr:  0xb2c19000 | Version:  0x00000002
      [  139.991669] mmc2: sdhci: Blk size:  0x00000200 | Blk cnt:  0x00000400
      [  139.998127] mmc2: sdhci: Argument:  0x40110400 | Trn mode: 0x00000033
      [  140.004618] mmc2: sdhci: Present:   0x01088a8f | Host ctl: 0x00000030
      [  140.011113] mmc2: sdhci: Power:     0x00000002 | Blk gap:  0x00000080
      [  140.017583] mmc2: sdhci: Wake-up:   0x00000008 | Clock:    0x0000000f
      [  140.024039] mmc2: sdhci: Timeout:   0x0000008f | Int stat: 0x00000000
      [  140.030497] mmc2: sdhci: Int enab:  0x107f4000 | Sig enab: 0x107f4000
      [  140.036972] mmc2: sdhci: AC12 err:  0x00000000 | Slot int: 0x00000502
      [  140.043426] mmc2: sdhci: Caps:      0x07eb0000 | Caps_1:   0x8000b407
      [  140.049867] mmc2: sdhci: Cmd:       0x00002c1a | Max curr: 0x00ffffff
      [  140.056314] mmc2: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0xffffffff
      [  140.062755] mmc2: sdhci: Resp[2]:   0x328f5903 | Resp[3]:  0x00d00f00
      [  140.069195] mmc2: sdhci: Host ctl2: 0x00000008
      [  140.073640] mmc2: sdhci: ADMA Err:  0x00000007 | ADMA Ptr: 0x7809c108
      [  140.080079] mmc2: sdhci: ============================================
      [  140.086662] mmc2: running CQE recovery
      
      Fixes: 18094430 ("mmc: sdhci-esdhc-imx: add ADMA Length Mismatch errata fix")
      Signed-off-by: NHaibo Chen <haibo.chen@nxp.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ff86bb4d
    • A
      mmc: cqhci: Fix a tiny potential memory leak on error condition · d612d7b4
      Alamy Liu 提交于
      commit d07e9fadf3a6b466ca3ae90fa4859089ff20530f upstream.
      
      Free up the allocated memory in the case of error return
      
      The value of mmc_host->cqe_enabled stays 'false'. Thus, cqhci_disable
      (mmc_cqe_ops->cqe_disable) won't be called to free the memory.  Also,
      cqhci_disable() seems to be designed to disable and free all resources, not
      suitable to handle this corner case.
      
      Fixes: a4080225 ("mmc: cqhci: support for command queue enabled host")
      Signed-off-by: NAlamy Liu <alamy.liu@gmail.com>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d612d7b4
    • A
      mmc: cqhci: fix space allocated for transfer descriptor · e446ae40
      Alamy Liu 提交于
      commit 27ec9dc17c48ea2e642ccb90b4ebf7fd47468911 upstream.
      
      There is not enough space being allocated when DCMD is disabled.
      
      CQE_DCMD is not necessary to be enabled when CQE is enabled.
      (Software could halt CQE to send command)
      
      In the case that CQE_DCMD is not enabled, it still needs to allocate
      space for data transfer. For instance:
        CQE_DCMD is enabled:  31 slots space (one slot used by DCMD)
        CQE_DCMD is disabled: 32 slots space
      
      Fixes: a4080225 ("mmc: cqhci: support for command queue enabled host")
      Signed-off-by: NAlamy Liu <alamy.liu@gmail.com>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e446ae40
    • T
      mmc: tmio: fix access width of Block Count Register · 85d9ad40
      Takeshi Saito 提交于
      commit 5603731a15ef9ca317c122cc8c959f1dee1798b4 upstream.
      
      In R-Car Gen2 or later, the maximum number of transfer blocks are
      changed from 0xFFFF to 0xFFFFFFFF. Therefore, Block Count Register
      should use iowrite32().
      
      If another system (U-boot, Hypervisor OS, etc) uses bit[31:16], this
      value will not be cleared. So, SD/MMC card initialization fails.
      
      So, check for the bigger register and use apropriate write. Also, mark
      the register as extended on Gen2.
      Signed-off-by: NTakeshi Saito <takeshi.saito.xv@renesas.com>
      [wsa: use max_blk_count in if(), add Gen2, update commit message]
      Signed-off-by: NWolfram Sang <wsa+renesas@sang-engineering.com>
      Cc: stable@kernel.org
      Reviewed-by: NSimon Horman <horms+renesas@verge.net.au>
      [Ulf: Fixed build error]
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      85d9ad40
    • S
      mmc: tmio_mmc_core: don't claim spurious interrupts · 5b716bc5
      Sergei Shtylyov 提交于
      commit 5c27ff5db1491a947264d6d4e4cbe43ae6535bae upstream.
      
      I have encountered an interrupt storm during the eMMC chip probing (and
      the chip finally didn't get detected).  It turned out that U-Boot left
      the DMAC interrupts enabled while the Linux driver  didn't use those.
      The SDHI driver's interrupt handler somehow assumes that, even if an
      SDIO interrupt didn't happen, it should return IRQ_HANDLED.  I think
      that if none of the enabled interrupts happened and got handled, we
      should return IRQ_NONE -- that way the kernel IRQ code recoginizes
      a spurious interrupt and masks it off pretty quickly...
      
      Fixes: 7729c7a2 ("mmc: tmio: Provide separate interrupt handlers")
      Signed-off-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Reviewed-by: NWolfram Sang <wsa+renesas@sang-engineering.com>
      Tested-by: NWolfram Sang <wsa+renesas@sang-engineering.com>
      Reviewed-by: NSimon Horman <horms+renesas@verge.net.au>
      Cc: stable@vger.kernel.org
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5b716bc5
    • J
      mmc: spi: Fix card detection during probe · c69e07a8
      Jonathan Neuschäfer 提交于
      commit c9bd505dbd9d3dc80c496f88eafe70affdcf1ba6 upstream.
      
      When using the mmc_spi driver with a card-detect pin, I noticed that the
      card was not detected immediately after probe, but only after it was
      unplugged and plugged back in (and the CD IRQ fired).
      
      The call tree looks something like this:
      
      mmc_spi_probe
        mmc_add_host
          mmc_start_host
            _mmc_detect_change
              mmc_schedule_delayed_work(&host->detect, 0)
                mmc_rescan
                  host->bus_ops->detect(host)
                    mmc_detect
                      _mmc_detect_card_removed
                        host->ops->get_cd(host)
                          mmc_gpio_get_cd -> -ENOSYS (ctx->cd_gpio not set)
        mmc_gpiod_request_cd
          ctx->cd_gpio = desc
      
      To fix this issue, call mmc_detect_change after the card-detect GPIO/IRQ
      is registered.
      Signed-off-by: NJonathan Neuschäfer <j.neuschaefer@gmx.net>
      Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c69e07a8
  7. 23 2月, 2019 1 次提交
    • M
      mmc: meson-gx: fix interrupt name · f9e6a18a
      Martin Blumenstingl 提交于
      commit 83e418a805d880a8b18add07f94d19b2a5a80307 upstream.
      
      Commit bb364890323cca ("mmc: meson-gx: Free irq in release() callback")
      changed the _probe code to use request_threaded_irq() instead of
      devm_request_threaded_irq().
      Unfortunately this removes a fallback for the interrupt name:
      devm_request_threaded_irq() uses the device name as fallback if the
      given IRQ name is NULL. request_threaded_irq() has no such fallback,
      thus /proc/interrupts shows "(null)" instead.
      
      Explicitly pass the dev_name() so we get the IRQ name shown in
      /proc/interrupts again.
      While here, also fix the indentation of the request_threaded_irq()
      parameter list.
      
      Fixes: bb364890323cca ("mmc: meson-gx: Free irq in release() callback")
      Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f9e6a18a
  8. 20 2月, 2019 1 次提交
  9. 13 2月, 2019 7 次提交
  10. 07 2月, 2019 3 次提交
  11. 31 1月, 2019 2 次提交
  12. 26 1月, 2019 1 次提交
    • J
      mmc: atmel-mci: do not assume idle after atmci_request_end · c21991ed
      Jonas Danielsson 提交于
      [ Upstream commit ae460c115b7aa50c9a36cf78fced07b27962c9d0 ]
      
      On our AT91SAM9260 board we use the same sdio bus for wifi and for the
      sd card slot. This caused the atmel-mci to give the following splat on
      the serial console:
      
        ------------[ cut here ]------------
        WARNING: CPU: 0 PID: 538 at drivers/mmc/host/atmel-mci.c:859 atmci_send_command+0x24/0x44
        Modules linked in:
        CPU: 0 PID: 538 Comm: mmcqd/0 Not tainted 4.14.76 #14
        Hardware name: Atmel AT91SAM9
        [<c000fccc>] (unwind_backtrace) from [<c000d3dc>] (show_stack+0x10/0x14)
        [<c000d3dc>] (show_stack) from [<c0017644>] (__warn+0xd8/0xf4)
        [<c0017644>] (__warn) from [<c0017704>] (warn_slowpath_null+0x1c/0x24)
        [<c0017704>] (warn_slowpath_null) from [<c033bb9c>] (atmci_send_command+0x24/0x44)
        [<c033bb9c>] (atmci_send_command) from [<c033e984>] (atmci_start_request+0x1f4/0x2dc)
        [<c033e984>] (atmci_start_request) from [<c033f3b4>] (atmci_request+0xf0/0x164)
        [<c033f3b4>] (atmci_request) from [<c0327108>] (mmc_start_request+0x280/0x2d0)
        [<c0327108>] (mmc_start_request) from [<c032800c>] (mmc_start_areq+0x230/0x330)
        [<c032800c>] (mmc_start_areq) from [<c03366f8>] (mmc_blk_issue_rw_rq+0xc4/0x310)
        [<c03366f8>] (mmc_blk_issue_rw_rq) from [<c03372c4>] (mmc_blk_issue_rq+0x118/0x5ac)
        [<c03372c4>] (mmc_blk_issue_rq) from [<c033781c>] (mmc_queue_thread+0xc4/0x118)
        [<c033781c>] (mmc_queue_thread) from [<c002daf8>] (kthread+0x100/0x118)
        [<c002daf8>] (kthread) from [<c000a580>] (ret_from_fork+0x14/0x34)
        ---[ end trace 594371ddfa284bd6 ]---
      
      This is:
        WARN_ON(host->cmd);
      
      This was fixed on our board by letting atmci_request_end determine what
      state we are in. Instead of unconditionally setting it to STATE_IDLE on
      STATE_END_REQUEST.
      Signed-off-by: NJonas Danielsson <jonas@orbital-systems.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      c21991ed
  13. 23 1月, 2019 1 次提交
  14. 29 12月, 2018 1 次提交
    • R
      mmc: omap_hsmmc: fix DMA API warning · 0867cfaa
      Russell King 提交于
      commit 0b479790684192ab7024ce6a621f93f6d0a64d92 upstream.
      
      While booting with rootfs on MMC, the following warning is encountered
      on OMAP4430:
      
      omap-dma-engine 4a056000.dma-controller: DMA-API: mapping sg segment longer than device claims to support [len=69632] [max=65536]
      
      This is because the DMA engine has a default maximum segment size of 64K
      but HSMMC sets:
      
              mmc->max_blk_size = 512;       /* Block Length at max can be 1024 */
              mmc->max_blk_count = 0xFFFF;    /* No. of Blocks is 16 bits */
              mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
              mmc->max_seg_size = mmc->max_req_size;
      
      which ends up telling the block layer that we support a maximum segment
      size of 65535*512, which exceeds the advertised DMA engine capabilities.
      
      Fix this by clamping the maximum segment size to the lower of the
      maximum request size and of the DMA engine device used for either DMA
      channel.
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0867cfaa
  15. 20 12月, 2018 3 次提交
    • A
      mmc: sdhci: fix the timeout check window for clock and reset · 113fe99d
      Alek Du 提交于
      commit b704441e38f645dcfba1348ca3cc1ba43d1a9f31 upstream.
      
      We observed some premature timeouts on a virtualization platform, the log
      is like this:
      
      case 1:
      [159525.255629] mmc1: Internal clock never stabilised.
      [159525.255818] mmc1: sdhci: ============ SDHCI REGISTER DUMP ===========
      [159525.256049] mmc1: sdhci: Sys addr:  0x00000000 | Version:  0x00001002
      ...
      [159525.257205] mmc1: sdhci: Wake-up:   0x00000000 | Clock:    0x0000fa03
      From the clock control register dump, we are pretty sure the clock was
      stablized.
      
      case 2:
      [  914.550127] mmc1: Reset 0x2 never completed.
      [  914.550321] mmc1: sdhci: ============ SDHCI REGISTER DUMP ===========
      [  914.550608] mmc1: sdhci: Sys addr:  0x00000010 | Version:  0x00001002
      
      After checking the sdhci code, we found the timeout check actually has a
      little window that the CPU can be scheduled out and when it comes back,
      the original time set or check is not valid.
      
      Fixes: 5a436cc0 ("mmc: sdhci: Optimize delay loops")
      Cc: stable@vger.kernel.org      # v4.12+
      Signed-off-by: NAlek Du <alek.du@intel.com>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      113fe99d
    • F
      mmc: sdhci-omap: Fix DCRC error handling during tuning · 661feb2f
      Faiz Abbas 提交于
      commit db2039fcfd5754d15986340152e4503737f68f8d upstream.
      
      Commit 7d33c358 ("mmc: sdhci-omap: Workaround for Errata i802")
      disabled DCRC interrupts during tuning. This write to the interrupt
      enable register gets overwritten in sdhci_prepare_data() and the
      interrupt is not in fact disabled. Fix this by disabling the interrupt
      in the host->ier variable.
      
      Fixes: 7d33c358 ("mmc: sdhci-omap: Workaround for Errata i802")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NFaiz Abbas <faiz_abbas@ti.com>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      661feb2f
    • A
      MMC: OMAP: fix broken MMC on OMAP15XX/OMAP5910/OMAP310 · e1e99fea
      Aaro Koskinen 提交于
      commit e8cde625 upstream.
      
      Since v2.6.22 or so there has been reports [1] about OMAP MMC being
      broken on OMAP15XX based hardware (OMAP5910 and OMAP310). The breakage
      seems to have been caused by commit 46a6730e ("mmc-omap: Fix
      omap to use MMC_POWER_ON") that changed clock enabling to be done
      on MMC_POWER_ON. This can happen multiple times in a row, and on 15XX
      the hardware doesn't seem to like it and the MMC just stops responding.
      Fix by memorizing the power mode and do the init only when necessary.
      
      Before the patch (on Palm TE):
      
      	mmc0: new SD card at address b368
      	mmcblk0: mmc0:b368 SDC   977 MiB
      	mmci-omap mmci-omap.0: command timeout (CMD18)
      	mmci-omap mmci-omap.0: command timeout (CMD13)
      	mmci-omap mmci-omap.0: command timeout (CMD13)
      	mmci-omap mmci-omap.0: command timeout (CMD12) [x 6]
      	mmci-omap mmci-omap.0: command timeout (CMD13) [x 6]
      	mmcblk0: error -110 requesting status
      	mmci-omap mmci-omap.0: command timeout (CMD8)
      	mmci-omap mmci-omap.0: command timeout (CMD18)
      	mmci-omap mmci-omap.0: command timeout (CMD13)
      	mmci-omap mmci-omap.0: command timeout (CMD13)
      	mmci-omap mmci-omap.0: command timeout (CMD12) [x 6]
      	mmci-omap mmci-omap.0: command timeout (CMD13) [x 6]
      	mmcblk0: error -110 requesting status
      	mmcblk0: recovery failed!
      	print_req_error: I/O error, dev mmcblk0, sector 0
      	Buffer I/O error on dev mmcblk0, logical block 0, async page read
      	 mmcblk0: unable to read partition table
      
      After the patch:
      
      	mmc0: new SD card at address b368
      	mmcblk0: mmc0:b368 SDC   977 MiB
      	 mmcblk0: p1
      
      The patch is based on a fix and analysis done by Ladislav Michl.
      
      Tested on OMAP15XX/OMAP310 (Palm TE), OMAP1710 (Nokia 770)
      and OMAP2420 (Nokia N810).
      
      [1] https://marc.info/?t=123175197000003&r=1&w=2
      
      Fixes: 46a6730e ("mmc-omap: Fix omap to use MMC_POWER_ON")
      Reported-by: NLadislav Michl <ladis@linux-mips.org>
      Reported-by: NAndrzej Zaborowski <balrogg@gmail.com>
      Tested-by: NLadislav Michl <ladis@linux-mips.org>
      Acked-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NAaro Koskinen <aaro.koskinen@iki.fi>
      Cc: stable@vger.kernel.org
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e1e99fea
  16. 01 12月, 2018 2 次提交
    • A
      mmc: sdhci-pci: Workaround GLK firmware failing to restore the tuning value · 6d24302a
      Adrian Hunter 提交于
      commit 5305ec6a27b2dc7398a689e661a4a2e951026f09 upstream.
      
      GLK firmware can indicate that the tuning value will be restored after
      runtime suspend, but not actually do that. Add a workaround that detects
      such cases, and lets the driver do re-tuning instead.
      Reported-by: NAnisse Astier <anisse@astier.eu>
      Tested-by: NAnisse Astier <anisse@astier.eu>
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6d24302a
    • R
      mmc: sdhci-pci: Try "cd" for card-detect lookup before using NULL · 52f40362
      Rajat Jain 提交于
      commit cdcefe6bd9df754f528ffc339d3cc143cea4ddf6 upstream.
      
      Problem:
      
      The card detect IRQ does not work with modern BIOS (that want
      to use _DSD to provide the card detect GPIO to the driver).
      
      Details:
      
      The mmc core provides the mmc_gpiod_request_cd() API to let host drivers
      request the gpio descriptor for the "card detect" pin.
      This pin is specified in the ACPI for the SDHC device:
      
       * Either as a resource using _CRS. This is a method used by legacy BIOS.
         (The driver needs to tell which resource index).
      
       * Or as a named property ("cd-gpios"/"cd-gpio") in _DSD (which internally
         points to an entry in _CRS). This way, the driver can lookup using a
         string. This is what modern BIOS prefer to use.
      
      This API finally results in a call to the following code:
      
      struct gpio_desc *acpi_find_gpio(..., const char *con_id,...)
      {
      ...
         /* Lookup gpio (using "<con_id>-gpio") in the _DSD */
      ...
         if (!acpi_can_fallback_to_crs(adev, con_id))
                return ERR_PTR(-ENOENT);
      ...
         /* Falling back to _CRS is allowed, Lookup gpio in the _CRS */
      ...
      }
      
      Note that this means that if the ACPI has _DSD properties, the kernel
      will never use _CRS for the lookup (Because acpi_can_fallback_to_crs()
      will always be false for any device hat has _DSD entries).
      
      The SDHCI driver is thus currently broken on a modern BIOS, even if
      BIOS provides both _CRS (for index based lookup) and _DSD entries (for
      string based lookup). Ironically, none of these will be used for the
      lookup currently because:
      
      * Since the con_id is NULL, acpi_find_gpio() does not find a matching
        entry in DSDT. (The _DSDT entry has the property name = "cd-gpios")
      
      * Because ACPI contains DSDT entries, thus acpi_can_fallback_to_crs()
        returns false (because device properties have been populated from
        _DSD), thus the _CRS is never used for the lookup.
      
      Fix:
      
      Try "cd" for lookup in the _DSD before falling back to using NULL so
      as to try looking up in the _CRS.
      
      I've tested this patch successfully with both Legacy BIOS (that
      provide only _CRS method) as well as modern BIOS (that provide both
      _CRS and _DSD). Also the use of "cd" appears to be fairly consistent
      across other users of this API (other MMC host controller drivers).
      
      Link: https://lkml.org/lkml/2018/9/25/1113Signed-off-by: NRajat Jain <rajatja@google.com>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Fixes: f10e4bf6 ("gpio: acpi: Even more tighten up ACPI GPIO lookups")
      Cc: stable@vger.kernel.org
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      52f40362
  17. 14 11月, 2018 2 次提交
    • W
      sdhci: acpi: add free_slot callback · cf6e9d03
      Wang Dongsheng 提交于
      [ Upstream commit c7eabbee ]
      
      The device specific resource can be free in free_slot after
      removing host controller.
      Signed-off-by: NWang Dongsheng <dongsheng.wang@hxt-semitech.com>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cf6e9d03
    • Y
      mmc: sdhci-pci-o2micro: Add quirk for O2 Micro dev 0x8620 rev 0x01 · 3625a551
      Yu Zhao 提交于
      [ Upstream commit 5169894982bb67486d93cc1e10151712bb86bcb6 ]
      
      This device reports SDHCI_CLOCK_INT_STABLE even though it's not
      ready to take SDHCI_CLOCK_CARD_EN. The symptom is that reading
      SDHCI_CLOCK_CONTROL after enabling the clock shows absence of the
      bit from the register (e.g. expecting 0x0000fa07 = 0x0000fa03 |
      SDHCI_CLOCK_CARD_EN but only observed the first operand).
      
      mmc1: Timeout waiting for hardware cmd interrupt.
      mmc1: sdhci: ============ SDHCI REGISTER DUMP ===========
      mmc1: sdhci: Sys addr:  0x00000000 | Version:  0x00000603
      mmc1: sdhci: Blk size:  0x00000000 | Blk cnt:  0x00000000
      mmc1: sdhci: Argument:  0x00000000 | Trn mode: 0x00000000
      mmc1: sdhci: Present:   0x01ff0001 | Host ctl: 0x00000001
      mmc1: sdhci: Power:     0x0000000f | Blk gap:  0x00000000
      mmc1: sdhci: Wake-up:   0x00000000 | Clock:    0x0000fa03
      mmc1: sdhci: Timeout:   0x00000000 | Int stat: 0x00000000
      mmc1: sdhci: Int enab:  0x00ff0083 | Sig enab: 0x00ff0083
      mmc1: sdhci: AC12 err:  0x00000000 | Slot int: 0x00000000
      mmc1: sdhci: Caps:      0x25fcc8bf | Caps_1:   0x00002077
      mmc1: sdhci: Cmd:       0x00000000 | Max curr: 0x005800c8
      mmc1: sdhci: Resp[0]:   0x00000000 | Resp[1]:  0x00000000
      mmc1: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
      mmc1: sdhci: Host ctl2: 0x00000008
      mmc1: sdhci: ADMA Err:  0x00000000 | ADMA Ptr: 0x00000000
      mmc1: sdhci: ============================================
      
      The problem happens during wakeup from S3. Adding a delay quirk
      after power up reliably fixes the problem.
      Signed-off-by: NYu Zhao <yuzhao@google.com>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3625a551
  18. 18 9月, 2018 1 次提交
  19. 05 9月, 2018 1 次提交
    • J
      mmc: meson-mx-sdio: fix OF child-node lookup · c483a5cc
      Johan Hovold 提交于
      Use the new of_get_compatible_child() helper to lookup the slot child
      node instead of using of_find_compatible_node(), which searches the
      entire tree from a given start node and thus can return an unrelated
      (i.e. non-child) node.
      
      This also addresses a potential use-after-free (e.g. after probe
      deferral) as the tree-wide helper drops a reference to its first
      argument (i.e. the node of the device being probed).
      
      While at it, also fix up the related slot-node reference leak.
      
      Fixes: ed80a13b ("mmc: meson-mx-sdio: Add a driver for the Amlogic Meson8 and Meson8b SoCs")
      Cc: stable <stable@vger.kernel.org>     # 4.15
      Cc: Carlo Caione <carlo@endlessm.com>
      Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
      Cc: Ulf Hansson <ulf.hansson@linaro.org>
      Acked-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      c483a5cc
  20. 04 9月, 2018 1 次提交
    • A
      mmc: omap_hsmmc: fix wakeirq handling on removal · 3c398f3c
      Andreas Kemnade 提交于
      after unbinding mmc I get things like this:
      [  185.294067] mmc1: card 0001 removed
      [  185.305206] omap_hsmmc 480b4000.mmc: wake IRQ with no resume: -13
      
      The wakeirq stays in /proc-interrupts
      
      rebinding shows this:
      [  289.795959] genirq: Flags mismatch irq 112. 0000200a (480b4000.mmc:wakeup) vs. 0000200a (480b4000.mmc:wakeup)
      [  289.808959] omap_hsmmc 480b4000.mmc: Unable to request wake IRQ
      [  289.815338] omap_hsmmc 480b4000.mmc: no SDIO IRQ support, falling back to polling
      
      That bug seems to be introduced by switching from devm_request_irq()
      to generic wakeirq handling.
      
      So let us cleanup at removal.
      Signed-off-by: NAndreas Kemnade <andreas@kemnade.info>
      Fixes: 5b83b223 ("mmc: omap_hsmmc: Change wake-up interrupt to use generic wakeirq")
      Cc: stable@vger.kernel.org # v4.2+
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      3c398f3c