intel-mid.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Intel MID platform setup code
  4. *
  5. * (C) Copyright 2008, 2012, 2021 Intel Corporation
  6. * Author: Jacob Pan ([email protected])
  7. * Author: Sathyanarayanan Kuppuswamy <[email protected]>
  8. */
  9. #define pr_fmt(fmt) "intel_mid: " fmt
  10. #include <linux/init.h>
  11. #include <linux/kernel.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/regulator/machine.h>
  14. #include <linux/scatterlist.h>
  15. #include <linux/irq.h>
  16. #include <linux/export.h>
  17. #include <linux/notifier.h>
  18. #include <asm/setup.h>
  19. #include <asm/mpspec_def.h>
  20. #include <asm/hw_irq.h>
  21. #include <asm/apic.h>
  22. #include <asm/io_apic.h>
  23. #include <asm/intel-mid.h>
  24. #include <asm/io.h>
  25. #include <asm/i8259.h>
  26. #include <asm/intel_scu_ipc.h>
  27. #include <asm/reboot.h>
  28. #define IPCMSG_COLD_OFF 0x80 /* Only for Tangier */
  29. #define IPCMSG_COLD_RESET 0xF1
  30. static void intel_mid_power_off(void)
  31. {
  32. /* Shut down South Complex via PWRMU */
  33. intel_mid_pwr_power_off();
  34. /* Only for Tangier, the rest will ignore this command */
  35. intel_scu_ipc_dev_simple_command(NULL, IPCMSG_COLD_OFF, 1);
  36. };
  37. static void intel_mid_reboot(void)
  38. {
  39. intel_scu_ipc_dev_simple_command(NULL, IPCMSG_COLD_RESET, 0);
  40. }
  41. static void __init intel_mid_time_init(void)
  42. {
  43. /* Lapic only, no apbt */
  44. x86_init.timers.setup_percpu_clockev = setup_boot_APIC_clock;
  45. x86_cpuinit.setup_percpu_clockev = setup_secondary_APIC_clock;
  46. }
  47. static void intel_mid_arch_setup(void)
  48. {
  49. switch (boot_cpu_data.x86_model) {
  50. case 0x3C:
  51. case 0x4A:
  52. x86_platform.legacy.rtc = 1;
  53. break;
  54. default:
  55. break;
  56. }
  57. /*
  58. * Intel MID platforms are using explicitly defined regulators.
  59. *
  60. * Let the regulator core know that we do not have any additional
  61. * regulators left. This lets it substitute unprovided regulators with
  62. * dummy ones:
  63. */
  64. regulator_has_full_constraints();
  65. }
  66. /*
  67. * Moorestown does not have external NMI source nor port 0x61 to report
  68. * NMI status. The possible NMI sources are from pmu as a result of NMI
  69. * watchdog or lock debug. Reading io port 0x61 results in 0xff which
  70. * misled NMI handler.
  71. */
  72. static unsigned char intel_mid_get_nmi_reason(void)
  73. {
  74. return 0;
  75. }
  76. /*
  77. * Moorestown specific x86_init function overrides and early setup
  78. * calls.
  79. */
  80. void __init x86_intel_mid_early_setup(void)
  81. {
  82. x86_init.resources.probe_roms = x86_init_noop;
  83. x86_init.resources.reserve_resources = x86_init_noop;
  84. x86_init.timers.timer_init = intel_mid_time_init;
  85. x86_init.timers.setup_percpu_clockev = x86_init_noop;
  86. x86_init.irqs.pre_vector_init = x86_init_noop;
  87. x86_init.oem.arch_setup = intel_mid_arch_setup;
  88. x86_platform.get_nmi_reason = intel_mid_get_nmi_reason;
  89. x86_init.pci.arch_init = intel_mid_pci_init;
  90. x86_init.pci.fixup_irqs = x86_init_noop;
  91. legacy_pic = &null_legacy_pic;
  92. /*
  93. * Do nothing for now as everything needed done in
  94. * x86_intel_mid_early_setup() below.
  95. */
  96. x86_init.acpi.reduced_hw_early_init = x86_init_noop;
  97. pm_power_off = intel_mid_power_off;
  98. machine_ops.emergency_restart = intel_mid_reboot;
  99. /* Avoid searching for BIOS MP tables */
  100. x86_init.mpparse.find_smp_config = x86_init_noop;
  101. x86_init.mpparse.get_smp_config = x86_init_uint_noop;
  102. set_bit(MP_BUS_ISA, mp_bus_not_pci);
  103. }