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/drzeus/mmc

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc: (46 commits)
  mmc-omap: Clean up omap set_ios and make MMC_POWER_ON work
  mmc-omap: Fix omap to use MMC_POWER_ON
  mmc-omap: add missing '\n'
  mmc: make tifm_sd_set_dma_data() static
  mmc: remove old card states
  mmc: support unsafe resume of cards
  mmc: separate out reading EXT_CSD
  mmc: break apart switch function
  MMC: Fix handling of low-voltage cards
  MMC: Consolidate voltage definitions
  mmc: add bus handler
  wbsd: check for data opcode earlier
  mmc: Separate out protocol ops
  mmc: Move core functions to subdir
  mmc: deprecate mmc bus topology
  mmc: remove card upon suspend
  mmc: allow suspended block driver to be removed
  mmc: Flush pending detects on host removal
  mmc: Move host and card drivers to subdirs
  mmc: Move queue functions to mmc_block
  ...
  • Loading branch information
Linus Torvalds committed May 5, 2007
2 parents fa24aa5 + d3af5ab commit 62ea6d8
Show file tree
Hide file tree
Showing 50 changed files with 4,858 additions and 3,941 deletions.
332 changes: 141 additions & 191 deletions drivers/misc/tifm_7xx1.c

Large diffs are not rendered by default.

305 changes: 182 additions & 123 deletions drivers/misc/tifm_core.c

Large diffs are not rendered by default.

106 changes: 3 additions & 103 deletions drivers/mmc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,110 +19,10 @@ config MMC_DEBUG
This is an option for use by developers; most people should
say N here. This enables MMC core and driver debugging.

config MMC_BLOCK
tristate "MMC block device driver"
depends on MMC && BLOCK
default y
help
Say Y here to enable the MMC block device driver support.
This provides a block device driver, which you can use to
mount the filesystem. Almost everyone wishing MMC support
should say Y or M here.

config MMC_ARMMMCI
tristate "ARM AMBA Multimedia Card Interface support"
depends on ARM_AMBA && MMC
help
This selects the ARM(R) AMBA(R) PrimeCell Multimedia Card
Interface (PL180 and PL181) support. If you have an ARM(R)
platform with a Multimedia Card slot, say Y or M here.

If unsure, say N.

config MMC_PXA
tristate "Intel PXA25x/26x/27x Multimedia Card Interface support"
depends on ARCH_PXA && MMC
help
This selects the Intel(R) PXA(R) Multimedia card Interface.
If you have a PXA(R) platform with a Multimedia Card slot,
say Y or M here.

If unsure, say N.

config MMC_SDHCI
tristate "Secure Digital Host Controller Interface support (EXPERIMENTAL)"
depends on PCI && MMC && EXPERIMENTAL
help
This select the generic Secure Digital Host Controller Interface.
It is used by manufacturers such as Texas Instruments(R), Ricoh(R)
and Toshiba(R). Most controllers found in laptops are of this type.
If you have a controller with this interface, say Y or M here.

If unsure, say N.

config MMC_OMAP
tristate "TI OMAP Multimedia Card Interface support"
depends on ARCH_OMAP && MMC
select TPS65010 if MACH_OMAP_H2
help
This selects the TI OMAP Multimedia card Interface.
If you have an OMAP board with a Multimedia Card slot,
say Y or M here.

If unsure, say N.
source "drivers/mmc/core/Kconfig"

config MMC_WBSD
tristate "Winbond W83L51xD SD/MMC Card Interface support"
depends on MMC && ISA_DMA_API
help
This selects the Winbond(R) W83L51xD Secure digital and
Multimedia card Interface.
If you have a machine with a integrated W83L518D or W83L519D
SD/MMC card reader, say Y or M here.

If unsure, say N.

config MMC_AU1X
tristate "Alchemy AU1XX0 MMC Card Interface support"
depends on MMC && SOC_AU1200
help
This selects the AMD Alchemy(R) Multimedia card interface.
If you have a Alchemy platform with a MMC slot, say Y or M here.

If unsure, say N.

config MMC_AT91
tristate "AT91 SD/MMC Card Interface support"
depends on ARCH_AT91 && MMC
help
This selects the AT91 MCI controller.

If unsure, say N.

config MMC_IMX
tristate "Motorola i.MX Multimedia Card Interface support"
depends on ARCH_IMX && MMC
help
This selects the Motorola i.MX Multimedia card Interface.
If you have a i.MX platform with a Multimedia Card slot,
say Y or M here.

If unsure, say N.

config MMC_TIFM_SD
tristate "TI Flash Media MMC/SD Interface support (EXPERIMENTAL)"
depends on MMC && EXPERIMENTAL && PCI
select TIFM_CORE
help
Say Y here if you want to be able to access MMC/SD cards with
the Texas Instruments(R) Flash Media card reader, found in many
laptops.
This option 'selects' (turns on, enables) 'TIFM_CORE', but you
probably also need appropriate card reader host adapter, such as
'Misc devices: TI Flash Media PCI74xx/PCI76xx host adapter support
(TIFM_7XX1)'.
source "drivers/mmc/card/Kconfig"

To compile this driver as a module, choose M here: the
module will be called tifm_sd.
source "drivers/mmc/host/Kconfig"

endmenu
33 changes: 6 additions & 27 deletions drivers/mmc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,11 @@
# Makefile for the kernel mmc device drivers.
#

#
# Core
#
obj-$(CONFIG_MMC) += mmc_core.o

#
# Media drivers
#
obj-$(CONFIG_MMC_BLOCK) += mmc_block.o

#
# Host drivers
#
obj-$(CONFIG_MMC_ARMMMCI) += mmci.o
obj-$(CONFIG_MMC_PXA) += pxamci.o
obj-$(CONFIG_MMC_IMX) += imxmmc.o
obj-$(CONFIG_MMC_SDHCI) += sdhci.o
obj-$(CONFIG_MMC_WBSD) += wbsd.o
obj-$(CONFIG_MMC_AU1X) += au1xmmc.o
obj-$(CONFIG_MMC_OMAP) += omap.o
obj-$(CONFIG_MMC_AT91) += at91_mci.o
obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o

mmc_core-y := mmc.o mmc_sysfs.o
mmc_core-$(CONFIG_BLOCK) += mmc_queue.o

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

obj-$(CONFIG_MMC) += core/
obj-$(CONFIG_MMC) += card/
obj-$(CONFIG_MMC) += host/

17 changes: 17 additions & 0 deletions drivers/mmc/card/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# MMC/SD card drivers
#

comment "MMC/SD Card Drivers"
depends MMC

config MMC_BLOCK
tristate "MMC block device driver"
depends on MMC && BLOCK
default y
help
Say Y here to enable the MMC block device driver support.
This provides a block device driver, which you can use to
mount the filesystem. Almost everyone wishing MMC support
should say Y or M here.

11 changes: 11 additions & 0 deletions drivers/mmc/card/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# 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

55 changes: 38 additions & 17 deletions drivers/mmc/mmc_block.c → drivers/mmc/card/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Block driver for media (i.e., flash cards)
*
* Copyright 2002 Hewlett-Packard Company
* Copyright 2005-2007 Pierre Ossman
*
* Use consistent with the GNU GPL is permitted,
* provided that this copyright notice is
Expand Down Expand Up @@ -31,13 +32,13 @@

#include <linux/mmc/card.h>
#include <linux/mmc/host.h>
#include <linux/mmc/protocol.h>
#include <linux/mmc/host.h>
#include <linux/mmc/mmc.h>
#include <linux/mmc/sd.h>

#include <asm/system.h>
#include <asm/uaccess.h>

#include "mmc_queue.h"
#include "queue.h"

/*
* max 8 partitions per card
Expand Down Expand Up @@ -223,10 +224,9 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
struct mmc_blk_data *md = mq->data;
struct mmc_card *card = md->queue.card;
struct mmc_blk_request brq;
int ret = 1;
int ret = 1, sg_pos, data_size;

if (mmc_card_claim_host(card))
goto flush_queue;
mmc_claim_host(card->host);

do {
struct mmc_command cmd;
Expand Down Expand Up @@ -283,6 +283,20 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
brq.data.sg = mq->sg;
brq.data.sg_len = blk_rq_map_sg(req->q, req, brq.data.sg);

if (brq.data.blocks !=
(req->nr_sectors >> (md->block_bits - 9))) {
data_size = brq.data.blocks * brq.data.blksz;
for (sg_pos = 0; sg_pos < brq.data.sg_len; sg_pos++) {
data_size -= mq->sg[sg_pos].length;
if (data_size <= 0) {
mq->sg[sg_pos].length += data_size;
sg_pos++;
break;
}
}
brq.data.sg_len = sg_pos;
}

mmc_wait_for_req(card->host, &brq.mrq);
if (brq.cmd.error) {
printk(KERN_ERR "%s: error %d sending read/write command\n",
Expand Down Expand Up @@ -342,7 +356,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
spin_unlock_irq(&md->lock);
} while (ret);

mmc_card_release_host(card);
mmc_release_host(card->host);

return 1;

Expand Down Expand Up @@ -378,9 +392,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
spin_unlock_irq(&md->lock);
}

flush_queue:

mmc_card_release_host(card);
mmc_release_host(card->host);

spin_lock_irq(&md->lock);
while (ret) {
Expand Down Expand Up @@ -477,11 +489,20 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)

blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits);

/*
* The CSD capacity field is in units of read_blkbits.
* set_capacity takes units of 512 bytes.
*/
set_capacity(md->disk, card->csd.capacity << (card->csd.read_blkbits - 9));
if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) {
/*
* The EXT_CSD sector count is in number or 512 byte
* sectors.
*/
set_capacity(md->disk, card->ext_csd.sectors);
} else {
/*
* The CSD capacity field is in units of read_blkbits.
* set_capacity takes units of 512 bytes.
*/
set_capacity(md->disk,
card->csd.capacity << (card->csd.read_blkbits - 9));
}
return md;

err_putdisk:
Expand All @@ -502,12 +523,12 @@ mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
if (mmc_card_blockaddr(card))
return 0;

mmc_card_claim_host(card);
mmc_claim_host(card->host);
cmd.opcode = MMC_SET_BLOCKLEN;
cmd.arg = 1 << md->block_bits;
cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
err = mmc_wait_for_cmd(card->host, &cmd, 5);
mmc_card_release_host(card);
mmc_release_host(card->host);

if (err) {
printk(KERN_ERR "%s: unable to set block size to %d: %d\n",
Expand Down
12 changes: 7 additions & 5 deletions drivers/mmc/mmc_queue.c → drivers/mmc/card/queue.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* linux/drivers/mmc/mmc_queue.c
* linux/drivers/mmc/queue.c
*
* Copyright (C) 2003 Russell King, All Rights Reserved.
* Copyright 2006-2007 Pierre Ossman
*
* 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
Expand All @@ -14,7 +15,7 @@

#include <linux/mmc/card.h>
#include <linux/mmc/host.h>
#include "mmc_queue.h"
#include "queue.h"

#define MMC_QUEUE_SUSPENDED (1 << 0)

Expand Down Expand Up @@ -179,7 +180,6 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
blk_cleanup_queue(mq->queue);
return ret;
}
EXPORT_SYMBOL(mmc_init_queue);

void mmc_cleanup_queue(struct mmc_queue *mq)
{
Expand All @@ -191,6 +191,9 @@ void mmc_cleanup_queue(struct mmc_queue *mq)
q->queuedata = NULL;
spin_unlock_irqrestore(q->queue_lock, flags);

/* Make sure the queue isn't suspended, as that will deadlock */
mmc_queue_resume(mq);

/* Then terminate our worker thread */
kthread_stop(mq->thread);

Expand Down Expand Up @@ -226,7 +229,6 @@ void mmc_queue_suspend(struct mmc_queue *mq)
down(&mq->thread_sem);
}
}
EXPORT_SYMBOL(mmc_queue_suspend);

/**
* mmc_queue_resume - resume a previously suspended MMC request queue
Expand All @@ -247,4 +249,4 @@ void mmc_queue_resume(struct mmc_queue *mq)
spin_unlock_irqrestore(q->queue_lock, flags);
}
}
EXPORT_SYMBOL(mmc_queue_resume);

File renamed without changes.
17 changes: 17 additions & 0 deletions drivers/mmc/core/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# MMC core configuration
#

config MMC_UNSAFE_RESUME
bool "Allow unsafe resume (DANGEROUS)"
depends on MMC != n
help
If you say Y here, the MMC layer will assume that all cards
stayed in their respective slots during the suspend. The
normal behaviour is to remove them at suspend and
redetecting them at resume. Breaking this assumption will
in most cases result in data corruption.

This option is usually just for embedded systems which use
a MMC/SD card for rootfs. Most people should say N here.

11 changes: 11 additions & 0 deletions drivers/mmc/core/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Makefile for the kernel mmc core.
#

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

obj-$(CONFIG_MMC) += mmc_core.o
mmc_core-y := core.o sysfs.o mmc.o mmc_ops.o sd.o sd_ops.o

Loading

0 comments on commit 62ea6d8

Please sign in to comment.