18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * linux/arch/sh/boards/se/770x/irq.c 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2000 Kazumoto Kojima 68c2ecf20Sopenharmony_ci * Copyright (C) 2006 Nobuhiro Iwamatsu 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Hitachi SolutionEngine Support. 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci */ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <linux/init.h> 138c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 148c2ecf20Sopenharmony_ci#include <linux/irq.h> 158c2ecf20Sopenharmony_ci#include <asm/irq.h> 168c2ecf20Sopenharmony_ci#include <asm/io.h> 178c2ecf20Sopenharmony_ci#include <mach-se/mach/se.h> 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_cistatic struct ipr_data ipr_irq_table[] = { 208c2ecf20Sopenharmony_ci /* 218c2ecf20Sopenharmony_ci * Super I/O (Just mimic PC): 228c2ecf20Sopenharmony_ci * 1: keyboard 238c2ecf20Sopenharmony_ci * 3: serial 0 248c2ecf20Sopenharmony_ci * 4: serial 1 258c2ecf20Sopenharmony_ci * 5: printer 268c2ecf20Sopenharmony_ci * 6: floppy 278c2ecf20Sopenharmony_ci * 8: rtc 288c2ecf20Sopenharmony_ci * 12: mouse 298c2ecf20Sopenharmony_ci * 14: ide0 308c2ecf20Sopenharmony_ci */ 318c2ecf20Sopenharmony_ci#if defined(CONFIG_CPU_SUBTYPE_SH7705) 328c2ecf20Sopenharmony_ci /* This is default value */ 338c2ecf20Sopenharmony_ci { 13, 0, 8, 0x0f-13, }, 348c2ecf20Sopenharmony_ci { 5 , 0, 4, 0x0f- 5, }, 358c2ecf20Sopenharmony_ci { 10, 1, 0, 0x0f-10, }, 368c2ecf20Sopenharmony_ci { 7 , 2, 4, 0x0f- 7, }, 378c2ecf20Sopenharmony_ci { 3 , 2, 0, 0x0f- 3, }, 388c2ecf20Sopenharmony_ci { 1 , 3, 12, 0x0f- 1, }, 398c2ecf20Sopenharmony_ci { 12, 3, 4, 0x0f-12, }, /* LAN */ 408c2ecf20Sopenharmony_ci { 2 , 4, 8, 0x0f- 2, }, /* PCIRQ2 */ 418c2ecf20Sopenharmony_ci { 6 , 4, 4, 0x0f- 6, }, /* PCIRQ1 */ 428c2ecf20Sopenharmony_ci { 14, 4, 0, 0x0f-14, }, /* PCIRQ0 */ 438c2ecf20Sopenharmony_ci { 0 , 5, 12, 0x0f , }, 448c2ecf20Sopenharmony_ci { 4 , 5, 4, 0x0f- 4, }, 458c2ecf20Sopenharmony_ci { 8 , 6, 12, 0x0f- 8, }, 468c2ecf20Sopenharmony_ci { 9 , 6, 8, 0x0f- 9, }, 478c2ecf20Sopenharmony_ci { 11, 6, 4, 0x0f-11, }, 488c2ecf20Sopenharmony_ci#else 498c2ecf20Sopenharmony_ci { 14, 0, 8, 0x0f-14, }, 508c2ecf20Sopenharmony_ci { 12, 0, 4, 0x0f-12, }, 518c2ecf20Sopenharmony_ci { 8, 1, 4, 0x0f- 8, }, 528c2ecf20Sopenharmony_ci { 6, 2, 12, 0x0f- 6, }, 538c2ecf20Sopenharmony_ci { 5, 2, 8, 0x0f- 5, }, 548c2ecf20Sopenharmony_ci { 4, 2, 4, 0x0f- 4, }, 558c2ecf20Sopenharmony_ci { 3, 2, 0, 0x0f- 3, }, 568c2ecf20Sopenharmony_ci { 1, 3, 12, 0x0f- 1, }, 578c2ecf20Sopenharmony_ci#if defined(CONFIG_STNIC) 588c2ecf20Sopenharmony_ci /* ST NIC */ 598c2ecf20Sopenharmony_ci { 10, 3, 4, 0x0f-10, }, /* LAN */ 608c2ecf20Sopenharmony_ci#endif 618c2ecf20Sopenharmony_ci /* MRSHPC IRQs setting */ 628c2ecf20Sopenharmony_ci { 0, 4, 12, 0x0f- 0, }, /* PCIRQ3 */ 638c2ecf20Sopenharmony_ci { 11, 4, 8, 0x0f-11, }, /* PCIRQ2 */ 648c2ecf20Sopenharmony_ci { 9, 4, 4, 0x0f- 9, }, /* PCIRQ1 */ 658c2ecf20Sopenharmony_ci { 7, 4, 0, 0x0f- 7, }, /* PCIRQ0 */ 668c2ecf20Sopenharmony_ci /* #2, #13 are allocated for SLOT IRQ #1 and #2 (for now) */ 678c2ecf20Sopenharmony_ci /* NOTE: #2 and #13 are not used on PC */ 688c2ecf20Sopenharmony_ci { 13, 6, 4, 0x0f-13, }, /* SLOTIRQ2 */ 698c2ecf20Sopenharmony_ci { 2, 6, 0, 0x0f- 2, }, /* SLOTIRQ1 */ 708c2ecf20Sopenharmony_ci#endif 718c2ecf20Sopenharmony_ci}; 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_cistatic unsigned long ipr_offsets[] = { 748c2ecf20Sopenharmony_ci BCR_ILCRA, 758c2ecf20Sopenharmony_ci BCR_ILCRB, 768c2ecf20Sopenharmony_ci BCR_ILCRC, 778c2ecf20Sopenharmony_ci BCR_ILCRD, 788c2ecf20Sopenharmony_ci BCR_ILCRE, 798c2ecf20Sopenharmony_ci BCR_ILCRF, 808c2ecf20Sopenharmony_ci BCR_ILCRG, 818c2ecf20Sopenharmony_ci}; 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_cistatic struct ipr_desc ipr_irq_desc = { 848c2ecf20Sopenharmony_ci .ipr_offsets = ipr_offsets, 858c2ecf20Sopenharmony_ci .nr_offsets = ARRAY_SIZE(ipr_offsets), 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci .ipr_data = ipr_irq_table, 888c2ecf20Sopenharmony_ci .nr_irqs = ARRAY_SIZE(ipr_irq_table), 898c2ecf20Sopenharmony_ci .chip = { 908c2ecf20Sopenharmony_ci .name = "IPR-se770x", 918c2ecf20Sopenharmony_ci }, 928c2ecf20Sopenharmony_ci}; 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci/* 958c2ecf20Sopenharmony_ci * Initialize IRQ setting 968c2ecf20Sopenharmony_ci */ 978c2ecf20Sopenharmony_civoid __init init_se_IRQ(void) 988c2ecf20Sopenharmony_ci{ 998c2ecf20Sopenharmony_ci /* Disable all interrupts */ 1008c2ecf20Sopenharmony_ci __raw_writew(0, BCR_ILCRA); 1018c2ecf20Sopenharmony_ci __raw_writew(0, BCR_ILCRB); 1028c2ecf20Sopenharmony_ci __raw_writew(0, BCR_ILCRC); 1038c2ecf20Sopenharmony_ci __raw_writew(0, BCR_ILCRD); 1048c2ecf20Sopenharmony_ci __raw_writew(0, BCR_ILCRE); 1058c2ecf20Sopenharmony_ci __raw_writew(0, BCR_ILCRF); 1068c2ecf20Sopenharmony_ci __raw_writew(0, BCR_ILCRG); 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci register_ipr_controller(&ipr_irq_desc); 1098c2ecf20Sopenharmony_ci} 110