	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt7531_mac_port_setup
_mt7531_mac_port_setup:                 ## @mt7531_mac_port_setup
	.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, %r15d
	movq	%rdi, %r14
	cmpl	$5, %esi
	jl	LBB0_2
## %bb.1:
	movq	_MT753X_NUM_PORTS@GOTPCREL(%rip), %rax
	cmpl	%r15d, (%rax)
	jle	LBB0_2
## %bb.3:
	movq	8(%rdx), %rax
	testq	%rax, %rax
	je	LBB0_9
## %bb.4:
	movq	_IPG_96BIT_WITH_SHORT_IPG@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
	movq	_IPG_CFG_S@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %ebx
	movq	_MAC_MODE@GOTPCREL(%rip), %rcx
	orl	(%rcx), %ebx
	movq	_MAC_TX_EN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %ebx
	movq	_MAC_RX_EN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %ebx
	movq	_BKOFF_EN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %ebx
	movq	_BACKPR_EN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %ebx
	cmpq	$0, 16(%rdx)
	je	LBB0_10
## %bb.5:
	movslq	(%rdx), %rsi
	movq	_MAC_SPD_2500@GOTPCREL(%rip), %rcx
	cmpq	%rsi, (%rcx)
	jne	LBB0_7
## %bb.6:
	movq	_MAC_SPD_1000@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
LBB0_7:
	movq	_FORCE_MODE_LNK@GOTPCREL(%rip), %rdi
	movq	_FORCE_LINK@GOTPCREL(%rip), %r8
	movq	_FORCE_MODE_SPD@GOTPCREL(%rip), %r9
	movq	_FORCE_MODE_DPX@GOTPCREL(%rip), %r10
	movq	_FORCE_MODE_RX_FC@GOTPCREL(%rip), %r11
	movq	_FORCE_MODE_TX_FC@GOTPCREL(%rip), %r12
	movq	_FORCE_RX_FC@GOTPCREL(%rip), %r13
	movq	_FORCE_SPD_S@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %esi
	orl	(%rdi), %ebx
	orl	(%r8), %ebx
	orl	(%r9), %ebx
	orl	(%r10), %ebx
	orl	(%r11), %ebx
	orl	(%r12), %ebx
	orl	(%r13), %ebx
	movq	_FORCE_TX_FC@GOTPCREL(%rip), %rcx
	orl	(%rcx), %ebx
	orl	%esi, %ebx
	cmpq	$0, 24(%rdx)
	je	LBB0_10
## %bb.8:
	movq	_FORCE_DPX@GOTPCREL(%rip), %rcx
	orl	(%rcx), %ebx
	jmp	LBB0_10
LBB0_2:
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_dev_info
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_20
LBB0_9:
	movq	_FORCE_MODE_LNK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
LBB0_10:
	movl	4(%rdx), %edi
	cmpl	$128, %edi
	je	LBB0_13
## %bb.11:
	cmpl	$129, %edi
	jne	LBB0_16
## %bb.12:
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_mt7531_set_port_rgmii
	jmp	LBB0_19
LBB0_13:
	cmpq	$0, 16(%rdx)
	je	LBB0_15
## %bb.14:
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_mt7531_set_port_sgmii_force_mode
	jmp	LBB0_19
LBB0_16:
	testq	%rax, %rax
	je	LBB0_18
## %bb.17:
	movl	(%r14), %ebx
	callq	_phy_modes
	leaq	L_.str.1(%rip), %rsi
	movl	%ebx, %edi
	movl	%eax, %edx
	movl	%r15d, %ecx
	xorl	%eax, %eax
	callq	_dev_info
LBB0_18:
	movq	_FORCE_MODE_LNK@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_19
LBB0_15:
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_mt7531_set_port_sgmii_an_mode
LBB0_19:
	movl	%r15d, %edi
	callq	_PMCR
	movq	%r14, %rdi
	movl	%eax, %esi
	movl	%ebx, %edx
	callq	_mt753x_reg_write
	xorl	%ebx, %ebx
LBB0_20:
	movl	%ebx, %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 MAC port\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_IPG_96BIT_WITH_SHORT_IPG,4,2   ## @IPG_96BIT_WITH_SHORT_IPG
	.comm	_IPG_CFG_S,4,2                  ## @IPG_CFG_S
	.comm	_MAC_MODE,4,2                   ## @MAC_MODE
	.comm	_MAC_TX_EN,4,2                  ## @MAC_TX_EN
	.comm	_MAC_RX_EN,4,2                  ## @MAC_RX_EN
	.comm	_BKOFF_EN,4,2                   ## @BKOFF_EN
	.comm	_BACKPR_EN,4,2                  ## @BACKPR_EN
	.comm	_MAC_SPD_2500,8,3               ## @MAC_SPD_2500
	.comm	_MAC_SPD_1000,4,2               ## @MAC_SPD_1000
	.comm	_FORCE_MODE_LNK,4,2             ## @FORCE_MODE_LNK
	.comm	_FORCE_LINK,4,2                 ## @FORCE_LINK
	.comm	_FORCE_MODE_SPD,4,2             ## @FORCE_MODE_SPD
	.comm	_FORCE_MODE_DPX,4,2             ## @FORCE_MODE_DPX
	.comm	_FORCE_MODE_RX_FC,4,2           ## @FORCE_MODE_RX_FC
	.comm	_FORCE_MODE_TX_FC,4,2           ## @FORCE_MODE_TX_FC
	.comm	_FORCE_RX_FC,4,2                ## @FORCE_RX_FC
	.comm	_FORCE_TX_FC,4,2                ## @FORCE_TX_FC
	.comm	_FORCE_SPD_S,4,2                ## @FORCE_SPD_S
	.comm	_FORCE_DPX,4,2                  ## @FORCE_DPX
L_.str.1:                               ## @.str.1
	.asciz	"%s is not supported by port %d\n"

	.no_dead_strip	_mt7531_mac_port_setup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt7531_mac_port_setup
_mt7531_mac_port_setup:                 ; @mt7531_mac_port_setup
	.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	x19, x1
	mov	x20, x0
	cmp	w1, #5
	b.lt	LBB0_6
; %bb.1:
Lloh0:
	adrp	x8, _MT753X_NUM_PORTS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MT753X_NUM_PORTS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w19
	b.le	LBB0_6
; %bb.2:
	ldr	x8, [x2, #8]
	cbz	x8, LBB0_7
; %bb.3:
Lloh3:
	adrp	x9, _IPG_96BIT_WITH_SHORT_IPG@GOTPAGE
Lloh4:
	ldr	x9, [x9, _IPG_96BIT_WITH_SHORT_IPG@GOTPAGEOFF]
Lloh5:
	adrp	x10, _IPG_CFG_S@GOTPAGE
Lloh6:
	ldr	x10, [x10, _IPG_CFG_S@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
Lloh8:
	ldr	w10, [x10]
	lsl	w9, w9, w10
Lloh9:
	adrp	x10, _MAC_MODE@GOTPAGE
Lloh10:
	ldr	x10, [x10, _MAC_MODE@GOTPAGEOFF]
Lloh11:
	ldr	w10, [x10]
	orr	w9, w9, w10
Lloh12:
	adrp	x10, _MAC_TX_EN@GOTPAGE
Lloh13:
	ldr	x10, [x10, _MAC_TX_EN@GOTPAGEOFF]
Lloh14:
	ldr	w10, [x10]
Lloh15:
	adrp	x11, _MAC_RX_EN@GOTPAGE
Lloh16:
	ldr	x11, [x11, _MAC_RX_EN@GOTPAGEOFF]
	orr	w9, w9, w10
Lloh17:
	ldr	w10, [x11]
	orr	w9, w9, w10
Lloh18:
	adrp	x10, _BKOFF_EN@GOTPAGE
Lloh19:
	ldr	x10, [x10, _BKOFF_EN@GOTPAGEOFF]
Lloh20:
	ldr	w10, [x10]
	orr	w9, w9, w10
Lloh21:
	adrp	x10, _BACKPR_EN@GOTPAGE
Lloh22:
	ldr	x10, [x10, _BACKPR_EN@GOTPAGEOFF]
Lloh23:
	ldr	w10, [x10]
	orr	w21, w9, w10
	ldr	x9, [x2, #16]
	cbz	x9, LBB0_8
; %bb.4:
	ldrsw	x9, [x2]
Lloh24:
	adrp	x10, _MAC_SPD_2500@GOTPAGE
Lloh25:
	ldr	x10, [x10, _MAC_SPD_2500@GOTPAGEOFF]
Lloh26:
	adrp	x11, _MAC_SPD_1000@GOTPAGE
Lloh27:
	ldr	x11, [x11, _MAC_SPD_1000@GOTPAGEOFF]
Lloh28:
	ldr	x10, [x10]
Lloh29:
	ldr	w11, [x11]
	cmp	x10, x9
	csel	w9, w11, w9, eq
Lloh30:
	adrp	x10, _FORCE_MODE_LNK@GOTPAGE
Lloh31:
	ldr	x10, [x10, _FORCE_MODE_LNK@GOTPAGEOFF]
Lloh32:
	ldr	w10, [x10]
Lloh33:
	adrp	x11, _FORCE_LINK@GOTPAGE
Lloh34:
	ldr	x11, [x11, _FORCE_LINK@GOTPAGEOFF]
Lloh35:
	ldr	w11, [x11]
Lloh36:
	adrp	x12, _FORCE_MODE_SPD@GOTPAGE
Lloh37:
	ldr	x12, [x12, _FORCE_MODE_SPD@GOTPAGEOFF]
Lloh38:
	ldr	w12, [x12]
Lloh39:
	adrp	x13, _FORCE_MODE_DPX@GOTPAGE
Lloh40:
	ldr	x13, [x13, _FORCE_MODE_DPX@GOTPAGEOFF]
Lloh41:
	ldr	w13, [x13]
Lloh42:
	adrp	x14, _FORCE_MODE_RX_FC@GOTPAGE
Lloh43:
	ldr	x14, [x14, _FORCE_MODE_RX_FC@GOTPAGEOFF]
Lloh44:
	ldr	w14, [x14]
Lloh45:
	adrp	x15, _FORCE_MODE_TX_FC@GOTPAGE
Lloh46:
	ldr	x15, [x15, _FORCE_MODE_TX_FC@GOTPAGEOFF]
Lloh47:
	ldr	w15, [x15]
Lloh48:
	adrp	x16, _FORCE_RX_FC@GOTPAGE
Lloh49:
	ldr	x16, [x16, _FORCE_RX_FC@GOTPAGEOFF]
Lloh50:
	ldr	w16, [x16]
Lloh51:
	adrp	x17, _FORCE_TX_FC@GOTPAGE
Lloh52:
	ldr	x17, [x17, _FORCE_TX_FC@GOTPAGEOFF]
Lloh53:
	ldr	w17, [x17]
Lloh54:
	adrp	x0, _FORCE_SPD_S@GOTPAGE
Lloh55:
	ldr	x0, [x0, _FORCE_SPD_S@GOTPAGEOFF]
Lloh56:
	ldr	w0, [x0]
	lsl	w9, w9, w0
	orr	w10, w10, w21
	orr	w10, w10, w11
	orr	w10, w10, w12
	orr	w10, w10, w13
	orr	w10, w10, w14
	orr	w10, w10, w15
	orr	w10, w10, w16
	orr	w10, w10, w17
	orr	w21, w10, w9
	ldr	x9, [x2, #24]
	cbz	x9, LBB0_8
; %bb.5:
Lloh57:
	adrp	x9, _FORCE_DPX@GOTPAGE
Lloh58:
	ldr	x9, [x9, _FORCE_DPX@GOTPAGEOFF]
Lloh59:
	ldr	w9, [x9]
	orr	w21, w9, w21
	b	LBB0_8
LBB0_6:
	ldr	w0, [x20]
Lloh60:
	adrp	x1, l_.str@PAGE
Lloh61:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x19
	bl	_dev_info
Lloh62:
	adrp	x8, _EINVAL@GOTPAGE
Lloh63:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh64:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_18
LBB0_7:
Lloh65:
	adrp	x9, _FORCE_MODE_LNK@GOTPAGE
Lloh66:
	ldr	x9, [x9, _FORCE_MODE_LNK@GOTPAGEOFF]
Lloh67:
	ldr	w21, [x9]
LBB0_8:
	ldr	w0, [x2, #4]
	cmp	w0, #128
	b.eq	LBB0_11
; %bb.9:
	cmp	w0, #129
	b.ne	LBB0_13
; %bb.10:
	mov	x0, x20
	mov	x1, x19
	bl	_mt7531_set_port_rgmii
	b	LBB0_17
LBB0_11:
	ldr	x8, [x2, #16]
	cbz	x8, LBB0_16
; %bb.12:
	mov	x0, x20
	mov	x1, x19
	bl	_mt7531_set_port_sgmii_force_mode
	b	LBB0_17
LBB0_13:
	cbz	x8, LBB0_15
; %bb.14:
	ldr	w21, [x20]
	bl	_phy_modes
	mov	x2, x0
	str	x19, [sp]
Lloh68:
	adrp	x1, l_.str.1@PAGE
Lloh69:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x21
	bl	_dev_info
LBB0_15:
Lloh70:
	adrp	x8, _FORCE_MODE_LNK@GOTPAGE
Lloh71:
	ldr	x8, [x8, _FORCE_MODE_LNK@GOTPAGEOFF]
Lloh72:
	ldr	w21, [x8]
	b	LBB0_17
LBB0_16:
	mov	x0, x20
	mov	x1, x19
	bl	_mt7531_set_port_sgmii_an_mode
LBB0_17:
	mov	x0, x19
	bl	_PMCR
	mov	x1, x0
	mov	x0, x20
	mov	x2, x21
	bl	_mt753x_reg_write
	mov	w0, #0
LBB0_18:
	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 AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh7
	.loh AdrpLdrGotLdr	Lloh54, Lloh55, Lloh56
	.loh AdrpLdrGotLdr	Lloh51, Lloh52, Lloh53
	.loh AdrpLdrGotLdr	Lloh48, Lloh49, Lloh50
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh28
	.loh AdrpLdrGotLdr	Lloh57, Lloh58, Lloh59
	.loh AdrpLdrGotLdr	Lloh62, Lloh63, Lloh64
	.loh AdrpAdd	Lloh60, Lloh61
	.loh AdrpLdrGotLdr	Lloh65, Lloh66, Lloh67
	.loh AdrpAdd	Lloh68, Lloh69
	.loh AdrpLdrGotLdr	Lloh70, Lloh71, Lloh72
	.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 MAC port\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_IPG_96BIT_WITH_SHORT_IPG,4,2   ; @IPG_96BIT_WITH_SHORT_IPG
	.comm	_IPG_CFG_S,4,2                  ; @IPG_CFG_S
	.comm	_MAC_MODE,4,2                   ; @MAC_MODE
	.comm	_MAC_TX_EN,4,2                  ; @MAC_TX_EN
	.comm	_MAC_RX_EN,4,2                  ; @MAC_RX_EN
	.comm	_BKOFF_EN,4,2                   ; @BKOFF_EN
	.comm	_BACKPR_EN,4,2                  ; @BACKPR_EN
	.comm	_MAC_SPD_2500,8,3               ; @MAC_SPD_2500
	.comm	_MAC_SPD_1000,4,2               ; @MAC_SPD_1000
	.comm	_FORCE_MODE_LNK,4,2             ; @FORCE_MODE_LNK
	.comm	_FORCE_LINK,4,2                 ; @FORCE_LINK
	.comm	_FORCE_MODE_SPD,4,2             ; @FORCE_MODE_SPD
	.comm	_FORCE_MODE_DPX,4,2             ; @FORCE_MODE_DPX
	.comm	_FORCE_MODE_RX_FC,4,2           ; @FORCE_MODE_RX_FC
	.comm	_FORCE_MODE_TX_FC,4,2           ; @FORCE_MODE_TX_FC
	.comm	_FORCE_RX_FC,4,2                ; @FORCE_RX_FC
	.comm	_FORCE_TX_FC,4,2                ; @FORCE_TX_FC
	.comm	_FORCE_SPD_S,4,2                ; @FORCE_SPD_S
	.comm	_FORCE_DPX,4,2                  ; @FORCE_DPX
l_.str.1:                               ; @.str.1
	.asciz	"%s is not supported by port %d\n"

	.no_dead_strip	_mt7531_mac_port_setup
.subsections_via_symbols
