From 158344f2c7523051032337fd6a6cbf2b145a031a Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Thu, 19 Nov 2026 23:15:13 +1100 Subject: [PATCH] arm64: dts: apple: t6050: share the SD card reader, add it to J714c, J716c, J716s and J775d The SD card reader, a Genesys GL9755 on PCIe port 1 of apcie0 (ADT pci-bridge1/pcie-sdreader), was described only on the J714s and the K116s, each with its own copy of the port node. The 14- and 16-inch MacBook Pros and the Mac Studio all have an SDXC slot, and every T6050 board's ADT has the same reader: port 1, PERST# on GPIO 81, CLKREQ# on GPIO 77, card detect and write protect active high, power from the SMC pcIO template of function-sd_pwr_en (0x0, 0x190000), behind dart-apcie1. Only the GL9755's own settings differ between the laptops and the Studios, and no driver takes them. The port node and dart-apcie1's manual availability move to a new t6050-sdreader.dtsi. Each board gives what differs: - pcie0's port1, phy1 and intr2axi1 windows (apcie0 reg[22], reg[24], reg[25]), phy-shared (reg[3]) where the kernel trains the port, interrupt 1531 (apcie0 interrupts[1]) and the iommu-map entry for the port's bus on dart-apcie1, stream 1; - pin 81 opened in pinctrl_ap's gpio-reserved-ranges; - the reader's power, pwren-gpios on the board's SMC pcIO output for sd_pwr_en: output 0 on J714c (new list) and the J714s/K116s as before; output 3 on J716c, after its three outputs; - the J714s and K116s keep their pci-bridge1 link tunables. No other board has a booted ADT with those lists, so none is copied; the driver skips a list the tree does not have. On the J714c and J716c the boot loader leaves port 1 down and pcie-apple trains it, as on the J714s. The J716s cannot power the reader from the kernel: its SMC gpio node is the gP bank that carries the N1's power, so the pcIO node stays deleted, and port 1 and its DART are described disabled until a boot loader that powers and trains the port enables them. On the J775d the bus the kernel would number port 1 (2) is already port 3's, so the port and its DART are described disabled with the tree's bus 4 (bus-range now 0-4), as the J775c tree does: a boot loader that powers and trains port 1 enables both and renumbers the buses. J714s: the DTB is unchanged apart from phandle numbers. K116s: it now uses the die's dart-apcie1 node, as the J714s does, instead of the copy at the same address in t6050-peripherals.dtsi. J775c, J873s, K114c, K114s and K116c are unchanged. J775c and K114c have their own open changes for the reader. The port node is the one Diljit Singh wrote for the J714s and Jens Axboe carried to the K116s. Signed-off-by: Ryan Murray --- arch/arm64/boot/dts/apple/t6050-j714c.dts | 51 ++++++++--- arch/arm64/boot/dts/apple/t6050-j714s.dts | 77 ++++++----------- arch/arm64/boot/dts/apple/t6050-j716c.dts | 59 +++++++++---- arch/arm64/boot/dts/apple/t6050-j716s.dts | 53 +++++++++--- arch/arm64/boot/dts/apple/t6050-j775d.dts | 48 ++++++++--- arch/arm64/boot/dts/apple/t6050-k116s.dts | 86 ++++++------------- arch/arm64/boot/dts/apple/t6050-sdreader.dtsi | 66 ++++++++++++++ 7 files changed, 275 insertions(+), 165 deletions(-) create mode 100644 arch/arm64/boot/dts/apple/t6050-sdreader.dtsi diff --git a/arch/arm64/boot/dts/apple/t6050-j714c.dts b/arch/arm64/boot/dts/apple/t6050-j714c.dts index cf1d62c690fcc..deef1d350626d 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714c.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714c.dts @@ -50,20 +50,34 @@ * PHY and PERST; Linux owns the routing, MSI and the DART. Disabled with its DART * until the boot loader trains it, which also renumbers the bus here to the PCI * core's order. + * + * PCIe port 1: the SD card reader (t6050-sdreader.dtsi), as on J714s. From this + * board's ADT: port1, phy1 and intr2axi1 are apcie0 reg[22], reg[24] and + * reg[25], phy-shared reg[3], its interrupt 1531 (apcie0 interrupts[1]). The + * boot loader leaves the port down and the kernel trains it. */ &pcie0 { reg = <0x1c 0xb0000000 0x0 0x10000000>, <0x4 0x14000000 0x0 0x4000>, <0x4 0x10028000 0x0 0x8000>, <0x4 0x17010000 0x0 0x4000>, - <0x4 0x10024000 0x0 0x4000>; - reg-names = "config", "rc", "port0", "phy0", "intr2axi0"; - interrupts = ; - interrupt-names = "port0"; - - /* The N1's three functions are on DART streams 1-3 */ - iommu-map = <0x100 &dart_apcie0 1 3>; + <0x4 0x10024000 0x0 0x4000>, + <0x4 0x11028000 0x0 0x8000>, + <0x4 0x17014000 0x0 0x4000>, + <0x4 0x11024000 0x0 0x4000>, + <0x4 0x17020000 0x0 0x4000>; + reg-names = "config", "rc", "port0", "phy0", "intr2axi0", "port1", "phy1", "intr2axi1", + "phy-shared"; + interrupts = , + ; + interrupt-names = "port0", "port1"; + + /* The N1's three functions are on DART streams 1-3, the SD reader on stream 1 */ + iommu-map = <0x100 &dart_apcie0 1 3>, + <0x200 &dart_apcie1 1 1>; bus-range = <0 4>; + /* dart_apcie1 probes only once port 1 is up: the host must not wait for it */ + post-init-providers = <&dart_apcie1>; port00: pci@0,0 { device_type = "pci"; @@ -109,6 +123,13 @@ }; }; +#include "t6050-sdreader.dtsi" + +/* The SD reader's power: SMC pcIO output 0 below (ADT pcie-sdreader function-sd_pwr_en) */ +&port01 { + pwren-gpios = <&smc_pcio 0 GPIO_ACTIVE_HIGH>; +}; + /* ATC3 and the PD controller bus nub-spmi-a2: not on this board's ports */ &nub_spmi_a2 { status = "disabled"; @@ -200,11 +221,21 @@ /* * Only the pins a node here names are exposed, as on the J716c: pin 112's register - * takes an SError when read. 80 is PCIe port 0's PERST#, 106 the amps' fault interrupt and - * 107 their shutdown line. + * takes an SError when read. 80 and 81 are PCIe ports 0 and 1's PERST#, 106 the amps' + * fault interrupt and 107 their shutdown line. */ &pinctrl_ap { - gpio-reserved-ranges = <0 80>, <81 25>, <108 113>; + gpio-reserved-ranges = <0 80>, <82 24>, <108 113>; +}; + +/* + * The one SMC pcIO output this board drives, as a pKW8('pcIO', lo, hi) template + * written (hi << 32) | lo with the level in the low bits: + * 0 sd_pwr_en (0x0, 0x190000): ADT pcie-sdreader function-sd_pwr_en, the SD + * reader's power on PCIe port 1 + */ +&smc_pcio { + apple,output-commands = /bits/ 64 <0x0019000000000000>; }; /* This board's SMC fan and power keys are not yet checked */ diff --git a/arch/arm64/boot/dts/apple/t6050-j714s.dts b/arch/arm64/boot/dts/apple/t6050-j714s.dts index 383ec08bedbe2..08f46425c62cb 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714s.dts @@ -146,54 +146,31 @@ local-bd-address = [00 00 00 00 00 00]; }; }; +}; - port01: pci@1,0 { - device_type = "pci"; - reg = <0x800 0 0 0 0>; - bus-range = <2 2>; - /* Down at boot: the kernel trains it, powering the reader first */ - apple,link-trained-by-bootloader; - pwren-gpios = <&smc_pcio 0 GPIO_ACTIVE_HIGH>; - /* PERST#: ADT pci-bridge1 function-perst, GPIO 81 */ - reset-gpios = <&pinctrl_ap 81 GPIO_ACTIVE_LOW>; - apple,apcie-config-tunables = <0x140 4 0x1 0x1>, - <0x144 4 0xffffff 0x253770>, - <0x8a8 4 0x1 0x1>, - <0x8ac 4 0x1 0x1>; - apple,pcie-rc-tunables = <0x78 4 0x7000 0x0>, - <0x194 4 0x2 0x2>, - <0xb80 4 0x7f3f3f 0x7f1e1e>, - <0xb88 4 0x7f3f3f 0x7f1e1e>; - apple,pcie-rc-gen3-shadow-tunables = <0x154 4 0xf0f0f0f 0x5050505>, - <0x890 4 0x3000000 0x0>, - <0x8a8 4 0xffff0f 0x1>; - apple,pcie-rc-gen4-shadow-tunables = <0x178 4 0xffff 0x5555>, - <0x890 4 0x3000000 0x1000000>, - <0x8a8 4 0xffff0f 0x1>; - apple,pcie-rc-gen5-shadow-tunables = <0x1ac 4 0xffff 0x5555>, - <0x890 4 0x3000000 0x2000000>, - <0x8a8 4 0xffff0f 0x1>; - - #address-cells = <3>; - #size-cells = <2>; - ranges; - - interrupt-controller; - #interrupt-cells = <1>; - interrupt-map-mask = <0 0 0 7>; - interrupt-map = <0 0 0 1 &port01 0 0 0 0>, - <0 0 0 2 &port01 0 0 0 1>, - <0 0 0 3 &port01 0 0 0 2>, - <0 0 0 4 &port01 0 0 0 3>; - - /* The GL9755; card detect and write protect active high (ADT *-polarity = 1) */ - sdhci0: mmc@0,0 { - compatible = "pci17a0,9755"; - reg = <0x20000 0x0 0x0 0x0 0x0>; - cd-inverted; - wp-inverted; - }; - }; +#include "t6050-sdreader.dtsi" + +&port01 { + /* Down at boot: the kernel trains it, powering the reader first */ + pwren-gpios = <&smc_pcio 0 GPIO_ACTIVE_HIGH>; + /* pci-bridge1's link tunables */ + apple,apcie-config-tunables = <0x140 4 0x1 0x1>, + <0x144 4 0xffffff 0x253770>, + <0x8a8 4 0x1 0x1>, + <0x8ac 4 0x1 0x1>; + apple,pcie-rc-tunables = <0x78 4 0x7000 0x0>, + <0x194 4 0x2 0x2>, + <0xb80 4 0x7f3f3f 0x7f1e1e>, + <0xb88 4 0x7f3f3f 0x7f1e1e>; + apple,pcie-rc-gen3-shadow-tunables = <0x154 4 0xf0f0f0f 0x5050505>, + <0x890 4 0x3000000 0x0>, + <0x8a8 4 0xffff0f 0x1>; + apple,pcie-rc-gen4-shadow-tunables = <0x178 4 0xffff 0x5555>, + <0x890 4 0x3000000 0x1000000>, + <0x8a8 4 0xffff0f 0x1>; + apple,pcie-rc-gen5-shadow-tunables = <0x1ac 4 0xffff 0x5555>, + <0x890 4 0x3000000 0x2000000>, + <0x8a8 4 0xffff0f 0x1>; }; /* @@ -207,12 +184,6 @@ gpio-reserved-ranges = <0 80>, <82 24>, <108 26>, <135 1>, <140 81>; }; -/* It answers only once port 1's root complex is up: pcie-apple then enables it */ -&dart_apcie1 { - apple,manual-availability; - status = "okay"; -}; - /* The keyboard backlight: ADT pwm0/kbd-backlight, channel 0 at 25 kHz */ / { aliases { diff --git a/arch/arm64/boot/dts/apple/t6050-j716c.dts b/arch/arm64/boot/dts/apple/t6050-j716c.dts index 8fdea5242027b..27b2ca73571d6 100644 --- a/arch/arm64/boot/dts/apple/t6050-j716c.dts +++ b/arch/arm64/boot/dts/apple/t6050-j716c.dts @@ -54,24 +54,38 @@ /* * PCIe port 0: the N1 (Wi-Fi and Bluetooth), the only GP port this board uses besides the SD - * reader on port 1 (not yet described). The boot loader trains the link after the SMC releases - * the N1's reset and keeps power, clocks, the PHY and PERST; Linux owns the routing, MSI and - * the DART. Disabled with its DART until the boot loader trains it, which also renumbers the - * bus here to the PCI core's order. + * reader on port 1. The boot loader trains the link after the SMC releases the N1's reset and + * keeps power, clocks, the PHY and PERST; Linux owns the routing, MSI and the DART. Disabled + * with its DART until the boot loader trains it, which also renumbers the bus here to the PCI + * core's order. + * + * PCIe port 1: the SD card reader (t6050-sdreader.dtsi), as on J714s. From this board's ADT: + * port1, phy1 and intr2axi1 are apcie0 reg[22], reg[24] and reg[25], phy-shared reg[3], its + * interrupt 1531 (apcie0 interrupts[1]). The boot loader leaves the port down and the kernel + * trains it. */ &pcie0 { reg = <0x1c 0xb0000000 0x0 0x10000000>, <0x4 0x14000000 0x0 0x4000>, <0x4 0x10028000 0x0 0x8000>, <0x4 0x17010000 0x0 0x4000>, - <0x4 0x10024000 0x0 0x4000>; - reg-names = "config", "rc", "port0", "phy0", "intr2axi0"; - interrupts = ; - interrupt-names = "port0"; - - /* The N1's three functions are on DART streams 1-3 */ - iommu-map = <0x100 &dart_apcie0 1 3>; + <0x4 0x10024000 0x0 0x4000>, + <0x4 0x11028000 0x0 0x8000>, + <0x4 0x17014000 0x0 0x4000>, + <0x4 0x11024000 0x0 0x4000>, + <0x4 0x17020000 0x0 0x4000>; + reg-names = "config", "rc", "port0", "phy0", "intr2axi0", "port1", "phy1", "intr2axi1", + "phy-shared"; + interrupts = , + ; + interrupt-names = "port0", "port1"; + + /* The N1's three functions are on DART streams 1-3, the SD reader on stream 1 */ + iommu-map = <0x100 &dart_apcie0 1 3>, + <0x200 &dart_apcie1 1 1>; bus-range = <0 4>; + /* dart_apcie1 probes only once port 1 is up: the host must not wait for it */ + post-init-providers = <&dart_apcie1>; port00: pci@0,0 { device_type = "pci"; @@ -176,11 +190,12 @@ /* * Pin 112's register (0x29c0001c0) takes an SError when read, so only the pins a node - * here names are exposed: 80 (PCIe port 0's PERST#, ADT pci-bridge0 function-perst). - * A reserved line cannot be requested, so a node that names a new pin opens it here too. + * here names are exposed: 80 and 81 (PCIe ports 0 and 1's PERST#, ADT pci-bridge0 and + * pci-bridge1 function-perst). A reserved line cannot be requested, so a node that names + * a new pin opens it here too. */ &pinctrl_ap { - gpio-reserved-ranges = <0 80>, <81 140>; + gpio-reserved-ranges = <0 80>, <82 139>; }; /* This board's SMC fan and power keys are not yet checked */ @@ -226,13 +241,25 @@ }; }; -/* This board's PCIO outputs, the trackpad AFE reset (2) among them */ +/* + * This board's PCIO outputs, the trackpad AFE reset (2) among them, and the SD reader's + * power (3), sd_pwr_en pKW8('pcIO', 0x0, 0x190000) + */ &smc_pcio { - apple,output-commands = /bits/ 64 <0x001a000000000000 0x000f000000800000 0x011c000000010000>; + apple,output-commands = /bits/ 64 <0x001a000000000000 0x000f000000800000 0x011c000000010000 + 0x0019000000000000>; }; #include "t6050-peripherals.dtsi" +/* After the peripherals, which describe dart-apcie1 (disabled) at the same node */ +#include "t6050-sdreader.dtsi" + +/* The SD reader's power: SMC pcIO output 3 above (ADT pcie-sdreader function-sd_pwr_en) */ +&port01 { + pwren-gpios = <&smc_pcio 3 GPIO_ACTIVE_HIGH>; +}; + #include "t6050-max-atc2.dtsi" /* This unit's host DROM (router UUID from an earlier boot) */ diff --git a/arch/arm64/boot/dts/apple/t6050-j716s.dts b/arch/arm64/boot/dts/apple/t6050-j716s.dts index 43747a4ce6be7..f457157f547e5 100644 --- a/arch/arm64/boot/dts/apple/t6050-j716s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j716s.dts @@ -81,8 +81,7 @@ }; /* - * PCIe port 0: the N1 (Wi-Fi and Bluetooth). Port 1 is the SD reader, not yet - * described. The registers, interrupt, DART streams and PERST# pin are the + * PCIe port 0: the N1 (Wi-Fi and Bluetooth). The registers, interrupt, DART streams and PERST# pin are the * J716c's: the J716s ADT has the same port. Port 0 and its DART stay disabled * until the boot loader enables them: once it trained the port, or with the * port down because the kernel can train it (port00 names the N1's power @@ -92,6 +91,14 @@ * (reg[5]), pcieclkgen (reg[6]), phy-window (reg[2]) and phy-ip (reg[4]), * the same as the J714c's; the PHY and axi2af windows are cut to what their * lists reach. + * + * PCIe port 1: the SD card reader (t6050-sdreader.dtsi), as on J714s. From this + * board's ADT: port1, phy1 and intr2axi1 are apcie0 reg[22], reg[24] and + * reg[25], its interrupt 1531 (apcie0 interrupts[1]). The reader's power is + * the SMC pcIO output of the ADT's function-sd_pwr_en, but this board's SMC + * gpio node is the gP bank (the N1's power, below), so the kernel cannot + * drive it and does not train the port. Port 1 and its DART stay disabled + * until a boot loader that powers and trains the port enables both. */ &pcie0 { reg = <0x1c 0xb0000000 0x0 0x10000000>, @@ -104,21 +111,27 @@ <0x4 0x16000000 0x0 0x24000>, <0x4 0x15044000 0x0 0x4000>, <0x4 0x17000000 0x0 0x24000>, - <0x4 0x17800000 0x0 0x1b4000>; + <0x4 0x17800000 0x0 0x1b4000>, + <0x4 0x11028000 0x0 0x8000>, + <0x4 0x17014000 0x0 0x4000>, + <0x4 0x11024000 0x0 0x4000>; reg-names = "config", "rc", "port0", "phy0", "intr2axi0", "phy-shared", "phy-common", "axi2af", "pcieclkgen", - "phy-window", "phy-ip"; - interrupts = ; - interrupt-names = "port0"; - - /* The N1's three functions are on DART streams 1-3 */ - iommu-map = <0x100 &dart_apcie0 1 3>; + "phy-window", "phy-ip", "port1", "phy1", "intr2axi1"; + interrupts = , + ; + interrupt-names = "port0", "port1"; + + /* The N1's three functions are on DART streams 1-3, the SD reader on stream 1 */ + iommu-map = <0x100 &dart_apcie0 1 3>, + <0x200 &dart_apcie1 1 1>; bus-range = <0 4>; /* - * dart_apcie0 probes only once this host has the port up: fw_devlink - * must not make the host wait for it (strict mode enforces iommu-map) + * dart_apcie0 and dart_apcie1 probe only once this host has their port + * up: fw_devlink must not make the host wait for them (strict mode + * enforces iommu-map) */ - post-init-providers = <&dart_apcie0>; + post-init-providers = <&dart_apcie0>, <&dart_apcie1>; port00: pci@0,0 { device_type = "pci"; @@ -166,6 +179,17 @@ }; }; +#include "t6050-sdreader.dtsi" + +/* Down at boot: a boot loader that powers and trains port 1 enables both */ +&port01 { + status = "disabled"; +}; + +&dart_apcie1 { + status = "disabled"; +}; + /* It answers only once port 0's root complex is up: pcie-apple then enables it */ &dart_apcie0 { apple,manual-availability; @@ -178,6 +202,7 @@ * 0 dp2hdmi_pwr_en (0x0, 0x1a0000) * 1 hdmi_pwr_en (0x800000, 0xf0000) * 2 afe-reset (0x10000, 0x11c0000) + * and the SD reader's sd_pwr_en (0x0, 0x190000). */ /delete-node/ &smc_pcio; @@ -456,10 +481,10 @@ /* * Pin 112 takes an SError when read (as on the J716c), so only the pins a node - * here names are exposed: 80 (PCIe port 0's PERST#). + * here names are exposed: 80 and 81 (PCIe ports 0 and 1's PERST#). */ &pinctrl_ap { - gpio-reserved-ranges = <0 80>, <81 140>; + gpio-reserved-ranges = <0 80>, <82 139>; }; /* diff --git a/arch/arm64/boot/dts/apple/t6050-j775d.dts b/arch/arm64/boot/dts/apple/t6050-j775d.dts index 68b4c324aca02..f76747e033067 100644 --- a/arch/arm64/boot/dts/apple/t6050-j775d.dts +++ b/arch/arm64/boot/dts/apple/t6050-j775d.dts @@ -92,6 +92,12 @@ * * Port 0 carries the N1 (Wi-Fi and Bluetooth), described disabled until the boot loader trains * it (pci@0,0 below). + * + * Port 1 carries the SD card reader (t6050-sdreader.dtsi), as on the MacBook Pros. From this + * board's ADT: port1, phy1 and intr2axi1 are apcie0 reg[22], reg[24] and reg[25], its interrupt + * 1531 (apcie0 interrupts[1]). The kernel does not train it here: the bus it would number the + * port is port 3's. Like port 0, it stays disabled with its DART until a boot loader that powers + * and trains it enables both and renumbers the buses. */ &pcie0 { reg = <0x1c 0xb0000000 0x0 0x10000000>, @@ -104,25 +110,31 @@ <0x4 0x13024000 0x0 0x4000>, <0x4 0x10028000 0x0 0x8000>, <0x4 0x17010000 0x0 0x4000>, - <0x4 0x10024000 0x0 0x4000>; + <0x4 0x10024000 0x0 0x4000>, + <0x4 0x11028000 0x0 0x8000>, + <0x4 0x17014000 0x0 0x4000>, + <0x4 0x11024000 0x0 0x4000>; reg-names = "config", "rc", "port2", "phy2", "intr2axi2", "port3", "phy3", "intr2axi3", - "port0", "phy0", "intr2axi0"; + "port0", "phy0", "intr2axi0", + "port1", "phy1", "intr2axi1"; interrupts = , , - ; - interrupt-names = "port2", "port3", "port0"; + , + ; + interrupt-names = "port2", "port3", "port0", "port1"; /* * The boot loader numbers port 2's secondary bus 1 and port 3's 2; - * port 0's is 3 until a boot loader that trains it renumbers all three - * in the PCI core's order. The N1's three functions are on DART - * streams 1-3. + * port 0's is 3 and port 1's 4 until a boot loader that trains them + * renumbers all four in the PCI core's order. The N1's three functions + * are on DART streams 1-3, the SD reader on stream 1. */ iommu-map = <0x100 &dart_apcie2 1 1>, <0x200 &dart_apcie3 1 1>, - <0x300 &dart_apcie0 1 3>; - bus-range = <0 3>; + <0x300 &dart_apcie0 1 3>, + <0x400 &dart_apcie1 1 1>; + bus-range = <0 4>; port02: pci@2,0 { device_type = "pci"; @@ -226,17 +238,29 @@ }; }; +#define T6050_SDREADER_BUS 4 +#include "t6050-sdreader.dtsi" + +/* Down at boot: a boot loader that powers and trains port 1 enables both */ +&port01 { + status = "disabled"; +}; + +&dart_apcie1 { + status = "disabled"; +}; + /* The pins this board's nodes name, and no others */ &pinctrl_ap { /* * Every pin reads cleanly, but only - * the pins a node in this file names are exposed: 80 (PCIe port 0's PERST#, ADT - * pci-bridge0 function-perst), 106 (amp IRQ), 107 (amp shutdown), 134 (jack IRQ) + * the pins a node in this file names are exposed: 80 and 81 (PCIe ports 0 and 1's + * PERST#, ADT pci-bridge0 and pci-bridge1 function-perst), 106 (amp IRQ), 107 (amp shutdown), 134 (jack IRQ) * and 139 (jack codec reset), from the ADT's audio-speaker and audio-codec-output. * A reserved line cannot be requested (gpiolib answers -EINVAL), so a node that * names a new pin of pinctrl_ap opens it here too. */ - gpio-reserved-ranges = <0 80>, <81 25>, <108 26>, <135 4>, <140 81>; + gpio-reserved-ranges = <0 80>, <82 24>, <108 26>, <135 4>, <140 81>; }; &i2c1 { diff --git a/arch/arm64/boot/dts/apple/t6050-k116s.dts b/arch/arm64/boot/dts/apple/t6050-k116s.dts index fe6468edc72c1..652fb373af930 100644 --- a/arch/arm64/boot/dts/apple/t6050-k116s.dts +++ b/arch/arm64/boot/dts/apple/t6050-k116s.dts @@ -84,10 +84,10 @@ ; interrupt-names = "port0", "port1"; iommu-map = <0x100 &dart_apcie0 1 3>, - <0x200 &apcie1_dart 1 1>; + <0x200 &dart_apcie1 1 1>; bus-range = <0 4>; - /* apcie1_dart probes only once port 1 is up: the host must not wait for it */ - post-init-providers = <&apcie1_dart>; + /* dart_apcie1 probes only once port 1 is up: the host must not wait for it */ + post-init-providers = <&dart_apcie1>; status = "okay"; port00: pci@0,0 { @@ -131,65 +131,31 @@ local-bd-address = [00 00 00 00 00 00]; }; }; - - port01: pci@1,0 { - device_type = "pci"; - reg = <0x800 0 0 0 0>; - bus-range = <2 2>; - /* Down at boot: the kernel trains it, powering the reader first */ - apple,link-trained-by-bootloader; - /* ADT pcie-sdreader function-sd_pwr_en: SMC pcIO output 0 below */ - pwren-gpios = <&smc_pcio 0 GPIO_ACTIVE_HIGH>; - /* PERST#: ADT pci-bridge1 function-perst, GPIO 81 */ - reset-gpios = <&pinctrl_ap 81 GPIO_ACTIVE_LOW>; - /* ADT pci-bridge1 */ - apple,apcie-config-tunables = <0x140 4 0x1 0x1>, - <0x144 4 0xffffff 0x253770>, - <0x8a8 4 0x1 0x1>, - <0x8ac 4 0x1 0x1>; - apple,pcie-rc-tunables = <0x78 4 0x7000 0x0>, - <0x194 4 0x2 0x2>, - <0xb80 4 0x7f3f3f 0x7f1e1e>, - <0xb88 4 0x7f3f3f 0x7f1e1e>; - apple,pcie-rc-gen3-shadow-tunables = <0x154 4 0xf0f0f0f 0x5050505>, - <0x890 4 0x3000000 0x0>, - <0x8a8 4 0xffff0f 0x1>; - apple,pcie-rc-gen4-shadow-tunables = <0x178 4 0xffff 0x5555>, - <0x890 4 0x3000000 0x1000000>, - <0x8a8 4 0xffff0f 0x1>; - apple,pcie-rc-gen5-shadow-tunables = <0x1ac 4 0xffff 0x5555>, - <0x890 4 0x3000000 0x2000000>, - <0x8a8 4 0xffff0f 0x1>; - - #address-cells = <3>; - #size-cells = <2>; - ranges; - - interrupt-controller; - #interrupt-cells = <1>; - interrupt-map-mask = <0 0 0 7>; - interrupt-map = <0 0 0 1 &port01 0 0 0 0>, - <0 0 0 2 &port01 0 0 0 1>, - <0 0 0 3 &port01 0 0 0 2>, - <0 0 0 4 &port01 0 0 0 3>; - - /* - * The GL9755. Card detect and write protect are active high: ADT - * pcie-sdreader card-detect-polarity and write-protect-polarity = 1. - */ - sdhci0: mmc@0,0 { - compatible = "pci17a0,9755"; - reg = <0x20000 0x0 0x0 0x0 0x0>; - cd-inverted; - wp-inverted; - }; - }; }; -/* ADT dart-apcie1 manual-availability: pcie-apple enables it once port 1 is up */ -&apcie1_dart { - apple,manual-availability; - status = "okay"; +#include "t6050-sdreader.dtsi" + +&port01 { + /* Down at boot: the kernel trains it, powering the reader first */ + pwren-gpios = <&smc_pcio 0 GPIO_ACTIVE_HIGH>; + /* ADT pci-bridge1 */ + apple,apcie-config-tunables = <0x140 4 0x1 0x1>, + <0x144 4 0xffffff 0x253770>, + <0x8a8 4 0x1 0x1>, + <0x8ac 4 0x1 0x1>; + apple,pcie-rc-tunables = <0x78 4 0x7000 0x0>, + <0x194 4 0x2 0x2>, + <0xb80 4 0x7f3f3f 0x7f1e1e>, + <0xb88 4 0x7f3f3f 0x7f1e1e>; + apple,pcie-rc-gen3-shadow-tunables = <0x154 4 0xf0f0f0f 0x5050505>, + <0x890 4 0x3000000 0x0>, + <0x8a8 4 0xffff0f 0x1>; + apple,pcie-rc-gen4-shadow-tunables = <0x178 4 0xffff 0x5555>, + <0x890 4 0x3000000 0x1000000>, + <0x8a8 4 0xffff0f 0x1>; + apple,pcie-rc-gen5-shadow-tunables = <0x1ac 4 0xffff 0x5555>, + <0x890 4 0x3000000 0x2000000>, + <0x8a8 4 0xffff0f 0x1>; }; /* diff --git a/arch/arm64/boot/dts/apple/t6050-sdreader.dtsi b/arch/arm64/boot/dts/apple/t6050-sdreader.dtsi new file mode 100644 index 0000000000000..77dd12431fe08 --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6050-sdreader.dtsi @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * The SD card reader of the T6050 MacBook Pros and Mac Studios: a Genesys + * GL9755 on PCIe port 1 of apcie0 (ADT pci-bridge1/pcie-sdreader). Every + * board's ADT gives it the same shape: PERST# is pci-bridge1's function-perst, + * GPIO 81; card detect and write protect are active high (card-detect-polarity + * and write-protect-polarity = 1); its power is the SMC pcIO template of + * function-sd_pwr_en, pKW8('pcIO', 0x0, 0x190000); it is behind dart-apcie1, + * which answers only once the root complex is up. mapper-apcie1 names no + * stream (the bridge requests one at run time), so the reader gets stream 1, + * below the DART's first bypass stream (16). pci-bridge1's function-clkreq + * (GPIO 77) is not described: the driver does not take CLKREQ# lines. + * + * The board includes this after its &pcie0 and gives what differs: + * - pcie0's "port1", "phy1", "intr2axi1" and "phy-shared" registers (apcie0 + * reg[22], reg[24], reg[25] and reg[3]), interrupt 1531 (apcie0 + * interrupts[1]) and an iommu-map entry for the port's bus on dart_apcie1, + * stream 1; + * - T6050_SDREADER_BUS, the port's secondary bus in this tree, if it is not 2; + * - pin 81 open in pinctrl_ap's gpio-reserved-ranges; + * - how the link comes up. On the MacBook Pros the boot loader leaves port 1 + * down and the kernel trains it: the board gives port01 the reader's power, + * pwren-gpios on its SMC pcIO output for sd_pwr_en. Where the boot loader + * trains the port, port01 and dart_apcie1 stay disabled until it does. + */ + +#ifndef T6050_SDREADER_BUS +#define T6050_SDREADER_BUS 2 +#endif + +&pcie0 { + port01: pci@1,0 { + device_type = "pci"; + reg = <0x800 0 0 0 0>; + bus-range = ; + apple,link-trained-by-bootloader; + /* PERST#: ADT pci-bridge1 function-perst, GPIO 81 */ + reset-gpios = <&pinctrl_ap 81 GPIO_ACTIVE_LOW>; + + #address-cells = <3>; + #size-cells = <2>; + ranges; + + interrupt-controller; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <0 0 0 1 &port01 0 0 0 0>, + <0 0 0 2 &port01 0 0 0 1>, + <0 0 0 3 &port01 0 0 0 2>, + <0 0 0 4 &port01 0 0 0 3>; + + /* The GL9755; card detect and write protect active high */ + sdhci0: mmc@0,0 { + compatible = "pci17a0,9755"; + reg = <(T6050_SDREADER_BUS << 16) 0x0 0x0 0x0 0x0>; + cd-inverted; + wp-inverted; + }; + }; +}; + +/* It answers only once port 1's root complex is up: pcie-apple then enables it */ +&dart_apcie1 { + apple,manual-availability; + status = "okay"; +};