Skip to contentSkip to conversation

S3C2416: Enable IIS and HSSPI clocks

PATCH Superseded Heiko Stübner 4 participants 11 messages Aug 20, 2011 – Aug 23, 2011

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover S3C2416: Enable IIS and HSSPI clocks

S3C2416/2450 (probably S3C2443 too) can use the newer style kernel-drivers made for S3C64xx and above for their I2S and HS-SPI controllers.

So as a first step in this direction, these patches add their respective clocks.

The I2S clocks were simply moved from S3C2443 to s3c2443-clock.c as they are identical on all 3 platforms.

The same is true for the HSSPI pclk which is added to s3c2443-clock.c, as it was not defined at all yet.

The HSSPI sclk is different between 2443 and 2416 and is therefore added to mach-s3c2416/clock.c

Heiko Stuebner (4):
S3C2443: Move i2s clock definitions to common code
S3C2443: Define constant for HSSPI pclk
S3C2416: Add HSSPI clock sourced from EPLL
S3C2443: Add hsspi-clock from pclk

 .../mach-s3c2410/include/mach/regs-s3c2443-clock.h |    1 +
 arch/arm/mach-s3c2416/clock.c                      |   26 +++++++++
 arch/arm/mach-s3c2443/clock.c                      |   53 ------------------
 arch/arm/plat-s3c24xx/s3c2443-clock.c              |   58 ++++++++++++++++++++
 4 files changed, 85 insertions(+), 53 deletions(-)
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 1/4 S3C2443: Move i2s clock definitions to common code

S3C2416/S3C2450 use the same clocks for their i2s blocks and can therefore reuse the existing ones.

---
 arch/arm/mach-s3c2443/clock.c         |   53 ---------------------------------
 arch/arm/plat-s3c24xx/s3c2443-clock.c |   53 +++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 53 deletions(-)
arch/arm/mach-s3c2443/clock.c +0 -53
index a1a7176..966bde5 100644
@@ -57,10 +57,6 @@
 
 /* clock selections */
 
-static struct clk clk_i2s_ext = {
-	.name		= "i2s-ext",
-};
-
 /* armdiv
  *
  * this clock is sourced from msysclk and can have a number of
@@ -235,48 +231,6 @@ static struct clk clk_hsmmc = {
 	},
 };
 
-/* i2s_eplldiv
- *
- * This clock is the output from the I2S divisor of ESYSCLK, and is separate
- * from the mux that comes after it (cannot merge into one single clock)
-*/
-
-static struct clksrc_clk clk_i2s_eplldiv = {
-	.clk	= {
-		.name		= "i2s-eplldiv",
-		.parent		= &clk_esysclk.clk,
-	},
-	.reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 12, },
-};
-
-/* i2s-ref
- *
- * i2s bus reference clock, selectable from external, esysclk or epllref
- *
- * Note, this used to be two clocks, but was compressed into one.
-*/
-
-struct clk *clk_i2s_srclist[] = {
-	[0] = &clk_i2s_eplldiv.clk,
-	[1] = &clk_i2s_ext,
-	[2] = &clk_epllref.clk,
-	[3] = &clk_epllref.clk,
-};
-
-static struct clksrc_clk clk_i2s = {
-	.clk	= {
-		.name		= "i2s-if",
-		.ctrlbit	= S3C2443_SCLKCON_I2SCLK,
-		.enable		= s3c2443_clkcon_enable_s,
-
-	},
-	.sources = &(struct clksrc_sources) {
-		.sources = clk_i2s_srclist,
-		.nr_sources = ARRAY_SIZE(clk_i2s_srclist),
-	},
-	.reg_src = { .reg = S3C2443_CLKSRC, .size = 2, .shift = 14 },
-};
-
 /* standard clock definitions */
 
 static struct clk init_clocks_off[] = {
@@ -286,11 +240,6 @@ static struct clk init_clocks_off[] = {
 		.enable		= s3c2443_clkcon_enable_p,
 		.ctrlbit	= S3C2443_PCLKCON_SDI,
 	}, {
-		.name		= "iis",
-		.parent		= &clk_p,
-		.enable		= s3c2443_clkcon_enable_p,
-		.ctrlbit	= S3C2443_PCLKCON_IIS,
-	}, {
 		.name		= "spi",
 		.devname	= "s3c2410-spi.0",
 		.parent		= &clk_p,
@@ -312,8 +261,6 @@ static struct clk init_clocks[] = {
 
 static struct clksrc_clk *clksrcs[] __initdata = {
 	&clk_arm,
-	&clk_i2s_eplldiv,
-	&clk_i2s,
 	&clk_hsspi,
 	&clk_hsmmc_div,
 };
arch/arm/plat-s3c24xx/s3c2443-clock.c +53 -0

68 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#2 lore raw

PATCH 1/4 S3C2443: Move i2s clock definitions to common code

arch/arm/plat-s3c24xx/s3c2443-clock.c static struct clksrc_clk clksrc_clks[] = { · line 238

Quoted 13 lines · Heiko St?bner
arch/arm/plat-s3c24xx/s3c2443-clock.c +13 -0
+/* i2s-ref
+ *
+ * i2s bus reference clock, selectable from external, esysclk or epllref
+ *
+ * Note, this used to be two clocks, but was compressed into one.
+*/
+
+struct clk *clk_i2s_srclist[] = {
+	[0] = &clk_i2s_eplldiv.clk,
+	[1] = &clk_i2s_ext,
+	[2] = &clk_epllref.clk,
+	[3] = &clk_epllref.clk,
+};

Is there any reason not to make this static (have you run your patch through checkpatch.pl ?)

#3 lore raw

PATCH 1/4 S3C2443: Move i2s clock definitions to common code

Am Sonntag 21 August 2011, 19:13:32 schrieb Russell King - ARM Linux:

Quoted 9 lines · Heiko St?bner
Quoted 8 lines
arch/arm/plat-s3c24xx/s3c2443-clock.c +8 -0
+/* i2s-ref
+ *
+ * i2s bus reference clock, selectable from external, esysclk or epllref
+ *
+ * Note, this used to be two clocks, but was compressed into one.
+*/
+
+struct clk *clk_i2s_srclist[] = {
Quoted 8 lines

arch/arm/plat-s3c24xx/s3c2443-clock.c static struct clksrc_clk clksrc_clks[] = { · line 238

Quoted 5 lines
arch/arm/plat-s3c24xx/s3c2443-clock.c +5 -0
+	[0] = &clk_i2s_eplldiv.clk,
+	[1] = &clk_i2s_ext,
+	[2] = &clk_epllref.clk,
+	[3] = &clk_epllref.clk,
+};

Is there any reason not to make this static (have you run your patch through checkpatch.pl ?)

Yep I did run all of them through checkpatch (after beeing scolded last time) and it didn't report anything.

But for this move of code I simply grabbed the code fragments and put them into their new location (i.e. it was this way in mach-s3c2443/clock.c) and should have probably taken a closer look at what I'm moving.

So it seems you are right, it should probably be static as everything else is also static.

Heiko

#4 lore raw

PATCH 1/4 S3C2443: Move i2s clock definitions to common code

Quoted 22 lines · Heiko St?bner

Am Sonntag 21 August 2011, 19:13:32 schrieb Russell King - ARM Linux:

Quoted 9 lines · Heiko St?bner
Quoted 8 lines

+/* i2s-ref
+ *
+ * i2s bus reference clock, selectable from external, esysclk or epllref + *
+ * Note, this used to be two clocks, but was compressed into one.

arch/arm/plat-s3c24xx/s3c2443-clock.c +3 -0
+*/
+
+struct clk *clk_i2s_srclist[] = {
Quoted 8 lines

arch/arm/plat-s3c24xx/s3c2443-clock.c static struct clksrc_clk clksrc_clks[] = { · line 238

Quoted 5 lines
arch/arm/plat-s3c24xx/s3c2443-clock.c +5 -0
+	[0] = &clk_i2s_eplldiv.clk,
+	[1] = &clk_i2s_ext,
+	[2] = &clk_epllref.clk,
+	[3] = &clk_epllref.clk,
+};

Is there any reason not to make this static (have you run your patch through checkpatch.pl ?)

Yep I did run all of them through checkpatch (after beeing scolded last time) and it didn't report anything.

Quoted 6 lines

But for this move of code I simply grabbed the code fragments and put them into their new location (i.e. it was this way in mach-s3c2443/clock.c) and should have probably taken a closer look at what I'm moving.

So it seems you are right, it should probably be static as everything else is also static.

And you don't really understand why everything else is static, right ? ;-)

(don't take it as an offense)

Quoted 7 lines

Heiko

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#5 lore raw

PATCH 1/4 S3C2443: Move i2s clock definitions to common code

Am Sonntag 21 August 2011, 22:26:16 schrieb Marek Vasut:

Quoted 28 lines · Heiko St?bner
Quoted 27 lines

Am Sonntag 21 August 2011, 19:13:32 schrieb Russell King - ARM Linux:

Quoted 9 lines · Heiko St?bner
Quoted 8 lines

+/* i2s-ref
+ *
+ * i2s bus reference clock, selectable from external, esysclk or epllref + *
+ * Note, this used to be two clocks, but was compressed into one.

arch/arm/plat-s3c24xx/s3c2443-clock.c +3 -0
+*/
+
+struct clk *clk_i2s_srclist[] = {
Quoted 8 lines

arch/arm/plat-s3c24xx/s3c2443-clock.c static struct clksrc_clk clksrc_clks[] = { · line 238

Quoted 5 lines
arch/arm/plat-s3c24xx/s3c2443-clock.c +5 -0
+	[0] = &clk_i2s_eplldiv.clk,
+	[1] = &clk_i2s_ext,
+	[2] = &clk_epllref.clk,
+	[3] = &clk_epllref.clk,
+};

Is there any reason not to make this static (have you run your patch through checkpatch.pl ?)

Yep I did run all of them through checkpatch (after beeing scolded last time) and it didn't report anything.

But for this move of code I simply grabbed the code fragments and put them into their new location (i.e. it was this way in mach-s3c2443/clock.c) and should have probably taken a closer look at what I'm moving.

Quoted 4 lines
Quoted 2 lines

So it seems you are right, it should probably be static as everything else is also static.

And you don't really understand why everything else is static, right ? ;-)

yep :-) - until now

But a quick lookup did help [lifetime of the variable extends across the entire run of the program, i.e. a global variable and local to the source file it's defined in].

Quoted 1 line

(don't take it as an offense)

none taken ... in fact it was a welcome push to reread variable storage classes and lifetime again [last time was some years ago] :-).

Heiko

#6 lore raw

PATCH 1/4 S3C2443: Move i2s clock definitions to common code

In reply to Heiko Stübner
Quoted 6 lines · Heiko St?bner

Am Sonntag 21 August 2011, 19:13:32 schrieb Russell King - ARM Linux:

Quoted 4 lines · Heiko St?bner
Quoted 3 lines

+/* i2s-ref
+ *
+ * i2s bus reference clock, selectable from external, esysclk or

epllref

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines

+ *
+ * Note, this used to be two clocks, but was compressed into one.

arch/arm/plat-s3c24xx/s3c2443-clock.c +3 -0
+*/
+
+struct clk *clk_i2s_srclist[] = {
Quoted 8 lines

arch/arm/plat-s3c24xx/s3c2443-clock.c static struct clksrc_clk clksrc_clks[] = { · line 238

Quoted 5 lines
arch/arm/plat-s3c24xx/s3c2443-clock.c +5 -0
+	[0] = &clk_i2s_eplldiv.clk,
+	[1] = &clk_i2s_ext,
+	[2] = &clk_epllref.clk,
+	[3] = &clk_epllref.clk,
+};

Is there any reason not to make this static (have you run your patch through checkpatch.pl ?)

Quoted 1 line

Yep I did run all of them through checkpatch (after beeing scolded last

time)

Quoted 2 lines

and it didn't report anything.

Hmm...as a note, happened following with checkpatch.pl :(

ERROR: need consistent spacing around '*' (ctx:WxV) #35: FILE: arch/arm/mach-s3c2416/clock.c:57:

+               .sources = (struct clk *[]) {
                                       ^

total: 1 errors, 0 warnings, 38 lines checked

PATCH 34 S3C2416 Add HSSPI clock sourced from EPLL.txt has style problems, please review.

Thanks.

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

Quoted 5 lines

But for this move of code I simply grabbed the code fragments and put them into their new location (i.e. it was this way in mach-s3c2443/clock.c) and should have probably taken a closer look at what I'm moving.

So it seems you are right, it should probably be static as everything else

is

Quoted 3 lines

also static.

Heiko

#7 lore raw

PATCH 1/4 S3C2443: Move i2s clock definitions to common code

Am Dienstag 23 August 2011, 05:42:47 schrieb Kukjin Kim:

Quoted 33 lines
Quoted 5 lines · Heiko St?bner

Am Sonntag 21 August 2011, 19:13:32 schrieb Russell King - ARM Linux:

Quoted 4 lines · Heiko St?bner
Quoted 3 lines

+/* i2s-ref
+ *
+ * i2s bus reference clock, selectable from external, esysclk or

epllref

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines

+ *
+ * Note, this used to be two clocks, but was compressed into one.

arch/arm/plat-s3c24xx/s3c2443-clock.c +3 -0
+*/
+
+struct clk *clk_i2s_srclist[] = {
Quoted 8 lines

arch/arm/plat-s3c24xx/s3c2443-clock.c static struct clksrc_clk clksrc_clks[] = { · line 238

Quoted 5 lines
arch/arm/plat-s3c24xx/s3c2443-clock.c +5 -0
+	[0] = &clk_i2s_eplldiv.clk,
+	[1] = &clk_i2s_ext,
+	[2] = &clk_epllref.clk,
+	[3] = &clk_epllref.clk,
+};

Is there any reason not to make this static (have you run your patch through checkpatch.pl ?)

Quoted 1 line

Yep I did run all of them through checkpatch (after beeing scolded last

time)

Quoted 1 line

and it didn't report anything.

Hmm...as a note, happened following with checkpatch.pl :(

ERROR: need consistent spacing around '*' (ctx:WxV) #35: FILE: arch/arm/mach-s3c2416/clock.c:57:

Quoted 7 lines
+               .sources = (struct clk *[]) {
                                       ^

total: 1 errors, 0 warnings, 38 lines checked

PATCH 34 S3C2416 Add HSSPI clock sourced from EPLL.txt has style problems, please review.

will do.

Today I also saw, that my definition of the hsspi pclk would have caused a conflict with the hsspi sclk definition of s3c2443.

So, as nobody uses the s3c2443's hsspi controller yet, I would also rename it to hsspi-if with the next patch iteration.

Heiko

#8 lore raw

PATCH 2/4 S3C2443: Define constant for HSSPI pclk

In reply to Heiko Stübner

It's the same clock for 2443/2416/2450.

---
 .../mach-s3c2410/include/mach/regs-s3c2443-clock.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h +1 -0
index 5e06c72..df6434f 100644
@@ -102,6 +102,7 @@
 #define S3C2443_PCLKCON_UART3		(1<<3)
 #define S3C2443_PCLKCON_IIC		(1<<4)
 #define S3C2443_PCLKCON_SDI		(1<<5)
+#define S3C2443_PCLKCON_HSSPI		(1<<6)
 #define S3C2443_PCLKCON_ADC		(1<<7)
 #define S3C2443_PCLKCON_AC97		(1<<8)
 #define S3C2443_PCLKCON_IIS		(1<<9)
Signature · 1 line
1.7.2.3
#9 lore raw

PATCH 3/4 S3C2416: Add HSSPI clock sourced from EPLL

In reply to Heiko Stübner

This clock is special to the S3C2416/2450 SoCs.

---
 arch/arm/mach-s3c2416/clock.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
arch/arm/mach-s3c2416/clock.c +26 -0
index 21a5e81..5177d79 100644
@@ -38,6 +38,30 @@ static unsigned int armdiv[8] = {
 	[7] = 8,
 };
 
+static struct clksrc_clk hsspi_eplldiv = {
+	.clk = {
+		.name	= "hsspi-eplldiv",
+		.parent	= &clk_esysclk.clk,
+		.ctrlbit = (1 << 14),
+		.enable = s3c2443_clkcon_enable_s,
+	},
+	.reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 24 },
+};
+
+static struct clksrc_clk hsspi_mux = {
+	.clk	= {
+		.name	= "hsspi-if",
+	},
+	.sources = &(struct clksrc_sources) {
+		.nr_sources = 2,
+		.sources = (struct clk *[]) {
+			[0] = &hsspi_eplldiv.clk,
+			[1] = NULL, /* to fix */
+		},
+	},
+	.reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 18 },
+};
+
 static struct clksrc_clk hsmmc_div[] = {
 	[0] = {
 		.clk = {
@@ -114,6 +138,8 @@ void __init_or_cpufreq s3c2416_setup_clocks(void)
 
 
 static struct clksrc_clk *clksrcs[] __initdata = {
+	&hsspi_eplldiv,
+	&hsspi_mux,
 	&hsmmc_div[0],
 	&hsmmc_div[1],
 	&hsmmc_mux[0],
Signature · 1 line
1.7.2.3
#10 lore raw

PATCH 4/4 S3C2443: Add hsspi-clock from pclk

In reply to Heiko Stübner

This clock is common to S3C2443/2416/2450.

---
 arch/arm/plat-s3c24xx/s3c2443-clock.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/plat-s3c24xx/s3c2443-clock.c +5 -0
index e2807d9..92fc25b 100644
@@ -259,6 +259,11 @@ static struct clk init_clocks_off[] = {
 		.enable		= s3c2443_clkcon_enable_p,
 		.ctrlbit	= S3C2443_PCLKCON_IIS,
 	}, {
+		.name		= "hsspi",
+		.parent		= &clk_p,
+		.enable		= s3c2443_clkcon_enable_p,
+		.ctrlbit	= S3C2443_PCLKCON_HSSPI,
+	}, {
 		.name		= "adc",
 		.parent		= &clk_p,
 		.enable		= s3c2443_clkcon_enable_p,
Signature · 1 line
1.7.2.3