Merged in alinjerpelea/nuttx (pull request #1024)

noards: arm: cxd56xx: migrate common code

* boards: arm: cxd56xx: common: move boot to common

    This is a common function and can be reused by all boards.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: arm: cxd56xx: common: move flash to common

    This is a common function and can be reused by all boards.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: arm: cxd56xx: common: move I2C driver to common

    This is a common function and can be reused by all boards.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: arm: cxd56xx: common: move uid to common

    This is a common function and can be reused by all boards.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: arm: cxd56xx: common: move usbmsc to common

    This is a common function and can be reused by all boards.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* arch: arm: cxd56: add SPH

    The SPH is used by the ASMP implementation from the SDK.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Alin Jerpelea
2019-08-26 14:29:55 +00:00
committed by Gregory Nutt
parent f9e80c4a1e
commit 3806a01c5d
12 changed files with 487 additions and 22 deletions
@@ -33,7 +33,6 @@
############################################################################
CSRCS += cxd56_main.c
CSRCS += cxd56_boot.c
CSRCS += cxd56_clock.c
CSRCS += cxd56_bringup.c
@@ -46,10 +45,6 @@ ifeq ($(CONFIG_BOARDCTL_IOCTL),y)
CSRCS += cxd56_ioctl.c
endif
ifeq ($(CONFIG_BOARDCTL_UNIQUEID),y)
CSRCS += cxd56_uid.c
endif
ifeq ($(CONFIG_ARCH_FPU),y)
CSRCS += cxd56_ostest.c
endif
@@ -74,10 +69,6 @@ ifeq ($(CONFIG_CXD56_PWM),y)
CSRCS += cxd56_pwm.c
endif
ifeq ($(CONFIG_CXD56_SFC),y)
CSRCS += cxd56_flash.c
endif
ifeq ($(CONFIG_SPI),y)
CSRCS += cxd56_spi.c
endif
@@ -94,18 +85,10 @@ ifeq ($(CONFIG_CXD56_CHARGER),y)
CSRCS += cxd56_charger.c
endif
ifeq ($(CONFIG_USBMSC),y)
CSRCS += cxd56_usbmsc.c
endif
ifeq ($(CONFIG_USBDEV_COMPOSITE),y)
CSRCS += cxd56_composite.c
endif
ifeq ($(CONFIG_CXD56_I2C_DRIVER),y)
CSRCS += cxd56_i2cdev.c
endif
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += $(shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)
@@ -1,71 +0,0 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/src/cxd56_boot.c
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* 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 of Sony Semiconductor Solutions Corporation 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 <debug.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "up_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: cxd56_boardinitialize
*
* Description:
*
****************************************************************************/
void cxd56_boardinitialize(void)
{
}
@@ -1,133 +0,0 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/src/cxd56_flash.c
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* 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 of Sony Semiconductor Solutions Corporation 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 <stdio.h>
#include <errno.h>
#include <debug.h>
#include <sys/mount.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include <nuttx/mtd/mtd.h>
#ifdef CONFIG_FS_NXFFS
# include <nuttx/fs/nxffs.h>
#endif
#include "cxd56_sfc.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifndef CONFIG_SFC_DEVNO
# define CONFIG_SFC_DEVNO 0
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_flash_initialize
*
* Description:
* Initialize the SPI-Flash device and mount the file system.
*
****************************************************************************/
int board_flash_initialize(void)
{
int ret;
FAR struct mtd_dev_s *mtd;
mtd = cxd56_sfc_initialize();
if (!mtd)
{
ferr("ERROR: Failed to initialize SFC. %d\n ", ret);
return -ENODEV;
}
/* use the FTL layer to wrap the MTD driver as a block driver */
ret = ftl_initialize(CONFIG_SFC_DEVNO, mtd);
if (ret < 0)
{
ferr("ERROR: Initializing the FTL layer: %d\n", ret);
return ret;
}
#if defined(CONFIG_FS_SMARTFS)
/* Initialize to provide SMARTFS on the MTD interface */
ret = smart_initialize(CONFIG_SFC_DEVNO, mtd, NULL);
if (ret < 0)
{
ferr("ERROR: SmartFS initialization failed: %d\n", ret);
return ret;
}
ret = mount("/dev/smart0d1", "/mnt/spif", "smartfs", 0, NULL);
if (ret < 0)
{
ferr("ERROR: Failed to mount the SmartFS volume: %d\n", errno);
return ret;
}
#elif defined(CONFIG_FS_NXFFS)
/* Initialize to provide NXFFS on the MTD interface */
ret = nxffs_initialize(mtd);
if (ret < 0)
{
ferr("ERROR: NXFFS initialization failed: %d\n", ret);
return ret;
}
ret = mount(NULL, "/mnt/spif", "nxffs", 0, NULL);
if (ret < 0)
{
ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno);
return ret;
}
#endif
return OK;
}
@@ -1,79 +0,0 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/src/cxd56_i2cdev.c
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* 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 of Sony Semiconductor Solutions Corporation 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 <stdio.h>
#include <debug.h>
#include <errno.h>
#include "cxd56_i2c.h"
/****************************************************************************
* Name: board_i2cdev_initialize
*
* Description:
* Initialize and register i2c driver for the specified i2c port
*
****************************************************************************/
int board_i2cdev_initialize(int port)
{
int ret;
FAR struct i2c_master_s *i2c;
_info("Initializing /dev/i2c%d..\n", port);
/* Initialize i2c deivce */
i2c = cxd56_i2cbus_initialize(port);
if (!i2c)
{
_err("ERROR: Failed to initialize i2c%d.\n", port);
return -ENODEV;
}
ret = i2c_register(i2c, port);
if (ret < 0)
{
_err("ERROR: Failed to register i2c%d: %d\n", port, ret);
}
return ret;
}
@@ -1,59 +0,0 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/src/cxd56_uid.c
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* 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 of Sony Semiconductor Solutions Corporation 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 <stdio.h>
#include <errno.h>
#include "cxd56_uid.h"
/****************************************************************************
* Public Functions
****************************************************************************/
int board_uniqueid(uint8_t *uniqueid)
{
if (uniqueid == NULL)
{
return -EINVAL;
}
cxd56_get_uniqueid(uniqueid);
return OK;
}
@@ -1,77 +0,0 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/src/cxd56_usbmsc.c
*
* Copyright (C) 2009, 2011, 2013, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* 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 <stdio.h>
#include <syslog.h>
#include <errno.h>
#include <nuttx/board.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_usbmsc_initialize
*
* Description:
* Perform architecture specific initialization as needed to establish
* the mass storage device that will be exported by the USB MSC device.
*
****************************************************************************/
int board_usbmsc_initialize(int port)
{
/* If system/usbmsc is built as an NSH command, then SD slot should
* already have been initialized in board_app_initialize()
* (see stm32_appinit.c).
* In this case, there is nothing further to be done here.
*/
return OK;
}