Commit graph

36 commits

Author SHA1 Message Date
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
Daniel DeGrasse 102f4c25f8 drivers: disk: remove legacy SDMMC SPI driver
remove existing SDMMC SPI driver, since it is replaced by the SPI mode
SD host controller driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Daniel DeGrasse 409cc23022 drivers: disk: remove legacy nxp USDHC driver
all in tree SOCs with the USDHC peripheral have now been converted to
use the new SD host controller USDHC driver, so remove legacy NXP disk
USDHC driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Daniel DeGrasse a79f485487 drivers: disk: add SDMMC zephyr disk driver
Add generic sdmmc zephyr disk driver, which uses the SDMMC subsystem

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
John Kjellberg 81d1be76ea drivers/disk: sdmmc: stm32: DMA header requested on F4 serie
Even if not used DMA HAL is required in F4 SD HAL driver. Just
as for L4/F7 series that have been added before.
Add it for this specific serie.

Signed-off-by: John Kjellberg <kjellberg.john@gmail.com>
2022-04-05 11:17:08 +02:00
Daniel DeGrasse 54eb607392 drivers: disk: usdhc: enable pinctrl for usdhc driver
Enable pinctrl driver for usdhc. USDHC driver uses custom pinctrl states
for fast, slow, and medium signal frequencies, as well as pin pull for
SD detection.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Nazar Kazakov 9713f0d47c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-14 20:22:24 -04:00
Daniel DeGrasse 419dc385f2 drivers: usdhc: Add log for DAT3 detection
Add log to tell user when DAT3 detection method is in use

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-02-02 16:59:30 +01: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
Johann Fischer 72cbc04a73 drivers: ramdisk: add checks for the upper boundary
Add checks for the upper boundary in access_read/access_write
instead of the homeopathic ASSERTS.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-14 13:40:47 -06:00
Daniel DeGrasse 1328abe052 drivers: disk: USDHC: Update USDHC driver to pass disk test
USDHC driver did not pass disk test (failed during multiple writes). Add
logic to wait for the SD card to be idle before reading new data, so
that the test will pass. Also, add logic to reject OOB reads and writes
to the disk.

Fixes #39942

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-13 20:30:06 -05:00
Daniel DeGrasse 57f35bbf5a drivers: USDHC: Enable detection using DAT3 pulldown
Enable USDHC host to detect inserted SD card via DAT3 line pulldown.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-06 15:27:25 -05:00
Daniel DeGrasse 4712913872 drivers: USDHC: Update USDHC driver for RT11xx SOCs
RT11xx USDHC lacks some watermarking features that RT10xx SOCs include.
Place #ifdef guards around these features.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-06 15:27:25 -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 08bb61e0ff drivers/disk: sdmmc: stm32: DMA header requested on L4/F7 series
Even if not used DMA HAL is required in L4/F7 SD HAL driver.
Add them for these specific series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-08 10:58:49 -05: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
Mahesh Mahadevan a90c4c38a1 drivers: disk: Fix USDHC driver to return 0 on success
The function usdhc_board_access_init was returning a non-zero
value as the variable "ret" is also used to store the GPIO
level for card-detect.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-09-17 08:12:22 -04:00
Mahesh Mahadevan 387e6a676f drivers: disk: Update NXP USDHC driver
1. Do not throw an error when FSL_FEATURE_USDHC_HAS_HS400_MODE
   is defined
2. Add support for the case when the card detect is handled
   by the USDHC module

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-08-17 17:53:31 -04:00
Daniel Leung f6a3dcf282 drivers: disk: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -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
Frank Li 42333dc282 driver: usdhc: add option to disable 1.8v
When 1.8V is disabled, sdhc can only
communicate at low speed. But this can
save the external circuit for switching
between 3.3V and 1.8V, which is very
practical in costdown scenarios.

Signed-off-by: Frank Li <lgl88911@163.com>
2021-04-19 08:25:55 -05:00
Frank Li 6f97f52f34 driver: usdhc: modify LOG message
LOG API will auto add \r\n at output end,
remove the \r\n at the end of debug messge.

Fix misspelled.

Signed-off-by: Frank Li <lgl88911@163.com>
2021-04-06 08:13:24 -05:00
Frank Li 664aaf0bdc driver: usdhc: fix spec 1.0 sdcard can't work
The SD Card below Physical Layer 1.10 does not support CMD6.
When usdhc_sd_init is executed, it will fail to exit due to
execution of CMD6, causing the SD Card to not work normally.

For different SD Card Physical Layer specifications,
the following modifications have been made:
Version 1.10 and above support CMD6.
Version 3.0 and above support CMD6 Group 3 (driver strength
and current limit) .

Signed-off-by: Frank Li <lgl88911@163.com>
2021-04-06 08:13:24 -05:00
Andrzej Puzdrowski 1960a5d234 disk/disk_acces_flash: remove flash_write_protection_set() usage
This patch removes scenario which was testing deprecated
API behaviors. Needed as As flash_write_protection_set() was
deprecated and became no-operation.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Rich Barlow 9f2a65e74e disk: sdhc: Switch to clock frequency from DTS
The "spi-max-frequency" property already exists, but was unused. This
now sets the SPI clock frequency to this value (limited to 24MHz) once
initialisation is complete.

Due to the nature of the SPI API, it is necessary to have two separate
configuration structures to switch clock speed as some SPI drivers only
compare pointers to detect changes.

Fixes: #32996

Signed-off-by: Rich Barlow <rich@bennellick.com>
2021-03-26 08:34:43 -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