]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARM: EXYNOS: Add MFC device tree support
authorArun Kumar K <arun.kk@samsung.com>
Tue, 23 Oct 2012 13:51:33 +0000 (22:51 +0900)
committerKukjin Kim <kgene.kim@samsung.com>
Fri, 19 Oct 2012 01:26:31 +0000 (10:26 +0900)
This patch adds device tree entry for MFC v6 in the Exynos5
SoC. Makes the required changes in the clock files and adds
MFC to the DT device list.

Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
[kgene.kim@samsung.com: fixed section mismatches Seung-Woo Kim reported]
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Documentation/devicetree/bindings/media/s5p-mfc.txt [new file with mode: 0644]
arch/arm/boot/dts/exynos5250-smdk5250.dts
arch/arm/boot/dts/exynos5250.dtsi
arch/arm/mach-exynos/Kconfig
arch/arm/mach-exynos/clock-exynos5.c
arch/arm/mach-exynos/mach-exynos5-dt.c
arch/arm/plat-samsung/devs.c
arch/arm/plat-samsung/include/plat/mfc.h
arch/arm/plat-samsung/s5p-dev-mfc.c

diff --git a/Documentation/devicetree/bindings/media/s5p-mfc.txt b/Documentation/devicetree/bindings/media/s5p-mfc.txt
new file mode 100644 (file)
index 0000000..67ec3d4
--- /dev/null
@@ -0,0 +1,23 @@
+* Samsung Multi Format Codec (MFC)
+
+Multi Format Codec (MFC) is the IP present in Samsung SoCs which
+supports high resolution decoding and encoding functionalities.
+The MFC device driver is a v4l2 driver which can encode/decode
+video raw/elementary streams and has support for all popular
+video codecs.
+
+Required properties:
+  - compatible : value should be either one among the following
+       (a) "samsung,mfc-v5" for MFC v5 present in Exynos4 SoCs
+       (b) "samsung,mfc-v6" for MFC v6 present in Exynos5 SoCs
+
+  - reg : Physical base address of the IP registers and length of memory
+         mapped region.
+
+  - interrupts : MFC interrupt number to the CPU.
+
+  - samsung,mfc-r : Base address of the first memory bank used by MFC
+                   for DMA contiguous memory allocation and its size.
+
+  - samsung,mfc-l : Base address of the second memory bank used by MFC
+                   for DMA contiguous memory allocation and its size.
index a352df403b7a5586ad1b2a47cb51c9eca0e89b0e..21d4ccdb0a5aa9a5067cc110588ebe98ba10d29e 100644 (file)
        spi_2: spi@12d40000 {
                status = "disabled";
        };
+
+       codec@11000000 {
+               samsung,mfc-r = <0x43000000 0x800000>;
+               samsung,mfc-l = <0x51000000 0x800000>;
+       };
 };
index dddfd6e444dcb1edbcb1d6f94617e6d29f87e5c7..49546bc43ec02be987d5fec4d145097088091e30 100644 (file)
                interrupts = <0 42 0>;
        };
 
+       codec@11000000 {
+               compatible = "samsung,mfc-v6";
+               reg = <0x11000000 0x10000>;
+               interrupts = <0 96 0>;
+       };
+
        rtc {
                compatible = "samsung,s3c6410-rtc";
                reg = <0x101E0000 0x100>;
index da55107033ddad6490550722863ade8273695ffc..bb3b09aa9183a4628476703b448d5be88b882040 100644 (file)
@@ -63,6 +63,7 @@ config SOC_EXYNOS5250
        depends on ARCH_EXYNOS5
        select S5P_PM if PM
        select S5P_SLEEP if PM
+       select S5P_DEV_MFC
        select SAMSUNG_DMADEV
        help
          Enable EXYNOS5250 SoC support
index c44ca1ee1b8d0196de2ac413bad5af226bc83bc9..8c4e3253cdb0086b7f77a3c3dec1361c0d626dba 100644 (file)
@@ -664,7 +664,7 @@ static struct clk exynos5_init_clocks_off[] = {
                .ctrlbit        = (1 << 25),
        }, {
                .name           = "mfc",
-               .devname        = "s5p-mfc",
+               .devname        = "s5p-mfc-v6",
                .enable         = exynos5_clk_ip_mfc_ctrl,
                .ctrlbit        = (1 << 0),
        }, {
index db1cd8eacf2820caeeb8700c8fca0a0d35951703..b7f1154088bdeba2d144d0a7299ba9dc5324a1a3 100644 (file)
@@ -11,6 +11,8 @@
 
 #include <linux/of_platform.h>
 #include <linux/serial_core.h>
+#include <linux/memblock.h>
+#include <linux/of_fdt.h>
 
 #include <asm/mach/arch.h>
 #include <asm/hardware/gic.h>
@@ -18,6 +20,7 @@
 
 #include <plat/cpu.h>
 #include <plat/regs-serial.h>
+#include <plat/mfc.h>
 
 #include "common.h"
 
@@ -72,6 +75,7 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
                                "exynos-gsc.2", NULL),
        OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC3,
                                "exynos-gsc.3", NULL),
+       OF_DEV_AUXDATA("samsung,mfc-v6", 0x11000000, "s5p-mfc-v6", NULL),
        {},
 };
 
@@ -92,6 +96,17 @@ static char const *exynos5250_dt_compat[] __initdata = {
        NULL
 };
 
+static void __init exynos5_reserve(void)
+{
+       struct s5p_mfc_dt_meminfo mfc_mem;
+
+       /* Reserve memory for MFC only if it's available */
+       mfc_mem.compatible = "samsung,mfc-v6";
+       if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem))
+               s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff,
+                               mfc_mem.lsize);
+}
+
 DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
        /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
        .init_irq       = exynos5_init_irq,
@@ -103,4 +118,5 @@ DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
        .timer          = &exynos4_timer,
        .dt_compat      = exynos5250_dt_compat,
        .restart        = exynos5_restart,
+       .reserve        = exynos5_reserve,
 MACHINE_END
index 03f654d55effb2f10355c914ab206730928759f7..52dfa8f914c7384e7ddaabb99b0a14cde456beb2 100644 (file)
@@ -933,6 +933,7 @@ struct platform_device s5p_device_mfc_r = {
                .coherent_dma_mask      = DMA_BIT_MASK(32),
        },
 };
+
 #endif /* CONFIG_S5P_DEV_MFC */
 
 /* MIPI CSIS */
index ac13227272f04c92dccd8b7a5933424889e0e7ae..e6d7c42d68b637e58e20b0186b7326df8a2a279d 100644 (file)
 #ifndef __PLAT_SAMSUNG_MFC_H
 #define __PLAT_SAMSUNG_MFC_H __FILE__
 
+struct s5p_mfc_dt_meminfo {
+       unsigned long   loff;
+       unsigned long   lsize;
+       unsigned long   roff;
+       unsigned long   rsize;
+       char            *compatible;
+};
+
 /**
  * s5p_mfc_reserve_mem - function to early reserve memory for MFC driver
  * @rbase:     base address for MFC 'right' memory interface
@@ -24,4 +32,7 @@
 void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
                                phys_addr_t lbase, unsigned int lsize);
 
+int __init s5p_fdt_find_mfc_mem(unsigned long node, const char *uname,
+                               int depth, void *data);
+
 #endif /* __PLAT_SAMSUNG_MFC_H */
index ad6089465e2afba33b49cc1def128c3c0f9a2cd5..5ec104b5408b37d58e25efa202439110150a21c2 100644 (file)
@@ -14,6 +14,8 @@
 #include <linux/dma-mapping.h>
 #include <linux/memblock.h>
 #include <linux/ioport.h>
+#include <linux/of_fdt.h>
+#include <linux/of.h>
 
 #include <mach/map.h>
 #include <plat/devs.h>
@@ -69,3 +71,35 @@ static int __init s5p_mfc_memory_init(void)
        return 0;
 }
 device_initcall(s5p_mfc_memory_init);
+
+#ifdef CONFIG_OF
+int __init s5p_fdt_find_mfc_mem(unsigned long node, const char *uname,
+                               int depth, void *data)
+{
+       __be32 *prop;
+       unsigned long len;
+       struct s5p_mfc_dt_meminfo *mfc_mem = data;
+
+       if (!data)
+               return 0;
+
+       if (!of_flat_dt_is_compatible(node, mfc_mem->compatible))
+               return 0;
+
+       prop = of_get_flat_dt_prop(node, "samsung,mfc-l", &len);
+       if (!prop || (len != 2 * sizeof(unsigned long)))
+               return 0;
+
+       mfc_mem->loff = be32_to_cpu(prop[0]);
+       mfc_mem->lsize = be32_to_cpu(prop[1]);
+
+       prop = of_get_flat_dt_prop(node, "samsung,mfc-r", &len);
+       if (!prop || (len != 2 * sizeof(unsigned long)))
+               return 0;
+
+       mfc_mem->roff = be32_to_cpu(prop[0]);
+       mfc_mem->rsize = be32_to_cpu(prop[1]);
+
+       return 1;
+}
+#endif