diff --git a/boards/xtensa/esp32s3/esp32s3-xiao/src/Make.defs b/boards/xtensa/esp32s3/esp32s3-xiao/src/Make.defs index 05bf52fb187..e141658834f 100644 --- a/boards/xtensa/esp32s3/esp32s3-xiao/src/Make.defs +++ b/boards/xtensa/esp32s3/esp32s3-xiao/src/Make.defs @@ -36,6 +36,10 @@ ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += esp32s3_gpio.c endif +ifeq ($(CONFIG_ESP32S3_SPI),y) +CSRCS += esp32s3_board_spi.c +endif + DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/xtensa/esp32s3/esp32s3-xiao/src/esp32s3_board_spi.c b/boards/xtensa/esp32s3/esp32s3-xiao/src/esp32s3_board_spi.c new file mode 100644 index 00000000000..a9de6e81efc --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-xiao/src/esp32s3_board_spi.c @@ -0,0 +1,57 @@ +/**************************************************************************** + * boards/xtensa/esp32s3/esp32s3-xiao/src/esp32s3_board_spi.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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 + +#include +#include +#include + +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: esp32s3_spi2_status + ****************************************************************************/ + +#ifdef CONFIG_ESP32S3_SPI2 + +uint8_t esp32s3_spi2_status(struct spi_dev_s *dev, uint32_t devid) +{ + uint8_t status = 0; + + if (devid == SPIDEV_MMCSD(0)) + { + return SPI_STATUS_PRESENT; + } + + return status; +} + +#endif diff --git a/boards/xtensa/esp32s3/esp32s3-xiao/src/esp32s3_bringup.c b/boards/xtensa/esp32s3/esp32s3-xiao/src/esp32s3_bringup.c index 5c81b3b0d12..5aac91128a8 100644 --- a/boards/xtensa/esp32s3/esp32s3-xiao/src/esp32s3_bringup.c +++ b/boards/xtensa/esp32s3/esp32s3-xiao/src/esp32s3_bringup.c @@ -51,6 +51,10 @@ # include "esp32s3_i2c.h" #endif +#if defined(CONFIG_ESP32S3_SDMMC) || defined(CONFIG_MMCSD_SPI) +# include "esp32s3_board_sdmmc.h" +#endif + #include "esp32s3-xiao.h" #ifdef CONFIG_USERLED @@ -123,6 +127,14 @@ int esp32s3_bringup(void) } #endif +#ifdef CONFIG_MMCSD_SPI + ret = board_sdmmc_spi_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SDMMC: %d\n", ret); + } +#endif + #ifdef CONFIG_I2C_DRIVER /* Configure I2C peripheral interfaces */