Commit graph

34 commits

Author SHA1 Message Date
Armin Brauns 444018f133 drivers/sdmmc_stm32: add eMMC support
The only difference is calling HAL_MMC_*() instead of HAL_SD_*() functions,
and removing the card detect logic.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2024-03-11 17:23:38 +01:00
Nick Ward 2d65acca3a drivers: gpio: use gpio_is_ready_dt helper function
Update `struct gpio_dt_spec` use with gpio_is_ready_dt()

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-08-28 08:48:35 -05:00
Maxmillion McLaughlin 840c976760 drivers: disk: sdmmc_stm32 support for clock divisor
Adds support for a devicetree property that controls the ClockDiv
value provided to the SDIO during init.

Signed-off-by: Maxmillion McLaughlin <github@maxmclau.com>
2023-04-12 17:44:48 +02:00
Pieter De Gendt 6b532ff43e treewide: Update clock control API usage
Replace all (clock_control_subsys_t *) casts with (clock_control_subsys_t)

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-04-05 10:55:46 +02:00
Petr Hlineny 94847be172 drivers/disk: sdmmc stm32: Enable SDMMC Internal DMA on STM32L4plus mcu
STM32L4plus mcu has SDMMC internal DMA which works without any
configuration and it's handled by SDMMC HAL driver. This commit adds
option to enable it and use it.

Signed-off-by: Petr Hlineny <development@hlineny.cz>
2023-02-23 10:48:50 +01:00
Armin Brauns b2c75f423a drivers: disk: sdmmc_stm32: handle DMA errors instead of ignoring them
One was clearly a typo, the other should also be handled properly.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-02-20 12:40:45 +01:00
Erwan Gouriou e67b2fa60d drivers/disk: sdmmc stm32: Fix compilation issues
Fix a bunch of issues which were blocking driver compilation.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-24 09:42:51 +01:00
Erwan Gouriou 29a4eb3acc divers: disk: stm32 sdmmc: Configure clock through device tree
Similarly to what was done in USB or RNG drivers, configure 48MHz domain
clock using device tree.
By default a freq clock check is enabled.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-19 20:58:15 -08:00
Armin Brauns fc0157f97c drivers: disk: reset stm32 SDMMC peripheral during init
This is important for applications which are chain-loaded by a broken
bootloader which doesn't reset the peripheral before handing over control.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-01-17 11:27:16 +01:00
Declan Snyder e1d309c17b drivers: disk: Framework for eMMC
Framework for using eMMC with disk subsystem.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Francois Ramu 2ed292e1be drivers: stm32: do not enable the HSI48 locally
The HSI48 is enabled by clock control driver.
It is no more done by each driver that requires this clock
However when using rng or sdmmc or bluetooth/ipm or usb,
the HSI48 clock must be present in the DTS.
Add a warning for this particular check but keep the deprecated
HSI48 clock enable : keeping for legacy but to remove later.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-07 10:03:11 +00:00
Gerard Marull-Paretas 178bdc4afc include: add missing zephyr/irq.h include
Change automated searching for files using "IRQ_CONNECT()" API not
including <zephyr/irq.h>.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-17 22:57:39 +09:00
Guillaume Gautier aba432348b drivers: Cleans variable scopes for STM32 drivers
Fix the scope of some variables in various STM32 drivers including:
 - SDMMC
 - DMA
 - OSPI/QSPI Flash
 - Interrupt controller

The variables are set static instead of global and const if appropriate.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-10-12 18:41:48 +02:00
Gerson Fernando Budke fba21ecfd9 drivers: disk: sdmmc: Enable STM32L5X support
* Enable hardware flow control on Kconfig
 * Enable HSI48 clock on sdmmc_stm32 driver

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2022-09-09 09:56:51 +00:00
Francois Ramu e133ebfe2e drivers: sdmmc: stm32 enables HSI48 MHz clock by default
For some stm32 devices, the SDMMC clock selection is HSI 48MHz
by default (reset value). It must be enabled before acccessing
the peripheral.
The ErrorCode is reported when Init fails.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-07 15:35:10 +02:00
Gerard Marull-Paretas a202341958 devices: constify device pointers initialized at compile time
Many device pointers are initialized at compile and never changed. This
means that the device pointer can be constified (immutable).

Automated using:

```
perl -i -pe 's/const struct device \*(?!const)(.*)= DEVICE/const struct
device *const $1= DEVICE/g' **/*.c
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-22 17:08:26 +02:00
John Kjellberg 6076991fdb drivers/disk: sdmmc: Add DMA support.
This fixes underrun issues when hardware flow control can't be used.

Only tested on STM32F4.

Signed-off-by: John Kjellberg <kjellberg.john@gmail.com>

...
2022-08-15 14:31:35 +02:00
Henrik Brix Andersen e7df446f64 drivers: disk: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Kumar Gala 0cb22dfa1d drivers: disk: sdmmc_stm32: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 06:40:02 -05:00
John Kjellberg 27179a53f8 drivers/disk: sdmmc: Fix build for STM32F4
Closes #46734

Signed-off-by: John Kjellberg <kjellberg.john@gmail.com>
2022-06-23 09:10:43 +02:00
Benedikt Schmidt 36b9da8874 drivers/disk: sdmmc: stm32: configurable SDMMC bus width
Make the SDMMC bus width for STM32 configurable.
Fixes #45021.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2022-06-16 10:28:26 +02:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Gerard Marull-Paretas 5dc6ed3ce3 pinctrl: require ; after PINCTRL_DT_(INST_)DEFINE macros
The PINCTRL_DT_(INST_)DEFINE macros already defined the trailing ;,
making its usage inconsistent with other macros such as
DEVICE_DT_DEFINE.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-01 07:39:08 -05:00
Erwan Gouriou d55905b2f7 drivers/disk: sdmmc: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou 608b358d6b drivers/disk: sdmmc: stm32: err var init is not required
err is set unconditionally in these functions.
No need to initialize it.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-04 09:40:47 -04:00
Erwan Gouriou 34a50e313d drivers/disk: sdmmc: stm32: Enable hw fc only after card init
During SDMMC card init, HW_FC is disabled by default, overwriting
driver configuration.
To avoid this, move HW FC configuration after card init.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-04 09:40:47 -04:00
Erwan Gouriou 9f6246c325 drivers/disk: sdmmc_stm32: Add Hardware FC Kconfig option
Add a Kconfig symbol to enable use of SDMMC hardware flow control.
In specific cases, this feature could help to avoid FIFO ovderrun
and underrun errors.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-02 22:20:36 -04:00
Erwan Gouriou 8bd5549021 drivers/disk: sdmmc_stm32: Convert driver to IT driven mode for r/w
Add IT driven read/write access.
2 new semaphores are added to protect IT driven procedures.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-02 22:20:36 -04:00
John Kjellberg 0647b2e0a8 disk: Add support for MCUs with SDIO drivers.
Use abstracted define to cover more MCUs.

Signed-off-by: John Kjellberg <kjellberg.john@gmail.com>
2021-07-16 18:57:17 -04:00
Erwan Gouriou fcc3177509 drivers/pinmux: stm32: Move stm32 driver from stm32/
Since we removed various series headers, move stm32 driver
under main driver/pinmux folder.
Take this change into account into various drivers.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-06-11 08:04:39 -05:00
Gerard Marull-Paretas 374d46c235 drivers: disk: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 16:41:29 -04:00
Johann Fischer 45d468bfdb include: move disk driver interface to own header
Move disk driver interface to own header and
separate disk access interface and disk driver interface.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-23 12:16:01 +01:00
Johann Fischer 69a5f07d16 drivers: disk: cleanup after driver relocation
Add common SDMMC_LOG_LEVEL and SDMMC_VOLUME_NAME.
Initialize drivers at POST_KERNEL level.
Update CODEOWNERS after sdmmc drivers relocation.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-23 12:16:01 +01:00
Johann Fischer 03101e75d8 disk: move disk and sdmmc controller drivers to drivers/disk
The files disk_access_usdhc.c, disk_access_spi_sdhc.c,
disk_access_stm32_sdmmc.c, disk_access_ram.c and
disk_access_flash.c are actually drivers for block devices and SD/MMC
controllers. This patch moves this drivers to drivers/disk and
reworks the configuration so that the drivers are selected when
the corresponding node is enabled.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-23 12:16:01 +01:00
Renamed from subsys/disk/disk_access_stm32_sdmmc.c (Browse further)