diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-03-06 15:39:02 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-03-06 15:39:02 +0000 |
commit | 9fa76b36d2eb8b4c329e763e499675dee143d527 (patch) | |
tree | 189cfec40a0599ca60497ac94d137f9f1231dae2 /nuttx/arch/arm/src/stm32/stm32_spi.c | |
parent | 517ae43b4f1c1eaf64137a5a6d0d79f3e26608af (diff) | |
download | px4-nuttx-9fa76b36d2eb8b4c329e763e499675dee143d527.tar.gz px4-nuttx-9fa76b36d2eb8b4c329e763e499675dee143d527.tar.bz2 px4-nuttx-9fa76b36d2eb8b4c329e763e499675dee143d527.zip |
Add support for RAMTRON NVRAM devices
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3347 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/stm32/stm32_spi.c')
-rwxr-xr-x | nuttx/arch/arm/src/stm32/stm32_spi.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_spi.c b/nuttx/arch/arm/src/stm32/stm32_spi.c index d04b1aef0..1317ef094 100755 --- a/nuttx/arch/arm/src/stm32/stm32_spi.c +++ b/nuttx/arch/arm/src/stm32/stm32_spi.c @@ -1,7 +1,7 @@ /************************************************************************************ * arm/arm/src/stm32/stm32_spi.c * - * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -760,6 +760,13 @@ static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency) uint16_t setbits; uint32_t actual; + /* Limit to max possible (if STM32_SPI_CLK_MAX is defined in board.h) */ + + if (frequency > STM32_SPI_CLK_MAX) + { + frequency = STM32_SPI_CLK_MAX; + } + /* Has the frequency changed? */ #ifndef CONFIG_SPI_OWNBUS @@ -1286,7 +1293,7 @@ FAR struct spi_dev_s *up_spiinitialize(int port) flags = irqsave(); #ifdef CONFIG_STM32_SPI1 - if (port == 0) + if (port == 1) { uint32_t mapr; @@ -1317,7 +1324,7 @@ FAR struct spi_dev_s *up_spiinitialize(int port) else #endif #ifdef CONFIG_STM32_SPI2 - if (port == 1) + if (port == 2) { /* Select SPI2 */ |