Skip to contentSkip to conversation

ARM: EXYNOS: Add MFC device tree support

PATCH Arun Kumar K 2 participants 2 messages Aug 17, 2012 – Aug 23, 2012 Arm Samsung Exynos

lore
Share & tools
lore
#0 lore raw

Hi Thomas,
Thank you for the comments.
Please find my response inline.

------- Original Message -------
Sender : Thomas Abraham<[email protected]>
Date : Aug 16, 2012 17:12 (GMT+05:30)
Title : Re: [PATCH] ARM: EXYNOS: Add MFC device tree support

Quoted 30 lines · Arun Kumar K

From: Naveen Krishna Chatradhi <[email protected]>

This patch adds device tree entry for MFC in the Exynos machines. Exynos4 SoCs support MFC v5 version and Exynos5 has MFC v6.x version. So making the required changes in the clock files and adds MFC to the DT device list.

---
 .../devicetree/bindings/media/s5p-mfc.txt          |   24 ++++++++++++++++++++
 arch/arm/boot/dts/exynos4210.dtsi                  |   10 ++++++++
 arch/arm/boot/dts/exynos5250.dtsi                  |   10 ++++++++
 arch/arm/mach-exynos/clock-exynos5.c               |    2 +-
 arch/arm/mach-exynos/mach-exynos4-dt.c             |   22 ++++++++++++++++++
 arch/arm/mach-exynos/mach-exynos5-dt.c             |   22 ++++++++++++++++++
 6 files changed, 89 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/s5p-mfc.txt
Documentation/devicetree/bindings/media/s5p-mfc.txt new file +4 -0
new file mode 100644
index 0000000..b9bd266
@@ -0,0 +1,24 @@
+* Samsung Multi Format Codec (MFC)
+
+Mult Format Codec (MFC) is the IP present in Samsung SoCs which
+supports high resolution decoding and encoding functionalities.
Quoted 2 lines

In addition to this, specifying that mfc is used for video encode/decode would be informative.

Ok. I will make it more descriptive.

Quoted 9 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt new file +5 -0
+
+Required properties:
+  - compatible : value should be either one among the following
+       (a) "samsung,s5p-mfc-v5" for MFC v5 present in Exynos4 SoCs
+       (b) "samsung,s5p-mfc-v6" for MFC v6.x present in Exynos5 SoCs

"s5p" should be dropped from the compatible values. For example, it should be "samsung,mfc-v5", which is sufficient to identify the version of the mfc controller.

Ok will remove s5p.

Quoted 11 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt new file +10 -0
+
+  - reg : Physical base address of the IP registers and length of memory
+         mapped region.
+
+  - interrupts : MFC interupt number to the CPU.
+
+  - samsung,mfc-r : Base address of the first memory bank used by MFC
+                   for DMA contiguous memory allocation.
+
+  - samsung,mfc-r-size : Size of the first memory bank.
Quoted 5 lines

It is not allowed to pass buffer base address and size from device tree. Device tree node should describe only the MFC controller hardware. Any memory management related information should be handled outside of device tree. This helps the bindings to be reusable across multiple operating systems.

The mfc-l and mfc-r base address and size is board specific info which has to be passed to the driver. This is used for DMA contiguous allocation by driver and this value can change on a different board.
So in that case, i will pass it as platform data to the driver from mach-exynos5-dt.c file. I hope that would be ok.

Quoted 9 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt new file +5 -0
+
+  - samsung,mfc-l : Base address of the second memory bank used by MFC
+                   for DMA contiguous memory allocation.
+
+  - samsung,mfc-l-size : Size of the second memory bank.

Same comment as above. And the bindings documentation is usually included in the same patch that adds device tree support for the driver.

Ok

Quoted 76 lines
arch/arm/boot/dts/exynos4210.dtsi +10 -0
index 02891fe..b5ee43d 100644
@@ -56,6 +56,16 @@
                interrupts = <0 43 0>;
        };
 
+       mfc {
+               compatible = "samsung,s5p-mfc";
+               reg = <0x13400000 0x10000>;
+               interrupts = <0 94 0>;
+               samsung,mfc-r = <0x43000000>;
+               samsung,mfc-r-size = <8388608>;
+               samsung,mfc-l = <0x51000000>;
+               samsung,mfc-l-size = <8388608>;
+       };
+
        rtc@10070000 {
                compatible = "samsung,s3c6410-rtc";
                reg = <0x10070000 0x100>;
arch/arm/boot/dts/exynos5250.dtsi +10 -0
index 004aaa8..3c762a4 100644
@@ -58,6 +58,16 @@
                interrupts = <0 42 0>;
        };
 
+       mfc {
+               compatible = "samsung,s5p-mfc-v6";
+               reg = <0x11000000 0x10000>;
+               interrupts = <0 96 0>;
+               samsung,mfc-r = <0x43000000>;
+               samsung,mfc-r-size = <8388608>;
+               samsung,mfc-l = <0x51000000>;
+               samsung,mfc-l-size = <8388608>;
+       };
+
        rtc {
                compatible = "samsung,s3c6410-rtc";
                reg = <0x101E0000 0x100>;
arch/arm/mach-exynos/clock-exynos5.c +1 -1
index 3b00e29..c85e7b2 100644
@@ -607,7 +607,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),
        }, {
arch/arm/mach-exynos/mach-exynos4-dt.c +2 -0
index b2b5d5f..c4a0e16 100644
@@ -13,6 +13,7 @@
 
 #include <linux/of_platform.h>
 #include <linux/serial_core.h>
+#include <linux/memblock.h>
 
 #include <asm/mach/arch.h>
 #include <asm/hardware/gic.h>
@@ -63,6 +64,7 @@ static const struct of_dev_auxdata exynos4210_auxdata_lookup[] __initconst = {
                                "exynos4210-spi.2", NULL),
        OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA0, "dma-pl330.0", NULL),
        OF_DEV_AUXDATA("arm,pl330", EXYNOS4_PA_PDMA1, "dma-pl330.1", NULL),
+       OF_DEV_AUXDATA("samsung,s5p-mfc", 0x13400000, "s5p-mfc", NULL),
        {},
 };
 

arch/arm/mach-exynos/mach-exynos4-dt.c static char const *exynos4210_dt_compat[] __initdata = { · line 92

Quoted 8 lines
arch/arm/mach-exynos/mach-exynos4-dt.c +5 -0
@@ -83,6 +85,25 @@ static char const *exynos4210_dt_compat[] __initdata = {
        NULL
 };
 
+static void s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
+               phys_addr_t lbase, unsigned int lsize) {
+
+       if (memblock_remove(lbase, lsize)) {
+               pr_err("Failed to reserve bank1 memory for MFC device

");

arch/arm/mach-exynos/mach-exynos4-dt.c static char const *exynos4210_dt_compat[] __initdata = { · line 97

Quoted 5 lines
arch/arm/mach-exynos/mach-exynos4-dt.c +5 -0
+               WARN_ON(1);
+       }
+
+       if (memblock_remove(rbase, rsize)) {
+               pr_err("Failed to reserve bank2 memory for MFC device

");

Quoted 6 lines
arch/arm/mach-exynos/mach-exynos4-dt.c +3 -0
+               WARN_ON(1);
+       }
+}
 

It would be better to split the device tree related changes and the driver buffer management related changes in separate patches.

Ok.

Quoted 36 lines
arch/arm/mach-exynos/mach-exynos4-dt.c +7 -0
+
+static void __init exynos4_reserve(void)
+{
+       s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
+}
+
 DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)")
        /* Maintainer: Thomas Abraham <[email protected]> */
        .init_irq       = exynos4_init_irq,
@@ -93,4 +114,5 @@ DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)")
        .timer          = &exynos4_timer,
        .dt_compat      = exynos4210_dt_compat,
        .restart        = exynos4_restart,
+       .reserve        = exynos4_reserve,
 MACHINE_END
arch/arm/mach-exynos/mach-exynos5-dt.c +2 -0
index ef770bc..898d2de 100644
@@ -11,6 +11,7 @@
 
 #include <linux/of_platform.h>
 #include <linux/serial_core.h>
+#include <linux/memblock.h>
 
 #include <asm/mach/arch.h>
 #include <asm/hardware/gic.h>
@@ -56,6 +57,7 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
        OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
        OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
        OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
+       OF_DEV_AUXDATA("samsung,s5p-mfc-v6", 0x11000000, "s5p-mfc-v6", NULL),
        {},
 };
 

arch/arm/mach-exynos/mach-exynos5-dt.c static char const *exynos5250_dt_compat[] __initdata = { · line 85

Quoted 8 lines
arch/arm/mach-exynos/mach-exynos5-dt.c +5 -0
@@ -76,6 +78,25 @@ static char const *exynos5250_dt_compat[] __initdata = {
        NULL
 };
 
+static void s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
+               phys_addr_t lbase, unsigned int lsize) {
+
+       if (memblock_remove(lbase, lsize)) {
+               pr_err("Failed to reserve bank1 memory for MFC device

");

arch/arm/mach-exynos/mach-exynos5-dt.c static char const *exynos5250_dt_compat[] __initdata = { · line 90

Quoted 5 lines
arch/arm/mach-exynos/mach-exynos5-dt.c +5 -0
+               WARN_ON(1);
+       }
+
+       if (memblock_remove(rbase, rsize)) {
+               pr_err("Failed to reserve bank2 memory for MFC device

");

Quoted 21 lines
arch/arm/mach-exynos/mach-exynos5-dt.c +10 -1
+               WARN_ON(1);
+       }
+}
+
+static void __init exynos5_reserve(void)
+{
+       s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
+}
+
 DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
        /* Maintainer: Kukjin Kim <[email protected]> */
        .init_irq       = exynos5_init_irq,
@@ -86,4 +107,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
--

1.7.0.4

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

<p>&nbsp;</p><p>&nbsp;</p>

#1 lore raw
Quoted 5 lines · Arun Kumar K

Hi Thomas,
Thank you for the comments.
Please find my response inline.

Quoted 11 lines

------- Original Message -------
Sender : Thomas Abraham<[email protected]>
Date : Aug 16, 2012 17:12 (GMT+05:30)
Title : Re: [PATCH] ARM: EXYNOS: Add MFC device tree support

Quoted 5 lines · Arun Kumar K

From: Naveen Krishna Chatradhi <[email protected]>

This patch adds device tree entry for MFC in the Exynos machines. Exynos4 SoCs support MFC v5 version and Exynos5 has MFC v6.x version. So making the required changes in the clock

Since v6.1 is not used anywhere so just MFC v6 should be ok.

Quoted 40 lines
Quoted 6 lines

files and adds MFC to the DT device list.

---
 .../devicetree/bindings/media/s5p-mfc.txt          |   24

++++++++++++++++++++

Quoted 4 lines
 arch/arm/boot/dts/exynos4210.dtsi                  |   10 ++++++++
 arch/arm/boot/dts/exynos5250.dtsi                  |   10 ++++++++
 arch/arm/mach-exynos/clock-exynos5.c               |    2 +-
 arch/arm/mach-exynos/mach-exynos4-dt.c             |   22

++++++++++++++++++

Quoted 1 line
 arch/arm/mach-exynos/mach-exynos5-dt.c             |   22

++++++++++++++++++

Review

Quoted 4 lines
 6 files changed, 89 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/s5p-mfc.txt
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/media/s5p-mfc.txt

Quoted 10 lines

new file mode 100644
index 0000000..b9bd266

Documentation/devicetree/bindings/media/s5p-mfc.txt new file +4 -0
@@ -0,0 +1,24 @@
+* Samsung Multi Format Codec (MFC)
+
+Mult Format Codec (MFC) is the IP present in Samsung SoCs which
+supports high resolution decoding and encoding functionalities.
Quoted 2 lines

In addition to this, specifying that mfc is used for video encode/decode would be informative.

Ok. I will make it more descriptive.

Quoted 6 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt new file +5 -0
+
+Required properties:
+  - compatible : value should be either one among the following
+       (a) "samsung,s5p-mfc-v5" for MFC v5 present in Exynos4 SoCs
+       (b) "samsung,s5p-mfc-v6" for MFC v6.x present in Exynos5 SoCs
Quoted 6 lines
Quoted 3 lines

"s5p" should be dropped from the compatible values. For example, it should be "samsung,mfc-v5", which is sufficient to identify the version of the mfc controller.

Ok will remove s5p.

Yeah, I agree, just 'mfc-vX' is enough.

Quoted 12 lines

Documentation/devicetree/bindings/media/s5p-mfc.txt

Quoted 2 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt new file +2 -0
+
+  - reg : Physical base address of the IP registers and length of

memory

Quoted 9 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt new file +8 -0
+         mapped region.
+
+  - interrupts : MFC interupt number to the CPU.
+
+  - samsung,mfc-r : Base address of the first memory bank used by MFC
+                   for DMA contiguous memory allocation.
+
+  - samsung,mfc-r-size : Size of the first memory bank.
Quoted 15 lines
Quoted 5 lines

It is not allowed to pass buffer base address and size from device tree. Device tree node should describe only the MFC controller hardware. Any memory management related information should be handled outside of device tree. This helps the bindings to be reusable across multiple operating systems.

The mfc-l and mfc-r base address and size is board specific info which has to
be passed to the driver. This is used for DMA contiguous allocation by driver and this value
can change on a different board.
So in that case, i will pass it as platform data to the driver from mach- exynos5-dt.c file.
I hope that would be ok.

I don't think so. The mach-exynos5-dt is for all EXYNOS5 SoCs not platform_data. As I know, the addresses and sizes for buffer passed via platform data before, so it can be passed via device tree for board(.dtsi)? not SoC. In addition, it depends on board.

Quoted 21 lines
Quoted 9 lines
Documentation/devicetree/bindings/media/s5p-mfc.txt new file +5 -0
+
+  - samsung,mfc-l : Base address of the second memory bank used by MFC
+                   for DMA contiguous memory allocation.
+
+  - samsung,mfc-l-size : Size of the second memory bank.

Same comment as above. And the bindings documentation is usually included in the same patch that adds device tree support for the driver.

Ok

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/boot/dts/exynos4210.dtsi

Quoted 7 lines

index 02891fe..b5ee43d 100644

arch/arm/boot/dts/exynos4210.dtsi +0 -0
@@ -56,6 +56,16 @@
                interrupts = <0 43 0>;
        };
 
Quoted 2 lines

arch/arm/boot/dts/exynos4210.dtsi line 60

Quoted 2 lines
arch/arm/boot/dts/exynos4210.dtsi +2 -0
+       mfc {
+               compatible = "samsung,s5p-mfc";

Maybe
+ compatible = "samsung,mfc-v5"; ?

Quoted 6 lines

arch/arm/boot/dts/exynos4210.dtsi line 66

Quoted 6 lines
arch/arm/boot/dts/exynos4210.dtsi +6 -0
+               reg = <0x13400000 0x10000>;
+               interrupts = <0 94 0>;
+               samsung,mfc-r = <0x43000000>;
+               samsung,mfc-r-size = <8388608>;
+               samsung,mfc-l = <0x51000000>;
+               samsung,mfc-l-size = <8388608>;

As I commented, the size depends on each board not SoC. So should be removed here.

[...]

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.