Skip to contentSkip to conversation

ARM: S3C2443: introduce soc_is_s3c2443 macro

PATCH In review Alexander Varnin 2 participants 5 messages Nov 26, 2012

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

PATCH 1/2 ARM: S3C2443: introduce soc_is_s3c2443 macro

---
 arch/arm/plat-samsung/include/plat/cpu.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
arch/arm/plat-samsung/include/plat/cpu.h +10 -0
index ace4451..613f492 100644
@@ -23,6 +23,9 @@ extern unsigned long samsung_cpu_id;
 #define S3C24XX_CPU_ID		0x32400000
 #define S3C24XX_CPU_MASK	0xFFF00000
 
+#define S3C2443_CPU_ID		0x32443001
+#define S3C2443_CPU_MASK	0xFFFFFFFF
+
 #define S3C6400_CPU_ID		0x36400000
 #define S3C6410_CPU_ID		0x36410000
 #define S3C64XX_CPU_MASK	0xFFFFF000
@@ -52,6 +55,7 @@ static inline int is_samsung_##name(void)	\
 }
 
 IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
+IS_SAMSUNG_CPU(s3c2443, S3C2443_CPU_ID, S3C2443_CPU_MASK)
 IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
 IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
 IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
@@ -72,6 +76,12 @@ IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
 # define soc_is_s3c24xx()	0
 #endif
 
+#if defined(CONFIG_CPU_S3C2443)
+# define soc_is_s3c2443()	is_samsung_s3c2443()
+#else
+# define soc_is_s3c2443()	0
+#endif
+
 #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
 # define soc_is_s3c64xx()	(is_samsung_s3c6400() || is_samsung_s3c6410())
 #else
Signature · 1 line
1.7.2.5
#1 lore raw

PATCH 2/2 ARM: S3C2443: Workaround for 2443 EXTINT error

S3C2443 CPU has a problem with incorrect reading from EXTINTn registers. So s3c_irqext_type function wrongly modifies them. So add special check to s3c_irqext_type, to handle this case.

---
 arch/arm/plat-s3c24xx/irq.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
arch/arm/plat-s3c24xx/irq.c +26 -0
index fe57bbb..ed19996 100644
@@ -219,6 +219,32 @@ s3c_irqext_type(struct irq_data *data, unsigned int type)
 	}
 
 	value = __raw_readl(extint_reg);
+
+	/*
+	* S3C2443 CPU has a problem with EXTINTn registers.
+	* Essentially register-reads returned transformed data, but the write 
+	* is done according to the datasheet.
+	*
+	* There is hack introduced for 2443 error workaround.
+	*
+	* For detais refer to the document "S3C2443 GUIDE TO EXTRA GPIO" found on the web.
+	*
+	* A. Varnin <[email protected]>
+	*/
+	if(soc_is_s3c2443()) 
+	{
+	    	int i;
+		int fixed = 0;
+		if(extint_reg == S3C24XX_EXTINT1 || extint_reg == S3C24XX_EXTINT2)
+			for(i=0; i<7;i++)
+		    		fixed |= (((value >> ((7-i)*4+1)) & 7) | ((value >> ((7-i)*4-3)) & 8)) << i*4;
+		else
+			for(i=0; i<7;i++)
+		    		fixed |= ( (value >> (7-i)*4) & 0xf )  << i*4;
+		fixed |= (((value>>1) & 7) | ((value<<3) & 8)) << 27;
+		value = fixed;
+	}
+
 	value = (value & ~(7 << extint_offset)) | (newvalue << extint_offset);
 	__raw_writel(value, extint_reg);
 
Signature · 1 line
1.7.2.5
#2 lore raw

Re: [PATCH 2/2] ARM: S3C2443: Workaround for 2443 EXTINT error

Hi Alexander,

I think this patch needs a bit more love :-) .

Please run scripts/checkpatch.pl on it and fix all the reported problems.

And I'd change the comment to something like:

/*
* S3C2443 CPU has a problem with EXTINTn registers.
* Essentially register-reads return transformed data, but the write
* is done according to the datasheet.
*
* Fix this by transforming the read data to the correct format. *
* For details refer to the document "S3C2443 GUIDE TO EXTRA GPIO" */

Especially the mail address does not need to be in the code - the git history preserves the committer identity quite well.

Heiko

Am Montag, 26. November 2012, 09:44:41 schrieb Alexander Varnin:

Quoted 27 lines

S3C2443 CPU has a problem with incorrect reading from EXTINTn registers. So s3c_irqext_type function wrongly modifies them. So add special check to s3c_irqext_type, to handle this case.

---
 arch/arm/plat-s3c24xx/irq.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
arch/arm/plat-s3c24xx/irq.c +9 -0
index fe57bbb..ed19996 100644
@@ -219,6 +219,32 @@ s3c_irqext_type(struct irq_data *data, unsigned int
 type) }
 
 	value = __raw_readl(extint_reg);
+
+	/*
+	* S3C2443 CPU has a problem with EXTINTn registers.
+	* Essentially register-reads returned transformed data, but the write
+	* is done according to the datasheet.
+	*
+	* There is hack introduced for 2443 error workaround.
+	*
+	* For detais refer to the document "S3C2443 GUIDE TO EXTRA GPIO" found on

the web. + *

arch/arm/plat-s3c24xx/irq.c s3c_irqext_type(struct irq_data *data, unsigned int type)

Quoted 10 lines
arch/arm/plat-s3c24xx/irq.c +9 -0
+	* A. Varnin <[email protected]>
+	*/
 
+	if(soc_is_s3c2443())
+	{
+	    	int i;
+		int fixed = 0;
+		if(extint_reg == S3C24XX_EXTINT1 || extint_reg == S3C24XX_EXTINT2)
+			for(i=0; i<7;i++)
+		    		fixed |= (((value >> ((7-i)*4+1)) & 7) | ((value >> ((7-

i)*4-3)) &

Quoted 9 lines

8)) << i*4; + else

arch/arm/plat-s3c24xx/irq.c +6 -0
+			for(i=0; i<7;i++)
+		    		fixed |= ( (value >> (7-i)*4) & 0xf )  << i*4;
+		fixed |= (((value>>1) & 7) | ((value<<3) & 8)) << 27;
+		value = fixed;
+	}
+
 	value = (value & ~(7 << extint_offset)) | (newvalue << extint_offset);
 	__raw_writel(value, extint_reg);
#3 lore raw

Re: [PATCH 2/2] ARM: S3C2443: Workaround for 2443 EXTINT error

Is it ok, to send only one last patch after changes, without the one, who make macro?

26.11.2012 13:12, Heiko Stübner пишет:

Quoted 71 lines

Hi Alexander,

I think this patch needs a bit more love :-) .

Please run scripts/checkpatch.pl on it and fix all the reported problems.

And I'd change the comment to something like:

/*
* S3C2443 CPU has a problem with EXTINTn registers.
* Essentially register-reads return transformed data, but the write
* is done according to the datasheet.
*
* Fix this by transforming the read data to the correct format. *
* For details refer to the document "S3C2443 GUIDE TO EXTRA GPIO" */

Especially the mail address does not need to be in the code - the git history preserves the committer identity quite well.

Heiko

Am Montag, 26. November 2012, 09:44:41 schrieb Alexander Varnin:

Quoted 27 lines

S3C2443 CPU has a problem with incorrect reading from EXTINTn registers. So s3c_irqext_type function wrongly modifies them. So add special check to s3c_irqext_type, to handle this case.

---
  arch/arm/plat-s3c24xx/irq.c |   26 ++++++++++++++++++++++++++
  1 files changed, 26 insertions(+), 0 deletions(-)
arch/arm/plat-s3c24xx/irq.c +9 -0
index fe57bbb..ed19996 100644
@@ -219,6 +219,32 @@ s3c_irqext_type(struct irq_data *data, unsigned int
 type) }
 
  	value = __raw_readl(extint_reg);
+
+	/*
+	* S3C2443 CPU has a problem with EXTINTn registers.
+	* Essentially register-reads returned transformed data, but the write
+	* is done according to the datasheet.
+	*
+	* There is hack introduced for 2443 error workaround.
+	*
+	* For detais refer to the document "S3C2443 GUIDE TO EXTRA GPIO" found on

the web. + *

arch/arm/plat-s3c24xx/irq.c s3c_irqext_type(struct irq_data *data, unsigned int type)

Quoted 9 lines
arch/arm/plat-s3c24xx/irq.c +9 -0
+	* A. Varnin <[email protected]>
+	*/
+	if(soc_is_s3c2443())
+	{
+	    	int i;
+		int fixed = 0;
+		if(extint_reg == S3C24XX_EXTINT1 || extint_reg == S3C24XX_EXTINT2)
+			for(i=0; i<7;i++)
+		    		fixed |= (((value >> ((7-i)*4+1)) & 7) | ((value >> ((7-

i)*4-3)) &

Quoted 9 lines

8)) << i*4; + else

arch/arm/plat-s3c24xx/irq.c +6 -0
+			for(i=0; i<7;i++)
+		    		fixed |= ( (value >> (7-i)*4) & 0xf )  << i*4;
+		fixed |= (((value>>1) & 7) | ((value<<3) & 8)) << 27;
+		value = fixed;
+	}
+
  	value = (value & ~(7 << extint_offset)) | (newvalue << extint_offset);
  	__raw_writel(value, extint_reg);
#4 lore raw

Re: [PATCH 2/2] ARM: S3C2443: Workaround for 2443 EXTINT error

Am Montag, 26. November 2012, 10:23:17 schrieb Alexander Varnin:

Quoted 2 lines

Is it ok, to send only one last patch after changes, without the one, who make macro?

I'd think so, as this series isn't this big. Just include a version into the patch subject, i.e.

	[PATCH v2 2/2] ARM: S3C2443: Workaround for 2443 EXTINT error

to denote the most recent version and include a short summary of the changes _after_ the "---" of the main commit message.

Quoted 46 lines

26.11.2012 13:12, Heiko Stübner пишет:

Quoted 45 lines

Hi Alexander,

I think this patch needs a bit more love :-) .

Please run scripts/checkpatch.pl on it and fix all the reported problems.

And I'd change the comment to something like:

/*

* S3C2443 CPU has a problem with EXTINTn registers.
* Essentially register-reads return transformed data, but the write
* is done according to the datasheet.
*
* Fix this by transforming the read data to the correct format. *
* For details refer to the document "S3C2443 GUIDE TO EXTRA GPIO" */

Especially the mail address does not need to be in the code - the git history preserves the committer identity quite well.

Heiko

Am Montag, 26. November 2012, 09:44:41 schrieb Alexander Varnin:

Quoted 19 lines

S3C2443 CPU has a problem with incorrect reading from EXTINTn registers. So s3c_irqext_type function wrongly modifies them. So add special check to s3c_irqext_type, to handle this case.

---

  arch/arm/plat-s3c24xx/irq.c |   26 ++++++++++++++++++++++++++
  1 files changed, 26 insertions(+), 0 deletions(-)
arch/arm/plat-s3c24xx/irq.c +0 -0
index fe57bbb..ed19996 100644
@@ -219,6 +219,32 @@ s3c_irqext_type(struct irq_data *data, unsigned int
 type) }
 
  	value = __raw_readl(extint_reg);
 
Quoted 9 lines
Quoted 9 lines

arch/arm/plat-s3c24xx/irq.c s3c_irqext_type(struct irq_data *data, unsigned int type)

Quoted 9 lines
arch/arm/plat-s3c24xx/irq.c +9 -0
+
+	/*
+	* S3C2443 CPU has a problem with EXTINTn registers.
+	* Essentially register-reads returned transformed data, but the write
+	* is done according to the datasheet.
+	*
+	* There is hack introduced for 2443 error workaround.
+	*
+	* For detais refer to the document "S3C2443 GUIDE TO EXTRA GPIO" 

found

Quoted 8 lines
Quoted 8 lines

arch/arm/plat-s3c24xx/irq.c s3c_irqext_type(struct irq_data *data, unsigned int type)

Quoted 8 lines

on the web. + *

arch/arm/plat-s3c24xx/irq.c +7 -0
+	* A. Varnin <[email protected]>
+	*/
+	if(soc_is_s3c2443())
+	{
+	    	int i;
+		int fixed = 0;
+		if(extint_reg == S3C24XX_EXTINT1 || extint_reg == 

S3C24XX_EXTINT2)

Quoted 15 lines
Quoted 15 lines

arch/arm/plat-s3c24xx/irq.c

Quoted 2 lines
arch/arm/plat-s3c24xx/irq.c +2 -0
+			for(i=0; i<7;i++)
+		    		fixed |= (((value >> ((7-i)*4+1)) & 7) | ((value >> ((7-

i)*4-3)) &

Quoted 10 lines

8)) << i*4; + else

arch/arm/plat-s3c24xx/irq.c +6 -0
+			for(i=0; i<7;i++)
+		    		fixed |= ( (value >> (7-i)*4) & 0xf )  << i*4;
+		fixed |= (((value>>1) & 7) | ((value<<3) & 8)) << 27;
+		value = fixed;
+	}
+
 
  	value = (value & ~(7 << extint_offset)) | (newvalue <<
  	extint_offset); __raw_writel(value, extint_reg);