|
@@ -138,101 +138,6 @@ static inline void gic_map_to_vpe(unsigned int intr, unsigned int vpe)
|
|
GIC_SH_MAP_TO_VPE_REG_BIT(vpe));
|
|
GIC_SH_MAP_TO_VPE_REG_BIT(vpe));
|
|
}
|
|
}
|
|
|
|
|
|
-#ifdef CONFIG_CLKSRC_MIPS_GIC
|
|
|
|
-u64 notrace gic_read_count(void)
|
|
|
|
-{
|
|
|
|
- unsigned int hi, hi2, lo;
|
|
|
|
-
|
|
|
|
- if (mips_cm_is64)
|
|
|
|
- return (u64)gic_read(GIC_REG(SHARED, GIC_SH_COUNTER));
|
|
|
|
-
|
|
|
|
- do {
|
|
|
|
- hi = gic_read32(GIC_REG(SHARED, GIC_SH_COUNTER_63_32));
|
|
|
|
- lo = gic_read32(GIC_REG(SHARED, GIC_SH_COUNTER_31_00));
|
|
|
|
- hi2 = gic_read32(GIC_REG(SHARED, GIC_SH_COUNTER_63_32));
|
|
|
|
- } while (hi2 != hi);
|
|
|
|
-
|
|
|
|
- return (((u64) hi) << 32) + lo;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-unsigned int gic_get_count_width(void)
|
|
|
|
-{
|
|
|
|
- unsigned int bits, config;
|
|
|
|
-
|
|
|
|
- config = gic_read(GIC_REG(SHARED, GIC_SH_CONFIG));
|
|
|
|
- bits = 32 + 4 * ((config & GIC_SH_CONFIG_COUNTBITS_MSK) >>
|
|
|
|
- GIC_SH_CONFIG_COUNTBITS_SHF);
|
|
|
|
-
|
|
|
|
- return bits;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-void notrace gic_write_compare(u64 cnt)
|
|
|
|
-{
|
|
|
|
- if (mips_cm_is64) {
|
|
|
|
- gic_write(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE), cnt);
|
|
|
|
- } else {
|
|
|
|
- gic_write32(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE_HI),
|
|
|
|
- (int)(cnt >> 32));
|
|
|
|
- gic_write32(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE_LO),
|
|
|
|
- (int)(cnt & 0xffffffff));
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-void notrace gic_write_cpu_compare(u64 cnt, int cpu)
|
|
|
|
-{
|
|
|
|
- unsigned long flags;
|
|
|
|
-
|
|
|
|
- local_irq_save(flags);
|
|
|
|
-
|
|
|
|
- gic_write(GIC_REG(VPE_LOCAL, GIC_VPE_OTHER_ADDR), mips_cm_vp_id(cpu));
|
|
|
|
-
|
|
|
|
- if (mips_cm_is64) {
|
|
|
|
- gic_write(GIC_REG(VPE_OTHER, GIC_VPE_COMPARE), cnt);
|
|
|
|
- } else {
|
|
|
|
- gic_write32(GIC_REG(VPE_OTHER, GIC_VPE_COMPARE_HI),
|
|
|
|
- (int)(cnt >> 32));
|
|
|
|
- gic_write32(GIC_REG(VPE_OTHER, GIC_VPE_COMPARE_LO),
|
|
|
|
- (int)(cnt & 0xffffffff));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- local_irq_restore(flags);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-u64 gic_read_compare(void)
|
|
|
|
-{
|
|
|
|
- unsigned int hi, lo;
|
|
|
|
-
|
|
|
|
- if (mips_cm_is64)
|
|
|
|
- return (u64)gic_read(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE));
|
|
|
|
-
|
|
|
|
- hi = gic_read32(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE_HI));
|
|
|
|
- lo = gic_read32(GIC_REG(VPE_LOCAL, GIC_VPE_COMPARE_LO));
|
|
|
|
-
|
|
|
|
- return (((u64) hi) << 32) + lo;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-void gic_start_count(void)
|
|
|
|
-{
|
|
|
|
- u32 gicconfig;
|
|
|
|
-
|
|
|
|
- /* Start the counter */
|
|
|
|
- gicconfig = gic_read(GIC_REG(SHARED, GIC_SH_CONFIG));
|
|
|
|
- gicconfig &= ~(1 << GIC_SH_CONFIG_COUNTSTOP_SHF);
|
|
|
|
- gic_write(GIC_REG(SHARED, GIC_SH_CONFIG), gicconfig);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-void gic_stop_count(void)
|
|
|
|
-{
|
|
|
|
- u32 gicconfig;
|
|
|
|
-
|
|
|
|
- /* Stop the counter */
|
|
|
|
- gicconfig = gic_read(GIC_REG(SHARED, GIC_SH_CONFIG));
|
|
|
|
- gicconfig |= 1 << GIC_SH_CONFIG_COUNTSTOP_SHF;
|
|
|
|
- gic_write(GIC_REG(SHARED, GIC_SH_CONFIG), gicconfig);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
unsigned gic_read_local_vp_id(void)
|
|
unsigned gic_read_local_vp_id(void)
|
|
{
|
|
{
|
|
unsigned long ident;
|
|
unsigned long ident;
|