Skip to contentSkip to conversation

ARM: S3C2443: Workaround for 2443 EXTINT error

PATCH Heiko Stübner 2 participants 4 messages Nov 24, 2012 Arm Samsung Exynos

lore
Share & tools
lore
#0 lore raw

sorry, forgot half of it [inline]

Am Freitag, 23. November 2012, 08:10:15 schrieb Alexander Varnin:

Quoted 4 lines

Please take a look at this document. It describes the problem with EXTINTn registers on 2443.
In fact, the irqext_set function for s3c2443 differs from common starting from "//Hack for 2443 error workaround" comment.

wow ... this is a crazy bug :-)

[...]

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
(quoted diff) +0 -0

b/arch/arm/mach-s3c24xx/s3c2443.c index ab648ad..99eef31 100644

arch/arm/mach-s3c24xx/s3c2443.c +0 -0

[...]

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-s3c24xx/s3c2443.c +4 -0
+#if defined(CONFIG_CPU_S3C2443)
+int
+s3c2443_irqext_type(struct irq_data *data, unsigned int type)
+{

[...]

Quoted 6 lines
Quoted 6 lines

arch/arm/mach-s3c24xx/s3c2443.c

Quoted 6 lines
arch/arm/mach-s3c24xx/s3c2443.c +6 -0
+	value = __raw_readl(extint_reg);
+	//Hack for 2443 error workaround
+	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 11 lines
Quoted 11 lines

arch/arm/mach-s3c24xx/s3c2443.c

Quoted 5 lines

& 8)) << i*4; + else

arch/arm/mach-s3c24xx/s3c2443.c +4 -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;

What does this do or what should it do? Also it gets calculated but never used?

And please use scripts/checkpatch.pl to verify your patch follows coding guidelines, as this block is especially hard to read.

So essentially register-reads somehow returned transformed data, but the write is done according to the datasheet.

It would definitely be better to integrate it into the existing _irqext_type function instead of introducing a second one.

The cpu_id is present in the samsung_cpu_id var and the list of cpus including the s3c2443 can be found in common.c. With this it would be possible to identify when the irq code is run on a s3c2443 machine and the original _irqext_type function could change the behaviour accordingly.

Not sure if it would make sense to introduce soc_is_s3c2443() etc macros for this.

And of course the actual block doing the transformation on read would need a more elaborate comment on the why and how, because in 3 years someone might not directly see what this does and why it was necessary.

Quoted 1 line
Quoted 1 line

arch/arm/mach-s3c24xx/s3c2443.c

Quoted 1 line
arch/arm/mach-s3c24xx/s3c2443.c +1 -0
+	value = (value & ~(7 << extint_offset)) | (newvalue << 

extint_offset);

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
arch/arm/mach-s3c24xx/s3c2443.c +5 -0
+	__raw_writel(value, extint_reg);
+
+	return 0;
+}
+#endif //defined(CONFIG_CPU_S3C2443)
 
  static struct irq_chip s3c_irqext_chip = {
 
  	.name		= "s3c-ext",
  	.irq_mask	= s3c_irqext_mask,
#1 lore raw

I've done it within another function, because otherwise users of other chips would pay for a one more runtime check, which they don't need. On the other hand, this function get called not so frequently, to make it valueable. The first version of my patch i've used internally worked as you said, so i can resend it.

I want to ask more experienced users of s3c2443. If this problem occures on all s3c2443 chips, or only with some series of it? Maybe we need some more checks, not to break working cases.

24.11.2012 04:16, Heiko Stübner пишет:

Quoted 24 lines
Quoted 5 lines
Quoted 5 lines

What does this do or what should it do? Also it gets calculated but never used?

And please use scripts/checkpatch.pl to verify your patch follows coding guidelines, as this block is especially hard to read.

So essentially register-reads somehow returned transformed data, but the write is done according to the datasheet.

It would definitely be better to integrate it into the existing _irqext_type function instead of introducing a second one.

The cpu_id is present in the samsung_cpu_id var and the list of cpus including the s3c2443 can be found in common.c. With this it would be possible to identify when the irq code is run on a s3c2443 machine and the original _irqext_type function could change the behaviour accordingly.

Not sure if it would make sense to introduce soc_is_s3c2443() etc macros for this.

And of course the actual block doing the transformation on read would need a more elaborate comment on the why and how, because in 3 years someone might not directly see what this does and why it was necessary.

#2 lore raw

Am Samstag, 24. November 2012, 10:01:31 schrieb Alexander Varnin:

Quoted 5 lines

I've done it within another function, because otherwise users of other chips would pay for a one more runtime check, which they don't need. On the other hand, this function get called not so frequently, to make it valueable. The first version of my patch i've used internally worked as you said, so i can resend it.

that would be cool, because as you said, this function isn't called this often and adding another function here seems kinda counter-productive to all the consolidation effort.

Your could even do a

#ifdef CONFIG_CPU_S3C2443
if (samsung_cpu_id == ...)
the fix
#endif

so only people building multi-platform kernels will be affected.

Quoted 3 lines

I want to ask more experienced users of s3c2443. If this problem occures on all s3c2443 chips, or only with some series of it? Maybe we need some more checks, not to break working cases.

Finding other s3c2443 mainline-users seems kinda hard - you're the first one I see :-) . In all the things I did to the s3c2416 I tried to pull the s3c2443 along (blindly) most of the time, because both SoCs are so similar [0]. And during all the changes no-one ever complained or spoke up.

@Kgene do you have anybody near you, who can tell us if the problem of the swapped EXTINT bits is common to all s3c2443 SoCs or how to identify affected ones?

Heiko

[0] for example, you should be able to use the s3c2416 cpufreq driver also on the s3c2443, as the armdiv etc structure is the same.

Quoted 26 lines

24.11.2012 04:16, Heiko Stübner пишет:

Quoted 25 lines
Quoted 5 lines
Quoted 5 lines

What does this do or what should it do? Also it gets calculated but never used?

And please use scripts/checkpatch.pl to verify your patch follows coding guidelines, as this block is especially hard to read.

So essentially register-reads somehow returned transformed data, but the write is done according to the datasheet.

It would definitely be better to integrate it into the existing _irqext_type function instead of introducing a second one.

The cpu_id is present in the samsung_cpu_id var and the list of cpus including the s3c2443 can be found in common.c. With this it would be possible to identify when the irq code is run on a s3c2443 machine and the original _irqext_type function could change the behaviour accordingly.

Not sure if it would make sense to introduce soc_is_s3c2443() etc macros for this.

And of course the actual block doing the transformation on read would need a more elaborate comment on the why and how, because in 3 years someone might not directly see what this does and why it was necessary.

#3 lore raw

Am Samstag, 24. November 2012, 12:24:49 schrieb Heiko Stübner:

Quoted 11 lines

Am Samstag, 24. November 2012, 10:01:31 schrieb Alexander Varnin:

Quoted 5 lines

I've done it within another function, because otherwise users of other chips would pay for a one more runtime check, which they don't need. On the other hand, this function get called not so frequently, to make it valueable. The first version of my patch i've used internally worked as you said, so i can resend it.

that would be cool, because as you said, this function isn't called this often and adding another function here seems kinda counter-productive to all the consolidation effort.

Quoted 6 lines

Your could even do a

#ifdef CONFIG_CPU_S3C2443
if (samsung_cpu_id == ...)
the fix
#endif

or alternatively introduce a soc_is_s3c2443 macro (plat- samsung/include/plat/cpu.h) for the conditional, like the other Samsung SoCs have.

if (soc_is_s3c2443())
the fix

If done like the other SoCs, it would evaluate to 0, when CONFIG_CPU_S3C2443 is not set and otherwise check the cpu_id.

Quoted 48 lines

so only people building multi-platform kernels will be affected.

Quoted 3 lines

I want to ask more experienced users of s3c2443. If this problem occures on all s3c2443 chips, or only with some series of it? Maybe we need some more checks, not to break working cases.

Finding other s3c2443 mainline-users seems kinda hard - you're the first one I see :-) . In all the things I did to the s3c2416 I tried to pull the s3c2443 along (blindly) most of the time, because both SoCs are so similar [0]. And during all the changes no-one ever complained or spoke up.

@Kgene do you have anybody near you, who can tell us if the problem of the swapped EXTINT bits is common to all s3c2443 SoCs or how to identify affected ones?

Heiko

[0] for example, you should be able to use the s3c2416 cpufreq driver also on the s3c2443, as the armdiv etc structure is the same.

Quoted 26 lines

24.11.2012 04:16, Heiko Stübner пишет:

Quoted 25 lines
Quoted 5 lines
Quoted 5 lines

What does this do or what should it do? Also it gets calculated but never used?

And please use scripts/checkpatch.pl to verify your patch follows coding guidelines, as this block is especially hard to read.

So essentially register-reads somehow returned transformed data, but the write is done according to the datasheet.

It would definitely be better to integrate it into the existing _irqext_type function instead of introducing a second one.

The cpu_id is present in the samsung_cpu_id var and the list of cpus including the s3c2443 can be found in common.c. With this it would be possible to identify when the irq code is run on a s3c2443 machine and the original _irqext_type function could change the behaviour accordingly.

Not sure if it would make sense to introduce soc_is_s3c2443() etc macros for this.

And of course the actual block doing the transformation on read would need a more elaborate comment on the why and how, because in 3 years someone might not directly see what this does and why it was necessary.