	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sun4i_can_start
_sun4i_can_start:                       ## @sun4i_can_start
	.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
	movq	%rdi, %r14
	callq	_netdev_priv
	movq	%rax, %r15
	movq	%r14, %rdi
	callq	_set_reset_mode
	testl	%eax, %eax
	je	LBB0_3
## %bb.1:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rsi
LBB0_2:
	movq	%r14, %rdi
	callq	_netdev_err
	jmp	LBB0_12
LBB0_3:
	movq	_SUN4I_REG_ACPC_ADDR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r15), %rsi
	xorl	%edi, %edi
	callq	_writel
	movq	_SUN4I_REG_ACPM_ADDR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r15), %rsi
	movl	$-1, %edi
	callq	_writel
	movq	_SUN4I_REG_ERRC_ADDR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r15), %rsi
	xorl	%edi, %edi
	callq	_writel
	movq	_CAN_CTRLMODE_BERR_REPORTING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	(%r15), %eax
	movq	_SUN4I_INTEN_BERR@GOTPCREL(%rip), %rcx
	movzbl	(%rcx), %ecx
	xorl	$255, %ecx
	testl	%eax, %eax
	movl	$255, %edi
	cmovel	%ecx, %edi
	movq	_SUN4I_REG_INTEN_ADDR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r15), %rsi
	callq	_writel
	movq	_SUN4I_REG_MSEL_ADDR@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	addq	8(%r15), %rdi
	callq	_readl
	movl	(%r15), %ecx
	movq	_CAN_CTRLMODE_LOOPBACK@GOTPCREL(%rip), %rdx
	testl	%ecx, (%rdx)
	je	LBB0_5
## %bb.4:
	movq	_SUN4I_MSEL_LOOPBACK_MODE@GOTPCREL(%rip), %rcx
	jmp	LBB0_7
LBB0_5:
	movq	_CAN_CTRLMODE_LISTENONLY@GOTPCREL(%rip), %rdx
	testl	%ecx, (%rdx)
	je	LBB0_8
## %bb.6:
	movq	_SUN4I_MSEL_LISTEN_ONLY_MODE@GOTPCREL(%rip), %rcx
LBB0_7:
	orl	(%rcx), %eax
LBB0_8:
	movq	(%rbx), %rsi
	addq	8(%r15), %rsi
	movl	%eax, %edi
	callq	_writel
	movq	%r14, %rdi
	callq	_sun4ican_set_bittiming
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_9
LBB0_12:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movq	%r14, %rdi
	callq	_set_normal_mode
	testl	%eax, %eax
	je	LBB0_11
## %bb.10:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_2
LBB0_11:
	movq	_CAN_STATE_ERROR_ACTIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 4(%r15)
	xorl	%ebx, %ebx
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"could not enter reset mode\n"

	.comm	_SUN4I_REG_ACPC_ADDR,8,3        ## @SUN4I_REG_ACPC_ADDR
	.comm	_SUN4I_REG_ACPM_ADDR,8,3        ## @SUN4I_REG_ACPM_ADDR
	.comm	_SUN4I_REG_ERRC_ADDR,8,3        ## @SUN4I_REG_ERRC_ADDR
	.comm	_CAN_CTRLMODE_BERR_REPORTING,4,2 ## @CAN_CTRLMODE_BERR_REPORTING
	.comm	_SUN4I_REG_INTEN_ADDR,8,3       ## @SUN4I_REG_INTEN_ADDR
	.comm	_SUN4I_INTEN_BERR,4,2           ## @SUN4I_INTEN_BERR
	.comm	_SUN4I_REG_MSEL_ADDR,8,3        ## @SUN4I_REG_MSEL_ADDR
	.comm	_CAN_CTRLMODE_LOOPBACK,4,2      ## @CAN_CTRLMODE_LOOPBACK
	.comm	_SUN4I_MSEL_LOOPBACK_MODE,4,2   ## @SUN4I_MSEL_LOOPBACK_MODE
	.comm	_CAN_CTRLMODE_LISTENONLY,4,2    ## @CAN_CTRLMODE_LISTENONLY
	.comm	_SUN4I_MSEL_LISTEN_ONLY_MODE,4,2 ## @SUN4I_MSEL_LISTEN_ONLY_MODE
L_.str.1:                               ## @.str.1
	.asciz	"could not enter normal mode\n"

	.comm	_CAN_STATE_ERROR_ACTIVE,4,2     ## @CAN_STATE_ERROR_ACTIVE
	.no_dead_strip	_sun4i_can_start
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sun4i_can_start
_sun4i_can_start:                       ; @sun4i_can_start
	.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	x19, x0
	bl	_netdev_priv
	mov	x20, x0
	mov	x0, x19
	bl	_set_reset_mode
	cbz	w0, LBB0_3
; %bb.1:
	mov	x21, x0
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
LBB0_2:
	mov	x0, x19
	bl	_netdev_err
	b	LBB0_9
LBB0_3:
	ldr	x8, [x20, #8]
Lloh2:
	adrp	x9, _SUN4I_REG_ACPC_ADDR@GOTPAGE
Lloh3:
	ldr	x9, [x9, _SUN4I_REG_ACPC_ADDR@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	x8, [x20, #8]
Lloh5:
	adrp	x9, _SUN4I_REG_ACPM_ADDR@GOTPAGE
Lloh6:
	ldr	x9, [x9, _SUN4I_REG_ACPM_ADDR@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #-1
	bl	_writel
	ldr	x8, [x20, #8]
Lloh8:
	adrp	x9, _SUN4I_REG_ERRC_ADDR@GOTPAGE
Lloh9:
	ldr	x9, [x9, _SUN4I_REG_ERRC_ADDR@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #0
	bl	_writel
	ldr	w8, [x20]
Lloh11:
	adrp	x9, _CAN_CTRLMODE_BERR_REPORTING@GOTPAGE
Lloh12:
	ldr	x9, [x9, _CAN_CTRLMODE_BERR_REPORTING@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
Lloh14:
	adrp	x10, _SUN4I_INTEN_BERR@GOTPAGE
Lloh15:
	ldr	x10, [x10, _SUN4I_INTEN_BERR@GOTPAGEOFF]
	ldrb	w10, [x10]
	eor	w10, w10, #0xff
	tst	w9, w8
	mov	w8, #255
	csel	w0, w10, w8, eq
	ldr	x8, [x20, #8]
Lloh16:
	adrp	x9, _SUN4I_REG_INTEN_ADDR@GOTPAGE
Lloh17:
	ldr	x9, [x9, _SUN4I_REG_INTEN_ADDR@GOTPAGEOFF]
Lloh18:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	x8, [x20, #8]
Lloh19:
	adrp	x21, _SUN4I_REG_MSEL_ADDR@GOTPAGE
Lloh20:
	ldr	x21, [x21, _SUN4I_REG_MSEL_ADDR@GOTPAGEOFF]
	ldr	x9, [x21]
	add	x0, x9, x8
	bl	_readl
	ldr	w8, [x20]
Lloh21:
	adrp	x9, _CAN_CTRLMODE_LOOPBACK@GOTPAGE
Lloh22:
	ldr	x9, [x9, _CAN_CTRLMODE_LOOPBACK@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_5
; %bb.4:
Lloh24:
	adrp	x8, _SUN4I_MSEL_LOOPBACK_MODE@GOTPAGE
Lloh25:
	ldr	x8, [x8, _SUN4I_MSEL_LOOPBACK_MODE@GOTPAGEOFF]
	b	LBB0_7
LBB0_5:
Lloh26:
	adrp	x9, _CAN_CTRLMODE_LISTENONLY@GOTPAGE
Lloh27:
	ldr	x9, [x9, _CAN_CTRLMODE_LISTENONLY@GOTPAGEOFF]
Lloh28:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_8
; %bb.6:
Lloh29:
	adrp	x8, _SUN4I_MSEL_LISTEN_ONLY_MODE@GOTPAGE
Lloh30:
	ldr	x8, [x8, _SUN4I_MSEL_LISTEN_ONLY_MODE@GOTPAGEOFF]
LBB0_7:
	ldr	w8, [x8]
	orr	w0, w8, w0
LBB0_8:
	ldr	x8, [x20, #8]
	ldr	x9, [x21]
	add	x1, x9, x8
	bl	_writel
	mov	x0, x19
	bl	_sun4ican_set_bittiming
	mov	x21, x0
	cbz	w0, LBB0_10
LBB0_9:
	mov	x0, x21
	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
	ret
LBB0_10:
	mov	x0, x19
	bl	_set_normal_mode
	mov	x21, x0
	cbz	w0, LBB0_12
; %bb.11:
Lloh31:
	adrp	x1, l_.str.1@PAGE
Lloh32:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_2
LBB0_12:
Lloh33:
	adrp	x8, _CAN_STATE_ERROR_ACTIVE@GOTPAGE
Lloh34:
	ldr	x8, [x8, _CAN_STATE_ERROR_ACTIVE@GOTPAGEOFF]
Lloh35:
	ldr	w8, [x8]
	str	w8, [x20, #4]
	b	LBB0_9
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"could not enter reset mode\n"

	.comm	_SUN4I_REG_ACPC_ADDR,8,3        ; @SUN4I_REG_ACPC_ADDR
	.comm	_SUN4I_REG_ACPM_ADDR,8,3        ; @SUN4I_REG_ACPM_ADDR
	.comm	_SUN4I_REG_ERRC_ADDR,8,3        ; @SUN4I_REG_ERRC_ADDR
	.comm	_CAN_CTRLMODE_BERR_REPORTING,4,2 ; @CAN_CTRLMODE_BERR_REPORTING
	.comm	_SUN4I_REG_INTEN_ADDR,8,3       ; @SUN4I_REG_INTEN_ADDR
	.comm	_SUN4I_INTEN_BERR,4,2           ; @SUN4I_INTEN_BERR
	.comm	_SUN4I_REG_MSEL_ADDR,8,3        ; @SUN4I_REG_MSEL_ADDR
	.comm	_CAN_CTRLMODE_LOOPBACK,4,2      ; @CAN_CTRLMODE_LOOPBACK
	.comm	_SUN4I_MSEL_LOOPBACK_MODE,4,2   ; @SUN4I_MSEL_LOOPBACK_MODE
	.comm	_CAN_CTRLMODE_LISTENONLY,4,2    ; @CAN_CTRLMODE_LISTENONLY
	.comm	_SUN4I_MSEL_LISTEN_ONLY_MODE,4,2 ; @SUN4I_MSEL_LISTEN_ONLY_MODE
l_.str.1:                               ; @.str.1
	.asciz	"could not enter normal mode\n"

	.comm	_CAN_STATE_ERROR_ACTIVE,4,2     ; @CAN_STATE_ERROR_ACTIVE
	.no_dead_strip	_sun4i_can_start
.subsections_via_symbols
