mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 21:21:37 +00:00
net: altera_tse: get numbers of fdt address and size cells
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> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
4c8df1d359
commit
75199d6f72
1 changed files with 8 additions and 6 deletions
|
@ -409,20 +409,22 @@ static int altera_tse_probe(struct udevice *dev)
|
||||||
{
|
{
|
||||||
struct eth_pdata *pdata = dev_get_platdata(dev);
|
struct eth_pdata *pdata = dev_get_platdata(dev);
|
||||||
struct altera_tse_priv *priv = dev_get_priv(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;
|
int node = dev->of_offset;
|
||||||
const char *list, *end;
|
const char *list, *end;
|
||||||
const fdt32_t *cell;
|
const fdt32_t *cell;
|
||||||
void *base, *desc_mem = NULL;
|
void *base, *desc_mem = NULL;
|
||||||
unsigned long addr, size;
|
unsigned long addr, size;
|
||||||
|
int parent, addrc, sizec;
|
||||||
int len, idx;
|
int len, idx;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* decode regs, assume address-cells and size-cells are both one.
|
* decode regs. there are multiple reg tuples, and they need to
|
||||||
* there are multiple reg tuples, and they need to match with
|
* match with reg-names.
|
||||||
* 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);
|
list = fdt_getprop(blob, node, "reg-names", &len);
|
||||||
if (!list)
|
if (!list)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
@ -434,7 +436,7 @@ static int altera_tse_probe(struct udevice *dev)
|
||||||
while (list < end) {
|
while (list < end) {
|
||||||
addr = fdt_translate_address((void *)blob,
|
addr = fdt_translate_address((void *)blob,
|
||||||
node, cell + idx);
|
node, cell + idx);
|
||||||
size = fdt_addr_to_cpu(cell[idx + 1]);
|
size = fdt_addr_to_cpu(cell[idx + addrc]);
|
||||||
base = ioremap(addr, size);
|
base = ioremap(addr, size);
|
||||||
len = strlen(list);
|
len = strlen(list);
|
||||||
if (strcmp(list, "control_port") == 0)
|
if (strcmp(list, "control_port") == 0)
|
||||||
|
@ -445,7 +447,7 @@ static int altera_tse_probe(struct udevice *dev)
|
||||||
priv->sgdma_tx = base;
|
priv->sgdma_tx = base;
|
||||||
else if (strcmp(list, "s1") == 0)
|
else if (strcmp(list, "s1") == 0)
|
||||||
desc_mem = base;
|
desc_mem = base;
|
||||||
idx += 2;
|
idx += addrc + sizec;
|
||||||
list += (len + 1);
|
list += (len + 1);
|
||||||
}
|
}
|
||||||
/* decode fifo depth */
|
/* decode fifo depth */
|
||||||
|
|
Loading…
Add table
Reference in a new issue