Skip to content

Commit

Permalink
Merge tag 'mmc-v4.7' of git://git.linaro.org/people/ulf.hansson/mmc
Browse files Browse the repository at this point in the history
Pull MMC updates from Ulf Hansson:
 "MMC core:
   - Add TRACE support to be able to debug request flow
   - Extend/improve reset support for (e)MMC
   - Convert MMC pwrseq to platform device drivers
   - Use IDA for indexes
   - Some additional minor improvements

  MMC host:
   - sdhci: Re-factoring, clean-ups and improvements
   - sdhci-acpi|pci: Use MMC_CAP_AGGRESSIVE_PM for Broxton
   - omap/omap_hsmmc: Convert to use dma_request_chan()
   - usdhi6rol0: Add support for UHS modes
   - sh_mmcif: Update runtime PM support
   - tmio: Wolfram Sang steps in as maintainer
   - tmio: Add UHS-I mode support
   - sh_mobile_sdhi: Add UHS-I mode support
   - tmio/sdhi: Re-factoring, clean-ups and improvements
   - dw_mmc: Re-factoring and clean-ups
   - davinci: Convert to use dma_request_chan()"

* tag 'mmc-v4.7' of git://git.linaro.org/people/ulf.hansson/mmc: (99 commits)
  mmc: mmc: Fix partition switch timeout for some eMMCs
  mmc: sh_mobile_sdhi: enable SDIO IRQs for RCar Gen3
  mmc: sdio: fall back to SDIO 1.0 for broken 1.1 cards
  mmc: sdhci-st: correct name of sd-uhs-sdr50 property
  MAINTAINERS: update entry for TMIO MMC driver
  mmc: block: improve logging of handling emmc timeouts
  mmc: sdhci: removed unneeded function wrappers
  mmc: core: remove the invalid message in mmc_select_timing
  mmc: core: fix using wrong io voltage if mmc_select_hs200 fails
  mmc: sdhci-of-arasan: fix set_clock when a phy is supported
  mmc: omap: Use dma_request_chan() for requesting DMA channel
  mmc: mmc: Attempt to flush cache before reset
  mmc: sh_mobile_sdhi: check return value when changing clk
  mmc: sh_mobile_sdhi: only change the clock on RCar Gen2+
  mmc: tmio/sdhi: introduce flag for RCar 2+ specific features
  mmc: sh_mobile_sdhi: make clk_update function more compact
  mmc: omap_hsmmc: Use dma_request_chan() for requesting DMA channel
  mmc: sdhci-of-at91: add presets setup
  mmc: usdhi6rol0: add pinctrl to set pin drive strength
  mmc: usdhi6rol0: add support for UHS modes
  ...
  • Loading branch information
Linus Torvalds committed May 17, 2016
2 parents d9dce51 + 1c44711 commit 3e21e5d
Show file tree
Hide file tree
Showing 54 changed files with 1,262 additions and 1,097 deletions.
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/mmc/sdhci-st.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Optional properties:
- bus-width: Number of data lines.
See: Documentation/devicetree/bindings/mmc/mmc.txt.

- max-frequency: Can be 200MHz, 100Mz or 50MHz (default) and used for
- max-frequency: Can be 200MHz, 100Mz or 50MHz (default) and used for
configuring the CCONFIG3 in the mmcss.
See: Documentation/devicetree/bindings/mmc/mmc.txt.

Expand All @@ -48,7 +48,7 @@ Optional properties:
- vqmmc-supply: Phandle to the regulator dt node, mentioned as the vcc/vdd
supply in eMMC/SD specs.

- sd-uhs--sdr50: To enable the SDR50 in the mmcss.
- sd-uhs-sdr50: To enable the SDR50 in the mmcss.
See: Documentation/devicetree/bindings/mmc/mmc.txt.

- sd-uhs-sdr104: To enable the SDR104 in the mmcss.
Expand Down
3 changes: 3 additions & 0 deletions Documentation/devicetree/bindings/mmc/tmio_mmc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ Required properties:

Optional properties:
- toshiba,mmc-wrprotect-disable: write-protect detection is unavailable
- pinctrl-names: should be "default", "state_uhs"
- pinctrl-0: should contain default/high speed pin ctrl
- pinctrl-1: should contain uhs mode pin ctrl
6 changes: 6 additions & 0 deletions Documentation/devicetree/bindings/mmc/usdhi6rol0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ Optional properties:

- vmmc-supply: a phandle of a regulator, supplying Vcc to the card
- vqmmc-supply: a phandle of a regulator, supplying VccQ to the card
- pinctrl-names: Can contain a "default" entry and a "state_uhs"
entry. The state_uhs entry is used together with the default
entry when the board requires distinct settings for UHS speeds.

- pinctrl-N: One property for each name listed in pinctrl-names, see
../pinctrl/pinctrl-bindings.txt.

Additionally any standard mmc bindings from mmc.txt can be used.

Expand Down
9 changes: 4 additions & 5 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -11246,14 +11246,13 @@ S: Maintained
F: drivers/media/i2c/tc358743*
F: include/media/i2c/tc358743.h

TMIO MMC DRIVER
M: Ian Molton <ian@mnementh.co.uk>
TMIO/SDHI MMC DRIVER
M: Wolfram Sang <wsa+renesas@sang-engineering.com>
L: linux-mmc@vger.kernel.org
S: Maintained
S: Supported
F: drivers/mmc/host/tmio_mmc*
F: drivers/mmc/host/sh_mobile_sdhi.c
F: include/linux/mmc/tmio.h
F: include/linux/mmc/sh_mobile_sdhi.h
F: include/linux/mfd/tmio.h

TMP401 HARDWARE MONITOR DRIVER
M: Guenter Roeck <linux@roeck-us.net>
Expand Down
20 changes: 0 additions & 20 deletions arch/arm/mach-davinci/devices-da8xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,16 +751,6 @@ static struct resource da8xx_mmcsd0_resources[] = {
.end = IRQ_DA8XX_MMCSDINT0,
.flags = IORESOURCE_IRQ,
},
{ /* DMA RX */
.start = DA8XX_DMA_MMCSD0_RX,
.end = DA8XX_DMA_MMCSD0_RX,
.flags = IORESOURCE_DMA,
},
{ /* DMA TX */
.start = DA8XX_DMA_MMCSD0_TX,
.end = DA8XX_DMA_MMCSD0_TX,
.flags = IORESOURCE_DMA,
},
};

static struct platform_device da8xx_mmcsd0_device = {
Expand Down Expand Up @@ -788,16 +778,6 @@ static struct resource da850_mmcsd1_resources[] = {
.end = IRQ_DA850_MMCSDINT0_1,
.flags = IORESOURCE_IRQ,
},
{ /* DMA RX */
.start = DA850_DMA_MMCSD1_RX,
.end = DA850_DMA_MMCSD1_RX,
.flags = IORESOURCE_DMA,
},
{ /* DMA TX */
.start = DA850_DMA_MMCSD1_TX,
.end = DA850_DMA_MMCSD1_TX,
.flags = IORESOURCE_DMA,
},
};

static struct platform_device da850_mmcsd1_device = {
Expand Down
16 changes: 0 additions & 16 deletions arch/arm/mach-davinci/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,6 @@ static struct resource mmcsd0_resources[] = {
.start = IRQ_SDIOINT,
.flags = IORESOURCE_IRQ,
},
/* DMA channels: RX, then TX */
{
.start = EDMA_CTLR_CHAN(0, DAVINCI_DMA_MMCRXEVT),
.flags = IORESOURCE_DMA,
}, {
.start = EDMA_CTLR_CHAN(0, DAVINCI_DMA_MMCTXEVT),
.flags = IORESOURCE_DMA,
},
};

static struct platform_device davinci_mmcsd0_device = {
Expand Down Expand Up @@ -181,14 +173,6 @@ static struct resource mmcsd1_resources[] = {
.start = IRQ_DM355_SDIOINT1,
.flags = IORESOURCE_IRQ,
},
/* DMA channels: RX, then TX */
{
.start = EDMA_CTLR_CHAN(0, 30), /* rx */
.flags = IORESOURCE_DMA,
}, {
.start = EDMA_CTLR_CHAN(0, 31), /* tx */
.flags = IORESOURCE_DMA,
},
};

static struct platform_device davinci_mmcsd1_device = {
Expand Down
1 change: 0 additions & 1 deletion arch/sh/boards/board-sh7757lcr.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <linux/mfd/tmio.h>
#include <linux/mmc/host.h>
#include <linux/mmc/sh_mmcif.h>
#include <linux/mmc/sh_mobile_sdhi.h>
#include <linux/sh_eth.h>
#include <linux/sh_intc.h>
#include <linux/usb/renesas_usbhs.h>
Expand Down
1 change: 0 additions & 1 deletion arch/sh/boards/mach-ap325rxa/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/mmc/host.h>
#include <linux/mmc/sh_mobile_sdhi.h>
#include <linux/mtd/physmap.h>
#include <linux/mtd/sh_flctl.h>
#include <linux/mfd/tmio.h>
Expand Down
1 change: 0 additions & 1 deletion arch/sh/boards/mach-ecovec24/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <linux/platform_device.h>
#include <linux/mmc/host.h>
#include <linux/mmc/sh_mmcif.h>
#include <linux/mmc/sh_mobile_sdhi.h>
#include <linux/mtd/physmap.h>
#include <linux/mfd/tmio.h>
#include <linux/gpio.h>
Expand Down
1 change: 0 additions & 1 deletion arch/sh/boards/mach-kfr2r09/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/mmc/host.h>
#include <linux/mmc/sh_mobile_sdhi.h>
#include <linux/mfd/tmio.h>
#include <linux/mtd/physmap.h>
#include <linux/mtd/onenand.h>
Expand Down
1 change: 0 additions & 1 deletion arch/sh/boards/mach-migor/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <linux/input.h>
#include <linux/input/sh_keysc.h>
#include <linux/mmc/host.h>
#include <linux/mmc/sh_mobile_sdhi.h>
#include <linux/mtd/physmap.h>
#include <linux/mfd/tmio.h>
#include <linux/mtd/nand.h>
Expand Down
1 change: 0 additions & 1 deletion arch/sh/boards/mach-se/7724/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/mmc/host.h>
#include <linux/mmc/sh_mobile_sdhi.h>
#include <linux/mfd/tmio.h>
#include <linux/mtd/physmap.h>
#include <linux/delay.h>
Expand Down
45 changes: 35 additions & 10 deletions drivers/mmc/card/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <linux/capability.h>
#include <linux/compat.h>
#include <linux/pm_runtime.h>
#include <linux/idr.h>

#include <linux/mmc/ioctl.h>
#include <linux/mmc/card.h>
Expand Down Expand Up @@ -78,14 +79,14 @@ static int perdev_minors = CONFIG_MMC_BLOCK_MINORS;
/*
* We've only got one major, so number of mmcblk devices is
* limited to (1 << 20) / number of minors per device. It is also
* currently limited by the size of the static bitmaps below.
* limited by the MAX_DEVICES below.
*/
static int max_devices;

#define MAX_DEVICES 256

/* TODO: Replace these with struct ida */
static DECLARE_BITMAP(dev_use, MAX_DEVICES);
static DEFINE_IDA(mmc_blk_ida);
static DEFINE_SPINLOCK(mmc_blk_lock);

/*
* There is one mmc_blk_data per slot.
Expand Down Expand Up @@ -178,7 +179,9 @@ static void mmc_blk_put(struct mmc_blk_data *md)
int devidx = mmc_get_devidx(md->disk);
blk_cleanup_queue(md->queue.queue);

__clear_bit(devidx, dev_use);
spin_lock(&mmc_blk_lock);
ida_remove(&mmc_blk_ida, devidx);
spin_unlock(&mmc_blk_lock);

put_disk(md->disk);
kfree(md);
Expand Down Expand Up @@ -945,16 +948,22 @@ static int mmc_blk_cmd_error(struct request *req, const char *name, int error,
req->rq_disk->disk_name, "timed out", name, status);

/* If the status cmd initially failed, retry the r/w cmd */
if (!status_valid)
if (!status_valid) {
pr_err("%s: status not valid, retrying timeout\n",
req->rq_disk->disk_name);
return ERR_RETRY;
}

/*
* If it was a r/w cmd crc error, or illegal command
* (eg, issued in wrong state) then retry - we should
* have corrected the state problem above.
*/
if (status & (R1_COM_CRC_ERROR | R1_ILLEGAL_COMMAND))
if (status & (R1_COM_CRC_ERROR | R1_ILLEGAL_COMMAND)) {
pr_err("%s: command error, retrying timeout\n",
req->rq_disk->disk_name);
return ERR_RETRY;
}

/* Otherwise abort the command */
return ERR_ABORT;
Expand Down Expand Up @@ -2189,10 +2198,23 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
struct mmc_blk_data *md;
int devidx, ret;

devidx = find_first_zero_bit(dev_use, max_devices);
if (devidx >= max_devices)
return ERR_PTR(-ENOSPC);
__set_bit(devidx, dev_use);
again:
if (!ida_pre_get(&mmc_blk_ida, GFP_KERNEL))
return ERR_PTR(-ENOMEM);

spin_lock(&mmc_blk_lock);
ret = ida_get_new(&mmc_blk_ida, &devidx);
spin_unlock(&mmc_blk_lock);

if (ret == -EAGAIN)
goto again;
else if (ret)
return ERR_PTR(ret);

if (devidx >= max_devices) {
ret = -ENOSPC;
goto out;
}

md = kzalloc(sizeof(struct mmc_blk_data), GFP_KERNEL);
if (!md) {
Expand Down Expand Up @@ -2289,6 +2311,9 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
err_kfree:
kfree(md);
out:
spin_lock(&mmc_blk_lock);
ida_remove(&mmc_blk_ida, devidx);
spin_unlock(&mmc_blk_lock);
return ERR_PTR(ret);
}

Expand Down
21 changes: 21 additions & 0 deletions drivers/mmc/core/Kconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
#
# MMC core configuration
#
config PWRSEQ_EMMC
tristate "HW reset support for eMMC"
default y
depends on OF
help
This selects Hardware reset support aka pwrseq-emmc for eMMC
devices. By default this option is set to y.

This driver can also be built as a module. If so, the module
will be called pwrseq_emmc.

config PWRSEQ_SIMPLE
tristate "Simple HW reset support for MMC"
default y
depends on OF
help
This selects simple hardware reset support aka pwrseq-simple for MMC
devices. By default this option is set to y.

This driver can also be built as a module. If so, the module
will be called pwrseq_simple.
4 changes: 3 additions & 1 deletion drivers/mmc/core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ mmc_core-y := core.o bus.o host.o \
sdio.o sdio_ops.o sdio_bus.o \
sdio_cis.o sdio_io.o sdio_irq.o \
quirks.o slot-gpio.o
mmc_core-$(CONFIG_OF) += pwrseq.o pwrseq_simple.o pwrseq_emmc.o
mmc_core-$(CONFIG_OF) += pwrseq.o
obj-$(CONFIG_PWRSEQ_SIMPLE) += pwrseq_simple.o
obj-$(CONFIG_PWRSEQ_EMMC) += pwrseq_emmc.o
mmc_core-$(CONFIG_DEBUG_FS) += debugfs.o
12 changes: 10 additions & 2 deletions drivers/mmc/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
#include <linux/mmc/sd.h>
#include <linux/mmc/slot-gpio.h>

#define CREATE_TRACE_POINTS
#include <trace/events/mmc.h>

#include "core.h"
#include "bus.h"
#include "host.h"
Expand Down Expand Up @@ -140,6 +143,8 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq)
cmd->retries = 0;
}

trace_mmc_request_done(host, mrq);

if (err && cmd->retries && !mmc_card_removed(host->card)) {
/*
* Request starter must handle retries - see
Expand Down Expand Up @@ -215,6 +220,8 @@ static void __mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
}
}

trace_mmc_request_start(host, mrq);

host->ops->request(host, mrq);
}

Expand Down Expand Up @@ -2449,8 +2456,9 @@ int mmc_hw_reset(struct mmc_host *host)
ret = host->bus_ops->reset(host);
mmc_bus_put(host);

if (ret != -EOPNOTSUPP)
pr_warn("%s: tried to reset card\n", mmc_hostname(host));
if (ret)
pr_warn("%s: tried to reset card, got error %d\n",
mmc_hostname(host), ret);

return ret;
}
Expand Down
22 changes: 14 additions & 8 deletions drivers/mmc/core/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@

#define cls_dev_to_mmc_host(d) container_of(d, struct mmc_host, class_dev)

static DEFINE_IDR(mmc_host_idr);
static DEFINE_IDA(mmc_host_ida);
static DEFINE_SPINLOCK(mmc_host_lock);

static void mmc_host_classdev_release(struct device *dev)
{
struct mmc_host *host = cls_dev_to_mmc_host(dev);
spin_lock(&mmc_host_lock);
idr_remove(&mmc_host_idr, host->index);
ida_remove(&mmc_host_ida, host->index);
spin_unlock(&mmc_host_lock);
kfree(host);
}
Expand Down Expand Up @@ -321,14 +321,20 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)

/* scanning will be enabled when we're ready */
host->rescan_disable = 1;
idr_preload(GFP_KERNEL);

again:
if (!ida_pre_get(&mmc_host_ida, GFP_KERNEL)) {
kfree(host);
return NULL;
}

spin_lock(&mmc_host_lock);
err = idr_alloc(&mmc_host_idr, host, 0, 0, GFP_NOWAIT);
if (err >= 0)
host->index = err;
err = ida_get_new(&mmc_host_ida, &host->index);
spin_unlock(&mmc_host_lock);
idr_preload_end();
if (err < 0) {

if (err == -EAGAIN) {
goto again;
} else if (err) {
kfree(host);
return NULL;
}
Expand Down
Loading

0 comments on commit 3e21e5d

Please sign in to comment.