summaryrefslogtreecommitdiff
path: root/board/engicam/common
diff options
context:
space:
mode:
authorJagan Teki <jagan@amarulasolutions.com>2017-05-06 21:13:14 (GMT)
committerStefano Babic <sbabic@denx.de>2017-05-18 09:23:31 (GMT)
commitac880e774260f5e1988d173d5bf75ea10ee04aeb (patch)
treeb99768e2d38e954e7d7d7ab658bd0c5f7a3bffa7 /board/engicam/common
parenta81b0fd667e97742ca5a1e3a62213f142645897f (diff)
downloadu-boot-fsl-qoriq-ac880e774260f5e1988d173d5bf75ea10ee04aeb.tar.xz
engicam: common: Move common board code
Move possible common board code into common area from supported boards. Cc: Stefano Babic <sbabic@denx.de> Cc: Matteo Lisi <matteo.lisi@engicam.com> Cc: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Diffstat (limited to 'board/engicam/common')
-rw-r--r--board/engicam/common/Makefile1
-rw-r--r--board/engicam/common/board.c56
-rw-r--r--board/engicam/common/board.h12
3 files changed, 69 insertions, 0 deletions
diff --git a/board/engicam/common/Makefile b/board/engicam/common/Makefile
index 6fd039c..6630fea 100644
--- a/board/engicam/common/Makefile
+++ b/board/engicam/common/Makefile
@@ -3,4 +3,5 @@
# SPDX-License-Identifier: GPL-2.0+
#
+obj-y := board.o
obj-$(CONFIG_SPL_BUILD) += spl.o
diff --git a/board/engicam/common/board.c b/board/engicam/common/board.c
new file mode 100644
index 0000000..8a83608
--- /dev/null
+++ b/board/engicam/common/board.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2016 Amarula Solutions B.V.
+ * Copyright (C) 2016 Engicam S.r.l.
+ * Author: Jagan Teki <jagan@amarulasolutions.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <mmc.h>
+#include <asm/arch/sys_proto.h>
+
+#include "board.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_ENV_IS_IN_MMC
+void mmc_late_init(void)
+{
+ char cmd[32];
+ char mmcblk[32];
+ u32 dev_no = mmc_get_env_dev();
+
+ setenv_ulong("mmcdev", dev_no);
+
+ /* Set mmcblk env */
+ sprintf(mmcblk, "/dev/mmcblk%dp2 rootwait rw", dev_no);
+ setenv("mmcroot", mmcblk);
+
+ sprintf(cmd, "mmc dev %d", dev_no);
+ run_command(cmd, 0);
+}
+#endif
+
+int board_init(void)
+{
+ /* Address of boot parameters */
+ gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+
+#ifdef CONFIG_NAND_MXS
+ setup_gpmi_nand();
+#endif
+
+#ifdef CONFIG_VIDEO_IPUV3
+ setup_display();
+#endif
+
+ return 0;
+}
+
+int dram_init(void)
+{
+ gd->ram_size = imx_ddr_size();
+
+ return 0;
+}
diff --git a/board/engicam/common/board.h b/board/engicam/common/board.h
new file mode 100644
index 0000000..9717e40
--- /dev/null
+++ b/board/engicam/common/board.h
@@ -0,0 +1,12 @@
+/*
+ * Copyright (C) 2016 Amarula Solutions B.V.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef _BOARD_H_
+#define _BOARD_H_
+void mmc_late_init(void);
+void setup_gpmi_nand(void);
+void setup_display(void);
+#endif /* _BOARD_H_ */