diff options
Diffstat (limited to 'bsps/arm/imx/spi/imx-ecspi.c')
-rw-r--r-- | bsps/arm/imx/spi/imx-ecspi.c | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/bsps/arm/imx/spi/imx-ecspi.c b/bsps/arm/imx/spi/imx-ecspi.c index 1ffc4d9798..7624bfdd3e 100644 --- a/bsps/arm/imx/spi/imx-ecspi.c +++ b/bsps/arm/imx/spi/imx-ecspi.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2017 embedded brains GmbH. All rights reserved. + * Copyright (c) 2017 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <info@embedded-brains.de> + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <bsp.h> @@ -351,6 +364,9 @@ static void imx_ecspi_interrupt(void *arg) } else if (bus->in_transfer > 0) { regs->intreg = IMX_ECSPI_RR; } else { + if (bus->msg->cs_change) { + imx_ecspi_set_chipsel(bus, IMX_ECSPI_CS_NONE); + } --bus->msg_todo; ++bus->msg; imx_ecspi_next_msg(bus, regs); @@ -377,9 +393,6 @@ static int imx_ecspi_check_messages( (msg->cs > IMX_ECSPI_MAX_CHIPSELECTS || !bus->cspins[msg->cs].valid)) { return -EINVAL; } - if (msg->cs_change != 0) { - return -EINVAL; - } ++msg; --size; @@ -408,7 +421,9 @@ static int imx_ecspi_transfer( imx_ecspi_next_msg(bus, bus->regs); rtems_event_transient_receive(RTEMS_WAIT, RTEMS_NO_TIMEOUT); - imx_ecspi_set_chipsel(bus, IMX_ECSPI_CS_NONE); + if (msgs[n-1].cs_change) { + imx_ecspi_set_chipsel(bus, IMX_ECSPI_CS_NONE); + } } return rv; } |