From 1c1464c2b19f1b96885040b8adc9cf5ba3c7b32d Mon Sep 17 00:00:00 2001 From: Jean-Jacques Hiblot Date: Tue, 22 Jan 2019 16:48:16 +0100 Subject: usb: ether: call _usb_eth_halt() if initialization fails If the host does not respond in time, the initialization fails. However the usb ether driver will still be registered. This will make usb_gadget_probe_driver() fail the next time the initialization is attempted because it cannot find an available UDC. Fixing this by calling _usb_eth_halt() when the init fails. Signed-off-by: Jean-Jacques Hiblot Acked-by: Lukasz Majewski --- drivers/usb/gadget/ether.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index e4993dc6e62..0b5a1a47966 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -2333,6 +2333,8 @@ fail: } /*-------------------------------------------------------------------------*/ +static void _usb_eth_halt(struct ether_priv *priv); + static int _usb_eth_init(struct ether_priv *priv) { struct eth_dev *dev = &priv->ethdev; @@ -2406,6 +2408,7 @@ static int _usb_eth_init(struct ether_priv *priv) rx_submit(dev, dev->rx_req, 0); return 0; fail: + _usb_eth_halt(priv); return -1; } @@ -2485,7 +2488,7 @@ static int _usb_eth_recv(struct ether_priv *priv) return 0; } -void _usb_eth_halt(struct ether_priv *priv) +static void _usb_eth_halt(struct ether_priv *priv) { struct eth_dev *dev = &priv->ethdev; -- cgit v1.3.1 From 3c29a5673617c8f03e0494febca310c2ea1f7ed9 Mon Sep 17 00:00:00 2001 From: Adam Ford Date: Thu, 24 Jan 2019 14:33:36 -0600 Subject: regulator: pbias: Handle extended drain IO when changing omap36 PBIAS The OMAP36 and DM37 TRM state to disable extneded drain IO before changing the PBIAS. This patch does this before pmic writes if the CONFIG_MMC_OMAP36XX_PINS flag is set and the cpu family is omap36xx Signed-off-by: Adam Ford --- drivers/power/regulator/pbias_regulator.c | 49 +++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/power/regulator/pbias_regulator.c b/drivers/power/regulator/pbias_regulator.c index 366f97b38b7..4ed3c94e031 100644 --- a/drivers/power/regulator/pbias_regulator.c +++ b/drivers/power/regulator/pbias_regulator.c @@ -14,6 +14,11 @@ #include #include #include +#ifdef CONFIG_MMC_OMAP36XX_PINS +#include +#include +#include +#endif struct pbias_reg_info { u32 enable; @@ -223,8 +228,11 @@ static int pbias_regulator_get_value(struct udevice *dev) static int pbias_regulator_set_value(struct udevice *dev, int uV) { const struct pbias_reg_info *p = dev_get_priv(dev); - int rc; + int rc, ret; u32 reg; +#ifdef CONFIG_MMC_OMAP36XX_PINS + u32 wkup_ctrl = readl(OMAP34XX_CTRL_WKUP_CTRL); +#endif rc = pmic_read(dev->parent, 0, (uint8_t *)®, sizeof(reg)); if (rc) @@ -240,7 +248,23 @@ static int pbias_regulator_set_value(struct udevice *dev, int uV) debug("Setting %s voltage to %s\n", p->name, (reg & p->vmode) ? "3.0v" : "1.8v"); - return pmic_write(dev->parent, 0, (uint8_t *)®, sizeof(reg)); +#ifdef CONFIG_MMC_OMAP36XX_PINS + if (get_cpu_family() == CPU_OMAP36XX) { + /* Disable extended drain IO before changing PBIAS */ + wkup_ctrl &= ~OMAP34XX_CTRL_WKUP_CTRL_GPIO_IO_PWRDNZ; + writel(wkup_ctrl, OMAP34XX_CTRL_WKUP_CTRL); + } +#endif + ret = pmic_write(dev->parent, 0, (uint8_t *)®, sizeof(reg)); +#ifdef CONFIG_MMC_OMAP36XX_PINS + if (get_cpu_family() == CPU_OMAP36XX) { + /* Enable extended drain IO after changing PBIAS */ + writel(wkup_ctrl | + OMAP34XX_CTRL_WKUP_CTRL_GPIO_IO_PWRDNZ, + OMAP34XX_CTRL_WKUP_CTRL); + } +#endif + return ret; } static int pbias_regulator_get_enable(struct udevice *dev) @@ -264,9 +288,20 @@ static int pbias_regulator_set_enable(struct udevice *dev, bool enable) const struct pbias_reg_info *p = dev_get_priv(dev); int rc; u32 reg; +#ifdef CONFIG_MMC_OMAP36XX_PINS + u32 wkup_ctrl = readl(OMAP34XX_CTRL_WKUP_CTRL); +#endif debug("Turning %s %s\n", enable ? "on" : "off", p->name); +#ifdef CONFIG_MMC_OMAP36XX_PINS + if (get_cpu_family() == CPU_OMAP36XX) { + /* Disable extended drain IO before changing PBIAS */ + wkup_ctrl &= ~OMAP34XX_CTRL_WKUP_CTRL_GPIO_IO_PWRDNZ; + writel(wkup_ctrl, OMAP34XX_CTRL_WKUP_CTRL); + } +#endif + rc = pmic_read(dev->parent, 0, (uint8_t *)®, sizeof(reg)); if (rc) return rc; @@ -278,6 +313,16 @@ static int pbias_regulator_set_enable(struct udevice *dev, bool enable) reg |= p->disable_val; rc = pmic_write(dev->parent, 0, (uint8_t *)®, sizeof(reg)); + +#ifdef CONFIG_MMC_OMAP36XX_PINS + if (get_cpu_family() == CPU_OMAP36XX) { + /* Enable extended drain IO after changing PBIAS */ + writel(wkup_ctrl | + OMAP34XX_CTRL_WKUP_CTRL_GPIO_IO_PWRDNZ, + OMAP34XX_CTRL_WKUP_CTRL); + } +#endif + if (rc) return rc; -- cgit v1.3.1