Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ea239d9 authored by Pierre Ossman's avatar Pierre Ossman
Browse files

mmc: add bus handler



Delegate protocol handling to "bus handlers". This allows the core to
just handle the task of arbitrating the bus. Initialisation and
pampering of cards is now done by the different bus handlers.

This design also allows MMC and SD (and later SDIO) to be more cleanly
separated, allowing easier maintenance.

Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
parent b2670b1c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7,5 +7,5 @@ ifeq ($(CONFIG_MMC_DEBUG),y)
endif

obj-$(CONFIG_MMC)		+= mmc_core.o
mmc_core-y			:= core.o sysfs.o mmc_ops.o sd_ops.o
mmc_core-y			:= core.o sysfs.o mmc.o mmc_ops.o sd.o sd_ops.o
+136 −681

File changed.

Preview size limit exceeded, changes collapsed.

+37 −0
Original line number Diff line number Diff line
@@ -15,7 +15,44 @@

#define MMC_CMD_RETRIES        3

struct mmc_bus_ops {
	void (*remove)(struct mmc_host *);
	void (*detect)(struct mmc_host *);
};

void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
void mmc_detach_bus(struct mmc_host *host);

void __mmc_release_bus(struct mmc_host *host);

static inline void mmc_bus_get(struct mmc_host *host)
{
	unsigned long flags;

	spin_lock_irqsave(&host->lock, flags);
	host->bus_refs++;
	spin_unlock_irqrestore(&host->lock, flags);
}

static inline void mmc_bus_put(struct mmc_host *host)
{
	unsigned long flags;

	spin_lock_irqsave(&host->lock, flags);
	host->bus_refs--;
	if ((host->bus_refs == 0) && host->bus_ops)
		__mmc_release_bus(host);
	spin_unlock_irqrestore(&host->lock, flags);
}

void mmc_set_chip_select(struct mmc_host *host, int mode);
void mmc_set_clock(struct mmc_host *host, unsigned int hz);
void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode);
void mmc_set_bus_width(struct mmc_host *host, unsigned int width);
u32 mmc_select_voltage(struct mmc_host *host, u32 ocr);
void mmc_set_timing(struct mmc_host *host, unsigned int timing);

struct mmc_card *mmc_alloc_card(struct mmc_host *host);

static inline void mmc_delay(unsigned int ms)
{

drivers/mmc/core/mmc.c

0 → 100644
+430 −0

File added.

Preview size limit exceeded, changes collapsed.

drivers/mmc/core/sd.c

0 → 100644
+431 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading