diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2016-03-02 15:59:21 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-03-02 15:59:23 +0100 |
commit | 572cfe6b52704c9273f0f245da19e3edb5aa797e (patch) | |
tree | 2179473f5b4086be20f5f61b85f5a68bcc511b2f /arch/arm/boards/karo-tx6x | |
parent | 294beb87b11a5dac0ea2f1efae0a1c8631ab38fa (diff) | |
download | barebox-572cfe6b52704c9273f0f245da19e3edb5aa797e.tar.gz barebox-572cfe6b52704c9273f0f245da19e3edb5aa797e.tar.xz |
ARM: i.MX: karo-tx6: Support eMMC board variants
The TX6 board come with either NAND flash or eMMC as primary
storage medium. This adds support for the eMMC variants.
We can detect if we have NAND or eMMC by looking at the
bootsource which will be configured accordingly. This
way we can modify the device tree during runtime and do
not have to create a new image.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/boards/karo-tx6x')
-rw-r--r-- | arch/arm/boards/karo-tx6x/board.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/arch/arm/boards/karo-tx6x/board.c b/arch/arm/boards/karo-tx6x/board.c index a921541bfc..346c4b9aa6 100644 --- a/arch/arm/boards/karo-tx6x/board.c +++ b/arch/arm/boards/karo-tx6x/board.c @@ -183,8 +183,13 @@ static void eth_init(void) writel(val, iomux + IOMUXC_GPR1); } +#define IMX6_SRC_SBMR1 0x04 + static int tx6x_devices_init(void) { + void __iomem *src_base = IOMEM(MX6_SRC_BASE_ADDR); + uint32_t sbmr1; + if (!of_machine_is_compatible("karo,imx6dl-tx6dl") && !of_machine_is_compatible("karo,imx6q-tx6q")) return 0; @@ -195,7 +200,26 @@ static int tx6x_devices_init(void) setup_pmic_voltages(); - imx6_bbu_nand_register_handler("nand", BBU_HANDLER_FLAG_DEFAULT); + sbmr1 = readl(src_base + IMX6_SRC_SBMR1); + + /* + * Check if this board is booted from eMMC or NAND to enable the + * corresponding device. We can't use the regular bootsource + * function here as it might return that we are in serial + * downloader mode. Even if we are SBMR1[7] indicates whether + * this board has eMMC or NAND. + */ + if (sbmr1 & (1 << 7)) { + imx6_bbu_nand_register_handler("nand", BBU_HANDLER_FLAG_DEFAULT); + of_device_enable_and_register_by_name("environment-nand"); + of_device_enable_and_register_by_name("gpmi-nand@00112000"); + } else { + imx6_bbu_internal_mmc_register_handler("eMMC", "/dev/mmc3.boot0", + BBU_HANDLER_FLAG_DEFAULT); + of_device_enable_and_register_by_name("environment-emmc"); + of_device_enable_and_register_by_name("usdhc@0219c000"); + } + return 0; } |