Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/cjb/mmc

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: (66 commits)
  mmc: add new sdhci-pxa driver for Marvell SoCs
  mmc: make number of mmcblk minors configurable
  mmc_spi: Recover from CRC errors for r/w operation over SPI.
  mmc: sdhci-pltfm: add -pltfm driver for imx35/51
  mmc: sdhci-of-esdhc: factor out common stuff
  mmc: sdhci_pltfm: pass more data on custom init call
  mmc: sdhci: introduce get_ro private write-protect hook
  mmc: sdhci-pltfm: move .h file into appropriate subdir
  mmc: sdhci-pltfm: Add structure for host-specific data
  mmc: fix cb710 kconfig dependency warning
  mmc: cb710: remove debugging printk (info duplicated from mmc-core)
  mmc: cb710: clear irq handler on init() error path
  mmc: cb710: remove unnecessary msleep()
  mmc: cb710: implement get_cd() callback
  mmc: cb710: partially demystify clock selection
  mmc: add a file to debugfs for changing host clock at runtime
  mmc: sdhci: allow for eMMC 74 clock generation by controller
  mmc: sdhci: highspeed: check for mmc as well as sd cards
  mmc: sdhci: Add Moorestown device support
  mmc: sdhci: Intel Medfield support
  ...
  • Loading branch information
torvalds committed Oct 28, 2010
2 parents 11cc21f + 536ac99 commit 00ebb63
Show file tree
Hide file tree
Showing 60 changed files with 2,535 additions and 565 deletions.
6 changes: 6 additions & 0 deletions Documentation/devices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2520,6 +2520,12 @@ Your cooperation is appreciated.
8 = /dev/mmcblk1 Second SD/MMC card
...

The start of next SD/MMC card can be configured with
CONFIG_MMC_BLOCK_MINORS, or overridden at boot/modprobe
time using the mmcblk.perdev_minors option. That would
bump the offset between each card to be the configured
value instead of the default 8.

179 char CCube DVXChip-based PCI products
0 = /dev/dvxirq0 First DVX device
1 = /dev/dvxirq1 Second DVX device
Expand Down
32 changes: 32 additions & 0 deletions arch/arm/plat-pxa/include/plat/sdhci.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* linux/arch/arm/plat-pxa/include/plat/sdhci.h
*
* Copyright 2010 Marvell
* Zhangfei Gao <[email protected]>
*
* PXA Platform - SDHCI platform data definitions
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef __PLAT_PXA_SDHCI_H
#define __PLAT_PXA_SDHCI_H

/* pxa specific flag */
/* Require clock free running */
#define PXA_FLAG_DISABLE_CLOCK_GATING (1<<0)

/*
* struct pxa_sdhci_platdata() - Platform device data for PXA SDHCI
* @max_speed: the maximum speed supported
* @quirks: quirks of specific device
* @flags: flags for platform requirement
*/
struct sdhci_pxa_platdata {
unsigned int max_speed;
unsigned int quirks;
unsigned int flags;
};

#endif /* __PLAT_PXA_SDHCI_H */
4 changes: 1 addition & 3 deletions drivers/mmc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
# Makefile for the kernel mmc device drivers.
#

ifeq ($(CONFIG_MMC_DEBUG),y)
EXTRA_CFLAGS += -DDEBUG
endif
subdir-ccflags-$(CONFIG_MMC_DEBUG) := -DDEBUG

obj-$(CONFIG_MMC) += core/
obj-$(CONFIG_MMC) += card/
Expand Down
17 changes: 17 additions & 0 deletions drivers/mmc/card/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ config MMC_BLOCK
mount the filesystem. Almost everyone wishing MMC support
should say Y or M here.

config MMC_BLOCK_MINORS
int "Number of minors per block device"
range 4 256
default 8
help
Number of minors per block device. One is needed for every
partition on the disk (plus one for the whole disk).

Number of total MMC minors available is 256, so your number
of supported block devices will be limited to 256 divided
by this number.

Default is 8 to be backwards compatible with previous
hardwired device numbering.

If unsure, say 8 here.

config MMC_BLOCK_BOUNCE
bool "Use bounce buffer for simple hosts"
depends on MMC_BLOCK
Expand Down
4 changes: 0 additions & 4 deletions drivers/mmc/card/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
# Makefile for MMC/SD card drivers
#

ifeq ($(CONFIG_MMC_DEBUG),y)
EXTRA_CFLAGS += -DDEBUG
endif

obj-$(CONFIG_MMC_BLOCK) += mmc_block.o
mmc_block-objs := block.o queue.o
obj-$(CONFIG_MMC_TEST) += mmc_test.o
Expand Down
61 changes: 36 additions & 25 deletions drivers/mmc/card/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,27 @@
#include "queue.h"

MODULE_ALIAS("mmc:block");
#ifdef MODULE_PARAM_PREFIX
#undef MODULE_PARAM_PREFIX
#endif
#define MODULE_PARAM_PREFIX "mmcblk."

static DEFINE_MUTEX(block_mutex);

/*
* max 8 partitions per card
* The defaults come from config options but can be overriden by module
* or bootarg options.
*/
#define MMC_SHIFT 3
#define MMC_NUM_MINORS (256 >> MMC_SHIFT)
static int perdev_minors = CONFIG_MMC_BLOCK_MINORS;

static DEFINE_MUTEX(block_mutex);
static DECLARE_BITMAP(dev_use, MMC_NUM_MINORS);
/*
* We've only got one major, so number of mmcblk devices is
* limited to 256 / number of minors per device.
*/
static int max_devices;

/* 256 minors, so at most 256 separate devices */
static DECLARE_BITMAP(dev_use, 256);

/*
* There is one mmc_blk_data per slot.
Expand All @@ -67,6 +79,9 @@ struct mmc_blk_data {

static DEFINE_MUTEX(open_lock);

module_param(perdev_minors, int, 0444);
MODULE_PARM_DESC(perdev_minors, "Minors numbers to allocate per device");

static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk)
{
struct mmc_blk_data *md;
Expand All @@ -88,10 +103,10 @@ static void mmc_blk_put(struct mmc_blk_data *md)
md->usage--;
if (md->usage == 0) {
int devmaj = MAJOR(disk_devt(md->disk));
int devidx = MINOR(disk_devt(md->disk)) >> MMC_SHIFT;
int devidx = MINOR(disk_devt(md->disk)) / perdev_minors;

if (!devmaj)
devidx = md->disk->first_minor >> MMC_SHIFT;
devidx = md->disk->first_minor / perdev_minors;

blk_cleanup_queue(md->queue.queue);

Expand Down Expand Up @@ -373,7 +388,6 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
readcmd = MMC_READ_SINGLE_BLOCK;
writecmd = MMC_WRITE_BLOCK;
}

if (rq_data_dir(req) == READ) {
brq.cmd.opcode = readcmd;
brq.data.flags |= MMC_DATA_READ;
Expand Down Expand Up @@ -567,8 +581,8 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
struct mmc_blk_data *md;
int devidx, ret;

devidx = find_first_zero_bit(dev_use, MMC_NUM_MINORS);
if (devidx >= MMC_NUM_MINORS)
devidx = find_first_zero_bit(dev_use, max_devices);
if (devidx >= max_devices)
return ERR_PTR(-ENOSPC);
__set_bit(devidx, dev_use);

Expand All @@ -585,7 +599,7 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
*/
md->read_only = mmc_blk_readonly(card);

md->disk = alloc_disk(1 << MMC_SHIFT);
md->disk = alloc_disk(perdev_minors);
if (md->disk == NULL) {
ret = -ENOMEM;
goto err_kfree;
Expand All @@ -602,7 +616,7 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
md->queue.data = md;

md->disk->major = MMC_BLOCK_MAJOR;
md->disk->first_minor = devidx << MMC_SHIFT;
md->disk->first_minor = devidx * perdev_minors;
md->disk->fops = &mmc_bdops;
md->disk->private_data = md;
md->disk->queue = md->queue.queue;
Expand All @@ -620,7 +634,8 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
* messages to tell when the card is present.
*/

sprintf(md->disk->disk_name, "mmcblk%d", devidx);
snprintf(md->disk->disk_name, sizeof(md->disk->disk_name),
"mmcblk%d", devidx);

blk_queue_logical_block_size(md->queue.queue, 512);

Expand Down Expand Up @@ -651,23 +666,15 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
static int
mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
{
struct mmc_command cmd;
int err;

/* Block-addressed cards ignore MMC_SET_BLOCKLEN. */
if (mmc_card_blockaddr(card))
return 0;

mmc_claim_host(card->host);
cmd.opcode = MMC_SET_BLOCKLEN;
cmd.arg = 512;
cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
err = mmc_wait_for_cmd(card->host, &cmd, 5);
err = mmc_set_blocklen(card, 512);
mmc_release_host(card->host);

if (err) {
printk(KERN_ERR "%s: unable to set block size to %d: %d\n",
md->disk->disk_name, cmd.arg, err);
printk(KERN_ERR "%s: unable to set block size to 512: %d\n",
md->disk->disk_name, err);
return -EINVAL;
}

Expand All @@ -678,7 +685,6 @@ static int mmc_blk_probe(struct mmc_card *card)
{
struct mmc_blk_data *md;
int err;

char cap_str[10];

/*
Expand Down Expand Up @@ -768,6 +774,11 @@ static int __init mmc_blk_init(void)
{
int res;

if (perdev_minors != CONFIG_MMC_BLOCK_MINORS)
pr_info("mmcblk: using %d minors per device\n", perdev_minors);

max_devices = 256 / perdev_minors;

res = register_blkdev(MMC_BLOCK_MAJOR, "mmc");
if (res)
goto out;
Expand Down
Loading

0 comments on commit 00ebb63

Please sign in to comment.