	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mlxsw_sp1_ptp_clock_init       ## -- Begin function mlxsw_sp1_ptp_clock_init
	.p2align	4, 0x90
_mlxsw_sp1_ptp_clock_init:              ## @mlxsw_sp1_ptp_clock_init
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %r12
	movl	$0, -36(%rbp)
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$48, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_4
## %bb.1:
	movq	%rax, %rbx
	leaq	44(%rax), %rdi
	callq	_spin_lock_init
	movq	_mlxsw_sp1_ptp_read_frc@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	leaq	16(%rbx), %r15
	movl	%eax, 28(%rbx)
	movq	_MLXSW_SP1_PTP_CLOCK_CYCLES_SHIFT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%esi, 24(%rbx)
	movq	_MLXSW_SP1_PTP_CLOCK_FREQ_KHZ@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_clocksource_khz2mult
	movl	%eax, 20(%rbx)
	movl	%eax, 40(%rbx)
	movq	_MLXSW_SP1_PTP_CLOCK_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_CLOCKSOURCE_MASK
	movl	%eax, 16(%rbx)
	movl	(%r12), %eax
	movl	%eax, 36(%rbx)
	leaq	32(%rbx), %r12
	xorl	%eax, %eax
	callq	_ktime_get_real
	movl	%eax, %edi
	callq	_ktime_to_ns
	movq	%r12, %rdi
	movq	%r15, %rsi
	movl	%eax, %edx
	callq	_timecounter_init
	movl	20(%rbx), %esi
	movabsq	$9223372036854775807, %rdi      ## imm = 0x7FFFFFFFFFFFFFFF
	callq	_div64_u64
	movl	%eax, %r12d
	movl	16(%rbx), %edi
	movl	$3, %esi
	callq	_div_u64
	movl	%r12d, %edi
	movl	%eax, %esi
	callq	_min
	leaq	-36(%rbp), %rcx
	movq	%r15, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	_cyclecounter_cyc2ns
	movl	%eax, %edi
	callq	_nsecs_to_jiffies
	movl	%eax, 12(%rbx)
	movq	_mlxsw_sp1_ptp_clock_overflow@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_INIT_DELAYED_WORK
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_mlxsw_core_schedule_dw
	movq	_mlxsw_sp1_ptp_clock_info@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	%rbx, %rdi
	addq	$8, %rdi
	movl	%eax, 8(%rbx)
	movq	%r14, %rsi
	callq	_ptp_clock_register
	movl	%eax, 4(%rbx)
	movl	%eax, %edi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movl	4(%rbx), %edi
	callq	_PTR_ERR
	movl	%eax, %r15d
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	callq	_dev_err
	movq	%rbx, %rdi
	callq	_cancel_delayed_work_sync
	movq	%rbx, %rdi
	callq	_kfree
	movl	%r15d, %edi
	callq	_ERR_PTR
	movq	%rax, %rbx
LBB0_3:
	movq	%rbx, %rax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	subl	(%rax), %edi
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_PTR                        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_mlxsw_sp1_ptp_read_frc,4,2     ## @mlxsw_sp1_ptp_read_frc
	.comm	_MLXSW_SP1_PTP_CLOCK_CYCLES_SHIFT,4,2 ## @MLXSW_SP1_PTP_CLOCK_CYCLES_SHIFT
	.comm	_MLXSW_SP1_PTP_CLOCK_FREQ_KHZ,4,2 ## @MLXSW_SP1_PTP_CLOCK_FREQ_KHZ
	.comm	_MLXSW_SP1_PTP_CLOCK_MASK,4,2   ## @MLXSW_SP1_PTP_CLOCK_MASK
	.comm	_mlxsw_sp1_ptp_clock_overflow,4,2 ## @mlxsw_sp1_ptp_clock_overflow
	.comm	_mlxsw_sp1_ptp_clock_info,4,2   ## @mlxsw_sp1_ptp_clock_info
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ptp_clock_register failed %d\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mlxsw_sp1_ptp_clock_init       ; -- Begin function mlxsw_sp1_ptp_clock_init
	.p2align	2
_mlxsw_sp1_ptp_clock_init:              ; @mlxsw_sp1_ptp_clock_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x20, x1
	mov	x21, x0
	str	wzr, [sp, #12]
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #48
	bl	_kzalloc
	cbz	x0, LBB0_4
; %bb.1:
	mov	x19, x0
	add	x0, x0, #44
	bl	_spin_lock_init
Lloh3:
	adrp	x8, _mlxsw_sp1_ptp_read_frc@GOTPAGE
Lloh4:
	ldr	x8, [x8, _mlxsw_sp1_ptp_read_frc@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _MLXSW_SP1_PTP_CLOCK_CYCLES_SHIFT@GOTPAGE
Lloh7:
	ldr	x9, [x9, _MLXSW_SP1_PTP_CLOCK_CYCLES_SHIFT@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x9]
	stp	w1, w8, [x19, #24]
Lloh9:
	adrp	x8, _MLXSW_SP1_PTP_CLOCK_FREQ_KHZ@GOTPAGE
Lloh10:
	ldr	x8, [x8, _MLXSW_SP1_PTP_CLOCK_FREQ_KHZ@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
	bl	_clocksource_khz2mult
	str	w0, [x19, #20]
	str	w0, [x19, #40]
Lloh12:
	adrp	x8, _MLXSW_SP1_PTP_CLOCK_MASK@GOTPAGE
Lloh13:
	ldr	x8, [x8, _MLXSW_SP1_PTP_CLOCK_MASK@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
	bl	_CLOCKSOURCE_MASK
	mov	x22, x19
	str	w0, [x22, #16]!
	ldr	w8, [x21]
	str	w8, [x19, #36]
	add	x21, x19, #32
	bl	_ktime_get_real
	bl	_ktime_to_ns
	mov	x2, x0
	mov	x0, x21
	mov	x1, x22
	bl	_timecounter_init
	ldr	w1, [x19, #20]
	mov	x0, #9223372036854775807
	bl	_div64_u64
	mov	x21, x0
	ldr	w0, [x22]
	mov	w1, #3
	bl	_div_u64
	mov	x1, x0
	mov	x0, x21
	bl	_min
	mov	x1, x0
	add	x3, sp, #12
	mov	x0, x22
	mov	w2, #0
	bl	_cyclecounter_cyc2ns
	bl	_nsecs_to_jiffies
	str	w0, [x19, #12]
Lloh15:
	adrp	x8, _mlxsw_sp1_ptp_clock_overflow@GOTPAGE
Lloh16:
	ldr	x8, [x8, _mlxsw_sp1_ptp_clock_overflow@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_INIT_DELAYED_WORK
	mov	x0, x19
	mov	w1, #0
	bl	_mlxsw_core_schedule_dw
Lloh18:
	adrp	x8, _mlxsw_sp1_ptp_clock_info@GOTPAGE
Lloh19:
	ldr	x8, [x8, _mlxsw_sp1_ptp_clock_info@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	mov	x21, x19
	str	w8, [x21, #8]!
	mov	x0, x21
	mov	x1, x20
	bl	_ptp_clock_register
	stur	w0, [x21, #-4]
	bl	_IS_ERR
	cbz	x0, LBB0_3
; %bb.2:
	ldr	w0, [x19, #4]
	bl	_PTR_ERR
	mov	x21, x0
Lloh21:
	adrp	x1, l_.str@PAGE
Lloh22:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	mov	x2, x21
	bl	_dev_err
	mov	x0, x19
	bl	_cancel_delayed_work_sync
	mov	x0, x19
	bl	_kfree
	mov	x0, x21
	bl	_ERR_PTR
	mov	x19, x0
LBB0_3:
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_4:
Lloh23:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh24:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	neg	w0, w8
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	b	_ERR_PTR
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_mlxsw_sp1_ptp_read_frc,4,2     ; @mlxsw_sp1_ptp_read_frc
	.comm	_MLXSW_SP1_PTP_CLOCK_CYCLES_SHIFT,4,2 ; @MLXSW_SP1_PTP_CLOCK_CYCLES_SHIFT
	.comm	_MLXSW_SP1_PTP_CLOCK_FREQ_KHZ,4,2 ; @MLXSW_SP1_PTP_CLOCK_FREQ_KHZ
	.comm	_MLXSW_SP1_PTP_CLOCK_MASK,4,2   ; @MLXSW_SP1_PTP_CLOCK_MASK
	.comm	_mlxsw_sp1_ptp_clock_overflow,4,2 ; @mlxsw_sp1_ptp_clock_overflow
	.comm	_mlxsw_sp1_ptp_clock_info,4,2   ; @mlxsw_sp1_ptp_clock_info
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ptp_clock_register failed %d\n"

.subsections_via_symbols
