mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 14:58:13 +08:00
Merged in alinjerpelea/nuttx (pull request #892)
Spresense board updates
* configs: spresense: Code style fix
There is no functional change
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* configs: spresense: initialize CPU
we are using the framework to initialize the CPU
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* configs: spresense: enable power manager
Enable PowerManager on spresense board
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* configs: spresense: initialize the UART interfaces
initialize the UART interfaces
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* configs: spresense: enable clock management
enable clock management using the cxd56 framework
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* configs: spresense: enable spresense timer
Use timerisr on the spresense board
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* configs: spresense: enable USBDEV
Enable USBDEV on Spresense board
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* configs: spresense: enable SD Card Support
Enable SD Card support on spresense board
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* configs: spresense: enable Mass Storage
Enable Mass Storage on Spresense board
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
committed by
Gregory Nutt
parent
aaa173dd37
commit
da4e3271f8
@@ -5,4 +5,27 @@
|
||||
|
||||
if ARCH_BOARD_SPRESENSE
|
||||
|
||||
config SDCARD_TXS02612
|
||||
bool "SD Card TXS02612 port expander with voltage level translation"
|
||||
default y
|
||||
---help---
|
||||
Enable TXS02612 Dual Voltage Level Translator for SD-Card interface.
|
||||
This device is used in SPD-003C board.
|
||||
|
||||
if SDCARD_TXS02612
|
||||
|
||||
choice
|
||||
prompt "TXS02612 port"
|
||||
default SDCARD_TXS02612_PORT0
|
||||
|
||||
config SDCARD_TXS02612_PORT0
|
||||
bool "Port 0"
|
||||
|
||||
config SDCARD_TXS02612_PORT1
|
||||
bool "Port 1"
|
||||
|
||||
endchoice # "TXS02612 port"
|
||||
|
||||
endif # SDCARD_TXS02612
|
||||
|
||||
endif
|
||||
|
||||
@@ -45,6 +45,10 @@
|
||||
#include <sys/boardctl.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "cxd56_clock.h"
|
||||
#include "cxd56_power.h"
|
||||
#include "cxd56_sdcard.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/****************************************************************************
|
||||
* configs/spresense/include/cxd56_clock.h
|
||||
*
|
||||
* Copyright 2019 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARD_COMMON_INCLUDE_CXD56_CLOCK_H
|
||||
#define __BOARD_COMMON_INCLUDE_CXD56_CLOCK_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_clock_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize clock control.
|
||||
* If this API is called and is returned, the clock mode is the highest
|
||||
* clock mode. For example, CPU frequency is 156MHz.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_clock_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_clock_enable
|
||||
*
|
||||
* Description:
|
||||
* Enable dynamic clock control.
|
||||
* If this API is called and is returned, the clock mode is the lowest
|
||||
* clock mode. Later, you can control the clock mode dynamically by calling
|
||||
* up_pm_acquire_freqlock() or up_pm_release_freqlock.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_clock_enable(void);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __BOARD_COMMON_INCLUDE_CXD56_CLOCK_H */
|
||||
@@ -0,0 +1,202 @@
|
||||
/****************************************************************************
|
||||
* configs/spresense/include/cxd56_power.h
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARD_COMMON_INCLUDE_CXD56_POWER_H
|
||||
#define __BOARD_COMMON_INCLUDE_CXD56_POWER_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define PMIC_NONE (0)
|
||||
#define PMIC_TYPE_LSW (1u << 8)
|
||||
#define PMIC_TYPE_GPO (1u << 9)
|
||||
#define PMIC_TYPE_DDCLDO (1u << 10)
|
||||
#define PMIC_GET_TYPE(v) ((v) & 0xff00)
|
||||
#define PMIC_GET_CH(v) ((v) & 0x00ff)
|
||||
#define PMIC_LSW(n) (PMIC_TYPE_LSW | (1u << (n)))
|
||||
#define PMIC_GPO(n) (PMIC_TYPE_GPO | (1u << (n)))
|
||||
#define PMIC_DDCLDO(n) (PMIC_TYPE_DDCLDO | (1u << (n)))
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_pmic_read
|
||||
*
|
||||
* Description:
|
||||
* Read the value from the specified sub address
|
||||
*
|
||||
* Input Parameter:
|
||||
* addr - sub address
|
||||
* buf - pointer to read buffer
|
||||
* size - byte count of read
|
||||
*
|
||||
* Returned Value:
|
||||
* Return 0 on success. Otherwise, return a negated errno.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_pmic_read(uint8_t addr, void *buf, uint32_t size);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_pmic_write
|
||||
*
|
||||
* Description:
|
||||
* Write the value to the specified sub address
|
||||
*
|
||||
* Input Parameter:
|
||||
* addr - sub address
|
||||
* buf - pointer to write buffer
|
||||
* size - byte count of write
|
||||
*
|
||||
* Returned Value:
|
||||
* Return 0 on success. Otherwise, return a negated errno.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_pmic_write(uint8_t addr, void *buf, uint32_t size);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_power_setup
|
||||
*
|
||||
* Description:
|
||||
* Initial setup for board-specific power control
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_power_setup(int status);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_power_control
|
||||
*
|
||||
* Description:
|
||||
* Power on/off the device on the board.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_power_control(int target, bool en);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_power_monitor
|
||||
*
|
||||
* Description:
|
||||
* Get status of Power on/off the device on the board.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
bool board_power_monitor(int target);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_flash_power_control
|
||||
*
|
||||
* Description:
|
||||
* Power on/off the flash device on the board.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_flash_power_control(bool en);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_flash_power_monitor
|
||||
*
|
||||
* Description:
|
||||
* Get status of Power on/off the flash device on the board.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
bool board_flash_power_monitor(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_xtal_power_control
|
||||
*
|
||||
* Description:
|
||||
* Power on/off the Xtal device on the board.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_xtal_power_control(bool en);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_xtal_power_monitor
|
||||
*
|
||||
* Description:
|
||||
* Get status of Power on/off the Xtal device on the board.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
bool board_xtal_power_monitor(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_lna_power_control
|
||||
*
|
||||
* Description:
|
||||
* Power on/off the LNA device on the board.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_lna_power_control(bool en);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARD_COMMON_INCLUDE_CXD56_POWER_H */
|
||||
@@ -0,0 +1,154 @@
|
||||
/****************************************************************************
|
||||
* configs/spresense/include/cxd56_sdcard.h
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARD_COMMON_INCLUDE_CXD56_SDCARD_H
|
||||
#define __BOARD_COMMON_INCLUDE_CXD56_SDCARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_sdcard_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize SD Card on the board.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_sdcard_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_sdcard_pin_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize SD Card pins on the board.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_sdcard_pin_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_sdcard_pin_finalize
|
||||
*
|
||||
* Description:
|
||||
* Finalize SD Card pins on the board.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_sdcard_pin_finalize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_sdcard_pin_configuraton
|
||||
*
|
||||
* Description:
|
||||
* Configure SD Card pins on the board.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_sdcard_pin_configuraton(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_sdcard_pin_enable
|
||||
*
|
||||
* Description:
|
||||
* Enable SD Card pins on the board.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_sdcard_pin_enable(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_sdcard_pin_disable
|
||||
*
|
||||
* Description:
|
||||
* Disable SD Card pins on the board.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_sdcard_pin_disable(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_sdcard_set_high_voltage
|
||||
*
|
||||
* Description:
|
||||
* Set SD Card IO voltage to 3.3V
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_sdcard_set_high_voltage(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_sdcard_set_low_voltage
|
||||
*
|
||||
* Description:
|
||||
* Set SD Card IO voltage to 1.8V
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_sdcard_set_low_voltage(void);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARD_COMMON_INCLUDE_CXD56_SDCARD_H */
|
||||
@@ -1,5 +1,5 @@
|
||||
############################################################################
|
||||
# configs/cxd56evb/nsh/Make.defs
|
||||
# configs/spresense/nsh/Make.defs
|
||||
#
|
||||
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* configs/cxd56evb/scripts/ramconfig.ld
|
||||
* configs/spresense/scripts/ramconfig.ld
|
||||
*
|
||||
* Copyright 2018 Sony Semiconductor Solutions Corporation
|
||||
*
|
||||
|
||||
@@ -37,10 +37,15 @@
|
||||
DEPPATH = --dep-path .
|
||||
|
||||
ASRCS =
|
||||
CSRCS = cxd56_boot.c cxd56_bringup.c
|
||||
CSRCS =
|
||||
|
||||
CSRCS += cxd56_boot.c
|
||||
CSRCS += cxd56_clock.c
|
||||
CSRCS += cxd56_bringup.c
|
||||
|
||||
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||
CSRCS += cxd56_appinit.c
|
||||
CSRCS += cxd56_power.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BOARDCTL_IOCTL),y)
|
||||
@@ -55,4 +60,12 @@ ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||
CSRCS += cxd56_leds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CXD56_SDIO),y)
|
||||
CSRCS += cxd56_sdcard.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_USBMSC),y)
|
||||
CSRCS += cxd56_usbmsc.c
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/configs/Board.mk
|
||||
|
||||
@@ -47,8 +47,6 @@
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "spresense.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@@ -71,26 +69,3 @@
|
||||
void cxd56_boardinitialize(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_late_initialize
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
|
||||
* initialization call will be performed in the boot-up sequence to a
|
||||
* function called board_late_initialize(). board_late_initialize() will be
|
||||
* called immediately after up_initialize() is called and just before the
|
||||
* initial application is started. This additional initialization phase
|
||||
* may be used, for example, to initialize board-specific device drivers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||
void board_late_initialize(void)
|
||||
{
|
||||
/* Perform board-specific initialization */
|
||||
|
||||
(void)cxd56_bringup();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -44,6 +44,36 @@
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include <arch/chip/pm.h>
|
||||
#include "chip.h"
|
||||
|
||||
#include "cxd56_sysctl.h"
|
||||
#include "cxd56_powermgr.h"
|
||||
#include "cxd56_uart.h"
|
||||
#include "cxd56_timerisr.h"
|
||||
#include "cxd56_gpio.h"
|
||||
#include "cxd56_pinconfig.h"
|
||||
|
||||
#ifdef CONFIG_CXD56_CPUFIFO
|
||||
#include "cxd56_cpufifo.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CXD56_ICC
|
||||
#include "cxd56_icc.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CXD56_FARAPI
|
||||
#include "cxd56_farapi.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBDEV
|
||||
#include "cxd56_usbdev.h"
|
||||
#endif
|
||||
|
||||
#include "spresense.h"
|
||||
|
||||
/****************************************************************************
|
||||
@@ -55,11 +85,37 @@
|
||||
/* procfs File System */
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
# ifdef CONFIG_NSH_PROC_MOUNTPOINT
|
||||
# define CXD56_PROCFS_MOUNTPOINT CONFIG_NSH_PROC_MOUNTPOINT
|
||||
# else
|
||||
# define CXD56_PROCFS_MOUNTPOINT "/proc"
|
||||
# endif
|
||||
#ifdef CONFIG_NSH_PROC_MOUNTPOINT
|
||||
#define CXD56_PROCFS_MOUNTPOINT CONFIG_NSH_PROC_MOUNTPOINT
|
||||
#else
|
||||
#define CXD56_PROCFS_MOUNTPOINT "/proc"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_CXD56_CPUFIFO
|
||||
static int nsh_cpucom_initialize(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
cxd56_cfinitialize();
|
||||
|
||||
#ifdef CONFIG_CXD56_ICC
|
||||
cxd56_iccinitialize();
|
||||
#endif
|
||||
#ifdef CONFIG_CXD56_FARAPI
|
||||
cxd56_farapiinitialize();
|
||||
#endif
|
||||
|
||||
cxd56_sysctlinitialize();
|
||||
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
# define nsh_cpucom_initialize() (OK)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@@ -82,11 +138,56 @@
|
||||
|
||||
int cxd56_bringup(void)
|
||||
{
|
||||
struct pm_cpu_wakelock_s wlock;
|
||||
int ret;
|
||||
|
||||
(void) ret;
|
||||
ret = nsh_cpucom_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
_err("ERROR: Failed to initialize cpucom.\n");
|
||||
}
|
||||
|
||||
ret = cxd56_pm_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
_err("ERROR: Failed to initialize powermgr.\n");
|
||||
}
|
||||
|
||||
wlock.info = PM_CPUWAKELOCK_TAG('C', 'A', 0);
|
||||
wlock.count = 0;
|
||||
up_pm_acquire_wakelock(&wlock);
|
||||
|
||||
cxd56_uart_initialize();
|
||||
cxd56_timerisr_initialize();
|
||||
|
||||
#ifdef CONFIG_CXD56_CPUFIFO
|
||||
ret = cxd56_pm_bootup();
|
||||
if (ret < 0)
|
||||
{
|
||||
_err("ERROR: Failed to powermgr bootup.\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize CPU clock to max frequency */
|
||||
|
||||
board_clock_initialize();
|
||||
|
||||
/* Setup the power of external device */
|
||||
|
||||
board_power_setup(0);
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS_REGISTER
|
||||
/* register usbdev procfs */
|
||||
|
||||
ret = cxd56_usbdev_procfs_register();
|
||||
if (ret < 0)
|
||||
{
|
||||
_err("ERROR: Failed to register usbdev.\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = mount(NULL, CXD56_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -94,5 +195,44 @@ int cxd56_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
/* In order to prevent Hi-Z from being input to the SD Card controller,
|
||||
* Initialize SDIO pins to GPIO low output with internal pull-down.
|
||||
*/
|
||||
|
||||
CXD56_PIN_CONFIGS(PINCONFS_SDIOA_GPIO);
|
||||
cxd56_gpio_write(PIN_SDIO_CLK, false);
|
||||
cxd56_gpio_write(PIN_SDIO_CMD, false);
|
||||
cxd56_gpio_write(PIN_SDIO_DATA0, false);
|
||||
cxd56_gpio_write(PIN_SDIO_DATA1, false);
|
||||
cxd56_gpio_write(PIN_SDIO_DATA2, false);
|
||||
cxd56_gpio_write(PIN_SDIO_DATA3, false);
|
||||
|
||||
#if defined(CONFIG_CXD56_SDIO) && !defined(CONFIG_CXD56_SPISD)
|
||||
ret = board_sdcard_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
_err("ERROR: Failed to initialze sdhci. \n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CXD56_SPISD
|
||||
/* Mount the SPI-based MMC/SD block driver */
|
||||
|
||||
ret = board_spisd_initialize(0, 4);
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: Failed to initialize SPI device to MMC/SD: %d\n",
|
||||
ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CPUFREQ_RELEASE_LOCK
|
||||
/* Enable dynamic clock control and CPU clock down for power saving */
|
||||
|
||||
board_clock_enable();
|
||||
#endif
|
||||
|
||||
up_pm_release_wakelock(&wlock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/****************************************************************************
|
||||
* configs/spresense/src/cxd56_clock.c
|
||||
*
|
||||
* Copyright 2019 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 <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
#include <arch/chip/pm.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static struct pm_cpu_freqlock_s g_hv_lock =
|
||||
PM_CPUFREQLOCK_INIT(PM_CPUFREQLOCK_TAG('C','P',0), PM_CPUFREQLOCK_FLAG_HV);
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_clock_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_clock_initialize(void)
|
||||
{
|
||||
up_pm_acquire_freqlock(&g_hv_lock);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_clock_enable
|
||||
****************************************************************************/
|
||||
|
||||
void board_clock_enable(void)
|
||||
{
|
||||
up_pm_release_freqlock(&g_hv_lock);
|
||||
}
|
||||
@@ -86,8 +86,7 @@
|
||||
|
||||
int board_ioctl(unsigned int cmd, uintptr_t arg)
|
||||
{
|
||||
int ret = -ENOTTY; /* The correct return for the case of an unrecognized
|
||||
* command. */
|
||||
int ret = -ENOTTY; /* The correct return for the case of an unrecognized command */
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,76 @@
|
||||
/****************************************************************************
|
||||
* configs/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;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_MMCSD_HAVE_WRITEPROTECT is not set
|
||||
# CONFIG_MMCSD_SPI is not set
|
||||
# CONFIG_STANDARD_SERIAL is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="spresense"
|
||||
CONFIG_ARCH_BOARD_SPRESENSE=y
|
||||
CONFIG_ARCH_CHIP_CXD56XX=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARMV7M_USEBASEPRI=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=5434
|
||||
CONFIG_BOOT_RUNFROMISRAM=y
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_CLOCK_MONOTONIC=y
|
||||
CONFIG_CXD56_SDIO=y
|
||||
CONFIG_CXD56_USBDEV=y
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_FAT_LCNAMES=y
|
||||
CONFIG_FAT_LFN=y
|
||||
CONFIG_FAT_MAXFNAME=64
|
||||
CONFIG_FS_FAT=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_PROCFS_REGISTER=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_I2C=y
|
||||
CONFIG_MAX_TASKS=16
|
||||
CONFIG_MAX_WDOGPARMS=2
|
||||
CONFIG_MMCSD=y
|
||||
CONFIG_MMCSD_SDIO=y
|
||||
CONFIG_NFILE_DESCRIPTORS=8
|
||||
CONFIG_NFILE_STREAMS=8
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_PREALLOC_MQ_MSGS=4
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_PREALLOC_WDOGS=16
|
||||
CONFIG_RAM_SIZE=1572864
|
||||
CONFIG_RAM_START=0x0d000000
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_HPWORK=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_SPI=y
|
||||
CONFIG_START_DAY=6
|
||||
CONFIG_START_MONTH=12
|
||||
CONFIG_START_YEAR=2011
|
||||
CONFIG_SYSTEM_CLE=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_NSH_CXXINITIALIZE=y
|
||||
CONFIG_SYSTEM_USBMSC=y
|
||||
CONFIG_UART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USBDEV=y
|
||||
CONFIG_USBDEV_DMA=y
|
||||
CONFIG_USBDEV_DUALSPEED=y
|
||||
CONFIG_USBMSC=y
|
||||
CONFIG_USBMSC_EPBULKIN=1
|
||||
CONFIG_USBMSC_REMOVABLE=y
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
Reference in New Issue
Block a user