Commit 0232b23d authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'usb-4.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB and PHY fixes from Greg KH:
 "Here are a number of small USB and PHY driver fixes for 4.7-rc6.

  Nothing major here, all are described in the shortlog below.  All have
  been in linux-next with no reported issues"

* tag 'usb-4.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  USB: don't free bandwidth_mutex too early
  USB: EHCI: declare hostpc register as zero-length array
  phy-sun4i-usb: Fix irq free conditions to match request conditions
  phy: bcm-ns-usb2: checking the wrong variable
  phy-sun4i-usb: fix missing __iomem *
  phy: phy-sun4i-usb: Fix optional gpios failing probe
  phy: rockchip-dp: fix return value check in rockchip_dp_phy_probe()
  phy: rcar-gen3-usb2: fix unexpected repeat interrupts of VBUS change
  usb: common: otg-fsm: add license to usb-otg-fsm
parents aa7a6c8e ab2a4bf8
...@@ -109,8 +109,8 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev) ...@@ -109,8 +109,8 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev)
} }
usb2->phy = devm_phy_create(dev, NULL, &ops); usb2->phy = devm_phy_create(dev, NULL, &ops);
if (IS_ERR(dev)) if (IS_ERR(usb2->phy))
return PTR_ERR(dev); return PTR_ERR(usb2->phy);
phy_set_drvdata(usb2->phy, usb2); phy_set_drvdata(usb2->phy, usb2);
platform_set_drvdata(pdev, usb2); platform_set_drvdata(pdev, usb2);
......
...@@ -144,12 +144,6 @@ static void rcar_gen3_init_for_peri(struct rcar_gen3_chan *ch) ...@@ -144,12 +144,6 @@ static void rcar_gen3_init_for_peri(struct rcar_gen3_chan *ch)
extcon_set_cable_state_(ch->extcon, EXTCON_USB, true); extcon_set_cable_state_(ch->extcon, EXTCON_USB, true);
} }
static bool rcar_gen3_check_vbus(struct rcar_gen3_chan *ch)
{
return !!(readl(ch->base + USB2_ADPCTRL) &
USB2_ADPCTRL_OTGSESSVLD);
}
static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch) static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch)
{ {
return !!(readl(ch->base + USB2_ADPCTRL) & USB2_ADPCTRL_IDDIG); return !!(readl(ch->base + USB2_ADPCTRL) & USB2_ADPCTRL_IDDIG);
...@@ -157,13 +151,7 @@ static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch) ...@@ -157,13 +151,7 @@ static bool rcar_gen3_check_id(struct rcar_gen3_chan *ch)
static void rcar_gen3_device_recognition(struct rcar_gen3_chan *ch) static void rcar_gen3_device_recognition(struct rcar_gen3_chan *ch)
{ {
bool is_host = true; if (!rcar_gen3_check_id(ch))
/* B-device? */
if (rcar_gen3_check_id(ch) && rcar_gen3_check_vbus(ch))
is_host = false;
if (is_host)
rcar_gen3_init_for_host(ch); rcar_gen3_init_for_host(ch);
else else
rcar_gen3_init_for_peri(ch); rcar_gen3_init_for_peri(ch);
......
...@@ -90,7 +90,7 @@ static int rockchip_dp_phy_probe(struct platform_device *pdev) ...@@ -90,7 +90,7 @@ static int rockchip_dp_phy_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL); dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL);
if (IS_ERR(dp)) if (!dp)
return -ENOMEM; return -ENOMEM;
dp->dev = dev; dp->dev = dev;
......
...@@ -175,7 +175,7 @@ static void sun4i_usb_phy_write(struct sun4i_usb_phy *phy, u32 addr, u32 data, ...@@ -175,7 +175,7 @@ static void sun4i_usb_phy_write(struct sun4i_usb_phy *phy, u32 addr, u32 data,
{ {
struct sun4i_usb_phy_data *phy_data = to_sun4i_usb_phy_data(phy); struct sun4i_usb_phy_data *phy_data = to_sun4i_usb_phy_data(phy);
u32 temp, usbc_bit = BIT(phy->index * 2); u32 temp, usbc_bit = BIT(phy->index * 2);
void *phyctl = phy_data->base + phy_data->cfg->phyctl_offset; void __iomem *phyctl = phy_data->base + phy_data->cfg->phyctl_offset;
int i; int i;
mutex_lock(&phy_data->mutex); mutex_lock(&phy_data->mutex);
...@@ -514,9 +514,9 @@ static int sun4i_usb_phy_remove(struct platform_device *pdev) ...@@ -514,9 +514,9 @@ static int sun4i_usb_phy_remove(struct platform_device *pdev)
if (data->vbus_power_nb_registered) if (data->vbus_power_nb_registered)
power_supply_unreg_notifier(&data->vbus_power_nb); power_supply_unreg_notifier(&data->vbus_power_nb);
if (data->id_det_irq >= 0) if (data->id_det_irq > 0)
devm_free_irq(dev, data->id_det_irq, data); devm_free_irq(dev, data->id_det_irq, data);
if (data->vbus_det_irq >= 0) if (data->vbus_det_irq > 0)
devm_free_irq(dev, data->vbus_det_irq, data); devm_free_irq(dev, data->vbus_det_irq, data);
cancel_delayed_work_sync(&data->detect); cancel_delayed_work_sync(&data->detect);
...@@ -645,11 +645,11 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) ...@@ -645,11 +645,11 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
data->id_det_irq = gpiod_to_irq(data->id_det_gpio); data->id_det_irq = gpiod_to_irq(data->id_det_gpio);
data->vbus_det_irq = gpiod_to_irq(data->vbus_det_gpio); data->vbus_det_irq = gpiod_to_irq(data->vbus_det_gpio);
if ((data->id_det_gpio && data->id_det_irq < 0) || if ((data->id_det_gpio && data->id_det_irq <= 0) ||
(data->vbus_det_gpio && data->vbus_det_irq < 0)) (data->vbus_det_gpio && data->vbus_det_irq <= 0))
data->phy0_poll = true; data->phy0_poll = true;
if (data->id_det_irq >= 0) { if (data->id_det_irq > 0) {
ret = devm_request_irq(dev, data->id_det_irq, ret = devm_request_irq(dev, data->id_det_irq,
sun4i_usb_phy0_id_vbus_det_irq, sun4i_usb_phy0_id_vbus_det_irq,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
...@@ -660,7 +660,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) ...@@ -660,7 +660,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
} }
} }
if (data->vbus_det_irq >= 0) { if (data->vbus_det_irq > 0) {
ret = devm_request_irq(dev, data->vbus_det_irq, ret = devm_request_irq(dev, data->vbus_det_irq,
sun4i_usb_phy0_id_vbus_det_irq, sun4i_usb_phy0_id_vbus_det_irq,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
* 675 Mass Ave, Cambridge, MA 02139, USA. * 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/mutex.h> #include <linux/mutex.h>
...@@ -450,3 +451,4 @@ int otg_statemachine(struct otg_fsm *fsm) ...@@ -450,3 +451,4 @@ int otg_statemachine(struct otg_fsm *fsm)
return fsm->state_changed; return fsm->state_changed;
} }
EXPORT_SYMBOL_GPL(otg_statemachine); EXPORT_SYMBOL_GPL(otg_statemachine);
MODULE_LICENSE("GPL");
...@@ -2598,26 +2598,23 @@ EXPORT_SYMBOL_GPL(usb_create_hcd); ...@@ -2598,26 +2598,23 @@ EXPORT_SYMBOL_GPL(usb_create_hcd);
* Don't deallocate the bandwidth_mutex until the last shared usb_hcd is * Don't deallocate the bandwidth_mutex until the last shared usb_hcd is
* deallocated. * deallocated.
* *
* Make sure to only deallocate the bandwidth_mutex when the primary HCD is * Make sure to deallocate the bandwidth_mutex only when the last HCD is
* freed. When hcd_release() is called for either hcd in a peer set * freed. When hcd_release() is called for either hcd in a peer set,
* invalidate the peer's ->shared_hcd and ->primary_hcd pointers to * invalidate the peer's ->shared_hcd and ->primary_hcd pointers.
* block new peering attempts
*/ */
static void hcd_release(struct kref *kref) static void hcd_release(struct kref *kref)
{ {
struct usb_hcd *hcd = container_of (kref, struct usb_hcd, kref); struct usb_hcd *hcd = container_of (kref, struct usb_hcd, kref);
mutex_lock(&usb_port_peer_mutex); mutex_lock(&usb_port_peer_mutex);
if (usb_hcd_is_primary_hcd(hcd)) {
kfree(hcd->address0_mutex);
kfree(hcd->bandwidth_mutex);
}
if (hcd->shared_hcd) { if (hcd->shared_hcd) {
struct usb_hcd *peer = hcd->shared_hcd; struct usb_hcd *peer = hcd->shared_hcd;
peer->shared_hcd = NULL; peer->shared_hcd = NULL;
if (peer->primary_hcd == hcd)
peer->primary_hcd = NULL; peer->primary_hcd = NULL;
} else {
kfree(hcd->address0_mutex);
kfree(hcd->bandwidth_mutex);
} }
mutex_unlock(&usb_port_peer_mutex); mutex_unlock(&usb_port_peer_mutex);
kfree(hcd); kfree(hcd);
......
...@@ -180,11 +180,11 @@ struct ehci_regs { ...@@ -180,11 +180,11 @@ struct ehci_regs {
* PORTSCx * PORTSCx
*/ */
/* HOSTPC: offset 0x84 */ /* HOSTPC: offset 0x84 */
u32 hostpc[1]; /* HOSTPC extension */ u32 hostpc[0]; /* HOSTPC extension */
#define HOSTPC_PHCD (1<<22) /* Phy clock disable */ #define HOSTPC_PHCD (1<<22) /* Phy clock disable */
#define HOSTPC_PSPD (3<<25) /* Port speed detection */ #define HOSTPC_PSPD (3<<25) /* Port speed detection */
u32 reserved5[16]; u32 reserved5[17];
/* USBMODE_EX: offset 0xc8 */ /* USBMODE_EX: offset 0xc8 */
u32 usbmode_ex; /* USB Device mode extension */ u32 usbmode_ex; /* USB Device mode extension */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment