diff --git a/drivers/phy/allwinner/Kconfig b/drivers/phy/allwinner/Kconfig index fb1204bcc454..53772d35b36e 100644 --- a/drivers/phy/allwinner/Kconfig +++ b/drivers/phy/allwinner/Kconfig @@ -3,7 +3,8 @@ # config PHY_SUN4I_USB tristate "Allwinner sunxi SoC USB PHY driver" - depends on ARCH_SUNXI && HAS_IOMEM && OF + depends on ARCH_SUNXI || COMPILE_TEST + depends on HAS_IOMEM depends on RESET_CONTROLLER depends on EXTCON depends on POWER_SUPPLY @@ -19,7 +20,8 @@ config PHY_SUN4I_USB config PHY_SUN6I_MIPI_DPHY tristate "Allwinner A31 MIPI D-PHY Support" - depends on ARCH_SUNXI && HAS_IOMEM && OF + depends on ARCH_SUNXI || COMPILE_TEST + depends on HAS_IOMEM depends on RESET_CONTROLLER select GENERIC_PHY select GENERIC_PHY_MIPI_DPHY @@ -31,7 +33,8 @@ config PHY_SUN6I_MIPI_DPHY config PHY_SUN9I_USB tristate "Allwinner sun9i SoC USB PHY driver" - depends on ARCH_SUNXI && HAS_IOMEM && OF + depends on ARCH_SUNXI || COMPILE_TEST + depends on HAS_IOMEM depends on RESET_CONTROLLER depends on USB_SUPPORT select USB_COMMON diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c index 4bbd9ede38c8..cc5af961778d 100644 --- a/drivers/phy/allwinner/phy-sun4i-usb.c +++ b/drivers/phy/allwinner/phy-sun4i-usb.c @@ -554,6 +554,7 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work) struct sun4i_usb_phy_data *data = container_of(work, struct sun4i_usb_phy_data, detect.work); struct phy *phy0 = data->phys[0].phy; + struct sun4i_usb_phy *phy = phy_get_drvdata(phy0); bool force_session_end, id_notify = false, vbus_notify = false; int id_det, vbus_det; @@ -610,6 +611,9 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work) mutex_unlock(&phy0->mutex); } + /* Enable PHY0 passby for host mode only. */ + sun4i_usb_phy_passby(phy, !id_det); + /* Re-route PHY0 if necessary */ if (data->cfg->phy0_dual_route) sun4i_usb_phy0_reroute(data, id_det); diff --git a/drivers/phy/marvell/phy-mvebu-a3700-utmi.c b/drivers/phy/marvell/phy-mvebu-a3700-utmi.c index 94a29dea57af..ded900b06f5a 100644 --- a/drivers/phy/marvell/phy-mvebu-a3700-utmi.c +++ b/drivers/phy/marvell/phy-mvebu-a3700-utmi.c @@ -266,7 +266,6 @@ static struct platform_driver mvebu_a3700_utmi_driver = { .probe = mvebu_a3700_utmi_phy_probe, .driver = { .name = "mvebu-a3700-utmi-phy", - .owner = THIS_MODULE, .of_match_table = mvebu_a3700_utmi_of_match, }, }; diff --git a/drivers/phy/motorola/Kconfig b/drivers/phy/motorola/Kconfig index 82651524ffb9..718f8729701d 100644 --- a/drivers/phy/motorola/Kconfig +++ b/drivers/phy/motorola/Kconfig @@ -13,7 +13,7 @@ config PHY_CPCAP_USB config PHY_MAPPHONE_MDM6600 tristate "Motorola Mapphone MDM6600 modem USB PHY driver" - depends on OF && USB_SUPPORT + depends on OF && USB_SUPPORT && GPIOLIB select GENERIC_PHY help Enable this for MDM6600 USB modem to work on Motorola phones diff --git a/drivers/phy/qualcomm/phy-qcom-ufs.c b/drivers/phy/qualcomm/phy-qcom-ufs.c index f2979ccad00a..78c339b2fc8b 100644 --- a/drivers/phy/qualcomm/phy-qcom-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-ufs.c @@ -459,7 +459,7 @@ out: } /* Turn OFF M-PHY RMMI interface clocks */ -void ufs_qcom_phy_disable_iface_clk(struct ufs_qcom_phy *phy) +static void ufs_qcom_phy_disable_iface_clk(struct ufs_qcom_phy *phy) { if (phy->is_iface_clk_enabled) { clk_disable_unprepare(phy->tx_iface_clk); diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c index e32edeebcd63..8ad366ee6ada 100644 --- a/drivers/phy/rockchip/phy-rockchip-typec.c +++ b/drivers/phy/rockchip/phy-rockchip-typec.c @@ -400,7 +400,7 @@ struct phy_reg { u32 addr; }; -struct phy_reg usb3_pll_cfg[] = { +static struct phy_reg usb3_pll_cfg[] = { { 0xf0, CMN_PLL0_VCOCAL_INIT }, { 0x18, CMN_PLL0_VCOCAL_ITER }, { 0xd0, CMN_PLL0_INTDIV }, @@ -417,7 +417,7 @@ struct phy_reg usb3_pll_cfg[] = { { 0x8, CMN_DIAG_PLL0_LF_PROG }, }; -struct phy_reg dp_pll_cfg[] = { +static struct phy_reg dp_pll_cfg[] = { { 0xf0, CMN_PLL1_VCOCAL_INIT }, { 0x18, CMN_PLL1_VCOCAL_ITER }, { 0x30b9, CMN_PLL1_VCOCAL_START }, diff --git a/drivers/phy/ti/Kconfig b/drivers/phy/ti/Kconfig index 103efc456a12..022ac16f626c 100644 --- a/drivers/phy/ti/Kconfig +++ b/drivers/phy/ti/Kconfig @@ -37,7 +37,7 @@ config OMAP_USB2 depends on USB_SUPPORT select GENERIC_PHY select USB_PHY - select OMAP_CONTROL_PHY if ARCH_OMAP2PLUS + select OMAP_CONTROL_PHY if ARCH_OMAP2PLUS || COMPILE_TEST help Enable this to support the transceiver that is part of SOC. This driver takes care of all the PHY functionality apart from comparator. diff --git a/drivers/phy/ti/phy-twl4030-usb.c b/drivers/phy/ti/phy-twl4030-usb.c index c267afb68f07..176e16a36553 100644 --- a/drivers/phy/ti/phy-twl4030-usb.c +++ b/drivers/phy/ti/phy-twl4030-usb.c @@ -172,6 +172,7 @@ struct twl4030_usb { int irq; enum musb_vbus_id_status linkstat; + atomic_t connected; bool vbus_supplied; bool musb_mailbox_pending; @@ -575,39 +576,29 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) { struct twl4030_usb *twl = _twl; enum musb_vbus_id_status status; - bool status_changed = false; int err; status = twl4030_usb_linkstat(twl); mutex_lock(&twl->lock); - if (status >= 0 && status != twl->linkstat) { - status_changed = - cable_present(twl->linkstat) != - cable_present(status); - twl->linkstat = status; - } + twl->linkstat = status; mutex_unlock(&twl->lock); - if (status_changed) { - /* FIXME add a set_power() method so that B-devices can - * configure the charger appropriately. It's not always - * correct to consume VBUS power, and how much current to - * consume is a function of the USB configuration chosen - * by the host. - * - * REVISIT usb_gadget_vbus_connect(...) as needed, ditto - * its disconnect() sibling, when changing to/from the - * USB_LINK_VBUS state. musb_hdrc won't care until it - * starts to handle softconnect right. - */ - if (cable_present(status)) { + if (cable_present(status)) { + if (atomic_add_unless(&twl->connected, 1, 1)) { + dev_dbg(twl->dev, "%s: cable connected %i\n", + __func__, status); pm_runtime_get_sync(twl->dev); - } else { + twl->musb_mailbox_pending = true; + } + } else { + if (atomic_add_unless(&twl->connected, -1, 0)) { + dev_dbg(twl->dev, "%s: cable disconnected %i\n", + __func__, status); pm_runtime_mark_last_busy(twl->dev); pm_runtime_put_autosuspend(twl->dev); + twl->musb_mailbox_pending = true; } - twl->musb_mailbox_pending = true; } if (twl->musb_mailbox_pending) { err = musb_mailbox(status);