Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There are many references to CONFIG_SPI_DMAPRIO in the kernel but it is not defined in none Kconfig or source file #11932

Open
acassis opened this issue Mar 17, 2024 · 6 comments

Comments

@acassis
Copy link
Contributor

acassis commented Mar 17, 2024

I think a modification at some eons damaged few SPI drivers, there are references to CONFIG_SPI_DMAPRIO but without any definition of it.

I didn't investigate further, but probably some boards could be non-functional now.

$ git grep CONFIG_SPI_DMAPRIO
arch/arm/src/at32/at32_spi.c:#  if defined(CONFIG_SPI_DMAPRIO)
arch/arm/src/at32/at32_spi.c:#    define SPI_DMA_PRIO  CONFIG_SPI_DMAPRIO
arch/arm/src/at32/at32_spi.c:#      error "Illegal value for CONFIG_SPI_DMAPRIO"
arch/arm/src/stm32/stm32_i2s.c:#  if defined(CONFIG_SPI_DMAPRIO)
arch/arm/src/stm32/stm32_i2s.c:#    define SPI_DMA_PRIO  CONFIG_SPI_DMAPRIO
arch/arm/src/stm32/stm32_i2s.c:#      error "Illegal value for CONFIG_SPI_DMAPRIO"
arch/arm/src/stm32/stm32_i2s.c:#      error "Illegal value for CONFIG_SPI_DMAPRIO"
arch/arm/src/stm32/stm32_spi.c:#  if defined(CONFIG_SPI_DMAPRIO)
arch/arm/src/stm32/stm32_spi.c:#    define SPI_DMA_PRIO  CONFIG_SPI_DMAPRIO
arch/arm/src/stm32/stm32_spi.c:#      error "Illegal value for CONFIG_SPI_DMAPRIO"
arch/arm/src/stm32/stm32_spi.c:#      error "Illegal value for CONFIG_SPI_DMAPRIO"
arch/arm/src/stm32f0l0g0/stm32_spi.c:#  if defined(CONFIG_SPI_DMAPRIO)
arch/arm/src/stm32f0l0g0/stm32_spi.c:#    define SPI_DMA_PRIO  CONFIG_SPI_DMAPRIO
arch/arm/src/stm32f0l0g0/stm32_spi.c:#    error "Illegal value for CONFIG_SPI_DMAPRIO"
arch/arm/src/stm32f7/stm32_spi.c:#  if defined(CONFIG_SPI_DMAPRIO)
arch/arm/src/stm32f7/stm32_spi.c:#    define SPI_DMA_PRIO  CONFIG_SPI_DMAPRIO
arch/arm/src/stm32f7/stm32_spi.c:#    error "Illegal value for CONFIG_SPI_DMAPRIO"
arch/arm/src/stm32h7/stm32_spi.c:#  if defined(CONFIG_SPI_DMAPRIO)
arch/arm/src/stm32h7/stm32_spi.c:#    define SPI_DMA_PRIO  CONFIG_SPI_DMAPRIO
arch/arm/src/stm32h7/stm32_spi.c:#    error "Illegal value for CONFIG_SPI_DMAPRIO"
arch/arm/src/stm32h7/stm32_spi_slave.c:#  if defined(CONFIG_SPI_DMAPRIO)
arch/arm/src/stm32h7/stm32_spi_slave.c:#    define SPI_DMA_PRIO  CONFIG_SPI_DMAPRIO
arch/arm/src/stm32h7/stm32_spi_slave.c:#    error "Illegal value for CONFIG_SPI_DMAPRIO"
arch/arm/src/stm32l4/stm32l4_spi.c:#  if defined(CONFIG_SPI_DMAPRIO)
arch/arm/src/stm32l4/stm32l4_spi.c:#    define SPI_DMA_PRIO  CONFIG_SPI_DMAPRIO
arch/arm/src/stm32l4/stm32l4_spi.c:#    error "Illegal value for CONFIG_SPI_DMAPRIO"
arch/arm/src/stm32l5/stm32l5_spi.c:#  if defined(CONFIG_SPI_DMAPRIO)
arch/arm/src/stm32l5/stm32l5_spi.c:#    define SPI_DMA_PRIO  CONFIG_SPI_DMAPRIO
arch/arm/src/stm32l5/stm32l5_spi.c:#    error "Illegal value for CONFIG_SPI_DMAPRIO"
arch/arm/src/stm32u5/stm32_spi.c:#  if defined(CONFIG_SPI_DMAPRIO)
arch/arm/src/stm32u5/stm32_spi.c:#    define SPI_DMA_PRIO  CONFIG_SPI_DMAPRIO
arch/arm/src/stm32u5/stm32_spi.c:#    error "Illegal value for CONFIG_SPI_DMAPRIO"
arch/arm/src/stm32wb/stm32wb_spi.c:#  if defined(CONFIG_SPI_DMAPRIO)
arch/arm/src/stm32wb/stm32wb_spi.c:#    define SPI_DMA_PRIO  CONFIG_SPI_DMAPRIO
arch/arm/src/stm32wb/stm32wb_spi.c:#    error "Illegal value for CONFIG_SPI_DMAPRIO"
arch/arm/src/stm32wl5/stm32wl5_spi.c:#  if defined(CONFIG_SPI_DMAPRIO)
arch/arm/src/stm32wl5/stm32wl5_spi.c:#    define SPI_DMA_PRIO  CONFIG_SPI_DMAPRIO
arch/arm/src/stm32wl5/stm32wl5_spi.c:#      error "Illegal value

Or maybe people started copying it blindly from stm32_spi.c. This is a point of attention. @raiden00pl did you notice it?

@raiden00pl
Copy link
Contributor

I think this is more common problem. You can find many ifdefs with the DMAPRIO phrase that are missing in Kconfig and it's been like that since I started using NuttX. I have no idea what the story is behind these :)

@raiden00pl
Copy link
Contributor

Another problem are definitions like this:

#ifde CONFIG_XXX
#  define CONFIG_XXX something
#endif

where CONFIG_XXX is not defined in Kconfig at all. There are many places like this in the code. Such definitions should be handled by the default statement in Kconfig.

@acassis
Copy link
Contributor Author

acassis commented Mar 18, 2024

Another problem are definitions like this:

#ifde CONFIG_XXX
#  define CONFIG_XXX something
#endif

where CONFIG_XXX is not defined in Kconfig at all. There are many places like this in the code. Such definitions should be handled by the default statement in Kconfig.

Agree!

@acassis
Copy link
Contributor Author

acassis commented Mar 18, 2024

I think this is more common problem. You can find many ifdefs with the DMAPRIO phrase that are missing in Kconfig and it's been like that since I started using NuttX. I have no idea what the story is behind these :)

Maybe @patacongo knows what happened to that definition.

@patacongo
Copy link
Contributor

patacongo commented Mar 18, 2024

For STM32, it looks like the the configuration never existed. It looks like I cloned it from somewhere else in:

   git blame stm32_spi.c
   git show f0b1643958b

Where

commit f0b1643958bbe42b1c51c7946c5dc78bda2ac014
Author: patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>
Date:   Fri Aug 10 22:01:12 2012 +0000

    STM32 SDIO DMA setup was losing DMA priority

git-svn-id: svn:https://svn.code.sf.net/p/nuttx/code/trunk@5019 42af7a65-404d-4744-a932-0658087f49c3

The above is an old SVN commit that github will not recognize, probably because of the weird email address? That bogus email address was created when the original CVS repository was converted to SVN. Github won't report anything about NuttX before 2012 or 2013 when NuttX was moved to a SourceForge GIT repository, even though the actual history goes back to 2007.

CONFIG_SPI_DMAPRIO did not exist then (and probably never existed):

   git checkout f0b1643958b
   find . -name Kconfig |xargs grep SPI_DMAPRIO

There is only a single definition of a DMAPRIO in all of the Kconfigs (for SDIO).

@patacongo
Copy link
Contributor

There is only a single DMA priority for SPI. If I wanted multiple SPI DMAs with different priorities, a single SPI_DMAPRIO value would not support that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants