You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by TimH <ti...@jti.uk.com.INVALID> on 2022/11/22 14:35:16 UTC

SAMA5D2 Flexcom SPI

A year or 2 ago I added flexcom SPI support to the SAMA5D2 but was not
confident enough to submit it via PR, and then had to put the project down
for a while anyway. I'm back at it now, but I see that since then the
underlying support for the main SPI has been changed a little to use, for
example, mutex locks rather than semaphores, which is a good thing.

Originally, I believe I copied the relevant sam_spi.c  file to
sam_flexcom_spi.c and changed all the function names to include "flexcom",
as well as amending it to correctly sift through the 5 possible flexcom
ports to set it all up right, etc. Plus fleshing out
hardware/sam_flexcom_spi.h with the missing register definitions etc.

Looking at it now, with a bit more experience, and despite the NuttX mantra
that code duplication is OK, I am thinking that the core operations are so
similar that it would be perhaps neater to enhance sam_spi.c to include the
flexcom stuff.

What do people think? I need to rework what I've done anyway, so it might as
well be done in what's perceived as the "best" way :-)