Skip to contentSkip to conversation

ARM: S3C2443: Workaround for 2443 EXTINT error

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

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

PATCH v2 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.

---
styling and comment fixes

 arch/arm/plat-s3c24xx/irq.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
arch/arm/plat-s3c24xx/irq.c +25 -0
index fe57bbb..b05c573 100644
@@ -219,6 +219,31 @@ 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 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"
+	 */
+	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
Acked-by on v2 2/2
#1 lore raw

Am Montag, 26. November 2012, 10:43:21 schrieb Alexander Varnin:

Quoted 5 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.

Quoted 40 lines

---
styling and comment fixes

 arch/arm/plat-s3c24xx/irq.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
arch/arm/plat-s3c24xx/irq.c +25 -0
index fe57bbb..b05c573 100644
@@ -219,6 +219,31 @@ 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 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"
+	 */
+	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);