From 9fa76b36d2eb8b4c329e763e499675dee143d527 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 6 Mar 2011 15:39:02 +0000 Subject: Add support for RAMTRON NVRAM devices git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3347 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/src/stm32/stm32_spi.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'nuttx/arch/arm/src/stm32/stm32_spi.c') 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 * * 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 */ -- cgit v1.2.3