1eed0eabdSPaul Burton /* 2eed0eabdSPaul Burton * Copyright (C) 2016 Imagination Technologies 3eed0eabdSPaul Burton * Author: Paul Burton <paul.burton@imgtec.com> 4eed0eabdSPaul Burton * 5eed0eabdSPaul Burton * This program is free software; you can redistribute it and/or modify it 6eed0eabdSPaul Burton * under the terms of the GNU General Public License as published by the 7eed0eabdSPaul Burton * Free Software Foundation; either version 2 of the License, or (at your 8eed0eabdSPaul Burton * option) any later version. 9eed0eabdSPaul Burton */ 10eed0eabdSPaul Burton 11eed0eabdSPaul Burton #include <linux/clk.h> 12eed0eabdSPaul Burton #include <linux/clk-provider.h> 13eed0eabdSPaul Burton #include <linux/clocksource.h> 14eed0eabdSPaul Burton #include <linux/init.h> 15eed0eabdSPaul Burton #include <linux/irqchip/mips-gic.h> 16eed0eabdSPaul Burton #include <linux/types.h> 17eed0eabdSPaul Burton 18eed0eabdSPaul Burton #include <asm/irq.h> 19*72eb2995SPaul Burton #include <asm/mips-cps.h> 202904cdbaSPaul Burton #include <asm/time.h> 21eed0eabdSPaul Burton 22eed0eabdSPaul Burton int get_c0_fdc_int(void) 23eed0eabdSPaul Burton { 24eed0eabdSPaul Burton int mips_cpu_fdc_irq; 25eed0eabdSPaul Burton 26eed0eabdSPaul Burton if (cpu_has_veic) 27eed0eabdSPaul Burton panic("Unimplemented!"); 28*72eb2995SPaul Burton else if (mips_gic_present()) 29eed0eabdSPaul Burton mips_cpu_fdc_irq = gic_get_c0_fdc_int(); 30eed0eabdSPaul Burton else if (cp0_fdc_irq >= 0) 31eed0eabdSPaul Burton mips_cpu_fdc_irq = MIPS_CPU_IRQ_BASE + cp0_fdc_irq; 32eed0eabdSPaul Burton else 33eed0eabdSPaul Burton mips_cpu_fdc_irq = -1; 34eed0eabdSPaul Burton 35eed0eabdSPaul Burton return mips_cpu_fdc_irq; 36eed0eabdSPaul Burton } 37eed0eabdSPaul Burton 38eed0eabdSPaul Burton int get_c0_perfcount_int(void) 39eed0eabdSPaul Burton { 40eed0eabdSPaul Burton int mips_cpu_perf_irq; 41eed0eabdSPaul Burton 42eed0eabdSPaul Burton if (cpu_has_veic) 43eed0eabdSPaul Burton panic("Unimplemented!"); 44*72eb2995SPaul Burton else if (mips_gic_present()) 45eed0eabdSPaul Burton mips_cpu_perf_irq = gic_get_c0_perfcount_int(); 46eed0eabdSPaul Burton else if (cp0_perfcount_irq >= 0) 47eed0eabdSPaul Burton mips_cpu_perf_irq = MIPS_CPU_IRQ_BASE + cp0_perfcount_irq; 48eed0eabdSPaul Burton else 49eed0eabdSPaul Burton mips_cpu_perf_irq = -1; 50eed0eabdSPaul Burton 51eed0eabdSPaul Burton return mips_cpu_perf_irq; 52eed0eabdSPaul Burton } 53eed0eabdSPaul Burton 54eed0eabdSPaul Burton unsigned int get_c0_compare_int(void) 55eed0eabdSPaul Burton { 56eed0eabdSPaul Burton int mips_cpu_timer_irq; 57eed0eabdSPaul Burton 58eed0eabdSPaul Burton if (cpu_has_veic) 59eed0eabdSPaul Burton panic("Unimplemented!"); 60*72eb2995SPaul Burton else if (mips_gic_present()) 61eed0eabdSPaul Burton mips_cpu_timer_irq = gic_get_c0_compare_int(); 62eed0eabdSPaul Burton else 63eed0eabdSPaul Burton mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq; 64eed0eabdSPaul Burton 65eed0eabdSPaul Burton return mips_cpu_timer_irq; 66eed0eabdSPaul Burton } 67