linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Lucas Stach <l.stach@pengutronix.de>
Cc: linux-pci@vger.kernel.org, Richard Zhu <r65037@freescale.com>,
	Mohit Kumar <mohit.kumar@st.com>,
	Jingoo Han <jg1.han@samsung.com>, Marek Vasut <marex@denx.de>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	kernel@pengutronix.de, Pratyush Anand <pratyush.anand@st.com>
Subject: Re: [PATCH 1/4] PCI: designware: start parsing bus-range
Date: Wed, 3 Sep 2014 12:37:49 -0600	[thread overview]
Message-ID: <20140903183749.GB26073@google.com> (raw)
In-Reply-To: <1406137961-14684-2-git-send-email-l.stach@pengutronix.de>

On Wed, Jul 23, 2014 at 07:52:38PM +0200, Lucas Stach wrote:
> This allows to explicitly specify the covered bus
> numbers in the devicetree, which will come in handy
> once we see a SoC with more than one PCIe host
> controller instance.
> 
> Previously the driver relied on the behavior of
> pci_scan_root_bus() to fill in a range of 0x00-0xff
> if no valid range was found. We fall back to the
> same range if no valid DT entry was found to keep
> backwards compatibility, but now do it explicitly.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  Documentation/devicetree/bindings/pci/designware-pcie.txt |  3 +++
>  drivers/pci/host/pcie-designware.c                        | 13 ++++++++++++-
>  drivers/pci/host/pcie-designware.h                        |  1 +
>  3 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/pci/designware-pcie.txt b/Documentation/devicetree/bindings/pci/designware-pcie.txt
> index ed0d9b9fff2b..9f4faa8e8d00 100644
> --- a/Documentation/devicetree/bindings/pci/designware-pcie.txt
> +++ b/Documentation/devicetree/bindings/pci/designware-pcie.txt
> @@ -23,3 +23,6 @@ Required properties:
>  
>  Optional properties:
>  - reset-gpio: gpio pin number of power good signal
> +- bus-range: PCI bus numbers covered (it is recommended for new devicetrees to
> +  specify this property, to keep backwards compatibility a range of 0x00-0xff
> +  is assumed if not present)
> diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
> index 52bd3a143563..b13a830c8b0f 100644
> --- a/drivers/pci/host/pcie-designware.c
> +++ b/drivers/pci/host/pcie-designware.c
> @@ -425,7 +425,7 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
>  	struct resource *cfg_res;
>  	u32 val, na, ns;
>  	const __be32 *addrp;
> -	int i, index;
> +	int i, index, ret;
>  
>  	/* Find the address cell size and the number of cells in order to get
>  	 * the untranslated address.
> @@ -500,6 +500,16 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
>  		}
>  	}
>  
> +	ret = of_pci_parse_bus_range(np, &pp->busn);
> +	if (ret < 0) {
> +		dev_dbg(pp->dev, "failed to parse bus-range property: %d, using default [0x00-0xff]\n",
> +			ret);
> +		pp->busn.name = np->name;
> +		pp->busn.start = 0;
> +		pp->busn.end = 0xff;
> +		pp->busn.flags = IORESOURCE_BUS;
> +	}
> +

I tweaked this to look like:

+       if (ret < 0) {
+               pp->busn.name = np->name;
+               pp->busn.start = 0;
+               pp->busn.end = 0xff;
+               pp->busn.flags = IORESOURCE_BUS;
+               dev_dbg(pp->dev, "failed to parse bus-range property: %d, using default %pR\n",
+                       ret, &pp->busn);

to avoid the repetition of 0x00 and 0xff.

Pratyush, I added your Reviewed-by to patches 1 and 2, which I missed before.

Bjorn

  parent reply	other threads:[~2014-09-03 18:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 17:52 [PATCH 0/4] PCI: designware: init order/resource alloc fixes Lucas Stach
2014-07-23 17:52 ` [PATCH 1/4] PCI: designware: start parsing bus-range Lucas Stach
2014-08-16 12:26   ` Pratyush Anand
2014-09-03 18:37   ` Bjorn Helgaas [this message]
2014-07-23 17:52 ` [PATCH 2/4] PCI: designware: get rid of pci_scan_root_bus Lucas Stach
2014-07-24  4:11   ` Jingoo Han
2014-07-24  8:32     ` Lucas Stach
2014-07-24  8:55       ` Jingoo Han
2014-07-24  9:02         ` Lucas Stach
2014-07-25  0:39           ` Jingoo Han
2014-08-16 12:27   ` Pratyush Anand
2014-07-23 17:52 ` [PATCH 3/4] PCI: designware: remove pci_assign_unassigned_resources call Lucas Stach
2014-08-16 13:13   ` Pratyush Anand
2014-08-17  2:59     ` Yinghai Lu
2014-08-17  6:20       ` Pratyush Anand
2014-08-18 15:39         ` Murali Karicheri
2014-07-23 17:52 ` [PATCH 4/4] PCI: imx6: move to module_init Lucas Stach
2014-07-24  6:32   ` Hong-Xing.Zhu
2014-07-23 18:08 ` [PATCH 0/4] PCI: designware: init order/resource alloc fixes Marek Vasut
2014-09-02 23:10 ` Bjorn Helgaas
2014-09-03  4:19   ` Mohit KUMAR DCG
2014-09-03 18:33 ` Bjorn Helgaas

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=20140903183749.GB26073@google.com \
    --to=bhelgaas@google.com \
    --cc=jg1.han@samsung.com \
    --cc=kernel@pengutronix.de \
    --cc=kishon@ti.com \
    --cc=l.stach@pengutronix.de \
    --cc=linux-pci@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=mohit.kumar@st.com \
    --cc=pratyush.anand@st.com \
    --cc=r65037@freescale.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).