2005-04-17 06:20:36 +08:00
|
|
|
#ifndef __ASM_SH_HW_IRQ_H
|
|
|
|
#define __ASM_SH_HW_IRQ_H
|
|
|
|
|
2007-07-18 16:25:09 +08:00
|
|
|
#include <linux/init.h>
|
2006-10-06 14:31:16 +08:00
|
|
|
#include <asm/atomic.h>
|
|
|
|
|
|
|
|
extern atomic_t irq_err_count;
|
|
|
|
|
2007-06-15 17:56:19 +08:00
|
|
|
struct ipr_data {
|
|
|
|
unsigned char irq;
|
|
|
|
unsigned char ipr_idx; /* Index for the IPR registered */
|
|
|
|
unsigned char shift; /* Number of bits to shift the data */
|
|
|
|
unsigned char priority; /* The priority */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ipr_desc {
|
|
|
|
unsigned long *ipr_offsets;
|
|
|
|
unsigned int nr_offsets;
|
|
|
|
struct ipr_data *ipr_data;
|
|
|
|
unsigned int nr_irqs;
|
|
|
|
struct irq_chip chip;
|
|
|
|
};
|
|
|
|
|
|
|
|
void register_ipr_controller(struct ipr_desc *);
|
|
|
|
|
2007-07-18 16:25:09 +08:00
|
|
|
typedef unsigned char intc_enum;
|
|
|
|
|
|
|
|
struct intc_vect {
|
|
|
|
intc_enum enum_id;
|
|
|
|
unsigned short vect;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define INTC_VECT(enum_id, vect) { enum_id, vect }
|
2007-08-03 13:25:32 +08:00
|
|
|
#define INTC_IRQ(enum_id, irq) INTC_VECT(enum_id, irq2evt(irq))
|
2007-07-18 16:25:09 +08:00
|
|
|
|
|
|
|
struct intc_group {
|
|
|
|
intc_enum enum_id;
|
2007-08-16 23:45:35 +08:00
|
|
|
intc_enum enum_ids[32];
|
2007-07-18 16:25:09 +08:00
|
|
|
};
|
|
|
|
|
2007-08-16 23:45:35 +08:00
|
|
|
#define INTC_GROUP(enum_id, ids...) { enum_id, { ids } }
|
2007-07-18 16:25:09 +08:00
|
|
|
|
|
|
|
struct intc_mask_reg {
|
|
|
|
unsigned long set_reg, clr_reg, reg_width;
|
|
|
|
intc_enum enum_ids[32];
|
2007-09-21 17:16:42 +08:00
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
unsigned long smp;
|
|
|
|
#endif
|
2007-07-18 16:25:09 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct intc_prio_reg {
|
2007-08-12 14:22:02 +08:00
|
|
|
unsigned long set_reg, clr_reg, reg_width, field_width;
|
2007-07-18 16:25:09 +08:00
|
|
|
intc_enum enum_ids[16];
|
2007-09-21 17:16:42 +08:00
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
unsigned long smp;
|
|
|
|
#endif
|
2007-07-18 16:25:09 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct intc_sense_reg {
|
|
|
|
unsigned long reg, reg_width, field_width;
|
|
|
|
intc_enum enum_ids[16];
|
|
|
|
};
|
|
|
|
|
2007-09-21 17:16:42 +08:00
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
#define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8)
|
|
|
|
#else
|
|
|
|
#define INTC_SMP(stride, nr)
|
|
|
|
#endif
|
|
|
|
|
2007-07-18 16:25:09 +08:00
|
|
|
struct intc_desc {
|
|
|
|
struct intc_vect *vectors;
|
|
|
|
unsigned int nr_vectors;
|
|
|
|
struct intc_group *groups;
|
|
|
|
unsigned int nr_groups;
|
|
|
|
struct intc_mask_reg *mask_regs;
|
|
|
|
unsigned int nr_mask_regs;
|
|
|
|
struct intc_prio_reg *prio_regs;
|
|
|
|
unsigned int nr_prio_regs;
|
|
|
|
struct intc_sense_reg *sense_regs;
|
|
|
|
unsigned int nr_sense_regs;
|
2007-08-12 14:26:12 +08:00
|
|
|
char *name;
|
2008-04-24 20:36:34 +08:00
|
|
|
#ifdef CONFIG_CPU_SH3
|
|
|
|
struct intc_mask_reg *ack_regs;
|
|
|
|
unsigned int nr_ack_regs;
|
|
|
|
#endif
|
2007-07-18 16:25:09 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a)
|
|
|
|
#define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \
|
2008-01-10 13:08:55 +08:00
|
|
|
mask_regs, prio_regs, sense_regs) \
|
2007-08-16 23:45:35 +08:00
|
|
|
struct intc_desc symbol __initdata = { \
|
2007-07-18 16:25:09 +08:00
|
|
|
_INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
|
|
|
|
_INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
|
|
|
|
_INTC_ARRAY(sense_regs), \
|
2007-08-12 14:26:12 +08:00
|
|
|
chipname, \
|
2007-07-18 16:25:09 +08:00
|
|
|
}
|
|
|
|
|
2008-04-24 20:36:34 +08:00
|
|
|
#ifdef CONFIG_CPU_SH3
|
|
|
|
#define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \
|
|
|
|
mask_regs, prio_regs, sense_regs, ack_regs) \
|
|
|
|
struct intc_desc symbol __initdata = { \
|
|
|
|
_INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
|
|
|
|
_INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
|
|
|
|
_INTC_ARRAY(sense_regs), \
|
|
|
|
chipname, \
|
|
|
|
_INTC_ARRAY(ack_regs), \
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-07-18 16:25:09 +08:00
|
|
|
void __init register_intc_controller(struct intc_desc *desc);
|
2007-08-16 23:50:44 +08:00
|
|
|
int intc_set_priority(unsigned int irq, unsigned int prio);
|
2007-07-18 16:25:09 +08:00
|
|
|
|
2007-07-18 16:57:34 +08:00
|
|
|
void __init plat_irq_setup(void);
|
2008-04-24 20:30:09 +08:00
|
|
|
#ifdef CONFIG_CPU_SH3
|
|
|
|
void __init plat_irq_setup_sh3(void);
|
|
|
|
#endif
|
2007-07-18 16:57:34 +08:00
|
|
|
|
2007-07-31 16:11:21 +08:00
|
|
|
enum { IRQ_MODE_IRQ, IRQ_MODE_IRQ7654, IRQ_MODE_IRQ3210,
|
2007-09-10 11:03:50 +08:00
|
|
|
IRQ_MODE_IRL7654_MASK, IRQ_MODE_IRL3210_MASK,
|
2007-07-31 16:11:21 +08:00
|
|
|
IRQ_MODE_IRL7654, IRQ_MODE_IRL3210 };
|
2007-07-20 11:10:29 +08:00
|
|
|
void __init plat_irq_setup_pins(int mode);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif /* __ASM_SH_HW_IRQ_H */
|