From 5c88b6ad400c42cabd347ad58098b149ede34281 Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Mon, 14 Dec 2020 12:34:19 +0100 Subject: [PATCH 1/2] usb: dwc3-meson-g12a: always configure dr-mode dwc3_meson_g12a_force_mode() sets the dr-mode of the USB PHY. However it skips setting the mode if it matches the one done during driver probe (stored in private structure). This fails if the mode has been changed to other value and then back to initial one. Fix this by configuring the dr-mode always, regadless of the one set at the driver probe). This fixes operation of USB gadget based drivers when they are initialized for the second time. Signed-off-by: Marek Szyprowski Acked-by: Neil Armstrong Signed-off-by: Neil Armstrong --- drivers/usb/dwc3/dwc3-meson-g12a.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c index 6567502cdd1..6f0bac2a00c 100644 --- a/drivers/usb/dwc3/dwc3-meson-g12a.c +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -269,9 +269,6 @@ int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_mode mode) if (!priv->phys[USB2_OTG_PHY].dev) return -EINVAL; - if (mode == priv->otg_mode) - return 0; - if (mode == USB_DR_MODE_HOST) debug("%s: switching to Host Mode\n", __func__); else From 5ccd5d2cc98224108ae9fb09593a862c9caa5e80 Mon Sep 17 00:00:00 2001 From: Neil Armstrong Date: Mon, 14 Dec 2020 19:39:07 +0100 Subject: [PATCH 2/2] pinctrl: meson: fix bit manipulation of pin bias configuration This fixes the wrong usage of clrsetbits_le32(), badly setting the set argument. Fixes: c4c726c26b ("pinctrl: meson: add pinconf support") Reported-by: Anton Arapov Reported-by: Otto Meier Signed-off-by: Neil Armstrong --- drivers/pinctrl/meson/pinctrl-meson.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c index d4539b02d88..5065b624367 100644 --- a/drivers/pinctrl/meson/pinctrl-meson.c +++ b/drivers/pinctrl/meson/pinctrl-meson.c @@ -216,13 +216,13 @@ static int meson_pinconf_bias_set(struct udevice *dev, unsigned int pin, } /* othewise, enable the bias and select level */ - clrsetbits_le32(priv->reg_pullen + reg, BIT(bit), 1); + clrsetbits_le32(priv->reg_pullen + reg, BIT(bit), BIT(bit)); ret = meson_gpio_calc_reg_and_bit(dev, offset, REG_PULL, ®, &bit); if (ret) return ret; clrsetbits_le32(priv->reg_pull + reg, BIT(bit), - param == PIN_CONFIG_BIAS_PULL_UP); + (param == PIN_CONFIG_BIAS_PULL_UP ? BIT(bit) : 0)); return 0; }