public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Thomas Chou <thomas@wytron.com.tw>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] net: altera_tse: get numbers of fdt address and size cells
Date: Fri, 6 Nov 2015 09:30:06 +0800	[thread overview]
Message-ID: <563C029E.2020002@wytron.com.tw> (raw)
In-Reply-To: <1446640121-4835-1-git-send-email-thomas@wytron.com.tw>



On 2015?11?04? 20:28, Thomas Chou wrote:
> Get numbers of fdt address and size cells in altera_tse_probe(),
> thereby remove the assumption of one address cell and one size
> cell.
>
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
>   drivers/net/altera_tse.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
>

Applied to u-boot-nios.

> diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
> index 394503f..b2002f4 100644
> --- a/drivers/net/altera_tse.c
> +++ b/drivers/net/altera_tse.c
> @@ -409,20 +409,22 @@ static int altera_tse_probe(struct udevice *dev)
>   {
>   	struct eth_pdata *pdata = dev_get_platdata(dev);
>   	struct altera_tse_priv *priv = dev_get_priv(dev);
> -	const void *blob = gd->fdt_blob;
> +	void *blob = (void *)gd->fdt_blob;
>   	int node = dev->of_offset;
>   	const char *list, *end;
>   	const fdt32_t *cell;
>   	void *base, *desc_mem = NULL;
>   	unsigned long addr, size;
> +	int parent, addrc, sizec;
>   	int len, idx;
>   	int ret;
>
>   	/*
> -	 * decode regs, assume address-cells and size-cells are both one.
> -	 * there are multiple reg tuples, and they need to match with
> -	 * reg-names.
> +	 * decode regs. there are multiple reg tuples, and they need to
> +	 * match with reg-names.
>   	 */
> +	parent = fdt_parent_offset(blob, node);
> +	of_bus_default_count_cells(blob, parent, &addrc, &sizec);
>   	list = fdt_getprop(blob, node, "reg-names", &len);
>   	if (!list)
>   		return -ENOENT;
> @@ -434,7 +436,7 @@ static int altera_tse_probe(struct udevice *dev)
>   	while (list < end) {
>   		addr = fdt_translate_address((void *)blob,
>   					     node, cell + idx);
> -		size = fdt_addr_to_cpu(cell[idx + 1]);
> +		size = fdt_addr_to_cpu(cell[idx + addrc]);
>   		base = ioremap(addr, size);
>   		len = strlen(list);
>   		if (strcmp(list, "control_port") == 0)
> @@ -445,7 +447,7 @@ static int altera_tse_probe(struct udevice *dev)
>   			priv->sgdma_tx = base;
>   		else if (strcmp(list, "s1") == 0)
>   			desc_mem = base;
> -		idx += 2;
> +		idx += addrc + sizec;
>   		list += (len + 1);
>   	}
>   	/* decode fifo depth */
>

      parent reply	other threads:[~2015-11-06  1:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04 12:28 [U-Boot] [PATCH] net: altera_tse: get numbers of fdt address and size cells Thomas Chou
2015-11-04 18:24 ` Joe Hershberger
2015-11-06  1:30 ` Thomas Chou [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=563C029E.2020002@wytron.com.tw \
    --to=thomas@wytron.com.tw \
    --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