Skip to contentSkip to conversation

1/4 MMC layer

RFC In review Russell King 3 participants 8 messages Apr 29, 2004 – May 3, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 1/4 MMC layer

Hi,

This patch adds core support to the Linux kernel for driving MMC interfaces found on embedded devices, such as found in the Intel PXA and ARM MMCI primecell. This patch does _not_ add support for SD or SDIO cards.

It is vaguely based upon the handhelds.org MMC code, but the bulk of the core has been rewritten from scratch.

The only area of concern is the MMC block device support, which, since the block layer does not really support hotplug, may be iffy. I believe Al Viro has some patches to make the block layer more "hotplug friendly."

Note that MMC is an hotpluggable medium, so we can't just ignore the issue and hope it goes away.

drivers/mmc/Kconfig +32 -0
diff -urpN orig/drivers/mmc/Kconfig linux/drivers/mmc/Kconfig
@@ -0,0 +1,32 @@
+#
+# MMC subsystem configuration
+#
+
+menu "MMC/SD Card support"
+
+config MMC
+	tristate "MMC support"
+	help
+	  MMC is the "multi-media card" bus protocol.
+
+	  If you want MMC support, you should say Y here and also
+	  to the specific driver for your MMC interface.
+
+config MMC_DEBUG
+	bool "MMC debugging"
+	depends on MMC != n
+	help
+	  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
+	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.
+
+endmenu
drivers/mmc/Makefile +19 -0
diff -urpN orig/drivers/mmc/Makefile linux/drivers/mmc/Makefile
@@ -0,0 +1,19 @@
+#
+# 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
+#
+
+mmc_core-y := mmc.o mmc_queue.o mmc_sysfs.o
drivers/mmc/mmc.c +823 -0

823 lines not on this page · raw message

drivers/mmc/mmc.h +16 -0
diff -urpN orig/drivers/mmc/mmc.h linux/drivers/mmc/mmc.h
@@ -0,0 +1,16 @@
+/*
+ *  linux/drivers/mmc/mmc.h
+ *
+ *  Copyright (C) 2003 Russell King, All Rights Reserved.
+ *
+ * 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 _MMC_H
+#define _MMC_H
+/* core-internal functions */
+void mmc_init_card(struct mmc_card *card, struct mmc_host *host);
+int mmc_register_card(struct mmc_card *card);
+void mmc_remove_card(struct mmc_card *card);
+#endif
drivers/mmc/mmc_block.c +498 -0

498 lines not on this page · raw message

drivers/mmc/mmc_queue.c +175 -0

175 lines not on this page · raw message

drivers/mmc/mmc_queue.h +29 -0
diff -urpN orig/drivers/mmc/mmc_queue.h linux/drivers/mmc/mmc_queue.h
@@ -0,0 +1,29 @@
+#ifndef MMC_QUEUE_H
+#define MMC_QUEUE_H
+
+struct request;
+struct task_struct;
+
+struct mmc_queue {
+	struct mmc_card		*card;
+	struct completion	thread_complete;
+	wait_queue_head_t	thread_wq;
+	struct task_struct	*thread;
+	struct request		*req;
+	int			(*prep_fn)(struct mmc_queue *, struct request *);
+	int			(*issue_fn)(struct mmc_queue *, struct request *);
+	void			*data;
+	struct request_queue	*queue;
+};
+
+struct mmc_io_request {
+	struct request		*rq;
+	int			num;
+	struct mmc_command	selcmd;		/* mmc_queue private */
+	struct mmc_command	cmd[4];		/* max 4 commands */
+};
+
+extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *);
+extern void mmc_cleanup_queue(struct mmc_queue *);
+
+#endif
drivers/mmc/mmc_sysfs.c +231 -0

231 lines not on this page · raw message

include/linux/mmc/card.h +83 -0

83 lines not on this page · raw message

include/linux/mmc/host.h +102 -0

102 lines not on this page · raw message

include/linux/mmc/mmc.h +88 -0

88 lines not on this page · raw message

include/linux/mmc/protocol.h +203 -0

203 lines not on this page · raw message

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#1 lore raw

Re: [RFC] 2/4 MMC layer: configuration + makefiles

Add changes to Kconfig / Makefiles to support MMC subsystem.

arch/arm/Kconfig +2 -0
@@ -631,6 +631,8 @@ source "drivers/misc/Kconfig"
 
 source "drivers/usb/Kconfig"
 
+source "drivers/mmc/Kconfig"
+
 
 menu "Kernel hacking"
 
drivers/Kconfig +2 -0
@@ -52,4 +52,6 @@ source "sound/Kconfig"
 
 source "drivers/usb/Kconfig"
 
+source "drivers/mmc/Kconfig"
+
 endmenu
drivers/Makefile +1 -0
@@ -49,4 +49,5 @@ obj-$(CONFIG_ISDN)		+= isdn/
 obj-$(CONFIG_MCA)		+= mca/
 obj-$(CONFIG_EISA)		+= eisa/
 obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
+obj-$(CONFIG_MMC)		+= mmc/
 obj-y				+= firmware/
Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#2 lore raw

Re: [RFC] 3/4 MMC layer: ARM MMCI driver

This patch adds initial support for the ARM MMCI Primecell - one of the drivers for a MMC interface.

drivers/mmc/Kconfig +10 -0
diff -urpN orig/drivers/mmc/Kconfig linux/drivers/mmc/Kconfig
@@ -29,4 +29,14 @@
 	  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.
+
 endmenu
drivers/mmc/Makefile +1 -0
diff -urpN orig/drivers/mmc/Makefile linux/drivers/mmc/Makefile
@@ -15,5 +15,6 @@
 #
 # Host drivers
 #
+obj-$(CONFIG_MMC_ARMMMCI)	+= mmci.o
 
 mmc_core-y := mmc.o mmc_queue.o mmc_sysfs.o
drivers/mmc/mmci.c +523 -0

523 lines not on this page · raw message

drivers/mmc/mmci.h +149 -0

149 lines not on this page · raw message

include/asm-arm/mach/mmc.h +16 -0
@@ -0,0 +1,16 @@
+/*
+ *  linux/include/asm-arm/mach/mmc.h
+ */
+#ifndef ASMARM_MACH_MMC_H
+#define ASMARM_MACH_MMC_H
+
+#include <linux/mmc/protocol.h>
+
+struct mmc_platform_data {
+	unsigned int mclk;			/* mmc base clock rate */
+	unsigned int ocr_mask;			/* available voltages */
+	u32 (*translate_vdd)(struct device *, unsigned int);
+	unsigned int (*status)(struct device *);
+};
+
+#endif
Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#3 lore raw

Re: [RFC] 4/4 MMC layer: PXA MCI driver

This patch adds support for the Intel PXA MCI interface.

drivers/mmc/Kconfig +10 -0
diff -urpN orig/drivers/mmc/Kconfig linux/drivers/mmc/Kconfig
@@ -39,4 +39,14 @@
 
 	  If unsure, say N.
 
+config MMC_PXA
+	tristate "Intel PXA255 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.
+
 endmenu
drivers/mmc/Makefile +1 -0
diff -urpN orig/drivers/mmc/Makefile linux/drivers/mmc/Makefile
@@ -16,5 +16,6 @@
 # Host drivers
 #
 obj-$(CONFIG_MMC_ARMMMCI)	+= mmci.o
+obj-$(CONFIG_MMC_PXA)		+= pxamci.o
 
 mmc_core-y := mmc.o mmc_queue.o mmc_sysfs.o
drivers/mmc/pxamci.c +590 -0

590 lines not on this page · raw message

drivers/mmc/pxamci.h +94 -0

94 lines not on this page · raw message

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#4 lore raw
In reply to Russell King
Quoted 4 lines · Russell King

This patch adds core support to the Linux kernel for driving MMC interfaces found on embedded devices, such as found in the Intel PXA and ARM MMCI primecell. This patch does _not_ add support for SD or SDIO cards.

As there haven't been any comments, can I assume that either people don't care, or people are happy for this to appear in Linus' tree?

(I actually suspect its out of peoples minds having been buried by about 4 days of lkml.)

Thanks. 8)

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#5 lore raw

Hi!

Quoted 2 lines

As there haven't been any comments, can I assume that either people don't care, or people are happy for this to appear in Linus' tree?

Happy. i386 nx5k notebook contains mmc slot, and I assume this will help me with a driver.

Signature · 1 line
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms         
#6 lore raw
Quoted 5 lines · Pavel Machek
Quoted 2 lines

As there haven't been any comments, can I assume that either people don't care, or people are happy for this to appear in Linus' tree?

Happy. i386 nx5k notebook contains mmc slot, and I assume this will help me with a driver.

That depends on the kind of hardware interface you have - whether it gives you low level access to the MMC command/data streams, or whether it looks like a USB device / CF disk / whatever else. (I've heard rumours that such games are played on laptops, but I've no idea how true this is.)

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#7 lore raw

Hi!

Quoted 11 lines
Quoted 5 lines
Quoted 2 lines

As there haven't been any comments, can I assume that either people don't care, or people are happy for this to appear in Linus' tree?

Happy. i386 nx5k notebook contains mmc slot, and I assume this will help me with a driver.

That depends on the kind of hardware interface you have - whether it gives you low level access to the MMC command/data streams, or whether it looks like a USB device / CF disk / whatever else. (I've heard rumours that such games are played on laptops, but I've no idea how true this is.)

Its not USB disk, and it does not look like any device I recognize, so I'm afraid your layer may be usefull. Interface is "TI PCI7420, PCI7620 flash media controller", and there's datasheet on the web, but I was not able to figure out how to control it.
Pavel

Signature · 1 line
934a471f20d6580d5aad759bf0d97ddc