All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection
@ 2012-12-03 12:19 Nikita Kiryanov
  2012-12-03 12:19 ` [U-Boot] [PATCH 1/7] omap: consolidate common mmc definitions Nikita Kiryanov
                   ` (11 more replies)
  0 siblings, 12 replies; 20+ messages in thread
From: Nikita Kiryanov @ 2012-12-03 12:19 UTC (permalink / raw)
  To: u-boot

This patchset implements card detection and write protection check for omap mmc.
The write protect implementation also adds generic code that is usable by other
mmc drivers.

The first 3 patches are preparation patches that contain general maintenance
for omap mmc driver.

This patchset depends on http://patchwork.ozlabs.org/patch/202384/

Nikita Kiryanov (7):
  omap: consolidate common mmc definitions
  omap_hsmmc: fix out of bounds array access
  omap_hsmmc: introduce omap_hsmmc_data struct
  omap_hsmmc: implement driver check for card detection
  cm-t35: implement board specific card detect check
  mmc: add support for write protection
  omap_hsmmc: add driver check for write protection

 arch/arm/cpu/armv7/am33xx/board.c               |    4 +-
 arch/arm/cpu/armv7/omap-common/boot-common.c    |    4 +-
 arch/arm/cpu/armv7/omap3/board.c                |    4 +-
 arch/arm/include/asm/arch-am33xx/mmc_host_def.h |  140 +------------------
 arch/arm/include/asm/arch-omap3/mmc_host_def.h  |  139 +------------------
 arch/arm/include/asm/arch-omap4/mmc_host_def.h  |  140 +------------------
 arch/arm/include/asm/arch-omap5/mmc_host_def.h  |  140 +------------------
 arch/arm/include/asm/omap_mmc.h                 |  168 +++++++++++++++++++++++
 board/cm_t35/cm_t35.c                           |   13 +-
 board/comelit/dig297/dig297.c                   |    3 +-
 board/corscience/tricorder/tricorder.c          |    2 +-
 board/htkw/mcx/mcx.c                            |    2 +-
 board/isee/igep0020/igep0020.c                  |    3 +-
 board/isee/igep0030/igep0030.c                  |    3 +-
 board/logicpd/am3517evm/am3517evm.c             |    3 +-
 board/logicpd/omap3som/omap3logic.c             |    2 +-
 board/logicpd/zoom1/zoom1.c                     |    3 +-
 board/logicpd/zoom2/zoom2.c                     |    3 +-
 board/matrix_vision/mvblx/mvblx.c               |    4 +-
 board/nokia/rx51/rx51.c                         |    4 +-
 board/overo/overo.c                             |    3 +-
 board/pandora/pandora.c                         |    3 +-
 board/technexion/twister/twister.c              |    2 +-
 board/teejet/mt_ventoux/mt_ventoux.c            |    2 +-
 board/ti/am3517crane/am3517crane.c              |    3 +-
 board/ti/beagle/beagle.c                        |    3 +-
 board/ti/evm/evm.c                              |    3 +-
 board/ti/omap5_evm/evm.c                        |    4 +-
 board/ti/panda/panda.c                          |    3 +-
 board/ti/sdp3430/sdp.c                          |    3 +-
 board/ti/sdp4430/sdp.c                          |    4 +-
 board/timll/devkit8000/devkit8000.c             |    3 +-
 common/cmd_mmc.c                                |    7 +
 drivers/mmc/arm_pl180_mmci.c                    |    1 +
 drivers/mmc/bfin_sdh.c                          |    1 +
 drivers/mmc/davinci_mmc.c                       |    1 +
 drivers/mmc/fsl_esdhc.c                         |    1 +
 drivers/mmc/ftsdc010_esdhc.c                    |    1 +
 drivers/mmc/gen_atmel_mci.c                     |    1 +
 drivers/mmc/mmc.c                               |   17 +++
 drivers/mmc/mmc_spi.c                           |    1 +
 drivers/mmc/mxcmmc.c                            |    1 +
 drivers/mmc/mxsmmc.c                            |    1 +
 drivers/mmc/omap_hsmmc.c                        |   78 +++++++++--
 drivers/mmc/sdhci.c                             |    1 +
 drivers/mmc/sh_mmcif.c                          |    1 +
 drivers/mmc/tegra_mmc.c                         |    1 +
 include/mmc.h                                   |    2 +
 48 files changed, 324 insertions(+), 612 deletions(-)
 create mode 100644 arch/arm/include/asm/omap_mmc.h

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 1/7] omap: consolidate common mmc definitions
  2012-12-03 12:19 [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection Nikita Kiryanov
@ 2012-12-03 12:19 ` Nikita Kiryanov
  2012-12-03 12:19 ` [U-Boot] [PATCH 2/7] omap_hsmmc: fix out of bounds array access Nikita Kiryanov
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Nikita Kiryanov @ 2012-12-03 12:19 UTC (permalink / raw)
  To: u-boot

The various mmc_host_def.h files are almost identical.
Reduce code duplication by moving the similar definitions to a common
header file.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
 arch/arm/include/asm/arch-am33xx/mmc_host_def.h |  140 +------------------
 arch/arm/include/asm/arch-omap3/mmc_host_def.h  |  139 +------------------
 arch/arm/include/asm/arch-omap4/mmc_host_def.h  |  140 +------------------
 arch/arm/include/asm/arch-omap5/mmc_host_def.h  |  140 +------------------
 arch/arm/include/asm/omap_mmc.h                 |  167 +++++++++++++++++++++++
 5 files changed, 175 insertions(+), 551 deletions(-)
 create mode 100644 arch/arm/include/asm/omap_mmc.h

diff --git a/arch/arm/include/asm/arch-am33xx/mmc_host_def.h b/arch/arm/include/asm/arch-am33xx/mmc_host_def.h
index 1f597c0..33c9c83 100644
--- a/arch/arm/include/asm/arch-am33xx/mmc_host_def.h
+++ b/arch/arm/include/asm/arch-am33xx/mmc_host_def.h
@@ -16,148 +16,12 @@
 #ifndef MMC_HOST_DEF_H
 #define MMC_HOST_DEF_H
 
+#include <asm/omap_mmc.h>
+
 /*
  * OMAP HSMMC register definitions
  */
 #define OMAP_HSMMC1_BASE		0x48060100
 #define OMAP_HSMMC2_BASE		0x481D8100
 
-typedef struct hsmmc {
-	unsigned char res1[0x10];
-	unsigned int sysconfig;		/* 0x10 */
-	unsigned int sysstatus;		/* 0x14 */
-	unsigned char res2[0x14];
-	unsigned int con;		/* 0x2C */
-	unsigned char res3[0xD4];
-	unsigned int blk;		/* 0x104 */
-	unsigned int arg;		/* 0x108 */
-	unsigned int cmd;		/* 0x10C */
-	unsigned int rsp10;		/* 0x110 */
-	unsigned int rsp32;		/* 0x114 */
-	unsigned int rsp54;		/* 0x118 */
-	unsigned int rsp76;		/* 0x11C */
-	unsigned int data;		/* 0x120 */
-	unsigned int pstate;		/* 0x124 */
-	unsigned int hctl;		/* 0x128 */
-	unsigned int sysctl;		/* 0x12C */
-	unsigned int stat;		/* 0x130 */
-	unsigned int ie;		/* 0x134 */
-	unsigned char res4[0x8];
-	unsigned int capa;		/* 0x140 */
-} hsmmc_t;
-
-/*
- * OMAP HS MMC Bit definitions
- */
-#define MMC_SOFTRESET			(0x1 << 1)
-#define RESETDONE			(0x1 << 0)
-#define NOOPENDRAIN			(0x0 << 0)
-#define OPENDRAIN			(0x1 << 0)
-#define OD				(0x1 << 0)
-#define INIT_NOINIT			(0x0 << 1)
-#define INIT_INITSTREAM			(0x1 << 1)
-#define HR_NOHOSTRESP			(0x0 << 2)
-#define STR_BLOCK			(0x0 << 3)
-#define MODE_FUNC			(0x0 << 4)
-#define DW8_1_4BITMODE			(0x0 << 5)
-#define MIT_CTO				(0x0 << 6)
-#define CDP_ACTIVEHIGH			(0x0 << 7)
-#define WPP_ACTIVEHIGH			(0x0 << 8)
-#define RESERVED_MASK			(0x3 << 9)
-#define CTPL_MMC_SD			(0x0 << 11)
-#define BLEN_512BYTESLEN		(0x200 << 0)
-#define NBLK_STPCNT			(0x0 << 16)
-#define DE_DISABLE			(0x0 << 0)
-#define BCE_DISABLE			(0x0 << 1)
-#define BCE_ENABLE			(0x1 << 1)
-#define ACEN_DISABLE			(0x0 << 2)
-#define DDIR_OFFSET			(4)
-#define DDIR_MASK			(0x1 << 4)
-#define DDIR_WRITE			(0x0 << 4)
-#define DDIR_READ			(0x1 << 4)
-#define MSBS_SGLEBLK			(0x0 << 5)
-#define MSBS_MULTIBLK			(0x1 << 5)
-#define RSP_TYPE_OFFSET			(16)
-#define RSP_TYPE_MASK			(0x3 << 16)
-#define RSP_TYPE_NORSP			(0x0 << 16)
-#define RSP_TYPE_LGHT136		(0x1 << 16)
-#define RSP_TYPE_LGHT48			(0x2 << 16)
-#define RSP_TYPE_LGHT48B		(0x3 << 16)
-#define CCCE_NOCHECK			(0x0 << 19)
-#define CCCE_CHECK			(0x1 << 19)
-#define CICE_NOCHECK			(0x0 << 20)
-#define CICE_CHECK			(0x1 << 20)
-#define DP_OFFSET			(21)
-#define DP_MASK				(0x1 << 21)
-#define DP_NO_DATA			(0x0 << 21)
-#define DP_DATA				(0x1 << 21)
-#define CMD_TYPE_NORMAL			(0x0 << 22)
-#define INDEX_OFFSET			(24)
-#define INDEX_MASK			(0x3f << 24)
-#define INDEX(i)			(i << 24)
-#define DATI_MASK			(0x1 << 1)
-#define CMDI_MASK			(0x1 << 0)
-#define DTW_1_BITMODE			(0x0 << 1)
-#define DTW_4_BITMODE			(0x1 << 1)
-#define DTW_8_BITMODE                   (0x1 << 5) /* CON[DW8]*/
-#define SDBP_PWROFF			(0x0 << 8)
-#define SDBP_PWRON			(0x1 << 8)
-#define SDVS_1V8			(0x5 << 9)
-#define SDVS_3V0			(0x6 << 9)
-#define ICE_MASK			(0x1 << 0)
-#define ICE_STOP			(0x0 << 0)
-#define ICS_MASK			(0x1 << 1)
-#define ICS_NOTREADY			(0x0 << 1)
-#define ICE_OSCILLATE			(0x1 << 0)
-#define CEN_MASK			(0x1 << 2)
-#define CEN_DISABLE			(0x0 << 2)
-#define CEN_ENABLE			(0x1 << 2)
-#define CLKD_OFFSET			(6)
-#define CLKD_MASK			(0x3FF << 6)
-#define DTO_MASK			(0xF << 16)
-#define DTO_15THDTO			(0xE << 16)
-#define SOFTRESETALL			(0x1 << 24)
-#define CC_MASK				(0x1 << 0)
-#define TC_MASK				(0x1 << 1)
-#define BWR_MASK			(0x1 << 4)
-#define BRR_MASK			(0x1 << 5)
-#define ERRI_MASK			(0x1 << 15)
-#define IE_CC				(0x01 << 0)
-#define IE_TC				(0x01 << 1)
-#define IE_BWR				(0x01 << 4)
-#define IE_BRR				(0x01 << 5)
-#define IE_CTO				(0x01 << 16)
-#define IE_CCRC				(0x01 << 17)
-#define IE_CEB				(0x01 << 18)
-#define IE_CIE				(0x01 << 19)
-#define IE_DTO				(0x01 << 20)
-#define IE_DCRC				(0x01 << 21)
-#define IE_DEB				(0x01 << 22)
-#define IE_CERR				(0x01 << 28)
-#define IE_BADA				(0x01 << 29)
-
-#define VS30_3V0SUP			(1 << 25)
-#define VS18_1V8SUP			(1 << 26)
-
-/* Driver definitions */
-#define MMCSD_SECTOR_SIZE		512
-#define MMC_CARD			0
-#define SD_CARD				1
-#define BYTE_MODE			0
-#define SECTOR_MODE			1
-#define CLK_INITSEQ			0
-#define CLK_400KHZ			1
-#define CLK_MISC			2
-
-#define RSP_TYPE_NONE	(RSP_TYPE_NORSP | CCCE_NOCHECK | CICE_NOCHECK)
-#define MMC_CMD0	(INDEX(0) | RSP_TYPE_NONE | DP_NO_DATA | DDIR_WRITE)
-
-/* Clock Configurations and Macros */
-#define MMC_CLOCK_REFERENCE	96 /* MHz */
-
-#define mmc_reg_out(addr, mask, val)\
-	writel((readl(addr) & (~(mask))) | ((val) & (mask)), (addr))
-
-int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max);
-
 #endif /* MMC_HOST_DEF_H */
diff --git a/arch/arm/include/asm/arch-omap3/mmc_host_def.h b/arch/arm/include/asm/arch-omap3/mmc_host_def.h
index 3ce1f07..0ba621a 100644
--- a/arch/arm/include/asm/arch-omap3/mmc_host_def.h
+++ b/arch/arm/include/asm/arch-omap3/mmc_host_def.h
@@ -25,6 +25,8 @@
 #ifndef MMC_HOST_DEF_H
 #define MMC_HOST_DEF_H
 
+#include <asm/omap_mmc.h>
+
 /* T2 Register definitions */
 #define T2_BASE			0x48002000
 
@@ -59,142 +61,5 @@ typedef struct t2 {
 #define OMAP_HSMMC2_BASE	0x480B4000
 #define OMAP_HSMMC3_BASE	0x480AD000
 
-struct hsmmc {
-	unsigned char res1[0x10];
-	unsigned int sysconfig;		/* 0x10 */
-	unsigned int sysstatus;		/* 0x14 */
-	unsigned char res2[0x14];
-	unsigned int con;		/* 0x2C */
-	unsigned char res3[0xD4];
-	unsigned int blk;		/* 0x104 */
-	unsigned int arg;		/* 0x108 */
-	unsigned int cmd;		/* 0x10C */
-	unsigned int rsp10;		/* 0x110 */
-	unsigned int rsp32;		/* 0x114 */
-	unsigned int rsp54;		/* 0x118 */
-	unsigned int rsp76;		/* 0x11C */
-	unsigned int data;		/* 0x120 */
-	unsigned int pstate;		/* 0x124 */
-	unsigned int hctl;		/* 0x128 */
-	unsigned int sysctl;		/* 0x12C */
-	unsigned int stat;		/* 0x130 */
-	unsigned int ie;		/* 0x134 */
-	unsigned char res4[0x8];
-	unsigned int capa;		/* 0x140 */
-};
-
-/*
- * OMAP HS MMC Bit definitions
- */
-#define MMC_SOFTRESET			(0x1 << 1)
-#define RESETDONE			(0x1 << 0)
-#define NOOPENDRAIN			(0x0 << 0)
-#define OPENDRAIN			(0x1 << 0)
-#define OD				(0x1 << 0)
-#define INIT_NOINIT			(0x0 << 1)
-#define INIT_INITSTREAM			(0x1 << 1)
-#define HR_NOHOSTRESP			(0x0 << 2)
-#define STR_BLOCK 			(0x0 << 3)
-#define MODE_FUNC			(0x0 << 4)
-#define DW8_1_4BITMODE 			(0x0 << 5)
-#define MIT_CTO				(0x0 << 6)
-#define CDP_ACTIVEHIGH			(0x0 << 7)
-#define WPP_ACTIVEHIGH 			(0x0 << 8)
-#define RESERVED_MASK			(0x3 << 9)
-#define CTPL_MMC_SD 			(0x0 << 11)
-#define BLEN_512BYTESLEN		(0x200 << 0)
-#define NBLK_STPCNT			(0x0 << 16)
-#define DE_DISABLE			(0x0 << 0)
-#define BCE_DISABLE			(0x0 << 1)
-#define BCE_ENABLE			(0x1 << 1)
-#define ACEN_DISABLE			(0x0 << 2)
-#define DDIR_OFFSET			(4)
-#define DDIR_MASK			(0x1 << 4)
-#define DDIR_WRITE			(0x0 << 4)
-#define DDIR_READ			(0x1 << 4)
-#define MSBS_SGLEBLK			(0x0 << 5)
-#define MSBS_MULTIBLK			(0x1 << 5)
-#define RSP_TYPE_OFFSET			(16)
-#define RSP_TYPE_MASK			(0x3 << 16)
-#define RSP_TYPE_NORSP			(0x0 << 16)
-#define RSP_TYPE_LGHT136		(0x1 << 16)
-#define RSP_TYPE_LGHT48			(0x2 << 16)
-#define RSP_TYPE_LGHT48B		(0x3 << 16)
-#define CCCE_NOCHECK			(0x0 << 19)
-#define CCCE_CHECK			(0x1 << 19)
-#define CICE_NOCHECK			(0x0 << 20)
-#define CICE_CHECK			(0x1 << 20)
-#define DP_OFFSET			(21)
-#define DP_MASK				(0x1 << 21)
-#define DP_NO_DATA			(0x0 << 21)
-#define DP_DATA				(0x1 << 21)
-#define CMD_TYPE_NORMAL			(0x0 << 22)
-#define INDEX_OFFSET			(24)
-#define INDEX_MASK			(0x3f << 24)
-#define INDEX(i)			(i << 24)
-#define DATI_MASK			(0x1 << 1)
-#define CMDI_MASK			(0x1 << 0)
-#define DTW_1_BITMODE			(0x0 << 1)
-#define DTW_4_BITMODE			(0x1 << 1)
-#define DTW_8_BITMODE                   (0x1 << 5) /* CON[DW8]*/
-#define SDBP_PWROFF			(0x0 << 8)
-#define SDBP_PWRON			(0x1 << 8)
-#define SDVS_1V8			(0x5 << 9)
-#define SDVS_3V0			(0x6 << 9)
-#define ICE_MASK			(0x1 << 0)
-#define ICE_STOP			(0x0 << 0)
-#define ICS_MASK			(0x1 << 1)
-#define ICS_NOTREADY			(0x0 << 1)
-#define ICE_OSCILLATE			(0x1 << 0)
-#define CEN_MASK			(0x1 << 2)
-#define CEN_DISABLE			(0x0 << 2)
-#define CEN_ENABLE			(0x1 << 2)
-#define CLKD_OFFSET			(6)
-#define CLKD_MASK			(0x3FF << 6)
-#define DTO_MASK			(0xF << 16)
-#define DTO_15THDTO			(0xE << 16)
-#define SOFTRESETALL			(0x1 << 24)
-#define CC_MASK				(0x1 << 0)
-#define TC_MASK				(0x1 << 1)
-#define BWR_MASK			(0x1 << 4)
-#define BRR_MASK			(0x1 << 5)
-#define ERRI_MASK			(0x1 << 15)
-#define IE_CC				(0x01 << 0)
-#define IE_TC				(0x01 << 1)
-#define IE_BWR				(0x01 << 4)
-#define IE_BRR				(0x01 << 5)
-#define IE_CTO				(0x01 << 16)
-#define IE_CCRC				(0x01 << 17)
-#define IE_CEB				(0x01 << 18)
-#define IE_CIE				(0x01 << 19)
-#define IE_DTO				(0x01 << 20)
-#define IE_DCRC				(0x01 << 21)
-#define IE_DEB				(0x01 << 22)
-#define IE_CERR				(0x01 << 28)
-#define IE_BADA				(0x01 << 29)
-
-#define VS30_3V0SUP			(1 << 25)
-#define VS18_1V8SUP			(1 << 26)
-
-/* Driver definitions */
-#define MMCSD_SECTOR_SIZE		512
-#define MMC_CARD			0
-#define SD_CARD				1
-#define BYTE_MODE			0
-#define SECTOR_MODE			1
-#define CLK_INITSEQ			0
-#define CLK_400KHZ			1
-#define CLK_MISC			2
-
-#define RSP_TYPE_NONE	(RSP_TYPE_NORSP   | CCCE_NOCHECK | CICE_NOCHECK)
-#define MMC_CMD0	(INDEX(0)  | RSP_TYPE_NONE | DP_NO_DATA | DDIR_WRITE)
-
-/* Clock Configurations and Macros */
-#define MMC_CLOCK_REFERENCE	96 /* MHz */
-
-#define mmc_reg_out(addr, mask, val)\
-	writel((readl(addr) & (~(mask))) | ((val) & (mask)), (addr))
-
-int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max);
 
 #endif /* MMC_HOST_DEF_H */
diff --git a/arch/arm/include/asm/arch-omap4/mmc_host_def.h b/arch/arm/include/asm/arch-omap4/mmc_host_def.h
index 2114046..9c8ccb6 100644
--- a/arch/arm/include/asm/arch-omap4/mmc_host_def.h
+++ b/arch/arm/include/asm/arch-omap4/mmc_host_def.h
@@ -25,6 +25,8 @@
 #ifndef MMC_HOST_DEF_H
 #define MMC_HOST_DEF_H
 
+#include <asm/omap_mmc.h>
+
 /*
  * OMAP HSMMC register definitions
  */
@@ -33,142 +35,4 @@
 #define OMAP_HSMMC2_BASE	0x480B4100
 #define OMAP_HSMMC3_BASE	0x480AD100
 
-struct hsmmc {
-	unsigned char res1[0x10];
-	unsigned int sysconfig;		/* 0x10 */
-	unsigned int sysstatus;		/* 0x14 */
-	unsigned char res2[0x14];
-	unsigned int con;		/* 0x2C */
-	unsigned char res3[0xD4];
-	unsigned int blk;		/* 0x104 */
-	unsigned int arg;		/* 0x108 */
-	unsigned int cmd;		/* 0x10C */
-	unsigned int rsp10;		/* 0x110 */
-	unsigned int rsp32;		/* 0x114 */
-	unsigned int rsp54;		/* 0x118 */
-	unsigned int rsp76;		/* 0x11C */
-	unsigned int data;		/* 0x120 */
-	unsigned int pstate;		/* 0x124 */
-	unsigned int hctl;		/* 0x128 */
-	unsigned int sysctl;		/* 0x12C */
-	unsigned int stat;		/* 0x130 */
-	unsigned int ie;		/* 0x134 */
-	unsigned char res4[0x8];
-	unsigned int capa;		/* 0x140 */
-};
-
-/*
- * OMAP HS MMC Bit definitions
- */
-#define MMC_SOFTRESET			(0x1 << 1)
-#define RESETDONE			(0x1 << 0)
-#define NOOPENDRAIN			(0x0 << 0)
-#define OPENDRAIN			(0x1 << 0)
-#define OD				(0x1 << 0)
-#define INIT_NOINIT			(0x0 << 1)
-#define INIT_INITSTREAM			(0x1 << 1)
-#define HR_NOHOSTRESP			(0x0 << 2)
-#define STR_BLOCK			(0x0 << 3)
-#define MODE_FUNC			(0x0 << 4)
-#define DW8_1_4BITMODE			(0x0 << 5)
-#define MIT_CTO				(0x0 << 6)
-#define CDP_ACTIVEHIGH			(0x0 << 7)
-#define WPP_ACTIVEHIGH			(0x0 << 8)
-#define RESERVED_MASK			(0x3 << 9)
-#define CTPL_MMC_SD			(0x0 << 11)
-#define BLEN_512BYTESLEN		(0x200 << 0)
-#define NBLK_STPCNT			(0x0 << 16)
-#define DE_DISABLE			(0x0 << 0)
-#define BCE_DISABLE			(0x0 << 1)
-#define BCE_ENABLE			(0x1 << 1)
-#define ACEN_DISABLE			(0x0 << 2)
-#define DDIR_OFFSET			(4)
-#define DDIR_MASK			(0x1 << 4)
-#define DDIR_WRITE			(0x0 << 4)
-#define DDIR_READ			(0x1 << 4)
-#define MSBS_SGLEBLK			(0x0 << 5)
-#define MSBS_MULTIBLK			(0x1 << 5)
-#define RSP_TYPE_OFFSET			(16)
-#define RSP_TYPE_MASK			(0x3 << 16)
-#define RSP_TYPE_NORSP			(0x0 << 16)
-#define RSP_TYPE_LGHT136		(0x1 << 16)
-#define RSP_TYPE_LGHT48			(0x2 << 16)
-#define RSP_TYPE_LGHT48B		(0x3 << 16)
-#define CCCE_NOCHECK			(0x0 << 19)
-#define CCCE_CHECK			(0x1 << 19)
-#define CICE_NOCHECK			(0x0 << 20)
-#define CICE_CHECK			(0x1 << 20)
-#define DP_OFFSET			(21)
-#define DP_MASK				(0x1 << 21)
-#define DP_NO_DATA			(0x0 << 21)
-#define DP_DATA				(0x1 << 21)
-#define CMD_TYPE_NORMAL			(0x0 << 22)
-#define INDEX_OFFSET			(24)
-#define INDEX_MASK			(0x3f << 24)
-#define INDEX(i)			(i << 24)
-#define DATI_MASK			(0x1 << 1)
-#define CMDI_MASK			(0x1 << 0)
-#define DTW_1_BITMODE			(0x0 << 1)
-#define DTW_4_BITMODE			(0x1 << 1)
-#define DTW_8_BITMODE                   (0x1 << 5) /* CON[DW8]*/
-#define SDBP_PWROFF			(0x0 << 8)
-#define SDBP_PWRON			(0x1 << 8)
-#define SDVS_1V8			(0x5 << 9)
-#define SDVS_3V0			(0x6 << 9)
-#define ICE_MASK			(0x1 << 0)
-#define ICE_STOP			(0x0 << 0)
-#define ICS_MASK			(0x1 << 1)
-#define ICS_NOTREADY			(0x0 << 1)
-#define ICE_OSCILLATE			(0x1 << 0)
-#define CEN_MASK			(0x1 << 2)
-#define CEN_DISABLE			(0x0 << 2)
-#define CEN_ENABLE			(0x1 << 2)
-#define CLKD_OFFSET			(6)
-#define CLKD_MASK			(0x3FF << 6)
-#define DTO_MASK			(0xF << 16)
-#define DTO_15THDTO			(0xE << 16)
-#define SOFTRESETALL			(0x1 << 24)
-#define CC_MASK				(0x1 << 0)
-#define TC_MASK				(0x1 << 1)
-#define BWR_MASK			(0x1 << 4)
-#define BRR_MASK			(0x1 << 5)
-#define ERRI_MASK			(0x1 << 15)
-#define IE_CC				(0x01 << 0)
-#define IE_TC				(0x01 << 1)
-#define IE_BWR				(0x01 << 4)
-#define IE_BRR				(0x01 << 5)
-#define IE_CTO				(0x01 << 16)
-#define IE_CCRC				(0x01 << 17)
-#define IE_CEB				(0x01 << 18)
-#define IE_CIE				(0x01 << 19)
-#define IE_DTO				(0x01 << 20)
-#define IE_DCRC				(0x01 << 21)
-#define IE_DEB				(0x01 << 22)
-#define IE_CERR				(0x01 << 28)
-#define IE_BADA				(0x01 << 29)
-
-#define VS30_3V0SUP			(1 << 25)
-#define VS18_1V8SUP			(1 << 26)
-
-/* Driver definitions */
-#define MMCSD_SECTOR_SIZE		512
-#define MMC_CARD			0
-#define SD_CARD				1
-#define BYTE_MODE			0
-#define SECTOR_MODE			1
-#define CLK_INITSEQ			0
-#define CLK_400KHZ			1
-#define CLK_MISC			2
-
-#define RSP_TYPE_NONE	(RSP_TYPE_NORSP   | CCCE_NOCHECK | CICE_NOCHECK)
-#define MMC_CMD0	(INDEX(0)  | RSP_TYPE_NONE | DP_NO_DATA | DDIR_WRITE)
-
-/* Clock Configurations and Macros */
-#define MMC_CLOCK_REFERENCE	96 /* MHz */
-
-#define mmc_reg_out(addr, mask, val)\
-	writel((readl(addr) & (~(mask))) | ((val) & (mask)), (addr))
-
-int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max);
-
 #endif /* MMC_HOST_DEF_H */
diff --git a/arch/arm/include/asm/arch-omap5/mmc_host_def.h b/arch/arm/include/asm/arch-omap5/mmc_host_def.h
index 2114046..9c8ccb6 100644
--- a/arch/arm/include/asm/arch-omap5/mmc_host_def.h
+++ b/arch/arm/include/asm/arch-omap5/mmc_host_def.h
@@ -25,6 +25,8 @@
 #ifndef MMC_HOST_DEF_H
 #define MMC_HOST_DEF_H
 
+#include <asm/omap_mmc.h>
+
 /*
  * OMAP HSMMC register definitions
  */
@@ -33,142 +35,4 @@
 #define OMAP_HSMMC2_BASE	0x480B4100
 #define OMAP_HSMMC3_BASE	0x480AD100
 
-struct hsmmc {
-	unsigned char res1[0x10];
-	unsigned int sysconfig;		/* 0x10 */
-	unsigned int sysstatus;		/* 0x14 */
-	unsigned char res2[0x14];
-	unsigned int con;		/* 0x2C */
-	unsigned char res3[0xD4];
-	unsigned int blk;		/* 0x104 */
-	unsigned int arg;		/* 0x108 */
-	unsigned int cmd;		/* 0x10C */
-	unsigned int rsp10;		/* 0x110 */
-	unsigned int rsp32;		/* 0x114 */
-	unsigned int rsp54;		/* 0x118 */
-	unsigned int rsp76;		/* 0x11C */
-	unsigned int data;		/* 0x120 */
-	unsigned int pstate;		/* 0x124 */
-	unsigned int hctl;		/* 0x128 */
-	unsigned int sysctl;		/* 0x12C */
-	unsigned int stat;		/* 0x130 */
-	unsigned int ie;		/* 0x134 */
-	unsigned char res4[0x8];
-	unsigned int capa;		/* 0x140 */
-};
-
-/*
- * OMAP HS MMC Bit definitions
- */
-#define MMC_SOFTRESET			(0x1 << 1)
-#define RESETDONE			(0x1 << 0)
-#define NOOPENDRAIN			(0x0 << 0)
-#define OPENDRAIN			(0x1 << 0)
-#define OD				(0x1 << 0)
-#define INIT_NOINIT			(0x0 << 1)
-#define INIT_INITSTREAM			(0x1 << 1)
-#define HR_NOHOSTRESP			(0x0 << 2)
-#define STR_BLOCK			(0x0 << 3)
-#define MODE_FUNC			(0x0 << 4)
-#define DW8_1_4BITMODE			(0x0 << 5)
-#define MIT_CTO				(0x0 << 6)
-#define CDP_ACTIVEHIGH			(0x0 << 7)
-#define WPP_ACTIVEHIGH			(0x0 << 8)
-#define RESERVED_MASK			(0x3 << 9)
-#define CTPL_MMC_SD			(0x0 << 11)
-#define BLEN_512BYTESLEN		(0x200 << 0)
-#define NBLK_STPCNT			(0x0 << 16)
-#define DE_DISABLE			(0x0 << 0)
-#define BCE_DISABLE			(0x0 << 1)
-#define BCE_ENABLE			(0x1 << 1)
-#define ACEN_DISABLE			(0x0 << 2)
-#define DDIR_OFFSET			(4)
-#define DDIR_MASK			(0x1 << 4)
-#define DDIR_WRITE			(0x0 << 4)
-#define DDIR_READ			(0x1 << 4)
-#define MSBS_SGLEBLK			(0x0 << 5)
-#define MSBS_MULTIBLK			(0x1 << 5)
-#define RSP_TYPE_OFFSET			(16)
-#define RSP_TYPE_MASK			(0x3 << 16)
-#define RSP_TYPE_NORSP			(0x0 << 16)
-#define RSP_TYPE_LGHT136		(0x1 << 16)
-#define RSP_TYPE_LGHT48			(0x2 << 16)
-#define RSP_TYPE_LGHT48B		(0x3 << 16)
-#define CCCE_NOCHECK			(0x0 << 19)
-#define CCCE_CHECK			(0x1 << 19)
-#define CICE_NOCHECK			(0x0 << 20)
-#define CICE_CHECK			(0x1 << 20)
-#define DP_OFFSET			(21)
-#define DP_MASK				(0x1 << 21)
-#define DP_NO_DATA			(0x0 << 21)
-#define DP_DATA				(0x1 << 21)
-#define CMD_TYPE_NORMAL			(0x0 << 22)
-#define INDEX_OFFSET			(24)
-#define INDEX_MASK			(0x3f << 24)
-#define INDEX(i)			(i << 24)
-#define DATI_MASK			(0x1 << 1)
-#define CMDI_MASK			(0x1 << 0)
-#define DTW_1_BITMODE			(0x0 << 1)
-#define DTW_4_BITMODE			(0x1 << 1)
-#define DTW_8_BITMODE                   (0x1 << 5) /* CON[DW8]*/
-#define SDBP_PWROFF			(0x0 << 8)
-#define SDBP_PWRON			(0x1 << 8)
-#define SDVS_1V8			(0x5 << 9)
-#define SDVS_3V0			(0x6 << 9)
-#define ICE_MASK			(0x1 << 0)
-#define ICE_STOP			(0x0 << 0)
-#define ICS_MASK			(0x1 << 1)
-#define ICS_NOTREADY			(0x0 << 1)
-#define ICE_OSCILLATE			(0x1 << 0)
-#define CEN_MASK			(0x1 << 2)
-#define CEN_DISABLE			(0x0 << 2)
-#define CEN_ENABLE			(0x1 << 2)
-#define CLKD_OFFSET			(6)
-#define CLKD_MASK			(0x3FF << 6)
-#define DTO_MASK			(0xF << 16)
-#define DTO_15THDTO			(0xE << 16)
-#define SOFTRESETALL			(0x1 << 24)
-#define CC_MASK				(0x1 << 0)
-#define TC_MASK				(0x1 << 1)
-#define BWR_MASK			(0x1 << 4)
-#define BRR_MASK			(0x1 << 5)
-#define ERRI_MASK			(0x1 << 15)
-#define IE_CC				(0x01 << 0)
-#define IE_TC				(0x01 << 1)
-#define IE_BWR				(0x01 << 4)
-#define IE_BRR				(0x01 << 5)
-#define IE_CTO				(0x01 << 16)
-#define IE_CCRC				(0x01 << 17)
-#define IE_CEB				(0x01 << 18)
-#define IE_CIE				(0x01 << 19)
-#define IE_DTO				(0x01 << 20)
-#define IE_DCRC				(0x01 << 21)
-#define IE_DEB				(0x01 << 22)
-#define IE_CERR				(0x01 << 28)
-#define IE_BADA				(0x01 << 29)
-
-#define VS30_3V0SUP			(1 << 25)
-#define VS18_1V8SUP			(1 << 26)
-
-/* Driver definitions */
-#define MMCSD_SECTOR_SIZE		512
-#define MMC_CARD			0
-#define SD_CARD				1
-#define BYTE_MODE			0
-#define SECTOR_MODE			1
-#define CLK_INITSEQ			0
-#define CLK_400KHZ			1
-#define CLK_MISC			2
-
-#define RSP_TYPE_NONE	(RSP_TYPE_NORSP   | CCCE_NOCHECK | CICE_NOCHECK)
-#define MMC_CMD0	(INDEX(0)  | RSP_TYPE_NONE | DP_NO_DATA | DDIR_WRITE)
-
-/* Clock Configurations and Macros */
-#define MMC_CLOCK_REFERENCE	96 /* MHz */
-
-#define mmc_reg_out(addr, mask, val)\
-	writel((readl(addr) & (~(mask))) | ((val) & (mask)), (addr))
-
-int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max);
-
 #endif /* MMC_HOST_DEF_H */
diff --git a/arch/arm/include/asm/omap_mmc.h b/arch/arm/include/asm/omap_mmc.h
new file mode 100644
index 0000000..83726ee
--- /dev/null
+++ b/arch/arm/include/asm/omap_mmc.h
@@ -0,0 +1,167 @@
+/*
+ * (C) Copyright 2008
+ * Texas Instruments, <www.ti.com>
+ * Syed Mohammed Khasim <khasim@ti.com>
+ *
+ * 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's version 2 of
+ * the License.
+ *
+ * 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,
+ * MA 02111-1307 USA
+ */
+
+#ifndef OMAP_MMC_H_
+#define OMAP_MMC_H_
+
+struct hsmmc {
+	unsigned char res1[0x10];
+	unsigned int sysconfig;		/* 0x10 */
+	unsigned int sysstatus;		/* 0x14 */
+	unsigned char res2[0x14];
+	unsigned int con;		/* 0x2C */
+	unsigned char res3[0xD4];
+	unsigned int blk;		/* 0x104 */
+	unsigned int arg;		/* 0x108 */
+	unsigned int cmd;		/* 0x10C */
+	unsigned int rsp10;		/* 0x110 */
+	unsigned int rsp32;		/* 0x114 */
+	unsigned int rsp54;		/* 0x118 */
+	unsigned int rsp76;		/* 0x11C */
+	unsigned int data;		/* 0x120 */
+	unsigned int pstate;		/* 0x124 */
+	unsigned int hctl;		/* 0x128 */
+	unsigned int sysctl;		/* 0x12C */
+	unsigned int stat;		/* 0x130 */
+	unsigned int ie;		/* 0x134 */
+	unsigned char res4[0x8];
+	unsigned int capa;		/* 0x140 */
+};
+
+/*
+ * OMAP HS MMC Bit definitions
+ */
+#define MMC_SOFTRESET			(0x1 << 1)
+#define RESETDONE			(0x1 << 0)
+#define NOOPENDRAIN			(0x0 << 0)
+#define OPENDRAIN			(0x1 << 0)
+#define OD				(0x1 << 0)
+#define INIT_NOINIT			(0x0 << 1)
+#define INIT_INITSTREAM			(0x1 << 1)
+#define HR_NOHOSTRESP			(0x0 << 2)
+#define STR_BLOCK			(0x0 << 3)
+#define MODE_FUNC			(0x0 << 4)
+#define DW8_1_4BITMODE			(0x0 << 5)
+#define MIT_CTO				(0x0 << 6)
+#define CDP_ACTIVEHIGH			(0x0 << 7)
+#define WPP_ACTIVEHIGH			(0x0 << 8)
+#define RESERVED_MASK			(0x3 << 9)
+#define CTPL_MMC_SD			(0x0 << 11)
+#define BLEN_512BYTESLEN		(0x200 << 0)
+#define NBLK_STPCNT			(0x0 << 16)
+#define DE_DISABLE			(0x0 << 0)
+#define BCE_DISABLE			(0x0 << 1)
+#define BCE_ENABLE			(0x1 << 1)
+#define ACEN_DISABLE			(0x0 << 2)
+#define DDIR_OFFSET			(4)
+#define DDIR_MASK			(0x1 << 4)
+#define DDIR_WRITE			(0x0 << 4)
+#define DDIR_READ			(0x1 << 4)
+#define MSBS_SGLEBLK			(0x0 << 5)
+#define MSBS_MULTIBLK			(0x1 << 5)
+#define RSP_TYPE_OFFSET			(16)
+#define RSP_TYPE_MASK			(0x3 << 16)
+#define RSP_TYPE_NORSP			(0x0 << 16)
+#define RSP_TYPE_LGHT136		(0x1 << 16)
+#define RSP_TYPE_LGHT48			(0x2 << 16)
+#define RSP_TYPE_LGHT48B		(0x3 << 16)
+#define CCCE_NOCHECK			(0x0 << 19)
+#define CCCE_CHECK			(0x1 << 19)
+#define CICE_NOCHECK			(0x0 << 20)
+#define CICE_CHECK			(0x1 << 20)
+#define DP_OFFSET			(21)
+#define DP_MASK				(0x1 << 21)
+#define DP_NO_DATA			(0x0 << 21)
+#define DP_DATA				(0x1 << 21)
+#define CMD_TYPE_NORMAL			(0x0 << 22)
+#define INDEX_OFFSET			(24)
+#define INDEX_MASK			(0x3f << 24)
+#define INDEX(i)			(i << 24)
+#define DATI_MASK			(0x1 << 1)
+#define CMDI_MASK			(0x1 << 0)
+#define DTW_1_BITMODE			(0x0 << 1)
+#define DTW_4_BITMODE			(0x1 << 1)
+#define DTW_8_BITMODE                   (0x1 << 5) /* CON[DW8]*/
+#define SDBP_PWROFF			(0x0 << 8)
+#define SDBP_PWRON			(0x1 << 8)
+#define SDVS_1V8			(0x5 << 9)
+#define SDVS_3V0			(0x6 << 9)
+#define ICE_MASK			(0x1 << 0)
+#define ICE_STOP			(0x0 << 0)
+#define ICS_MASK			(0x1 << 1)
+#define ICS_NOTREADY			(0x0 << 1)
+#define ICE_OSCILLATE			(0x1 << 0)
+#define CEN_MASK			(0x1 << 2)
+#define CEN_DISABLE			(0x0 << 2)
+#define CEN_ENABLE			(0x1 << 2)
+#define CLKD_OFFSET			(6)
+#define CLKD_MASK			(0x3FF << 6)
+#define DTO_MASK			(0xF << 16)
+#define DTO_15THDTO			(0xE << 16)
+#define SOFTRESETALL			(0x1 << 24)
+#define CC_MASK				(0x1 << 0)
+#define TC_MASK				(0x1 << 1)
+#define BWR_MASK			(0x1 << 4)
+#define BRR_MASK			(0x1 << 5)
+#define ERRI_MASK			(0x1 << 15)
+#define IE_CC				(0x01 << 0)
+#define IE_TC				(0x01 << 1)
+#define IE_BWR				(0x01 << 4)
+#define IE_BRR				(0x01 << 5)
+#define IE_CTO				(0x01 << 16)
+#define IE_CCRC				(0x01 << 17)
+#define IE_CEB				(0x01 << 18)
+#define IE_CIE				(0x01 << 19)
+#define IE_DTO				(0x01 << 20)
+#define IE_DCRC				(0x01 << 21)
+#define IE_DEB				(0x01 << 22)
+#define IE_CERR				(0x01 << 28)
+#define IE_BADA				(0x01 << 29)
+
+#define VS30_3V0SUP			(1 << 25)
+#define VS18_1V8SUP			(1 << 26)
+
+/* Driver definitions */
+#define MMCSD_SECTOR_SIZE		512
+#define MMC_CARD			0
+#define SD_CARD				1
+#define BYTE_MODE			0
+#define SECTOR_MODE			1
+#define CLK_INITSEQ			0
+#define CLK_400KHZ			1
+#define CLK_MISC			2
+
+#define RSP_TYPE_NONE	(RSP_TYPE_NORSP   | CCCE_NOCHECK | CICE_NOCHECK)
+#define MMC_CMD0	(INDEX(0)  | RSP_TYPE_NONE | DP_NO_DATA | DDIR_WRITE)
+
+/* Clock Configurations and Macros */
+#define MMC_CLOCK_REFERENCE	96 /* MHz */
+
+#define mmc_reg_out(addr, mask, val)\
+	writel((readl(addr) & (~(mask))) | ((val) & (mask)), (addr))
+
+int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max);
+
+
+#endif /* OMAP_MMC_H_ */
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 2/7] omap_hsmmc: fix out of bounds array access
  2012-12-03 12:19 [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection Nikita Kiryanov
  2012-12-03 12:19 ` [U-Boot] [PATCH 1/7] omap: consolidate common mmc definitions Nikita Kiryanov
@ 2012-12-03 12:19 ` Nikita Kiryanov
  2012-12-03 12:19 ` [U-Boot] [PATCH 3/7] omap_hsmmc: introduce omap_hsmmc_data struct Nikita Kiryanov
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Nikita Kiryanov @ 2012-12-03 12:19 UTC (permalink / raw)
  To: u-boot

There are 3 MMC/SD/SDIO controllers in OMAP SoCs, but only 2 structs
are defined for devices. This leads to data being written outside of
array bounds on systems that use all 3 controllers.

Update hsmmc_dev array to the correct size.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
---
 drivers/mmc/omap_hsmmc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index afd9b30..23dcebd 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -44,7 +44,7 @@
 static int mmc_read_data(struct hsmmc *mmc_base, char *buf, unsigned int size);
 static int mmc_write_data(struct hsmmc *mmc_base, const char *buf,
 			unsigned int siz);
-static struct mmc hsmmc_dev[2];
+static struct mmc hsmmc_dev[3];
 
 #if defined(CONFIG_OMAP44XX) && defined(CONFIG_TWL6030_POWER)
 static void omap4_vmmc_pbias_config(struct mmc *mmc)
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 3/7] omap_hsmmc: introduce omap_hsmmc_data struct
  2012-12-03 12:19 [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection Nikita Kiryanov
  2012-12-03 12:19 ` [U-Boot] [PATCH 1/7] omap: consolidate common mmc definitions Nikita Kiryanov
  2012-12-03 12:19 ` [U-Boot] [PATCH 2/7] omap_hsmmc: fix out of bounds array access Nikita Kiryanov
@ 2012-12-03 12:19 ` Nikita Kiryanov
  2012-12-03 12:19 ` [U-Boot] [PATCH 4/7] omap_hsmmc: implement driver check for card detection Nikita Kiryanov
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Nikita Kiryanov @ 2012-12-03 12:19 UTC (permalink / raw)
  To: u-boot

Currently there's no appropriate place to store driver specific data
because the pointer that is meant for that (priv) is being used to
store the base address of mmc registers.

Introduce a new struct for storing driver specific data.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
---
 drivers/mmc/omap_hsmmc.c |   28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index 23dcebd..0fdbac3 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -38,6 +38,10 @@
 #define SYSCTL_SRC	(1 << 25)
 #define SYSCTL_SRD	(1 << 26)
 
+struct omap_hsmmc_data {
+	struct hsmmc *base_addr;
+};
+
 /* If we fail after 1 second wait, something is really bad */
 #define MAX_RETRY_MS	1000
 
@@ -45,6 +49,7 @@ static int mmc_read_data(struct hsmmc *mmc_base, char *buf, unsigned int size);
 static int mmc_write_data(struct hsmmc *mmc_base, const char *buf,
 			unsigned int siz);
 static struct mmc hsmmc_dev[3];
+static struct omap_hsmmc_data hsmmc_dev_data[3];
 
 #if defined(CONFIG_OMAP44XX) && defined(CONFIG_TWL6030_POWER)
 static void omap4_vmmc_pbias_config(struct mmc *mmc)
@@ -177,11 +182,12 @@ void mmc_init_stream(struct hsmmc *mmc_base)
 
 static int mmc_init_setup(struct mmc *mmc)
 {
-	struct hsmmc *mmc_base = (struct hsmmc *)mmc->priv;
+	struct hsmmc *mmc_base;
 	unsigned int reg_val;
 	unsigned int dsor;
 	ulong start;
 
+	mmc_base = ((struct omap_hsmmc_data *)mmc->priv)->base_addr;
 	mmc_board_init(mmc);
 
 	writel(readl(&mmc_base->sysconfig) | MMC_SOFTRESET,
@@ -262,10 +268,11 @@ static void mmc_reset_controller_fsm(struct hsmmc *mmc_base, u32 bit)
 static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
 			struct mmc_data *data)
 {
-	struct hsmmc *mmc_base = (struct hsmmc *)mmc->priv;
+	struct hsmmc *mmc_base;
 	unsigned int flags, mmc_stat;
 	ulong start;
 
+	mmc_base = ((struct omap_hsmmc_data *)mmc->priv)->base_addr;
 	start = get_timer(0);
 	while ((readl(&mmc_base->pstate) & (DATI_MASK | CMDI_MASK)) != 0) {
 		if (get_timer(0) - start > MAX_RETRY_MS) {
@@ -489,10 +496,11 @@ static int mmc_write_data(struct hsmmc *mmc_base, const char *buf,
 
 static void mmc_set_ios(struct mmc *mmc)
 {
-	struct hsmmc *mmc_base = (struct hsmmc *)mmc->priv;
+	struct hsmmc *mmc_base;
 	unsigned int dsor = 0;
 	ulong start;
 
+	mmc_base = ((struct omap_hsmmc_data *)mmc->priv)->base_addr;
 	/* configue bus width */
 	switch (mmc->bus_width) {
 	case 8:
@@ -542,32 +550,32 @@ static void mmc_set_ios(struct mmc *mmc)
 
 int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max)
 {
-	struct mmc *mmc;
-
-	mmc = &hsmmc_dev[dev_index];
+	struct mmc *mmc = &hsmmc_dev[dev_index];
+	struct omap_hsmmc_data *priv_data = &hsmmc_dev_data[dev_index];
 
 	sprintf(mmc->name, "OMAP SD/MMC");
 	mmc->send_cmd = mmc_send_cmd;
 	mmc->set_ios = mmc_set_ios;
 	mmc->init = mmc_init_setup;
 	mmc->getcd = NULL;
+	mmc->priv = priv_data;
 
 	switch (dev_index) {
 	case 0:
-		mmc->priv = (struct hsmmc *)OMAP_HSMMC1_BASE;
+		priv_data->base_addr = (struct hsmmc *)OMAP_HSMMC1_BASE;
 		break;
 #ifdef OMAP_HSMMC2_BASE
 	case 1:
-		mmc->priv = (struct hsmmc *)OMAP_HSMMC2_BASE;
+		priv_data->base_addr = (struct hsmmc *)OMAP_HSMMC2_BASE;
 		break;
 #endif
 #ifdef OMAP_HSMMC3_BASE
 	case 2:
-		mmc->priv = (struct hsmmc *)OMAP_HSMMC3_BASE;
+		priv_data->base_addr = (struct hsmmc *)OMAP_HSMMC3_BASE;
 		break;
 #endif
 	default:
-		mmc->priv = (struct hsmmc *)OMAP_HSMMC1_BASE;
+		priv_data->base_addr = (struct hsmmc *)OMAP_HSMMC1_BASE;
 		return 1;
 	}
 	mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 4/7] omap_hsmmc: implement driver check for card detection
  2012-12-03 12:19 [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection Nikita Kiryanov
                   ` (2 preceding siblings ...)
  2012-12-03 12:19 ` [U-Boot] [PATCH 3/7] omap_hsmmc: introduce omap_hsmmc_data struct Nikita Kiryanov
@ 2012-12-03 12:19 ` Nikita Kiryanov
  2012-12-18 23:52   ` Tom Rini
  2012-12-03 12:19 ` [U-Boot] [PATCH 5/7] cm-t35: implement board specific card detect check Nikita Kiryanov
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 20+ messages in thread
From: Nikita Kiryanov @ 2012-12-03 12:19 UTC (permalink / raw)
  To: u-boot

Implement driver check for card detection.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
 arch/arm/cpu/armv7/am33xx/board.c            |    4 +--
 arch/arm/cpu/armv7/omap-common/boot-common.c |    4 +--
 arch/arm/cpu/armv7/omap3/board.c             |    4 +--
 arch/arm/include/asm/omap_mmc.h              |    2 +-
 board/cm_t35/cm_t35.c                        |    2 +-
 board/comelit/dig297/dig297.c                |    3 +--
 board/corscience/tricorder/tricorder.c       |    2 +-
 board/htkw/mcx/mcx.c                         |    2 +-
 board/isee/igep0020/igep0020.c               |    3 +--
 board/isee/igep0030/igep0030.c               |    3 +--
 board/logicpd/am3517evm/am3517evm.c          |    3 +--
 board/logicpd/omap3som/omap3logic.c          |    2 +-
 board/logicpd/zoom1/zoom1.c                  |    3 +--
 board/logicpd/zoom2/zoom2.c                  |    3 +--
 board/matrix_vision/mvblx/mvblx.c            |    4 +--
 board/nokia/rx51/rx51.c                      |    4 +--
 board/overo/overo.c                          |    3 +--
 board/pandora/pandora.c                      |    3 +--
 board/technexion/twister/twister.c           |    2 +-
 board/teejet/mt_ventoux/mt_ventoux.c         |    2 +-
 board/ti/am3517crane/am3517crane.c           |    3 +--
 board/ti/beagle/beagle.c                     |    3 +--
 board/ti/evm/evm.c                           |    3 +--
 board/ti/omap5_evm/evm.c                     |    4 +--
 board/ti/panda/panda.c                       |    3 +--
 board/ti/sdp3430/sdp.c                       |    3 +--
 board/ti/sdp4430/sdp.c                       |    4 +--
 board/timll/devkit8000/devkit8000.c          |    3 +--
 drivers/mmc/omap_hsmmc.c                     |   37 ++++++++++++++++++++++++--
 29 files changed, 70 insertions(+), 51 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c
index e4c123c..928ff9f 100644
--- a/arch/arm/cpu/armv7/am33xx/board.c
+++ b/arch/arm/cpu/armv7/am33xx/board.c
@@ -50,11 +50,11 @@ int cpu_mmc_init(bd_t *bis)
 {
 	int ret;
 
-	ret = omap_mmc_init(0, 0, 0);
+	ret = omap_mmc_init(0, 0, 0, -1);
 	if (ret)
 		return ret;
 
-	return omap_mmc_init(1, 0, 0);
+	return omap_mmc_init(1, 0, 0, -1);
 }
 #endif
 
diff --git a/arch/arm/cpu/armv7/omap-common/boot-common.c b/arch/arm/cpu/armv7/omap-common/boot-common.c
index 0f19141..dc2ee0d 100644
--- a/arch/arm/cpu/armv7/omap-common/boot-common.c
+++ b/arch/arm/cpu/armv7/omap-common/boot-common.c
@@ -60,11 +60,11 @@ int board_mmc_init(bd_t *bis)
 {
 	switch (spl_boot_device()) {
 	case BOOT_DEVICE_MMC1:
-		omap_mmc_init(0, 0, 0);
+		omap_mmc_init(0, 0, 0, -1);
 		break;
 	case BOOT_DEVICE_MMC2:
 	case BOOT_DEVICE_MMC2_2:
-		omap_mmc_init(1, 0, 0);
+		omap_mmc_init(1, 0, 0, -1);
 		break;
 	}
 	return 0;
diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index f3cd81a..e95cc50 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -98,11 +98,11 @@ int board_mmc_init(bd_t *bis)
 {
 	switch (spl_boot_device()) {
 	case BOOT_DEVICE_MMC1:
-		omap_mmc_init(0, 0, 0);
+		omap_mmc_init(0, 0, 0, -1);
 		break;
 	case BOOT_DEVICE_MMC2:
 	case BOOT_DEVICE_MMC2_2:
-		omap_mmc_init(1, 0, 0);
+		omap_mmc_init(1, 0, 0, -1);
 		break;
 	}
 	return 0;
diff --git a/arch/arm/include/asm/omap_mmc.h b/arch/arm/include/asm/omap_mmc.h
index 83726ee..8d86de1 100644
--- a/arch/arm/include/asm/omap_mmc.h
+++ b/arch/arm/include/asm/omap_mmc.h
@@ -161,7 +161,7 @@ struct hsmmc {
 #define mmc_reg_out(addr, mask, val)\
 	writel((readl(addr) & (~(mask))) | ((val) & (mask)), (addr))
 
-int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max);
+int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio);
 
 
 #endif /* OMAP_MMC_H_ */
diff --git a/board/cm_t35/cm_t35.c b/board/cm_t35/cm_t35.c
index 6c2e95b..87a18c0 100644
--- a/board/cm_t35/cm_t35.c
+++ b/board/cm_t35/cm_t35.c
@@ -346,7 +346,7 @@ void set_muxconf_regs(void)
 #ifdef CONFIG_GENERIC_MMC
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0);
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
 
diff --git a/board/comelit/dig297/dig297.c b/board/comelit/dig297/dig297.c
index c6c1071..2a55cb8 100644
--- a/board/comelit/dig297/dig297.c
+++ b/board/comelit/dig297/dig297.c
@@ -147,8 +147,7 @@ void set_muxconf_regs(void)
 #ifdef CONFIG_GENERIC_MMC
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	return 0;
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
 
diff --git a/board/corscience/tricorder/tricorder.c b/board/corscience/tricorder/tricorder.c
index aaff2e8..7a79139 100644
--- a/board/corscience/tricorder/tricorder.c
+++ b/board/corscience/tricorder/tricorder.c
@@ -80,7 +80,7 @@ void set_muxconf_regs(void)
 #if defined(CONFIG_GENERIC_MMC) && !(defined(CONFIG_SPL_BUILD))
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0);
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
 
diff --git a/board/htkw/mcx/mcx.c b/board/htkw/mcx/mcx.c
index 9fe6408..5cf5bb6 100644
--- a/board/htkw/mcx/mcx.c
+++ b/board/htkw/mcx/mcx.c
@@ -114,7 +114,7 @@ void set_muxconf_regs(void)
 #if defined(CONFIG_OMAP_HSMMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0);
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
 
diff --git a/board/isee/igep0020/igep0020.c b/board/isee/igep0020/igep0020.c
index a8257a3..54e2daf 100644
--- a/board/isee/igep0020/igep0020.c
+++ b/board/isee/igep0020/igep0020.c
@@ -134,8 +134,7 @@ static void setup_net_chip(void)
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	return 0;
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
 
diff --git a/board/isee/igep0030/igep0030.c b/board/isee/igep0030/igep0030.c
index 107cb7f..670e0dd 100644
--- a/board/isee/igep0030/igep0030.c
+++ b/board/isee/igep0030/igep0030.c
@@ -88,8 +88,7 @@ void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	return 0;
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
 
diff --git a/board/logicpd/am3517evm/am3517evm.c b/board/logicpd/am3517evm/am3517evm.c
index d316f33..837fe21 100644
--- a/board/logicpd/am3517evm/am3517evm.c
+++ b/board/logicpd/am3517evm/am3517evm.c
@@ -79,7 +79,6 @@ void set_muxconf_regs(void)
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-       omap_mmc_init(0, 0, 0);
-       return 0;
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c
index 12bcfcb..fc11812 100644
--- a/board/logicpd/omap3som/omap3logic.c
+++ b/board/logicpd/omap3som/omap3logic.c
@@ -140,7 +140,7 @@ int board_init(void)
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0);
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
 
diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c
index 90b6b0f..e02dc34 100644
--- a/board/logicpd/zoom1/zoom1.c
+++ b/board/logicpd/zoom1/zoom1.c
@@ -92,8 +92,7 @@ void set_muxconf_regs(void)
 #ifdef CONFIG_GENERIC_MMC
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	return 0;
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
 
diff --git a/board/logicpd/zoom2/zoom2.c b/board/logicpd/zoom2/zoom2.c
index 8e18019..a622b9a 100644
--- a/board/logicpd/zoom2/zoom2.c
+++ b/board/logicpd/zoom2/zoom2.c
@@ -183,8 +183,7 @@ void set_muxconf_regs (void)
 #ifdef CONFIG_GENERIC_MMC
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	return 0;
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
 
diff --git a/board/matrix_vision/mvblx/mvblx.c b/board/matrix_vision/mvblx/mvblx.c
index f68f312..cb1e0c8 100644
--- a/board/matrix_vision/mvblx/mvblx.c
+++ b/board/matrix_vision/mvblx/mvblx.c
@@ -106,8 +106,8 @@ void set_muxconf_regs(void)
 #ifdef CONFIG_GENERIC_MMC
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	omap_mmc_init(1, 0, 0);
+	omap_mmc_init(0, 0, 0, -1);
+	omap_mmc_init(1, 0, 0, -1);
 	return 0;
 }
 #endif
diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
index b2fe1c5..f303e1e 100644
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
@@ -671,7 +671,7 @@ int rx51_kp_getc(void)
  */
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	omap_mmc_init(1, 0, 0);
+	omap_mmc_init(0, 0, 0, -1);
+	omap_mmc_init(1, 0, 0, -1);
 	return 0;
 }
diff --git a/board/overo/overo.c b/board/overo/overo.c
index c6d50a0..ef6f77c 100644
--- a/board/overo/overo.c
+++ b/board/overo/overo.c
@@ -393,7 +393,6 @@ int board_eth_init(bd_t *bis)
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	return 0;
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
diff --git a/board/pandora/pandora.c b/board/pandora/pandora.c
index 3a62e9d..e2feff8 100644
--- a/board/pandora/pandora.c
+++ b/board/pandora/pandora.c
@@ -139,7 +139,6 @@ void set_muxconf_regs(void)
 #ifdef CONFIG_GENERIC_MMC
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	return 0;
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
diff --git a/board/technexion/twister/twister.c b/board/technexion/twister/twister.c
index 1471559..b9c543d 100644
--- a/board/technexion/twister/twister.c
+++ b/board/technexion/twister/twister.c
@@ -143,7 +143,7 @@ int board_eth_init(bd_t *bis)
 	!defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0);
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
 
diff --git a/board/teejet/mt_ventoux/mt_ventoux.c b/board/teejet/mt_ventoux/mt_ventoux.c
index 9622a81..0a03c89 100644
--- a/board/teejet/mt_ventoux/mt_ventoux.c
+++ b/board/teejet/mt_ventoux/mt_ventoux.c
@@ -299,7 +299,7 @@ int board_eth_init(bd_t *bis)
 	!defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0);
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
 
diff --git a/board/ti/am3517crane/am3517crane.c b/board/ti/am3517crane/am3517crane.c
index 888398d..91b6822 100644
--- a/board/ti/am3517crane/am3517crane.c
+++ b/board/ti/am3517crane/am3517crane.c
@@ -78,7 +78,6 @@ void set_muxconf_regs(void)
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	return 0;
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
index 6175e1d..639c127 100644
--- a/board/ti/beagle/beagle.c
+++ b/board/ti/beagle/beagle.c
@@ -483,8 +483,7 @@ void set_muxconf_regs(void)
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	return 0;
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
 
diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
index 61fc7b5..12a433f 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -278,7 +278,6 @@ int board_eth_init(bd_t *bis)
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	return 0;
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
diff --git a/board/ti/omap5_evm/evm.c b/board/ti/omap5_evm/evm.c
index c8dfdf8..45d4704 100644
--- a/board/ti/omap5_evm/evm.c
+++ b/board/ti/omap5_evm/evm.c
@@ -94,8 +94,8 @@ void set_muxconf_regs_non_essential(void)
 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC)
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	omap_mmc_init(1, 0, 0);
+	omap_mmc_init(0, 0, 0, -1);
+	omap_mmc_init(1, 0, 0, -1);
 	return 0;
 }
 #endif
diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
index 4feef78..ebbb8b1 100644
--- a/board/ti/panda/panda.c
+++ b/board/ti/panda/panda.c
@@ -179,8 +179,7 @@ void set_muxconf_regs_non_essential(void)
 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC)
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	return 0;
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
 
diff --git a/board/ti/sdp3430/sdp.c b/board/ti/sdp3430/sdp.c
index 9a1c012..e256815 100644
--- a/board/ti/sdp3430/sdp.c
+++ b/board/ti/sdp3430/sdp.c
@@ -209,7 +209,6 @@ void set_muxconf_regs(void)
 #ifdef CONFIG_GENERIC_MMC
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	return 0;
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
diff --git a/board/ti/sdp4430/sdp.c b/board/ti/sdp4430/sdp.c
index 982c771..167f3cb 100644
--- a/board/ti/sdp4430/sdp.c
+++ b/board/ti/sdp4430/sdp.c
@@ -108,8 +108,8 @@ void set_muxconf_regs_non_essential(void)
 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC)
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	omap_mmc_init(1, 0, 0);
+	omap_mmc_init(0, 0, 0, -1);
+	omap_mmc_init(1, 0, 0, -1);
 	return 0;
 }
 #endif
diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c
index 35f5e15..c6f7158 100644
--- a/board/timll/devkit8000/devkit8000.c
+++ b/board/timll/devkit8000/devkit8000.c
@@ -136,8 +136,7 @@ void set_muxconf_regs(void)
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0);
-	return 0;
+	return omap_mmc_init(0, 0, 0, -1);
 }
 #endif
 
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index 0fdbac3..cb1a7bd 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -30,6 +30,7 @@
 #include <twl4030.h>
 #include <twl6030.h>
 #include <twl6035.h>
+#include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/sys_proto.h>
@@ -40,6 +41,7 @@
 
 struct omap_hsmmc_data {
 	struct hsmmc *base_addr;
+	int cd_gpio;
 };
 
 /* If we fail after 1 second wait, something is really bad */
@@ -51,6 +53,36 @@ static int mmc_write_data(struct hsmmc *mmc_base, const char *buf,
 static struct mmc hsmmc_dev[3];
 static struct omap_hsmmc_data hsmmc_dev_data[3];
 
+#if (defined(CONFIG_OMAP_GPIO) && !defined(CONFIG_SPL_BUILD)) || \
+	(defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_GPIO_SUPPORT))
+static int omap_mmc_setup_gpio_in(int gpio, const char *label)
+{
+	if (!gpio_is_valid(gpio))
+		return -1;
+
+	if (gpio_request(gpio, label) < 0)
+		return -1;
+
+	if (gpio_direction_input(gpio) < 0)
+		return -1;
+
+	return gpio;
+}
+
+static int omap_mmc_getcd(struct mmc *mmc)
+{
+	int cd_gpio = ((struct omap_hsmmc_data *)mmc->priv)->cd_gpio;
+	return gpio_get_value(cd_gpio);
+}
+#else
+static inline int omap_mmc_setup_gpio_in(int gpio, const char *label)
+{
+	return -1;
+}
+
+#define omap_mmc_getcd NULL
+#endif
+
 #if defined(CONFIG_OMAP44XX) && defined(CONFIG_TWL6030_POWER)
 static void omap4_vmmc_pbias_config(struct mmc *mmc)
 {
@@ -548,7 +580,7 @@ static void mmc_set_ios(struct mmc *mmc)
 	writel(readl(&mmc_base->sysctl) | CEN_ENABLE, &mmc_base->sysctl);
 }
 
-int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max)
+int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio)
 {
 	struct mmc *mmc = &hsmmc_dev[dev_index];
 	struct omap_hsmmc_data *priv_data = &hsmmc_dev_data[dev_index];
@@ -557,7 +589,7 @@ int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max)
 	mmc->send_cmd = mmc_send_cmd;
 	mmc->set_ios = mmc_set_ios;
 	mmc->init = mmc_init_setup;
-	mmc->getcd = NULL;
+	mmc->getcd = omap_mmc_getcd;
 	mmc->priv = priv_data;
 
 	switch (dev_index) {
@@ -578,6 +610,7 @@ int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max)
 		priv_data->base_addr = (struct hsmmc *)OMAP_HSMMC1_BASE;
 		return 1;
 	}
+	priv_data->cd_gpio = omap_mmc_setup_gpio_in(cd_gpio, "mmc_cd");
 	mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
 	mmc->host_caps = (MMC_MODE_4BIT | MMC_MODE_HS_52MHz | MMC_MODE_HS |
 				MMC_MODE_HC) & ~host_caps_mask;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 5/7] cm-t35: implement board specific card detect check
  2012-12-03 12:19 [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection Nikita Kiryanov
                   ` (3 preceding siblings ...)
  2012-12-03 12:19 ` [U-Boot] [PATCH 4/7] omap_hsmmc: implement driver check for card detection Nikita Kiryanov
@ 2012-12-03 12:19 ` Nikita Kiryanov
  2012-12-03 12:19 ` [U-Boot] [PATCH 6/7] mmc: add support for write protection Nikita Kiryanov
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Nikita Kiryanov @ 2012-12-03 12:19 UTC (permalink / raw)
  To: u-boot

Implement a card detection check for cm-t35.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
 board/cm_t35/cm_t35.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/board/cm_t35/cm_t35.c b/board/cm_t35/cm_t35.c
index 87a18c0..50c0990 100644
--- a/board/cm_t35/cm_t35.c
+++ b/board/cm_t35/cm_t35.c
@@ -32,6 +32,7 @@
 #include <netdev.h>
 #include <net.h>
 #include <i2c.h>
+#include <mmc.h>
 #include <twl4030.h>
 #include <linux/compiler.h>
 
@@ -344,6 +345,16 @@ void set_muxconf_regs(void)
 }
 
 #ifdef CONFIG_GENERIC_MMC
+int board_mmc_getcd(struct mmc *mmc)
+{
+	u8 val;
+
+	if (twl4030_i2c_read_u8(TWL4030_CHIP_GPIO, &val, TWL4030_BASEADD_GPIO))
+		return -1;
+
+	return !(val & 1);
+}
+
 int board_mmc_init(bd_t *bis)
 {
 	return omap_mmc_init(0, 0, 0, -1);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 6/7] mmc: add support for write protection
  2012-12-03 12:19 [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection Nikita Kiryanov
                   ` (4 preceding siblings ...)
  2012-12-03 12:19 ` [U-Boot] [PATCH 5/7] cm-t35: implement board specific card detect check Nikita Kiryanov
@ 2012-12-03 12:19 ` Nikita Kiryanov
  2012-12-03 12:19 ` [U-Boot] [PATCH 7/7] omap_hsmmc: add driver check " Nikita Kiryanov
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Nikita Kiryanov @ 2012-12-03 12:19 UTC (permalink / raw)
  To: u-boot

Add generic mmc write protection functionality.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
 common/cmd_mmc.c             |    7 +++++++
 drivers/mmc/arm_pl180_mmci.c |    1 +
 drivers/mmc/bfin_sdh.c       |    1 +
 drivers/mmc/davinci_mmc.c    |    1 +
 drivers/mmc/fsl_esdhc.c      |    1 +
 drivers/mmc/ftsdc010_esdhc.c |    1 +
 drivers/mmc/gen_atmel_mci.c  |    1 +
 drivers/mmc/mmc.c            |   17 +++++++++++++++++
 drivers/mmc/mmc_spi.c        |    1 +
 drivers/mmc/mxcmmc.c         |    1 +
 drivers/mmc/mxsmmc.c         |    1 +
 drivers/mmc/omap_hsmmc.c     |    1 +
 drivers/mmc/sdhci.c          |    1 +
 drivers/mmc/sh_mmcif.c       |    1 +
 drivers/mmc/tegra_mmc.c      |    1 +
 include/mmc.h                |    2 ++
 16 files changed, 39 insertions(+)

diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index 4c19df7..337bf2b 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -283,6 +283,13 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 		mmc_init(mmc);
 
+		if ((state == MMC_WRITE || state == MMC_ERASE)) {
+			if (mmc_getwp(mmc) == 1) {
+				printf("Error: card is write protected!\n");
+				return 1;
+			}
+		}
+
 		switch (state) {
 		case MMC_READ:
 			n = mmc->block_dev.block_read(curr_device, blk,
diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
index af1380a..ab2e81e 100644
--- a/drivers/mmc/arm_pl180_mmci.c
+++ b/drivers/mmc/arm_pl180_mmci.c
@@ -377,6 +377,7 @@ int arm_pl180_mmci_init(struct pl180_mmc_host *host)
 	dev->set_ios = host_set_ios;
 	dev->init = mmc_host_reset;
 	dev->getcd = NULL;
+	dev->getwp = NULL;
 	dev->host_caps = host->caps;
 	dev->voltages = host->voltages;
 	dev->f_min = host->clock_min;
diff --git a/drivers/mmc/bfin_sdh.c b/drivers/mmc/bfin_sdh.c
index 8d59d46..81d8e54 100644
--- a/drivers/mmc/bfin_sdh.c
+++ b/drivers/mmc/bfin_sdh.c
@@ -251,6 +251,7 @@ int bfin_mmc_init(bd_t *bis)
 	mmc->set_ios = bfin_sdh_set_ios;
 	mmc->init = bfin_sdh_init;
 	mmc->getcd = NULL;
+	mmc->getwp = NULL;
 	mmc->host_caps = MMC_MODE_4BIT;
 
 	mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
diff --git a/drivers/mmc/davinci_mmc.c b/drivers/mmc/davinci_mmc.c
index ee8f261..e2379e3 100644
--- a/drivers/mmc/davinci_mmc.c
+++ b/drivers/mmc/davinci_mmc.c
@@ -388,6 +388,7 @@ int davinci_mmc_init(bd_t *bis, struct davinci_mmc *host)
 	mmc->set_ios = dmmc_set_ios;
 	mmc->init = dmmc_init;
 	mmc->getcd = NULL;
+	mmc->getwp = NULL;
 
 	mmc->f_min = 200000;
 	mmc->f_max = 25000000;
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index e93e38a..9aef2c7 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -552,6 +552,7 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg)
 	mmc->set_ios = esdhc_set_ios;
 	mmc->init = esdhc_init;
 	mmc->getcd = esdhc_getcd;
+	mmc->getwp = NULL;
 
 	voltage_caps = 0;
 	caps = regs->hostcapblt;
diff --git a/drivers/mmc/ftsdc010_esdhc.c b/drivers/mmc/ftsdc010_esdhc.c
index f1702fe..42f0e0c 100644
--- a/drivers/mmc/ftsdc010_esdhc.c
+++ b/drivers/mmc/ftsdc010_esdhc.c
@@ -666,6 +666,7 @@ int ftsdc010_mmc_init(int dev_index)
 	mmc->set_ios = ftsdc010_set_ios;
 	mmc->init = ftsdc010_core_init;
 	mmc->getcd = NULL;
+	mmc->getwp = NULL;
 
 	mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
 
diff --git a/drivers/mmc/gen_atmel_mci.c b/drivers/mmc/gen_atmel_mci.c
index 67b2dbe..70a9f91 100644
--- a/drivers/mmc/gen_atmel_mci.c
+++ b/drivers/mmc/gen_atmel_mci.c
@@ -349,6 +349,7 @@ int atmel_mci_init(void *regs)
 	mmc->set_ios = mci_set_ios;
 	mmc->init = mci_init;
 	mmc->getcd = NULL;
+	mmc->getwp = NULL;
 
 	/* need to be able to pass these in on a board by board basis */
 	mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 5ffd8c5..619200b 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -40,6 +40,23 @@
 static struct list_head mmc_devices;
 static int cur_dev_num = -1;
 
+int __weak board_mmc_getwp(struct mmc *mmc)
+{
+	return -1;
+}
+
+int mmc_getwp(struct mmc *mmc)
+{
+	int wp;
+
+	wp = board_mmc_getwp(mmc);
+
+	if ((wp < 0) && mmc->getwp)
+		wp = mmc->getwp(mmc);
+
+	return wp;
+}
+
 int __board_mmc_getcd(struct mmc *mmc) {
 	return -1;
 }
diff --git a/drivers/mmc/mmc_spi.c b/drivers/mmc/mmc_spi.c
index 11ba532..fe6a5a1 100644
--- a/drivers/mmc/mmc_spi.c
+++ b/drivers/mmc/mmc_spi.c
@@ -273,6 +273,7 @@ struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode)
 	mmc->set_ios = mmc_spi_set_ios;
 	mmc->init = mmc_spi_init_p;
 	mmc->getcd = NULL;
+	mmc->getwp = NULL;
 	mmc->host_caps = MMC_MODE_SPI;
 
 	mmc->voltages = MMC_SPI_VOLTAGE;
diff --git a/drivers/mmc/mxcmmc.c b/drivers/mmc/mxcmmc.c
index d58c18b..4f99617 100644
--- a/drivers/mmc/mxcmmc.c
+++ b/drivers/mmc/mxcmmc.c
@@ -499,6 +499,7 @@ static int mxcmci_initialize(bd_t *bis)
 	mmc->set_ios = mxcmci_set_ios;
 	mmc->init = mxcmci_init;
 	mmc->getcd = NULL;
+	mmc->getwp = NULL;
 	mmc->host_caps = MMC_MODE_4BIT;
 
 	host->base = (struct mxcmci_regs *)CONFIG_MXC_MCI_REGS_BASE;
diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c
index 109acbf..59d0fce 100644
--- a/drivers/mmc/mxsmmc.c
+++ b/drivers/mmc/mxsmmc.c
@@ -428,6 +428,7 @@ int mxsmmc_initialize(bd_t *bis, int id, int (*wp)(int))
 	mmc->set_ios = mxsmmc_set_ios;
 	mmc->init = mxsmmc_init;
 	mmc->getcd = NULL;
+	mmc->getwp = NULL;
 	mmc->priv = priv;
 
 	mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index cb1a7bd..fcbd133 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -590,6 +590,7 @@ int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio)
 	mmc->set_ios = mmc_set_ios;
 	mmc->init = mmc_init_setup;
 	mmc->getcd = omap_mmc_getcd;
+	mmc->getwp = NULL;
 	mmc->priv = priv_data;
 
 	switch (dev_index) {
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 7845f87..1c0be72 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -435,6 +435,7 @@ int add_sdhci(struct sdhci_host *host, u32 max_clk, u32 min_clk)
 	mmc->set_ios = sdhci_set_ios;
 	mmc->init = sdhci_init;
 	mmc->getcd = NULL;
+	mmc->getwp = NULL;
 
 	caps = sdhci_readl(host, SDHCI_CAPABILITIES);
 #ifdef CONFIG_MMC_SDMA
diff --git a/drivers/mmc/sh_mmcif.c b/drivers/mmc/sh_mmcif.c
index 4588568..011d4f3 100644
--- a/drivers/mmc/sh_mmcif.c
+++ b/drivers/mmc/sh_mmcif.c
@@ -599,6 +599,7 @@ int mmcif_mmc_init(void)
 	mmc->set_ios = sh_mmcif_set_ios;
 	mmc->init = sh_mmcif_init;
 	mmc->getcd = NULL;
+	mmc->getwp = NULL;
 	host->regs = (struct sh_mmcif_regs *)CONFIG_SH_MMCIF_ADDR;
 	host->clk = CONFIG_SH_MMCIF_CLK;
 	mmc->priv = host;
diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c
index 8fea6a6..633173f 100644
--- a/drivers/mmc/tegra_mmc.c
+++ b/drivers/mmc/tegra_mmc.c
@@ -545,6 +545,7 @@ int tegra_mmc_init(int dev_index, int bus_width, int pwr_gpio, int cd_gpio)
 	mmc->set_ios = mmc_set_ios;
 	mmc->init = mmc_core_init;
 	mmc->getcd = tegra_mmc_getcd;
+	mmc->getwp = NULL;
 
 	mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
 	if (bus_width == 8)
diff --git a/include/mmc.h b/include/mmc.h
index a13e2bd..de6d497 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -259,6 +259,7 @@ struct mmc {
 	void (*set_ios)(struct mmc *mmc);
 	int (*init)(struct mmc *mmc);
 	int (*getcd)(struct mmc *mmc);
+	int (*getwp)(struct mmc *mmc);
 	uint b_max;
 };
 
@@ -274,6 +275,7 @@ int get_mmc_num(void);
 int board_mmc_getcd(struct mmc *mmc);
 int mmc_switch_part(int dev_num, unsigned int part_num);
 int mmc_getcd(struct mmc *mmc);
+int mmc_getwp(struct mmc *mmc);
 void spl_mmc_load(void) __noreturn;
 
 #ifdef CONFIG_GENERIC_MMC
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 7/7] omap_hsmmc: add driver check for write protection
  2012-12-03 12:19 [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection Nikita Kiryanov
                   ` (5 preceding siblings ...)
  2012-12-03 12:19 ` [U-Boot] [PATCH 6/7] mmc: add support for write protection Nikita Kiryanov
@ 2012-12-03 12:19 ` Nikita Kiryanov
  2013-02-15 21:22   ` Tom Rini
  2012-12-18  7:58 ` [U-Boot] [PATCH 0/7] omap mmc: implement card detect and " Nikita Kiryanov
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 20+ messages in thread
From: Nikita Kiryanov @ 2012-12-03 12:19 UTC (permalink / raw)
  To: u-boot

Add check for write protection in omap mmc driver.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
---
 arch/arm/cpu/armv7/am33xx/board.c            |    4 ++--
 arch/arm/cpu/armv7/omap-common/boot-common.c |    4 ++--
 arch/arm/cpu/armv7/omap3/board.c             |    4 ++--
 arch/arm/include/asm/omap_mmc.h              |    3 ++-
 board/cm_t35/cm_t35.c                        |    2 +-
 board/comelit/dig297/dig297.c                |    2 +-
 board/corscience/tricorder/tricorder.c       |    2 +-
 board/htkw/mcx/mcx.c                         |    2 +-
 board/isee/igep0020/igep0020.c               |    2 +-
 board/isee/igep0030/igep0030.c               |    2 +-
 board/logicpd/am3517evm/am3517evm.c          |    2 +-
 board/logicpd/omap3som/omap3logic.c          |    2 +-
 board/logicpd/zoom1/zoom1.c                  |    2 +-
 board/logicpd/zoom2/zoom2.c                  |    2 +-
 board/matrix_vision/mvblx/mvblx.c            |    4 ++--
 board/nokia/rx51/rx51.c                      |    4 ++--
 board/overo/overo.c                          |    2 +-
 board/pandora/pandora.c                      |    2 +-
 board/technexion/twister/twister.c           |    2 +-
 board/teejet/mt_ventoux/mt_ventoux.c         |    2 +-
 board/ti/am3517crane/am3517crane.c           |    2 +-
 board/ti/beagle/beagle.c                     |    2 +-
 board/ti/evm/evm.c                           |    2 +-
 board/ti/omap5_evm/evm.c                     |    4 ++--
 board/ti/panda/panda.c                       |    2 +-
 board/ti/sdp3430/sdp.c                       |    2 +-
 board/ti/sdp4430/sdp.c                       |    4 ++--
 board/timll/devkit8000/devkit8000.c          |    2 +-
 drivers/mmc/omap_hsmmc.c                     |   14 ++++++++++++--
 29 files changed, 48 insertions(+), 37 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c
index 928ff9f..99325c4 100644
--- a/arch/arm/cpu/armv7/am33xx/board.c
+++ b/arch/arm/cpu/armv7/am33xx/board.c
@@ -50,11 +50,11 @@ int cpu_mmc_init(bd_t *bis)
 {
 	int ret;
 
-	ret = omap_mmc_init(0, 0, 0, -1);
+	ret = omap_mmc_init(0, 0, 0, -1, -1);
 	if (ret)
 		return ret;
 
-	return omap_mmc_init(1, 0, 0, -1);
+	return omap_mmc_init(1, 0, 0, -1, -1);
 }
 #endif
 
diff --git a/arch/arm/cpu/armv7/omap-common/boot-common.c b/arch/arm/cpu/armv7/omap-common/boot-common.c
index dc2ee0d..25253b6 100644
--- a/arch/arm/cpu/armv7/omap-common/boot-common.c
+++ b/arch/arm/cpu/armv7/omap-common/boot-common.c
@@ -60,11 +60,11 @@ int board_mmc_init(bd_t *bis)
 {
 	switch (spl_boot_device()) {
 	case BOOT_DEVICE_MMC1:
-		omap_mmc_init(0, 0, 0, -1);
+		omap_mmc_init(0, 0, 0, -1, -1);
 		break;
 	case BOOT_DEVICE_MMC2:
 	case BOOT_DEVICE_MMC2_2:
-		omap_mmc_init(1, 0, 0, -1);
+		omap_mmc_init(1, 0, 0, -1, -1);
 		break;
 	}
 	return 0;
diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index e95cc50..84e3bcb 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -98,11 +98,11 @@ int board_mmc_init(bd_t *bis)
 {
 	switch (spl_boot_device()) {
 	case BOOT_DEVICE_MMC1:
-		omap_mmc_init(0, 0, 0, -1);
+		omap_mmc_init(0, 0, 0, -1, -1);
 		break;
 	case BOOT_DEVICE_MMC2:
 	case BOOT_DEVICE_MMC2_2:
-		omap_mmc_init(1, 0, 0, -1);
+		omap_mmc_init(1, 0, 0, -1, -1);
 		break;
 	}
 	return 0;
diff --git a/arch/arm/include/asm/omap_mmc.h b/arch/arm/include/asm/omap_mmc.h
index 8d86de1..617e22f 100644
--- a/arch/arm/include/asm/omap_mmc.h
+++ b/arch/arm/include/asm/omap_mmc.h
@@ -161,7 +161,8 @@ struct hsmmc {
 #define mmc_reg_out(addr, mask, val)\
 	writel((readl(addr) & (~(mask))) | ((val) & (mask)), (addr))
 
-int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio);
+int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio,
+		int wp_gpio);
 
 
 #endif /* OMAP_MMC_H_ */
diff --git a/board/cm_t35/cm_t35.c b/board/cm_t35/cm_t35.c
index 50c0990..6b3617c 100644
--- a/board/cm_t35/cm_t35.c
+++ b/board/cm_t35/cm_t35.c
@@ -357,7 +357,7 @@ int board_mmc_getcd(struct mmc *mmc)
 
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, 59);
 }
 #endif
 
diff --git a/board/comelit/dig297/dig297.c b/board/comelit/dig297/dig297.c
index 2a55cb8..2dca275 100644
--- a/board/comelit/dig297/dig297.c
+++ b/board/comelit/dig297/dig297.c
@@ -147,7 +147,7 @@ void set_muxconf_regs(void)
 #ifdef CONFIG_GENERIC_MMC
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
 
diff --git a/board/corscience/tricorder/tricorder.c b/board/corscience/tricorder/tricorder.c
index 7a79139..092f82e 100644
--- a/board/corscience/tricorder/tricorder.c
+++ b/board/corscience/tricorder/tricorder.c
@@ -80,7 +80,7 @@ void set_muxconf_regs(void)
 #if defined(CONFIG_GENERIC_MMC) && !(defined(CONFIG_SPL_BUILD))
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
 
diff --git a/board/htkw/mcx/mcx.c b/board/htkw/mcx/mcx.c
index 5cf5bb6..46fa7e4 100644
--- a/board/htkw/mcx/mcx.c
+++ b/board/htkw/mcx/mcx.c
@@ -114,7 +114,7 @@ void set_muxconf_regs(void)
 #if defined(CONFIG_OMAP_HSMMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
 
diff --git a/board/isee/igep0020/igep0020.c b/board/isee/igep0020/igep0020.c
index 54e2daf..a025c24 100644
--- a/board/isee/igep0020/igep0020.c
+++ b/board/isee/igep0020/igep0020.c
@@ -134,7 +134,7 @@ static void setup_net_chip(void)
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
 
diff --git a/board/isee/igep0030/igep0030.c b/board/isee/igep0030/igep0030.c
index 670e0dd..87f6774 100644
--- a/board/isee/igep0030/igep0030.c
+++ b/board/isee/igep0030/igep0030.c
@@ -88,7 +88,7 @@ void get_board_mem_timings(u32 *mcfg, u32 *ctrla, u32 *ctrlb, u32 *rfr_ctrl,
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
 
diff --git a/board/logicpd/am3517evm/am3517evm.c b/board/logicpd/am3517evm/am3517evm.c
index 837fe21..c9858cc 100644
--- a/board/logicpd/am3517evm/am3517evm.c
+++ b/board/logicpd/am3517evm/am3517evm.c
@@ -79,6 +79,6 @@ void set_muxconf_regs(void)
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c
index fc11812..6e83aa2 100644
--- a/board/logicpd/omap3som/omap3logic.c
+++ b/board/logicpd/omap3som/omap3logic.c
@@ -140,7 +140,7 @@ int board_init(void)
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
 
diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c
index e02dc34..c79a261 100644
--- a/board/logicpd/zoom1/zoom1.c
+++ b/board/logicpd/zoom1/zoom1.c
@@ -92,7 +92,7 @@ void set_muxconf_regs(void)
 #ifdef CONFIG_GENERIC_MMC
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
 
diff --git a/board/logicpd/zoom2/zoom2.c b/board/logicpd/zoom2/zoom2.c
index a622b9a..ad6ae36 100644
--- a/board/logicpd/zoom2/zoom2.c
+++ b/board/logicpd/zoom2/zoom2.c
@@ -183,7 +183,7 @@ void set_muxconf_regs (void)
 #ifdef CONFIG_GENERIC_MMC
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
 
diff --git a/board/matrix_vision/mvblx/mvblx.c b/board/matrix_vision/mvblx/mvblx.c
index cb1e0c8..49af384 100644
--- a/board/matrix_vision/mvblx/mvblx.c
+++ b/board/matrix_vision/mvblx/mvblx.c
@@ -106,8 +106,8 @@ void set_muxconf_regs(void)
 #ifdef CONFIG_GENERIC_MMC
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0, -1);
-	omap_mmc_init(1, 0, 0, -1);
+	omap_mmc_init(0, 0, 0, -1, -1);
+	omap_mmc_init(1, 0, 0, -1, -1);
 	return 0;
 }
 #endif
diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
index f303e1e..48eb65f 100644
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
@@ -671,7 +671,7 @@ int rx51_kp_getc(void)
  */
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0, -1);
-	omap_mmc_init(1, 0, 0, -1);
+	omap_mmc_init(0, 0, 0, -1, -1);
+	omap_mmc_init(1, 0, 0, -1, -1);
 	return 0;
 }
diff --git a/board/overo/overo.c b/board/overo/overo.c
index ef6f77c..c6a4e3a 100644
--- a/board/overo/overo.c
+++ b/board/overo/overo.c
@@ -393,6 +393,6 @@ int board_eth_init(bd_t *bis)
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
diff --git a/board/pandora/pandora.c b/board/pandora/pandora.c
index e2feff8..9ff5dd7 100644
--- a/board/pandora/pandora.c
+++ b/board/pandora/pandora.c
@@ -139,6 +139,6 @@ void set_muxconf_regs(void)
 #ifdef CONFIG_GENERIC_MMC
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
diff --git a/board/technexion/twister/twister.c b/board/technexion/twister/twister.c
index b9c543d..242c04e 100644
--- a/board/technexion/twister/twister.c
+++ b/board/technexion/twister/twister.c
@@ -143,7 +143,7 @@ int board_eth_init(bd_t *bis)
 	!defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
 
diff --git a/board/teejet/mt_ventoux/mt_ventoux.c b/board/teejet/mt_ventoux/mt_ventoux.c
index 0a03c89..5c5383a 100644
--- a/board/teejet/mt_ventoux/mt_ventoux.c
+++ b/board/teejet/mt_ventoux/mt_ventoux.c
@@ -299,7 +299,7 @@ int board_eth_init(bd_t *bis)
 	!defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
 
diff --git a/board/ti/am3517crane/am3517crane.c b/board/ti/am3517crane/am3517crane.c
index 91b6822..0b94245 100644
--- a/board/ti/am3517crane/am3517crane.c
+++ b/board/ti/am3517crane/am3517crane.c
@@ -78,6 +78,6 @@ void set_muxconf_regs(void)
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
index 639c127..7829261 100644
--- a/board/ti/beagle/beagle.c
+++ b/board/ti/beagle/beagle.c
@@ -483,7 +483,7 @@ void set_muxconf_regs(void)
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
 
diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
index 12a433f..d2959ba 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -278,6 +278,6 @@ int board_eth_init(bd_t *bis)
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
diff --git a/board/ti/omap5_evm/evm.c b/board/ti/omap5_evm/evm.c
index 45d4704..55337c0 100644
--- a/board/ti/omap5_evm/evm.c
+++ b/board/ti/omap5_evm/evm.c
@@ -94,8 +94,8 @@ void set_muxconf_regs_non_essential(void)
 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC)
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0, -1);
-	omap_mmc_init(1, 0, 0, -1);
+	omap_mmc_init(0, 0, 0, -1, -1);
+	omap_mmc_init(1, 0, 0, -1, -1);
 	return 0;
 }
 #endif
diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
index ebbb8b1..cab0598 100644
--- a/board/ti/panda/panda.c
+++ b/board/ti/panda/panda.c
@@ -179,7 +179,7 @@ void set_muxconf_regs_non_essential(void)
 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
 
diff --git a/board/ti/sdp3430/sdp.c b/board/ti/sdp3430/sdp.c
index e256815..052efc5 100644
--- a/board/ti/sdp3430/sdp.c
+++ b/board/ti/sdp3430/sdp.c
@@ -209,6 +209,6 @@ void set_muxconf_regs(void)
 #ifdef CONFIG_GENERIC_MMC
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
diff --git a/board/ti/sdp4430/sdp.c b/board/ti/sdp4430/sdp.c
index 167f3cb..4c1a4f7 100644
--- a/board/ti/sdp4430/sdp.c
+++ b/board/ti/sdp4430/sdp.c
@@ -108,8 +108,8 @@ void set_muxconf_regs_non_essential(void)
 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC)
 int board_mmc_init(bd_t *bis)
 {
-	omap_mmc_init(0, 0, 0, -1);
-	omap_mmc_init(1, 0, 0, -1);
+	omap_mmc_init(0, 0, 0, -1, -1);
+	omap_mmc_init(1, 0, 0, -1, -1);
 	return 0;
 }
 #endif
diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c
index c6f7158..0b81e56 100644
--- a/board/timll/devkit8000/devkit8000.c
+++ b/board/timll/devkit8000/devkit8000.c
@@ -136,7 +136,7 @@ void set_muxconf_regs(void)
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
-	return omap_mmc_init(0, 0, 0, -1);
+	return omap_mmc_init(0, 0, 0, -1, -1);
 }
 #endif
 
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index fcbd133..d0b2820 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -42,6 +42,7 @@
 struct omap_hsmmc_data {
 	struct hsmmc *base_addr;
 	int cd_gpio;
+	int wp_gpio;
 };
 
 /* If we fail after 1 second wait, something is really bad */
@@ -74,6 +75,12 @@ static int omap_mmc_getcd(struct mmc *mmc)
 	int cd_gpio = ((struct omap_hsmmc_data *)mmc->priv)->cd_gpio;
 	return gpio_get_value(cd_gpio);
 }
+
+static int omap_mmc_getwp(struct mmc *mmc)
+{
+	int wp_gpio = ((struct omap_hsmmc_data *)mmc->priv)->wp_gpio;
+	return gpio_get_value(wp_gpio);
+}
 #else
 static inline int omap_mmc_setup_gpio_in(int gpio, const char *label)
 {
@@ -81,6 +88,7 @@ static inline int omap_mmc_setup_gpio_in(int gpio, const char *label)
 }
 
 #define omap_mmc_getcd NULL
+#define omap_mmc_getwp NULL
 #endif
 
 #if defined(CONFIG_OMAP44XX) && defined(CONFIG_TWL6030_POWER)
@@ -580,7 +588,8 @@ static void mmc_set_ios(struct mmc *mmc)
 	writel(readl(&mmc_base->sysctl) | CEN_ENABLE, &mmc_base->sysctl);
 }
 
-int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio)
+int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio,
+		int wp_gpio)
 {
 	struct mmc *mmc = &hsmmc_dev[dev_index];
 	struct omap_hsmmc_data *priv_data = &hsmmc_dev_data[dev_index];
@@ -590,7 +599,7 @@ int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio)
 	mmc->set_ios = mmc_set_ios;
 	mmc->init = mmc_init_setup;
 	mmc->getcd = omap_mmc_getcd;
-	mmc->getwp = NULL;
+	mmc->getwp = omap_mmc_getwp;
 	mmc->priv = priv_data;
 
 	switch (dev_index) {
@@ -612,6 +621,7 @@ int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio)
 		return 1;
 	}
 	priv_data->cd_gpio = omap_mmc_setup_gpio_in(cd_gpio, "mmc_cd");
+	priv_data->wp_gpio = omap_mmc_setup_gpio_in(wp_gpio, "mmc_wp");
 	mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
 	mmc->host_caps = (MMC_MODE_4BIT | MMC_MODE_HS_52MHz | MMC_MODE_HS |
 				MMC_MODE_HC) & ~host_caps_mask;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection
  2012-12-03 12:19 [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection Nikita Kiryanov
                   ` (6 preceding siblings ...)
  2012-12-03 12:19 ` [U-Boot] [PATCH 7/7] omap_hsmmc: add driver check " Nikita Kiryanov
@ 2012-12-18  7:58 ` Nikita Kiryanov
  2012-12-30  6:13 ` Nikita Kiryanov
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Nikita Kiryanov @ 2012-12-18  7:58 UTC (permalink / raw)
  To: u-boot

Gentle ping.

On 12/03/2012 02:19 PM, Nikita Kiryanov wrote:
> This patchset implements card detection and write protection check for omap mmc.
> The write protect implementation also adds generic code that is usable by other
> mmc drivers.
>
> The first 3 patches are preparation patches that contain general maintenance
> for omap mmc driver.
>
> This patchset depends on http://patchwork.ozlabs.org/patch/202384/
>
> Nikita Kiryanov (7):
>    omap: consolidate common mmc definitions
>    omap_hsmmc: fix out of bounds array access
>    omap_hsmmc: introduce omap_hsmmc_data struct
>    omap_hsmmc: implement driver check for card detection
>    cm-t35: implement board specific card detect check
>    mmc: add support for write protection
>    omap_hsmmc: add driver check for write protection
>
>   arch/arm/cpu/armv7/am33xx/board.c               |    4 +-
>   arch/arm/cpu/armv7/omap-common/boot-common.c    |    4 +-
>   arch/arm/cpu/armv7/omap3/board.c                |    4 +-
>   arch/arm/include/asm/arch-am33xx/mmc_host_def.h |  140 +------------------
>   arch/arm/include/asm/arch-omap3/mmc_host_def.h  |  139 +------------------
>   arch/arm/include/asm/arch-omap4/mmc_host_def.h  |  140 +------------------
>   arch/arm/include/asm/arch-omap5/mmc_host_def.h  |  140 +------------------
>   arch/arm/include/asm/omap_mmc.h                 |  168 +++++++++++++++++++++++
>   board/cm_t35/cm_t35.c                           |   13 +-
>   board/comelit/dig297/dig297.c                   |    3 +-
>   board/corscience/tricorder/tricorder.c          |    2 +-
>   board/htkw/mcx/mcx.c                            |    2 +-
>   board/isee/igep0020/igep0020.c                  |    3 +-
>   board/isee/igep0030/igep0030.c                  |    3 +-
>   board/logicpd/am3517evm/am3517evm.c             |    3 +-
>   board/logicpd/omap3som/omap3logic.c             |    2 +-
>   board/logicpd/zoom1/zoom1.c                     |    3 +-
>   board/logicpd/zoom2/zoom2.c                     |    3 +-
>   board/matrix_vision/mvblx/mvblx.c               |    4 +-
>   board/nokia/rx51/rx51.c                         |    4 +-
>   board/overo/overo.c                             |    3 +-
>   board/pandora/pandora.c                         |    3 +-
>   board/technexion/twister/twister.c              |    2 +-
>   board/teejet/mt_ventoux/mt_ventoux.c            |    2 +-
>   board/ti/am3517crane/am3517crane.c              |    3 +-
>   board/ti/beagle/beagle.c                        |    3 +-
>   board/ti/evm/evm.c                              |    3 +-
>   board/ti/omap5_evm/evm.c                        |    4 +-
>   board/ti/panda/panda.c                          |    3 +-
>   board/ti/sdp3430/sdp.c                          |    3 +-
>   board/ti/sdp4430/sdp.c                          |    4 +-
>   board/timll/devkit8000/devkit8000.c             |    3 +-
>   common/cmd_mmc.c                                |    7 +
>   drivers/mmc/arm_pl180_mmci.c                    |    1 +
>   drivers/mmc/bfin_sdh.c                          |    1 +
>   drivers/mmc/davinci_mmc.c                       |    1 +
>   drivers/mmc/fsl_esdhc.c                         |    1 +
>   drivers/mmc/ftsdc010_esdhc.c                    |    1 +
>   drivers/mmc/gen_atmel_mci.c                     |    1 +
>   drivers/mmc/mmc.c                               |   17 +++
>   drivers/mmc/mmc_spi.c                           |    1 +
>   drivers/mmc/mxcmmc.c                            |    1 +
>   drivers/mmc/mxsmmc.c                            |    1 +
>   drivers/mmc/omap_hsmmc.c                        |   78 +++++++++--
>   drivers/mmc/sdhci.c                             |    1 +
>   drivers/mmc/sh_mmcif.c                          |    1 +
>   drivers/mmc/tegra_mmc.c                         |    1 +
>   include/mmc.h                                   |    2 +
>   48 files changed, 324 insertions(+), 612 deletions(-)
>   create mode 100644 arch/arm/include/asm/omap_mmc.h
>


-- 
Regards,
Nikita.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 4/7] omap_hsmmc: implement driver check for card detection
  2012-12-03 12:19 ` [U-Boot] [PATCH 4/7] omap_hsmmc: implement driver check for card detection Nikita Kiryanov
@ 2012-12-18 23:52   ` Tom Rini
  2012-12-19  6:58     ` Nikita Kiryanov
  0 siblings, 1 reply; 20+ messages in thread
From: Tom Rini @ 2012-12-18 23:52 UTC (permalink / raw)
  To: u-boot

On Mon, Dec 03, 2012 at 02:19:44PM +0200, Nikita Kiryanov wrote:

> Implement driver check for card detection.
> 
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>

> -	ret = omap_mmc_init(0, 0, 0);
> +	ret = omap_mmc_init(0, 0, 0, -1);

Everyone passes -1 here, including the follow-up patch for cm_t35.  Why
do we need the change?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121218/e25e1b96/attachment.pgp>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 4/7] omap_hsmmc: implement driver check for card detection
  2012-12-18 23:52   ` Tom Rini
@ 2012-12-19  6:58     ` Nikita Kiryanov
  0 siblings, 0 replies; 20+ messages in thread
From: Nikita Kiryanov @ 2012-12-19  6:58 UTC (permalink / raw)
  To: u-boot

On 12/19/2012 01:52 AM, Tom Rini wrote:
> On Mon, Dec 03, 2012 at 02:19:44PM +0200, Nikita Kiryanov wrote:
>
>> Implement driver check for card detection.
>>
>> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
>> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
>
>> -	ret = omap_mmc_init(0, 0, 0);
>> +	ret = omap_mmc_init(0, 0, 0, -1);
>
> Everyone passes -1 here, including the follow-up patch for cm_t35.  Why
> do we need the change?
>

This change is useful because on OMAP it's a fair assumption
that card detect (and write protect) signal will be ascertained via
a GPIO, though it is not a certainty.

Everybody who is not cm_t35 get a -1 because I did not try to
figure out if they really do use GPIOs for card detect.
cm_t35 gets a -1 because it does not use OMAP GPIOs for card detect,
but relies on those of the PMIC instead.

-- 
Regards,
Nikita.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection
  2012-12-03 12:19 [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection Nikita Kiryanov
                   ` (7 preceding siblings ...)
  2012-12-18  7:58 ` [U-Boot] [PATCH 0/7] omap mmc: implement card detect and " Nikita Kiryanov
@ 2012-12-30  6:13 ` Nikita Kiryanov
  2013-01-07 14:43   ` Tom Rini
  2013-02-13  7:27 ` Nikita Kiryanov
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 20+ messages in thread
From: Nikita Kiryanov @ 2012-12-30  6:13 UTC (permalink / raw)
  To: u-boot

Gentle ping.

On 12/03/2012 02:19 PM, Nikita Kiryanov wrote:
> This patchset implements card detection and write protection check for omap mmc.
> The write protect implementation also adds generic code that is usable by other
> mmc drivers.
>
> The first 3 patches are preparation patches that contain general maintenance
> for omap mmc driver.
>
> This patchset depends on http://patchwork.ozlabs.org/patch/202384/
>
> Nikita Kiryanov (7):
>    omap: consolidate common mmc definitions
>    omap_hsmmc: fix out of bounds array access
>    omap_hsmmc: introduce omap_hsmmc_data struct
>    omap_hsmmc: implement driver check for card detection
>    cm-t35: implement board specific card detect check
>    mmc: add support for write protection
>    omap_hsmmc: add driver check for write protection
>
>   arch/arm/cpu/armv7/am33xx/board.c               |    4 +-
>   arch/arm/cpu/armv7/omap-common/boot-common.c    |    4 +-
>   arch/arm/cpu/armv7/omap3/board.c                |    4 +-
>   arch/arm/include/asm/arch-am33xx/mmc_host_def.h |  140 +------------------
>   arch/arm/include/asm/arch-omap3/mmc_host_def.h  |  139 +------------------
>   arch/arm/include/asm/arch-omap4/mmc_host_def.h  |  140 +------------------
>   arch/arm/include/asm/arch-omap5/mmc_host_def.h  |  140 +------------------
>   arch/arm/include/asm/omap_mmc.h                 |  168 +++++++++++++++++++++++
>   board/cm_t35/cm_t35.c                           |   13 +-
>   board/comelit/dig297/dig297.c                   |    3 +-
>   board/corscience/tricorder/tricorder.c          |    2 +-
>   board/htkw/mcx/mcx.c                            |    2 +-
>   board/isee/igep0020/igep0020.c                  |    3 +-
>   board/isee/igep0030/igep0030.c                  |    3 +-
>   board/logicpd/am3517evm/am3517evm.c             |    3 +-
>   board/logicpd/omap3som/omap3logic.c             |    2 +-
>   board/logicpd/zoom1/zoom1.c                     |    3 +-
>   board/logicpd/zoom2/zoom2.c                     |    3 +-
>   board/matrix_vision/mvblx/mvblx.c               |    4 +-
>   board/nokia/rx51/rx51.c                         |    4 +-
>   board/overo/overo.c                             |    3 +-
>   board/pandora/pandora.c                         |    3 +-
>   board/technexion/twister/twister.c              |    2 +-
>   board/teejet/mt_ventoux/mt_ventoux.c            |    2 +-
>   board/ti/am3517crane/am3517crane.c              |    3 +-
>   board/ti/beagle/beagle.c                        |    3 +-
>   board/ti/evm/evm.c                              |    3 +-
>   board/ti/omap5_evm/evm.c                        |    4 +-
>   board/ti/panda/panda.c                          |    3 +-
>   board/ti/sdp3430/sdp.c                          |    3 +-
>   board/ti/sdp4430/sdp.c                          |    4 +-
>   board/timll/devkit8000/devkit8000.c             |    3 +-
>   common/cmd_mmc.c                                |    7 +
>   drivers/mmc/arm_pl180_mmci.c                    |    1 +
>   drivers/mmc/bfin_sdh.c                          |    1 +
>   drivers/mmc/davinci_mmc.c                       |    1 +
>   drivers/mmc/fsl_esdhc.c                         |    1 +
>   drivers/mmc/ftsdc010_esdhc.c                    |    1 +
>   drivers/mmc/gen_atmel_mci.c                     |    1 +
>   drivers/mmc/mmc.c                               |   17 +++
>   drivers/mmc/mmc_spi.c                           |    1 +
>   drivers/mmc/mxcmmc.c                            |    1 +
>   drivers/mmc/mxsmmc.c                            |    1 +
>   drivers/mmc/omap_hsmmc.c                        |   78 +++++++++--
>   drivers/mmc/sdhci.c                             |    1 +
>   drivers/mmc/sh_mmcif.c                          |    1 +
>   drivers/mmc/tegra_mmc.c                         |    1 +
>   include/mmc.h                                   |    2 +
>   48 files changed, 324 insertions(+), 612 deletions(-)
>   create mode 100644 arch/arm/include/asm/omap_mmc.h
>


-- 
Regards,
Nikita.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection
  2012-12-30  6:13 ` Nikita Kiryanov
@ 2013-01-07 14:43   ` Tom Rini
  2013-01-31  7:44     ` Igor Grinberg
  0 siblings, 1 reply; 20+ messages in thread
From: Tom Rini @ 2013-01-07 14:43 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/30/2012 01:13 AM, Nikita Kiryanov wrote:
> Gentle ping.
> 
> On 12/03/2012 02:19 PM, Nikita Kiryanov wrote:
>> This patchset implements card detection and write protection 
>> check for omap mmc. The write protect implementation also adds 
>> generic code that is usable by other mmc drivers.
>> 
>> The first 3 patches are preparation patches that contain general 
>> maintenance for omap mmc driver.
>> 
>> This patchset depends on 
>> http://patchwork.ozlabs.org/patch/202384/
>> 
>> Nikita Kiryanov (7): omap: consolidate common mmc definitions 
>> omap_hsmmc: fix out of bounds array access omap_hsmmc: introduce
>>  omap_hsmmc_data struct omap_hsmmc: implement driver check for 
>> card detection cm-t35: implement board specific card detect
>> check mmc: add support for write protection omap_hsmmc: add
>> driver check for write protection
>> 
>> arch/arm/cpu/armv7/am33xx/board.c               |    4 +- 
>> arch/arm/cpu/armv7/omap-common/boot-common.c    |    4 +- 
>> arch/arm/cpu/armv7/omap3/board.c                |    4 +- 
>> arch/arm/include/asm/arch-am33xx/mmc_host_def.h |  140 
>> +------------------ 
>> arch/arm/include/asm/arch-omap3/mmc_host_def.h  |  139 
>> +------------------ 
>> arch/arm/include/asm/arch-omap4/mmc_host_def.h  |  140 
>> +------------------ 
>> arch/arm/include/asm/arch-omap5/mmc_host_def.h  |  140 
>> +------------------ arch/arm/include/asm/omap_mmc.h |  168 
>> +++++++++++++++++++++++ board/cm_t35/cm_t35.c |   13 +- 
>> board/comelit/dig297/dig297.c                   |    3 +- 
>> board/corscience/tricorder/tricorder.c          |    2 +- 
>> board/htkw/mcx/mcx.c                            |    2 +- 
>> board/isee/igep0020/igep0020.c                  |    3 +- 
>> board/isee/igep0030/igep0030.c                  |    3 +- 
>> board/logicpd/am3517evm/am3517evm.c             |    3 +- 
>> board/logicpd/omap3som/omap3logic.c             |    2 +- 
>> board/logicpd/zoom1/zoom1.c                     |    3 +- 
>> board/logicpd/zoom2/zoom2.c                     |    3 +- 
>> board/matrix_vision/mvblx/mvblx.c               |    4 +- 
>> board/nokia/rx51/rx51.c                         |    4 +- 
>> board/overo/overo.c                             |    3 +- 
>> board/pandora/pandora.c                         |    3 +- 
>> board/technexion/twister/twister.c              |    2 +- 
>> board/teejet/mt_ventoux/mt_ventoux.c            |    2 +- 
>> board/ti/am3517crane/am3517crane.c              |    3 +- 
>> board/ti/beagle/beagle.c                        |    3 +- 
>> board/ti/evm/evm.c                              |    3 +- 
>> board/ti/omap5_evm/evm.c                        |    4 +- 
>> board/ti/panda/panda.c                          |    3 +- 
>> board/ti/sdp3430/sdp.c                          |    3 +- 
>> board/ti/sdp4430/sdp.c                          |    4 +- 
>> board/timll/devkit8000/devkit8000.c             |    3 +- 
>> common/cmd_mmc.c                                |    7 + 
>> drivers/mmc/arm_pl180_mmci.c                    |    1 + 
>> drivers/mmc/bfin_sdh.c                          |    1 + 
>> drivers/mmc/davinci_mmc.c                       |    1 + 
>> drivers/mmc/fsl_esdhc.c                         |    1 + 
>> drivers/mmc/ftsdc010_esdhc.c                    |    1 + 
>> drivers/mmc/gen_atmel_mci.c                     |    1 + 
>> drivers/mmc/mmc.c                               |   17 +++ 
>> drivers/mmc/mmc_spi.c                           |    1 + 
>> drivers/mmc/mxcmmc.c                            |    1 + 
>> drivers/mmc/mxsmmc.c                            |    1 + 
>> drivers/mmc/omap_hsmmc.c                        |   78 
>> +++++++++-- drivers/mmc/sdhci.c                             | 1
>> + drivers/mmc/sh_mmcif.c                          |    1 + 
>> drivers/mmc/tegra_mmc.c                         |    1 + 
>> include/mmc.h                                   |    2 +

Andy, do you want this in your tree or should I put it in
u-boot-ti/next?  Thanks!

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQIcBAEBAgAGBQJQ6t8DAAoJENk4IS6UOR1WhdoQAIsFVmLLchgmxJcTkyRT3yTR
V6ZLczn/60dYBi9jOTw8kbq1wXyCDay08ZyRHKW6ZbDuKvoSwGPTQD/eN0bsL7lr
Q3/xHSHjei9giMSNu68BDmTcaNg34iti8VBJRjmQ+fe6AVw06ighzdZfbNrhCfM7
8QRQgojq03Hdp1evB+Jn6greG7sVKcOeFb9ambRdj1cBfWI+4FEprfJjZHixzXrt
706mqz+S6ePLogLeU3xdBuQmhCB2T40lCfztL00xuy9l5KCaVyMGjc5cGhF8DYYQ
K54pOjJQZdI//auyPmY6v353WvAQBzVY1x/tgN2Oq86pMimgH2nVHhIoa04H8e1F
9vd9sKFTxDOn0E073YWeMRSzlpBJ7VYWAK5eN9NcjQd5Gyn3SIf5ZteopQyIEkFc
30uuFeCUFwRsoDBEwG/Hz0VSDbIFiAlVyP6bGqzHOTwUG4B6+dJ2Lg/USL+BQCyp
F3y0TGvvBtPXsh8wJ4IwlH7DPISlodn6SWVrnJ1CMbFkHdT74tb0ngLFIW6XFgSX
I5fJOgigrQIsyTnBbH78R8vd1MwtEX+/IDHhxSMoFaJXoqvtlRz8uDy6Jz1JEqt3
O7wBDaxM84LGdq8u8Ck5TN4pCl/jAA9eOtbSxZkV0inEHp4fs3Hqy7eQ/O/rWZgf
m16uMVVWxsGjCZEJk5Iz
=CDRf
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection
  2013-01-07 14:43   ` Tom Rini
@ 2013-01-31  7:44     ` Igor Grinberg
  0 siblings, 0 replies; 20+ messages in thread
From: Igor Grinberg @ 2013-01-31  7:44 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/07/13 16:43, Tom Rini wrote:
> On 12/30/2012 01:13 AM, Nikita Kiryanov wrote:
>> Gentle ping.
> 
>> On 12/03/2012 02:19 PM, Nikita Kiryanov wrote:
>>> This patchset implements card detection and write protection 
>>> check for omap mmc. The write protect implementation also adds 
>>> generic code that is usable by other mmc drivers.
>>>
>>> The first 3 patches are preparation patches that contain general 
>>> maintenance for omap mmc driver.
>>>
>>> This patchset depends on 
>>> http://patchwork.ozlabs.org/patch/202384/

[...]

> 
> Andy, do you want this in your tree or should I put it in
> u-boot-ti/next?  Thanks!

Andy, Tom?


- -- 
Regards,
Igor.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRCiDeAAoJEBDE8YO64EfagmMP/ApwvIUgrbNuHFoZVV1wnD8l
7Vl7ORaqN7Ep9gB8feN43GQ2xMhEFAByFJ0pb1jUXUbAoqkTy7i61XBAAqIMpmgY
kPHWKOcArKc7tsbggOgOGKsKMd3T5KgE9+noRujmAFraiVvhmSQAH5Lm8nI9sGId
eXv7krIgmDuf/p+S568O1RPKVD/6YItH7RYuniArUplm2v6opjDkc/ZbQM8FSowR
OiD5Y5BAMhX8mD30LhUHqJZXcsy3rpZGi6xu3ZrUmllWziTNs/NmCel2Jz7Rw5XM
ZG3+xafov4Y/YLwoxz5thgkDsC/3rX0NHkx2wfXiTmR40VXafSX0t03qrN6Zf08u
kCL3lWiwuRBsC/92JWKOHvi7U1Qos+t9hwhCdJJ1xeNWiZscWbvg1qNdv1vrrHK/
HQJJBkU40lOI0pg/JBBo70Xwp8TUIJLGf0Y1X71QulN74S+TuINQ6jSncPYTJIsC
7O5kZ6l6jst48KgCm9OH0BYcThexANOBe1x++AbDJjxRHxeLdLujDhz1e+qd+NyV
ussFLEMR4Xl+xoH8fcX7+kD9+eCDt0MlEKGJFMtw2LnK0jJtQvT9W6ltXPeD7QMK
Fc7EkNrtBzu9lt1dqFBn5yOtt5KcBw8pN4VjnqsGHUkyxOXEiY5BOcJS01ynpOXw
kBJAH0MVJVSsFQa8Y5cB
=ABJ2
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection
  2012-12-03 12:19 [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection Nikita Kiryanov
                   ` (8 preceding siblings ...)
  2012-12-30  6:13 ` Nikita Kiryanov
@ 2013-02-13  7:27 ` Nikita Kiryanov
  2013-02-15 21:24 ` Tom Rini
  2013-03-09  7:11 ` Igor Grinberg
  11 siblings, 0 replies; 20+ messages in thread
From: Nikita Kiryanov @ 2013-02-13  7:27 UTC (permalink / raw)
  To: u-boot

Hi Andy, Tom,

this patchset is 2 months old.
Can you please address it?

On 12/03/2012 02:19 PM, Nikita Kiryanov wrote:
> This patchset implements card detection and write protection check for omap mmc.
> The write protect implementation also adds generic code that is usable by other
> mmc drivers.
>
> The first 3 patches are preparation patches that contain general maintenance
> for omap mmc driver.
>
> This patchset depends on http://patchwork.ozlabs.org/patch/202384/
>
> Nikita Kiryanov (7):
>    omap: consolidate common mmc definitions
>    omap_hsmmc: fix out of bounds array access
>    omap_hsmmc: introduce omap_hsmmc_data struct
>    omap_hsmmc: implement driver check for card detection
>    cm-t35: implement board specific card detect check
>    mmc: add support for write protection
>    omap_hsmmc: add driver check for write protection
>
>   arch/arm/cpu/armv7/am33xx/board.c               |    4 +-
>   arch/arm/cpu/armv7/omap-common/boot-common.c    |    4 +-
>   arch/arm/cpu/armv7/omap3/board.c                |    4 +-
>   arch/arm/include/asm/arch-am33xx/mmc_host_def.h |  140 +------------------
>   arch/arm/include/asm/arch-omap3/mmc_host_def.h  |  139 +------------------
>   arch/arm/include/asm/arch-omap4/mmc_host_def.h  |  140 +------------------
>   arch/arm/include/asm/arch-omap5/mmc_host_def.h  |  140 +------------------
>   arch/arm/include/asm/omap_mmc.h                 |  168 +++++++++++++++++++++++
>   board/cm_t35/cm_t35.c                           |   13 +-
>   board/comelit/dig297/dig297.c                   |    3 +-
>   board/corscience/tricorder/tricorder.c          |    2 +-
>   board/htkw/mcx/mcx.c                            |    2 +-
>   board/isee/igep0020/igep0020.c                  |    3 +-
>   board/isee/igep0030/igep0030.c                  |    3 +-
>   board/logicpd/am3517evm/am3517evm.c             |    3 +-
>   board/logicpd/omap3som/omap3logic.c             |    2 +-
>   board/logicpd/zoom1/zoom1.c                     |    3 +-
>   board/logicpd/zoom2/zoom2.c                     |    3 +-
>   board/matrix_vision/mvblx/mvblx.c               |    4 +-
>   board/nokia/rx51/rx51.c                         |    4 +-
>   board/overo/overo.c                             |    3 +-
>   board/pandora/pandora.c                         |    3 +-
>   board/technexion/twister/twister.c              |    2 +-
>   board/teejet/mt_ventoux/mt_ventoux.c            |    2 +-
>   board/ti/am3517crane/am3517crane.c              |    3 +-
>   board/ti/beagle/beagle.c                        |    3 +-
>   board/ti/evm/evm.c                              |    3 +-
>   board/ti/omap5_evm/evm.c                        |    4 +-
>   board/ti/panda/panda.c                          |    3 +-
>   board/ti/sdp3430/sdp.c                          |    3 +-
>   board/ti/sdp4430/sdp.c                          |    4 +-
>   board/timll/devkit8000/devkit8000.c             |    3 +-
>   common/cmd_mmc.c                                |    7 +
>   drivers/mmc/arm_pl180_mmci.c                    |    1 +
>   drivers/mmc/bfin_sdh.c                          |    1 +
>   drivers/mmc/davinci_mmc.c                       |    1 +
>   drivers/mmc/fsl_esdhc.c                         |    1 +
>   drivers/mmc/ftsdc010_esdhc.c                    |    1 +
>   drivers/mmc/gen_atmel_mci.c                     |    1 +
>   drivers/mmc/mmc.c                               |   17 +++
>   drivers/mmc/mmc_spi.c                           |    1 +
>   drivers/mmc/mxcmmc.c                            |    1 +
>   drivers/mmc/mxsmmc.c                            |    1 +
>   drivers/mmc/omap_hsmmc.c                        |   78 +++++++++--
>   drivers/mmc/sdhci.c                             |    1 +
>   drivers/mmc/sh_mmcif.c                          |    1 +
>   drivers/mmc/tegra_mmc.c                         |    1 +
>   include/mmc.h                                   |    2 +
>   48 files changed, 324 insertions(+), 612 deletions(-)
>   create mode 100644 arch/arm/include/asm/omap_mmc.h
>


-- 
Regards,
Nikita.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 7/7] omap_hsmmc: add driver check for write protection
  2012-12-03 12:19 ` [U-Boot] [PATCH 7/7] omap_hsmmc: add driver check " Nikita Kiryanov
@ 2013-02-15 21:22   ` Tom Rini
  0 siblings, 0 replies; 20+ messages in thread
From: Tom Rini @ 2013-02-15 21:22 UTC (permalink / raw)
  To: u-boot

On Mon, Dec 03, 2012 at 02:19:47PM +0200, Nikita Kiryanov wrote:

> Add check for write protection in omap mmc driver.
> 
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
[snip]
> -int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio)
> +int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio,
> +		int wp_gpio)

OK, next person to modify this function has to make it take a struct
params instead.  Or if you're up for it, a follow-up patch.

Reviewed-by: Tom Rini <trini@ti.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130215/386f62ed/attachment.pgp>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection
  2012-12-03 12:19 [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection Nikita Kiryanov
                   ` (9 preceding siblings ...)
  2013-02-13  7:27 ` Nikita Kiryanov
@ 2013-02-15 21:24 ` Tom Rini
  2013-03-05  7:53   ` Nikita Kiryanov
  2013-03-09  7:11 ` Igor Grinberg
  11 siblings, 1 reply; 20+ messages in thread
From: Tom Rini @ 2013-02-15 21:24 UTC (permalink / raw)
  To: u-boot

On Mon, Dec 03, 2012 at 02:19:40PM +0200, Nikita Kiryanov wrote:

> This patchset implements card detection and write protection check for
> omap mmc.  The write protect implementation also adds generic code
> that is usable by other mmc drivers.
> 
> The first 3 patches are preparation patches that contain general maintenance
> for omap mmc driver.
> 
> This patchset depends on http://patchwork.ozlabs.org/patch/202384/
> 
> Nikita Kiryanov (7):
>   omap: consolidate common mmc definitions
>   omap_hsmmc: fix out of bounds array access
>   omap_hsmmc: introduce omap_hsmmc_data struct
>   omap_hsmmc: implement driver check for card detection
>   cm-t35: implement board specific card detect check
>   mmc: add support for write protection
>   omap_hsmmc: add driver check for write protection
> 
>  arch/arm/cpu/armv7/am33xx/board.c               |    4 +-
>  arch/arm/cpu/armv7/omap-common/boot-common.c    |    4 +-
>  arch/arm/cpu/armv7/omap3/board.c                |    4 +-
>  arch/arm/include/asm/arch-am33xx/mmc_host_def.h |  140 +------------------
>  arch/arm/include/asm/arch-omap3/mmc_host_def.h  |  139 +------------------
>  arch/arm/include/asm/arch-omap4/mmc_host_def.h  |  140 +------------------
>  arch/arm/include/asm/arch-omap5/mmc_host_def.h  |  140 +------------------
>  arch/arm/include/asm/omap_mmc.h                 |  168 +++++++++++++++++++++++
>  board/cm_t35/cm_t35.c                           |   13 +-
>  board/comelit/dig297/dig297.c                   |    3 +-
>  board/corscience/tricorder/tricorder.c          |    2 +-
>  board/htkw/mcx/mcx.c                            |    2 +-
>  board/isee/igep0020/igep0020.c                  |    3 +-
>  board/isee/igep0030/igep0030.c                  |    3 +-
>  board/logicpd/am3517evm/am3517evm.c             |    3 +-
>  board/logicpd/omap3som/omap3logic.c             |    2 +-
>  board/logicpd/zoom1/zoom1.c                     |    3 +-
>  board/logicpd/zoom2/zoom2.c                     |    3 +-
>  board/matrix_vision/mvblx/mvblx.c               |    4 +-
>  board/nokia/rx51/rx51.c                         |    4 +-
>  board/overo/overo.c                             |    3 +-
>  board/pandora/pandora.c                         |    3 +-
>  board/technexion/twister/twister.c              |    2 +-
>  board/teejet/mt_ventoux/mt_ventoux.c            |    2 +-
>  board/ti/am3517crane/am3517crane.c              |    3 +-
>  board/ti/beagle/beagle.c                        |    3 +-
>  board/ti/evm/evm.c                              |    3 +-
>  board/ti/omap5_evm/evm.c                        |    4 +-
>  board/ti/panda/panda.c                          |    3 +-
>  board/ti/sdp3430/sdp.c                          |    3 +-
>  board/ti/sdp4430/sdp.c                          |    4 +-
>  board/timll/devkit8000/devkit8000.c             |    3 +-
>  common/cmd_mmc.c                                |    7 +
>  drivers/mmc/arm_pl180_mmci.c                    |    1 +
>  drivers/mmc/bfin_sdh.c                          |    1 +
>  drivers/mmc/davinci_mmc.c                       |    1 +
>  drivers/mmc/fsl_esdhc.c                         |    1 +
>  drivers/mmc/ftsdc010_esdhc.c                    |    1 +
>  drivers/mmc/gen_atmel_mci.c                     |    1 +
>  drivers/mmc/mmc.c                               |   17 +++
>  drivers/mmc/mmc_spi.c                           |    1 +
>  drivers/mmc/mxcmmc.c                            |    1 +
>  drivers/mmc/mxsmmc.c                            |    1 +
>  drivers/mmc/omap_hsmmc.c                        |   78 +++++++++--
>  drivers/mmc/sdhci.c                             |    1 +
>  drivers/mmc/sh_mmcif.c                          |    1 +
>  drivers/mmc/tegra_mmc.c                         |    1 +
>  include/mmc.h                                   |    2 +
>  48 files changed, 324 insertions(+), 612 deletions(-)
>  create mode 100644 arch/arm/include/asm/omap_mmc.h

For the series:

Reviewed-by: Tom Rini <trini@ti.com>

Andy, since this touches generic code to add the write-protect stuff,
which looks fine to me, I'd really like a chime-in before I take this to
u-boot-ti, or you pick it all up for u-boot-mmc.  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130215/e1513657/attachment.pgp>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection
  2013-02-15 21:24 ` Tom Rini
@ 2013-03-05  7:53   ` Nikita Kiryanov
  0 siblings, 0 replies; 20+ messages in thread
From: Nikita Kiryanov @ 2013-03-05  7:53 UTC (permalink / raw)
  To: u-boot

Hi Tom,

On 02/15/2013 11:24 PM, Tom Rini wrote:
> On Mon, Dec 03, 2012 at 02:19:40PM +0200, Nikita Kiryanov wrote:
>
>> This patchset implements card detection and write protection check for
>> omap mmc.  The write protect implementation also adds generic code
>> that is usable by other mmc drivers.
>>
>> The first 3 patches are preparation patches that contain general maintenance
>> for omap mmc driver.
>>
>> This patchset depends on http://patchwork.ozlabs.org/patch/202384/
>>
>> Nikita Kiryanov (7):
>>    omap: consolidate common mmc definitions
>>    omap_hsmmc: fix out of bounds array access
>>    omap_hsmmc: introduce omap_hsmmc_data struct
>>    omap_hsmmc: implement driver check for card detection
>>    cm-t35: implement board specific card detect check
>>    mmc: add support for write protection
>>    omap_hsmmc: add driver check for write protection
[...]
>
> For the series:
>
> Reviewed-by: Tom Rini <trini@ti.com>
>
> Andy, since this touches generic code to add the write-protect stuff,
> which looks fine to me, I'd really like a chime-in before I take this to
> u-boot-ti, or you pick it all up for u-boot-mmc.  Thanks!
>

Now that rc1 is out, perhaps it is time to finally apply this series?
Andy doesn't seem to be involved much in U-Boot these days, I don't
think we should wait for him anymore.

-- 
Regards,
Nikita.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection
  2012-12-03 12:19 [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection Nikita Kiryanov
                   ` (10 preceding siblings ...)
  2013-02-15 21:24 ` Tom Rini
@ 2013-03-09  7:11 ` Igor Grinberg
  2013-03-09 12:18   ` Tom Rini
  11 siblings, 1 reply; 20+ messages in thread
From: Igor Grinberg @ 2013-03-09  7:11 UTC (permalink / raw)
  To: u-boot

Hi guys,

This patch set is "floating" already for _three_ months.
All comments were addressed, it introduces negative diff stat,
and provides two useful features (also for production automation).

Andy hasn't been responding for quite a while.
I think this patch set is good enough for merging.
There is no reason for it to float any longer.

Please, merge it either via Tom's tree or anyone else's staging.

Thanks!

On 12/03/12 14:19, Nikita Kiryanov wrote:
> This patchset implements card detection and write protection check for omap mmc.
> The write protect implementation also adds generic code that is usable by other
> mmc drivers.
> 
> The first 3 patches are preparation patches that contain general maintenance
> for omap mmc driver.
> 
> This patchset depends on http://patchwork.ozlabs.org/patch/202384/
> 
> Nikita Kiryanov (7):
>   omap: consolidate common mmc definitions
>   omap_hsmmc: fix out of bounds array access
>   omap_hsmmc: introduce omap_hsmmc_data struct
>   omap_hsmmc: implement driver check for card detection
>   cm-t35: implement board specific card detect check
>   mmc: add support for write protection
>   omap_hsmmc: add driver check for write protection
> 
>  arch/arm/cpu/armv7/am33xx/board.c               |    4 +-
>  arch/arm/cpu/armv7/omap-common/boot-common.c    |    4 +-
>  arch/arm/cpu/armv7/omap3/board.c                |    4 +-
>  arch/arm/include/asm/arch-am33xx/mmc_host_def.h |  140 +------------------
>  arch/arm/include/asm/arch-omap3/mmc_host_def.h  |  139 +------------------
>  arch/arm/include/asm/arch-omap4/mmc_host_def.h  |  140 +------------------
>  arch/arm/include/asm/arch-omap5/mmc_host_def.h  |  140 +------------------
>  arch/arm/include/asm/omap_mmc.h                 |  168 +++++++++++++++++++++++
>  board/cm_t35/cm_t35.c                           |   13 +-
>  board/comelit/dig297/dig297.c                   |    3 +-
>  board/corscience/tricorder/tricorder.c          |    2 +-
>  board/htkw/mcx/mcx.c                            |    2 +-
>  board/isee/igep0020/igep0020.c                  |    3 +-
>  board/isee/igep0030/igep0030.c                  |    3 +-
>  board/logicpd/am3517evm/am3517evm.c             |    3 +-
>  board/logicpd/omap3som/omap3logic.c             |    2 +-
>  board/logicpd/zoom1/zoom1.c                     |    3 +-
>  board/logicpd/zoom2/zoom2.c                     |    3 +-
>  board/matrix_vision/mvblx/mvblx.c               |    4 +-
>  board/nokia/rx51/rx51.c                         |    4 +-
>  board/overo/overo.c                             |    3 +-
>  board/pandora/pandora.c                         |    3 +-
>  board/technexion/twister/twister.c              |    2 +-
>  board/teejet/mt_ventoux/mt_ventoux.c            |    2 +-
>  board/ti/am3517crane/am3517crane.c              |    3 +-
>  board/ti/beagle/beagle.c                        |    3 +-
>  board/ti/evm/evm.c                              |    3 +-
>  board/ti/omap5_evm/evm.c                        |    4 +-
>  board/ti/panda/panda.c                          |    3 +-
>  board/ti/sdp3430/sdp.c                          |    3 +-
>  board/ti/sdp4430/sdp.c                          |    4 +-
>  board/timll/devkit8000/devkit8000.c             |    3 +-
>  common/cmd_mmc.c                                |    7 +
>  drivers/mmc/arm_pl180_mmci.c                    |    1 +
>  drivers/mmc/bfin_sdh.c                          |    1 +
>  drivers/mmc/davinci_mmc.c                       |    1 +
>  drivers/mmc/fsl_esdhc.c                         |    1 +
>  drivers/mmc/ftsdc010_esdhc.c                    |    1 +
>  drivers/mmc/gen_atmel_mci.c                     |    1 +
>  drivers/mmc/mmc.c                               |   17 +++
>  drivers/mmc/mmc_spi.c                           |    1 +
>  drivers/mmc/mxcmmc.c                            |    1 +
>  drivers/mmc/mxsmmc.c                            |    1 +
>  drivers/mmc/omap_hsmmc.c                        |   78 +++++++++--
>  drivers/mmc/sdhci.c                             |    1 +
>  drivers/mmc/sh_mmcif.c                          |    1 +
>  drivers/mmc/tegra_mmc.c                         |    1 +
>  include/mmc.h                                   |    2 +
>  48 files changed, 324 insertions(+), 612 deletions(-)
>  create mode 100644 arch/arm/include/asm/omap_mmc.h
> 

-- 
Regards,
Igor.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection
  2013-03-09  7:11 ` Igor Grinberg
@ 2013-03-09 12:18   ` Tom Rini
  0 siblings, 0 replies; 20+ messages in thread
From: Tom Rini @ 2013-03-09 12:18 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/09/2013 02:11 AM, Igor Grinberg wrote:
> Hi guys,
> 
> This patch set is "floating" already for _three_ months. All
> comments were addressed, it introduces negative diff stat, and
> provides two useful features (also for production automation).
> 
> Andy hasn't been responding for quite a while. I think this patch
> set is good enough for merging. There is no reason for it to float
> any longer.
> 
> Please, merge it either via Tom's tree or anyone else's staging.

I grabbed this locally yesterday and the only issue is that there's
new boards that need their mmc calls updated.  I should have this
merged soon.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJROyikAAoJENk4IS6UOR1WSC8P/2SNB6v96Cmbw+hwpNl3iJSa
stk2r7pxOUBvMJR7ZMzjVz53DUn8OvKbc+0eaPR12VwHGY/i9GuOqHfcu31dx1q5
Hq4W5J+MS97czVK/6S5FcbDLFr8araBHM8AZwQNz1DqQVoswLA6bHKepNdzXzp+q
X04K0dNP4TbikazytLiStLiGcS58VORVKIrT7coWjapIOO9+bcKhCq4XgsuGOluy
YGIbn0s3kewoDxCbdpDQIu5QBpbNv13wTYWqRFVlaf5x+sBvUxtSTPPHNjl8I6c8
O3acMI+5AGpsNyQrRqRCbpZ3ce9NZw2/7ORS0GOLyWF/TAH0qv7+W8OuK8L+YtHm
8ivqSypSA33A0dneC0U3wu72lkBRWmA8tXjWifyNh0bKfL+5eKo37ZT3RL2sCmsl
n8aNXIwnMHEOXt+g9afU4g0EgD4EfJY3CF0sJcB8VuxDttkFYs/nVIwNRdg0Ivq3
xHEdPrgbBZsBbpbpjaxX6gatz8zdBl77ky4roCc9OQ5xJpQmO7lab5wAJK8Un5vl
ywGZa5akE7IHTrgpOlDKANe8PUsfSR8YnRkzov2rUuoXnxiT/avtWQuQXch2nmbR
Als1LbNapRwevslrGFUpcbQwOefXOIlaX+ise6Jelky44/udoxCPFxkPPjXgqSRU
Kw9IGLWgup5EylWGHitM
=JIxn
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2013-03-09 12:18 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-03 12:19 [U-Boot] [PATCH 0/7] omap mmc: implement card detect and write protection Nikita Kiryanov
2012-12-03 12:19 ` [U-Boot] [PATCH 1/7] omap: consolidate common mmc definitions Nikita Kiryanov
2012-12-03 12:19 ` [U-Boot] [PATCH 2/7] omap_hsmmc: fix out of bounds array access Nikita Kiryanov
2012-12-03 12:19 ` [U-Boot] [PATCH 3/7] omap_hsmmc: introduce omap_hsmmc_data struct Nikita Kiryanov
2012-12-03 12:19 ` [U-Boot] [PATCH 4/7] omap_hsmmc: implement driver check for card detection Nikita Kiryanov
2012-12-18 23:52   ` Tom Rini
2012-12-19  6:58     ` Nikita Kiryanov
2012-12-03 12:19 ` [U-Boot] [PATCH 5/7] cm-t35: implement board specific card detect check Nikita Kiryanov
2012-12-03 12:19 ` [U-Boot] [PATCH 6/7] mmc: add support for write protection Nikita Kiryanov
2012-12-03 12:19 ` [U-Boot] [PATCH 7/7] omap_hsmmc: add driver check " Nikita Kiryanov
2013-02-15 21:22   ` Tom Rini
2012-12-18  7:58 ` [U-Boot] [PATCH 0/7] omap mmc: implement card detect and " Nikita Kiryanov
2012-12-30  6:13 ` Nikita Kiryanov
2013-01-07 14:43   ` Tom Rini
2013-01-31  7:44     ` Igor Grinberg
2013-02-13  7:27 ` Nikita Kiryanov
2013-02-15 21:24 ` Tom Rini
2013-03-05  7:53   ` Nikita Kiryanov
2013-03-09  7:11 ` Igor Grinberg
2013-03-09 12:18   ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.