Skip to content

Commit

Permalink
drivers/mmc: Add support for bus driver
Browse files Browse the repository at this point in the history
Bus driver support is needed for nrf53 but it
can be used with any MCU that has SPI driver
support (in contrast to just SPI HAL)

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
  • Loading branch information
kasjer committed Aug 1, 2023
1 parent b1a186a commit 2a7206a
Show file tree
Hide file tree
Showing 4 changed files with 387 additions and 63 deletions.
14 changes: 14 additions & 0 deletions hw/drivers/mmc/include/mmc/mmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

#include "os/mynewt.h"
#include <disk/disk.h>
#if MYNEWT_VAL(BUS_DRIVER_PRESENT)
#include <bus/drivers/spi_common.h>
#endif

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -96,6 +99,17 @@ mmc_write(uint8_t mmc_id, uint32_t addr, const void *buf, uint32_t len);
int
mmc_ioctl(uint8_t mmc_id, uint32_t cmd, void *arg);

#if MYNEWT_VAL(BUS_DRIVER_PRESENT)
struct mmc_config {
struct bus_spi_node_cfg spi_cfg;
};
struct mmc {
struct bus_spi_node node;
};

int mmc_create_dev(struct mmc *mmc, const char *name, struct mmc_config *mmc_cfg);
#endif

#ifdef __cplusplus
}
#endif
Expand Down
6 changes: 6 additions & 0 deletions hw/drivers/mmc/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ pkg.keywords:

pkg.deps:
- "@apache-mynewt-core/hw/hal"

pkg.deps.BUS_DRIVER_PRESENT:
- "@apache-mynewt-core/hw/bus/drivers/spi_common"

pkg.init.MMC_AUTO_MOUNT:
mmc_pkg_init: MYNEWT_VAL(MMC_PKG_SYSINIT_STAGE)
Loading

0 comments on commit 2a7206a

Please sign in to comment.