summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mauderer <christian.mauderer@embedded-brains.de>2021-09-28 14:19:47 +0200
committerChristian Mauderer <christian.mauderer@embedded-brains.de>2021-10-06 10:24:03 +0200
commit1fc3f171270b651ae871e5131da55b5825a11686 (patch)
treeaa3210dd1a10f6a6d375a184332b3587cfd57a9b
parent38c2147759d1b687a7330419a04a6c84d80b784a (diff)
downloadrtems-1fc3f171270b651ae871e5131da55b5825a11686.tar.bz2
bsp/imx: Add cs_change support to SPI
-rw-r--r--bsps/arm/imx/spi/imx-ecspi.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/bsps/arm/imx/spi/imx-ecspi.c b/bsps/arm/imx/spi/imx-ecspi.c
index 1ffc4d9798..243f508d51 100644
--- a/bsps/arm/imx/spi/imx-ecspi.c
+++ b/bsps/arm/imx/spi/imx-ecspi.c
@@ -351,6 +351,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 +380,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 +408,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;
}