Skip to content

Commit

Permalink
mvebu: clearfog: Detect MMC vs SDHC and fixup fdt
Browse files Browse the repository at this point in the history
The Clearfog devices have only one SDHC device.  This
is either eMMC if it is populated on the SOM or SDHC
if not.  Detect if the device is an eMMC and fixup the
device-tree so it will be detected by Linux.

Signed-off-by: Jon Nettleton <jon@solid-run.com>
  • Loading branch information
jnettlet committed Mar 23, 2018
1 parent 496776b commit 19a96f7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions board/solidrun/clearfog/clearfog.c
Expand Up @@ -8,6 +8,7 @@
#include <dm.h>
#include <i2c.h>
#include <miiphy.h>
#include <mmc.h>
#include <netdev.h>
#include <rtc.h>
#include <asm/io.h>
Expand Down Expand Up @@ -183,3 +184,29 @@ int board_eth_init(bd_t *bis)
cpu_eth_init(bis); /* Built in controller(s) come first */
return pci_eth_init(bis);
}

static bool has_emmc(void)
{
struct mmc *mmc;
mmc = find_mmc_device(0);
if (!mmc)
return 0;
return (!mmc_init(mmc) && IS_MMC(mmc)) ? true : false;
}

#ifdef CONFIG_OF_LIBFDT
int ft_board_setup(void *blob, bd_t *bd)
{
__maybe_unused int offset;

if (has_emmc()) {
offset = fdt_path_offset(blob, "/soc/internal-regs/sdhci@d8000");
if (offset >= 0) {
fdt_delprop(blob, offset, "cd-gpios");
fdt_setprop_empty(blob, offset, "non-removable");
}
}

return 0;
}
#endif
1 change: 1 addition & 0 deletions configs/clearfog_defconfig
Expand Up @@ -63,3 +63,4 @@ CONFIG_RTC_MVEBU=y
CONFIG_SCSI=y
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_NET_RANDOM_ETHADDR_OUI="d0:63:b4:00:00:00"
CONFIG_OF_BOARD_SETUP=y

0 comments on commit 19a96f7

Please sign in to comment.