	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt7530_setup_port5
_mt7530_setup_port5:                    ## @mt7530_setup_port5
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	8(%rdi), %r13
	leaq	4(%r13), %r12
	movq	%r12, %rdi
	callq	_mutex_lock
	movq	_MT7530_MHWTRAP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_mt7530_read
	movl	(%r13), %edx
	leal	-128(%rdx), %esi
	cmpl	$3, %esi
	ja	LBB0_5
## %bb.1:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	_MHWTRAP_MANUAL@GOTPCREL(%rip), %rdi
	movq	_MHWTRAP_P5_MAC_SEL@GOTPCREL(%rip), %rcx
	movq	_MHWTRAP_P5_DIS@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	movl	(%rcx), %ecx
	orl	%edx, %ecx
	orl	%ecx, %eax
	orl	(%rdi), %eax
	movq	_MHWTRAP_P5_RGMII_MODE@GOTPCREL(%rip), %r14
	movq	_MHWTRAP_PHY0_SEL@GOTPCREL(%rip), %rdi
	movl	(%rdi), %edi
	movl	(%r14), %ebx
	orl	%edi, %ebx
	notl	%ebx
	andl	%eax, %ebx
	leaq	LJTI0_0(%rip), %rax
	movslq	(%rax,%rsi,4), %rsi
	addq	%rax, %rsi
	jmpq	*%rsi
LBB0_2:
	orl	%edi, %ebx
LBB0_3:
	notl	%ecx
	andl	%ecx, %ebx
	movl	$5, %edi
	callq	_MT7530_PMCR_P
	movq	%r13, %rdi
	movl	%eax, %esi
	movl	$353024, %edx                   ## imm = 0x56300
	callq	_mt7530_write
	jmp	LBB0_7
LBB0_5:
	movl	(%rbx), %edi
	leaq	L_.str(%rip), %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_dev_err
	jmp	LBB0_12
LBB0_6:
	notl	%edx
	andl	%edx, %ebx
	jmp	LBB0_7
LBB0_4:
	movq	_PHY_INTERFACE_MODE_NA@GOTPCREL(%rip), %rax
	movq	(%rax), %r15
LBB0_7:
	movq	%r15, %rdi
	callq	_phy_interface_mode_is_rgmii
	testq	%rax, %rax
	movq	%r12, -56(%rbp)                 ## 8-byte Spill
	je	LBB0_11
## %bb.8:
	orl	(%r14), %ebx
	movq	_MT7530_P5RGMIIRXCR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CSR_RGMII_EDGE_ALIGN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	callq	_mt7530_write
	movl	16(%r13), %edi
	movl	$5, %esi
	callq	_dsa_is_dsa_port
	movl	$16, %edi
	testl	%eax, %eax
	jne	LBB0_10
## %bb.9:
	movq	_PHY_INTERFACE_MODE_RGMII_TXID@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r15
	sete	%al
	movq	_PHY_INTERFACE_MODE_RGMII_ID@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %r15
	sete	%cl
	orb	%al, %cl
	movzbl	%cl, %eax
	leal	16(,%rax,4), %edi
LBB0_10:
	movq	_MT7530_P5RGMIITXCR@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	callq	_CSR_RGMII_TXC_CFG
	movq	%r13, %rdi
	movl	%r14d, %esi
	movl	%eax, %edx
	callq	_mt7530_write
	movq	_MT7530_IO_DRV_CR@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movl	$1, %edi
	callq	_P5_IO_CLK_DRV
	movl	%eax, %r12d
	movl	$1, %edi
	callq	_P5_IO_DATA_DRV
	orl	%eax, %r12d
	movq	%r13, %rdi
	movl	%r14d, %esi
	movl	%r12d, %edx
	callq	_mt7530_write
LBB0_11:
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	_MT7530_MHWTRAP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movl	%ebx, %edx
	callq	_mt7530_write
	movl	(%r14), %r14d
	movl	(%r13), %edi
	callq	_p5_intf_modes
	movl	%eax, %r12d
	movq	%r15, %rdi
	callq	_phy_modes
	leaq	L_.str.1(%rip), %rsi
	movl	%r14d, %edi
	movl	%ebx, %edx
	movl	%r12d, %ecx
	movl	%eax, %r8d
	callq	_dev_dbg
	movq	%r15, 8(%r13)
	movq	-56(%rbp), %r12                 ## 8-byte Reload
LBB0_12:
	movq	%r12, %rdi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mutex_unlock                   ## TAILCALL
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_3, LBB0_3-LJTI0_0
.set L0_0_set_2, LBB0_2-LJTI0_0
.set L0_0_set_6, LBB0_6-LJTI0_0
.set L0_0_set_4, LBB0_4-LJTI0_0
LJTI0_0:
	.long	L0_0_set_3
	.long	L0_0_set_2
	.long	L0_0_set_6
	.long	L0_0_set_4
	.end_data_region
                                        ## -- End function
	.comm	_MT7530_MHWTRAP,4,2             ## @MT7530_MHWTRAP
	.comm	_MHWTRAP_MANUAL,4,2             ## @MHWTRAP_MANUAL
	.comm	_MHWTRAP_P5_MAC_SEL,4,2         ## @MHWTRAP_P5_MAC_SEL
	.comm	_MHWTRAP_P5_DIS,4,2             ## @MHWTRAP_P5_DIS
	.comm	_MHWTRAP_P5_RGMII_MODE,4,2      ## @MHWTRAP_P5_RGMII_MODE
	.comm	_MHWTRAP_PHY0_SEL,4,2           ## @MHWTRAP_PHY0_SEL
	.comm	_PHY_INTERFACE_MODE_NA,8,3      ## @PHY_INTERFACE_MODE_NA
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Unsupported p5_intf_sel %d\n"

	.comm	_MT7530_P5RGMIIRXCR,4,2         ## @MT7530_P5RGMIIRXCR
	.comm	_CSR_RGMII_EDGE_ALIGN,4,2       ## @CSR_RGMII_EDGE_ALIGN
	.comm	_PHY_INTERFACE_MODE_RGMII_TXID,8,3 ## @PHY_INTERFACE_MODE_RGMII_TXID
	.comm	_PHY_INTERFACE_MODE_RGMII_ID,8,3 ## @PHY_INTERFACE_MODE_RGMII_ID
	.comm	_MT7530_P5RGMIITXCR,4,2         ## @MT7530_P5RGMIITXCR
	.comm	_MT7530_IO_DRV_CR,4,2           ## @MT7530_IO_DRV_CR
L_.str.1:                               ## @.str.1
	.asciz	"Setup P5, HWTRAP=0x%x, intf_sel=%s, phy-mode=%s\n"

	.no_dead_strip	_mt7530_setup_port5
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt7530_setup_port5
_mt7530_setup_port5:                    ; @mt7530_setup_port5
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x21, x1
	mov	x22, x0
	ldr	x20, [x0, #8]
	add	x19, x20, #4
	mov	x0, x19
	bl	_mutex_lock
Lloh0:
	adrp	x26, _MT7530_MHWTRAP@GOTPAGE
Lloh1:
	ldr	x26, [x26, _MT7530_MHWTRAP@GOTPAGEOFF]
	ldr	w1, [x26]
	mov	x0, x20
	bl	_mt7530_read
	ldr	w2, [x20]
	sub	w8, w2, #128
	cmp	w8, #3
	b.hi	LBB0_4
; %bb.1:
Lloh2:
	adrp	x9, _MHWTRAP_MANUAL@GOTPAGE
Lloh3:
	ldr	x9, [x9, _MHWTRAP_MANUAL@GOTPAGEOFF]
Lloh4:
	ldr	w11, [x9]
Lloh5:
	adrp	x9, _MHWTRAP_P5_MAC_SEL@GOTPAGE
Lloh6:
	ldr	x9, [x9, _MHWTRAP_P5_MAC_SEL@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
Lloh8:
	adrp	x10, _MHWTRAP_P5_DIS@GOTPAGE
Lloh9:
	ldr	x10, [x10, _MHWTRAP_P5_DIS@GOTPAGEOFF]
Lloh10:
	ldr	w10, [x10]
	orr	w9, w10, w9
	orr	w12, w9, w0
	orr	w12, w12, w11
Lloh11:
	adrp	x24, _MHWTRAP_P5_RGMII_MODE@GOTPAGE
Lloh12:
	ldr	x24, [x24, _MHWTRAP_P5_RGMII_MODE@GOTPAGEOFF]
	ldr	w13, [x24]
Lloh13:
	adrp	x11, _MHWTRAP_PHY0_SEL@GOTPAGE
Lloh14:
	ldr	x11, [x11, _MHWTRAP_PHY0_SEL@GOTPAGEOFF]
Lloh15:
	ldr	w11, [x11]
	orr	w13, w11, w13
	bic	w23, w12, w13
Lloh16:
	adrp	x12, lJTI0_0@PAGE
Lloh17:
	add	x12, x12, lJTI0_0@PAGEOFF
	adr	x13, LBB0_2
	ldrb	w14, [x12, x8]
	add	x13, x13, x14, lsl #2
	br	x13
LBB0_2:
	orr	w23, w23, w11
LBB0_3:
	bic	w23, w23, w9
	mov	w0, #5
	bl	_MT7530_PMCR_P
	mov	x1, x0
	mov	x0, x20
	mov	w2, #25344
	movk	w2, #5, lsl #16
	bl	_mt7530_write
	b	LBB0_7
LBB0_4:
	ldr	w0, [x22]
Lloh18:
	adrp	x1, l_.str@PAGE
Lloh19:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_12
LBB0_5:
	bic	w23, w23, w10
	b	LBB0_7
LBB0_6:
Lloh20:
	adrp	x8, _PHY_INTERFACE_MODE_NA@GOTPAGE
Lloh21:
	ldr	x8, [x8, _PHY_INTERFACE_MODE_NA@GOTPAGEOFF]
Lloh22:
	ldr	x21, [x8]
LBB0_7:
	mov	x0, x21
	bl	_phy_interface_mode_is_rgmii
	cbz	x0, LBB0_11
; %bb.8:
	ldr	w8, [x24]
	orr	w23, w8, w23
Lloh23:
	adrp	x8, _MT7530_P5RGMIIRXCR@GOTPAGE
Lloh24:
	ldr	x8, [x8, _MT7530_P5RGMIIRXCR@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
Lloh26:
	adrp	x8, _CSR_RGMII_EDGE_ALIGN@GOTPAGE
Lloh27:
	ldr	x8, [x8, _CSR_RGMII_EDGE_ALIGN@GOTPAGEOFF]
Lloh28:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_mt7530_write
	ldr	w0, [x20, #16]
	mov	w1, #5
	bl	_dsa_is_dsa_port
	mov	x8, x0
	mov	w0, #16
	cbnz	w8, LBB0_10
; %bb.9:
Lloh29:
	adrp	x8, _PHY_INTERFACE_MODE_RGMII_TXID@GOTPAGE
Lloh30:
	ldr	x8, [x8, _PHY_INTERFACE_MODE_RGMII_TXID@GOTPAGEOFF]
Lloh31:
	adrp	x9, _PHY_INTERFACE_MODE_RGMII_ID@GOTPAGE
Lloh32:
	ldr	x9, [x9, _PHY_INTERFACE_MODE_RGMII_ID@GOTPAGEOFF]
Lloh33:
	ldr	x8, [x8]
Lloh34:
	ldr	x9, [x9]
	cmp	x21, x9
	ccmp	x21, x8, #4, ne
	mov	w8, #20
	csel	w0, w8, w0, eq
LBB0_10:
Lloh35:
	adrp	x8, _MT7530_P5RGMIITXCR@GOTPAGE
Lloh36:
	ldr	x8, [x8, _MT7530_P5RGMIITXCR@GOTPAGEOFF]
Lloh37:
	ldr	w24, [x8]
	bl	_CSR_RGMII_TXC_CFG
	mov	x2, x0
	mov	x0, x20
	mov	x1, x24
	bl	_mt7530_write
Lloh38:
	adrp	x8, _MT7530_IO_DRV_CR@GOTPAGE
Lloh39:
	ldr	x8, [x8, _MT7530_IO_DRV_CR@GOTPAGEOFF]
Lloh40:
	ldr	w24, [x8]
	mov	w0, #1
	bl	_P5_IO_CLK_DRV
	mov	x25, x0
	mov	w0, #1
	bl	_P5_IO_DATA_DRV
	orr	w2, w0, w25
	mov	x0, x20
	mov	x1, x24
	bl	_mt7530_write
LBB0_11:
	ldr	w1, [x26]
	mov	x0, x20
	mov	x2, x23
	bl	_mt7530_write
	ldr	w22, [x22]
	ldr	w0, [x20]
	bl	_p5_intf_modes
	mov	x24, x0
	mov	x0, x21
	bl	_phy_modes
	mov	x4, x0
Lloh41:
	adrp	x1, l_.str.1@PAGE
Lloh42:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x22
	mov	x2, x23
	mov	x3, x24
	bl	_dev_dbg
	str	x21, [x20, #8]
LBB0_12:
	mov	x0, x19
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_mutex_unlock
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh33
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpAdd	Lloh41, Lloh42
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_3-LBB0_2)>>2
	.byte	(LBB0_2-LBB0_2)>>2
	.byte	(LBB0_5-LBB0_2)>>2
	.byte	(LBB0_6-LBB0_2)>>2
                                        ; -- End function
	.comm	_MT7530_MHWTRAP,4,2             ; @MT7530_MHWTRAP
	.comm	_MHWTRAP_MANUAL,4,2             ; @MHWTRAP_MANUAL
	.comm	_MHWTRAP_P5_MAC_SEL,4,2         ; @MHWTRAP_P5_MAC_SEL
	.comm	_MHWTRAP_P5_DIS,4,2             ; @MHWTRAP_P5_DIS
	.comm	_MHWTRAP_P5_RGMII_MODE,4,2      ; @MHWTRAP_P5_RGMII_MODE
	.comm	_MHWTRAP_PHY0_SEL,4,2           ; @MHWTRAP_PHY0_SEL
	.comm	_PHY_INTERFACE_MODE_NA,8,3      ; @PHY_INTERFACE_MODE_NA
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Unsupported p5_intf_sel %d\n"

	.comm	_MT7530_P5RGMIIRXCR,4,2         ; @MT7530_P5RGMIIRXCR
	.comm	_CSR_RGMII_EDGE_ALIGN,4,2       ; @CSR_RGMII_EDGE_ALIGN
	.comm	_PHY_INTERFACE_MODE_RGMII_TXID,8,3 ; @PHY_INTERFACE_MODE_RGMII_TXID
	.comm	_PHY_INTERFACE_MODE_RGMII_ID,8,3 ; @PHY_INTERFACE_MODE_RGMII_ID
	.comm	_MT7530_P5RGMIITXCR,4,2         ; @MT7530_P5RGMIITXCR
	.comm	_MT7530_IO_DRV_CR,4,2           ; @MT7530_IO_DRV_CR
l_.str.1:                               ; @.str.1
	.asciz	"Setup P5, HWTRAP=0x%x, intf_sel=%s, phy-mode=%s\n"

	.no_dead_strip	_mt7530_setup_port5
.subsections_via_symbols
