davids5 commented on issue #1570:
URL: https://github.com/apache/nuttx/issues/1570#issuecomment-1500289598

   While some solutions were discussed in
   - https://github.com/apache/nuttx/pull/5012
   
   I would like to propose a solution for this issue as a request for comment:
   
   1. That will not effect any existing boards
   2. Will allow us to fix the issues without forcing massive changes.
   3. Eventually after N more releases of NuttX deprecate the solution.
   
   Steps to get there:
   
   1. Kconfig for all effected arches will have STM32xxx_USE_LEGACY_PINMAP set 
to yes as a default.
   2. Rework top level pinmap files E.G. hardware/stm32_pinmap.h. 
   3. The current pinmap file will be renamed with `_legacy`  E.G. 
hardware/stm32h7x3xx_pinmap_legacy.h
   3. Rework chip specific files removing speeds and adding _0 to the previous 
no-selectable pins with speeds
   4. Rework chip specific files adding _0 to the previous no-selectable pins
   
   The `hardware/stm32_pinmap.h` will have the following structure
   
   ```
   #if defined(STM32H7_USE_LEGACY_PINMAP )
   #  if defined(CONFIG_STM32H7_STM32H7X3XX)
   #    include "hardware/stm32h7x3xx_pinmap_legacy.h"
   #  elif defined(CONFIG_STM32H7_STM32H7X7XX)
   #    include "hardware/stm32h7x3xx_pinmap_legacy.h"
   #  else
   #     error "Unsupported STM32 H7 Legacy Pin map"
   #  endif
   #else
   #  if defined(CONFIG_STM32H7_STM32H7X3XX)
   #    include "hardware/stm32h7x3xx_pinmap.h"
   #  elif defined(CONFIG_STM32H7_STM32H7X7XX)
   #    include "hardware/stm32h7x3xx_pinmap.h"
   #  else
   #     error "Unsupported STM32 H7 Pin map"
   #  endif
   # endif
   
   ```
   
   Moving forward boards will turn off STM32xx_USE_LEGACY_PINMAP and update the 
board.h files to fully define
   the pins with selected speeds.
   
   was:
   ```
   #define GPIO_SDMMC2_CK   GPIO_SDMMC2_CK_1  /* PD6  FC_PD6_SDMMC2_CK  */
   #define GPIO_SDMMC2_CMD  GPIO_SDMMC2_CMD_1 /* PD7  FC_PD7_SDMMC2_CMD */
   //      GPIO_SDMMC2_D0   No Remap          /* PB14 FC_PB14_SDMMC2_D0 */
   //      GPIO_SDMMC2_D1   No Remap          /* PB15 FC_PB15_SDMMC2_D1 */
   #define GPIO_SDMMC2_D2   GPIO_SDMMC2_D2_1  /* PG11 FC_PG11_SDMMC2_D2 */
   //      GPIO_SDMMC2_D3    No Remap         /* PB4  FC_PB4_SDMMC2_D3  */
   ```
   is:
   ```
   #define GPIO_SDMMC2_CK      (GPIO_SDMMC2_CK_1    |  GPIO_SPEED_25MHz)  /* 
PD6  FC_PD6_SDMMC2_CK  */
   #define GPIO_SDMMC2_CMD  (GPIO_SDMMC2_CMD_1 |  GPIO_SPEED_2MHz)  /* PD7  
FC_PD7_SDMMC2_CMD */
   #define GPIO_SDMMC2_D0   (GPIO_SDMMC2_D0_0  | GPIO_SPEED_2MHz) /* PB14 
FC_PB14_SDMMC2_D0 */
   #define GPIO_SDMMC2_D1   (GPIO_SDMMC2_D1_0  |  GPIO_SPEED_2MHz)/* PB15 
FC_PB15_SDMMC2_D1 */
   #define GPIO_SDMMC2_D2    GPIO_SDMMC2_D2_1  | GPIO_SPEED_2MHz)  /* PG11 
FC_PG11_SDMMC2_D2 */
   #define GPIO_SDMMC2_D3   (GPIO_SDMMC2_D3_0  | GPIO_SPEED_2MHz) /* PB4  
FC_PB4_SDMMC2_D3  */
   ```
   
   To maintain the speed that was set in the legacy files just diff the 
`_legacy` file with the non legacy file and use that
   speed when creating the #define.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to