Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp433077pxv; Wed, 14 Jul 2021 07:18:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqC/Y5N7RfeLgumQCZE0iuuPk5V81Q+jlVzlvSv0nYvqySZ13fS+VsgeBEe/75lhFICRk9 X-Received: by 2002:a17:907:d09:: with SMTP id gn9mr12646460ejc.447.1626272336347; Wed, 14 Jul 2021 07:18:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626272336; cv=none; d=google.com; s=arc-20160816; b=0zC20PFSBb/yoN89kedC7BgBCZvLW2tqgHBlYfz50MEMuzpAa0OTpzWvn5QnRPKjL7 EyivQmLQd0VoLvS/fAp7LBB2skl6zwe+MMFt653P1KihfJbqYSRYSilOtWKgjVVf6uyX 1P5ldwrF8pZw00O8d3lMi7n9cnONsebWSUBoZOgi7Q7zODB+Edz7rPW3EdD/lv5BpInW AXWI7h+MAJew8RY8pvsrorVUSxVdr5v5lqX1XAeqIsTKmGkrpNX3+yKCqGPgRIBbXe6n d/tHYfclLNol5kUgDUO73gUPJj2U/wfxnhXWuhmfDJ70ctiH3X1qIb3oFYcImRkJkIM6 ivvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=J9oUbcngTl+9FDkdRp1+uTgH5MVpd0Lhn1CbhaZTMrM=; b=l4FvxkrxFoLVELXxcoYPpSDjE+FrYnPC+QxK3HOwVYI2NhDDYCyYkgTl08TkK7G6ZV ARZwgHb1HK0zDpba9HNpU/+UItD+uxawaM0+OzSyzWeQH8G1qFrZGTrl5384hAw89nZy uk+deYO0TXU1lt688wrMczgoWL1HSTaH1gcq3vNAxCx0A9rcPkMzXlP+3ufblf2F5ZhI 9MFHZ2POVmMa3AzvcX5V8OTdVYwZSvMcsGuF52O3DOcd2ZRC9Ue8TfpLz+XC7IqIFxAp T17drolkDA+rNK7YrJuhnL1AEfhNaikZz9yXNMCHY4qda0MjYRxCbkh0yV7vI+dsW3sL OG0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c8OycKEq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p92si3024544edb.71.2021.07.14.07.18.33; Wed, 14 Jul 2021 07:18:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c8OycKEq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239440AbhGNOUM (ORCPT + 99 others); Wed, 14 Jul 2021 10:20:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:51470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231892AbhGNOUL (ORCPT ); Wed, 14 Jul 2021 10:20:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8DF2C61183; Wed, 14 Jul 2021 14:17:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626272239; bh=uppVytZe/PF+h1BO83tiAZrIINXS8zKoOHCBNTsqSWY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=c8OycKEqYChbNdGae3TpdVnjXYGHoDH/LydrE0UtAwGn+Qn6FtXlptNXvrRGfAvGI fszb1cqhwBgsqImzOQDET8Oh3F2aRiZpWPkwscdAr2gRTuhXvS5TAcL+F+/iO9YkkC xDV9ArVAm/RFrPtz+pPqBt04hfw6P+uECAINATxRUBNtLSCjn2B2V90+V904nY11aL SCywRZeA1/BeeAoJ6PDxtbBravCJvUJ+rjEPVBOzwKvDauJRqTutg7/tRk3oLRL+xW JxPSohodCsxrPWio8XEGK+Fctj4xSTorsgFvcRkpGsIR9kNZ9xa0ekbzieT5nLaFbS 470NlD4y3B25w== Received: by mail-ej1-f42.google.com with SMTP id c17so3531286ejk.13; Wed, 14 Jul 2021 07:17:19 -0700 (PDT) X-Gm-Message-State: AOAM533DLogF4jc8N8Jcdbu5GEW+vqF9VLeHSFWOmwgWmMqerGTC6gg5 K05INsMBsjpIq9ntTTrFIHIYYBZ2j9Vx1iyTDA== X-Received: by 2002:a17:907:5096:: with SMTP id fv22mr12203806ejc.525.1626272238042; Wed, 14 Jul 2021 07:17:18 -0700 (PDT) MIME-Version: 1.0 References: <20210714022649.GA1324196@robh.at.kernel.org> <20210714091435.322d68b1@coco.lan> In-Reply-To: <20210714091435.322d68b1@coco.lan> From: Rob Herring Date: Wed, 14 Jul 2021 08:17:05 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 2/8] dt-bindings: phy: Add bindings for HiKey 970 PCIe PHY To: Mauro Carvalho Chehab Cc: Bjorn Helgaas , Linuxarm , mauro.chehab@huawei.com, Manivannan Sadhasivam , Kishon Vijay Abraham I , Vinod Koul , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , linux-phy@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 14, 2021 at 1:14 AM Mauro Carvalho Chehab wrote: > > Em Tue, 13 Jul 2021 20:26:49 -0600 > Rob Herring escreveu: > > > On Tue, Jul 13, 2021 at 08:28:35AM +0200, Mauro Carvalho Chehab wrote: > > > > + reset-gpios: > > > + description: PCI PERST reset GPIOs > > > + maxItems: 4 > > > > Hiding the 4 ports in the phy? > > Rob, > > I'm not trying to hide anything. > > There are several differences with regards to how PERST# is handled between > HiKey 960 and HiKey 970. > > From hardware perspective, you can see the schematics of both boards: > > https://github.com/96boards/documentation/raw/master/consumer/hikey/hikey960/hardware-docs/HiKey960_SoC_Reference_Manual.pdf > https://www.96boards.org/documentation/consumer/hikey/hikey970/hardware-docs/files/hikey970-schematics.pdf > > The 960 PHY has the SoC directly connected to a PCIE M.2 slot > (model 10130616) without any external bridge chipset. It uses a single > GPIO (GPIO 089) for the PERST# signal, connected via a voltage converter > (from 1.8V to 3.3V). > > $ lspci > 00:00.0 PCI bridge: Huawei Technologies Co., Ltd. Device 3660 (rev 01) > > The 970 PHY has an external PCI bridge chipset (PLX Technology PEX 8606). > Besides the bridge, the hardware comes with an Ethernet PCI adapter, a > M.2 slot and a mini-PCIe connector. Each one with its own PERST# signal, > mapped to different GPIO pins, and each one using its own voltage > converter. > > $ lspci > 00:00.0 PCI bridge: Huawei Technologies Co., Ltd. Device 3670 (rev 01) > 01:00.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) > 02:01.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) > 02:04.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) > 02:05.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) > 02:07.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) > 02:09.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) > 06:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 07) > > On other words, there are 4 GPIOs mapped to different PERST# pins in > the hardware: > > - GPIO 56 is connected to the PERST# pin at PEX 8606; > - GPIO 25 is connected to the PERST# pin at the M.2 slot; > - GPIO 220 is connected to the PERST# pin at the PCIe mini slot; > - GPIO 203 is connected to the PERST# pin at the Ethernet chipset. > > Maybe due to different electrical requirements, the hardware design > use different GPIOs instead of feeding them altogether. > > Anyway, the fact is that the PHY on 970 has 4 different GPIOs that are > need in order for the hardware to work. and this is specific to this > particular PHY. This hierarchy could be done on any board. It has nothing to do with the PHY. > Now, from software perspective, the power on sequence on Hikey 960 > finishes sending PERST# signal to the M.2 slot: > > static int hi3660_pcie_phy_power_on(struct phy *generic_phy) > { > ... > /* perst assert Endpoint */ > if (!gpio_request(phy->gpio_id_reset, "pcie_perst")) { > usleep_range(REF_2_PERST_MIN, REF_2_PERST_MAX); > ret = gpio_direction_output(phy->gpio_id_reset, 1); > if (ret) > goto disable_clks; > usleep_range(PERST_2_ACCESS_MIN, PERST_2_ACCESS_MAX); > return 0; > } > > disable_clks: > kirin_pcie_clk_ctrl(phy, false); > return ret; > } > > The 970 PHY, however, sends PERST# signal in the middle of the power > on sequence, as, after sending reset, it needs to wait for the hardware > to stabilize, in order to setup an eye diagram at the PHY: > > static int hi3670_pcie_phy_power_on(struct phy *generic_phy) > { > ... > /* perst assert Endpoints */ > usleep_range(21000, 23000); > for (i = 0; i < phy->n_gpio_resets; i++) { > ret = gpio_direction_output(phy->gpio_id_reset[i], 1); > if (ret) > return ret; > } > usleep_range(10000, 11000); > > ret = is_pipe_clk_stable(phy); > if (!ret) > goto disable_clks; > > hi3670_pcie_set_eyeparam(phy); > > ret = hi3670_pcie_noc_power(phy, false); > if (ret) > goto disable_clks; > > return 0; > > disable_clks: > kirin_pcie_clk_ctrl(phy, false); > return ret; > } > > IMO, it makes a lot more sense to map this on DT as part of the > PHY and not as part of the PCIe, but no matter how it is mapped, > this PHY still requires 4 GPIOs for PERST#. It does not because PERST# control is part of PCIe for every other driver. Rob