Re: [PATCH v2 1/2] mfd: viperboard: allocate I/O buffer separately
On Mon, Sep 22, 2014 at 10:39:18PM +0300, Octavian Purdila wrote: > Currently the I/O buffer is allocated part of the device status > structure, potentially sharing the same cache line with other members > in this structure. > > Allocate the buffer separately, to avoid the I/O operations corrupting > the device status structure due to cache line sharing. > > Compiled tested only as I don't have access to hardware. > > Signed-off-by: Octavian Purdila > --- > drivers/mfd/viperboard.c | 8 > include/linux/mfd/viperboard.h | 2 +- > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/mfd/viperboard.c b/drivers/mfd/viperboard.c > index e00f534..5f62f4e 100644 > --- a/drivers/mfd/viperboard.c > +++ b/drivers/mfd/viperboard.c > @@ -64,6 +64,12 @@ static int vprbrd_probe(struct usb_interface *interface, > return -ENOMEM; > } > > + vb->buf = kzalloc(sizeof(struct vprbrd_i2c_write_msg), GFP_KERNEL); > + if (vb->buf == NULL) { > + ret = -ENOMEM; > + goto error; This will cause a kref imbalance as you have a usb_put_dev in error, but haven't done the get yet. > + } > + > mutex_init(&vb->lock); > > vb->usb_dev = usb_get_dev(interface_to_usbdev(interface)); Here's the get. Johan -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/2] mfd: viperboard: allocate I/O buffer separately
On Tue, Sep 23, 2014 at 09:35:41AM +0200, Johan Hovold wrote: > On Mon, Sep 22, 2014 at 10:39:18PM +0300, Octavian Purdila wrote: > > Currently the I/O buffer is allocated part of the device status > > structure, potentially sharing the same cache line with other members > > in this structure. > > > > Allocate the buffer separately, to avoid the I/O operations corrupting > > the device status structure due to cache line sharing. > > > > Compiled tested only as I don't have access to hardware. > > > > Signed-off-by: Octavian Purdila > > --- > > drivers/mfd/viperboard.c | 8 > > include/linux/mfd/viperboard.h | 2 +- > > 2 files changed, 9 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/mfd/viperboard.c b/drivers/mfd/viperboard.c > > index e00f534..5f62f4e 100644 > > --- a/drivers/mfd/viperboard.c > > +++ b/drivers/mfd/viperboard.c > > @@ -64,6 +64,12 @@ static int vprbrd_probe(struct usb_interface *interface, > > return -ENOMEM; > > } > > > > + vb->buf = kzalloc(sizeof(struct vprbrd_i2c_write_msg), GFP_KERNEL); > > + if (vb->buf == NULL) { > > + ret = -ENOMEM; > > + goto error; > > This will cause a kref imbalance as you have a usb_put_dev in error, > but haven't done the get yet. Nevermind. This isn't problem as the usb device is null. Haven't had my morning coffee yet. ;) Johan -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/2] mfd: viperboard: allocate I/O buffer separately
On Mon, Sep 22, 2014 at 10:39:18PM +0300, Octavian Purdila wrote: > Currently the I/O buffer is allocated part of the device status > structure, potentially sharing the same cache line with other members > in this structure. > > Allocate the buffer separately, to avoid the I/O operations corrupting > the device status structure due to cache line sharing. > > Compiled tested only as I don't have access to hardware. > > Signed-off-by: Octavian Purdila Reviewed-by: Johan Hovold > --- > drivers/mfd/viperboard.c | 8 > include/linux/mfd/viperboard.h | 2 +- > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/mfd/viperboard.c b/drivers/mfd/viperboard.c > index e00f534..5f62f4e 100644 > --- a/drivers/mfd/viperboard.c > +++ b/drivers/mfd/viperboard.c > @@ -64,6 +64,12 @@ static int vprbrd_probe(struct usb_interface *interface, > return -ENOMEM; > } > > + vb->buf = kzalloc(sizeof(struct vprbrd_i2c_write_msg), GFP_KERNEL); > + if (vb->buf == NULL) { > + ret = -ENOMEM; > + goto error; > + } > + > mutex_init(&vb->lock); > > vb->usb_dev = usb_get_dev(interface_to_usbdev(interface)); > @@ -105,6 +111,7 @@ static int vprbrd_probe(struct usb_interface *interface, > error: > if (vb) { > usb_put_dev(vb->usb_dev); > + kfree(vb->buf); > kfree(vb); > } > > @@ -118,6 +125,7 @@ static void vprbrd_disconnect(struct usb_interface > *interface) > mfd_remove_devices(&interface->dev); > usb_set_intfdata(interface, NULL); > usb_put_dev(vb->usb_dev); > + kfree(vb->buf); > kfree(vb); > > dev_dbg(&interface->dev, "disconnected\n"); > diff --git a/include/linux/mfd/viperboard.h b/include/linux/mfd/viperboard.h > index 1934528..af928d0 100644 > --- a/include/linux/mfd/viperboard.h > +++ b/include/linux/mfd/viperboard.h > @@ -103,7 +103,7 @@ struct vprbrd_i2c_addr_msg { > struct vprbrd { > struct usb_device *usb_dev; /* the usb device for this device */ > struct mutex lock; > - u8 buf[sizeof(struct vprbrd_i2c_write_msg)]; > + u8 *buf; > struct platform_device pdev; > }; -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net] r8152: fix the carrier off when autoresuming
netif_carrier_off would be called when autoresuming, even though the cable is plugged. This causes some applications do relative actions when detecting the carrier off. Keep the status of the carrier, and let it be modified when the linking change occurs. Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 52 + 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 74760e8..e039442 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -1949,10 +1949,34 @@ static void rxdy_gated_en(struct r8152 *tp, bool enable) ocp_write_word(tp, MCU_TYPE_PLA, PLA_MISC_1, ocp_data); } +static int rtl_start_rx(struct r8152 *tp) +{ + int i, ret = 0; + + INIT_LIST_HEAD(&tp->rx_done); + for (i = 0; i < RTL8152_MAX_RX; i++) { + INIT_LIST_HEAD(&tp->rx_info[i].list); + ret = r8152_submit_rx(tp, &tp->rx_info[i], GFP_KERNEL); + if (ret) + break; + } + + return ret; +} + +static int rtl_stop_rx(struct r8152 *tp) +{ + int i; + + for (i = 0; i < RTL8152_MAX_RX; i++) + usb_kill_urb(tp->rx_info[i].urb); + + return 0; +} + static int rtl_enable(struct r8152 *tp) { u32 ocp_data; - int i, ret; r8152b_reset_packet_filter(tp); @@ -1962,14 +1986,7 @@ static int rtl_enable(struct r8152 *tp) rxdy_gated_en(tp, false); - INIT_LIST_HEAD(&tp->rx_done); - ret = 0; - for (i = 0; i < RTL8152_MAX_RX; i++) { - INIT_LIST_HEAD(&tp->rx_info[i].list); - ret |= r8152_submit_rx(tp, &tp->rx_info[i], GFP_KERNEL); - } - - return ret; + return rtl_start_rx(tp); } static int rtl8152_enable(struct r8152 *tp) @@ -2053,8 +2070,7 @@ static void rtl_disable(struct r8152 *tp) mdelay(1); } - for (i = 0; i < RTL8152_MAX_RX; i++) - usb_kill_urb(tp->rx_info[i].urb); + rtl_stop_rx(tp); rtl8152_nic_reset(tp); } @@ -3083,13 +3099,14 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message) clear_bit(WORK_ENABLE, &tp->flags); usb_kill_urb(tp->intr_urb); cancel_delayed_work_sync(&tp->schedule); + tasklet_disable(&tp->tl); if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { + rtl_stop_rx(tp); rtl_runtime_suspend_enable(tp, true); } else { - tasklet_disable(&tp->tl); tp->rtl_ops.down(tp); - tasklet_enable(&tp->tl); } + tasklet_enable(&tp->tl); } return 0; @@ -3108,17 +3125,18 @@ static int rtl8152_resume(struct usb_interface *intf) if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { rtl_runtime_suspend_enable(tp, false); clear_bit(SELECTIVE_SUSPEND, &tp->flags); + set_bit(WORK_ENABLE, &tp->flags); if (tp->speed & LINK_STATUS) - tp->rtl_ops.disable(tp); + rtl_start_rx(tp); } else { tp->rtl_ops.up(tp); rtl8152_set_speed(tp, AUTONEG_ENABLE, tp->mii.supports_gmii ? SPEED_1000 : SPEED_100, DUPLEX_FULL); + tp->speed = 0; + netif_carrier_off(tp->netdev); + set_bit(WORK_ENABLE, &tp->flags); } - tp->speed = 0; - netif_carrier_off(tp->netdev); - set_bit(WORK_ENABLE, &tp->flags); usb_submit_urb(tp->intr_urb, GFP_KERNEL); } -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 1/7] usb: move the OTG state from the USB PHY to the OTG structure
Before using the PHY framework instead of the USB PHY one, we need to move the OTG state into another place, since it won't be available when USB PHY isn't used. This patch moves the OTG state into the OTG structure, and makes all the needed modifications in the drivers using the OTG state. Signed-off-by: Antoine Tenart Acked-by: Peter Chen --- drivers/phy/phy-omap-usb2.c | 8 +--- drivers/usb/chipidea/debug.c| 2 +- drivers/usb/chipidea/otg_fsm.c | 12 ++--- drivers/usb/common/usb-otg-fsm.c| 8 ++-- drivers/usb/host/ohci-omap.c| 2 +- drivers/usb/musb/am35x.c| 28 +-- drivers/usb/musb/blackfin.c | 18 +++ drivers/usb/musb/da8xx.c| 28 +-- drivers/usb/musb/davinci.c | 18 +++ drivers/usb/musb/musb_core.c| 94 ++--- drivers/usb/musb/musb_dsps.c| 26 +- drivers/usb/musb/musb_gadget.c | 36 +++--- drivers/usb/musb/musb_host.c| 8 ++-- drivers/usb/musb/musb_virthub.c | 22 - drivers/usb/musb/omap2430.c | 30 ++-- drivers/usb/musb/tusb6010.c | 40 drivers/usb/musb/ux500.c| 10 ++-- drivers/usb/phy/phy-ab8500-usb.c| 10 ++-- drivers/usb/phy/phy-fsl-usb.c | 10 ++-- drivers/usb/phy/phy-generic.c | 4 +- drivers/usb/phy/phy-gpio-vbus-usb.c | 10 ++-- drivers/usb/phy/phy-msm-usb.c | 34 +++--- drivers/usb/phy/phy-mv-usb.c| 46 +- include/linux/usb/otg.h | 2 + include/linux/usb/phy.h | 1 - 25 files changed, 252 insertions(+), 255 deletions(-) diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 93d78359246c..3bb54e55c762 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -80,11 +80,9 @@ static int omap_usb_start_srp(struct usb_otg *otg) static int omap_usb_set_host(struct usb_otg *otg, struct usb_bus *host) { - struct usb_phy *phy = otg->phy; - otg->host = host; if (!host) - phy->state = OTG_STATE_UNDEFINED; + otg->state = OTG_STATE_UNDEFINED; return 0; } @@ -92,11 +90,9 @@ static int omap_usb_set_host(struct usb_otg *otg, struct usb_bus *host) static int omap_usb_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget) { - struct usb_phy *phy = otg->phy; - otg->gadget = gadget; if (!gadget) - phy->state = OTG_STATE_UNDEFINED; + otg->state = OTG_STATE_UNDEFINED; return 0; } diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c index 795d6538d630..8878eea38d44 100644 --- a/drivers/usb/chipidea/debug.c +++ b/drivers/usb/chipidea/debug.c @@ -220,7 +220,7 @@ static int ci_otg_show(struct seq_file *s, void *unused) /* -- State - */ seq_printf(s, "OTG state: %s\n\n", - usb_otg_state_string(ci->transceiver->state)); + usb_otg_state_string(ci->transceiver->otg.state)); /* -- State Machine Variables - */ seq_printf(s, "a_bus_drop: %d\n", fsm->a_bus_drop); diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index caaabc58021e..8cb2508a6b71 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -328,7 +328,7 @@ static void b_ssend_srp_tmout_func(void *ptr, unsigned long indicator) set_tmout(ci, indicator); /* only vbus fall below B_sess_vld in b_idle state */ - if (ci->transceiver->state == OTG_STATE_B_IDLE) + if (ci->fsm.otg->state == OTG_STATE_B_IDLE) ci_otg_queue_work(ci); } @@ -582,11 +582,11 @@ int ci_otg_fsm_work(struct ci_hdrc *ci) * when there is no gadget class driver */ if (ci->fsm.id && !(ci->driver) && - ci->transceiver->state < OTG_STATE_A_IDLE) + ci->fsm.otg->state < OTG_STATE_A_IDLE) return 0; if (otg_statemachine(&ci->fsm)) { - if (ci->transceiver->state == OTG_STATE_A_IDLE) { + if (ci->fsm.otg->state == OTG_STATE_A_IDLE) { /* * Further state change for cases: * a_idle to b_idle; or @@ -600,7 +600,7 @@ int ci_otg_fsm_work(struct ci_hdrc *ci) ci_otg_queue_work(ci); if (ci->id_event) ci->id_event = false; - } else if (ci->transceiver->state == OTG_STATE_B_IDLE) { + } else if (ci->fsm.otg->state == OTG_STATE_B_IDLE) { if (ci->fsm.b_sess_vld) { ci->fsm.power_up = 0; /* @@ -627,7 +627,7 @@ static void ci_otg_fsm_event(struct ci_hdrc *ci) otg_bsess_vld = hw_read_otgsc(ci, OTGSC_BSV); port_conn = h
[PATCH v6 2/7] usb: rename phy to usb_phy in OTG
This patch prepares the introduction of the generic PHY support in the USB OTG common functions. The USB PHY member of the OTG structure is renamed to 'usb_phy' and modifications are done in all drivers accessing it. Renaming this pointer will allow to keep the compatibility for USB PHY drivers. Signed-off-by: Antoine Tenart --- drivers/phy/phy-omap-usb2.c | 6 ++-- drivers/usb/chipidea/otg_fsm.c | 2 +- drivers/usb/phy/phy-ab8500-usb.c| 6 ++-- drivers/usb/phy/phy-fsl-usb.c | 13 drivers/usb/phy/phy-generic.c | 2 +- drivers/usb/phy/phy-gpio-vbus-usb.c | 4 +-- drivers/usb/phy/phy-isp1301-omap.c | 10 +++--- drivers/usb/phy/phy-msm-usb.c | 61 +++-- drivers/usb/phy/phy-mv-usb.c| 4 +-- drivers/usb/phy/phy-samsung-usb2.c | 2 +- drivers/usb/phy/phy-tahvo.c | 8 +++-- drivers/usb/phy/phy-ulpi.c | 6 ++-- include/linux/usb/otg.h | 2 +- 13 files changed, 66 insertions(+), 60 deletions(-) diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 3bb54e55c762..a454042ddb06 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -60,7 +60,7 @@ EXPORT_SYMBOL_GPL(omap_usb2_set_comparator); static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled) { - struct omap_usb *phy = phy_to_omapusb(otg->phy); + struct omap_usb *phy = phy_to_omapusb(otg->usb_phy); if (!phy->comparator) return -ENODEV; @@ -70,7 +70,7 @@ static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled) static int omap_usb_start_srp(struct usb_otg *otg) { - struct omap_usb *phy = phy_to_omapusb(otg->phy); + struct omap_usb *phy = phy_to_omapusb(otg->usb_phy); if (!phy->comparator) return -ENODEV; @@ -255,7 +255,7 @@ static int omap_usb2_probe(struct platform_device *pdev) otg->set_vbus = omap_usb_set_vbus; if (phy_data->flags & OMAP_USB2_HAS_START_SRP) otg->start_srp = omap_usb_start_srp; - otg->phy= &phy->phy; + otg->usb_phy= &phy->phy; platform_set_drvdata(pdev, phy); diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 8cb2508a6b71..d8490e758a74 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -788,7 +788,7 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) return -ENOMEM; } - otg->phy = ci->transceiver; + otg->usb_phy = ci->transceiver; otg->gadget = &ci->gadget; ci->fsm.otg = otg; ci->transceiver->otg = ci->fsm.otg; diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index 2d5250143ce1..3a802fa7dae2 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c @@ -1056,7 +1056,7 @@ static int ab8500_usb_set_peripheral(struct usb_otg *otg, if (!otg) return -ENODEV; - ab = phy_to_ab(otg->phy); + ab = phy_to_ab(otg->usb_phy); ab->phy.otg->gadget = gadget; @@ -1080,7 +1080,7 @@ static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host) if (!otg) return -ENODEV; - ab = phy_to_ab(otg->phy); + ab = phy_to_ab(otg->usb_phy); ab->phy.otg->host = host; @@ -1382,7 +1382,7 @@ static int ab8500_usb_probe(struct platform_device *pdev) ab->phy.set_power = ab8500_usb_set_power; ab->phy.otg->state = OTG_STATE_UNDEFINED; - otg->phy= &ab->phy; + otg->usb_phy= &ab->phy; otg->set_host = ab8500_usb_set_host; otg->set_peripheral = ab8500_usb_set_peripheral; diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index a22f88fb8176..b4cc341094ac 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -499,7 +499,8 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on) { struct usb_otg *otg = fsm->otg; struct device *dev; - struct fsl_otg *otg_dev = container_of(otg->phy, struct fsl_otg, phy); + struct fsl_otg *otg_dev = + container_of(otg->usb_phy, struct fsl_otg, phy); u32 retval = 0; if (!otg->host) @@ -594,7 +595,7 @@ static int fsl_otg_set_host(struct usb_otg *otg, struct usb_bus *host) if (!otg) return -ENODEV; - otg_dev = container_of(otg->phy, struct fsl_otg, phy); + otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy); if (otg_dev != fsl_otg_dev) return -ENODEV; @@ -644,7 +645,7 @@ static int fsl_otg_set_peripheral(struct usb_otg *otg, if (!otg) return -ENODEV; - otg_dev = container_of(otg->phy, struct fsl_otg, phy); + otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy); VDBG("otg_dev
[PATCH v6 6/7] usb: chipidea: move usb_otg into struct ci_hdrc
Move the usb_otg member from struct usb_phy to struct ci_hdrc. Rework its initialization taking in account this modification. Signed-off-by: Antoine Tenart Acked-by: Peter Chen --- drivers/usb/chipidea/ci.h | 1 + drivers/usb/chipidea/debug.c | 2 +- drivers/usb/chipidea/host.c| 5 +++-- drivers/usb/chipidea/otg_fsm.c | 16 +++- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index b2caa1772712..dac5ab6adfa2 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -177,6 +177,7 @@ struct ci_hdrc { struct ci_role_driver *roles[CI_ROLE_END]; enum ci_rolerole; boolis_otg; + struct usb_otg otg; struct otg_fsm fsm; struct ci_otg_fsm_timer_list*fsm_timer; struct work_struct work; diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c index 8f437e1512fa..999e9d683d7a 100644 --- a/drivers/usb/chipidea/debug.c +++ b/drivers/usb/chipidea/debug.c @@ -220,7 +220,7 @@ static int ci_otg_show(struct seq_file *s, void *unused) /* -- State - */ seq_printf(s, "OTG state: %s\n\n", - usb_otg_state_string(ci->usb_phy->otg.state)); + usb_otg_state_string(ci->otg.state)); /* -- State Machine Variables - */ seq_printf(s, "a_bus_drop: %d\n", fsm->a_bus_drop); diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index 0b67d78dd953..4fcebb6a6d14 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c @@ -85,10 +85,11 @@ static int host_start(struct ci_hdrc *ci) if (ret) { goto disable_reg; } else { - struct usb_otg *otg = ci->usb_phy->otg; + struct usb_otg *otg = &ci->otg; ci->hcd = hcd; - if (otg) { + + if (ci_otg_is_fsm_mode(ci)) { otg->host = &hcd->self; hcd->self.otg_port = 1; } diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 8a64ce87364e..862d7cb01b92 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -778,20 +778,10 @@ void ci_hdrc_otg_fsm_start(struct ci_hdrc *ci) int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) { int retval = 0; - struct usb_otg *otg; - otg = devm_kzalloc(ci->dev, - sizeof(struct usb_otg), GFP_KERNEL); - if (!otg) { - dev_err(ci->dev, - "Failed to allocate usb_otg structure for ci hdrc otg!\n"); - return -ENOMEM; - } - - otg->usb_phy = ci->usb_phy; - otg->gadget = &ci->gadget; - ci->fsm.otg = otg; - ci->usb_phy->otg = ci->fsm.otg; + ci->otg.usb_phy = ci->usb_phy; + ci->otg.gadget = &ci->gadget; + ci->fsm.otg = &ci->otg; ci->fsm.power_up = 1; ci->fsm.id = hw_read_otgsc(ci, OTGSC_ID) ? 1 : 0; ci->fsm.otg->state = OTG_STATE_UNDEFINED; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 3/7] usb: add support to the generic PHY framework in OTG
This patch adds support of the PHY framework in OTG and keeps the USB PHY compatibility. Here the only modification is to add PHY member in the OTG structure, along with the USB PHY one. Signed-off-by: Antoine Tenart --- include/linux/usb/otg.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 978fbbb0e266..52661c5da690 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h @@ -9,11 +9,14 @@ #ifndef __LINUX_USB_OTG_H #define __LINUX_USB_OTG_H +#include #include struct usb_otg { u8 default_a; + struct phy *phy; + /* old usb_phy interface */ struct usb_phy *usb_phy; struct usb_bus *host; struct usb_gadget *gadget; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 4/7] usb: allow to supply the PHY in the drivers when using HCD
This patch modify the generic code handling PHYs to allow them to be supplied from the drivers. This adds checks to ensure no PHY was already there when looking for one in the generic code. This also makes sure we do not modify its state in the generic HCD functions, it was provided by the driver. Signed-off-by: Antoine Tenart Acked-by: Alan Stern --- drivers/usb/core/hcd.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 6619239baf6d..dc0e46e5e618 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2646,7 +2646,7 @@ int usb_add_hcd(struct usb_hcd *hcd, } } - if (IS_ENABLED(CONFIG_GENERIC_PHY)) { + if (IS_ENABLED(CONFIG_GENERIC_PHY) && !hcd->phy) { struct phy *phy = phy_get(hcd->self.controller, "usb"); if (IS_ERR(phy)) { @@ -2666,6 +2666,7 @@ int usb_add_hcd(struct usb_hcd *hcd, goto err_phy; } hcd->phy = phy; + hcd->remove_phy = 1; } } @@ -2812,7 +2813,7 @@ err_allocate_root_hub: err_register_bus: hcd_buffer_destroy(hcd); err_create_buf: - if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->phy) { + if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->remove_phy && hcd->phy) { phy_power_off(hcd->phy); phy_exit(hcd->phy); phy_put(hcd->phy); @@ -2896,7 +2897,7 @@ void usb_remove_hcd(struct usb_hcd *hcd) usb_deregister_bus(&hcd->self); hcd_buffer_destroy(hcd); - if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->phy) { + if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->remove_phy && hcd->phy) { phy_power_off(hcd->phy); phy_exit(hcd->phy); phy_put(hcd->phy); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 5/7] usb: rename transceiver and phy to usb_phy in ChipIdea
This patch prepares the introduction of the generic PHY support in the USB ChipIdea common functions. The USB PHY member of the ChipIdea structure ('transceiver') is renamed to 'usb_phy', the 'phy' member of the ChipIdea pdata structure is renamed to 'usb_phy' and modifications are done in all drivers accessing it. Renaming this pointer will allow to keep the compatibility for USB PHY drivers. Signed-off-by: Antoine Tenart --- drivers/usb/chipidea/ci.h | 4 ++-- drivers/usb/chipidea/ci_hdrc_imx.c | 2 +- drivers/usb/chipidea/ci_hdrc_msm.c | 8 drivers/usb/chipidea/core.c| 20 ++-- drivers/usb/chipidea/debug.c | 2 +- drivers/usb/chipidea/host.c| 4 ++-- drivers/usb/chipidea/otg_fsm.c | 4 ++-- drivers/usb/chipidea/udc.c | 4 ++-- include/linux/usb/chipidea.h | 2 +- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index 9563cb56d564..b2caa1772712 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -161,7 +161,7 @@ struct hw_bank { * @test_mode: the selected test mode * @platdata: platform specific information supplied by parent device * @vbus_active: is VBUS active - * @transceiver: pointer to USB PHY, if any + * @usb_phy: pointer to USB PHY, if any * @hcd: pointer to usb_hcd for ehci host driver * @debugfs: root dentry for this controller in debugfs * @id_event: indicates there is an id event, and handled at ci_otg_work @@ -201,7 +201,7 @@ struct ci_hdrc { struct ci_hdrc_platform_data*platdata; int vbus_active; - struct usb_phy *transceiver; + struct usb_phy *usb_phy; struct usb_hcd *hcd; struct dentry *debugfs; boolid_event; diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index a7ab0f15926e..6f8b1b1045b5 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -147,7 +147,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) goto err_clk; } - pdata.phy = data->phy; + pdata.usb_phy = data->phy; if (imx_platform_flag->flags & CI_HDRC_IMX_IMX28_WRITE_FIX) pdata.flags |= CI_HDRC_IMX28_WRITE_FIX; diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c index 4935ac38fd00..3edf969ed797 100644 --- a/drivers/usb/chipidea/ci_hdrc_msm.c +++ b/drivers/usb/chipidea/ci_hdrc_msm.c @@ -26,15 +26,15 @@ static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) dev_dbg(dev, "CI_HDRC_CONTROLLER_RESET_EVENT received\n"); writel(0, USB_AHBBURST); writel(0, USB_AHBMODE); - usb_phy_init(ci->transceiver); + usb_phy_init(ci->usb_phy); break; case CI_HDRC_CONTROLLER_STOPPED_EVENT: dev_dbg(dev, "CI_HDRC_CONTROLLER_STOPPED_EVENT received\n"); /* -* Put the transceiver in non-driving mode. Otherwise host +* Put the phy in non-driving mode. Otherwise host * may not detect soft-disconnection. */ - usb_phy_notify_disconnect(ci->transceiver, USB_SPEED_UNKNOWN); + usb_phy_notify_disconnect(ci->usb_phy, USB_SPEED_UNKNOWN); break; default: dev_dbg(dev, "unknown ci_hdrc event\n"); @@ -68,7 +68,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) if (IS_ERR(phy)) return PTR_ERR(phy); - ci_hdrc_msm_platdata.phy = phy; + ci_hdrc_msm_platdata.usb_phy = phy; plat_ci = ci_hdrc_add_device(&pdev->dev, pdev->resource, pdev->num_resources, diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 579b3538cb27..ee96b0696a7b 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -306,7 +306,7 @@ static int ci_usb_phy_init(struct ci_hdrc *ci) case USBPHY_INTERFACE_MODE_UTMI: case USBPHY_INTERFACE_MODE_UTMIW: case USBPHY_INTERFACE_MODE_HSIC: - ret = usb_phy_init(ci->transceiver); + ret = usb_phy_init(ci->usb_phy); if (ret) return ret; hw_phymode_configure(ci); @@ -314,12 +314,12 @@ static int ci_usb_phy_init(struct ci_hdrc *ci) case USBPHY_INTERFACE_MODE_ULPI: case USBPHY_INTERFACE_MODE_SERIAL: hw_phymode_configure(ci); - ret = usb_phy_init(ci->transceiver); + ret = usb_phy_init(ci->usb_phy); if (ret) return ret; break; default: - ret = usb_phy_init(ci->transceiver); +
[PATCH v6 7/7] usb: chipidea: add support to the generic PHY framework in ChipIdea
This patch adds support of the PHY framework for ChipIdea drivers. Changes are done in both the ChipIdea common code and in the drivers accessing the PHY. This is done by adding a new PHY member in ChipIdea's structures and by taking care of it in the code. Signed-off-by: Antoine Tenart --- drivers/usb/chipidea/ci.h | 5 ++- drivers/usb/chipidea/core.c| 83 +- drivers/usb/chipidea/host.c| 5 ++- drivers/usb/chipidea/otg_fsm.c | 6 ++- include/linux/usb/chipidea.h | 2 + 5 files changed, 80 insertions(+), 21 deletions(-) diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index dac5ab6adfa2..7e9e8223672a 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -161,7 +161,8 @@ struct hw_bank { * @test_mode: the selected test mode * @platdata: platform specific information supplied by parent device * @vbus_active: is VBUS active - * @usb_phy: pointer to USB PHY, if any + * @phy: pointer to PHY, if any + * @usb_phy: pointer to USB PHY, if any and if using the USB PHY framework * @hcd: pointer to usb_hcd for ehci host driver * @debugfs: root dentry for this controller in debugfs * @id_event: indicates there is an id event, and handled at ci_otg_work @@ -202,6 +203,8 @@ struct ci_hdrc { struct ci_hdrc_platform_data*platdata; int vbus_active; + struct phy *phy; + /* old usb_phy interface */ struct usb_phy *usb_phy; struct usb_hcd *hcd; struct dentry *debugfs; diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index ee96b0696a7b..e1d3d3f44075 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -293,6 +294,49 @@ static void hw_phymode_configure(struct ci_hdrc *ci) } /** + * _ci_usb_phy_init: initialize phy taking in account both phy and usb_phy + * interfaces + * @ci: the controller + * + * This function returns an error code if the phy failed to init + */ +static int _ci_usb_phy_init(struct ci_hdrc *ci) +{ + int ret; + + if (ci->phy) { + ret = phy_init(ci->phy); + if (ret) + return ret; + + ret = phy_power_on(ci->phy); + if (ret) { + phy_exit(ci->phy); + return ret; + } + } else { + ret = usb_phy_init(ci->usb_phy); + } + + return ret; +} + +/** + * _ci_usb_phy_exit: deinitialize phy taking in account both phy and usb_phy + * interfaces + * @ci: the controller + */ +static void ci_usb_phy_exit(struct ci_hdrc *ci) +{ + if (ci->phy) { + phy_power_off(ci->phy); + phy_exit(ci->phy); + } else { + usb_phy_shutdown(ci->usb_phy); + } +} + +/** * ci_usb_phy_init: initialize phy according to different phy type * @ci: the controller * @@ -306,7 +350,7 @@ static int ci_usb_phy_init(struct ci_hdrc *ci) case USBPHY_INTERFACE_MODE_UTMI: case USBPHY_INTERFACE_MODE_UTMIW: case USBPHY_INTERFACE_MODE_HSIC: - ret = usb_phy_init(ci->usb_phy); + ret = _ci_usb_phy_init(ci); if (ret) return ret; hw_phymode_configure(ci); @@ -314,12 +358,12 @@ static int ci_usb_phy_init(struct ci_hdrc *ci) case USBPHY_INTERFACE_MODE_ULPI: case USBPHY_INTERFACE_MODE_SERIAL: hw_phymode_configure(ci); - ret = usb_phy_init(ci->usb_phy); + ret = _ci_usb_phy_init(ci); if (ret) return ret; break; default: - ret = usb_phy_init(ci->usb_phy); + ret = _ci_usb_phy_init(ci); } return ret; @@ -595,23 +639,26 @@ static int ci_hdrc_probe(struct platform_device *pdev) return -ENODEV; } - if (ci->platdata->usb_phy) + if (ci->platdata->phy) { + ci->phy = ci->platdata->phy; + } else if (ci->platdata->usb_phy) { ci->usb_phy = ci->platdata->usb_phy; - else + } else { + ci->phy = devm_phy_get(dev, "usb-phy"); ci->usb_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); - if (IS_ERR(ci->usb_phy)) { - ret = PTR_ERR(ci->usb_phy); - /* -* if -ENXIO is returned, it means PHY layer wasn't -* enabled, so it makes no sense to return -EPROBE_DEFER -* in that case, since no PHY driver will ever probe. -*/ - if (ret == -ENXIO) - return ret; + /* if both generic PHY and USB PHY layers aren't enabled */ +
[PATCH v6 0/7] usb: add support for the generic PHY framework
Patches can also be found at: git://git.free-electrons.com:users/antoine-tenart/linux.git usb-phy The series applies on top of Sergei generic PHY support in HCD[1] and on top of Peter Chen's ci-for-usb-next branch[2]. Thanks a lot! Antoine Changes since v5: - rebased on the latest version of Sergei's series[1] - fixed one modifiaction made in the wrong patch Changes since v4: - reworked the PHY handling in ci_hdrc_probe() - fixed a rebase error - rebased on top of [3] Changes since v3: - moved phy_exit() after phy_power_on() - fixed the PHY handling in ci_hdrc_probe() - some little fixes Changes since v2: - rebased the series on top of v3.17-rc1 (and [2]) - switched to devm_phy_get() to handle non DT cases - moved usb_otg into the ci_hdrc structure Changes since v1: - rebased the series on top of [2] (generic PHY support for HCD) - split s/phy/usb_phy/ renaming and generic PHY support in separate patches [1] https://www.mail-archive.com/linux-usb%40vger.kernel.org/msg48068.html [2] git://github.com/hzpeterchen/linux-usb.git ci-for-usb-next Antoine Tenart (7): usb: move the OTG state from the USB PHY to the OTG structure usb: rename phy to usb_phy in OTG usb: add support to the generic PHY framework in OTG usb: allow to supply the PHY in the drivers when using HCD usb: rename transceiver and phy to usb_phy in ChipIdea usb: chipidea: move usb_otg into struct ci_hdrc usb: chipidea: add support to the generic PHY framework in ChipIdea drivers/phy/phy-omap-usb2.c | 14 ++ drivers/usb/chipidea/ci.h | 8 +++- drivers/usb/chipidea/ci_hdrc_imx.c | 2 +- drivers/usb/chipidea/ci_hdrc_msm.c | 8 ++-- drivers/usb/chipidea/core.c | 89 ++ drivers/usb/chipidea/debug.c| 2 +- drivers/usb/chipidea/host.c | 10 ++-- drivers/usb/chipidea/otg_fsm.c | 30 +--- drivers/usb/chipidea/udc.c | 4 +- drivers/usb/common/usb-otg-fsm.c| 8 ++-- drivers/usb/core/hcd.c | 7 +-- drivers/usb/host/ohci-omap.c| 2 +- drivers/usb/musb/am35x.c| 28 +-- drivers/usb/musb/blackfin.c | 18 +++ drivers/usb/musb/da8xx.c| 28 +-- drivers/usb/musb/davinci.c | 18 +++ drivers/usb/musb/musb_core.c| 94 ++-- drivers/usb/musb/musb_dsps.c| 26 +- drivers/usb/musb/musb_gadget.c | 36 +++--- drivers/usb/musb/musb_host.c| 8 ++-- drivers/usb/musb/musb_virthub.c | 22 - drivers/usb/musb/omap2430.c | 30 ++-- drivers/usb/musb/tusb6010.c | 40 drivers/usb/musb/ux500.c| 10 ++-- drivers/usb/phy/phy-ab8500-usb.c| 16 +++ drivers/usb/phy/phy-fsl-usb.c | 23 - drivers/usb/phy/phy-generic.c | 6 +-- drivers/usb/phy/phy-gpio-vbus-usb.c | 14 +++--- drivers/usb/phy/phy-isp1301-omap.c | 10 ++-- drivers/usb/phy/phy-msm-usb.c | 95 +++-- drivers/usb/phy/phy-mv-usb.c| 50 +-- drivers/usb/phy/phy-samsung-usb2.c | 2 +- drivers/usb/phy/phy-tahvo.c | 8 ++-- drivers/usb/phy/phy-ulpi.c | 6 +-- include/linux/usb/chipidea.h| 4 +- include/linux/usb/otg.h | 7 ++- include/linux/usb/phy.h | 1 - 37 files changed, 421 insertions(+), 363 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] libusbg: Fix usbg_disable_gadget to actually clear the UDC
> -Original Message- > From: Tony Lindgren [mailto:t...@atomide.com] > Sent: Monday, September 22, 2014 3:17 PM > To: Krzysztof Opasiak > Cc: 'Matt Porter'; linux-usb@vger.kernel.org; Stanislaw Wadas; > Andrzej Pietrasiewicz; Marek Szyprowski; Karol Lewandowski; > philippedesw...@gmail.com > Subject: Re: [PATCH] libusbg: Fix usbg_disable_gadget to actually > clear the UDC > > * Krzysztof Opasiak [140922 01:07]: > > Dear Tony, > > > > > -Original Message- > > > From: linux-usb-ow...@vger.kernel.org [mailto:linux-usb- > > > ow...@vger.kernel.org] On Behalf Of Tony Lindgren > > > Sent: Saturday, September 20, 2014 5:51 PM > > > To: Matt Porter > > > Cc: linux-usb@vger.kernel.org > > > Subject: [PATCH] libusbg: Fix usbg_disable_gadget to actually > clear > > > the UDC > > > > > > Currently usbg_disable_gadget() does not actually write > anything > > > to UDC to clear it and the configured UDC name stays there. > > > > > > > No, udc name doesn't stay there due to O_TRUNC flag which is > always used > > for writing in usbg_write_string(). With this flag we don't need > to > > write new line to file because size of file is set to 0 while > opening. > > > > Summing up: > > > > open("/sys/kernel/config/usb_gadget/g1/UDC", > O_WRONLY|O_CREAT|O_TRUNC, > > 0666) = 3 > > close(3)= 0 > > > > causes unbind, so everything works fine. > > Hmm not clearing for me doing this afterwards: > > # cat /sys/kernel/config/usb_gadget/g1/UDC > musb-hdrc.0.auto > > The UDC name stays there and won't get cleared. > > Am I missing something? Please forgive me, I have checked it once again and you are right. I thought that truncate flag works on configfs in a similar way than on others fs but I was wrong. This flag simply does nothing and you have definitely found a bug. I was certain sure that this function works fine due to gadget-vid-pid-remove example. In this simple program gadget is disabled before removing. I had in my mind that it is impossible to modify a gadget if it is bound to any udc. This example worked fine so I assumed that usbg_disable_gadget() also works fine. I have look into configfs composite gadget source and there I have found some surprise: /* * ideally I would like to forbid to unlink functions while a gadget is * bound to an UDC. Since this isn't possible at the moment, we simply * force an unbind, the function is available here and then we can * remove the function. */ mutex_lock(&gi->lock); if (gi->udc_name) unregister_gadget(gi); WARN_ON(gi->udc_name); This means that it is currently possible to remove function binding on enabled gadget and it will cause unbind. This is why usbg_rm_gadget() also worked fine without proper usbg_disable_gadget(). Summing up, Your patch fix an important bug. Its form is good for me. I have checked it and it works fine. You may add: Reviewed-by: Krzysztof Opasiak If it is going about Matt Porter activity, he is not responding for mails or patches since April. I have github-fork of libusbg [1] with latest source (my master is 35 commits ahead of libusbg/master and some devel branches are even more). All patches which are intended for libusbg (sent on a list or from pull requests) are merged there after review. Please let me also notice that your patch has been also merged into my master. Thank you for fixing this issue. Foot notes: 1 - https://github.com/kopasiak/libusbg -- Best Regards, Krzysztof Opasiak Samsung R&D Institute Poland Samsung Electronics k.opas...@samsung.com -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 01/12] reset: add the Berlin reset controller driver
Add a reset controller for Marvell Berlin SoCs which is used by the USB PHYs drivers (for now). Signed-off-by: Antoine Tenart Signed-off-by: Sebastian Hesselbarth Acked-by: Philipp Zabel --- drivers/reset/Makefile | 1 + drivers/reset/reset-berlin.c | 131 +++ 2 files changed, 132 insertions(+) create mode 100644 drivers/reset/reset-berlin.c diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile index 60fed3d7820b..157d421f755b 100644 --- a/drivers/reset/Makefile +++ b/drivers/reset/Makefile @@ -1,4 +1,5 @@ obj-$(CONFIG_RESET_CONTROLLER) += core.o obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o +obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o obj-$(CONFIG_ARCH_STI) += sti/ diff --git a/drivers/reset/reset-berlin.c b/drivers/reset/reset-berlin.c new file mode 100644 index ..f8b48a13cf0b --- /dev/null +++ b/drivers/reset/reset-berlin.c @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2014 Marvell Technology Group Ltd. + * + * Antoine Tenart + * Sebastian Hesselbarth + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BERLIN_MAX_RESETS 32 + +#define to_berlin_reset_priv(p)\ + container_of((p), struct berlin_reset_priv, rcdev) + +struct berlin_reset_priv { + void __iomem*base; + unsigned intsize; + struct reset_controller_dev rcdev; +}; + +static int berlin_reset_reset(struct reset_controller_dev *rcdev, + unsigned long id) +{ + struct berlin_reset_priv *priv = to_berlin_reset_priv(rcdev); + int offset = id >> 8; + int mask = BIT(id & 0x1f); + + writel(mask, priv->base + offset); + + /* let the reset be effective */ + udelay(10); + + return 0; +} + +static struct reset_control_ops berlin_reset_ops = { + .reset = berlin_reset_reset, +}; + +static int berlin_reset_xlate(struct reset_controller_dev *rcdev, + const struct of_phandle_args *reset_spec) +{ + struct berlin_reset_priv *priv = to_berlin_reset_priv(rcdev); + unsigned offset, bit; + + if (WARN_ON(reset_spec->args_count != rcdev->of_reset_n_cells)) + return -EINVAL; + + offset = reset_spec->args[0]; + bit = reset_spec->args[1]; + + if (offset >= priv->size) + return -EINVAL; + + if (bit >= BERLIN_MAX_RESETS) + return -EINVAL; + + return (offset << 8) | bit; +} + +static int __berlin_reset_init(struct device_node *np) +{ + struct berlin_reset_priv *priv; + struct resource res; + resource_size_t size; + int ret; + + priv = kzalloc(sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + ret = of_address_to_resource(np, 0, &res); + if (ret) + goto err; + + size = resource_size(&res); + priv->base = ioremap(res.start, size); + if (!priv->base) { + ret = -ENOMEM; + goto err; + } + priv->size = size; + + priv->rcdev.owner = THIS_MODULE; + priv->rcdev.ops = &berlin_reset_ops; + priv->rcdev.of_node = np; + priv->rcdev.of_reset_n_cells = 2; + priv->rcdev.of_xlate = berlin_reset_xlate; + + reset_controller_register(&priv->rcdev); + + return 0; + +err: + kfree(priv); + return ret; +} + +static const struct of_device_id berlin_reset_of_match[] __initconst = { + { .compatible = "marvell,berlin2-chip-ctrl" }, + { .compatible = "marvell,berlin2cd-chip-ctrl" }, + { .compatible = "marvell,berlin2q-chip-ctrl" }, + { }, +}; + +static int __init berlin_reset_init(void) +{ + struct device_node *np; + int ret; + + for_each_matching_node(np, berlin_reset_of_match) { + ret = __berlin_reset_init(np); + if (ret) + return ret; + } + + return 0; +} +arch_initcall(berlin_reset_init); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 12/12] ARM: dts: berlin: enable USB on the Google Chromecast
From: Sebastian Hesselbarth Enable usb1 on Google Chromecast which is connected to micro-USB plug used for external power supply, too. Signed-off-by: Sebastian Hesselbarth Signed-off-by: Antoine Tenart --- arch/arm/boot/dts/berlin2cd-google-chromecast.dts | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/berlin2cd-google-chromecast.dts b/arch/arm/boot/dts/berlin2cd-google-chromecast.dts index bcd81ffc495d..5c42c3bfb613 100644 --- a/arch/arm/boot/dts/berlin2cd-google-chromecast.dts +++ b/arch/arm/boot/dts/berlin2cd-google-chromecast.dts @@ -27,3 +27,7 @@ }; &uart0 { status = "okay"; }; + +&usb_phy1 { status = "okay"; }; + +&usb1 { status = "okay"; }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 11/12] ARM: dts: berlin: add BG2CD nodes for USB support
From: Sebastian Hesselbarth Adds nodes describing the Marvell Berlin BG2CD USB PHY and USB. The BG2CD SoC has 2 USB ChipIdea controllers, with usb0 host-only and usb1 dual-role capable. Signed-off-by: Sebastian Hesselbarth Signed-off-by: Antoine Tenart --- arch/arm/boot/dts/berlin2cd.dtsi | 34 ++ 1 file changed, 34 insertions(+) diff --git a/arch/arm/boot/dts/berlin2cd.dtsi b/arch/arm/boot/dts/berlin2cd.dtsi index 68f7032b4686..5c6950531327 100644 --- a/arch/arm/boot/dts/berlin2cd.dtsi +++ b/arch/arm/boot/dts/berlin2cd.dtsi @@ -66,6 +66,22 @@ clocks = <&chip CLKID_TWD>; }; + usb_phy0: usb-phy@b74000 { + compatible = "marvell,berlin2cd-usb-phy"; + reg = <0xb74000 0x128>; + #phy-cells = <0>; + resets = <&chip 0x178 23>; + status = "disabled"; + }; + + usb_phy1: usb-phy@b78000 { + compatible = "marvell,berlin2cd-usb-phy"; + reg = <0xb78000 0x128>; + #phy-cells = <0>; + resets = <&chip 0x178 24>; + status = "disabled"; + }; + apb@e8 { compatible = "simple-bus"; #address-cells = <1>; @@ -242,6 +258,24 @@ }; }; + usb0: usb@ed { + compatible = "chipidea,usb2"; + reg = <0xed 0x200>; + interrupts = ; + clocks = <&chip CLKID_USB0>; + usb-phy = <&usb_phy0>; + status = "disabled"; + }; + + usb1: usb@ee { + compatible = "chipidea,usb2"; + reg = <0xee 0x200>; + interrupts = ; + clocks = <&chip CLKID_USB1>; + usb-phy = <&usb_phy1>; + status = "disabled"; + }; + apb@fc { compatible = "simple-bus"; #address-cells = <1>; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 10/12] ARM: dts: Berlin: enable USB on the BG2Q DMP
Enable the 2 available USB PHY and USB nodes on the Marvell Berlin BG2Q DMP. Signed-off-by: Antoine Tenart --- arch/arm/boot/dts/berlin2q-marvell-dmp.dts | 53 ++ 1 file changed, 53 insertions(+) diff --git a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts index a357ce02a64e..663aedb173e0 100644 --- a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts +++ b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts @@ -7,6 +7,8 @@ */ /dts-v1/; + +#include #include "berlin2q.dtsi" / { @@ -21,6 +23,39 @@ choosen { bootargs = "console=ttyS0,115200 earlyprintk"; }; + + regulators { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; + + reg_usb0_vbus: regulator@0 { + compatible = "regulator-fixed"; + regulator-name = "usb0_vbus"; + regulator-min-microvolt = <500>; + regulator-max-microvolt = <500>; + gpio = <&portb 8 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + reg_usb1_vbus: regulator@1 { + compatible = "regulator-fixed"; + regulator-name = "usb1_vbus"; + regulator-min-microvolt = <500>; + regulator-max-microvolt = <500>; + gpio = <&portb 10 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + reg_usb2_vbus: regulator@2 { + compatible = "regulator-fixed"; + regulator-name = "usb2_vbus"; + regulator-min-microvolt = <500>; + regulator-max-microvolt = <500>; + gpio = <&portb 12 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + }; }; &sdhci1 { @@ -45,3 +80,21 @@ &uart0 { status = "okay"; }; + +&usb_phy0 { + status = "okay"; +}; + +&usb_phy2 { + status = "okay"; +}; + +&usb0 { + vbus-supply = <®_usb0_vbus>; + status = "okay"; +}; + +&usb2 { + vbus-supply = <®_usb2_vbus>; + status = "okay"; +}; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 06/12] Documentation: bindings: add doc for the Berlin USB PHY
Document the bindings of the Marvell Berlin USB PHY driver. Signed-off-by: Antoine Tenart --- Documentation/devicetree/bindings/phy/berlin-usb-phy.txt | 16 1 file changed, 16 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/berlin-usb-phy.txt diff --git a/Documentation/devicetree/bindings/phy/berlin-usb-phy.txt b/Documentation/devicetree/bindings/phy/berlin-usb-phy.txt new file mode 100644 index ..be33780f668e --- /dev/null +++ b/Documentation/devicetree/bindings/phy/berlin-usb-phy.txt @@ -0,0 +1,16 @@ +* Marvell Berlin USB PHY + +Required properties: +- compatible: "marvell,berlin2-usb-phy" or "marvell,berlin2cd-usb-phy" +- reg: base address and length of the registers +- #phys-cells: should be 0 +- resets: reference to the reset controller + +Example: + + usb-phy@f774000 { + compatible = "marvell,berlin2-usb-phy"; + reg = <0xf774000 0x128>; + #phy-cells = <0>; + resets = <&chip 0x104 14>; + }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 09/12] ARM: dts: berlin: add BG2Q nodes for USB support
Adds nodes describing the Marvell Berlin BG2Q USB PHY and USB. The BG2Q SoC has 3 USB host controller, compatible with ChipIdea. Signed-off-by: Antoine Tenart --- arch/arm/boot/dts/berlin2q.dtsi | 52 + 1 file changed, 52 insertions(+) diff --git a/arch/arm/boot/dts/berlin2q.dtsi b/arch/arm/boot/dts/berlin2q.dtsi index ffba5c3bdab8..faf7cbe2af20 100644 --- a/arch/arm/boot/dts/berlin2q.dtsi +++ b/arch/arm/boot/dts/berlin2q.dtsi @@ -114,6 +114,39 @@ #interrupt-cells = <3>; }; + usb_phy2: phy@a2f400 { + compatible = "marvell,berlin2-usb-phy"; + reg = <0xa2f400 0x128>; + #phy-cells = <0>; + resets = <&chip 0x104 14>; + status = "disabled"; + }; + + usb2: usb@a3 { + compatible = "chipidea,usb2"; + reg = <0xa3 0x1>; + interrupts = ; + clocks = <&chip CLKID_USB2>; + phys = <&usb_phy2>; + status = "disabled"; + }; + + usb_phy0: phy@b74000 { + compatible = "marvell,berlin2-usb-phy"; + reg = <0xb74000 0x128>; + #phy-cells = <0>; + resets = <&chip 0x104 12>; + status = "disabled"; + }; + + usb_phy1: phy@b78000 { + compatible = "marvell,berlin2-usb-phy"; + reg = <0xb78000 0x128>; + #phy-cells = <0>; + resets = <&chip 0x104 13>; + status = "disabled"; + }; + cpu-ctrl@dd { compatible = "marvell,berlin-cpu-ctrl"; reg = <0xdd 0x1>; @@ -348,6 +381,24 @@ }; }; + usb0: usb@ed { + compatible = "chipidea,usb2"; + reg = <0xed 0x1>; + interrupts = ; + clocks = <&chip CLKID_USB0>; + phys = <&usb_phy0>; + status = "disabled"; + }; + + usb1: usb@ee { + compatible = "chipidea,usb2"; + reg = <0xee 0x1>; + interrupts = ; + clocks = <&chip CLKID_USB1>; + phys = <&usb_phy1>; + status = "disabled"; + }; + apb@fc { compatible = "simple-bus"; #address-cells = <1>; @@ -440,5 +491,6 @@ interrupts = ; }; }; + }; }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
Add a USB2 ChipIdea driver for ci13xxx, with optional PHY, clock and DMA mask, to support USB2 ChipIdea controllers that don't need specific functions. Tested on the Marvell Berlin SoCs USB controllers. Signed-off-by: Antoine Tenart --- drivers/usb/chipidea/Makefile | 1 + drivers/usb/chipidea/ci_hdrc_usb2.c | 138 2 files changed, 139 insertions(+) create mode 100644 drivers/usb/chipidea/ci_hdrc_usb2.c diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile index 2f099c7df7b5..1fc86a2ca22d 100644 --- a/drivers/usb/chipidea/Makefile +++ b/drivers/usb/chipidea/Makefile @@ -10,6 +10,7 @@ ci_hdrc-$(CONFIG_USB_OTG_FSM) += otg_fsm.o # Glue/Bridge layers go here +obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_usb2.o obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_msm.o obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_zevio.o diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c new file mode 100644 index ..6eae1de587f2 --- /dev/null +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2014 Marvell Technology Group Ltd. + * + * Antoine Tenart + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ci.h" + +struct ci_hdrc_usb2_priv { + struct platform_device *ci_pdev; + struct clk *clk; +}; + +static int ci_hdrc_usb2_dt_probe(struct device *dev, +struct ci_hdrc_platform_data *ci_pdata) +{ + ci_pdata->phy = of_phy_get(dev->of_node, 0); + if (IS_ERR(ci_pdata->phy)) { + if (PTR_ERR(ci_pdata->phy) == -EPROBE_DEFER) + return -EPROBE_DEFER; + + /* PHY is optional */ + ci_pdata->phy = NULL; + } + + return 0; +} + +static struct ci_hdrc_platform_data ci_default_pdata = { + .capoffset = DEF_CAPOFFSET, + .flags = CI_HDRC_REQUIRE_TRANSCEIVER | + CI_HDRC_DISABLE_STREAMING, +}; + +static int ci_hdrc_usb2_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct ci_hdrc_usb2_priv *priv; + struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(&pdev->dev); + int ret; + + if (!ci_pdata) + ci_pdata = &ci_default_pdata; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->clk = devm_clk_get(dev, NULL); + if (!IS_ERR(priv->clk)) { + ret = clk_prepare_enable(priv->clk); + if (ret) { + dev_err(dev, "failed to enable the clock: %d\n", ret); + return ret; + } + } + + if (dev->of_node) { + ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata); + if (ret) + goto clk_err; + } else { + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) + goto clk_err; + } + + ci_pdata->name = dev_name(&pdev->dev); + + priv->ci_pdev = ci_hdrc_add_device(dev, pdev->resource, + pdev->num_resources, ci_pdata); + if (IS_ERR(priv->ci_pdev)) { + ret = PTR_ERR(priv->ci_pdev); + if (ret != -EPROBE_DEFER) + dev_err(dev, + "failed to register ci_hdrc platform device: %d\n", + ret); + goto clk_err; + } + + platform_set_drvdata(pdev, priv); + + pm_runtime_no_callbacks(dev); + pm_runtime_enable(dev); + + return 0; + +clk_err: + if (!IS_ERR(priv->clk)) + clk_disable_unprepare(priv->clk); + return ret; +} + +static int ci_hdrc_usb2_remove(struct platform_device *pdev) +{ + struct ci_hdrc_usb2_priv *priv = platform_get_drvdata(pdev); + + pm_runtime_disable(&pdev->dev); + ci_hdrc_remove_device(priv->ci_pdev); + clk_disable_unprepare(priv->clk); + + return 0; +} + +static const struct of_device_id ci_hdrc_usb2_of_match[] = { + { .compatible = "chipidea,usb2" }, + { } +}; +MODULE_DEVICE_TABLE(of, ci_hdrc_usb2_of_match); + +static struct platform_driver ci_hdrc_usb2_driver = { + .probe = ci_hdrc_usb2_probe, + .remove = ci_hdrc_usb2_remove, + .driver = { + .name = "chipidea-usb2", + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(ci_hdrc_usb2_of_match), + }, +}; +module_platform_driver(ci_hdrc_usb2_driver); + +MODULE_DESCRIPTION("ChipIdea HDRC USB2 bindin
[PATCH v6 05/12] phy: add the Berlin USB PHY driver
Add the driver driving the Marvell Berlin USB PHY. This allows to initialize the PHY and to use it from the USB driver later. Signed-off-by: Antoine Tenart --- drivers/phy/Kconfig | 7 ++ drivers/phy/Makefile | 1 + drivers/phy/phy-berlin-usb.c | 224 +++ 3 files changed, 232 insertions(+) create mode 100644 drivers/phy/phy-berlin-usb.c diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 0dd742719154..d1d73dd8c1fb 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -15,6 +15,13 @@ config GENERIC_PHY phy users can obtain reference to the PHY. All the users of this framework should select this config. +config PHY_BERLIN_USB + tristate "Marvell Berlin USB PHY Driver" + depends on ARCH_BERLIN && HAS_IOMEM && OF + select GENERIC_PHY + help + Enable this to support the USB PHY on Marvell Berlin SoCs. + config PHY_BERLIN_SATA tristate "Marvell Berlin SATA PHY driver" depends on ARCH_BERLIN && HAS_IOMEM && OF diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 95c69ed5ed45..b12e84b69c23 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -3,6 +3,7 @@ # obj-$(CONFIG_GENERIC_PHY) += phy-core.o +obj-$(CONFIG_PHY_BERLIN_USB) += phy-berlin-usb.o obj-$(CONFIG_PHY_BERLIN_SATA) += phy-berlin-sata.o obj-$(CONFIG_BCM_KONA_USB2_PHY)+= phy-bcm-kona-usb2.o obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o diff --git a/drivers/phy/phy-berlin-usb.c b/drivers/phy/phy-berlin-usb.c new file mode 100644 index ..f9f13067f50f --- /dev/null +++ b/drivers/phy/phy-berlin-usb.c @@ -0,0 +1,224 @@ +/* + * Copyright (C) 2014 Marvell Technology Group Ltd. + * + * Antoine Tenart + * Jisheng Zhang + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define USB_PHY_PLL0x04 +#define USB_PHY_PLL_CONTROL0x08 +#define USB_PHY_TX_CTRL0 0x10 +#define USB_PHY_TX_CTRL1 0x14 +#define USB_PHY_TX_CTRL2 0x18 +#define USB_PHY_RX_CTRL0x20 +#define USB_PHY_ANALOG 0x34 + +/* USB_PHY_PLL */ +#define CLK_REF_DIV(x) ((x) << 4) +#define FEEDBACK_CLK_DIV(x)((x) << 8) + +/* USB_PHY_PLL_CONTROL */ +#define CLK_STABLE BIT(0) +#define PLL_CTRL_PIN BIT(1) +#define PLL_CTRL_REG BIT(2) +#define PLL_ON BIT(3) +#define PHASE_OFF_TOL_125 (0x0 << 5) +#define PHASE_OFF_TOL_250 BIT(5) +#define KVC0_CALIB (0x0 << 9) +#define KVC0_REG_CTRL BIT(9) +#define KVC0_HIGH (0x0 << 10) +#define KVC0_LOW (0x3 << 10) +#define CLK_BLK_EN BIT(13) + +/* USB_PHY_TX_CTRL0 */ +#define EXT_HS_RCAL_EN BIT(3) +#define EXT_FS_RCAL_EN BIT(4) +#define IMPCAL_VTH_DIV(x) ((x) << 5) +#define EXT_RS_RCAL_DIV(x) ((x) << 8) +#define EXT_FS_RCAL_DIV(x) ((x) << 12) + +/* USB_PHY_TX_CTRL1 */ +#define TX_VDD15_14(0x0 << 4) +#define TX_VDD15_15BIT(4) +#define TX_VDD15_16(0x2 << 4) +#define TX_VDD15_17(0x3 << 4) +#define TX_VDD12_VDD (0x0 << 6) +#define TX_VDD12_11BIT(6) +#define TX_VDD12_12(0x2 << 6) +#define TX_VDD12_13(0x3 << 6) +#define LOW_VDD_EN BIT(8) +#define TX_OUT_AMP(x) ((x) << 9) + +/* USB_PHY_TX_CTRL2 */ +#define TX_CHAN_CTRL_REG(x)((x) << 0) +#define DRV_SLEWRATE(x)((x) << 4) +#define IMP_CAL_FS_HS_DLY_0(0x0 << 6) +#define IMP_CAL_FS_HS_DLY_1BIT(6) +#define IMP_CAL_FS_HS_DLY_2(0x2 << 6) +#define IMP_CAL_FS_HS_DLY_3(0x3 << 6) +#define FS_DRV_EN_MASK(x) ((x) << 8) +#define HS_DRV_EN_MASK(x) ((x) << 12) + +/* USB_PHY_RX_CTRL */ +#define PHASE_FREEZE_DLY_2_CL (0x0 << 0) +#define PHASE_FREEZE_DLY_4_CL BIT(0) +#define ACK_LENGTH_8_CL(0x0 << 2) +#define ACK_LENGTH_12_CL BIT(2) +#define ACK_LENGTH_16_CL (0x2 << 2) +#define ACK_LENGTH_20_CL (0x3 << 2) +#define SQ_LENGTH_3(0x0 << 4) +#define SQ_LENGTH_6BIT(4) +#define SQ_LENGTH_9(0x2 << 4) +#define SQ_LENGTH_12 (0x3 << 4) +#define DISCON_THRESHOLD_260 (0x0 << 6) +#define DISCON_THRESHOLD_270 BIT(6) +#define DISCON_THRESHOLD_280 (0x2 << 6) +#define DISCON_THRESHOLD_290 (0x3 << 6) +#define SQ_THRESHOLD(x)((x) << 8) +#define LPF_COEF(x)((x) << 12) +#define INTPL_CUR_10 (0x0 << 14) +#define INTPL_CUR_20 BIT(14) +#define INTPL_CUR_30 (0x2 << 14) +#define INTPL_CUR_40 (0x3 << 14) + +/* USB_PHY_ANALOG */ +#define ANA_PWR_UP BIT(1) +#defin
[PATCH v6 08/12] Documentation: bindings: add doc for the USB2 ChipIdea USB driver
Document the USB2 ChipIdea driver (ci13xxx) bindings. Signed-off-by: Antoine Tenart --- .../devicetree/bindings/usb/ci-hdrc-usb2.txt | 22 ++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt new file mode 100644 index ..8dd6d8285dab --- /dev/null +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt @@ -0,0 +1,22 @@ +* USB2 ChipIdea USB controller for ci13xxx + +Required properties: +- compatible: should be "chipidea,usb2" +- reg: base address and length of the registers +- interrupts: interrupt for the USB controller + +Optional properties: +- clocks: reference to the USB clock +- phys: reference to the USB PHY +- vbus-supply: reference to the VBUS regulator + +Example: + + usb@f7ed { + compatible = "chipidea,usb2"; + reg = <0xf7ed 0x1>; + interrupts = ; + clocks = <&chip CLKID_USB0>; + phys = <&usb_phy0>; + vbus-supply = <®_usb0_vbus>; + }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 03/12] ARM: Berlin: select the reset controller
The Marvell Berlin SoCs now has a reset controller. Add the needed configuration. Signed-off-by: Antoine Tenart --- arch/arm/mach-berlin/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig index 24f85be71671..5803f773a065 100644 --- a/arch/arm/mach-berlin/Kconfig +++ b/arch/arm/mach-berlin/Kconfig @@ -1,11 +1,13 @@ menuconfig ARCH_BERLIN bool "Marvell Berlin SoCs" if ARCH_MULTI_V7 + select ARCH_HAS_RESET_CONTROLLER select ARCH_REQUIRE_GPIOLIB select ARM_GIC select GENERIC_IRQ_CHIP select DW_APB_ICTL select DW_APB_TIMER_OF select PINCTRL + select RESET_CONTROLLER if ARCH_BERLIN -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 00/12] ARM: berlin: USB support
This series adds the support for ChipIdea USB2 (ci13xxx) controllers, the USB PHYs of the Marvell Berlin SoCs and also adds a reset controller for these SoCs. The reset controller is used by the PHY driver and shares the existing chip controller node with the clocks and one pin controller. The Marvell Berlin USB controllers are host only on the BG2Q and are compatible with USB ChipIdea. We here add a glue to use the available common functions for this kind of controllers, and add a generic USB2 ChipIdea driver. A PHY driver is also added to control the USB PHY. This series applies on top of the generic PHY support in the USB framework[1]. Patches 1-4 have already been taken by Sebastian. Changes since v5: - added a missing header in ci_hdrc_usb2 Changes since v4: - fixed the error handling of ci_hdrc_usb2_probe() Changes since v3: - removed the DMA mask property - moved the clock handling in the common probe function - fixed the documentation for the USB2 ChipIdea USB PHY binding - made sure the reset bit is 0-31 in the reset driver Changes since v2: - moved the PHY driver to the generic PHY framework - changed the compatible to 'chipidea,usb2' - added a property to set the DMA mask in the USB2 CI driver - separated dt specific calls in the CI probing function - rebased on top of the generic PHY support for CI[1] Changes since v1: - made the Berlin CI USB driver a generic one - added support to custom offset for the reset register - added fixed regulators to support supply the VBUS - modified the PHY driver to support the one one the BG2CD as well - documented the reset properties - added bindings for the BG2CD - cosmetic fixes [1] git://git.free-electrons.com:users/antoine-tenart/linux.git usb-phy Antoine Tenart (10): reset: add the Berlin reset controller driver Documentation: bindings: add reset bindings docs for Marvell Berlin SoCs ARM: Berlin: select the reset controller ARM: dts: berlin: add a required reset property in the chip controller node phy: add the Berlin USB PHY driver Documentation: bindings: add doc for the Berlin USB PHY usb: chipidea: add a usb2 driver for ci13xxx Documentation: bindings: add doc for the USB2 ChipIdea USB driver ARM: dts: berlin: add BG2Q nodes for USB support ARM: dts: Berlin: enable USB on the BG2Q DMP Sebastian Hesselbarth (2): ARM: dts: berlin: add BG2CD nodes for USB support ARM: dts: berlin: enable USB on the Google Chromecast .../devicetree/bindings/arm/marvell,berlin.txt | 10 + .../devicetree/bindings/phy/berlin-usb-phy.txt | 16 ++ .../devicetree/bindings/usb/ci-hdrc-usb2.txt | 22 ++ arch/arm/boot/dts/berlin2.dtsi | 1 + arch/arm/boot/dts/berlin2cd-google-chromecast.dts | 4 + arch/arm/boot/dts/berlin2cd.dtsi | 35 arch/arm/boot/dts/berlin2q-marvell-dmp.dts | 53 + arch/arm/boot/dts/berlin2q.dtsi| 53 + arch/arm/mach-berlin/Kconfig | 2 + drivers/phy/Kconfig| 7 + drivers/phy/Makefile | 1 + drivers/phy/phy-berlin-usb.c | 224 + drivers/reset/Makefile | 1 + drivers/reset/reset-berlin.c | 131 drivers/usb/chipidea/Makefile | 1 + drivers/usb/chipidea/ci_hdrc_usb2.c| 138 + 16 files changed, 699 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/berlin-usb-phy.txt create mode 100644 Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt create mode 100644 drivers/phy/phy-berlin-usb.c create mode 100644 drivers/reset/reset-berlin.c create mode 100644 drivers/usb/chipidea/ci_hdrc_usb2.c -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 04/12] ARM: dts: berlin: add a required reset property in the chip controller node
The chip controller node now also describes the Marvell Berlin reset controller. Add the required 'reset-cells' property. Signed-off-by: Antoine Tenart Acked-by: Philipp Zabel --- arch/arm/boot/dts/berlin2.dtsi | 1 + arch/arm/boot/dts/berlin2cd.dtsi | 1 + arch/arm/boot/dts/berlin2q.dtsi | 1 + 3 files changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/berlin2.dtsi b/arch/arm/boot/dts/berlin2.dtsi index 9d7c810ebd0b..d7e81e124de0 100644 --- a/arch/arm/boot/dts/berlin2.dtsi +++ b/arch/arm/boot/dts/berlin2.dtsi @@ -249,6 +249,7 @@ chip: chip-control@ea { compatible = "marvell,berlin2-chip-ctrl"; #clock-cells = <1>; + #reset-cells = <2>; reg = <0xea 0x400>; clocks = <&refclk>; clock-names = "refclk"; diff --git a/arch/arm/boot/dts/berlin2cd.dtsi b/arch/arm/boot/dts/berlin2cd.dtsi index cc1df65da504..68f7032b4686 100644 --- a/arch/arm/boot/dts/berlin2cd.dtsi +++ b/arch/arm/boot/dts/berlin2cd.dtsi @@ -231,6 +231,7 @@ chip: chip-control@ea { compatible = "marvell,berlin2cd-chip-ctrl"; #clock-cells = <1>; + #reset-cells = <2>; reg = <0xea 0x400>; clocks = <&refclk>; clock-names = "refclk"; diff --git a/arch/arm/boot/dts/berlin2q.dtsi b/arch/arm/boot/dts/berlin2q.dtsi index 400c40fceccc..ffba5c3bdab8 100644 --- a/arch/arm/boot/dts/berlin2q.dtsi +++ b/arch/arm/boot/dts/berlin2q.dtsi @@ -332,6 +332,7 @@ chip: chip-control@ea { compatible = "marvell,berlin2q-chip-ctrl"; #clock-cells = <1>; + #reset-cells = <2>; reg = <0xea 0x400>, <0xdd0170 0x10>; clocks = <&refclk>; clock-names = "refclk"; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v6 02/12] Documentation: bindings: add reset bindings docs for Marvell Berlin SoCs
Add the reset binding documentation to the SoC binding documentation as the reset driver in Marvell Berlin SoC is part of the chip/system control registers. This patch adds the required properties to configure the reset controller. Signed-off-by: Antoine Tenart Acked-by: Philipp Zabel --- Documentation/devicetree/bindings/arm/marvell,berlin.txt | 10 ++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/marvell,berlin.txt b/Documentation/devicetree/bindings/arm/marvell,berlin.txt index 904de5781f44..a99eb9eb14c0 100644 --- a/Documentation/devicetree/bindings/arm/marvell,berlin.txt +++ b/Documentation/devicetree/bindings/arm/marvell,berlin.txt @@ -106,11 +106,21 @@ Required subnode-properties: - groups: a list of strings describing the group names. - function: a string describing the function used to mux the groups. +* Reset controller binding + +A reset controller is part of the chip control registers set. The chip control +node also provides the reset. The register set is not at the same offset between +Berlin SoCs. + +Required property: +- #reset-cells: must be set to 2 + Example: chip: chip-control@ea { compatible = "marvell,berlin2-chip-ctrl"; #clock-cells = <1>; + #reset-cells = <2>; reg = <0xea 0x400>; clocks = <&refclk>, <&externaldev 0>; clock-names = "refclk", "video_ext0"; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
On Tuesday 23 September 2014 12:28:03 Antoine Tenart wrote: > + if (dev->of_node) { > + ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata); > + if (ret) > + goto clk_err; > + } else { > + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); > + if (ret) > + goto clk_err; > + } > Why do you care about the non-DT case here? I think it would be nicer to open-code the ci_hdrc_usb2_dt_probe() function in here and remove the dma_set_mask_and_coherent(), which should not even be necessary for the case where you have a hardwired platform device. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/6] phy: improved lookup method
On Mon, Sep 22, 2014 at 05:07:55PM +0530, Kishon Vijay Abraham I wrote: > On Thursday 18 September 2014 03:55 PM, Heikki Krogerus wrote: > > On Mon, Sep 15, 2014 at 03:35:08PM +0300, Heikki Krogerus wrote: > >> On Fri, Sep 12, 2014 at 08:16:01PM +0530, Kishon Vijay Abraham I wrote: > >>> Assume you have 2 phys in your system.. > >>> static struct phy_lookup usb_lookup = { > >>> .phy_name = "phy-usb.0", > >>> .dev_id = "usb.0", > >>> .con_id = "usb", > >>> }; > >>> > >>> static struct phy_lookup sata_lookup = { > >>> .phy_name = "sata-usb.1", > >>> .dev_id = "sata.0", > >>> .con_id = "sata", > >>> }; > >>> > >>> First you do modprobe phy-usb, the probe of USB PHY driver gets invoked > >>> and it > >>> creates the PHY. The phy-core will find a free id (now it will be 0) and > >>> then > >>> name the phy as phy-usb.0. > >>> Then with modprobe phy-sata, the phy-core will create phy-sata.1. > >>> > >>> This is an ideal case where the .phy_name in phy_lookup matches. > >>> > >>> Consider if the order is flipped and the user does modprobe phy-sata > >>> first. The > >>> phy_names won't match anymore (the sata phy device name would be > >>> "sata-usb.0"). > > > > Actually, I don't think there would be this problem if we used the > > name of the actual device which is the parent of phy devices, right? > > hmm.. but if the parent is a multi-phy phy provider (like pipe3 PHY driver), > we > might end up with the same problem. I'm not completely sure what you mean? If you are talking about platforms with multiple instances of a single phy, I don't see how there could ever be a scenario where we did not know the order in which they were enumerated. Can you give an example again? Thanks, -- heikki -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/6] phy: improved lookup method
Hi, On Tuesday 23 September 2014 04:23 PM, Heikki Krogerus wrote: > On Mon, Sep 22, 2014 at 05:07:55PM +0530, Kishon Vijay Abraham I wrote: >> On Thursday 18 September 2014 03:55 PM, Heikki Krogerus wrote: >>> On Mon, Sep 15, 2014 at 03:35:08PM +0300, Heikki Krogerus wrote: On Fri, Sep 12, 2014 at 08:16:01PM +0530, Kishon Vijay Abraham I wrote: > Assume you have 2 phys in your system.. > static struct phy_lookup usb_lookup = { > .phy_name = "phy-usb.0", > .dev_id = "usb.0", > .con_id = "usb", > }; > > static struct phy_lookup sata_lookup = { > .phy_name = "sata-usb.1", > .dev_id = "sata.0", > .con_id = "sata", > }; > > First you do modprobe phy-usb, the probe of USB PHY driver gets invoked > and it > creates the PHY. The phy-core will find a free id (now it will be 0) and > then > name the phy as phy-usb.0. > Then with modprobe phy-sata, the phy-core will create phy-sata.1. > > This is an ideal case where the .phy_name in phy_lookup matches. > > Consider if the order is flipped and the user does modprobe phy-sata > first. The > phy_names won't match anymore (the sata phy device name would be > "sata-usb.0"). >>> >>> Actually, I don't think there would be this problem if we used the >>> name of the actual device which is the parent of phy devices, right? >> >> hmm.. but if the parent is a multi-phy phy provider (like pipe3 PHY driver), >> we >> might end up with the same problem. > > I'm not completely sure what you mean? If you are talking about > platforms with multiple instances of a single phy, I don't see how > there could ever be a scenario where we did not know the order in > which they were enumerated. Can you give an example again? If a single IP implements multiple PHYs (phy-miphy365x.c in linux-phy next), the parent for all the phy devices would be the same. Thanks Kishon -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] storage: Add quirk for another SCM-based USB-SCSI converter
Hi, There is apparently another SCM USB-SCSI converter with ID 04E6:000F. It is listed along with 04E6:000B in the Windows INF file for the Startech ICUSBSCSI2 as "eUSB SCSI Adapter (Bus Powered)". The quirk allows devices with SCSI ID other than 0 to be accessed. Also make a couple of existing SCM product IDs lower case to be consistent with other entries. Signed-off-by: Mark Knibbs --- diff -up linux-3.17-rc6/drivers/usb/storage/unusual_devs.h.orig linux-3.17-rc6/drivers/usb/storage/unusual_devs.h --- linux-3.17-rc6/drivers/usb/storage/unusual_devs.h.orig 2014-09-21 23:43:02.0 +0100 +++ linux-3.17-rc6/drivers/usb/storage/unusual_devs.h 2014-09-23 12:33:45.0 +0100 @@ -492,18 +492,24 @@ UNUSUAL_DEV( 0x04e6, 0x000a, 0x0200, 0x "eUSB CompactFlash Adapter", USB_SC_8020, USB_PR_CB, NULL, 0), -UNUSUAL_DEV( 0x04e6, 0x000B, 0x0100, 0x0100, +UNUSUAL_DEV( 0x04e6, 0x000b, 0x0100, 0x0100, "Shuttle", "eUSCSI Bridge", USB_SC_SCSI, USB_PR_BULK, usb_stor_euscsi_init, US_FL_SCM_MULT_TARG ), -UNUSUAL_DEV( 0x04e6, 0x000C, 0x0100, 0x0100, +UNUSUAL_DEV( 0x04e6, 0x000c, 0x0100, 0x0100, "Shuttle", "eUSCSI Bridge", USB_SC_SCSI, USB_PR_BULK, usb_stor_euscsi_init, US_FL_SCM_MULT_TARG ), +UNUSUAL_DEV( 0x04e6, 0x000f, 0x, 0x, + "SCM Microsystems", + "eUSB SCSI Adapter (Bus Powered)", + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, + US_FL_SCM_MULT_TARG ), + UNUSUAL_DEV( 0x04e6, 0x0101, 0x0200, 0x0200, "Shuttle", "CD-RW Device", -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/6] phy: improved lookup method
On Tue, Sep 23, 2014 at 04:33:09PM +0530, Kishon Vijay Abraham I wrote: > Hi, > > On Tuesday 23 September 2014 04:23 PM, Heikki Krogerus wrote: > > On Mon, Sep 22, 2014 at 05:07:55PM +0530, Kishon Vijay Abraham I wrote: > >> On Thursday 18 September 2014 03:55 PM, Heikki Krogerus wrote: > >>> On Mon, Sep 15, 2014 at 03:35:08PM +0300, Heikki Krogerus wrote: > On Fri, Sep 12, 2014 at 08:16:01PM +0530, Kishon Vijay Abraham I wrote: > > Assume you have 2 phys in your system.. > > static struct phy_lookup usb_lookup = { > > .phy_name = "phy-usb.0", > > .dev_id = "usb.0", > > .con_id = "usb", > > }; > > > > static struct phy_lookup sata_lookup = { > > .phy_name = "sata-usb.1", > > .dev_id = "sata.0", > > .con_id = "sata", > > }; > > > > First you do modprobe phy-usb, the probe of USB PHY driver gets invoked > > and it > > creates the PHY. The phy-core will find a free id (now it will be 0) > > and then > > name the phy as phy-usb.0. > > Then with modprobe phy-sata, the phy-core will create phy-sata.1. > > > > This is an ideal case where the .phy_name in phy_lookup matches. > > > > Consider if the order is flipped and the user does modprobe phy-sata > > first. The > > phy_names won't match anymore (the sata phy device name would be > > "sata-usb.0"). > >>> > >>> Actually, I don't think there would be this problem if we used the > >>> name of the actual device which is the parent of phy devices, right? > >> > >> hmm.. but if the parent is a multi-phy phy provider (like pipe3 PHY > >> driver), we > >> might end up with the same problem. > > > > I'm not completely sure what you mean? If you are talking about > > platforms with multiple instances of a single phy, I don't see how > > there could ever be a scenario where we did not know the order in > > which they were enumerated. Can you give an example again? > > If a single IP implements multiple PHYs (phy-miphy365x.c in linux-phy next), > the parent for all the phy devices would be the same. OK, got it. So I guess we need to match to the phy dev and to the phy name. First to the dev and then in case the phy name is defined in the lookup, to that as well. That should cover both cases. Thanks, -- heikki -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
Arnd, On Tue, Sep 23, 2014 at 12:39:04PM +0200, Arnd Bergmann wrote: > On Tuesday 23 September 2014 12:28:03 Antoine Tenart wrote: > > + if (dev->of_node) { > > + ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata); > > + if (ret) > > + goto clk_err; > > + } else { > > + ret = dma_set_mask_and_coherent(&pdev->dev, > > DMA_BIT_MASK(32)); > > + if (ret) > > + goto clk_err; > > + } > > > > Why do you care about the non-DT case here? I think it would be nicer to > open-code the ci_hdrc_usb2_dt_probe() function in here and remove > the dma_set_mask_and_coherent(), which should not even be necessary for > the case where you have a hardwired platform device. > I thought we agreed to call dma_set_mask_and_coherent(): http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/273335.html I do not have a strong opinion on this as I only use the dt case for my usage. Antoine -- Antoine Ténart, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 0/6] libusbg: Add remove gadget/config/func/binding functionality.
On Tue, Mar 18, 2014 at 09:29:00PM +0100, Krzysztof Opasiak wrote: > Dear Matt, > > In this series of patch I have added remove gadget, config, function, > binding functionality which was missing since introduction of library. > > I have also added remove strings functionality which allow to remove > gadget and configuration strings in given language. > > To show how to use new part of API I have also added example > gadget-vid-pid-remove which removes gadget created by > gadget-acm-ecm (identified using VID and PID). > > This series of patch depends on all my previous series which you can > find on a list or in github pull request. Applied to master, thanks. -Matt > --- > Changes since v1: > - rebased on [1] and adjust to new memory management conventions > - Replace sprintf with snprintf > > 1 - http://article.gmane.org/gmane.linux.usb.general/105164 > > Changes since v2: > - rebased on v2 of earlier mentioned patch series > - use sizeof(target) in snprintf() instead of macro with direct size > - use USBG_MAX_PATH_LENGTH instead of PATH_MAX > - clean up topic from unwanted patches added by mistake > > Krzysztof Opasiak (6): > libusbg: Add remove binding functionality. > libusbg: Add remove gadget/config strings functionality. > libusbg: Add remove configuration functionality. > libusbg: Add remove function functionality. > libusbg: Add remove gadget functionality. > libusbg: Update examples to new API functionality. > > examples/Makefile.am |3 +- > examples/gadget-vid-pid-remove.c | 113 + > include/usbg/usbg.h | 57 - > src/usbg.c | 259 > ++ > 4 files changed, 430 insertions(+), 2 deletions(-) > create mode 100644 examples/gadget-vid-pid-remove.c > > -- > 1.7.9.5 > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 0/4] libusbg: Fix potential issues found with coverity
On Tue, May 13, 2014 at 05:13:18PM +0300, Philippe De Swert wrote: > This patch series fixes a number of issues found with coverity in libusbg > A pull request has also be made: > https://github.com/libusbg/libusbg/pull/4 > > This is the second version where we use a different fix for the readlink, > actually use the right USB_MAX_STR_LENGTH define. I also fixed an issue > I missed first time around. Thanks, applied to master. -Matt > Philippe De Swert (4): > libusbg: Fix readlink/buffer overrun issue. CID#56130, CID#56129 > libusbg: Fix buffer overrun issue. CID#56128 > libusbg: Do not try to dereference func when it is NULL. CID#56127 > libusbg: Do not dereference usb config attributes when they are NULL. > CID#56126 > > src/usbg.c | 7 --- > 1 file changed, 4 insertions(+), 3 deletions(-) > > -- > 1.8.1.2 > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH fix for 3.17] uas: Add another ASM1051 usb-id to the uas blacklist
As most ASM1051 based devices, this one has unfixable issues with uas too. Cc: sta...@vger.kernel.org # 3.16 Signed-off-by: Hans de Goede --- drivers/usb/storage/unusual_uas.h | 8 1 file changed, 8 insertions(+) diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h index 94fb09f..8511b54 100644 --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h @@ -67,3 +67,11 @@ UNUSUAL_DEV(0x152d, 0x0567, 0x, 0x, "JMS567", USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_REPORT_OPCODES), + +/* Most ASM1051 based devices have issues with uas, blacklist them all */ +/* Reported-by: Hans de Goede */ +UNUSUAL_DEV(0x174c, 0x5106, 0x, 0x, + "ASMedia", + "ASM1051", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_UAS), -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 0/4] libusbg: Add support for functionfs
On Wed, Jun 11, 2014 at 05:09:46PM +0200, Krzysztof Opasiak wrote: > Dear Matt, > > Configuration of function fs based functions using config fs has been > merged to linux kernel quite long ago. To keep libusbg up to date I > have prepared patches that add support for functionfs function type. > > When working with ffs I noticed that it would be a good feature to > provide device name directly to user and avoid him confusion that > instance name has to be the same as device to mount ffs. That's why I > have added structure for ffs attributes which has only one, pure > virtual (not present in configfs and read-only) attribute dev_name. > > Now user can create ffs function in a two ways: > > 1) Pass instance name name and then get function attributes (device > name) > > 2) Pass NULL as instance name and pass function attributes with > desired device name This is great, I just made use of this in an application I'm working on now and like it. > First commit in this serie fix potential memory leak which could > take place in usbg_init(). To avoid this usbg_init() has been > refactored and now all memory should be free() properly. > > I have created pull request on github with those patches [1]. > > Please also notice that there are still two pending patch series: > > 1) Remove gadget functionality [2] > This one has been changed according to your review but is still > pending for over a month. > > 2) Couple fixes from Philippe De Swert [3] > That's a few commits which fix errors reported by coverity. > I have reviewed this serie, build and run and it looks good > to me. Please also run through this code and merge if you > don't find anny issues. > Applied to master, thanks! -Matt -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 0/3] Small fixes and clean up
On Fri, Aug 22, 2014 at 01:56:37PM +0200, Krzysztof Opasiak wrote: > Dear Matt, > > This is a small series which fix usbg_set_function_attrs() > which previously tried to set attributes which are read only > on configfs. > > I have also went through code and marked attributes which should not > change during function calls with const qualifiers. > > Third patch is a small enhancement which replace ether_aton() and > ether_ntoa() calls with their reentrant versions ether_aton_r() and > ether_ntoa(). > > I'm looking froward for your review and merge if you find it > suitable. I have also created a github pull request: > > https://github.com/libusbg/libusbg/pull/7 > > Please let me also notice that there are still three patch series > which are pending for your review and some of them are waiting for > quite a long time: > > https://github.com/libusbg/libusbg/pull/6 - since 10th of June > (this is reopened pull request #5 due to some git issues) > https://github.com/libusbg/libusbg/pull/4 - since 9th of May > https://github.com/libusbg/libusbg/pull/3 - since 2nd of April All applied to master now along with this set of fixes, thanks. -Matt -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: core: downgrade log severity to info when descriptor missing
On Mon, 22 Sep 2014, Scot Doyle wrote: > According to commit 0cce2eda19923e5e5ccc8b042dec5af87b3ffad0 > USB: fix LANGID=0 regression > > usb devices are not required to report string descriptors. Since they are > optional, log an info message instead of an error message. In addition, > use a higher level info message while moving the details to a debug message. > > Tested with USB device 0930:021c. This is a good description, but it's not what the patch actually does. > Signed-off-by: Scot Doyle > --- > drivers/usb/core/message.c | 14 +- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c > index 0c8a7fc..6b95de7 100644 > --- a/drivers/usb/core/message.c > +++ b/drivers/usb/core/message.c > @@ -766,7 +766,7 @@ static int usb_get_langid(struct usb_device *dev, > unsigned char *tbuf) > > /* If the string was reported but is malformed, default to english >* (0x0409) */ > - if (err == -ENODATA || (err > 0 && err < 4)) { > + if (err > 0 && err < 4) { Why treat ENODATA as a separate case? It's just like the others -- the device returned some data, but the data was malformed. If the device really does not support string descriptors at all, err would be equal to -EPIPE. > dev->string_langid = 0x0409; > dev->have_langid = 1; > dev_err(&dev->dev, > @@ -776,6 +776,18 @@ static int usb_get_langid(struct usb_device *dev, > unsigned char *tbuf) > return 0; > } > > + /* If the string was unavailable, default to english (0x0409) */ -ENODATA doesn't mean the string was unavailable. It means that the second byte of the reply was different from USB_DT_STRING, i.e., the reply was malformed. > + if (err == -ENODATA) { > + dev->string_langid = 0x0409; > + dev->have_langid = 1; > + dev_info(&dev->dev, > + "no string descriptor language, defaulting to English"); > + dev_dbg(&dev->dev, > + "string descriptor 0 unavailable (err = -ENODATA), " > + "defaulting to 0x%04x\n", dev->string_langid); > + return 0; > + } Therefore this section is completely unnecessary. > + > /* In case of all other errors, we assume the device is not able to >* deal with strings at all. Set string_langid to -1 in order to >* prevent any string to be retrieved from the device */ And down here is where you should call either dev_info() or dev_err(), depending on whether err is equal to -EPIPE or something else. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] libusbg: Fix usbg_disable_gadget to actually clear the UDC
* Krzysztof Opasiak [140923 03:22]: > > -Original Message- > > From: Tony Lindgren [mailto:t...@atomide.com] > > Sent: Monday, September 22, 2014 3:17 PM > > To: Krzysztof Opasiak > > Cc: 'Matt Porter'; linux-usb@vger.kernel.org; Stanislaw Wadas; > > Andrzej Pietrasiewicz; Marek Szyprowski; Karol Lewandowski; > > philippedesw...@gmail.com > > Subject: Re: [PATCH] libusbg: Fix usbg_disable_gadget to actually > > clear the UDC > > > > * Krzysztof Opasiak [140922 01:07]: > > > Dear Tony, > > > > > > > -Original Message- > > > > From: linux-usb-ow...@vger.kernel.org [mailto:linux-usb- > > > > ow...@vger.kernel.org] On Behalf Of Tony Lindgren > > > > Sent: Saturday, September 20, 2014 5:51 PM > > > > To: Matt Porter > > > > Cc: linux-usb@vger.kernel.org > > > > Subject: [PATCH] libusbg: Fix usbg_disable_gadget to actually > > clear > > > > the UDC > > > > > > > > Currently usbg_disable_gadget() does not actually write > > anything > > > > to UDC to clear it and the configured UDC name stays there. > > > > > > > > > > No, udc name doesn't stay there due to O_TRUNC flag which is > > always used > > > for writing in usbg_write_string(). With this flag we don't need > > to > > > write new line to file because size of file is set to 0 while > > opening. > > > > > > Summing up: > > > > > > open("/sys/kernel/config/usb_gadget/g1/UDC", > > O_WRONLY|O_CREAT|O_TRUNC, > > > 0666) = 3 > > > close(3)= 0 > > > > > > causes unbind, so everything works fine. > > > > Hmm not clearing for me doing this afterwards: > > > > # cat /sys/kernel/config/usb_gadget/g1/UDC > > musb-hdrc.0.auto > > > > The UDC name stays there and won't get cleared. > > > > Am I missing something? > > Please forgive me, I have checked it once again and you are right. I > thought that truncate flag works on configfs in a similar way than on > others fs but I was wrong. This flag simply does nothing and you have > definitely found a bug. > > I was certain sure that this function works fine due to > gadget-vid-pid-remove example. In this simple program gadget is disabled > before removing. I had in my mind that it is impossible to modify a > gadget if it is bound to any udc. This example worked fine so I assumed > that usbg_disable_gadget() also works fine. I have look into configfs > composite gadget source and there I have found some surprise: > > /* >* ideally I would like to forbid to unlink functions while a > gadget is >* bound to an UDC. Since this isn't possible at the moment, we > simply >* force an unbind, the function is available here and then we > can >* remove the function. >*/ > mutex_lock(&gi->lock); > if (gi->udc_name) > unregister_gadget(gi); > WARN_ON(gi->udc_name); > > This means that it is currently possible to remove function binding on > enabled gadget and it will cause unbind. This is why usbg_rm_gadget() > also worked fine without proper usbg_disable_gadget(). > > Summing up, Your patch fix an important bug. Its form is good for me. I > have checked it and it works fine. You may add: > > Reviewed-by: Krzysztof Opasiak > > If it is going about Matt Porter activity, he is not responding for > mails or patches since April. I have github-fork of libusbg [1] with > latest source (my master is 35 commits ahead of libusbg/master and some > devel branches are even more). All patches which are intended for > libusbg (sent on a list or from pull requests) are merged there after > review. Oh OK maybe he's busy with other things then. I'll give your branch a try then. > Please let me also notice that your patch has been also merged into my > master. OK thanks. > Thank you for fixing this issue. No problem, thanks for queueing the pending patches. Is there an example somewhere that completely clears any configured gadget from /sys/config/? Regards, Tony > Foot notes: > 1 - https://github.com/kopasiak/libusbg -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 00/15] Add import from/export to file functionality
On Mon, Aug 25, 2014 at 10:54:51AM +0200, Krzysztof Opasiak wrote: > Dear Matt, > > This quite big series adds new part of libusbg API which allows to > import/export gadget/function/configuration from/to file. > > Motivation: > > Libusbg allows to create a binary file which set up custom > gadget. This is useful but if we have to create custom binary for > each gadget we wast a lot of work which kernel people put to separate > code from configuration. This leads us to main idea of gadget > schemes. Allow to create simple, human readable config file which > library will be able to translate into usb gadget. > > Description: > > Gadget schemes is idea of describing gadget/function/configuration in > config file. To not reinvent the wheel I have used existing library > libconfig [1]. This means that the syntax is similar to this described > in documentation of libconfig. Thank goodness. Apparently you read my mind and avoided use of xml and json here. I've used libconfig before and really like the human readable/creatable syntax. > > I have extended the library with set of usbg_export_*() functions > which allows to export selected gadget to given FILE. There is also > set of complementary usbg_import_*() functions which allows to read > scheme of gadget/function/config from file and create it using > configfs. > > To avoid name conflict I have used the convention that > usbg_import_gadget() function takes name of new gadget as parameter > and usbg_export_gadget() doesn't export gadget name to scheme > file. Similar idea is used in configuration and functions. > > Base convention of gadget schemes is simple: if something is not set > in scheme file, default values provided by kernel are used. Moreover > configfs has some attributes which are read only. To allow to store > them in scheme file they are ignored by import functions. > > Usage of libconfig and whole design of gadget schemes allows us to use > include directive in gadget definition to import complicated > configurations or functions. > > Syntax and detailed rules of using schemes has been described in > gadget_schemes.txt in commit: > Summary: > > I have created a pull request also for this series: > > https://github.com/libusbg/libusbg/pull/8 Applied this to master, thanks. > > Feel free to provide your comments about the whole idea and also about > its implementation. It all looks good, my major concern when you had first mentioned this was about was schema/format would be used. APIs look great, and I've tested this with my own WIP application and it works quite nicely. Thanks for adding this feature. -Matt -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] libusbg: Fix usbg_disable_gadget to actually clear the UDC
Forgot about link: 1 - https://github.com/kopasiak/gt > -Original Message- > From: Tony Lindgren [mailto:t...@atomide.com] > Sent: Tuesday, September 23, 2014 4:34 PM > To: Krzysztof Opasiak > Cc: 'Matt Porter'; linux-usb@vger.kernel.org; Stanislaw Wadas; > Andrzej Pietrasiewicz; Marek Szyprowski; Karol Lewandowski; > philippedesw...@gmail.com > Subject: Re: [PATCH] libusbg: Fix usbg_disable_gadget to actually > clear the UDC > > * Krzysztof Opasiak [140923 03:22]: > > > -Original Message- > > > From: Tony Lindgren [mailto:t...@atomide.com] > > > Sent: Monday, September 22, 2014 3:17 PM > > > To: Krzysztof Opasiak > > > Cc: 'Matt Porter'; linux-usb@vger.kernel.org; Stanislaw Wadas; > > > Andrzej Pietrasiewicz; Marek Szyprowski; Karol Lewandowski; > > > philippedesw...@gmail.com > > > Subject: Re: [PATCH] libusbg: Fix usbg_disable_gadget to > actually > > > clear the UDC > > > > > > * Krzysztof Opasiak [140922 01:07]: > > > > Dear Tony, > > > > > > > > > -Original Message- > > > > > From: linux-usb-ow...@vger.kernel.org [mailto:linux-usb- > > > > > ow...@vger.kernel.org] On Behalf Of Tony Lindgren > > > > > Sent: Saturday, September 20, 2014 5:51 PM > > > > > To: Matt Porter > > > > > Cc: linux-usb@vger.kernel.org > > > > > Subject: [PATCH] libusbg: Fix usbg_disable_gadget to > actually > > > clear > > > > > the UDC > > > > > > > > > > Currently usbg_disable_gadget() does not actually write > > > anything > > > > > to UDC to clear it and the configured UDC name stays there. > > > > > > > > > > > > > No, udc name doesn't stay there due to O_TRUNC flag which is > > > always used > > > > for writing in usbg_write_string(). With this flag we don't > need > > > to > > > > write new line to file because size of file is set to 0 while > > > opening. > > > > > > > > Summing up: > > > > > > > > open("/sys/kernel/config/usb_gadget/g1/UDC", > > > O_WRONLY|O_CREAT|O_TRUNC, > > > > 0666) = 3 > > > > close(3)= 0 > > > > > > > > causes unbind, so everything works fine. > > > > > > Hmm not clearing for me doing this afterwards: > > > > > > # cat /sys/kernel/config/usb_gadget/g1/UDC > > > musb-hdrc.0.auto > > > > > > The UDC name stays there and won't get cleared. > > > > > > Am I missing something? > > > > Please forgive me, I have checked it once again and you are > right. I > > thought that truncate flag works on configfs in a similar way > than on > > others fs but I was wrong. This flag simply does nothing and you > have > > definitely found a bug. > > > > I was certain sure that this function works fine due to > > gadget-vid-pid-remove example. In this simple program gadget is > disabled > > before removing. I had in my mind that it is impossible to modify > a > > gadget if it is bound to any udc. This example worked fine so I > assumed > > that usbg_disable_gadget() also works fine. I have look into > configfs > > composite gadget source and there I have found some surprise: > > > > /* > > * ideally I would like to forbid to unlink functions while a > > gadget is > > * bound to an UDC. Since this isn't possible at the moment, > we > > simply > > * force an unbind, the function is available here and then > we > > can > > * remove the function. > > */ > > mutex_lock(&gi->lock); > > if (gi->udc_name) > > unregister_gadget(gi); > > WARN_ON(gi->udc_name); > > > > This means that it is currently possible to remove function > binding on > > enabled gadget and it will cause unbind. This is why > usbg_rm_gadget() > > also worked fine without proper usbg_disable_gadget(). > > > > Summing up, Your patch fix an important bug. Its form is good for > me. I > > have checked it and it works fine. You may add: > > > > Reviewed-by: Krzysztof Opasiak > > > > If it is going about Matt Porter activity, he is not responding > for > > mails or patches since April. I have github-fork of libusbg [1] > with > > latest source (my master is 35 commits ahead of libusbg/master > and some > > devel branches are even more). All patches which are intended for > > libusbg (sent on a list or from pull requests) are merged there > after > > review. > > Oh OK maybe he's busy with other things then. I'll give your branch > a try then. > > > Please let me also notice that your patch has been also merged > into my > > master. > > OK thanks. > > > Thank you for fixing this issue. > > No problem, thanks for queueing the pending patches. > > Is there an example somewhere that completely clears any configured > gadget from /sys/config/? > > Regards, > > Tony > > > Foot notes: > > 1 - https://github.com/kopasiak/libusbg -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/2] USB: core: add add device-qualifier quirk
On Mon, Aug 25, 2014 at 05:51:25PM +0200, Johan Hovold wrote: > This is quirk is indeed needed to get the Elan Touchscreen found on some > Samsung laptops to enumerate reliably. [...] > Johan Hovold (2): > USB: core: add device-qualifier quirk > USB: quirks: enable device-qualifier quirk for Elan Touchscreen Are these patches still in your queue, Greg? Just checking now that the merge window is around the corner. Thanks, Johan -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] libusbg: Fix usbg_disable_gadget to actually clear the UDC
> -Original Message- > From: Tony Lindgren [mailto:t...@atomide.com] > Sent: Tuesday, September 23, 2014 4:34 PM > To: Krzysztof Opasiak > Cc: 'Matt Porter'; linux-usb@vger.kernel.org; Stanislaw Wadas; > Andrzej Pietrasiewicz; Marek Szyprowski; Karol Lewandowski; > philippedesw...@gmail.com > Subject: Re: [PATCH] libusbg: Fix usbg_disable_gadget to actually > clear the UDC > > * Krzysztof Opasiak [140923 03:22]: > > > -Original Message- > > > From: Tony Lindgren [mailto:t...@atomide.com] > > > Sent: Monday, September 22, 2014 3:17 PM > > > To: Krzysztof Opasiak > > > Cc: 'Matt Porter'; linux-usb@vger.kernel.org; Stanislaw Wadas; > > > Andrzej Pietrasiewicz; Marek Szyprowski; Karol Lewandowski; > > > philippedesw...@gmail.com > > > Subject: Re: [PATCH] libusbg: Fix usbg_disable_gadget to > actually > > > clear the UDC > > > > > > * Krzysztof Opasiak [140922 01:07]: > > > > Dear Tony, > > > > > > > > > -Original Message- > > > > > From: linux-usb-ow...@vger.kernel.org [mailto:linux-usb- > > > > > ow...@vger.kernel.org] On Behalf Of Tony Lindgren > > > > > Sent: Saturday, September 20, 2014 5:51 PM > > > > > To: Matt Porter > > > > > Cc: linux-usb@vger.kernel.org > > > > > Subject: [PATCH] libusbg: Fix usbg_disable_gadget to > actually > > > clear > > > > > the UDC > > > > > > > > > > Currently usbg_disable_gadget() does not actually write > > > anything > > > > > to UDC to clear it and the configured UDC name stays there. > > > > > > > > > > > > > No, udc name doesn't stay there due to O_TRUNC flag which is > > > always used > > > > for writing in usbg_write_string(). With this flag we don't > need > > > to > > > > write new line to file because size of file is set to 0 while > > > opening. > > > > > > > > Summing up: > > > > > > > > open("/sys/kernel/config/usb_gadget/g1/UDC", > > > O_WRONLY|O_CREAT|O_TRUNC, > > > > 0666) = 3 > > > > close(3)= 0 > > > > > > > > causes unbind, so everything works fine. > > > > > > Hmm not clearing for me doing this afterwards: > > > > > > # cat /sys/kernel/config/usb_gadget/g1/UDC > > > musb-hdrc.0.auto > > > > > > The UDC name stays there and won't get cleared. > > > > > > Am I missing something? > > > > Please forgive me, I have checked it once again and you are > right. I > > thought that truncate flag works on configfs in a similar way > than on > > others fs but I was wrong. This flag simply does nothing and you > have > > definitely found a bug. > > > > I was certain sure that this function works fine due to > > gadget-vid-pid-remove example. In this simple program gadget is > disabled > > before removing. I had in my mind that it is impossible to modify > a > > gadget if it is bound to any udc. This example worked fine so I > assumed > > that usbg_disable_gadget() also works fine. I have look into > configfs > > composite gadget source and there I have found some surprise: > > > > /* > > * ideally I would like to forbid to unlink functions while a > > gadget is > > * bound to an UDC. Since this isn't possible at the moment, > we > > simply > > * force an unbind, the function is available here and then > we > > can > > * remove the function. > > */ > > mutex_lock(&gi->lock); > > if (gi->udc_name) > > unregister_gadget(gi); > > WARN_ON(gi->udc_name); > > > > This means that it is currently possible to remove function > binding on > > enabled gadget and it will cause unbind. This is why > usbg_rm_gadget() > > also worked fine without proper usbg_disable_gadget(). > > > > Summing up, Your patch fix an important bug. Its form is good for > me. I > > have checked it and it works fine. You may add: > > > > Reviewed-by: Krzysztof Opasiak > > > > If it is going about Matt Porter activity, he is not responding > for > > mails or patches since April. I have github-fork of libusbg [1] > with > > latest source (my master is 35 commits ahead of libusbg/master > and some > > devel branches are even more). All patches which are intended for > > libusbg (sent on a list or from pull requests) are merged there > after > > review. > > Oh OK maybe he's busy with other things then. I'll give your branch > a try then. > > > Please let me also notice that your patch has been also merged > into my > > master. > > OK thanks. > > > Thank you for fixing this issue. > > No problem, thanks for queueing the pending patches. > > Is there an example somewhere that completely clears any configured > gadget from /sys/config/? > Yes, please check my master branch. There is a set of functions: usbg_rm_*() which can be used to remove selected entity. The most convenient usage for gadget is to use usbg_rm_gadget() with USBG_RM_RECURSE flag which works quite like rm -rf *. There is also an example called gadget-vid-pid-remove which removes all gadgets based on vid and pid. Currently this example is hardcoded to remove gadget with vid 0x1d6b and pid 0x0104 (those are used along almost
Re: [PATCH] libusbg: Fix usbg_disable_gadget to actually clear the UDC
* Krzysztof Opasiak [140923 07:48]: > > From: Tony Lindgren [mailto:t...@atomide.com] > > > > Is there an example somewhere that completely clears any configured > > gadget from /sys/config/? > > > > Yes, please check my master branch. > > There is a set of functions: usbg_rm_*() which can be used to remove > selected entity. The most convenient usage for gadget is to use > usbg_rm_gadget() with USBG_RM_RECURSE flag which works quite like rm -rf > *. > > There is also an example called gadget-vid-pid-remove which removes all > gadgets based on vid and pid. Currently this example is hardcoded to > remove gadget with vid 0x1d6b and pid 0x0104 (those are used along > almost all examples) but you may easily edit it to take vid pid or > gadget name from command line. > > Moreover there is also a command line tool called gt [1] to manipulate > usb gadgets but it's in very initial state (only command line parsing is > ready). This tool would do the thing in a future but currently this > functionality is not implemented. OK great thanks. Tony -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Revert "usb: gadget: composite: dequeue cdev->req before free it in composite_dev_cleanup"
On Mon, Sep 22, 2014 at 09:28:26AM -0500, Felipe Balbi wrote: > Hi, > > On Thu, Sep 18, 2014 at 09:31:32AM -0500, Felipe Balbi wrote: > > This reverts commit f2267089ea17fa97b796b1b4247e3f8957655df3. > > > > That commit causes more problem than fixes. Firstly, kfree() > > should be called after usb_ep_dequeue() and secondly, the way > > things are, we will try to dequeue a request that has already > > completed much more frequently than one which is pending. > > > > Cc: Li Jun > > Signed-off-by: Felipe Balbi > > --- > > > > Greg, can you still apply this for v3.17 final ? Please take it as a patch > > directly so we avoid a pull request for a single patch. If you prefer a > > pull, > > let me know. > > looks like -rc6 will be the last -rc for v3.17. If we can't get this on > v3.17-final, do you mind merging this on usb-next and add a Cc stable > #3.17 ? Ick, sorry, missed this for an earlier release, will go do this now and queue it up that way. greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/2] USB: core: add add device-qualifier quirk
On Tue, Sep 23, 2014 at 04:56:24PM +0200, Johan Hovold wrote: > On Mon, Aug 25, 2014 at 05:51:25PM +0200, Johan Hovold wrote: > > This is quirk is indeed needed to get the Elan Touchscreen found on some > > Samsung laptops to enumerate reliably. > > [...] > > > Johan Hovold (2): > > USB: core: add device-qualifier quirk > > USB: quirks: enable device-qualifier quirk for Elan Touchscreen > > Are these patches still in your queue, Greg? Just checking now that the > merge window is around the corner. My queue is "huge" and I hope to tackle it tonight... thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Revert "usb: gadget: composite: dequeue cdev->req before free it in composite_dev_cleanup"
On Tue, Sep 23, 2014 at 07:55:38AM -0700, Greg KH wrote: > On Mon, Sep 22, 2014 at 09:28:26AM -0500, Felipe Balbi wrote: > > Hi, > > > > On Thu, Sep 18, 2014 at 09:31:32AM -0500, Felipe Balbi wrote: > > > This reverts commit f2267089ea17fa97b796b1b4247e3f8957655df3. > > > > > > That commit causes more problem than fixes. Firstly, kfree() > > > should be called after usb_ep_dequeue() and secondly, the way > > > things are, we will try to dequeue a request that has already > > > completed much more frequently than one which is pending. > > > > > > Cc: Li Jun > > > Signed-off-by: Felipe Balbi > > > --- > > > > > > Greg, can you still apply this for v3.17 final ? Please take it as a patch > > > directly so we avoid a pull request for a single patch. If you prefer a > > > pull, > > > let me know. > > > > looks like -rc6 will be the last -rc for v3.17. If we can't get this on > > v3.17-final, do you mind merging this on usb-next and add a Cc stable > > #3.17 ? > > Ick, sorry, missed this for an earlier release, will go do this now and > queue it up that way. Thanks -- balbi signature.asc Description: Digital signature
Re: [PATCH 0/2] USB: core: add add device-qualifier quirk
On Tue, Sep 23, 2014 at 08:21:51AM -0700, Greg Kroah-Hartman wrote: > On Tue, Sep 23, 2014 at 04:56:24PM +0200, Johan Hovold wrote: > > On Mon, Aug 25, 2014 at 05:51:25PM +0200, Johan Hovold wrote: > > > This is quirk is indeed needed to get the Elan Touchscreen found on some > > > Samsung laptops to enumerate reliably. > > > > [...] > > > > > Johan Hovold (2): > > > USB: core: add device-qualifier quirk > > > USB: quirks: enable device-qualifier quirk for Elan Touchscreen > > > > Are these patches still in your queue, Greg? Just checking now that the > > merge window is around the corner. > > My queue is "huge" and I hope to tackle it tonight... Yeah, that's the impression I got. Just a heads up: There was another quirk submitted after this one that uses the same quirk mask. Good luck with the queue. :) Johan -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] libusbg: Fix usbg_disable_gadget to actually clear the UDC
On Tue, Sep 23, 2014 at 12:21:01PM +0200, Krzysztof Opasiak wrote: > > -Original Message- > > From: Tony Lindgren [mailto:t...@atomide.com] > > Sent: Monday, September 22, 2014 3:17 PM > > To: Krzysztof Opasiak > > Cc: 'Matt Porter'; linux-usb@vger.kernel.org; Stanislaw Wadas; > > Andrzej Pietrasiewicz; Marek Szyprowski; Karol Lewandowski; > > philippedesw...@gmail.com > > Subject: Re: [PATCH] libusbg: Fix usbg_disable_gadget to actually > > clear the UDC > > > > * Krzysztof Opasiak [140922 01:07]: > > > Dear Tony, > > > > > > > -Original Message- > > > > From: linux-usb-ow...@vger.kernel.org [mailto:linux-usb- > > > > ow...@vger.kernel.org] On Behalf Of Tony Lindgren > > > > Sent: Saturday, September 20, 2014 5:51 PM > > > > To: Matt Porter > > > > Cc: linux-usb@vger.kernel.org > > > > Subject: [PATCH] libusbg: Fix usbg_disable_gadget to actually > > clear > > > > the UDC > > > > > > > > Currently usbg_disable_gadget() does not actually write > > anything > > > > to UDC to clear it and the configured UDC name stays there. > > > > > > > > > > No, udc name doesn't stay there due to O_TRUNC flag which is > > always used > > > for writing in usbg_write_string(). With this flag we don't need > > to > > > write new line to file because size of file is set to 0 while > > opening. > > > > > > Summing up: > > > > > > open("/sys/kernel/config/usb_gadget/g1/UDC", > > O_WRONLY|O_CREAT|O_TRUNC, > > > 0666) = 3 > > > close(3)= 0 > > > > > > causes unbind, so everything works fine. > > > > Hmm not clearing for me doing this afterwards: > > > > # cat /sys/kernel/config/usb_gadget/g1/UDC > > musb-hdrc.0.auto > > > > The UDC name stays there and won't get cleared. > > > > Am I missing something? > > Please forgive me, I have checked it once again and you are right. I > thought that truncate flag works on configfs in a similar way than on > others fs but I was wrong. This flag simply does nothing and you have > definitely found a bug. > > I was certain sure that this function works fine due to > gadget-vid-pid-remove example. In this simple program gadget is disabled > before removing. I had in my mind that it is impossible to modify a > gadget if it is bound to any udc. This example worked fine so I assumed > that usbg_disable_gadget() also works fine. I have look into configfs > composite gadget source and there I have found some surprise: > > /* >* ideally I would like to forbid to unlink functions while a > gadget is >* bound to an UDC. Since this isn't possible at the moment, we > simply >* force an unbind, the function is available here and then we > can >* remove the function. >*/ > mutex_lock(&gi->lock); > if (gi->udc_name) > unregister_gadget(gi); > WARN_ON(gi->udc_name); > > This means that it is currently possible to remove function binding on > enabled gadget and it will cause unbind. This is why usbg_rm_gadget() > also worked fine without proper usbg_disable_gadget(). > > Summing up, Your patch fix an important bug. Its form is good for me. I > have checked it and it works fine. You may add: > > Reviewed-by: Krzysztof Opasiak > > If it is going about Matt Porter activity, he is not responding for > mails or patches since April. I have github-fork of libusbg [1] with > latest source (my master is 35 commits ahead of libusbg/master and some > devel branches are even more). All patches which are intended for > libusbg (sent on a list or from pull requests) are merged there after > review. > > Please let me also notice that your patch has been also merged into my > master. > > Thank you for fixing this issue. Also verified that it fixes the issue here. Applied to master [1] along with all of the backlog, excluding the WIP usbg_udc patches. Thanks for everybody's patience. -Matt [1] https://github.com/libusbg/libusbg -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
On Tuesday 23 September 2014 15:36:45 Antoine Tenart wrote: > On Tue, Sep 23, 2014 at 12:39:04PM +0200, Arnd Bergmann wrote: > > On Tuesday 23 September 2014 12:28:03 Antoine Tenart wrote: > > > + if (dev->of_node) { > > > + ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata); > > > + if (ret) > > > + goto clk_err; > > > + } else { > > > + ret = dma_set_mask_and_coherent(&pdev->dev, > > > DMA_BIT_MASK(32)); > > > + if (ret) > > > + goto clk_err; > > > + } > > > > > > > Why do you care about the non-DT case here? I think it would be nicer to > > open-code the ci_hdrc_usb2_dt_probe() function in here and remove > > the dma_set_mask_and_coherent(), which should not even be necessary for > > the case where you have a hardwired platform device. > > > > I thought we agreed to call dma_set_mask_and_coherent(): > http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/273335.html > > I do not have a strong opinion on this as I only use the dt case for my > usage. The question is more about who actually wants the non-DT case. Since this is a new driver, I suspect that the answer is "nobody", as the existing board files are all for legacy platforms that we are not going to adapt for this driver. I see in the thread that at least Peter Chen was assuming the non-DT case was still needed, but I can't find a reason for this in the code. If we no longer care about that, the call to dev_get_platdata() can also get removed. Looking through the code some more, I also notice that it's using a strange way of doing the abstraction: ci_hdrc_add_device() actually creates a child device node, while the preferred way would be to just call into ci_hdrc_probe(), or a generalized version of that. That should probably be changed, but can be done as a later cleanup. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
HI, On Tue, Sep 23, 2014 at 06:44:40PM +0200, Arnd Bergmann wrote: > On Tuesday 23 September 2014 15:36:45 Antoine Tenart wrote: > > On Tue, Sep 23, 2014 at 12:39:04PM +0200, Arnd Bergmann wrote: > > > On Tuesday 23 September 2014 12:28:03 Antoine Tenart wrote: > > > > + if (dev->of_node) { > > > > + ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata); > > > > + if (ret) > > > > + goto clk_err; > > > > + } else { > > > > + ret = dma_set_mask_and_coherent(&pdev->dev, > > > > DMA_BIT_MASK(32)); > > > > + if (ret) > > > > + goto clk_err; > > > > + } > > > > > > > > > > Why do you care about the non-DT case here? I think it would be nicer to > > > open-code the ci_hdrc_usb2_dt_probe() function in here and remove > > > the dma_set_mask_and_coherent(), which should not even be necessary for > > > the case where you have a hardwired platform device. > > > > > > > I thought we agreed to call dma_set_mask_and_coherent(): > > http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/273335.html > > > > I do not have a strong opinion on this as I only use the dt case for my > > usage. > > The question is more about who actually wants the non-DT case. > > Since this is a new driver, I suspect that the answer is "nobody", > as the existing board files are all for legacy platforms that we > are not going to adapt for this driver. wait a minute... will the legacy platforms be adapted to DT and, thus, to this driver in the future ? I really don't want to keep several copies of chipidea driver just because there are still some legacy platforms still using them. I have said in the past and will say again, everybody should move to the generic chipidea driver at the earliest opportunity so we avoid duplication of work. -- balbi signature.asc Description: Digital signature
Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
On Tuesday 23 September 2014 11:55:15 Felipe Balbi wrote: > On Tue, Sep 23, 2014 at 06:44:40PM +0200, Arnd Bergmann wrote: > > On Tuesday 23 September 2014 15:36:45 Antoine Tenart wrote: > > > On Tue, Sep 23, 2014 at 12:39:04PM +0200, Arnd Bergmann wrote: > > > > On Tuesday 23 September 2014 12:28:03 Antoine Tenart wrote: > > > > > + if (dev->of_node) { > > > > > + ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata); > > > > > + if (ret) > > > > > + goto clk_err; > > > > > + } else { > > > > > + ret = dma_set_mask_and_coherent(&pdev->dev, > > > > > DMA_BIT_MASK(32)); > > > > > + if (ret) > > > > > + goto clk_err; > > > > > + } > > > > > > > > > > > > > Why do you care about the non-DT case here? I think it would be nicer to > > > > open-code the ci_hdrc_usb2_dt_probe() function in here and remove > > > > the dma_set_mask_and_coherent(), which should not even be necessary for > > > > the case where you have a hardwired platform device. > > > > > > > > > > I thought we agreed to call dma_set_mask_and_coherent(): > > > http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/273335.html > > > > > > I do not have a strong opinion on this as I only use the dt case for my > > > usage. > > > > The question is more about who actually wants the non-DT case. > > > > Since this is a new driver, I suspect that the answer is "nobody", > > as the existing board files are all for legacy platforms that we > > are not going to adapt for this driver. > > wait a minute... will the legacy platforms be adapted to DT and, thus, > to this driver in the future ? I really don't want to keep several > copies of chipidea driver just because there are still some legacy > platforms still using them. I have said in the past and will say again, > everybody should move to the generic chipidea driver at the earliest > opportunity so we avoid duplication of work. > Sorry, my mistake. The intention that this new driver is meant to replace the existing ones wasn't clear to me from the changelog, and if I'd been involved in the discussion before, then I've forgotten about it. It absolutely makes sense to migrate to a common driver, and in that case we should keep the platform_data handling and dma_set_mask_and_coherent() call in there, so we can do the two conversions (migrating from platform specific frontends to the generic one, and migrating from platform_data to DT) on independent schedules. Eventually I'd like all of the existing users of the platform_data path to move to DT, but that should not hold up the other cleanup if it takes longer. There is however still my point that we shouldn't have an extra platform device that is not attached to the device node. I think the generic driver should just be part of the common code, without an extra framework. Something like the (entirely untested) patch below. Arnd --- diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index 9563cb56d564..a2b20c1342f1 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -207,6 +207,7 @@ struct ci_hdrc { boolid_event; boolb_sess_valid_event; boolimx28_write_fix; + struct clk *clk; }; static inline struct ci_role_driver *ci_role(struct ci_hdrc *ci) diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c index 6eae1de587f2..03ef35997dd8 100644 --- a/drivers/usb/chipidea/ci_hdrc_usb2.c +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c @@ -70,6 +70,7 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev) } if (dev->of_node) { + ret = ci_get_platdata(dev, platdata); ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata); if (ret) goto clk_err; diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 619d13e29995..32613751e731 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -478,6 +478,15 @@ static int ci_get_platdata(struct device *dev, if (of_usb_get_maximum_speed(dev->of_node) == USB_SPEED_FULL) platdata->flags |= CI_HDRC_FORCE_FULLSPEED; + platdata->phy = of_phy_get(dev->of_node, 0); + if (IS_ERR(platdata->phy)) { + if (PTR_ERR(platdata->phy) == -EPROBE_DEFER) + return -EPROBE_DEFER; + + /* PHY is optional */ + platdata->phy = NULL; + } + return 0; } @@ -559,6 +568,12 @@ static void ci_get_otg_capable(struct ci_hdrc *ci) dev_dbg(ci->dev, "It is OTG capable controller\n"); } +static const struct ci_hdrc_platform_data ci_default_pdata = { + .capoffset = DEF_CAPOFFSET, + .flags = CI_HDRC_REQUIRE_TRANSCEIVER | + CI_HDRC
Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
Hi, On Tue, Sep 23, 2014 at 07:37:25PM +0200, Arnd Bergmann wrote: > On Tuesday 23 September 2014 11:55:15 Felipe Balbi wrote: > > On Tue, Sep 23, 2014 at 06:44:40PM +0200, Arnd Bergmann wrote: > > > On Tuesday 23 September 2014 15:36:45 Antoine Tenart wrote: > > > > On Tue, Sep 23, 2014 at 12:39:04PM +0200, Arnd Bergmann wrote: > > > > > On Tuesday 23 September 2014 12:28:03 Antoine Tenart wrote: > > > > > > + if (dev->of_node) { > > > > > > + ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata); > > > > > > + if (ret) > > > > > > + goto clk_err; > > > > > > + } else { > > > > > > + ret = dma_set_mask_and_coherent(&pdev->dev, > > > > > > DMA_BIT_MASK(32)); > > > > > > + if (ret) > > > > > > + goto clk_err; > > > > > > + } > > > > > > > > > > > > > > > > Why do you care about the non-DT case here? I think it would be nicer > > > > > to > > > > > open-code the ci_hdrc_usb2_dt_probe() function in here and remove > > > > > the dma_set_mask_and_coherent(), which should not even be necessary > > > > > for > > > > > the case where you have a hardwired platform device. > > > > > > > > > > > > > I thought we agreed to call dma_set_mask_and_coherent(): > > > > http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/273335.html > > > > > > > > I do not have a strong opinion on this as I only use the dt case for my > > > > usage. > > > > > > The question is more about who actually wants the non-DT case. > > > > > > Since this is a new driver, I suspect that the answer is "nobody", > > > as the existing board files are all for legacy platforms that we > > > are not going to adapt for this driver. > > > > wait a minute... will the legacy platforms be adapted to DT and, thus, > > to this driver in the future ? I really don't want to keep several > > copies of chipidea driver just because there are still some legacy > > platforms still using them. I have said in the past and will say again, > > everybody should move to the generic chipidea driver at the earliest > > opportunity so we avoid duplication of work. > > > > Sorry, my mistake. The intention that this new driver is meant to > replace the existing ones wasn't clear to me from the changelog, and > if I'd been involved in the discussion before, then I've forgotten > about it. > > It absolutely makes sense to migrate to a common driver, and in that > case we should keep the platform_data handling and > dma_set_mask_and_coherent() call in there, so we can do the two > conversions (migrating from platform specific frontends to the generic > one, and migrating from platform_data to DT) on independent schedules. makes sense to me. > Eventually I'd like all of the existing users of the platform_data > path to move to DT, but that should not hold up the other cleanup if > it takes longer. yeah, certainly. > There is however still my point that we shouldn't have an extra > platform device that is not attached to the device node. I think the > generic driver should just be part of the common code, without an > extra framework. Something like the (entirely untested) patch below. yeah, that's what I did on dwc3 at least. We support platform_data and DT on the core driver. As for glue layers, we have ST, Qcom, PCI, OMAP, Exynos and Keystone. The only difference is that core dwc3 still doesn't know about clocks, but that's not an issue right now because we're not yet supporting pm_runtime. -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: core: downgrade log severity to info when descriptor missing
On Tue, 23 Sep 2014, Alan Stern wrote: > -ENODATA doesn't mean the string was unavailable. It means that the > second byte of the reply was different from USB_DT_STRING, i.e., the > reply was malformed. Thank you for the correction! > And down here is where you should call either dev_info() or dev_err(), > depending on whether err is equal to -EPIPE or something else. I hope to send it shortly. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] usb: core: downgrade log severity to info when descriptor unavailable
According to commit 0cce2eda19923e5e5ccc8b042dec5af87b3ffad0 USB: fix LANGID=0 regression usb devices are not required to report string descriptors. Since they are optional, log an info message instead of an error message. Signed-off-by: Scot Doyle --- drivers/usb/core/message.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 0c8a7fc..da2f1f2 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -780,8 +780,12 @@ static int usb_get_langid(struct usb_device *dev, unsigned char *tbuf) * deal with strings at all. Set string_langid to -1 in order to * prevent any string to be retrieved from the device */ if (err < 0) { - dev_err(&dev->dev, "string descriptor 0 read error: %d\n", - err); + if (err == -EPIPE) + dev_info(&dev->dev, +"string descriptor 0 read error: -EPIPE\n"); + else + dev_err(&dev->dev, + "string descriptor 0 read error: %d\n", err); dev->string_langid = -1; return -EPIPE; } -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
No USB3 / Asus P5B-VM, U3S6 and Transcend RDF-8 card reader
Hi, my RDF-8 card reader does not establish a super-speed connection when connected to an U3S6 USB3.0 port. It only manages high-speed: [0.894119] xhci_hcd :05:00.0: xHCI Host Controller [0.894126] xhci_hcd :05:00.0: new USB bus registered, assigned bus number 8 [0.894300] xhci_hcd :05:00.0: irq 48 for MSI/MSI-X [0.894306] xhci_hcd :05:00.0: irq 49 for MSI/MSI-X [0.894312] xhci_hcd :05:00.0: irq 50 for MSI/MSI-X [0.894317] xhci_hcd :05:00.0: irq 51 for MSI/MSI-X [0.894322] xhci_hcd :05:00.0: irq 52 for MSI/MSI-X [0.894440] usb usb8: New USB device found, idVendor=1d6b, idProduct=0002 [0.894443] usb usb8: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [0.894445] usb usb8: Product: xHCI Host Controller [0.894447] usb usb8: Manufacturer: Linux 3.13.0-27-generic xhci_hcd [0.894449] usb usb8: SerialNumber: :05:00.0 [0.894534] hub 8-0:1.0: USB hub found [0.894546] hub 8-0:1.0: 2 ports detected [0.894626] xhci_hcd :05:00.0: xHCI Host Controller [0.894630] xhci_hcd :05:00.0: new USB bus registered, assigned bus number 9 [0.897657] usb usb9: New USB device found, idVendor=1d6b, idProduct=0003 [0.897659] usb usb9: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [0.897661] usb usb9: Product: xHCI Host Controller [0.897663] usb usb9: Manufacturer: Linux 3.13.0-27-generic xhci_hcd [0.897665] usb usb9: SerialNumber: :05:00.0 [0.897750] hub 9-0:1.0: USB hub found [0.897764] hub 9-0:1.0: 2 ports detected [..] [1.920042] usb 8-2: new high-speed USB device number 2 using xhci_hcd [..] [1.941372] usb 8-2: New USB device found, idVendor=8564, idProduct=4000 [1.941375] usb 8-2: New USB device strings: Mfr=3, Product=4, SerialNumber=5 [1.941377] usb 8-2: Product: Transcend [1.941379] usb 8-2: Manufacturer: TS-RDF8 [1.941381] usb 8-2: SerialNumber: 00080 The NEC/Renesas USB controller chip on the U3S6 card was upgraded to F303408.MEM firmware. The RDF-8 reader reports TS-22 firmware. 05:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 03) I'm running a ubuntu trusty kernel 3.13.0-27-generic #50-Ubuntu SMP Thu May 15 18:06:16 UTC 2014 lspci && lsusb && lsusb -v && usb-devices: https://gist.github.com/anonymous/b73bc03ee5f7c1b33aaf So much for my cunning plan to easily get USB3 up and running on my aging linux machine by just plugging in some pci card :-) Any pointers? Regard, Daniel -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
USB3 WD drive failure on ASUS M5A 78L-M USB3
I'm running debian 7. Linux foobar 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux. I have a Passport drive which fails on the USB3 connector. It works fine on USB2. It also works fine as USB3 on my Lenovo laptop. The output of lspci -v & lsusb -v is at http://outtopastureenterprises.com/device.txt When I plug in the device to the USB3 port I get the following in /var/log/messages. If I wait long enough, eventually it seems to connect. This can take tens of minutes. I don't know what else to include. Any ideas greatly appreciated. Thanks. --Len Sep 23 17:49:22 foobar kernel: [23209.332493] usb 4-1: new SuperSpeed USB device number 4 using xhci_hcd Sep 23 17:49:22 foobar kernel: [23209.352862] usb 4-1: New USB device found, idVendor=1058, idProduct=0820 Sep 23 17:49:22 foobar kernel: [23209.352875] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=5 Sep 23 17:49:22 foobar kernel: [23209.352884] usb 4-1: Product: My Passport 0820 Sep 23 17:49:22 foobar kernel: [23209.352890] usb 4-1: Manufacturer: Western Digital Sep 23 17:49:22 foobar kernel: [23209.352897] usb 4-1: SerialNumber: 575835314142334434373334 Sep 23 17:49:22 foobar kernel: [23209.356231] scsi9 : usb-storage 4-1:1.0 Sep 23 17:49:22 foobar mtp-probe: checking bus 4, device 4: "/sys/devices/pci:00/:00:07.0/:02:00.0/usb4/4-1" Sep 23 17:49:22 foobar mtp-probe: bus: 4, device: 4 was not an MTP device Sep 23 17:49:23 foobar kernel: [23210.356893] scsi 9:0:0:0: Direct-Access WD My Passport 0820 1007 PQ: 0 ANSI: 6 Sep 23 17:49:23 foobar kernel: [23210.357131] scsi 9:0:0:1: Enclosure WD SES Device 1007 PQ: 0 ANSI: 6 Sep 23 17:49:23 foobar kernel: [23210.358448] sd 9:0:0:0: Attached scsi generic sg5 type 0 Sep 23 17:49:23 foobar kernel: [23210.358724] ses 9:0:0:1: Attached Enclosure device Sep 23 17:49:23 foobar kernel: [23210.358922] ses 9:0:0:1: Attached scsi generic sg6 type 13 Sep 23 17:49:54 foobar kernel: [23240.945357] usb 4-1: reset SuperSpeed USB device number 4 using xhci_hcd Sep 23 17:49:54 foobar kernel: [23240.962978] xhci_hcd :02:00.0: xHCI xhci_drop_endpoint called with disabled ep 8801f234f2c0 Sep 23 17:49:54 foobar kernel: [23240.962992] xhci_hcd :02:00.0: xHCI xhci_drop_endpoint called with disabled ep 8801f234f300 Sep 23 17:50:25 foobar kernel: [23271.953310] usb 4-1: reset SuperSpeed USB device number 4 using xhci_hcd Sep 23 17:50:25 foobar kernel: [23271.971070] xhci_hcd :02:00.0: xHCI xhci_drop_endpoint called with disabled ep 8801f234f2c0 Sep 23 17:50:25 foobar kernel: [23271.971085] xhci_hcd :02:00.0: xHCI xhci_drop_endpoint called with disabled ep 8801f234f300 Sep 23 17:50:25 foobar kernel: [23271.973226] sd 9:0:0:0: [sde] 1953458176 512-byte logical blocks: (1.00 TB/931 GiB) Sep 23 17:50:56 foobar kernel: [23302.993335] usb 4-1: reset SuperSpeed USB device number 4 using xhci_hcd Sep 23 17:50:56 foobar kernel: [23303.010894] xhci_hcd :02:00.0: xHCI xhci_drop_endpoint called with disabled ep 8801f234f2c0 Sep 23 17:50:56 foobar kernel: [23303.010909] xhci_hcd :02:00.0: xHCI xhci_drop_endpoint called with disabled ep 8801f234f300 Sep 23 17:51:27 foobar kernel: [2.973362] usb 4-1: reset SuperSpeed USB device number 4 using xhci_hcd Sep 23 17:51:27 foobar kernel: [2.990995] xhci_hcd :02:00.0: xHCI xhci_drop_endpoint called with disabled ep 8801f234f2c0 Sep 23 17:51:27 foobar kernel: [2.991009] xhci_hcd :02:00.0: xHCI xhci_drop_endpoint called with disabled ep 8801f234f300 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC PATCH] usb: core: log more general message on malformed LANGID descriptor
I'd like to change this error message: [3.325837] usb 1-4: string descriptor 0 malformed (err = -61), defaulting to 0x0409 into an error message followed by a debug message: [3.324726] usb 1-4: malformed string descriptor; unknown language, defaulting to English [3.327514] usb 1-4: string descriptor 0 malformed (err = -61), defaulting to 0x0409 in order to communicate more information from the log itself. Are there any problems with this approach? Would it be better to put all the information on a single line? Something else? --- diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 0c8a7fc..c29eb37 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -770,6 +770,8 @@ static int usb_get_langid(struct usb_device *dev, unsigned char *tbuf) dev->string_langid = 0x0409; dev->have_langid = 1; dev_err(&dev->dev, + "malformed string descriptor; unknown language, defaulting to English"); + dev_dbg(&dev->dev, "string descriptor 0 malformed (err = %d), " "defaulting to 0x%04x\n", err, dev->string_langid); -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
g_mass_storage bug ?
Hi Alan, Need your help looking over this detail here. When I run g_mass_storage with stall=0 everything works fine. As soon as I remove it, things go bonkers. Looking at the bulk-only spec, I see: "6.7.2 Hi - Host expects to receive data from the device [ ... ] The specific device requirements are: 1. The device shall receive a CBW. 2. When the CBW is valid and meaningful, then: . The device shall attempt the command. . [Case (6)] If the device intends to send dCBWDataTransferLength, then: The device shall send dCBWDataTransferLength bytes of data. The device shall set bCSWStatus to 00h or 01h. The device shall set dCSWDataResidue to zero. " Case (6) is when Hi == Di, looking at my logs, I have: 720 [ 286.843965] SCSI CDB: 1a 00 3f 00 c0 00 721 [ 286.844000] g_mass_storage gadget: SCSI command: MODE SENSE(6); Dc=6, Di=192; Hc=6, Hi=192 722 [ 286.844018] g_mass_storage gadget: bulk-in set halt 723 [ 286.844034] g_mass_storage gadget: sending command-failure status 724 [ 286.844045] g_mass_storage gadget: sense data: SK x06, ASC x29, ASCQ x00; info x0 Isn't it wrong to halt in this condition ? cheers -- balbi signature.asc Description: Digital signature
Re: [PATCH v6 07/12] usb: chipidea: add a usb2 driver for ci13xxx
On Tue, Sep 23, 2014 at 07:37:25PM +0200, Arnd Bergmann wrote: > On Tuesday 23 September 2014 11:55:15 Felipe Balbi wrote: > > On Tue, Sep 23, 2014 at 06:44:40PM +0200, Arnd Bergmann wrote: > > > On Tuesday 23 September 2014 15:36:45 Antoine Tenart wrote: > > > > On Tue, Sep 23, 2014 at 12:39:04PM +0200, Arnd Bergmann wrote: > > > > > On Tuesday 23 September 2014 12:28:03 Antoine Tenart wrote: > > > > > > + if (dev->of_node) { > > > > > > + ret = ci_hdrc_usb2_dt_probe(dev, ci_pdata); > > > > > > + if (ret) > > > > > > + goto clk_err; > > > > > > + } else { > > > > > > + ret = dma_set_mask_and_coherent(&pdev->dev, > > > > > > DMA_BIT_MASK(32)); > > > > > > + if (ret) > > > > > > + goto clk_err; > > > > > > + } > > > > > > > > > > > > > > > > Why do you care about the non-DT case here? I think it would be nicer > > > > > to > > > > > open-code the ci_hdrc_usb2_dt_probe() function in here and remove > > > > > the dma_set_mask_and_coherent(), which should not even be necessary > > > > > for > > > > > the case where you have a hardwired platform device. > > > > > > > > > > > > > I thought we agreed to call dma_set_mask_and_coherent(): > > > > http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/273335.html > > > > > > > > I do not have a strong opinion on this as I only use the dt case for my > > > > usage. > > > > > > The question is more about who actually wants the non-DT case. > > > > > > Since this is a new driver, I suspect that the answer is "nobody", > > > as the existing board files are all for legacy platforms that we > > > are not going to adapt for this driver. > > > > wait a minute... will the legacy platforms be adapted to DT and, thus, > > to this driver in the future ? I really don't want to keep several > > copies of chipidea driver just because there are still some legacy > > platforms still using them. I have said in the past and will say again, > > everybody should move to the generic chipidea driver at the earliest > > opportunity so we avoid duplication of work. > > > > Sorry, my mistake. The intention that this new driver is meant to > replace the existing ones wasn't clear to me from the changelog, > and if I'd been involved in the discussion before, then I've forgotten > about it. > > It absolutely makes sense to migrate to a common driver, and in that > case we should keep the platform_data handling and dma_set_mask_and_coherent() > call in there, so we can do the two conversions (migrating from platform > specific frontends to the generic one, and migrating from platform_data > to DT) on independent schedules. Eventually I'd like all of the existing > users of the platform_data path to move to DT, but that should not > hold up the other cleanup if it takes longer. > > There is however still my point that we shouldn't have an extra platform > device that is not attached to the device node. I think the generic driver > should just be part of the common code, without an extra framework. > Something like the (entirely untested) patch below. > > Arnd Thanks, Arnd. Antoine is adding a generic chipdea glue layer driver, which like ehci generic platform driver: drivers/usb/host/ehci-platform.c, since other architectures like MIPS (Someone submitted mips chipidea driver before) may not have device tree support, I think non-dt support is also needed. It is a good suggestion for adding DT support for core driver, Since we did not do it at the first, it is a little embarrass at current situation. - For the new chipidea glue drivers, it is ok we can have a child node for core device at glue device node, and some common entries can be there like: phy, vbus, dr_mode, etc. We need to add support for getting these common things for both through device tree and platform data (parent is DT support and parent is non-DT support) at core driver. - For the existing glue drivers, since we can't change existed dts, we can only do it from future SoC support. Then, in this kinds of glue drivers, we need to support for both create core driver by node and by current calling platform_device_add way. Peter > > --- > diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h > index 9563cb56d564..a2b20c1342f1 100644 > --- a/drivers/usb/chipidea/ci.h > +++ b/drivers/usb/chipidea/ci.h > @@ -207,6 +207,7 @@ struct ci_hdrc { > boolid_event; > boolb_sess_valid_event; > boolimx28_write_fix; > + struct clk *clk; > }; > > static inline struct ci_role_driver *ci_role(struct ci_hdrc *ci) > diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c > b/drivers/usb/chipidea/ci_hdrc_usb2.c > index 6eae1de587f2..03ef35997dd8 100644 > --- a/drivers/usb/chipidea/ci_hdrc_usb2.c > +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c > @@ -70,6 +70,7 @@ static i
Re: [PATCH v5 1/3] usb: gadget: Refactor request completion
Dear Felipe, On Wed, Sep 17 2014, Felipe Balbi wrote: > On Wed, Sep 17, 2014 at 09:21:11AM +0200, Michal Sojka wrote: >> All USB peripheral controller drivers called completion routines >> directly. This patch moves the completion call from drivers to >> usb_gadget_giveback_request(), in order to have a place where common >> functionality can be added. >> >> All places in drivers/usb/ matching "[-.]complete(" were replaced with a >> call to usb_gadget_giveback_request(). This was compile-tested with all >> ARM drivers enabled and runtime-tested for musb. >> >> Signed-off-by: Michal Sojka >> --- >> drivers/usb/chipidea/udc.c | 6 +++--- >> drivers/usb/dwc2/gadget.c | 6 +++--- >> drivers/usb/dwc3/gadget.c | 2 +- >> drivers/usb/gadget/udc/amd5536udc.c | 2 +- >> drivers/usb/gadget/udc/at91_udc.c | 2 +- >> drivers/usb/gadget/udc/atmel_usba_udc.c | 4 ++-- >> drivers/usb/gadget/udc/bcm63xx_udc.c| 2 +- >> drivers/usb/gadget/udc/dummy_hcd.c | 10 +- >> drivers/usb/gadget/udc/fotg210-udc.c| 2 +- >> drivers/usb/gadget/udc/fsl_qe_udc.c | 6 +- >> drivers/usb/gadget/udc/fsl_udc_core.c | 6 ++ >> drivers/usb/gadget/udc/fusb300_udc.c| 2 +- >> drivers/usb/gadget/udc/goku_udc.c | 2 +- >> drivers/usb/gadget/udc/gr_udc.c | 2 +- >> drivers/usb/gadget/udc/lpc32xx_udc.c| 2 +- >> drivers/usb/gadget/udc/m66592-udc.c | 2 +- >> drivers/usb/gadget/udc/mv_u3d_core.c| 8 ++-- >> drivers/usb/gadget/udc/mv_udc_core.c| 8 ++-- >> drivers/usb/gadget/udc/net2272.c| 2 +- >> drivers/usb/gadget/udc/net2280.c| 2 +- >> drivers/usb/gadget/udc/omap_udc.c | 2 +- >> drivers/usb/gadget/udc/pch_udc.c| 2 +- >> drivers/usb/gadget/udc/pxa25x_udc.c | 2 +- >> drivers/usb/gadget/udc/pxa27x_udc.c | 2 +- >> drivers/usb/gadget/udc/r8a66597-udc.c | 2 +- >> drivers/usb/gadget/udc/s3c-hsudc.c | 3 +-- >> drivers/usb/gadget/udc/s3c2410_udc.c| 2 +- >> drivers/usb/gadget/udc/udc-core.c | 19 +++ >> drivers/usb/musb/musb_gadget.c | 2 +- >> drivers/usb/renesas_usbhs/mod_gadget.c | 2 +- >> include/linux/usb/gadget.h | 8 > > I would rather split this into several patches, btw. With the > introduction of usb_gadget_giveback_request() being the first one in the > series. It's easier to review that way. This would be no problem. >> diff --git a/drivers/usb/gadget/udc/udc-core.c >> b/drivers/usb/gadget/udc/udc-core.c >> index b0d9817..29789f1 100644 >> --- a/drivers/usb/gadget/udc/udc-core.c >> +++ b/drivers/usb/gadget/udc/udc-core.c >> @@ -106,6 +106,25 @@ EXPORT_SYMBOL_GPL(usb_gadget_unmap_request); >> >> /* >> - */ >> >> +/** >> + * usb_gadget_giveback_request - give the request back to the gadget layer >> + * Context: in_interrupt() >> + * >> + * This is called by device controller drivers in order to return the >> + * completed request back to the gadget layer. >> + */ >> +void usb_gadget_giveback_request(struct usb_ep *ep, >> +struct usb_request *req) >> +{ >> +if (likely(req->complete)) >> +req->complete(ep, req); >> +else >> +pr_err("%s : req->complete must not be NULL\n", __func__); > > let it Oops. We require ->complete to be valid, if there's any gadget > driver not setting ->complete, it deserves to oops so we can the > error. The Oops was there before, but I removed it because greg k-h didn't want it. See http://marc.info/?l=linux-usb&m=140917381611947&w=2. Do you still want the oops here? -Michal -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] usb: gadget: f_rndis: fix usb_interface_descriptor for rndis
use the values for RNDIS over Ethernet as defined in http://www.usb.org/developers/defined_class (search for RDNIS): - baseclass: 0xef (miscellaneous) - subclass: 0x04 - protocol: 0x01 with this setings the file in Documentation/usb/linux.inf is obsolete. Signed-off-by: Heiko Schocher --- Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org Cc: linux-ker...@vger.kernel.org Cc: Oliver Neukum Cc: net...@vger.kernel.org Cc: linux-...@vger.kernel.org Cc: Andrzej Pietrasiewicz Cc: Michal Nazarewicz Cc: Kyungmin Park Cc: Dan Carpenter Cc: Macpaul Lin Tested with the "USB Compliance test suite which runs Windows", see: http://www.usb.org/developers/tools/usb20_tools/#usb20cv drivers/net/usb/cdc_ether.c | 6 +++--- drivers/usb/core/generic.c| 6 +++--- drivers/usb/gadget/function/f_rndis.c | 6 +++--- include/uapi/linux/usb/cdc.h | 3 +++ 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 2a32d91..9c216c2 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c @@ -35,9 +35,9 @@ static int is_rndis(struct usb_interface_descriptor *desc) { - return (desc->bInterfaceClass == USB_CLASS_COMM && - desc->bInterfaceSubClass == 2 && - desc->bInterfaceProtocol == 0xff); + return (desc->bInterfaceClass == USB_CLASS_MISC && + desc->bInterfaceSubClass == USB_CDC_SUBCLASS_RNDIS && + desc->bInterfaceProtocol == USB_CDC_RNDIS_PROTO_ETH); } static int is_activesync(struct usb_interface_descriptor *desc) diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c index 358ca8d..a2a4e05 100644 --- a/drivers/usb/core/generic.c +++ b/drivers/usb/core/generic.c @@ -28,9 +28,9 @@ static inline const char *plural(int n) static int is_rndis(struct usb_interface_descriptor *desc) { - return desc->bInterfaceClass == USB_CLASS_COMM - && desc->bInterfaceSubClass == 2 - && desc->bInterfaceProtocol == 0xff; + return desc->bInterfaceClass == USB_CLASS_MISC + && desc->bInterfaceSubClass == USB_CDC_SUBCLASS_RNDIS + && desc->bInterfaceProtocol == USB_CDC_RNDIS_PROTO_ETH; } static int is_activesync(struct usb_interface_descriptor *desc) diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c index ddb09dc..cc06046 100644 --- a/drivers/usb/gadget/function/f_rndis.c +++ b/drivers/usb/gadget/function/f_rndis.c @@ -117,9 +117,9 @@ static struct usb_interface_descriptor rndis_control_intf = { /* .bInterfaceNumber = DYNAMIC */ /* status endpoint is optional; this could be patched later */ .bNumEndpoints =1, - .bInterfaceClass = USB_CLASS_COMM, - .bInterfaceSubClass = USB_CDC_SUBCLASS_ACM, - .bInterfaceProtocol = USB_CDC_ACM_PROTO_VENDOR, + .bInterfaceClass = USB_CLASS_MISC, + .bInterfaceSubClass = USB_CDC_SUBCLASS_RNDIS, + .bInterfaceProtocol = USB_CDC_RNDIS_PROTO_ETH, /* .iInterface = DYNAMIC */ }; diff --git a/include/uapi/linux/usb/cdc.h b/include/uapi/linux/usb/cdc.h index b6a9cdd..8e8fc85 100644 --- a/include/uapi/linux/usb/cdc.h +++ b/include/uapi/linux/usb/cdc.h @@ -12,6 +12,7 @@ #include #define USB_CDC_SUBCLASS_ACM 0x02 +#define USB_CDC_SUBCLASS_RNDIS 0x04 #define USB_CDC_SUBCLASS_ETHERNET 0x06 #define USB_CDC_SUBCLASS_WHCM 0x08 #define USB_CDC_SUBCLASS_DMM 0x09 @@ -31,6 +32,8 @@ #define USB_CDC_ACM_PROTO_AT_CDMA 6 #define USB_CDC_ACM_PROTO_VENDOR 0xff +#define USB_CDC_RNDIS_PROTO_ETH1 + #define USB_CDC_PROTO_EEM 7 #define USB_CDC_NCM_PROTO_NTB 1 -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html