From ed1f3aec618c70375e56dde86775ae2eec0819be Mon Sep 17 00:00:00 2001 From: Michael Spahlinger Date: Tue, 28 Jun 2016 08:23:41 -0600 Subject: [PATCH] Fixed build of SAMV71-XULT/nsh. With the changes from 26f7b8c the build process of the default configuration did not succeed anymore. This is fixed by this commit. --- arch/arm/src/samv7/sam_twihs.c | 10 ++++++++-- configs/samv71-xult/nsh/defconfig | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/arch/arm/src/samv7/sam_twihs.c b/arch/arm/src/samv7/sam_twihs.c index 032d2eaa4a..0488cdddf6 100644 --- a/arch/arm/src/samv7/sam_twihs.c +++ b/arch/arm/src/samv7/sam_twihs.c @@ -283,7 +283,7 @@ static const struct twi_attr_s g_twi2attr = .pid = SAM_PID_TWIHS2, .irq = SAM_IRQ_TWIHS2, .glitchfltr = CONFIG_SAMV7_TWIHS2_GLITCH_FILTER, -#ifdef CONFIG_SAMV7_TWIHS0_SINGLE_MASTER +#ifdef CONFIG_SAMV7_TWIHS2_SINGLE_MASTER .s_master = 1, #else .s_master = 0, @@ -515,6 +515,7 @@ static int twi_wait(struct twi_dev_s *priv, unsigned int size) * all further interrupts for the TWIHS have been disabled. */ +#ifdef CONFIG_I2C_RESET /* Check if an Arbitration Lost has occured */ if (priv->result == -EUSERS) @@ -532,6 +533,7 @@ static int twi_wait(struct twi_dev_s *priv, unsigned int size) priv->result = -EIO; } } +#endif return priv->result; } @@ -646,6 +648,7 @@ static int twi_interrupt(struct twi_dev_s *priv) } } +#ifdef CONFIG_I2C_RESET /* If Single-Master Mode is enabled and we lost arbitration (someone else or * an EMC-Pulse did something on the bus) something went very wrong. So we end * the current transfer with an EUSERS. The wait function will then reset @@ -656,9 +659,10 @@ static int twi_interrupt(struct twi_dev_s *priv) { /* Wake up the thread with an Arbitration Lost error indication */ - i2cllerr("ERROR: TWIHS%d Arbitration Lost\n"); + i2cerr("ERROR: TWIHS%d Arbitration Lost\n"); twi_wakeup(priv, -EUSERS); } +#endif /* Check for errors. We must check for errors *before* checking TXRDY or * TXCMP because the error can be signaled in combination with TXRDY or @@ -945,6 +949,7 @@ static int twi_transfer(FAR struct i2c_master_s *dev, twi_setfrequency(priv, msgs->frequency); +#ifdef CONFIG_I2C_RESET /* When we are in Single Master Mode check if the bus is ready (no stuck * DATA or CLK line). * Otherwise initiate a bus reset. @@ -960,6 +965,7 @@ static int twi_transfer(FAR struct i2c_master_s *dev, goto errout; } } +#endif /* Initiate the transfer. The rest will be handled from interrupt * logic. Interrupts must be disabled to prevent re-entrance from the diff --git a/configs/samv71-xult/nsh/defconfig b/configs/samv71-xult/nsh/defconfig index b7c95d30e7..7377f2fdf1 100644 --- a/configs/samv71-xult/nsh/defconfig +++ b/configs/samv71-xult/nsh/defconfig @@ -290,6 +290,8 @@ CONFIG_SAMV7_SDRAMSIZE=2097152 # TWIHS device driver options # CONFIG_SAMV7_TWIHS0_FREQUENCY=100000 +CONFIG_SAMV7_TWIHS0_GLITCH_FILTER=0 +CONFIG_SAMV7_TWIHS0_SINGLE_MASTER=y # # HSMCI device driver options @@ -515,12 +517,13 @@ CONFIG_DEV_NULL=y # CONFIG_ARCH_HAVE_PWM_PULSECOUNT is not set # CONFIG_ARCH_HAVE_PWM_MULTICHAN is not set # CONFIG_PWM is not set -# CONFIG_ARCH_HAVE_I2CRESET is not set +CONFIG_ARCH_HAVE_I2CRESET=y CONFIG_I2C=y # CONFIG_I2C_SLAVE is not set # CONFIG_I2C_POLLED is not set # CONFIG_I2C_TRACE is not set CONFIG_I2C_DRIVER=y +CONFIG_I2C_RESET=y CONFIG_SPI=y # CONFIG_SPI_SLAVE is not set CONFIG_SPI_EXCHANGE=y