Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4206439pxv; Tue, 27 Jul 2021 01:12:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6zoSZdz9HiqwImyQ6rl7Qe7yEw683F5Cr18zwYxWcPb97gxL9vQHwVZdwgciKiDHYyO5p X-Received: by 2002:a92:c5c5:: with SMTP id s5mr15158713ilt.271.1627373542376; Tue, 27 Jul 2021 01:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627373542; cv=none; d=google.com; s=arc-20160816; b=YHVfrgzxrfZOxn1DhtX96hQ9QttDLzZ421QnHwYoYPz1LeXoTvvtmkquXsWewUJbDb /KYXXj+vpmQGK1aofDXnvmkLpBSwg/RObF7skYz7CMSrXuAr1GLRVKUHHtAxyo1h15vC PTxbCl5NhwCvg8Zw2gxtVvFNjx+/7OAG20hd6+bU2qFpQ6bDsHUwQY2kLazYYBSMxyAg wDi3YMOY8CNy5GjPFjwlanZ1U1BGIHFNvZw1+Hg4sja4Y3MRMBDJ9PJ1iLsxBHmf11L5 +IcRsBX/o0Nv0XfYzAfHA+V7CvuTI4553HV5dGx0dSPATaiGol5fC1a9mv7kaDoDwDB/ Nt4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=zHVLg23zhaQo12YFxH3CVNgV8ufispooDmNcrwfmH4w=; b=tGSNiRPVB/DQO6X/K1gQAoTqDB/OJ43jBGu/r0XU/oTTaVpzS3YMpJ5ArKlqjxPwfN xpNXhFeHhnfam34xoTdKCms0xifJDXi4BH0VK8pM0rQJWNYTJ7d1DHBvl2z6s46oPnR2 gN2mJiOtTZuvPHcf/v17OiU29DPLzZ1pFe4PCoY3Rk1WFhqRxwWveSFYVsQpaeY2utIk 4c3TP6yLtkUEd/hiQxwhpuhOd3eIevGTVCb0MciI2vlyC1lj2CeDzc3KC2pwNwE8uCIm b57Kks7J9w56Kw1TNQFMlgK6xeCAjW7omYKCnQfX8JeB7qHF5KvqTNY1zts+EUFjqIGU xPEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qkONxAMB; 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 x1si2475742iow.49.2021.07.27.01.12.10; Tue, 27 Jul 2021 01:12:22 -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=qkONxAMB; 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 S235942AbhG0IL3 (ORCPT + 99 others); Tue, 27 Jul 2021 04:11:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:53626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235874AbhG0IL0 (ORCPT ); Tue, 27 Jul 2021 04:11:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DE01A60527; Tue, 27 Jul 2021 08:11:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627373487; bh=zVqEdy3HT0nY8M2r7ytmalbkDZCkuC6kKnk5DTAldt4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=qkONxAMBkplh6w8TVbdOBYTugIGhUMN5hMMUiDc07rH6uelsS8P7180mk4IL81jDN irY84ozNrDsgpOxDqmffFLL2AwiwYFpRq0Ga+Nj+l4MIJUium7fqom5OLTQXUZ0TiN RX0qQldnNwXPY9zdkwdugsy+h9gvSM3QVQYbaSYYN1bIo0tPShH7Xz7esdn0xMxmAB GwhsidMKS+vfmqcE9Xgee4Nji1NIosmPKuu6zZZML+TtjhOHYc6QmKfs18gzNaL5e4 EOFtjT/mWoYRe1xytqVi6GjaimnBepLNu58XwjuD64gDlm61J4/ruvzKsXjZcXRX0B uFKJxeCnWHM6A== Date: Tue, 27 Jul 2021 10:11:22 +0200 From: Mauro Carvalho Chehab To: Manivannan Sadhasivam Cc: Rob Herring , Bjorn Helgaas , linuxarm@huawei.com, mauro.chehab@huawei.com, Kishon Vijay Abraham I , Vinod Koul , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org Subject: Re: [PATCH v5 2/8] dt-bindings: phy: Add bindings for HiKey 970 PCIe PHY Message-ID: <20210727101122.204b6b9e@coco.lan> In-Reply-To: <20210714174225.GA8988@workstation> References: <20210714022649.GA1324196@robh.at.kernel.org> <20210714091435.322d68b1@coco.lan> <20210714174225.GA8988@workstation> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mani, Em Wed, 14 Jul 2021 23:12:25 +0530 Manivannan Sadhasivam escreveu: > I'm not sure about this. That fact that the PCIe device's PERST# signal > wired to different GPIOs doesn't mean that those GPIOs belong to the PHY. > Those GPIOs should be independent of the PCIe core controlled manually > by the driver. > > I think this issue is somewhat similar to the one we are dealing on the > Qcom platforms [1] where each PCIe device uses a different GPIO and voltage > config to operate. And those need to be active for the link training to > succeed. > > So perhaps we should aim for a common solution? The GPIO and voltage > layout should be described in DT for each port exposed by the SoC/board. > > Thanks, > Mani > > [1] https://lkml.org/lkml/2021/6/21/1524 After re-visiting this issue, I'm starting to think that this should be mapped as something similar to: pcie@xxxx { ... slot { slot#1 { // clock, power supply, reset pins, etc } slot#2 { // clock, power supply, reset pins, etc } ... } }; E. g. placing each specific PCIe device requirement inside the pcie or phy, as it should be up to the driver to initialize each PCIe child-specific requirements when the hardware is ready for that. --- A longer explanation why this should be initialized during PHY power on sequence: On my tests with Kirin 970, there are some steps to be done before enabling the clocks and sending PERST# signals, plus some extra steps to run after PERST# is sent to all devices. While playing with PHY split, I noticed that Linux and/or the SoC is very sensitive to an specific probing order. If such order is not followed, an ARM SError happens and the Kernel panics with something similar to: [ 1.837458] SError Interrupt on CPU0, code 0xbf000002 -- SError [ 1.837462] CPU: 0 PID: 74 Comm: kworker/0:1 Not tainted 5.8.0+ #205 [ 1.837463] Hardware name: HiKey970 (DT) [ 1.837465] Workqueue: events deferred_probe_work_func [ 1.837467] pstate: 20000005 (nzCv daif -PAN -UAO BTYPE=--) [ 1.837468] pc : _raw_spin_unlock_irqrestore+0x18/0x50 [ 1.837469] lr : regmap_unlock_spinlock+0x14/0x20 ... [ 1.837507] Kernel panic - not syncing: Asynchronous SError Interrupt One example is with regards to the clocks required for the PCIe to work: clocks = <&crg_ctrl HI3670_CLK_GATE_PCIEPHY_REF>, <&crg_ctrl HI3670_CLK_GATE_PCIEAUX>, <&crg_ctrl HI3670_PCLK_GATE_PCIE_PHY>, <&crg_ctrl HI3670_PCLK_GATE_PCIE_SYS>, <&crg_ctrl HI3670_ACLK_GATE_PCIE>; If them aren't initialized at the expected order, the Kernel hangs. The same applies to the slot-specific clocks. So, basically, the driver needs to initialize them on this sequence: 1. PHY ref clock; 2. APB sys and phy clock; 3. aclk and aux_clk; 4. slot-specific clocks. failing to follow a valid power-on sequence crashes the Kernel. Thanks, Mauro