Commit graph

7 commits

Author SHA1 Message Date
Attie Grande a97b61e7ed include: sd: revise the minimum alignment of card_buffer to 4-bytes
Since a85ffa8, `struct sd_card.card_buffer` has naturally fallen at an
offset that is unaligned. This meant that on systems without support for
unaligned access (e.g: Cortex-M0), a hard fault would present when
executing code that casts the buffer to `uint32_t` (such as
`sdmmc_spi_read_cxd()`, `card_query_written()`, etc...)

Historically, it appears that the alignment of the `card_buffer` member
was good and operational only by chance.

Altering the default value of `CONFIG_SDHC_BUFFER_ALIGNMENT` was
rejected, as this has wider implications.

Fixes #62619

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2024-01-18 20:04:50 +01:00
Daniel DeGrasse 64878aa115 sd: add sdio header file
Add SDIO header file, defining functions supported by SDIO subsystem

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-11-06 19:01:08 -05:00
Mourad Kharrazi a85ffa8130 drivers: sdhc: allow bandwidth selection
The current implementation uses both, host and card capabilites to derive
the maximum bus width to be used. However, in cases where a MMC device is
not connected to the host via shdc using the full bus width of 8 lines,
device initialization fails. Introducing the `bus-width` property
circumvents this by reducing the host bus capabilites and forcing
communication with the MMC device using 1, 4 or 8 lines.

Signed-off-by: Mourad Kharrazi <mourad.kharrazi@ithinx.io>
2023-09-13 16:20:59 +02:00
Daniel DeGrasse b2172a97d8 sd: clean up sizes of some SD data fields
Clean up sizes of some SD data fields, as the max value of these fields
is limited by the SD specification

Specifically, the limits are as follows:
num_io: 0-7, 3 bits (SDIO only)
relative_addr: 16 bits (SDMMC/MMC)
block_size: 12 bits (Max of 2KB, uint16_t used)
sd_version: 8 bits (currently at version 3)
card_speed: 8 bits (could potentially be reduced in size)

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-08-31 10:19:37 +02:00
Declan Snyder 3bc095a810 sd: MMC API, and MMC Spec
- Adds the declaration of the MMC API
- Adds MMC spec related declarations
- Adds some properties to sdhc dts binding for mmc

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Gerard Marull-Paretas 6a0f554ffa include: add missing kernel.h include
Some files make use of Kernel APIs without including kernel.h, fix this
problem.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Daniel DeGrasse d90a16f591 include: sd: Add SD subsystem header files
Add SD subsystem headers. SD subsystem contains generic header for SD
initialization, and headers for SDIO and SDMMC cards.

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