Repository navigation
Expand file tree
/
Copy pathSSDT-O2SD.dsl
More file actions
140 lines (127 loc) · 5.02 KB
/
Copy pathSSDT-O2SD.dsl
File metadata and controls
140 lines (127 loc) · 5.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
* SSDT-O2SD: O2 Micro 8520 (FUJIN2) SD card reader cold-boot init for Hackintosh
*
* Replicates the PCI config-space init sequence from the Linux kernel driver
* drivers/mmc/host/sdhci-pci-o2micro.c so that CtlnaSDXC (spoofed BCM57765,
* pci14e4,16bc) can attach on cold boot. Without this, the reader only works
* after a warm reboot from Windows (Windows driver leaves the chip initialized).
*
* IMPORTANT: adjust the ACPI path below to YOUR machine.
* This path (\_SB.PCI0.RP11.PXSX) is for the Panasonic Let's Note CF-SV8.
* Find yours in Windows Device Manager -> device Properties -> Details ->
* "BIOS device name", or via `ioreg -p IODeviceTree` in macOS.
*
* License: GPL-2.0 (derived from the Linux kernel, copyright BayHub Technology Ltd.)
*/
DefinitionBlock ("", "SSDT", 2, "ACDT", "O2SD", 0x00001000)
{
External (\_SB.PCI0.RP11.PXSX, DeviceObj)
Scope (\_SB.PCI0.RP11.PXSX)
{
OperationRegion (PCIC, PCI_Config, Zero, 0x0400)
Field (PCIC, ByteAcc, NoLock, Preserve)
{
Offset (0xD3),
LKWP, 8 // O2_SD_LOCK_WP
}
Field (PCIC, DWordAcc, NoLock, Preserve)
{
Offset (0x64),
M5CT, 32, // O2_SD_MISC_REG5
LD0C, 32, // 0x68 O2_SD_LD0_CTRL
Offset (0x88),
DEVC, 32, // O2_SD_DEV_CTRL
Offset (0xD4),
TSTR, 32, // O2_SD_TEST_REG (dword access)
Offset (0xDC),
FRG0, 32, // O2_SD_FUNC_REG0
CAPS, 32, // 0xE0 O2_SD_CAPS
Offset (0xEC),
CLKR, 32, // O2_SD_CLKREQ
Offset (0xFC),
MC4_, 32, // O2_SD_MISC_CTRL4
Offset (0x300),
TUNC, 32, // O2_SD_TUNING_CTRL
PLLS, 32, // 0x304 O2_SD_PLL_SETTING
Offset (0x328),
CLKS, 32, // O2_SD_CLK_SETTING
Offset (0x330),
CAP2, 32, // O2_SD_CAP_REG2
CAP0, 32, // 0x334 O2_SD_CAP_REG0
Offset (0x350),
DELC, 32, // O2_SD_DELAY_CTRL
Offset (0x35C),
U2LC, 32, // O2_SD_UHS2_L1_CTRL
Offset (0x3E0),
FRG3, 32, // O2_SD_FUNC_REG3
FRG4, 32 // 0x3E4 O2_SD_FUNC_REG4
}
Method (O2IN, 0, NotSerialized)
{
// sdhci_pci_o2_probe: unlock write-protect
And (LKWP, 0x7F, LKWP)
// subtype check: top byte of FUNC_REG0
Store (FRG0, Local0)
ShiftRight (Local0, 24, Local0)
If (LOr (LEqual (Local0, 0x11), LEqual (Local0, 0x12)))
{
// subtype 0x11/0x12: set base clock, enable clk change, tuning window 4
And (PLLS, 0x0000FFFF, PLLS)
Or (PLLS, 0x25100000, PLLS)
Or (FRG4, 0x00400000, FRG4)
And (TUNC, 0xFFFFFF00, TUNC)
Or (TUNC, 0x44, TUNC)
}
Else
{
// o2_pci_led_enable: clear LEDOFF bit in FUNC_REG0
And (FRG0, 0xFFFFDFFF, FRG0)
// TEST_REG |= LED_ENABLE(0x40) | overcurrent protection(0x10)
Or (TSTR, 0x50, TSTR)
// set timeout CLK
And (CLKS, 0xFFFF00FF, CLKS)
Or (CLKS, 0x07E0C800, CLKS)
// CLKREQ |= 0x3
Or (CLKR, 0x03, CLKR)
// PLL setting
And (PLLS, 0xE0C0F8F1, PLLS)
Or (PLLS, 0x18270106, PLLS)
// disable UHS1 function
And (CAP2, 0xFFFFFF1F, CAP2)
// ---- sdhci_pci_o2_fujin2_pci_init ----
// improve write performance for SD3.0
And (DEVC, 0xFFFF8FFF, DEVC)
// enable link abnormal reset generating reset
And (M5CT, 0xFFF7F7FF, M5CT)
Or (M5CT, 0x0400, M5CT)
// output delay for SD mode
Store (0x2492, DELC)
// aux 1.2v LDO output voltage
And (LD0C, 0xFFFFCFFF, LD0C)
// max power supply capability of SD host
And (CAP0, 0xFFFFFE01, CAP0)
Or (CAP0, 0xCC, CAP0)
// DLL tuning window
And (TUNC, 0xFFFFFF00, TUNC)
Or (TUNC, 0x66, TUNC)
// UHS2 T_EIDLE
And (U2LC, 0xFFFFFF03, U2LC)
Or (U2LC, 0x84, U2LC)
// UHS2 termination
And (FRG3, 0xBFDFFFFF, FRG3)
// L1 entrance timer
And (CAPS, 0x0FFFFFFF, CAPS)
Or (CAPS, 0x30000000, CAPS)
// MISC_CTRL4
And (MC4_, 0xFFF0FFFF, MC4_)
Or (MC4_, 0x00080000, MC4_)
// lock write-protect
Or (LKWP, 0x80, LKWP)
}
}
Method (_INI, 0, NotSerialized)
{
O2IN ()
}
}
}