18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * linux/arch/sh/boards/se/7780/irq.c 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2006,2007 Nobuhiro Iwamatsu 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Hitachi UL SolutionEngine 7780 Support. 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci#include <linux/init.h> 108c2ecf20Sopenharmony_ci#include <linux/irq.h> 118c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 128c2ecf20Sopenharmony_ci#include <linux/io.h> 138c2ecf20Sopenharmony_ci#include <mach-se/mach/se7780.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#define INTC_BASE 0xffd00000 168c2ecf20Sopenharmony_ci#define INTC_ICR1 (INTC_BASE+0x1c) 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci/* 198c2ecf20Sopenharmony_ci * Initialize IRQ setting 208c2ecf20Sopenharmony_ci */ 218c2ecf20Sopenharmony_civoid __init init_se7780_IRQ(void) 228c2ecf20Sopenharmony_ci{ 238c2ecf20Sopenharmony_ci /* enable all interrupt at FPGA */ 248c2ecf20Sopenharmony_ci __raw_writew(0, FPGA_INTMSK1); 258c2ecf20Sopenharmony_ci /* mask SM501 interrupt */ 268c2ecf20Sopenharmony_ci __raw_writew((__raw_readw(FPGA_INTMSK1) | 0x0002), FPGA_INTMSK1); 278c2ecf20Sopenharmony_ci /* enable all interrupt at FPGA */ 288c2ecf20Sopenharmony_ci __raw_writew(0, FPGA_INTMSK2); 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci /* set FPGA INTSEL register */ 318c2ecf20Sopenharmony_ci /* FPGA + 0x06 */ 328c2ecf20Sopenharmony_ci __raw_writew( ((IRQPIN_SM501 << IRQPOS_SM501) | 338c2ecf20Sopenharmony_ci (IRQPIN_SMC91CX << IRQPOS_SMC91CX)), FPGA_INTSEL1); 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci /* FPGA + 0x08 */ 368c2ecf20Sopenharmony_ci __raw_writew(((IRQPIN_EXTINT4 << IRQPOS_EXTINT4) | 378c2ecf20Sopenharmony_ci (IRQPIN_EXTINT3 << IRQPOS_EXTINT3) | 388c2ecf20Sopenharmony_ci (IRQPIN_EXTINT2 << IRQPOS_EXTINT2) | 398c2ecf20Sopenharmony_ci (IRQPIN_EXTINT1 << IRQPOS_EXTINT1)), FPGA_INTSEL2); 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci /* FPGA + 0x0A */ 428c2ecf20Sopenharmony_ci __raw_writew((IRQPIN_PCCPW << IRQPOS_PCCPW), FPGA_INTSEL3); 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci plat_irq_setup_pins(IRQ_MODE_IRQ); /* install handlers for IRQ0-7 */ 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci /* ICR1: detect low level(for 2ndcut) */ 478c2ecf20Sopenharmony_ci __raw_writel(0xAAAA0000, INTC_ICR1); 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci /* 508c2ecf20Sopenharmony_ci * FPGA PCISEL register initialize 518c2ecf20Sopenharmony_ci * 528c2ecf20Sopenharmony_ci * CPU || SLOT1 | SLOT2 | S-ATA | USB 538c2ecf20Sopenharmony_ci * ------------------------------------- 548c2ecf20Sopenharmony_ci * INTA || INTA | INTD | -- | INTB 558c2ecf20Sopenharmony_ci * ------------------------------------- 568c2ecf20Sopenharmony_ci * INTB || INTB | INTA | -- | INTC 578c2ecf20Sopenharmony_ci * ------------------------------------- 588c2ecf20Sopenharmony_ci * INTC || INTC | INTB | INTA | -- 598c2ecf20Sopenharmony_ci * ------------------------------------- 608c2ecf20Sopenharmony_ci * INTD || INTD | INTC | -- | INTA 618c2ecf20Sopenharmony_ci * ------------------------------------- 628c2ecf20Sopenharmony_ci */ 638c2ecf20Sopenharmony_ci __raw_writew(0x0013, FPGA_PCI_INTSEL1); 648c2ecf20Sopenharmony_ci __raw_writew(0xE402, FPGA_PCI_INTSEL2); 658c2ecf20Sopenharmony_ci} 66