Commit graph

9 commits

Author SHA1 Message Date
Pisit Sawangvonganan 8534c38232 sd: omit zero-initialization for sdhc_command and sdhc_data structures
The decision to omit zero-initialization is driven by a desire to enhance
Zephyr's compactness and efficiency.

This is achieved by omitting zero-initialization, thereby reducing the
instruction count and, as a byproduct, the code size.

After a thorough review of the usage of struct sdhc_command and sdhc_data,
it has been determined that zero-initialization can be omitted.
Only a portion of the fields need to be manually initialized.
(e.g. cmd.retries, data.block_addr)

For the uninitialized fields, it can be expected from successful
operations that data will be appropriately written back from
the underlying layer.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-25 20:13:25 +01:00
Pisit Sawangvonganan 612aa7169a sd: add config SD_CMD_RETRIES
Introduced the config SD_CMD_RETRIES option as a build-time parameter.
This allows the assignment of a specific value to cmd.retries.
The default value has been set to 0 to preserve the previous setting.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-25 20:13:25 +01:00
Najumon B.A c5094776e9 sd: add check for maximum supported voltage by host controller
add check for maximum voltage supported by hc before apply card voltage.

Signed-off-by: Najumon B.A <najumon.ba@intel.com>
2023-09-29 16:29:00 +02:00
Declan Snyder cad243d59e sd: Changes framework to support MMC
- Adds mmc.c
- Edits sd.c to init and probe MMC
- Adds mmc init to sd_init
- Some functions from sdmmc.c should be in sd_ops because
they can be used by both sdmmc and mmc.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Declan Snyder 9fe18e05b4 sd: Changed Init Header Structure
In sd subsystem, made one header for all the init functions
instead of having a bunch of header files with one function.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Daniel DeGrasse b7cd970493 sd: add stub for SDIO support
Add stub code for SDIO support, capable of verifying card responds to CMD5.
This commit also changes the architecture of the SDIO probe step to make
adding new protocol support more streamlined, and enable compiling out
support for undesired protocols.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-14 09:22:22 +01: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
Daniel DeGrasse 64c5b93d5c sd: Add sdmmc protocol stack
Add SDMMC driver to subsystem. SDMMC driver will handle initialization,
as well as SDMMC I/O. SD mode support is currently supported, SPI mode
support is not.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Daniel DeGrasse 3e8bbee9ed sd: Add common SD initialization code
All SD cards require SD CMD0 (reset) and CMD8 (send IF cond) at boot.
Add this portion of the initialization flow to SD subsystem, as well as
query command to check if card is SDIO.

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