public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
From: "Jianjun Wang (王建军)" <Jianjun.Wang@mediatek.com>
To: "lorenzo@kernel.org" <lorenzo@kernel.org>,
	"helgaas@kernel.org" <helgaas@kernel.org>
Cc: "linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"manivannan.sadhasivam@linaro.org"
	<manivannan.sadhasivam@linaro.org>,
	"robh@kernel.org" <robh@kernel.org>,
	"kw@linux.com" <kw@linux.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"lpieralisi@kernel.org" <lpieralisi@kernel.org>,
	Ryder Lee <Ryder.Lee@mediatek.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: [PATCH 3/3] PCI: mediatek-gen3: Move reset/assert callbacks in .power_up()
Date: Mon, 11 Nov 2024 06:04:24 +0000	[thread overview]
Message-ID: <026a225fde4f4e499f75c24551bbce3199a8d2e7.camel@mediatek.com> (raw)
In-Reply-To: <Zy5JJuAsxPqEos4I@lore-desk>

On Fri, 2024-11-08 at 18:23 +0100, lorenzo@kernel.org wrote:
> On Nov 08, Bjorn Helgaas wrote:
> > On Fri, Nov 08, 2024 at 06:04:13PM +0100, lorenzo@kernel.org wrote:
> > > > On Fri, Nov 08, 2024 at 09:39:41AM +0100, lorenzo@kernel.org
> > > > wrote:
> > > > > > On Thu, 2024-11-07 at 17:08 +0100, Lorenzo Bianconi wrote:
> > > > > > > > On Thu, Nov 07, 2024 at 02:50:55PM +0100, Lorenzo
> > > > > > > > Bianconi wrote:
> > > > > > > > > In order to make the code more readable, move phy and
> > > > > > > > > mac
> > > > > > > > > reset lines assert/de-assert configuration in
> > > > > > > > > .power_up
> > > > > > > > > callback
> > > > > > > > > (mtk_pcie_en7581_power_up/mtk_pcie_power_up).
> > > > > > > > > +	/*
> > > > > > > > > +	 * The controller may have been left out of
> > > > > > > > > reset by the
> > > > > > > > > bootloader
> > > > > > > > > +	 * so make sure that we get a clean start by
> > > > > > > > > asserting resets
> > > > > > > > > here.
> > > > > > > > > +	 */
> > > > > > > > > +	reset_control_bulk_assert(pcie->soc-
> > > > > > > > > >phy_resets.num_resets,
> > > > > > > > > +				  pcie->phy_resets);
> > > > > > > > > +	reset_control_assert(pcie->mac_reset);
> > > > > > > > > +	usleep_range(10, 20);
> > > > > > > > 
> > > > > > > > Unrelated to this patch, but since you're moving it, do
> > > > > > > > you
> > > > > > > > know what this delay is for?  Can we add a #define and
> > > > > > > > a spec
> > > > > > > > citation for it?
> > > > > > > 
> > > > > > > I am not sure about it, this was already there.  @Jianjun
> > > > > > > Wang:
> > > > > > > any input on it?
> > > > > > 
> > > > > > This delay is used to ensure the reset is effective. A
> > > > > > delay of
> > > > > > 10us should be sufficient in this scenario.
> > > > > 
> > > > > ack, so we can introduce a marco like:
> > > > > 
> > > > > #define PCIE_RESET_TIME_US	10
> > > > > ...
> > > > > 
> > > > > usleep_range(PCIE_RESET_TIME_US, 2 * PCIE_RESET_TIME_US);
> > > > 
> > > > Unless this corresponds to a value specified by the PCIe base
> > > > spec
> > > > or CEM spec, this macro should be internal to
> > > > pcie-mediatek-gen3.c.
> > > 
> > > My plan is to add it in pcie-mediatek-gen3.c. Do you think
> > > PCIE_RESET_TIME_US is too generic?
> > 
> > It's generic, but so are most of the other #defines in
> > pcie-mediatek-gen3.c, so I'd follow suit.
> > 
> > Connect it to language in the MediaTek spec if possible, i.e., if
> > the
> > spec names this parameter, try to use the same name.
> 
> unfortunately I do not have any mediatek spec documentation
> available.
> 
> @Jianjun Wang: is PCIE_RESET_TIME_US fine for you or according to the
> available
> documentation?

It's fine for me.

Thanks.

> 
> Regards,
> Lorenzo

      reply	other threads:[~2024-11-11  6:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-07 13:50 [PATCH 0/3] PCI: mediatek-gen3: mtk_pcie_en7581_power_up code refactoring Lorenzo Bianconi
2024-11-07 13:50 ` [PATCH 1/3] PCI: mediatek-gen3: Add missing reset_control_deassert for mac_rst in mtk_pcie_en7581_power_up Lorenzo Bianconi
2024-11-07 13:50 ` [PATCH 2/3] PCI: mediatek-gen3: rely on clk_bulk_prepare_enable " Lorenzo Bianconi
2024-11-07 15:19   ` Bjorn Helgaas
2024-11-07 15:28     ` Lorenzo Bianconi
2024-11-07 13:50 ` [PATCH 3/3] PCI: mediatek-gen3: Move reset/assert callbacks in .power_up() Lorenzo Bianconi
2024-11-07 15:27   ` Bjorn Helgaas
2024-11-07 16:08     ` Lorenzo Bianconi
2024-11-07 16:21       ` Bjorn Helgaas
2024-11-07 16:37         ` Lorenzo Bianconi
2024-11-08  2:51         ` Jianjun Wang (王建军)
2024-11-08 16:48           ` Bjorn Helgaas
2024-11-08 17:15             ` lorenzo
2024-11-08  2:41       ` Jianjun Wang (王建军)
2024-11-08  8:39         ` lorenzo
2024-11-08 16:37           ` Bjorn Helgaas
2024-11-08 17:04             ` lorenzo
2024-11-08 17:17               ` Bjorn Helgaas
2024-11-08 17:23                 ` lorenzo
2024-11-11  6:04                   ` Jianjun Wang (王建军) [this message]

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=026a225fde4f4e499f75c24551bbce3199a8d2e7.camel@mediatek.com \
    --to=jianjun.wang@mediatek.com \
    --cc=Ryder.Lee@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=kw@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox