arch/arm/src/stm32f7: Port Bob Feritich's change (2c699d7812) to STM32 F2 and F4 which appear to have identical SD support and I/O compensation requirements.

This commit is contained in:
Gregory Nutt
2018-07-15 17:46:58 -06:00
parent 0c093f800d
commit f09f186375
9 changed files with 93 additions and 15 deletions
+19
View File
@@ -1422,6 +1422,7 @@ config STM32_LOWDENSITY
config STM32_STM32F20XX
bool
default n
select STM32_HAVE_IOCOMPENSATION
config STM32_STM32F205
bool
@@ -1570,6 +1571,7 @@ config STM32_STM32F4XXX
default n
select STM32_HAVE_SPI2
select STM32_HAVE_I2C2
select STM32_HAVE_IOCOMPENSATION
config STM32_STM32F401xBC
bool
@@ -1899,6 +1901,10 @@ config STM32_HAVE_FSMC
bool
default n
config STM32_HAVE_IOCOMPENSATION
bool
default n
config STM32_HAVE_HRTIM1
bool
default n
@@ -2752,6 +2758,19 @@ config STM32_NOEXT_VECTORS
Sometimes you may not need any Vector support beyond SysTick
and wish to save memory. This applies only to ARMv7-M architectures.
config STM32_SYSCFG_IOCOMPENSATION
bool "SYSCFG I/O Compensation"
default n
depends on STM32_HAVE_IOCOMPENSATION
---help---
By default the I/O compensation cell is not used. However when the I/O
output buffer speed is configured in 50 MHz or 100 MHz mode, it is
recommended to use the compensation cell for slew rate control on I/O
tf(IO)out)/tr(IO)out commutation to reduce the I/O noise on power supply.
The I/O compensation cell can be used only when the supply voltage ranges
from 2.4 to 3.6 V.
menu "Alternate Pin Mapping"
choice
+7 -2
View File
@@ -400,9 +400,14 @@
#define GPIO_RTC_50HZ (GPIO_ALT|GPIO_AF0|GPIO_PORTC|GPIO_PIN15)
/* SDIO */
/* SDIO
*
* Note that the below configures GPIO_SPEED_50MHz I/O, that means for using
* the SDIO that you must enable I/O Compensation via the configuration option
* CONFIG_STM32_SYSCFG_IOCOMPENSATION=y.
*/
#define GPIO_SDIO_CK (GPIO_ALT|GPIO_AF12|GPIO_PORTC|GPIO_PIN12)
#define GPIO_SDIO_CK (GPIO_ALT|GPIO_AF12|GPIO_SPEED_50MHz|GPIO_PORTC|GPIO_PIN12)
#define GPIO_SDIO_CMD (GPIO_ALT|GPIO_AF12|GPIO_PULLUP|GPIO_SPEED_50MHz|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN2)
#define GPIO_SDIO_D0 (GPIO_ALT|GPIO_AF12|GPIO_PULLUP|GPIO_SPEED_50MHz|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN8)
#define GPIO_SDIO_D1 (GPIO_ALT|GPIO_AF12|GPIO_PULLUP|GPIO_SPEED_50MHz|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN9)
+9 -4
View File
@@ -554,7 +554,12 @@
#define GPIO_RTC_50HZ (GPIO_ALT|GPIO_AF0|GPIO_PORTC|GPIO_PIN15)
/* SDIO */
/* SDIO
*
* Note that the below configures GPIO_SPEED_50MHz I/O, that means for using
* the SDIO that you must enable I/O Compensation via the configuration option
* CONFIG_STM32_SYSCFG_IOCOMPENSATION=y.
*/
#define GPIO_SDIO_CMD (GPIO_ALT|GPIO_AF12|GPIO_PULLUP|GPIO_SPEED_50MHz|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN2)
#define GPIO_SDIO_D0 (GPIO_ALT|GPIO_AF12|GPIO_PULLUP|GPIO_SPEED_50MHz|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN8)
@@ -565,14 +570,14 @@
#define GPIO_SDIO_D7 (GPIO_ALT|GPIO_AF12|GPIO_PULLUP|GPIO_SPEED_50MHz|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN7)
#if defined(CONFIG_STM32_STM32F446)
# define GPIO_SDIO_CK_1 (GPIO_ALT|GPIO_AF12|GPIO_PORTC|GPIO_PIN12)
# define GPIO_SDIO_CK_2 (GPIO_ALT|GPIO_AF12|GPIO_PORTB|GPIO_PIN2)
# define GPIO_SDIO_CK_1 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_50MHz|GPIO_PORTC|GPIO_PIN12)
# define GPIO_SDIO_CK_2 (GPIO_ALT|GPIO_AF12|GPIO_SPEED_50MHz|GPIO_PORTB|GPIO_PIN2)
# define GPIO_SDIO_D1_1 (GPIO_ALT|GPIO_AF12|GPIO_PULLUP|GPIO_SPEED_50MHz|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN9)
# define GPIO_SDIO_D1_2 (GPIO_ALT|GPIO_AF12|GPIO_PULLUP|GPIO_SPEED_50MHz|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN0)
# define GPIO_SDIO_D2_1 (GPIO_ALT|GPIO_AF12|GPIO_PULLUP|GPIO_SPEED_50MHz|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN10)
# define GPIO_SDIO_D2_2 (GPIO_ALT|GPIO_AF12|GPIO_PULLUP|GPIO_SPEED_50MHz|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN1)
#else
# define GPIO_SDIO_CK (GPIO_ALT|GPIO_AF12|GPIO_PORTC|GPIO_PIN12)
# define GPIO_SDIO_CK (GPIO_ALT|GPIO_AF12|GPIO_SPEED_50MHz|GPIO_PORTC|GPIO_PIN12)
# define GPIO_SDIO_D1 (GPIO_ALT|GPIO_AF12|GPIO_PULLUP|GPIO_SPEED_50MHz|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN9)
# define GPIO_SDIO_D2 (GPIO_ALT|GPIO_AF12|GPIO_PULLUP|GPIO_SPEED_50MHz|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN10)
#endif
-3
View File
@@ -49,9 +49,6 @@
#include <nuttx/irq.h>
#include "up_arch.h"
#include "chip.h"
#include "stm32_gpio.h"
#if defined(CONFIG_STM32_STM32L15XX) || defined(CONFIG_STM32_STM32F20XX) || \
+45
View File
@@ -51,7 +51,9 @@
#include <nuttx/irq.h>
#include "up_arch.h"
#include "chip.h"
#include "chip/stm32_syscfg.h"
#if defined(CONFIG_STM32_STM32L15XX)
# include "chip/stm32l15xxx_gpio.h"
@@ -419,6 +421,49 @@ extern "C"
EXTERN const uint32_t g_gpiobase[STM32_NGPIO_PORTS];
/************************************************************************************
* Inline Functions
************************************************************************************/
/****************************************************************************
* Name: syscfg_iocompensation
*
* Description:
* Enable I/O compensation.
*
* By default the I/O compensation cell is not used. However when the I/O
* output buffer speed is configured in 50 MHz or 100 MHz mode, it is
* recommended to use the compensation cell for slew rate control on I/O
* tf(IO)out)/tr(IO)out commutation to reduce the I/O noise on power supply.
*
* The I/O compensation cell can be used only when the supply voltage ranges
* from 2.4 to 3.6 V.
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
static inline void syscfg_iocompensation(void)
{
#ifdef STM32_SYSCFG_CMPCR
/* Enable I/O Compensation. Writing '1' to the CMPCR power-down bit
* enables the I/O compensation cell.
*/
putreg32(SYSCFG_CMPCR_CMPPD, STM32_SYSCFG_CMPCR);
/* Wait for compensation cell to become ready */
while ((getreg32(STM32_SYSCFG_CMPCR) & SYSCFG_CMPCR_READY) == 0)
{
}
#endif
}
/************************************************************************************
* Public Function Prototypes
************************************************************************************/
+7
View File
@@ -51,6 +51,7 @@
#include "up_arch.h"
#include "chip.h"
#include "stm32_gpio.h"
#include "stm32_rcc.h"
#include "stm32_rtc.h"
#include "stm32_flash.h"
@@ -198,6 +199,12 @@ void stm32_clockconfig(void)
#endif
#ifdef CONFIG_STM32_SYSCFG_IOCOMPENSATION
/* Enable I/O Compensation */
syscfg_iocompensation();
#endif
/* Enable peripheral clocking */
rcc_enableperipherals();
@@ -579,8 +579,8 @@
/* SD/MMC
*
* Note that the below configures GPIO_SPEED_50MHz I/O, that means for using
* the SDMMC, the board's boot code must enable I/O Compensation via the
* configuration option CONFIG_STM32F7_SYSCFG_IOCOMPENSATION=y.
* the SDIO that you must enable I/O Compensation via the configuration option
* CONFIG_STM32F7_SYSCFG_IOCOMPENSATION=y.
*/
#define GPIO_SDMMC1_CK (GPIO_ALT|GPIO_AF12|GPIO_SPEED_50MHz|GPIO_PORTC|GPIO_PIN12)
@@ -819,8 +819,8 @@
/* SD/MMC
*
* Note that the below configures GPIO_SPEED_50MHz I/O, that means for using
* the SDMMC, the board's boot code must enable I/O Compensation via the
* configuration option CONFIG_STM32F7_SYSCFG_IOCOMPENSATION=y.
* the SDIO that you must enable I/O Compensation via the configuration option
* CONFIG_STM32F7_SYSCFG_IOCOMPENSATION=y.
*/
#define GPIO_SDMMC1_CK (GPIO_ALT|GPIO_AF12|GPIO_SPEED_50MHz|GPIO_PORTC|GPIO_PIN12)
@@ -930,8 +930,8 @@
/* SD/MMC
*
* Note that the below configures GPIO_SPEED_50MHz I/O, that means for using
* the SDMMC, the board's boot code must enable I/O Compensation via the
* configuration option CONFIG_STM32F7_SYSCFG_IOCOMPENSATION=y.
* the SDIO that you must enable I/O Compensation via the configuration option
* CONFIG_STM32F7_SYSCFG_IOCOMPENSATION=y.
*/
#define GPIO_SDMMC1_CK (GPIO_ALT|GPIO_AF12|GPIO_SPEED_50MHz|GPIO_PORTC|GPIO_PIN12)