Skip to contentSkip to conversation

Add support for the MMC device to the vexpress

PATCH Superseded matt.waddel at linaro.org 6 participants 25 messages Feb 25, 2011 – Apr 28, 2011

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

cover Add support for the MMC device to the vexpress

From: Matt Waddel <[email protected]>

These patches add support for the ARM PrimeCell PL180 MultiMedia Interface. The Versatile Express was the test platform for these changes.

Matt Waddel (3):
MMC: Max blocks value adjustable
MMC: Add support for PL180 ARM mmc device
ARMV7: Vexpress: Add MMC support

 board/armltd/vexpress/ca9x4_ct_vxp.c |    9 +
 drivers/mmc/Makefile                 |    1 +
 drivers/mmc/mmc.c                    |   19 +-
 drivers/mmc/mmci.c                   |  452 ++++++++++++++++++++++++++++++++++
 drivers/mmc/mmci.h                   |  181 ++++++++++++++
 include/configs/ca9x4_ct_vxp.h       |    4 +
 6 files changed, 656 insertions(+), 10 deletions(-)
 create mode 100644 drivers/mmc/mmci.c
 create mode 100644 drivers/mmc/mmci.h
#1 lore raw

PATCH 1/3 MMC: Max blocks value adjustable

From: Matt Waddel <[email protected]>

The maximum blocks value was hardcoded to 65535 due to a 16 bit register length. The value can change for different platforms. This patch makes the default the current value of 65535, but it is configurable for other platforms.

---
 drivers/mmc/mmc.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)
drivers/mmc/mmc.c +9 -10
index 6805b33..d69eaa1 100644
@@ -33,6 +33,11 @@
 #include <mmc.h>
 #include <div64.h>
 
+/* Set block count limit because of 16 bit register limit on some hardware*/
+#ifndef CONFIG_SYS_MMC_MAX_BLK_COUNT
+#define CONFIG_SYS_MMC_MAX_BLK_COUNT 65535
+#endif
+
 static struct list_head mmc_devices;
 static int cur_dev_num = -1;
 
@@ -139,11 +144,8 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src)
 		return 0;
 
 	do {
-		/*
-		 * The 65535 constraint comes from some hardware has
-		 * only 16 bit width block number counter
-		 */
-		cur = (blocks_todo > 65535) ? 65535 : blocks_todo;
+		cur = (blocks_todo > CONFIG_SYS_MMC_MAX_BLK_COUNT) ?
+		       CONFIG_SYS_MMC_MAX_BLK_COUNT : blocks_todo;
 		if(mmc_write_blocks(mmc, start, cur, src) != cur)
 			return 0;
 		blocks_todo -= cur;
@@ -215,11 +217,8 @@ static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst)
 		return 0;
 
 	do {
-		/*
-		 * The 65535 constraint comes from some hardware has
-		 * only 16 bit width block number counter
-		 */
-		cur = (blocks_todo > 65535) ? 65535 : blocks_todo;
+		cur = (blocks_todo > CONFIG_SYS_MMC_MAX_BLK_COUNT) ?
+		       CONFIG_SYS_MMC_MAX_BLK_COUNT : blocks_todo;
 		if(mmc_read_blocks(mmc, dst, start, cur) != cur)
 			return 0;
 		blocks_todo -= cur;
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/3 MMC: Add support for PL180 ARM mmc device

In reply to matt.waddel at linaro.org

From: Matt Waddel <[email protected]>

Add support for the ARM PrimeCell MultiMedia Interface - PL180. Ported from original device driver written by ST-Ericsson.

---
 drivers/mmc/Makefile |    1 +
 drivers/mmc/mmci.c   |  452 ++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/mmc/mmci.h   |  181 ++++++++++++++++++++
 3 files changed, 634 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mmc/mmci.c
 create mode 100644 drivers/mmc/mmci.h
drivers/mmc/Makefile +1 -0
index 3496f0a..999970b 100644
@@ -31,6 +31,7 @@ COBJS-$(CONFIG_DAVINCI_MMC) += davinci_mmc.o
 COBJS-$(CONFIG_FSL_ESDHC) += fsl_esdhc.o
 COBJS-$(CONFIG_GENERIC_MMC) += mmc.o
 COBJS-$(CONFIG_GENERIC_ATMEL_MCI) += gen_atmel_mci.o
+COBJS-$(CONFIG_MMCI) += mmci.o
 COBJS-$(CONFIG_MXC_MMC) += mxcmmc.o
 COBJS-$(CONFIG_OMAP3_MMC) += omap3_mmc.o
 COBJS-$(CONFIG_OMAP_HSMMC) += omap_hsmmc.o
drivers/mmc/mmci.c new file +452 -0

452 lines not on this page · raw message

drivers/mmc/mmci.h new file +181 -0

181 lines not on this page · raw message

Signature · 1 line
1.7.1
#3 lore raw

PATCH 3/3 ARMV7: Vexpress: Add MMC support

In reply to matt.waddel at linaro.org

From: Matt Waddel <[email protected]>

Added the board specific definitions to use the MMCI device.

---
 board/armltd/vexpress/ca9x4_ct_vxp.c |    9 +++++++++
 include/configs/ca9x4_ct_vxp.h       |    4 ++++
 2 files changed, 13 insertions(+), 0 deletions(-)
board/armltd/vexpress/ca9x4_ct_vxp.c +9 -0
index ce1be1e..73cea1c 100644
@@ -86,6 +86,15 @@ int board_eth_init(bd_t *bis)
 	return rc;
 }
 
+int cpu_mmc_init(bd_t *bis)
+{
+	int rc = 0;
+#ifdef CONFIG_MMCI
+	rc = mmci_init(bis);
+#endif
+	return rc;
+}
+
 static void flash__init(void)
 {
 	/* Setup the sytem control register to allow writing to flash */
include/configs/ca9x4_ct_vxp.h +4 -0
index 63f003d..47a3bfc 100644
@@ -86,6 +86,10 @@
 #define CONFIG_MMC			1
 #define CONFIG_CMD_MMC
 #define CONFIG_GENERIC_MMC
+#define CONFIG_MMCI
+#define CONFIG_MMC_BASE			0x10005000
+#define CONFIG_SYS_MMC_MAX_BLK_COUNT	127
+#define CONFIG_MMCI_CLOCK_FREQ		6250000
 
 /* BOOTP options */
 #define CONFIG_BOOTP_BOOTFILESIZE
Signature · 1 line
1.7.1
#4 lore raw

cover Add support for the MMC device to the vexpress

In reply to matt.waddel at linaro.org

Dear matt.waddel at linaro.org,

Quoted 10 lines

From: Matt Waddel<[email protected]>

These patches add support for the ARM PrimeCell PL180 MultiMedia Interface. The Versatile Express was the test platform for these changes.

Matt Waddel (3):
MMC: Max blocks value adjustable
MMC: Add support for PL180 ARM mmc device
ARMV7: Vexpress: Add MMC support

Quoted 5 lines
  board/armltd/vexpress/ca9x4_ct_vxp.c |    9 +
  drivers/mmc/Makefile                 |    1 +
  drivers/mmc/mmc.c                    |   19 +-
  drivers/mmc/mmci.c                   |  452 ++++++++++++++++++++++++++++++++++
  drivers/mmc/mmci.h                   |  181 ++++++++++++++

I would expect something more descriptive like <hardware>_mmc.[ch] here. mmci.[ch] does not lead one to think its a hardware specific driver, even less for what specific hardware it is.
The same is true for the exported function name "mmci_init", the macro CONFIG_MMCI etc.

Then, in patch 2/3:

+int mmci_init(void)

but in patch 3/3:

+ rc = mmci_init(bis);

Seems you should add a prototype to include/mmc.h to detect such mistakes ;)

Best Regards,
Reinhard

#5 lore raw

cover Add support for the MMC device to the vexpress

Reinhard,

Quoted 17 lines · Reinhard Meyer

Dear matt.waddel at linaro.org,

Quoted 10 lines

From: Matt Waddel<[email protected]>

These patches add support for the ARM PrimeCell PL180 MultiMedia Interface. The Versatile Express was the test platform for these changes.

Matt Waddel (3):
? ?MMC: Max blocks value adjustable
? ?MMC: Add support for PL180 ARM mmc device
? ?ARMV7: Vexpress: Add MMC support

Quoted 5 lines
? board/armltd/vexpress/ca9x4_ct_vxp.c | ? ?9 +
? drivers/mmc/Makefile ? ? ? ? ? ? ? ? | ? ?1 +
? drivers/mmc/mmc.c ? ? ? ? ? ? ? ? ? ?| ? 19 +-
? drivers/mmc/mmci.c ? ? ? ? ? ? ? ? ? | ?452 ++++++++++++++++++++++++++++++++++
? drivers/mmc/mmci.h ? ? ? ? ? ? ? ? ? | ?181 ++++++++++++++
Quoted 4 lines

I would expect something more descriptive like <hardware>_mmc.[ch] here. mmci.[ch] does not lead one to think its a hardware specific driver, even less for what specific hardware it is.
The same is true for the exported function name "mmci_init", the macro CONFIG_MMCI etc.

The file in the linux kernel is mmci.c. One could argue that keeping it the same as the kernel is a good thing. If it needs to be changed, I would vote for arm_mmci.c.

The config option in the kernel is CONFIG_MMC_ARMMMCI so I would vote for that as the config option in u-boot.

br,
John

#6 lore raw

v2 cover Add support for the MMC device to the vexpress

In reply to matt.waddel at linaro.org

From: Matt Waddel <[email protected]>

These patches add support for the ARM PrimeCell PL180 MultiMedia Interface. The Versatile Express was the test platform for these changes.

---
Change log:

v2 - Rename patch items to a more descriptive name (ie. mmci -> arm_mmci)
Fixed conflicting fuction call and added prototype to arm_mmci.h (Note: Patch 1/3 did not change with these corrections)

Matt Waddel (3):
MMC: Max blocks value adjustable
MMC: Add support for PL180 ARM mmc device
ARMV7: Vexpress: Add MMC support

 board/armltd/vexpress/ca9x4_ct_vxp.c |    9 +
 drivers/mmc/Makefile                 |    1 +
 drivers/mmc/arm_mmci.c               |  452 ++++++++++++++++++++++++++++++++++
 drivers/mmc/arm_mmci.h               |  183 ++++++++++++++
 drivers/mmc/mmc.c                    |   19 +-
 include/configs/ca9x4_ct_vxp.h       |    4 +
 6 files changed, 658 insertions(+), 10 deletions(-)
 create mode 100644 drivers/mmc/arm_mmci.c
 create mode 100644 drivers/mmc/arm_mmci.h
#7 lore raw

v2 cover Add support for the MMC device to the vexpress

Dear matt.waddel,

Quoted 10 lines

From: Matt Waddel<[email protected]>

These patches add support for the ARM PrimeCell PL180 MultiMedia Interface. The Versatile Express was the test platform for these changes.

---
Change log:

v2 - Rename patch items to a more descriptive name (ie. mmci -> arm_mmci)
Fixed conflicting fuction call and added prototype to arm_mmci.h

"function"

Quoted 14 lines

(Note: Patch 1/3 did not change with these corrections)

Matt Waddel (3):
MMC: Max blocks value adjustable
MMC: Add support for PL180 ARM mmc device
ARMV7: Vexpress: Add MMC support

  board/armltd/vexpress/ca9x4_ct_vxp.c |    9 +
  drivers/mmc/Makefile                 |    1 +
  drivers/mmc/arm_mmci.c               |  452 ++++++++++++++++++++++++++++++++++
  drivers/mmc/arm_mmci.h               |  183 ++++++++++++++
  drivers/mmc/mmc.c                    |   19 +-
  include/configs/ca9x4_ct_vxp.h       |    4 +
  6 files changed, 658 insertions(+), 10 deletions(-)
Quoted 2 lines

create mode 100644 drivers/mmc/arm_mmci.c
create mode 100644 drivers/mmc/arm_mmci.h

Sorry, my original comment still holds true for the naming, now the name suggests that this driver is generic to ARM devices, which clearly is not true.

Can you list which devices have a MMCI that is covered by this driver? PL180 only? Or a series of PLxxx? It should be possible to find a naming that is more descriptive than "arm".

(That such a generic name slipped into the kernel must not imply we have to make the same mistake in u-boot)

Best Regards,
Reinhard

#8 lore raw

v2 cover Add support for the MMC device to the vexpress

Hi Reinhard,

Quoted 3 lines · Reinhard Meyer

Dear matt.waddel,

Quoted 2 lines

From: Matt Waddel<[email protected]>

<snip>

Quoted 3 lines

Sorry, my original comment still holds true for the naming, now the name suggests that this driver is generic to ARM devices, which clearly is not true.

Correct. However, this hardware device was developed by ARM (the company). As far as I know the other ARM mmc drivers, like the omap3_mmc, are not. So that would be the difference between the naming of these drivers.

I don't feel like this driver should be named after a particular platform like vexpress, since this driver could be used in any ARM hardware.

Quoted 4 lines

Can you list which devices have a MMCI that is covered by this driver? PL180 only? Or a series of PLxxx? It should be possible to find a naming that is more descriptive than "arm".

The PL180 is the name assigned to the hardware in the SOC. Here is the description of device from the 1st paragraph in the manual:

1.1 About the ARM PrimeCell Multimedia Card Interface (PL180)
The PrimeCell Multimedia Card Interface (MCI) is an Advanced
Microcontroller Bus Architecture(AMBA) compliant, System-on-a-Chip (SoC) peripheral that is developed, tested, and licensed by ARM.
----

As far as other platforms that use this hardware, it is in some of the other ARM EVMs and some STEricsson platforms like the u300 and u8500.

Quoted 3 lines

(That such a generic name slipped into the kernel must not imply we have to make the same mistake in u-boot)

I agree. However, it would be nice to have a bit of a link between the device in the kernel and the one in u-boot and I didn't think having "_mmci" in the name would be too objectionable.

Would pl180_mmci.c work? or how about arm_pl180_mmc.c? I'm open to other suggestions.

Best regards,
Matt

Quoted 3 lines

Best Regards,
Reinhard

#9 lore raw

v2 cover Add support for the MMC device to the vexpress

Hello Matt Waddel,

Quoted 8 lines
Quoted 3 lines

Sorry, my original comment still holds true for the naming, now the name suggests that this driver is generic to ARM devices, which clearly is not true.

Correct. However, this hardware device was developed by ARM (the company). As far as I know the other ARM mmc drivers, like the omap3_mmc, are not. So that would be the difference between the naming of these drivers.

I see. The "problem" is that ARM is a company, an architecture, and now even an IP manufacturer...

Quoted 4 lines

I don't feel like this driver should be named after a particular platform like vexpress, since this driver could be used in any ARM hardware.

Correct.

Quoted 24 lines
Quoted 5 lines

Can you list which devices have a MMCI that is covered by this driver? PL180 only? Or a series of PLxxx? It should be possible to find a naming that is more descriptive than "arm".

The PL180 is the name assigned to the hardware in the SOC. Here is the description of device from the 1st paragraph in the manual:

1.1 About the ARM PrimeCell Multimedia Card Interface (PL180)
The PrimeCell Multimedia Card Interface (MCI) is an Advanced
Microcontroller Bus Architecture(AMBA) compliant, System-on-a-Chip (SoC) peripheral that is developed, tested, and licensed by ARM.
----

As far as other platforms that use this hardware, it is in some of the other ARM EVMs and some STEricsson platforms like the u300 and u8500.

Quoted 3 lines

(That such a generic name slipped into the kernel must not imply we have to make the same mistake in u-boot)

Quoted 6 lines

I agree. However, it would be nice to have a bit of a link between the device in the kernel and the one in u-boot and I didn't think having "_mmci" in the name would be too objectionable.

Would pl180_mmci.c work? or how about arm_pl180_mmc.c? I'm open to other suggestions.

Yes, after what you have described, is it to be expected that it is always designated as PL180 when licensed and used by a SoC nanufacturer? "arm_pl180_mmci" would be best then, I think. That leaves the namespace open for other "arm_*_mmci" controllers that might appear in the future.

Best regards,
Reinhard

#10 lore raw

PATCH v2 2/3 MMC: Add support for PL180 ARM mmc device

In reply to matt.waddel at linaro.org

From: Matt Waddel <[email protected]>

Add support for the ARM PrimeCell MultiMedia Interface - PL180. Ported from original device driver written by ST-Ericsson.

---
 drivers/mmc/Makefile   |    1 +
 drivers/mmc/arm_mmci.c |  452 ++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/mmc/arm_mmci.h |  183 +++++++++++++++++++
 3 files changed, 636 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mmc/arm_mmci.c
 create mode 100644 drivers/mmc/arm_mmci.h
drivers/mmc/Makefile +1 -0
index 3496f0a..7f365b4 100644
@@ -31,6 +31,7 @@ COBJS-$(CONFIG_DAVINCI_MMC) += davinci_mmc.o
 COBJS-$(CONFIG_FSL_ESDHC) += fsl_esdhc.o
 COBJS-$(CONFIG_GENERIC_MMC) += mmc.o
 COBJS-$(CONFIG_GENERIC_ATMEL_MCI) += gen_atmel_mci.o
+COBJS-$(CONFIG_ARM_MMCI) += arm_mmci.o
 COBJS-$(CONFIG_MXC_MMC) += mxcmmc.o
 COBJS-$(CONFIG_OMAP3_MMC) += omap3_mmc.o
 COBJS-$(CONFIG_OMAP_HSMMC) += omap_hsmmc.o
drivers/mmc/arm_mmci.c new file +452 -0

452 lines not on this page · raw message

drivers/mmc/arm_mmci.h new file +183 -0

183 lines not on this page · raw message

Signature · 1 line
1.7.1
#11 lore raw

PATCH v2 3/3 ARMV7: Vexpress: Add MMC support

In reply to matt.waddel at linaro.org

From: Matt Waddel <[email protected]>

Added the board specific definitions to use the MMCI device.

---
 board/armltd/vexpress/ca9x4_ct_vxp.c |    9 +++++++++
 include/configs/ca9x4_ct_vxp.h       |    4 ++++
 2 files changed, 13 insertions(+), 0 deletions(-)
board/armltd/vexpress/ca9x4_ct_vxp.c +9 -0
index ce1be1e..92cb6be 100644
@@ -86,6 +86,15 @@ int board_eth_init(bd_t *bis)
 	return rc;
 }
 
+int cpu_mmc_init(bd_t *bis)
+{
+	int rc = 0;
+#ifdef CONFIG_ARM_MMCI
+	rc = arm_mmci_init();
+#endif
+	return rc;
+}
+
 static void flash__init(void)
 {
 	/* Setup the sytem control register to allow writing to flash */
include/configs/ca9x4_ct_vxp.h +4 -0
index 63f003d..52fb5df 100644
@@ -86,6 +86,10 @@
 #define CONFIG_MMC			1
 #define CONFIG_CMD_MMC
 #define CONFIG_GENERIC_MMC
+#define CONFIG_ARM_MMCI
+#define CONFIG_ARM_MMCI_BASE		0x10005000
+#define CONFIG_SYS_MMC_MAX_BLK_COUNT	127
+#define CONFIG_ARM_MMCI_CLOCK_FREQ	6250000
 
 /* BOOTP options */
 #define CONFIG_BOOTP_BOOTFILESIZE
Signature · 1 line
1.7.1
#12 lore raw

v3 cover Add support for the MMC device to the vexpress

In reply to matt.waddel at linaro.org

From: Matt Waddel <[email protected]>

These patches add support for the ARM PrimeCell PL180 MultiMedia Interface. The Versatile Express was the test platform for these changes.

---
Change log:

v2 - Rename patch items to a more descriptive name (ie. mmci -> arm_mmci)
Fixed conflicting fuction call and added prototype to arm_mmci.h

v3 - Rename patch items (arm_mmci -> arm_pl180_mmci)
(Note: Patch 1/3 still did not change with these corrections)

Matt Waddel (3):
MMC: Max blocks value adjustable
MMC: Add support for PL180 ARM mmc device
ARMV7: Vexpress: Add MMC support

 board/armltd/vexpress/ca9x4_ct_vxp.c |    9 +
 drivers/mmc/Makefile                 |    1 +
 drivers/mmc/arm_pl180_mmci.c         |  452 ++++++++++++++++++++++++++++++++++
 drivers/mmc/arm_pl180_mmci.h         |  183 ++++++++++++++
 drivers/mmc/mmc.c                    |   19 +-
 include/configs/ca9x4_ct_vxp.h       |    4 +
 6 files changed, 658 insertions(+), 10 deletions(-)
 create mode 100644 drivers/mmc/arm_pl180_mmci.c
 create mode 100644 drivers/mmc/arm_pl180_mmci.h
#13 lore raw

PATCH v3 2/3 MMC: Add support for PL180 ARM mmc device

In reply to matt.waddel at linaro.org

From: Matt Waddel <[email protected]>

Add support for the ARM PrimeCell MultiMedia Interface - PL180. Ported from original device driver written by ST-Ericsson.

---
 drivers/mmc/Makefile         |    1 +
 drivers/mmc/arm_pl180_mmci.c |  452 ++++++++++++++++++++++++++++++++++++++++++
 drivers/mmc/arm_pl180_mmci.h |  183 +++++++++++++++++
 3 files changed, 636 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mmc/arm_pl180_mmci.c
 create mode 100644 drivers/mmc/arm_pl180_mmci.h
drivers/mmc/Makefile +1 -0
index 3496f0a..7b3c319 100644
@@ -31,6 +31,7 @@ COBJS-$(CONFIG_DAVINCI_MMC) += davinci_mmc.o
 COBJS-$(CONFIG_FSL_ESDHC) += fsl_esdhc.o
 COBJS-$(CONFIG_GENERIC_MMC) += mmc.o
 COBJS-$(CONFIG_GENERIC_ATMEL_MCI) += gen_atmel_mci.o
+COBJS-$(CONFIG_ARM_PL180_MMCI) += arm_pl180_mmci.o
 COBJS-$(CONFIG_MXC_MMC) += mxcmmc.o
 COBJS-$(CONFIG_OMAP3_MMC) += omap3_mmc.o
 COBJS-$(CONFIG_OMAP_HSMMC) += omap_hsmmc.o
drivers/mmc/arm_pl180_mmci.c new file +452 -0

452 lines not on this page · raw message

drivers/mmc/arm_pl180_mmci.h new file +183 -0

183 lines not on this page · raw message

Signature · 1 line
1.7.1
#14 lore raw

PATCH v3 2/3 MMC: Add support for PL180 ARM mmc device

Review

Quoted 11 lines · On Wed, Mar 2, 2011 at 11:22 PM, <[email protected]> wrote:
(quoted diff) +11 -0
+
+static int convert_from_bytes_to_power_of_two(unsigned int x)
+{
+ ? ? ? int y = 0;
+ ? ? ? y = (x & 0xAAAA) ? 1 : 0;
+ ? ? ? y |= ((x & 0xCCCC) ? 1 : 0) << 1;
+ ? ? ? y |= ((x & 0xF0F0) ? 1 : 0) << 2;
+ ? ? ? y |= ((x & 0xFF00) ? 1 : 0) << 3;
+
+ ? ? ? return y;
+}

Let's not try to be this clever. U-Boot already has a function that tells you which power of two a number corresponds to. Unless the caller of this will be highly sensitive to several cycles that you may gain from knowing that the input is already a power-of-two, there's just no cause to creating a separate implementation of ffs().

Other than that, it looks fine, and as soon as you respin, I'll add it to the mmc tree.

Andy

#15 lore raw

PATCH v3 3/3 ARMV7: Vexpress: Add MMC support

In reply to matt.waddel at linaro.org

From: Matt Waddel <[email protected]>

Added the board specific definitions to use the MMCI device.

---
 board/armltd/vexpress/ca9x4_ct_vxp.c |    9 +++++++++
 include/configs/ca9x4_ct_vxp.h       |    4 ++++
 2 files changed, 13 insertions(+), 0 deletions(-)
board/armltd/vexpress/ca9x4_ct_vxp.c +9 -0
index ce1be1e..3566b95 100644
@@ -86,6 +86,15 @@ int board_eth_init(bd_t *bis)
 	return rc;
 }
 
+int cpu_mmc_init(bd_t *bis)
+{
+	int rc = 0;
+#ifdef CONFIG_ARM_PL180_MMCI
+	rc = arm_pl180_mmci_init();
+#endif
+	return rc;
+}
+
 static void flash__init(void)
 {
 	/* Setup the sytem control register to allow writing to flash */
include/configs/ca9x4_ct_vxp.h +4 -0
index 63f003d..4ab58c0 100644
@@ -86,6 +86,10 @@
 #define CONFIG_MMC			1
 #define CONFIG_CMD_MMC
 #define CONFIG_GENERIC_MMC
+#define CONFIG_ARM_PL180_MMCI
+#define CONFIG_ARM_PL180_MMCI_BASE	0x10005000
+#define CONFIG_SYS_MMC_MAX_BLK_COUNT	127
+#define CONFIG_ARM_PL180_MMCI_CLOCK_FREQ 6250000
 
 /* BOOTP options */
 #define CONFIG_BOOTP_BOOTFILESIZE
Signature · 1 line
1.7.1
#16 lore raw

PATCH v3 3/3 ARMV7: Vexpress: Add MMC support

Quoted 5 lines · On Wed, Mar 2, 2011 at 11:22 PM, <[email protected]> wrote:

From: Matt Waddel <[email protected]>

Added the board specific definitions to use the MMCI device.

Looks fine to me. I can apply this to my tree if that's fine with the maintainer. If not, I'm also OK if the maintainer wants to pull in the driver patch (with the previously-mentioned small change).

Either way:

Andy

#17 lore raw

PATCH v3 3/3 ARMV7: Vexpress: Add MMC support

Quoted 10 lines · Andy Fleming
Quoted 5 lines · On Wed, Mar 2, 2011 at 11:22 PM, <[email protected]> wrote:

From: Matt Waddel <[email protected]>

Added the board specific definitions to use the MMCI device.

Looks fine to me. I can apply this to my tree if that's fine with the maintainer. If not, I'm also OK if the maintainer wants to pull in the driver patch (with the previously-mentioned small change).

Hi Andy,

I made the ffs() change you suggested and have posted a 4th version of the 3 patches (even though the 2nd one was the only one that changed, I wanted to make sure they were all still in sync with the repository).

If you could apply these to your tree that would be great.

Quoted 3 lines

Either way:

Thanks,
Matt

Quoted 6 lines

Andy
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#18 lore raw

PATCH v3 3/3 ARMV7: Vexpress: Add MMC support

Quoted 35 lines · Matt Waddel
Quoted 10 lines · Andy Fleming
Quoted 5 lines · On Wed, Mar 2, 2011 at 11:22 PM, ?<[email protected]> wrote:

From: Matt Waddel <[email protected]>

Added the board specific definitions to use the MMCI device.

Looks fine to me. ?I can apply this to my tree if that's fine with the maintainer. ?If not, I'm also OK if the maintainer wants to pull in the driver patch (with the previously-mentioned small change).

Hi Andy,

I made the ffs() change you suggested and have posted a 4th version of the 3 patches (even though the 2nd one was the only one that changed, I wanted to make sure they were all still in sync with the repository).

If you could apply these to your tree that would be great.

Quoted 3 lines

Either way:

Thanks,
Matt

Quoted 6 lines

Andy
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Quoted 5 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Andy, Matt:

What is the plan for getting the pl180 mmc driver commited? I need it in before my U8500 board patches can be commited.

Thanks,
John

#19 lore raw

PATCH v3 3/3 ARMV7: Vexpress: Add MMC support

It's on my todo list for today

Quoted 50 lines · John Rigby
Quoted 35 lines · Matt Waddel
Quoted 10 lines · Andy Fleming
Quoted 5 lines · On Wed, Mar 2, 2011 at 11:22 PM, <[email protected]> wrote:

From: Matt Waddel <[email protected]>

Added the board specific definitions to use the MMCI device.

Looks fine to me. I can apply this to my tree if that's fine with the maintainer. If not, I'm also OK if the maintainer wants to pull in the driver patch (with the previously-mentioned small change).

Hi Andy,

I made the ffs() change you suggested and have posted a 4th version of the 3 patches (even though the 2nd one was the only one that changed, I wanted to make sure they were all still in sync with the repository).

If you could apply these to your tree that would be great.

Quoted 3 lines

Either way:

Thanks,
Matt

Quoted 6 lines

Andy
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Quoted 5 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Andy, Matt:

What is the plan for getting the pl180 mmc driver commited? I need it in before my U8500 board patches can be commited.

Thanks,
John

#20 lore raw

PATCH v3 3/3 ARMV7: Vexpress: Add MMC support

Quoted 1 line · Andy Fleming

It's on my todo list for today

Thanks!

#21 lore raw

v4 cover Add support for the MMC device to the vexpress

In reply to matt.waddel at linaro.org

From: Matt Waddel <[email protected]>

These patches add support for the ARM PrimeCell PL180 MultiMedia Interface. The Versatile Express was the test platform for these changes.

---
Change log:

v2 - Rename patch items to a more descriptive name (ie. mmci -> arm_mmci)
Fixed conflicting fuction call and added prototype to arm_mmci.h

v3 - Rename patch items (arm_mmci -> arm_pl180_mmci)
(Note: Patch 1/3 still did not change with these corrections)

v4 - Removed convert_from_bytes_to_power_of_two() routine and used generic ffs
call instead. (Feedback from Andy Fleming.)

Matt Waddel (3):
MMC: Max blocks value adjustable
MMC: Add support for PL180 ARM mmc device
ARMV7: Vexpress: Add MMC support

 board/armltd/vexpress/ca9x4_ct_vxp.c |    9 +
 drivers/mmc/Makefile                 |    1 +
 drivers/mmc/arm_pl180_mmci.c         |  441 ++++++++++++++++++++++++++++++++++
 drivers/mmc/arm_pl180_mmci.h         |  183 ++++++++++++++
 drivers/mmc/mmc.c                    |   19 +-
 include/configs/ca9x4_ct_vxp.h       |    4 +
 6 files changed, 647 insertions(+), 10 deletions(-)
 create mode 100644 drivers/mmc/arm_pl180_mmci.c
 create mode 100644 drivers/mmc/arm_pl180_mmci.h
Signature · 1 line
1.7.4.1
#22 lore raw

PATCH v4 1/3 MMC: Max blocks value adjustable

From: Matt Waddel <[email protected]>

The maximum blocks value was hardcoded to 65535 due to a 16 bit register length. The value can change for different platforms. This patch makes the default the current value of 65535, but it is configurable for other platforms.

---
 drivers/mmc/mmc.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)
drivers/mmc/mmc.c +9 -10
index 6805b33..d69eaa1 100644
@@ -33,6 +33,11 @@
 #include <mmc.h>
 #include <div64.h>
 
+/* Set block count limit because of 16 bit register limit on some hardware*/
+#ifndef CONFIG_SYS_MMC_MAX_BLK_COUNT
+#define CONFIG_SYS_MMC_MAX_BLK_COUNT 65535
+#endif
+
 static struct list_head mmc_devices;
 static int cur_dev_num = -1;
 
@@ -139,11 +144,8 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src)
 		return 0;
 
 	do {
-		/*
-		 * The 65535 constraint comes from some hardware has
-		 * only 16 bit width block number counter
-		 */
-		cur = (blocks_todo > 65535) ? 65535 : blocks_todo;
+		cur = (blocks_todo > CONFIG_SYS_MMC_MAX_BLK_COUNT) ?
+		       CONFIG_SYS_MMC_MAX_BLK_COUNT : blocks_todo;
 		if(mmc_write_blocks(mmc, start, cur, src) != cur)
 			return 0;
 		blocks_todo -= cur;
@@ -215,11 +217,8 @@ static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst)
 		return 0;
 
 	do {
-		/*
-		 * The 65535 constraint comes from some hardware has
-		 * only 16 bit width block number counter
-		 */
-		cur = (blocks_todo > 65535) ? 65535 : blocks_todo;
+		cur = (blocks_todo > CONFIG_SYS_MMC_MAX_BLK_COUNT) ?
+		       CONFIG_SYS_MMC_MAX_BLK_COUNT : blocks_todo;
 		if(mmc_read_blocks(mmc, dst, start, cur) != cur)
 			return 0;
 		blocks_todo -= cur;
Signature · 1 line
1.7.4.1
#23 lore raw

PATCH v4 2/3 MMC: Add support for PL180 ARM mmc device

In reply to matt.waddel at linaro.org

From: Matt Waddel <[email protected]>

Add support for the ARM PrimeCell MultiMedia Interface - PL180. Ported from original device driver written by ST-Ericsson.

---
 drivers/mmc/Makefile         |    1 +
 drivers/mmc/arm_pl180_mmci.c |  441 ++++++++++++++++++++++++++++++++++++++++++
 drivers/mmc/arm_pl180_mmci.h |  183 +++++++++++++++++
 3 files changed, 625 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mmc/arm_pl180_mmci.c
 create mode 100644 drivers/mmc/arm_pl180_mmci.h
drivers/mmc/Makefile +1 -0
index 3496f0a..7b3c319 100644
@@ -31,6 +31,7 @@ COBJS-$(CONFIG_DAVINCI_MMC) += davinci_mmc.o
 COBJS-$(CONFIG_FSL_ESDHC) += fsl_esdhc.o
 COBJS-$(CONFIG_GENERIC_MMC) += mmc.o
 COBJS-$(CONFIG_GENERIC_ATMEL_MCI) += gen_atmel_mci.o
+COBJS-$(CONFIG_ARM_PL180_MMCI) += arm_pl180_mmci.o
 COBJS-$(CONFIG_MXC_MMC) += mxcmmc.o
 COBJS-$(CONFIG_OMAP3_MMC) += omap3_mmc.o
 COBJS-$(CONFIG_OMAP_HSMMC) += omap_hsmmc.o
drivers/mmc/arm_pl180_mmci.c new file +441 -0

441 lines not on this page · raw message

drivers/mmc/arm_pl180_mmci.h new file +183 -0

183 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#24 lore raw

PATCH v4 3/3 ARMV7: Vexpress: Add MMC support

In reply to matt.waddel at linaro.org

From: Matt Waddel <[email protected]>

Added the board specific definitions to use the MMCI device.

---
 board/armltd/vexpress/ca9x4_ct_vxp.c |    9 +++++++++
 include/configs/ca9x4_ct_vxp.h       |    4 ++++
 2 files changed, 13 insertions(+), 0 deletions(-)
board/armltd/vexpress/ca9x4_ct_vxp.c +9 -0
index ce1be1e..3566b95 100644
@@ -86,6 +86,15 @@ int board_eth_init(bd_t *bis)
 	return rc;
 }
 
+int cpu_mmc_init(bd_t *bis)
+{
+	int rc = 0;
+#ifdef CONFIG_ARM_PL180_MMCI
+	rc = arm_pl180_mmci_init();
+#endif
+	return rc;
+}
+
 static void flash__init(void)
 {
 	/* Setup the sytem control register to allow writing to flash */
include/configs/ca9x4_ct_vxp.h +4 -0
index 63f003d..4ab58c0 100644
@@ -86,6 +86,10 @@
 #define CONFIG_MMC			1
 #define CONFIG_CMD_MMC
 #define CONFIG_GENERIC_MMC
+#define CONFIG_ARM_PL180_MMCI
+#define CONFIG_ARM_PL180_MMCI_BASE	0x10005000
+#define CONFIG_SYS_MMC_MAX_BLK_COUNT	127
+#define CONFIG_ARM_PL180_MMCI_CLOCK_FREQ 6250000
 
 /* BOOTP options */
 #define CONFIG_BOOTP_BOOTFILESIZE
Signature · 1 line
1.7.4.1