]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/video/exynos_fimd.c
Merge branch 'u-boot-samsung/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / drivers / video / exynos_fimd.c
index 675d9e17758003019a2ee7783f9a105878070d08..cebbba7581e40c26992c6388c3d0552dac76c14b 100644 (file)
@@ -4,20 +4,7 @@
  * Author: InKi Dae <inki.dae@samsung.com>
  * Author: Donghwa Lee <dh09.lee@samsung.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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <config.h>
 #include <asm/io.h>
 #include <lcd.h>
 #include <div64.h>
+#include <fdtdec.h>
+#include <libfdt.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/cpu.h>
 #include "exynos_fb.h"
 
+DECLARE_GLOBAL_DATA_PTR;
+
 static unsigned long *lcd_base_addr;
 static vidinfo_t *pvid;
 static struct exynos_fb *fimd_ctrl;
@@ -82,18 +73,19 @@ static void exynos_fimd_set_par(unsigned int win_id)
        /* DATAPATH is DMA */
        cfg |= EXYNOS_WINCON_DATAPATH_DMA;
 
-       if (pvid->logo_on) /* To get proprietary LOGO */
-               cfg |= EXYNOS_WINCON_WSWP_ENABLE;
-       else /* To get output console on LCD */
-               cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
+       cfg |= EXYNOS_WINCON_HAWSWP_ENABLE;
 
        /* dma burst is 16 */
        cfg |= EXYNOS_WINCON_BURSTLEN_16WORD;
 
-       if (pvid->logo_on) /* To get proprietary LOGO */
-               cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
-       else /* To get output console on LCD */
+       switch (pvid->vl_bpix) {
+       case 4:
                cfg |= EXYNOS_WINCON_BPPMODE_16BPP_565;
+               break;
+       default:
+               cfg |= EXYNOS_WINCON_BPPMODE_24BPP_888;
+               break;
+       }
 
        writel(cfg, (unsigned int)&fimd_ctrl->wincon0 +
                        EXYNOS_WINCON(win_id));
@@ -264,7 +256,21 @@ void exynos_fimd_lcd_init(vidinfo_t *vid)
 {
        unsigned int cfg = 0, rgb_mode;
        unsigned int offset;
+#ifdef CONFIG_OF_CONTROL
+       unsigned int node;
+
+       node = fdtdec_next_compatible(gd->fdt_blob,
+                                       0, COMPAT_SAMSUNG_EXYNOS_FIMD);
+       if (node <= 0)
+               debug("exynos_fb: Can't get device node for fimd\n");
+
+       fimd_ctrl = (struct exynos_fb *)fdtdec_get_addr(gd->fdt_blob,
+                                                               node, "reg");
+       if (fimd_ctrl == NULL)
+               debug("Can't get the FIMD base address\n");
+#else
        fimd_ctrl = (struct exynos_fb *)samsung_get_base_fimd();
+#endif
 
        offset = exynos_fimd_get_base_offset();