apb_timer.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * apb_timer.h: Driver for Langwell APB timer based on Synopsis DesignWare
  3. *
  4. * (C) Copyright 2009 Intel Corporation
  5. * Author: Jacob Pan (jacob.jun.pan@intel.com)
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; version 2
  10. * of the License.
  11. *
  12. * Note:
  13. */
  14. #ifndef ASM_X86_APBT_H
  15. #define ASM_X86_APBT_H
  16. #include <linux/sfi.h>
  17. #ifdef CONFIG_APB_TIMER
  18. /* Langwell DW APB timer registers */
  19. #define APBTMR_N_LOAD_COUNT 0x00
  20. #define APBTMR_N_CURRENT_VALUE 0x04
  21. #define APBTMR_N_CONTROL 0x08
  22. #define APBTMR_N_EOI 0x0c
  23. #define APBTMR_N_INT_STATUS 0x10
  24. #define APBTMRS_INT_STATUS 0xa0
  25. #define APBTMRS_EOI 0xa4
  26. #define APBTMRS_RAW_INT_STATUS 0xa8
  27. #define APBTMRS_COMP_VERSION 0xac
  28. #define APBTMRS_REG_SIZE 0x14
  29. /* register bits */
  30. #define APBTMR_CONTROL_ENABLE (1<<0)
  31. #define APBTMR_CONTROL_MODE_PERIODIC (1<<1) /*1: periodic 0:free running */
  32. #define APBTMR_CONTROL_INT (1<<2)
  33. /* default memory mapped register base */
  34. #define LNW_SCU_ADDR 0xFF100000
  35. #define LNW_EXT_TIMER_OFFSET 0x1B800
  36. #define APBT_DEFAULT_BASE (LNW_SCU_ADDR+LNW_EXT_TIMER_OFFSET)
  37. #define LNW_EXT_TIMER_PGOFFSET 0x800
  38. /* APBT clock speed range from PCLK to fabric base, 25-100MHz */
  39. #define APBT_MAX_FREQ 50
  40. #define APBT_MIN_FREQ 1
  41. #define APBT_MMAP_SIZE 1024
  42. #define APBT_DEV_USED 1
  43. extern void apbt_time_init(void);
  44. extern struct clock_event_device *global_clock_event;
  45. extern unsigned long apbt_quick_calibrate(void);
  46. extern int arch_setup_apbt_irqs(int irq, int trigger, int mask, int cpu);
  47. extern void apbt_setup_secondary_clock(void);
  48. extern unsigned int boot_cpu_id;
  49. extern int disable_apbt_percpu;
  50. extern struct sfi_timer_table_entry *sfi_get_mtmr(int hint);
  51. extern void sfi_free_mtmr(struct sfi_timer_table_entry *mtmr);
  52. extern int sfi_mtimer_num;
  53. #else /* CONFIG_APB_TIMER */
  54. static inline unsigned long apbt_quick_calibrate(void) {return 0; }
  55. static inline void apbt_time_init(void) {return 0; }
  56. #endif
  57. #endif /* ASM_X86_APBT_H */