	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_gmac0_rgmii_adjust
_mtk_gmac0_rgmii_adjust:                ## @mtk_gmac0_rgmii_adjust
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %rbx
	movq	_SPEED_1000@GOTPCREL(%rip), %r15
	cmpl	%esi, (%r15)
	jne	LBB0_1
## %bb.2:
	movq	_INTF_MODE_RGMII_1000@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	movq	_INTF_MODE_RGMII_10_100@GOTPCREL(%rip), %rax
LBB0_3:
	movl	(%rax), %esi
	movq	_INTF_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_mtk_w32
	movl	16(%rbx), %edi
	movq	_ETHSYS_CLKCFG0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ETHSYS_TRGMII_CLK_SEL362_5@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%ecx, %edx
	callq	_regmap_update_bits
	cmpl	%r14d, (%r15)
	movl	$250000000, %eax                ## imm = 0xEE6B280
	movl	$500000000, %esi                ## imm = 0x1DCD6500
	cmovel	%eax, %esi
	movq	8(%rbx), %rax
	movq	_MTK_CLK_TRGPLL@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rax,%rcx,4), %edi
	callq	_clk_set_rate
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movl	(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	callq	_dev_err
LBB0_5:
	cmpl	%r14d, (%r15)
	jne	LBB0_6
## %bb.7:
	movq	_RCK_CTRL_RGMII_1000@GOTPCREL(%rip), %rax
	jmp	LBB0_8
LBB0_6:
	movq	_RCK_CTRL_RGMII_10_100@GOTPCREL(%rip), %rax
LBB0_8:
	movl	(%rax), %esi
	movq	_TRGMII_RCK_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_mtk_w32
	cmpl	%r14d, (%r15)
	jne	LBB0_9
## %bb.10:
	movq	_TCK_CTRL_RGMII_1000@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_9:
	movq	_TCK_CTRL_RGMII_10_100@GOTPCREL(%rip), %rax
LBB0_11:
	movl	(%rax), %esi
	movq	_TRGMII_TCK_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mtk_w32                        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_SPEED_1000,4,2                 ## @SPEED_1000
	.comm	_INTF_MODE_RGMII_1000,4,2       ## @INTF_MODE_RGMII_1000
	.comm	_INTF_MODE_RGMII_10_100,4,2     ## @INTF_MODE_RGMII_10_100
	.comm	_INTF_MODE,4,2                  ## @INTF_MODE
	.comm	_ETHSYS_CLKCFG0,4,2             ## @ETHSYS_CLKCFG0
	.comm	_ETHSYS_TRGMII_CLK_SEL362_5,4,2 ## @ETHSYS_TRGMII_CLK_SEL362_5
	.comm	_MTK_CLK_TRGPLL,8,3             ## @MTK_CLK_TRGPLL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to set trgmii pll: %d\n"

	.comm	_RCK_CTRL_RGMII_1000,4,2        ## @RCK_CTRL_RGMII_1000
	.comm	_RCK_CTRL_RGMII_10_100,4,2      ## @RCK_CTRL_RGMII_10_100
	.comm	_TRGMII_RCK_CTRL,4,2            ## @TRGMII_RCK_CTRL
	.comm	_TCK_CTRL_RGMII_1000,4,2        ## @TCK_CTRL_RGMII_1000
	.comm	_TCK_CTRL_RGMII_10_100,4,2      ## @TCK_CTRL_RGMII_10_100
	.comm	_TRGMII_TCK_CTRL,4,2            ## @TRGMII_TCK_CTRL
	.no_dead_strip	_mtk_gmac0_rgmii_adjust
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_gmac0_rgmii_adjust
_mtk_gmac0_rgmii_adjust:                ; @mtk_gmac0_rgmii_adjust
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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	x19, x0
Lloh0:
	adrp	x21, _SPEED_1000@GOTPAGE
Lloh1:
	ldr	x21, [x21, _SPEED_1000@GOTPAGEOFF]
	ldr	w8, [x21]
Lloh2:
	adrp	x9, _INTF_MODE_RGMII_1000@GOTPAGE
Lloh3:
	ldr	x9, [x9, _INTF_MODE_RGMII_1000@GOTPAGEOFF]
Lloh4:
	adrp	x10, _INTF_MODE_RGMII_10_100@GOTPAGE
Lloh5:
	ldr	x10, [x10, _INTF_MODE_RGMII_10_100@GOTPAGEOFF]
	cmp	w8, w1
	csel	x8, x9, x10, eq
	ldr	w1, [x8]
Lloh6:
	adrp	x8, _INTF_MODE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _INTF_MODE@GOTPAGEOFF]
Lloh8:
	ldr	w2, [x8]
	bl	_mtk_w32
	ldr	w0, [x19, #16]
Lloh9:
	adrp	x8, _ETHSYS_CLKCFG0@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ETHSYS_CLKCFG0@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
Lloh12:
	adrp	x8, _ETHSYS_TRGMII_CLK_SEL362_5@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ETHSYS_TRGMII_CLK_SEL362_5@GOTPAGEOFF]
Lloh14:
	ldr	w2, [x8]
	mov	x3, x2
	bl	_regmap_update_bits
	ldr	w8, [x21]
	mov	w9, #25856
	movk	w9, #7629, lsl #16
	mov	w10, #45696
	movk	w10, #3814, lsl #16
	cmp	w8, w20
	csel	w1, w10, w9, eq
	ldr	x8, [x19, #8]
Lloh15:
	adrp	x9, _MTK_CLK_TRGPLL@GOTPAGE
Lloh16:
	ldr	x9, [x9, _MTK_CLK_TRGPLL@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	ldr	w0, [x8, x9, lsl #2]
	bl	_clk_set_rate
	cbz	w0, LBB0_2
; %bb.1:
	mov	x2, x0
	ldr	w0, [x19]
Lloh18:
	adrp	x1, l_.str@PAGE
Lloh19:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
LBB0_2:
	ldr	w8, [x21]
Lloh20:
	adrp	x9, _RCK_CTRL_RGMII_1000@GOTPAGE
Lloh21:
	ldr	x9, [x9, _RCK_CTRL_RGMII_1000@GOTPAGEOFF]
Lloh22:
	adrp	x10, _RCK_CTRL_RGMII_10_100@GOTPAGE
Lloh23:
	ldr	x10, [x10, _RCK_CTRL_RGMII_10_100@GOTPAGEOFF]
	cmp	w8, w20
	csel	x8, x9, x10, eq
	ldr	w1, [x8]
Lloh24:
	adrp	x8, _TRGMII_RCK_CTRL@GOTPAGE
Lloh25:
	ldr	x8, [x8, _TRGMII_RCK_CTRL@GOTPAGEOFF]
Lloh26:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_mtk_w32
Lloh27:
	adrp	x8, _TCK_CTRL_RGMII_1000@GOTPAGE
Lloh28:
	ldr	x8, [x8, _TCK_CTRL_RGMII_1000@GOTPAGEOFF]
	ldr	w9, [x21]
Lloh29:
	adrp	x10, _TCK_CTRL_RGMII_10_100@GOTPAGE
Lloh30:
	ldr	x10, [x10, _TCK_CTRL_RGMII_10_100@GOTPAGEOFF]
	cmp	w9, w20
	csel	x8, x8, x10, eq
	ldr	w1, [x8]
Lloh31:
	adrp	x8, _TRGMII_TCK_CTRL@GOTPAGE
Lloh32:
	ldr	x8, [x8, _TRGMII_TCK_CTRL@GOTPAGEOFF]
Lloh33:
	ldr	w2, [x8]
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_mtk_w32
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_SPEED_1000,4,2                 ; @SPEED_1000
	.comm	_INTF_MODE_RGMII_1000,4,2       ; @INTF_MODE_RGMII_1000
	.comm	_INTF_MODE_RGMII_10_100,4,2     ; @INTF_MODE_RGMII_10_100
	.comm	_INTF_MODE,4,2                  ; @INTF_MODE
	.comm	_ETHSYS_CLKCFG0,4,2             ; @ETHSYS_CLKCFG0
	.comm	_ETHSYS_TRGMII_CLK_SEL362_5,4,2 ; @ETHSYS_TRGMII_CLK_SEL362_5
	.comm	_MTK_CLK_TRGPLL,8,3             ; @MTK_CLK_TRGPLL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to set trgmii pll: %d\n"

	.comm	_RCK_CTRL_RGMII_1000,4,2        ; @RCK_CTRL_RGMII_1000
	.comm	_RCK_CTRL_RGMII_10_100,4,2      ; @RCK_CTRL_RGMII_10_100
	.comm	_TRGMII_RCK_CTRL,4,2            ; @TRGMII_RCK_CTRL
	.comm	_TCK_CTRL_RGMII_1000,4,2        ; @TCK_CTRL_RGMII_1000
	.comm	_TCK_CTRL_RGMII_10_100,4,2      ; @TCK_CTRL_RGMII_10_100
	.comm	_TRGMII_TCK_CTRL,4,2            ; @TRGMII_TCK_CTRL
	.no_dead_strip	_mtk_gmac0_rgmii_adjust
.subsections_via_symbols
