Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'sfi-removal-5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull Simple Firmware Interface (SFI) support removal from Rafael Wysocki:
"Drop support for depercated platforms using SFI, drop the entire
support for SFI that has been long deprecated too and make some
janitorial changes on top of that (Andy Shevchenko)"

* tag 'sfi-removal-5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
x86/platform/intel-mid: Update Copyright year and drop file names
x86/platform/intel-mid: Remove unused header inclusion in intel-mid.h
x86/platform/intel-mid: Drop unused __intel_mid_cpu_chip and Co.
x86/platform/intel-mid: Get rid of intel_scu_ipc_legacy.h
x86/PCI: Describe @reg for type1_access_ok()
x86/PCI: Get rid of custom x86 model comparison
sfi: Remove framework for deprecated firmware
cpufreq: sfi-cpufreq: Remove driver for deprecated firmware
media: atomisp: Remove unused header
mfd: intel_msic: Remove driver for deprecated platform
x86/apb_timer: Remove driver for deprecated platform
x86/platform/intel-mid: Remove unused leftovers (vRTC)
x86/platform/intel-mid: Remove unused leftovers (msic)
x86/platform/intel-mid: Remove unused leftovers (msic_thermal)
x86/platform/intel-mid: Remove unused leftovers (msic_power_btn)
x86/platform/intel-mid: Remove unused leftovers (msic_gpio)
x86/platform/intel-mid: Remove unused leftovers (msic_battery)
x86/platform/intel-mid: Remove unused leftovers (msic_ocd)
x86/platform/intel-mid: Remove unused leftovers (msic_audio)
platform/x86: intel_scu_wdt: Drop mistakenly added const

+41 -5038
-15
Documentation/ABI/testing/sysfs-firmware-sfi
··· 1 - What: /sys/firmware/sfi/tables/ 2 - Date: May 2010 3 - Contact: Len Brown <lenb@kernel.org> 4 - Description: 5 - SFI defines a number of small static memory tables 6 - so the kernel can get platform information from firmware. 7 - 8 - The tables are defined in the latest SFI specification: 9 - http://simplefirmware.org/documentation 10 - 11 - While the tables are used by the kernel, user-space 12 - can observe them this way:: 13 - 14 - # cd /sys/firmware/sfi/tables 15 - # cat $TABLENAME > $TABLENAME.bin
+1 -1
Documentation/ABI/testing/sysfs-platform-kim
··· 7 7 is connected. example: "/dev/ttyS0". 8 8 9 9 The device name flows down to architecture specific board 10 - initialization file from the SFI/ATAGS bootloader 10 + initialization file from the ATAGS bootloader 11 11 firmware. The name exposed is read from the user-space 12 12 dameon and opens the device when install is requested. 13 13
-6
Documentation/admin-guide/kernel-parameters.txt
··· 5990 5990 default x2apic cluster mode on platforms 5991 5991 supporting x2apic. 5992 5992 5993 - x86_intel_mid_timer= [X86-32,APBT] 5994 - Choose timer option for x86 Intel MID platform. 5995 - Two valid options are apbt timer only and lapic timer 5996 - plus one apbt timer for broadcast timer. 5997 - x86_intel_mid_timer=apbt_only | lapic_and_apbt 5998 - 5999 5993 xen_512gb_limit [KNL,X86-64,XEN] 6000 5994 Restricts the kernel running paravirtualized under Xen 6001 5995 to use only up to 512 GB of RAM. The reason to do so is
-9
MAINTAINERS
··· 9122 9122 INTEL PMIC MULTIFUNCTION DEVICE DRIVERS 9123 9123 M: Andy Shevchenko <andy@kernel.org> 9124 9124 S: Maintained 9125 - F: drivers/mfd/intel_msic.c 9126 9125 F: drivers/mfd/intel_soc_pmic* 9127 - F: include/linux/mfd/intel_msic.h 9128 9126 F: include/linux/mfd/intel_soc_pmic* 9129 9127 9130 9128 INTEL PMT DRIVER ··· 16319 16321 S: Maintained 16320 16322 F: Documentation/devicetree/bindings/i3c/silvaco,i3c-master.yaml 16321 16323 F: drivers/i3c/master/svc-i3c-master.c 16322 - 16323 - SIMPLE FIRMWARE INTERFACE (SFI) 16324 - S: Obsolete 16325 - W: http://simplefirmware.org/ 16326 - F: arch/x86/platform/sfi/ 16327 - F: drivers/sfi/ 16328 - F: include/linux/sfi*.h 16329 16324 16330 16325 SIMPLEFB FB DRIVER 16331 16326 M: Hans de Goede <hdegoede@redhat.com>
+2 -17
arch/x86/Kconfig
··· 448 448 If you don't know what to do here, say N. 449 449 450 450 config X86_MPPARSE 451 - bool "Enable MPS table" if ACPI || SFI 451 + bool "Enable MPS table" if ACPI 452 452 default y 453 453 depends on X86_LOCAL_APIC 454 454 help ··· 607 607 depends on PCI 608 608 depends on X86_64 || (PCI_GOANY && X86_32) 609 609 depends on X86_IO_APIC 610 - select SFI 611 610 select I2C 612 611 select DW_APB_TIMER 613 612 select APB_TIMER ··· 894 895 config HPET_EMULATE_RTC 895 896 def_bool y 896 897 depends on HPET_TIMER && (RTC_DRV_CMOS=m || RTC_DRV_CMOS=y) 897 - 898 - config APB_TIMER 899 - def_bool y if X86_INTEL_MID 900 - prompt "Intel MID APB Timer Support" if X86_INTEL_MID 901 - select DW_APB_TIMER 902 - depends on X86_INTEL_MID && SFI 903 - help 904 - APB timer is the replacement for 8254, HPET on X86 MID platforms. 905 - The APBT provides a stable time base on SMP 906 - systems, unlike the TSC, but it is more expensive to access, 907 - as it is off-chip. APB timers are always running regardless of CPU 908 - C states, they are used as per CPU clockevent device when possible. 909 898 910 899 # Mark as expert because too many people got it wrong. 911 900 # The code disables itself when not needed. ··· 2456 2469 2457 2470 source "drivers/acpi/Kconfig" 2458 2471 2459 - source "drivers/sfi/Kconfig" 2460 - 2461 2472 config X86_APM_BOOT 2462 2473 def_bool y 2463 2474 depends on APM ··· 2642 2657 config PCI_MMCONFIG 2643 2658 bool "Support mmconfig PCI config space access" if X86_64 2644 2659 default y 2645 - depends on PCI && (ACPI || SFI || JAILHOUSE_GUEST) 2660 + depends on PCI && (ACPI || JAILHOUSE_GUEST) 2646 2661 depends on X86_64 || (PCI_GOANY || PCI_GOMMCONFIG) 2647 2662 2648 2663 config PCI_OLPC
-40
arch/x86/include/asm/apb_timer.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * apb_timer.h: Driver for Langwell APB timer based on Synopsis DesignWare 4 - * 5 - * (C) Copyright 2009 Intel Corporation 6 - * Author: Jacob Pan (jacob.jun.pan@intel.com) 7 - * 8 - * Note: 9 - */ 10 - 11 - #ifndef ASM_X86_APBT_H 12 - #define ASM_X86_APBT_H 13 - #include <linux/sfi.h> 14 - 15 - #ifdef CONFIG_APB_TIMER 16 - 17 - /* default memory mapped register base */ 18 - #define LNW_SCU_ADDR 0xFF100000 19 - #define LNW_EXT_TIMER_OFFSET 0x1B800 20 - #define APBT_DEFAULT_BASE (LNW_SCU_ADDR+LNW_EXT_TIMER_OFFSET) 21 - #define LNW_EXT_TIMER_PGOFFSET 0x800 22 - 23 - /* APBT clock speed range from PCLK to fabric base, 25-100MHz */ 24 - #define APBT_MAX_FREQ 50000000 25 - #define APBT_MIN_FREQ 1000000 26 - #define APBT_MMAP_SIZE 1024 27 - 28 - extern void apbt_time_init(void); 29 - extern void apbt_setup_secondary_clock(void); 30 - 31 - extern struct sfi_timer_table_entry *sfi_get_mtmr(int hint); 32 - extern void sfi_free_mtmr(struct sfi_timer_table_entry *mtmr); 33 - extern int sfi_mtimer_num; 34 - 35 - #else /* CONFIG_APB_TIMER */ 36 - 37 - static inline void apbt_time_init(void) { } 38 - 39 - #endif 40 - #endif /* ASM_X86_APBT_H */
-3
arch/x86/include/asm/fixmap.h
··· 108 108 #ifdef CONFIG_PARAVIRT_XXL 109 109 FIX_PARAVIRT_BOOTMAP, 110 110 #endif 111 - #ifdef CONFIG_X86_INTEL_MID 112 - FIX_LNW_VRTC, 113 - #endif 114 111 115 112 #ifdef CONFIG_ACPI_APEI_GHES 116 113 /* Used for GHES mapping from assorted contexts */
+2 -91
arch/x86/include/asm/intel-mid.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 2 /* 3 - * intel-mid.h: Intel MID specific setup code 3 + * Intel MID specific setup code 4 4 * 5 - * (C) Copyright 2009 Intel Corporation 5 + * (C) Copyright 2009, 2021 Intel Corporation 6 6 */ 7 7 #ifndef _ASM_X86_INTEL_MID_H 8 8 #define _ASM_X86_INTEL_MID_H 9 9 10 - #include <linux/sfi.h> 11 10 #include <linux/pci.h> 12 - #include <linux/platform_device.h> 13 11 14 12 extern int intel_mid_pci_init(void); 15 13 extern int intel_mid_pci_set_power_state(struct pci_dev *pdev, pci_power_t state); ··· 20 22 21 23 extern int intel_mid_pwr_get_lss_id(struct pci_dev *pdev); 22 24 23 - extern int get_gpio_by_name(const char *name); 24 - extern int __init sfi_parse_mrtc(struct sfi_table_header *table); 25 - extern int __init sfi_parse_mtmr(struct sfi_table_header *table); 26 - extern int sfi_mrtc_num; 27 - extern struct sfi_rtc_table_entry sfi_mrtc_array[]; 28 - 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 - u8 msic; 39 - void *(*get_platform_data)(void *info); 40 - }; 41 - 42 - #define sfi_device(i) \ 43 - static const struct devs_id *const __intel_mid_sfi_##i##_dev __used \ 44 - __section(".x86_intel_mid_dev.init") = &i 45 - 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 - /* 62 - * Medfield is the follow-up of Moorestown, it combines two chip solution into 63 - * one. Other than that it also added always-on and constant tsc and lapic 64 - * timers. Medfield is the platform name, and the chip name is called Penwell 65 - * we treat Medfield/Penwell as a variant of Moorestown. Penwell can be 66 - * identified via MSRs. 67 - */ 68 - enum intel_mid_cpu_type { 69 - /* 1 was Moorestown */ 70 - INTEL_MID_CPU_CHIP_PENWELL = 2, 71 - INTEL_MID_CPU_CHIP_CLOVERVIEW, 72 - INTEL_MID_CPU_CHIP_TANGIER, 73 - }; 74 - 75 - extern enum intel_mid_cpu_type __intel_mid_cpu_chip; 76 - 77 25 #ifdef CONFIG_X86_INTEL_MID 78 - 79 - static inline enum intel_mid_cpu_type intel_mid_identify_cpu(void) 80 - { 81 - return __intel_mid_cpu_chip; 82 - } 83 - 84 - static inline bool intel_mid_has_msic(void) 85 - { 86 - return (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_PENWELL); 87 - } 88 26 89 27 extern void intel_scu_devices_create(void); 90 28 extern void intel_scu_devices_destroy(void); 91 29 92 30 #else /* !CONFIG_X86_INTEL_MID */ 93 31 94 - #define intel_mid_identify_cpu() 0 95 - #define intel_mid_has_msic() 0 96 - 97 32 static inline void intel_scu_devices_create(void) { } 98 33 static inline void intel_scu_devices_destroy(void) { } 99 34 100 35 #endif /* !CONFIG_X86_INTEL_MID */ 101 - 102 - enum intel_mid_timer_options { 103 - INTEL_MID_TIMER_DEFAULT, 104 - INTEL_MID_TIMER_APBT_ONLY, 105 - INTEL_MID_TIMER_LAPIC_APBT, 106 - }; 107 - 108 - extern enum intel_mid_timer_options intel_mid_timer_options; 109 36 110 37 /* Bus Select SoC Fuse value */ 111 38 #define BSEL_SOC_FUSE_MASK 0x7 ··· 40 117 #define BSEL_SOC_FUSE_101 0x5 41 118 /* FSB 83MHz */ 42 119 #define BSEL_SOC_FUSE_111 0x7 43 - 44 - #define SFI_MTMR_MAX_NUM 8 45 - #define SFI_MRTC_MAX 8 46 - 47 - /* VRTC timer */ 48 - #define MRST_VRTC_MAP_SZ 1024 49 - /* #define MRST_VRTC_PGOFFSET 0xc00 */ 50 - 51 - extern void intel_mid_rtc_init(void); 52 - 53 - /* The offset for the mapping of global gpio pin to irq */ 54 - #define INTEL_MID_IRQ_OFFSET 0x100 55 120 56 121 #endif /* _ASM_X86_INTEL_MID_H */
-10
arch/x86/include/asm/intel_mid_vrtc.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _INTEL_MID_VRTC_H 3 - #define _INTEL_MID_VRTC_H 4 - 5 - extern unsigned char vrtc_cmos_read(unsigned char reg); 6 - extern void vrtc_cmos_write(unsigned char val, unsigned char reg); 7 - extern void vrtc_get_time(struct timespec64 *now); 8 - extern int vrtc_set_mmss(const struct timespec64 *now); 9 - 10 - #endif
-2
arch/x86/include/asm/intel_scu_ipc.h
··· 65 65 inlen, out, outlen); 66 66 } 67 67 68 - #include <asm/intel_scu_ipc_legacy.h> 69 - 70 68 #endif
-91
arch/x86/include/asm/intel_scu_ipc_legacy.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ASM_X86_INTEL_SCU_IPC_LEGACY_H_ 3 - #define _ASM_X86_INTEL_SCU_IPC_LEGACY_H_ 4 - 5 - #include <linux/notifier.h> 6 - 7 - #define IPCMSG_INDIRECT_READ 0x02 8 - #define IPCMSG_INDIRECT_WRITE 0x05 9 - 10 - #define IPCMSG_COLD_OFF 0x80 /* Only for Tangier */ 11 - 12 - #define IPCMSG_WARM_RESET 0xF0 13 - #define IPCMSG_COLD_RESET 0xF1 14 - #define IPCMSG_SOFT_RESET 0xF2 15 - #define IPCMSG_COLD_BOOT 0xF3 16 - 17 - #define IPCMSG_VRTC 0xFA /* Set vRTC device */ 18 - /* Command id associated with message IPCMSG_VRTC */ 19 - #define IPC_CMD_VRTC_SETTIME 1 /* Set time */ 20 - #define IPC_CMD_VRTC_SETALARM 2 /* Set alarm */ 21 - 22 - /* Don't call these in new code - they will be removed eventually */ 23 - 24 - /* Read single register */ 25 - static inline int intel_scu_ipc_ioread8(u16 addr, u8 *data) 26 - { 27 - return intel_scu_ipc_dev_ioread8(NULL, addr, data); 28 - } 29 - 30 - /* Read a vector */ 31 - static inline int intel_scu_ipc_readv(u16 *addr, u8 *data, int len) 32 - { 33 - return intel_scu_ipc_dev_readv(NULL, addr, data, len); 34 - } 35 - 36 - /* Write single register */ 37 - static inline int intel_scu_ipc_iowrite8(u16 addr, u8 data) 38 - { 39 - return intel_scu_ipc_dev_iowrite8(NULL, addr, data); 40 - } 41 - 42 - /* Write a vector */ 43 - static inline int intel_scu_ipc_writev(u16 *addr, u8 *data, int len) 44 - { 45 - return intel_scu_ipc_dev_writev(NULL, addr, data, len); 46 - } 47 - 48 - /* Update single register based on the mask */ 49 - static inline int intel_scu_ipc_update_register(u16 addr, u8 data, u8 mask) 50 - { 51 - return intel_scu_ipc_dev_update(NULL, addr, data, mask); 52 - } 53 - 54 - /* Issue commands to the SCU with or without data */ 55 - static inline int intel_scu_ipc_simple_command(int cmd, int sub) 56 - { 57 - return intel_scu_ipc_dev_simple_command(NULL, cmd, sub); 58 - } 59 - 60 - static inline int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen, 61 - u32 *out, int outlen) 62 - { 63 - /* New API takes both inlen and outlen as bytes so convert here */ 64 - size_t inbytes = inlen * sizeof(u32); 65 - size_t outbytes = outlen * sizeof(u32); 66 - 67 - return intel_scu_ipc_dev_command_with_size(NULL, cmd, sub, in, inbytes, 68 - inlen, out, outbytes); 69 - } 70 - 71 - extern struct blocking_notifier_head intel_scu_notifier; 72 - 73 - static inline void intel_scu_notifier_add(struct notifier_block *nb) 74 - { 75 - blocking_notifier_chain_register(&intel_scu_notifier, nb); 76 - } 77 - 78 - static inline void intel_scu_notifier_remove(struct notifier_block *nb) 79 - { 80 - blocking_notifier_chain_unregister(&intel_scu_notifier, nb); 81 - } 82 - 83 - static inline int intel_scu_notifier_post(unsigned long v, void *p) 84 - { 85 - return blocking_notifier_call_chain(&intel_scu_notifier, v, p); 86 - } 87 - 88 - #define SCU_AVAILABLE 1 89 - #define SCU_DOWN 2 90 - 91 - #endif
-2
arch/x86/include/asm/platform_sst_audio.h
··· 10 10 #ifndef _PLATFORM_SST_AUDIO_H_ 11 11 #define _PLATFORM_SST_AUDIO_H_ 12 12 13 - #include <linux/sfi.h> 14 - 15 13 #define MAX_NUM_STREAMS_MRFLD 25 16 14 #define MAX_NUM_STREAMS MAX_NUM_STREAMS_MRFLD 17 15
-1
arch/x86/kernel/Makefile
··· 116 116 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 117 117 118 118 obj-$(CONFIG_HPET_TIMER) += hpet.o 119 - obj-$(CONFIG_APB_TIMER) += apb_timer.o 120 119 121 120 obj-$(CONFIG_AMD_NB) += amd_nb.o 122 121 obj-$(CONFIG_DEBUG_NMI_SELFTEST) += nmi_selftest.o
-347
arch/x86/kernel/apb_timer.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * apb_timer.c: Driver for Langwell APB timers 4 - * 5 - * (C) Copyright 2009 Intel Corporation 6 - * Author: Jacob Pan (jacob.jun.pan@intel.com) 7 - * 8 - * Note: 9 - * Langwell is the south complex of Intel Moorestown MID platform. There are 10 - * eight external timers in total that can be used by the operating system. 11 - * The timer information, such as frequency and addresses, is provided to the 12 - * OS via SFI tables. 13 - * Timer interrupts are routed via FW/HW emulated IOAPIC independently via 14 - * individual redirection table entries (RTE). 15 - * Unlike HPET, there is no master counter, therefore one of the timers are 16 - * used as clocksource. The overall allocation looks like: 17 - * - timer 0 - NR_CPUs for per cpu timer 18 - * - one timer for clocksource 19 - * - one timer for watchdog driver. 20 - * It is also worth notice that APB timer does not support true one-shot mode, 21 - * free-running mode will be used here to emulate one-shot mode. 22 - * APB timer can also be used as broadcast timer along with per cpu local APIC 23 - * timer, but by default APB timer has higher rating than local APIC timers. 24 - */ 25 - 26 - #include <linux/delay.h> 27 - #include <linux/dw_apb_timer.h> 28 - #include <linux/errno.h> 29 - #include <linux/init.h> 30 - #include <linux/slab.h> 31 - #include <linux/pm.h> 32 - #include <linux/sfi.h> 33 - #include <linux/interrupt.h> 34 - #include <linux/cpu.h> 35 - #include <linux/irq.h> 36 - 37 - #include <asm/fixmap.h> 38 - #include <asm/apb_timer.h> 39 - #include <asm/intel-mid.h> 40 - #include <asm/time.h> 41 - 42 - #define APBT_CLOCKEVENT_RATING 110 43 - #define APBT_CLOCKSOURCE_RATING 250 44 - 45 - #define APBT_CLOCKEVENT0_NUM (0) 46 - #define APBT_CLOCKSOURCE_NUM (2) 47 - 48 - static phys_addr_t apbt_address; 49 - static int apb_timer_block_enabled; 50 - static void __iomem *apbt_virt_address; 51 - 52 - /* 53 - * Common DW APB timer info 54 - */ 55 - static unsigned long apbt_freq; 56 - 57 - struct apbt_dev { 58 - struct dw_apb_clock_event_device *timer; 59 - unsigned int num; 60 - int cpu; 61 - unsigned int irq; 62 - char name[10]; 63 - }; 64 - 65 - static struct dw_apb_clocksource *clocksource_apbt; 66 - 67 - static inline void __iomem *adev_virt_addr(struct apbt_dev *adev) 68 - { 69 - return apbt_virt_address + adev->num * APBTMRS_REG_SIZE; 70 - } 71 - 72 - static DEFINE_PER_CPU(struct apbt_dev, cpu_apbt_dev); 73 - 74 - #ifdef CONFIG_SMP 75 - static unsigned int apbt_num_timers_used; 76 - #endif 77 - 78 - static inline void apbt_set_mapping(void) 79 - { 80 - struct sfi_timer_table_entry *mtmr; 81 - int phy_cs_timer_id = 0; 82 - 83 - if (apbt_virt_address) { 84 - pr_debug("APBT base already mapped\n"); 85 - return; 86 - } 87 - mtmr = sfi_get_mtmr(APBT_CLOCKEVENT0_NUM); 88 - if (mtmr == NULL) { 89 - printk(KERN_ERR "Failed to get MTMR %d from SFI\n", 90 - APBT_CLOCKEVENT0_NUM); 91 - return; 92 - } 93 - apbt_address = (phys_addr_t)mtmr->phys_addr; 94 - if (!apbt_address) { 95 - printk(KERN_WARNING "No timer base from SFI, use default\n"); 96 - apbt_address = APBT_DEFAULT_BASE; 97 - } 98 - apbt_virt_address = ioremap(apbt_address, APBT_MMAP_SIZE); 99 - if (!apbt_virt_address) { 100 - pr_debug("Failed mapping APBT phy address at %lu\n",\ 101 - (unsigned long)apbt_address); 102 - goto panic_noapbt; 103 - } 104 - apbt_freq = mtmr->freq_hz; 105 - sfi_free_mtmr(mtmr); 106 - 107 - /* Now figure out the physical timer id for clocksource device */ 108 - mtmr = sfi_get_mtmr(APBT_CLOCKSOURCE_NUM); 109 - if (mtmr == NULL) 110 - goto panic_noapbt; 111 - 112 - /* Now figure out the physical timer id */ 113 - pr_debug("Use timer %d for clocksource\n", 114 - (int)(mtmr->phys_addr & 0xff) / APBTMRS_REG_SIZE); 115 - phy_cs_timer_id = (unsigned int)(mtmr->phys_addr & 0xff) / 116 - APBTMRS_REG_SIZE; 117 - 118 - clocksource_apbt = dw_apb_clocksource_init(APBT_CLOCKSOURCE_RATING, 119 - "apbt0", apbt_virt_address + phy_cs_timer_id * 120 - APBTMRS_REG_SIZE, apbt_freq); 121 - return; 122 - 123 - panic_noapbt: 124 - panic("Failed to setup APB system timer\n"); 125 - 126 - } 127 - 128 - static inline void apbt_clear_mapping(void) 129 - { 130 - iounmap(apbt_virt_address); 131 - apbt_virt_address = NULL; 132 - } 133 - 134 - static int __init apbt_clockevent_register(void) 135 - { 136 - struct sfi_timer_table_entry *mtmr; 137 - struct apbt_dev *adev = this_cpu_ptr(&cpu_apbt_dev); 138 - 139 - mtmr = sfi_get_mtmr(APBT_CLOCKEVENT0_NUM); 140 - if (mtmr == NULL) { 141 - printk(KERN_ERR "Failed to get MTMR %d from SFI\n", 142 - APBT_CLOCKEVENT0_NUM); 143 - return -ENODEV; 144 - } 145 - 146 - adev->num = smp_processor_id(); 147 - adev->timer = dw_apb_clockevent_init(smp_processor_id(), "apbt0", 148 - intel_mid_timer_options == INTEL_MID_TIMER_LAPIC_APBT ? 149 - APBT_CLOCKEVENT_RATING - 100 : APBT_CLOCKEVENT_RATING, 150 - adev_virt_addr(adev), 0, apbt_freq); 151 - /* Firmware does EOI handling for us. */ 152 - adev->timer->eoi = NULL; 153 - 154 - if (intel_mid_timer_options == INTEL_MID_TIMER_LAPIC_APBT) { 155 - global_clock_event = &adev->timer->ced; 156 - printk(KERN_DEBUG "%s clockevent registered as global\n", 157 - global_clock_event->name); 158 - } 159 - 160 - dw_apb_clockevent_register(adev->timer); 161 - 162 - sfi_free_mtmr(mtmr); 163 - return 0; 164 - } 165 - 166 - #ifdef CONFIG_SMP 167 - 168 - static void apbt_setup_irq(struct apbt_dev *adev) 169 - { 170 - irq_modify_status(adev->irq, 0, IRQ_MOVE_PCNTXT); 171 - irq_set_affinity(adev->irq, cpumask_of(adev->cpu)); 172 - } 173 - 174 - /* Should be called with per cpu */ 175 - void apbt_setup_secondary_clock(void) 176 - { 177 - struct apbt_dev *adev; 178 - int cpu; 179 - 180 - /* Don't register boot CPU clockevent */ 181 - cpu = smp_processor_id(); 182 - if (!cpu) 183 - return; 184 - 185 - adev = this_cpu_ptr(&cpu_apbt_dev); 186 - if (!adev->timer) { 187 - adev->timer = dw_apb_clockevent_init(cpu, adev->name, 188 - APBT_CLOCKEVENT_RATING, adev_virt_addr(adev), 189 - adev->irq, apbt_freq); 190 - adev->timer->eoi = NULL; 191 - } else { 192 - dw_apb_clockevent_resume(adev->timer); 193 - } 194 - 195 - printk(KERN_INFO "Registering CPU %d clockevent device %s, cpu %08x\n", 196 - cpu, adev->name, adev->cpu); 197 - 198 - apbt_setup_irq(adev); 199 - dw_apb_clockevent_register(adev->timer); 200 - 201 - return; 202 - } 203 - 204 - /* 205 - * this notify handler process CPU hotplug events. in case of S0i3, nonboot 206 - * cpus are disabled/enabled frequently, for performance reasons, we keep the 207 - * per cpu timer irq registered so that we do need to do free_irq/request_irq. 208 - * 209 - * TODO: it might be more reliable to directly disable percpu clockevent device 210 - * without the notifier chain. currently, cpu 0 may get interrupts from other 211 - * cpu timers during the offline process due to the ordering of notification. 212 - * the extra interrupt is harmless. 213 - */ 214 - static int apbt_cpu_dead(unsigned int cpu) 215 - { 216 - struct apbt_dev *adev = &per_cpu(cpu_apbt_dev, cpu); 217 - 218 - dw_apb_clockevent_pause(adev->timer); 219 - if (system_state == SYSTEM_RUNNING) { 220 - pr_debug("skipping APBT CPU %u offline\n", cpu); 221 - } else { 222 - pr_debug("APBT clockevent for cpu %u offline\n", cpu); 223 - dw_apb_clockevent_stop(adev->timer); 224 - } 225 - return 0; 226 - } 227 - 228 - static __init int apbt_late_init(void) 229 - { 230 - if (intel_mid_timer_options == INTEL_MID_TIMER_LAPIC_APBT || 231 - !apb_timer_block_enabled) 232 - return 0; 233 - return cpuhp_setup_state(CPUHP_X86_APB_DEAD, "x86/apb:dead", NULL, 234 - apbt_cpu_dead); 235 - } 236 - fs_initcall(apbt_late_init); 237 - #else 238 - 239 - void apbt_setup_secondary_clock(void) {} 240 - 241 - #endif /* CONFIG_SMP */ 242 - 243 - static int apbt_clocksource_register(void) 244 - { 245 - u64 start, now; 246 - u64 t1; 247 - 248 - /* Start the counter, use timer 2 as source, timer 0/1 for event */ 249 - dw_apb_clocksource_start(clocksource_apbt); 250 - 251 - /* Verify whether apbt counter works */ 252 - t1 = dw_apb_clocksource_read(clocksource_apbt); 253 - start = rdtsc(); 254 - 255 - /* 256 - * We don't know the TSC frequency yet, but waiting for 257 - * 200000 TSC cycles is safe: 258 - * 4 GHz == 50us 259 - * 1 GHz == 200us 260 - */ 261 - do { 262 - rep_nop(); 263 - now = rdtsc(); 264 - } while ((now - start) < 200000UL); 265 - 266 - /* APBT is the only always on clocksource, it has to work! */ 267 - if (t1 == dw_apb_clocksource_read(clocksource_apbt)) 268 - panic("APBT counter not counting. APBT disabled\n"); 269 - 270 - dw_apb_clocksource_register(clocksource_apbt); 271 - 272 - return 0; 273 - } 274 - 275 - /* 276 - * Early setup the APBT timer, only use timer 0 for booting then switch to 277 - * per CPU timer if possible. 278 - * returns 1 if per cpu apbt is setup 279 - * returns 0 if no per cpu apbt is chosen 280 - * panic if set up failed, this is the only platform timer on Moorestown. 281 - */ 282 - void __init apbt_time_init(void) 283 - { 284 - #ifdef CONFIG_SMP 285 - int i; 286 - struct sfi_timer_table_entry *p_mtmr; 287 - struct apbt_dev *adev; 288 - #endif 289 - 290 - if (apb_timer_block_enabled) 291 - return; 292 - apbt_set_mapping(); 293 - if (!apbt_virt_address) 294 - goto out_noapbt; 295 - /* 296 - * Read the frequency and check for a sane value, for ESL model 297 - * we extend the possible clock range to allow time scaling. 298 - */ 299 - 300 - if (apbt_freq < APBT_MIN_FREQ || apbt_freq > APBT_MAX_FREQ) { 301 - pr_debug("APBT has invalid freq 0x%lx\n", apbt_freq); 302 - goto out_noapbt; 303 - } 304 - if (apbt_clocksource_register()) { 305 - pr_debug("APBT has failed to register clocksource\n"); 306 - goto out_noapbt; 307 - } 308 - if (!apbt_clockevent_register()) 309 - apb_timer_block_enabled = 1; 310 - else { 311 - pr_debug("APBT has failed to register clockevent\n"); 312 - goto out_noapbt; 313 - } 314 - #ifdef CONFIG_SMP 315 - /* kernel cmdline disable apb timer, so we will use lapic timers */ 316 - if (intel_mid_timer_options == INTEL_MID_TIMER_LAPIC_APBT) { 317 - printk(KERN_INFO "apbt: disabled per cpu timer\n"); 318 - return; 319 - } 320 - pr_debug("%s: %d CPUs online\n", __func__, num_online_cpus()); 321 - if (num_possible_cpus() <= sfi_mtimer_num) 322 - apbt_num_timers_used = num_possible_cpus(); 323 - else 324 - apbt_num_timers_used = 1; 325 - pr_debug("%s: %d APB timers used\n", __func__, apbt_num_timers_used); 326 - 327 - /* here we set up per CPU timer data structure */ 328 - for (i = 0; i < apbt_num_timers_used; i++) { 329 - adev = &per_cpu(cpu_apbt_dev, i); 330 - adev->num = i; 331 - adev->cpu = i; 332 - p_mtmr = sfi_get_mtmr(i); 333 - if (p_mtmr) 334 - adev->irq = p_mtmr->irq; 335 - else 336 - printk(KERN_ERR "Failed to get timer for cpu %d\n", i); 337 - snprintf(adev->name, sizeof(adev->name) - 1, "apbt%d", i); 338 - } 339 - #endif 340 - 341 - return; 342 - 343 - out_noapbt: 344 - apbt_clear_mapping(); 345 - apb_timer_block_enabled = 0; 346 - panic("failed to enable APB timer\n"); 347 - }
+2 -2
arch/x86/kernel/apic/io_apic.c
··· 198 198 } 199 199 early_param("noapic", parse_noapic); 200 200 201 - /* Will be called in mpparse/acpi/sfi codes for saving IRQ info */ 201 + /* Will be called in mpparse/ACPI codes for saving IRQ info */ 202 202 void mp_save_irq(struct mpc_intsrc *m) 203 203 { 204 204 int i; ··· 2863 2863 2864 2864 /* 2865 2865 * If mp_register_ioapic() is called during early boot stage when 2866 - * walking ACPI/SFI/DT tables, it's too early to create irqdomain, 2866 + * walking ACPI/DT tables, it's too early to create irqdomain, 2867 2867 * we are still using bootmem allocator. So delay it to setup_IO_APIC(). 2868 2868 */ 2869 2869 if (hotplug) {
-2
arch/x86/kernel/setup.c
··· 16 16 #include <linux/memblock.h> 17 17 #include <linux/pci.h> 18 18 #include <linux/root_dev.h> 19 - #include <linux/sfi.h> 20 19 #include <linux/hugetlb.h> 21 20 #include <linux/tboot.h> 22 21 #include <linux/usb/xhci-dbgp.h> ··· 1184 1185 * Read APIC and some other early information from ACPI tables. 1185 1186 */ 1186 1187 acpi_boot_init(); 1187 - sfi_init(); 1188 1188 x86_dtb_init(); 1189 1189 1190 1190 /*
+16 -2
arch/x86/pci/intel_mid_pci.c
··· 28 28 #include <linux/io.h> 29 29 #include <linux/smp.h> 30 30 31 + #include <asm/cpu_device_id.h> 31 32 #include <asm/segment.h> 32 33 #include <asm/pci_x86.h> 33 34 #include <asm/hw_irq.h> 34 35 #include <asm/io_apic.h> 36 + #include <asm/intel-family.h> 35 37 #include <asm/intel-mid.h> 36 38 #include <asm/acpi.h> 37 39 ··· 142 140 * type1_access_ok - check whether to use type 1 143 141 * @bus: bus number 144 142 * @devfn: device & function in question 143 + * @reg: configuration register offset 145 144 * 146 145 * If the bus is on a Lincroft chip and it exists, or is not on a Lincroft at 147 146 * all, the we can go ahead with any reads & writes. If it's on a Lincroft, ··· 215 212 where, size, value); 216 213 } 217 214 215 + static const struct x86_cpu_id intel_mid_cpu_ids[] = { 216 + X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT_MID, NULL), 217 + {} 218 + }; 219 + 218 220 static int intel_mid_pci_irq_enable(struct pci_dev *dev) 219 221 { 222 + const struct x86_cpu_id *id; 220 223 struct irq_alloc_info info; 221 224 bool polarity_low; 225 + u16 model = 0; 222 226 int ret; 223 227 u8 gsi; 224 228 ··· 238 228 return ret; 239 229 } 240 230 241 - switch (intel_mid_identify_cpu()) { 242 - case INTEL_MID_CPU_CHIP_TANGIER: 231 + id = x86_match_cpu(intel_mid_cpu_ids); 232 + if (id) 233 + model = id->model; 234 + 235 + switch (model) { 236 + case INTEL_FAM6_ATOM_SILVERMONT_MID: 243 237 polarity_low = false; 244 238 245 239 /* Special treatment for IRQ0 */
+3 -3
arch/x86/pci/mmconfig-shared.c
··· 11 11 * themselves. 12 12 */ 13 13 14 + #include <linux/acpi.h> 14 15 #include <linux/pci.h> 15 16 #include <linux/init.h> 16 - #include <linux/sfi_acpi.h> 17 17 #include <linux/bitmap.h> 18 18 #include <linux/dmi.h> 19 19 #include <linux/slab.h> ··· 665 665 if (pci_mmcfg_check_hostbridge()) 666 666 known_bridge = 1; 667 667 else 668 - acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg); 668 + acpi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg); 669 669 __pci_mmcfg_init(1); 670 670 671 671 set_apei_filter(); ··· 683 683 684 684 /* MMCONFIG hasn't been enabled yet, try again */ 685 685 if (pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF) { 686 - acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg); 686 + acpi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg); 687 687 __pci_mmcfg_init(0); 688 688 } 689 689 }
-1
arch/x86/platform/Makefile
··· 10 10 obj-y += intel-quark/ 11 11 obj-y += olpc/ 12 12 obj-y += scx200/ 13 - obj-y += sfi/ 14 13 obj-y += ts5500/ 15 14 obj-y += uv/
+1 -6
arch/x86/platform/intel-mid/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - obj-$(CONFIG_X86_INTEL_MID) += intel-mid.o intel_mid_vrtc.o pwr.o 3 - 4 - # SFI specific code 5 - ifdef CONFIG_X86_INTEL_MID 6 - obj-$(CONFIG_SFI) += sfi.o device_libs/ 7 - endif 2 + obj-$(CONFIG_X86_INTEL_MID) += intel-mid.o pwr.o
-32
arch/x86/platform/intel-mid/device_libs/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - # Family-Level Interface Shim (FLIS) 3 - obj-$(subst m,y,$(CONFIG_PINCTRL_MERRIFIELD)) += platform_mrfld_pinctrl.o 4 - # SDHCI Devices 5 - obj-$(subst m,y,$(CONFIG_MMC_SDHCI_PCI)) += platform_mrfld_sd.o 6 - # WiFi + BT 7 - obj-$(subst m,y,$(CONFIG_BRCMFMAC_SDIO)) += platform_bcm43xx.o 8 - obj-$(subst m,y,$(CONFIG_BT_HCIUART_BCM)) += platform_bt.o 9 - # IPC Devices 10 - obj-$(subst m,y,$(CONFIG_MFD_INTEL_MSIC)) += platform_msic.o 11 - obj-$(subst m,y,$(CONFIG_SND_MFLD_MACHINE)) += platform_msic_audio.o 12 - obj-$(subst m,y,$(CONFIG_GPIO_MSIC)) += platform_msic_gpio.o 13 - obj-$(subst m,y,$(CONFIG_MFD_INTEL_MSIC)) += platform_msic_ocd.o 14 - obj-$(subst m,y,$(CONFIG_MFD_INTEL_MSIC)) += platform_msic_battery.o 15 - obj-$(subst m,y,$(CONFIG_INTEL_MID_POWER_BUTTON)) += platform_msic_power_btn.o 16 - obj-$(subst m,y,$(CONFIG_INTEL_MFLD_THERMAL)) += platform_msic_thermal.o 17 - # SPI Devices 18 - obj-$(subst m,y,$(CONFIG_SPI_SPIDEV)) += platform_mrfld_spidev.o 19 - # I2C Devices 20 - obj-$(subst m,y,$(CONFIG_SENSORS_EMC1403)) += platform_emc1403.o 21 - obj-$(subst m,y,$(CONFIG_SENSORS_LIS3LV02D)) += platform_lis331.o 22 - obj-$(subst m,y,$(CONFIG_MPU3050_I2C)) += platform_mpu3050.o 23 - obj-$(subst m,y,$(CONFIG_INPUT_BMA150)) += platform_bma023.o 24 - obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o 25 - # I2C GPIO Expanders 26 - obj-$(subst m,y,$(CONFIG_GPIO_PCA953X)) += platform_max7315.o 27 - obj-$(subst m,y,$(CONFIG_GPIO_PCA953X)) += platform_pcal9555a.o 28 - obj-$(subst m,y,$(CONFIG_GPIO_PCA953X)) += platform_tca6416.o 29 - # MISC Devices 30 - obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o 31 - obj-$(subst m,y,$(CONFIG_INTEL_MID_POWER_BUTTON)) += platform_mrfld_power_btn.o 32 - obj-$(subst m,y,$(CONFIG_RTC_DRV_CMOS)) += platform_mrfld_rtc.o
-101
arch/x86/platform/intel-mid/device_libs/platform_bcm43xx.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * platform_bcm43xx.c: bcm43xx platform data initialization file 4 - * 5 - * (C) Copyright 2016 Intel Corporation 6 - * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 7 - */ 8 - 9 - #include <linux/gpio/machine.h> 10 - #include <linux/platform_device.h> 11 - #include <linux/regulator/machine.h> 12 - #include <linux/regulator/fixed.h> 13 - #include <linux/sfi.h> 14 - 15 - #include <asm/intel-mid.h> 16 - 17 - #define WLAN_SFI_GPIO_IRQ_NAME "WLAN-interrupt" 18 - #define WLAN_SFI_GPIO_ENABLE_NAME "WLAN-enable" 19 - 20 - #define WLAN_DEV_NAME "0000:00:01.3" 21 - 22 - static struct regulator_consumer_supply bcm43xx_vmmc_supply = { 23 - .dev_name = WLAN_DEV_NAME, 24 - .supply = "vmmc", 25 - }; 26 - 27 - static struct regulator_init_data bcm43xx_vmmc_data = { 28 - .constraints = { 29 - .valid_ops_mask = REGULATOR_CHANGE_STATUS, 30 - }, 31 - .num_consumer_supplies = 1, 32 - .consumer_supplies = &bcm43xx_vmmc_supply, 33 - }; 34 - 35 - static struct fixed_voltage_config bcm43xx_vmmc = { 36 - .supply_name = "bcm43xx-vmmc-regulator", 37 - /* 38 - * Announce 2.0V here to be compatible with SDIO specification. The 39 - * real voltage and signaling are still 1.8V. 40 - */ 41 - .microvolts = 2000000, /* 1.8V */ 42 - .startup_delay = 250 * 1000, /* 250ms */ 43 - .enabled_at_boot = 0, /* disabled at boot */ 44 - .init_data = &bcm43xx_vmmc_data, 45 - }; 46 - 47 - static struct platform_device bcm43xx_vmmc_regulator = { 48 - .name = "reg-fixed-voltage", 49 - .id = PLATFORM_DEVID_AUTO, 50 - .dev = { 51 - .platform_data = &bcm43xx_vmmc, 52 - }, 53 - }; 54 - 55 - static struct gpiod_lookup_table bcm43xx_vmmc_gpio_table = { 56 - .dev_id = "reg-fixed-voltage.0", 57 - .table = { 58 - GPIO_LOOKUP("0000:00:0c.0", -1, NULL, GPIO_ACTIVE_LOW), 59 - {} 60 - }, 61 - }; 62 - 63 - static int __init bcm43xx_regulator_register(void) 64 - { 65 - struct gpiod_lookup_table *table = &bcm43xx_vmmc_gpio_table; 66 - struct gpiod_lookup *lookup = table->table; 67 - int ret; 68 - 69 - lookup[0].chip_hwnum = get_gpio_by_name(WLAN_SFI_GPIO_ENABLE_NAME); 70 - gpiod_add_lookup_table(table); 71 - 72 - ret = platform_device_register(&bcm43xx_vmmc_regulator); 73 - if (ret) { 74 - pr_err("%s: vmmc regulator register failed\n", __func__); 75 - return ret; 76 - } 77 - 78 - return 0; 79 - } 80 - 81 - static void __init *bcm43xx_platform_data(void *info) 82 - { 83 - int ret; 84 - 85 - ret = bcm43xx_regulator_register(); 86 - if (ret) 87 - return NULL; 88 - 89 - pr_info("Using generic wifi platform data\n"); 90 - 91 - /* For now it's empty */ 92 - return NULL; 93 - } 94 - 95 - static const struct devs_id bcm43xx_clk_vmmc_dev_id __initconst = { 96 - .name = "bcm43xx_clk_vmmc", 97 - .type = SFI_DEV_TYPE_SD, 98 - .get_platform_data = &bcm43xx_platform_data, 99 - }; 100 - 101 - sfi_device(bcm43xx_clk_vmmc_dev_id);
-16
arch/x86/platform/intel-mid/device_libs/platform_bma023.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * platform_bma023.c: bma023 platform data initialization file 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - */ 7 - 8 - #include <asm/intel-mid.h> 9 - 10 - static const struct devs_id bma023_dev_id __initconst = { 11 - .name = "bma023", 12 - .type = SFI_DEV_TYPE_I2C, 13 - .delay = 1, 14 - }; 15 - 16 - sfi_device(bma023_dev_id);
-101
arch/x86/platform/intel-mid/device_libs/platform_bt.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Bluetooth platform data initialization file 4 - * 5 - * (C) Copyright 2017 Intel Corporation 6 - * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 7 - */ 8 - 9 - #include <linux/gpio/machine.h> 10 - #include <linux/pci.h> 11 - #include <linux/platform_device.h> 12 - 13 - #include <asm/cpu_device_id.h> 14 - #include <asm/intel-family.h> 15 - #include <asm/intel-mid.h> 16 - 17 - struct bt_sfi_data { 18 - struct device *dev; 19 - const char *name; 20 - int (*setup)(struct bt_sfi_data *ddata); 21 - }; 22 - 23 - static struct gpiod_lookup_table tng_bt_sfi_gpio_table = { 24 - .dev_id = "hci_bcm", 25 - .table = { 26 - GPIO_LOOKUP("0000:00:0c.0", -1, "device-wakeup", GPIO_ACTIVE_HIGH), 27 - GPIO_LOOKUP("0000:00:0c.0", -1, "shutdown", GPIO_ACTIVE_HIGH), 28 - GPIO_LOOKUP("0000:00:0c.0", -1, "host-wakeup", GPIO_ACTIVE_HIGH), 29 - { }, 30 - }, 31 - }; 32 - 33 - #define TNG_BT_SFI_GPIO_DEVICE_WAKEUP "bt_wakeup" 34 - #define TNG_BT_SFI_GPIO_SHUTDOWN "BT-reset" 35 - #define TNG_BT_SFI_GPIO_HOST_WAKEUP "bt_uart_enable" 36 - 37 - static int __init tng_bt_sfi_setup(struct bt_sfi_data *ddata) 38 - { 39 - struct gpiod_lookup_table *table = &tng_bt_sfi_gpio_table; 40 - struct gpiod_lookup *lookup = table->table; 41 - struct pci_dev *pdev; 42 - 43 - /* Connected to /dev/ttyS0 */ 44 - pdev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(4, 1)); 45 - if (!pdev) 46 - return -ENODEV; 47 - 48 - ddata->dev = &pdev->dev; 49 - ddata->name = table->dev_id; 50 - 51 - lookup[0].chip_hwnum = get_gpio_by_name(TNG_BT_SFI_GPIO_DEVICE_WAKEUP); 52 - lookup[1].chip_hwnum = get_gpio_by_name(TNG_BT_SFI_GPIO_SHUTDOWN); 53 - lookup[2].chip_hwnum = get_gpio_by_name(TNG_BT_SFI_GPIO_HOST_WAKEUP); 54 - 55 - gpiod_add_lookup_table(table); 56 - return 0; 57 - } 58 - 59 - static struct bt_sfi_data tng_bt_sfi_data __initdata = { 60 - .setup = tng_bt_sfi_setup, 61 - }; 62 - 63 - static const struct x86_cpu_id bt_sfi_cpu_ids[] = { 64 - X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT_MID, &tng_bt_sfi_data), 65 - {} 66 - }; 67 - 68 - static int __init bt_sfi_init(void) 69 - { 70 - struct platform_device_info info; 71 - struct platform_device *pdev; 72 - const struct x86_cpu_id *id; 73 - struct bt_sfi_data *ddata; 74 - int ret; 75 - 76 - id = x86_match_cpu(bt_sfi_cpu_ids); 77 - if (!id) 78 - return -ENODEV; 79 - 80 - ddata = (struct bt_sfi_data *)id->driver_data; 81 - if (!ddata) 82 - return -ENODEV; 83 - 84 - ret = ddata->setup(ddata); 85 - if (ret) 86 - return ret; 87 - 88 - memset(&info, 0, sizeof(info)); 89 - info.fwnode = ddata->dev->fwnode; 90 - info.parent = ddata->dev; 91 - info.name = ddata->name; 92 - info.id = PLATFORM_DEVID_NONE; 93 - 94 - pdev = platform_device_register_full(&info); 95 - if (IS_ERR(pdev)) 96 - return PTR_ERR(pdev); 97 - 98 - dev_info(ddata->dev, "Registered Bluetooth device: %s\n", ddata->name); 99 - return 0; 100 - } 101 - device_initcall(bt_sfi_init);
-39
arch/x86/platform/intel-mid/device_libs/platform_emc1403.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * platform_emc1403.c: emc1403 platform data initialization file 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 7 - */ 8 - 9 - #include <linux/init.h> 10 - #include <linux/gpio.h> 11 - #include <linux/i2c.h> 12 - #include <asm/intel-mid.h> 13 - 14 - static void __init *emc1403_platform_data(void *info) 15 - { 16 - static short intr2nd_pdata; 17 - struct i2c_board_info *i2c_info = info; 18 - int intr = get_gpio_by_name("thermal_int"); 19 - int intr2nd = get_gpio_by_name("thermal_alert"); 20 - 21 - if (intr < 0) 22 - return NULL; 23 - if (intr2nd < 0) 24 - return NULL; 25 - 26 - i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET; 27 - intr2nd_pdata = intr2nd + INTEL_MID_IRQ_OFFSET; 28 - 29 - return &intr2nd_pdata; 30 - } 31 - 32 - static const struct devs_id emc1403_dev_id __initconst = { 33 - .name = "emc1403", 34 - .type = SFI_DEV_TYPE_I2C, 35 - .delay = 1, 36 - .get_platform_data = &emc1403_platform_data, 37 - }; 38 - 39 - sfi_device(emc1403_dev_id);
-81
arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * platform_gpio_keys.c: gpio_keys platform data initialization file 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 7 - */ 8 - 9 - #include <linux/input.h> 10 - #include <linux/init.h> 11 - #include <linux/kernel.h> 12 - #include <linux/gpio.h> 13 - #include <linux/gpio_keys.h> 14 - #include <linux/platform_device.h> 15 - #include <asm/intel-mid.h> 16 - 17 - #define DEVICE_NAME "gpio-keys" 18 - 19 - /* 20 - * we will search these buttons in SFI GPIO table (by name) 21 - * and register them dynamically. Please add all possible 22 - * buttons here, we will shrink them if no GPIO found. 23 - */ 24 - static struct gpio_keys_button gpio_button[] = { 25 - {KEY_POWER, -1, 1, "power_btn", EV_KEY, 0, 3000}, 26 - {KEY_PROG1, -1, 1, "prog_btn1", EV_KEY, 0, 20}, 27 - {KEY_PROG2, -1, 1, "prog_btn2", EV_KEY, 0, 20}, 28 - {SW_LID, -1, 1, "lid_switch", EV_SW, 0, 20}, 29 - {KEY_VOLUMEUP, -1, 1, "vol_up", EV_KEY, 0, 20}, 30 - {KEY_VOLUMEDOWN, -1, 1, "vol_down", EV_KEY, 0, 20}, 31 - {KEY_MUTE, -1, 1, "mute_enable", EV_KEY, 0, 20}, 32 - {KEY_VOLUMEUP, -1, 1, "volume_up", EV_KEY, 0, 20}, 33 - {KEY_VOLUMEDOWN, -1, 1, "volume_down", EV_KEY, 0, 20}, 34 - {KEY_CAMERA, -1, 1, "camera_full", EV_KEY, 0, 20}, 35 - {KEY_CAMERA_FOCUS, -1, 1, "camera_half", EV_KEY, 0, 20}, 36 - {SW_KEYPAD_SLIDE, -1, 1, "MagSw1", EV_SW, 0, 20}, 37 - {SW_KEYPAD_SLIDE, -1, 1, "MagSw2", EV_SW, 0, 20}, 38 - }; 39 - 40 - static struct gpio_keys_platform_data gpio_keys = { 41 - .buttons = gpio_button, 42 - .rep = 1, 43 - .nbuttons = -1, /* will fill it after search */ 44 - }; 45 - 46 - static struct platform_device pb_device = { 47 - .name = DEVICE_NAME, 48 - .id = -1, 49 - .dev = { 50 - .platform_data = &gpio_keys, 51 - }, 52 - }; 53 - 54 - /* 55 - * Shrink the non-existent buttons, register the gpio button 56 - * device if there is some 57 - */ 58 - static int __init pb_keys_init(void) 59 - { 60 - struct gpio_keys_button *gb = gpio_button; 61 - int i, good = 0; 62 - 63 - for (i = 0; i < ARRAY_SIZE(gpio_button); i++) { 64 - gb[i].gpio = get_gpio_by_name(gb[i].desc); 65 - pr_debug("info[%2d]: name = %s, gpio = %d\n", i, gb[i].desc, 66 - gb[i].gpio); 67 - if (gb[i].gpio < 0) 68 - continue; 69 - 70 - if (i != good) 71 - gb[good] = gb[i]; 72 - good++; 73 - } 74 - 75 - if (good) { 76 - gpio_keys.nbuttons = good; 77 - return platform_device_register(&pb_device); 78 - } 79 - return 0; 80 - } 81 - late_initcall(pb_keys_init);
-37
arch/x86/platform/intel-mid/device_libs/platform_lis331.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * platform_lis331.c: lis331 platform data initialization file 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 7 - */ 8 - 9 - #include <linux/i2c.h> 10 - #include <linux/gpio.h> 11 - #include <asm/intel-mid.h> 12 - 13 - static void __init *lis331dl_platform_data(void *info) 14 - { 15 - static short intr2nd_pdata; 16 - struct i2c_board_info *i2c_info = info; 17 - int intr = get_gpio_by_name("accel_int"); 18 - int intr2nd = get_gpio_by_name("accel_2"); 19 - 20 - if (intr < 0) 21 - return NULL; 22 - if (intr2nd < 0) 23 - return NULL; 24 - 25 - i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET; 26 - intr2nd_pdata = intr2nd + INTEL_MID_IRQ_OFFSET; 27 - 28 - return &intr2nd_pdata; 29 - } 30 - 31 - static const struct devs_id lis331dl_dev_id __initconst = { 32 - .name = "i2c_accel", 33 - .type = SFI_DEV_TYPE_I2C, 34 - .get_platform_data = &lis331dl_platform_data, 35 - }; 36 - 37 - sfi_device(lis331dl_dev_id);
-77
arch/x86/platform/intel-mid/device_libs/platform_max7315.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * platform_max7315.c: max7315 platform data initialization file 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 7 - */ 8 - 9 - #include <linux/init.h> 10 - #include <linux/gpio.h> 11 - #include <linux/i2c.h> 12 - #include <linux/platform_data/pca953x.h> 13 - #include <asm/intel-mid.h> 14 - 15 - #define MAX7315_NUM 2 16 - 17 - static void __init *max7315_platform_data(void *info) 18 - { 19 - static struct pca953x_platform_data max7315_pdata[MAX7315_NUM]; 20 - static int nr; 21 - struct pca953x_platform_data *max7315 = &max7315_pdata[nr]; 22 - struct i2c_board_info *i2c_info = info; 23 - int gpio_base, intr; 24 - char base_pin_name[SFI_NAME_LEN + 1]; 25 - char intr_pin_name[SFI_NAME_LEN + 1]; 26 - 27 - if (nr == MAX7315_NUM) { 28 - pr_err("too many max7315s, we only support %d\n", 29 - MAX7315_NUM); 30 - return NULL; 31 - } 32 - /* we have several max7315 on the board, we only need load several 33 - * instances of the same pca953x driver to cover them 34 - */ 35 - strcpy(i2c_info->type, "max7315"); 36 - if (nr++) { 37 - snprintf(base_pin_name, sizeof(base_pin_name), 38 - "max7315_%d_base", nr); 39 - snprintf(intr_pin_name, sizeof(intr_pin_name), 40 - "max7315_%d_int", nr); 41 - } else { 42 - strcpy(base_pin_name, "max7315_base"); 43 - strcpy(intr_pin_name, "max7315_int"); 44 - } 45 - 46 - gpio_base = get_gpio_by_name(base_pin_name); 47 - intr = get_gpio_by_name(intr_pin_name); 48 - 49 - if (gpio_base < 0) 50 - return NULL; 51 - max7315->gpio_base = gpio_base; 52 - if (intr != -1) { 53 - i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET; 54 - max7315->irq_base = gpio_base + INTEL_MID_IRQ_OFFSET; 55 - } else { 56 - i2c_info->irq = -1; 57 - max7315->irq_base = -1; 58 - } 59 - return max7315; 60 - } 61 - 62 - static const struct devs_id max7315_dev_id __initconst = { 63 - .name = "i2c_max7315", 64 - .type = SFI_DEV_TYPE_I2C, 65 - .delay = 1, 66 - .get_platform_data = &max7315_platform_data, 67 - }; 68 - 69 - static const struct devs_id max7315_2_dev_id __initconst = { 70 - .name = "i2c_max7315_2", 71 - .type = SFI_DEV_TYPE_I2C, 72 - .delay = 1, 73 - .get_platform_data = &max7315_platform_data, 74 - }; 75 - 76 - sfi_device(max7315_dev_id); 77 - sfi_device(max7315_2_dev_id);
-32
arch/x86/platform/intel-mid/device_libs/platform_mpu3050.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * platform_mpu3050.c: mpu3050 platform data initialization file 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 7 - */ 8 - 9 - #include <linux/gpio.h> 10 - #include <linux/i2c.h> 11 - #include <asm/intel-mid.h> 12 - 13 - static void *mpu3050_platform_data(void *info) 14 - { 15 - struct i2c_board_info *i2c_info = info; 16 - int intr = get_gpio_by_name("mpu3050_int"); 17 - 18 - if (intr < 0) 19 - return NULL; 20 - 21 - i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET; 22 - return NULL; 23 - } 24 - 25 - static const struct devs_id mpu3050_dev_id __initconst = { 26 - .name = "mpu3050", 27 - .type = SFI_DEV_TYPE_I2C, 28 - .delay = 1, 29 - .get_platform_data = &mpu3050_platform_data, 30 - }; 31 - 32 - sfi_device(mpu3050_dev_id);
-39
arch/x86/platform/intel-mid/device_libs/platform_mrfld_pinctrl.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Intel Merrifield FLIS platform device initialization file 4 - * 5 - * Copyright (C) 2016, Intel Corporation 6 - * 7 - * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 8 - */ 9 - 10 - #include <linux/init.h> 11 - #include <linux/ioport.h> 12 - #include <linux/platform_device.h> 13 - 14 - #include <asm/intel-mid.h> 15 - 16 - #define FLIS_BASE_ADDR 0xff0c0000 17 - #define FLIS_LENGTH 0x8000 18 - 19 - static struct resource mrfld_pinctrl_mmio_resource = { 20 - .start = FLIS_BASE_ADDR, 21 - .end = FLIS_BASE_ADDR + FLIS_LENGTH - 1, 22 - .flags = IORESOURCE_MEM, 23 - }; 24 - 25 - static struct platform_device mrfld_pinctrl_device = { 26 - .name = "pinctrl-merrifield", 27 - .id = PLATFORM_DEVID_NONE, 28 - .resource = &mrfld_pinctrl_mmio_resource, 29 - .num_resources = 1, 30 - }; 31 - 32 - static int __init mrfld_pinctrl_init(void) 33 - { 34 - if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER) 35 - return platform_device_register(&mrfld_pinctrl_device); 36 - 37 - return -ENODEV; 38 - } 39 - arch_initcall(mrfld_pinctrl_init);
-78
arch/x86/platform/intel-mid/device_libs/platform_mrfld_power_btn.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Intel Merrifield power button support 4 - * 5 - * (C) Copyright 2017 Intel Corporation 6 - * 7 - * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 8 - */ 9 - 10 - #include <linux/init.h> 11 - #include <linux/ioport.h> 12 - #include <linux/platform_device.h> 13 - #include <linux/sfi.h> 14 - 15 - #include <asm/intel-mid.h> 16 - #include <asm/intel_scu_ipc.h> 17 - 18 - static struct resource mrfld_power_btn_resources[] = { 19 - { 20 - .flags = IORESOURCE_IRQ, 21 - }, 22 - }; 23 - 24 - static struct platform_device mrfld_power_btn_dev = { 25 - .name = "msic_power_btn", 26 - .id = PLATFORM_DEVID_NONE, 27 - .num_resources = ARRAY_SIZE(mrfld_power_btn_resources), 28 - .resource = mrfld_power_btn_resources, 29 - }; 30 - 31 - static int mrfld_power_btn_scu_status_change(struct notifier_block *nb, 32 - unsigned long code, void *data) 33 - { 34 - if (code == SCU_DOWN) { 35 - platform_device_unregister(&mrfld_power_btn_dev); 36 - return 0; 37 - } 38 - 39 - return platform_device_register(&mrfld_power_btn_dev); 40 - } 41 - 42 - static struct notifier_block mrfld_power_btn_scu_notifier = { 43 - .notifier_call = mrfld_power_btn_scu_status_change, 44 - }; 45 - 46 - static int __init register_mrfld_power_btn(void) 47 - { 48 - if (intel_mid_identify_cpu() != INTEL_MID_CPU_CHIP_TANGIER) 49 - return -ENODEV; 50 - 51 - /* 52 - * We need to be sure that the SCU IPC is ready before 53 - * PMIC power button device can be registered: 54 - */ 55 - intel_scu_notifier_add(&mrfld_power_btn_scu_notifier); 56 - 57 - return 0; 58 - } 59 - arch_initcall(register_mrfld_power_btn); 60 - 61 - static void __init *mrfld_power_btn_platform_data(void *info) 62 - { 63 - struct resource *res = mrfld_power_btn_resources; 64 - struct sfi_device_table_entry *pentry = info; 65 - 66 - res->start = res->end = pentry->irq; 67 - return NULL; 68 - } 69 - 70 - static const struct devs_id mrfld_power_btn_dev_id __initconst = { 71 - .name = "bcove_power_btn", 72 - .type = SFI_DEV_TYPE_IPC, 73 - .delay = 1, 74 - .msic = 1, 75 - .get_platform_data = &mrfld_power_btn_platform_data, 76 - }; 77 - 78 - sfi_device(mrfld_power_btn_dev_id);
-44
arch/x86/platform/intel-mid/device_libs/platform_mrfld_rtc.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Intel Merrifield legacy RTC initialization file 4 - * 5 - * (C) Copyright 2017 Intel Corporation 6 - * 7 - * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 8 - */ 9 - 10 - #include <linux/init.h> 11 - 12 - #include <asm/hw_irq.h> 13 - #include <asm/intel-mid.h> 14 - #include <asm/io_apic.h> 15 - #include <asm/time.h> 16 - #include <asm/x86_init.h> 17 - 18 - static int __init mrfld_legacy_rtc_alloc_irq(void) 19 - { 20 - struct irq_alloc_info info; 21 - int ret; 22 - 23 - if (!x86_platform.legacy.rtc) 24 - return -ENODEV; 25 - 26 - ioapic_set_alloc_attr(&info, NUMA_NO_NODE, 1, 0); 27 - ret = mp_map_gsi_to_irq(RTC_IRQ, IOAPIC_MAP_ALLOC, &info); 28 - if (ret < 0) { 29 - pr_info("Failed to allocate RTC interrupt. Disabling RTC\n"); 30 - x86_platform.legacy.rtc = 0; 31 - return ret; 32 - } 33 - 34 - return 0; 35 - } 36 - 37 - static int __init mrfld_legacy_rtc_init(void) 38 - { 39 - if (intel_mid_identify_cpu() != INTEL_MID_CPU_CHIP_TANGIER) 40 - return -ENODEV; 41 - 42 - return mrfld_legacy_rtc_alloc_irq(); 43 - } 44 - arch_initcall(mrfld_legacy_rtc_init);
-43
arch/x86/platform/intel-mid/device_libs/platform_mrfld_sd.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * SDHCI platform data initilisation file 4 - * 5 - * (C) Copyright 2016 Intel Corporation 6 - * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 7 - */ 8 - 9 - #include <linux/init.h> 10 - #include <linux/pci.h> 11 - 12 - #include <linux/mmc/sdhci-pci-data.h> 13 - 14 - #include <asm/intel-mid.h> 15 - 16 - #define INTEL_MRFLD_SD 2 17 - #define INTEL_MRFLD_SD_CD_GPIO 77 18 - 19 - static struct sdhci_pci_data mrfld_sdhci_pci_data = { 20 - .rst_n_gpio = -EINVAL, 21 - .cd_gpio = INTEL_MRFLD_SD_CD_GPIO, 22 - }; 23 - 24 - static struct sdhci_pci_data * 25 - mrfld_sdhci_pci_get_data(struct pci_dev *pdev, int slotno) 26 - { 27 - unsigned int func = PCI_FUNC(pdev->devfn); 28 - 29 - if (func == INTEL_MRFLD_SD) 30 - return &mrfld_sdhci_pci_data; 31 - 32 - return NULL; 33 - } 34 - 35 - static int __init mrfld_sd_init(void) 36 - { 37 - if (intel_mid_identify_cpu() != INTEL_MID_CPU_CHIP_TANGIER) 38 - return -ENODEV; 39 - 40 - sdhci_pci_get_data = mrfld_sdhci_pci_get_data; 41 - return 0; 42 - } 43 - arch_initcall(mrfld_sd_init);
-50
arch/x86/platform/intel-mid/device_libs/platform_mrfld_spidev.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * spidev platform data initialization file 4 - * 5 - * (C) Copyright 2014, 2016 Intel Corporation 6 - * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 7 - * Dan O'Donovan <dan@emutex.com> 8 - */ 9 - 10 - #include <linux/err.h> 11 - #include <linux/init.h> 12 - #include <linux/sfi.h> 13 - #include <linux/spi/pxa2xx_spi.h> 14 - #include <linux/spi/spi.h> 15 - 16 - #include <asm/intel-mid.h> 17 - 18 - #define MRFLD_SPI_DEFAULT_DMA_BURST 8 19 - #define MRFLD_SPI_DEFAULT_TIMEOUT 500 20 - 21 - /* GPIO pin for spidev chipselect */ 22 - #define MRFLD_SPIDEV_GPIO_CS 111 23 - 24 - static struct pxa2xx_spi_chip spidev_spi_chip = { 25 - .dma_burst_size = MRFLD_SPI_DEFAULT_DMA_BURST, 26 - .timeout = MRFLD_SPI_DEFAULT_TIMEOUT, 27 - .gpio_cs = MRFLD_SPIDEV_GPIO_CS, 28 - }; 29 - 30 - static void __init *spidev_platform_data(void *info) 31 - { 32 - struct spi_board_info *spi_info = info; 33 - 34 - if (intel_mid_identify_cpu() != INTEL_MID_CPU_CHIP_TANGIER) 35 - return ERR_PTR(-ENODEV); 36 - 37 - spi_info->mode = SPI_MODE_0; 38 - spi_info->controller_data = &spidev_spi_chip; 39 - 40 - return NULL; 41 - } 42 - 43 - static const struct devs_id spidev_dev_id __initconst = { 44 - .name = "spidev", 45 - .type = SFI_DEV_TYPE_SPI, 46 - .delay = 0, 47 - .get_platform_data = &spidev_platform_data, 48 - }; 49 - 50 - sfi_device(spidev_dev_id);
-83
arch/x86/platform/intel-mid/device_libs/platform_msic.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * platform_msic.c: MSIC platform data initialization file 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 7 - */ 8 - 9 - #include <linux/kernel.h> 10 - #include <linux/interrupt.h> 11 - #include <linux/scatterlist.h> 12 - #include <linux/init.h> 13 - #include <linux/sfi.h> 14 - #include <linux/mfd/intel_msic.h> 15 - #include <asm/intel_scu_ipc.h> 16 - #include <asm/intel-mid.h> 17 - #include "platform_msic.h" 18 - 19 - struct intel_msic_platform_data msic_pdata; 20 - 21 - static struct resource msic_resources[] = { 22 - { 23 - .start = INTEL_MSIC_IRQ_PHYS_BASE, 24 - .end = INTEL_MSIC_IRQ_PHYS_BASE + 64 - 1, 25 - .flags = IORESOURCE_MEM, 26 - }, 27 - }; 28 - 29 - static struct platform_device msic_device = { 30 - .name = "intel_msic", 31 - .id = -1, 32 - .dev = { 33 - .platform_data = &msic_pdata, 34 - }, 35 - .num_resources = ARRAY_SIZE(msic_resources), 36 - .resource = msic_resources, 37 - }; 38 - 39 - static int msic_scu_status_change(struct notifier_block *nb, 40 - unsigned long code, void *data) 41 - { 42 - if (code == SCU_DOWN) { 43 - platform_device_unregister(&msic_device); 44 - return 0; 45 - } 46 - 47 - return platform_device_register(&msic_device); 48 - } 49 - 50 - static int __init msic_init(void) 51 - { 52 - static struct notifier_block msic_scu_notifier = { 53 - .notifier_call = msic_scu_status_change, 54 - }; 55 - 56 - /* 57 - * We need to be sure that the SCU IPC is ready before MSIC device 58 - * can be registered. 59 - */ 60 - if (intel_mid_has_msic()) 61 - intel_scu_notifier_add(&msic_scu_notifier); 62 - 63 - return 0; 64 - } 65 - arch_initcall(msic_init); 66 - 67 - /* 68 - * msic_generic_platform_data - sets generic platform data for the block 69 - * @info: pointer to the SFI device table entry for this block 70 - * @block: MSIC block 71 - * 72 - * Function sets IRQ number from the SFI table entry for given device to 73 - * the MSIC platform data. 74 - */ 75 - void *msic_generic_platform_data(void *info, enum intel_msic_block block) 76 - { 77 - struct sfi_device_table_entry *entry = info; 78 - 79 - BUG_ON(block < 0 || block >= INTEL_MSIC_BLOCK_LAST); 80 - msic_pdata.irq[block] = entry->irq; 81 - 82 - return NULL; 83 - }
-15
arch/x86/platform/intel-mid/device_libs/platform_msic.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * platform_msic.h: MSIC platform data header file 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 7 - */ 8 - #ifndef _PLATFORM_MSIC_H_ 9 - #define _PLATFORM_MSIC_H_ 10 - 11 - extern struct intel_msic_platform_data msic_pdata; 12 - 13 - void *msic_generic_platform_data(void *info, enum intel_msic_block block); 14 - 15 - #endif
-42
arch/x86/platform/intel-mid/device_libs/platform_msic_audio.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * platform_msic_audio.c: MSIC audio platform data initialization file 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 7 - */ 8 - 9 - #include <linux/kernel.h> 10 - #include <linux/interrupt.h> 11 - #include <linux/scatterlist.h> 12 - #include <linux/init.h> 13 - #include <linux/sfi.h> 14 - #include <linux/platform_device.h> 15 - #include <linux/mfd/intel_msic.h> 16 - #include <asm/intel-mid.h> 17 - 18 - #include "platform_msic.h" 19 - 20 - static void *msic_audio_platform_data(void *info) 21 - { 22 - struct platform_device *pdev; 23 - 24 - pdev = platform_device_register_simple("sst-platform", -1, NULL, 0); 25 - 26 - if (IS_ERR(pdev)) { 27 - pr_err("failed to create audio platform device\n"); 28 - return NULL; 29 - } 30 - 31 - return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_AUDIO); 32 - } 33 - 34 - static const struct devs_id msic_audio_dev_id __initconst = { 35 - .name = "msic_audio", 36 - .type = SFI_DEV_TYPE_IPC, 37 - .delay = 1, 38 - .msic = 1, 39 - .get_platform_data = &msic_audio_platform_data, 40 - }; 41 - 42 - sfi_device(msic_audio_dev_id);
-32
arch/x86/platform/intel-mid/device_libs/platform_msic_battery.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * platform_msic_battery.c: MSIC battery platform data initialization file 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 7 - */ 8 - 9 - #include <linux/kernel.h> 10 - #include <linux/interrupt.h> 11 - #include <linux/scatterlist.h> 12 - #include <linux/init.h> 13 - #include <linux/sfi.h> 14 - #include <linux/mfd/intel_msic.h> 15 - #include <asm/intel-mid.h> 16 - 17 - #include "platform_msic.h" 18 - 19 - static void __init *msic_battery_platform_data(void *info) 20 - { 21 - return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_BATTERY); 22 - } 23 - 24 - static const struct devs_id msic_battery_dev_id __initconst = { 25 - .name = "msic_battery", 26 - .type = SFI_DEV_TYPE_IPC, 27 - .delay = 1, 28 - .msic = 1, 29 - .get_platform_data = &msic_battery_platform_data, 30 - }; 31 - 32 - sfi_device(msic_battery_dev_id);
-43
arch/x86/platform/intel-mid/device_libs/platform_msic_gpio.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * platform_msic_gpio.c: MSIC GPIO platform data initialization file 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 7 - */ 8 - 9 - #include <linux/kernel.h> 10 - #include <linux/interrupt.h> 11 - #include <linux/scatterlist.h> 12 - #include <linux/sfi.h> 13 - #include <linux/init.h> 14 - #include <linux/gpio.h> 15 - #include <linux/mfd/intel_msic.h> 16 - #include <asm/intel-mid.h> 17 - 18 - #include "platform_msic.h" 19 - 20 - static void __init *msic_gpio_platform_data(void *info) 21 - { 22 - static struct intel_msic_gpio_pdata msic_gpio_pdata; 23 - 24 - int gpio = get_gpio_by_name("msic_gpio_base"); 25 - 26 - if (gpio < 0) 27 - return NULL; 28 - 29 - msic_gpio_pdata.gpio_base = gpio; 30 - msic_pdata.gpio = &msic_gpio_pdata; 31 - 32 - return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_GPIO); 33 - } 34 - 35 - static const struct devs_id msic_gpio_dev_id __initconst = { 36 - .name = "msic_gpio", 37 - .type = SFI_DEV_TYPE_IPC, 38 - .delay = 1, 39 - .msic = 1, 40 - .get_platform_data = &msic_gpio_platform_data, 41 - }; 42 - 43 - sfi_device(msic_gpio_dev_id);
-44
arch/x86/platform/intel-mid/device_libs/platform_msic_ocd.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * platform_msic_ocd.c: MSIC OCD platform data initialization file 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 7 - */ 8 - 9 - #include <linux/kernel.h> 10 - #include <linux/interrupt.h> 11 - #include <linux/scatterlist.h> 12 - #include <linux/sfi.h> 13 - #include <linux/init.h> 14 - #include <linux/gpio.h> 15 - #include <linux/mfd/intel_msic.h> 16 - #include <asm/intel-mid.h> 17 - 18 - #include "platform_msic.h" 19 - 20 - static void __init *msic_ocd_platform_data(void *info) 21 - { 22 - static struct intel_msic_ocd_pdata msic_ocd_pdata; 23 - int gpio; 24 - 25 - gpio = get_gpio_by_name("ocd_gpio"); 26 - 27 - if (gpio < 0) 28 - return NULL; 29 - 30 - msic_ocd_pdata.gpio = gpio; 31 - msic_pdata.ocd = &msic_ocd_pdata; 32 - 33 - return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_OCD); 34 - } 35 - 36 - static const struct devs_id msic_ocd_dev_id __initconst = { 37 - .name = "msic_ocd", 38 - .type = SFI_DEV_TYPE_IPC, 39 - .delay = 1, 40 - .msic = 1, 41 - .get_platform_data = &msic_ocd_platform_data, 42 - }; 43 - 44 - sfi_device(msic_ocd_dev_id);
-31
arch/x86/platform/intel-mid/device_libs/platform_msic_power_btn.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * platform_msic_power_btn.c: MSIC power btn platform data initialization file 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 7 - */ 8 - #include <linux/kernel.h> 9 - #include <linux/interrupt.h> 10 - #include <linux/scatterlist.h> 11 - #include <linux/sfi.h> 12 - #include <linux/init.h> 13 - #include <linux/mfd/intel_msic.h> 14 - #include <asm/intel-mid.h> 15 - 16 - #include "platform_msic.h" 17 - 18 - static void __init *msic_power_btn_platform_data(void *info) 19 - { 20 - return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_POWER_BTN); 21 - } 22 - 23 - static const struct devs_id msic_power_btn_dev_id __initconst = { 24 - .name = "msic_power_btn", 25 - .type = SFI_DEV_TYPE_IPC, 26 - .delay = 1, 27 - .msic = 1, 28 - .get_platform_data = &msic_power_btn_platform_data, 29 - }; 30 - 31 - sfi_device(msic_power_btn_dev_id);
-32
arch/x86/platform/intel-mid/device_libs/platform_msic_thermal.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * platform_msic_thermal.c: msic_thermal platform data initialization file 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 7 - */ 8 - 9 - #include <linux/input.h> 10 - #include <linux/init.h> 11 - #include <linux/kernel.h> 12 - #include <linux/gpio.h> 13 - #include <linux/platform_device.h> 14 - #include <linux/mfd/intel_msic.h> 15 - #include <asm/intel-mid.h> 16 - 17 - #include "platform_msic.h" 18 - 19 - static void __init *msic_thermal_platform_data(void *info) 20 - { 21 - return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_THERMAL); 22 - } 23 - 24 - static const struct devs_id msic_thermal_dev_id __initconst = { 25 - .name = "msic_thermal", 26 - .type = SFI_DEV_TYPE_IPC, 27 - .delay = 1, 28 - .msic = 1, 29 - .get_platform_data = &msic_thermal_platform_data, 30 - }; 31 - 32 - sfi_device(msic_thermal_dev_id);
-95
arch/x86/platform/intel-mid/device_libs/platform_pcal9555a.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * PCAL9555a platform data initialization file 4 - * 5 - * Copyright (C) 2016, Intel Corporation 6 - * 7 - * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 8 - * Dan O'Donovan <dan@emutex.com> 9 - */ 10 - 11 - #include <linux/gpio.h> 12 - #include <linux/init.h> 13 - #include <linux/i2c.h> 14 - #include <linux/platform_data/pca953x.h> 15 - #include <linux/sfi.h> 16 - 17 - #include <asm/intel-mid.h> 18 - 19 - #define PCAL9555A_NUM 4 20 - 21 - static struct pca953x_platform_data pcal9555a_pdata[PCAL9555A_NUM]; 22 - static int nr; 23 - 24 - static void __init *pcal9555a_platform_data(void *info) 25 - { 26 - struct i2c_board_info *i2c_info = info; 27 - char *type = i2c_info->type; 28 - struct pca953x_platform_data *pcal9555a; 29 - char base_pin_name[SFI_NAME_LEN + 1]; 30 - char intr_pin_name[SFI_NAME_LEN + 1]; 31 - int gpio_base, intr; 32 - 33 - snprintf(base_pin_name, sizeof(base_pin_name), "%s_base", type); 34 - snprintf(intr_pin_name, sizeof(intr_pin_name), "%s_int", type); 35 - 36 - gpio_base = get_gpio_by_name(base_pin_name); 37 - intr = get_gpio_by_name(intr_pin_name); 38 - 39 - /* Check if the SFI record valid */ 40 - if (gpio_base == -1) 41 - return NULL; 42 - 43 - if (nr >= PCAL9555A_NUM) { 44 - pr_err("%s: Too many instances, only %d supported\n", __func__, 45 - PCAL9555A_NUM); 46 - return NULL; 47 - } 48 - 49 - pcal9555a = &pcal9555a_pdata[nr++]; 50 - pcal9555a->gpio_base = gpio_base; 51 - 52 - if (intr >= 0) { 53 - i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET; 54 - pcal9555a->irq_base = gpio_base + INTEL_MID_IRQ_OFFSET; 55 - } else { 56 - i2c_info->irq = -1; 57 - pcal9555a->irq_base = -1; 58 - } 59 - 60 - strcpy(type, "pcal9555a"); 61 - return pcal9555a; 62 - } 63 - 64 - static const struct devs_id pcal9555a_1_dev_id __initconst = { 65 - .name = "pcal9555a-1", 66 - .type = SFI_DEV_TYPE_I2C, 67 - .delay = 1, 68 - .get_platform_data = &pcal9555a_platform_data, 69 - }; 70 - 71 - static const struct devs_id pcal9555a_2_dev_id __initconst = { 72 - .name = "pcal9555a-2", 73 - .type = SFI_DEV_TYPE_I2C, 74 - .delay = 1, 75 - .get_platform_data = &pcal9555a_platform_data, 76 - }; 77 - 78 - static const struct devs_id pcal9555a_3_dev_id __initconst = { 79 - .name = "pcal9555a-3", 80 - .type = SFI_DEV_TYPE_I2C, 81 - .delay = 1, 82 - .get_platform_data = &pcal9555a_platform_data, 83 - }; 84 - 85 - static const struct devs_id pcal9555a_4_dev_id __initconst = { 86 - .name = "pcal9555a-4", 87 - .type = SFI_DEV_TYPE_I2C, 88 - .delay = 1, 89 - .get_platform_data = &pcal9555a_platform_data, 90 - }; 91 - 92 - sfi_device(pcal9555a_1_dev_id); 93 - sfi_device(pcal9555a_2_dev_id); 94 - sfi_device(pcal9555a_3_dev_id); 95 - sfi_device(pcal9555a_4_dev_id);
-42
arch/x86/platform/intel-mid/device_libs/platform_tc35876x.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * platform_tc35876x.c: tc35876x platform data initialization file 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 7 - */ 8 - 9 - #include <linux/gpio/machine.h> 10 - #include <asm/intel-mid.h> 11 - 12 - static struct gpiod_lookup_table tc35876x_gpio_table = { 13 - .dev_id = "i2c_disp_brig", 14 - .table = { 15 - GPIO_LOOKUP("0000:00:0c.0", -1, "bridge-reset", GPIO_ACTIVE_HIGH), 16 - GPIO_LOOKUP("0000:00:0c.0", -1, "bl-en", GPIO_ACTIVE_HIGH), 17 - GPIO_LOOKUP("0000:00:0c.0", -1, "vadd", GPIO_ACTIVE_HIGH), 18 - { }, 19 - }, 20 - }; 21 - 22 - /*tc35876x DSI_LVDS bridge chip and panel platform data*/ 23 - static void *tc35876x_platform_data(void *data) 24 - { 25 - struct gpiod_lookup_table *table = &tc35876x_gpio_table; 26 - struct gpiod_lookup *lookup = table->table; 27 - 28 - lookup[0].chip_hwnum = get_gpio_by_name("LCMB_RXEN"); 29 - lookup[1].chip_hwnum = get_gpio_by_name("6S6P_BL_EN"); 30 - lookup[2].chip_hwnum = get_gpio_by_name("EN_VREG_LCD_V3P3"); 31 - gpiod_add_lookup_table(table); 32 - 33 - return NULL; 34 - } 35 - 36 - static const struct devs_id tc35876x_dev_id __initconst = { 37 - .name = "i2c_disp_brig", 38 - .type = SFI_DEV_TYPE_I2C, 39 - .get_platform_data = &tc35876x_platform_data, 40 - }; 41 - 42 - sfi_device(tc35876x_dev_id);
-53
arch/x86/platform/intel-mid/device_libs/platform_tca6416.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * platform_tca6416.c: tca6416 platform data initialization file 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 7 - */ 8 - 9 - #include <linux/platform_data/pca953x.h> 10 - #include <linux/i2c.h> 11 - #include <linux/gpio.h> 12 - #include <asm/intel-mid.h> 13 - 14 - #define TCA6416_NAME "tca6416" 15 - #define TCA6416_BASE "tca6416_base" 16 - #define TCA6416_INTR "tca6416_int" 17 - 18 - static void *tca6416_platform_data(void *info) 19 - { 20 - static struct pca953x_platform_data tca6416; 21 - struct i2c_board_info *i2c_info = info; 22 - int gpio_base, intr; 23 - char base_pin_name[SFI_NAME_LEN + 1]; 24 - char intr_pin_name[SFI_NAME_LEN + 1]; 25 - 26 - strcpy(i2c_info->type, TCA6416_NAME); 27 - strcpy(base_pin_name, TCA6416_BASE); 28 - strcpy(intr_pin_name, TCA6416_INTR); 29 - 30 - gpio_base = get_gpio_by_name(base_pin_name); 31 - intr = get_gpio_by_name(intr_pin_name); 32 - 33 - if (gpio_base < 0) 34 - return NULL; 35 - tca6416.gpio_base = gpio_base; 36 - if (intr >= 0) { 37 - i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET; 38 - tca6416.irq_base = gpio_base + INTEL_MID_IRQ_OFFSET; 39 - } else { 40 - i2c_info->irq = -1; 41 - tca6416.irq_base = -1; 42 - } 43 - return &tca6416; 44 - } 45 - 46 - static const struct devs_id tca6416_dev_id __initconst = { 47 - .name = "tca6416", 48 - .type = SFI_DEV_TYPE_I2C, 49 - .delay = 1, 50 - .get_platform_data = &tca6416_platform_data, 51 - }; 52 - 53 - sfi_device(tca6416_dev_id);
+9 -97
arch/x86/platform/intel-mid/intel-mid.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * intel-mid.c: Intel MID platform setup code 3 + * Intel MID platform setup code 4 4 * 5 - * (C) Copyright 2008, 2012 Intel Corporation 5 + * (C) Copyright 2008, 2012, 2021 Intel Corporation 6 6 * Author: Jacob Pan (jacob.jun.pan@intel.com) 7 7 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 8 8 */ ··· 14 14 #include <linux/interrupt.h> 15 15 #include <linux/regulator/machine.h> 16 16 #include <linux/scatterlist.h> 17 - #include <linux/sfi.h> 18 17 #include <linux/irq.h> 19 18 #include <linux/export.h> 20 19 #include <linux/notifier.h> ··· 24 25 #include <asm/apic.h> 25 26 #include <asm/io_apic.h> 26 27 #include <asm/intel-mid.h> 27 - #include <asm/intel_mid_vrtc.h> 28 28 #include <asm/io.h> 29 29 #include <asm/i8259.h> 30 30 #include <asm/intel_scu_ipc.h> 31 - #include <asm/apb_timer.h> 32 31 #include <asm/reboot.h> 33 32 34 - /* 35 - * the clockevent devices on Moorestown/Medfield can be APBT or LAPIC clock, 36 - * cmdline option x86_intel_mid_timer can be used to override the configuration 37 - * to prefer one or the other. 38 - * at runtime, there are basically three timer configurations: 39 - * 1. per cpu apbt clock only 40 - * 2. per cpu always-on lapic clocks only, this is Penwell/Medfield only 41 - * 3. per cpu lapic clock (C3STOP) and one apbt clock, with broadcast. 42 - * 43 - * by default (without cmdline option), platform code first detects cpu type 44 - * to see if we are on lincroft or penwell, then set up both lapic or apbt 45 - * clocks accordingly. 46 - * i.e. by default, medfield uses configuration #2, moorestown uses #1. 47 - * config #3 is supported but not recommended on medfield. 48 - * 49 - * rating and feature summary: 50 - * lapic (with C3STOP) --------- 100 51 - * apbt (always-on) ------------ 110 52 - * lapic (always-on,ARAT) ------ 150 53 - */ 54 - 55 - enum intel_mid_timer_options intel_mid_timer_options; 56 - 57 - enum intel_mid_cpu_type __intel_mid_cpu_chip; 58 - EXPORT_SYMBOL_GPL(__intel_mid_cpu_chip); 33 + #define IPCMSG_COLD_OFF 0x80 /* Only for Tangier */ 34 + #define IPCMSG_COLD_RESET 0xF1 59 35 60 36 static void intel_mid_power_off(void) 61 37 { ··· 38 64 intel_mid_pwr_power_off(); 39 65 40 66 /* Only for Tangier, the rest will ignore this command */ 41 - intel_scu_ipc_simple_command(IPCMSG_COLD_OFF, 1); 67 + intel_scu_ipc_dev_simple_command(NULL, IPCMSG_COLD_OFF, 1); 42 68 }; 43 69 44 70 static void intel_mid_reboot(void) 45 71 { 46 - intel_scu_ipc_simple_command(IPCMSG_COLD_RESET, 0); 47 - } 48 - 49 - static void __init intel_mid_setup_bp_timer(void) 50 - { 51 - apbt_time_init(); 52 - setup_boot_APIC_clock(); 72 + intel_scu_ipc_dev_simple_command(NULL, IPCMSG_COLD_RESET, 0); 53 73 } 54 74 55 75 static void __init intel_mid_time_init(void) 56 76 { 57 - sfi_table_parse(SFI_SIG_MTMR, NULL, NULL, sfi_parse_mtmr); 58 - 59 - switch (intel_mid_timer_options) { 60 - case INTEL_MID_TIMER_APBT_ONLY: 61 - break; 62 - case INTEL_MID_TIMER_LAPIC_APBT: 63 - /* Use apbt and local apic */ 64 - x86_init.timers.setup_percpu_clockev = intel_mid_setup_bp_timer; 65 - x86_cpuinit.setup_percpu_clockev = setup_secondary_APIC_clock; 66 - return; 67 - default: 68 - if (!boot_cpu_has(X86_FEATURE_ARAT)) 69 - break; 70 - /* Lapic only, no apbt */ 71 - x86_init.timers.setup_percpu_clockev = setup_boot_APIC_clock; 72 - x86_cpuinit.setup_percpu_clockev = setup_secondary_APIC_clock; 73 - return; 74 - } 75 - 76 - x86_init.timers.setup_percpu_clockev = apbt_time_init; 77 + /* Lapic only, no apbt */ 78 + x86_init.timers.setup_percpu_clockev = setup_boot_APIC_clock; 79 + x86_cpuinit.setup_percpu_clockev = setup_secondary_APIC_clock; 77 80 } 78 81 79 82 static void intel_mid_arch_setup(void) 80 83 { 81 - if (boot_cpu_data.x86 != 6) { 82 - pr_err("Unknown Intel MID CPU (%d:%d), default to Penwell\n", 83 - boot_cpu_data.x86, boot_cpu_data.x86_model); 84 - __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_PENWELL; 85 - goto out; 86 - } 87 - 88 84 switch (boot_cpu_data.x86_model) { 89 - case 0x35: 90 - __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_CLOVERVIEW; 91 - break; 92 85 case 0x3C: 93 86 case 0x4A: 94 - __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_TANGIER; 95 87 x86_platform.legacy.rtc = 1; 96 88 break; 97 - case 0x27: 98 89 default: 99 - __intel_mid_cpu_chip = INTEL_MID_CPU_CHIP_PENWELL; 100 90 break; 101 91 } 102 92 103 - out: 104 93 /* 105 94 * Intel MID platforms are using explicitly defined regulators. 106 95 * ··· 96 159 97 160 x86_init.timers.timer_init = intel_mid_time_init; 98 161 x86_init.timers.setup_percpu_clockev = x86_init_noop; 99 - x86_init.timers.wallclock_init = intel_mid_rtc_init; 100 162 101 163 x86_init.irqs.pre_vector_init = x86_init_noop; 102 164 103 165 x86_init.oem.arch_setup = intel_mid_arch_setup; 104 - 105 - x86_cpuinit.setup_percpu_clockev = apbt_setup_secondary_clock; 106 166 107 167 x86_platform.get_nmi_reason = intel_mid_get_nmi_reason; 108 168 ··· 122 188 x86_init.mpparse.get_smp_config = x86_init_uint_noop; 123 189 set_bit(MP_BUS_ISA, mp_bus_not_pci); 124 190 } 125 - 126 - /* 127 - * if user does not want to use per CPU apb timer, just give it a lower rating 128 - * than local apic timer and skip the late per cpu timer init. 129 - */ 130 - static inline int __init setup_x86_intel_mid_timer(char *arg) 131 - { 132 - if (!arg) 133 - return -EINVAL; 134 - 135 - if (strcmp("apbt_only", arg) == 0) 136 - intel_mid_timer_options = INTEL_MID_TIMER_APBT_ONLY; 137 - else if (strcmp("lapic_and_apbt", arg) == 0) 138 - intel_mid_timer_options = INTEL_MID_TIMER_LAPIC_APBT; 139 - else { 140 - pr_warn("X86 INTEL_MID timer option %s not recognised use x86_intel_mid_timer=apbt_only or lapic_and_apbt\n", 141 - arg); 142 - return -EINVAL; 143 - } 144 - return 0; 145 - } 146 - __setup("x86_intel_mid_timer=", setup_x86_intel_mid_timer);
-173
arch/x86/platform/intel-mid/intel_mid_vrtc.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * intel_mid_vrtc.c: Driver for virtual RTC device on Intel MID platform 4 - * 5 - * (C) Copyright 2009 Intel Corporation 6 - * 7 - * Note: 8 - * VRTC is emulated by system controller firmware, the real HW 9 - * RTC is located in the PMIC device. SCU FW shadows PMIC RTC 10 - * in a memory mapped IO space that is visible to the host IA 11 - * processor. 12 - * 13 - * This driver is based on RTC CMOS driver. 14 - */ 15 - 16 - #include <linux/kernel.h> 17 - #include <linux/export.h> 18 - #include <linux/init.h> 19 - #include <linux/sfi.h> 20 - #include <linux/platform_device.h> 21 - #include <linux/mc146818rtc.h> 22 - 23 - #include <asm/intel-mid.h> 24 - #include <asm/intel_mid_vrtc.h> 25 - #include <asm/time.h> 26 - #include <asm/fixmap.h> 27 - 28 - static unsigned char __iomem *vrtc_virt_base; 29 - 30 - unsigned char vrtc_cmos_read(unsigned char reg) 31 - { 32 - unsigned char retval; 33 - 34 - /* vRTC's registers range from 0x0 to 0xD */ 35 - if (reg > 0xd || !vrtc_virt_base) 36 - return 0xff; 37 - 38 - lock_cmos_prefix(reg); 39 - retval = __raw_readb(vrtc_virt_base + (reg << 2)); 40 - lock_cmos_suffix(reg); 41 - return retval; 42 - } 43 - EXPORT_SYMBOL_GPL(vrtc_cmos_read); 44 - 45 - void vrtc_cmos_write(unsigned char val, unsigned char reg) 46 - { 47 - if (reg > 0xd || !vrtc_virt_base) 48 - return; 49 - 50 - lock_cmos_prefix(reg); 51 - __raw_writeb(val, vrtc_virt_base + (reg << 2)); 52 - lock_cmos_suffix(reg); 53 - } 54 - EXPORT_SYMBOL_GPL(vrtc_cmos_write); 55 - 56 - void vrtc_get_time(struct timespec64 *now) 57 - { 58 - u8 sec, min, hour, mday, mon; 59 - unsigned long flags; 60 - u32 year; 61 - 62 - spin_lock_irqsave(&rtc_lock, flags); 63 - 64 - while ((vrtc_cmos_read(RTC_FREQ_SELECT) & RTC_UIP)) 65 - cpu_relax(); 66 - 67 - sec = vrtc_cmos_read(RTC_SECONDS); 68 - min = vrtc_cmos_read(RTC_MINUTES); 69 - hour = vrtc_cmos_read(RTC_HOURS); 70 - mday = vrtc_cmos_read(RTC_DAY_OF_MONTH); 71 - mon = vrtc_cmos_read(RTC_MONTH); 72 - year = vrtc_cmos_read(RTC_YEAR); 73 - 74 - spin_unlock_irqrestore(&rtc_lock, flags); 75 - 76 - /* vRTC YEAR reg contains the offset to 1972 */ 77 - year += 1972; 78 - 79 - pr_info("vRTC: sec: %d min: %d hour: %d day: %d " 80 - "mon: %d year: %d\n", sec, min, hour, mday, mon, year); 81 - 82 - now->tv_sec = mktime64(year, mon, mday, hour, min, sec); 83 - now->tv_nsec = 0; 84 - } 85 - 86 - int vrtc_set_mmss(const struct timespec64 *now) 87 - { 88 - unsigned long flags; 89 - struct rtc_time tm; 90 - int year; 91 - int retval = 0; 92 - 93 - rtc_time64_to_tm(now->tv_sec, &tm); 94 - if (!rtc_valid_tm(&tm) && tm.tm_year >= 72) { 95 - /* 96 - * tm.year is the number of years since 1900, and the 97 - * vrtc need the years since 1972. 98 - */ 99 - year = tm.tm_year - 72; 100 - spin_lock_irqsave(&rtc_lock, flags); 101 - vrtc_cmos_write(year, RTC_YEAR); 102 - vrtc_cmos_write(tm.tm_mon, RTC_MONTH); 103 - vrtc_cmos_write(tm.tm_mday, RTC_DAY_OF_MONTH); 104 - vrtc_cmos_write(tm.tm_hour, RTC_HOURS); 105 - vrtc_cmos_write(tm.tm_min, RTC_MINUTES); 106 - vrtc_cmos_write(tm.tm_sec, RTC_SECONDS); 107 - spin_unlock_irqrestore(&rtc_lock, flags); 108 - } else { 109 - pr_err("%s: Invalid vRTC value: write of %llx to vRTC failed\n", 110 - __func__, (s64)now->tv_sec); 111 - retval = -EINVAL; 112 - } 113 - return retval; 114 - } 115 - 116 - void __init intel_mid_rtc_init(void) 117 - { 118 - unsigned long vrtc_paddr; 119 - 120 - sfi_table_parse(SFI_SIG_MRTC, NULL, NULL, sfi_parse_mrtc); 121 - 122 - vrtc_paddr = sfi_mrtc_array[0].phys_addr; 123 - if (!sfi_mrtc_num || !vrtc_paddr) 124 - return; 125 - 126 - vrtc_virt_base = (void __iomem *)set_fixmap_offset_nocache(FIX_LNW_VRTC, 127 - vrtc_paddr); 128 - x86_platform.get_wallclock = vrtc_get_time; 129 - x86_platform.set_wallclock = vrtc_set_mmss; 130 - } 131 - 132 - /* 133 - * The Moorestown platform has a memory mapped virtual RTC device that emulates 134 - * the programming interface of the RTC. 135 - */ 136 - 137 - static struct resource vrtc_resources[] = { 138 - [0] = { 139 - .flags = IORESOURCE_MEM, 140 - }, 141 - [1] = { 142 - .flags = IORESOURCE_IRQ, 143 - } 144 - }; 145 - 146 - static struct platform_device vrtc_device = { 147 - .name = "rtc_mrst", 148 - .id = -1, 149 - .resource = vrtc_resources, 150 - .num_resources = ARRAY_SIZE(vrtc_resources), 151 - }; 152 - 153 - /* Register the RTC device if appropriate */ 154 - static int __init intel_mid_device_create(void) 155 - { 156 - /* No Moorestown, no device */ 157 - if (!intel_mid_identify_cpu()) 158 - return -ENODEV; 159 - /* No timer, no device */ 160 - if (!sfi_mrtc_num) 161 - return -ENODEV; 162 - 163 - /* iomem resource */ 164 - vrtc_resources[0].start = sfi_mrtc_array[0].phys_addr; 165 - vrtc_resources[0].end = sfi_mrtc_array[0].phys_addr + 166 - MRST_VRTC_MAP_SZ; 167 - /* irq resource */ 168 - vrtc_resources[1].start = sfi_mrtc_array[0].irq; 169 - vrtc_resources[1].end = sfi_mrtc_array[0].irq; 170 - 171 - return platform_device_register(&vrtc_device); 172 - } 173 - device_initcall(intel_mid_device_create);
-543
arch/x86/platform/intel-mid/sfi.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * intel_mid_sfi.c: Intel MID SFI initialization code 4 - * 5 - * (C) Copyright 2013 Intel Corporation 6 - * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com> 7 - */ 8 - 9 - #include <linux/init.h> 10 - #include <linux/kernel.h> 11 - #include <linux/interrupt.h> 12 - #include <linux/scatterlist.h> 13 - #include <linux/sfi.h> 14 - #include <linux/spi/spi.h> 15 - #include <linux/i2c.h> 16 - #include <linux/skbuff.h> 17 - #include <linux/gpio.h> 18 - #include <linux/gpio_keys.h> 19 - #include <linux/input.h> 20 - #include <linux/platform_device.h> 21 - #include <linux/irq.h> 22 - #include <linux/export.h> 23 - #include <linux/notifier.h> 24 - #include <linux/mmc/core.h> 25 - #include <linux/mmc/card.h> 26 - #include <linux/blkdev.h> 27 - 28 - #include <asm/setup.h> 29 - #include <asm/mpspec_def.h> 30 - #include <asm/hw_irq.h> 31 - #include <asm/apic.h> 32 - #include <asm/io_apic.h> 33 - #include <asm/intel-mid.h> 34 - #include <asm/intel_mid_vrtc.h> 35 - #include <asm/io.h> 36 - #include <asm/i8259.h> 37 - #include <asm/intel_scu_ipc.h> 38 - #include <asm/apb_timer.h> 39 - #include <asm/reboot.h> 40 - 41 - #define SFI_SIG_OEM0 "OEM0" 42 - #define MAX_IPCDEVS 24 43 - #define MAX_SCU_SPI 24 44 - #define MAX_SCU_I2C 24 45 - 46 - static struct platform_device *ipc_devs[MAX_IPCDEVS]; 47 - static struct spi_board_info *spi_devs[MAX_SCU_SPI]; 48 - static struct i2c_board_info *i2c_devs[MAX_SCU_I2C]; 49 - static struct sfi_gpio_table_entry *gpio_table; 50 - static struct sfi_timer_table_entry sfi_mtimer_array[SFI_MTMR_MAX_NUM]; 51 - static int ipc_next_dev; 52 - static int spi_next_dev; 53 - static int i2c_next_dev; 54 - static int i2c_bus[MAX_SCU_I2C]; 55 - static int gpio_num_entry; 56 - static u32 sfi_mtimer_usage[SFI_MTMR_MAX_NUM]; 57 - int sfi_mrtc_num; 58 - int sfi_mtimer_num; 59 - 60 - struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX]; 61 - EXPORT_SYMBOL_GPL(sfi_mrtc_array); 62 - 63 - struct blocking_notifier_head intel_scu_notifier = 64 - BLOCKING_NOTIFIER_INIT(intel_scu_notifier); 65 - EXPORT_SYMBOL_GPL(intel_scu_notifier); 66 - 67 - #define intel_mid_sfi_get_pdata(dev, priv) \ 68 - ((dev)->get_platform_data ? (dev)->get_platform_data(priv) : NULL) 69 - 70 - /* parse all the mtimer info to a static mtimer array */ 71 - int __init sfi_parse_mtmr(struct sfi_table_header *table) 72 - { 73 - struct sfi_table_simple *sb; 74 - struct sfi_timer_table_entry *pentry; 75 - struct mpc_intsrc mp_irq; 76 - int totallen; 77 - 78 - sb = (struct sfi_table_simple *)table; 79 - if (!sfi_mtimer_num) { 80 - sfi_mtimer_num = SFI_GET_NUM_ENTRIES(sb, 81 - struct sfi_timer_table_entry); 82 - pentry = (struct sfi_timer_table_entry *) sb->pentry; 83 - totallen = sfi_mtimer_num * sizeof(*pentry); 84 - memcpy(sfi_mtimer_array, pentry, totallen); 85 - } 86 - 87 - pr_debug("SFI MTIMER info (num = %d):\n", sfi_mtimer_num); 88 - pentry = sfi_mtimer_array; 89 - for (totallen = 0; totallen < sfi_mtimer_num; totallen++, pentry++) { 90 - pr_debug("timer[%d]: paddr = 0x%08x, freq = %dHz, irq = %d\n", 91 - totallen, (u32)pentry->phys_addr, 92 - pentry->freq_hz, pentry->irq); 93 - mp_irq.type = MP_INTSRC; 94 - mp_irq.irqtype = mp_INT; 95 - mp_irq.irqflag = MP_IRQTRIG_EDGE | MP_IRQPOL_ACTIVE_HIGH; 96 - mp_irq.srcbus = MP_BUS_ISA; 97 - mp_irq.srcbusirq = pentry->irq; /* IRQ */ 98 - mp_irq.dstapic = MP_APIC_ALL; 99 - mp_irq.dstirq = pentry->irq; 100 - mp_save_irq(&mp_irq); 101 - mp_map_gsi_to_irq(pentry->irq, IOAPIC_MAP_ALLOC, NULL); 102 - } 103 - 104 - return 0; 105 - } 106 - 107 - struct sfi_timer_table_entry *sfi_get_mtmr(int hint) 108 - { 109 - int i; 110 - if (hint < sfi_mtimer_num) { 111 - if (!sfi_mtimer_usage[hint]) { 112 - pr_debug("hint taken for timer %d irq %d\n", 113 - hint, sfi_mtimer_array[hint].irq); 114 - sfi_mtimer_usage[hint] = 1; 115 - return &sfi_mtimer_array[hint]; 116 - } 117 - } 118 - /* take the first timer available */ 119 - for (i = 0; i < sfi_mtimer_num;) { 120 - if (!sfi_mtimer_usage[i]) { 121 - sfi_mtimer_usage[i] = 1; 122 - return &sfi_mtimer_array[i]; 123 - } 124 - i++; 125 - } 126 - return NULL; 127 - } 128 - 129 - void sfi_free_mtmr(struct sfi_timer_table_entry *mtmr) 130 - { 131 - int i; 132 - for (i = 0; i < sfi_mtimer_num;) { 133 - if (mtmr->irq == sfi_mtimer_array[i].irq) { 134 - sfi_mtimer_usage[i] = 0; 135 - return; 136 - } 137 - i++; 138 - } 139 - } 140 - 141 - /* parse all the mrtc info to a global mrtc array */ 142 - int __init sfi_parse_mrtc(struct sfi_table_header *table) 143 - { 144 - struct sfi_table_simple *sb; 145 - struct sfi_rtc_table_entry *pentry; 146 - struct mpc_intsrc mp_irq; 147 - 148 - int totallen; 149 - 150 - sb = (struct sfi_table_simple *)table; 151 - if (!sfi_mrtc_num) { 152 - sfi_mrtc_num = SFI_GET_NUM_ENTRIES(sb, 153 - struct sfi_rtc_table_entry); 154 - pentry = (struct sfi_rtc_table_entry *)sb->pentry; 155 - totallen = sfi_mrtc_num * sizeof(*pentry); 156 - memcpy(sfi_mrtc_array, pentry, totallen); 157 - } 158 - 159 - pr_debug("SFI RTC info (num = %d):\n", sfi_mrtc_num); 160 - pentry = sfi_mrtc_array; 161 - for (totallen = 0; totallen < sfi_mrtc_num; totallen++, pentry++) { 162 - pr_debug("RTC[%d]: paddr = 0x%08x, irq = %d\n", 163 - totallen, (u32)pentry->phys_addr, pentry->irq); 164 - mp_irq.type = MP_INTSRC; 165 - mp_irq.irqtype = mp_INT; 166 - mp_irq.irqflag = MP_IRQTRIG_LEVEL | MP_IRQPOL_ACTIVE_LOW; 167 - mp_irq.srcbus = MP_BUS_ISA; 168 - mp_irq.srcbusirq = pentry->irq; /* IRQ */ 169 - mp_irq.dstapic = MP_APIC_ALL; 170 - mp_irq.dstirq = pentry->irq; 171 - mp_save_irq(&mp_irq); 172 - mp_map_gsi_to_irq(pentry->irq, IOAPIC_MAP_ALLOC, NULL); 173 - } 174 - return 0; 175 - } 176 - 177 - 178 - /* 179 - * Parsing GPIO table first, since the DEVS table will need this table 180 - * to map the pin name to the actual pin. 181 - */ 182 - static int __init sfi_parse_gpio(struct sfi_table_header *table) 183 - { 184 - struct sfi_table_simple *sb; 185 - struct sfi_gpio_table_entry *pentry; 186 - int num, i; 187 - 188 - if (gpio_table) 189 - return 0; 190 - sb = (struct sfi_table_simple *)table; 191 - num = SFI_GET_NUM_ENTRIES(sb, struct sfi_gpio_table_entry); 192 - pentry = (struct sfi_gpio_table_entry *)sb->pentry; 193 - 194 - gpio_table = kmemdup(pentry, num * sizeof(*pentry), GFP_KERNEL); 195 - if (!gpio_table) 196 - return -1; 197 - gpio_num_entry = num; 198 - 199 - pr_debug("GPIO pin info:\n"); 200 - for (i = 0; i < num; i++, pentry++) 201 - pr_debug("info[%2d]: controller = %16.16s, pin_name = %16.16s," 202 - " pin = %d\n", i, 203 - pentry->controller_name, 204 - pentry->pin_name, 205 - pentry->pin_no); 206 - return 0; 207 - } 208 - 209 - int get_gpio_by_name(const char *name) 210 - { 211 - struct sfi_gpio_table_entry *pentry = gpio_table; 212 - int i; 213 - 214 - if (!pentry) 215 - return -1; 216 - for (i = 0; i < gpio_num_entry; i++, pentry++) { 217 - if (!strncmp(name, pentry->pin_name, SFI_NAME_LEN)) 218 - return pentry->pin_no; 219 - } 220 - return -EINVAL; 221 - } 222 - 223 - static void __init intel_scu_ipc_device_register(struct platform_device *pdev) 224 - { 225 - if (ipc_next_dev == MAX_IPCDEVS) 226 - pr_err("too many SCU IPC devices"); 227 - else 228 - ipc_devs[ipc_next_dev++] = pdev; 229 - } 230 - 231 - static void __init intel_scu_spi_device_register(struct spi_board_info *sdev) 232 - { 233 - struct spi_board_info *new_dev; 234 - 235 - if (spi_next_dev == MAX_SCU_SPI) { 236 - pr_err("too many SCU SPI devices"); 237 - return; 238 - } 239 - 240 - new_dev = kzalloc(sizeof(*sdev), GFP_KERNEL); 241 - if (!new_dev) { 242 - pr_err("failed to alloc mem for delayed spi dev %s\n", 243 - sdev->modalias); 244 - return; 245 - } 246 - *new_dev = *sdev; 247 - 248 - spi_devs[spi_next_dev++] = new_dev; 249 - } 250 - 251 - static void __init intel_scu_i2c_device_register(int bus, 252 - struct i2c_board_info *idev) 253 - { 254 - struct i2c_board_info *new_dev; 255 - 256 - if (i2c_next_dev == MAX_SCU_I2C) { 257 - pr_err("too many SCU I2C devices"); 258 - return; 259 - } 260 - 261 - new_dev = kzalloc(sizeof(*idev), GFP_KERNEL); 262 - if (!new_dev) { 263 - pr_err("failed to alloc mem for delayed i2c dev %s\n", 264 - idev->type); 265 - return; 266 - } 267 - *new_dev = *idev; 268 - 269 - i2c_bus[i2c_next_dev] = bus; 270 - i2c_devs[i2c_next_dev++] = new_dev; 271 - } 272 - 273 - /* Called by IPC driver */ 274 - void intel_scu_devices_create(void) 275 - { 276 - int i; 277 - 278 - for (i = 0; i < ipc_next_dev; i++) 279 - platform_device_add(ipc_devs[i]); 280 - 281 - for (i = 0; i < spi_next_dev; i++) 282 - spi_register_board_info(spi_devs[i], 1); 283 - 284 - for (i = 0; i < i2c_next_dev; i++) { 285 - struct i2c_adapter *adapter; 286 - struct i2c_client *client; 287 - 288 - adapter = i2c_get_adapter(i2c_bus[i]); 289 - if (adapter) { 290 - client = i2c_new_client_device(adapter, i2c_devs[i]); 291 - if (IS_ERR(client)) 292 - pr_err("can't create i2c device %s\n", 293 - i2c_devs[i]->type); 294 - } else 295 - i2c_register_board_info(i2c_bus[i], i2c_devs[i], 1); 296 - } 297 - intel_scu_notifier_post(SCU_AVAILABLE, NULL); 298 - } 299 - EXPORT_SYMBOL_GPL(intel_scu_devices_create); 300 - 301 - /* Called by IPC driver */ 302 - void intel_scu_devices_destroy(void) 303 - { 304 - int i; 305 - 306 - intel_scu_notifier_post(SCU_DOWN, NULL); 307 - 308 - for (i = 0; i < ipc_next_dev; i++) 309 - platform_device_del(ipc_devs[i]); 310 - } 311 - EXPORT_SYMBOL_GPL(intel_scu_devices_destroy); 312 - 313 - static void __init install_irq_resource(struct platform_device *pdev, int irq) 314 - { 315 - /* Single threaded */ 316 - static struct resource res __initdata = { 317 - .name = "IRQ", 318 - .flags = IORESOURCE_IRQ, 319 - }; 320 - res.start = irq; 321 - platform_device_add_resources(pdev, &res, 1); 322 - } 323 - 324 - static void __init sfi_handle_ipc_dev(struct sfi_device_table_entry *pentry, 325 - struct devs_id *dev) 326 - { 327 - struct platform_device *pdev; 328 - void *pdata = NULL; 329 - 330 - pr_debug("IPC bus, name = %16.16s, irq = 0x%2x\n", 331 - pentry->name, pentry->irq); 332 - 333 - /* 334 - * We need to call platform init of IPC devices to fill misc_pdata 335 - * structure. It will be used in msic_init for initialization. 336 - */ 337 - pdata = intel_mid_sfi_get_pdata(dev, pentry); 338 - if (IS_ERR(pdata)) 339 - return; 340 - 341 - /* 342 - * On Medfield the platform device creation is handled by the MSIC 343 - * MFD driver so we don't need to do it here. 344 - */ 345 - if (dev->msic && intel_mid_has_msic()) 346 - return; 347 - 348 - pdev = platform_device_alloc(pentry->name, 0); 349 - if (pdev == NULL) { 350 - pr_err("out of memory for SFI platform device '%s'.\n", 351 - pentry->name); 352 - return; 353 - } 354 - install_irq_resource(pdev, pentry->irq); 355 - 356 - pdev->dev.platform_data = pdata; 357 - if (dev->delay) 358 - intel_scu_ipc_device_register(pdev); 359 - else 360 - platform_device_add(pdev); 361 - } 362 - 363 - static void __init sfi_handle_spi_dev(struct sfi_device_table_entry *pentry, 364 - struct devs_id *dev) 365 - { 366 - struct spi_board_info spi_info; 367 - void *pdata = NULL; 368 - 369 - memset(&spi_info, 0, sizeof(spi_info)); 370 - strncpy(spi_info.modalias, pentry->name, SFI_NAME_LEN); 371 - spi_info.irq = ((pentry->irq == (u8)0xff) ? 0 : pentry->irq); 372 - spi_info.bus_num = pentry->host_num; 373 - spi_info.chip_select = pentry->addr; 374 - spi_info.max_speed_hz = pentry->max_freq; 375 - pr_debug("SPI bus=%d, name=%16.16s, irq=0x%2x, max_freq=%d, cs=%d\n", 376 - spi_info.bus_num, 377 - spi_info.modalias, 378 - spi_info.irq, 379 - spi_info.max_speed_hz, 380 - spi_info.chip_select); 381 - 382 - pdata = intel_mid_sfi_get_pdata(dev, &spi_info); 383 - if (IS_ERR(pdata)) 384 - return; 385 - 386 - spi_info.platform_data = pdata; 387 - if (dev->delay) 388 - intel_scu_spi_device_register(&spi_info); 389 - else 390 - spi_register_board_info(&spi_info, 1); 391 - } 392 - 393 - static void __init sfi_handle_i2c_dev(struct sfi_device_table_entry *pentry, 394 - struct devs_id *dev) 395 - { 396 - struct i2c_board_info i2c_info; 397 - void *pdata = NULL; 398 - 399 - memset(&i2c_info, 0, sizeof(i2c_info)); 400 - strncpy(i2c_info.type, pentry->name, SFI_NAME_LEN); 401 - i2c_info.irq = ((pentry->irq == (u8)0xff) ? 0 : pentry->irq); 402 - i2c_info.addr = pentry->addr; 403 - pr_debug("I2C bus = %d, name = %16.16s, irq = 0x%2x, addr = 0x%x\n", 404 - pentry->host_num, 405 - i2c_info.type, 406 - i2c_info.irq, 407 - i2c_info.addr); 408 - pdata = intel_mid_sfi_get_pdata(dev, &i2c_info); 409 - i2c_info.platform_data = pdata; 410 - if (IS_ERR(pdata)) 411 - return; 412 - 413 - if (dev->delay) 414 - intel_scu_i2c_device_register(pentry->host_num, &i2c_info); 415 - else 416 - i2c_register_board_info(pentry->host_num, &i2c_info, 1); 417 - } 418 - 419 - static void __init sfi_handle_sd_dev(struct sfi_device_table_entry *pentry, 420 - struct devs_id *dev) 421 - { 422 - struct mid_sd_board_info sd_info; 423 - void *pdata; 424 - 425 - memset(&sd_info, 0, sizeof(sd_info)); 426 - strncpy(sd_info.name, pentry->name, SFI_NAME_LEN); 427 - sd_info.bus_num = pentry->host_num; 428 - sd_info.max_clk = pentry->max_freq; 429 - sd_info.addr = pentry->addr; 430 - pr_debug("SD bus = %d, name = %16.16s, max_clk = %d, addr = 0x%x\n", 431 - sd_info.bus_num, 432 - sd_info.name, 433 - sd_info.max_clk, 434 - sd_info.addr); 435 - pdata = intel_mid_sfi_get_pdata(dev, &sd_info); 436 - if (IS_ERR(pdata)) 437 - return; 438 - 439 - /* Nothing we can do with this for now */ 440 - sd_info.platform_data = pdata; 441 - 442 - pr_debug("Successfully registered %16.16s", sd_info.name); 443 - } 444 - 445 - extern struct devs_id *const __x86_intel_mid_dev_start[], 446 - *const __x86_intel_mid_dev_end[]; 447 - 448 - static struct devs_id __init *get_device_id(u8 type, char *name) 449 - { 450 - struct devs_id *const *dev_table; 451 - 452 - for (dev_table = __x86_intel_mid_dev_start; 453 - dev_table < __x86_intel_mid_dev_end; dev_table++) { 454 - struct devs_id *dev = *dev_table; 455 - if (dev->type == type && 456 - !strncmp(dev->name, name, SFI_NAME_LEN)) { 457 - return dev; 458 - } 459 - } 460 - 461 - return NULL; 462 - } 463 - 464 - static int __init sfi_parse_devs(struct sfi_table_header *table) 465 - { 466 - struct sfi_table_simple *sb; 467 - struct sfi_device_table_entry *pentry; 468 - struct devs_id *dev = NULL; 469 - int num, i, ret; 470 - int polarity; 471 - struct irq_alloc_info info; 472 - 473 - sb = (struct sfi_table_simple *)table; 474 - num = SFI_GET_NUM_ENTRIES(sb, struct sfi_device_table_entry); 475 - pentry = (struct sfi_device_table_entry *)sb->pentry; 476 - 477 - for (i = 0; i < num; i++, pentry++) { 478 - int irq = pentry->irq; 479 - 480 - if (irq != (u8)0xff) { /* native RTE case */ 481 - /* these SPI2 devices are not exposed to system as PCI 482 - * devices, but they have separate RTE entry in IOAPIC 483 - * so we have to enable them one by one here 484 - */ 485 - if (intel_mid_identify_cpu() == 486 - INTEL_MID_CPU_CHIP_TANGIER) { 487 - if (!strncmp(pentry->name, "r69001-ts-i2c", 13)) 488 - /* active low */ 489 - polarity = 1; 490 - else if (!strncmp(pentry->name, 491 - "synaptics_3202", 14)) 492 - /* active low */ 493 - polarity = 1; 494 - else if (irq == 41) 495 - /* fast_int_1 */ 496 - polarity = 1; 497 - else 498 - /* active high */ 499 - polarity = 0; 500 - } else { 501 - /* PNW and CLV go with active low */ 502 - polarity = 1; 503 - } 504 - 505 - ioapic_set_alloc_attr(&info, NUMA_NO_NODE, 1, polarity); 506 - ret = mp_map_gsi_to_irq(irq, IOAPIC_MAP_ALLOC, &info); 507 - WARN_ON(ret < 0); 508 - } 509 - 510 - dev = get_device_id(pentry->type, pentry->name); 511 - 512 - if (!dev) 513 - continue; 514 - 515 - switch (pentry->type) { 516 - case SFI_DEV_TYPE_IPC: 517 - sfi_handle_ipc_dev(pentry, dev); 518 - break; 519 - case SFI_DEV_TYPE_SPI: 520 - sfi_handle_spi_dev(pentry, dev); 521 - break; 522 - case SFI_DEV_TYPE_I2C: 523 - sfi_handle_i2c_dev(pentry, dev); 524 - break; 525 - case SFI_DEV_TYPE_SD: 526 - sfi_handle_sd_dev(pentry, dev); 527 - break; 528 - case SFI_DEV_TYPE_UART: 529 - case SFI_DEV_TYPE_HSI: 530 - default: 531 - break; 532 - } 533 - } 534 - return 0; 535 - } 536 - 537 - static int __init intel_mid_platform_init(void) 538 - { 539 - sfi_table_parse(SFI_SIG_GPIO, NULL, NULL, sfi_parse_gpio); 540 - sfi_table_parse(SFI_SIG_DEVS, NULL, NULL, sfi_parse_devs); 541 - return 0; 542 - } 543 - arch_initcall(intel_mid_platform_init);
-2
arch/x86/platform/sfi/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - obj-$(CONFIG_SFI) += sfi.o
-100
arch/x86/platform/sfi/sfi.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * sfi.c - x86 architecture SFI support. 4 - * 5 - * Copyright (c) 2009, Intel Corporation. 6 - */ 7 - 8 - #define KMSG_COMPONENT "SFI" 9 - #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 10 - 11 - #include <linux/acpi.h> 12 - #include <linux/init.h> 13 - #include <linux/sfi.h> 14 - #include <linux/io.h> 15 - 16 - #include <asm/irqdomain.h> 17 - #include <asm/io_apic.h> 18 - #include <asm/mpspec.h> 19 - #include <asm/setup.h> 20 - #include <asm/apic.h> 21 - 22 - #ifdef CONFIG_X86_LOCAL_APIC 23 - static unsigned long sfi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; 24 - 25 - /* All CPUs enumerated by SFI must be present and enabled */ 26 - static void __init mp_sfi_register_lapic(u8 id) 27 - { 28 - if (MAX_LOCAL_APIC - id <= 0) { 29 - pr_warn("Processor #%d invalid (max %d)\n", id, MAX_LOCAL_APIC); 30 - return; 31 - } 32 - 33 - pr_info("registering lapic[%d]\n", id); 34 - 35 - generic_processor_info(id, GET_APIC_VERSION(apic_read(APIC_LVR))); 36 - } 37 - 38 - static int __init sfi_parse_cpus(struct sfi_table_header *table) 39 - { 40 - struct sfi_table_simple *sb; 41 - struct sfi_cpu_table_entry *pentry; 42 - int i; 43 - int cpu_num; 44 - 45 - sb = (struct sfi_table_simple *)table; 46 - cpu_num = SFI_GET_NUM_ENTRIES(sb, struct sfi_cpu_table_entry); 47 - pentry = (struct sfi_cpu_table_entry *)sb->pentry; 48 - 49 - for (i = 0; i < cpu_num; i++) { 50 - mp_sfi_register_lapic(pentry->apic_id); 51 - pentry++; 52 - } 53 - 54 - smp_found_config = 1; 55 - return 0; 56 - } 57 - #endif /* CONFIG_X86_LOCAL_APIC */ 58 - 59 - #ifdef CONFIG_X86_IO_APIC 60 - 61 - static int __init sfi_parse_ioapic(struct sfi_table_header *table) 62 - { 63 - struct sfi_table_simple *sb; 64 - struct sfi_apic_table_entry *pentry; 65 - int i, num; 66 - struct ioapic_domain_cfg cfg = { 67 - .type = IOAPIC_DOMAIN_STRICT, 68 - .ops = &mp_ioapic_irqdomain_ops, 69 - }; 70 - 71 - sb = (struct sfi_table_simple *)table; 72 - num = SFI_GET_NUM_ENTRIES(sb, struct sfi_apic_table_entry); 73 - pentry = (struct sfi_apic_table_entry *)sb->pentry; 74 - 75 - for (i = 0; i < num; i++) { 76 - mp_register_ioapic(i, pentry->phys_addr, gsi_top, &cfg); 77 - pentry++; 78 - } 79 - 80 - WARN(pic_mode, KERN_WARNING 81 - "SFI: pic_mod shouldn't be 1 when IOAPIC table is present\n"); 82 - pic_mode = 0; 83 - return 0; 84 - } 85 - #endif /* CONFIG_X86_IO_APIC */ 86 - 87 - /* 88 - * sfi_platform_init(): register lapics & io-apics 89 - */ 90 - int __init sfi_platform_init(void) 91 - { 92 - #ifdef CONFIG_X86_LOCAL_APIC 93 - register_lapic_address(sfi_lapic_addr); 94 - sfi_table_parse(SFI_SIG_CPUS, NULL, NULL, sfi_parse_cpus); 95 - #endif 96 - #ifdef CONFIG_X86_IO_APIC 97 - sfi_table_parse(SFI_SIG_APIC, NULL, NULL, sfi_parse_ioapic); 98 - #endif 99 - return 0; 100 - }
+1 -1
drivers/Makefile
··· 27 27 obj-y += char/ipmi/ 28 28 29 29 obj-$(CONFIG_ACPI) += acpi/ 30 - obj-$(CONFIG_SFI) += sfi/ 30 + 31 31 # PnP must come after ACPI since it will eventually need to check if acpi 32 32 # was used and do nothing if so 33 33 obj-$(CONFIG_PNP) += pnp/
-10
drivers/cpufreq/Kconfig.x86
··· 62 62 By enabling this option the acpi_cpufreq driver provides the old 63 63 entry in addition to the new boost ones, for compatibility reasons. 64 64 65 - config X86_SFI_CPUFREQ 66 - tristate "SFI Performance-States driver" 67 - depends on X86_INTEL_MID && SFI 68 - help 69 - This adds a CPUFreq driver for some Silvermont based Intel Atom 70 - architectures like Z34xx and Z35xx which enumerate processor 71 - performance states through SFI. 72 - 73 - If in doubt, say N. 74 - 75 65 config ELAN_CPUFREQ 76 66 tristate "AMD Elan SC400 and SC410" 77 67 depends on MELAN
-1
drivers/cpufreq/Makefile
··· 43 43 obj-$(CONFIG_X86_CPUFREQ_NFORCE2) += cpufreq-nforce2.o 44 44 obj-$(CONFIG_X86_INTEL_PSTATE) += intel_pstate.o 45 45 obj-$(CONFIG_X86_AMD_FREQ_SENSITIVITY) += amd_freq_sensitivity.o 46 - obj-$(CONFIG_X86_SFI_CPUFREQ) += sfi-cpufreq.o 47 46 48 47 ################################################################################## 49 48 # ARM SoC drivers
-127
drivers/cpufreq/sfi-cpufreq.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * SFI Performance States Driver 4 - * 5 - * Author: Vishwesh M Rudramuni <vishwesh.m.rudramuni@intel.com> 6 - * Author: Srinidhi Kasagar <srinidhi.kasagar@intel.com> 7 - */ 8 - 9 - #include <linux/cpufreq.h> 10 - #include <linux/init.h> 11 - #include <linux/kernel.h> 12 - #include <linux/module.h> 13 - #include <linux/sfi.h> 14 - #include <linux/slab.h> 15 - #include <linux/smp.h> 16 - 17 - #include <asm/msr.h> 18 - 19 - static struct cpufreq_frequency_table *freq_table; 20 - static struct sfi_freq_table_entry *sfi_cpufreq_array; 21 - static int num_freq_table_entries; 22 - 23 - static int sfi_parse_freq(struct sfi_table_header *table) 24 - { 25 - struct sfi_table_simple *sb; 26 - struct sfi_freq_table_entry *pentry; 27 - int totallen; 28 - 29 - sb = (struct sfi_table_simple *)table; 30 - num_freq_table_entries = SFI_GET_NUM_ENTRIES(sb, 31 - struct sfi_freq_table_entry); 32 - if (num_freq_table_entries <= 1) { 33 - pr_err("No p-states discovered\n"); 34 - return -ENODEV; 35 - } 36 - 37 - pentry = (struct sfi_freq_table_entry *)sb->pentry; 38 - totallen = num_freq_table_entries * sizeof(*pentry); 39 - 40 - sfi_cpufreq_array = kmemdup(pentry, totallen, GFP_KERNEL); 41 - if (!sfi_cpufreq_array) 42 - return -ENOMEM; 43 - 44 - return 0; 45 - } 46 - 47 - static int sfi_cpufreq_target(struct cpufreq_policy *policy, unsigned int index) 48 - { 49 - unsigned int next_perf_state = 0; /* Index into perf table */ 50 - u32 lo, hi; 51 - 52 - next_perf_state = policy->freq_table[index].driver_data; 53 - 54 - rdmsr_on_cpu(policy->cpu, MSR_IA32_PERF_CTL, &lo, &hi); 55 - lo = (lo & ~INTEL_PERF_CTL_MASK) | 56 - ((u32) sfi_cpufreq_array[next_perf_state].ctrl_val & 57 - INTEL_PERF_CTL_MASK); 58 - wrmsr_on_cpu(policy->cpu, MSR_IA32_PERF_CTL, lo, hi); 59 - 60 - return 0; 61 - } 62 - 63 - static int sfi_cpufreq_cpu_init(struct cpufreq_policy *policy) 64 - { 65 - policy->shared_type = CPUFREQ_SHARED_TYPE_HW; 66 - policy->cpuinfo.transition_latency = 100000; /* 100us */ 67 - policy->freq_table = freq_table; 68 - 69 - return 0; 70 - } 71 - 72 - static struct cpufreq_driver sfi_cpufreq_driver = { 73 - .flags = CPUFREQ_CONST_LOOPS, 74 - .verify = cpufreq_generic_frequency_table_verify, 75 - .target_index = sfi_cpufreq_target, 76 - .init = sfi_cpufreq_cpu_init, 77 - .name = "sfi-cpufreq", 78 - .attr = cpufreq_generic_attr, 79 - }; 80 - 81 - static int __init sfi_cpufreq_init(void) 82 - { 83 - int ret, i; 84 - 85 - /* parse the freq table from SFI */ 86 - ret = sfi_table_parse(SFI_SIG_FREQ, NULL, NULL, sfi_parse_freq); 87 - if (ret) 88 - return ret; 89 - 90 - freq_table = kcalloc(num_freq_table_entries + 1, sizeof(*freq_table), 91 - GFP_KERNEL); 92 - if (!freq_table) { 93 - ret = -ENOMEM; 94 - goto err_free_array; 95 - } 96 - 97 - for (i = 0; i < num_freq_table_entries; i++) { 98 - freq_table[i].driver_data = i; 99 - freq_table[i].frequency = sfi_cpufreq_array[i].freq_mhz * 1000; 100 - } 101 - freq_table[i].frequency = CPUFREQ_TABLE_END; 102 - 103 - ret = cpufreq_register_driver(&sfi_cpufreq_driver); 104 - if (ret) 105 - goto err_free_tbl; 106 - 107 - return ret; 108 - 109 - err_free_tbl: 110 - kfree(freq_table); 111 - err_free_array: 112 - kfree(sfi_cpufreq_array); 113 - return ret; 114 - } 115 - late_initcall(sfi_cpufreq_init); 116 - 117 - static void __exit sfi_cpufreq_exit(void) 118 - { 119 - cpufreq_unregister_driver(&sfi_cpufreq_driver); 120 - kfree(freq_table); 121 - kfree(sfi_cpufreq_array); 122 - } 123 - module_exit(sfi_cpufreq_exit); 124 - 125 - MODULE_AUTHOR("Vishwesh M Rudramuni <vishwesh.m.rudramuni@intel.com>"); 126 - MODULE_DESCRIPTION("SFI Performance-States Driver"); 127 - MODULE_LICENSE("GPL");
-9
drivers/mfd/Kconfig
··· 659 659 I2C, SPI and HS-UART starting from Intel Sunrisepoint (Intel Skylake 660 660 PCH) in PCI mode. 661 661 662 - config MFD_INTEL_MSIC 663 - bool "Intel MSIC" 664 - depends on INTEL_SCU 665 - select MFD_CORE 666 - help 667 - Select this option to enable access to Intel MSIC (Avatele 668 - Passage) chip. This chip embeds audio, battery, GPIO, etc. 669 - devices used in Intel Medfield platforms. 670 - 671 662 config MFD_INTEL_PMC_BXT 672 663 tristate "Intel PMC Driver for Broxton" 673 664 depends on X86
-1
drivers/mfd/Makefile
··· 214 214 obj-$(CONFIG_MFD_INTEL_LPSS) += intel-lpss.o 215 215 obj-$(CONFIG_MFD_INTEL_LPSS_PCI) += intel-lpss-pci.o 216 216 obj-$(CONFIG_MFD_INTEL_LPSS_ACPI) += intel-lpss-acpi.o 217 - obj-$(CONFIG_MFD_INTEL_MSIC) += intel_msic.o 218 217 obj-$(CONFIG_MFD_INTEL_PMC_BXT) += intel_pmc_bxt.o 219 218 obj-$(CONFIG_MFD_INTEL_PMT) += intel_pmt.o 220 219 obj-$(CONFIG_MFD_PALMAS) += palmas.o
-425
drivers/mfd/intel_msic.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Driver for Intel MSIC 4 - * 5 - * Copyright (C) 2011, Intel Corporation 6 - * Author: Mika Westerberg <mika.westerberg@linux.intel.com> 7 - */ 8 - 9 - #include <linux/err.h> 10 - #include <linux/gpio.h> 11 - #include <linux/io.h> 12 - #include <linux/init.h> 13 - #include <linux/mfd/core.h> 14 - #include <linux/mfd/intel_msic.h> 15 - #include <linux/platform_device.h> 16 - #include <linux/slab.h> 17 - 18 - #include <asm/intel_scu_ipc.h> 19 - 20 - #define MSIC_VENDOR(id) ((id >> 6) & 3) 21 - #define MSIC_VERSION(id) (id & 0x3f) 22 - #define MSIC_MAJOR(id) ('A' + ((id >> 3) & 7)) 23 - #define MSIC_MINOR(id) (id & 7) 24 - 25 - /* 26 - * MSIC interrupt tree is readable from SRAM at INTEL_MSIC_IRQ_PHYS_BASE. 27 - * Since IRQ block starts from address 0x002 we need to subtract that from 28 - * the actual IRQ status register address. 29 - */ 30 - #define MSIC_IRQ_STATUS(x) (INTEL_MSIC_IRQ_PHYS_BASE + ((x) - 2)) 31 - #define MSIC_IRQ_STATUS_ACCDET MSIC_IRQ_STATUS(INTEL_MSIC_ACCDET) 32 - 33 - /* 34 - * The SCU hardware has limitation of 16 bytes per read/write buffer on 35 - * Medfield. 36 - */ 37 - #define SCU_IPC_RWBUF_LIMIT 16 38 - 39 - /** 40 - * struct intel_msic - an MSIC MFD instance 41 - * @pdev: pointer to the platform device 42 - * @vendor: vendor ID 43 - * @version: chip version 44 - * @irq_base: base address of the mapped MSIC SRAM interrupt tree 45 - */ 46 - struct intel_msic { 47 - struct platform_device *pdev; 48 - unsigned vendor; 49 - unsigned version; 50 - void __iomem *irq_base; 51 - }; 52 - 53 - static const struct resource msic_touch_resources[] = { 54 - DEFINE_RES_IRQ(0), 55 - }; 56 - 57 - static const struct resource msic_adc_resources[] = { 58 - DEFINE_RES_IRQ(0), 59 - }; 60 - 61 - static const struct resource msic_battery_resources[] = { 62 - DEFINE_RES_IRQ(0), 63 - }; 64 - 65 - static const struct resource msic_gpio_resources[] = { 66 - DEFINE_RES_IRQ(0), 67 - }; 68 - 69 - static const struct resource msic_audio_resources[] = { 70 - DEFINE_RES_IRQ_NAMED(0, "IRQ"), 71 - /* 72 - * We will pass IRQ_BASE to the driver now but this can be removed 73 - * when/if the driver starts to use intel_msic_irq_read(). 74 - */ 75 - DEFINE_RES_MEM_NAMED(MSIC_IRQ_STATUS_ACCDET, 1, "IRQ_BASE"), 76 - }; 77 - 78 - static const struct resource msic_hdmi_resources[] = { 79 - DEFINE_RES_IRQ(0), 80 - }; 81 - 82 - static const struct resource msic_thermal_resources[] = { 83 - DEFINE_RES_IRQ(0), 84 - }; 85 - 86 - static const struct resource msic_power_btn_resources[] = { 87 - DEFINE_RES_IRQ(0), 88 - }; 89 - 90 - static const struct resource msic_ocd_resources[] = { 91 - DEFINE_RES_IRQ(0), 92 - }; 93 - 94 - /* 95 - * Devices that are part of the MSIC and are available via firmware 96 - * populated SFI DEVS table. 97 - */ 98 - static struct mfd_cell msic_devs[] = { 99 - [INTEL_MSIC_BLOCK_TOUCH] = { 100 - .name = "msic_touch", 101 - .num_resources = ARRAY_SIZE(msic_touch_resources), 102 - .resources = msic_touch_resources, 103 - }, 104 - [INTEL_MSIC_BLOCK_ADC] = { 105 - .name = "msic_adc", 106 - .num_resources = ARRAY_SIZE(msic_adc_resources), 107 - .resources = msic_adc_resources, 108 - }, 109 - [INTEL_MSIC_BLOCK_BATTERY] = { 110 - .name = "msic_battery", 111 - .num_resources = ARRAY_SIZE(msic_battery_resources), 112 - .resources = msic_battery_resources, 113 - }, 114 - [INTEL_MSIC_BLOCK_GPIO] = { 115 - .name = "msic_gpio", 116 - .num_resources = ARRAY_SIZE(msic_gpio_resources), 117 - .resources = msic_gpio_resources, 118 - }, 119 - [INTEL_MSIC_BLOCK_AUDIO] = { 120 - .name = "msic_audio", 121 - .num_resources = ARRAY_SIZE(msic_audio_resources), 122 - .resources = msic_audio_resources, 123 - }, 124 - [INTEL_MSIC_BLOCK_HDMI] = { 125 - .name = "msic_hdmi", 126 - .num_resources = ARRAY_SIZE(msic_hdmi_resources), 127 - .resources = msic_hdmi_resources, 128 - }, 129 - [INTEL_MSIC_BLOCK_THERMAL] = { 130 - .name = "msic_thermal", 131 - .num_resources = ARRAY_SIZE(msic_thermal_resources), 132 - .resources = msic_thermal_resources, 133 - }, 134 - [INTEL_MSIC_BLOCK_POWER_BTN] = { 135 - .name = "msic_power_btn", 136 - .num_resources = ARRAY_SIZE(msic_power_btn_resources), 137 - .resources = msic_power_btn_resources, 138 - }, 139 - [INTEL_MSIC_BLOCK_OCD] = { 140 - .name = "msic_ocd", 141 - .num_resources = ARRAY_SIZE(msic_ocd_resources), 142 - .resources = msic_ocd_resources, 143 - }, 144 - }; 145 - 146 - /* 147 - * Other MSIC related devices which are not directly available via SFI DEVS 148 - * table. These can be pseudo devices, regulators etc. which are needed for 149 - * different purposes. 150 - * 151 - * These devices appear only after the MSIC driver itself is initialized so 152 - * we can guarantee that the SCU IPC interface is ready. 153 - */ 154 - static const struct mfd_cell msic_other_devs[] = { 155 - /* Audio codec in the MSIC */ 156 - { 157 - .id = -1, 158 - .name = "sn95031", 159 - }, 160 - }; 161 - 162 - /** 163 - * intel_msic_reg_read - read a single MSIC register 164 - * @reg: register to read 165 - * @val: register value is placed here 166 - * 167 - * Read a single register from MSIC. Returns %0 on success and negative 168 - * errno in case of failure. 169 - * 170 - * Function may sleep. 171 - */ 172 - int intel_msic_reg_read(unsigned short reg, u8 *val) 173 - { 174 - return intel_scu_ipc_ioread8(reg, val); 175 - } 176 - EXPORT_SYMBOL_GPL(intel_msic_reg_read); 177 - 178 - /** 179 - * intel_msic_reg_write - write a single MSIC register 180 - * @reg: register to write 181 - * @val: value to write to that register 182 - * 183 - * Write a single MSIC register. Returns 0 on success and negative 184 - * errno in case of failure. 185 - * 186 - * Function may sleep. 187 - */ 188 - int intel_msic_reg_write(unsigned short reg, u8 val) 189 - { 190 - return intel_scu_ipc_iowrite8(reg, val); 191 - } 192 - EXPORT_SYMBOL_GPL(intel_msic_reg_write); 193 - 194 - /** 195 - * intel_msic_reg_update - update a single MSIC register 196 - * @reg: register to update 197 - * @val: value to write to the register 198 - * @mask: specifies which of the bits are updated (%0 = don't update, 199 - * %1 = update) 200 - * 201 - * Perform an update to a register @reg. @mask is used to specify which 202 - * bits are updated. Returns %0 in case of success and negative errno in 203 - * case of failure. 204 - * 205 - * Function may sleep. 206 - */ 207 - int intel_msic_reg_update(unsigned short reg, u8 val, u8 mask) 208 - { 209 - return intel_scu_ipc_update_register(reg, val, mask); 210 - } 211 - EXPORT_SYMBOL_GPL(intel_msic_reg_update); 212 - 213 - /** 214 - * intel_msic_bulk_read - read an array of registers 215 - * @reg: array of register addresses to read 216 - * @buf: array where the read values are placed 217 - * @count: number of registers to read 218 - * 219 - * Function reads @count registers from the MSIC using addresses passed in 220 - * @reg. Read values are placed in @buf. Reads are performed atomically 221 - * wrt. MSIC. 222 - * 223 - * Returns %0 in case of success and negative errno in case of failure. 224 - * 225 - * Function may sleep. 226 - */ 227 - int intel_msic_bulk_read(unsigned short *reg, u8 *buf, size_t count) 228 - { 229 - if (WARN_ON(count > SCU_IPC_RWBUF_LIMIT)) 230 - return -EINVAL; 231 - 232 - return intel_scu_ipc_readv(reg, buf, count); 233 - } 234 - EXPORT_SYMBOL_GPL(intel_msic_bulk_read); 235 - 236 - /** 237 - * intel_msic_bulk_write - write an array of values to the MSIC registers 238 - * @reg: array of registers to write 239 - * @buf: values to write to each register 240 - * @count: number of registers to write 241 - * 242 - * Function writes @count registers in @buf to MSIC. Writes are performed 243 - * atomically wrt MSIC. Returns %0 in case of success and negative errno in 244 - * case of failure. 245 - * 246 - * Function may sleep. 247 - */ 248 - int intel_msic_bulk_write(unsigned short *reg, u8 *buf, size_t count) 249 - { 250 - if (WARN_ON(count > SCU_IPC_RWBUF_LIMIT)) 251 - return -EINVAL; 252 - 253 - return intel_scu_ipc_writev(reg, buf, count); 254 - } 255 - EXPORT_SYMBOL_GPL(intel_msic_bulk_write); 256 - 257 - /** 258 - * intel_msic_irq_read - read a register from an MSIC interrupt tree 259 - * @msic: MSIC instance 260 - * @reg: interrupt register (between %INTEL_MSIC_IRQLVL1 and 261 - * %INTEL_MSIC_RESETIRQ2) 262 - * @val: value of the register is placed here 263 - * 264 - * This function can be used by an MSIC subdevice interrupt handler to read 265 - * a register value from the MSIC interrupt tree. In this way subdevice 266 - * drivers don't have to map in the interrupt tree themselves but can just 267 - * call this function instead. 268 - * 269 - * Function doesn't sleep and is callable from interrupt context. 270 - * 271 - * Returns %-EINVAL if @reg is outside of the allowed register region. 272 - */ 273 - int intel_msic_irq_read(struct intel_msic *msic, unsigned short reg, u8 *val) 274 - { 275 - if (WARN_ON(reg < INTEL_MSIC_IRQLVL1 || reg > INTEL_MSIC_RESETIRQ2)) 276 - return -EINVAL; 277 - 278 - *val = readb(msic->irq_base + (reg - INTEL_MSIC_IRQLVL1)); 279 - return 0; 280 - } 281 - EXPORT_SYMBOL_GPL(intel_msic_irq_read); 282 - 283 - static int intel_msic_init_devices(struct intel_msic *msic) 284 - { 285 - struct platform_device *pdev = msic->pdev; 286 - struct intel_msic_platform_data *pdata = dev_get_platdata(&pdev->dev); 287 - int ret, i; 288 - 289 - if (pdata->gpio) { 290 - struct mfd_cell *cell = &msic_devs[INTEL_MSIC_BLOCK_GPIO]; 291 - 292 - cell->platform_data = pdata->gpio; 293 - cell->pdata_size = sizeof(*pdata->gpio); 294 - } 295 - 296 - if (pdata->ocd) { 297 - unsigned gpio = pdata->ocd->gpio; 298 - 299 - ret = devm_gpio_request_one(&pdev->dev, gpio, 300 - GPIOF_IN, "ocd_gpio"); 301 - if (ret) { 302 - dev_err(&pdev->dev, "failed to register OCD GPIO\n"); 303 - return ret; 304 - } 305 - 306 - ret = gpio_to_irq(gpio); 307 - if (ret < 0) { 308 - dev_err(&pdev->dev, "no IRQ number for OCD GPIO\n"); 309 - return ret; 310 - } 311 - 312 - /* Update the IRQ number for the OCD */ 313 - pdata->irq[INTEL_MSIC_BLOCK_OCD] = ret; 314 - } 315 - 316 - for (i = 0; i < ARRAY_SIZE(msic_devs); i++) { 317 - if (!pdata->irq[i]) 318 - continue; 319 - 320 - ret = mfd_add_devices(&pdev->dev, -1, &msic_devs[i], 1, NULL, 321 - pdata->irq[i], NULL); 322 - if (ret) 323 - goto fail; 324 - } 325 - 326 - ret = mfd_add_devices(&pdev->dev, 0, msic_other_devs, 327 - ARRAY_SIZE(msic_other_devs), NULL, 0, NULL); 328 - if (ret) 329 - goto fail; 330 - 331 - return 0; 332 - 333 - fail: 334 - mfd_remove_devices(&pdev->dev); 335 - 336 - return ret; 337 - } 338 - 339 - static void intel_msic_remove_devices(struct intel_msic *msic) 340 - { 341 - struct platform_device *pdev = msic->pdev; 342 - 343 - mfd_remove_devices(&pdev->dev); 344 - } 345 - 346 - static int intel_msic_probe(struct platform_device *pdev) 347 - { 348 - struct intel_msic_platform_data *pdata = dev_get_platdata(&pdev->dev); 349 - struct intel_msic *msic; 350 - struct resource *res; 351 - u8 id0, id1; 352 - int ret; 353 - 354 - if (!pdata) { 355 - dev_err(&pdev->dev, "no platform data passed\n"); 356 - return -EINVAL; 357 - } 358 - 359 - /* First validate that we have an MSIC in place */ 360 - ret = intel_scu_ipc_ioread8(INTEL_MSIC_ID0, &id0); 361 - if (ret) { 362 - dev_err(&pdev->dev, "failed to identify the MSIC chip (ID0)\n"); 363 - return -ENXIO; 364 - } 365 - 366 - ret = intel_scu_ipc_ioread8(INTEL_MSIC_ID1, &id1); 367 - if (ret) { 368 - dev_err(&pdev->dev, "failed to identify the MSIC chip (ID1)\n"); 369 - return -ENXIO; 370 - } 371 - 372 - if (MSIC_VENDOR(id0) != MSIC_VENDOR(id1)) { 373 - dev_err(&pdev->dev, "invalid vendor ID: %x, %x\n", id0, id1); 374 - return -ENXIO; 375 - } 376 - 377 - msic = devm_kzalloc(&pdev->dev, sizeof(*msic), GFP_KERNEL); 378 - if (!msic) 379 - return -ENOMEM; 380 - 381 - msic->vendor = MSIC_VENDOR(id0); 382 - msic->version = MSIC_VERSION(id0); 383 - msic->pdev = pdev; 384 - 385 - /* 386 - * Map in the MSIC interrupt tree area in SRAM. This is exposed to 387 - * the clients via intel_msic_irq_read(). 388 - */ 389 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 390 - msic->irq_base = devm_ioremap_resource(&pdev->dev, res); 391 - if (IS_ERR(msic->irq_base)) 392 - return PTR_ERR(msic->irq_base); 393 - 394 - platform_set_drvdata(pdev, msic); 395 - 396 - ret = intel_msic_init_devices(msic); 397 - if (ret) { 398 - dev_err(&pdev->dev, "failed to initialize MSIC devices\n"); 399 - return ret; 400 - } 401 - 402 - dev_info(&pdev->dev, "Intel MSIC version %c%d (vendor %#x)\n", 403 - MSIC_MAJOR(msic->version), MSIC_MINOR(msic->version), 404 - msic->vendor); 405 - 406 - return 0; 407 - } 408 - 409 - static int intel_msic_remove(struct platform_device *pdev) 410 - { 411 - struct intel_msic *msic = platform_get_drvdata(pdev); 412 - 413 - intel_msic_remove_devices(msic); 414 - 415 - return 0; 416 - } 417 - 418 - static struct platform_driver intel_msic_driver = { 419 - .probe = intel_msic_probe, 420 - .remove = intel_msic_remove, 421 - .driver = { 422 - .name = "intel_msic", 423 - }, 424 - }; 425 - builtin_platform_driver(intel_msic_driver);
+4 -18
drivers/platform/x86/intel_scu_pcidrv.c
··· 17 17 static int intel_scu_pci_probe(struct pci_dev *pdev, 18 18 const struct pci_device_id *id) 19 19 { 20 - void (*setup_fn)(void) = (void (*)(void))id->driver_data; 21 20 struct intel_scu_ipc_data scu_data = {}; 22 21 struct intel_scu_ipc_dev *scu; 23 22 int ret; ··· 29 30 scu_data.irq = pdev->irq; 30 31 31 32 scu = intel_scu_ipc_register(&pdev->dev, &scu_data); 32 - if (IS_ERR(scu)) 33 - return PTR_ERR(scu); 34 - 35 - if (setup_fn) 36 - setup_fn(); 37 - return 0; 38 - } 39 - 40 - static void intel_mid_scu_setup(void) 41 - { 42 - intel_scu_devices_create(); 33 + return PTR_ERR_OR_ZERO(scu); 43 34 } 44 35 45 36 static const struct pci_device_id pci_ids[] = { 46 - { PCI_VDEVICE(INTEL, 0x080e), 47 - .driver_data = (kernel_ulong_t)intel_mid_scu_setup }, 48 - { PCI_VDEVICE(INTEL, 0x08ea), 49 - .driver_data = (kernel_ulong_t)intel_mid_scu_setup }, 37 + { PCI_VDEVICE(INTEL, 0x080e) }, 38 + { PCI_VDEVICE(INTEL, 0x08ea) }, 50 39 { PCI_VDEVICE(INTEL, 0x0a94) }, 51 - { PCI_VDEVICE(INTEL, 0x11a0), 52 - .driver_data = (kernel_ulong_t)intel_mid_scu_setup }, 40 + { PCI_VDEVICE(INTEL, 0x11a0) }, 53 41 { PCI_VDEVICE(INTEL, 0x1a94) }, 54 42 { PCI_VDEVICE(INTEL, 0x5a94) }, 55 43 {}
-18
drivers/sfi/Kconfig
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - # 3 - # SFI Configuration 4 - # 5 - 6 - menuconfig SFI 7 - bool "SFI (Simple Firmware Interface) Support" 8 - help 9 - The Simple Firmware Interface (SFI) provides a lightweight method 10 - for platform firmware to pass information to the operating system 11 - via static tables in memory. Kernel SFI support is required to 12 - boot on SFI-only platforms. Currently, all SFI-only platforms are 13 - based on the 2nd generation Intel Atom processor platform, 14 - code-named Moorestown. 15 - 16 - For more information, see http://simplefirmware.org 17 - 18 - Say 'Y' here to enable the kernel to boot on SFI-only platforms.
-4
drivers/sfi/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - obj-y += sfi_acpi.o 3 - obj-y += sfi_core.o 4 -
-214
drivers/sfi/sfi_acpi.c
··· 1 - /* sfi_acpi.c Simple Firmware Interface - ACPI extensions */ 2 - 3 - /* 4 - 5 - This file is provided under a dual BSD/GPLv2 license. When using or 6 - redistributing this file, you may do so under either license. 7 - 8 - GPL LICENSE SUMMARY 9 - 10 - Copyright(c) 2009 Intel Corporation. All rights reserved. 11 - 12 - This program is free software; you can redistribute it and/or modify 13 - it under the terms of version 2 of the GNU General Public License as 14 - published by the Free Software Foundation. 15 - 16 - This program is distributed in the hope that it will be useful, but 17 - WITHOUT ANY WARRANTY; without even the implied warranty of 18 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 - General Public License for more details. 20 - 21 - You should have received a copy of the GNU General Public License 22 - along with this program; if not, write to the Free Software 23 - Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 24 - The full GNU General Public License is included in this distribution 25 - in the file called LICENSE.GPL. 26 - 27 - BSD LICENSE 28 - 29 - Copyright(c) 2009 Intel Corporation. All rights reserved. 30 - 31 - Redistribution and use in source and binary forms, with or without 32 - modification, are permitted provided that the following conditions 33 - are met: 34 - 35 - * Redistributions of source code must retain the above copyright 36 - notice, this list of conditions and the following disclaimer. 37 - * Redistributions in binary form must reproduce the above copyright 38 - notice, this list of conditions and the following disclaimer in 39 - the documentation and/or other materials provided with the 40 - distribution. 41 - * Neither the name of Intel Corporation nor the names of its 42 - contributors may be used to endorse or promote products derived 43 - from this software without specific prior written permission. 44 - 45 - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 46 - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 47 - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 48 - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 49 - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 50 - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 51 - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 52 - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 53 - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 54 - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 55 - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 56 - 57 - */ 58 - 59 - #define KMSG_COMPONENT "SFI" 60 - #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 61 - 62 - #include <linux/kernel.h> 63 - #include <linux/sfi_acpi.h> 64 - #include "sfi_core.h" 65 - 66 - /* 67 - * SFI can access ACPI-defined tables via an optional ACPI XSDT. 68 - * 69 - * This allows re-use, and avoids re-definition, of standard tables. 70 - * For example, the "MCFG" table is defined by PCI, reserved by ACPI, 71 - * and is expected to be present many SFI-only systems. 72 - */ 73 - 74 - static struct acpi_table_xsdt *xsdt_va __read_mostly; 75 - 76 - #define XSDT_GET_NUM_ENTRIES(ptable, entry_type) \ 77 - ((ptable->header.length - sizeof(struct acpi_table_header)) / \ 78 - (sizeof(entry_type))) 79 - 80 - static inline struct sfi_table_header *acpi_to_sfi_th( 81 - struct acpi_table_header *th) 82 - { 83 - return (struct sfi_table_header *)th; 84 - } 85 - 86 - static inline struct acpi_table_header *sfi_to_acpi_th( 87 - struct sfi_table_header *th) 88 - { 89 - return (struct acpi_table_header *)th; 90 - } 91 - 92 - /* 93 - * sfi_acpi_parse_xsdt() 94 - * 95 - * Parse the ACPI XSDT for later access by sfi_acpi_table_parse(). 96 - */ 97 - static int __init sfi_acpi_parse_xsdt(struct sfi_table_header *th) 98 - { 99 - struct sfi_table_key key = SFI_ANY_KEY; 100 - int tbl_cnt, i; 101 - void *ret; 102 - 103 - xsdt_va = (struct acpi_table_xsdt *)th; 104 - tbl_cnt = XSDT_GET_NUM_ENTRIES(xsdt_va, u64); 105 - for (i = 0; i < tbl_cnt; i++) { 106 - ret = sfi_check_table(xsdt_va->table_offset_entry[i], &key); 107 - if (IS_ERR(ret)) { 108 - disable_sfi(); 109 - return -1; 110 - } 111 - } 112 - 113 - return 0; 114 - } 115 - 116 - int __init sfi_acpi_init(void) 117 - { 118 - struct sfi_table_key xsdt_key = { .sig = SFI_SIG_XSDT }; 119 - 120 - sfi_table_parse(SFI_SIG_XSDT, NULL, NULL, sfi_acpi_parse_xsdt); 121 - 122 - /* Only call the get_table to keep the table mapped */ 123 - xsdt_va = (struct acpi_table_xsdt *)sfi_get_table(&xsdt_key); 124 - return 0; 125 - } 126 - 127 - static struct acpi_table_header *sfi_acpi_get_table(struct sfi_table_key *key) 128 - { 129 - u32 tbl_cnt, i; 130 - void *ret; 131 - 132 - tbl_cnt = XSDT_GET_NUM_ENTRIES(xsdt_va, u64); 133 - for (i = 0; i < tbl_cnt; i++) { 134 - ret = sfi_check_table(xsdt_va->table_offset_entry[i], key); 135 - if (!IS_ERR(ret) && ret) 136 - return sfi_to_acpi_th(ret); 137 - } 138 - 139 - return NULL; 140 - } 141 - 142 - static void sfi_acpi_put_table(struct acpi_table_header *table) 143 - { 144 - sfi_put_table(acpi_to_sfi_th(table)); 145 - } 146 - 147 - /* 148 - * sfi_acpi_table_parse() 149 - * 150 - * Find specified table in XSDT, run handler on it and return its return value 151 - */ 152 - int sfi_acpi_table_parse(char *signature, char *oem_id, char *oem_table_id, 153 - int(*handler)(struct acpi_table_header *)) 154 - { 155 - struct acpi_table_header *table = NULL; 156 - struct sfi_table_key key; 157 - int ret = 0; 158 - 159 - if (sfi_disabled) 160 - return -1; 161 - 162 - key.sig = signature; 163 - key.oem_id = oem_id; 164 - key.oem_table_id = oem_table_id; 165 - 166 - table = sfi_acpi_get_table(&key); 167 - if (!table) 168 - return -EINVAL; 169 - 170 - ret = handler(table); 171 - sfi_acpi_put_table(table); 172 - return ret; 173 - } 174 - 175 - static ssize_t sfi_acpi_table_show(struct file *filp, struct kobject *kobj, 176 - struct bin_attribute *bin_attr, char *buf, 177 - loff_t offset, size_t count) 178 - { 179 - struct sfi_table_attr *tbl_attr = 180 - container_of(bin_attr, struct sfi_table_attr, attr); 181 - struct acpi_table_header *th = NULL; 182 - struct sfi_table_key key; 183 - ssize_t cnt; 184 - 185 - key.sig = tbl_attr->name; 186 - key.oem_id = NULL; 187 - key.oem_table_id = NULL; 188 - 189 - th = sfi_acpi_get_table(&key); 190 - if (!th) 191 - return 0; 192 - 193 - cnt = memory_read_from_buffer(buf, count, &offset, 194 - th, th->length); 195 - sfi_acpi_put_table(th); 196 - 197 - return cnt; 198 - } 199 - 200 - 201 - void __init sfi_acpi_sysfs_init(void) 202 - { 203 - u32 tbl_cnt, i; 204 - struct sfi_table_attr *tbl_attr; 205 - 206 - tbl_cnt = XSDT_GET_NUM_ENTRIES(xsdt_va, u64); 207 - for (i = 0; i < tbl_cnt; i++) { 208 - tbl_attr = 209 - sfi_sysfs_install_table(xsdt_va->table_offset_entry[i]); 210 - tbl_attr->attr.read = sfi_acpi_table_show; 211 - } 212 - 213 - return; 214 - }
-522
drivers/sfi/sfi_core.c
··· 1 - /* sfi_core.c Simple Firmware Interface - core internals */ 2 - 3 - /* 4 - 5 - This file is provided under a dual BSD/GPLv2 license. When using or 6 - redistributing this file, you may do so under either license. 7 - 8 - GPL LICENSE SUMMARY 9 - 10 - Copyright(c) 2009 Intel Corporation. All rights reserved. 11 - 12 - This program is free software; you can redistribute it and/or modify 13 - it under the terms of version 2 of the GNU General Public License as 14 - published by the Free Software Foundation. 15 - 16 - This program is distributed in the hope that it will be useful, but 17 - WITHOUT ANY WARRANTY; without even the implied warranty of 18 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 - General Public License for more details. 20 - 21 - You should have received a copy of the GNU General Public License 22 - along with this program; if not, write to the Free Software 23 - Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 24 - The full GNU General Public License is included in this distribution 25 - in the file called LICENSE.GPL. 26 - 27 - BSD LICENSE 28 - 29 - Copyright(c) 2009 Intel Corporation. All rights reserved. 30 - 31 - Redistribution and use in source and binary forms, with or without 32 - modification, are permitted provided that the following conditions 33 - are met: 34 - 35 - * Redistributions of source code must retain the above copyright 36 - notice, this list of conditions and the following disclaimer. 37 - * Redistributions in binary form must reproduce the above copyright 38 - notice, this list of conditions and the following disclaimer in 39 - the documentation and/or other materials provided with the 40 - distribution. 41 - * Neither the name of Intel Corporation nor the names of its 42 - contributors may be used to endorse or promote products derived 43 - from this software without specific prior written permission. 44 - 45 - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 46 - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 47 - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 48 - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 49 - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 50 - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 51 - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 52 - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 53 - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 54 - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 55 - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 56 - 57 - */ 58 - 59 - #define KMSG_COMPONENT "SFI" 60 - #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 61 - 62 - #include <linux/memblock.h> 63 - #include <linux/kernel.h> 64 - #include <linux/module.h> 65 - #include <linux/errno.h> 66 - #include <linux/types.h> 67 - #include <linux/acpi.h> 68 - #include <linux/init.h> 69 - #include <linux/sfi.h> 70 - #include <linux/slab.h> 71 - #include <linux/io.h> 72 - 73 - #include "sfi_core.h" 74 - 75 - #define ON_SAME_PAGE(addr1, addr2) \ 76 - (((unsigned long)(addr1) & PAGE_MASK) == \ 77 - ((unsigned long)(addr2) & PAGE_MASK)) 78 - #define TABLE_ON_PAGE(page, table, size) (ON_SAME_PAGE(page, table) && \ 79 - ON_SAME_PAGE(page, table + size)) 80 - 81 - int sfi_disabled __read_mostly; 82 - EXPORT_SYMBOL(sfi_disabled); 83 - 84 - static u64 syst_pa __read_mostly; 85 - static struct sfi_table_simple *syst_va __read_mostly; 86 - 87 - /* 88 - * FW creates and saves the SFI tables in memory. When these tables get 89 - * used, they may need to be mapped to virtual address space, and the mapping 90 - * can happen before or after the memremap() is ready, so a flag is needed 91 - * to indicating this 92 - */ 93 - static u32 sfi_use_memremap __read_mostly; 94 - 95 - /* 96 - * sfi_un/map_memory calls early_memremap/memunmap which is a __init function 97 - * and introduces section mismatch. So use __ref to make it calm. 98 - */ 99 - static void __iomem * __ref sfi_map_memory(u64 phys, u32 size) 100 - { 101 - if (!phys || !size) 102 - return NULL; 103 - 104 - if (sfi_use_memremap) 105 - return memremap(phys, size, MEMREMAP_WB); 106 - else 107 - return early_memremap(phys, size); 108 - } 109 - 110 - static void __ref sfi_unmap_memory(void __iomem *virt, u32 size) 111 - { 112 - if (!virt || !size) 113 - return; 114 - 115 - if (sfi_use_memremap) 116 - memunmap(virt); 117 - else 118 - early_memunmap(virt, size); 119 - } 120 - 121 - static void sfi_print_table_header(unsigned long long pa, 122 - struct sfi_table_header *header) 123 - { 124 - pr_info("%4.4s %llX, %04X (v%d %6.6s %8.8s)\n", 125 - header->sig, pa, 126 - header->len, header->rev, header->oem_id, 127 - header->oem_table_id); 128 - } 129 - 130 - /* 131 - * sfi_verify_table() 132 - * Sanity check table lengh, calculate checksum 133 - */ 134 - static int sfi_verify_table(struct sfi_table_header *table) 135 - { 136 - 137 - u8 checksum = 0; 138 - u8 *puchar = (u8 *)table; 139 - u32 length = table->len; 140 - 141 - /* Sanity check table length against arbitrary 1MB limit */ 142 - if (length > 0x100000) { 143 - pr_err("Invalid table length 0x%x\n", length); 144 - return -1; 145 - } 146 - 147 - while (length--) 148 - checksum += *puchar++; 149 - 150 - if (checksum) { 151 - pr_err("Checksum %2.2X should be %2.2X\n", 152 - table->csum, table->csum - checksum); 153 - return -1; 154 - } 155 - return 0; 156 - } 157 - 158 - /* 159 - * sfi_map_table() 160 - * 161 - * Return address of mapped table 162 - * Check for common case that we can re-use mapping to SYST, 163 - * which requires syst_pa, syst_va to be initialized. 164 - */ 165 - static struct sfi_table_header *sfi_map_table(u64 pa) 166 - { 167 - struct sfi_table_header *th; 168 - u32 length; 169 - 170 - if (!TABLE_ON_PAGE(syst_pa, pa, sizeof(struct sfi_table_header))) 171 - th = sfi_map_memory(pa, sizeof(struct sfi_table_header)); 172 - else 173 - th = (void *)syst_va + (pa - syst_pa); 174 - 175 - /* If table fits on same page as its header, we are done */ 176 - if (TABLE_ON_PAGE(th, th, th->len)) 177 - return th; 178 - 179 - /* Entire table does not fit on same page as SYST */ 180 - length = th->len; 181 - if (!TABLE_ON_PAGE(syst_pa, pa, sizeof(struct sfi_table_header))) 182 - sfi_unmap_memory(th, sizeof(struct sfi_table_header)); 183 - 184 - return sfi_map_memory(pa, length); 185 - } 186 - 187 - /* 188 - * sfi_unmap_table() 189 - * 190 - * Undoes effect of sfi_map_table() by unmapping table 191 - * if it did not completely fit on same page as SYST. 192 - */ 193 - static void sfi_unmap_table(struct sfi_table_header *th) 194 - { 195 - if (!TABLE_ON_PAGE(syst_va, th, th->len)) 196 - sfi_unmap_memory(th, TABLE_ON_PAGE(th, th, th->len) ? 197 - sizeof(*th) : th->len); 198 - } 199 - 200 - static int sfi_table_check_key(struct sfi_table_header *th, 201 - struct sfi_table_key *key) 202 - { 203 - 204 - if (strncmp(th->sig, key->sig, SFI_SIGNATURE_SIZE) 205 - || (key->oem_id && strncmp(th->oem_id, 206 - key->oem_id, SFI_OEM_ID_SIZE)) 207 - || (key->oem_table_id && strncmp(th->oem_table_id, 208 - key->oem_table_id, SFI_OEM_TABLE_ID_SIZE))) 209 - return -1; 210 - 211 - return 0; 212 - } 213 - 214 - /* 215 - * This function will be used in 2 cases: 216 - * 1. used to enumerate and verify the tables addressed by SYST/XSDT, 217 - * thus no signature will be given (in kernel boot phase) 218 - * 2. used to parse one specific table, signature must exist, and 219 - * the mapped virt address will be returned, and the virt space 220 - * will be released by call sfi_put_table() later 221 - * 222 - * This two cases are from two different functions with two different 223 - * sections and causes section mismatch warning. So use __ref to tell 224 - * modpost not to make any noise. 225 - * 226 - * Return value: 227 - * NULL: when can't find a table matching the key 228 - * ERR_PTR(error): error value 229 - * virt table address: when a matched table is found 230 - */ 231 - struct sfi_table_header * 232 - __ref sfi_check_table(u64 pa, struct sfi_table_key *key) 233 - { 234 - struct sfi_table_header *th; 235 - void *ret = NULL; 236 - 237 - th = sfi_map_table(pa); 238 - if (!th) 239 - return ERR_PTR(-ENOMEM); 240 - 241 - if (!key->sig) { 242 - sfi_print_table_header(pa, th); 243 - if (sfi_verify_table(th)) 244 - ret = ERR_PTR(-EINVAL); 245 - } else { 246 - if (!sfi_table_check_key(th, key)) 247 - return th; /* Success */ 248 - } 249 - 250 - sfi_unmap_table(th); 251 - return ret; 252 - } 253 - 254 - /* 255 - * sfi_get_table() 256 - * 257 - * Search SYST for the specified table with the signature in 258 - * the key, and return the mapped table 259 - */ 260 - struct sfi_table_header *sfi_get_table(struct sfi_table_key *key) 261 - { 262 - struct sfi_table_header *th; 263 - u32 tbl_cnt, i; 264 - 265 - tbl_cnt = SFI_GET_NUM_ENTRIES(syst_va, u64); 266 - for (i = 0; i < tbl_cnt; i++) { 267 - th = sfi_check_table(syst_va->pentry[i], key); 268 - if (!IS_ERR(th) && th) 269 - return th; 270 - } 271 - 272 - return NULL; 273 - } 274 - 275 - void sfi_put_table(struct sfi_table_header *th) 276 - { 277 - sfi_unmap_table(th); 278 - } 279 - 280 - /* Find table with signature, run handler on it */ 281 - int sfi_table_parse(char *signature, char *oem_id, char *oem_table_id, 282 - sfi_table_handler handler) 283 - { 284 - struct sfi_table_header *table = NULL; 285 - struct sfi_table_key key; 286 - int ret = -EINVAL; 287 - 288 - if (sfi_disabled || !handler || !signature) 289 - goto exit; 290 - 291 - key.sig = signature; 292 - key.oem_id = oem_id; 293 - key.oem_table_id = oem_table_id; 294 - 295 - table = sfi_get_table(&key); 296 - if (!table) 297 - goto exit; 298 - 299 - ret = handler(table); 300 - sfi_put_table(table); 301 - exit: 302 - return ret; 303 - } 304 - EXPORT_SYMBOL_GPL(sfi_table_parse); 305 - 306 - /* 307 - * sfi_parse_syst() 308 - * Checksum all the tables in SYST and print their headers 309 - * 310 - * success: set syst_va, return 0 311 - */ 312 - static int __init sfi_parse_syst(void) 313 - { 314 - struct sfi_table_key key = SFI_ANY_KEY; 315 - int tbl_cnt, i; 316 - void *ret; 317 - 318 - syst_va = sfi_map_memory(syst_pa, sizeof(struct sfi_table_simple)); 319 - if (!syst_va) 320 - return -ENOMEM; 321 - 322 - tbl_cnt = SFI_GET_NUM_ENTRIES(syst_va, u64); 323 - for (i = 0; i < tbl_cnt; i++) { 324 - ret = sfi_check_table(syst_va->pentry[i], &key); 325 - if (IS_ERR(ret)) 326 - return PTR_ERR(ret); 327 - } 328 - 329 - return 0; 330 - } 331 - 332 - /* 333 - * The OS finds the System Table by searching 16-byte boundaries between 334 - * physical address 0x000E0000 and 0x000FFFFF. The OS shall search this region 335 - * starting at the low address and shall stop searching when the 1st valid SFI 336 - * System Table is found. 337 - * 338 - * success: set syst_pa, return 0 339 - * fail: return -1 340 - */ 341 - static __init int sfi_find_syst(void) 342 - { 343 - unsigned long offset, len; 344 - void *start; 345 - 346 - len = SFI_SYST_SEARCH_END - SFI_SYST_SEARCH_BEGIN; 347 - start = sfi_map_memory(SFI_SYST_SEARCH_BEGIN, len); 348 - if (!start) 349 - return -1; 350 - 351 - for (offset = 0; offset < len; offset += 16) { 352 - struct sfi_table_header *syst_hdr; 353 - 354 - syst_hdr = start + offset; 355 - if (strncmp(syst_hdr->sig, SFI_SIG_SYST, 356 - SFI_SIGNATURE_SIZE)) 357 - continue; 358 - 359 - if (syst_hdr->len > PAGE_SIZE) 360 - continue; 361 - 362 - sfi_print_table_header(SFI_SYST_SEARCH_BEGIN + offset, 363 - syst_hdr); 364 - 365 - if (sfi_verify_table(syst_hdr)) 366 - continue; 367 - 368 - /* 369 - * Enforce SFI spec mandate that SYST reside within a page. 370 - */ 371 - if (!ON_SAME_PAGE(syst_pa, syst_pa + syst_hdr->len)) { 372 - pr_info("SYST 0x%llx + 0x%x crosses page\n", 373 - syst_pa, syst_hdr->len); 374 - continue; 375 - } 376 - 377 - /* Success */ 378 - syst_pa = SFI_SYST_SEARCH_BEGIN + offset; 379 - sfi_unmap_memory(start, len); 380 - return 0; 381 - } 382 - 383 - sfi_unmap_memory(start, len); 384 - return -1; 385 - } 386 - 387 - static struct kobject *sfi_kobj; 388 - static struct kobject *tables_kobj; 389 - 390 - static ssize_t sfi_table_show(struct file *filp, struct kobject *kobj, 391 - struct bin_attribute *bin_attr, char *buf, 392 - loff_t offset, size_t count) 393 - { 394 - struct sfi_table_attr *tbl_attr = 395 - container_of(bin_attr, struct sfi_table_attr, attr); 396 - struct sfi_table_header *th = NULL; 397 - struct sfi_table_key key; 398 - ssize_t cnt; 399 - 400 - key.sig = tbl_attr->name; 401 - key.oem_id = NULL; 402 - key.oem_table_id = NULL; 403 - 404 - if (strncmp(SFI_SIG_SYST, tbl_attr->name, SFI_SIGNATURE_SIZE)) { 405 - th = sfi_get_table(&key); 406 - if (!th) 407 - return 0; 408 - 409 - cnt = memory_read_from_buffer(buf, count, &offset, 410 - th, th->len); 411 - sfi_put_table(th); 412 - } else 413 - cnt = memory_read_from_buffer(buf, count, &offset, 414 - syst_va, syst_va->header.len); 415 - 416 - return cnt; 417 - } 418 - 419 - struct sfi_table_attr __init *sfi_sysfs_install_table(u64 pa) 420 - { 421 - struct sfi_table_attr *tbl_attr; 422 - struct sfi_table_header *th; 423 - int ret; 424 - 425 - tbl_attr = kzalloc(sizeof(struct sfi_table_attr), GFP_KERNEL); 426 - if (!tbl_attr) 427 - return NULL; 428 - 429 - th = sfi_map_table(pa); 430 - if (!th || !th->sig[0]) { 431 - kfree(tbl_attr); 432 - return NULL; 433 - } 434 - 435 - sysfs_attr_init(&tbl_attr->attr.attr); 436 - memcpy(tbl_attr->name, th->sig, SFI_SIGNATURE_SIZE); 437 - 438 - tbl_attr->attr.size = 0; 439 - tbl_attr->attr.read = sfi_table_show; 440 - tbl_attr->attr.attr.name = tbl_attr->name; 441 - tbl_attr->attr.attr.mode = 0400; 442 - 443 - ret = sysfs_create_bin_file(tables_kobj, 444 - &tbl_attr->attr); 445 - if (ret) { 446 - kfree(tbl_attr); 447 - tbl_attr = NULL; 448 - } 449 - 450 - sfi_unmap_table(th); 451 - return tbl_attr; 452 - } 453 - 454 - static int __init sfi_sysfs_init(void) 455 - { 456 - int tbl_cnt, i; 457 - 458 - if (sfi_disabled) 459 - return 0; 460 - 461 - sfi_kobj = kobject_create_and_add("sfi", firmware_kobj); 462 - if (!sfi_kobj) 463 - return 0; 464 - 465 - tables_kobj = kobject_create_and_add("tables", sfi_kobj); 466 - if (!tables_kobj) { 467 - kobject_put(sfi_kobj); 468 - return 0; 469 - } 470 - 471 - sfi_sysfs_install_table(syst_pa); 472 - 473 - tbl_cnt = SFI_GET_NUM_ENTRIES(syst_va, u64); 474 - 475 - for (i = 0; i < tbl_cnt; i++) 476 - sfi_sysfs_install_table(syst_va->pentry[i]); 477 - 478 - sfi_acpi_sysfs_init(); 479 - kobject_uevent(sfi_kobj, KOBJ_ADD); 480 - kobject_uevent(tables_kobj, KOBJ_ADD); 481 - pr_info("SFI sysfs interfaces init success\n"); 482 - return 0; 483 - } 484 - 485 - void __init sfi_init(void) 486 - { 487 - if (!acpi_disabled) 488 - disable_sfi(); 489 - 490 - if (sfi_disabled) 491 - return; 492 - 493 - pr_info("Simple Firmware Interface v0.81 http://simplefirmware.org\n"); 494 - 495 - if (sfi_find_syst() || sfi_parse_syst() || sfi_platform_init()) 496 - disable_sfi(); 497 - 498 - return; 499 - } 500 - 501 - void __init sfi_init_late(void) 502 - { 503 - int length; 504 - 505 - if (sfi_disabled) 506 - return; 507 - 508 - length = syst_va->header.len; 509 - sfi_unmap_memory(syst_va, sizeof(struct sfi_table_simple)); 510 - 511 - /* Use memremap now after it is ready */ 512 - sfi_use_memremap = 1; 513 - syst_va = sfi_map_memory(syst_pa, length); 514 - 515 - sfi_acpi_init(); 516 - } 517 - 518 - /* 519 - * The reason we put it here because we need wait till the /sys/firmware 520 - * is setup, then our interface can be registered in /sys/firmware/sfi 521 - */ 522 - core_initcall(sfi_sysfs_init);
-81
drivers/sfi/sfi_core.h
··· 1 - /* sfi_core.h Simple Firmware Interface, internal header */ 2 - 3 - /* 4 - 5 - This file is provided under a dual BSD/GPLv2 license. When using or 6 - redistributing this file, you may do so under either license. 7 - 8 - GPL LICENSE SUMMARY 9 - 10 - Copyright(c) 2009 Intel Corporation. All rights reserved. 11 - 12 - This program is free software; you can redistribute it and/or modify 13 - it under the terms of version 2 of the GNU General Public License as 14 - published by the Free Software Foundation. 15 - 16 - This program is distributed in the hope that it will be useful, but 17 - WITHOUT ANY WARRANTY; without even the implied warranty of 18 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 - General Public License for more details. 20 - 21 - You should have received a copy of the GNU General Public License 22 - along with this program; if not, write to the Free Software 23 - Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 24 - The full GNU General Public License is included in this distribution 25 - in the file called LICENSE.GPL. 26 - 27 - BSD LICENSE 28 - 29 - Copyright(c) 2009 Intel Corporation. All rights reserved. 30 - 31 - Redistribution and use in source and binary forms, with or without 32 - modification, are permitted provided that the following conditions 33 - are met: 34 - 35 - * Redistributions of source code must retain the above copyright 36 - notice, this list of conditions and the following disclaimer. 37 - * Redistributions in binary form must reproduce the above copyright 38 - notice, this list of conditions and the following disclaimer in 39 - the documentation and/or other materials provided with the 40 - distribution. 41 - * Neither the name of Intel Corporation nor the names of its 42 - contributors may be used to endorse or promote products derived 43 - from this software without specific prior written permission. 44 - 45 - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 46 - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 47 - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 48 - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 49 - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 50 - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 51 - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 52 - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 53 - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 54 - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 55 - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 56 - 57 - */ 58 - 59 - #include <linux/sysfs.h> 60 - 61 - struct sfi_table_key{ 62 - char *sig; 63 - char *oem_id; 64 - char *oem_table_id; 65 - }; 66 - 67 - /* sysfs interface */ 68 - struct sfi_table_attr { 69 - struct bin_attribute attr; 70 - char name[8]; 71 - }; 72 - 73 - #define SFI_ANY_KEY { .sig = NULL, .oem_id = NULL, .oem_table_id = NULL } 74 - 75 - extern int __init sfi_acpi_init(void); 76 - extern struct sfi_table_header *sfi_check_table(u64 paddr, 77 - struct sfi_table_key *key); 78 - struct sfi_table_header *sfi_get_table(struct sfi_table_key *key); 79 - extern void sfi_put_table(struct sfi_table_header *table); 80 - extern struct sfi_table_attr __init *sfi_sysfs_install_table(u64 pa); 81 - extern void __init sfi_acpi_sysfs_init(void);
-1
drivers/staging/media/atomisp/include/linux/atomisp_platform.h
··· 22 22 #include <asm/processor.h> 23 23 24 24 #include <linux/i2c.h> 25 - #include <linux/sfi.h> 26 25 #include <media/v4l2-subdev.h> 27 26 #include "atomisp.h" 28 27
-453
include/linux/mfd/intel_msic.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * Core interface for Intel MSIC 4 - * 5 - * Copyright (C) 2011, Intel Corporation 6 - * Author: Mika Westerberg <mika.westerberg@linux.intel.com> 7 - */ 8 - 9 - #ifndef __LINUX_MFD_INTEL_MSIC_H__ 10 - #define __LINUX_MFD_INTEL_MSIC_H__ 11 - 12 - /* ID */ 13 - #define INTEL_MSIC_ID0 0x000 /* RO */ 14 - #define INTEL_MSIC_ID1 0x001 /* RO */ 15 - 16 - /* IRQ */ 17 - #define INTEL_MSIC_IRQLVL1 0x002 18 - #define INTEL_MSIC_ADC1INT 0x003 19 - #define INTEL_MSIC_CCINT 0x004 20 - #define INTEL_MSIC_PWRSRCINT 0x005 21 - #define INTEL_MSIC_PWRSRCINT1 0x006 22 - #define INTEL_MSIC_CHRINT 0x007 23 - #define INTEL_MSIC_CHRINT1 0x008 24 - #define INTEL_MSIC_RTCIRQ 0x009 25 - #define INTEL_MSIC_GPIO0LVIRQ 0x00a 26 - #define INTEL_MSIC_GPIO1LVIRQ 0x00b 27 - #define INTEL_MSIC_GPIOHVIRQ 0x00c 28 - #define INTEL_MSIC_VRINT 0x00d 29 - #define INTEL_MSIC_OCAUDIO 0x00e 30 - #define INTEL_MSIC_ACCDET 0x00f 31 - #define INTEL_MSIC_RESETIRQ1 0x010 32 - #define INTEL_MSIC_RESETIRQ2 0x011 33 - #define INTEL_MSIC_MADC1INT 0x012 34 - #define INTEL_MSIC_MCCINT 0x013 35 - #define INTEL_MSIC_MPWRSRCINT 0x014 36 - #define INTEL_MSIC_MPWRSRCINT1 0x015 37 - #define INTEL_MSIC_MCHRINT 0x016 38 - #define INTEL_MSIC_MCHRINT1 0x017 39 - #define INTEL_MSIC_RTCIRQMASK 0x018 40 - #define INTEL_MSIC_GPIO0LVIRQMASK 0x019 41 - #define INTEL_MSIC_GPIO1LVIRQMASK 0x01a 42 - #define INTEL_MSIC_GPIOHVIRQMASK 0x01b 43 - #define INTEL_MSIC_VRINTMASK 0x01c 44 - #define INTEL_MSIC_OCAUDIOMASK 0x01d 45 - #define INTEL_MSIC_ACCDETMASK 0x01e 46 - #define INTEL_MSIC_RESETIRQ1MASK 0x01f 47 - #define INTEL_MSIC_RESETIRQ2MASK 0x020 48 - #define INTEL_MSIC_IRQLVL1MSK 0x021 49 - #define INTEL_MSIC_PBCONFIG 0x03e 50 - #define INTEL_MSIC_PBSTATUS 0x03f /* RO */ 51 - 52 - /* GPIO */ 53 - #define INTEL_MSIC_GPIO0LV7CTLO 0x040 54 - #define INTEL_MSIC_GPIO0LV6CTLO 0x041 55 - #define INTEL_MSIC_GPIO0LV5CTLO 0x042 56 - #define INTEL_MSIC_GPIO0LV4CTLO 0x043 57 - #define INTEL_MSIC_GPIO0LV3CTLO 0x044 58 - #define INTEL_MSIC_GPIO0LV2CTLO 0x045 59 - #define INTEL_MSIC_GPIO0LV1CTLO 0x046 60 - #define INTEL_MSIC_GPIO0LV0CTLO 0x047 61 - #define INTEL_MSIC_GPIO1LV7CTLOS 0x048 62 - #define INTEL_MSIC_GPIO1LV6CTLO 0x049 63 - #define INTEL_MSIC_GPIO1LV5CTLO 0x04a 64 - #define INTEL_MSIC_GPIO1LV4CTLO 0x04b 65 - #define INTEL_MSIC_GPIO1LV3CTLO 0x04c 66 - #define INTEL_MSIC_GPIO1LV2CTLO 0x04d 67 - #define INTEL_MSIC_GPIO1LV1CTLO 0x04e 68 - #define INTEL_MSIC_GPIO1LV0CTLO 0x04f 69 - #define INTEL_MSIC_GPIO0LV7CTLI 0x050 70 - #define INTEL_MSIC_GPIO0LV6CTLI 0x051 71 - #define INTEL_MSIC_GPIO0LV5CTLI 0x052 72 - #define INTEL_MSIC_GPIO0LV4CTLI 0x053 73 - #define INTEL_MSIC_GPIO0LV3CTLI 0x054 74 - #define INTEL_MSIC_GPIO0LV2CTLI 0x055 75 - #define INTEL_MSIC_GPIO0LV1CTLI 0x056 76 - #define INTEL_MSIC_GPIO0LV0CTLI 0x057 77 - #define INTEL_MSIC_GPIO1LV7CTLIS 0x058 78 - #define INTEL_MSIC_GPIO1LV6CTLI 0x059 79 - #define INTEL_MSIC_GPIO1LV5CTLI 0x05a 80 - #define INTEL_MSIC_GPIO1LV4CTLI 0x05b 81 - #define INTEL_MSIC_GPIO1LV3CTLI 0x05c 82 - #define INTEL_MSIC_GPIO1LV2CTLI 0x05d 83 - #define INTEL_MSIC_GPIO1LV1CTLI 0x05e 84 - #define INTEL_MSIC_GPIO1LV0CTLI 0x05f 85 - #define INTEL_MSIC_PWM0CLKDIV1 0x061 86 - #define INTEL_MSIC_PWM0CLKDIV0 0x062 87 - #define INTEL_MSIC_PWM1CLKDIV1 0x063 88 - #define INTEL_MSIC_PWM1CLKDIV0 0x064 89 - #define INTEL_MSIC_PWM2CLKDIV1 0x065 90 - #define INTEL_MSIC_PWM2CLKDIV0 0x066 91 - #define INTEL_MSIC_PWM0DUTYCYCLE 0x067 92 - #define INTEL_MSIC_PWM1DUTYCYCLE 0x068 93 - #define INTEL_MSIC_PWM2DUTYCYCLE 0x069 94 - #define INTEL_MSIC_GPIO0HV3CTLO 0x06d 95 - #define INTEL_MSIC_GPIO0HV2CTLO 0x06e 96 - #define INTEL_MSIC_GPIO0HV1CTLO 0x06f 97 - #define INTEL_MSIC_GPIO0HV0CTLO 0x070 98 - #define INTEL_MSIC_GPIO1HV3CTLO 0x071 99 - #define INTEL_MSIC_GPIO1HV2CTLO 0x072 100 - #define INTEL_MSIC_GPIO1HV1CTLO 0x073 101 - #define INTEL_MSIC_GPIO1HV0CTLO 0x074 102 - #define INTEL_MSIC_GPIO0HV3CTLI 0x075 103 - #define INTEL_MSIC_GPIO0HV2CTLI 0x076 104 - #define INTEL_MSIC_GPIO0HV1CTLI 0x077 105 - #define INTEL_MSIC_GPIO0HV0CTLI 0x078 106 - #define INTEL_MSIC_GPIO1HV3CTLI 0x079 107 - #define INTEL_MSIC_GPIO1HV2CTLI 0x07a 108 - #define INTEL_MSIC_GPIO1HV1CTLI 0x07b 109 - #define INTEL_MSIC_GPIO1HV0CTLI 0x07c 110 - 111 - /* SVID */ 112 - #define INTEL_MSIC_SVIDCTRL0 0x080 113 - #define INTEL_MSIC_SVIDCTRL1 0x081 114 - #define INTEL_MSIC_SVIDCTRL2 0x082 115 - #define INTEL_MSIC_SVIDTXLASTPKT3 0x083 /* RO */ 116 - #define INTEL_MSIC_SVIDTXLASTPKT2 0x084 /* RO */ 117 - #define INTEL_MSIC_SVIDTXLASTPKT1 0x085 /* RO */ 118 - #define INTEL_MSIC_SVIDTXLASTPKT0 0x086 /* RO */ 119 - #define INTEL_MSIC_SVIDPKTOUTBYTE3 0x087 120 - #define INTEL_MSIC_SVIDPKTOUTBYTE2 0x088 121 - #define INTEL_MSIC_SVIDPKTOUTBYTE1 0x089 122 - #define INTEL_MSIC_SVIDPKTOUTBYTE0 0x08a 123 - #define INTEL_MSIC_SVIDRXVPDEBUG1 0x08b 124 - #define INTEL_MSIC_SVIDRXVPDEBUG0 0x08c 125 - #define INTEL_MSIC_SVIDRXLASTPKT3 0x08d /* RO */ 126 - #define INTEL_MSIC_SVIDRXLASTPKT2 0x08e /* RO */ 127 - #define INTEL_MSIC_SVIDRXLASTPKT1 0x08f /* RO */ 128 - #define INTEL_MSIC_SVIDRXLASTPKT0 0x090 /* RO */ 129 - #define INTEL_MSIC_SVIDRXCHKSTATUS3 0x091 /* RO */ 130 - #define INTEL_MSIC_SVIDRXCHKSTATUS2 0x092 /* RO */ 131 - #define INTEL_MSIC_SVIDRXCHKSTATUS1 0x093 /* RO */ 132 - #define INTEL_MSIC_SVIDRXCHKSTATUS0 0x094 /* RO */ 133 - 134 - /* VREG */ 135 - #define INTEL_MSIC_VCCLATCH 0x0c0 136 - #define INTEL_MSIC_VNNLATCH 0x0c1 137 - #define INTEL_MSIC_VCCCNT 0x0c2 138 - #define INTEL_MSIC_SMPSRAMP 0x0c3 139 - #define INTEL_MSIC_VNNCNT 0x0c4 140 - #define INTEL_MSIC_VNNAONCNT 0x0c5 141 - #define INTEL_MSIC_VCC122AONCNT 0x0c6 142 - #define INTEL_MSIC_V180AONCNT 0x0c7 143 - #define INTEL_MSIC_V500CNT 0x0c8 144 - #define INTEL_MSIC_VIHFCNT 0x0c9 145 - #define INTEL_MSIC_LDORAMP1 0x0ca 146 - #define INTEL_MSIC_LDORAMP2 0x0cb 147 - #define INTEL_MSIC_VCC108AONCNT 0x0cc 148 - #define INTEL_MSIC_VCC108ASCNT 0x0cd 149 - #define INTEL_MSIC_VCC108CNT 0x0ce 150 - #define INTEL_MSIC_VCCA100ASCNT 0x0cf 151 - #define INTEL_MSIC_VCCA100CNT 0x0d0 152 - #define INTEL_MSIC_VCC180AONCNT 0x0d1 153 - #define INTEL_MSIC_VCC180CNT 0x0d2 154 - #define INTEL_MSIC_VCC330CNT 0x0d3 155 - #define INTEL_MSIC_VUSB330CNT 0x0d4 156 - #define INTEL_MSIC_VCCSDIOCNT 0x0d5 157 - #define INTEL_MSIC_VPROG1CNT 0x0d6 158 - #define INTEL_MSIC_VPROG2CNT 0x0d7 159 - #define INTEL_MSIC_VEMMCSCNT 0x0d8 160 - #define INTEL_MSIC_VEMMC1CNT 0x0d9 161 - #define INTEL_MSIC_VEMMC2CNT 0x0da 162 - #define INTEL_MSIC_VAUDACNT 0x0db 163 - #define INTEL_MSIC_VHSPCNT 0x0dc 164 - #define INTEL_MSIC_VHSNCNT 0x0dd 165 - #define INTEL_MSIC_VHDMICNT 0x0de 166 - #define INTEL_MSIC_VOTGCNT 0x0df 167 - #define INTEL_MSIC_V1P35CNT 0x0e0 168 - #define INTEL_MSIC_V330AONCNT 0x0e1 169 - 170 - /* RESET */ 171 - #define INTEL_MSIC_CHIPCNTRL 0x100 /* WO */ 172 - #define INTEL_MSIC_ERCONFIG 0x101 173 - 174 - /* BURST */ 175 - #define INTEL_MSIC_BATCURRENTLIMIT12 0x102 176 - #define INTEL_MSIC_BATTIMELIMIT12 0x103 177 - #define INTEL_MSIC_BATTIMELIMIT3 0x104 178 - #define INTEL_MSIC_BATTIMEDB 0x105 179 - #define INTEL_MSIC_BRSTCONFIGOUTPUTS 0x106 180 - #define INTEL_MSIC_BRSTCONFIGACTIONS 0x107 181 - #define INTEL_MSIC_BURSTCONTROLSTATUS 0x108 182 - 183 - /* RTC */ 184 - #define INTEL_MSIC_RTCB1 0x140 /* RO */ 185 - #define INTEL_MSIC_RTCB2 0x141 /* RO */ 186 - #define INTEL_MSIC_RTCB3 0x142 /* RO */ 187 - #define INTEL_MSIC_RTCB4 0x143 /* RO */ 188 - #define INTEL_MSIC_RTCOB1 0x144 189 - #define INTEL_MSIC_RTCOB2 0x145 190 - #define INTEL_MSIC_RTCOB3 0x146 191 - #define INTEL_MSIC_RTCOB4 0x147 192 - #define INTEL_MSIC_RTCAB1 0x148 193 - #define INTEL_MSIC_RTCAB2 0x149 194 - #define INTEL_MSIC_RTCAB3 0x14a 195 - #define INTEL_MSIC_RTCAB4 0x14b 196 - #define INTEL_MSIC_RTCWAB1 0x14c 197 - #define INTEL_MSIC_RTCWAB2 0x14d 198 - #define INTEL_MSIC_RTCWAB3 0x14e 199 - #define INTEL_MSIC_RTCWAB4 0x14f 200 - #define INTEL_MSIC_RTCSC1 0x150 201 - #define INTEL_MSIC_RTCSC2 0x151 202 - #define INTEL_MSIC_RTCSC3 0x152 203 - #define INTEL_MSIC_RTCSC4 0x153 204 - #define INTEL_MSIC_RTCSTATUS 0x154 /* RO */ 205 - #define INTEL_MSIC_RTCCONFIG1 0x155 206 - #define INTEL_MSIC_RTCCONFIG2 0x156 207 - 208 - /* CHARGER */ 209 - #define INTEL_MSIC_BDTIMER 0x180 210 - #define INTEL_MSIC_BATTRMV 0x181 211 - #define INTEL_MSIC_VBUSDET 0x182 212 - #define INTEL_MSIC_VBUSDET1 0x183 213 - #define INTEL_MSIC_ADPHVDET 0x184 214 - #define INTEL_MSIC_ADPLVDET 0x185 215 - #define INTEL_MSIC_ADPDETDBDM 0x186 216 - #define INTEL_MSIC_LOWBATTDET 0x187 217 - #define INTEL_MSIC_CHRCTRL 0x188 218 - #define INTEL_MSIC_CHRCVOLTAGE 0x189 219 - #define INTEL_MSIC_CHRCCURRENT 0x18a 220 - #define INTEL_MSIC_SPCHARGER 0x18b 221 - #define INTEL_MSIC_CHRTTIME 0x18c 222 - #define INTEL_MSIC_CHRCTRL1 0x18d 223 - #define INTEL_MSIC_PWRSRCLMT 0x18e 224 - #define INTEL_MSIC_CHRSTWDT 0x18f 225 - #define INTEL_MSIC_WDTWRITE 0x190 /* WO */ 226 - #define INTEL_MSIC_CHRSAFELMT 0x191 227 - #define INTEL_MSIC_SPWRSRCINT 0x192 /* RO */ 228 - #define INTEL_MSIC_SPWRSRCINT1 0x193 /* RO */ 229 - #define INTEL_MSIC_CHRLEDPWM 0x194 230 - #define INTEL_MSIC_CHRLEDCTRL 0x195 231 - 232 - /* ADC */ 233 - #define INTEL_MSIC_ADC1CNTL1 0x1c0 234 - #define INTEL_MSIC_ADC1CNTL2 0x1c1 235 - #define INTEL_MSIC_ADC1CNTL3 0x1c2 236 - #define INTEL_MSIC_ADC1OFFSETH 0x1c3 /* RO */ 237 - #define INTEL_MSIC_ADC1OFFSETL 0x1c4 /* RO */ 238 - #define INTEL_MSIC_ADC1ADDR0 0x1c5 239 - #define INTEL_MSIC_ADC1ADDR1 0x1c6 240 - #define INTEL_MSIC_ADC1ADDR2 0x1c7 241 - #define INTEL_MSIC_ADC1ADDR3 0x1c8 242 - #define INTEL_MSIC_ADC1ADDR4 0x1c9 243 - #define INTEL_MSIC_ADC1ADDR5 0x1ca 244 - #define INTEL_MSIC_ADC1ADDR6 0x1cb 245 - #define INTEL_MSIC_ADC1ADDR7 0x1cc 246 - #define INTEL_MSIC_ADC1ADDR8 0x1cd 247 - #define INTEL_MSIC_ADC1ADDR9 0x1ce 248 - #define INTEL_MSIC_ADC1ADDR10 0x1cf 249 - #define INTEL_MSIC_ADC1ADDR11 0x1d0 250 - #define INTEL_MSIC_ADC1ADDR12 0x1d1 251 - #define INTEL_MSIC_ADC1ADDR13 0x1d2 252 - #define INTEL_MSIC_ADC1ADDR14 0x1d3 253 - #define INTEL_MSIC_ADC1SNS0H 0x1d4 /* RO */ 254 - #define INTEL_MSIC_ADC1SNS0L 0x1d5 /* RO */ 255 - #define INTEL_MSIC_ADC1SNS1H 0x1d6 /* RO */ 256 - #define INTEL_MSIC_ADC1SNS1L 0x1d7 /* RO */ 257 - #define INTEL_MSIC_ADC1SNS2H 0x1d8 /* RO */ 258 - #define INTEL_MSIC_ADC1SNS2L 0x1d9 /* RO */ 259 - #define INTEL_MSIC_ADC1SNS3H 0x1da /* RO */ 260 - #define INTEL_MSIC_ADC1SNS3L 0x1db /* RO */ 261 - #define INTEL_MSIC_ADC1SNS4H 0x1dc /* RO */ 262 - #define INTEL_MSIC_ADC1SNS4L 0x1dd /* RO */ 263 - #define INTEL_MSIC_ADC1SNS5H 0x1de /* RO */ 264 - #define INTEL_MSIC_ADC1SNS5L 0x1df /* RO */ 265 - #define INTEL_MSIC_ADC1SNS6H 0x1e0 /* RO */ 266 - #define INTEL_MSIC_ADC1SNS6L 0x1e1 /* RO */ 267 - #define INTEL_MSIC_ADC1SNS7H 0x1e2 /* RO */ 268 - #define INTEL_MSIC_ADC1SNS7L 0x1e3 /* RO */ 269 - #define INTEL_MSIC_ADC1SNS8H 0x1e4 /* RO */ 270 - #define INTEL_MSIC_ADC1SNS8L 0x1e5 /* RO */ 271 - #define INTEL_MSIC_ADC1SNS9H 0x1e6 /* RO */ 272 - #define INTEL_MSIC_ADC1SNS9L 0x1e7 /* RO */ 273 - #define INTEL_MSIC_ADC1SNS10H 0x1e8 /* RO */ 274 - #define INTEL_MSIC_ADC1SNS10L 0x1e9 /* RO */ 275 - #define INTEL_MSIC_ADC1SNS11H 0x1ea /* RO */ 276 - #define INTEL_MSIC_ADC1SNS11L 0x1eb /* RO */ 277 - #define INTEL_MSIC_ADC1SNS12H 0x1ec /* RO */ 278 - #define INTEL_MSIC_ADC1SNS12L 0x1ed /* RO */ 279 - #define INTEL_MSIC_ADC1SNS13H 0x1ee /* RO */ 280 - #define INTEL_MSIC_ADC1SNS13L 0x1ef /* RO */ 281 - #define INTEL_MSIC_ADC1SNS14H 0x1f0 /* RO */ 282 - #define INTEL_MSIC_ADC1SNS14L 0x1f1 /* RO */ 283 - #define INTEL_MSIC_ADC1BV0H 0x1f2 /* RO */ 284 - #define INTEL_MSIC_ADC1BV0L 0x1f3 /* RO */ 285 - #define INTEL_MSIC_ADC1BV1H 0x1f4 /* RO */ 286 - #define INTEL_MSIC_ADC1BV1L 0x1f5 /* RO */ 287 - #define INTEL_MSIC_ADC1BV2H 0x1f6 /* RO */ 288 - #define INTEL_MSIC_ADC1BV2L 0x1f7 /* RO */ 289 - #define INTEL_MSIC_ADC1BV3H 0x1f8 /* RO */ 290 - #define INTEL_MSIC_ADC1BV3L 0x1f9 /* RO */ 291 - #define INTEL_MSIC_ADC1BI0H 0x1fa /* RO */ 292 - #define INTEL_MSIC_ADC1BI0L 0x1fb /* RO */ 293 - #define INTEL_MSIC_ADC1BI1H 0x1fc /* RO */ 294 - #define INTEL_MSIC_ADC1BI1L 0x1fd /* RO */ 295 - #define INTEL_MSIC_ADC1BI2H 0x1fe /* RO */ 296 - #define INTEL_MSIC_ADC1BI2L 0x1ff /* RO */ 297 - #define INTEL_MSIC_ADC1BI3H 0x200 /* RO */ 298 - #define INTEL_MSIC_ADC1BI3L 0x201 /* RO */ 299 - #define INTEL_MSIC_CCCNTL 0x202 300 - #define INTEL_MSIC_CCOFFSETH 0x203 /* RO */ 301 - #define INTEL_MSIC_CCOFFSETL 0x204 /* RO */ 302 - #define INTEL_MSIC_CCADCHA 0x205 /* RO */ 303 - #define INTEL_MSIC_CCADCLA 0x206 /* RO */ 304 - 305 - /* AUDIO */ 306 - #define INTEL_MSIC_AUDPLLCTRL 0x240 307 - #define INTEL_MSIC_DMICBUF0123 0x241 308 - #define INTEL_MSIC_DMICBUF45 0x242 309 - #define INTEL_MSIC_DMICGPO 0x244 310 - #define INTEL_MSIC_DMICMUX 0x245 311 - #define INTEL_MSIC_DMICCLK 0x246 312 - #define INTEL_MSIC_MICBIAS 0x247 313 - #define INTEL_MSIC_ADCCONFIG 0x248 314 - #define INTEL_MSIC_MICAMP1 0x249 315 - #define INTEL_MSIC_MICAMP2 0x24a 316 - #define INTEL_MSIC_NOISEMUX 0x24b 317 - #define INTEL_MSIC_AUDIOMUX12 0x24c 318 - #define INTEL_MSIC_AUDIOMUX34 0x24d 319 - #define INTEL_MSIC_AUDIOSINC 0x24e 320 - #define INTEL_MSIC_AUDIOTXEN 0x24f 321 - #define INTEL_MSIC_HSEPRXCTRL 0x250 322 - #define INTEL_MSIC_IHFRXCTRL 0x251 323 - #define INTEL_MSIC_VOICETXVOL 0x252 324 - #define INTEL_MSIC_SIDETONEVOL 0x253 325 - #define INTEL_MSIC_MUSICSHARVOL 0x254 326 - #define INTEL_MSIC_VOICETXCTRL 0x255 327 - #define INTEL_MSIC_HSMIXER 0x256 328 - #define INTEL_MSIC_DACCONFIG 0x257 329 - #define INTEL_MSIC_SOFTMUTE 0x258 330 - #define INTEL_MSIC_HSLVOLCTRL 0x259 331 - #define INTEL_MSIC_HSRVOLCTRL 0x25a 332 - #define INTEL_MSIC_IHFLVOLCTRL 0x25b 333 - #define INTEL_MSIC_IHFRVOLCTRL 0x25c 334 - #define INTEL_MSIC_DRIVEREN 0x25d 335 - #define INTEL_MSIC_LINEOUTCTRL 0x25e 336 - #define INTEL_MSIC_VIB1CTRL1 0x25f 337 - #define INTEL_MSIC_VIB1CTRL2 0x260 338 - #define INTEL_MSIC_VIB1CTRL3 0x261 339 - #define INTEL_MSIC_VIB1SPIPCM_1 0x262 340 - #define INTEL_MSIC_VIB1SPIPCM_2 0x263 341 - #define INTEL_MSIC_VIB1CTRL5 0x264 342 - #define INTEL_MSIC_VIB2CTRL1 0x265 343 - #define INTEL_MSIC_VIB2CTRL2 0x266 344 - #define INTEL_MSIC_VIB2CTRL3 0x267 345 - #define INTEL_MSIC_VIB2SPIPCM_1 0x268 346 - #define INTEL_MSIC_VIB2SPIPCM_2 0x269 347 - #define INTEL_MSIC_VIB2CTRL5 0x26a 348 - #define INTEL_MSIC_BTNCTRL1 0x26b 349 - #define INTEL_MSIC_BTNCTRL2 0x26c 350 - #define INTEL_MSIC_PCM1TXSLOT01 0x26d 351 - #define INTEL_MSIC_PCM1TXSLOT23 0x26e 352 - #define INTEL_MSIC_PCM1TXSLOT45 0x26f 353 - #define INTEL_MSIC_PCM1RXSLOT0123 0x270 354 - #define INTEL_MSIC_PCM1RXSLOT045 0x271 355 - #define INTEL_MSIC_PCM2TXSLOT01 0x272 356 - #define INTEL_MSIC_PCM2TXSLOT23 0x273 357 - #define INTEL_MSIC_PCM2TXSLOT45 0x274 358 - #define INTEL_MSIC_PCM2RXSLOT01 0x275 359 - #define INTEL_MSIC_PCM2RXSLOT23 0x276 360 - #define INTEL_MSIC_PCM2RXSLOT45 0x277 361 - #define INTEL_MSIC_PCM1CTRL1 0x278 362 - #define INTEL_MSIC_PCM1CTRL2 0x279 363 - #define INTEL_MSIC_PCM1CTRL3 0x27a 364 - #define INTEL_MSIC_PCM2CTRL1 0x27b 365 - #define INTEL_MSIC_PCM2CTRL2 0x27c 366 - 367 - /* HDMI */ 368 - #define INTEL_MSIC_HDMIPUEN 0x280 369 - #define INTEL_MSIC_HDMISTATUS 0x281 /* RO */ 370 - 371 - /* Physical address of the start of the MSIC interrupt tree in SRAM */ 372 - #define INTEL_MSIC_IRQ_PHYS_BASE 0xffff7fc0 373 - 374 - /** 375 - * struct intel_msic_gpio_pdata - platform data for the MSIC GPIO driver 376 - * @gpio_base: base number for the GPIOs 377 - */ 378 - struct intel_msic_gpio_pdata { 379 - unsigned gpio_base; 380 - }; 381 - 382 - /** 383 - * struct intel_msic_ocd_pdata - platform data for the MSIC OCD driver 384 - * @gpio: GPIO number used for OCD interrupts 385 - * 386 - * The MSIC MFD driver converts @gpio into an IRQ number and passes it to 387 - * the OCD driver as %IORESOURCE_IRQ. 388 - */ 389 - struct intel_msic_ocd_pdata { 390 - unsigned gpio; 391 - }; 392 - 393 - /* MSIC embedded blocks (subdevices) */ 394 - enum intel_msic_block { 395 - INTEL_MSIC_BLOCK_TOUCH, 396 - INTEL_MSIC_BLOCK_ADC, 397 - INTEL_MSIC_BLOCK_BATTERY, 398 - INTEL_MSIC_BLOCK_GPIO, 399 - INTEL_MSIC_BLOCK_AUDIO, 400 - INTEL_MSIC_BLOCK_HDMI, 401 - INTEL_MSIC_BLOCK_THERMAL, 402 - INTEL_MSIC_BLOCK_POWER_BTN, 403 - INTEL_MSIC_BLOCK_OCD, 404 - 405 - INTEL_MSIC_BLOCK_LAST, 406 - }; 407 - 408 - /** 409 - * struct intel_msic_platform_data - platform data for the MSIC driver 410 - * @irq: array of interrupt numbers, one per device. If @irq is set to %0 411 - * for a given block, the corresponding platform device is not 412 - * created. For devices which don't have an interrupt, use %0xff 413 - * (this is same as in SFI spec). 414 - * @gpio: platform data for the MSIC GPIO driver 415 - * @ocd: platform data for the MSIC OCD driver 416 - * 417 - * Once the MSIC driver is initialized, the register interface is ready to 418 - * use. All the platform devices for subdevices are created after the 419 - * register interface is ready so that we can guarantee its availability to 420 - * the subdevice drivers. 421 - * 422 - * Interrupt numbers are passed to the subdevices via %IORESOURCE_IRQ 423 - * resources of the created platform device. 424 - */ 425 - struct intel_msic_platform_data { 426 - int irq[INTEL_MSIC_BLOCK_LAST]; 427 - struct intel_msic_gpio_pdata *gpio; 428 - struct intel_msic_ocd_pdata *ocd; 429 - }; 430 - 431 - struct intel_msic; 432 - 433 - extern int intel_msic_reg_read(unsigned short reg, u8 *val); 434 - extern int intel_msic_reg_write(unsigned short reg, u8 val); 435 - extern int intel_msic_reg_update(unsigned short reg, u8 val, u8 mask); 436 - extern int intel_msic_bulk_read(unsigned short *reg, u8 *buf, size_t count); 437 - extern int intel_msic_bulk_write(unsigned short *reg, u8 *buf, size_t count); 438 - 439 - /* 440 - * pdev_to_intel_msic - gets an MSIC instance from the platform device 441 - * @pdev: platform device pointer 442 - * 443 - * The client drivers need to have pointer to the MSIC instance if they 444 - * want to call intel_msic_irq_read(). This macro can be used for 445 - * convenience to get the MSIC pointer from @pdev where needed. This is 446 - * _only_ valid for devices which are managed by the MSIC. 447 - */ 448 - #define pdev_to_intel_msic(pdev) (dev_get_drvdata(pdev->dev.parent)) 449 - 450 - extern int intel_msic_irq_read(struct intel_msic *msic, unsigned short reg, 451 - u8 *val); 452 - 453 - #endif /* __LINUX_MFD_INTEL_MSIC_H__ */
-210
include/linux/sfi.h
··· 1 - /* sfi.h Simple Firmware Interface */ 2 - 3 - /* 4 - 5 - This file is provided under a dual BSD/GPLv2 license. When using or 6 - redistributing this file, you may do so under either license. 7 - 8 - GPL LICENSE SUMMARY 9 - 10 - Copyright(c) 2009 Intel Corporation. All rights reserved. 11 - 12 - This program is free software; you can redistribute it and/or modify 13 - it under the terms of version 2 of the GNU General Public License as 14 - published by the Free Software Foundation. 15 - 16 - This program is distributed in the hope that it will be useful, but 17 - WITHOUT ANY WARRANTY; without even the implied warranty of 18 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 - General Public License for more details. 20 - 21 - You should have received a copy of the GNU General Public License 22 - along with this program; if not, write to the Free Software 23 - Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 24 - The full GNU General Public License is included in this distribution 25 - in the file called LICENSE.GPL. 26 - 27 - BSD LICENSE 28 - 29 - Copyright(c) 2009 Intel Corporation. All rights reserved. 30 - 31 - Redistribution and use in source and binary forms, with or without 32 - modification, are permitted provided that the following conditions 33 - are met: 34 - 35 - * Redistributions of source code must retain the above copyright 36 - notice, this list of conditions and the following disclaimer. 37 - * Redistributions in binary form must reproduce the above copyright 38 - notice, this list of conditions and the following disclaimer in 39 - the documentation and/or other materials provided with the 40 - distribution. 41 - * Neither the name of Intel Corporation nor the names of its 42 - contributors may be used to endorse or promote products derived 43 - from this software without specific prior written permission. 44 - 45 - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 46 - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 47 - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 48 - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 49 - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 50 - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 51 - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 52 - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 53 - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 54 - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 55 - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 56 - 57 - */ 58 - 59 - #ifndef _LINUX_SFI_H 60 - #define _LINUX_SFI_H 61 - 62 - #include <linux/init.h> 63 - #include <linux/types.h> 64 - 65 - /* Table signatures reserved by the SFI specification */ 66 - #define SFI_SIG_SYST "SYST" 67 - #define SFI_SIG_FREQ "FREQ" 68 - #define SFI_SIG_IDLE "IDLE" 69 - #define SFI_SIG_CPUS "CPUS" 70 - #define SFI_SIG_MTMR "MTMR" 71 - #define SFI_SIG_MRTC "MRTC" 72 - #define SFI_SIG_MMAP "MMAP" 73 - #define SFI_SIG_APIC "APIC" 74 - #define SFI_SIG_XSDT "XSDT" 75 - #define SFI_SIG_WAKE "WAKE" 76 - #define SFI_SIG_DEVS "DEVS" 77 - #define SFI_SIG_GPIO "GPIO" 78 - 79 - #define SFI_SIGNATURE_SIZE 4 80 - #define SFI_OEM_ID_SIZE 6 81 - #define SFI_OEM_TABLE_ID_SIZE 8 82 - 83 - #define SFI_NAME_LEN 16 84 - 85 - #define SFI_SYST_SEARCH_BEGIN 0x000E0000 86 - #define SFI_SYST_SEARCH_END 0x000FFFFF 87 - 88 - #define SFI_GET_NUM_ENTRIES(ptable, entry_type) \ 89 - ((ptable->header.len - sizeof(struct sfi_table_header)) / \ 90 - (sizeof(entry_type))) 91 - /* 92 - * Table structures must be byte-packed to match the SFI specification, 93 - * as they are provided by the BIOS. 94 - */ 95 - struct sfi_table_header { 96 - char sig[SFI_SIGNATURE_SIZE]; 97 - u32 len; 98 - u8 rev; 99 - u8 csum; 100 - char oem_id[SFI_OEM_ID_SIZE]; 101 - char oem_table_id[SFI_OEM_TABLE_ID_SIZE]; 102 - } __packed; 103 - 104 - struct sfi_table_simple { 105 - struct sfi_table_header header; 106 - u64 pentry[1]; 107 - } __packed; 108 - 109 - /* Comply with UEFI spec 2.1 */ 110 - struct sfi_mem_entry { 111 - u32 type; 112 - u64 phys_start; 113 - u64 virt_start; 114 - u64 pages; 115 - u64 attrib; 116 - } __packed; 117 - 118 - struct sfi_cpu_table_entry { 119 - u32 apic_id; 120 - } __packed; 121 - 122 - struct sfi_cstate_table_entry { 123 - u32 hint; /* MWAIT hint */ 124 - u32 latency; /* latency in ms */ 125 - } __packed; 126 - 127 - struct sfi_apic_table_entry { 128 - u64 phys_addr; /* phy base addr for APIC reg */ 129 - } __packed; 130 - 131 - struct sfi_freq_table_entry { 132 - u32 freq_mhz; /* in MHZ */ 133 - u32 latency; /* transition latency in ms */ 134 - u32 ctrl_val; /* value to write to PERF_CTL */ 135 - } __packed; 136 - 137 - struct sfi_wake_table_entry { 138 - u64 phys_addr; /* pointer to where the wake vector locates */ 139 - } __packed; 140 - 141 - struct sfi_timer_table_entry { 142 - u64 phys_addr; /* phy base addr for the timer */ 143 - u32 freq_hz; /* in HZ */ 144 - u32 irq; 145 - } __packed; 146 - 147 - struct sfi_rtc_table_entry { 148 - u64 phys_addr; /* phy base addr for the RTC */ 149 - u32 irq; 150 - } __packed; 151 - 152 - struct sfi_device_table_entry { 153 - u8 type; /* bus type, I2C, SPI or ...*/ 154 - #define SFI_DEV_TYPE_SPI 0 155 - #define SFI_DEV_TYPE_I2C 1 156 - #define SFI_DEV_TYPE_UART 2 157 - #define SFI_DEV_TYPE_HSI 3 158 - #define SFI_DEV_TYPE_IPC 4 159 - #define SFI_DEV_TYPE_SD 5 160 - 161 - u8 host_num; /* attached to host 0, 1...*/ 162 - u16 addr; 163 - u8 irq; 164 - u32 max_freq; 165 - char name[SFI_NAME_LEN]; 166 - } __packed; 167 - 168 - struct sfi_gpio_table_entry { 169 - char controller_name[SFI_NAME_LEN]; 170 - u16 pin_no; 171 - char pin_name[SFI_NAME_LEN]; 172 - } __packed; 173 - 174 - typedef int (*sfi_table_handler) (struct sfi_table_header *table); 175 - 176 - #ifdef CONFIG_SFI 177 - extern void __init sfi_init(void); 178 - extern int __init sfi_platform_init(void); 179 - extern void __init sfi_init_late(void); 180 - extern int sfi_table_parse(char *signature, char *oem_id, char *oem_table_id, 181 - sfi_table_handler handler); 182 - 183 - extern int sfi_disabled; 184 - static inline void disable_sfi(void) 185 - { 186 - sfi_disabled = 1; 187 - } 188 - 189 - #else /* !CONFIG_SFI */ 190 - 191 - static inline void sfi_init(void) 192 - { 193 - } 194 - 195 - static inline void sfi_init_late(void) 196 - { 197 - } 198 - 199 - #define sfi_disabled 0 200 - 201 - static inline int sfi_table_parse(char *signature, char *oem_id, 202 - char *oem_table_id, 203 - sfi_table_handler handler) 204 - { 205 - return -1; 206 - } 207 - 208 - #endif /* !CONFIG_SFI */ 209 - 210 - #endif /*_LINUX_SFI_H*/
-93
include/linux/sfi_acpi.h
··· 1 - /* sfi.h Simple Firmware Interface */ 2 - 3 - /* 4 - 5 - This file is provided under a dual BSD/GPLv2 license. When using or 6 - redistributing this file, you may do so under either license. 7 - 8 - GPL LICENSE SUMMARY 9 - 10 - Copyright(c) 2009 Intel Corporation. All rights reserved. 11 - 12 - This program is free software; you can redistribute it and/or modify 13 - it under the terms of version 2 of the GNU General Public License as 14 - published by the Free Software Foundation. 15 - 16 - This program is distributed in the hope that it will be useful, but 17 - WITHOUT ANY WARRANTY; without even the implied warranty of 18 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 - General Public License for more details. 20 - 21 - You should have received a copy of the GNU General Public License 22 - along with this program; if not, write to the Free Software 23 - Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 24 - The full GNU General Public License is included in this distribution 25 - in the file called LICENSE.GPL. 26 - 27 - BSD LICENSE 28 - 29 - Copyright(c) 2009 Intel Corporation. All rights reserved. 30 - 31 - Redistribution and use in source and binary forms, with or without 32 - modification, are permitted provided that the following conditions 33 - are met: 34 - 35 - * Redistributions of source code must retain the above copyright 36 - notice, this list of conditions and the following disclaimer. 37 - * Redistributions in binary form must reproduce the above copyright 38 - notice, this list of conditions and the following disclaimer in 39 - the documentation and/or other materials provided with the 40 - distribution. 41 - * Neither the name of Intel Corporation nor the names of its 42 - contributors may be used to endorse or promote products derived 43 - from this software without specific prior written permission. 44 - 45 - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 46 - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 47 - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 48 - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 49 - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 50 - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 51 - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 52 - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 53 - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 54 - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 55 - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 56 - 57 - */ 58 - 59 - #ifndef _LINUX_SFI_ACPI_H 60 - #define _LINUX_SFI_ACPI_H 61 - 62 - #include <linux/acpi.h> 63 - #include <linux/sfi.h> 64 - 65 - #ifdef CONFIG_SFI 66 - extern int sfi_acpi_table_parse(char *signature, char *oem_id, 67 - char *oem_table_id, 68 - int (*handler)(struct acpi_table_header *)); 69 - 70 - static inline int __init acpi_sfi_table_parse(char *signature, 71 - int (*handler)(struct acpi_table_header *)) 72 - { 73 - if (!acpi_table_parse(signature, handler)) 74 - return 0; 75 - 76 - return sfi_acpi_table_parse(signature, NULL, NULL, handler); 77 - } 78 - #else /* !CONFIG_SFI */ 79 - static inline int sfi_acpi_table_parse(char *signature, char *oem_id, 80 - char *oem_table_id, 81 - int (*handler)(struct acpi_table_header *)) 82 - { 83 - return -1; 84 - } 85 - 86 - static inline int __init acpi_sfi_table_parse(char *signature, 87 - int (*handler)(struct acpi_table_header *)) 88 - { 89 - return acpi_table_parse(signature, handler); 90 - } 91 - #endif /* !CONFIG_SFI */ 92 - 93 - #endif /*_LINUX_SFI_ACPI_H*/
-2
init/main.c
··· 74 74 #include <linux/kgdb.h> 75 75 #include <linux/ftrace.h> 76 76 #include <linux/async.h> 77 - #include <linux/sfi.h> 78 77 #include <linux/shmem_fs.h> 79 78 #include <linux/slab.h> 80 79 #include <linux/perf_event.h> ··· 1053 1054 1054 1055 acpi_subsystem_init(); 1055 1056 arch_post_acpi_subsys_init(); 1056 - sfi_init_late(); 1057 1057 kcsan_init(); 1058 1058 1059 1059 /* Do the rest non-__init'ed, we're now alive */