Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Documentation/PCI/controller/apple-t8140.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.. SPDX-License-Identifier: GPL-2.0-only

T8140/J700 experimental radio PCIe bootstrap
==========================================

The J700 path trains port 0, validates a bounded PIODMA bootstrap request,
and enables native ECAM for the MediaTek Wi-Fi and Bluetooth functions.
The root bridge forwards their BARs and DART translates endpoint DMA.

This is an opt-in bring-up implementation, not general T8140 PCIe support.
Build ``CONFIG_PCIE_APPLE_PIODMA_DIAG=y`` and pass
``pcie_apple_piodma_diag.enumerate=1`` to the kernel. Without the opt-in, the
root-only diagnostic path continues to reject downstream configuration access.
The option excludes suspend and kexec. Failed or uncertain bootstrap state
requires a full external hardware reset; there is no command retry.

The PIODMA arena remains allocated until external reset. Controller removal,
teardown, memory reuse and arbitrary downstream devices are unqualified.
Do not remove the controller or its IOMMU while this experiment is active.
These lifecycle contracts require further work before production support.

J700's ``wifi0`` alias and PCI endpoint node allow the public bootloader to
pass the unit's own Wi-Fi address through ``local-mac-address``. The zero
placeholder in the static device tree is not a usable station address.
1 change: 1 addition & 0 deletions Documentation/PCI/controller/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ PCI Native Host Bridge and Endpoint Drivers
:maxdepth: 2

rcar-pcie-firmware
apple-t8140
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/dma/apple,t8140-piodma-diagnostic.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Apple T8140 experimental PCIe PIODMA bootstrap engine

maintainers:
- Ace <Acelogic@users.noreply.github.com>

description: |
The J700 diagnostic driver uses this engine for a single retained request
before enabling native downstream ECAM access. It does not expose generic
DMA channels. This experimental binding describes that bounded bootstrap;
it does not establish an engine reset, removal or memory reuse contract.

properties:
compatible:
const: apple,t8140-piodma-diagnostic

reg:
items:
- description: Request engine
- description: Interrupt aggregator
- description: PCIe fabric interface

reg-names:
items:
- const: engine
- const: irq-aggregator
- const: fabric

interrupts:
maxItems: 1

power-domains:
maxItems: 1

iommus:
maxItems: 1

apple,pcie-host:
$ref: /schemas/types.yaml#/definitions/phandle
description: PCIe host controller whose ECAM access this engine primes.

required:
- compatible
- reg
- reg-names
- interrupts
- power-domains
- iommus
- apple,pcie-host

additionalProperties: false
68 changes: 55 additions & 13 deletions Documentation/devicetree/bindings/pci/apple,pcie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ properties:
- const: apple,t8122-pcie
- const: apple,t6020-pcie
- const: apple,t6020-pcie
- const: apple,t8140-pcie
- const: apple,t8103-pciec
- items:
- const: apple,t8112-pciec
Expand Down Expand Up @@ -86,6 +87,11 @@ properties:

dma-coherent: true

apple,piodma:
$ref: /schemas/types.yaml#/definitions/phandle
description:
T8140 PIODMA bootstrap engine used before native downstream ECAM access.

patternProperties:
"^pci@":
$ref: /schemas/pci/pci-bus.yaml#
Expand Down Expand Up @@ -125,6 +131,17 @@ unevaluatedProperties: false
allOf:
- $ref: /schemas/pci/pci-host-bridge.yaml#
- $ref: /schemas/interrupt-controller/msi-controller.yaml#
- if:
properties:
compatible:
contains:
const: apple,t8140-pcie
then:
properties:
apple,piodma: true
else:
properties:
apple,piodma: false
- if:
properties:
compatible:
Expand Down Expand Up @@ -180,21 +197,46 @@ allOf:
maxItems: 3
else:
properties:
reg-names:
minItems: 3
items:
- const: config
- const: rc
- const: port0
- const: port1
- const: port2
- const: port3
- const: phy0
- const: phy1
- const: phy2
- const: phy3
ranges:
maxItems: 2
allOf:
- if:
properties:
compatible:
contains:
const: apple,t8140-pcie
then:
properties:
reg:
minItems: 8
maxItems: 8
reg-names:
items:
- const: config
- const: rc
- const: port0
- const: port1
- const: port2
- const: phy0
- const: phy1
- const: phy2
interrupts:
maxItems: 3
else:
properties:
reg-names:
minItems: 3
items:
- const: config
- const: rc
- const: port0
- const: port1
- const: port2
- const: port3
- const: phy0
- const: phy1
- const: phy2
- const: phy3
patternProperties:
"^pci@":
required:
Expand Down
55 changes: 55 additions & 0 deletions arch/arm64/boot/dts/apple/t8140-j700.dts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
atcphy0 = &atcphy0;
keyboard = &keyboard;
serial0 = &serial0;
wifi0 = &wifi0;
};

chosen {
Expand Down Expand Up @@ -1349,3 +1350,57 @@

#include "hwmon-common.dtsi"
#include "hwmon-laptop.dtsi"

&pcie0 {
/* Experiment: guard stays closed until the retained bootstrap succeeds. */
apple,piodma = <&pcie0_piodma_diag>;
iommu-map = <0x100 &pcie0_dart 1 2>;
iommu-map-mask = <0xffff>;
pinctrl-0 = <&pcie0_clkreq>;
pinctrl-names = "default";
status = "okay";
};

&pcie0_port0 {
reset-gpios = <&pinctrl_ap 114 GPIO_ACTIVE_LOW>;
pwren-gpios = <&smc_gpio 8 GPIO_ACTIVE_HIGH>;
max-link-speed = <2>;
status = "okay";
};

&pinctrl_ap {
pcie0_clkreq: pcie0-clkreq {
pinmux = <APPLE_PINMUX(101, 2)>;
};
};

/* Experimental SID17 bootstrap; arena ownership lasts until full reset. */
&pcie0_dart {
status = "okay";
apple,dma-range = /bits/ 64 <0 0x1000000000>;
};

/ {
pcie0_piodma_diag: dma-controller@390030000 {
compatible = "apple,t8140-piodma-diagnostic";
reg = <0x3 0x90030000 0x0 0x4000>,
<0x3 0x90034000 0x0 0x4000>,
<0x3 0x90038000 0x0 0x4000>;
reg-names = "engine", "irq-aggregator", "fabric";
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 1207 IRQ_TYPE_LEVEL_HIGH>;
power-domains = <&ps_apcie_gp>;
iommus = <&pcie0_dart 17>;
apple,pcie-host = <&pcie0>;
};
};

&pcie0_port0 {
bus-range = <1 1>;
wifi0: wifi@0,0 {
compatible = "pci14c3,7932";
reg = <0x10000 0 0 0 0>;
/* Public m1n1 supplies this device's address at boot. */
local-mac-address = [00 00 00 00 00 00];
};
};
56 changes: 56 additions & 0 deletions arch/arm64/boot/dts/apple/t8140.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,62 @@
status = "disabled";
};

pcie0: pcie@1cb0000000 {
compatible = "apple,t8140-pcie";
device_type = "pci";
reg = <0x1c 0xb0000000 0x0 0x10000000>,
<0x3 0x94000000 0x0 0x4000>,
<0x3 0x90028000 0x0 0x8000>,
<0x3 0x91028000 0x0 0x8000>,
<0x3 0x92028000 0x0 0x8000>,
<0x3 0x97020000 0x0 0x4000>,
<0x3 0x97024000 0x0 0x4000>,
<0x3 0x97028000 0x0 0x4000>;
reg-names = "config", "rc", "port0", "port1", "port2",
"phy0", "phy1", "phy2";
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 1205 IRQ_TYPE_LEVEL_HIGH>,
<AIC_IRQ 1214 IRQ_TYPE_LEVEL_HIGH>,
<AIC_IRQ 1223 IRQ_TYPE_LEVEL_HIGH>;
msi-controller;
msi-parent = <&pcie0>;
/* Only port 0 is described; it owns the first 32 vectors. */
msi-ranges = <&aic AIC_IRQ 1331 IRQ_TYPE_EDGE_RISING 32>;
bus-range = <0 1>;
#address-cells = <3>;
#size-cells = <2>;
ranges = <0x43000000 0xb 0xc0000000 0xb 0xc0000000 0x0 0x20000000>,
<0x02000000 0x0 0x80000000 0xb 0x80000000 0x0 0x40000000>;
power-domains = <&ps_apcie_gp>;
status = "disabled";

pcie0_port0: pci@0,0 {
device_type = "pci";
reg = <0 0 0 0 0>;
#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 &pcie0_port0 0 0 0 0>,
<0 0 0 2 &pcie0_port0 0 0 0 1>,
<0 0 0 3 &pcie0_port0 0 0 0 2>,
<0 0 0 4 &pcie0_port0 0 0 0 3>;
status = "disabled";
};
};

pcie0_dart: iommu@390000000 {
compatible = "apple,t8140-dart", "apple,t8110-dart";
reg = <0x3 0x90000000 0x0 0x20000>;
#iommu-cells = <1>;
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 1206 IRQ_TYPE_LEVEL_HIGH>;
power-domains = <&ps_apcie_gp>;
status = "disabled";
};

dwc3_0: usb@40a280000 {
compatible = "apple,t8140-dwc3", "apple,t8103-dwc3";
reg = <0x4 0x0a280000 0x0 0xcd00>,
Expand Down
Loading