intel-mid.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * intel-mid.h: Intel MID specific setup code
  3. *
  4. * (C) Copyright 2009 Intel Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; version 2
  9. * of the License.
  10. */
  11. #ifndef _ASM_X86_INTEL_MID_H
  12. #define _ASM_X86_INTEL_MID_H
  13. #include <linux/sfi.h>
  14. #include <linux/pci.h>
  15. #include <linux/platform_device.h>
  16. extern int intel_mid_pci_init(void);
  17. extern int intel_mid_pci_set_power_state(struct pci_dev *pdev, pci_power_t state);
  18. extern pci_power_t intel_mid_pci_get_power_state(struct pci_dev *pdev);
  19. extern void intel_mid_pwr_power_off(void);
  20. #define INTEL_MID_PWR_LSS_OFFSET 4
  21. #define INTEL_MID_PWR_LSS_TYPE (1 << 7)
  22. extern int intel_mid_pwr_get_lss_id(struct pci_dev *pdev);
  23. extern int get_gpio_by_name(const char *name);
  24. extern void intel_scu_device_register(struct platform_device *pdev);
  25. extern int __init sfi_parse_mrtc(struct sfi_table_header *table);
  26. extern int __init sfi_parse_mtmr(struct sfi_table_header *table);
  27. extern int sfi_mrtc_num;
  28. extern struct sfi_rtc_table_entry sfi_mrtc_array[];
  29. /*
  30. * Here defines the array of devices platform data that IAFW would export
  31. * through SFI "DEVS" table, we use name and type to match the device and
  32. * its platform data.
  33. */
  34. struct devs_id {
  35. char name[SFI_NAME_LEN + 1];
  36. u8 type;
  37. u8 delay;
  38. void *(*get_platform_data)(void *info);
  39. /* Custom handler for devices */
  40. void (*device_handler)(struct sfi_device_table_entry *pentry,
  41. struct devs_id *dev);
  42. };
  43. #define sfi_device(i) \
  44. static const struct devs_id *const __intel_mid_sfi_##i##_dev __used \
  45. __attribute__((__section__(".x86_intel_mid_dev.init"))) = &i
  46. /**
  47. * struct mid_sd_board_info - template for SD device creation
  48. * @name: identifies the driver
  49. * @bus_num: board-specific identifier for a given SD controller
  50. * @max_clk: the maximum frequency device supports
  51. * @platform_data: the particular data stored there is driver-specific
  52. */
  53. struct mid_sd_board_info {
  54. char name[SFI_NAME_LEN];
  55. int bus_num;
  56. unsigned short addr;
  57. u32 max_clk;
  58. void *platform_data;
  59. };
  60. /*
  61. * Medfield is the follow-up of Moorestown, it combines two chip solution into
  62. * one. Other than that it also added always-on and constant tsc and lapic
  63. * timers. Medfield is the platform name, and the chip name is called Penwell
  64. * we treat Medfield/Penwell as a variant of Moorestown. Penwell can be
  65. * identified via MSRs.
  66. */
  67. enum intel_mid_cpu_type {
  68. /* 1 was Moorestown */
  69. INTEL_MID_CPU_CHIP_PENWELL = 2,
  70. INTEL_MID_CPU_CHIP_CLOVERVIEW,
  71. INTEL_MID_CPU_CHIP_TANGIER,
  72. };
  73. extern enum intel_mid_cpu_type __intel_mid_cpu_chip;
  74. /**
  75. * struct intel_mid_ops - Interface between intel-mid & sub archs
  76. * @arch_setup: arch_setup function to re-initialize platform
  77. * structures (x86_init, x86_platform_init)
  78. *
  79. * This structure can be extended if any new interface is required
  80. * between intel-mid & its sub arch files.
  81. */
  82. struct intel_mid_ops {
  83. void (*arch_setup)(void);
  84. };
  85. /* Helper API's for INTEL_MID_OPS_INIT */
  86. #define DECLARE_INTEL_MID_OPS_INIT(cpuname, cpuid) \
  87. [cpuid] = get_##cpuname##_ops
  88. /* Maximum number of CPU ops */
  89. #define MAX_CPU_OPS(a) (sizeof(a)/sizeof(void *))
  90. /*
  91. * For every new cpu addition, a weak get_<cpuname>_ops() function needs be
  92. * declared in arch/x86/platform/intel_mid/intel_mid_weak_decls.h.
  93. */
  94. #define INTEL_MID_OPS_INIT { \
  95. DECLARE_INTEL_MID_OPS_INIT(penwell, INTEL_MID_CPU_CHIP_PENWELL), \
  96. DECLARE_INTEL_MID_OPS_INIT(cloverview, INTEL_MID_CPU_CHIP_CLOVERVIEW), \
  97. DECLARE_INTEL_MID_OPS_INIT(tangier, INTEL_MID_CPU_CHIP_TANGIER) \
  98. };
  99. #ifdef CONFIG_X86_INTEL_MID
  100. static inline enum intel_mid_cpu_type intel_mid_identify_cpu(void)
  101. {
  102. return __intel_mid_cpu_chip;
  103. }
  104. static inline bool intel_mid_has_msic(void)
  105. {
  106. return (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_PENWELL);
  107. }
  108. #else /* !CONFIG_X86_INTEL_MID */
  109. #define intel_mid_identify_cpu() 0
  110. #define intel_mid_has_msic() 0
  111. #endif /* !CONFIG_X86_INTEL_MID */
  112. enum intel_mid_timer_options {
  113. INTEL_MID_TIMER_DEFAULT,
  114. INTEL_MID_TIMER_APBT_ONLY,
  115. INTEL_MID_TIMER_LAPIC_APBT,
  116. };
  117. extern enum intel_mid_timer_options intel_mid_timer_options;
  118. /*
  119. * Penwell uses spread spectrum clock, so the freq number is not exactly
  120. * the same as reported by MSR based on SDM.
  121. */
  122. #define FSB_FREQ_83SKU 83200
  123. #define FSB_FREQ_100SKU 99840
  124. #define FSB_FREQ_133SKU 133000
  125. #define FSB_FREQ_167SKU 167000
  126. #define FSB_FREQ_200SKU 200000
  127. #define FSB_FREQ_267SKU 267000
  128. #define FSB_FREQ_333SKU 333000
  129. #define FSB_FREQ_400SKU 400000
  130. /* Bus Select SoC Fuse value */
  131. #define BSEL_SOC_FUSE_MASK 0x7
  132. /* FSB 133MHz */
  133. #define BSEL_SOC_FUSE_001 0x1
  134. /* FSB 100MHz */
  135. #define BSEL_SOC_FUSE_101 0x5
  136. /* FSB 83MHz */
  137. #define BSEL_SOC_FUSE_111 0x7
  138. #define SFI_MTMR_MAX_NUM 8
  139. #define SFI_MRTC_MAX 8
  140. extern void intel_scu_devices_create(void);
  141. extern void intel_scu_devices_destroy(void);
  142. /* VRTC timer */
  143. #define MRST_VRTC_MAP_SZ 1024
  144. /* #define MRST_VRTC_PGOFFSET 0xc00 */
  145. extern void intel_mid_rtc_init(void);
  146. /* The offset for the mapping of global gpio pin to irq */
  147. #define INTEL_MID_IRQ_OFFSET 0x100
  148. #endif /* _ASM_X86_INTEL_MID_H */