[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1606792003.14736.63.camel@mhfsdcap03>
Date: Tue, 1 Dec 2020 11:06:43 +0800
From: Jianjun Wang <jianjun.wang@...iatek.com>
To: Bjorn Helgaas <helgaas@...nel.org>
CC: Bjorn Helgaas <bhelgaas@...gle.com>,
Rob Herring <robh+dt@...nel.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Ryder Lee <ryder.lee@...iatek.com>,
Philipp Zabel <p.zabel@...gutronix.de>,
"Matthias Brugger" <matthias.bgg@...il.com>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
<davem@...emloft.net>, <linux-pci@...r.kernel.org>,
<linux-mediatek@...ts.infradead.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
Sj Huang <sj.huang@...iatek.com>, <youlin.pei@...iatek.com>,
<chuanjia.liu@...iatek.com>, <qizhong.cheng@...iatek.com>,
<sin_jieyang@...iatek.com>, Lukas Wunner <lukas@...ner.de>
Subject: Re: [v4,2/3] PCI: mediatek: Add new generation controller support
On Mon, 2020-11-30 at 11:30 -0600, Bjorn Helgaas wrote:
> [+cc Lukas, pciehp power control question]
>
> On Mon, Nov 23, 2020 at 02:45:13PM +0800, Jianjun Wang wrote:
> > On Thu, 2020-11-19 at 14:28 -0600, Bjorn Helgaas wrote:
> > > "Add new generation" really contains no information. And "mediatek"
> > > is already used for the pcie-mediatek.c driver, so we should have a
> > > new tag for this new driver. Include useful information in the
> > > subject, e.g.,
> > >
> > > PCI: mediatek-gen3: Add MediaTek Gen3 driver for MT8192
>
> > > > +static int mtk_pcie_setup(struct mtk_pcie_port *port)
> > > > +{
> > > > + struct device *dev = port->dev;
> > > > + struct platform_device *pdev = to_platform_device(dev);
> > > > + struct resource *regs;
> > > > + int err;
> > > > +
> > > > + regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pcie-mac");
> > > > + port->base = devm_ioremap_resource(dev, regs);
> > > > + if (IS_ERR(port->base)) {
> > > > + dev_notice(dev, "failed to map register base\n");
> > > > + return PTR_ERR(port->base);
> > > > + }
> > > > +
> > > > + port->reg_base = regs->start;
> > > > +
> > > > + /* Don't touch the hardware registers before power up */
> > > > + err = mtk_pcie_power_up(port);
> > > > + if (err)
> > > > + return err;
> > > > +
> > > > + /* Try link up */
> > > > + err = mtk_pcie_startup_port(port);
> > > > + if (err) {
> > > > + dev_notice(dev, "PCIe link down\n");
> > > > + goto err_setup;
> > >
> > > Generally it should not be a fatal error if the link is not up at
> > > probe-time. You may be able to hot-add a device, or the device may
> > > have some external power control that will power it up later.
> >
> > This is for the power saving requirement. If there is no device
> > connected with the PCIe slot, the PCIe MAC and PHY should be powered
> > off.
> >
> > Is there any standard flow to support power down the hardware at
> > probe-time if no device is connected and power it up when hot-add a
> > device?
>
> That's a good question. I assume this looks like a standard PCIe
> hot-add event?
>
> When you hot-add a device, does the Root Port generate a Presence
> Detect Changed interrupt? The pciehp driver should field that
> interrupt and turn on power to the slot via the Power Controller
> Control bit in the Slot Control register.
>
> Does your hardware require something more than that to control the MAC
> and PHY power?
>
> Bjorn
The hardware support to generate a Presence Detect Changed interrupt
when hot-add a device.
But it seems that we should keep the PHY's power and clocks to ensure
the data link layer state change can be detected, and keep the MAC layer
active for routing the interrupt event to pciehp driver handler.
For the power saving requirement, the modules that is not used when
probe-time must be powered off, so I think we may not support hot-plug
in this case.
Thanks
Powered by blists - more mailing lists