From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E67E2CA1016 for ; Mon, 8 Sep 2025 23:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2cuatXLabluJ3CkaEx442uHgntV1NQobYjc7F765Bzw=; b=Yj9feYVrT4LnIiSHCOFGKJhYJq 9AkVSEJfzZJvkKuldlH1SJYRiBomE2X0bPhs96zWZpw8S2UEcdhtzrTOYfQhakzQrt68NXcjRMiPp AoIhvK5Dr9K32aSed9BH+Gj0O5kvm3wwg+ygyHJZaSQBzaIPmnHIDEgPYT4cE3BtVE32QWg91GF0a R2+6AxvosHZDLqkyZ4f6in5YiiA2AaiBtOanyrS4KBFke7y/+Xuugp9tOFfnW2+ur8ajX4PhmJ+13 k7O57PoJCtlOyqMieHi6+OHa9odkTfq3M66oJCBskJu7t6EZ9OjoanvQSvMgVLtf40KE+UicjQbXU U9biLs5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uvlfU-000000034WR-40w7; Mon, 08 Sep 2025 23:53:05 +0000 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uvgMV-00000001Rzw-0jvK; Mon, 08 Sep 2025 18:13:09 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id 952921400182; Mon, 8 Sep 2025 14:13:03 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Mon, 08 Sep 2025 14:13:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jannau.net; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1757355183; x=1757441583; bh=2cuatXLabl uJ3CkaEx442uHgntV1NQobYjc7F765Bzw=; b=W92hAt8zipaNUv9cn+SrTvTrzC NJOgJzI0vFRPYjQC0AqqzSRUc5/lpz4lxaiMxA/lEUcwhlPM9GoPMWa6BSpysJbn APX/lZB6GECks6Rvn+XTrq6ScDnqxa2tGkch66numKlCfbnJ4bLyMOM7IC+QvcCW VNTbIeN7dHqbH/IS6L4zH6/bAI4FeMtzGGXapbDK8lzVFKGWz0vK70CtXNfomwaS cd/IVW8nrJKxVV/fhaM1VcuWSPQQMWONR39/FJxOFVCEYL8sDdH2VYWSQSelV4xf 2/JxFf+NoFOq5Cgsci2Z01ulcAzSi0mI0HgfAIfnsriF3xOfmkP3+s1QC7Tg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1757355183; x=1757441583; bh=2cuatXLabluJ3CkaEx442uHgntV1NQobYjc 7F765Bzw=; b=MIyhvqRjBUNSOm4wZlJKcDOjSu8kP13qHkI8HYpMx7iV24aUAkb zMwQzv5dRQ7Pe5djmfH5doAFTRotxOKsbgDKYG7/MqU53yqb3E7rwhdlF25qNltE cgMhiR+RZW6JlUfKDUOIwdcJmIeDVFObVxCd80nM2e3i6D0v5QB53i3U5SkytbOg jzcyo+ngdUWAdaOxQiL2lzT7yosc8vd6M2HZJrksfnhNgY97+ViR630Pz9VLQMan nnIGpLBmzob7B+dGiTpPZYiQ3RxtDSOUGhCt/xhBqxjMN5TknkTgH0FFLU+KYRS0 ML4f1Dv+l0mTQf+z3RI5E0GSDo6nbUbVvdg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddukedvvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfhfgggtuggjsehttdertddttdejnecuhfhrohhmpeflrghnnhgvucfi rhhunhgruhcuoehjsehjrghnnhgruhdrnhgvtheqnecuggftrfgrthhtvghrnhepgfdvff evleegudejfeefheehkeehleehfefgjefffeetudegtefhuedufeehfeetnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhesjhgrnhhnrghurd hnvghtpdhnsggprhgtphhtthhopedvfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthht ohepshhvvghnsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehgrhgvghhkhheslhhinh hugihfohhunhgurghtihhonhdrohhrghdprhgtphhtthhopehrohgshheskhgvrhhnvghl rdhorhhgpdhrtghpthhtohepkhhriihkodgutheskhgvrhhnvghlrdhorhhgpdhrtghpth htoheptghonhhorhdoughtsehkvghrnhgvlhdrohhrghdprhgtphhtthhopegsrghlsghi sehkvghrnhgvlhdrohhrghdprhgtphhtthhopegrlhihshhsrgesrhhoshgvnhiifigvih hgrdhiohdprhgtphhtthhopehnvggrlhesghhomhhprgdruggvvhdprhgtphhtthhopehv khhouhhlsehkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i47b949f6:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 8 Sep 2025 14:13:01 -0400 (EDT) Date: Mon, 8 Sep 2025 20:12:59 +0200 From: Janne Grunau To: Sven Peter Cc: Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Felipe Balbi , Alyssa Rosenzweig , Neal Gompa , Vinod Koul , Kishon Vijay Abraham I , Thinh Nguyen , Heikki Krogerus , Philipp Zabel , Frank Li , Ran Wang , Peter Chen , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, Hector Martin Subject: Re: [PATCH v2 18/22] phy: apple: Add Apple Type-C PHY Message-ID: <20250908181259.GC89417@robin.jannau.net> References: <20250906-atcphy-6-17-v2-0-52c348623ef6@kernel.org> <20250906-atcphy-6-17-v2-18-52c348623ef6@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20250906-atcphy-6-17-v2-18-52c348623ef6@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250908_111307_585040_E54C7FC1 X-CRM114-Status: GOOD ( 23.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, Sep 06, 2025 at 03:43:31PM +0000, Sven Peter wrote: > The Apple Type-C PHY (ATCPHY) is a PHY for USB 2.0, USB 3.x, > USB4/Thunderbolt, and DisplayPort connectivity found in Apple Silicon SoCs. > The PHY handles muxing between these different protocols and also provides > the reset controller for the attached dwc3 USB controller. > > There is no documentation available for this PHY and the entire sequence > of MMIO pokes has been figured out by tracing all MMIO access of Apple's > driver under a thin hypervisor and correlating the register reads/writes > to their kernel's debug output to find their names. Deviations from this > sequence generally results in the port not working or, especially when > the mode is switched to USB4 or Thunderbolt, to some watchdog resetting > the entire SoC. > > This initial commit already introduces support for Display Port and > USB4/Thunderbolt but the drivers for these are not ready. We cannot > control the alternate mode negotiation and are stuck with whatever Apple's > firmware decides such that any DisplayPort or USB4/Thunderbolt device will > result in a correctly setup PHY but not be usable until the other drivers > are upstreamed as well. > > Co-developed-by: Janne Grunau > Signed-off-by: Janne Grunau > Co-developed-by: Hector Martin > Signed-off-by: Hector Martin > Signed-off-by: Sven Peter > --- > MAINTAINERS | 1 + > drivers/phy/Kconfig | 1 + > drivers/phy/Makefile | 1 + > drivers/phy/apple/Kconfig | 14 + > drivers/phy/apple/Makefile | 4 + > drivers/phy/apple/atc.c | 2214 ++++++++++++++++++++++++++++++++++++++++++++ > 6 files changed, 2235 insertions(+) [...] > diff --git a/drivers/phy/apple/atc.c b/drivers/phy/apple/atc.c > new file mode 100644 > index 0000000000000000000000000000000000000000..9213485234873fcaafeb1d1d9de3ddf07767d552 > --- /dev/null > +++ b/drivers/phy/apple/atc.c > @@ -0,0 +1,2214 @@ [...] > +static int atcphy_load_tunables(struct apple_atcphy *atcphy) > +{ > + int ret; > + struct { > + const char *dt_name; > + struct apple_tunable **tunable; > + } tunables[] = { > + { "apple,tunable-fuses", &atcphy->tunables.fuses }, > + { "apple,tunable-axi2af", &atcphy->tunables.axi2af }, > + { "apple,tunable-common", &atcphy->tunables.common }, > + { "apple,tunable-lane0-usb", &atcphy->tunables.lane_usb3[0] }, > + { "apple,tunable-lane1-usb", &atcphy->tunables.lane_usb3[1] }, > + { "apple,tunable-lane0-cio", &atcphy->tunables.lane_usb4[0] }, > + { "apple,tunable-lane1-cio", &atcphy->tunables.lane_usb4[1] }, > + { "apple,tunable-lane0-dp", &atcphy->tunables.lane_displayport[0] }, > + { "apple,tunable-lane1-dp", &atcphy->tunables.lane_displayport[1] }, > + }; > + > + for (int i = 0; i < ARRAY_SIZE(tunables); i++) { > + *tunables[i].tunable = > + devm_apple_tunable_parse(atcphy->dev, atcphy->np, tunables[i].dt_name); > + if (IS_ERR(tunables[i].tunable)) { > + dev_err(atcphy->dev, "Failed to read tunable %s: %ld\n", > + tunables[i].dt_name, PTR_ERR(tunables[i].tunable)); > + return ret; ret is unitialized here, could be `return PTR_ERR(tunables[i].tunable);` instead Janne