]> git.sur5r.net Git - u-boot/blobdiff - board/wandboard/wandboard.c
Merge branch 'next' of git://git.denx.de/u-boot-mpc83xx
[u-boot] / board / wandboard / wandboard.c
index bb983528b9a5905addc2a4947c683548ec2b272b..23a78c1663852ed46774762b2c38699a4a49f6e7 100644 (file)
@@ -3,16 +3,15 @@
  *
  * Author: Fabio Estevam <fabio.estevam@freescale.com>
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <asm/arch/clock.h>
+#include <asm/arch/crm_regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/mx6-pins.h>
+#include <asm/arch/mxc_hdmi.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
 #include <asm/imx-common/iomux-v3.h>
 #include <asm/sizes.h>
 #include <common.h>
 #include <fsl_esdhc.h>
+#include <ipu_pixfmt.h>
 #include <mmc.h>
 #include <miiphy.h>
 #include <netdev.h>
+#include <linux/fb.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -44,7 +45,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int dram_init(void)
 {
-       gd->ram_size = CONFIG_DDR_MB * SZ_1M;
+       gd->ram_size = (phys_size_t)CONFIG_DDR_MB * 1024 * 1024;
 
        return 0;
 }
@@ -206,6 +207,52 @@ int board_phy_config(struct phy_device *phydev)
        return 0;
 }
 
+#if defined(CONFIG_VIDEO_IPUV3)
+static struct fb_videomode const hdmi = {
+       .name           = "HDMI",
+       .refresh        = 60,
+       .xres           = 1024,
+       .yres           = 768,
+       .pixclock       = 15385,
+       .left_margin    = 220,
+       .right_margin   = 40,
+       .upper_margin   = 21,
+       .lower_margin   = 7,
+       .hsync_len      = 60,
+       .vsync_len      = 10,
+       .sync           = FB_SYNC_EXT,
+       .vmode          = FB_VMODE_NONINTERLACED
+};
+
+int board_video_skip(void)
+{
+       int ret;
+
+       ret = ipuv3_fb_init(&hdmi, 0, IPU_PIX_FMT_RGB24);
+
+       if (ret)
+               printf("HDMI cannot be configured: %d\n", ret);
+
+       imx_enable_hdmi_phy();
+
+       return ret;
+}
+
+static void setup_display(void)
+{
+       struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
+       int reg;
+
+       enable_ipu_clock();
+       imx_setup_hdmi();
+
+       reg = readl(&mxc_ccm->chsccdr);
+       reg |= (CHSCCDR_CLK_SEL_LDB_DI0
+               << MXC_CCM_CHSCCDR_IPU1_DI0_CLK_SEL_OFFSET);
+       writel(reg, &mxc_ccm->chsccdr);
+}
+#endif /* CONFIG_VIDEO_IPUV3 */
+
 int board_eth_init(bd_t *bis)
 {
        int ret;
@@ -222,9 +269,21 @@ int board_eth_init(bd_t *bis)
 int board_early_init_f(void)
 {
        setup_iomux_uart();
+#if defined(CONFIG_VIDEO_IPUV3)
+       setup_display();
+#endif
        return 0;
 }
 
+/*
+ * Do not overwrite the console
+ * Use always serial for U-Boot console
+ */
+int overwrite_console(void)
+{
+       return 1;
+}
+
 #ifdef CONFIG_CMD_BMODE
 static const struct boot_mode board_boot_modes[] = {
        /* 4 bit bus width */