summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/tqmls1046a/board.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-05-10 18:15:50 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-05-10 18:15:50 +0200
commite7dad8c88a19e7130b4241bfe1f251620850ce4b (patch)
treea75ceec92f5e08744f09fc0a4acda4b21d3c21c4 /arch/arm/boards/tqmls1046a/board.c
parentf33d27e9715a7ff077d603162b1def42cd408317 (diff)
parent51d850a0a8e736d6883f981bbea108dd9e110b0a (diff)
downloadbarebox-e7dad8c88a19e7130b4241bfe1f251620850ce4b.tar.gz
barebox-e7dad8c88a19e7130b4241bfe1f251620850ce4b.tar.xz
Merge branch 'for-next/layerscape'
Diffstat (limited to 'arch/arm/boards/tqmls1046a/board.c')
-rw-r--r--arch/arm/boards/tqmls1046a/board.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/arm/boards/tqmls1046a/board.c b/arch/arm/boards/tqmls1046a/board.c
index 5d6d5ad62c..8cc4d73de5 100644
--- a/arch/arm/boards/tqmls1046a/board.c
+++ b/arch/arm/boards/tqmls1046a/board.c
@@ -3,10 +3,15 @@
#include <common.h>
#include <init.h>
#include <envfs.h>
+#include <bbu.h>
+#include <bootsource.h>
#include <asm/memory.h>
#include <linux/sizes.h>
#include <linux/clk.h>
#include <linux/clkdev.h>
+#include <soc/fsl/immap_lsch2.h>
+#include <mach/bbu.h>
+#include <mach/layerscape.h>
static int tqmls1046a_mem_init(void)
{
@@ -21,11 +26,39 @@ mem_initcall(tqmls1046a_mem_init);
static int tqmls1046a_postcore_init(void)
{
+ struct ccsr_scfg *scfg = IOMEM(LSCH2_SCFG_ADDR);
+ enum bootsource bootsource;
+ unsigned long sd_bbu_flags = 0, qspi_bbu_flags = 0;
+
if (!of_machine_is_compatible("tqc,tqmls1046a"))
return 0;
defaultenv_append_directory(defaultenv_tqmls1046a);
+ /* Configure iomux for i2c4 */
+ out_be32(&scfg->rcwpmuxcr0, 0x3300);
+
+ /* divide CGA1/CGA2 PLL by 24 to get QSPI interface clock */
+ out_be32(&scfg->qspi_cfg, 0x30100000);
+
+ bootsource = ls1046_bootsource_get();
+
+ switch (bootsource) {
+ case BOOTSOURCE_MMC:
+ of_device_enable_path("/chosen/environment-sd");
+ sd_bbu_flags = BBU_HANDLER_FLAG_DEFAULT;
+ break;
+ case BOOTSOURCE_SPI_NOR:
+ of_device_enable_path("/chosen/environment-qspi");
+ qspi_bbu_flags = BBU_HANDLER_FLAG_DEFAULT;
+ break;
+ default:
+ break;
+ }
+
+ ls1046a_bbu_mmc_register_handler("sd", "/dev/mmc0.barebox", sd_bbu_flags);
+ ls1046a_bbu_qspi_register_handler("qspi", "/dev/qspiflash0.barebox", qspi_bbu_flags);
+
return 0;
}