mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-11-28 22:21:49 +01:00
pci: pci_mvebu: Inline mvebu_pcie_port_parse_dt() function
Function mvebu_pcie_port_parse_dt() is called only from mvebu_pcie_of_to_plat() function. Both these function parse DT properties required to setup mvebu pcie. So inline mvebu_pcie_port_parse_dt() function into mvebu_pcie_of_to_plat() to have all code related to parsing DT properties at one place. Signed-off-by: Pali Rohár <pali@kernel.org>
This commit is contained in:
parent
537b0142b0
commit
6f4988f90c
@ -479,22 +479,6 @@ static int mvebu_pcie_probe(struct udevice *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mvebu_pcie_port_parse_dt(ofnode node, struct mvebu_pcie *pcie)
|
|
||||||
{
|
|
||||||
const u32 *addr;
|
|
||||||
int len;
|
|
||||||
|
|
||||||
addr = ofnode_get_property(node, "assigned-addresses", &len);
|
|
||||||
if (!addr) {
|
|
||||||
pr_err("property \"assigned-addresses\" not found");
|
|
||||||
return -FDT_ERR_NOTFOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
pcie->base = (void *)(fdt32_to_cpu(addr[2]) + SOC_REGS_PHY_BASE);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DT_FLAGS_TO_TYPE(flags) (((flags) >> 24) & 0x03)
|
#define DT_FLAGS_TO_TYPE(flags) (((flags) >> 24) & 0x03)
|
||||||
#define DT_TYPE_IO 0x1
|
#define DT_TYPE_IO 0x1
|
||||||
#define DT_TYPE_MEM32 0x2
|
#define DT_TYPE_MEM32 0x2
|
||||||
@ -558,7 +542,9 @@ static int mvebu_get_tgt_attr(ofnode node, int devfn,
|
|||||||
static int mvebu_pcie_of_to_plat(struct udevice *dev)
|
static int mvebu_pcie_of_to_plat(struct udevice *dev)
|
||||||
{
|
{
|
||||||
struct mvebu_pcie *pcie = dev_get_plat(dev);
|
struct mvebu_pcie *pcie = dev_get_plat(dev);
|
||||||
|
const u32 *addr;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
int len;
|
||||||
|
|
||||||
/* Get port number, lane number and memory target / attr */
|
/* Get port number, lane number and memory target / attr */
|
||||||
if (ofnode_read_u32(dev_ofnode(dev), "marvell,pcie-port",
|
if (ofnode_read_u32(dev_ofnode(dev), "marvell,pcie-port",
|
||||||
@ -596,9 +582,14 @@ static int mvebu_pcie_of_to_plat(struct udevice *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Parse PCIe controller register base from DT */
|
/* Parse PCIe controller register base from DT */
|
||||||
ret = mvebu_pcie_port_parse_dt(dev_ofnode(dev), pcie);
|
addr = ofnode_get_property(dev_ofnode(dev), "assigned-addresses", &len);
|
||||||
if (ret < 0)
|
if (!addr) {
|
||||||
|
printf("%s: property \"assigned-addresses\" not found\n", pcie->name);
|
||||||
|
ret = -FDT_ERR_NOTFOUND;
|
||||||
goto err;
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
pcie->base = (void *)(fdt32_to_cpu(addr[2]) + SOC_REGS_PHY_BASE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user