Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp14682iob; Mon, 2 May 2022 10:49:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyX9S3NJjGtyvSTr5UgRqeyToCTzSkmne2lB9ST+/apv2W8M6S6aFKGrEw7Q7FWnMhL4XL5 X-Received: by 2002:a63:df18:0:b0:3ab:938b:e6c5 with SMTP id u24-20020a63df18000000b003ab938be6c5mr10771573pgg.165.1651513763296; Mon, 02 May 2022 10:49:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651513763; cv=none; d=google.com; s=arc-20160816; b=k3C9XODX50Z4e3GW9hZug6SsLMyPTeYzI0kk53morye/lvC0ELGBiPEEVvPsdg2Ii+ OipvD3HnFrkwvcLbMECuhtfNuFiDhSUt6jtLEKtIVdPrUtXrotvkMJvexsQL2r6AzXt0 ICmkrGbEWNurMAub68InrPhYUFRDe1WRXv/xs+nsaHcx6Wr43pVa86sA8r5vq68rskgf 0L7x4bjs5/15OA9wRzz8Ez26nZvfmFNUyGnkaLuMmiRfiqDUDuHUEX9vLJvdIQrdwkcY zj6ydf6Pypjg30eqlqP8oxeQGKyaaID5Ar4MTjVaLwR71qjDR2avqhDyQleYPKTOFrR1 UD3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id; bh=O9Nq2XVfcfY8luzWcpjgd3fOHJkFNzIB8ljbX2+/Ab4=; b=dwVPAMC2zt5L9DBkIydYLcV5FZxOIry4xp4OydtDMdgcldx3FRvpFilDBXv9IMVC6d Ql3N+rBQI6ge9BxNXTlbuwL2zXd/uQnwkkLkzta9YLCmpTjQ1XMwNPpUbnjmTJnuKdIs lr00KLyZdYA3eeTrZzgf7gMeYG6zmVWJz4LqbAFJz0KOBWI9j5zLlspyTv8SBkdFLt+A KrgquP4v6VkTYqUyPdRSgMI7CK8ZaYbZfYFowgB3gFISitzS/6UVBZjdk4Gmy3EyywIT vqlJur4tOwg2Kz/KUjPoEqYKh8mAwF+YcWdOPDMK9KvyFfmRovmssrxTir4r2S4qxrek GTmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=marcan.st Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w185-20020a6382c2000000b003ab18552eadsi14406452pgd.564.2022.05.02.10.49.07; Mon, 02 May 2022 10:49:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=marcan.st Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385807AbiEBPgN (ORCPT + 99 others); Mon, 2 May 2022 11:36:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385871AbiEBPgH (ORCPT ); Mon, 2 May 2022 11:36:07 -0400 Received: from mail.marcansoft.com (marcansoft.com [IPv6:2a01:298:fe:f::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E2D7BE0B; Mon, 2 May 2022 08:32:26 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: marcan@marcan.st) by mail.marcansoft.com (Postfix) with ESMTPSA id DD83041E96; Mon, 2 May 2022 15:32:21 +0000 (UTC) Message-ID: <0ccc44cd-21aa-3670-24b3-4ee051dd3c12@marcan.st> Date: Tue, 3 May 2022 00:32:19 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: es-ES To: Rob Herring Cc: Marc Zyngier , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= , Bjorn Helgaas , Alyssa Rosenzweig , Sven Peter , PCI , "linux-kernel@vger.kernel.org" References: <20220502093832.32778-1-marcan@marcan.st> <20220502093832.32778-4-marcan@marcan.st> From: Hector Martin Subject: Re: [PATCH 3/3] PCI: apple: Add support for optional PWREN GPIO In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/05/2022 00.14, Rob Herring wrote: > On Mon, May 2, 2022 at 4:39 AM Hector Martin wrote: >> >> WiFi and SD card devices on M1 Macs have a separate power enable GPIO. >> Add support for this to the PCIe controller. This is modeled after how >> pcie-fu740 does it. > > It did, but it's not ideal really. The problem is the GPIO is really > associated with the device (WiFi/SD) rather than the PCI host and > therefore should be part of a WiFi or SD node. You probably don't have > one (yet), but I would suspect that SD will need one for all the > standard MMC/SD DT properties. The secondary issue is we'll end up > adding more power sequencing properties to control ordering and timing > for different devices. The exception here is standard PCI slot > properties like perst#, clkreq, and standard voltage rails can go in > the host bridge (and for new bindings, those should really be in the > root port node). For a complicated example, see Hikey960 or 970. > > Of course with power control related properties there's a chicken or > egg issue that the PCI device is not discoverable until the device is > powered on. This issue comes up over and over with various hacky > solutions in the bindings. The PCI subsystem needs to solve this. My > suggestion is that if the firmware says there is a device on the bus > and it wasn't probed, then we should force probing (or add a pre-probe > hook for drivers). That is what MDIO bus does for example. > I agree with the premise. Right now macOS does not actually power down these devices as far as I know (except maybe sleep mode? not sure what goes on then yet), but I think the hardware actually has an SD card detect GPIO hookup that would allow us to entirely power down the SD controller when no card is inserted. That would obviously be ideal. FWIW, we do have the device nodes downstream [1]. I did in fact have to add the SD one for the CD/WP inversion flags (and had to add driver support for that too). That said, as for how to make this happen in the PCI subsystem properly... I think I'll defer to the maintainers' opinion there before trying to hack something up ;) Meanwhile, I guess I better get PCIe hotplug working, since doing it in the driver isn't going to work without that first... [1] https://github.com/AsahiLinux/linux/blob/bits/000-devicetree/arch/arm64/boot/dts/apple/t600x-j314-j316.dtsi#L222 -- Hector Martin (marcan@marcan.st) Public Key: https://mrcn.st/pub