mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-24 19:40:21 +09:00
Merge tag 'v6.1.88' of git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable into odroidxu4-6.1.y
This is the 6.1.88 stable release Change-Id: I315dcc2c4e4ed33383be0d220065074892242be6
This commit is contained in:
@@ -6603,6 +6603,9 @@
|
||||
pause after every control message);
|
||||
o = USB_QUIRK_HUB_SLOW_RESET (Hub needs extra
|
||||
delay after resetting its port);
|
||||
p = USB_QUIRK_SHORT_SET_ADDRESS_REQ_TIMEOUT
|
||||
(Reduce timeout of the SET_ADDRESS
|
||||
request from 5000 ms to 500 ms);
|
||||
Example: quirks=0781:5580:bk,0a5c:5834:gij
|
||||
|
||||
usbhid.mousepoll=
|
||||
|
||||
@@ -8031,7 +8031,7 @@ M: Geoffrey D. Bennett <g@b4.vu>
|
||||
L: alsa-devel@alsa-project.org (moderated for non-subscribers)
|
||||
S: Maintained
|
||||
T: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
|
||||
F: sound/usb/mixer_scarlett_gen2.c
|
||||
F: sound/usb/mixer_scarlett2.c
|
||||
|
||||
FORCEDETH GIGABIT ETHERNET DRIVER
|
||||
M: Rain River <rain.1986.08.12@gmail.com>
|
||||
|
||||
2
Makefile
2
Makefile
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
VERSION = 6
|
||||
PATCHLEVEL = 1
|
||||
SUBLEVEL = 87
|
||||
SUBLEVEL = 88
|
||||
EXTRAVERSION =
|
||||
NAME = Curry Ramen
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <linux/platform_data/spi-omap2-mcspi.h>
|
||||
#include <linux/platform_data/mmc-omap.h>
|
||||
#include <linux/mfd/menelaus.h>
|
||||
#include <sound/tlv320aic3x.h>
|
||||
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach-types.h>
|
||||
@@ -567,10 +566,6 @@ struct menelaus_platform_data n8x0_menelaus_platform_data = {
|
||||
.late_init = n8x0_menelaus_late_init,
|
||||
};
|
||||
|
||||
struct aic3x_pdata n810_aic33_data = {
|
||||
.gpio_reset = 118,
|
||||
};
|
||||
|
||||
static int __init n8x0_late_initcall(void)
|
||||
{
|
||||
if (!board_caps)
|
||||
|
||||
@@ -2,12 +2,10 @@
|
||||
#ifndef __OMAP_COMMON_BOARD_DEVICES__
|
||||
#define __OMAP_COMMON_BOARD_DEVICES__
|
||||
|
||||
#include <sound/tlv320aic3x.h>
|
||||
#include <linux/mfd/menelaus.h>
|
||||
|
||||
void *n8x0_legacy_init(void);
|
||||
|
||||
extern struct menelaus_platform_data n8x0_menelaus_platform_data;
|
||||
extern struct aic3x_pdata n810_aic33_data;
|
||||
|
||||
#endif /* __OMAP_COMMON_BOARD_DEVICES__ */
|
||||
|
||||
@@ -257,9 +257,19 @@ static struct platform_device pandora_backlight = {
|
||||
.id = -1,
|
||||
};
|
||||
|
||||
static struct gpiod_lookup_table pandora_soc_audio_gpios = {
|
||||
.dev_id = "soc-audio",
|
||||
.table = {
|
||||
GPIO_LOOKUP("gpio-112-127", 6, "dac", GPIO_ACTIVE_HIGH),
|
||||
GPIO_LOOKUP("gpio-0-15", 14, "amp", GPIO_ACTIVE_HIGH),
|
||||
{ }
|
||||
},
|
||||
};
|
||||
|
||||
static void __init omap3_pandora_legacy_init(void)
|
||||
{
|
||||
platform_device_register(&pandora_backlight);
|
||||
gpiod_add_lookup_table(&pandora_soc_audio_gpios);
|
||||
}
|
||||
#endif /* CONFIG_ARCH_OMAP3 */
|
||||
|
||||
@@ -440,7 +450,6 @@ static struct of_dev_auxdata omap_auxdata_lookup[] = {
|
||||
#ifdef CONFIG_MACH_NOKIA_N8X0
|
||||
OF_DEV_AUXDATA("ti,omap2420-mmc", 0x4809c000, "mmci-omap.0", NULL),
|
||||
OF_DEV_AUXDATA("menelaus", 0x72, "1-0072", &n8x0_menelaus_platform_data),
|
||||
OF_DEV_AUXDATA("tlv320aic3x", 0x18, "2-0018", &n810_aic33_data),
|
||||
#endif
|
||||
#ifdef CONFIG_ARCH_OMAP3
|
||||
OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu",
|
||||
|
||||
@@ -220,9 +220,6 @@ bool kernel_page_present(struct page *page)
|
||||
pte_t *ptep;
|
||||
unsigned long addr = (unsigned long)page_address(page);
|
||||
|
||||
if (!can_set_direct_map())
|
||||
return true;
|
||||
|
||||
pgdp = pgd_offset_k(addr);
|
||||
if (pgd_none(READ_ONCE(*pgdp)))
|
||||
return false;
|
||||
|
||||
@@ -91,7 +91,7 @@ $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
|
||||
|
||||
SETUP_OBJS = $(addprefix $(obj)/,$(setup-y))
|
||||
|
||||
sed-zoffset := -e 's/^\([0-9a-fA-F]*\) [a-zA-Z] \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|efi32_pe_entry\|input_data\|kernel_info\|_end\|_ehead\|_text\|z_.*\)$$/\#define ZO_\2 0x\1/p'
|
||||
sed-zoffset := -e 's/^\([0-9a-fA-F]*\) [a-zA-Z] \(startup_32\|efi.._stub_entry\|efi\(32\)\?_pe_entry\|input_data\|kernel_info\|_end\|_ehead\|_text\|_e\?data\|z_.*\)$$/\#define ZO_\2 0x\1/p'
|
||||
|
||||
quiet_cmd_zoffset = ZOFFSET $@
|
||||
cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@
|
||||
|
||||
@@ -84,7 +84,7 @@ LDFLAGS_vmlinux += -T
|
||||
hostprogs := mkpiggy
|
||||
HOST_EXTRACFLAGS += -I$(srctree)/tools/include
|
||||
|
||||
sed-voffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(_text\|__bss_start\|_end\)$$/\#define VO_\2 _AC(0x\1,UL)/p'
|
||||
sed-voffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(_text\|__start_rodata\|__bss_start\|_end\)$$/\#define VO_\2 _AC(0x\1,UL)/p'
|
||||
|
||||
quiet_cmd_voffset = VOFFSET $@
|
||||
cmd_voffset = $(NM) $< | sed -n $(sed-voffset) > $@
|
||||
|
||||
@@ -330,6 +330,7 @@ static size_t parse_elf(void *output)
|
||||
return ehdr.e_entry - LOAD_PHYSICAL_ADDR;
|
||||
}
|
||||
|
||||
const unsigned long kernel_text_size = VO___start_rodata - VO__text;
|
||||
const unsigned long kernel_total_size = VO__end - VO__text;
|
||||
|
||||
static u8 boot_heap[BOOT_HEAP_SIZE] __aligned(4);
|
||||
|
||||
@@ -118,6 +118,9 @@ static bool fault_in_kernel_space(unsigned long address)
|
||||
#define __init
|
||||
#define __pa(x) ((unsigned long)(x))
|
||||
|
||||
#undef __head
|
||||
#define __head
|
||||
|
||||
#define __BOOT_COMPRESSED
|
||||
|
||||
/* Basic instruction decoding support needed */
|
||||
|
||||
@@ -42,11 +42,13 @@ SECTIONS
|
||||
*(.rodata.*)
|
||||
_erodata = . ;
|
||||
}
|
||||
.data : {
|
||||
.data : ALIGN(0x1000) {
|
||||
_data = . ;
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.bss.efistub)
|
||||
|
||||
/* Add 4 bytes of extra space for a CRC-32 checksum */
|
||||
. = ALIGN(. + 4, 0x200);
|
||||
_edata = . ;
|
||||
}
|
||||
. = ALIGN(L1_CACHE_BYTES);
|
||||
|
||||
@@ -36,65 +36,19 @@ SYSSEG = 0x1000 /* historical load address >> 4 */
|
||||
#define ROOT_RDONLY 1
|
||||
#endif
|
||||
|
||||
.set salign, 0x1000
|
||||
.set falign, 0x200
|
||||
|
||||
.code16
|
||||
.section ".bstext", "ax"
|
||||
|
||||
.global bootsect_start
|
||||
bootsect_start:
|
||||
#ifdef CONFIG_EFI_STUB
|
||||
# "MZ", MS-DOS header
|
||||
.word MZ_MAGIC
|
||||
#endif
|
||||
|
||||
# Normalize the start address
|
||||
ljmp $BOOTSEG, $start2
|
||||
|
||||
start2:
|
||||
movw %cs, %ax
|
||||
movw %ax, %ds
|
||||
movw %ax, %es
|
||||
movw %ax, %ss
|
||||
xorw %sp, %sp
|
||||
sti
|
||||
cld
|
||||
|
||||
movw $bugger_off_msg, %si
|
||||
|
||||
msg_loop:
|
||||
lodsb
|
||||
andb %al, %al
|
||||
jz bs_die
|
||||
movb $0xe, %ah
|
||||
movw $7, %bx
|
||||
int $0x10
|
||||
jmp msg_loop
|
||||
|
||||
bs_die:
|
||||
# Allow the user to press a key, then reboot
|
||||
xorw %ax, %ax
|
||||
int $0x16
|
||||
int $0x19
|
||||
|
||||
# int 0x19 should never return. In case it does anyway,
|
||||
# invoke the BIOS reset code...
|
||||
ljmp $0xf000,$0xfff0
|
||||
|
||||
#ifdef CONFIG_EFI_STUB
|
||||
.org 0x3c
|
||||
#
|
||||
# Offset to the PE header.
|
||||
#
|
||||
.long pe_header
|
||||
#endif /* CONFIG_EFI_STUB */
|
||||
|
||||
.section ".bsdata", "a"
|
||||
bugger_off_msg:
|
||||
.ascii "Use a boot loader.\r\n"
|
||||
.ascii "\n"
|
||||
.ascii "Remove disk and press any key to reboot...\r\n"
|
||||
.byte 0
|
||||
|
||||
#ifdef CONFIG_EFI_STUB
|
||||
pe_header:
|
||||
.long PE_MAGIC
|
||||
|
||||
@@ -123,30 +77,26 @@ optional_header:
|
||||
.byte 0x02 # MajorLinkerVersion
|
||||
.byte 0x14 # MinorLinkerVersion
|
||||
|
||||
# Filled in by build.c
|
||||
.long 0 # SizeOfCode
|
||||
.long ZO__data # SizeOfCode
|
||||
|
||||
.long 0 # SizeOfInitializedData
|
||||
.long ZO__end - ZO__data # SizeOfInitializedData
|
||||
.long 0 # SizeOfUninitializedData
|
||||
|
||||
# Filled in by build.c
|
||||
.long 0x0000 # AddressOfEntryPoint
|
||||
.long setup_size + ZO_efi_pe_entry # AddressOfEntryPoint
|
||||
|
||||
.long 0x0200 # BaseOfCode
|
||||
.long setup_size # BaseOfCode
|
||||
#ifdef CONFIG_X86_32
|
||||
.long 0 # data
|
||||
#endif
|
||||
|
||||
extra_header_fields:
|
||||
# PE specification requires ImageBase to be 64k aligned
|
||||
.set image_base, (LOAD_PHYSICAL_ADDR + 0xffff) & ~0xffff
|
||||
#ifdef CONFIG_X86_32
|
||||
.long image_base # ImageBase
|
||||
.long 0 # ImageBase
|
||||
#else
|
||||
.quad image_base # ImageBase
|
||||
.quad 0 # ImageBase
|
||||
#endif
|
||||
.long 0x20 # SectionAlignment
|
||||
.long 0x20 # FileAlignment
|
||||
.long salign # SectionAlignment
|
||||
.long falign # FileAlignment
|
||||
.word 0 # MajorOperatingSystemVersion
|
||||
.word 0 # MinorOperatingSystemVersion
|
||||
.word LINUX_EFISTUB_MAJOR_VERSION # MajorImageVersion
|
||||
@@ -155,12 +105,9 @@ extra_header_fields:
|
||||
.word 0 # MinorSubsystemVersion
|
||||
.long 0 # Win32VersionValue
|
||||
|
||||
#
|
||||
# The size of the bzImage is written in tools/build.c
|
||||
#
|
||||
.long 0 # SizeOfImage
|
||||
.long setup_size + ZO__end # SizeOfImage
|
||||
|
||||
.long 0x200 # SizeOfHeaders
|
||||
.long salign # SizeOfHeaders
|
||||
.long 0 # CheckSum
|
||||
.word IMAGE_SUBSYSTEM_EFI_APPLICATION # Subsystem (EFI application)
|
||||
#ifdef CONFIG_EFI_DXE_MEM_ATTRIBUTES
|
||||
@@ -191,87 +138,77 @@ extra_header_fields:
|
||||
|
||||
# Section table
|
||||
section_table:
|
||||
#
|
||||
# The offset & size fields are filled in by build.c.
|
||||
#
|
||||
.ascii ".setup"
|
||||
.byte 0
|
||||
.byte 0
|
||||
.long 0
|
||||
.long 0x0 # startup_{32,64}
|
||||
.long 0 # Size of initialized data
|
||||
# on disk
|
||||
.long 0x0 # startup_{32,64}
|
||||
.long 0 # PointerToRelocations
|
||||
.long 0 # PointerToLineNumbers
|
||||
.word 0 # NumberOfRelocations
|
||||
.word 0 # NumberOfLineNumbers
|
||||
.long IMAGE_SCN_CNT_CODE | \
|
||||
IMAGE_SCN_MEM_READ | \
|
||||
IMAGE_SCN_MEM_EXECUTE | \
|
||||
IMAGE_SCN_ALIGN_16BYTES # Characteristics
|
||||
.long pecompat_fstart - salign # VirtualSize
|
||||
.long salign # VirtualAddress
|
||||
.long pecompat_fstart - salign # SizeOfRawData
|
||||
.long salign # PointerToRawData
|
||||
|
||||
#
|
||||
# The EFI application loader requires a relocation section
|
||||
# because EFI applications must be relocatable. The .reloc
|
||||
# offset & size fields are filled in by build.c.
|
||||
#
|
||||
.ascii ".reloc"
|
||||
.byte 0
|
||||
.byte 0
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0 # SizeOfRawData
|
||||
.long 0 # PointerToRawData
|
||||
.long 0 # PointerToRelocations
|
||||
.long 0 # PointerToLineNumbers
|
||||
.word 0 # NumberOfRelocations
|
||||
.word 0 # NumberOfLineNumbers
|
||||
.long 0, 0, 0
|
||||
.long IMAGE_SCN_CNT_INITIALIZED_DATA | \
|
||||
IMAGE_SCN_MEM_READ | \
|
||||
IMAGE_SCN_MEM_DISCARDABLE | \
|
||||
IMAGE_SCN_ALIGN_1BYTES # Characteristics
|
||||
IMAGE_SCN_MEM_DISCARDABLE # Characteristics
|
||||
|
||||
#ifdef CONFIG_EFI_MIXED
|
||||
#
|
||||
# The offset & size fields are filled in by build.c.
|
||||
#
|
||||
.asciz ".compat"
|
||||
.long 0
|
||||
.long 0x0
|
||||
.long 0 # Size of initialized data
|
||||
# on disk
|
||||
.long 0x0
|
||||
.long 0 # PointerToRelocations
|
||||
.long 0 # PointerToLineNumbers
|
||||
.word 0 # NumberOfRelocations
|
||||
.word 0 # NumberOfLineNumbers
|
||||
|
||||
.long pecompat_fsize # VirtualSize
|
||||
.long pecompat_fstart # VirtualAddress
|
||||
.long pecompat_fsize # SizeOfRawData
|
||||
.long pecompat_fstart # PointerToRawData
|
||||
|
||||
.long 0, 0, 0
|
||||
.long IMAGE_SCN_CNT_INITIALIZED_DATA | \
|
||||
IMAGE_SCN_MEM_READ | \
|
||||
IMAGE_SCN_MEM_DISCARDABLE | \
|
||||
IMAGE_SCN_ALIGN_1BYTES # Characteristics
|
||||
#endif
|
||||
IMAGE_SCN_MEM_DISCARDABLE # Characteristics
|
||||
|
||||
#
|
||||
# The offset & size fields are filled in by build.c.
|
||||
#
|
||||
/*
|
||||
* Put the IA-32 machine type and the associated entry point address in
|
||||
* the .compat section, so loaders can figure out which other execution
|
||||
* modes this image supports.
|
||||
*/
|
||||
.pushsection ".pecompat", "a", @progbits
|
||||
.balign salign
|
||||
.globl pecompat_fstart
|
||||
pecompat_fstart:
|
||||
.byte 0x1 # Version
|
||||
.byte 8 # Size
|
||||
.word IMAGE_FILE_MACHINE_I386 # PE machine type
|
||||
.long setup_size + ZO_efi32_pe_entry # Entrypoint
|
||||
.byte 0x0 # Sentinel
|
||||
.popsection
|
||||
#else
|
||||
.set pecompat_fstart, setup_size
|
||||
#endif
|
||||
.ascii ".text"
|
||||
.byte 0
|
||||
.byte 0
|
||||
.byte 0
|
||||
.long 0
|
||||
.long 0x0 # startup_{32,64}
|
||||
.long 0 # Size of initialized data
|
||||
.long ZO__data
|
||||
.long setup_size
|
||||
.long ZO__data # Size of initialized data
|
||||
# on disk
|
||||
.long 0x0 # startup_{32,64}
|
||||
.long setup_size
|
||||
.long 0 # PointerToRelocations
|
||||
.long 0 # PointerToLineNumbers
|
||||
.word 0 # NumberOfRelocations
|
||||
.word 0 # NumberOfLineNumbers
|
||||
.long IMAGE_SCN_CNT_CODE | \
|
||||
IMAGE_SCN_MEM_READ | \
|
||||
IMAGE_SCN_MEM_EXECUTE | \
|
||||
IMAGE_SCN_ALIGN_16BYTES # Characteristics
|
||||
IMAGE_SCN_MEM_EXECUTE # Characteristics
|
||||
|
||||
.ascii ".data\0\0\0"
|
||||
.long ZO__end - ZO__data # VirtualSize
|
||||
.long setup_size + ZO__data # VirtualAddress
|
||||
.long ZO__edata - ZO__data # SizeOfRawData
|
||||
.long setup_size + ZO__data # PointerToRawData
|
||||
|
||||
.long 0, 0, 0
|
||||
.long IMAGE_SCN_CNT_INITIALIZED_DATA | \
|
||||
IMAGE_SCN_MEM_READ | \
|
||||
IMAGE_SCN_MEM_WRITE # Characteristics
|
||||
|
||||
.set section_count, (. - section_table) / 40
|
||||
#endif /* CONFIG_EFI_STUB */
|
||||
@@ -285,12 +222,12 @@ sentinel: .byte 0xff, 0xff /* Used to detect broken loaders */
|
||||
|
||||
.globl hdr
|
||||
hdr:
|
||||
setup_sects: .byte 0 /* Filled in by build.c */
|
||||
.byte setup_sects - 1
|
||||
root_flags: .word ROOT_RDONLY
|
||||
syssize: .long 0 /* Filled in by build.c */
|
||||
syssize: .long ZO__edata / 16
|
||||
ram_size: .word 0 /* Obsolete */
|
||||
vid_mode: .word SVGA_MODE
|
||||
root_dev: .word 0 /* Filled in by build.c */
|
||||
root_dev: .word 0 /* Default to major/minor 0/0 */
|
||||
boot_flag: .word 0xAA55
|
||||
|
||||
# offset 512, entry point
|
||||
@@ -578,9 +515,25 @@ pref_address: .quad LOAD_PHYSICAL_ADDR # preferred load addr
|
||||
# define INIT_SIZE VO_INIT_SIZE
|
||||
#endif
|
||||
|
||||
.macro __handover_offset
|
||||
#ifndef CONFIG_EFI_HANDOVER_PROTOCOL
|
||||
.long 0
|
||||
#elif !defined(CONFIG_X86_64)
|
||||
.long ZO_efi32_stub_entry
|
||||
#else
|
||||
/* Yes, this is really how we defined it :( */
|
||||
.long ZO_efi64_stub_entry - 0x200
|
||||
#ifdef CONFIG_EFI_MIXED
|
||||
.if ZO_efi32_stub_entry != ZO_efi64_stub_entry - 0x200
|
||||
.error "32-bit and 64-bit EFI entry points do not match"
|
||||
.endif
|
||||
#endif
|
||||
#endif
|
||||
.endm
|
||||
|
||||
init_size: .long INIT_SIZE # kernel initialization size
|
||||
handover_offset: .long 0 # Filled in by build.c
|
||||
kernel_info_offset: .long 0 # Filled in by build.c
|
||||
handover_offset: __handover_offset
|
||||
kernel_info_offset: .long ZO_kernel_info
|
||||
|
||||
# End of setup header #####################################################
|
||||
|
||||
|
||||
@@ -10,10 +10,11 @@ ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0;
|
||||
.bstext : { *(.bstext) }
|
||||
.bsdata : { *(.bsdata) }
|
||||
.bstext : {
|
||||
*(.bstext)
|
||||
. = 495;
|
||||
} =0xffffffff
|
||||
|
||||
. = 495;
|
||||
.header : { *(.header) }
|
||||
.entrytext : { *(.entrytext) }
|
||||
.inittext : { *(.inittext) }
|
||||
@@ -23,6 +24,9 @@ SECTIONS
|
||||
.text : { *(.text .text.*) }
|
||||
.text32 : { *(.text32) }
|
||||
|
||||
.pecompat : { *(.pecompat) }
|
||||
PROVIDE(pecompat_fsize = setup_size - pecompat_fstart);
|
||||
|
||||
. = ALIGN(16);
|
||||
.rodata : { *(.rodata*) }
|
||||
|
||||
@@ -38,8 +42,10 @@ SECTIONS
|
||||
.signature : {
|
||||
setup_sig = .;
|
||||
LONG(0x5a5aaa55)
|
||||
}
|
||||
|
||||
setup_size = ALIGN(ABSOLUTE(.), 4096);
|
||||
setup_sects = ABSOLUTE(setup_size / 512);
|
||||
}
|
||||
|
||||
. = ALIGN(16);
|
||||
.bss :
|
||||
|
||||
@@ -40,10 +40,6 @@ typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
|
||||
#define DEFAULT_MAJOR_ROOT 0
|
||||
#define DEFAULT_MINOR_ROOT 0
|
||||
#define DEFAULT_ROOT_DEV (DEFAULT_MAJOR_ROOT << 8 | DEFAULT_MINOR_ROOT)
|
||||
|
||||
/* Minimal number of setup sectors */
|
||||
#define SETUP_SECT_MIN 5
|
||||
#define SETUP_SECT_MAX 64
|
||||
@@ -51,22 +47,7 @@ typedef unsigned int u32;
|
||||
/* This must be large enough to hold the entire setup */
|
||||
u8 buf[SETUP_SECT_MAX*512];
|
||||
|
||||
#define PECOFF_RELOC_RESERVE 0x20
|
||||
|
||||
#ifdef CONFIG_EFI_MIXED
|
||||
#define PECOFF_COMPAT_RESERVE 0x20
|
||||
#else
|
||||
#define PECOFF_COMPAT_RESERVE 0x0
|
||||
#endif
|
||||
|
||||
static unsigned long efi32_stub_entry;
|
||||
static unsigned long efi64_stub_entry;
|
||||
static unsigned long efi_pe_entry;
|
||||
static unsigned long efi32_pe_entry;
|
||||
static unsigned long kernel_info;
|
||||
static unsigned long startup_64;
|
||||
static unsigned long _ehead;
|
||||
static unsigned long _end;
|
||||
static unsigned long _edata;
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -152,180 +133,6 @@ static void usage(void)
|
||||
die("Usage: build setup system zoffset.h image");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_EFI_STUB
|
||||
|
||||
static void update_pecoff_section_header_fields(char *section_name, u32 vma, u32 size, u32 datasz, u32 offset)
|
||||
{
|
||||
unsigned int pe_header;
|
||||
unsigned short num_sections;
|
||||
u8 *section;
|
||||
|
||||
pe_header = get_unaligned_le32(&buf[0x3c]);
|
||||
num_sections = get_unaligned_le16(&buf[pe_header + 6]);
|
||||
|
||||
#ifdef CONFIG_X86_32
|
||||
section = &buf[pe_header + 0xa8];
|
||||
#else
|
||||
section = &buf[pe_header + 0xb8];
|
||||
#endif
|
||||
|
||||
while (num_sections > 0) {
|
||||
if (strncmp((char*)section, section_name, 8) == 0) {
|
||||
/* section header size field */
|
||||
put_unaligned_le32(size, section + 0x8);
|
||||
|
||||
/* section header vma field */
|
||||
put_unaligned_le32(vma, section + 0xc);
|
||||
|
||||
/* section header 'size of initialised data' field */
|
||||
put_unaligned_le32(datasz, section + 0x10);
|
||||
|
||||
/* section header 'file offset' field */
|
||||
put_unaligned_le32(offset, section + 0x14);
|
||||
|
||||
break;
|
||||
}
|
||||
section += 0x28;
|
||||
num_sections--;
|
||||
}
|
||||
}
|
||||
|
||||
static void update_pecoff_section_header(char *section_name, u32 offset, u32 size)
|
||||
{
|
||||
update_pecoff_section_header_fields(section_name, offset, size, size, offset);
|
||||
}
|
||||
|
||||
static void update_pecoff_setup_and_reloc(unsigned int size)
|
||||
{
|
||||
u32 setup_offset = 0x200;
|
||||
u32 reloc_offset = size - PECOFF_RELOC_RESERVE - PECOFF_COMPAT_RESERVE;
|
||||
#ifdef CONFIG_EFI_MIXED
|
||||
u32 compat_offset = reloc_offset + PECOFF_RELOC_RESERVE;
|
||||
#endif
|
||||
u32 setup_size = reloc_offset - setup_offset;
|
||||
|
||||
update_pecoff_section_header(".setup", setup_offset, setup_size);
|
||||
update_pecoff_section_header(".reloc", reloc_offset, PECOFF_RELOC_RESERVE);
|
||||
|
||||
/*
|
||||
* Modify .reloc section contents with a single entry. The
|
||||
* relocation is applied to offset 10 of the relocation section.
|
||||
*/
|
||||
put_unaligned_le32(reloc_offset + 10, &buf[reloc_offset]);
|
||||
put_unaligned_le32(10, &buf[reloc_offset + 4]);
|
||||
|
||||
#ifdef CONFIG_EFI_MIXED
|
||||
update_pecoff_section_header(".compat", compat_offset, PECOFF_COMPAT_RESERVE);
|
||||
|
||||
/*
|
||||
* Put the IA-32 machine type (0x14c) and the associated entry point
|
||||
* address in the .compat section, so loaders can figure out which other
|
||||
* execution modes this image supports.
|
||||
*/
|
||||
buf[compat_offset] = 0x1;
|
||||
buf[compat_offset + 1] = 0x8;
|
||||
put_unaligned_le16(0x14c, &buf[compat_offset + 2]);
|
||||
put_unaligned_le32(efi32_pe_entry + size, &buf[compat_offset + 4]);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void update_pecoff_text(unsigned int text_start, unsigned int file_sz,
|
||||
unsigned int init_sz)
|
||||
{
|
||||
unsigned int pe_header;
|
||||
unsigned int text_sz = file_sz - text_start;
|
||||
unsigned int bss_sz = init_sz - file_sz;
|
||||
|
||||
pe_header = get_unaligned_le32(&buf[0x3c]);
|
||||
|
||||
/*
|
||||
* The PE/COFF loader may load the image at an address which is
|
||||
* misaligned with respect to the kernel_alignment field in the setup
|
||||
* header.
|
||||
*
|
||||
* In order to avoid relocating the kernel to correct the misalignment,
|
||||
* add slack to allow the buffer to be aligned within the declared size
|
||||
* of the image.
|
||||
*/
|
||||
bss_sz += CONFIG_PHYSICAL_ALIGN;
|
||||
init_sz += CONFIG_PHYSICAL_ALIGN;
|
||||
|
||||
/*
|
||||
* Size of code: Subtract the size of the first sector (512 bytes)
|
||||
* which includes the header.
|
||||
*/
|
||||
put_unaligned_le32(file_sz - 512 + bss_sz, &buf[pe_header + 0x1c]);
|
||||
|
||||
/* Size of image */
|
||||
put_unaligned_le32(init_sz, &buf[pe_header + 0x50]);
|
||||
|
||||
/*
|
||||
* Address of entry point for PE/COFF executable
|
||||
*/
|
||||
put_unaligned_le32(text_start + efi_pe_entry, &buf[pe_header + 0x28]);
|
||||
|
||||
update_pecoff_section_header_fields(".text", text_start, text_sz + bss_sz,
|
||||
text_sz, text_start);
|
||||
}
|
||||
|
||||
static int reserve_pecoff_reloc_section(int c)
|
||||
{
|
||||
/* Reserve 0x20 bytes for .reloc section */
|
||||
memset(buf+c, 0, PECOFF_RELOC_RESERVE);
|
||||
return PECOFF_RELOC_RESERVE;
|
||||
}
|
||||
|
||||
static void efi_stub_defaults(void)
|
||||
{
|
||||
/* Defaults for old kernel */
|
||||
#ifdef CONFIG_X86_32
|
||||
efi_pe_entry = 0x10;
|
||||
#else
|
||||
efi_pe_entry = 0x210;
|
||||
startup_64 = 0x200;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void efi_stub_entry_update(void)
|
||||
{
|
||||
unsigned long addr = efi32_stub_entry;
|
||||
|
||||
#ifdef CONFIG_EFI_HANDOVER_PROTOCOL
|
||||
#ifdef CONFIG_X86_64
|
||||
/* Yes, this is really how we defined it :( */
|
||||
addr = efi64_stub_entry - 0x200;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_EFI_MIXED
|
||||
if (efi32_stub_entry != addr)
|
||||
die("32-bit and 64-bit EFI entry points do not match\n");
|
||||
#endif
|
||||
#endif
|
||||
put_unaligned_le32(addr, &buf[0x264]);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline void update_pecoff_setup_and_reloc(unsigned int size) {}
|
||||
static inline void update_pecoff_text(unsigned int text_start,
|
||||
unsigned int file_sz,
|
||||
unsigned int init_sz) {}
|
||||
static inline void efi_stub_defaults(void) {}
|
||||
static inline void efi_stub_entry_update(void) {}
|
||||
|
||||
static inline int reserve_pecoff_reloc_section(int c)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_EFI_STUB */
|
||||
|
||||
static int reserve_pecoff_compat_section(int c)
|
||||
{
|
||||
/* Reserve 0x20 bytes for .compat section */
|
||||
memset(buf+c, 0, PECOFF_COMPAT_RESERVE);
|
||||
return PECOFF_COMPAT_RESERVE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse zoffset.h and find the entry points. We could just #include zoffset.h
|
||||
* but that would mean tools/build would have to be rebuilt every time. It's
|
||||
@@ -354,14 +161,7 @@ static void parse_zoffset(char *fname)
|
||||
p = (char *)buf;
|
||||
|
||||
while (p && *p) {
|
||||
PARSE_ZOFS(p, efi32_stub_entry);
|
||||
PARSE_ZOFS(p, efi64_stub_entry);
|
||||
PARSE_ZOFS(p, efi_pe_entry);
|
||||
PARSE_ZOFS(p, efi32_pe_entry);
|
||||
PARSE_ZOFS(p, kernel_info);
|
||||
PARSE_ZOFS(p, startup_64);
|
||||
PARSE_ZOFS(p, _ehead);
|
||||
PARSE_ZOFS(p, _end);
|
||||
PARSE_ZOFS(p, _edata);
|
||||
|
||||
p = strchr(p, '\n');
|
||||
while (p && (*p == '\r' || *p == '\n'))
|
||||
@@ -371,17 +171,14 @@ static void parse_zoffset(char *fname)
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
unsigned int i, sz, setup_sectors, init_sz;
|
||||
unsigned int i, sz, setup_sectors;
|
||||
int c;
|
||||
u32 sys_size;
|
||||
struct stat sb;
|
||||
FILE *file, *dest;
|
||||
int fd;
|
||||
void *kernel;
|
||||
u32 crc = 0xffffffffUL;
|
||||
|
||||
efi_stub_defaults();
|
||||
|
||||
if (argc != 5)
|
||||
usage();
|
||||
parse_zoffset(argv[3]);
|
||||
@@ -403,72 +200,27 @@ int main(int argc, char ** argv)
|
||||
die("Boot block hasn't got boot flag (0xAA55)");
|
||||
fclose(file);
|
||||
|
||||
c += reserve_pecoff_compat_section(c);
|
||||
c += reserve_pecoff_reloc_section(c);
|
||||
|
||||
/* Pad unused space with zeros */
|
||||
setup_sectors = (c + 511) / 512;
|
||||
setup_sectors = (c + 4095) / 4096;
|
||||
setup_sectors *= 8;
|
||||
if (setup_sectors < SETUP_SECT_MIN)
|
||||
setup_sectors = SETUP_SECT_MIN;
|
||||
i = setup_sectors*512;
|
||||
memset(buf+c, 0, i-c);
|
||||
|
||||
update_pecoff_setup_and_reloc(i);
|
||||
|
||||
/* Set the default root device */
|
||||
put_unaligned_le16(DEFAULT_ROOT_DEV, &buf[508]);
|
||||
|
||||
/* Open and stat the kernel file */
|
||||
fd = open(argv[2], O_RDONLY);
|
||||
if (fd < 0)
|
||||
die("Unable to open `%s': %m", argv[2]);
|
||||
if (fstat(fd, &sb))
|
||||
die("Unable to stat `%s': %m", argv[2]);
|
||||
sz = sb.st_size;
|
||||
if (_edata != sb.st_size)
|
||||
die("Unexpected file size `%s': %u != %u", argv[2], _edata,
|
||||
sb.st_size);
|
||||
sz = _edata - 4;
|
||||
kernel = mmap(NULL, sz, PROT_READ, MAP_SHARED, fd, 0);
|
||||
if (kernel == MAP_FAILED)
|
||||
die("Unable to mmap '%s': %m", argv[2]);
|
||||
/* Number of 16-byte paragraphs, including space for a 4-byte CRC */
|
||||
sys_size = (sz + 15 + 4) / 16;
|
||||
#ifdef CONFIG_EFI_STUB
|
||||
/*
|
||||
* COFF requires minimum 32-byte alignment of sections, and
|
||||
* adding a signature is problematic without that alignment.
|
||||
*/
|
||||
sys_size = (sys_size + 1) & ~1;
|
||||
#endif
|
||||
|
||||
/* Patch the setup code with the appropriate size parameters */
|
||||
buf[0x1f1] = setup_sectors-1;
|
||||
put_unaligned_le32(sys_size, &buf[0x1f4]);
|
||||
|
||||
init_sz = get_unaligned_le32(&buf[0x260]);
|
||||
#ifdef CONFIG_EFI_STUB
|
||||
/*
|
||||
* The decompression buffer will start at ImageBase. When relocating
|
||||
* the compressed kernel to its end, we must ensure that the head
|
||||
* section does not get overwritten. The head section occupies
|
||||
* [i, i + _ehead), and the destination is [init_sz - _end, init_sz).
|
||||
*
|
||||
* At present these should never overlap, because 'i' is at most 32k
|
||||
* because of SETUP_SECT_MAX, '_ehead' is less than 1k, and the
|
||||
* calculation of INIT_SIZE in boot/header.S ensures that
|
||||
* 'init_sz - _end' is at least 64k.
|
||||
*
|
||||
* For future-proofing, increase init_sz if necessary.
|
||||
*/
|
||||
|
||||
if (init_sz - _end < i + _ehead) {
|
||||
init_sz = (i + _ehead + _end + 4095) & ~4095;
|
||||
put_unaligned_le32(init_sz, &buf[0x260]);
|
||||
}
|
||||
#endif
|
||||
update_pecoff_text(setup_sectors * 512, i + (sys_size * 16), init_sz);
|
||||
|
||||
efi_stub_entry_update();
|
||||
|
||||
/* Update kernel_info offset. */
|
||||
put_unaligned_le32(kernel_info, &buf[0x268]);
|
||||
|
||||
crc = partial_crc32(buf, i, crc);
|
||||
if (fwrite(buf, 1, i, dest) != i)
|
||||
@@ -479,13 +231,6 @@ int main(int argc, char ** argv)
|
||||
if (fwrite(kernel, 1, sz, dest) != sz)
|
||||
die("Writing kernel failed");
|
||||
|
||||
/* Add padding leaving 4 bytes for the checksum */
|
||||
while (sz++ < (sys_size*16) - 4) {
|
||||
crc = partial_crc32_one('\0', crc);
|
||||
if (fwrite("\0", 1, 1, dest) != 1)
|
||||
die("Writing padding failed");
|
||||
}
|
||||
|
||||
/* Write the CRC */
|
||||
put_unaligned_le32(crc, buf);
|
||||
if (fwrite(buf, 1, 4, dest) != 4)
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
extern unsigned int output_len;
|
||||
extern const unsigned long kernel_text_size;
|
||||
extern const unsigned long kernel_total_size;
|
||||
|
||||
unsigned long decompress_kernel(unsigned char *outbuf, unsigned long virt_addr,
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#ifndef _ASM_X86_INIT_H
|
||||
#define _ASM_X86_INIT_H
|
||||
|
||||
#define __head __section(".head.text")
|
||||
|
||||
struct x86_mapping_info {
|
||||
void *(*alloc_pgt_page)(void *); /* allocate buf for page table */
|
||||
void *context; /* context for alloc_pgt_page */
|
||||
|
||||
@@ -773,6 +773,7 @@ struct kvm_vcpu_arch {
|
||||
int cpuid_nent;
|
||||
struct kvm_cpuid_entry2 *cpuid_entries;
|
||||
u32 kvm_cpuid_base;
|
||||
bool is_amd_compatible;
|
||||
|
||||
u64 reserved_gpa_bits;
|
||||
int maxphyaddr;
|
||||
|
||||
@@ -46,8 +46,8 @@ void __init sme_unmap_bootdata(char *real_mode_data);
|
||||
void __init sme_early_init(void);
|
||||
void __init sev_setup_arch(void);
|
||||
|
||||
void __init sme_encrypt_kernel(struct boot_params *bp);
|
||||
void __init sme_enable(struct boot_params *bp);
|
||||
void sme_encrypt_kernel(struct boot_params *bp);
|
||||
void sme_enable(struct boot_params *bp);
|
||||
|
||||
int __init early_set_memory_decrypted(unsigned long vaddr, unsigned long size);
|
||||
int __init early_set_memory_encrypted(unsigned long vaddr, unsigned long size);
|
||||
@@ -80,8 +80,8 @@ static inline void __init sme_unmap_bootdata(char *real_mode_data) { }
|
||||
static inline void __init sme_early_init(void) { }
|
||||
static inline void __init sev_setup_arch(void) { }
|
||||
|
||||
static inline void __init sme_encrypt_kernel(struct boot_params *bp) { }
|
||||
static inline void __init sme_enable(struct boot_params *bp) { }
|
||||
static inline void sme_encrypt_kernel(struct boot_params *bp) { }
|
||||
static inline void sme_enable(struct boot_params *bp) { }
|
||||
|
||||
static inline void sev_es_init_vc_handling(void) { }
|
||||
|
||||
|
||||
@@ -11,20 +11,14 @@
|
||||
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
|
||||
#define PAGE_MASK (~(PAGE_SIZE-1))
|
||||
|
||||
#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)
|
||||
#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))
|
||||
|
||||
#define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT)
|
||||
#define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1))
|
||||
|
||||
#define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1)
|
||||
|
||||
/* Cast *PAGE_MASK to a signed type so that it is sign-extended if
|
||||
/* Cast P*D_MASK to a signed type so that it is sign-extended if
|
||||
virtual addresses are 32-bits but physical addresses are larger
|
||||
(ie, 32-bit PAE). */
|
||||
#define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK)
|
||||
#define PHYSICAL_PMD_PAGE_MASK (((signed long)PMD_PAGE_MASK) & __PHYSICAL_MASK)
|
||||
#define PHYSICAL_PUD_PAGE_MASK (((signed long)PUD_PAGE_MASK) & __PHYSICAL_MASK)
|
||||
#define PHYSICAL_PMD_PAGE_MASK (((signed long)PMD_MASK) & __PHYSICAL_MASK)
|
||||
#define PHYSICAL_PUD_PAGE_MASK (((signed long)PUD_MASK) & __PHYSICAL_MASK)
|
||||
|
||||
#define HPAGE_SHIFT PMD_SHIFT
|
||||
#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
|
||||
|
||||
@@ -192,15 +192,15 @@ static inline int pvalidate(unsigned long vaddr, bool rmp_psize, bool validate)
|
||||
struct snp_guest_request_ioctl;
|
||||
|
||||
void setup_ghcb(void);
|
||||
void __init early_snp_set_memory_private(unsigned long vaddr, unsigned long paddr,
|
||||
unsigned long npages);
|
||||
void __init early_snp_set_memory_shared(unsigned long vaddr, unsigned long paddr,
|
||||
unsigned long npages);
|
||||
void early_snp_set_memory_private(unsigned long vaddr, unsigned long paddr,
|
||||
unsigned long npages);
|
||||
void early_snp_set_memory_shared(unsigned long vaddr, unsigned long paddr,
|
||||
unsigned long npages);
|
||||
void snp_set_memory_shared(unsigned long vaddr, unsigned long npages);
|
||||
void snp_set_memory_private(unsigned long vaddr, unsigned long npages);
|
||||
void snp_set_wakeup_secondary_cpu(void);
|
||||
bool snp_init(struct boot_params *bp);
|
||||
void __init __noreturn snp_abort(void);
|
||||
void __noreturn snp_abort(void);
|
||||
void snp_dmi_setup(void);
|
||||
int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, struct snp_guest_request_ioctl *rio);
|
||||
u64 snp_get_unsupported_features(u64 status);
|
||||
|
||||
@@ -504,7 +504,7 @@ static __init unsigned long check_iommu_size(unsigned long aper, u64 aper_size)
|
||||
}
|
||||
|
||||
a = aper + iommu_size;
|
||||
iommu_size -= round_up(a, PMD_PAGE_SIZE) - a;
|
||||
iommu_size -= round_up(a, PMD_SIZE) - a;
|
||||
|
||||
if (iommu_size < 64*1024*1024) {
|
||||
pr_warn("PCI-DMA: Warning: Small IOMMU %luMB."
|
||||
|
||||
@@ -1629,7 +1629,8 @@ static void __init bhi_select_mitigation(void)
|
||||
return;
|
||||
|
||||
/* Retpoline mitigates against BHI unless the CPU has RRSBA behavior */
|
||||
if (cpu_feature_enabled(X86_FEATURE_RETPOLINE)) {
|
||||
if (boot_cpu_has(X86_FEATURE_RETPOLINE) &&
|
||||
!boot_cpu_has(X86_FEATURE_RETPOLINE_LFENCE)) {
|
||||
spec_ctrl_disable_kernel_rrsba();
|
||||
if (rrsba_disabled)
|
||||
return;
|
||||
@@ -2783,11 +2784,13 @@ static const char *spectre_bhi_state(void)
|
||||
{
|
||||
if (!boot_cpu_has_bug(X86_BUG_BHI))
|
||||
return "; BHI: Not affected";
|
||||
else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_HW))
|
||||
else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_HW))
|
||||
return "; BHI: BHI_DIS_S";
|
||||
else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP))
|
||||
else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP))
|
||||
return "; BHI: SW loop, KVM: SW loop";
|
||||
else if (boot_cpu_has(X86_FEATURE_RETPOLINE) && rrsba_disabled)
|
||||
else if (boot_cpu_has(X86_FEATURE_RETPOLINE) &&
|
||||
!boot_cpu_has(X86_FEATURE_RETPOLINE_LFENCE) &&
|
||||
rrsba_disabled)
|
||||
return "; BHI: Retpoline";
|
||||
else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT))
|
||||
return "; BHI: Vulnerable, KVM: SW loop";
|
||||
|
||||
@@ -44,7 +44,10 @@ static const struct cpuid_dep cpuid_deps[] = {
|
||||
{ X86_FEATURE_F16C, X86_FEATURE_XMM2, },
|
||||
{ X86_FEATURE_AES, X86_FEATURE_XMM2 },
|
||||
{ X86_FEATURE_SHA_NI, X86_FEATURE_XMM2 },
|
||||
{ X86_FEATURE_GFNI, X86_FEATURE_XMM2 },
|
||||
{ X86_FEATURE_FMA, X86_FEATURE_AVX },
|
||||
{ X86_FEATURE_VAES, X86_FEATURE_AVX },
|
||||
{ X86_FEATURE_VPCLMULQDQ, X86_FEATURE_AVX },
|
||||
{ X86_FEATURE_AVX2, X86_FEATURE_AVX, },
|
||||
{ X86_FEATURE_AVX512F, X86_FEATURE_AVX, },
|
||||
{ X86_FEATURE_AVX512IFMA, X86_FEATURE_AVX512F },
|
||||
@@ -56,9 +59,6 @@ static const struct cpuid_dep cpuid_deps[] = {
|
||||
{ X86_FEATURE_AVX512VL, X86_FEATURE_AVX512F },
|
||||
{ X86_FEATURE_AVX512VBMI, X86_FEATURE_AVX512F },
|
||||
{ X86_FEATURE_AVX512_VBMI2, X86_FEATURE_AVX512VL },
|
||||
{ X86_FEATURE_GFNI, X86_FEATURE_AVX512VL },
|
||||
{ X86_FEATURE_VAES, X86_FEATURE_AVX512VL },
|
||||
{ X86_FEATURE_VPCLMULQDQ, X86_FEATURE_AVX512VL },
|
||||
{ X86_FEATURE_AVX512_VNNI, X86_FEATURE_AVX512VL },
|
||||
{ X86_FEATURE_AVX512_BITALG, X86_FEATURE_AVX512VL },
|
||||
{ X86_FEATURE_AVX512_4VNNIW, X86_FEATURE_AVX512F },
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <asm/trapnr.h>
|
||||
#include <asm/sev.h>
|
||||
#include <asm/tdx.h>
|
||||
#include <asm/init.h>
|
||||
|
||||
/*
|
||||
* Manage page tables very early on.
|
||||
@@ -84,8 +85,6 @@ static struct desc_ptr startup_gdt_descr = {
|
||||
.address = 0,
|
||||
};
|
||||
|
||||
#define __head __section(".head.text")
|
||||
|
||||
static void __head *fixup_pointer(void *ptr, unsigned long physaddr)
|
||||
{
|
||||
return ptr - (void *)_text + (void *)physaddr;
|
||||
@@ -203,7 +202,7 @@ unsigned long __head __startup_64(unsigned long physaddr,
|
||||
load_delta = physaddr - (unsigned long)(_text - __START_KERNEL_map);
|
||||
|
||||
/* Is the address not 2M aligned? */
|
||||
if (load_delta & ~PMD_PAGE_MASK)
|
||||
if (load_delta & ~PMD_MASK)
|
||||
for (;;);
|
||||
|
||||
/* Include the SME encryption mask in the fixup value */
|
||||
@@ -588,7 +587,7 @@ static void set_bringup_idt_handler(gate_desc *idt, int n, void *handler)
|
||||
}
|
||||
|
||||
/* This runs while still in the direct mapping */
|
||||
static void startup_64_load_idt(unsigned long physbase)
|
||||
static void __head startup_64_load_idt(unsigned long physbase)
|
||||
{
|
||||
struct desc_ptr *desc = fixup_pointer(&bringup_idt_descr, physbase);
|
||||
gate_desc *idt = fixup_pointer(bringup_idt_table, physbase);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/pnp.h>
|
||||
|
||||
#include <asm/setup.h>
|
||||
#include <asm/bios_ebda.h>
|
||||
|
||||
@@ -86,7 +86,8 @@ static bool __init sev_es_check_cpu_features(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void __noreturn sev_es_terminate(unsigned int set, unsigned int reason)
|
||||
static void __head __noreturn
|
||||
sev_es_terminate(unsigned int set, unsigned int reason)
|
||||
{
|
||||
u64 val = GHCB_MSR_TERM_REQ;
|
||||
|
||||
@@ -323,13 +324,7 @@ static int sev_cpuid_hv(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid
|
||||
*/
|
||||
static const struct snp_cpuid_table *snp_cpuid_get_table(void)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
asm ("lea cpuid_table_copy(%%rip), %0"
|
||||
: "=r" (ptr)
|
||||
: "p" (&cpuid_table_copy));
|
||||
|
||||
return ptr;
|
||||
return &RIP_REL_REF(cpuid_table_copy);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -388,7 +383,7 @@ static u32 snp_cpuid_calc_xsave_size(u64 xfeatures_en, bool compacted)
|
||||
return xsave_size;
|
||||
}
|
||||
|
||||
static bool
|
||||
static bool __head
|
||||
snp_cpuid_get_validated_func(struct cpuid_leaf *leaf)
|
||||
{
|
||||
const struct snp_cpuid_table *cpuid_table = snp_cpuid_get_table();
|
||||
@@ -525,7 +520,8 @@ static int snp_cpuid_postprocess(struct ghcb *ghcb, struct es_em_ctxt *ctxt,
|
||||
* Returns -EOPNOTSUPP if feature not enabled. Any other non-zero return value
|
||||
* should be treated as fatal by caller.
|
||||
*/
|
||||
static int snp_cpuid(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf)
|
||||
static int __head
|
||||
snp_cpuid(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf)
|
||||
{
|
||||
const struct snp_cpuid_table *cpuid_table = snp_cpuid_get_table();
|
||||
|
||||
@@ -567,7 +563,7 @@ static int snp_cpuid(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_le
|
||||
* page yet, so it only supports the MSR based communication with the
|
||||
* hypervisor and only the CPUID exit-code.
|
||||
*/
|
||||
void __init do_vc_no_ghcb(struct pt_regs *regs, unsigned long exit_code)
|
||||
void __head do_vc_no_ghcb(struct pt_regs *regs, unsigned long exit_code)
|
||||
{
|
||||
unsigned int subfn = lower_bits(regs->cx, 32);
|
||||
unsigned int fn = lower_bits(regs->ax, 32);
|
||||
@@ -1013,7 +1009,8 @@ struct cc_setup_data {
|
||||
* Search for a Confidential Computing blob passed in as a setup_data entry
|
||||
* via the Linux Boot Protocol.
|
||||
*/
|
||||
static struct cc_blob_sev_info *find_cc_blob_setup_data(struct boot_params *bp)
|
||||
static __head
|
||||
struct cc_blob_sev_info *find_cc_blob_setup_data(struct boot_params *bp)
|
||||
{
|
||||
struct cc_setup_data *sd = NULL;
|
||||
struct setup_data *hdr;
|
||||
@@ -1040,7 +1037,7 @@ static struct cc_blob_sev_info *find_cc_blob_setup_data(struct boot_params *bp)
|
||||
* mapping needs to be updated in sync with all the changes to virtual memory
|
||||
* layout and related mapping facilities throughout the boot process.
|
||||
*/
|
||||
static void __init setup_cpuid_table(const struct cc_blob_sev_info *cc_info)
|
||||
static void __head setup_cpuid_table(const struct cc_blob_sev_info *cc_info)
|
||||
{
|
||||
const struct snp_cpuid_table *cpuid_table_fw, *cpuid_table;
|
||||
int i;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <linux/dmi.h>
|
||||
#include <uapi/linux/sev-guest.h>
|
||||
|
||||
#include <asm/init.h>
|
||||
#include <asm/cpu_entry_area.h>
|
||||
#include <asm/stacktrace.h>
|
||||
#include <asm/sev.h>
|
||||
@@ -690,7 +691,7 @@ static void pvalidate_pages(unsigned long vaddr, unsigned long npages, bool vali
|
||||
}
|
||||
}
|
||||
|
||||
static void __init early_set_pages_state(unsigned long paddr, unsigned long npages, enum psc_op op)
|
||||
static void __head early_set_pages_state(unsigned long paddr, unsigned long npages, enum psc_op op)
|
||||
{
|
||||
unsigned long paddr_end;
|
||||
u64 val;
|
||||
@@ -728,7 +729,7 @@ e_term:
|
||||
sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_PSC);
|
||||
}
|
||||
|
||||
void __init early_snp_set_memory_private(unsigned long vaddr, unsigned long paddr,
|
||||
void __head early_snp_set_memory_private(unsigned long vaddr, unsigned long paddr,
|
||||
unsigned long npages)
|
||||
{
|
||||
/*
|
||||
@@ -2085,7 +2086,7 @@ fail:
|
||||
*
|
||||
* Scan for the blob in that order.
|
||||
*/
|
||||
static __init struct cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
|
||||
static __head struct cc_blob_sev_info *find_cc_blob(struct boot_params *bp)
|
||||
{
|
||||
struct cc_blob_sev_info *cc_info;
|
||||
|
||||
@@ -2111,7 +2112,7 @@ found_cc_info:
|
||||
return cc_info;
|
||||
}
|
||||
|
||||
bool __init snp_init(struct boot_params *bp)
|
||||
bool __head snp_init(struct boot_params *bp)
|
||||
{
|
||||
struct cc_blob_sev_info *cc_info;
|
||||
|
||||
@@ -2133,7 +2134,7 @@ bool __init snp_init(struct boot_params *bp)
|
||||
return true;
|
||||
}
|
||||
|
||||
void __init __noreturn snp_abort(void)
|
||||
void __head __noreturn snp_abort(void)
|
||||
{
|
||||
sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SNP_UNSUPPORTED);
|
||||
}
|
||||
|
||||
@@ -340,6 +340,7 @@ static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu)
|
||||
|
||||
kvm_update_pv_runtime(vcpu);
|
||||
|
||||
vcpu->arch.is_amd_compatible = guest_cpuid_is_amd_or_hygon(vcpu);
|
||||
vcpu->arch.maxphyaddr = cpuid_query_maxphyaddr(vcpu);
|
||||
vcpu->arch.reserved_gpa_bits = kvm_vcpu_reserved_gpa_bits_raw(vcpu);
|
||||
|
||||
|
||||
@@ -125,6 +125,16 @@ static inline bool guest_cpuid_is_intel(struct kvm_vcpu *vcpu)
|
||||
return best && is_guest_vendor_intel(best->ebx, best->ecx, best->edx);
|
||||
}
|
||||
|
||||
static inline bool guest_cpuid_is_amd_compatible(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
return vcpu->arch.is_amd_compatible;
|
||||
}
|
||||
|
||||
static inline bool guest_cpuid_is_intel_compatible(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
return !guest_cpuid_is_amd_compatible(vcpu);
|
||||
}
|
||||
|
||||
static inline int guest_cpuid_family(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
struct kvm_cpuid_entry2 *best;
|
||||
|
||||
@@ -2548,7 +2548,8 @@ int kvm_apic_local_deliver(struct kvm_lapic *apic, int lvt_type)
|
||||
trig_mode = reg & APIC_LVT_LEVEL_TRIGGER;
|
||||
|
||||
r = __apic_accept_irq(apic, mode, vector, 1, trig_mode, NULL);
|
||||
if (r && lvt_type == APIC_LVTPC)
|
||||
if (r && lvt_type == APIC_LVTPC &&
|
||||
guest_cpuid_is_intel_compatible(apic->vcpu))
|
||||
kvm_lapic_set_reg(apic, APIC_LVTPC, reg | APIC_LVT_MASKED);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -4649,7 +4649,7 @@ static void reset_guest_rsvds_bits_mask(struct kvm_vcpu *vcpu,
|
||||
context->cpu_role.base.level, is_efer_nx(context),
|
||||
guest_can_use_gbpages(vcpu),
|
||||
is_cr4_pse(context),
|
||||
guest_cpuid_is_amd_or_hygon(vcpu));
|
||||
guest_cpuid_is_amd_compatible(vcpu));
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -7742,8 +7742,28 @@ static u64 vmx_get_perf_capabilities(void)
|
||||
|
||||
if (vmx_pebs_supported()) {
|
||||
perf_cap |= host_perf_cap & PERF_CAP_PEBS_MASK;
|
||||
if ((perf_cap & PERF_CAP_PEBS_FORMAT) < 4)
|
||||
perf_cap &= ~PERF_CAP_PEBS_BASELINE;
|
||||
|
||||
/*
|
||||
* Disallow adaptive PEBS as it is functionally broken, can be
|
||||
* used by the guest to read *host* LBRs, and can be used to
|
||||
* bypass userspace event filters. To correctly and safely
|
||||
* support adaptive PEBS, KVM needs to:
|
||||
*
|
||||
* 1. Account for the ADAPTIVE flag when (re)programming fixed
|
||||
* counters.
|
||||
*
|
||||
* 2. Gain support from perf (or take direct control of counter
|
||||
* programming) to support events without adaptive PEBS
|
||||
* enabled for the hardware counter.
|
||||
*
|
||||
* 3. Ensure LBR MSRs cannot hold host data on VM-Entry with
|
||||
* adaptive PEBS enabled and MSR_PEBS_DATA_CFG.LBRS=1.
|
||||
*
|
||||
* 4. Document which PMU events are effectively exposed to the
|
||||
* guest via adaptive PEBS, and make adaptive PEBS mutually
|
||||
* exclusive with KVM_SET_PMU_EVENT_FILTER if necessary.
|
||||
*/
|
||||
perf_cap &= ~PERF_CAP_PEBS_BASELINE;
|
||||
}
|
||||
|
||||
return perf_cap;
|
||||
|
||||
@@ -3278,7 +3278,7 @@ static bool is_mci_status_msr(u32 msr)
|
||||
static bool can_set_mci_status(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
/* McStatusWrEn enabled? */
|
||||
if (guest_cpuid_is_amd_or_hygon(vcpu))
|
||||
if (guest_cpuid_is_amd_compatible(vcpu))
|
||||
return !!(vcpu->arch.msr_hwcr & BIT_ULL(18));
|
||||
|
||||
return false;
|
||||
|
||||
@@ -26,7 +26,7 @@ SYM_FUNC_START(sme_encrypt_execute)
|
||||
* RCX - virtual address of the encryption workarea, including:
|
||||
* - stack page (PAGE_SIZE)
|
||||
* - encryption routine page (PAGE_SIZE)
|
||||
* - intermediate copy buffer (PMD_PAGE_SIZE)
|
||||
* - intermediate copy buffer (PMD_SIZE)
|
||||
* R8 - physical address of the pagetables to use for encryption
|
||||
*/
|
||||
|
||||
@@ -123,7 +123,7 @@ SYM_FUNC_START(__enc_copy)
|
||||
wbinvd /* Invalidate any cache entries */
|
||||
|
||||
/* Copy/encrypt up to 2MB at a time */
|
||||
movq $PMD_PAGE_SIZE, %r12
|
||||
movq $PMD_SIZE, %r12
|
||||
1:
|
||||
cmpq %r12, %r9
|
||||
jnb 2f
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <linux/mem_encrypt.h>
|
||||
#include <linux/cc_platform.h>
|
||||
|
||||
#include <asm/init.h>
|
||||
#include <asm/setup.h>
|
||||
#include <asm/sections.h>
|
||||
#include <asm/cmdline.h>
|
||||
@@ -93,12 +94,12 @@ struct sme_populate_pgd_data {
|
||||
* section is 2MB aligned to allow for simple pagetable setup using only
|
||||
* PMD entries (see vmlinux.lds.S).
|
||||
*/
|
||||
static char sme_workarea[2 * PMD_PAGE_SIZE] __section(".init.scratch");
|
||||
static char sme_workarea[2 * PMD_SIZE] __section(".init.scratch");
|
||||
|
||||
static char sme_cmdline_arg[] __initdata = "mem_encrypt";
|
||||
static char sme_cmdline_on[] __initdata = "on";
|
||||
|
||||
static void __init sme_clear_pgd(struct sme_populate_pgd_data *ppd)
|
||||
static void __head sme_clear_pgd(struct sme_populate_pgd_data *ppd)
|
||||
{
|
||||
unsigned long pgd_start, pgd_end, pgd_size;
|
||||
pgd_t *pgd_p;
|
||||
@@ -113,7 +114,7 @@ static void __init sme_clear_pgd(struct sme_populate_pgd_data *ppd)
|
||||
memset(pgd_p, 0, pgd_size);
|
||||
}
|
||||
|
||||
static pud_t __init *sme_prepare_pgd(struct sme_populate_pgd_data *ppd)
|
||||
static pud_t __head *sme_prepare_pgd(struct sme_populate_pgd_data *ppd)
|
||||
{
|
||||
pgd_t *pgd;
|
||||
p4d_t *p4d;
|
||||
@@ -150,7 +151,7 @@ static pud_t __init *sme_prepare_pgd(struct sme_populate_pgd_data *ppd)
|
||||
return pud;
|
||||
}
|
||||
|
||||
static void __init sme_populate_pgd_large(struct sme_populate_pgd_data *ppd)
|
||||
static void __head sme_populate_pgd_large(struct sme_populate_pgd_data *ppd)
|
||||
{
|
||||
pud_t *pud;
|
||||
pmd_t *pmd;
|
||||
@@ -166,7 +167,7 @@ static void __init sme_populate_pgd_large(struct sme_populate_pgd_data *ppd)
|
||||
set_pmd(pmd, __pmd(ppd->paddr | ppd->pmd_flags));
|
||||
}
|
||||
|
||||
static void __init sme_populate_pgd(struct sme_populate_pgd_data *ppd)
|
||||
static void __head sme_populate_pgd(struct sme_populate_pgd_data *ppd)
|
||||
{
|
||||
pud_t *pud;
|
||||
pmd_t *pmd;
|
||||
@@ -192,17 +193,17 @@ static void __init sme_populate_pgd(struct sme_populate_pgd_data *ppd)
|
||||
set_pte(pte, __pte(ppd->paddr | ppd->pte_flags));
|
||||
}
|
||||
|
||||
static void __init __sme_map_range_pmd(struct sme_populate_pgd_data *ppd)
|
||||
static void __head __sme_map_range_pmd(struct sme_populate_pgd_data *ppd)
|
||||
{
|
||||
while (ppd->vaddr < ppd->vaddr_end) {
|
||||
sme_populate_pgd_large(ppd);
|
||||
|
||||
ppd->vaddr += PMD_PAGE_SIZE;
|
||||
ppd->paddr += PMD_PAGE_SIZE;
|
||||
ppd->vaddr += PMD_SIZE;
|
||||
ppd->paddr += PMD_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
static void __init __sme_map_range_pte(struct sme_populate_pgd_data *ppd)
|
||||
static void __head __sme_map_range_pte(struct sme_populate_pgd_data *ppd)
|
||||
{
|
||||
while (ppd->vaddr < ppd->vaddr_end) {
|
||||
sme_populate_pgd(ppd);
|
||||
@@ -212,7 +213,7 @@ static void __init __sme_map_range_pte(struct sme_populate_pgd_data *ppd)
|
||||
}
|
||||
}
|
||||
|
||||
static void __init __sme_map_range(struct sme_populate_pgd_data *ppd,
|
||||
static void __head __sme_map_range(struct sme_populate_pgd_data *ppd,
|
||||
pmdval_t pmd_flags, pteval_t pte_flags)
|
||||
{
|
||||
unsigned long vaddr_end;
|
||||
@@ -224,11 +225,11 @@ static void __init __sme_map_range(struct sme_populate_pgd_data *ppd,
|
||||
vaddr_end = ppd->vaddr_end;
|
||||
|
||||
/* If start is not 2MB aligned, create PTE entries */
|
||||
ppd->vaddr_end = ALIGN(ppd->vaddr, PMD_PAGE_SIZE);
|
||||
ppd->vaddr_end = ALIGN(ppd->vaddr, PMD_SIZE);
|
||||
__sme_map_range_pte(ppd);
|
||||
|
||||
/* Create PMD entries */
|
||||
ppd->vaddr_end = vaddr_end & PMD_PAGE_MASK;
|
||||
ppd->vaddr_end = vaddr_end & PMD_MASK;
|
||||
__sme_map_range_pmd(ppd);
|
||||
|
||||
/* If end is not 2MB aligned, create PTE entries */
|
||||
@@ -236,22 +237,22 @@ static void __init __sme_map_range(struct sme_populate_pgd_data *ppd,
|
||||
__sme_map_range_pte(ppd);
|
||||
}
|
||||
|
||||
static void __init sme_map_range_encrypted(struct sme_populate_pgd_data *ppd)
|
||||
static void __head sme_map_range_encrypted(struct sme_populate_pgd_data *ppd)
|
||||
{
|
||||
__sme_map_range(ppd, PMD_FLAGS_ENC, PTE_FLAGS_ENC);
|
||||
}
|
||||
|
||||
static void __init sme_map_range_decrypted(struct sme_populate_pgd_data *ppd)
|
||||
static void __head sme_map_range_decrypted(struct sme_populate_pgd_data *ppd)
|
||||
{
|
||||
__sme_map_range(ppd, PMD_FLAGS_DEC, PTE_FLAGS_DEC);
|
||||
}
|
||||
|
||||
static void __init sme_map_range_decrypted_wp(struct sme_populate_pgd_data *ppd)
|
||||
static void __head sme_map_range_decrypted_wp(struct sme_populate_pgd_data *ppd)
|
||||
{
|
||||
__sme_map_range(ppd, PMD_FLAGS_DEC_WP, PTE_FLAGS_DEC_WP);
|
||||
}
|
||||
|
||||
static unsigned long __init sme_pgtable_calc(unsigned long len)
|
||||
static unsigned long __head sme_pgtable_calc(unsigned long len)
|
||||
{
|
||||
unsigned long entries = 0, tables = 0;
|
||||
|
||||
@@ -288,7 +289,7 @@ static unsigned long __init sme_pgtable_calc(unsigned long len)
|
||||
return entries + tables;
|
||||
}
|
||||
|
||||
void __init sme_encrypt_kernel(struct boot_params *bp)
|
||||
void __head sme_encrypt_kernel(struct boot_params *bp)
|
||||
{
|
||||
unsigned long workarea_start, workarea_end, workarea_len;
|
||||
unsigned long execute_start, execute_end, execute_len;
|
||||
@@ -323,9 +324,8 @@ void __init sme_encrypt_kernel(struct boot_params *bp)
|
||||
* memory from being cached.
|
||||
*/
|
||||
|
||||
/* Physical addresses gives us the identity mapped virtual addresses */
|
||||
kernel_start = __pa_symbol(_text);
|
||||
kernel_end = ALIGN(__pa_symbol(_end), PMD_PAGE_SIZE);
|
||||
kernel_start = (unsigned long)RIP_REL_REF(_text);
|
||||
kernel_end = ALIGN((unsigned long)RIP_REL_REF(_end), PMD_SIZE);
|
||||
kernel_len = kernel_end - kernel_start;
|
||||
|
||||
initrd_start = 0;
|
||||
@@ -342,25 +342,17 @@ void __init sme_encrypt_kernel(struct boot_params *bp)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We're running identity mapped, so we must obtain the address to the
|
||||
* SME encryption workarea using rip-relative addressing.
|
||||
*/
|
||||
asm ("lea sme_workarea(%%rip), %0"
|
||||
: "=r" (workarea_start)
|
||||
: "p" (sme_workarea));
|
||||
|
||||
/*
|
||||
* Calculate required number of workarea bytes needed:
|
||||
* executable encryption area size:
|
||||
* stack page (PAGE_SIZE)
|
||||
* encryption routine page (PAGE_SIZE)
|
||||
* intermediate copy buffer (PMD_PAGE_SIZE)
|
||||
* intermediate copy buffer (PMD_SIZE)
|
||||
* pagetable structures for the encryption of the kernel
|
||||
* pagetable structures for workarea (in case not currently mapped)
|
||||
*/
|
||||
execute_start = workarea_start;
|
||||
execute_end = execute_start + (PAGE_SIZE * 2) + PMD_PAGE_SIZE;
|
||||
execute_start = workarea_start = (unsigned long)RIP_REL_REF(sme_workarea);
|
||||
execute_end = execute_start + (PAGE_SIZE * 2) + PMD_SIZE;
|
||||
execute_len = execute_end - execute_start;
|
||||
|
||||
/*
|
||||
@@ -383,7 +375,7 @@ void __init sme_encrypt_kernel(struct boot_params *bp)
|
||||
* before it is mapped.
|
||||
*/
|
||||
workarea_len = execute_len + pgtable_area_len;
|
||||
workarea_end = ALIGN(workarea_start + workarea_len, PMD_PAGE_SIZE);
|
||||
workarea_end = ALIGN(workarea_start + workarea_len, PMD_SIZE);
|
||||
|
||||
/*
|
||||
* Set the address to the start of where newly created pagetable
|
||||
@@ -502,7 +494,7 @@ void __init sme_encrypt_kernel(struct boot_params *bp)
|
||||
native_write_cr3(__native_read_cr3());
|
||||
}
|
||||
|
||||
void __init sme_enable(struct boot_params *bp)
|
||||
void __head sme_enable(struct boot_params *bp)
|
||||
{
|
||||
const char *cmdline_ptr, *cmdline_arg, *cmdline_on;
|
||||
unsigned int eax, ebx, ecx, edx;
|
||||
|
||||
@@ -747,11 +747,11 @@ phys_addr_t slow_virt_to_phys(void *__virt_addr)
|
||||
switch (level) {
|
||||
case PG_LEVEL_1G:
|
||||
phys_addr = (phys_addr_t)pud_pfn(*(pud_t *)pte) << PAGE_SHIFT;
|
||||
offset = virt_addr & ~PUD_PAGE_MASK;
|
||||
offset = virt_addr & ~PUD_MASK;
|
||||
break;
|
||||
case PG_LEVEL_2M:
|
||||
phys_addr = (phys_addr_t)pmd_pfn(*(pmd_t *)pte) << PAGE_SHIFT;
|
||||
offset = virt_addr & ~PMD_PAGE_MASK;
|
||||
offset = virt_addr & ~PMD_MASK;
|
||||
break;
|
||||
default:
|
||||
phys_addr = (phys_addr_t)pte_pfn(*pte) << PAGE_SHIFT;
|
||||
@@ -1041,7 +1041,7 @@ __split_large_page(struct cpa_data *cpa, pte_t *kpte, unsigned long address,
|
||||
case PG_LEVEL_1G:
|
||||
ref_prot = pud_pgprot(*(pud_t *)kpte);
|
||||
ref_pfn = pud_pfn(*(pud_t *)kpte);
|
||||
pfninc = PMD_PAGE_SIZE >> PAGE_SHIFT;
|
||||
pfninc = PMD_SIZE >> PAGE_SHIFT;
|
||||
lpaddr = address & PUD_MASK;
|
||||
lpinc = PMD_SIZE;
|
||||
/*
|
||||
|
||||
@@ -592,7 +592,7 @@ static void pti_set_kernel_image_nonglobal(void)
|
||||
* of the image.
|
||||
*/
|
||||
unsigned long start = PFN_ALIGN(_text);
|
||||
unsigned long end = ALIGN((unsigned long)_end, PMD_PAGE_SIZE);
|
||||
unsigned long end = ALIGN((unsigned long)_end, PMD_SIZE);
|
||||
|
||||
/*
|
||||
* This clears _PAGE_GLOBAL from the entire kernel image.
|
||||
|
||||
@@ -573,7 +573,7 @@ static u_long get_word(struct vc_data *vc)
|
||||
}
|
||||
attr_ch = get_char(vc, (u_short *)tmp_pos, &spk_attr);
|
||||
buf[cnt++] = attr_ch;
|
||||
while (tmpx < vc->vc_cols - 1) {
|
||||
while (tmpx < vc->vc_cols - 1 && cnt < sizeof(buf) - 1) {
|
||||
tmp_pos += 2;
|
||||
tmpx++;
|
||||
ch = get_char(vc, (u_short *)tmp_pos, &temp);
|
||||
|
||||
@@ -1707,8 +1707,10 @@ static size_t binder_get_object(struct binder_proc *proc,
|
||||
size_t object_size = 0;
|
||||
|
||||
read_size = min_t(size_t, sizeof(*object), buffer->data_size - offset);
|
||||
if (offset > buffer->data_size || read_size < sizeof(*hdr))
|
||||
if (offset > buffer->data_size || read_size < sizeof(*hdr) ||
|
||||
!IS_ALIGNED(offset, sizeof(u32)))
|
||||
return 0;
|
||||
|
||||
if (u) {
|
||||
if (copy_from_user(object, u + offset, read_size))
|
||||
return 0;
|
||||
|
||||
@@ -683,7 +683,7 @@ static void extract_entropy(void *buf, size_t len)
|
||||
|
||||
static void __cold _credit_init_bits(size_t bits)
|
||||
{
|
||||
static struct execute_work set_ready;
|
||||
static DECLARE_WORK(set_ready, crng_set_ready);
|
||||
unsigned int new, orig, add;
|
||||
unsigned long flags;
|
||||
|
||||
@@ -699,8 +699,8 @@ static void __cold _credit_init_bits(size_t bits)
|
||||
|
||||
if (orig < POOL_READY_BITS && new >= POOL_READY_BITS) {
|
||||
crng_reseed(); /* Sets crng_init to CRNG_READY under base_crng.lock. */
|
||||
if (static_key_initialized)
|
||||
execute_in_process_context(crng_set_ready, &set_ready);
|
||||
if (static_key_initialized && system_unbound_wq)
|
||||
queue_work(system_unbound_wq, &set_ready);
|
||||
wake_up_interruptible(&crng_init_wait);
|
||||
kill_fasync(&fasync, SIGIO, POLL_IN);
|
||||
pr_notice("crng init done\n");
|
||||
@@ -870,8 +870,8 @@ void __init random_init(void)
|
||||
|
||||
/*
|
||||
* If we were initialized by the cpu or bootloader before jump labels
|
||||
* are initialized, then we should enable the static branch here, where
|
||||
* it's guaranteed that jump labels have been initialized.
|
||||
* or workqueues are initialized, then we should enable the static
|
||||
* branch here, where it's guaranteed that these have been initialized.
|
||||
*/
|
||||
if (!static_branch_likely(&crng_is_ready) && crng_init >= CRNG_READY)
|
||||
crng_set_ready(NULL);
|
||||
|
||||
@@ -37,6 +37,10 @@ static HLIST_HEAD(clk_root_list);
|
||||
static HLIST_HEAD(clk_orphan_list);
|
||||
static LIST_HEAD(clk_notifier_list);
|
||||
|
||||
/* List of registered clks that use runtime PM */
|
||||
static HLIST_HEAD(clk_rpm_list);
|
||||
static DEFINE_MUTEX(clk_rpm_list_lock);
|
||||
|
||||
static const struct hlist_head *all_lists[] = {
|
||||
&clk_root_list,
|
||||
&clk_orphan_list,
|
||||
@@ -59,6 +63,7 @@ struct clk_core {
|
||||
struct clk_hw *hw;
|
||||
struct module *owner;
|
||||
struct device *dev;
|
||||
struct hlist_node rpm_node;
|
||||
struct device_node *of_node;
|
||||
struct clk_core *parent;
|
||||
struct clk_parent_map *parents;
|
||||
@@ -122,6 +127,89 @@ static void clk_pm_runtime_put(struct clk_core *core)
|
||||
pm_runtime_put_sync(core->dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* clk_pm_runtime_get_all() - Runtime "get" all clk provider devices
|
||||
*
|
||||
* Call clk_pm_runtime_get() on all runtime PM enabled clks in the clk tree so
|
||||
* that disabling unused clks avoids a deadlock where a device is runtime PM
|
||||
* resuming/suspending and the runtime PM callback is trying to grab the
|
||||
* prepare_lock for something like clk_prepare_enable() while
|
||||
* clk_disable_unused_subtree() holds the prepare_lock and is trying to runtime
|
||||
* PM resume/suspend the device as well.
|
||||
*
|
||||
* Context: Acquires the 'clk_rpm_list_lock' and returns with the lock held on
|
||||
* success. Otherwise the lock is released on failure.
|
||||
*
|
||||
* Return: 0 on success, negative errno otherwise.
|
||||
*/
|
||||
static int clk_pm_runtime_get_all(void)
|
||||
{
|
||||
int ret;
|
||||
struct clk_core *core, *failed;
|
||||
|
||||
/*
|
||||
* Grab the list lock to prevent any new clks from being registered
|
||||
* or unregistered until clk_pm_runtime_put_all().
|
||||
*/
|
||||
mutex_lock(&clk_rpm_list_lock);
|
||||
|
||||
/*
|
||||
* Runtime PM "get" all the devices that are needed for the clks
|
||||
* currently registered. Do this without holding the prepare_lock, to
|
||||
* avoid the deadlock.
|
||||
*/
|
||||
hlist_for_each_entry(core, &clk_rpm_list, rpm_node) {
|
||||
ret = clk_pm_runtime_get(core);
|
||||
if (ret) {
|
||||
failed = core;
|
||||
pr_err("clk: Failed to runtime PM get '%s' for clk '%s'\n",
|
||||
dev_name(failed->dev), failed->name);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
hlist_for_each_entry(core, &clk_rpm_list, rpm_node) {
|
||||
if (core == failed)
|
||||
break;
|
||||
|
||||
clk_pm_runtime_put(core);
|
||||
}
|
||||
mutex_unlock(&clk_rpm_list_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* clk_pm_runtime_put_all() - Runtime "put" all clk provider devices
|
||||
*
|
||||
* Put the runtime PM references taken in clk_pm_runtime_get_all() and release
|
||||
* the 'clk_rpm_list_lock'.
|
||||
*/
|
||||
static void clk_pm_runtime_put_all(void)
|
||||
{
|
||||
struct clk_core *core;
|
||||
|
||||
hlist_for_each_entry(core, &clk_rpm_list, rpm_node)
|
||||
clk_pm_runtime_put(core);
|
||||
mutex_unlock(&clk_rpm_list_lock);
|
||||
}
|
||||
|
||||
static void clk_pm_runtime_init(struct clk_core *core)
|
||||
{
|
||||
struct device *dev = core->dev;
|
||||
|
||||
if (dev && pm_runtime_enabled(dev)) {
|
||||
core->rpm_enabled = true;
|
||||
|
||||
mutex_lock(&clk_rpm_list_lock);
|
||||
hlist_add_head(&core->rpm_node, &clk_rpm_list);
|
||||
mutex_unlock(&clk_rpm_list_lock);
|
||||
}
|
||||
}
|
||||
|
||||
/*** locking ***/
|
||||
static void clk_prepare_lock(void)
|
||||
{
|
||||
@@ -1310,9 +1398,6 @@ static void __init clk_unprepare_unused_subtree(struct clk_core *core)
|
||||
if (core->flags & CLK_IGNORE_UNUSED)
|
||||
return;
|
||||
|
||||
if (clk_pm_runtime_get(core))
|
||||
return;
|
||||
|
||||
if (clk_core_is_prepared(core)) {
|
||||
trace_clk_unprepare(core);
|
||||
if (core->ops->unprepare_unused)
|
||||
@@ -1321,8 +1406,6 @@ static void __init clk_unprepare_unused_subtree(struct clk_core *core)
|
||||
core->ops->unprepare(core->hw);
|
||||
trace_clk_unprepare_complete(core);
|
||||
}
|
||||
|
||||
clk_pm_runtime_put(core);
|
||||
}
|
||||
|
||||
static void __init clk_disable_unused_subtree(struct clk_core *core)
|
||||
@@ -1338,9 +1421,6 @@ static void __init clk_disable_unused_subtree(struct clk_core *core)
|
||||
if (core->flags & CLK_OPS_PARENT_ENABLE)
|
||||
clk_core_prepare_enable(core->parent);
|
||||
|
||||
if (clk_pm_runtime_get(core))
|
||||
goto unprepare_out;
|
||||
|
||||
flags = clk_enable_lock();
|
||||
|
||||
if (core->enable_count)
|
||||
@@ -1365,8 +1445,6 @@ static void __init clk_disable_unused_subtree(struct clk_core *core)
|
||||
|
||||
unlock_out:
|
||||
clk_enable_unlock(flags);
|
||||
clk_pm_runtime_put(core);
|
||||
unprepare_out:
|
||||
if (core->flags & CLK_OPS_PARENT_ENABLE)
|
||||
clk_core_disable_unprepare(core->parent);
|
||||
}
|
||||
@@ -1382,12 +1460,22 @@ __setup("clk_ignore_unused", clk_ignore_unused_setup);
|
||||
static int __init clk_disable_unused(void)
|
||||
{
|
||||
struct clk_core *core;
|
||||
int ret;
|
||||
|
||||
if (clk_ignore_unused) {
|
||||
pr_warn("clk: Not disabling unused clocks\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
pr_info("clk: Disabling unused clocks\n");
|
||||
|
||||
ret = clk_pm_runtime_get_all();
|
||||
if (ret)
|
||||
return ret;
|
||||
/*
|
||||
* Grab the prepare lock to keep the clk topology stable while iterating
|
||||
* over clks.
|
||||
*/
|
||||
clk_prepare_lock();
|
||||
|
||||
hlist_for_each_entry(core, &clk_root_list, child_node)
|
||||
@@ -1404,6 +1492,8 @@ static int __init clk_disable_unused(void)
|
||||
|
||||
clk_prepare_unlock();
|
||||
|
||||
clk_pm_runtime_put_all();
|
||||
|
||||
return 0;
|
||||
}
|
||||
late_initcall_sync(clk_disable_unused);
|
||||
@@ -3115,28 +3205,41 @@ static void clk_summary_show_one(struct seq_file *s, struct clk_core *c,
|
||||
int level)
|
||||
{
|
||||
int phase;
|
||||
struct clk *clk_user;
|
||||
int multi_node = 0;
|
||||
|
||||
seq_printf(s, "%*s%-*s %7d %8d %8d %11lu %10lu ",
|
||||
seq_printf(s, "%*s%-*s %-7d %-8d %-8d %-11lu %-10lu ",
|
||||
level * 3 + 1, "",
|
||||
30 - level * 3, c->name,
|
||||
35 - level * 3, c->name,
|
||||
c->enable_count, c->prepare_count, c->protect_count,
|
||||
clk_core_get_rate_recalc(c),
|
||||
clk_core_get_accuracy_recalc(c));
|
||||
|
||||
phase = clk_core_get_phase(c);
|
||||
if (phase >= 0)
|
||||
seq_printf(s, "%5d", phase);
|
||||
seq_printf(s, "%-5d", phase);
|
||||
else
|
||||
seq_puts(s, "-----");
|
||||
|
||||
seq_printf(s, " %6d", clk_core_get_scaled_duty_cycle(c, 100000));
|
||||
seq_printf(s, " %-6d", clk_core_get_scaled_duty_cycle(c, 100000));
|
||||
|
||||
if (c->ops->is_enabled)
|
||||
seq_printf(s, " %9c\n", clk_core_is_enabled(c) ? 'Y' : 'N');
|
||||
seq_printf(s, " %5c ", clk_core_is_enabled(c) ? 'Y' : 'N');
|
||||
else if (!c->ops->enable)
|
||||
seq_printf(s, " %9c\n", 'Y');
|
||||
seq_printf(s, " %5c ", 'Y');
|
||||
else
|
||||
seq_printf(s, " %9c\n", '?');
|
||||
seq_printf(s, " %5c ", '?');
|
||||
|
||||
hlist_for_each_entry(clk_user, &c->clks, clks_node) {
|
||||
seq_printf(s, "%*s%-*s %-25s\n",
|
||||
level * 3 + 2 + 105 * multi_node, "",
|
||||
30,
|
||||
clk_user->dev_id ? clk_user->dev_id : "deviceless",
|
||||
clk_user->con_id ? clk_user->con_id : "no_connection_id");
|
||||
|
||||
multi_node = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void clk_summary_show_subtree(struct seq_file *s, struct clk_core *c,
|
||||
@@ -3144,9 +3247,7 @@ static void clk_summary_show_subtree(struct seq_file *s, struct clk_core *c,
|
||||
{
|
||||
struct clk_core *child;
|
||||
|
||||
clk_pm_runtime_get(c);
|
||||
clk_summary_show_one(s, c, level);
|
||||
clk_pm_runtime_put(c);
|
||||
|
||||
hlist_for_each_entry(child, &c->children, child_node)
|
||||
clk_summary_show_subtree(s, child, level + 1);
|
||||
@@ -3155,11 +3256,16 @@ static void clk_summary_show_subtree(struct seq_file *s, struct clk_core *c,
|
||||
static int clk_summary_show(struct seq_file *s, void *data)
|
||||
{
|
||||
struct clk_core *c;
|
||||
struct hlist_head **lists = (struct hlist_head **)s->private;
|
||||
struct hlist_head **lists = s->private;
|
||||
int ret;
|
||||
|
||||
seq_puts(s, " enable prepare protect duty hardware\n");
|
||||
seq_puts(s, " clock count count count rate accuracy phase cycle enable\n");
|
||||
seq_puts(s, "-------------------------------------------------------------------------------------------------------\n");
|
||||
seq_puts(s, " enable prepare protect duty hardware connection\n");
|
||||
seq_puts(s, " clock count count count rate accuracy phase cycle enable consumer id\n");
|
||||
seq_puts(s, "---------------------------------------------------------------------------------------------------------------------------------------------\n");
|
||||
|
||||
ret = clk_pm_runtime_get_all();
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
clk_prepare_lock();
|
||||
|
||||
@@ -3168,6 +3274,7 @@ static int clk_summary_show(struct seq_file *s, void *data)
|
||||
clk_summary_show_subtree(s, c, 0);
|
||||
|
||||
clk_prepare_unlock();
|
||||
clk_pm_runtime_put_all();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -3214,9 +3321,15 @@ static int clk_dump_show(struct seq_file *s, void *data)
|
||||
{
|
||||
struct clk_core *c;
|
||||
bool first_node = true;
|
||||
struct hlist_head **lists = (struct hlist_head **)s->private;
|
||||
struct hlist_head **lists = s->private;
|
||||
int ret;
|
||||
|
||||
ret = clk_pm_runtime_get_all();
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
seq_putc(s, '{');
|
||||
|
||||
clk_prepare_lock();
|
||||
|
||||
for (; *lists; lists++) {
|
||||
@@ -3229,6 +3342,7 @@ static int clk_dump_show(struct seq_file *s, void *data)
|
||||
}
|
||||
|
||||
clk_prepare_unlock();
|
||||
clk_pm_runtime_put_all();
|
||||
|
||||
seq_puts(s, "}\n");
|
||||
return 0;
|
||||
@@ -3836,8 +3950,6 @@ static int __clk_core_init(struct clk_core *core)
|
||||
}
|
||||
|
||||
clk_core_reparent_orphans_nolock();
|
||||
|
||||
kref_init(&core->ref);
|
||||
out:
|
||||
clk_pm_runtime_put(core);
|
||||
unlock:
|
||||
@@ -4066,6 +4178,22 @@ static void clk_core_free_parent_map(struct clk_core *core)
|
||||
kfree(core->parents);
|
||||
}
|
||||
|
||||
/* Free memory allocated for a struct clk_core */
|
||||
static void __clk_release(struct kref *ref)
|
||||
{
|
||||
struct clk_core *core = container_of(ref, struct clk_core, ref);
|
||||
|
||||
if (core->rpm_enabled) {
|
||||
mutex_lock(&clk_rpm_list_lock);
|
||||
hlist_del(&core->rpm_node);
|
||||
mutex_unlock(&clk_rpm_list_lock);
|
||||
}
|
||||
|
||||
clk_core_free_parent_map(core);
|
||||
kfree_const(core->name);
|
||||
kfree(core);
|
||||
}
|
||||
|
||||
static struct clk *
|
||||
__clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw)
|
||||
{
|
||||
@@ -4086,6 +4214,8 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw)
|
||||
goto fail_out;
|
||||
}
|
||||
|
||||
kref_init(&core->ref);
|
||||
|
||||
core->name = kstrdup_const(init->name, GFP_KERNEL);
|
||||
if (!core->name) {
|
||||
ret = -ENOMEM;
|
||||
@@ -4098,9 +4228,8 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw)
|
||||
}
|
||||
core->ops = init->ops;
|
||||
|
||||
if (dev && pm_runtime_enabled(dev))
|
||||
core->rpm_enabled = true;
|
||||
core->dev = dev;
|
||||
clk_pm_runtime_init(core);
|
||||
core->of_node = np;
|
||||
if (dev && dev->driver)
|
||||
core->owner = dev->driver->owner;
|
||||
@@ -4140,12 +4269,10 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw)
|
||||
hw->clk = NULL;
|
||||
|
||||
fail_create_clk:
|
||||
clk_core_free_parent_map(core);
|
||||
fail_parents:
|
||||
fail_ops:
|
||||
kfree_const(core->name);
|
||||
fail_name:
|
||||
kfree(core);
|
||||
kref_put(&core->ref, __clk_release);
|
||||
fail_out:
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
@@ -4225,18 +4352,6 @@ int of_clk_hw_register(struct device_node *node, struct clk_hw *hw)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(of_clk_hw_register);
|
||||
|
||||
/* Free memory allocated for a clock. */
|
||||
static void __clk_release(struct kref *ref)
|
||||
{
|
||||
struct clk_core *core = container_of(ref, struct clk_core, ref);
|
||||
|
||||
lockdep_assert_held(&prepare_lock);
|
||||
|
||||
clk_core_free_parent_map(core);
|
||||
kfree_const(core->name);
|
||||
kfree(core);
|
||||
}
|
||||
|
||||
/*
|
||||
* Empty clk_ops for unregistered clocks. These are used temporarily
|
||||
* after clk_unregister() was called on a clock and until last clock
|
||||
|
||||
@@ -152,12 +152,12 @@ const struct clk_ops mtk_clk_gate_ops_no_setclr_inv = {
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(mtk_clk_gate_ops_no_setclr_inv);
|
||||
|
||||
static struct clk_hw *mtk_clk_register_gate(const char *name,
|
||||
static struct clk_hw *mtk_clk_register_gate(struct device *dev, const char *name,
|
||||
const char *parent_name,
|
||||
struct regmap *regmap, int set_ofs,
|
||||
int clr_ofs, int sta_ofs, u8 bit,
|
||||
const struct clk_ops *ops,
|
||||
unsigned long flags, struct device *dev)
|
||||
unsigned long flags)
|
||||
{
|
||||
struct mtk_clk_gate *cg;
|
||||
int ret;
|
||||
@@ -202,10 +202,9 @@ static void mtk_clk_unregister_gate(struct clk_hw *hw)
|
||||
kfree(cg);
|
||||
}
|
||||
|
||||
int mtk_clk_register_gates_with_dev(struct device_node *node,
|
||||
const struct mtk_gate *clks, int num,
|
||||
struct clk_hw_onecell_data *clk_data,
|
||||
struct device *dev)
|
||||
int mtk_clk_register_gates(struct device *dev, struct device_node *node,
|
||||
const struct mtk_gate *clks, int num,
|
||||
struct clk_hw_onecell_data *clk_data)
|
||||
{
|
||||
int i;
|
||||
struct clk_hw *hw;
|
||||
@@ -229,13 +228,13 @@ int mtk_clk_register_gates_with_dev(struct device_node *node,
|
||||
continue;
|
||||
}
|
||||
|
||||
hw = mtk_clk_register_gate(gate->name, gate->parent_name,
|
||||
hw = mtk_clk_register_gate(dev, gate->name, gate->parent_name,
|
||||
regmap,
|
||||
gate->regs->set_ofs,
|
||||
gate->regs->clr_ofs,
|
||||
gate->regs->sta_ofs,
|
||||
gate->shift, gate->ops,
|
||||
gate->flags, dev);
|
||||
gate->flags);
|
||||
|
||||
if (IS_ERR(hw)) {
|
||||
pr_err("Failed to register clk %s: %pe\n", gate->name,
|
||||
@@ -261,14 +260,6 @@ err:
|
||||
|
||||
return PTR_ERR(hw);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mtk_clk_register_gates_with_dev);
|
||||
|
||||
int mtk_clk_register_gates(struct device_node *node,
|
||||
const struct mtk_gate *clks, int num,
|
||||
struct clk_hw_onecell_data *clk_data)
|
||||
{
|
||||
return mtk_clk_register_gates_with_dev(node, clks, num, clk_data, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mtk_clk_register_gates);
|
||||
|
||||
void mtk_clk_unregister_gates(const struct mtk_gate *clks, int num,
|
||||
|
||||
@@ -50,15 +50,10 @@ struct mtk_gate {
|
||||
#define GATE_MTK(_id, _name, _parent, _regs, _shift, _ops) \
|
||||
GATE_MTK_FLAGS(_id, _name, _parent, _regs, _shift, _ops, 0)
|
||||
|
||||
int mtk_clk_register_gates(struct device_node *node,
|
||||
int mtk_clk_register_gates(struct device *dev, struct device_node *node,
|
||||
const struct mtk_gate *clks, int num,
|
||||
struct clk_hw_onecell_data *clk_data);
|
||||
|
||||
int mtk_clk_register_gates_with_dev(struct device_node *node,
|
||||
const struct mtk_gate *clks, int num,
|
||||
struct clk_hw_onecell_data *clk_data,
|
||||
struct device *dev);
|
||||
|
||||
void mtk_clk_unregister_gates(const struct mtk_gate *clks, int num,
|
||||
struct clk_hw_onecell_data *clk_data);
|
||||
|
||||
|
||||
@@ -127,8 +127,8 @@ static int clk_mt2701_aud_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_AUD_NR);
|
||||
|
||||
mtk_clk_register_gates(node, audio_clks, ARRAY_SIZE(audio_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, audio_clks,
|
||||
ARRAY_SIZE(audio_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r) {
|
||||
|
||||
@@ -51,8 +51,8 @@ static int clk_mt2701_eth_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_ETHSYS_NR);
|
||||
|
||||
mtk_clk_register_gates(node, eth_clks, ARRAY_SIZE(eth_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, eth_clks,
|
||||
ARRAY_SIZE(eth_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
|
||||
@@ -45,7 +45,7 @@ static int clk_mt2701_g3dsys_init(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_G3DSYS_NR);
|
||||
|
||||
mtk_clk_register_gates(node, g3d_clks, ARRAY_SIZE(g3d_clks),
|
||||
mtk_clk_register_gates(&pdev->dev, node, g3d_clks, ARRAY_SIZE(g3d_clks),
|
||||
clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
@@ -48,8 +48,8 @@ static int clk_mt2701_hif_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_HIFSYS_NR);
|
||||
|
||||
mtk_clk_register_gates(node, hif_clks, ARRAY_SIZE(hif_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, hif_clks,
|
||||
ARRAY_SIZE(hif_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r) {
|
||||
|
||||
@@ -76,8 +76,8 @@ static int clk_mt2701_mm_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MM_NR);
|
||||
|
||||
mtk_clk_register_gates(node, mm_clks, ARRAY_SIZE(mm_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, mm_clks,
|
||||
ARRAY_SIZE(mm_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
|
||||
@@ -679,14 +679,15 @@ static int mtk_topckgen_init(struct platform_device *pdev)
|
||||
mtk_clk_register_factors(top_fixed_divs, ARRAY_SIZE(top_fixed_divs),
|
||||
clk_data);
|
||||
|
||||
mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes),
|
||||
base, &mt2701_clk_lock, clk_data);
|
||||
mtk_clk_register_composites(&pdev->dev, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), base,
|
||||
&mt2701_clk_lock, clk_data);
|
||||
|
||||
mtk_clk_register_dividers(top_adj_divs, ARRAY_SIZE(top_adj_divs),
|
||||
base, &mt2701_clk_lock, clk_data);
|
||||
|
||||
mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, top_clks,
|
||||
ARRAY_SIZE(top_clks), clk_data);
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
}
|
||||
@@ -789,8 +790,8 @@ static int mtk_infrasys_init(struct platform_device *pdev)
|
||||
}
|
||||
}
|
||||
|
||||
mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
|
||||
infra_clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, infra_clks,
|
||||
ARRAY_SIZE(infra_clks), infra_clk_data);
|
||||
mtk_clk_register_factors(infra_fixed_divs, ARRAY_SIZE(infra_fixed_divs),
|
||||
infra_clk_data);
|
||||
|
||||
@@ -902,11 +903,12 @@ static int mtk_pericfg_init(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
mtk_clk_register_gates(node, peri_clks, ARRAY_SIZE(peri_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, peri_clks,
|
||||
ARRAY_SIZE(peri_clks), clk_data);
|
||||
|
||||
mtk_clk_register_composites(peri_muxs, ARRAY_SIZE(peri_muxs), base,
|
||||
&mt2701_clk_lock, clk_data);
|
||||
mtk_clk_register_composites(&pdev->dev, peri_muxs,
|
||||
ARRAY_SIZE(peri_muxs), base,
|
||||
&mt2701_clk_lock, clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
|
||||
@@ -117,8 +117,8 @@ static int clk_mt2712_mm_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, mm_clks, ARRAY_SIZE(mm_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, mm_clks,
|
||||
ARRAY_SIZE(mm_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
|
||||
@@ -1320,12 +1320,13 @@ static int clk_mt2712_top_probe(struct platform_device *pdev)
|
||||
mtk_clk_register_factors(top_early_divs, ARRAY_SIZE(top_early_divs),
|
||||
top_clk_data);
|
||||
mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), top_clk_data);
|
||||
mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base,
|
||||
&mt2712_clk_lock, top_clk_data);
|
||||
mtk_clk_register_composites(&pdev->dev, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), base,
|
||||
&mt2712_clk_lock, top_clk_data);
|
||||
mtk_clk_register_dividers(top_adj_divs, ARRAY_SIZE(top_adj_divs), base,
|
||||
&mt2712_clk_lock, top_clk_data);
|
||||
mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks),
|
||||
top_clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, top_clks,
|
||||
ARRAY_SIZE(top_clks), top_clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, top_clk_data);
|
||||
|
||||
@@ -1344,8 +1345,8 @@ static int clk_mt2712_infra_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, infra_clks,
|
||||
ARRAY_SIZE(infra_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
@@ -1366,8 +1367,8 @@ static int clk_mt2712_peri_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, peri_clks, ARRAY_SIZE(peri_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, peri_clks,
|
||||
ARRAY_SIZE(peri_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
@@ -1395,8 +1396,11 @@ static int clk_mt2712_mcu_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MCU_NR_CLK);
|
||||
|
||||
mtk_clk_register_composites(mcu_muxes, ARRAY_SIZE(mcu_muxes), base,
|
||||
&mt2712_clk_lock, clk_data);
|
||||
r = mtk_clk_register_composites(&pdev->dev, mcu_muxes,
|
||||
ARRAY_SIZE(mcu_muxes), base,
|
||||
&mt2712_clk_lock, clk_data);
|
||||
if (r)
|
||||
dev_err(&pdev->dev, "Could not register composites: %d\n", r);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
|
||||
@@ -743,7 +743,7 @@ static int clk_mt6765_apmixed_probe(struct platform_device *pdev)
|
||||
|
||||
mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
|
||||
|
||||
mtk_clk_register_gates(node, apmixed_clks,
|
||||
mtk_clk_register_gates(&pdev->dev, node, apmixed_clks,
|
||||
ARRAY_SIZE(apmixed_clks), clk_data);
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
@@ -782,10 +782,11 @@ static int clk_mt6765_top_probe(struct platform_device *pdev)
|
||||
clk_data);
|
||||
mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs),
|
||||
clk_data);
|
||||
mtk_clk_register_muxes(top_muxes, ARRAY_SIZE(top_muxes), node,
|
||||
mtk_clk_register_muxes(&pdev->dev, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), node,
|
||||
&mt6765_clk_lock, clk_data);
|
||||
mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, top_clks,
|
||||
ARRAY_SIZE(top_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
@@ -820,8 +821,8 @@ static int clk_mt6765_ifr_probe(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
mtk_clk_register_gates(node, ifr_clks, ARRAY_SIZE(ifr_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, ifr_clks,
|
||||
ARRAY_SIZE(ifr_clks), clk_data);
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
if (r)
|
||||
|
||||
@@ -93,8 +93,8 @@ static int clk_mt6779_mm_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, mm_clks, ARRAY_SIZE(mm_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, mm_clks,
|
||||
ARRAY_SIZE(mm_clks), clk_data);
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
@@ -1223,7 +1223,7 @@ static int clk_mt6779_apmixed_probe(struct platform_device *pdev)
|
||||
|
||||
mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
|
||||
|
||||
mtk_clk_register_gates(node, apmixed_clks,
|
||||
mtk_clk_register_gates(&pdev->dev, node, apmixed_clks,
|
||||
ARRAY_SIZE(apmixed_clks), clk_data);
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
@@ -1248,14 +1248,17 @@ static int clk_mt6779_top_probe(struct platform_device *pdev)
|
||||
|
||||
mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data);
|
||||
|
||||
mtk_clk_register_muxes(top_muxes, ARRAY_SIZE(top_muxes),
|
||||
node, &mt6779_clk_lock, clk_data);
|
||||
mtk_clk_register_muxes(&pdev->dev, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), node,
|
||||
&mt6779_clk_lock, clk_data);
|
||||
|
||||
mtk_clk_register_composites(top_aud_muxes, ARRAY_SIZE(top_aud_muxes),
|
||||
base, &mt6779_clk_lock, clk_data);
|
||||
mtk_clk_register_composites(&pdev->dev, top_aud_muxes,
|
||||
ARRAY_SIZE(top_aud_muxes), base,
|
||||
&mt6779_clk_lock, clk_data);
|
||||
|
||||
mtk_clk_register_composites(top_aud_divs, ARRAY_SIZE(top_aud_divs),
|
||||
base, &mt6779_clk_lock, clk_data);
|
||||
mtk_clk_register_composites(&pdev->dev, top_aud_divs,
|
||||
ARRAY_SIZE(top_aud_divs), base,
|
||||
&mt6779_clk_lock, clk_data);
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
}
|
||||
@@ -1267,8 +1270,8 @@ static int clk_mt6779_infra_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, infra_clks,
|
||||
ARRAY_SIZE(infra_clks), clk_data);
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,8 @@ static int clk_mt6795_infracfg_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
goto free_clk_data;
|
||||
|
||||
ret = mtk_clk_register_gates(node, infra_gates, ARRAY_SIZE(infra_gates), clk_data);
|
||||
ret = mtk_clk_register_gates(&pdev->dev, node, infra_gates,
|
||||
ARRAY_SIZE(infra_gates), clk_data);
|
||||
if (ret)
|
||||
goto free_clk_data;
|
||||
|
||||
|
||||
@@ -87,7 +87,8 @@ static int clk_mt6795_mm_probe(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = mtk_clk_register_gates(node, mm_gates, ARRAY_SIZE(mm_gates), clk_data);
|
||||
ret = mtk_clk_register_gates(&pdev->dev, node, mm_gates,
|
||||
ARRAY_SIZE(mm_gates), clk_data);
|
||||
if (ret)
|
||||
goto free_clk_data;
|
||||
|
||||
|
||||
@@ -109,11 +109,13 @@ static int clk_mt6795_pericfg_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
goto free_clk_data;
|
||||
|
||||
ret = mtk_clk_register_gates(node, peri_gates, ARRAY_SIZE(peri_gates), clk_data);
|
||||
ret = mtk_clk_register_gates(&pdev->dev, node, peri_gates,
|
||||
ARRAY_SIZE(peri_gates), clk_data);
|
||||
if (ret)
|
||||
goto free_clk_data;
|
||||
|
||||
ret = mtk_clk_register_composites(peri_clks, ARRAY_SIZE(peri_clks), base,
|
||||
ret = mtk_clk_register_composites(&pdev->dev, peri_clks,
|
||||
ARRAY_SIZE(peri_clks), base,
|
||||
&mt6795_peri_clk_lock, clk_data);
|
||||
if (ret)
|
||||
goto unregister_gates;
|
||||
|
||||
@@ -552,12 +552,14 @@ static int clk_mt6795_topckgen_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
goto unregister_fixed_clks;
|
||||
|
||||
ret = mtk_clk_register_muxes(top_muxes, ARRAY_SIZE(top_muxes), node,
|
||||
ret = mtk_clk_register_muxes(&pdev->dev, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), node,
|
||||
&mt6795_top_clk_lock, clk_data);
|
||||
if (ret)
|
||||
goto unregister_factors;
|
||||
|
||||
ret = mtk_clk_register_composites(top_aud_divs, ARRAY_SIZE(top_aud_divs), base,
|
||||
ret = mtk_clk_register_composites(&pdev->dev, top_aud_divs,
|
||||
ARRAY_SIZE(top_aud_divs), base,
|
||||
&mt6795_top_clk_lock, clk_data);
|
||||
if (ret)
|
||||
goto unregister_muxes;
|
||||
|
||||
@@ -89,8 +89,8 @@ static int clk_mt6797_mm_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MM_NR);
|
||||
|
||||
mtk_clk_register_gates(node, mm_clks, ARRAY_SIZE(mm_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, mm_clks,
|
||||
ARRAY_SIZE(mm_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
|
||||
@@ -398,7 +398,8 @@ static int mtk_topckgen_init(struct platform_device *pdev)
|
||||
mtk_clk_register_factors(top_fixed_divs, ARRAY_SIZE(top_fixed_divs),
|
||||
clk_data);
|
||||
|
||||
mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base,
|
||||
mtk_clk_register_composites(&pdev->dev, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), base,
|
||||
&mt6797_clk_lock, clk_data);
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
@@ -584,8 +585,8 @@ static int mtk_infrasys_init(struct platform_device *pdev)
|
||||
}
|
||||
}
|
||||
|
||||
mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
|
||||
infra_clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, infra_clks,
|
||||
ARRAY_SIZE(infra_clks), infra_clk_data);
|
||||
mtk_clk_register_factors(infra_fixed_divs, ARRAY_SIZE(infra_fixed_divs),
|
||||
infra_clk_data);
|
||||
|
||||
|
||||
@@ -114,8 +114,8 @@ static int clk_mt7622_audiosys_init(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_AUDIO_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, audio_clks, ARRAY_SIZE(audio_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, audio_clks,
|
||||
ARRAY_SIZE(audio_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r) {
|
||||
|
||||
@@ -69,8 +69,8 @@ static int clk_mt7622_ethsys_init(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_ETH_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, eth_clks, ARRAY_SIZE(eth_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, eth_clks,
|
||||
ARRAY_SIZE(eth_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
@@ -91,8 +91,8 @@ static int clk_mt7622_sgmiisys_init(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_SGMII_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, sgmii_clks, ARRAY_SIZE(sgmii_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, sgmii_clks,
|
||||
ARRAY_SIZE(sgmii_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
|
||||
@@ -80,8 +80,8 @@ static int clk_mt7622_ssusbsys_init(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_SSUSB_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, ssusb_clks, ARRAY_SIZE(ssusb_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, ssusb_clks,
|
||||
ARRAY_SIZE(ssusb_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
@@ -102,8 +102,8 @@ static int clk_mt7622_pciesys_init(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_PCIE_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, pcie_clks, ARRAY_SIZE(pcie_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, pcie_clks,
|
||||
ARRAY_SIZE(pcie_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
|
||||
@@ -615,14 +615,15 @@ static int mtk_topckgen_init(struct platform_device *pdev)
|
||||
mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs),
|
||||
clk_data);
|
||||
|
||||
mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes),
|
||||
base, &mt7622_clk_lock, clk_data);
|
||||
mtk_clk_register_composites(&pdev->dev, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), base,
|
||||
&mt7622_clk_lock, clk_data);
|
||||
|
||||
mtk_clk_register_dividers(top_adj_divs, ARRAY_SIZE(top_adj_divs),
|
||||
base, &mt7622_clk_lock, clk_data);
|
||||
|
||||
mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, top_clks,
|
||||
ARRAY_SIZE(top_clks), clk_data);
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
}
|
||||
@@ -635,8 +636,8 @@ static int mtk_infrasys_init(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, infra_clks,
|
||||
ARRAY_SIZE(infra_clks), clk_data);
|
||||
|
||||
mtk_clk_register_cpumuxes(node, infra_muxes, ARRAY_SIZE(infra_muxes),
|
||||
clk_data);
|
||||
@@ -663,7 +664,7 @@ static int mtk_apmixedsys_init(struct platform_device *pdev)
|
||||
mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls),
|
||||
clk_data);
|
||||
|
||||
mtk_clk_register_gates(node, apmixed_clks,
|
||||
mtk_clk_register_gates(&pdev->dev, node, apmixed_clks,
|
||||
ARRAY_SIZE(apmixed_clks), clk_data);
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
@@ -682,10 +683,11 @@ static int mtk_pericfg_init(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, peri_clks, ARRAY_SIZE(peri_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, peri_clks,
|
||||
ARRAY_SIZE(peri_clks), clk_data);
|
||||
|
||||
mtk_clk_register_composites(peri_muxes, ARRAY_SIZE(peri_muxes), base,
|
||||
mtk_clk_register_composites(&pdev->dev, peri_muxes,
|
||||
ARRAY_SIZE(peri_muxes), base,
|
||||
&mt7622_clk_lock, clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
@@ -82,7 +82,8 @@ static int clk_mt7629_ethsys_init(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
mtk_clk_register_gates(node, eth_clks, CLK_ETH_NR_CLK, clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, eth_clks,
|
||||
CLK_ETH_NR_CLK, clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
@@ -106,8 +107,8 @@ static int clk_mt7629_sgmiisys_init(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
mtk_clk_register_gates(node, sgmii_clks[id++], CLK_SGMII_NR_CLK,
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, sgmii_clks[id++],
|
||||
CLK_SGMII_NR_CLK, clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
|
||||
@@ -75,8 +75,8 @@ static int clk_mt7629_ssusbsys_init(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_SSUSB_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, ssusb_clks, ARRAY_SIZE(ssusb_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, ssusb_clks,
|
||||
ARRAY_SIZE(ssusb_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
@@ -97,8 +97,8 @@ static int clk_mt7629_pciesys_init(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_PCIE_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, pcie_clks, ARRAY_SIZE(pcie_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, pcie_clks,
|
||||
ARRAY_SIZE(pcie_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
|
||||
@@ -566,8 +566,9 @@ static int mtk_topckgen_init(struct platform_device *pdev)
|
||||
mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs),
|
||||
clk_data);
|
||||
|
||||
mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes),
|
||||
base, &mt7629_clk_lock, clk_data);
|
||||
mtk_clk_register_composites(&pdev->dev, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), base,
|
||||
&mt7629_clk_lock, clk_data);
|
||||
|
||||
clk_prepare_enable(clk_data->hws[CLK_TOP_AXI_SEL]->clk);
|
||||
clk_prepare_enable(clk_data->hws[CLK_TOP_MEM_SEL]->clk);
|
||||
@@ -585,8 +586,8 @@ static int mtk_infrasys_init(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, infra_clks,
|
||||
ARRAY_SIZE(infra_clks), clk_data);
|
||||
|
||||
mtk_clk_register_cpumuxes(node, infra_muxes, ARRAY_SIZE(infra_muxes),
|
||||
clk_data);
|
||||
@@ -610,10 +611,11 @@ static int mtk_pericfg_init(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
mtk_clk_register_gates(node, peri_clks, ARRAY_SIZE(peri_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, peri_clks,
|
||||
ARRAY_SIZE(peri_clks), clk_data);
|
||||
|
||||
mtk_clk_register_composites(peri_muxes, ARRAY_SIZE(peri_muxes), base,
|
||||
mtk_clk_register_composites(&pdev->dev, peri_muxes,
|
||||
ARRAY_SIZE(peri_muxes), base,
|
||||
&mt7629_clk_lock, clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
@@ -637,7 +639,7 @@ static int mtk_apmixedsys_init(struct platform_device *pdev)
|
||||
mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls),
|
||||
clk_data);
|
||||
|
||||
mtk_clk_register_gates(node, apmixed_clks,
|
||||
mtk_clk_register_gates(&pdev->dev, node, apmixed_clks,
|
||||
ARRAY_SIZE(apmixed_clks), clk_data);
|
||||
|
||||
clk_prepare_enable(clk_data->hws[CLK_APMIXED_ARMPLL]->clk);
|
||||
|
||||
@@ -72,8 +72,8 @@ static void __init mtk_sgmiisys_0_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(ARRAY_SIZE(sgmii0_clks));
|
||||
|
||||
mtk_clk_register_gates(node, sgmii0_clks, ARRAY_SIZE(sgmii0_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(NULL, node, sgmii0_clks,
|
||||
ARRAY_SIZE(sgmii0_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
@@ -90,8 +90,8 @@ static void __init mtk_sgmiisys_1_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(ARRAY_SIZE(sgmii1_clks));
|
||||
|
||||
mtk_clk_register_gates(node, sgmii1_clks, ARRAY_SIZE(sgmii1_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(NULL, node, sgmii1_clks,
|
||||
ARRAY_SIZE(sgmii1_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
@@ -109,7 +109,7 @@ static void __init mtk_ethsys_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(ARRAY_SIZE(eth_clks));
|
||||
|
||||
mtk_clk_register_gates(node, eth_clks, ARRAY_SIZE(eth_clks), clk_data);
|
||||
mtk_clk_register_gates(NULL, node, eth_clks, ARRAY_SIZE(eth_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
|
||||
@@ -178,10 +178,11 @@ static int clk_mt7986_infracfg_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
mtk_clk_register_factors(infra_divs, ARRAY_SIZE(infra_divs), clk_data);
|
||||
mtk_clk_register_muxes(infra_muxes, ARRAY_SIZE(infra_muxes), node,
|
||||
mtk_clk_register_muxes(&pdev->dev, infra_muxes,
|
||||
ARRAY_SIZE(infra_muxes), node,
|
||||
&mt7986_clk_lock, clk_data);
|
||||
mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, infra_clks,
|
||||
ARRAY_SIZE(infra_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r) {
|
||||
|
||||
@@ -303,7 +303,8 @@ static int clk_mt7986_topckgen_probe(struct platform_device *pdev)
|
||||
mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data);
|
||||
mtk_clk_register_muxes(top_muxes, ARRAY_SIZE(top_muxes), node,
|
||||
mtk_clk_register_muxes(&pdev->dev, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), node,
|
||||
&mt7986_clk_lock, clk_data);
|
||||
|
||||
clk_prepare_enable(clk_data->hws[CLK_TOP_SYSAXI_SEL]->clk);
|
||||
|
||||
@@ -536,8 +536,9 @@ static void __init mtk_topckgen_init(struct device_node *node)
|
||||
|
||||
mtk_clk_register_factors(root_clk_alias, ARRAY_SIZE(root_clk_alias), clk_data);
|
||||
mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data);
|
||||
mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base,
|
||||
&mt8135_clk_lock, clk_data);
|
||||
mtk_clk_register_composites(NULL, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), base,
|
||||
&mt8135_clk_lock, clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
@@ -553,8 +554,8 @@ static void __init mtk_infrasys_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(NULL, node, infra_clks,
|
||||
ARRAY_SIZE(infra_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
@@ -579,10 +580,11 @@ static void __init mtk_pericfg_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, peri_gates, ARRAY_SIZE(peri_gates),
|
||||
clk_data);
|
||||
mtk_clk_register_composites(peri_clks, ARRAY_SIZE(peri_clks), base,
|
||||
&mt8135_clk_lock, clk_data);
|
||||
mtk_clk_register_gates(NULL, node, peri_gates,
|
||||
ARRAY_SIZE(peri_gates), clk_data);
|
||||
mtk_clk_register_composites(NULL, peri_clks,
|
||||
ARRAY_SIZE(peri_clks), base,
|
||||
&mt8135_clk_lock, clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
|
||||
@@ -50,7 +50,7 @@ static void __init mtk_audsys_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_AUD_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, aud_clks, ARRAY_SIZE(aud_clks), clk_data);
|
||||
mtk_clk_register_gates(NULL, node, aud_clks, ARRAY_SIZE(aud_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
|
||||
@@ -42,7 +42,7 @@ static void __init mtk_imgsys_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_IMG_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, img_clks, ARRAY_SIZE(img_clks), clk_data);
|
||||
mtk_clk_register_gates(NULL, node, img_clks, ARRAY_SIZE(img_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ static void __init mtk_mfgcfg_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MFG_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, mfg_clks, ARRAY_SIZE(mfg_clks), clk_data);
|
||||
mtk_clk_register_gates(NULL, node, mfg_clks, ARRAY_SIZE(mfg_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
|
||||
@@ -98,8 +98,8 @@ static int clk_mt8167_mm_probe(struct platform_device *pdev)
|
||||
|
||||
data = &mt8167_mmsys_driver_data;
|
||||
|
||||
ret = mtk_clk_register_gates(node, data->gates_clk, data->gates_num,
|
||||
clk_data);
|
||||
ret = mtk_clk_register_gates(&pdev->dev, node, data->gates_clk,
|
||||
data->gates_num, clk_data);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -49,7 +49,8 @@ static void __init mtk_vdecsys_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_VDEC_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, vdec_clks, ARRAY_SIZE(vdec_clks), clk_data);
|
||||
mtk_clk_register_gates(NULL, node, vdec_clks, ARRAY_SIZE(vdec_clks),
|
||||
clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
|
||||
@@ -937,11 +937,12 @@ static void __init mtk_topckgen_init(struct device_node *node)
|
||||
|
||||
mtk_clk_register_fixed_clks(fixed_clks, ARRAY_SIZE(fixed_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks), clk_data);
|
||||
mtk_clk_register_gates(NULL, node, top_clks, ARRAY_SIZE(top_clks), clk_data);
|
||||
|
||||
mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data);
|
||||
mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base,
|
||||
&mt8167_clk_lock, clk_data);
|
||||
mtk_clk_register_composites(NULL, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), base,
|
||||
&mt8167_clk_lock, clk_data);
|
||||
mtk_clk_register_dividers(top_adj_divs, ARRAY_SIZE(top_adj_divs),
|
||||
base, &mt8167_clk_lock, clk_data);
|
||||
|
||||
@@ -966,8 +967,9 @@ static void __init mtk_infracfg_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_IFR_NR_CLK);
|
||||
|
||||
mtk_clk_register_composites(ifr_muxes, ARRAY_SIZE(ifr_muxes), base,
|
||||
&mt8167_clk_lock, clk_data);
|
||||
mtk_clk_register_composites(NULL, ifr_muxes,
|
||||
ARRAY_SIZE(ifr_muxes), base,
|
||||
&mt8167_clk_lock, clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
|
||||
@@ -112,8 +112,8 @@ static int clk_mt8173_mm_probe(struct platform_device *pdev)
|
||||
|
||||
data = &mt8173_mmsys_driver_data;
|
||||
|
||||
ret = mtk_clk_register_gates(node, data->gates_clk, data->gates_num,
|
||||
clk_data);
|
||||
ret = mtk_clk_register_gates(&pdev->dev, node, data->gates_clk,
|
||||
data->gates_num, clk_data);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -869,8 +869,9 @@ static void __init mtk_topckgen_init(struct device_node *node)
|
||||
|
||||
mtk_clk_register_fixed_clks(fixed_clks, ARRAY_SIZE(fixed_clks), clk_data);
|
||||
mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data);
|
||||
mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base,
|
||||
&mt8173_clk_lock, clk_data);
|
||||
mtk_clk_register_composites(NULL, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), base,
|
||||
&mt8173_clk_lock, clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
@@ -888,8 +889,8 @@ static void __init mtk_infrasys_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(NULL, node, infra_clks,
|
||||
ARRAY_SIZE(infra_clks), clk_data);
|
||||
mtk_clk_register_factors(infra_divs, ARRAY_SIZE(infra_divs), clk_data);
|
||||
|
||||
mtk_clk_register_cpumuxes(node, cpu_muxes, ARRAY_SIZE(cpu_muxes),
|
||||
@@ -918,10 +919,11 @@ static void __init mtk_pericfg_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, peri_gates, ARRAY_SIZE(peri_gates),
|
||||
clk_data);
|
||||
mtk_clk_register_composites(peri_clks, ARRAY_SIZE(peri_clks), base,
|
||||
&mt8173_clk_lock, clk_data);
|
||||
mtk_clk_register_gates(NULL, node, peri_gates,
|
||||
ARRAY_SIZE(peri_gates), clk_data);
|
||||
mtk_clk_register_composites(NULL, peri_clks,
|
||||
ARRAY_SIZE(peri_clks), base,
|
||||
&mt8173_clk_lock, clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
@@ -1062,8 +1064,8 @@ static void __init mtk_imgsys_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_IMG_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, img_clks, ARRAY_SIZE(img_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(NULL, node, img_clks,
|
||||
ARRAY_SIZE(img_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
@@ -1080,8 +1082,8 @@ static void __init mtk_vdecsys_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_VDEC_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, vdec_clks, ARRAY_SIZE(vdec_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(NULL, node, vdec_clks,
|
||||
ARRAY_SIZE(vdec_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
@@ -1097,8 +1099,8 @@ static void __init mtk_vencsys_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_VENC_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, venc_clks, ARRAY_SIZE(venc_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(NULL, node, venc_clks,
|
||||
ARRAY_SIZE(venc_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
@@ -1114,8 +1116,8 @@ static void __init mtk_vencltsys_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_VENCLT_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, venclt_clks, ARRAY_SIZE(venclt_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(NULL, node, venclt_clks,
|
||||
ARRAY_SIZE(venclt_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
|
||||
@@ -75,8 +75,8 @@ static int clk_mt8183_audio_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_AUDIO_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, audio_clks, ARRAY_SIZE(audio_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, audio_clks,
|
||||
ARRAY_SIZE(audio_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
|
||||
@@ -90,8 +90,8 @@ static int clk_mt8183_mm_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, mm_clks, ARRAY_SIZE(mm_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, mm_clks,
|
||||
ARRAY_SIZE(mm_clks), clk_data);
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
@@ -1172,8 +1172,8 @@ static int clk_mt8183_apmixed_probe(struct platform_device *pdev)
|
||||
|
||||
mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
|
||||
|
||||
mtk_clk_register_gates(node, apmixed_clks, ARRAY_SIZE(apmixed_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, apmixed_clks,
|
||||
ARRAY_SIZE(apmixed_clks), clk_data);
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
}
|
||||
@@ -1238,17 +1238,20 @@ static int clk_mt8183_top_probe(struct platform_device *pdev)
|
||||
|
||||
mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), top_clk_data);
|
||||
|
||||
mtk_clk_register_muxes(top_muxes, ARRAY_SIZE(top_muxes),
|
||||
node, &mt8183_clk_lock, top_clk_data);
|
||||
mtk_clk_register_muxes(&pdev->dev, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), node,
|
||||
&mt8183_clk_lock, top_clk_data);
|
||||
|
||||
mtk_clk_register_composites(top_aud_muxes, ARRAY_SIZE(top_aud_muxes),
|
||||
base, &mt8183_clk_lock, top_clk_data);
|
||||
mtk_clk_register_composites(&pdev->dev, top_aud_muxes,
|
||||
ARRAY_SIZE(top_aud_muxes), base,
|
||||
&mt8183_clk_lock, top_clk_data);
|
||||
|
||||
mtk_clk_register_composites(top_aud_divs, ARRAY_SIZE(top_aud_divs),
|
||||
base, &mt8183_clk_lock, top_clk_data);
|
||||
mtk_clk_register_composites(&pdev->dev, top_aud_divs,
|
||||
ARRAY_SIZE(top_aud_divs), base,
|
||||
&mt8183_clk_lock, top_clk_data);
|
||||
|
||||
mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks),
|
||||
top_clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, top_clks,
|
||||
ARRAY_SIZE(top_clks), top_clk_data);
|
||||
|
||||
ret = clk_mt8183_reg_mfg_mux_notifier(&pdev->dev,
|
||||
top_clk_data->hws[CLK_TOP_MUX_MFG]->clk);
|
||||
@@ -1267,8 +1270,8 @@ static int clk_mt8183_infra_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, infra_clks,
|
||||
ARRAY_SIZE(infra_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r) {
|
||||
@@ -1290,8 +1293,8 @@ static int clk_mt8183_peri_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, peri_clks, ARRAY_SIZE(peri_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, peri_clks,
|
||||
ARRAY_SIZE(peri_clks), clk_data);
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
}
|
||||
@@ -1308,8 +1311,9 @@ static int clk_mt8183_mcu_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MCU_NR_CLK);
|
||||
|
||||
mtk_clk_register_composites(mcu_muxes, ARRAY_SIZE(mcu_muxes), base,
|
||||
&mt8183_clk_lock, clk_data);
|
||||
mtk_clk_register_composites(&pdev->dev, mcu_muxes,
|
||||
ARRAY_SIZE(mcu_muxes), base,
|
||||
&mt8183_clk_lock, clk_data);
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,8 @@ static int clk_mt8186_mcu_probe(struct platform_device *pdev)
|
||||
goto free_mcu_data;
|
||||
}
|
||||
|
||||
r = mtk_clk_register_composites(mcu_muxes, ARRAY_SIZE(mcu_muxes), base,
|
||||
r = mtk_clk_register_composites(&pdev->dev, mcu_muxes,
|
||||
ARRAY_SIZE(mcu_muxes), base,
|
||||
NULL, clk_data);
|
||||
if (r)
|
||||
goto free_mcu_data;
|
||||
|
||||
@@ -69,7 +69,8 @@ static int clk_mt8186_mm_probe(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
r = mtk_clk_register_gates(node, mm_clks, ARRAY_SIZE(mm_clks), clk_data);
|
||||
r = mtk_clk_register_gates(&pdev->dev, node, mm_clks,
|
||||
ARRAY_SIZE(mm_clks), clk_data);
|
||||
if (r)
|
||||
goto free_mm_data;
|
||||
|
||||
|
||||
@@ -715,17 +715,20 @@ static int clk_mt8186_topck_probe(struct platform_device *pdev)
|
||||
if (r)
|
||||
goto unregister_fixed_clks;
|
||||
|
||||
r = mtk_clk_register_muxes(top_mtk_muxes, ARRAY_SIZE(top_mtk_muxes), node,
|
||||
r = mtk_clk_register_muxes(&pdev->dev, top_mtk_muxes,
|
||||
ARRAY_SIZE(top_mtk_muxes), node,
|
||||
&mt8186_clk_lock, clk_data);
|
||||
if (r)
|
||||
goto unregister_factors;
|
||||
|
||||
r = mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base,
|
||||
r = mtk_clk_register_composites(&pdev->dev, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), base,
|
||||
&mt8186_clk_lock, clk_data);
|
||||
if (r)
|
||||
goto unregister_muxes;
|
||||
|
||||
r = mtk_clk_register_composites(top_adj_divs, ARRAY_SIZE(top_adj_divs), base,
|
||||
r = mtk_clk_register_composites(&pdev->dev, top_adj_divs,
|
||||
ARRAY_SIZE(top_adj_divs), base,
|
||||
&mt8186_clk_lock, clk_data);
|
||||
if (r)
|
||||
goto unregister_composite_muxes;
|
||||
|
||||
@@ -87,7 +87,8 @@ static int clk_mt8192_aud_probe(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
r = mtk_clk_register_gates(node, aud_clks, ARRAY_SIZE(aud_clks), clk_data);
|
||||
r = mtk_clk_register_gates(&pdev->dev, node, aud_clks,
|
||||
ARRAY_SIZE(aud_clks), clk_data);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
|
||||
@@ -91,7 +91,8 @@ static int clk_mt8192_mm_probe(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
r = mtk_clk_register_gates(node, mm_clks, ARRAY_SIZE(mm_clks), clk_data);
|
||||
r = mtk_clk_register_gates(&pdev->dev, node, mm_clks,
|
||||
ARRAY_SIZE(mm_clks), clk_data);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
|
||||
@@ -1100,27 +1100,68 @@ static int clk_mt8192_top_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(base))
|
||||
return PTR_ERR(base);
|
||||
|
||||
mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), top_clk_data);
|
||||
mtk_clk_register_factors(top_early_divs, ARRAY_SIZE(top_early_divs), top_clk_data);
|
||||
mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), top_clk_data);
|
||||
mtk_clk_register_muxes(top_mtk_muxes, ARRAY_SIZE(top_mtk_muxes), node, &mt8192_clk_lock,
|
||||
top_clk_data);
|
||||
mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base, &mt8192_clk_lock,
|
||||
top_clk_data);
|
||||
mtk_clk_register_composites(top_adj_divs, ARRAY_SIZE(top_adj_divs), base, &mt8192_clk_lock,
|
||||
top_clk_data);
|
||||
r = mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks), top_clk_data);
|
||||
r = mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks), top_clk_data);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = mtk_clk_register_factors(top_early_divs, ARRAY_SIZE(top_early_divs), top_clk_data);
|
||||
if (r)
|
||||
goto unregister_fixed_clks;
|
||||
|
||||
r = mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), top_clk_data);
|
||||
if (r)
|
||||
goto unregister_early_factors;
|
||||
|
||||
r = mtk_clk_register_muxes(&pdev->dev, top_mtk_muxes,
|
||||
ARRAY_SIZE(top_mtk_muxes), node,
|
||||
&mt8192_clk_lock, top_clk_data);
|
||||
if (r)
|
||||
goto unregister_factors;
|
||||
|
||||
r = mtk_clk_register_composites(&pdev->dev, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), base,
|
||||
&mt8192_clk_lock, top_clk_data);
|
||||
if (r)
|
||||
goto unregister_muxes;
|
||||
|
||||
r = mtk_clk_register_composites(&pdev->dev, top_adj_divs,
|
||||
ARRAY_SIZE(top_adj_divs), base,
|
||||
&mt8192_clk_lock, top_clk_data);
|
||||
if (r)
|
||||
goto unregister_top_composites;
|
||||
|
||||
r = mtk_clk_register_gates(&pdev->dev, node, top_clks,
|
||||
ARRAY_SIZE(top_clks), top_clk_data);
|
||||
if (r)
|
||||
goto unregister_adj_divs_composites;
|
||||
|
||||
r = clk_mt8192_reg_mfg_mux_notifier(&pdev->dev,
|
||||
top_clk_data->hws[CLK_TOP_MFG_PLL_SEL]->clk);
|
||||
if (r)
|
||||
return r;
|
||||
goto unregister_gates;
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, top_clk_data);
|
||||
if (r)
|
||||
goto unregister_gates;
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
|
||||
return 0;
|
||||
|
||||
unregister_gates:
|
||||
mtk_clk_unregister_gates(top_clks, ARRAY_SIZE(top_clks), top_clk_data);
|
||||
unregister_adj_divs_composites:
|
||||
mtk_clk_unregister_composites(top_adj_divs, ARRAY_SIZE(top_adj_divs), top_clk_data);
|
||||
unregister_top_composites:
|
||||
mtk_clk_unregister_composites(top_muxes, ARRAY_SIZE(top_muxes), top_clk_data);
|
||||
unregister_muxes:
|
||||
mtk_clk_unregister_muxes(top_mtk_muxes, ARRAY_SIZE(top_mtk_muxes), top_clk_data);
|
||||
unregister_factors:
|
||||
mtk_clk_unregister_factors(top_divs, ARRAY_SIZE(top_divs), top_clk_data);
|
||||
unregister_early_factors:
|
||||
mtk_clk_unregister_factors(top_early_divs, ARRAY_SIZE(top_early_divs), top_clk_data);
|
||||
unregister_fixed_clks:
|
||||
mtk_clk_unregister_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks),
|
||||
top_clk_data);
|
||||
return r;
|
||||
}
|
||||
|
||||
static int clk_mt8192_infra_probe(struct platform_device *pdev)
|
||||
@@ -1133,20 +1174,23 @@ static int clk_mt8192_infra_probe(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
r = mtk_clk_register_gates(node, infra_clks, ARRAY_SIZE(infra_clks), clk_data);
|
||||
r = mtk_clk_register_gates(&pdev->dev, node, infra_clks,
|
||||
ARRAY_SIZE(infra_clks), clk_data);
|
||||
if (r)
|
||||
goto free_clk_data;
|
||||
|
||||
r = mtk_register_reset_controller_with_dev(&pdev->dev, &clk_rst_desc);
|
||||
if (r)
|
||||
goto free_clk_data;
|
||||
goto unregister_gates;
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
goto free_clk_data;
|
||||
goto unregister_gates;
|
||||
|
||||
return r;
|
||||
|
||||
unregister_gates:
|
||||
mtk_clk_unregister_gates(infra_clks, ARRAY_SIZE(infra_clks), clk_data);
|
||||
free_clk_data:
|
||||
mtk_free_clk_data(clk_data);
|
||||
return r;
|
||||
@@ -1162,16 +1206,19 @@ static int clk_mt8192_peri_probe(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
r = mtk_clk_register_gates(node, peri_clks, ARRAY_SIZE(peri_clks), clk_data);
|
||||
r = mtk_clk_register_gates(&pdev->dev, node, peri_clks,
|
||||
ARRAY_SIZE(peri_clks), clk_data);
|
||||
if (r)
|
||||
goto free_clk_data;
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
goto free_clk_data;
|
||||
goto unregister_gates;
|
||||
|
||||
return r;
|
||||
|
||||
unregister_gates:
|
||||
mtk_clk_unregister_gates(peri_clks, ARRAY_SIZE(peri_clks), clk_data);
|
||||
free_clk_data:
|
||||
mtk_free_clk_data(clk_data);
|
||||
return r;
|
||||
@@ -1188,16 +1235,19 @@ static int clk_mt8192_apmixed_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
|
||||
r = mtk_clk_register_gates(node, apmixed_clks, ARRAY_SIZE(apmixed_clks), clk_data);
|
||||
r = mtk_clk_register_gates(&pdev->dev, node, apmixed_clks,
|
||||
ARRAY_SIZE(apmixed_clks), clk_data);
|
||||
if (r)
|
||||
goto free_clk_data;
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
goto free_clk_data;
|
||||
goto unregister_gates;
|
||||
|
||||
return r;
|
||||
|
||||
unregister_gates:
|
||||
mtk_clk_unregister_gates(apmixed_clks, ARRAY_SIZE(apmixed_clks), clk_data);
|
||||
free_clk_data:
|
||||
mtk_free_clk_data(clk_data);
|
||||
return r;
|
||||
|
||||
@@ -124,7 +124,8 @@ static int clk_mt8195_apmixed_probe(struct platform_device *pdev)
|
||||
if (r)
|
||||
goto free_apmixed_data;
|
||||
|
||||
r = mtk_clk_register_gates(node, apmixed_clks, ARRAY_SIZE(apmixed_clks), clk_data);
|
||||
r = mtk_clk_register_gates(&pdev->dev, node, apmixed_clks,
|
||||
ARRAY_SIZE(apmixed_clks), clk_data);
|
||||
if (r)
|
||||
goto unregister_plls;
|
||||
|
||||
|
||||
@@ -1262,7 +1262,8 @@ static int clk_mt8195_topck_probe(struct platform_device *pdev)
|
||||
if (r)
|
||||
goto unregister_fixed_clks;
|
||||
|
||||
r = mtk_clk_register_muxes(top_mtk_muxes, ARRAY_SIZE(top_mtk_muxes), node,
|
||||
r = mtk_clk_register_muxes(&pdev->dev, top_mtk_muxes,
|
||||
ARRAY_SIZE(top_mtk_muxes), node,
|
||||
&mt8195_clk_lock, top_clk_data);
|
||||
if (r)
|
||||
goto unregister_factors;
|
||||
@@ -1281,12 +1282,14 @@ static int clk_mt8195_topck_probe(struct platform_device *pdev)
|
||||
if (r)
|
||||
goto unregister_muxes;
|
||||
|
||||
r = mtk_clk_register_composites(top_adj_divs, ARRAY_SIZE(top_adj_divs), base,
|
||||
r = mtk_clk_register_composites(&pdev->dev, top_adj_divs,
|
||||
ARRAY_SIZE(top_adj_divs), base,
|
||||
&mt8195_clk_lock, top_clk_data);
|
||||
if (r)
|
||||
goto unregister_muxes;
|
||||
|
||||
r = mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks), top_clk_data);
|
||||
r = mtk_clk_register_gates(&pdev->dev, node, top_clks,
|
||||
ARRAY_SIZE(top_clks), top_clk_data);
|
||||
if (r)
|
||||
goto unregister_composite_divs;
|
||||
|
||||
|
||||
@@ -104,7 +104,8 @@ static int clk_mt8195_vdo0_probe(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
r = mtk_clk_register_gates(node, vdo0_clks, ARRAY_SIZE(vdo0_clks), clk_data);
|
||||
r = mtk_clk_register_gates(&pdev->dev, node, vdo0_clks,
|
||||
ARRAY_SIZE(vdo0_clks), clk_data);
|
||||
if (r)
|
||||
goto free_vdo0_data;
|
||||
|
||||
|
||||
@@ -131,7 +131,8 @@ static int clk_mt8195_vdo1_probe(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
r = mtk_clk_register_gates(node, vdo1_clks, ARRAY_SIZE(vdo1_clks), clk_data);
|
||||
r = mtk_clk_register_gates(&pdev->dev, node, vdo1_clks,
|
||||
ARRAY_SIZE(vdo1_clks), clk_data);
|
||||
if (r)
|
||||
goto free_vdo1_data;
|
||||
|
||||
|
||||
@@ -81,9 +81,8 @@ static int clk_mt8365_mm_probe(struct platform_device *pdev)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
|
||||
|
||||
ret = mtk_clk_register_gates_with_dev(node, mm_clks,
|
||||
ARRAY_SIZE(mm_clks), clk_data,
|
||||
dev);
|
||||
ret = mtk_clk_register_gates(dev, node, mm_clks,
|
||||
ARRAY_SIZE(mm_clks), clk_data);
|
||||
if (ret)
|
||||
goto err_free_clk_data;
|
||||
|
||||
|
||||
@@ -947,12 +947,13 @@ static int clk_mt8365_top_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
goto unregister_fixed_clks;
|
||||
|
||||
ret = mtk_clk_register_muxes(top_muxes, ARRAY_SIZE(top_muxes), node,
|
||||
ret = mtk_clk_register_muxes(&pdev->dev, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), node,
|
||||
&mt8365_clk_lock, clk_data);
|
||||
if (ret)
|
||||
goto unregister_factors;
|
||||
|
||||
ret = mtk_clk_register_composites(top_misc_mux_gates,
|
||||
ret = mtk_clk_register_composites(&pdev->dev, top_misc_mux_gates,
|
||||
ARRAY_SIZE(top_misc_mux_gates), base,
|
||||
&mt8365_clk_lock, clk_data);
|
||||
if (ret)
|
||||
@@ -1019,8 +1020,8 @@ static int clk_mt8365_infra_probe(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = mtk_clk_register_gates(node, ifr_clks, ARRAY_SIZE(ifr_clks),
|
||||
clk_data);
|
||||
ret = mtk_clk_register_gates(&pdev->dev, node, ifr_clks,
|
||||
ARRAY_SIZE(ifr_clks), clk_data);
|
||||
if (ret)
|
||||
goto free_clk_data;
|
||||
|
||||
@@ -1080,8 +1081,9 @@ static int clk_mt8365_mcu_probe(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = mtk_clk_register_composites(mcu_muxes, ARRAY_SIZE(mcu_muxes),
|
||||
base, &mt8365_clk_lock, clk_data);
|
||||
ret = mtk_clk_register_composites(&pdev->dev, mcu_muxes,
|
||||
ARRAY_SIZE(mcu_muxes), base,
|
||||
&mt8365_clk_lock, clk_data);
|
||||
if (ret)
|
||||
goto free_clk_data;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ static void __init mtk_audsys_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_AUD_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, aud_clks, ARRAY_SIZE(aud_clks), clk_data);
|
||||
mtk_clk_register_gates(NULL, node, aud_clks, ARRAY_SIZE(aud_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
|
||||
@@ -655,11 +655,12 @@ static void __init mtk_topckgen_init(struct device_node *node)
|
||||
|
||||
mtk_clk_register_fixed_clks(fixed_clks, ARRAY_SIZE(fixed_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(node, top_clks, ARRAY_SIZE(top_clks), clk_data);
|
||||
mtk_clk_register_gates(NULL, node, top_clks, ARRAY_SIZE(top_clks), clk_data);
|
||||
|
||||
mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data);
|
||||
mtk_clk_register_composites(top_muxes, ARRAY_SIZE(top_muxes), base,
|
||||
&mt8516_clk_lock, clk_data);
|
||||
mtk_clk_register_composites(NULL, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), base,
|
||||
&mt8516_clk_lock, clk_data);
|
||||
mtk_clk_register_dividers(top_adj_divs, ARRAY_SIZE(top_adj_divs),
|
||||
base, &mt8516_clk_lock, clk_data);
|
||||
|
||||
@@ -684,8 +685,9 @@ static void __init mtk_infracfg_init(struct device_node *node)
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_IFR_NR_CLK);
|
||||
|
||||
mtk_clk_register_composites(ifr_muxes, ARRAY_SIZE(ifr_muxes), base,
|
||||
&mt8516_clk_lock, clk_data);
|
||||
mtk_clk_register_composites(NULL, ifr_muxes,
|
||||
ARRAY_SIZE(ifr_muxes), base,
|
||||
&mt8516_clk_lock, clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
|
||||
@@ -11,12 +11,15 @@
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-gate.h"
|
||||
#include "clk-mux.h"
|
||||
|
||||
static void mtk_init_clk_data(struct clk_hw_onecell_data *clk_data,
|
||||
unsigned int clk_num)
|
||||
@@ -197,8 +200,8 @@ void mtk_clk_unregister_factors(const struct mtk_fixed_factor *clks, int num,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mtk_clk_unregister_factors);
|
||||
|
||||
static struct clk_hw *mtk_clk_register_composite(const struct mtk_composite *mc,
|
||||
void __iomem *base, spinlock_t *lock)
|
||||
static struct clk_hw *mtk_clk_register_composite(struct device *dev,
|
||||
const struct mtk_composite *mc, void __iomem *base, spinlock_t *lock)
|
||||
{
|
||||
struct clk_hw *hw;
|
||||
struct clk_mux *mux = NULL;
|
||||
@@ -264,7 +267,7 @@ static struct clk_hw *mtk_clk_register_composite(const struct mtk_composite *mc,
|
||||
div_ops = &clk_divider_ops;
|
||||
}
|
||||
|
||||
hw = clk_hw_register_composite(NULL, mc->name, parent_names, num_parents,
|
||||
hw = clk_hw_register_composite(dev, mc->name, parent_names, num_parents,
|
||||
mux_hw, mux_ops,
|
||||
div_hw, div_ops,
|
||||
gate_hw, gate_ops,
|
||||
@@ -308,7 +311,8 @@ static void mtk_clk_unregister_composite(struct clk_hw *hw)
|
||||
kfree(mux);
|
||||
}
|
||||
|
||||
int mtk_clk_register_composites(const struct mtk_composite *mcs, int num,
|
||||
int mtk_clk_register_composites(struct device *dev,
|
||||
const struct mtk_composite *mcs, int num,
|
||||
void __iomem *base, spinlock_t *lock,
|
||||
struct clk_hw_onecell_data *clk_data)
|
||||
{
|
||||
@@ -327,7 +331,7 @@ int mtk_clk_register_composites(const struct mtk_composite *mcs, int num,
|
||||
continue;
|
||||
}
|
||||
|
||||
hw = mtk_clk_register_composite(mc, base, lock);
|
||||
hw = mtk_clk_register_composite(dev, mc, base, lock);
|
||||
|
||||
if (IS_ERR(hw)) {
|
||||
pr_err("Failed to register clk %s: %pe\n", mc->name,
|
||||
@@ -449,20 +453,81 @@ int mtk_clk_simple_probe(struct platform_device *pdev)
|
||||
const struct mtk_clk_desc *mcd;
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
int r;
|
||||
void __iomem *base;
|
||||
int num_clks, r;
|
||||
|
||||
mcd = of_device_get_match_data(&pdev->dev);
|
||||
if (!mcd)
|
||||
return -EINVAL;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(mcd->num_clks);
|
||||
/* Composite clocks needs us to pass iomem pointer */
|
||||
if (mcd->composite_clks) {
|
||||
if (!mcd->shared_io)
|
||||
base = devm_platform_ioremap_resource(pdev, 0);
|
||||
else
|
||||
base = of_iomap(node, 0);
|
||||
|
||||
if (IS_ERR_OR_NULL(base))
|
||||
return IS_ERR(base) ? PTR_ERR(base) : -ENOMEM;
|
||||
}
|
||||
|
||||
|
||||
devm_pm_runtime_enable(&pdev->dev);
|
||||
/*
|
||||
* Do a pm_runtime_resume_and_get() to workaround a possible
|
||||
* deadlock between clk_register() and the genpd framework.
|
||||
*/
|
||||
r = pm_runtime_resume_and_get(&pdev->dev);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
/* Calculate how many clk_hw_onecell_data entries to allocate */
|
||||
num_clks = mcd->num_clks + mcd->num_composite_clks;
|
||||
num_clks += mcd->num_fixed_clks + mcd->num_factor_clks;
|
||||
num_clks += mcd->num_mux_clks;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(num_clks);
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
r = mtk_clk_register_gates_with_dev(node, mcd->clks, mcd->num_clks,
|
||||
clk_data, &pdev->dev);
|
||||
if (r)
|
||||
goto free_data;
|
||||
if (mcd->fixed_clks) {
|
||||
r = mtk_clk_register_fixed_clks(mcd->fixed_clks,
|
||||
mcd->num_fixed_clks, clk_data);
|
||||
if (r)
|
||||
goto free_data;
|
||||
}
|
||||
|
||||
if (mcd->factor_clks) {
|
||||
r = mtk_clk_register_factors(mcd->factor_clks,
|
||||
mcd->num_factor_clks, clk_data);
|
||||
if (r)
|
||||
goto unregister_fixed_clks;
|
||||
}
|
||||
|
||||
if (mcd->mux_clks) {
|
||||
r = mtk_clk_register_muxes(&pdev->dev, mcd->mux_clks,
|
||||
mcd->num_mux_clks, node,
|
||||
mcd->clk_lock, clk_data);
|
||||
if (r)
|
||||
goto unregister_factors;
|
||||
};
|
||||
|
||||
if (mcd->composite_clks) {
|
||||
/* We don't check composite_lock because it's optional */
|
||||
r = mtk_clk_register_composites(&pdev->dev,
|
||||
mcd->composite_clks,
|
||||
mcd->num_composite_clks,
|
||||
base, mcd->clk_lock, clk_data);
|
||||
if (r)
|
||||
goto unregister_muxes;
|
||||
}
|
||||
|
||||
if (mcd->clks) {
|
||||
r = mtk_clk_register_gates(&pdev->dev, node, mcd->clks,
|
||||
mcd->num_clks, clk_data);
|
||||
if (r)
|
||||
goto unregister_composites;
|
||||
}
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
@@ -477,12 +542,35 @@ int mtk_clk_simple_probe(struct platform_device *pdev)
|
||||
goto unregister_clks;
|
||||
}
|
||||
|
||||
pm_runtime_put(&pdev->dev);
|
||||
|
||||
return r;
|
||||
|
||||
unregister_clks:
|
||||
mtk_clk_unregister_gates(mcd->clks, mcd->num_clks, clk_data);
|
||||
if (mcd->clks)
|
||||
mtk_clk_unregister_gates(mcd->clks, mcd->num_clks, clk_data);
|
||||
unregister_composites:
|
||||
if (mcd->composite_clks)
|
||||
mtk_clk_unregister_composites(mcd->composite_clks,
|
||||
mcd->num_composite_clks, clk_data);
|
||||
unregister_muxes:
|
||||
if (mcd->mux_clks)
|
||||
mtk_clk_unregister_muxes(mcd->mux_clks,
|
||||
mcd->num_mux_clks, clk_data);
|
||||
unregister_factors:
|
||||
if (mcd->factor_clks)
|
||||
mtk_clk_unregister_factors(mcd->factor_clks,
|
||||
mcd->num_factor_clks, clk_data);
|
||||
unregister_fixed_clks:
|
||||
if (mcd->fixed_clks)
|
||||
mtk_clk_unregister_fixed_clks(mcd->fixed_clks,
|
||||
mcd->num_fixed_clks, clk_data);
|
||||
free_data:
|
||||
mtk_free_clk_data(clk_data);
|
||||
if (mcd->shared_io && base)
|
||||
iounmap(base);
|
||||
|
||||
pm_runtime_put(&pdev->dev);
|
||||
return r;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mtk_clk_simple_probe);
|
||||
@@ -494,7 +582,20 @@ int mtk_clk_simple_remove(struct platform_device *pdev)
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
|
||||
of_clk_del_provider(node);
|
||||
mtk_clk_unregister_gates(mcd->clks, mcd->num_clks, clk_data);
|
||||
if (mcd->clks)
|
||||
mtk_clk_unregister_gates(mcd->clks, mcd->num_clks, clk_data);
|
||||
if (mcd->composite_clks)
|
||||
mtk_clk_unregister_composites(mcd->composite_clks,
|
||||
mcd->num_composite_clks, clk_data);
|
||||
if (mcd->mux_clks)
|
||||
mtk_clk_unregister_muxes(mcd->mux_clks,
|
||||
mcd->num_mux_clks, clk_data);
|
||||
if (mcd->factor_clks)
|
||||
mtk_clk_unregister_factors(mcd->factor_clks,
|
||||
mcd->num_factor_clks, clk_data);
|
||||
if (mcd->fixed_clks)
|
||||
mtk_clk_unregister_fixed_clks(mcd->fixed_clks,
|
||||
mcd->num_fixed_clks, clk_data);
|
||||
mtk_free_clk_data(clk_data);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -149,7 +149,8 @@ struct mtk_composite {
|
||||
.flags = 0, \
|
||||
}
|
||||
|
||||
int mtk_clk_register_composites(const struct mtk_composite *mcs, int num,
|
||||
int mtk_clk_register_composites(struct device *dev,
|
||||
const struct mtk_composite *mcs, int num,
|
||||
void __iomem *base, spinlock_t *lock,
|
||||
struct clk_hw_onecell_data *clk_data);
|
||||
void mtk_clk_unregister_composites(const struct mtk_composite *mcs, int num,
|
||||
@@ -195,7 +196,17 @@ void mtk_clk_unregister_ref2usb_tx(struct clk_hw *hw);
|
||||
struct mtk_clk_desc {
|
||||
const struct mtk_gate *clks;
|
||||
size_t num_clks;
|
||||
const struct mtk_composite *composite_clks;
|
||||
size_t num_composite_clks;
|
||||
const struct mtk_fixed_clk *fixed_clks;
|
||||
size_t num_fixed_clks;
|
||||
const struct mtk_fixed_factor *factor_clks;
|
||||
size_t num_factor_clks;
|
||||
const struct mtk_mux *mux_clks;
|
||||
size_t num_mux_clks;
|
||||
const struct mtk_clk_rst_desc *rst_desc;
|
||||
spinlock_t *clk_lock;
|
||||
bool shared_io;
|
||||
};
|
||||
|
||||
int mtk_clk_simple_probe(struct platform_device *pdev);
|
||||
|
||||
@@ -154,9 +154,10 @@ const struct clk_ops mtk_mux_gate_clr_set_upd_ops = {
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(mtk_mux_gate_clr_set_upd_ops);
|
||||
|
||||
static struct clk_hw *mtk_clk_register_mux(const struct mtk_mux *mux,
|
||||
struct regmap *regmap,
|
||||
spinlock_t *lock)
|
||||
static struct clk_hw *mtk_clk_register_mux(struct device *dev,
|
||||
const struct mtk_mux *mux,
|
||||
struct regmap *regmap,
|
||||
spinlock_t *lock)
|
||||
{
|
||||
struct mtk_clk_mux *clk_mux;
|
||||
struct clk_init_data init = {};
|
||||
@@ -177,7 +178,7 @@ static struct clk_hw *mtk_clk_register_mux(const struct mtk_mux *mux,
|
||||
clk_mux->lock = lock;
|
||||
clk_mux->hw.init = &init;
|
||||
|
||||
ret = clk_hw_register(NULL, &clk_mux->hw);
|
||||
ret = clk_hw_register(dev, &clk_mux->hw);
|
||||
if (ret) {
|
||||
kfree(clk_mux);
|
||||
return ERR_PTR(ret);
|
||||
@@ -198,7 +199,8 @@ static void mtk_clk_unregister_mux(struct clk_hw *hw)
|
||||
kfree(mux);
|
||||
}
|
||||
|
||||
int mtk_clk_register_muxes(const struct mtk_mux *muxes,
|
||||
int mtk_clk_register_muxes(struct device *dev,
|
||||
const struct mtk_mux *muxes,
|
||||
int num, struct device_node *node,
|
||||
spinlock_t *lock,
|
||||
struct clk_hw_onecell_data *clk_data)
|
||||
@@ -222,7 +224,7 @@ int mtk_clk_register_muxes(const struct mtk_mux *muxes,
|
||||
continue;
|
||||
}
|
||||
|
||||
hw = mtk_clk_register_mux(mux, regmap, lock);
|
||||
hw = mtk_clk_register_mux(dev, mux, regmap, lock);
|
||||
|
||||
if (IS_ERR(hw)) {
|
||||
pr_err("Failed to register clk %s: %pe\n", mux->name,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user