Skip to contentSkip to conversation

Platform fixes for s5p-fimc

PATCH New Marek Szyprowski 4 participants 21 messages Sep 6, 2010 – Sep 15, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Platform fixes for s5p-fimc

Hello,

This patch series fixes a bunch of bugs in s5p-fimc platform support. Mainly it adds missing clocks, dma coherent masks and clock setup code required on Aquila and Goni targets.

This is a pure bugfix series to get fimc driver working. I hope to get it merged for 2.6.36-rc4.

The complete list of patches:

[PATCH 1/4] ARM: S5PC110: add fimc clocks.
[PATCH 2/4] ARM: Samsung: s5p-fimc: fix dma coherent mask [PATCH 3/4] ARM: S5PC110: add common FIMC setup code [PATCH 4/4] ARM: S5PC110: use common FIMC clock setup code

Best regards

Signature · 2 lines
Marek Szyprowski
Samsung Poland R&D Center
#1 lore raw

PATCH 1/4 ARM: S5PC110: add fimc clocks.

These clocks enables FIMC driver to operate on machines, which bootloader power gated FIMC devices to save power on boot.

---
 arch/arm/mach-s5pv210/clock.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/mach-s5pv210/clock.c +18 -0
index af91fef..9c199ef 100644
@@ -281,6 +281,24 @@ static struct clk init_clocks_disable[] = {
 		.enable		= s5pv210_clk_ip0_ctrl,
 		.ctrlbit	= (1<<29),
 	}, {
+		.name		= "fimc",
+		.id		= 0,
+		.parent		= &clk_hclk_dsys.clk,
+		.enable		= s5pv210_clk_ip0_ctrl,
+		.ctrlbit	= (1 << 24),
+	}, {
+		.name		= "fimc",
+		.id		= 1,
+		.parent		= &clk_hclk_dsys.clk,
+		.enable		= s5pv210_clk_ip0_ctrl,
+		.ctrlbit	= (1 << 25),
+	}, {
+		.name		= "fimc",
+		.id		= 2,
+		.parent		= &clk_hclk_dsys.clk,
+		.enable		= s5pv210_clk_ip0_ctrl,
+		.ctrlbit	= (1 << 26),
+	}, {
 		.name		= "otg",
 		.id		= -1,
 		.parent		= &clk_hclk_psys.clk,
Signature · 1 line
1.7.2.2
#2 lore raw

PATCH 1/4 ARM: S5PC110: add fimc clocks.

Quoted 40 lines · Marek Szyprowski

These clocks enables FIMC driver to operate on machines, which bootloader power gated FIMC devices to save power on boot.

---
 arch/arm/mach-s5pv210/clock.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/mach-s5pv210/clock.c +18 -1
index af91fef..9c199ef 100644
@@ -281,6 +281,24 @@ static struct clk init_clocks_disable[] = {
 		.enable		= s5pv210_clk_ip0_ctrl,
 		.ctrlbit	= (1<<29),
 	}, {
+		.name		= "fimc",
+		.id		= 0,
+		.parent		= &clk_hclk_dsys.clk,
+		.enable		= s5pv210_clk_ip0_ctrl,
+		.ctrlbit	= (1 << 24),
+	}, {
+		.name		= "fimc",
+		.id		= 1,
+		.parent		= &clk_hclk_dsys.clk,
+		.enable		= s5pv210_clk_ip0_ctrl,
+		.ctrlbit	= (1 << 25),
+	}, {
+		.name		= "fimc",
+		.id		= 2,
+		.parent		= &clk_hclk_dsys.clk,
+		.enable		= s5pv210_clk_ip0_ctrl,
+		.ctrlbit	= (1 << 26),
+	}, {
 		.name		= "otg",
 		.id		= -1,
 		.parent		= &clk_hclk_psys.clk,
--
Quoted 1 line

1.7.2.2

Ok..will apply.

Thanks.

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

#3 lore raw

PATCH 2/4 ARM: Samsung: s5p-fimc: fix dma coherent mask

In reply to Marek Szyprowski

FIMC driver uses DMA_coherent allocator, which requires proper dma mask to be set.

---
 arch/arm/plat-s5p/dev-fimc0.c |    2 ++
 arch/arm/plat-s5p/dev-fimc1.c |    2 ++
 arch/arm/plat-s5p/dev-fimc2.c |    2 ++
 3 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/plat-s5p/dev-fimc0.c +2 -0
index d3f1a9b..9f26096 100644
@@ -33,4 +33,6 @@ struct platform_device s5p_device_fimc0 = {
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(s5p_fimc0_resource),
 	.resource	= s5p_fimc0_resource,
+	.dev.dma_mask	  = &s5p_device_fimc0.dev.coherent_dma_mask,
+	.dev.coherent_dma_mask = 0xffffffffUL,
 };
arch/arm/plat-s5p/dev-fimc1.c +2 -0
index 41bd698..4149c49 100644
@@ -33,4 +33,6 @@ struct platform_device s5p_device_fimc1 = {
 	.id		= 1,
 	.num_resources	= ARRAY_SIZE(s5p_fimc1_resource),
 	.resource	= s5p_fimc1_resource,
+	.dev.dma_mask	  = &s5p_device_fimc1.dev.coherent_dma_mask,
+	.dev.coherent_dma_mask = 0xffffffffUL,
 };
arch/arm/plat-s5p/dev-fimc2.c +2 -0
index dfddeda..ced9097 100644
@@ -33,4 +33,6 @@ struct platform_device s5p_device_fimc2 = {
 	.id		= 2,
 	.num_resources	= ARRAY_SIZE(s5p_fimc2_resource),
 	.resource	= s5p_fimc2_resource,
+	.dev.dma_mask	  = &s5p_device_fimc2.dev.coherent_dma_mask,
+	.dev.coherent_dma_mask = 0xffffffffUL,
 };
Signature · 1 line
1.7.2.2
#4 lore raw

PATCH 2/4 ARM: Samsung: s5p-fimc: fix dma coherent mask

Quoted 17 lines · Marek Szyprowski

FIMC driver uses DMA_coherent allocator, which requires proper dma mask to be set.

---
 arch/arm/plat-s5p/dev-fimc0.c |    2 ++
 arch/arm/plat-s5p/dev-fimc1.c |    2 ++
 arch/arm/plat-s5p/dev-fimc2.c |    2 ++
 3 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/plat-s5p/dev-fimc0.c +0 -0
index d3f1a9b..9f26096 100644

arch/arm/plat-s5p/dev-fimc0.c struct platform_device s5p_device_fimc0 = { · line 37

Quoted 5 lines
arch/arm/plat-s5p/dev-fimc0.c +2 -0
@@ -33,4 +33,6 @@ struct platform_device s5p_device_fimc0 = {
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(s5p_fimc0_resource),
 	.resource	= s5p_fimc0_resource,
+	.dev.dma_mask	  = &s5p_device_fimc0.dev.coherent_dma_mask,
+	.dev.coherent_dma_mask = 0xffffffffUL,

Ok...but I prefer following style :-)
Could you please re-submit your this patch?

arch/arm/plat-s5p/dev-fimc0.c +6 -0
index d3f1a9b..cb1ff4d 100644
@@ -28,9 +28,15 @@ static struct resource s5p_fimc0_resource[] = {
        },
 };
 
+static u64 s5p_fimc_dma_mask = DMA_BIT_MASK(32);
+
 struct platform_device s5p_device_fimc0 = {
 	.name		= "s5p-fimc",
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(s5p_fimc0_resource),
 	.resource	= s5p_fimc0_resource,
+	.dev		= {
+		.dma_mask		= &s5p_fimc_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
 };
Quoted 24 lines
arch/arm/plat-s5p/dev-fimc0.c +0 -0
 };
arch/arm/plat-s5p/dev-fimc1.c +2 -0
index 41bd698..4149c49 100644
@@ -33,4 +33,6 @@ struct platform_device s5p_device_fimc1 = {
 	.id		= 1,
 	.num_resources	= ARRAY_SIZE(s5p_fimc1_resource),
 	.resource	= s5p_fimc1_resource,
+	.dev.dma_mask	  = &s5p_device_fimc1.dev.coherent_dma_mask,
+	.dev.coherent_dma_mask = 0xffffffffUL,
 };
arch/arm/plat-s5p/dev-fimc2.c +2 -1
index dfddeda..ced9097 100644
@@ -33,4 +33,6 @@ struct platform_device s5p_device_fimc2 = {
 	.id		= 2,
 	.num_resources	= ARRAY_SIZE(s5p_fimc2_resource),
 	.resource	= s5p_fimc2_resource,
+	.dev.dma_mask	  = &s5p_device_fimc2.dev.coherent_dma_mask,
+	.dev.coherent_dma_mask = 0xffffffffUL,
 };
--
Quoted 1 line

1.7.2.2

Thanks.

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

#5 lore raw

PATCH 2/4 ARM: Samsung: s5p-fimc: fix dma coherent mask

W dniu 2010-09-09 09:41, Kukjin Kim pisze:

Quoted 13 lines
Quoted 12 lines · Marek Szyprowski

FIMC driver uses DMA_coherent allocator, which requires proper dma mask to be set.

---
  arch/arm/plat-s5p/dev-fimc0.c |    2 ++
  arch/arm/plat-s5p/dev-fimc1.c |    2 ++
  arch/arm/plat-s5p/dev-fimc2.c |    2 ++
  3 files changed, 6 insertions(+), 0 deletions(-)
Quoted 13 lines

arch/arm/plat-s5p/dev-fimc0.c struct platform_device s5p_device_fimc0 = { · line 37

Quoted 10 lines
arch/arm/plat-s5p/dev-fimc0.c +2 -0
index d3f1a9b..9f26096 100644
@@ -33,4 +33,6 @@ struct platform_device s5p_device_fimc0 = {
  	.id		= 0,
  	.num_resources	= ARRAY_SIZE(s5p_fimc0_resource),
  	.resource	= s5p_fimc0_resource,
+	.dev.dma_mask	  =&s5p_device_fimc0.dev.coherent_dma_mask,
+	.dev.coherent_dma_mask = 0xffffffffUL,

Ok...but I prefer following style :-)
Could you please re-submit your this patch?

OK, I will update the style and resubmit the patch.

Best regards

Signature · 2 lines
Marek Szyprowski
Samsung Poland R&D Center
#6 lore raw

PATCH v2 1/1 ARM: Samsung: s5p-fimc: fix dma coherent mask

In reply to Kukjin Kim

FIMC driver uses DMA_coherent allocator, which requires proper dma mask to be set.

---

Chnages since v1:
- use DMA_BIT_MASK() macro, minor coding style change

---
 arch/arm/plat-s5p/dev-fimc0.c |    7 +++++++
 arch/arm/plat-s5p/dev-fimc1.c |    7 +++++++
 arch/arm/plat-s5p/dev-fimc2.c |    7 +++++++
 3 files changed, 21 insertions(+), 0 deletions(-)
arch/arm/plat-s5p/dev-fimc0.c +7 -0
index d3f1a9b..f9203fa 100644
@@ -10,6 +10,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
@@ -28,9 +29,15 @@ static struct resource s5p_fimc0_resource[] = {
 	},
 };
 
+static u64 s5p_fimc0_dma_mask = DMA_BIT_MASK(32);
+
 struct platform_device s5p_device_fimc0 = {
 	.name		= "s5p-fimc",
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(s5p_fimc0_resource),
 	.resource	= s5p_fimc0_resource,
+	.dev		= {
+		.dma_mask		= &s5p_fimc0_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
 };
arch/arm/plat-s5p/dev-fimc1.c +7 -0
index 41bd698..7ed91a3 100644
@@ -10,6 +10,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
@@ -28,9 +29,15 @@ static struct resource s5p_fimc1_resource[] = {
 	},
 };
 
+static u64 s5p_fimc1_dma_mask = DMA_BIT_MASK(32);
+
 struct platform_device s5p_device_fimc1 = {
 	.name		= "s5p-fimc",
 	.id		= 1,
 	.num_resources	= ARRAY_SIZE(s5p_fimc1_resource),
 	.resource	= s5p_fimc1_resource,
+	.dev		= {
+		.dma_mask		= &s5p_fimc1_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
 };
arch/arm/plat-s5p/dev-fimc2.c +7 -0
index dfddeda..5543d6373 100644
@@ -10,6 +10,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
@@ -28,9 +29,15 @@ static struct resource s5p_fimc2_resource[] = {
 	},
 };
 
+static u64 s5p_fimc2_dma_mask = DMA_BIT_MASK(32);
+
 struct platform_device s5p_device_fimc2 = {
 	.name		= "s5p-fimc",
 	.id		= 2,
 	.num_resources	= ARRAY_SIZE(s5p_fimc2_resource),
 	.resource	= s5p_fimc2_resource,
+	.dev		= {
+		.dma_mask		= &s5p_fimc2_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
 };
Signature · 1 line
1.7.2.2
#7 lore raw

PATCH v2 1/1 ARM: Samsung: s5p-fimc: fix dma coherent mask

Quoted 102 lines · Marek Szyprowski

FIMC driver uses DMA_coherent allocator, which requires proper dma mask to be set.

---

Chnages since v1:
- use DMA_BIT_MASK() macro, minor coding style change

---
 arch/arm/plat-s5p/dev-fimc0.c |    7 +++++++
 arch/arm/plat-s5p/dev-fimc1.c |    7 +++++++
 arch/arm/plat-s5p/dev-fimc2.c |    7 +++++++
 3 files changed, 21 insertions(+), 0 deletions(-)
arch/arm/plat-s5p/dev-fimc0.c +7 -0
index d3f1a9b..f9203fa 100644
@@ -10,6 +10,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
@@ -28,9 +29,15 @@ static struct resource s5p_fimc0_resource[] = {
 	},
 };
 
+static u64 s5p_fimc0_dma_mask = DMA_BIT_MASK(32);
+
 struct platform_device s5p_device_fimc0 = {
 	.name		= "s5p-fimc",
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(s5p_fimc0_resource),
 	.resource	= s5p_fimc0_resource,
+	.dev		= {
+		.dma_mask		= &s5p_fimc0_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
 };
arch/arm/plat-s5p/dev-fimc1.c +7 -0
index 41bd698..7ed91a3 100644
@@ -10,6 +10,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
@@ -28,9 +29,15 @@ static struct resource s5p_fimc1_resource[] = {
 	},
 };
 
+static u64 s5p_fimc1_dma_mask = DMA_BIT_MASK(32);
+
 struct platform_device s5p_device_fimc1 = {
 	.name		= "s5p-fimc",
 	.id		= 1,
 	.num_resources	= ARRAY_SIZE(s5p_fimc1_resource),
 	.resource	= s5p_fimc1_resource,
+	.dev		= {
+		.dma_mask		= &s5p_fimc1_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
 };
arch/arm/plat-s5p/dev-fimc2.c +7 -1
index dfddeda..5543d6373 100644
@@ -10,6 +10,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
@@ -28,9 +29,15 @@ static struct resource s5p_fimc2_resource[] = {
 	},
 };
 
+static u64 s5p_fimc2_dma_mask = DMA_BIT_MASK(32);
+
 struct platform_device s5p_device_fimc2 = {
 	.name		= "s5p-fimc",
 	.id		= 2,
 	.num_resources	= ARRAY_SIZE(s5p_fimc2_resource),
 	.resource	= s5p_fimc2_resource,
+	.dev		= {
+		.dma_mask		= &s5p_fimc2_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
 };
--
Quoted 1 line

1.7.2.2

looks good to me..will apply :-)

Thanks.

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

#8 lore raw

PATCH v2 1/1 ARM: Samsung: s5p-fimc: fix dma coherent mask

Hello,

Quoted 93 lines · Kukjin Kim

arch/arm/plat-s5p/dev-

Quoted 18 lines · Marek Szyprowski

FIMC driver uses DMA_coherent allocator, which requires proper dma mask to be set.

---

Chnages since v1:
- use DMA_BIT_MASK() macro, minor coding style change

---
 arch/arm/plat-s5p/dev-fimc0.c |    7 +++++++
 arch/arm/plat-s5p/dev-fimc1.c |    7 +++++++
 arch/arm/plat-s5p/dev-fimc2.c |    7 +++++++
 3 files changed, 21 insertions(+), 0 deletions(-)
arch/arm/plat-s5p/dev- renamed from arch/arm/plat-s5p/dev-fimc0.c +0 -0

fimc0.c

arch/arm/plat-s5p/dev-

Quoted 28 lines

index d3f1a9b..f9203fa 100644

arch/arm/plat-s5p/dev-fimc0.c +7 -0
@@ -10,6 +10,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
@@ -28,9 +29,15 @@ static struct resource s5p_fimc0_resource[] = {
 	},
 };
 
+static u64 s5p_fimc0_dma_mask = DMA_BIT_MASK(32);
+
 struct platform_device s5p_device_fimc0 = {
 	.name		= "s5p-fimc",
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(s5p_fimc0_resource),
 	.resource	= s5p_fimc0_resource,
+	.dev		= {
+		.dma_mask		= &s5p_fimc0_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
 };
arch/arm/plat-s5p/dev- renamed from arch/arm/plat-s5p/dev-fimc1.c +0 -0

fimc1.c

arch/arm/plat-s5p/dev-

Quoted 28 lines

index 41bd698..7ed91a3 100644

arch/arm/plat-s5p/dev-fimc1.c +7 -0
@@ -10,6 +10,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
@@ -28,9 +29,15 @@ static struct resource s5p_fimc1_resource[] = {
 	},
 };
 
+static u64 s5p_fimc1_dma_mask = DMA_BIT_MASK(32);
+
 struct platform_device s5p_device_fimc1 = {
 	.name		= "s5p-fimc",
 	.id		= 1,
 	.num_resources	= ARRAY_SIZE(s5p_fimc1_resource),
 	.resource	= s5p_fimc1_resource,
+	.dev		= {
+		.dma_mask		= &s5p_fimc1_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
 };
arch/arm/plat-s5p/dev- renamed from arch/arm/plat-s5p/dev-fimc2.c +0 -0

fimc2.c

Quoted 15 lines

index dfddeda..5543d6373 100644

arch/arm/plat-s5p/dev-fimc2.c +1 -0
@@ -10,6 +10,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
@@ -28,9 +29,15 @@ static struct resource s5p_fimc2_resource[] = {
 	},
 };
 
Quoted 16 lines
Quoted 13 lines
arch/arm/plat-s5p/dev-fimc2.c +6 -1
+static u64 s5p_fimc2_dma_mask = DMA_BIT_MASK(32);
+
 struct platform_device s5p_device_fimc2 = {
 	.name		= "s5p-fimc",
 	.id		= 2,
 	.num_resources	= ARRAY_SIZE(s5p_fimc2_resource),
 	.resource	= s5p_fimc2_resource,
+	.dev		= {
+		.dma_mask		= &s5p_fimc2_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
 };
--
Quoted 1 line

1.7.2.2

looks good to me..will apply :-)

What about merging this patch also to the kgene/s5p-fixes-for-linus branch? IMHO this and the fimc clocks patch are pure bug fixes that should be merged into final 2.6.36 kernel. Without these two patches fimc driver is useless.

Best regards
--
Marek Szyprowski
Samsung Poland R&D Center

#9 lore raw

PATCH v2 1/1 ARM: Samsung: s5p-fimc: fix dma coherent mask

Quoted 3 lines · Marek Szyprowski

Hello,

Hi ;-)

Quoted 5 lines · Kukjin Kim
Quoted 4 lines
Quoted 2 lines · Marek Szyprowski

FIMC driver uses DMA_coherent allocator, which requires proper dma

mask

Quoted 107 lines
Quoted 90 lines

arch/arm/plat-s5p/dev-

Quoted 16 lines

to be set.

---

Chnages since v1:
- use DMA_BIT_MASK() macro, minor coding style change

---
 arch/arm/plat-s5p/dev-fimc0.c |    7 +++++++
 arch/arm/plat-s5p/dev-fimc1.c |    7 +++++++
 arch/arm/plat-s5p/dev-fimc2.c |    7 +++++++
 3 files changed, 21 insertions(+), 0 deletions(-)
arch/arm/plat-s5p/dev- renamed from arch/arm/plat-s5p/dev-fimc0.c +0 -0

fimc0.c

arch/arm/plat-s5p/dev-

Quoted 28 lines

index d3f1a9b..f9203fa 100644

arch/arm/plat-s5p/dev-fimc0.c +7 -0
@@ -10,6 +10,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
@@ -28,9 +29,15 @@ static struct resource s5p_fimc0_resource[] = {
 	},
 };
 
+static u64 s5p_fimc0_dma_mask = DMA_BIT_MASK(32);
+
 struct platform_device s5p_device_fimc0 = {
 	.name		= "s5p-fimc",
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(s5p_fimc0_resource),
 	.resource	= s5p_fimc0_resource,
+	.dev		= {
+		.dma_mask		= &s5p_fimc0_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
 };
arch/arm/plat-s5p/dev- renamed from arch/arm/plat-s5p/dev-fimc1.c +0 -0

fimc1.c

arch/arm/plat-s5p/dev-

Quoted 28 lines

index 41bd698..7ed91a3 100644

arch/arm/plat-s5p/dev-fimc1.c +7 -0
@@ -10,6 +10,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
@@ -28,9 +29,15 @@ static struct resource s5p_fimc1_resource[] = {
 	},
 };
 
+static u64 s5p_fimc1_dma_mask = DMA_BIT_MASK(32);
+
 struct platform_device s5p_device_fimc1 = {
 	.name		= "s5p-fimc",
 	.id		= 1,
 	.num_resources	= ARRAY_SIZE(s5p_fimc1_resource),
 	.resource	= s5p_fimc1_resource,
+	.dev		= {
+		.dma_mask		= &s5p_fimc1_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
 };
arch/arm/plat-s5p/dev- renamed from arch/arm/plat-s5p/dev-fimc2.c +0 -0

fimc2.c

Quoted 15 lines

index dfddeda..5543d6373 100644

arch/arm/plat-s5p/dev-fimc2.c +1 -0
@@ -10,6 +10,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
@@ -28,9 +29,15 @@ static struct resource s5p_fimc2_resource[] = {
 	},
 };
 
Quoted 16 lines
Quoted 13 lines
arch/arm/plat-s5p/dev-fimc2.c +6 -1
+static u64 s5p_fimc2_dma_mask = DMA_BIT_MASK(32);
+
 struct platform_device s5p_device_fimc2 = {
 	.name		= "s5p-fimc",
 	.id		= 2,
 	.num_resources	= ARRAY_SIZE(s5p_fimc2_resource),
 	.resource	= s5p_fimc2_resource,
+	.dev		= {
+		.dma_mask		= &s5p_fimc2_dma_mask,
+		.coherent_dma_mask	= DMA_BIT_MASK(32),
+	},
 };
--
Quoted 1 line

1.7.2.2

looks good to me..will apply :-)

Quoted 1 line

What about merging this patch also to the kgene/s5p-fixes-for-linus

branch?

Quoted 1 line

IMHO this and the fimc clocks patch are pure bug fixes that should be

merged

Quoted 1 line

into final 2.6.36 kernel. Without these two patches fimc driver is

useless.

Quoted 1 line

Hmm...ok...will sort out with other fixes.

Thanks.

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

#10 lore raw

PATCH 3/4 ARM: S5PC110: add common FIMC setup code

In reply to Marek Szyprowski

Add common clocks setup code for FIMC devices on S5PV210 SoCs.

---
 arch/arm/mach-s5pv210/Kconfig             |    6 ++++
 arch/arm/mach-s5pv210/Makefile            |    1 +
 arch/arm/mach-s5pv210/setup-fimc.c        |   46 +++++++++++++++++++++++++++++
 arch/arm/plat-samsung/include/plat/fimc.h |   24 +++++++++++++++
 4 files changed, 77 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5pv210/setup-fimc.c
 create mode 100644 arch/arm/plat-samsung/include/plat/fimc.h
arch/arm/mach-s5pv210/Kconfig +6 -0
index d3a3895..48489bb 100644
@@ -37,6 +37,12 @@ config S5PV210_SETUP_FB_24BPP
 	help
           Common setup code for S5PV210 with an 24bpp RGB display helper.
 
+config S5PV210_SETUP_FIMC
+	bool
+	help
+	  Compile common code for S5PV210 based machines to setup correct
+	  FIMC clock parameters.
+
 config S5PV210_SETUP_KEYPAD
 	bool
 	help
arch/arm/mach-s5pv210/Makefile +1 -0
index 05048c5..c13aef1 100644
@@ -29,6 +29,7 @@ obj-$(CONFIG_S3C64XX_DEV_SPI)	+= dev-spi.o
 obj-$(CONFIG_S5PC110_DEV_ONENAND) += dev-onenand.o
 
 obj-$(CONFIG_S5PV210_SETUP_FB_24BPP)	+= setup-fb-24bpp.o
+obj-$(CONFIG_S5PV210_SETUP_FIMC)	+= setup-fimc.o
 obj-$(CONFIG_S5PV210_SETUP_I2C1) 	+= setup-i2c1.o
 obj-$(CONFIG_S5PV210_SETUP_I2C2) 	+= setup-i2c2.o
 obj-$(CONFIG_S5PV210_SETUP_IDE)		+= setup-ide.o
arch/arm/mach-s5pv210/setup-fimc.c new file +46 -0

46 lines not on this page · raw message

arch/arm/plat-samsung/include/plat/fimc.h new file +24 -0
new file mode 100644
index 0000000..2c06f37
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Common FIMC devices definitions and helper functions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __PLAT_SAMSUNG_FIMC_H
+#define __PLAT_SAMSUNG_FIMC_H __FILE__
+
+/**
+ * s5pv210_fimc_setup_clks() - S5PV210/S5PC110 fimc clocks setup function
+ *
+ * Set correct parent clocks on machines which bootloaded did not configured
+ * fimc clocks correctly. FIMC devices works properly only if sourced from
+ * certain clock sources. "mout_epll" clock is the recommended one.
+ */
+extern int s5pv210_fimc_setup_clks(void);
+
+#endif /* __PLAT_SAMSUNG_FIMC_H */
Signature · 1 line
1.7.2.2
#11 lore raw

PATCH 3/4 ARM: S5PC110: add common FIMC setup code

Dne Po 6. z??? 2010 05:50:43 Marek Szyprowski napsal(a):

Quoted 76 lines

Add common clocks setup code for FIMC devices on S5PV210 SoCs.

---
 arch/arm/mach-s5pv210/Kconfig             |    6 ++++
 arch/arm/mach-s5pv210/Makefile            |    1 +
 arch/arm/mach-s5pv210/setup-fimc.c        |   46
+++++++++++++++++++++++++++++ arch/arm/plat-samsung/include/plat/fimc.h | 
 24 +++++++++++++++
 4 files changed, 77 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5pv210/setup-fimc.c
 create mode 100644 arch/arm/plat-samsung/include/plat/fimc.h
arch/arm/mach-s5pv210/Kconfig +6 -0
index d3a3895..48489bb 100644
@@ -37,6 +37,12 @@ config S5PV210_SETUP_FB_24BPP
 	help
           Common setup code for S5PV210 with an 24bpp RGB display helper.
 
+config S5PV210_SETUP_FIMC
+	bool
+	help
+	  Compile common code for S5PV210 based machines to setup correct
+	  FIMC clock parameters.
+
 config S5PV210_SETUP_KEYPAD
 	bool
 	help
(quoted diff) +0 -0

b/arch/arm/mach-s5pv210/Makefile index 05048c5..c13aef1 100644

arch/arm/mach-s5pv210/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_S3C64XX_DEV_SPI)	+= dev-spi.o
 obj-$(CONFIG_S5PC110_DEV_ONENAND) += dev-onenand.o
 
 obj-$(CONFIG_S5PV210_SETUP_FB_24BPP)	+= setup-fb-24bpp.o
+obj-$(CONFIG_S5PV210_SETUP_FIMC)	+= setup-fimc.o
 obj-$(CONFIG_S5PV210_SETUP_I2C1) 	+= setup-i2c1.o
 obj-$(CONFIG_S5PV210_SETUP_I2C2) 	+= setup-i2c2.o
 obj-$(CONFIG_S5PV210_SETUP_IDE)		+= setup-ide.o
(quoted diff) +0 -0

b/arch/arm/mach-s5pv210/setup-fimc.c new file mode 100644 index 0000000..80c1ffe

arch/arm/mach-s5pv210/setup-fimc.c new file +27 -0
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * S5PV210 clock setup code for FIMC devices
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/device.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+#include <plat/devs.h>
+#include <plat/fimc.h>
+
+int __init s5pv210_fimc_setup_clks(void)
+{
+	int err = 0;
+	int i;
+	struct clk *clk_fimc, *parent;
+
+	struct device *fimc_devs[] = {
+		&s5p_device_fimc0.dev,
+		&s5p_device_fimc1.dev,
+		&s5p_device_fimc2.dev
+	};

arch/arm/mach-s5pv210/setup-fimc.c line 37

Quoted 10 lines
arch/arm/mach-s5pv210/setup-fimc.c new file +10 -0
+
+	parent = clk_get(NULL, "mout_epll");
+	if (IS_ERR(parent))
+		return PTR_ERR(parent);
+
+	for (i = 0; err == 0 && i < ARRAY_SIZE(fimc_devs); i++) {
+		if (fimc_devs[i]) {
+			clk_fimc = clk_get(fimc_devs[i], "sclk_fimc");
+			if (IS_ERR(clk_fimc)) {
+				err = PTR_ERR(clk_fimc);

I believe you should clk_put() the clocks that were already clk_get()-ed here.

Cheers

Quoted 39 lines
arch/arm/mach-s5pv210/setup-fimc.c new file +9 -0
+				break;
+			}
+			clk_set_parent(clk_fimc, parent);
+			clk_put(clk_fimc);
+		}
+	}
+	clk_put(parent);
+	return err;
+}
(quoted diff) +0 -0

b/arch/arm/plat-samsung/include/plat/fimc.h new file mode 100644 index 0000000..2c06f37

arch/arm/plat-samsung/include/plat/fimc.h new file +18 -0
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Common FIMC devices definitions and helper functions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __PLAT_SAMSUNG_FIMC_H
+#define __PLAT_SAMSUNG_FIMC_H __FILE__
+
+/**
+ * s5pv210_fimc_setup_clks() - S5PV210/S5PC110 fimc clocks setup function
+ *
+ * Set correct parent clocks on machines which bootloaded did not

configured + * fimc clocks correctly. FIMC devices works properly only if sourced from + * certain clock sources. "mout_epll" clock is the recommended one. + */

arch/arm/plat-samsung/include/plat/fimc.h new file +3 -0
+extern int s5pv210_fimc_setup_clks(void);
+
+#endif /* __PLAT_SAMSUNG_FIMC_H */
#12 lore raw

PATCH 3/4 ARM: S5PC110: add common FIMC setup code

Hello,

Quoted 81 lines · On 2010-09-06 13:16 Marek Vasut wrote:

Dne Po 6. z??? 2010 05:50:43 Marek Szyprowski napsal(a):

Quoted 80 lines

Add common clocks setup code for FIMC devices on S5PV210 SoCs.

---
  arch/arm/mach-s5pv210/Kconfig             |    6 ++++
  arch/arm/mach-s5pv210/Makefile            |    1 +
  arch/arm/mach-s5pv210/setup-fimc.c        |   46
+++++++++++++++++++++++++++++ arch/arm/plat-samsung/include/plat/fimc.h |
  24 +++++++++++++++
  4 files changed, 77 insertions(+), 0 deletions(-)

create mode 100644 arch/arm/mach-s5pv210/setup-fimc.c create mode 100644 arch/arm/plat-samsung/include/plat/fimc.h

arch/arm/mach-s5pv210/Kconfig +6 -0
index d3a3895..48489bb 100644
@@ -37,6 +37,12 @@ config S5PV210_SETUP_FB_24BPP
  	help
            Common setup code for S5PV210 with an 24bpp RGB display helper.
 
+config S5PV210_SETUP_FIMC
+	bool
+	help
+	  Compile common code for S5PV210 based machines to setup correct
+	  FIMC clock parameters.
+
  config S5PV210_SETUP_KEYPAD
  	bool
  	help
(quoted diff) +0 -0

b/arch/arm/mach-s5pv210/Makefile index 05048c5..c13aef1 100644

arch/arm/mach-s5pv210/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_S3C64XX_DEV_SPI)	+= dev-spi.o
  obj-$(CONFIG_S5PC110_DEV_ONENAND) += dev-onenand.o
 
  obj-$(CONFIG_S5PV210_SETUP_FB_24BPP)	+= setup-fb-24bpp.o
+obj-$(CONFIG_S5PV210_SETUP_FIMC)	+= setup-fimc.o
  obj-$(CONFIG_S5PV210_SETUP_I2C1) 	+= setup-i2c1.o
  obj-$(CONFIG_S5PV210_SETUP_I2C2) 	+= setup-i2c2.o
  obj-$(CONFIG_S5PV210_SETUP_IDE)		+= setup-ide.o
(quoted diff) +0 -0

b/arch/arm/mach-s5pv210/setup-fimc.c new file mode 100644 index 0000000..80c1ffe

arch/arm/mach-s5pv210/setup-fimc.c new file +31 -0
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * S5PV210 clock setup code for FIMC devices
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include<linux/device.h>
+#include<linux/clk.h>
+#include<linux/err.h>
+#include<plat/devs.h>
+#include<plat/fimc.h>
+
+int __init s5pv210_fimc_setup_clks(void)
+{
+	int err = 0;
+	int i;
+	struct clk *clk_fimc, *parent;
+
+	struct device *fimc_devs[] = {
+		&s5p_device_fimc0.dev,
+		&s5p_device_fimc1.dev,
+		&s5p_device_fimc2.dev
+	};
+
+	parent = clk_get(NULL, "mout_epll");
+	if (IS_ERR(parent))
+		return PTR_ERR(parent);
Quoted 8 lines

arch/arm/mach-s5pv210/setup-fimc.c line 37

Quoted 6 lines
arch/arm/mach-s5pv210/setup-fimc.c new file +6 -0
+
+	for (i = 0; err == 0&&  i<  ARRAY_SIZE(fimc_devs); i++) {
+		if (fimc_devs[i]) {
+			clk_fimc = clk_get(fimc_devs[i], "sclk_fimc");
+			if (IS_ERR(clk_fimc)) {
+				err = PTR_ERR(clk_fimc);

I believe you should clk_put() the clocks that were already clk_get()-ed here.

They are, see clk_put after clk_set_parent.

Quoted 32 lines

Cheers

Quoted 31 lines
arch/arm/mach-s5pv210/setup-fimc.c new file +9 -0
+				break;
+			}
+			clk_set_parent(clk_fimc, parent);
+			clk_put(clk_fimc);
+		}
+	}
+	clk_put(parent);
+	return err;
+}
(quoted diff) +0 -0

b/arch/arm/plat-samsung/include/plat/fimc.h new file mode 100644 index 0000000..2c06f37

arch/arm/plat-samsung/include/plat/fimc.h new file +16 -0
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Common FIMC devices definitions and helper functions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __PLAT_SAMSUNG_FIMC_H
+#define __PLAT_SAMSUNG_FIMC_H __FILE__
+
+/**
+ * s5pv210_fimc_setup_clks() - S5PV210/S5PC110 fimc clocks setup function
Quoted 9 lines

arch/arm/plat-samsung/include/plat/fimc.h line 24

Quoted 8 lines
arch/arm/plat-samsung/include/plat/fimc.h new file +2 -0
+ *
+ * Set correct parent clocks on machines which bootloaded did not

configured + * fimc clocks correctly. FIMC devices works properly only if sourced from + * certain clock sources. "mout_epll" clock is the recommended one. + */

arch/arm/plat-samsung/include/plat/fimc.h new file +3 -0
+extern int s5pv210_fimc_setup_clks(void);
+
+#endif /* __PLAT_SAMSUNG_FIMC_H */

Best regards

Signature · 2 lines
Marek Szyprowski
Samsung Poland R&D Center
#13 lore raw

PATCH 3/4 ARM: S5PC110: add common FIMC setup code

Dne Po 6. z??? 2010 06:34:28 Marek Szyprowski napsal(a):

Quoted 107 lines

Hello,

Quoted 104 lines · On 2010-09-06 13:16 Marek Vasut wrote:

Dne Po 6. z??? 2010 05:50:43 Marek Szyprowski napsal(a):

Quoted 90 lines

Add common clocks setup code for FIMC devices on S5PV210 SoCs.

---

  arch/arm/mach-s5pv210/Kconfig             |    6 ++++
  arch/arm/mach-s5pv210/Makefile            |    1 +
  arch/arm/mach-s5pv210/setup-fimc.c        |   46

+++++++++++++++++++++++++++++ arch/arm/plat-samsung/include/plat/fimc.h |

24 +++++++++++++++

  4 files changed, 77 insertions(+), 0 deletions(-)

create mode 100644 arch/arm/mach-s5pv210/setup-fimc.c create mode 100644 arch/arm/plat-samsung/include/plat/fimc.h

(quoted diff) +0 -0

b/arch/arm/mach-s5pv210/Kconfig index d3a3895..48489bb 100644

arch/arm/mach-s5pv210/Kconfig +6 -0
@@ -37,6 +37,12 @@ config S5PV210_SETUP_FB_24BPP
 
  	help
 
            Common setup code for S5PV210 with an 24bpp RGB display
            helper.
 
+config S5PV210_SETUP_FIMC
+	bool
+	help
+	  Compile common code for S5PV210 based machines to setup correct
+	  FIMC clock parameters.
+

config S5PV210_SETUP_KEYPAD

bool
help

(quoted diff) +0 -0

b/arch/arm/mach-s5pv210/Makefile index 05048c5..c13aef1 100644

arch/arm/mach-s5pv210/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_S3C64XX_DEV_SPI)	+= dev-spi.o
 
  obj-$(CONFIG_S5PC110_DEV_ONENAND) += dev-onenand.o
 
  obj-$(CONFIG_S5PV210_SETUP_FB_24BPP)	+= setup-fb-24bpp.o
 
+obj-$(CONFIG_S5PV210_SETUP_FIMC)	+= setup-fimc.o
 
  obj-$(CONFIG_S5PV210_SETUP_I2C1) 	+= setup-i2c1.o
  obj-$(CONFIG_S5PV210_SETUP_I2C2) 	+= setup-i2c2.o
  obj-$(CONFIG_S5PV210_SETUP_IDE)		+= setup-ide.o
(quoted diff) +0 -0

b/arch/arm/mach-s5pv210/setup-fimc.c new file mode 100644 index 0000000..80c1ffe

arch/arm/mach-s5pv210/setup-fimc.c new file +27 -0
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * S5PV210 clock setup code for FIMC devices
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include<linux/device.h>
+#include<linux/clk.h>
+#include<linux/err.h>
+#include<plat/devs.h>
+#include<plat/fimc.h>
+
+int __init s5pv210_fimc_setup_clks(void)
+{
+	int err = 0;
+	int i;
+	struct clk *clk_fimc, *parent;
+
+	struct device *fimc_devs[] = {
+		&s5p_device_fimc0.dev,
+		&s5p_device_fimc1.dev,
+		&s5p_device_fimc2.dev
+	};

arch/arm/mach-s5pv210/setup-fimc.c line 37

Quoted 10 lines
arch/arm/mach-s5pv210/setup-fimc.c new file +10 -0
+
+	parent = clk_get(NULL, "mout_epll");
+	if (IS_ERR(parent))
+		return PTR_ERR(parent);
+
+	for (i = 0; err == 0&&  i<  ARRAY_SIZE(fimc_devs); i++) {
+		if (fimc_devs[i]) {
+			clk_fimc = clk_get(fimc_devs[i], "sclk_fimc");
+			if (IS_ERR(clk_fimc)) {
+				err = PTR_ERR(clk_fimc);

I believe you should clk_put() the clocks that were already clk_get()-ed here.

Ah, please ignore my stupid comment then, I missed this one.

Quoted 6 lines

They are, see clk_put after clk_set_parent.

Quoted 3 lines

Cheers

arch/arm/mach-s5pv210/setup-fimc.c line 38

Quoted 1 line
arch/arm/mach-s5pv210/setup-fimc.c new file +1 -0
+				break;

btw. can the array fimc_devs[] be sparse ? So you'd replace this break; with continue; ?

Well ... it's ok :)

Quoted 40 lines
Quoted 30 lines
Quoted 30 lines
arch/arm/mach-s5pv210/setup-fimc.c new file +8 -0
+			}
+			clk_set_parent(clk_fimc, parent);
+			clk_put(clk_fimc);
+		}
+	}
+	clk_put(parent);
+	return err;
+}
(quoted diff) +0 -0

b/arch/arm/plat-samsung/include/plat/fimc.h new file mode 100644 index 0000000..2c06f37

arch/arm/plat-samsung/include/plat/fimc.h new file +16 -0
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Common FIMC devices definitions and helper functions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __PLAT_SAMSUNG_FIMC_H
+#define __PLAT_SAMSUNG_FIMC_H __FILE__
+
+/**
+ * s5pv210_fimc_setup_clks() - S5PV210/S5PC110 fimc clocks setup
Quoted 8 lines

arch/arm/plat-samsung/include/plat/fimc.h line 24

Quoted 8 lines

function + *
+ * Set correct parent clocks on machines which bootloaded did not configured + * fimc clocks correctly. FIMC devices works properly only if sourced from + * certain clock sources. "mout_epll" clock is the recommended one. + */

arch/arm/plat-samsung/include/plat/fimc.h new file +3 -0
+extern int s5pv210_fimc_setup_clks(void);
+
+#endif /* __PLAT_SAMSUNG_FIMC_H */

Best regards

#14 lore raw

PATCH 3/4 ARM: S5PC110: add common FIMC setup code

In reply to Marek Szyprowski

On Mon, Sep 6, 2010 at 12:50 PM, Marek Szyprowski
<[email protected]> wrote:
....

Quoted 7 lines

+ ? ? ? parent = clk_get(NULL, "mout_epll");
+ ? ? ? if (IS_ERR(parent))
+ ? ? ? ? ? ? ? return PTR_ERR(parent);
+
+ ? ? ? for (i = 0; err == 0 && i < ARRAY_SIZE(fimc_devs); i++) {
+ ? ? ? ? ? ? ? if (fimc_devs[i]) {
+ ? ? ? ? ? ? ? ? ? ? ? clk_fimc = clk_get(fimc_devs[i], "sclk_fimc");

Quoted 8 lines

+ ? ? ? ? ? ? ? ? ? ? ? if (IS_ERR(clk_fimc)) {
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? err = PTR_ERR(clk_fimc);
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
+ ? ? ? ? ? ? ? ? ? ? ? }
+ ? ? ? ? ? ? ? ? ? ? ? clk_set_parent(clk_fimc, parent);
+ ? ? ? ? ? ? ? ? ? ? ? clk_put(clk_fimc);
+ ? ? ? ? ? ? ? }
+ ? ? ? }

The sclk_fimc could source clock from a number of options out of a mux. mout_epll is just one of them. Different machines may want to source the clock differently.
So, IMO the parent selection should not be done in platform code, but rather in machine init code.
Not the best, but a better solution can be found in arch/arm/mach-s5pc100/dev-spi.c
Give it a thought.

#15 lore raw

PATCH 3/4 ARM: S5PC110: add common FIMC setup code

Hello,

Quoted 19 lines · Jassi Brar

On Mon, Sep 6, 2010 at 12:50 PM, Marek Szyprowski
<[email protected]> wrote:
....

Quoted 5 lines
arch/arm/mach-s5pv210/setup-fimc.c new file +5 -0
+       parent = clk_get(NULL, "mout_epll");
+       if (IS_ERR(parent))
+               return PTR_ERR(parent);
+
+       for (i = 0; err == 0&&  i<  ARRAY_SIZE(fimc_devs); i++) {

arch/arm/mach-s5pv210/setup-fimc.c line 43

Quoted 10 lines
arch/arm/mach-s5pv210/setup-fimc.c new file +10 -0
+               if (fimc_devs[i]) {
+                       clk_fimc = clk_get(fimc_devs[i], "sclk_fimc");
+                       if (IS_ERR(clk_fimc)) {
+                               err = PTR_ERR(clk_fimc);
+                               break;
+                       }
+                       clk_set_parent(clk_fimc, parent);
+                       clk_put(clk_fimc);
+               }
+       }
Quoted 3 lines

The sclk_fimc could source clock from a number of options out of a mux. mout_epll is just one of them. Different machines may want to source the clock differently.

Right, I forgot about this case.

Quoted 5 lines

So, IMO the parent selection should not be done in platform code, but rather in machine init code.
Not the best, but a better solution can be found in arch/arm/mach-s5pc100/dev-spi.c
Give it a thought.

I'm thinking of making the parent clock an argument to the s5pv210_fimc_setup_clks().

I really don't like the idea of passing clock name through the platform data and letting driver to mess with clock's parents. Machine startup code is the last place where such things should be changed.

Best regards

Signature · 2 lines
Marek Szyprowski
Samsung Poland R&D Center
#16 lore raw

PATCH 3/4 ARM: S5PC110: add common FIMC setup code

Quoted 37 lines · Marek Szyprowski

Hello,

Quoted 21 lines · Jassi Brar

On Mon, Sep 6, 2010 at 12:50 PM, Marek Szyprowski
<[email protected]> ?wrote:
....

Quoted 16 lines

+ ? ? ? parent = clk_get(NULL, "mout_epll");
+ ? ? ? if (IS_ERR(parent))
+ ? ? ? ? ? ? ? return PTR_ERR(parent);
+
+ ? ? ? for (i = 0; err == 0&& ?i< ?ARRAY_SIZE(fimc_devs); i++) {
+ ? ? ? ? ? ? ? if (fimc_devs[i]) {
+ ? ? ? ? ? ? ? ? ? ? ? clk_fimc = clk_get(fimc_devs[i], "sclk_fimc");
+ ? ? ? ? ? ? ? ? ? ? ? if (IS_ERR(clk_fimc)) {
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? err = PTR_ERR(clk_fimc);
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
+ ? ? ? ? ? ? ? ? ? ? ? }
+ ? ? ? ? ? ? ? ? ? ? ? clk_set_parent(clk_fimc, parent);
+ ? ? ? ? ? ? ? ? ? ? ? clk_put(clk_fimc);
+ ? ? ? ? ? ? ? }
+ ? ? ? }

Quoted 3 lines

The sclk_fimc could source clock from a number of options out of a mux. mout_epll is just one of them. Different machines may want to source the clock differently.

Right, I forgot about this case.

Quoted 6 lines

So, IMO the parent selection should not be done in platform code, but rather
in machine init code.
Not the best, but a better solution can be found in arch/arm/mach-s5pc100/dev-spi.c
Give it a thought.

Quoted 2 lines

I'm thinking of making the parent clock an argument to the s5pv210_fimc_setup_clks().

Yes, that's better since the relevant clock is managed by the CMU

Quoted 2 lines

I really don't like the idea of passing clock name through the platform data and letting driver to mess with clock's parents.

In case of SPI the clock mux and scalar is present _within_ the SPI controller and having to touch SPI regs from outside the driver isn't what I prefer.

Quoted 2 lines

Machine startup code is the
last place where such things should be changed.

Until I am enlightened, I'd like to think otherwise.
I think the board designer would already have thought out the clock sourcing hierarchy. Setting appropriate parents once at boot-time and having drivers not worry about it, should be better.

#17 lore raw

PATCH 3/4 ARM: S5PC110: add common FIMC setup code

Hello,

Quoted 3 lines · Jassi Brar
Quoted 2 lines

I'm thinking of making the parent clock an argument to the s5pv210_fimc_setup_clks().

Yes, that's better since the relevant clock is managed by the CMU

What do you mean by the CMU? This function is intended to be called from board startup code.

Quoted 5 lines
Quoted 2 lines

I really don't like the idea of passing clock name through the platform data and letting driver to mess with clock's parents.

In case of SPI the clock mux and scalar is present _within_ the SPI controller and having to touch SPI regs from outside the driver isn't what I prefer.

I know. It is the same case as with SDHCI and UART controllers. I have an idea how to solve this in a bit more cleaner way. I hope to post a proposition soon.

Quoted 6 lines
Quoted 2 lines

Machine startup code is the
last place where such things should be changed.

Until I am enlightened, I'd like to think otherwise.
I think the board designer would already have thought out the clock sourcing hierarchy. Setting appropriate parents once at boot-time and having drivers not worry about it, should be better.

Definitely, but in our case kernel the default fimc_sclk parent points to non-existing clock.

Best regards

Signature · 2 lines
Marek Szyprowski
Samsung Poland R&D Center
#18 lore raw

PATCH 3/4 ARM: S5PC110: add common FIMC setup code

Quoted 11 lines · Marek Szyprowski

Hello,

Quoted 4 lines · Jassi Brar
Quoted 2 lines

I'm thinking of making the parent clock an argument to the s5pv210_fimc_setup_clks().

Yes, that's better since the relevant clock is managed by the CMU

What do you mean by the CMU? This function is intended to be called from board startup code.

Clock-Management-Unit block of the SoC.

Quoted 11 lines
Quoted 7 lines
Quoted 3 lines

I really don't like the idea of passing clock name through the platform data
and letting driver to mess with clock's parents.

In case of SPI the clock mux and scalar is present _within_ the SPI controller and having to touch SPI regs from outside the driver isn't what I prefer.

I know. It is the same case as with SDHCI and UART controllers. I have an idea how to solve this in a bit more cleaner way. I hope to post a proposition soon.

I'll be waiting.

Quoted 10 lines
Quoted 9 lines
Quoted 2 lines

Machine startup code is the
last place where such things should be changed.

Until I am enlightened, I'd like to think otherwise.
I think the board designer would already have thought out the clock sourcing
hierarchy. Setting appropriate parents once at boot-time and having drivers
not worry about it, should be better.

Quoted 2 lines

Definitely, but in our case kernel the default fimc_sclk parent points to non-existing clock.

You mean the default value in mux field of some CMU register points to absent source
of clock on the board?
Yes, that's why it's machine specific and should be setup by the board init code.
Rather we should never count upon defaults and always set parents explicitly.

#19 lore raw

PATCH 3/4 ARM: S5PC110: add common FIMC setup code

In reply to Jassi Brar

Hello,

Quoted 19 lines · Jassi Brar

On Mon, Sep 6, 2010 at 12:50 PM, Marek Szyprowski
<[email protected]> wrote:
....

Quoted 5 lines
arch/arm/mach-s5pv210/setup-fimc.c new file +5 -0
+       parent = clk_get(NULL, "mout_epll");
+       if (IS_ERR(parent))
+               return PTR_ERR(parent);
+
+       for (i = 0; err == 0&&  i<  ARRAY_SIZE(fimc_devs); i++) {

arch/arm/mach-s5pv210/setup-fimc.c line 43

Quoted 10 lines
arch/arm/mach-s5pv210/setup-fimc.c new file +10 -0
+               if (fimc_devs[i]) {
+                       clk_fimc = clk_get(fimc_devs[i], "sclk_fimc");
+                       if (IS_ERR(clk_fimc)) {
+                               err = PTR_ERR(clk_fimc);
+                               break;
+                       }
+                       clk_set_parent(clk_fimc, parent);
+                       clk_put(clk_fimc);
+               }
+       }
Quoted 3 lines

The sclk_fimc could source clock from a number of options out of a mux. mout_epll is just one of them. Different machines may want to source the clock differently.

Right, I forgot about this case.

Quoted 5 lines

So, IMO the parent selection should not be done in platform code, but rather in machine init code.
Not the best, but a better solution can be found in arch/arm/mach-s5pc100/dev-spi.c
Give it a thought.

I'm thinking of making the parent clock an argument to the s5pv210_fimc_setup_clks().

I really don't like the idea of passing clock name through the platform data and letting driver to mess with clock's parents. Machine startup code is the last place where such things should be changed.

Best regards

Signature · 2 lines
Marek Szyprowski
Samsung Poland R&D Center
#20 lore raw

PATCH 4/4 ARM: S5PC110: use common FIMC clock setup code

In reply to Marek Szyprowski

On Aquila and GONI the bootloader doesn't set FIMC parent clocks correctly. Use common FIMC setup code to fix this during machne boot.

---
 arch/arm/mach-s5pv210/Kconfig       |    2 ++
 arch/arm/mach-s5pv210/mach-aquila.c |    3 +++
 arch/arm/mach-s5pv210/mach-goni.c   |    2 ++
 3 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/mach-s5pv210/Kconfig +2 -0
index 48489bb..7b5e816 100644
@@ -79,6 +79,7 @@ config MACH_AQUILA
 	select S3C_DEV_HSMMC2
 	select S5PC110_DEV_ONENAND
 	select S5PV210_SETUP_FB_24BPP
+	select S5PV210_SETUP_FIMC
 	select S5PV210_SETUP_SDHCI
 	help
 	  Machine support for the Samsung Aquila target based on S5PC110 SoC
@@ -96,6 +97,7 @@ config MACH_GONI
 	select S3C_DEV_HSMMC2
 	select S5PC110_DEV_ONENAND
 	select S5PV210_SETUP_FB_24BPP
+	select S5PV210_SETUP_FIMC
 	select S5PV210_SETUP_SDHCI
 	help
 	  Machine support for Samsung GONI board
arch/arm/mach-s5pv210/mach-aquila.c +3 -0
index 0dda801..65f616b 100644
@@ -35,7 +35,9 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <plat/fb.h>
+#include <plat/fimc.h>
 #include <plat/fimc-core.h>
+
 #include <plat/sdhci.h>
 
 /* Following are default values for UCON, ULCON and UFCON UART registers */
@@ -510,6 +512,7 @@ static void __init aquila_machine_init(void)
 	s3c_fb_set_platdata(&aquila_lcd_pdata);
 
 	platform_add_devices(aquila_devices, ARRAY_SIZE(aquila_devices));
+	s5pv210_fimc_setup_clks();
 }
 
 MACHINE_START(AQUILA, "Aquila")
arch/arm/mach-s5pv210/mach-goni.c +2 -0
index 53754d7..9f3b52d 100644
@@ -35,6 +35,7 @@
 #include <plat/devs.h>
 #include <plat/cpu.h>
 #include <plat/fb.h>
+#include <plat/fimc.h>
 #include <plat/sdhci.h>
 
 /* Following are default values for UCON, ULCON and UFCON UART registers */
@@ -487,6 +488,7 @@ static void __init goni_machine_init(void)
 	s3c_fb_set_platdata(&goni_lcd_pdata);
 
 	platform_add_devices(goni_devices, ARRAY_SIZE(goni_devices));
+	s5pv210_fimc_setup_clks();
 }
 
 MACHINE_START(GONI, "GONI")
Signature · 1 line
1.7.2.2