Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2144765pxy; Mon, 2 Aug 2021 21:27:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVOEfWIJLlSyUimqy1BPdV2pX9cgnPlW7Wzg6ns+vONogLRQ9uPRsBAwaoeDtjnNTY8Gl2 X-Received: by 2002:a92:507:: with SMTP id q7mr87024ile.81.1627964871724; Mon, 02 Aug 2021 21:27:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627964871; cv=none; d=google.com; s=arc-20160816; b=eGH2L8kTQfGgpMzQzNPWEB1taUMsmyhng+M18Nb3bSdI0/GbC0O5LCJlPHHk+Rgybp hO3eHmD0ANjltFa/kQP2YR8oEZBK7wz+tYa3659Q+nw/NeabFN05c/WiutrKY8wZT2G3 qjEcght2hKyXMrsNlA4gmjFGuS9KfwyXSpVrl4WxITRNv/dBlIzCIRI3L8oj3kuNc9vN sh9t3Ppy0te6aJF1q6sZEBQdOQbbryCEqPXCsm6RdvnWwkQdiCwwxKlov7C01wnd2RLL yrZ1uKPuicWHFflYo6I6bFCM0cXe3UlgPDkH44c/6FB7/HYem7F1iS0q8LhB3hOxfGtC f/YA== 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=xsdKhjhqNcjrXNqNiNFwt6BzPiDnEx2ePzrNfbYSgII=; b=mF7k9DidSVNXiBP2s8N0uWq3AqGl62UIP0IXuVtylLzBZiMDhy/1FRRfXvTBbMNf41 9jVSgh4X4OxQy1FhRFJQNw4cnfeHU7NtwOjqyNqDDi0VoAkJu7DrTjqZF5EtAnlq+ZSU uptRJudcAHo99Dd/Zn47JKMnwtsWBSaveNuxV1PKRREvKIDSv5Zf0vvjlJUErr6EvQS+ 3LwPHTIO+GJ4+Gq+ZzFlMybxXsfZxGEVjh9Mzv4ML/0N9raAqqBlHBiMAobcltX7tafw +0kG7iV3+D+jy2j7429BDWRuYe4CDki3rNBqClc+4spzALAJEcGdFcrjmmBlg3orcAHf Pbuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=awMZtxBC; 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 l6si14763210ios.26.2021.08.02.21.27.39; Mon, 02 Aug 2021 21:27:51 -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=awMZtxBC; 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 S233918AbhHCE1K (ORCPT + 99 others); Tue, 3 Aug 2021 00:27:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:35104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234056AbhHCEZr (ORCPT ); Tue, 3 Aug 2021 00:25:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E149561158; Tue, 3 Aug 2021 04:25:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627964736; bh=SkJpApRxFG/jXxtvFIyQH90yLQk7myOrmz5Wih/Vuyw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=awMZtxBCR6GUxLWOagGdN/FDay6Jkz15CQMKxFG2yTgIVUsUx6vsnK4JcbxpWjx+1 kQlCkP6FyuwBM9ub3ON2S7ZlW9f6TjNRAwq+9Q0EaM6rh4Iu38cnCwt5hUjIPJPc0k Ci84LWZzZ8CPkAXX0/HqHVO0n6U8fiiksBaVVgjBF1ZiMPygfuk7eOwfZNz5vmCpGx 7MgVnlsV0tv6tKMWYwZtuCn60lFP+MPUOPsqjlelHwIjM2MtAGF/fgHqBuKmc0sDVK X1c69ifh+ndYVuRVbQ2B0qXpp745y3R1qrUx+UZnOEIN4HzEbUgKnfcx+K3Lwlt/aK IsMAS/UCBLbpA== Date: Tue, 3 Aug 2021 06:25:28 +0200 From: Mauro Carvalho Chehab To: Manivannan Sadhasivam Cc: Vinod Koul , Bjorn Helgaas , Rob Herring , linuxarm@huawei.com, mauro.chehab@huawei.com, Krzysztof =?UTF-8?B?V2lsY3p5xYRza2k=?= , Binghui Wang , Lorenzo Pieralisi , Rob Herring , Wei Xu , Xiaowei Song , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH v7 08/10] arm64: dts: HiSilicon: Add support for HiKey 970 PCIe controller hardware Message-ID: <20210803062528.0a264682@coco.lan> In-Reply-To: <20210724041150.GA4053@thinkpad> References: <20210722133628.GC4446@workstation> <20210723085318.243f155f@coco.lan> <20210724041150.GA4053@thinkpad> 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 Em Sat, 24 Jul 2021 09:41:50 +0530 Manivannan Sadhasivam escreveu: > On Fri, Jul 23, 2021 at 08:53:18AM +0200, Mauro Carvalho Chehab wrote: > > Em Thu, 22 Jul 2021 19:06:28 +0530 > > Manivannan Sadhasivam escreveu: > > > > > On Wed, Jul 21, 2021 at 10:39:10AM +0200, Mauro Carvalho Chehab wrote: > > > > From: Manivannan Sadhasivam > > > > > > > > Add DTS bindings for the HiKey 970 board's PCIe hardware. > > > > > > > > Co-developed-by: Mauro Carvalho Chehab > > > > Signed-off-by: Manivannan Sadhasivam > > > > Signed-off-by: Mauro Carvalho Chehab > > > > --- > > > > arch/arm64/boot/dts/hisilicon/hi3670.dtsi | 71 +++++++++++++++++++ > > > > .../boot/dts/hisilicon/hikey970-pmic.dtsi | 1 - > > > > drivers/pci/controller/dwc/pcie-kirin.c | 12 ---- > > > > 3 files changed, 71 insertions(+), 13 deletions(-) > > > > > > > > diff --git a/arch/arm64/boot/dts/hisilicon/hi3670.dtsi b/arch/arm64/boot/dts/hisilicon/hi3670.dtsi > > > > index 1f228612192c..6dfcfcfeedae 100644 > > > > --- a/arch/arm64/boot/dts/hisilicon/hi3670.dtsi > > > > +++ b/arch/arm64/boot/dts/hisilicon/hi3670.dtsi > > > > @@ -177,6 +177,12 @@ sctrl: sctrl@fff0a000 { > > > > #clock-cells = <1>; > > > > }; > > > > > > > > + pmctrl: pmctrl@fff31000 { > > > > + compatible = "hisilicon,hi3670-pmctrl", "syscon"; > > > > + reg = <0x0 0xfff31000 0x0 0x1000>; > > > > + #clock-cells = <1>; > > > > + }; > > > > + > > > > > > Irrelevant change to this patch. > > > > Huh? > > > > This is used by PCIe PHY, as part of the power on procedures: > > > > +static int hi3670_pcie_noc_power(struct hi3670_pcie_phy *phy, bool enable) > > +{ > > + struct device *dev = phy->dev; > > + u32 time = 100; > > + unsigned int val = NOC_PW_MASK; > > + int rst; > > + > > + if (enable) > > + val = NOC_PW_MASK | NOC_PW_SET_BIT; > > + else > > + val = NOC_PW_MASK; > > + rst = enable ? 1 : 0; > > + > > + regmap_write(phy->pmctrl, NOC_POWER_IDLEREQ_1, val); > > > > > > Ah... you're hardcoding the syscon compatible in driver. Sorry missed that. > > But if these syscon nodes are independent memory regions or belong to non > PCI/PHY memory map, you could've fetched the reference through a DT property > along with the offset then used it in driver. > > Like, > > pcie_phy: pcie-phy@fc000000 { > ... > hisilicon,noc-power-regs = <&pmctrl 0x38c>; > hisilicon,sctrl-cmos-regs = <&sctrl 0x60>; > ... > }; > > The benefit of doing this way is, if the pmctrl, sctrl register layout changes > in future, you can handle it without any issues. Interesting approach, but probably overkill. I mean, the register mapping here should be the same for all Kirin 970 PHY based devices. A PHY for a different SoC will likely have other differences than just those two regs. Regards, Mauro