You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/03/07 08:59:30 UTC

[incubator-nuttx] branch master updated: arch/z80/src/ez80/ez80_spi.c: Correct oversight in previous commit

This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 78563d5  arch/z80/src/ez80/ez80_spi.c:  Correct oversight in previous commit
78563d5 is described below

commit 78563d555ab5794faa0d039900578a27944a2bf0
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Fri Mar 6 17:52:50 2020 -0600

    arch/z80/src/ez80/ez80_spi.c:  Correct oversight in previous commit
    
    Commit 797e45d6bfc467743a3ff350858d2169cad5126e attempted to reduce the frequency of SPI reconfiguration by keeping track of the current frequency and mode settings and changing these settings only when the new settings differ from the old settings.
    
    However, the original commit neglected to save the new frequency setting and, hence, was not effective in what it was trying to do:  Every time the SPI setfrequency() method was called, it still looked like a new frequency and the frequency was still reconfigured, even though it hadn't really changed.
---
 arch/z80/src/ez80/ez80_spi.c    | 11 ++++++-----
 boards/z80/ez80/z20x/src/z20x.h |  4 ----
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/arch/z80/src/ez80/ez80_spi.c b/arch/z80/src/ez80/ez80_spi.c
index fdb9ba0..f46b4a5 100644
--- a/arch/z80/src/ez80/ez80_spi.c
+++ b/arch/z80/src/ez80/ez80_spi.c
@@ -236,7 +236,8 @@ static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev,
       outp(EZ80_SPI_BRG_L, brg & 0xff);
       outp(EZ80_SPI_BRG_H, (brg >> 8) & 0xff);
 
-      g_spi_actual = ((EZ80_SYS_CLK_FREQ + 1) / 2 + brg - 1) / brg;
+      g_spi_frequency = frequency;
+      g_spi_actual    = ((EZ80_SYS_CLK_FREQ + 1) / 2 + brg - 1) / brg;
 
       finfo("BRG=%lu Actual=%lu\n",
             (unsigned long)brg, (unsigned long)g_spi_actual);
@@ -580,10 +581,10 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer,
  *   prior to calling this function.  Specifically:  GPIOs should have
  *   been configured for output, and all chip selects disabled.
  *
- *   One GPIO, SS (PB2 on the eZ8F091) is reserved as a chip select.  However,
- *   If multiple devices on on the bus, then multiple chip selects will be
- *   required.  Therefore, all GPIO chip management is deferred to board-
- *   specific logic.
+ *   One GPIO, SS (PB2 on the eZ8F091) is reserved as a chip select.
+ *   However, if multiple devices on on the bus, then multiple chip
+ *   selects will be required.  Therefore, all GPIO chip management is
+ *   deferred to board-specific logic.
  *
  * Input Parameters:
  *   Port number (for hardware that has multiple SPI interfaces)
diff --git a/boards/z80/ez80/z20x/src/z20x.h b/boards/z80/ez80/z20x/src/z20x.h
index 64bc9ce..38c71c3 100644
--- a/boards/z80/ez80/z20x/src/z20x.h
+++ b/boards/z80/ez80/z20x/src/z20x.h
@@ -86,10 +86,6 @@
  * Chip select 3 is not used
  */
 
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
 /* RAM Memory map
  *
  * 040000              Beginning of RAM