Skip to contentSkip to conversation

Marvell SDIO/MMC driver for Sheevaplug

PATCH Superseded DrEagle 2 participants 18 messages Sep 21, 2012 – Sep 26, 2012

Subsystems (2)
lore
Share & tools
lore

DrEagle

author
#0 lore raw

cover Marvell SDIO/MMC driver for Sheevaplug

This serie of patch add SDIO/MMC support to Sheevaplug board

drEagle (4):
Add Marvell SDIO/MMC driver for Kirkwood SoC
Add SDIO/MMC support for kirkwood SoC
Add SDIO/MMC support for Sheevaplug board
Fix env address for Sheevaplug board

 arch/arm/include/asm/arch-kirkwood/kirkwood.h |    1 +
 board/Marvell/sheevaplug/sheevaplug.c         |   11 +
 drivers/mmc/Makefile                          |    1 +
 drivers/mmc/mrvl_mmc.c                        |  277 +++++++++++++++++++++++++
 include/configs/sheevaplug.h                  |   17 +-
 include/mrvl_mmc.h                            |  191 +++++++++++++++++
 6 files changed, 495 insertions(+), 3 deletions(-)
 create mode 100644 drivers/mmc/mrvl_mmc.c
 create mode 100644 include/mrvl_mmc.h
Signature · 1 line
1.7.10.4
author
#1 lore raw

v2 cover Marvell SDIO/MMC driver for Sheevaplug

This serie of patch add SDIO/MMC support to Sheevaplug board

Change from v1:
- Fix an issue with most SDHC cards because of timeout delay

drEagle (5):
Add Marvell SDIO/MMC driver for Kirkwood SoC
Add SDIO/MMC support for kirkwood SoC
Add SDIO/MMC support for Sheevaplug board
Fix env address for Sheevaplug board
Fix timeout in Marvell SDIO MMC driver

author
#2 lore raw

v2 cover Marvell SDIO/MMC driver for Sheevaplug

Hi,

I found an issue of timeout problems.

Now all my cards read correctly, quickly and efficiently.

If someone need a precompiled u-boot binary for testing this version, fell free to ask.

I will put it available online.

Le 22/09/2012 09:15, DrEagle a ?crit :

Quoted 6 lines

This serie of patch add SDIO/MMC support to Sheevaplug board

Change from v1:
- Fix an issue with most SDHC cards because of timeout delay

Quoted 7 lines

drEagle (5):
Add Marvell SDIO/MMC driver for Kirkwood SoC
Add SDIO/MMC support for kirkwood SoC
Add SDIO/MMC support for Sheevaplug board
Fix env address for Sheevaplug board
Fix timeout in Marvell SDIO MMC driver

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 551 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120922/582bd240/attachment.pgp>

#3 lore raw

v2 cover Marvell SDIO/MMC driver for Sheevaplug

Quoted 12 lines

-----Original Message-----
From: DrEagle [mailto:dreagle at doukki.net]
Sent: 22 September 2012 13:05
To: DrEagle
Cc: u-boot at lists.denx.de; uboot at doukki.net; Lior Amsalem; Prafulla Wadaskar; Martin Michlmayr
Subject: Re: [PATCH v2 0/5] Marvell SDIO/MMC driver for Sheevaplug

Hi,

Quoted 8 lines

I found an issue of timeout problems.

Now all my cards read correctly, quickly and efficiently.

If someone need a precompiled u-boot binary for testing this version, fell free to ask.

I will put it available online.

Avoid top posting

Quoted 16 lines

Le 22/09/2012 09:15, DrEagle a ?crit :

Quoted 13 lines

This serie of patch add SDIO/MMC support to Sheevaplug board

Change from v1:
- Fix an issue with most SDHC cards because of timeout delay

drEagle (5):
Add Marvell SDIO/MMC driver for Kirkwood SoC
Add SDIO/MMC support for kirkwood SoC
Add SDIO/MMC support for Sheevaplug board
Fix env address for Sheevaplug board
Fix timeout in Marvell SDIO MMC driver

#4 lore raw

v2 cover Marvell SDIO/MMC driver for Sheevaplug

In reply to DrEagle
Quoted 14 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of DrEagle
Sent: 22 September 2012 12:45
To: DrEagle
Cc: Lior Amsalem; u-boot at lists.denx.de; uboot at doukki.net
Subject: [U-Boot] [PATCH v2 0/5] Marvell SDIO/MMC driver for Sheevaplug

This serie of patch add SDIO/MMC support to Sheevaplug board

Quoted 7 lines

Change from v1:
- Fix an issue with most SDHC cards because of timeout delay

drEagle (5):
Add Marvell SDIO/MMC driver for Kirkwood SoC
Add SDIO/MMC support for kirkwood SoC
Add SDIO/MMC support for Sheevaplug board

Hi DrEagle
Thanks for this patch series.
Copying Andy Fleming being MMC custodian

Quoted 2 lines

Fix env address for Sheevaplug board
Fix timeout in Marvell SDIO MMC driver

Below these could be standalone patch can be posted independently (not part of this patch series)

Regards...
Prafulla . . .

#5 lore raw

v2 cover Marvell SDIO/MMC driver for Sheevaplug

In reply to DrEagle
Quoted 17 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of DrEagle
Sent: 22 September 2012 12:45
To: DrEagle
Cc: Lior Amsalem; u-boot at lists.denx.de; uboot at doukki.net
Subject: [U-Boot] [PATCH v2 0/5] Marvell SDIO/MMC driver for Sheevaplug

This serie of patch add SDIO/MMC support to Sheevaplug board

Change from v1:
- Fix an issue with most SDHC cards because of timeout delay

Quoted 6 lines

drEagle (5):
Add Marvell SDIO/MMC driver for Kirkwood SoC
Add SDIO/MMC support for kirkwood SoC
Add SDIO/MMC support for Sheevaplug board
Fix env address for Sheevaplug board
Fix timeout in Marvell SDIO MMC driver

Hi DrEagle
I still request you to study mvsdhci.c which is similar framework used for Pantheon family of SoCs, try to use this infrastructure is possible for Kirkwood support.

Regards...
Prafulla . . .

author
#6 lore raw

PATCH v2 1/5 Add Marvell SDIO/MMC driver for Kirkwood SoC

In reply to DrEagle

Add Marvell SDIO/MMC driver for Kirkwood SoC

---
 drivers/mmc/Makefile   |    1 +
 drivers/mmc/mrvl_mmc.c |  277 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/mrvl_mmc.h     |  191 +++++++++++++++++++++++++++++++++
 3 files changed, 469 insertions(+)
 create mode 100644 drivers/mmc/mrvl_mmc.c
 create mode 100644 include/mrvl_mmc.h
drivers/mmc/Makefile +1 -0
index 2b96cdc..7f3b7c1 100644
@@ -37,6 +37,7 @@ COBJS-$(CONFIG_GENERIC_MMC) += mmc.o
 COBJS-$(CONFIG_GENERIC_ATMEL_MCI) += gen_atmel_mci.o
 COBJS-$(CONFIG_MMC_SPI) += mmc_spi.o
 COBJS-$(CONFIG_ARM_PL180_MMCI) += arm_pl180_mmci.o
+COBJS-$(CONFIG_MRVL_MMC) += mrvl_mmc.o
 COBJS-$(CONFIG_MV_SDHCI) += mv_sdhci.o
 COBJS-$(CONFIG_MXC_MMC) += mxcmmc.o
 COBJS-$(CONFIG_MXS_MMC) += mxsmmc.o
drivers/mmc/mrvl_mmc.c new file +277 -0

277 lines not on this page · raw message

include/mrvl_mmc.h new file +191 -0

191 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#7 lore raw

PATCH v2 1/5 Add Marvell SDIO/MMC driver for Kirkwood SoC

Quoted 12 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of DrEagle
Sent: 22 September 2012 12:46
To: DrEagle
Cc: Lior Amsalem; u-boot at lists.denx.de; uboot at doukki.net
Subject: [U-Boot] [PATCH v2 1/5] Add Marvell SDIO/MMC driver for Kirkwood SoC

Quoted 7 lines

Add Marvell SDIO/MMC driver for Kirkwood SoC

---
 drivers/mmc/Makefile   |    1 +
 drivers/mmc/mrvl_mmc.c |  277

The file name should be kirkwood_mmc.*

Quoted 2 lines

++++++++++++++++++++++++++++++++++++++++++++++++

 include/mrvl_mmc.h     |  191 +++++++++++++++++++++++++++++++++

Ditto

drivers/mmc/Makefile COBJS-$(CONFIG_GENERIC_MMC) += mmc.o · line 40

Quoted 13 lines
 3 files changed, 469 insertions(+)
 create mode 100644 drivers/mmc/mrvl_mmc.c
 create mode 100644 include/mrvl_mmc.h
drivers/mmc/Makefile +1 -0
index 2b96cdc..7f3b7c1 100644
@@ -37,6 +37,7 @@ COBJS-$(CONFIG_GENERIC_MMC) += mmc.o
 COBJS-$(CONFIG_GENERIC_ATMEL_MCI) += gen_atmel_mci.o
 COBJS-$(CONFIG_MMC_SPI) += mmc_spi.o
 COBJS-$(CONFIG_ARM_PL180_MMCI) += arm_pl180_mmci.o
+COBJS-$(CONFIG_MRVL_MMC) += mrvl_mmc.o

This should be CONFIG_KIRKWOOD_MMC

Quoted 31 lines
drivers/mmc/Makefile +0 -0
 COBJS-$(CONFIG_MV_SDHCI) += mv_sdhci.o
 COBJS-$(CONFIG_MXC_MMC) += mxcmmc.o
 COBJS-$(CONFIG_MXS_MMC) += mxsmmc.o
drivers/mmc/mrvl_mmc.c new file +22 -0
new file mode 100644
index 0000000..8127961
@@ -0,0 +1,277 @@
+/*
+ * Driver for Marvell SDIO/MMC controller
+ *
+ * (C) Copyright 2012
+ * Marvell Semiconductor <www.marvell.com>
+ * Written-by: Lior Amsalem <[email protected]>
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,

drivers/mmc/mrvl_mmc.c line 32

Quoted 10 lines
drivers/mmc/mrvl_mmc.c new file +10 -0
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <malloc.h>
+#include <part.h>
+#include <mmc.h>
+
+#include <mrvl_mmc.h>
+#define MRVL_MMC_MAKE_CMD(c, f) (((c & 0xff) << 8) | (f & 0xff))

Since this is Kirkwood MMC driver you should use KW_ suffix for all macros and kw_ suffix for all function/variable names.

MRVL is generic to marvell and valid if this driver is applicable to all Marvell SOCs.

drivers/mmc/mrvl_mmc.c

Quoted 6 lines
drivers/mmc/mrvl_mmc.c new file +6 -0
+
+
+static int mrvl_mmc_setup_data(struct mmc_data *data)
+{
+     if (data->flags & MMC_DATA_READ) {
+             SDIO_REG_WRITE16(SDIO_SYS_ADDR_LOW,((ulong)(data->dest)) &

No need to define these macros use standard readl/writel calls for register r/w operation.

Quoted 33 lines

0xffff);
+ SDIO_REG_WRITE16(SDIO_SYS_ADDR_HI,(((ulong)data->dest) >> 16)
& 0xffff);

drivers/mmc/mrvl_mmc.c new file +2 -0
+     } else {
+             SDIO_REG_WRITE16(SDIO_SYS_ADDR_LOW,((ulong)(data->src)) &

0xffff);
+ SDIO_REG_WRITE16(SDIO_SYS_ADDR_HI,(((ulong)data->src) >> 16) &
0xffff);

drivers/mmc/mrvl_mmc.c new file +9 -0
+     }
+
+     SDIO_REG_WRITE16(SDIO_BLK_SIZE, data->blocksize);
+     SDIO_REG_WRITE16(SDIO_BLK_COUNT, data->blocks);
+
+     return 0;
+}
+
+static int mrvl_mmc_send_cmd (struct mmc *mmc, struct mmc_cmd *cmd,

struct mmc_data *data)

drivers/mmc/mrvl_mmc.c new file +10 -0
+{
+     int     timeout = 10;
+     ushort waittype = 0;
+     int err = 0 ;
+     ushort response[8], resp_indx = 0;
+     ushort resptype = 0;
+     ushort xfertype = 0;
+
+#ifdef DEBUG
+     printf("cmd [0x%x] resp_type[0x%x] arg[0x%x]\n", cmd->cmdidx, cmd-
Quoted 1 line

resp_type, cmd->cmdarg);

drivers/mmc/mrvl_mmc.c new file +4 -0
+#endif
+
+     /* clear status */
+     SDIO_REG_WRITE16(SDIO_NOR_INTR_STATUS, 0xffff);

drivers/mmc/mrvl_mmc.c line 75

Quoted 10 lines
drivers/mmc/mrvl_mmc.c new file +10 -0
+     SDIO_REG_WRITE16(SDIO_ERR_INTR_STATUS, 0xffff);
+
+     /* Checking if card is busy */
+     while ((SDIO_REG_READ16(SDIO_PRESENT_STATE0) & CARD_BUSY)) {
+             if (timeout == 0) {
+                     printf("MRVL MMC: card busy!\n");
+                     return -1;
+             }
+             timeout--;
+             udelay(1000);

Can you avoid this delay, may you increase timeout value and avoid this udelay?

drivers/mmc/mrvl_mmc.c line 80

Quoted 5 lines
drivers/mmc/mrvl_mmc.c new file +5 -0
+     }
+
+     /* Set up for a data transfer if we have one */
+     if (data) {
+             int err;

Defined should be done at the top, but you can avoid this by directly using function call in if statement

drivers/mmc/mrvl_mmc.c line 83

Quoted 3 lines
drivers/mmc/mrvl_mmc.c new file +3 -0
+             err = mrvl_mmc_setup_data(data);
+             if(err)
+                     return err;

You can reduce the code here to two lines.

Quoted 28 lines
drivers/mmc/mrvl_mmc.c new file +28 -0
+     }
+
+     /* Analyzing resptype/xfertype/waittype for the command */
+     if (cmd->resp_type & MMC_RSP_BUSY)
+             resptype |= SDIO_CMD_RSP_48BUSY;
+     else if (cmd->resp_type & MMC_RSP_136)
+             resptype |= SDIO_CMD_RSP_136;
+     else if (cmd->resp_type & MMC_RSP_PRESENT)
+             resptype |= SDIO_CMD_RSP_48;
+     else
+             resptype |= SDIO_CMD_RSP_NONE;
+
+     if (cmd->resp_type & MMC_RSP_CRC)
+             resptype |= SDIO_CMD_CHECK_CMDCRC;
+
+     if (cmd->resp_type & MMC_RSP_OPCODE)
+             resptype |= SDIO_CMD_INDX_CHECK;
+
+     if (cmd->resp_type & MMC_RSP_PRESENT) {
+             resptype |= SDIO_UNEXPECTED_RESP;
+             waittype |= SDIO_NOR_UNEXP_RSP;
+     }
+
+     if (data) {
+             resptype |= SDIO_CMD_DATA_PRESENT | SDIO_CMD_CHECK_DATACRC16;
+             xfertype |= SDIO_XFER_MODE_HW_WR_DATA_EN;
+             if (data->flags & MMC_DATA_READ) {
+                     xfertype |= SDIO_XFER_MODE_TO_HOST;

drivers/mmc/mrvl_mmc.c line 121

Quoted 10 lines
drivers/mmc/mrvl_mmc.c new file +10 -0
+                     waittype = SDIO_NOR_DMA_INI;
+             } else
+                     waittype |= SDIO_NOR_XFER_DONE;
+     } else {
+             waittype |= SDIO_NOR_CMD_DONE;
+     }
+
+     /* Setting cmd arguments */
+     SDIO_REG_WRITE16(SDIO_ARG_LOW, (ushort)(cmd->cmdarg & 0xffff));
+     SDIO_REG_WRITE16(SDIO_ARG_HI,  (ushort)(cmd->cmdarg >> 16) );

Avoid hard coding, use macros, some comments too

Quoted 32 lines
drivers/mmc/mrvl_mmc.c new file +6 -0
+
+     /* Setting Xfer mode */
+     SDIO_REG_WRITE16(SDIO_XFER_MODE, xfertype);
+
+     /* Sending command */
+     SDIO_REG_WRITE16(SDIO_CMD, MRVL_MMC_MAKE_CMD(cmd->cmdidx,

resptype));

drivers/mmc/mrvl_mmc.c new file +9 -0
+
+     /* Waiting for completion */
+     timeout = 1000000;
+
+     while (!((SDIO_REG_READ16(SDIO_NOR_INTR_STATUS)) & waittype)) {
+             udelay(1);
+             if (SDIO_REG_READ16(SDIO_NOR_INTR_STATUS) & SDIO_NOR_ERROR) {
+#ifdef DEBUG
+                     printf("mrvl_mmc_send_cmd: error! cmd : %d, err reg:

%04x\n", cmd->cmdidx, SDIO_REG_READ16(SDIO_ERR_INTR_STATUS));

drivers/mmc/mrvl_mmc.c new file +2 -0
+#endif
+                     if (SDIO_REG_READ16(SDIO_ERR_INTR_STATUS) &

(SDIO_ERR_CMD_TIMEOUT | SDIO_ERR_DATA_TIMEOUT))

drivers/mmc/mrvl_mmc.c new file +12 -0
+                             return TIMEOUT;
+                     return COMM_ERR;
+             }
+             timeout--;
+             if (timeout <= 0) {
+                     printf("MRVL MMC: command timed out\n");
+                     return TIMEOUT;
+             }
+     }
+
+     /* Handling response */
+     for (resp_indx = 0 ; resp_indx < 8; resp_indx++)
author
#8 lore raw

PATCH v2 2/5 Add SDIO/MMC support for kirkwood SoC

In reply to DrEagle

Add SDIO/MMC support for kirkwood SoC

---
 arch/arm/include/asm/arch-kirkwood/kirkwood.h |    1 +
 1 file changed, 1 insertion(+)
arch/arm/include/asm/arch-kirkwood/kirkwood.h +1 -0
index 47771d5..343214b 100644
@@ -55,6 +55,7 @@
 #define KW_EGIGA0_BASE			(KW_REGISTER(0x72000))
 #define KW_EGIGA1_BASE			(KW_REGISTER(0x76000))
 #define KW_SATA_BASE			(KW_REGISTER(0x80000))
+#define KW_SDIO_BASE			(KW_REGISTER(0x90000))
 
 /* Kirkwood Sata controller has two ports */
 #define KW_SATA_PORT0_OFFSET		0x2000
Signature · 1 line
1.7.10.4
#9 lore raw

PATCH v2 2/5 Add SDIO/MMC support for kirkwood SoC

Quoted 24 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of DrEagle
Sent: 22 September 2012 12:47
To: DrEagle
Cc: Lior Amsalem; u-boot at lists.denx.de; uboot at doukki.net
Subject: [U-Boot] [PATCH v2 2/5] Add SDIO/MMC support for kirkwood SoC

Add SDIO/MMC support for kirkwood SoC

---
 arch/arm/include/asm/arch-kirkwood/kirkwood.h |    1 +
 1 file changed, 1 insertion(+)
arch/arm/include/asm/arch-kirkwood/kirkwood.h +0 -0
index 47771d5..343214b 100644

arch/arm/include/asm/arch-kirkwood/kirkwood.h line 61

Quoted 7 lines
arch/arm/include/asm/arch-kirkwood/kirkwood.h +1 -0
@@ -55,6 +55,7 @@
 #define KW_EGIGA0_BASE			(KW_REGISTER(0x72000))
 #define KW_EGIGA1_BASE			(KW_REGISTER(0x76000))
 #define KW_SATA_BASE			(KW_REGISTER(0x80000))
+#define KW_SDIO_BASE			(KW_REGISTER(0x90000))
 
 /* Kirkwood Sata controller has two ports */
 #define KW_SATA_PORT0_OFFSET		0x2000

Regards...
Prafulla . . .

Quoted 7 lines

--
1.7.10.4

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

author
#10 lore raw

PATCH v2 3/5 Add SDIO/MMC support for Sheevaplug board

In reply to DrEagle

Add SDIO/MMC support for Sheevaplug board

---
 board/Marvell/sheevaplug/sheevaplug.c |   11 +++++++++++
 include/configs/sheevaplug.h          |   12 ++++++++++++
 2 files changed, 23 insertions(+)
board/Marvell/sheevaplug/sheevaplug.c +11 -0
index 688d308..db64a05 100644
@@ -28,6 +28,9 @@
 #include <asm/arch/kirkwood.h>
 #include <asm/arch/mpp.h>
 #include "sheevaplug.h"
+#ifdef CONFIG_MRVL_MMC
+#include <mrvl_mmc.h>
+#endif /* CONFIG_MRVL_MMC */
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -147,3 +150,11 @@ void reset_phy(void)
 	printf("88E1116 Initialized on %s\n", name);
 }
 #endif /* CONFIG_RESET_PHY_R */
+
+#ifdef CONFIG_MRVL_MMC
+int board_mmc_init(bd_t *bis)
+{
+	mrvl_mmc_initialize(bis);
+	return 0;
+}
+#endif /* CONFIG_MRVL_MMC */
include/configs/sheevaplug.h +12 -0
index 83dd8ff..7d710bf 100644
@@ -47,6 +47,7 @@
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_ENV
 #define CONFIG_CMD_MII
+#define CONFIG_CMD_MMC
 #define CONFIG_CMD_NAND
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_USB
@@ -98,6 +99,17 @@
 #endif /* CONFIG_CMD_NET */
 
 /*
+ * SDIO/MMC Card Configuration
+ */
+#ifdef CONFIG_CMD_MMC
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MRVL_MMC
+#define CONFIG_SYS_MMC_BASE KW_SDIO_BASE
+#endif /* CONFIG_CMD_MMC */
+
+
+/*
  * File system
  */
 #define CONFIG_CMD_EXT2
Signature · 1 line
1.7.10.4
#11 lore raw

PATCH v2 3/5 Add SDIO/MMC support for Sheevaplug board

Quoted 62 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of DrEagle
Sent: 22 September 2012 12:47
To: DrEagle
Cc: Lior Amsalem; u-boot at lists.denx.de; uboot at doukki.net
Subject: [U-Boot] [PATCH v2 3/5] Add SDIO/MMC support for Sheevaplug board

Add SDIO/MMC support for Sheevaplug board

---
 board/Marvell/sheevaplug/sheevaplug.c |   11 +++++++++++
 include/configs/sheevaplug.h          |   12 ++++++++++++
 2 files changed, 23 insertions(+)
board/Marvell/sheevaplug/sheevaplug.c +11 -0
index 688d308..db64a05 100644
@@ -28,6 +28,9 @@
 #include <asm/arch/kirkwood.h>
 #include <asm/arch/mpp.h>
 #include "sheevaplug.h"
+#ifdef CONFIG_MRVL_MMC
+#include <mrvl_mmc.h>
+#endif /* CONFIG_MRVL_MMC */
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -147,3 +150,11 @@ void reset_phy(void)
 	printf("88E1116 Initialized on %s\n", name);
 }
 #endif /* CONFIG_RESET_PHY_R */
+
+#ifdef CONFIG_MRVL_MMC
+int board_mmc_init(bd_t *bis)
+{
+	mrvl_mmc_initialize(bis);
+	return 0;
+}
+#endif /* CONFIG_MRVL_MMC */
include/configs/sheevaplug.h +1 -0
index 83dd8ff..7d710bf 100644
@@ -47,6 +47,7 @@
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_ENV
 #define CONFIG_CMD_MII
+#define CONFIG_CMD_MMC
 #define CONFIG_CMD_NAND
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_USB
@@ -98,6 +99,17 @@
 #endif /* CONFIG_CMD_NET */

include/configs/sheevaplug.h line 109

Quoted 10 lines
include/configs/sheevaplug.h +8 -0
 
 /*
+ * SDIO/MMC Card Configuration
+ */
+#ifdef CONFIG_CMD_MMC
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MRVL_MMC
+#define CONFIG_SYS_MMC_BASE KW_SDIO_BASE
+#endif /* CONFIG_CMD_MMC */

This should go in mv-common.h so that it can be shared across multiple boards

Regards...
Prafulla . . .

Quoted 13 lines
include/configs/sheevaplug.h +3 -1
+
+
+/*
  * File system
  */
 #define CONFIG_CMD_EXT2
--

1.7.10.4

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

author
#12 lore raw

PATCH v2 4/5 Fix env address for Sheevaplug board

In reply to DrEagle

Fix env address for Sheevaplug board
Move env address and offset from 0x60000 to 0x80000

---
 include/configs/sheevaplug.h |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
include/configs/sheevaplug.h +2 -3
index 7d710bf..a10e825 100644
@@ -71,9 +71,8 @@
  * it has to be rounded to sector size
  */
 #define CONFIG_ENV_SIZE			0x20000	/* 128k */
-#define CONFIG_ENV_ADDR			0x60000
-#define CONFIG_ENV_OFFSET		0x60000	/* env starts here */
-
+#define CONFIG_ENV_ADDR			0x80000
+#define CONFIG_ENV_OFFSET		0x80000	/* env starts here */
 /*
  * Default environment variables
  */
Signature · 1 line
1.7.10.4
#13 lore raw

PATCH v2 4/5 Fix env address for Sheevaplug board

Quoted 25 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of DrEagle
Sent: 22 September 2012 12:48
To: DrEagle
Cc: Lior Amsalem; u-boot at lists.denx.de; uboot at doukki.net
Subject: [U-Boot] [PATCH v2 4/5] Fix env address for Sheevaplug board

Fix env address for Sheevaplug board
Move env address and offset from 0x60000 to 0x80000

---
 include/configs/sheevaplug.h |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
include/configs/sheevaplug.h +0 -0
index 7d710bf..a10e825 100644

include/configs/sheevaplug.h line 75

Quoted 8 lines
include/configs/sheevaplug.h +2 -3
@@ -71,9 +71,8 @@
  * it has to be rounded to sector size
  */
 #define CONFIG_ENV_SIZE			0x20000	/* 128k */
-#define CONFIG_ENV_ADDR			0x60000
-#define CONFIG_ENV_OFFSET		0x60000	/* env starts here */
-
+#define CONFIG_ENV_ADDR			0x80000
+#define CONFIG_ENV_OFFSET		0x80000	/* env starts here */

Why do you need this shift?

Regards...
Prafulla . ..

author
#14 lore raw

PATCH v2 4/5 Fix env address for Sheevaplug board

Le 24/09/2012 10:46, Prafulla Wadaskar a ?crit :

Quoted 19 lines
Quoted 19 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of DrEagle
Sent: 22 September 2012 12:48
To: DrEagle
Cc: Lior Amsalem; u-boot at lists.denx.de; uboot at doukki.net
Subject: [U-Boot] [PATCH v2 4/5] Fix env address for Sheevaplug board

Fix env address for Sheevaplug board
Move env address and offset from 0x60000 to 0x80000

---
 include/configs/sheevaplug.h |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Quoted 16 lines
Quoted 6 lines
include/configs/sheevaplug.h +0 -0
index 7d710bf..a10e825 100644

include/configs/sheevaplug.h line 75

Quoted 8 lines
include/configs/sheevaplug.h +2 -3
@@ -71,9 +71,8 @@
  * it has to be rounded to sector size
  */
 #define CONFIG_ENV_SIZE			0x20000	/* 128k */
-#define CONFIG_ENV_ADDR			0x60000
-#define CONFIG_ENV_OFFSET		0x60000	/* env starts here */
-
+#define CONFIG_ENV_ADDR			0x80000
+#define CONFIG_ENV_OFFSET		0x80000	/* env starts here */

Why do you need this shift?

Because the size of the new u-boot binary overlap the actual env offset.
If you reset the env or save env with a new u-boot, the code is corrupt, and noo boot anymore.

This shift fix this.

Quoted 3 lines

Regards...
Prafulla . ..

#15 lore raw

PATCH v2 4/5 Fix env address for Sheevaplug board

Quoted 48 lines

-----Original Message-----
From: DrEagle [mailto:dreagle at doukki.net]
Sent: 26 September 2012 11:06
To: Prafulla Wadaskar
Cc: DrEagle; u-boot at lists.denx.de; uboot at doukki.net
Subject: Re: [U-Boot] [PATCH v2 4/5] Fix env address for Sheevaplug board

Le 24/09/2012 10:46, Prafulla Wadaskar a ?crit :

Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of DrEagle
Sent: 22 September 2012 12:48
To: DrEagle
Cc: Lior Amsalem; u-boot at lists.denx.de; uboot at doukki.net
Subject: [U-Boot] [PATCH v2 4/5] Fix env address for Sheevaplug

board

Quoted 10 lines
Quoted 10 lines

Fix env address for Sheevaplug board
Move env address and offset from 0x60000 to 0x80000

---
 include/configs/sheevaplug.h |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Quoted 16 lines
Quoted 6 lines
include/configs/sheevaplug.h +0 -0
index 7d710bf..a10e825 100644

include/configs/sheevaplug.h line 75

Quoted 8 lines
include/configs/sheevaplug.h +2 -3
@@ -71,9 +71,8 @@
  * it has to be rounded to sector size
  */
 #define CONFIG_ENV_SIZE			0x20000	/* 128k */
-#define CONFIG_ENV_ADDR			0x60000
-#define CONFIG_ENV_OFFSET		0x60000	/* env starts here */
-
+#define CONFIG_ENV_ADDR			0x80000
+#define CONFIG_ENV_OFFSET		0x80000	/* env starts here */

Why do you need this shift?

Quoted 6 lines

Because the size of the new u-boot binary overlap the actual env offset.
If you reset the env or save env with a new u-boot, the code is corrupt, and noo boot anymore.

This shift fix this.

Then this will be valid for all the boards on which MMC support is being enabled, right?

In that case for sheevaplug, make this change in one patch in your next version (i.e. relocating ENV offset, and enabling MMC support)

Regards...
Prafulla . . .

author
#16 lore raw

PATCH v2 5/5 Fix timeout in Marvell SDIO MMC driver

In reply to DrEagle

Fix an issue with most SDHC cards because of timeout delay

---
 drivers/mmc/mrvl_mmc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/mrvl_mmc.c +3 -2
index 8127961..bdafbc7 100644
@@ -4,6 +4,7 @@
  * (C) Copyright 2012
  * Marvell Semiconductor <www.marvell.com>
  * Written-by: Lior Amsalem <[email protected]>
+ * Written-by: G?rald Kerma <[email protected]>
  * See file CREDITS for list of people who contributed to this
  * project.
  *
@@ -127,10 +128,9 @@ static int mrvl_mmc_send_cmd (struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_d
 	SDIO_REG_WRITE16(SDIO_CMD, MRVL_MMC_MAKE_CMD(cmd->cmdidx, resptype));
 
 	/* Waiting for completion */
-	timeout = 1000000;
+	timeout = 10000;
 
 	while (!((SDIO_REG_READ16(SDIO_NOR_INTR_STATUS)) & waittype)) {
-		udelay(1);
 		if (SDIO_REG_READ16(SDIO_NOR_INTR_STATUS) & SDIO_NOR_ERROR) {
 #ifdef DEBUG
 			printf("mrvl_mmc_send_cmd: error! cmd : %d, err reg: %04x\n", cmd->cmdidx, SDIO_REG_READ16(SDIO_ERR_INTR_STATUS));
@@ -139,6 +139,7 @@ static int mrvl_mmc_send_cmd (struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_d
 				return TIMEOUT;
 			return COMM_ERR;
 		}
+		udelay(1000);
 		timeout--;
 		if (timeout <= 0) {
 			printf("MRVL MMC: command timed out\n");
Signature · 1 line
1.7.10.4
#17 lore raw

PATCH v2 5/5 Fix timeout in Marvell SDIO MMC driver

Quoted 12 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of DrEagle
Sent: 22 September 2012 12:49
To: DrEagle
Cc: Lior Amsalem; u-boot at lists.denx.de; uboot at doukki.net
Subject: [U-Boot] [PATCH v2 5/5] Fix timeout in Marvell SDIO MMC driver

Quoted 6 lines

Fix an issue with most SDHC cards because of timeout delay

---
 drivers/mmc/mrvl_mmc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Well, you can make this as a part of your first patch since you are creating these files

Regards...
Prafulla . . .