mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
2a4496b32a
19539: drivers/periph_sdmmc: define a High-level SDIO/SD/MMC API and low-level SDMMC periperal driver interface r=benpicco a=gschorcht ### Contribution description This PR provides a SDIO/SD/MMC Device API (SDMMC). It implements a SD host controller driver that provides a high-level functions using a low-level SDIO/SD/MMC peripheral driver for accessing - MultiMediaCards (MMC) and Embedded MultiMediaCards (eMMC) - SD Memory Cards (SD Cards) with Standard Capacity (SDSC), High Capacity (SDHC) or Extended Capacity (SDXC). It supports: - 1-bit, 4-bit and 8-bit data bus width - Default Speed and High Speed - Auto-CLK The SDIO/SD/MMC device API (SDMMC) is divided into two parts: 1. The high-level API that implements the SD Host Controller driver and allows - to inititialize and identify different types of cards, - to access them either blockwise or bytewise, - to get information about the used card, and - to send single commands or application specific commands to the card. 2. The low-level SDIO/SD/MMC peripheral driver implements the low-level functions required by the high-level device API. It has to be implemented for each MCU. ### Limitations: - Only one card per SDIO/SD/MMC device is supported. - eMMCs specific features are not supported. - UHS-I, UHS-II and UHS-III are not supported. ### Testing procedure PR #19540, PR #19760 or PR #19786 is needed to test this PR. ### Issues/PRs references Prerequisite for PR #19540 Prerequisite for PR #19760 Prerequisite for PR #19786 19815: cpu/sam0_common/periph/sdhc: busy waiting and clock fixes r=benpicco a=benpicco 19860: drivers/ft5x06: fix vendor ID for FT6xx6 and FTxxxx register addresses r=benpicco a=gschorcht ### Contribution description This PR provides a fix of the vendor ID for FT6xx6 touch panel driver ICs and a fix of register addresses for FTxxxx. According to the [Application Note for FT6x06 CTPM](https://cdn-shop.adafruit.com/datasheets/FT6x06_AN_public_ver0.1.3.pdf), the vendor ID of FT6x06 touch panel driver ICs is `0x11` instead of `0xcd`. Although there are no information found in the Web about the FT6x36, the FT6336U touch panel of a ESP32-S3 WT32 SC01 Plus is also working with `0x11` as vendor ID so that it seems that FT6x36 is also using `0x11` as vendor ID. Figured out with a `stm32f723e-disco` board (revision D03). Without this PR, `tests/drivers/ft5x06` gives: ``` +------------Initializing------------+ [ft5x06] init: invalid vendor ID: '0x11' (expected: 0xcd) [Error] Initialization failed ``` With this PR it works as expected. ``` +------------Initializing------------+ Initialization successful main(): This is RIOT! (Version: 2023.10-devel-96-gbb9011-drivers/ft5x06_fix_vendor_id) FT5x06 test application +------------Initializing------------+ [ft5x06] init: configuring touchscreen interrupt Initialization successful 1 touch detected [ft5x06] read gesture_id '0x00' Touch 1 - X: 151, Y:138 [ft5x06] read gesture_id '0x00' ``` Some background information found in the Web: - According to the [STM32CubeF7](c20e6dd15b/Drivers/BSP/STM32F723E-Discovery/stm32f723e_discovery_ts.c (L24-L27)
) the FRIDA LCD panel mounted on the `stm32f723e-disco` board either uses FT6x36 (prior revision D) or FT3x67 (revision D). However, the FT5x06 driver type for the card is defined as FT6x06, which does not seem correct:bb9011c3fb/boards/stm32f723e-disco/include/board.h (L59)
- According to the [STM32CubeF7](c20e6dd15b/Drivers/BSP/Components/ft6x06/ft6x06.h (L269-L270)
), the vendor ID for FT6x36 should be `0xcd`. However, the FT6336U on ESP32-S3 WT32 SC01 Plus works with vendor ID `0x11`. - The [Adafruit FT6206 library](95118cd983/Adafruit_FT6206.h (L28)
) uses `0x11` as vendor id. - The `stm32l496g-disco` board uses a FT6236 which has vendor ID `0xcd`. So the information available on the web is confusing. Maybe, a better solution would be to accept `0x11` as well as `0xcd` as vendor ID for FT6xxx touch panels. Unfortunately, there are no documents available on the registers directly from FocalTech 😟 so it seems to be more speculation than knowledge. ### Testing procedure ### Issues/PRs references 19886: cpu/efm32: fix DAC configuration r=benpicco a=gschorcht ### Contribution description The EFM32 MCU allows the reference voltage to be configured per DAC device, not per DAC channel. Also, the DAC reference voltage was defined in the configuration but not used anywhere. At the moment we have only defined one board (`stwstk6220a`) that uses the DAC, so changing the configuration interface shouldn't be critical. ### Testing procedure `tests/periph/dac` should still work for the `stwstk6220a` ``` BOARD=slwstk6220a make -j8 -C tests/periph/dac flash ``` I don't have a `stwstk6220a` board (EFM32 Series 0) so that I can't test it. I could only test it for the `sltb009a` board (EFM32 Series 1) with the change for VDAC in PR #19887. ### Issues/PRs references Co-authored-by: Gunar Schorcht <gunar@schorcht.net> Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
152 lines
3.3 KiB
C
152 lines
3.3 KiB
C
/*
|
|
* Copyright (C) 2017 Freie Universität Berlin
|
|
* 2017 Kaspar Schleiser <kaspar@schleiser.de>
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU Lesser General
|
|
* Public License v2.1. See the file LICENSE in the top level directory for more
|
|
* details.
|
|
*/
|
|
|
|
/**
|
|
* @ingroup drivers_periph_init
|
|
* @{
|
|
*
|
|
* @file
|
|
* @brief Common static peripheral driver initialization implementation
|
|
*
|
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
|
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
|
*
|
|
* @}
|
|
*/
|
|
|
|
#define USB_H_USER_IS_RIOT_INTERNAL
|
|
|
|
#include "kernel_defines.h"
|
|
#include "periph_conf.h"
|
|
#include "periph_cpu.h"
|
|
|
|
#ifdef MODULE_PERIPH_INIT
|
|
#ifdef MODULE_PERIPH_INIT_I2C
|
|
#include "periph/i2c.h"
|
|
#endif
|
|
#ifdef MODULE_PERIPH_INIT_SPI
|
|
#include "periph/spi.h"
|
|
#endif
|
|
#ifdef MODULE_PERIPH_INIT_RTC
|
|
#include "periph/rtc.h"
|
|
#endif
|
|
#ifdef MODULE_PERIPH_INIT_RTT
|
|
#include "periph/rtt.h"
|
|
#endif
|
|
#ifdef MODULE_PERIPH_INIT_HWRNG
|
|
#include "periph/hwrng.h"
|
|
#endif
|
|
#ifdef MODULE_PERIPH_INIT_USBDEV
|
|
#include "periph/usbdev.h"
|
|
#endif
|
|
#ifdef MODULE_PERIPH_INIT_WDT
|
|
#include "periph/wdt.h"
|
|
#endif
|
|
#ifdef MODULE_PERIPH_INIT_PTP
|
|
#include "periph/ptp.h"
|
|
#endif
|
|
#ifdef MODULE_PERIPH_INIT_VBAT
|
|
#include "periph/vbat.h"
|
|
#endif
|
|
#ifdef MODULE_PERIPH_INIT_PIO
|
|
#include "periph/pio.h"
|
|
#endif
|
|
#ifdef MODULE_PERIPH_INIT_SDMMC
|
|
#include "sdmmc/sdmmc.h"
|
|
#endif
|
|
#endif /* MODULE_PERIPH_INIT */
|
|
|
|
void periph_init(void)
|
|
{
|
|
#ifdef MODULE_PERIPH_INIT
|
|
/* initialize buttonss */
|
|
if (IS_USED(MODULE_PERIPH_INIT_BUTTONS)) {
|
|
extern void button_init(void);
|
|
button_init();
|
|
}
|
|
/* initialize configured I2C devices */
|
|
#ifdef MODULE_PERIPH_INIT_I2C
|
|
for (unsigned i = 0; i < I2C_NUMOF; i++) {
|
|
i2c_init(I2C_DEV(i));
|
|
}
|
|
#endif
|
|
|
|
/* initialize configured SPI devices */
|
|
#ifdef MODULE_PERIPH_INIT_SPI
|
|
for (unsigned i = 0; i < SPI_NUMOF; i++) {
|
|
spi_init(SPI_DEV(i));
|
|
}
|
|
#endif
|
|
|
|
/* Initialize RTT before RTC to allow for RTT based RTC implementations */
|
|
#ifdef MODULE_PERIPH_INIT_RTT
|
|
rtt_init();
|
|
#endif
|
|
|
|
/* Initialize RTC */
|
|
#ifdef MODULE_PERIPH_INIT_RTC
|
|
rtc_init();
|
|
#endif
|
|
|
|
/* Initialize Tamper Detection */
|
|
#ifdef MODULE_PERIPH_INIT_GPIO_TAMPER_WAKE
|
|
rtc_tamper_init();
|
|
#endif
|
|
|
|
#ifdef MODULE_PERIPH_INIT_HWRNG
|
|
hwrng_init();
|
|
#endif
|
|
|
|
#ifdef MODULE_PERIPH_INIT_USBDEV
|
|
usbdev_init_lowlevel();
|
|
#endif
|
|
|
|
#if defined(MODULE_PERIPH_INIT_WDT) && WDT_HAS_INIT
|
|
wdt_init();
|
|
|
|
if (IS_ACTIVE(MODULE_PERIPH_WDT_AUTO_START)) {
|
|
wdt_setup_reboot(CONFIG_PERIPH_WDT_WIN_MIN_MS, CONFIG_PERIPH_WDT_WIN_MAX_MS);
|
|
wdt_start();
|
|
}
|
|
#endif
|
|
|
|
#if defined(MODULE_PERIPH_INIT_PTP)
|
|
ptp_init();
|
|
#endif
|
|
|
|
#if defined(MODULE_PERIPH_INIT_FMC)
|
|
extern void fmc_init(void);
|
|
fmc_init();
|
|
#endif
|
|
|
|
#if defined(MODULE_PERIPH_INIT_VBAT)
|
|
vbat_init();
|
|
#endif
|
|
|
|
#ifdef MODULE_PERIPH_INIT_PIO
|
|
for (int i = 0; i < (int)PIO_NUMOF; i++) {
|
|
pio_init(PIO_DEV(i));
|
|
}
|
|
#if defined(MODULE_PERIPH_INIT_I2C) && defined(PIO_I2C_NUMOF)
|
|
for (unsigned i = 0; i < PIO_I2C_NUMOF; i++) {
|
|
i2c_init(I2C_DEV(I2C_NUMOF + i));
|
|
}
|
|
#endif
|
|
pio_start_programs();
|
|
#endif
|
|
|
|
#if defined(MODULE_PERIPH_INIT_SDMMC)
|
|
for (unsigned i = 0; i < SDMMC_NUMOF; i++) {
|
|
sdmmc_init(sdmmc_get_dev(i));
|
|
}
|
|
#endif
|
|
|
|
#endif /* MODULE_PERIPH_INIT */
|
|
}
|