af28821c77
group boards by architecture * z80: group boards by architecture all boards that share the same architecture are moved to the same arch folder following the soc layout Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com> * z16: group boards by architecture all boards that share the same architecture are moved to the same arch folder following the soc layout Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com> * xtensa: group boards by architecture all boards that share the same architecture are moved to the same arch folder following the soc layout Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com> * x86: group boards by architecture all boards that share the same architecture are moved to the same arch folder following the soc layout Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com> * sim: group boards by architecture all boards that share the same architecture are moved to the same arch folder following the soc layout Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com> * risc-v: group boards by architecture all boards that share the same architecture are moved to the same arch folder following the soc layout Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com> * renesas: group boards by architecture all boards that share the same architecture are moved to the same arch folder following the soc layout Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com> * or1k: group boards by architecture all boards that share the same architecture are moved to the same arch folder following the soc layout Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com> * misoc: group boards by architecture all boards that share the same architecture are moved to the same arch folder following the soc layout Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com> * mips: group boards by architecture all boards that share the same architecture are moved to the same arch folder following the soc layout Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com> * hc: group boards by architecture all boards that share the same architecture are moved to the same arch folder following the soc layout Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com> * avr: group boards by architecture all boards that share the same architecture are moved to the same arch folder following the soc layout Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com> * arm: group boards by architecture all boards that share the same architecture are moved to the same arch folder following the soc layout Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com> * boards: group boards by architecture Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com> Approved-by: Gregory Nutt <gnutt@nuttx.org>
186 lines
5.3 KiB
C
186 lines
5.3 KiB
C
/****************************************************************************
|
|
* config/imxrt1060-evk/src/imxrt_bringup.c
|
|
*
|
|
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
|
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
|
* David Sidrane <david_s5@nscdg.com>
|
|
*
|
|
* 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.
|
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
* used to endorse or promote products derived from this software
|
|
* without specific prior written permission.
|
|
*
|
|
* 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.
|
|
*
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
* Included Files
|
|
****************************************************************************/
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <sys/mount.h>
|
|
#include <sys/types.h>
|
|
#include <debug.h>
|
|
|
|
#include <syslog.h>
|
|
#include <nuttx/i2c/i2c_master.h>
|
|
#include <imxrt_lpi2c.h>
|
|
#include <imxrt_lpspi.h>
|
|
|
|
#ifdef CONFIG_IMXRT_USDHC
|
|
# include "imxrt_usdhc.h"
|
|
#endif
|
|
|
|
#include "imxrt1060-evk.h"
|
|
|
|
#include <arch/board/board.h> /* Must always be included last */
|
|
|
|
/****************************************************************************
|
|
* Pre-processor Definitions
|
|
****************************************************************************/
|
|
|
|
/* Checking needed by MMC/SDCard */
|
|
|
|
#ifdef CONFIG_NSH_MMCSDMINOR
|
|
# define MMCSD_MINOR CONFIG_NSH_MMCSDMINOR
|
|
#else
|
|
# define MMCSD_MINOR 0
|
|
#endif
|
|
|
|
/****************************************************************************
|
|
* Private Functions
|
|
****************************************************************************/
|
|
|
|
#if defined(CONFIG_I2C_DRIVER) && defined(CONFIG_IMXRT_LPI2C)
|
|
static void imxrt_i2c_register(int bus)
|
|
{
|
|
FAR struct i2c_master_s *i2c;
|
|
int ret;
|
|
|
|
i2c = imxrt_i2cbus_initialize(bus);
|
|
if (i2c == NULL)
|
|
{
|
|
serr("ERROR: Failed to get I2C%d interface\n", bus);
|
|
}
|
|
else
|
|
{
|
|
ret = i2c_register(i2c, bus);
|
|
if (ret < 0)
|
|
{
|
|
serr("ERROR: Failed to register I2C%d driver: %d\n", bus, ret);
|
|
imxrt_i2cbus_uninitialize(i2c);
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#ifdef CONFIG_IMXRT_USDHC
|
|
static int nsh_sdmmc_initialize(void)
|
|
{
|
|
struct sdio_dev_s *sdmmc;
|
|
int ret = 0;
|
|
|
|
/* Get an instance of the SDIO interface */
|
|
|
|
sdmmc = imxrt_usdhc_initialize(0);
|
|
if (!sdmmc)
|
|
{
|
|
syslog(LOG_ERR, "ERROR: Failed to initialize SD/MMC\n");
|
|
}
|
|
else
|
|
{
|
|
/* Bind the SDIO interface to the MMC/SD driver */
|
|
|
|
ret = mmcsd_slotinitialize(0, sdmmc);
|
|
if (ret != OK)
|
|
{
|
|
syslog(LOG_ERR,
|
|
"ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n",
|
|
ret);
|
|
}
|
|
}
|
|
return OK;
|
|
}
|
|
#else
|
|
# define nsh_sdmmc_initialize() (OK)
|
|
#endif
|
|
|
|
/****************************************************************************
|
|
* Public Functions
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
* Name: imxrt_bringup
|
|
*
|
|
* Description:
|
|
* Bring up board features
|
|
*
|
|
****************************************************************************/
|
|
|
|
int imxrt_bringup(void)
|
|
{
|
|
int ret;
|
|
|
|
/* If we got here then perhaps not all initialization was successful, but
|
|
* at least enough succeeded to bring-up NSH with perhaps reduced
|
|
* capabilities.
|
|
*/
|
|
|
|
#ifdef CONFIG_FS_PROCFS
|
|
/* Mount the procfs file system */
|
|
|
|
ret = mount(NULL, "/proc", "procfs", 0, NULL);
|
|
if (ret < 0)
|
|
{
|
|
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
|
|
}
|
|
#endif
|
|
|
|
#if defined(CONFIG_I2C_DRIVER) && defined(CONFIG_IMXRT_LPI2C1)
|
|
imxrt_i2c_register(1);
|
|
#endif
|
|
|
|
#ifdef CONFIG_IMXRT_USDHC
|
|
/* Initialize SDHC-base MMC/SD card support */
|
|
|
|
nsh_sdmmc_initialize();
|
|
#endif
|
|
|
|
#ifdef CONFIG_MMCSD_SPI
|
|
/* Initialize SPI-based MMC/SD card support */
|
|
|
|
imxrt_spidev_initialize();
|
|
|
|
ret = imxrt_mmcsd_spi_initialize(MMCSD_MINOR);
|
|
if (ret < 0)
|
|
{
|
|
syslog(LOG_ERR, "ERROR: Failed to initialize SD slot %d: %d\n", ret);
|
|
}
|
|
#endif
|
|
|
|
UNUSED(ret);
|
|
return OK;
|
|
}
|