Skip to contentSkip to conversation

ARM: kirkwood: add mvsdio driver

PATCH Superseded Gerald Kerma 2 participants 4 messages Jul 25, 2014

Subsystems (2)

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 ARM: kirkwood: add mvsdio driver

This patch add Marvell kirkwood MVSDIO/MMC driver and enable it for Sheevaplugs and OpenRD boards.

---

Changes in v5:
- purge uneeded code
- remove some extra debug

Changes in v4:
- rename drivers files to MVSDIO
- fix MMC clock init which now use dev ID
- clean debug strings
- remove MVSDIO_TWEAK_NOSDHS quirk
- remove dead code

Changes in v3:
- Add MVSDIO_TWEAK_NOSDHS quirk
- Minor clean

Changes in v2:
- Fix some typo and missing lines from patch import

 arch/arm/include/asm/arch-kirkwood/kirkwood.h |   1 +
 board/Marvell/openrd/openrd.c                 |  11 +
 board/Marvell/sheevaplug/sheevaplug.c         |  11 +
 drivers/mmc/Makefile                          |   1 +
 drivers/mmc/mvsdio.c                          | 353 ++++++++++++++++++++++++++
 include/configs/openrd.h                      |   8 +
 include/configs/sheevaplug.h                  |  17 +-
 include/mvsdio.h                              | 279 ++++++++++++++++++++
 8 files changed, 679 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mmc/mvsdio.c
 create mode 100644 include/mvsdio.h
arch/arm/include/asm/arch-kirkwood/kirkwood.h +1 -0
index bc207f5..3ea51d7 100644
@@ -39,6 +39,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
board/Marvell/openrd/openrd.c +11 -0
index a005a2f..6e9dca6 100644
@@ -17,6 +17,9 @@
 #include <asm/arch/kirkwood.h>
 #include <asm/arch/mpp.h>
 #include "openrd.h"
+#ifdef CONFIG_MVSDIO_MMC
+# include <mvsdio.h>
+#endif /* CONFIG_MVSDIO_MMC */
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -159,3 +162,11 @@ void reset_phy(void)
 #endif
 }
 #endif /* CONFIG_RESET_PHY_R */
+
+#ifdef CONFIG_MRVL_MMC
+int board_mmc_init(bd_t *bis)
+{
+	mrvl_mmc_init(bis);
+	return 0;
+}
+#endif /* CONFIG_MRVL_MMC */
board/Marvell/sheevaplug/sheevaplug.c +11 -0
index 87e49f4..c33f55c 100644
@@ -12,6 +12,9 @@
 #include <asm/arch/kirkwood.h>
 #include <asm/arch/mpp.h>
 #include "sheevaplug.h"
+#ifdef CONFIG_MVSDIO_MMC
+# include <mvsdio.h>
+#endif /* CONFIG_MVSDIO_MMC */
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -131,3 +134,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_init(bis);
+	return 0;
+}
+#endif /* CONFIG_MRVL_MMC */
drivers/mmc/Makefile +1 -0
index 34febf5..1c8f275 100644
@@ -37,3 +37,4 @@ obj-$(CONFIG_SPL_MMC_BOOT) += fsl_esdhc_spl.o
 else
 obj-$(CONFIG_GENERIC_MMC) += mmc_write.o
 endif
+obj-$(CONFIG_MVSDIO_MMC) += mvsdio.o
drivers/mmc/mvsdio.c new file +353 -0

353 lines not on this page · raw message

include/configs/openrd.h +8 -0
index 8fab6e6..03370b7 100644
@@ -49,6 +49,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
@@ -123,4 +124,11 @@
 #define CONFIG_SYS_ATA_IDE1_OFFSET	MV_SATA_PORT1_OFFSET
 #endif /*CONFIG_MVSATA_IDE*/
 
+#ifdef CONFIG_CMD_MMC
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MVSDIO_MMC
+#define CONFIG_SYS_MMC_BASE KW_SDIO_BASE
+#endif /* CONFIG_CMD_MMC */
+
 #endif /* _CONFIG_OPENRD_BASE_H */
include/configs/sheevaplug.h +15 -2
index ecc93bc..1b44f8f 100644
@@ -31,9 +31,11 @@
 #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
+
 /*
  * mv-common.h should be defined after CMD configs since it used them
  * to enable certain macros
@@ -49,13 +51,14 @@
 #else
 #define CONFIG_ENV_IS_NOWHERE		1	/* if env in SDRAM */
 #endif
+
 /*
  * max 4k env size is enough, but in case of nand
  * 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
@@ -82,6 +85,16 @@
 #endif /* CONFIG_CMD_NET */
 
 /*
+ * SDIO/MMC Card Configuration
+ */
+#ifdef CONFIG_CMD_MMC
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MVSDIO_MMC
+#define CONFIG_SYS_MMC_BASE KW_SDIO_BASE
+#endif /* CONFIG_CMD_MMC */
+
+/*
  * File system
  */
 #define CONFIG_CMD_EXT2
include/mvsdio.h new file +279 -0

279 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw

PATCH v5 1/1 ARM: kirkwood: add mvsdio driver

Quoted 4 lines · Gerald Kerma

This patch add Marvell kirkwood MVSDIO/MMC driver
and enable it for Sheevaplugs and OpenRD boards.

Please don't send this patch as base64 encoded. It makes it impossible to apply this patch or run checkpatch on it.

Did you run it though checkpatch btw?

Quoted 17 lines

---

Changes in v5:
- purge uneeded code
- remove some extra debug

Changes in v4:
- rename drivers files to MVSDIO
- fix MMC clock init which now use dev ID
- clean debug strings
- remove MVSDIO_TWEAK_NOSDHS quirk
- remove dead code

Changes in v3:
- Add MVSDIO_TWEAK_NOSDHS quirk
- Minor clean

Quoted 8 lines

Changes in v2:
- Fix some typo and missing lines from patch import

  arch/arm/include/asm/arch-kirkwood/kirkwood.h |   1 +
  board/Marvell/openrd/openrd.c                 |  11 +
  board/Marvell/sheevaplug/sheevaplug.c         |  11 +
  drivers/mmc/Makefile                          |   1 +
  drivers/mmc/mvsdio.c                          | 353 ++++++++++++++++++++++++++

I suggest to rename the driver to mvebu_mmc.c instead. This MVEBU is the generally agreed upon abbreviation for Marvell SoC's (Orion, Kirkwood, Armada XP, 370 ...).

Quoted 35 lines
  include/configs/openrd.h                      |   8 +
  include/configs/sheevaplug.h                  |  17 +-
  include/mvsdio.h                              | 279 ++++++++++++++++++++
  8 files changed, 679 insertions(+), 2 deletions(-)

create mode 100644 drivers/mmc/mvsdio.c
create mode 100644 include/mvsdio.h

arch/arm/include/asm/arch-kirkwood/kirkwood.h +1 -0
index bc207f5..3ea51d7 100644
@@ -39,6 +39,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
board/Marvell/openrd/openrd.c +3 -0
index a005a2f..6e9dca6 100644
@@ -17,6 +17,9 @@
  #include <asm/arch/kirkwood.h>
  #include <asm/arch/mpp.h>
  #include "openrd.h"
+#ifdef CONFIG_MVSDIO_MMC
+# include <mvsdio.h>
+#endif /* CONFIG_MVSDIO_MMC */
 
  DECLARE_GLOBAL_DATA_PTR;
 
@@ -159,3 +162,11 @@ void reset_phy(void)
  #endif

board/Marvell/openrd/openrd.c void reset_phy(void) · line 172

Quoted 10 lines
board/Marvell/openrd/openrd.c +8 -0
  }
  #endif /* CONFIG_RESET_PHY_R */
+
+#ifdef CONFIG_MRVL_MMC
+int board_mmc_init(bd_t *bis)
+{
+	mrvl_mmc_init(bis);
+	return 0;
+}
+#endif /* CONFIG_MRVL_MMC */

Doesn't it make sense to move this code to init / enable the MMC driver into the arch/cpu/... SoC code? Instead of adding it to all the board specific files?

Quoted 16 lines
board/Marvell/sheevaplug/sheevaplug.c +3 -0
index 87e49f4..c33f55c 100644
@@ -12,6 +12,9 @@
  #include <asm/arch/kirkwood.h>
  #include <asm/arch/mpp.h>
  #include "sheevaplug.h"
+#ifdef CONFIG_MVSDIO_MMC
+# include <mvsdio.h>
+#endif /* CONFIG_MVSDIO_MMC */
 
  DECLARE_GLOBAL_DATA_PTR;
 
@@ -131,3 +134,11 @@ void reset_phy(void)
  	printf("88E1116 Initialized on %s\n", name);

board/Marvell/sheevaplug/sheevaplug.c void reset_phy(void) · line 144

Quoted 10 lines
board/Marvell/sheevaplug/sheevaplug.c +8 -0
  }
  #endif /* CONFIG_RESET_PHY_R */
+
+#ifdef CONFIG_MRVL_MMC
+int board_mmc_init(bd_t *bis)
+{
+	mrvl_mmc_init(bis);
+	return 0;
+}
+#endif /* CONFIG_MRVL_MMC */

Here we have this code again. I suggest to move it to the kirkwood cpu.c file instead.

Thanks,
Stefan

author
#2 lore raw

PATCH v5 1/1 ARM: kirkwood: add mvsdio driver

Hi Stefan,

Quoted 7 lines · Stefan Roese
Quoted 4 lines · Gerald Kerma

This patch add Marvell kirkwood MVSDIO/MMC driver
and enable it for Sheevaplugs and OpenRD boards.

Please don't send this patch as base64 encoded. It makes it impossible to apply this patch or run checkpatch on it.

I use git send-email and I have used the default encoding [UTF-8], what is the preferred format that I may specify ?

Quoted 1 line

Did you run it though checkpatch btw?

yes, the results given is :
total: 0 errors, 0 warnings, 0 checks, 744 lines checked

Same for the coming v6 on 730 lines checked.

Quoted 1 line

I suggest to rename the driver to mvebu_mmc.c instead. This MVEBU is the generally agreed upon abbreviation for Marvell SoC's (Orion, Kirkwood, Armada XP, 370 ...).

Done,

Quoted 1 line

Doesn't it make sense to move this code to init / enable the MMC driver into the arch/cpu/... SoC code? Instead of adding it to all the board specific files?

Good idea

Quoted 1 line

Here we have this code again. I suggest to move it to the kirkwood cpu.c file instead.

Done

I'll check and send a new version (v6).
Do I rename the patch header ?

Enjoy

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

author
#3 lore raw

PATCH v5 1/1 ARM: kirkwood: add mvsdio driver

Quoted 3 lines
Quoted 1 line

Please don't send this patch as base64 encoded. It makes it impossible to apply this patch or run checkpatch on it.

I use git send-email and I have used the default encoding [UTF-8], what is the preferred format that I may specify ?

My first name is G?rald.
So the message are sent in UTF-8

MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Is this a problem ?

Enjoy,

Signature · 7 lines
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 538 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140725/81d6a21e/attachment.pgp>