Skip to content

mmc: Implement central card-detection.

Mike Frysinger u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 Latest0 of 4 patches 0 repliesNew

Patches in v3 No applies recorded yet

None of the 4 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [U-Boot] [PATCH v3 0/4] mmc: Implement central card-detection.
Quoted 8 lines · On Tuesday 20 December 2011 03:52:39 Thierry Reding wrote:

This series of patches implements central card-detection within the MMC framework. Before this patch series, many boards actually did implement the board_mmc_getcd() function, but it wasn't used except by one driver (fsl_esdhc). Unfortunately, implementations interpreted the meaning of the cd parameter differently, some taking it to signal card absence and others using it to detect card presence. Furthermore, the signature of the board_mmc_getcd() function was not at all consistent with other MMC related functions.

as you've seen, GPIO pin detection is not novel or unique to any driver/SoC. i'd suggest instead finding a way to move this into "struct mmc". perhaps something like:

include/mmc.h:

struct mmc {
	...
#ifdef CONFIG_MMC_GPIO_CD
	unsigned gpio_cd;
#endif
	...
};

and then the default mmc_register() func can do:

#ifdef CONFIG_MMC_GPIO_CD
	if (!mmc->getcd)
		mmc->getcd = mmc_getcd_gpio;

#endif

and we can have the drivers/mmc/mmc.c:
#ifdef CONFIG_MMC_GPIO_CD
int mmc_getcd_gpio(struct mmc *mmc)

{
	return !gpio_get_value(mmc->getcd);
}

#endif

then mmc drivers can extend their register function to take a GPIO number (if they don't already). and then they get everything else for free.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111220/0c3d279b/attachment.pgp>