	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function spi_attach
_spi_attach:                            ## @spi_attach
	.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	%edi, %r12d
	callq	_device_get_softc
	movq	%rax, %rbx
	movl	%r12d, 8(%rax)
	xorl	%eax, %eax
	callq	_imx_ccm_ecspi_hz
	movl	%eax, 52(%rbx)
	leaq	48(%rbx), %r15
	movl	%r12d, %edi
	callq	_device_get_nameunit
	movq	_MTX_DEF@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	%r15, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	_mtx_init
	movl	8(%rbx), %edi
	callq	_device_get_sysctl_ctx
	movl	%eax, %r15d
	movl	8(%rbx), %edi
	callq	_device_get_sysctl_tree
	movl	%eax, %edi
	callq	_SYSCTL_CHILDREN
	movq	_OID_AUTO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	_CTLFLAG_RWTUN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	leaq	L_.str.1(%rip), %r10
	leaq	L_.str(%rip), %rcx
	movl	%r15d, %edi
	movl	%eax, %esi
	movq	%rbx, %r9
	pushq	%r10
	pushq	$0
	callq	_SYSCTL_ADD_INT
	addq	$16, %rsp
	movl	$0, -44(%rbp)
	movl	8(%rbx), %edi
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_RF_ACTIVE@GOTPCREL(%rip), %r14
	movl	(%r14), %ecx
	leaq	-44(%rbp), %rdx
	callq	_bus_alloc_resource_any
	movq	%rax, 40(%rbx)
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movl	$0, -44(%rbp)
	movl	8(%rbx), %edi
	movq	_SYS_RES_IRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r14), %ecx
	leaq	-44(%rbp), %rdx
	callq	_bus_alloc_resource_any
	movq	%rax, 32(%rbx)
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	_INTR_TYPE_MISC@GOTPCREL(%rip), %rcx
	movq	_INTR_MPSAFE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	movl	8(%rbx), %edi
	movq	_spi_intr@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	movq	%rbx, %r10
	addq	$24, %r10
	subq	$8, %rsp
	movq	%rax, %rsi
	xorl	%ecx, %ecx
	movq	%rbx, %r9
	pushq	%r10
	callq	_bus_setup_intr
	addq	$16, %rsp
	movl	8(%rbx), %edi
	testl	%eax, %eax
	je	LBB0_8
## %bb.5:
	leaq	L_.str.4(%rip), %rsi
	jmp	LBB0_6
LBB0_1:
	movl	8(%rbx), %edi
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_device_printf
	movl	8(%rbx), %edi
	callq	_spi_detach
	jmp	LBB0_7
LBB0_3:
	movl	8(%rbx), %edi
	leaq	L_.str.3(%rip), %rsi
LBB0_6:
	xorl	%eax, %eax
	callq	_device_printf
	movl	8(%rbx), %edi
	callq	_device_detach
LBB0_7:
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_16:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movl	%r12d, -48(%rbp)                ## 4-byte Spill
	callq	_ofw_bus_get_node
	movl	%eax, %r15d
	movq	16(%rbx), %rdi
	callq	_nitems
	testl	%eax, %eax
	jle	LBB0_15
## %bb.9:
	leaq	L_.str.5(%rip), %r12
	xorl	%r14d, %r14d
	xorl	%r13d, %r13d
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_10 Depth=1
	movq	16(%rbx), %rax
	movl	(%rax,%r13,4), %edi
	movq	_GPIO_PIN_OUTPUT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_gpio_pin_setflags
LBB0_14:                                ##   in Loop: Header=BB0_10 Depth=1
	incq	%r13
	movq	16(%rbx), %rdi
	callq	_nitems
	cltq
	addq	$4, %r14
	cmpq	%rax, %r13
	jge	LBB0_15
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movl	8(%rbx), %edi
	movq	16(%rbx), %r8
	addq	%r14, %r8
	movl	%r15d, %esi
	movq	%r12, %rdx
	movl	%r13d, %ecx
	callq	_gpio_pin_get_by_ofw_propidx
	testl	%eax, %eax
	je	LBB0_11
## %bb.12:                              ##   in Loop: Header=BB0_10 Depth=1
	cmpl	$2, (%rbx)
	jl	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_10 Depth=1
	movl	8(%rbx), %edi
	leaq	L_.str.6(%rip), %rsi
	movl	%r13d, %edx
	xorl	%eax, %eax
	callq	_device_printf
	jmp	LBB0_14
LBB0_15:
	movq	_ECSPI_CTLREG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_CTLREG_CMODES_MASTER@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_WR4
	leaq	L_.str.7(%rip), %rsi
	movl	-48(%rbp), %r14d                ## 4-byte Reload
	movl	%r14d, %edi
	movl	$-1, %edx
	callq	_device_add_child
	movl	%eax, 4(%rbx)
	movq	_bus_generic_attach@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%r14d, %esi
	callq	_config_intrhook_oneshot
	xorl	%eax, %eax
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_MTX_DEF,4,2                    ## @MTX_DEF
	.comm	_OID_AUTO,4,2                   ## @OID_AUTO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"debug"

	.comm	_CTLFLAG_RWTUN,4,2              ## @CTLFLAG_RWTUN
L_.str.1:                               ## @.str.1
	.asciz	"Enable debug, higher values = more info"

	.comm	_SYS_RES_MEMORY,4,2             ## @SYS_RES_MEMORY
	.comm	_RF_ACTIVE,4,2                  ## @RF_ACTIVE
L_.str.2:                               ## @.str.2
	.asciz	"could not allocate registers\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_SYS_RES_IRQ,4,2                ## @SYS_RES_IRQ
L_.str.3:                               ## @.str.3
	.asciz	"could not allocate interrupt\n"

	.comm	_INTR_TYPE_MISC,4,2             ## @INTR_TYPE_MISC
	.comm	_INTR_MPSAFE,4,2                ## @INTR_MPSAFE
	.comm	_spi_intr,4,2                   ## @spi_intr
L_.str.4:                               ## @.str.4
	.asciz	"could not setup interrupt handler"

L_.str.5:                               ## @.str.5
	.asciz	"cs-gpios"

	.comm	_GPIO_PIN_OUTPUT,4,2            ## @GPIO_PIN_OUTPUT
L_.str.6:                               ## @.str.6
	.asciz	"cannot configure gpio for chip select %u\n"

	.comm	_ECSPI_CTLREG,4,2               ## @ECSPI_CTLREG
	.comm	_CTLREG_CMODES_MASTER,4,2       ## @CTLREG_CMODES_MASTER
L_.str.7:                               ## @.str.7
	.asciz	"spibus"

	.comm	_bus_generic_attach,8,3         ## @bus_generic_attach
	.no_dead_strip	_spi_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function spi_attach
_spi_attach:                            ; @spi_attach
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x20, x0
	bl	_device_get_softc
	mov	x19, x0
	str	w20, [x0, #8]
	bl	_imx_ccm_ecspi_hz
	str	w0, [x19, #52]
	add	x21, x19, #48
	mov	x0, x20
	bl	_device_get_nameunit
	mov	x1, x0
Lloh0:
	adrp	x8, _MTX_DEF@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MTX_DEF@GOTPAGEOFF]
Lloh2:
	ldr	w3, [x8]
	mov	x0, x21
	mov	x2, #0
	bl	_mtx_init
	ldr	w0, [x19, #8]
	bl	_device_get_sysctl_ctx
	mov	x21, x0
	ldr	w0, [x19, #8]
	bl	_device_get_sysctl_tree
	bl	_SYSCTL_CHILDREN
	mov	x1, x0
Lloh3:
	adrp	x8, _OID_AUTO@GOTPAGE
Lloh4:
	ldr	x8, [x8, _OID_AUTO@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
Lloh6:
	adrp	x8, _CTLFLAG_RWTUN@GOTPAGE
Lloh7:
	ldr	x8, [x8, _CTLFLAG_RWTUN@GOTPAGEOFF]
Lloh8:
	ldr	w4, [x8]
Lloh9:
	adrp	x3, l_.str@PAGE
Lloh10:
	add	x3, x3, l_.str@PAGEOFF
Lloh11:
	adrp	x7, l_.str.1@PAGE
Lloh12:
	add	x7, x7, l_.str.1@PAGEOFF
	mov	x0, x21
	mov	x5, x19
	mov	w6, #0
	bl	_SYSCTL_ADD_INT
	str	wzr, [sp, #12]
	ldr	w0, [x19, #8]
Lloh13:
	adrp	x8, _SYS_RES_MEMORY@GOTPAGE
Lloh14:
	ldr	x8, [x8, _SYS_RES_MEMORY@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
Lloh16:
	adrp	x21, _RF_ACTIVE@GOTPAGE
Lloh17:
	ldr	x21, [x21, _RF_ACTIVE@GOTPAGEOFF]
	ldr	w3, [x21]
	add	x2, sp, #12
	bl	_bus_alloc_resource_any
	str	x0, [x19, #40]
	cbz	x0, LBB0_4
; %bb.1:
	str	wzr, [sp, #12]
	ldr	w0, [x19, #8]
Lloh18:
	adrp	x8, _SYS_RES_IRQ@GOTPAGE
Lloh19:
	ldr	x8, [x8, _SYS_RES_IRQ@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	ldr	w3, [x21]
	add	x2, sp, #12
	bl	_bus_alloc_resource_any
	str	x0, [x19, #32]
	cbz	x0, LBB0_5
; %bb.2:
	mov	x1, x0
	ldr	w0, [x19, #8]
Lloh21:
	adrp	x8, _INTR_TYPE_MISC@GOTPAGE
Lloh22:
	ldr	x8, [x8, _INTR_TYPE_MISC@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
Lloh24:
	adrp	x9, _INTR_MPSAFE@GOTPAGE
Lloh25:
	ldr	x9, [x9, _INTR_MPSAFE@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	orr	w2, w9, w8
Lloh27:
	adrp	x8, _spi_intr@GOTPAGE
Lloh28:
	ldr	x8, [x8, _spi_intr@GOTPAGEOFF]
Lloh29:
	ldr	w4, [x8]
	add	x6, x19, #24
	mov	x3, #0
	mov	x5, x19
	bl	_bus_setup_intr
	mov	x8, x0
	ldr	w0, [x19, #8]
	cbz	w8, LBB0_9
; %bb.3:
Lloh30:
	adrp	x1, l_.str.4@PAGE
Lloh31:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_6
LBB0_4:
	ldr	w0, [x19, #8]
Lloh32:
	adrp	x1, l_.str.2@PAGE
Lloh33:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_device_printf
	ldr	w0, [x19, #8]
	bl	_spi_detach
	b	LBB0_7
LBB0_5:
	ldr	w0, [x19, #8]
Lloh34:
	adrp	x1, l_.str.3@PAGE
Lloh35:
	add	x1, x1, l_.str.3@PAGEOFF
LBB0_6:
	bl	_device_printf
	ldr	w0, [x19, #8]
	bl	_device_detach
LBB0_7:
Lloh36:
	adrp	x8, _ENXIO@GOTPAGE
Lloh37:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh38:
	ldr	w0, [x8]
LBB0_8:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_9:
	bl	_ofw_bus_get_node
	mov	x21, x0
	ldr	x0, [x19, #16]
	bl	_nitems
	cmp	w0, #1
	b.lt	LBB0_16
; %bb.10:
	mov	x25, #0
	mov	x22, #0
Lloh39:
	adrp	x23, l_.str.5@PAGE
Lloh40:
	add	x23, x23, l_.str.5@PAGEOFF
Lloh41:
	adrp	x26, _GPIO_PIN_OUTPUT@GOTPAGE
Lloh42:
	ldr	x26, [x26, _GPIO_PIN_OUTPUT@GOTPAGEOFF]
Lloh43:
	adrp	x24, l_.str.6@PAGE
Lloh44:
	add	x24, x24, l_.str.6@PAGEOFF
	b	LBB0_13
LBB0_11:                                ;   in Loop: Header=BB0_13 Depth=1
	ldr	x8, [x19, #16]
	ldr	w0, [x8, x22, lsl #2]
	ldr	w1, [x26]
	bl	_gpio_pin_setflags
LBB0_12:                                ;   in Loop: Header=BB0_13 Depth=1
	add	x22, x22, #1
	ldr	x0, [x19, #16]
	bl	_nitems
	add	x25, x25, #4
	cmp	x22, w0, sxtw
	b.ge	LBB0_16
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x19, #8]
	ldr	x8, [x19, #16]
	add	x4, x8, x25
	mov	x1, x21
	mov	x2, x23
	mov	x3, x22
	bl	_gpio_pin_get_by_ofw_propidx
	cbz	w0, LBB0_11
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=1
	ldr	w8, [x19]
	cmp	w8, #2
	b.lt	LBB0_12
; %bb.15:                               ;   in Loop: Header=BB0_13 Depth=1
	ldr	w0, [x19, #8]
	str	x22, [sp]
	mov	x1, x24
	bl	_device_printf
	b	LBB0_12
LBB0_16:
Lloh45:
	adrp	x8, _ECSPI_CTLREG@GOTPAGE
Lloh46:
	ldr	x8, [x8, _ECSPI_CTLREG@GOTPAGEOFF]
Lloh47:
	ldr	w1, [x8]
Lloh48:
	adrp	x8, _CTLREG_CMODES_MASTER@GOTPAGE
Lloh49:
	ldr	x8, [x8, _CTLREG_CMODES_MASTER@GOTPAGEOFF]
Lloh50:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_WR4
Lloh51:
	adrp	x1, l_.str.7@PAGE
Lloh52:
	add	x1, x1, l_.str.7@PAGEOFF
	mov	x0, x20
	mov	w2, #-1
	bl	_device_add_child
	str	w0, [x19, #4]
Lloh53:
	adrp	x8, _bus_generic_attach@GOTPAGE
Lloh54:
	ldr	x8, [x8, _bus_generic_attach@GOTPAGEOFF]
Lloh55:
	ldr	w0, [x8]
	mov	x1, x20
	bl	_config_intrhook_oneshot
	mov	w0, #0
	b	LBB0_8
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpAdd	Lloh43, Lloh44
	.loh AdrpLdrGot	Lloh41, Lloh42
	.loh AdrpAdd	Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh53, Lloh54, Lloh55
	.loh AdrpAdd	Lloh51, Lloh52
	.loh AdrpLdrGotLdr	Lloh48, Lloh49, Lloh50
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.cfi_endproc
                                        ; -- End function
	.comm	_MTX_DEF,4,2                    ; @MTX_DEF
	.comm	_OID_AUTO,4,2                   ; @OID_AUTO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"debug"

	.comm	_CTLFLAG_RWTUN,4,2              ; @CTLFLAG_RWTUN
l_.str.1:                               ; @.str.1
	.asciz	"Enable debug, higher values = more info"

	.comm	_SYS_RES_MEMORY,4,2             ; @SYS_RES_MEMORY
	.comm	_RF_ACTIVE,4,2                  ; @RF_ACTIVE
l_.str.2:                               ; @.str.2
	.asciz	"could not allocate registers\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_SYS_RES_IRQ,4,2                ; @SYS_RES_IRQ
l_.str.3:                               ; @.str.3
	.asciz	"could not allocate interrupt\n"

	.comm	_INTR_TYPE_MISC,4,2             ; @INTR_TYPE_MISC
	.comm	_INTR_MPSAFE,4,2                ; @INTR_MPSAFE
	.comm	_spi_intr,4,2                   ; @spi_intr
l_.str.4:                               ; @.str.4
	.asciz	"could not setup interrupt handler"

l_.str.5:                               ; @.str.5
	.asciz	"cs-gpios"

	.comm	_GPIO_PIN_OUTPUT,4,2            ; @GPIO_PIN_OUTPUT
l_.str.6:                               ; @.str.6
	.asciz	"cannot configure gpio for chip select %u\n"

	.comm	_ECSPI_CTLREG,4,2               ; @ECSPI_CTLREG
	.comm	_CTLREG_CMODES_MASTER,4,2       ; @CTLREG_CMODES_MASTER
l_.str.7:                               ; @.str.7
	.asciz	"spibus"

	.comm	_bus_generic_attach,8,3         ; @bus_generic_attach
	.no_dead_strip	_spi_attach
.subsections_via_symbols
