diff --git a/arch/arm/src/efm32/efm32_spi.c b/arch/arm/src/efm32/efm32_spi.c index cd96358e7b..117e664668 100644 --- a/arch/arm/src/efm32/efm32_spi.c +++ b/arch/arm/src/efm32/efm32_spi.c @@ -1070,8 +1070,8 @@ static void spi_setbits(struct spi_dev_s *dev, int nbits) * Set hardware-specific feature flags. * * Input Parameters: - * dev - Device-specific state data - * flags - H/W feature flags + * dev - Device-specific state data + * features - H/W feature flags * * Returned Value: * Zero (OK) if the selected H/W features are enabled; A negated errno @@ -1094,7 +1094,7 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features) /* Bit order is encoded by the sign of nbits */ - lsbfirst = ((hwfeatures & HWFEAT_LSBFIRST) != 0); + lsbfirst = ((features & HWFEAT_LSBFIRST) != 0); /* Has the number of bits or the bit order changed? */ @@ -1121,7 +1121,9 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features) priv->lsbfirst = lsbfirst; } - return ((hwfeatures & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS; + /* Other H/W features are not supported */ + + return ((features & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS; } #endif diff --git a/arch/arm/src/stm32/stm32_spi.c b/arch/arm/src/stm32/stm32_spi.c index 74625fa8c4..363d85dbca 100644 --- a/arch/arm/src/stm32/stm32_spi.c +++ b/arch/arm/src/stm32/stm32_spi.c @@ -1186,8 +1186,8 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits) * Set hardware-specific feature flags. * * Input Parameters: - * dev - Device-specific state data - * flags - H/W feature flags + * dev - Device-specific state data + * features - H/W feature flags * * Returned Value: * Zero (OK) if the selected H/W features are enabled; A negated errno @@ -1206,7 +1206,7 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features) /* Transfer data LSB first? */ - if ((hwfeatures & HWFEAT_LSBFIRST) != 0) + if ((features & HWFEAT_LSBFIRST) != 0) { setbits = SPI_CR1_LSBFIRST; clrbits = 0; @@ -1221,7 +1221,9 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features) spi_modifycr1(priv, setbits, clrbits); spi_modifycr1(priv, SPI_CR1_SPE, 0); - return ((hwfeatures & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS; + /* Other H/W features are not supported */ + + return ((features & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS; } #endif diff --git a/arch/arm/src/stm32f7/stm32_spi.c b/arch/arm/src/stm32f7/stm32_spi.c index fdd5221427..a2b2651ef6 100644 --- a/arch/arm/src/stm32f7/stm32_spi.c +++ b/arch/arm/src/stm32f7/stm32_spi.c @@ -1289,8 +1289,8 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits) * Set hardware-specific feature flags. * * Input Parameters: - * dev - Device-specific state data - * flags - H/W feature flags + * dev - Device-specific state data + * features - H/W feature flags * * Returned Value: * Zero (OK) if the selected H/W features are enabled; A negated errno @@ -1312,7 +1312,7 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features) /* Transfer data LSB first? */ - if ((hwfeatures & HWFEAT_LSBFIRST) != 0) + if ((features & HWFEAT_LSBFIRST) != 0) { setbits = SPI_CR1_LSBFIRST; clrbits = 0; @@ -1327,7 +1327,9 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features) spi_modifycr1(priv, setbits, clrbits); spi_modifycr1(priv, SPI_CR1_SPE, 0); - return ((hwfeatures & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS; + /* Other H/W features are not supported */ + + return ((features & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS; } #endif diff --git a/arch/arm/src/stm32l4/stm32l4_spi.c b/arch/arm/src/stm32l4/stm32l4_spi.c index da46623f10..b77a4892f2 100644 --- a/arch/arm/src/stm32l4/stm32l4_spi.c +++ b/arch/arm/src/stm32l4/stm32l4_spi.c @@ -1153,8 +1153,8 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits) * Set hardware-specific feature flags. * * Input Parameters: - * dev - Device-specific state data - * flags - H/W feature flags + * dev - Device-specific state data + * features - H/W feature flags * * Returned Value: * Zero (OK) if the selected H/W features are enabled; A negated errno @@ -1173,7 +1173,7 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features) /* Transfer data LSB first? */ - if ((hwfeatures & HWFEAT_LSBFIRST) != 0) + if ((features & HWFEAT_LSBFIRST) != 0) { setbits = SPI_CR1_LSBFIRST; clrbits = 0; @@ -1188,7 +1188,9 @@ static int spi_hwfeatures(FAR struct spi_dev_s *dev, spi_hwfeatures_t features) spi_modifycr(STM32L4_SPI_CR1_OFFSET, priv, setbits, clrbits); spi_modifycr(STM32L4_SPI_CR1_OFFSET, priv, SPI_CR1_SPE, 0); - return ((hwfeatures & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS; + /* Other H/W features are not supported */ + + return ((features & ~HWFEAT_LSBFIRST) == 0) ? OK : -ENOSYS; } #endif diff --git a/include/nuttx/spi/spi.h b/include/nuttx/spi/spi.h index 6b6ebe733e..9ef9dc40de 100644 --- a/include/nuttx/spi/spi.h +++ b/include/nuttx/spi/spi.h @@ -192,8 +192,8 @@ * Set hardware-specific feature flags. * * Input Parameters: - * dev - Device-specific state data - * flags - H/W feature flags + * dev - Device-specific state data + * features - H/W feature flags * * Returned Value: * Zero (OK) if the selected H/W features are enabled; A negated errno @@ -237,6 +237,7 @@ # define HWFEAT_ESCAPE_LASTXFER (1 << 3) # endif +# define HWFEAT_MSBFIRST (0 << 4) # define HWFEAT_LSBFIRST (1 << 4) #else