	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt7531_set_port_sgmii_force_mode
_mt7531_set_port_sgmii_force_mode:      ## @mt7531_set_port_sgmii_force_mode
	.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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %ecx
	movq	%rdi, %r13
	cmpl	$5, %esi
	jl	LBB0_2
## %bb.1:
	movq	_MT753X_NUM_PORTS@GOTPCREL(%rip), %rax
	cmpl	%ecx, (%rax)
	jle	LBB0_2
## %bb.3:
	movq	%rdx, %r15
	leal	-5(%rcx), %r14d
	movl	(%rdx), %edx
	movq	_RG_TPHY_SPEED_1000@GOTPCREL(%rip), %rbx
	cmpl	$129, %edx
	je	LBB0_7
## %bb.4:
	cmpl	$128, %edx
	jne	LBB0_6
## %bb.5:
	movq	_RG_TPHY_SPEED_2500@GOTPCREL(%rip), %rbx
	jmp	LBB0_7
LBB0_2:
	movl	(%r13), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%r15d, %r15d
	movl	%ecx, %edx
	xorl	%eax, %eax
	callq	_dev_info
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_6:
	movl	(%r13), %edi
	leaq	L_.str.1(%rip), %rsi
                                        ## kill: def $ecx killed $ecx killed $rcx
	xorl	%eax, %eax
	callq	_dev_info
LBB0_7:
	movl	(%rbx), %r12d
	movl	%r14d, %edi
	callq	_PHYA_CTRL_SIGNAL3
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_mt753x_reg_read
	movq	_RG_TPHY_SPEED_M@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	notl	%edx
	andl	%eax, %edx
	movq	_RG_TPHY_SPEED_S@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %r12d
	orl	%edx, %r12d
	movl	%r14d, %edi
	callq	_PHYA_CTRL_SIGNAL3
	movq	%r13, %rdi
	movl	%eax, %esi
	movl	%r12d, %edx
	callq	_mt753x_reg_write
	movl	%r14d, %edi
	callq	_PCS_CONTROL_1
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_mt753x_reg_read
	movq	_SGMII_AN_ENABLE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
	notl	%ebx
	andl	%eax, %ebx
	movl	%r14d, %edi
	callq	_PCS_CONTROL_1
	movq	%r13, %rdi
	movl	%eax, %esi
	movl	%ebx, %edx
	callq	_mt753x_reg_write
	movl	%r14d, %edi
	callq	_SGMII_MODE
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_mt753x_reg_read
	movq	_SGMII_IF_MODE_ADVERT_AN@GOTPCREL(%rip), %rcx
	movq	_SGMII_IF_MODE_FORCE_SPEED_M@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	movq	_SGMII_IF_MODE_FORCE_SPEED_S@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movq	_SGMII_IF_MODE_FORCE_SPEED_1000@GOTPCREL(%rip), %rsi
	movl	(%rsi), %esi
	shll	%cl, %esi
	notl	%edx
	andl	%eax, %edx
	orl	%edx, %esi
	movq	_SGMII_IF_MODE_FORCE_DUPLEX@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movl	%esi, %eax
	orl	%ebx, %eax
	notl	%ebx
	andl	%esi, %ebx
	cmpq	$0, 8(%r15)
	cmovel	%eax, %ebx
	movl	%r14d, %edi
	callq	_SGMII_MODE
	movq	%r13, %rdi
	movl	%eax, %esi
	movl	%ebx, %edx
	callq	_mt753x_reg_write
	movl	%r14d, %edi
	callq	_QPHY_PWR_STATE_CTRL
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_mt753x_reg_read
	movq	_PHYA_PWD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
	notl	%ebx
	andl	%eax, %ebx
	movl	%r14d, %edi
	callq	_QPHY_PWR_STATE_CTRL
	movq	%r13, %rdi
	movl	%eax, %esi
	movl	%ebx, %edx
	callq	_mt753x_reg_write
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	callq	_ktime_get
	movl	%eax, %edi
	movl	$2000000, %esi                  ## imm = 0x1E8480
	callq	_ktime_add_us
	movl	%eax, %ebx
	movq	_SGMII_LINK_STATUS@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movl	%r14d, %edi
	callq	_PCS_CONTROL_1
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_mt753x_reg_read
	testl	%eax, (%r12)
	jne	LBB0_12
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	xorl	%eax, %eax
	callq	_ktime_get
	movl	%eax, %edi
	movl	%ebx, %esi
	callq	_ktime_compare
	testq	%rax, %rax
	jle	LBB0_8
## %bb.10:
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
LBB0_11:
	subl	(%rax), %r15d
LBB0_12:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MT753X_NUM_PORTS,4,2           ## @MT753X_NUM_PORTS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"port %d is not a SGMII port\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_RG_TPHY_SPEED_1000,4,2         ## @RG_TPHY_SPEED_1000
	.comm	_RG_TPHY_SPEED_2500,4,2         ## @RG_TPHY_SPEED_2500
L_.str.1:                               ## @.str.1
	.asciz	"invalid SGMII speed idx %d for port %d\n"

	.comm	_RG_TPHY_SPEED_M,4,2            ## @RG_TPHY_SPEED_M
	.comm	_RG_TPHY_SPEED_S,4,2            ## @RG_TPHY_SPEED_S
	.comm	_SGMII_AN_ENABLE,4,2            ## @SGMII_AN_ENABLE
	.comm	_SGMII_IF_MODE_ADVERT_AN,4,2    ## @SGMII_IF_MODE_ADVERT_AN
	.comm	_SGMII_IF_MODE_FORCE_SPEED_M,4,2 ## @SGMII_IF_MODE_FORCE_SPEED_M
	.comm	_SGMII_IF_MODE_FORCE_SPEED_1000,4,2 ## @SGMII_IF_MODE_FORCE_SPEED_1000
	.comm	_SGMII_IF_MODE_FORCE_SPEED_S,4,2 ## @SGMII_IF_MODE_FORCE_SPEED_S
	.comm	_SGMII_IF_MODE_FORCE_DUPLEX,4,2 ## @SGMII_IF_MODE_FORCE_DUPLEX
	.comm	_PHYA_PWD,4,2                   ## @PHYA_PWD
	.comm	_SGMII_LINK_STATUS,4,2          ## @SGMII_LINK_STATUS
	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.no_dead_strip	_mt7531_set_port_sgmii_force_mode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt7531_set_port_sgmii_force_mode
_mt7531_set_port_sgmii_force_mode:      ; @mt7531_set_port_sgmii_force_mode
	.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	x8, x1
	mov	x19, x0
	subs	w20, w1, #5
	b.lt	LBB0_5
; %bb.1:
Lloh0:
	adrp	x9, _MT753X_NUM_PORTS@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MT753X_NUM_PORTS@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	cmp	w9, w8
	b.le	LBB0_5
; %bb.2:
	mov	x21, x2
	ldr	w2, [x2]
	cmp	w2, #129
	b.eq	LBB0_7
; %bb.3:
	cmp	w2, #128
	b.ne	LBB0_6
; %bb.4:
Lloh3:
	adrp	x8, _RG_TPHY_SPEED_2500@GOTPAGE
Lloh4:
	ldr	x8, [x8, _RG_TPHY_SPEED_2500@GOTPAGEOFF]
	b	LBB0_8
LBB0_5:
	ldr	w0, [x19]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x8
	bl	_dev_info
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_12
LBB0_6:
	ldr	w0, [x19]
	str	x8, [sp]
Lloh9:
	adrp	x1, l_.str.1@PAGE
Lloh10:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_info
LBB0_7:
Lloh11:
	adrp	x8, _RG_TPHY_SPEED_1000@GOTPAGE
Lloh12:
	ldr	x8, [x8, _RG_TPHY_SPEED_1000@GOTPAGEOFF]
LBB0_8:
	ldr	w22, [x8]
	mov	x0, x20
	bl	_PHYA_CTRL_SIGNAL3
	mov	x1, x0
	mov	x0, x19
	bl	_mt753x_reg_read
Lloh13:
	adrp	x8, _RG_TPHY_SPEED_M@GOTPAGE
Lloh14:
	ldr	x8, [x8, _RG_TPHY_SPEED_M@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	bic	w8, w0, w8
Lloh16:
	adrp	x9, _RG_TPHY_SPEED_S@GOTPAGE
Lloh17:
	ldr	x9, [x9, _RG_TPHY_SPEED_S@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	lsl	w9, w22, w9
	orr	w22, w9, w8
	mov	x0, x20
	bl	_PHYA_CTRL_SIGNAL3
	mov	x1, x0
	mov	x0, x19
	mov	x2, x22
	bl	_mt753x_reg_write
	mov	x0, x20
	bl	_PCS_CONTROL_1
	mov	x1, x0
	mov	x0, x19
	bl	_mt753x_reg_read
Lloh19:
	adrp	x8, _SGMII_AN_ENABLE@GOTPAGE
Lloh20:
	ldr	x8, [x8, _SGMII_AN_ENABLE@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	bic	w22, w0, w8
	mov	x0, x20
	bl	_PCS_CONTROL_1
	mov	x1, x0
	mov	x0, x19
	mov	x2, x22
	bl	_mt753x_reg_write
	mov	x0, x20
	bl	_SGMII_MODE
	mov	x1, x0
	mov	x0, x19
	bl	_mt753x_reg_read
Lloh22:
	adrp	x8, _SGMII_IF_MODE_ADVERT_AN@GOTPAGE
Lloh23:
	ldr	x8, [x8, _SGMII_IF_MODE_ADVERT_AN@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
Lloh25:
	adrp	x9, _SGMII_IF_MODE_FORCE_SPEED_M@GOTPAGE
Lloh26:
	ldr	x9, [x9, _SGMII_IF_MODE_FORCE_SPEED_M@GOTPAGEOFF]
Lloh27:
	ldr	w9, [x9]
	orr	w8, w9, w8
	bic	w8, w0, w8
Lloh28:
	adrp	x9, _SGMII_IF_MODE_FORCE_SPEED_1000@GOTPAGE
Lloh29:
	ldr	x9, [x9, _SGMII_IF_MODE_FORCE_SPEED_1000@GOTPAGEOFF]
Lloh30:
	adrp	x10, _SGMII_IF_MODE_FORCE_SPEED_S@GOTPAGE
Lloh31:
	ldr	x10, [x10, _SGMII_IF_MODE_FORCE_SPEED_S@GOTPAGEOFF]
Lloh32:
	ldr	w9, [x9]
Lloh33:
	ldr	w10, [x10]
	lsl	w9, w9, w10
	orr	w8, w9, w8
Lloh34:
	adrp	x9, _SGMII_IF_MODE_FORCE_DUPLEX@GOTPAGE
Lloh35:
	ldr	x9, [x9, _SGMII_IF_MODE_FORCE_DUPLEX@GOTPAGEOFF]
Lloh36:
	ldr	w9, [x9]
	orr	w10, w8, w9
	ldr	x11, [x21, #8]
	bic	w8, w8, w9
	cmp	x11, #0
	csel	w21, w10, w8, eq
	mov	x0, x20
	bl	_SGMII_MODE
	mov	x1, x0
	mov	x0, x19
	mov	x2, x21
	bl	_mt753x_reg_write
	mov	x0, x20
	bl	_QPHY_PWR_STATE_CTRL
	mov	x1, x0
	mov	x0, x19
	bl	_mt753x_reg_read
Lloh37:
	adrp	x8, _PHYA_PWD@GOTPAGE
Lloh38:
	ldr	x8, [x8, _PHYA_PWD@GOTPAGEOFF]
Lloh39:
	ldr	w8, [x8]
	bic	w21, w0, w8
	mov	x0, x20
	bl	_QPHY_PWR_STATE_CTRL
	mov	x1, x0
	mov	x0, x19
	mov	x2, x21
	bl	_mt753x_reg_write
	bl	_ktime_get
	mov	w1, #33920
	movk	w1, #30, lsl #16
	bl	_ktime_add_us
	mov	x21, x0
Lloh40:
	adrp	x22, _SGMII_LINK_STATUS@GOTPAGE
Lloh41:
	ldr	x22, [x22, _SGMII_LINK_STATUS@GOTPAGEOFF]
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_PCS_CONTROL_1
	mov	x1, x0
	mov	x0, x19
	bl	_mt753x_reg_read
	ldr	w8, [x22]
	tst	w8, w0
	b.ne	LBB0_13
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	bl	_ktime_get
	mov	x1, x21
	bl	_ktime_compare
	cmp	x0, #1
	b.lt	LBB0_9
; %bb.11:
Lloh42:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh43:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
LBB0_12:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_14
LBB0_13:
	mov	w0, #0
LBB0_14:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh32
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh42, Lloh43
	.cfi_endproc
                                        ; -- End function
	.comm	_MT753X_NUM_PORTS,4,2           ; @MT753X_NUM_PORTS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"port %d is not a SGMII port\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_RG_TPHY_SPEED_1000,4,2         ; @RG_TPHY_SPEED_1000
	.comm	_RG_TPHY_SPEED_2500,4,2         ; @RG_TPHY_SPEED_2500
l_.str.1:                               ; @.str.1
	.asciz	"invalid SGMII speed idx %d for port %d\n"

	.comm	_RG_TPHY_SPEED_M,4,2            ; @RG_TPHY_SPEED_M
	.comm	_RG_TPHY_SPEED_S,4,2            ; @RG_TPHY_SPEED_S
	.comm	_SGMII_AN_ENABLE,4,2            ; @SGMII_AN_ENABLE
	.comm	_SGMII_IF_MODE_ADVERT_AN,4,2    ; @SGMII_IF_MODE_ADVERT_AN
	.comm	_SGMII_IF_MODE_FORCE_SPEED_M,4,2 ; @SGMII_IF_MODE_FORCE_SPEED_M
	.comm	_SGMII_IF_MODE_FORCE_SPEED_1000,4,2 ; @SGMII_IF_MODE_FORCE_SPEED_1000
	.comm	_SGMII_IF_MODE_FORCE_SPEED_S,4,2 ; @SGMII_IF_MODE_FORCE_SPEED_S
	.comm	_SGMII_IF_MODE_FORCE_DUPLEX,4,2 ; @SGMII_IF_MODE_FORCE_DUPLEX
	.comm	_PHYA_PWD,4,2                   ; @PHYA_PWD
	.comm	_SGMII_LINK_STATUS,4,2          ; @SGMII_LINK_STATUS
	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.no_dead_strip	_mt7531_set_port_sgmii_force_mode
.subsections_via_symbols
