Skip to content
Closed
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
101 changes: 83 additions & 18 deletions Documentation/devicetree/bindings/phy/apple,t6040-atcphy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ maintainers:

description: >
The Type-C PHY of the Apple T6040 (M4 Pro) SoC, as used for USB2 and USB3
host operation. USB3 is brought up by a PHY coprocessor running RTKit
firmware, reached through an ASC mailbox. The PHY also provides the reset
line of the attached DWC3 controller and acts as the Type-C orientation
switch.
host operation and for DisplayPort. USB3 is brought up by a PHY coprocessor
running RTKit firmware, reached through an ASC mailbox. The PHY also
provides the reset line of the attached DWC3 controller and acts as the
Type-C orientation switch and, where the port carries DisplayPort alt mode,
as its mode switch. The same PHY drives the fixed DisplayPort link of an
HDMI converter; that instance has no USB controller behind it and therefore
no PIPE interface.

$defs:
apple,tunable:
Expand All @@ -35,6 +38,7 @@ properties:
const: apple,t6040-atcphy

reg:
minItems: 10
items:
- description: USB2 PHY controls
- description: USB2 event counter controls
Expand All @@ -49,21 +53,37 @@ properties:
- description: ATC common configuration controls

reg-names:
items:
- const: bank0
- const: bank1
- const: pipehandler
- const: core
- const: cfg
- const: cpu
- const: cpu-data
- const: axi2af
- const: axi2af-lioa
- const: fabric
- const: common-cfg
oneOf:
- items:
- const: bank0
- const: bank1
- const: pipehandler
- const: core
- const: cfg
- const: cpu
- const: cpu-data
- const: axi2af
- const: axi2af-lioa
- const: fabric
- const: common-cfg
- description: A fixed DisplayPort PHY without a USB controller
items:
- const: bank0
- const: bank1
- const: core
- const: cfg
- const: cpu
- const: cpu-data
- const: axi2af
- const: axi2af-lioa
- const: fabric
- const: common-cfg

"#phy-cells":
const: 1
description: >
The PHY type (dt-bindings/phy/phy.h): PHY_TYPE_USB2, PHY_TYPE_USB3 or
PHY_TYPE_DP.

"#reset-cells":
const: 0
Expand All @@ -81,9 +101,13 @@ properties:

orientation-switch: true

mode-switch: true

port:
$ref: /schemas/graph.yaml#/properties/port
description: Link to the SuperSpeed lanes of the Type-C connector.
description: >
Link to the SuperSpeed lanes of the Type-C connector. Absent on a fixed
DisplayPort PHY.

apple,tunable-axi2af:
$ref: "#/$defs/apple,tunable"
Expand Down Expand Up @@ -134,9 +158,24 @@ required:
- reg
- reg-names
- "#phy-cells"
- "#reset-cells"
- power-domains

allOf:
- if:
properties:
reg-names:
contains:
const: pipehandler
then:
required:
- "#reset-cells"
else:
properties:
"#reset-cells": false
orientation-switch: false
mode-switch: false
port: false

additionalProperties: false

examples:
Expand Down Expand Up @@ -170,4 +209,30 @@ examples:
orientation-switch;
};
};
- |
soc {
#address-cells = <2>;
#size-cells = <2>;

phy@39aa90000 {
compatible = "apple,t6040-atcphy";
reg = <0x3 0x9aa90000 0x0 0x4000>,
<0x3 0x9a800000 0x0 0x4000>,
<0x3 0x9b000000 0x0 0x30000>,
<0x3 0x9b200000 0x0 0x4000>,
<0x3 0x9b140000 0x0 0x4000>,
<0x3 0x9b0c0000 0x0 0x10000>,
<0x3 0x98000000 0x0 0x8000>,
<0x3 0x98020000 0x0 0x4000>,
<0x3 0x9b244000 0x0 0x4000>,
<0x3 0x9b250000 0x0 0x4000>;
reg-names = "bank0", "bank1", "core", "cfg", "cpu", "cpu-data",
"axi2af", "axi2af-lioa", "fabric", "common-cfg";
#phy-cells = <1>;
power-domains = <&ps_atc3_common_dp>;
mboxes = <&atcphy3_mbox>;
mbox-names = "phy-cpu";
nonposted-mmio;
};
};
...
3 changes: 3 additions & 0 deletions drivers/gpu/drm/apple/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ config DRM_APPLE
depends on ARCH_APPLE || COMPILE_TEST
depends on APPLE_RTKIT
depends on TYPEC || !TYPEC
depends on PHY_APPLE_T6040_USB2 || !PHY_APPLE_T6040_USB2
depends on OF_ADDRESS
select APPLE_PMP_REPORT
select OF_DYNAMIC
Expand All @@ -14,6 +15,8 @@ config DRM_APPLE
select DRM_GEM_SHMEM_HELPER
select DRM_GEM_DMA_HELPER
select VIDEOMODE_HELPERS
# write-combined maps of firmware-placed carveouts (desktop 26.x)
select VMAP_PFN
depends on BACKLIGHT_CLASS_DEVICE
select MULTIPLEXER
select DRM_APPLE_FABRIC_CORE
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/apple/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ appledrm-y += dcpext_drm.o
appledrm-y += iomfb_v12_3.o
appledrm-y += iomfb_v13_3.o
appledrm-y += iomfb_v14_7_tpl.o
appledrm-y += iomfb_v26_6_desktop.o
appledrm-y += iomfb_v14_7.o iomfb_v14_7_link.o
appledrm-$(CONFIG_DRM_APPLE_DCP_T8132) += iomfb_m4.o
appledrm-y += iomfb_h17p.o
Expand Down
44 changes: 44 additions & 0 deletions drivers/gpu/drm/apple/afk-fragment.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
#ifndef __APPLE_DCP_AFK_FRAGMENT_H__
#define __APPLE_DCP_AFK_FRAGMENT_H__

#include <linux/errno.h>
#include <linux/types.h>

/* Native 26.6 AV traffic: repeated 8-byte header, then up to 1028 bytes
* of the logical message (timestamp, subheader, descriptor and payload).
* The total length is repeated and the endpoint sequence advances on every
* fragment, including 255 -> 0. Messages are not interleaved on an endpoint.
*/
#define AFK_COMPACT_FRAGMENT_SIZE 1028U
#define AFK_COMPACT_MESSAGE_MAX (1024U * 1024U)

struct afk_fragment_state {
u32 total;
u32 received;
u16 intf_id;
u8 next_seq;
};

/* Validate before allocating/copying. Returns 1 on completion, 0 while
* collecting, or an error. The caller discards the whole message on error.
*/
static inline int afk_fragment_accept(struct afk_fragment_state *s,
u16 intf_id, u8 seq, u32 total, u32 size)
{
if (total < 16 || total > AFK_COMPACT_MESSAGE_MAX || !size || size > total)
return -EMSGSIZE;
if (s->received && (s->total != total || s->intf_id != intf_id ||
s->next_seq != seq))
return -EPROTO;
if (size > total - s->received)
return -EMSGSIZE;

s->total = total;
s->intf_id = intf_id;
s->next_seq = seq + 1;
s->received += size;
return s->received == total;
}

#endif
Loading