external interrupt on GPIO causing malfunction hardware

miniarm
@Davef,

I am using mini2440 board with GPIO available on Camera Interface and CON4.
 My hardware is connected with those GPIO, my Application handle the
hardware using GPIO. now the problem is sometime the Hardware is doing
malfunction, however I am sending right data on GPIO, but still sometime it
is doing malfunctioning. So I guess some external interrupt appear on GPIO,
hence hardware is doing malfunction.

I also explore mini2440 schematics diagram and found GPF are connected with
EXT INT, and some external interrupt are sending data to those port, so my
hardware is doing malfunctioning.

Can you please tell me is there any external interrupt handled by GPF port?
How can i find which interrupts are interrupting GPIO, so that I can design
my hardware according? 

Is there any way to disable interrupt which appear on GPIO port?

Please let me know the solution.

Look forward to hear from you soon.

regards,
miniarm

davef
minarm,

I know nothing about using interrupts on this platform.  Now, for the
ATmega series I might be able to help.

Good luck!

miniarm
@davef,

Please let me know the steps to take to reduce the interrupt. You are
saying there is nothing like interrupt, but some other interrupt are
causing my hardware to do malfunction.

Look forward to hear from you soon.

davef
There are many interrupts.

For the 8bit AVR series there is an ASM instruction to disable all
interrupts. It is the cli instruction.

No idea of how it is done on the ARM.  OK, I had a look in the datasheet
and on page 14-11 they talk about the INTMSK value.  Maybe, try setting
that to 0xFFFFFFFF

For an interrupt to be generated I would expect that you would have to
explicitly enable that interrupt.  In other words, I would expect all
interrupts to be disabled on boot-up UNLESS you actual enabled them.

miniarm
@davef,

Thanks for the prompt reply. How can I disable interrupt at bootup and
reenable when needed, For ethernet I can disable ethernet by 'ifconfig eth0
down', but how to do it for GPIO.

One more thing, how can I set INTMASK value as per you're saying. Where I
have to set the value? in kernel, in program ?

I am using C program to set GPIO using kernel module.

miniarm
Also How to disable interrupt for CON20 - GPJ port and CON4 where Pins are
defined as EINT0-19, I guess those pins are use for external interrupt. 

I have attached my hardware to CON4 port, it looks like External interrupt
on those pin are causing malfunction.

miniarm
@davef,

I explored the code and found


  unsigned long eintpnd = __raw_readl(S3C24XX_EINTPEND);
        unsigned long eintmsk = __raw_readl(S3C24XX_EINTMASK);

        eintpnd &= ~eintmsk;
        eintpnd &= ~0xff;       /* ignore lower irqs */

        /* we may as well handle all the pending IRQs here */

        while (eintpnd) {
                irq = __ffs(eintpnd);
                eintpnd &= ~(1<<irq);

                irq += (IRQ_EINT4 - 4);
                generic_handle_irq(irq);


in irq.c, Do i need to change eintmsk value in irq.c file.

davef
> In other words, I would expect all interrupts to be disabled
> on boot-up UNLESS you actual enabled them.

Does the datasheet say anywhere that interrupts are always enabled during
and/or after boot-up and that you have to deliberately disable them?

I would be really surprised that any interrupt sources were enabled during
or after bootup, unless you or some driver enables them.

Unless someone can tell me I am wrong then trying to disable interrupts on
those pins could be a waste of time, in the sense that it won't solve your
problem.

Those EINTx pins can be used for external interrupts but I believe that you
have to set them up to perform that function.

I haven't used interrupts on this device so maybe you need to find someone
with real hands-on experience.

Did you do a good search of the site?  I do not recall many interrupt
related threads.

Good luck!

Dave Festing
Sorry, I didn't notice that you got in before my last post.

__raw_readl(S3C24XX_EINTMASK) what is this value set to on boot-up?


eintpnd &= ~0xff;       /* ignore lower irqs */

are your interrupts in the "lower irqs"?


Who calls irq.c (irq.o) during boot-up? The kernel?


0xFF would be ignoring most of the interrupts if 0xFFFFFFFF masks all of
them.

There are 10 pages on interrupts on the site.

Think I have a bit to learn here!

Dave McLaughlin
Thinking about what you 2 are looking at. miniarm indicates that this is
the camera interface port. Now, I may be wrong on this but there is a good
chance that the OS is indeed configuring this IO for a camera and I would
assume that transfers from the camera will enable interrupts as that is the
most likely transfer method for the image data to be transmitted.

If this is the case, you need to make calls to the OS to disable the
interrupts but you also need to be sure that the OS is not going to be
doing camera stuff in the background. Most likely the initial interrupt
setup will be in the bootup so it should be possible for your own code to
disable these during your initialisation.

Have you tried to disable only the interrupt that goes to that port?

Dave...

miniarm
But how to disable interrupt on CON20 and CON4. Lets say I am using CON4 as
GPIO, how to disable interrupt on CON4 only.

do i need to set value 0xfffffff in irq.c file to variable?

let me know.

Juergen Beisert
To make use of interrupts at the GPIO lines, these interrupts must be
enabled (on a per GPIO pin base). As long they are not enabled, *no*
interrupt will occur.
To get an idea which interrupts (and maybe GPIOs) are in use, just read the
file "/proc/interrupts". There is no direct mapping between interrupt
numbers and GPIO numbers, but you can send me the file's content and I will
take a look.
In recent kernels you can also read a file from the debugfs to see what
GPIO pins are in use (direction, value, driver who uses it and so on).

miniarm
@Juergen,

I am using CON4 GPF and GPE port, If i see entries in /proc/interrupt, 
there isn;t any description about GPIO.

As of now I am using linux 2.6.32.2 which ship with board. I am facing
problem of malfunction hardware which are connected with those GPIO.

Please let me know the solution for this problem, also let me know your
email id and I will share my code with you.

Juergen Beisert
Sorry, very hard to guess a solution for you. You could send more
information to my account jbe at pengutronix dot de.