1/* 2 * linux/arch/sh/boards/renesas/systemh/irq.c 3 * 4 * Copyright (C) 2000 Kazumoto Kojima 5 * 6 * Hitachi SystemH Support. 7 * 8 * Modified for 7751 SystemH by 9 * Jonathan Short. 10 */ 11 12#include <linux/init.h> 13#include <linux/irq.h> 14#include <linux/interrupt.h> 15#include <linux/io.h> 16 17#include <mach/systemh7751.h> 18#include <asm/smc37c93x.h> 19 20static unsigned long *systemh_irq_mask_register = (unsigned long *)0xB3F10004; 21static unsigned long *systemh_irq_request_register = (unsigned long *)0xB3F10000; 22 23/* forward declaration */ 24static void enable_systemh_irq(unsigned int irq); 25static void disable_systemh_irq(unsigned int irq); 26static void mask_and_ack_systemh(unsigned int); 27 28static struct irq_chip systemh_irq_type = { 29 .name = " SystemH Register", 30 .unmask = enable_systemh_irq, 31 .mask = disable_systemh_irq, 32 .ack = mask_and_ack_systemh, 33}; 34 35static void disable_systemh_irq(unsigned int irq) 36{ 37 if (systemh_irq_mask_register) { 38 unsigned long val, mask = 0x01 << 1; 39 40 /* Clear the "irq"th bit in the mask and set it in the request */ 41 val = __raw_readl((unsigned long)systemh_irq_mask_register); 42 val &= ~mask; 43 __raw_writel(val, (unsigned long)systemh_irq_mask_register); 44 45 val = __raw_readl((unsigned long)systemh_irq_request_register); 46 val |= mask; 47 __raw_writel(val, (unsigned long)systemh_irq_request_register); 48 } 49} 50 51static void enable_systemh_irq(unsigned int irq) 52{ 53 if (systemh_irq_mask_register) { 54 unsigned long val, mask = 0x01 << 1; 55 56 /* Set "irq"th bit in the mask register */ 57 val = __raw_readl((unsigned long)systemh_irq_mask_register); 58 val |= mask; 59 __raw_writel(val, (unsigned long)systemh_irq_mask_register); 60 } 61} 62 63static void mask_and_ack_systemh(unsigned int irq) 64{ 65 disable_systemh_irq(irq); 66} 67 68void make_systemh_irq(unsigned int irq) 69{ 70 disable_irq_nosync(irq); 71 set_irq_chip_and_handler(irq, &systemh_irq_type, handle_level_irq); 72 disable_systemh_irq(irq); 73} 74