All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Rob Herring <robh@kernel.org>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
	linuxarm@huawei.com, mauro.chehab@huawei.com,
	Manivannan Sadhasivam <mani@kernel.org>,
	Binghui Wang <wangbinghui@hisilicon.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Xiaowei Song <songxiaowei@hisilicon.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH v5 4/8] dt-bindings: PCI: kirin: Drop PHY properties
Date: Fri, 16 Jul 2021 13:22:08 +0200	[thread overview]
Message-ID: <20210716132208.3cd8f404@coco.lan> (raw)
In-Reply-To: <20210714022849.GA1330659@robh.at.kernel.org>

Em Tue, 13 Jul 2021 20:28:49 -0600
Rob Herring <robh@kernel.org> escreveu:

> On Tue, Jul 13, 2021 at 08:28:37AM +0200, Mauro Carvalho Chehab wrote:
> > There are several properties there that belong to the PHY
> > interface. Drop them, as a new binding file will describe
> > the PHY properties for Kirin 960.  
> 
> Folks are okay with an incompatible change on hikey960?

Accepting an incompatible change here seems the right thing to do.

Another possibility would be to create a "pcie-kirin-with-phy" driver
that would be identical to the existing one, except for the absence
of a PHY and using a different compatible string.

-

Long answer:

There aren't many alternatives here, if we want to split the PHY out of
the driver, as you requested.

I've been scratching my head in order to find a way that would keep
the Hikey960 a separate PHY driver, with a proper DT schema, but
capable of also parse the original DT schema.

See, making the phy driver parse the PCIE-based OF-node data is 
trivial (I have already a patch doing that), but it will require at
least some DT schema additions, in order to add a pcie_phy node[1]:

<snip>
diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
index e0eca598af1f..6aaa2f966d74 100644
--- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
@@ -1001,6 +1001,11 @@ spi3: spi@ff3b3000 {
                        status = "disabled";
                };
 
+               pcie_phy: pcie-phy@f3f2000 {
+                       compatible = "hisilicon,hi960-pcie-phy";
+                       #phy-cells = <0>;
+               };
+
                pcie@f4000000 {
                        compatible = "hisilicon,kirin960-pcie";
                        reg = <0x0 0xf4000000 0x0 0x1000>,
@@ -1012,6 +1017,7 @@ pcie@f4000000 {
                        #address-cells = <3>;
                        #size-cells = <2>;
                        device_type = "pci";
+                       phys = <&pcie_phy>;
                        ranges = <0x02000000 0x0 0x00000000
                                  0x0 0xf6000000
                                  0x0 0x02000000>;
</snip>

[1] or, alternatively, the pcie-kirin driver would need to dynamically
    populate DT with the above, as some ACPI drivers do when the
    firmware is broken.

Without a PHY representation at the DT schema, the PHY driver won't 
be recognized by pcie-kirin.

See, even if the pcie-kirin driver would be changed to register
the PHY without DT, with:

	phy = devm_of_phy_get(dev, NULL, "hi3660_pcie_phy");

The phy_get() implementation will internally ignore a non-DT PHY,
as internally, it uses of_property_match_string() if the caller driver
has of_node:

	struct phy *phy_get(struct device *dev, const char *string)
	{
		int index = 0;
		struct phy *phy;
		struct device_link *link;

		if (dev->of_node) {
			if (string)
				index = of_property_match_string(dev->of_node, "phy-names",
					string);
			else
				index = 0;
			phy = _of_phy_get(dev->of_node, index);
		} else {
			if (string == NULL) {
				dev_WARN(dev, "missing string\n");
				return ERR_PTR(-EINVAL);
			}
			phy = phy_find(dev, string);
		}

Thanks,
Mauro

  parent reply	other threads:[~2021-07-16 11:23 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13  6:28 [PATCH v5 0/8] Add support for Hikey 970 PCIe Mauro Carvalho Chehab
2021-07-13  6:28 ` Mauro Carvalho Chehab
2021-07-13  6:28 ` Mauro Carvalho Chehab
2021-07-13  6:28 ` [PATCH v5 1/8] dt-bindings: phy: Add bindings for HiKey 960 PCIe PHY Mauro Carvalho Chehab
2021-07-13  6:28   ` Mauro Carvalho Chehab
2021-07-14  2:22   ` Rob Herring
2021-07-14  2:22     ` Rob Herring
2021-07-13  6:28 ` [PATCH v5 2/8] dt-bindings: phy: Add bindings for HiKey 970 " Mauro Carvalho Chehab
2021-07-13  6:28   ` Mauro Carvalho Chehab
2021-07-14  2:26   ` Rob Herring
2021-07-14  2:26     ` Rob Herring
2021-07-14  7:14     ` Mauro Carvalho Chehab
2021-07-14  7:14       ` Mauro Carvalho Chehab
2021-07-14 14:17       ` Rob Herring
2021-07-14 14:17         ` Rob Herring
2021-07-14 14:31         ` Mauro Carvalho Chehab
2021-07-14 14:31           ` Mauro Carvalho Chehab
2021-07-14 17:42       ` Manivannan Sadhasivam
2021-07-14 17:42         ` Manivannan Sadhasivam
2021-07-15  6:37         ` Mauro Carvalho Chehab
2021-07-15  6:37           ` Mauro Carvalho Chehab
2021-07-19 15:26           ` Mauro Carvalho Chehab
2021-07-19 15:26             ` Mauro Carvalho Chehab
2021-07-27  8:11         ` Mauro Carvalho Chehab
2021-07-27  8:11           ` Mauro Carvalho Chehab
2021-07-13  6:28 ` [PATCH v5 3/8] dt-bindings: PCI: kirin: Fix compatible string Mauro Carvalho Chehab
2021-07-14  2:27   ` Rob Herring
2021-07-13  6:28 ` [PATCH v5 4/8] dt-bindings: PCI: kirin: Drop PHY properties Mauro Carvalho Chehab
2021-07-14  2:28   ` Rob Herring
2021-07-14 11:22     ` Mauro Carvalho Chehab
2021-07-16 11:22     ` Mauro Carvalho Chehab [this message]
2021-07-13  6:28 ` [PATCH v5 5/8] phy: HiSilicon: Add driver for Kirin 960 PCIe PHY Mauro Carvalho Chehab
2021-07-13  6:28   ` Mauro Carvalho Chehab
2021-07-13  6:28 ` [PATCH v5 6/8] phy: HiSilicon: add driver for Kirin 970 " Mauro Carvalho Chehab
2021-07-13  6:28   ` Mauro Carvalho Chehab
2021-07-13  6:28 ` [PATCH v5 7/8] PCI: kirin: Drop the PHY logic from the driver Mauro Carvalho Chehab
2021-07-13  6:28   ` Mauro Carvalho Chehab
2021-07-13  6:28 ` [PATCH v5 8/8] PCI: kirin: Use regmap for APB registers Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210716132208.3cd8f404@coco.lan \
    --to=mchehab+huawei@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=helgaas@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mani@kernel.org \
    --cc=mauro.chehab@huawei.com \
    --cc=robh@kernel.org \
    --cc=songxiaowei@hisilicon.com \
    --cc=wangbinghui@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.