public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fdt: pci: Permit use of reg property for setting device address
Date: Wed, 21 Jan 2015 10:33:06 +0100	[thread overview]
Message-ID: <1421832786.6818.73.camel@collabora.co.uk> (raw)
In-Reply-To: <1421723963-5269-1-git-send-email-sjg@chromium.org>

On Mon, 2015-01-19 at 20:19 -0700, Simon Glass wrote:
> In commit a62e84d the old functionality of obtaining a PCI address from the
> 'reg' property was lost. Add it back, so we can support both a compatible
> string list and a 'reg' property.
> 
> This patch fixes PCIe ethernet on Tegra boards.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  lib/fdtdec.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> index 89dac4c..0488607 100644
> --- a/lib/fdtdec.c
> +++ b/lib/fdtdec.c
> @@ -219,8 +219,14 @@ int fdtdec_get_pci_bdf(const void *blob, int node,
>  
>  	/* get vendor id & device id from the compatible string */
>  	ret = fdtdec_get_pci_vendev(blob, node, &dt_vendor, &dt_device);
> -	if (ret)
> -		return ret;
> +	if (ret) {
> +		/* Fall back to using the 'reg' property */
> +		ret = fdtdec_get_int(blob, node, "reg", -1);
> +		if (ret == -1)
> +			return -ENOENT;
> +		*bdf = ret & 0xffffff;
> +		return 0;
> +	}

Unless I'm missing something, this makes no sense. the 'reg' property
should contain the physical address of the PCI device which this
function already gets as one of its input parameters. Unless there is
some valid case where the passed address isn't correct for the node ?


-- 
Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Collabora Ltd.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6170 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150121/a49942fd/attachment.bin>

      parent reply	other threads:[~2015-01-21  9:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-20  3:19 [U-Boot] [PATCH] fdt: pci: Permit use of reg property for setting device address Simon Glass
2015-01-20 12:59 ` Bin Meng
2015-01-20 14:31   ` Simon Glass
2015-01-21  2:00     ` Bin Meng
2015-01-21  8:05       ` Thierry Reding
2015-01-21  8:46         ` Bin Meng
2015-01-21  9:33           ` Thierry Reding
2015-01-21  9:33 ` Sjoerd Simons [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=1421832786.6818.73.camel@collabora.co.uk \
    --to=sjoerd.simons@collabora.co.uk \
    --cc=u-boot@lists.denx.de \
    /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