1eed0eabdSPaul Burton /* 2eed0eabdSPaul Burton * Copyright (C) 2016 Imagination Technologies 3*fb615d61SPaul Burton * Author: Paul Burton <paul.burton@mips.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/types.h> 16eed0eabdSPaul Burton 17eed0eabdSPaul Burton #include <asm/irq.h> 1872eb2995SPaul Burton #include <asm/mips-cps.h> 192904cdbaSPaul Burton #include <asm/time.h> 20eed0eabdSPaul Burton 21eed0eabdSPaul Burton int get_c0_fdc_int(void) 22eed0eabdSPaul Burton { 23eed0eabdSPaul Burton int mips_cpu_fdc_irq; 24eed0eabdSPaul Burton 25eed0eabdSPaul Burton if (cpu_has_veic) 26eed0eabdSPaul Burton panic("Unimplemented!"); 2772eb2995SPaul Burton else if (mips_gic_present()) 28eed0eabdSPaul Burton mips_cpu_fdc_irq = gic_get_c0_fdc_int(); 29eed0eabdSPaul Burton else if (cp0_fdc_irq >= 0) 30eed0eabdSPaul Burton mips_cpu_fdc_irq = MIPS_CPU_IRQ_BASE + cp0_fdc_irq; 31eed0eabdSPaul Burton else 32eed0eabdSPaul Burton mips_cpu_fdc_irq = -1; 33eed0eabdSPaul Burton 34eed0eabdSPaul Burton return mips_cpu_fdc_irq; 35eed0eabdSPaul Burton } 36eed0eabdSPaul Burton 37eed0eabdSPaul Burton int get_c0_perfcount_int(void) 38eed0eabdSPaul Burton { 39eed0eabdSPaul Burton int mips_cpu_perf_irq; 40eed0eabdSPaul Burton 41eed0eabdSPaul Burton if (cpu_has_veic) 42eed0eabdSPaul Burton panic("Unimplemented!"); 4372eb2995SPaul Burton else if (mips_gic_present()) 44eed0eabdSPaul Burton mips_cpu_perf_irq = gic_get_c0_perfcount_int(); 45eed0eabdSPaul Burton else if (cp0_perfcount_irq >= 0) 46eed0eabdSPaul Burton mips_cpu_perf_irq = MIPS_CPU_IRQ_BASE + cp0_perfcount_irq; 47eed0eabdSPaul Burton else 48eed0eabdSPaul Burton mips_cpu_perf_irq = -1; 49eed0eabdSPaul Burton 50eed0eabdSPaul Burton return mips_cpu_perf_irq; 51eed0eabdSPaul Burton } 52eed0eabdSPaul Burton 53eed0eabdSPaul Burton unsigned int get_c0_compare_int(void) 54eed0eabdSPaul Burton { 55eed0eabdSPaul Burton int mips_cpu_timer_irq; 56eed0eabdSPaul Burton 57eed0eabdSPaul Burton if (cpu_has_veic) 58eed0eabdSPaul Burton panic("Unimplemented!"); 5972eb2995SPaul Burton else if (mips_gic_present()) 60eed0eabdSPaul Burton mips_cpu_timer_irq = gic_get_c0_compare_int(); 61eed0eabdSPaul Burton else 62eed0eabdSPaul Burton mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq; 63eed0eabdSPaul Burton 64eed0eabdSPaul Burton return mips_cpu_timer_irq; 65eed0eabdSPaul Burton } 66