mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 21:36:28 +08:00
drivers/mmcsd: Added support for MMC(eMMC) bigger than 2 GB (Tested with IMXRT1050EVKB and samsung eMMC 16GB). arch/arm/src/imxrt: IMXRT uSDHC driver cmd line reset logic modified.
This commit is contained in:
committed by
Gregory Nutt
parent
fe6f9b1f24
commit
19c070e0d1
@@ -4,6 +4,7 @@
|
|||||||
* Copyright (C) 2018-2019 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2018-2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
* Dave Marples <dave@marples.net>
|
* Dave Marples <dave@marples.net>
|
||||||
|
* Ivan Ucherdzhiev <ivanucherdjiev@gmail.com>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -2021,7 +2022,11 @@ static int imxrt_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd,
|
|||||||
|
|
||||||
if ((getreg32(priv->addr + IMXRT_USDHC_IRQSTAT_OFFSET) & USDHC_RESPERR_INTS) != 0)
|
if ((getreg32(priv->addr + IMXRT_USDHC_IRQSTAT_OFFSET) & USDHC_RESPERR_INTS) != 0)
|
||||||
{
|
{
|
||||||
putreg32(USDHC_SYSCTL_RSTC, priv->addr + IMXRT_USDHC_SYSCTL_OFFSET);
|
modifyreg32(priv->addr + IMXRT_USDHC_SYSCTL_OFFSET, 0, USDHC_SYSCTL_RSTC);
|
||||||
|
while ((getreg32(priv->addr + IMXRT_USDHC_SYSCTL_OFFSET) &
|
||||||
|
USDHC_SYSCTL_RSTC) != 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout = USDHC_CMDTIMEOUT;
|
timeout = USDHC_CMDTIMEOUT;
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
#define MMCSD_CARDTYPE_MMC 1 /* Bit 0: MMC card */
|
#define MMCSD_CARDTYPE_MMC 1 /* Bit 0: MMC card */
|
||||||
#define MMCSD_CARDTYPE_SDV1 2 /* Bit 1: SD version 1.x */
|
#define MMCSD_CARDTYPE_SDV1 2 /* Bit 1: SD version 1.x */
|
||||||
#define MMCSD_CARDTYPE_SDV2 4 /* Bit 2: SD version 2.x with byte addressing */
|
#define MMCSD_CARDTYPE_SDV2 4 /* Bit 2: SD version 2.x with byte addressing */
|
||||||
#define MMCSD_CARDTYPE_BLOCK 8 /* Bit 3: SD version 2.x with block addressing */
|
#define MMCSD_CARDTYPE_BLOCK 8 /* Bit 3: SD version 2.x or MMC with block addressing */
|
||||||
|
|
||||||
#define IS_MMC(t) (((t) & MMCSD_CARDTYPE_MMC) != 0)
|
#define IS_MMC(t) (((t) & MMCSD_CARDTYPE_MMC) != 0)
|
||||||
#define IS_SD(t) (((t) & (MMCSD_CARDTYPE_SDV1|MMCSD_CARDTYPE_SDV2)) != 0)
|
#define IS_SD(t) (((t) & (MMCSD_CARDTYPE_SDV1|MMCSD_CARDTYPE_SDV2)) != 0)
|
||||||
@@ -81,7 +81,8 @@
|
|||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
#define EXTERN extern "C"
|
#define EXTERN extern "C"
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
#else
|
#else
|
||||||
#define EXTERN extern
|
#define EXTERN extern
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+410
-103
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
* drivers/mmcsd/mmcsd_sdio.h
|
* drivers/mmcsd/mmcsd_sdio.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2009, 2011, 2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -150,6 +150,7 @@
|
|||||||
#define MMCSD_VDD_35_36 ((uint32_t)1 << 23) /* VDD voltage 3.5-3.6 */
|
#define MMCSD_VDD_35_36 ((uint32_t)1 << 23) /* VDD voltage 3.5-3.6 */
|
||||||
#define MMCSD_R3_HIGHCAPACITY ((uint32_t)1 << 30) /* true: Card supports block addressing */
|
#define MMCSD_R3_HIGHCAPACITY ((uint32_t)1 << 30) /* true: Card supports block addressing */
|
||||||
#define MMCSD_CARD_BUSY ((uint32_t)1 << 31) /* Card power-up busy bit */
|
#define MMCSD_CARD_BUSY ((uint32_t)1 << 31) /* Card power-up busy bit */
|
||||||
|
#define MMCSD_R3_STDCAPACITY ((uint32_t)0)
|
||||||
|
|
||||||
/* R6 Card Status bit definitions */
|
/* R6 Card Status bit definitions */
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* include/nuttx/sdio.h
|
* include/nuttx/sdio.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009, 2011-2013, 2017 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2009, 2011-2013, 2017, 2019 Gregory Nutt. All rights
|
||||||
|
* reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -118,8 +119,9 @@
|
|||||||
# define MMCSD_CMDIDX6 6 /* HS_SWITCH: Checks switchable function */
|
# define MMCSD_CMDIDX6 6 /* HS_SWITCH: Checks switchable function */
|
||||||
# define MMCSD_CMDIDX7 7 /* SELECT/DESELECT CARD
|
# define MMCSD_CMDIDX7 7 /* SELECT/DESELECT CARD
|
||||||
* -Addressed Command, R1 response 31:16=RCA */
|
* -Addressed Command, R1 response 31:16=RCA */
|
||||||
# define SD_CMDIDX8 8 /* IF_COND: Sends SD Memory Card interface condition
|
# define MMCSD_CMDIDX8 8 /* SD: IF_COND: Sends SD Memory Card interface condition
|
||||||
* R7 response */
|
* R7 response;
|
||||||
|
* MMC: get extended CSD register 512 bytes R1 response */
|
||||||
# define MMCSD_CMDIDX9 9 /* SEND_CSD: Asks card to send its card specific data (CSD)
|
# define MMCSD_CMDIDX9 9 /* SEND_CSD: Asks card to send its card specific data (CSD)
|
||||||
* -Addressed Command, R2 response 31:16=RCA */
|
* -Addressed Command, R2 response 31:16=RCA */
|
||||||
# define MMCSD_CMDIDX10 10 /* SEND_CID: Asks card to send its card identification (CID)
|
# define MMCSD_CMDIDX10 10 /* SEND_CID: Asks card to send its card identification (CID)
|
||||||
@@ -274,7 +276,8 @@
|
|||||||
#define MMCSD_CMD6 (MMCSD_CMDIDX6 |MMCSD_R1_RESPONSE |MMCSD_RDDATAXFR)
|
#define MMCSD_CMD6 (MMCSD_CMDIDX6 |MMCSD_R1_RESPONSE |MMCSD_RDDATAXFR)
|
||||||
#define MMCSD_CMD7S (MMCSD_CMDIDX7 |MMCSD_R1B_RESPONSE|MMCSD_NODATAXFR)
|
#define MMCSD_CMD7S (MMCSD_CMDIDX7 |MMCSD_R1B_RESPONSE|MMCSD_NODATAXFR)
|
||||||
#define MMCSD_CMD7D (MMCSD_CMDIDX7 |MMCSD_NO_RESPONSE |MMCSD_NODATAXFR) /* No response when de-selecting card */
|
#define MMCSD_CMD7D (MMCSD_CMDIDX7 |MMCSD_NO_RESPONSE |MMCSD_NODATAXFR) /* No response when de-selecting card */
|
||||||
#define SD_CMD8 (SD_CMDIDX8 |MMCSD_R7_RESPONSE |MMCSD_NODATAXFR)
|
#define SD_CMD8 (MMCSD_CMDIDX8 |MMCSD_R7_RESPONSE |MMCSD_NODATAXFR)
|
||||||
|
#define MMC_CMD8 (MMCSD_CMDIDX8 |MMCSD_R1_RESPONSE |MMCSD_RDDATAXFR)
|
||||||
#define MMCSD_CMD9 (MMCSD_CMDIDX9 |MMCSD_R2_RESPONSE |MMCSD_NODATAXFR)
|
#define MMCSD_CMD9 (MMCSD_CMDIDX9 |MMCSD_R2_RESPONSE |MMCSD_NODATAXFR)
|
||||||
#define MMCSD_CMD10 (MMCSD_CMDIDX10|MMCSD_R2_RESPONSE |MMCSD_NODATAXFR)
|
#define MMCSD_CMD10 (MMCSD_CMDIDX10|MMCSD_R2_RESPONSE |MMCSD_NODATAXFR)
|
||||||
#define MMC_CMD11 (MMC_CMDIDX11 |MMCSD_R1_RESPONSE |MMCSD_RDSTREAM )
|
#define MMC_CMD11 (MMC_CMDIDX11 |MMCSD_R1_RESPONSE |MMCSD_RDSTREAM )
|
||||||
|
|||||||
Reference in New Issue
Block a user