From: Marek Vasut Date: Mon, 29 Jun 2020 04:27:57 +0200 Subject: [PATCH 3/7] usb: ehci-mx6: Turn on the power domain of USB PHY In-Reply-To: <20200629021350.21262-3-peng.fan@nxp.com> References: <20200629021350.21262-1-peng.fan@nxp.com> <20200629021350.21262-3-peng.fan@nxp.com> Message-ID: <2626048e-2eb8-a3ea-ccdf-2bb7cb8a0802@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 6/29/20 4:13 AM, Peng Fan wrote: [...] > @@ -23,6 +25,9 @@ > #include > > #include "ehci.h" > +#if CONFIG_IS_ENABLED(POWER_DOMAIN) > +#include > +#endif The ifdef here should not be needed. > DECLARE_GLOBAL_DATA_PTR; > > @@ -590,6 +595,18 @@ static int ehci_usb_phy_mode(struct udevice *dev) > if ((fdt_addr_t)addr == FDT_ADDR_T_NONE) > return -EINVAL; > > + /* Need to power on the PHY before access it */ > +#if CONFIG_IS_ENABLED(POWER_DOMAIN) > + struct udevice phy_dev; > + struct power_domain pd; > + > + phy_dev.node = offset_to_ofnode(phy_off); > + if (!power_domain_get(&phy_dev, &pd)) { > + if (power_domain_on(&pd)) > + return -EINVAL; Please return the return value of power_domain_on() in case of failure. [...]