Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arch, boards: cxd56xx: Minor update for spresense #6036

Merged
merged 8 commits into from
Apr 11, 2022
1 change: 1 addition & 0 deletions arch/arm/src/cxd56xx/cxd56_emmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include <debug.h>
#include <errno.h>

#include <nuttx/arch.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/cxd56xx/cxd56_farapistub.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
#ifndef __ARCH_ARM_SRC_CXD56XX_CXD56_FARAPISTUB_H
#define __ARCH_ARM_SRC_CXD56XX_CXD56_FARAPISTUB_H

#define FARAPISTUB_VERSION 20175
#define FARAPISTUB_VERSION 20585

#endif /* __ARCH_ARM_SRC_CXD56XX_CXD56_FARAPISTUB_H */
6 changes: 6 additions & 0 deletions arch/arm/src/cxd56xx/cxd56_scu.c
Original file line number Diff line number Diff line change
Expand Up @@ -939,8 +939,11 @@ static void seq_setstartphase(int sid, int phase)
static void seq_startseq(int sid)
{
uint32_t val;
irqstate_t flags;
flags = enter_critical_section();
val = getreg32(SCU_START_MODE0);
putreg32(val | (1 << sid), SCU_START_MODE0);
leave_critical_section(flags);
}

/****************************************************************************
Expand All @@ -957,8 +960,11 @@ static void seq_startseq(int sid)
static void seq_stopseq(int sid)
{
uint32_t val;
irqstate_t flags;
flags = enter_critical_section();
val = getreg32(SCU_START_MODE0);
putreg32(val & ~(1 << sid), SCU_START_MODE0);
leave_critical_section(flags);
}

/****************************************************************************
Expand Down
4 changes: 4 additions & 0 deletions boards/arm/cxd56xx/common/src/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ ifeq ($(CONFIG_SENSORS_RPR0521RS_SCU),y)
CSRCS += cxd56_rpr0521rs_scu.c
endif

ifeq ($(CONFIG_SENSORS_SCD41),y)
CSRCS += cxd56_scd41_i2c.c
endif

ifeq ($(CONFIG_NETDEVICES),y)
CSRCS += cxd56_netinit.c
endif
Expand Down
1 change: 1 addition & 0 deletions boards/arm/cxd56xx/common/src/cxd56_i2cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ int board_i2cdev_initialize(int port)
if (ret < 0)
{
_err("ERROR: Failed to register i2c%d: %d\n", port, ret);
cxd56_i2cbus_uninitialize(i2c);
}

return ret;
Expand Down
72 changes: 72 additions & 0 deletions boards/arm/cxd56xx/common/src/cxd56_scd41_i2c.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/****************************************************************************
* boards/arm/cxd56xx/common/src/cxd56_scd41_i2c.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

/****************************************************************************
* Included Files
****************************************************************************/

#include <nuttx/config.h>

#include <stdio.h>
#include <debug.h>
#include <errno.h>

#include <nuttx/board.h>

#include <nuttx/sensors/scd41.h>

#include "cxd56_i2c.h"

/****************************************************************************
* Private Functions
****************************************************************************/

/****************************************************************************
* Public Functions
****************************************************************************/

#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_SCD41)

int board_scd41_initialize(FAR const char *devpath, int bus)
{
int ret;
FAR struct i2c_master_s *i2c;

sninfo("Initializing SCD41...\n");

/* Initialize i2c device */

i2c = cxd56_i2cbus_initialize(bus);
if (!i2c)
{
snerr("ERROR: Failed to initialize i2c%d.\n", bus);
return -ENODEV;
}

ret = scd41_register_i2c(devpath, i2c);
if (ret < 0)
{
snerr("Error registering SCD41.\n");
}

return ret;
}

#endif
3 changes: 3 additions & 0 deletions boards/arm/cxd56xx/common/src/cxd56_sensors.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ static struct sensor_device_s sensor_device[] =
#if defined(CONFIG_SENSORS_BH1745NUC) || defined(CONFIG_SENSORS_BH1745NUC_SCU)
_I2C_DEVICE(bh1745nuc, "/dev/color"), /* Color */
#endif
#if defined(CONFIG_SENSORS_SCD41)
_I2C_DEVICE(scd41, "/dev/co2"), /* CO2 */
#endif
};

/****************************************************************************
Expand Down
183 changes: 183 additions & 0 deletions boards/arm/cxd56xx/spresense/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,189 @@ config LCD_ON_MAIN_BOARD
Display connected to main board.

endchoice

if LCD_ON_MAIN_BOARD

choice
prompt "LCD ILI934x RST Pin selection"
default LCD_RSTPIN_I2S0_BCK

config LCD_RSTPIN_UART2_TX
bool "UART2_TX (D01) PIN"

config LCD_RSTPIN_UART2_RX
bool "UART2_RX (D00) PIN"

config LCD_RSTPIN_UART2_RTS
bool "UART2_RTS (D28) PIN"

config LCD_RSTPIN_UART2_CTS
bool "UART2_CTS (D27) PIN"

config LCD_RSTPIN_I2S0_BCK
bool "I2S0_BCK (D26) PIN"

config LCD_RSTPIN_I2S0_LRCK
bool "I2S0_LRCK (D25) PIN"

config LCD_RSTPIN_SEN_IRQ_IN
bool "SEN_IRQ_IN (D22) PIN"

config LCD_RSTPIN_EMMC_DATA3
bool "EMMC_DATA3 (D21) PIN"

config LCD_RSTPIN_EMMC_DATA2
bool "EMMC_DATA2 (D20) PIN"

config LCD_RSTPIN_I2S0_DATA_IN
bool "I2S0_DATA_IN (D19) PIN"

config LCD_RSTPIN_I2S0_DATA_OUT
bool "I2S0_DATA_OUT (D18) PIN"

config LCD_RSTPIN_I2C0_SCL
bool "I2C0_SCL (D15) PIN"

config LCD_RSTPIN_I2C0_SDA
bool "I2C0_SDA (D14) PIN"

endchoice

choice
prompt "LCD ILI934x DC Pin selection"
default LCD_DCPIN_I2S0_LRCK

config LCD_DCPIN_UART2_TX
bool "UART2_TX (D01) PIN"

config LCD_DCPIN_UART2_RX
bool "UART2_RX (D00) PIN"

config LCD_DCPIN_UART2_RTS
bool "UART2_RTS (D28) PIN"

config LCD_DCPIN_UART2_CTS
bool "UART2_CTS (D27) PIN"

config LCD_DCPIN_I2S0_BCK
bool "I2S0_BCK (D26) PIN"

config LCD_DCPIN_I2S0_LRCK
bool "I2S0_LRCK (D25) PIN"

config LCD_DCPIN_SEN_IRQ_IN
bool "SEN_IRQ_IN (D22) PIN"

config LCD_DCPIN_EMMC_DATA3
bool "EMMC_DATA3 (D21) PIN"

config LCD_DCPIN_EMMC_DATA2
bool "EMMC_DATA2 (D20) PIN"

config LCD_DCPIN_I2S0_DATA_IN
bool "I2S0_DATA_IN (D19) PIN"

config LCD_DCPIN_I2S0_DATA_OUT
bool "I2S0_DATA_OUT (D18) PIN"

config LCD_DCPIN_I2C0_SCL
bool "I2C0_SCL (D15) PIN"

config LCD_DCPIN_I2C0_SDA
bool "I2C0_SDA (D14) PIN"

endchoice

endif

if LCD_ON_EXTENSION_BOARD

choice
prompt "LCD ILI934x RST Pin selection"
default LCD_RSTPIN_SPI2_MISO

config LCD_RSTPIN_I2C0_SCL_E
bool "I2C0_SCL (D15) PIN"

config LCD_RSTPIN_I2C0_SDA_E
bool "I2C0_SDA (D14) PIN"

config LCD_RSTPIN_PWM2
bool "PWM2 (D09) PIN"

config LCD_RSTPIN_SPI2_MISO
bool "SPI2_MISO (D08) PIN"

config LCD_RSTPIN_SPI3_CS1_X
bool "SPI3_CS1_X (D07) PIN"

config LCD_RSTPIN_PWM0
bool "PWM0 (D06) PIN"

config LCD_RSTPIN_PWM1
bool "PWM1 (D05) PIN"

config LCD_RSTPIN_SPI2_MOSI
bool "SPI2_MOSI (D04) PIN"

config LCD_RSTPIN_PWM3
bool "PWM3 (D03) PIN"

config LCD_RSTPIN_HIF_IRQ_OUT
bool "HIF_IRQ_OUT (D02) PIN"

config LCD_RSTPIN_UART2_TX_E
bool "UART2_TX (D01) PIN"

config LCD_RSTPIN_UART2_RX_E
bool "UART2_RX (D00) PIN"

endchoice

choice
prompt "LCD ILI934x DC Pin selection"
default LCD_DCPIN_PWM2

config LCD_DCPIN_I2C0_SCL_E
bool "I2C0_SCL (D15) PIN"

config LCD_DCPIN_I2C0_SDA_E
bool "I2C0_SDA (D14) PIN"

config LCD_DCPIN_PWM2
bool "PWM2 (D09) PIN"

config LCD_DCPIN_SPI2_MISO
bool "SPI2_MISO (D08) PIN"

config LCD_DCPIN_SPI3_CS1_X
bool "SPI3_CS1_X (D07) PIN"

config LCD_DCPIN_PWM0
bool "PWM0 (D06) PIN"

config LCD_DCPIN_PWM1
bool "PWM1 (D05) PIN"

config LCD_DCPIN_SPI2_MOSI
bool "SPI2_MOSI (D04) PIN"

config LCD_DCPIN_PWM3
bool "PWM3 (D03) PIN"

config LCD_DCPIN_HIF_IRQ_OUT
bool "HIF_IRQ_OUT (D02) PIN"

config LCD_DCPIN_UART2_TX_E
bool "UART2_TX (D01) PIN"

config LCD_DCPIN_UART2_RX_E
bool "UART2_RX (D00) PIN"

endchoice

endif

endif

choice
Expand Down
16 changes: 10 additions & 6 deletions boards/arm/cxd56xx/spresense/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <sys/boardctl.h>
#include <stdbool.h>

#include "board_lcdpins.h"

#include "cxd56_clock.h"
#include "cxd56_power.h"
#include "cxd56_flash.h"
Expand Down Expand Up @@ -59,6 +61,7 @@
#include "cxd56_kx022.h"
#include "cxd56_lt1pa01.h"
#include "cxd56_rpr0521rs.h"
#include "cxd56_scd41.h"
#include "cxd56_sensors.h"

#include "cxd56_isx012.h"
Expand Down Expand Up @@ -212,9 +215,6 @@ enum board_power_device

#if defined(CONFIG_LCD_ON_MAIN_BOARD) /* Display connected to main board. */

#define DISPLAY_RST PIN_I2S0_BCK
#define DISPLAY_DC PIN_I2S0_LRCK

#define DISPLAY_SPI 5

#define DISPLAY_DMA_TXCH (4)
Expand All @@ -226,9 +226,6 @@ enum board_power_device

#else /* Display is connected through extension board. */

#define DISPLAY_RST PIN_SPI2_MISO
#define DISPLAY_DC PIN_PWM2

#define DISPLAY_SPI 4

#define DISPLAY_DMA_TXCH (2)
Expand All @@ -240,6 +237,9 @@ enum board_power_device

#endif

#define DISPLAY_RST ILI934X_RST_PIN
#define DISPLAY_DC ILI934X_DC_PIN

/* Sensor device bus definitions ********************************************/

#define SENSOR_I2C 0
Expand All @@ -261,6 +261,10 @@ enum board_power_device

#define BOARDIOC_USBDEV_SETNOTIFYSIG (BOARDIOC_USER+0x0001)

/* Set callback function pointer for notify SDCard state change *************/

#define BOARDIOC_SDCARD_SETNOTIFYCB (BOARDIOC_USER+0x0002)

/* Altair modem device pin definitions **************************************/

#define ALTMDM_SLAVE_REQ PIN_SPI2_SCK
Expand Down
Loading