linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Hanjie Lin <hanjie.lin@amlogic.com>
Cc: Yixun Lan <yixun.lan@amlogic.com>, Rob Herring <robh@kernel.org>,
	Jianxin Pan <jianxin.pan@amlogic.com>,
	Kevin Hilman <khilman@baylibre.com>,
	Shawn Lin <shawn.lin@rock-chips.com>,
	Philippe Ombredanne <pombredanne@nexb.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yue Wang <yue.wang@amlogic.com>,
	Qiufang Dai <qiufang.dai@amlogic.com>,
	Jian Hu <jian.hu@amlogic.com>,
	Liang Yang <liang.yang@amlogic.com>,
	Bjorn Helgaas <helgaas@kernel.org>,
	Gustavo Pimentel <gustavo.pimentel@synopsys.com>,
	Carlo Caione <carlo@caione.org>,
	Cyrille Pitchen <cyrille.pitchen@free-electrons.com>,
	linux-amlogic@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	Jerome Brunet <jbrunet@baylibre.com>
Subject: Re: [PATCH v8 2/2] PCI: amlogic: Add the Amlogic Meson PCIe controller driver
Date: Wed, 19 Dec 2018 15:13:55 +0000	[thread overview]
Message-ID: <20181219151355.GA25410@e107981-ln.cambridge.arm.com> (raw)
In-Reply-To: <df9e974d-cac8-3522-fdbe-1811160bb4fc@amlogic.com>

On Wed, Dec 19, 2018 at 07:13:47PM +0800, Hanjie Lin wrote:
> 
> 
> On 2018/12/19 6:47, Bjorn Helgaas wrote:
> > On Tue, Dec 18, 2018 at 04:04:46PM +0800, Hanjie Lin wrote:
> >> From: Yue Wang <yue.wang@amlogic.com>
> >>
> >> The Amlogic Meson PCIe host controller is based on the Synopsys DesignWare
> >> PCI core. This patch adds the driver support for Meson PCIe controller.
> > 
> > I don't have any comments on the code itself; just the trivial things
> > below.  No need to repost for these unless you're changing something
> > else.
> > 
> > I thought it looked very pretty overall, thanks for paying attention
> > to that!
> > 
> >> +static int meson_size_to_payload(struct meson_pcie *mp, int size)
> >> +{
> >> +	struct device *dev = mp->pci.dev;
> >> +
> >> +	/*
> >> +	 * dwc supports 2^(val+7) payload size, which val is 0~5 default to 1.
> >> +	 * So if input size is not 2^order alignment or less than 2^7 or bigger
> >> +	 * than 2^12, just set to default size 2^(1+7).
> >> +	 */
> >> +	if (!is_power_of_2(size) || size < 128 || size > 4096) {
> >> +		dev_warn(dev, "playload size %d, set to default 256\n", size);
> > 
> > s/playload/payload/
> > 
> >> +static void meson_set_max_payload(struct meson_pcie *mp, int size)
> >> +{
> >> +	u32 val = 0;
> > 
> > Unnecessary initialization.
> > 
> >> +	int max_payload_size = meson_size_to_payload(mp, size);
> >> +
> >> +	val = meson_elb_readl(mp, PCIE_DEV_CTRL_DEV_STUS);
> > 
> >> +static int meson_pcie_rd_own_conf(struct pcie_port *pp, int where, int size,
> >> +				  u32 *val)
> >> +{
> >> +	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
> >> +	int ret;
> >> +
> >> +	ret = dw_pcie_read(pci->dbi_base + where, size, val);
> >> +	if (ret != PCIBIOS_SUCCESSFUL)
> >> +		return ret;
> >> +
> >> +	/*
> >> +	 * There is a bug in the MESON AXG pcie controller whereby software
> >> +	 * cannot programme the PCI_CLASS_DEVICE register, so we must fabricate
> >> +	 * the return value in the config accessors.
> > 
> > s/pcie/PCIe/
> > s/programme/program/ (IIUC, "programme" is British and only used as a
> > noun, where here you need a verb)
> > 
> >> +static int meson_pcie_link_up(struct dw_pcie *pci)
> >> +{
> >> +	struct meson_pcie *mp = to_meson_pcie(pci);
> >> +	struct device *dev = pci->dev;
> >> +	u32 smlh_up = 0;
> >> +	u32 ltssm_up = 0;
> >> +	u32 rdlh_up = 0;
> > 
> > Unnecessary initialization of smlh_up, ltssm_up, and rdlh_up.
> > 
> >> +	u32 speed_okay = 0;
> >> +	u32 cnt = 0;
> >> +	u32 state12, state17;
> >> +
> >> +	do {
> >> +		state12 = meson_cfg_readl(mp, PCIE_CFG_STATUS12);
> >> +		state17 = meson_cfg_readl(mp, PCIE_CFG_STATUS17);
> >> +		smlh_up = IS_SMLH_LINK_UP(state12);
> >> +		rdlh_up = IS_RDLH_LINK_UP(state12);
> >> +		ltssm_up = IS_LTSSM_UP(state12);
> > 
> >> +	dev_err(dev, "Error: Wait linkup timeout.\n");
> > 
> > Message doesn't match others from driver (capitalization and trailing
> > period).
> > 
> >> +			dev_err(dev, "failed to get msi irq\n");
> > 
> > s/msi irq/MSI IRQ/
> > 
> >> +	ret = meson_add_pcie_port(mp, pdev);
> >> +	if (ret < 0) {
> >> +		dev_err(dev, "Add PCIE port failed, %d\n", ret);
> > 
> > s/PCIE/PCIe/
> > 
> > All the messages in this function are capitalized differently than
> > other messages in the driver.
> > 
> > Bjorn
> > 
> > .
> > 
> 
> hi Bjorn:
> 
> Thanks for the all suggestions and corrections.
> 
> There were too many code details unnecessary initialization, typing errors
> and coding style etc. I will pay more attention to these rules and code-details
> in the future patches also my daily work.

I have merged your patches with Bjorn's suggestions in my pci/amlogic
branch, aiming at v4.21, please have a look.

Lorenzo

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2018-12-19 15:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-18  8:04 [PATCH v8 0/2 RESEND] add the Amlogic Meson PCIe controller driver Hanjie Lin
2018-12-18  8:04 ` [PATCH v8 1/2] dt-bindings: PCI: meson: add DT bindings for Amlogic Meson PCIe controller Hanjie Lin
2018-12-18 23:14   ` Martin Blumenstingl
2018-12-19 10:57     ` Hanjie Lin
2018-12-18  8:04 ` [PATCH v8 2/2] PCI: amlogic: Add the Amlogic Meson PCIe controller driver Hanjie Lin
2018-12-18 22:47   ` Bjorn Helgaas
2018-12-19 11:13     ` Hanjie Lin
2018-12-19 15:13       ` Lorenzo Pieralisi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-12-18  7:56 [PATCH v7 0/2] add " Hanjie Lin
2018-12-18  7:56 ` [PATCH v8 2/2] PCI: amlogic: Add " Hanjie Lin

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=20181219151355.GA25410@e107981-ln.cambridge.arm.com \
    --to=lorenzo.pieralisi@arm.com \
    --cc=carlo@caione.org \
    --cc=cyrille.pitchen@free-electrons.com \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=hanjie.lin@amlogic.com \
    --cc=helgaas@kernel.org \
    --cc=jbrunet@baylibre.com \
    --cc=jian.hu@amlogic.com \
    --cc=jianxin.pan@amlogic.com \
    --cc=khilman@baylibre.com \
    --cc=liang.yang@amlogic.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=pombredanne@nexb.com \
    --cc=qiufang.dai@amlogic.com \
    --cc=robh@kernel.org \
    --cc=shawn.lin@rock-chips.com \
    --cc=yixun.lan@amlogic.com \
    --cc=yue.wang@amlogic.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).