irq.h 2.8 KB
Newer Older
1
/* linux/arch/arm/plat-samsung/include/plat/irq.h
2 3 4 5 6 7 8 9 10 11 12
 *
 * Copyright (c) 2004-2005 Simtec Electronics
 *	Ben Dooks <ben@simtec.co.uk>
 *
 * Header file for S3C24XX CPU IRQ support
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
*/

13 14 15 16 17 18
#include <linux/io.h>

#include <mach/hardware.h>
#include <mach/regs-irq.h>
#include <mach/regs-gpio.h>

19 20 21 22 23
#define irqdbf(x...)
#define irqdbf2(x...)

#define EXTINT_OFF (IRQ_EINT4 - 4)

24
/* these are exported for arch/arm/mach-* usage */
25
extern struct irq_chip s3c_irq_level_chip;
26
extern struct irq_chip s3c_irq_chip;
27

28 29 30
static inline void s3c_irqsub_mask(unsigned int irqno,
				   unsigned int parentbit,
				   int subcheck)
31 32 33 34 35 36 37 38 39 40 41
{
	unsigned long mask;
	unsigned long submask;

	submask = __raw_readl(S3C2410_INTSUBMSK);
	mask = __raw_readl(S3C2410_INTMSK);

	submask |= (1UL << (irqno - IRQ_S3CUART_RX0));

	/* check to see if we need to mask the parent IRQ */

42
	if ((submask  & subcheck) == subcheck)
43 44 45 46 47 48 49
		__raw_writel(mask | parentbit, S3C2410_INTMSK);

	/* write back masks */
	__raw_writel(submask, S3C2410_INTSUBMSK);

}

50 51
static inline void s3c_irqsub_unmask(unsigned int irqno,
				     unsigned int parentbit)
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
{
	unsigned long mask;
	unsigned long submask;

	submask = __raw_readl(S3C2410_INTSUBMSK);
	mask = __raw_readl(S3C2410_INTMSK);

	submask &= ~(1UL << (irqno - IRQ_S3CUART_RX0));
	mask &= ~parentbit;

	/* write back masks */
	__raw_writel(submask, S3C2410_INTSUBMSK);
	__raw_writel(mask, S3C2410_INTMSK);
}


68 69 70
static inline void s3c_irqsub_maskack(unsigned int irqno,
				      unsigned int parentmask,
				      unsigned int group)
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
{
	unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);

	s3c_irqsub_mask(irqno, parentmask, group);

	__raw_writel(bit, S3C2410_SUBSRCPND);

	/* only ack parent if we've got all the irqs (seems we must
	 * ack, all and hope that the irq system retriggers ok when
	 * the interrupt goes off again)
	 */

	if (1) {
		__raw_writel(parentmask, S3C2410_SRCPND);
		__raw_writel(parentmask, S3C2410_INTPND);
	}
}

89 90 91
static inline void s3c_irqsub_ack(unsigned int irqno,
				  unsigned int parentmask,
				  unsigned int group)
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
{
	unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);

	__raw_writel(bit, S3C2410_SUBSRCPND);

	/* only ack parent if we've got all the irqs (seems we must
	 * ack, all and hope that the irq system retriggers ok when
	 * the interrupt goes off again)
	 */

	if (1) {
		__raw_writel(parentmask, S3C2410_SRCPND);
		__raw_writel(parentmask, S3C2410_INTPND);
	}
}
107 108 109

/* exported for use in arch/arm/mach-s3c2410 */

110
#ifdef CONFIG_PM
111
extern int s3c_irq_wake(struct irq_data *data, unsigned int state);
112 113 114 115
#else
#define s3c_irq_wake NULL
#endif

116
extern int s3c_irqext_type(struct irq_data *d, unsigned int type);