Add capabilities() method to SDIO interface. Remove CONFIG_SDIO_WIDTH_D1_ONLY. That should not be a global propertie, but rather a capability/limitation of single slot when there may be multiple slots.

This commit is contained in:
Gregory Nutt 2017-01-31 09:16:01 -06:00
parent 4c39b68505
commit 9ac00a355f
59 changed files with 198 additions and 118 deletions

View File

@ -5376,7 +5376,8 @@ int kbd_decode(FAR struct lib_instream_s *stream, FAR struct kbd_getstate_s *sta
</p>
<ul>
<p><code>void (*reset)(FAR struct sdio_dev_s *dev);</code><br>
<code>uint8_t (*status)(FAR struct sdio_dev_s *dev);</code><br>
<code>sdio_capset_t (*capabilities)(FAR struct sdio_dev_s *dev);</code><br>
<code>sdio_statset_t (*status)(FAR struct sdio_dev_s *dev);</code><br>
<code>void (*widebus)(FAR struct sdio_dev_s *dev, bool enable);</code><br>
<code>void (*clock)(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate);</code><br>
<code>int (*attach)(FAR struct sdio_dev_s *dev);</code><br>

View File

@ -658,6 +658,12 @@ endmenu # Kinetis Ethernet Configuration
menu "Kinetis SDHC Configuration"
depends on KINETIS_SDHC
config KINETIS_SDHC_WIDTH_D1_ONLY
bool "Use D1 only"
default n
---help---
Select 1-bit transfer mode. Default: 4-bit transfer mode.
config KINETIS_SDHC_ABSFREQ
bool "Custom transfer frequencies"
default n
@ -687,14 +693,14 @@ config KINETIS_MMCXFR_FREQ
config KINETIS_SD1BIT_FREQ
int "SD 1-bit transfer frequency"
default 20000000
depends on SDIO_WIDTH_D1_ONLY
depends on KINETIS_SDHC_WIDTH_D1_ONLY
---help---
Frequency to use for transferring data to/from an SD card using on a single data liune.
config KINETIS_SD4BIT_FREQ
int "SD 4-bit transfer frequency"
default 20000000
depends on !SDIO_WIDTH_D1_ONLY
depends on !KINETIS_SDHC_WIDTH_D1_ONLY
---help---
Frequency to use for transferring data to/from an SD card using all four data lines.

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/kinetis/kinetis_sdhc.c
*
* Copyright (C) 2011-2012, 2014, 2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2012, 2014, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -173,7 +173,7 @@ struct kinetis_dev_s
/* Callback support */
uint8_t cdstatus; /* Card status */
sdio_statset_t cdstatus; /* Card status */
sdio_eventset_t cbevents; /* Set of events to be cause callbacks */
worker_t callback; /* Registered callback function */
void *cbarg; /* Registered callback argument */
@ -282,7 +282,8 @@ static int kinetis_lock(FAR struct sdio_dev_s *dev, bool lock);
/* Initialization/setup */
static void kinetis_reset(FAR struct sdio_dev_s *dev);
static uint8_t kinetis_status(FAR struct sdio_dev_s *dev);
static sdio_capset_t kinetis_capabilities(FAR struct sdio_dev_s *dev);
static sdio_statset_t kinetis_status(FAR struct sdio_dev_s *dev);
static void kinetis_widebus(FAR struct sdio_dev_s *dev, bool enable);
#ifdef CONFIG_KINETIS_SDHC_ABSFREQ
static void kinetis_frequency(FAR struct sdio_dev_s *dev, uint32_t frequency);
@ -350,6 +351,7 @@ struct kinetis_dev_s g_sdhcdev =
.lock = kinetis_lock,
#endif
.reset = kinetis_reset,
.capabilities = kinetis_capabilities,
.status = kinetis_status,
.widebus = kinetis_widebus,
.clock = kinetis_clock,
@ -1311,6 +1313,28 @@ static void kinetis_reset(FAR struct sdio_dev_s *dev)
priv->xfrints = 0; /* Interrupt enables for data transfer */
}
/****************************************************************************
* Name: kinetis_capabilities
*
* Description:
* Get capabilities (and limitations) of the SDIO driver (optional)
*
* Input Parameters:
* dev - Device-specific state data
*
* Returned Value:
* Returns a bitset of status values (see SDIO_CAPS_* defines)
*
****************************************************************************/
static sdio_capset_t kinetis_capabilities(FAR struct sdio_dev_s *dev)
{
#ifdef CONFIG_KINETIS_SDHC_WIDTH_D1_ONLY
return SDIO_CAPS_1BIT_ONLY;
#else
return 0;
}
/****************************************************************************
* Name: kinetis_status
*
@ -1325,7 +1349,7 @@ static void kinetis_reset(FAR struct sdio_dev_s *dev)
*
****************************************************************************/
static uint8_t kinetis_status(FAR struct sdio_dev_s *dev)
static sdio_statset_t kinetis_status(FAR struct sdio_dev_s *dev)
{
struct kinetis_dev_s *priv = (struct kinetis_dev_s *)dev;
return priv->cdstatus;
@ -1560,7 +1584,7 @@ static void kinetis_clock(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate)
break;
case CLOCK_SD_TRANSFER_1BIT : /* SD normal operation clocking (narrow 1-bit mode) */
#ifndef CONFIG_SDIO_WIDTH_D1_ONLY
#ifndef CONFIG_KINETIS_SDHC_WIDTH_D1_ONLY
frequency = CONFIG_KINETIS_SD1BIT_FREQ;
break;
#endif
@ -1632,7 +1656,7 @@ static void kinetis_clock(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate)
case CLOCK_SD_TRANSFER_1BIT : /* SD normal operation clocking (narrow
* 1-bit mode) */
#ifndef CONFIG_SDIO_WIDTH_D1_ONLY
#ifndef CONFIG_KINETIS_SDHC_WIDTH_D1_ONLY
regval |= (BOARD_SDHC_SD1MODE_PRESCALER | BOARD_SDHC_IDMODE_DIVISOR |
SDHC_SYSCTL_SDCLKEN | SDHC_SYSCTL_PEREN | SDHC_SYSCTL_HCKEN |
SDHC_SYSCTL_IPGEN);
@ -2829,7 +2853,7 @@ FAR struct sdio_dev_s *sdhc_initialize(int slotno)
/* Data width 4 or 8 */
#ifndef CONFIG_SDIO_WIDTH_D1_ONLY
#ifndef CONFIG_KINETIS_SDHC_WIDTH_D1_ONLY
kinetis_pinconfig(PIN_SDHC0_D1);
kinetis_pinconfig(PIN_SDHC0_D2);
kinetis_pinconfig(PIN_SDHC0_D3);
@ -2881,7 +2905,7 @@ FAR struct sdio_dev_s *sdhc_initialize(int slotno)
void sdhc_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot)
{
struct kinetis_dev_s *priv = (struct kinetis_dev_s *)dev;
uint8_t cdstatus;
sdio_statset_t cdstatus;
irqstate_t flags;
/* Update card status */

View File

@ -630,7 +630,7 @@ config LPC17_I2C2_FREQUENCY
endmenu
menu "SDIO Configuration"
menu "SDCARD Configuration"
depends on LPC17_SDCARD
config SDIO_DMA
@ -643,7 +643,7 @@ config SDIO_DMA
For most usages, SD accesses will cause data overruns if used without
DMA. Requires LPC17_SDCARD and config LPC17_GPDMA.
config SDIO_WIDTH_D1_ONLY
config LPC17_SDCARD_WIDTH_D1_ONLY
bool "Use D1 only"
default n
---help---

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/lpc17xx/lpc17_sdcard.c
*
* Copyright (C) 2013-2014, 2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2013-2014, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -91,9 +91,9 @@
* CONFIG_SDIO_DMA - Enable SD card DMA. This is a marginally optional.
* For most usages, SD accesses will cause data overruns if used without DMA.
* NOTE the above system DMA configuration options.
* CONFIG_SDIO_WIDTH_D1_ONLY - This may be selected to force the driver
* operate with only a single data line (the default is to use all
* 4 SD data lines).
* CONFIG_LPC17_SDCARD_WIDTH_D1_ONLY - This may be selected to force the
* driver operate with only a single data line (the default is to use
* all 4 SD data lines).
* CONFIG_DEBUG_MEMCARD_* - Enables some very low-level debug output
* This also requires CONFIG_DEBUG_FS and CONFIG_DEBUG_INFO
*/
@ -247,7 +247,7 @@ struct lpc17_dev_s
/* Callback support */
uint8_t cdstatus; /* Card status */
sdio_statset_t cdstatus; /* Card status */
sdio_eventset_t cbevents; /* Set of events to be cause callbacks */
worker_t callback; /* Registered callback function */
void *cbarg; /* Registered callback argument */
@ -355,6 +355,7 @@ static int lpc17_lock(FAR struct sdio_dev_s *dev, bool lock);
/* Initialization/setup */
static void lpc17_reset(FAR struct sdio_dev_s *dev);
static sdio_capset_t lpc17_capabilities(FAR struct sdio_dev_s *dev);
static uint8_t lpc17_status(FAR struct sdio_dev_s *dev);
static void lpc17_widebus(FAR struct sdio_dev_s *dev, bool enable);
static void lpc17_clock(FAR struct sdio_dev_s *dev,
@ -419,6 +420,7 @@ struct lpc17_dev_s g_scard_dev =
.lock = lpc17_lock,
#endif
.reset = lpc17_reset,
.capabilities = lpc17_capabilities,
.status = lpc17_status,
.widebus = lpc17_widebus,
.clock = lpc17_clock,
@ -1482,6 +1484,28 @@ static void lpc17_reset(FAR struct sdio_dev_s *dev)
getreg32(LPC17_SDCARD_CLOCK), getreg32(LPC17_SDCARD_PWR));
}
/****************************************************************************
* Name: lpc17_capabilities
*
* Description:
* Get capabilities (and limitations) of the SDIO driver (optional)
*
* Input Parameters:
* dev - Device-specific state data
*
* Returned Value:
* Returns a bitset of status values (see SDIO_CAPS_* defines)
*
****************************************************************************/
static sdio_capset_t lpc17_capabilities(FAR struct sdio_dev_s *dev)
{
#ifdef CONFIG_LPC17_SDCARD_WIDTH_D1_ONLY
return SDIO_CAPS_1BIT_ONLY;
#else
return 0;
}
/****************************************************************************
* Name: lpc17_status
*
@ -1496,7 +1520,7 @@ static void lpc17_reset(FAR struct sdio_dev_s *dev)
*
****************************************************************************/
static uint8_t lpc17_status(FAR struct sdio_dev_s *dev)
static sdio_statset_t lpc17_status(FAR struct sdio_dev_s *dev)
{
struct lpc17_dev_s *priv = (struct lpc17_dev_s *)dev;
return priv->cdstatus;
@ -1569,7 +1593,7 @@ static void lpc17_clock(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate)
/* SD normal operation clocking (wide 4-bit mode) */
case CLOCK_SD_TRANSFER_4BIT:
#ifndef CONFIG_SDIO_WIDTH_D1_ONLY
#ifndef CONFIG_LPC17_SDCARD_WIDTH_D1_ONLY
clkcr = (SDCARD_CLOCK_SDWIDEXFR | SDCARD_CLOCK_CLKEN);
break;
#endif
@ -2735,7 +2759,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
#ifndef CONFIG_SDIO_MUXBUS
lpc17_configgpio(GPIO_SD_DAT0);
#ifndef CONFIG_SDIO_WIDTH_D1_ONLY
#ifndef CONFIG_LPC17_SDCARD_WIDTH_D1_ONLY
lpc17_configgpio(GPIO_SD_DAT1);
lpc17_configgpio(GPIO_SD_DAT2);
lpc17_configgpio(GPIO_SD_DAT3);
@ -2775,7 +2799,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot)
{
struct lpc17_dev_s *priv = (struct lpc17_dev_s *)dev;
uint8_t cdstatus;
sdio_statset_t cdstatus;
irqstate_t flags;
/* Update card status */
@ -2798,6 +2822,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot)
{
lpc17_callback(priv);
}
leave_critical_section(flags);
}

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/sam34/sam_hsmci.c
*
* Copyright (C) 2010, 2012-2014, 2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2010, 2012-2014, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -325,7 +325,7 @@ struct sam_dev_s
/* Callback support */
uint8_t cdstatus; /* Card status */
sdio_statset_t cdstatus; /* Card status */
sdio_eventset_t cbevents; /* Set of events to be cause callbacks */
worker_t callback; /* Registered callback function */
void *cbarg; /* Registered callback argument */
@ -464,7 +464,7 @@ static int sam_interrupt(int irq, void *context);
/* Initialization/setup */
static void sam_reset(FAR struct sdio_dev_s *dev);
static uint8_t sam_status(FAR struct sdio_dev_s *dev);
static sdio_statset_t sam_status(FAR struct sdio_dev_s *dev);
static void sam_widebus(FAR struct sdio_dev_s *dev, bool enable);
static void sam_clock(FAR struct sdio_dev_s *dev,
enum sdio_clock_e rate);
@ -519,6 +519,7 @@ struct sam_dev_s g_sdiodev =
.dev =
{
.reset = sam_reset,
.capabilities = NULL,
.status = sam_status,
.widebus = sam_widebus,
.clock = sam_clock,
@ -1470,7 +1471,7 @@ static void sam_reset(FAR struct sdio_dev_s *dev)
*
****************************************************************************/
static uint8_t sam_status(FAR struct sdio_dev_s *dev)
static sdio_statset_t sam_status(FAR struct sdio_dev_s *dev)
{
struct sam_dev_s *priv = (struct sam_dev_s *)dev;
return priv->cdstatus;
@ -2738,7 +2739,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot)
{
struct sam_dev_s *priv = (struct sam_dev_s *)dev;
uint8_t cdstatus;
sdio_statset_t cdstatus;
irqstate_t flags;
/* Update card status */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/sama5/sam_hsmci.c
*
* Copyright (C) 2013-2014, 2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2013-2014, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -407,7 +407,7 @@ struct sam_dev_s
/* Callback support */
uint8_t cdstatus; /* Card status */
sdio_statset_t cdstatus; /* Card status */
sdio_eventset_t cbevents; /* Set of events to be cause callbacks */
worker_t callback; /* Registered callback function */
void *cbarg; /* Registered callback argument */
@ -547,7 +547,7 @@ static int sam_hsmci2_interrupt(int irq, void *context);
/* Initialization/setup */
static void sam_reset(FAR struct sdio_dev_s *dev);
static uint8_t sam_status(FAR struct sdio_dev_s *dev);
static sdio_statset_t sam_status(FAR struct sdio_dev_s *dev);
static void sam_widebus(FAR struct sdio_dev_s *dev, bool enable);
static void sam_clock(FAR struct sdio_dev_s *dev,
enum sdio_clock_e rate);
@ -609,6 +609,7 @@ static void sam_callback(void *arg);
static const struct sdio_dev_s g_callbacks =
{
.reset = sam_reset,
.capabilities = NULL,
.status = sam_status,
.widebus = sam_widebus,
.clock = sam_clock,
@ -1788,7 +1789,7 @@ static void sam_reset(FAR struct sdio_dev_s *dev)
*
****************************************************************************/
static uint8_t sam_status(FAR struct sdio_dev_s *dev)
static sdio_statset_t sam_status(FAR struct sdio_dev_s *dev)
{
struct sam_dev_s *priv = (struct sam_dev_s *)dev;
return priv->cdstatus;
@ -3389,7 +3390,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot)
{
struct sam_dev_s *priv = (struct sam_dev_s *)dev;
uint8_t cdstatus;
sdio_statset_t cdstatus;
irqstate_t flags;
/* Update card status. Interrupts are disabled here because if we are

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/samv7/sam_hsmci.c
*
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2015-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -341,7 +341,7 @@ struct sam_dev_s
/* Callback support */
uint8_t cdstatus; /* Card status */
sdio_statset_t cdstatus; /* Card status */
sdio_eventset_t cbevents; /* Set of events to be cause callbacks */
worker_t callback; /* Registered callback function */
void *cbarg; /* Registered callback argument */
@ -478,7 +478,7 @@ static int sam_hsmci1_interrupt(int irq, void *context);
/* Initialization/setup */
static void sam_reset(FAR struct sdio_dev_s *dev);
static uint8_t sam_status(FAR struct sdio_dev_s *dev);
static sdio_statset_t sam_status(FAR struct sdio_dev_s *dev);
static void sam_widebus(FAR struct sdio_dev_s *dev, bool enable);
static void sam_clock(FAR struct sdio_dev_s *dev,
enum sdio_clock_e rate);
@ -540,6 +540,7 @@ static void sam_callback(void *arg);
static const struct sdio_dev_s g_callbacks =
{
.reset = sam_reset,
.capabilities = NULL,
.status = sam_status,
.widebus = sam_widebus,
.clock = sam_clock,
@ -1762,7 +1763,7 @@ static void sam_reset(FAR struct sdio_dev_s *dev)
*
****************************************************************************/
static uint8_t sam_status(FAR struct sdio_dev_s *dev)
static sdio_statset_t sam_status(FAR struct sdio_dev_s *dev)
{
struct sam_dev_s *priv = (struct sam_dev_s *)dev;
return priv->cdstatus;
@ -3410,7 +3411,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot)
{
struct sam_dev_s *priv = (struct sam_dev_s *)dev;
uint8_t cdstatus;
sdio_statset_t cdstatus;
irqstate_t flags;
/* Update card status. Interrupts are disabled here because if we are

View File

@ -6103,7 +6103,7 @@ config SDIO_DMAPRIO
For other STM32's, options are: 0x00000000 low, 0x00010000 medium,
0x00020000 high, 0x00030000 very high. Default: medium.
config SDIO_WIDTH_D1_ONLY
config STM32_SDIO_WIDTH_D1_ONLY
bool "Use D1 only"
default n
---help---

View File

@ -342,7 +342,7 @@
#define GPIO_SDIO_D0 (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN8)
#ifndef CONFIG_SDIO_WIDTH_D1_ONLY
#ifndef CONFIG_STM32_SDIO_WIDTH_D1_ONLY
# define GPIO_SDIO_D1 (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN9)
# define GPIO_SDIO_D2 (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN10)
# define GPIO_SDIO_D3 (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN11)

View File

@ -83,7 +83,7 @@
#define GPIO_SDIO_D0 (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN8)
#ifndef CONFIG_SDIO_WIDTH_D1_ONLY
#ifndef CONFIG_STM32_SDIO_WIDTH_D1_ONLY
# define GPIO_SDIO_D1 (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN9)
# define GPIO_SDIO_D2 (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN10)
# define GPIO_SDIO_D3 (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN11)

View File

@ -451,7 +451,7 @@
#define GPIO_SDIO_D0 (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN8)
#ifndef CONFIG_SDIO_WIDTH_D1_ONLY
#ifndef CONFIG_STM32_SDIO_WIDTH_D1_ONLY
# define GPIO_SDIO_D1 (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN9)
# define GPIO_SDIO_D2 (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN10)
# define GPIO_SDIO_D3 (GPIO_ALT|GPIO_CNF_AFPP|GPIO_MODE_50MHz|GPIO_PORTC|GPIO_PIN11)

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32/stm32_sdio.c
*
* Copyright (C) 2009, 2011-2014, 2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2009, 2011-2014, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -88,9 +88,9 @@
* CONFIG_SDIO_DMA - Enable SDIO. This is a marginally optional. For
* most usages, SDIO will cause data overruns if used without DMA.
* NOTE the above system DMA configuration options.
* CONFIG_SDIO_WIDTH_D1_ONLY - This may be selected to force the driver
* operate with only a single data line (the default is to use all
* 4 SD data lines).
* CONFIG_STM32_SDIO_WIDTH_D1_ONLY - This may be selected to force the
* driver operate with only a single data line (the default is to use
* all 4 SD data lines).
* CONFIG_SDIO_PRI - SDIO interrupt priority. This setting is not very
* important since interrupt nesting is not currently supported.
* CONFIG_SDM_DMAPRIO - SDIO DMA priority. This can be selecte if
@ -314,7 +314,7 @@ struct stm32_dev_s
/* Callback support */
uint8_t cdstatus; /* Card status */
sdio_statset_t cdstatus; /* Card status */
sdio_eventset_t cbevents; /* Set of events to be cause callbacks */
worker_t callback; /* Registered callback function */
void *cbarg; /* Registered callback argument */
@ -425,7 +425,8 @@ static int stm32_lock(FAR struct sdio_dev_s *dev, bool lock);
/* Initialization/setup */
static void stm32_reset(FAR struct sdio_dev_s *dev);
static uint8_t stm32_status(FAR struct sdio_dev_s *dev);
static sdio_capset_t stm32_capabilities(FAR struct sdio_dev_s *dev);
static sdio_statset_t stm32_status(FAR struct sdio_dev_s *dev);
static void stm32_widebus(FAR struct sdio_dev_s *dev, bool enable);
static void stm32_clock(FAR struct sdio_dev_s *dev,
enum sdio_clock_e rate);
@ -493,6 +494,7 @@ struct stm32_dev_s g_sdiodev =
.lock = stm32_lock,
#endif
.reset = stm32_reset,
.capabilities = stm32_capabilities,
.status = stm32_status,
.widebus = stm32_widebus,
.clock = stm32_clock,
@ -1602,6 +1604,28 @@ static void stm32_reset(FAR struct sdio_dev_s *dev)
getreg32(STM32_SDIO_CLKCR), getreg32(STM32_SDIO_POWER));
}
/****************************************************************************
* Name: stm32_capabilities
*
* Description:
* Get capabilities (and limitations) of the SDIO driver (optional)
*
* Input Parameters:
* dev - Device-specific state data
*
* Returned Value:
* Returns a bitset of status values (see SDIO_CAPS_* defines)
*
****************************************************************************/
static sdio_capset_t stm32_capabilities(FAR struct sdio_dev_s *dev)
{
#ifdef CONFIG_STM32_SDIO_WIDTH_D1_ONLY
return SDIO_CAPS_1BIT_ONLY;
#else
return 0;
}
/****************************************************************************
* Name: stm32_status
*
@ -1616,7 +1640,7 @@ static void stm32_reset(FAR struct sdio_dev_s *dev)
*
****************************************************************************/
static uint8_t stm32_status(FAR struct sdio_dev_s *dev)
static sdio_statset_t stm32_status(FAR struct sdio_dev_s *dev)
{
struct stm32_dev_s *priv = (struct stm32_dev_s *)dev;
return priv->cdstatus;
@ -1688,7 +1712,7 @@ static void stm32_clock(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate)
/* SD normal operation clocking (wide 4-bit mode) */
case CLOCK_SD_TRANSFER_4BIT:
#ifndef CONFIG_SDIO_WIDTH_D1_ONLY
#ifndef CONFIG_STM32_SDIO_WIDTH_D1_ONLY
clckr = (SDIO_CLCKR_SDWIDEXFR | SDIO_CLKCR_CLKEN);
break;
#endif
@ -2897,7 +2921,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
#ifndef CONFIG_SDIO_MUXBUS
stm32_configgpio(GPIO_SDIO_D0);
#ifndef CONFIG_SDIO_WIDTH_D1_ONLY
#ifndef CONFIG_STM32_SDIO_WIDTH_D1_ONLY
stm32_configgpio(GPIO_SDIO_D1);
stm32_configgpio(GPIO_SDIO_D2);
stm32_configgpio(GPIO_SDIO_D3);
@ -2936,7 +2960,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot)
{
struct stm32_dev_s *priv = (struct stm32_dev_s *)dev;
uint8_t cdstatus;
sdio_statset_t cdstatus;
irqstate_t flags;
/* Update card status */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32f7/stm32_sdmmc.c
*
* Copyright (C) 2009, 2011-2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2009, 2011-2017 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>
* David Sidrane <david_s5@nscdg.com>
*
@ -366,7 +366,7 @@ struct stm32_dev_s
/* Callback support */
uint8_t cdstatus; /* Card status */
sdio_statset_t cdstatus; /* Card status */
sdio_eventset_t cbevents; /* Set of events to be cause callbacks */
worker_t callback; /* Registered callback function */
void *cbarg; /* Registered callback argument */
@ -495,7 +495,7 @@ static int stm32_lock(FAR struct sdio_dev_s *dev, bool lock);
/* Initialization/setup */
static void stm32_reset(FAR struct sdio_dev_s *dev);
static uint8_t stm32_status(FAR struct sdio_dev_s *dev);
static sdio_statset_t stm32_status(FAR struct sdio_dev_s *dev);
static void stm32_widebus(FAR struct sdio_dev_s *dev, bool enable);
static void stm32_clock(FAR struct sdio_dev_s *dev,
enum sdio_clock_e rate);
@ -563,6 +563,7 @@ struct stm32_dev_s g_sdmmcdev1 =
.lock = stm32_lock,
#endif
.reset = stm32_reset,
.capabilities = NULL,
.status = stm32_status,
.widebus = stm32_widebus,
.clock = stm32_clock,
@ -619,6 +620,7 @@ struct stm32_dev_s g_sdmmcdev2 =
.lock = stm32_lock,
#endif
.reset = stm32_reset,
.capabilities = NULL,
.status = stm32_status,
.widebus = stm32_widebus,
.clock = stm32_clock,
@ -1866,7 +1868,7 @@ static void stm32_reset(FAR struct sdio_dev_s *dev)
*
****************************************************************************/
static uint8_t stm32_status(FAR struct sdio_dev_s *dev)
static sdio_statset_t stm32_status(FAR struct sdio_dev_s *dev)
{
struct stm32_dev_s *priv = (struct stm32_dev_s *)dev;
return priv->cdstatus;
@ -3276,7 +3278,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot)
{
struct stm32_dev_s *priv = (struct stm32_dev_s *)dev;
uint8_t cdstatus;
sdio_statset_t cdstatus;
irqstate_t flags;
/* Update card status */

View File

@ -739,7 +739,7 @@ M3 Wildfire-specific Configuration Options
CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
Default: Medium
CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
CONFIG_STM32_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
4-bit transfer mode.
M3 Wildfire CAN Configuration

View File

@ -157,7 +157,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# STM32 Configuration Options

View File

@ -249,7 +249,6 @@ CONFIG_KINETIS_PORTEINTS=y
#
# CONFIG_KINETIS_UARTFIFOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# Architecture Options

View File

@ -481,7 +481,7 @@ HY-Mini specific Configuration Options
CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
Default: Medium
CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
CONFIG_STM32_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
4-bit transfer mode.
CONFIG_MMCSD_HAVECARDDETECT - Select if SDIO driver card detection
is 100% accurate (it is on the HY-MiniSTM32V)

View File

@ -146,7 +146,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# STM32 Configuration Options

View File

@ -149,7 +149,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# STM32 Configuration Options

View File

@ -146,7 +146,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# STM32 Configuration Options

View File

@ -678,7 +678,7 @@ Mikroe-STM32F4-specific Configuration Options
CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
Default: Medium
CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
CONFIG_STM32_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
4-bit transfer mode.
STM32 USB OTG FS Host Driver Support

View File

@ -233,7 +233,6 @@ CONFIG_LPC17_GPDMA=y
# SDIO Configuration
#
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# Architecture Options

View File

@ -227,7 +227,6 @@ CONFIG_LPC17_GPDMA=y
# SDIO Configuration
#
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# Architecture Options

View File

@ -240,7 +240,6 @@ CONFIG_LPC17_EXTDRAMHEAP=y
# SDIO Configuration
#
# CONFIG_SDIO_DMA is not set
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# LCD device driver options

View File

@ -154,7 +154,6 @@ CONFIG_ARCH_HAVE_EXTNAND=y
CONFIG_ARCH_HAVE_EXTNOR=y
CONFIG_ARCH_HAVE_EXTSRAM0=y
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
CONFIG_ARCH_HAVE_EXTSRAM1=y
#

View File

@ -148,7 +148,6 @@ CONFIG_ARMV7A_TOOLCHAIN_CODESOURCERYW=y
# CONFIG_ARMV7A_DECODEFIQ is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
# CONFIG_USBHOST_BULK_DISABLE is not set
# CONFIG_USBHOST_INT_DISABLE is not set
CONFIG_USBHOST_ISOC_DISABLE=y

View File

@ -148,7 +148,6 @@ CONFIG_ARMV7A_TOOLCHAIN_CODESOURCERYW=y
# CONFIG_ARMV7A_DECODEFIQ is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# SAMA5 Configuration Options

View File

@ -156,7 +156,6 @@ CONFIG_ARMV7A_TOOLCHAIN_CODESOURCERYW=y
# CONFIG_ARMV7A_DECODEFIQ is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
# CONFIG_USBHOST_BULK_DISABLE is not set
# CONFIG_USBHOST_INT_DISABLE is not set
CONFIG_USBHOST_ISOC_DISABLE=y

View File

@ -163,7 +163,6 @@ CONFIG_ARMV7A_TOOLCHAIN_CODESOURCERYW=y
# CONFIG_ARMV7A_DECODEFIQ is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# SAMA5 Configuration Options

View File

@ -156,7 +156,6 @@ CONFIG_ARMV7A_TOOLCHAIN_CODESOURCERYW=y
# CONFIG_ARMV7A_DECODEFIQ is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
# CONFIG_USBHOST_BULK_DISABLE is not set
# CONFIG_USBHOST_INT_DISABLE is not set
CONFIG_USBHOST_ISOC_DISABLE=y

View File

@ -158,7 +158,6 @@ CONFIG_ARMV7A_TOOLCHAIN_CODESOURCERYW=y
# CONFIG_ARMV7A_DECODEFIQ is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
# CONFIG_USBHOST_BULK_DISABLE is not set
# CONFIG_USBHOST_INT_DISABLE is not set
CONFIG_USBHOST_ISOC_DISABLE=y

View File

@ -167,7 +167,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# SAMV7 Configuration Options

View File

@ -167,7 +167,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# SAMV7 Configuration Options

View File

@ -173,7 +173,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# SAMV7 Configuration Options

View File

@ -167,7 +167,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# SAMV7 Configuration Options

View File

@ -168,7 +168,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# SAMV7 Configuration Options

View File

@ -167,7 +167,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# SAMV7 Configuration Options

View File

@ -167,7 +167,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# SAMV7 Configuration Options

View File

@ -167,7 +167,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# SAMV7 Configuration Options

View File

@ -167,7 +167,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# SAMV7 Configuration Options

View File

@ -638,7 +638,7 @@ STM3210E-EVAL-specific Configuration Options
CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
Default: Medium
CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
CONFIG_STM32_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
4-bit transfer mode.
STM3210E-EVAL CAN Configuration

View File

@ -159,7 +159,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# STM32 Configuration Options

View File

@ -160,7 +160,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# STM32 Configuration Options

View File

@ -159,7 +159,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# STM32 Configuration Options

View File

@ -150,7 +150,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# STM32 Configuration Options

View File

@ -776,7 +776,7 @@ STM3220G-EVAL-specific Configuration Options
CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
Default: Medium
CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
CONFIG_STM32_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
4-bit transfer mode.
CONFIG_STM32_PHYADDR - The 5-bit address of the PHY on the board

View File

@ -156,7 +156,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_STACKCHECK is not set
# CONFIG_ARMV7M_ITMSYSLOG is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# STM32 Configuration Options

View File

@ -769,7 +769,7 @@ STM3240G-EVAL-specific Configuration Options
CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
Default: Medium
CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
CONFIG_STM32_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
4-bit transfer mode.
CONFIG_STM32_PHYADDR - The 5-bit address of the PHY on the board

View File

@ -157,7 +157,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_STACKCHECK is not set
# CONFIG_ARMV7M_ITMSYSLOG is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# STM32 Configuration Options

View File

@ -612,7 +612,7 @@ STM32F429I-DISCO-specific Configuration Options
CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
Default: Medium
CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
CONFIG_STM32_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
4-bit transfer mode.
STM32 USB OTG FS Host Driver Support

View File

@ -1044,7 +1044,7 @@ STM32F4Discovery-specific Configuration Options
CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
Default: Medium
CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
CONFIG_STM32_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
4-bit transfer mode.
STM32 USB OTG FS Host Driver Support

View File

@ -158,7 +158,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# STM32 Configuration Options

View File

@ -158,7 +158,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
CONFIG_SDIO_DMA=y
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
#
# STM32 Configuration Options

View File

@ -155,7 +155,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
# CONFIG_SDIO_DMA is not set
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
# CONFIG_USART6_RS485 is not set
# CONFIG_USART6_RXDMA is not set
# CONFIG_SERIAL_DISABLE_REORDERING is not set

View File

@ -426,7 +426,7 @@ STM32F746G-DISCO-specific Configuration Options
CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
Default: Medium
CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
CONFIG_STM32_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
4-bit transfer mode.
STM32 USB OTG FS Host Driver Support

View File

@ -128,6 +128,7 @@ struct mmcsd_state_s
uint8_t mode:2; /* (See MMCSDMODE_* definitions) */
uint8_t type:4; /* Card type (See MMCSD_CARDTYPE_* definitions) */
uint8_t buswidth:4; /* Bus widthes supported (SD only) */
sdio_capset_t caps; /* SDIO driver capabilities/limitations */
uint16_t selblocklen; /* The currently selected block length */
uint16_t rca; /* Relative Card Address (RCS) register */
@ -2381,12 +2382,14 @@ static void mmcsd_mediachange(FAR void *arg)
static int mmcsd_widebus(FAR struct mmcsd_state_s *priv)
{
#ifndef CONFIG_SDIO_WIDTH_D1_ONLY
int ret;
/* Check if the SD card supports this feature (as reported in the SCR) */
/* Check if the SD card supports wide bus operation (as reported in the
* SCR or in the SDIO driver capabililities)
*/
if ((priv->buswidth & MMCSD_SCR_BUSWIDTH_4BIT) != 0)
if ((priv->buswidth & MMCSD_SCR_BUSWIDTH_4BIT) != 0 &&
(priv->caps & SDIO_CAPS_1BIT_ONLY) == 0)
{
/* Disconnect any CD/DAT3 pull up using ACMD42. ACMD42 is optional and
* need not be supported by all SD calls.
@ -2453,13 +2456,6 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv)
fwarn("WARNING: Card does not support wide-bus operation\n");
return -ENOSYS;
#else /* CONFIG_SDIO_WIDTH_D1_ONLY */
finfo("Wide-bus operation is disabled\n");
return -ENOSYS;
#endif /* CONFIG_SDIO_WIDTH_D1_ONLY */
}
/****************************************************************************
@ -3131,6 +3127,10 @@ static int mmcsd_hwinitialize(FAR struct mmcsd_state_s *priv)
mmcsd_takesem(priv);
/* Get the capabilities of the SDIO driver */
priv->caps = SDIO_CAPABILITIES(priv->dev);
#ifdef CONFIG_SDIO_DMA
/* Does this architecture support DMA with the MMC/SD device? */

View File

@ -42,14 +42,6 @@
#include <nuttx/config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/sdio.h
*
* Copyright (C) 2009, 2011-2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2009, 2011-2013, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -362,6 +362,28 @@
#define SDIO_RESET(dev) ((dev)->reset(dev))
/****************************************************************************
* Name: SDIO_CAPABILITIES
*
* Description:
* Get capabilities (and limitations) of the SDIO driver (optional)
*
* Input Parameters:
* dev - Device-specific state data
*
* Returned Value:
* Returns a bitset of status values (see SDIO_CAPS_* defines)
*
****************************************************************************/
#define SDIO_CAPABILITIES(dev) \
(((dev)->status != NULL) ? (dev)->capabilities(dev) : 0)
/* SDIO capability bits */
#define SDIO_CAPS_1BIT_ONLY 0x01 /* Bit 0=1: Supports only 1-bit operation */
/****************************************************************************
* Name: SDIO_STATUS
*
@ -820,6 +842,19 @@ enum sdio_clock_e
typedef uint8_t sdio_eventset_t;
/* Capabilities set. A uint8_t is big enough to hold a set of
* 8-capabilities/limitations. If more are needed, change this to a
* uint16_t.
*/
typedef uint8_t sdio_capset_t;
/* Status set. A uint8_t is big enough to hold a set of 8 status bits.
* If more are needed, change this to a uint16_t.
*/
typedef uint8_t sdio_statset_t;
/* This structure defines the interface between the NuttX SDIO driver and
* the chip- or board-specific SDIO interface. This interface is only used
* in architectures that support SDIO 1- or 4-bit data buses. For SDIO
@ -842,7 +877,8 @@ struct sdio_dev_s
/* Initialization/setup */
void (*reset)(FAR struct sdio_dev_s *dev);
uint8_t (*status)(FAR struct sdio_dev_s *dev);
sdio_capset_t (*capabilities)(FAR struct sdio_dev_s *dev);
sdio_statset_t (*status)(FAR struct sdio_dev_s *dev);
void (*widebus)(FAR struct sdio_dev_s *dev, bool enable);
void (*clock)(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate);
int (*attach)(FAR struct sdio_dev_s *dev);