Commit graph

19 commits

Author SHA1 Message Date
Daniel DeGrasse bf61a47887 drivers: sdhc: imx_usdhc: extend reset timeout duration
Some instances of the USDHC peripheral take longer to reset, and will
timeout with the previous delay of 100 cycles. Extend this delay to 1000
cycles to resolve this.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-05-14 20:23:28 -04:00
Daniel DeGrasse da9361e544 drivers: sdhc: imx_usdhc: remove dead code for waiting for clock gate
Remove function for waiting for clock gate, as this is not used anywhere
within the USDHC driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-05-14 20:23:28 -04:00
Daniel DeGrasse bd17c86299 drivers: sdhc: imx_usdhc: move voltage selection to separate function
Some USDHC IP instances do not have the voltage control bit present, as
they can only operate at 3.3V. Move code to select 1.8V mode into a
separate helper, and guard the call to UDSHC_SelectVoltage() behind a
feature macro from MCUX SDK.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-05-14 20:23:28 -04:00
Daniel DeGrasse 2236eaf52c drivers: sdhc: imx_usdhc: add explicit fallthrough to I/O timing setup
DDR50/DDR52 modes should use PINCTRL_STATE_SLOW (50MHz), so the lack of a
break statement after enabling DDR mode is expected. Add an explicit
__fallthrough to resolve the issue flagged by coverity scan

Fixes #65324

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-12-12 10:57:20 +01:00
Daniel DeGrasse 0b365359dc drivers: sdhc: imx_usdhc: explicitly set host_io fields
Explicitly set host_io fields, instead of using memset(). This way the
fields should have values that are defined in the enum types for each
field.

Fixes #63130

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-12-12 10:57:20 +01:00
Daniel DeGrasse 7ca3aec97e drivers: sdhc: imx_usdhc: Initialize card clock with CMD0
Use CMD0 to detect card initialization, rather than using card power on.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-11-06 19:01:08 -05:00
Daniel DeGrasse a517d79eff drivers: sdhc: imx_usdhc: enable DDR50 mode
Enable support for DDR50 mode within imx usdhc driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-11-06 19:01:08 -05:00
Daniel DeGrasse c28ffb4305 drivers: sdhc: imx_usdhc: add support for SDIO RW extended command
Add support for CMD53 (read/write extended) to imx USDHC driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-11-06 19:01:08 -05:00
Daniel DeGrasse 69aaed1266 drivers: sdhc: imx_usdhc: add support for card interrupts
Add support for card interrupt sources to USDHC driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-11-06 19:01:08 -05:00
Gerard Marull-Paretas c4c5f57d59 drivers: all: imx: remove conditional support for pinctrl
The iMX platform always uses pinctrl, there's no need to keep
extra macrology around pinctrl. Also updated driver's Kconfig to `select
PINCTRL`.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-24 13:34:22 +02:00
Declan Snyder 4fe04f9a85 drivers: sdhc: Support HS400 mode on IMX driver
Enables HS400 mode on mimxrt595_evk

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Declan Snyder f7e026f655 drivers: sdhc: Adds MMC functionality to IMX USDHC
Adds MMC support to IMX USDHC driver.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Declan Snyder 26ad12f55e drivers: sdhc: Fixes IMX SDHC DMA support
Enables DMA support for cacheless IMX systems.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01: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
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Henrik Brix Andersen 9c1833b2e8 drivers: sdhc: 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
Daniel DeGrasse e2fe582d62 drivers: sdhc: Add SD response type masks
Add SD response type masks, to allow drivers to mask out the
SPI or SD native mode response type based on the SD host controller
mode they use.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-09 08:46:29 -05:00
Daniel DeGrasse c91d473ead drivers: imx_usdhc: change DT_COMPAT string to imx-usdhc
with the legacy USDHC driver fully removed from the tree, the
nxp,imx-usdhc binding can now be used for the new SD host controller
driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Daniel DeGrasse 6aaa2b5d33 drivers: sdhc: Implement NXP USDHC SDHC driver
Implement SDHC driver for NXP USDHC peripheral, supporting all api calls
available in the sdhc driver. This implementation leverages NXP's HAL,
and simply implements a shim layer over the HAL itself.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00