Re: [U-Boot] [PATCH V3 4/9] video: exynos_fimd: Add framework to disable FIMD sysmmu

2014-07-10 Thread Ajay kumar
Hi Simon,

On Fri, Jul 11, 2014 at 9:17 AM, Simon Glass  wrote:
> On 4 July 2014 07:19, Ajay Kumar  wrote:
>>
>> On Exynos5420 and newer versions, the FIMD sysmmus are in
>> "on state" by default.
>> We have to disable them in order to make FIMD DMA work.
>> This patch adds the required framework to exynos_fimd driver,
>> and disables FIMD sysmmu on Exynos5420.
>>
>> Signed-off-by: Ajay Kumar 
>
>
> Acked-by: Simon Glass 
>
> (was there supposed to be a change log or is this a new patch?)
This is old patch with a new compatible string as in kernel.

I have added the change log in coverletter:
[PATCH V3 0/9] peach_pit: Add support for FIMD, DP and parade chip

Regards,
Ajay Kumar
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V3 4/9] video: exynos_fimd: Add framework to disable FIMD sysmmu

2014-07-10 Thread Simon Glass
On 4 July 2014 07:19, Ajay Kumar  wrote:
>
> On Exynos5420 and newer versions, the FIMD sysmmus are in
> "on state" by default.
> We have to disable them in order to make FIMD DMA work.
> This patch adds the required framework to exynos_fimd driver,
> and disables FIMD sysmmu on Exynos5420.
>
> Signed-off-by: Ajay Kumar 


Acked-by: Simon Glass 

(was there supposed to be a change log or is this a new patch?)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH V3 4/9] video: exynos_fimd: Add framework to disable FIMD sysmmu

2014-07-04 Thread Ajay Kumar
On Exynos5420 and newer versions, the FIMD sysmmus are in
"on state" by default.
We have to disable them in order to make FIMD DMA work.
This patch adds the required framework to exynos_fimd driver,
and disables FIMD sysmmu on Exynos5420.

Signed-off-by: Ajay Kumar 
---
 arch/arm/dts/exynos54xx.dtsi |   10 ++
 doc/device-tree-bindings/video/exynos-fb.txt |6 
 drivers/video/exynos_fimd.c  |   43 ++
 include/fdtdec.h |1 +
 lib/fdtdec.c |1 +
 5 files changed, 61 insertions(+)

diff --git a/arch/arm/dts/exynos54xx.dtsi b/arch/arm/dts/exynos54xx.dtsi
index b9f8e0b..c21d798 100644
--- a/arch/arm/dts/exynos54xx.dtsi
+++ b/arch/arm/dts/exynos54xx.dtsi
@@ -113,6 +113,16 @@
status = "disabled";
};
 
+   fimdm0_sysmmu@0x1464 {
+   compatible = "samsung,sysmmu-v3.3";
+   reg = <0x1464 0x100>;
+   };
+
+   fimdm1_sysmmu@0x1468 {
+   compatible = "samsung,sysmmu-v3.3";
+   reg = <0x1468 0x100>;
+   };
+
fimd@1440 {
/* sysmmu is not used in U-Boot */
samsung,disable-sysmmu;
diff --git a/doc/device-tree-bindings/video/exynos-fb.txt 
b/doc/device-tree-bindings/video/exynos-fb.txt
index bb7441c..dc4e44f 100644
--- a/doc/device-tree-bindings/video/exynos-fb.txt
+++ b/doc/device-tree-bindings/video/exynos-fb.txt
@@ -55,6 +55,12 @@ Board(panel specific):
samsung,pclk-name: parent clock identifier: 1(MPLL), 2(EPLL), 3(VPLL)
samsung,sclk-div: parent_clock/source_clock ratio
samsung,dual-lcd-enabled: 1 if you support two LCD, else 0
+   samsung,disable-sysmmu: Define this if you want to disable FIMD sysmmu.
+   (needed for Exynos5420 and newer versions)
+   Add the required FIMD sysmmu nodes to be
+   disabled with compatible string
+   "samsung,sysmmu-v3.3", with a "reg" property
+   holding the register address of FIMD sysmmu.
 
 Example:
 SOC specific part:
diff --git a/drivers/video/exynos_fimd.c b/drivers/video/exynos_fimd.c
index cebbba7..f67fa81 100644
--- a/drivers/video/exynos_fimd.c
+++ b/drivers/video/exynos_fimd.c
@@ -251,6 +251,45 @@ void exynos_fimd_window_off(unsigned int win_id)
writel(cfg, &fimd_ctrl->winshmap);
 }
 
+#ifdef CONFIG_OF_CONTROL
+/*
+* The reset value for FIMD SYSMMU register MMU_CTRL is 3
+* on Exynos5420 and newer versions.
+* This means FIMD SYSMMU is on by default on Exynos5420
+* and newer versions.
+* Since in u-boot we don't use SYSMMU, we should disable
+* those FIMD SYSMMU.
+* Note that there are 2 SYSMMU for FIMD: m0 and m1.
+* m0 handles windows 0 and 4, and m1 handles windows 1, 2 and 3.
+* We disable both of them here.
+*/
+void exynos_fimd_disable_sysmmu(void)
+{
+   u32 *sysmmufimd;
+   unsigned int node;
+   int node_list[2];
+   int count;
+   int i;
+
+   count = fdtdec_find_aliases_for_id(gd->fdt_blob, "fimd",
+   COMPAT_SAMSUNG_EXYNOS_SYSMMU, node_list, 2);
+   for (i = 0; i < count; i++) {
+   node = node_list[i];
+   if (node <= 0) {
+   debug("Can't get device node for fimd sysmmu\n");
+   return;
+   }
+
+   sysmmufimd = (u32 *)fdtdec_get_addr(gd->fdt_blob, node, "reg");
+   if (!sysmmufimd) {
+   debug("Can't get base address for sysmmu fimdm0");
+   return;
+   }
+
+   writel(0x0, sysmmufimd);
+   }
+}
+#endif
 
 void exynos_fimd_lcd_init(vidinfo_t *vid)
 {
@@ -268,6 +307,10 @@ void exynos_fimd_lcd_init(vidinfo_t *vid)
node, "reg");
if (fimd_ctrl == NULL)
debug("Can't get the FIMD base address\n");
+
+   if (fdtdec_get_bool(gd->fdt_blob, node, "samsung,disable-sysmmu"))
+   exynos_fimd_disable_sysmmu();
+
 #else
fimd_ctrl = (struct exynos_fb *)samsung_get_base_fimd();
 #endif
diff --git a/include/fdtdec.h b/include/fdtdec.h
index a7e6ee7..a583d68 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -94,6 +94,7 @@ enum fdt_compat_id {
COMPAT_SANDBOX_LCD_SDL, /* Sandbox LCD emulation with SDL */
COMPAT_TI_TPS65090, /* Texas Instrument TPS65090 */
COMPAT_NXP_PTN3460, /* NXP PTN3460 DP/LVDS bridge */
+   COMPAT_SAMSUNG_EXYNOS_SYSMMU,   /* Exynos sysmmu */
 
COMPAT_COUNT,
 };
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index aaa6620..64d2398 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -68,6 +68,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
COMPAT(SANDBOX_LCD_SDL, "sandbox,lcd-sdl"),
COMPAT(TI_TPS