162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * linux/arch/sh/boards/se/7780/irq.c 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2006,2007 Nobuhiro Iwamatsu 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Hitachi UL SolutionEngine 7780 Support. 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci#include <linux/init.h> 1062306a36Sopenharmony_ci#include <linux/irq.h> 1162306a36Sopenharmony_ci#include <linux/interrupt.h> 1262306a36Sopenharmony_ci#include <linux/io.h> 1362306a36Sopenharmony_ci#include <mach-se/mach/se7780.h> 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#define INTC_BASE 0xffd00000 1662306a36Sopenharmony_ci#define INTC_ICR1 (INTC_BASE+0x1c) 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci/* 1962306a36Sopenharmony_ci * Initialize IRQ setting 2062306a36Sopenharmony_ci */ 2162306a36Sopenharmony_civoid __init init_se7780_IRQ(void) 2262306a36Sopenharmony_ci{ 2362306a36Sopenharmony_ci /* enable all interrupt at FPGA */ 2462306a36Sopenharmony_ci __raw_writew(0, FPGA_INTMSK1); 2562306a36Sopenharmony_ci /* mask SM501 interrupt */ 2662306a36Sopenharmony_ci __raw_writew((__raw_readw(FPGA_INTMSK1) | 0x0002), FPGA_INTMSK1); 2762306a36Sopenharmony_ci /* enable all interrupt at FPGA */ 2862306a36Sopenharmony_ci __raw_writew(0, FPGA_INTMSK2); 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci /* set FPGA INTSEL register */ 3162306a36Sopenharmony_ci /* FPGA + 0x06 */ 3262306a36Sopenharmony_ci __raw_writew( ((IRQPIN_SM501 << IRQPOS_SM501) | 3362306a36Sopenharmony_ci (IRQPIN_SMC91CX << IRQPOS_SMC91CX)), FPGA_INTSEL1); 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci /* FPGA + 0x08 */ 3662306a36Sopenharmony_ci __raw_writew(((IRQPIN_EXTINT4 << IRQPOS_EXTINT4) | 3762306a36Sopenharmony_ci (IRQPIN_EXTINT3 << IRQPOS_EXTINT3) | 3862306a36Sopenharmony_ci (IRQPIN_EXTINT2 << IRQPOS_EXTINT2) | 3962306a36Sopenharmony_ci (IRQPIN_EXTINT1 << IRQPOS_EXTINT1)), FPGA_INTSEL2); 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci /* FPGA + 0x0A */ 4262306a36Sopenharmony_ci __raw_writew((IRQPIN_PCCPW << IRQPOS_PCCPW), FPGA_INTSEL3); 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci plat_irq_setup_pins(IRQ_MODE_IRQ); /* install handlers for IRQ0-7 */ 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci /* ICR1: detect low level(for 2ndcut) */ 4762306a36Sopenharmony_ci __raw_writel(0xAAAA0000, INTC_ICR1); 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci /* 5062306a36Sopenharmony_ci * FPGA PCISEL register initialize 5162306a36Sopenharmony_ci * 5262306a36Sopenharmony_ci * CPU || SLOT1 | SLOT2 | S-ATA | USB 5362306a36Sopenharmony_ci * ------------------------------------- 5462306a36Sopenharmony_ci * INTA || INTA | INTD | -- | INTB 5562306a36Sopenharmony_ci * ------------------------------------- 5662306a36Sopenharmony_ci * INTB || INTB | INTA | -- | INTC 5762306a36Sopenharmony_ci * ------------------------------------- 5862306a36Sopenharmony_ci * INTC || INTC | INTB | INTA | -- 5962306a36Sopenharmony_ci * ------------------------------------- 6062306a36Sopenharmony_ci * INTD || INTD | INTC | -- | INTA 6162306a36Sopenharmony_ci * ------------------------------------- 6262306a36Sopenharmony_ci */ 6362306a36Sopenharmony_ci __raw_writew(0x0013, FPGA_PCI_INTSEL1); 6462306a36Sopenharmony_ci __raw_writew(0xE402, FPGA_PCI_INTSEL2); 6562306a36Sopenharmony_ci} 66