From f002980b505d68b9f0e9eb6035342e543b344452 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 27 Jan 2016 08:39:02 -0600 Subject: [PATCH] For eZ80 MCUs, rename up_spiinitialize to ez80_spibus_initialize --- arch/z80/src/ez80/ez80_spi.c | 4 ++-- arch/z80/src/ez80/ez80f91_spi.h | 36 ++++++++++++++++++++++++++++----- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/arch/z80/src/ez80/ez80_spi.c b/arch/z80/src/ez80/ez80_spi.c index fa3c519497..a2f1c4c535 100644 --- a/arch/z80/src/ez80/ez80_spi.c +++ b/arch/z80/src/ez80/ez80_spi.c @@ -419,7 +419,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t bu ****************************************************************************/ /**************************************************************************** - * Name: up_spiinitialize + * Name: ez80_spibus_initialize * * Description: * Initialize common parts the selected SPI port. Initialization of @@ -440,7 +440,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t bu * ****************************************************************************/ -FAR struct spi_dev_s *up_spiinitialize(int port) +FAR struct spi_dev_s *ez80_spibus_initialize(int port) { uint8_t regval; diff --git a/arch/z80/src/ez80/ez80f91_spi.h b/arch/z80/src/ez80/ez80f91_spi.h index ffb35c6a97..36c0016f48 100644 --- a/arch/z80/src/ez80/ez80f91_spi.h +++ b/arch/z80/src/ez80/ez80f91_spi.h @@ -100,10 +100,35 @@ extern "C" * Public Functions ************************************************************************************/ -/* The external functions, ez80_spiselect, ez80_spistatus, ans ez80_spicmddata must +/**************************************************************************** + * Name: ez80_spibus_initialize + * + * Description: + * Initialize common parts the selected SPI port. Initialization of + * chip select GPIOs must have been performed by board specific logic + * 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. Theregore, all GPIO chip management is deferred to board- + * specific logic. + * + * Input Parameter: + * Port number (for hardware that has mutiple SPI interfaces) + * + * Returned Value: + * Valid SPI device structre reference on succcess; a NULL on failure + * + ****************************************************************************/ + +FAR struct spi_dev_s *ez80_spibus_initialize(int port); + +/************************************************************************************ + * The external functions, ez80_spiselect, ez80_spistatus, ans ez80_spicmddata must * be provided by board-specific logic. These are implementations of the select, * status, and cmddata methods of the SPI interface defined by struct spi_ops_s (see - * include/nuttx/spi/spi.h). All other methods (including up_spiinitialize()) are + * include/nuttx/spi/spi.h). All other methods (including ez80_spibus_initialize()) are * provided by common logic. To use this common SPI logic on your board: * * 1. Provide ez80_spiselect() and ez80_spistatus() functions in your board-specific @@ -113,11 +138,12 @@ extern "C" * ez80_spiscmddata() function in your board-specific logic. This function will * perform cmd/data selection operations using GPIOs in the way your board is * configured. - * 3. Add a call to up_spiinitialize() in your low level initialization logic - * 4. The handle returned by up_spiinitialize() may then be used to bind the + * 3. Add a call to ez80_spibus_initialize() in your low level initialization logic + * 4. The handle returned by ez80_spibus_initialize() may then be used to bind the * SPI driver to higher level logic (e.g., calling mmcsd_spislotinitialize(), * for example, will bind the SPI driver to the SPI MMC/SD driver). - */ + * + ************************************************************************************/ void ez80_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); uint8_t ez80_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);