-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Add missing peripheral support on STM32F1 #81181
base: main
Are you sure you want to change the base?
Changes from all commits
13b5dc8
891aaba
9146cd4
c26526b
b94c7a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
LOG_MODULE_REGISTER(stm32_sdmmc, CONFIG_SDMMC_LOG_LEVEL); | ||
|
||
#define STM32_SDMMC_USE_DMA DT_NODE_HAS_PROP(DT_DRV_INST(0), dmas) | ||
#define STM32_SDMMC_USE_RESET !DT_NODE_HAS_COMPAT(DT_DRV_INST(0), st_stm32f1_sdmmc) | ||
|
||
#if STM32_SDMMC_USE_DMA | ||
#include <zephyr/drivers/dma.h> | ||
|
@@ -84,7 +85,9 @@ | |
struct gpio_dt_spec pe; | ||
struct stm32_pclken *pclken; | ||
const struct pinctrl_dev_config *pcfg; | ||
#if STM32_SDMMC_USE_RESET | ||
const struct reset_dt_spec reset; | ||
#endif | ||
|
||
#if STM32_SDMMC_USE_DMA | ||
struct sdmmc_dma_stream dma_rx; | ||
|
@@ -302,11 +305,13 @@ | |
return err; | ||
} | ||
|
||
#if STM32_SDMMC_USE_RESET | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Using This being said proposed code is aligned with DMA handling, so keeping it this way could be ok as well. This is readability vs consistency .. |
||
err = reset_line_toggle_dt(&priv->reset); | ||
if (err) { | ||
LOG_ERR("failed to reset peripheral"); | ||
return err; | ||
} | ||
#endif | ||
|
||
#ifdef CONFIG_SDMMC_STM32_EMMC | ||
err = HAL_MMC_Init(&priv->hsd); | ||
|
@@ -690,10 +695,12 @@ | |
return -ENODEV; | ||
} | ||
|
||
#if STM32_SDMMC_USE_RESET | ||
if (!device_is_ready(priv->reset.dev)) { | ||
LOG_ERR("reset control device not ready"); | ||
return -ENODEV; | ||
} | ||
#endif | ||
|
||
/* Configure dt provided device signals when available */ | ||
err = pinctrl_apply_state(priv->pcfg, PINCTRL_STATE_DEFAULT); | ||
|
@@ -804,7 +811,7 @@ | |
.Init.ClockDiv = DT_INST_PROP(0, clk_div), | ||
#endif | ||
}, | ||
#if DT_INST_NODE_HAS_PROP(0, cd_gpios) | ||
Check notice on line 814 in drivers/disk/sdmmc_stm32.c GitHub Actions / Run compliance checks on patch series (PR)You may want to run clang-format on this change
|
||
.cd = GPIO_DT_SPEC_INST_GET(0, cd_gpios), | ||
#endif | ||
#if DT_INST_NODE_HAS_PROP(0, pwr_gpios) | ||
|
@@ -812,11 +819,13 @@ | |
#endif | ||
.pclken = pclken_sdmmc, | ||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0), | ||
#if STM32_SDMMC_USE_RESET | ||
.reset = RESET_DT_SPEC_INST_GET(0), | ||
#endif | ||
SDMMC_DMA_CHANNEL(rx, RX) | ||
SDMMC_DMA_CHANNEL(tx, TX) | ||
}; | ||
|
||
Check notice on line 828 in drivers/disk/sdmmc_stm32.c GitHub Actions / Run compliance checks on patch series (PR)You may want to run clang-format on this change
|
||
DEVICE_DT_INST_DEFINE(0, disk_stm32_sdmmc_init, NULL, | ||
&stm32_sdmmc_priv_1, NULL, POST_KERNEL, | ||
CONFIG_SD_INIT_PRIORITY, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) 2024 Benjamin Björnsson [email protected] | ||
|
||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
description: | | ||
ST STM32F1 family SDIO | ||
Remove the resets property since there's no reset register | ||
for AHB peripherals on F1 series. | ||
|
||
compatible: "st,stm32f1-sdmmc" | ||
|
||
include: | ||
- name: st,stm32-sdmmc.yaml | ||
property-blocklist: | ||
- resets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not
DT_NODE_HAS_PROP(DT_DRV_INST(0), reset)
?