[PATCH v3 08/11] pci: Add DW PCIe controller support for iMX8MP SoC
Marek Vasut
marex at denx.de
Thu Mar 14 05:13:19 CET 2024
On 3/12/24 8:03 AM, Sumit Garg wrote:
> pcie_imx doesn't seem to share any useful code for iMX8 SoC and it is
> tied to quite old port of pcie_designware driver from Linux which
> suffices only iMX6 specific needs.
>
> But currently we have the common DWC specific bits which alligns pretty
> well with DW PCIe controller on iMX8MP SoC. So lets reuse those common
> bits instead as a new driver for iMX8 SoCs. It should be fairly easy to
> add support for other iMX8 variants to this driver.
>
> iMX8MP SoC also comes up with standalone PCIe PHY support, so hence we
> can reuse the generic PHY infrastructure to power on PCIe PHY.
>
> Tested-by: Tim Harvey <tharvey at gateworks.com> #imx8mp-venice*
> Tested-by: Adam Ford <aford173 at gmail.com> #imx8mp-beacon-kit
> Signed-off-by: Sumit Garg <sumit.garg at linaro.org>
[...]
> +static int pcie_dw_imx_of_to_plat(struct udevice *dev)
> +{
> + struct pcie_dw_imx *priv = dev_get_priv(dev);
> + ofnode gpr;
> + int ret;
> +
> + /* Get the controller base address */
> + priv->dw.dbi_base = (void *)dev_read_addr_name(dev, "dbi");
> + if ((fdt_addr_t)priv->dw.dbi_base == FDT_ADDR_T_NONE) {
> + dev_err(dev, "failed to get dbi_base address\n");
> + return -EINVAL;
> + }
> +
> + /* Get the config space base address and size */
> + priv->dw.cfg_base = (void *)dev_read_addr_size_name(dev, "config",
> + &priv->dw.cfg_size);
> + if ((fdt_addr_t)priv->dw.cfg_base == FDT_ADDR_T_NONE) {
> + dev_err(dev, "failed to get cfg_base address\n");
> + return -EINVAL;
> + }
> +
> + ret = clk_get_bulk(dev, &priv->clks);
> + if (ret) {
> + dev_err(dev, "failed to get PCIe clks\n");
> + return ret;
> + }
> +
> + ret = reset_get_by_name(dev, "apps", &priv->apps_reset);
> + if (ret) {
> + dev_err(dev,
> + "Failed to get PCIe apps reset control\n");
> + goto err_reset;
> + }
> +
> + ret = gpio_request_by_name(dev, "reset-gpio", 0, &priv->reset_gpio,
> + (GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE));
The extra parenthesis () is not needed.
With that fixed:
Reviewed-by: Marek Vasut <marex at denx.de>
More information about the U-Boot
mailing list