Re: usb/188683: dwc_otg FDT support for specifying usb controller mode

2014-04-16 Thread John Wehle
The following reply was made to PR usb/188683; it has been noted by GNATS.

From: John Wehle 
To: i...@freebsd.org
Cc: freebsd-gnats-sub...@freebsd.org
Subject: Re: usb/188683: dwc_otg FDT support for specifying usb controller mode
Date: Thu, 17 Apr 2014 00:27:49 -0400 (EDT)

 > - dr_mode: tells Dual-Role USB controllers that we want to work on a
 > particular mode. Valid arguments are "host", "peripheral" and "otg". In
 > case this attribute isn't passed via DT, USB DRD controllers should
 > default to OTG.
 
 Patch revised per your comments attached below.
 
 -- John
 8<8<-
 Index: sys/dev/usb/controller/dwc_otg_fdt.c
 ===
 --- sys/dev/usb/controller/dwc_otg_fdt.c   (revision 264251)
 +++ sys/dev/usb/controller/dwc_otg_fdt.c   (working copy)
 @@ -91,9 +91,27 @@
  dwc_otg_attach(device_t dev)
  {
struct dwc_otg_super_softc *sc = device_get_softc(dev);
 +  pcell_t *prop;
 +  phandle_t node;
 +  ssize_t len;
int err;
int rid;
  
 +  node = ofw_bus_get_node(dev);
 +  len = OF_getprop_alloc(node, "dr_mode", sizeof(char), (void **)&prop);
 +  if (len >= 0) {
 +  if (strcmp((char *)prop, "host") == 0)
 +  sc->sc_otg.sc_mode = DWC_MODE_HOST;
 +  else if (strcmp((char *)prop, "peripheral") == 0)
 +  sc->sc_otg.sc_mode = DWC_MODE_DEVICE;
 +  else if (strcmp((char *)prop, "otg") == 0)
 +  ;
 +  else
 +  device_printf(dev,
 +"ignoring unknown value for dr_mode attribute in 
FDT\n");
 +  }
 +  free(prop, M_OFWPROP);
 +
/* initialise some bus fields */
sc->sc_otg.sc_bus.parent = dev;
sc->sc_otg.sc_bus.devices = sc->sc_otg.sc_devices;
 Index: sys/dev/usb/controller/dwc_otg.c
 ===
 --- sys/dev/usb/controller/dwc_otg.c   (revision 264251)
 +++ sys/dev/usb/controller/dwc_otg.c   (working copy)
 @@ -2332,7 +2332,7 @@
  
DPRINTFN(5, "GOTGCTL=0x%08x\n", temp);
  
 -  dwc_otg_vbus_interrupt(sc,
 +  dwc_otg_vbus_interrupt(sc, (sc->sc_mode == DWC_MODE_HOST) ? 1 :
(temp & (GOTGCTL_ASESVLD | GOTGCTL_BSESVLD)) ? 1 : 0);
}
  
 @@ -3182,7 +3182,7 @@
sc->sc_host_ch_max);
  
/* setup FIFO */
 -  if (dwc_otg_init_fifo(sc, DWC_MODE_OTG))
 +  if (dwc_otg_init_fifo(sc, sc->sc_mode))
return (EINVAL);
  
/* enable interrupts */
 @@ -3233,7 +3233,7 @@
  
DPRINTFN(5, "GOTCTL=0x%08x\n", temp);
  
 -  dwc_otg_vbus_interrupt(sc,
 +  dwc_otg_vbus_interrupt(sc, (sc->sc_mode == DWC_MODE_HOST) ? 1 :
(temp & (GOTGCTL_ASESVLD | GOTGCTL_BSESVLD)) ? 1 : 0);
  
USB_BUS_UNLOCK(&sc->sc_bus);
 -
 |   Feith Systems  |   Voice: 1-215-646-8000  |  Email: j...@feith.com  |
 |John Wehle| Fax: 1-215-540-5495  | |
 -
 
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: usb/172931: [ums] Suspend/resume blocks USB mouse

2014-04-16 Thread linimon
Old Synopsis: Suspen/resume blocks USB mouse
New Synopsis: [ums] Suspend/resume blocks USB mouse

Responsible-Changed-From-To: freebsd-bugs->freebsd-usb
Responsible-Changed-By: linimon
Responsible-Changed-When: Thu Apr 17 04:29:10 UTC 2014
Responsible-Changed-Why: 
reclassify.

http://www.freebsd.org/cgi/query-pr.cgi?pr=172931
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: usb/174814: [PATCH] support for MiFi 2200

2014-04-16 Thread linimon
Synopsis: [PATCH] support for MiFi 2200

State-Changed-From-To: open->closed
State-Changed-By: linimon
State-Changed-When: Thu Apr 17 04:23:03 UTC 2014
State-Changed-Why: 
committer over a year ago.


Responsible-Changed-From-To: freebsd-usb->hselasky
Responsible-Changed-By: linimon
Responsible-Changed-When: Thu Apr 17 04:23:03 UTC 2014
Responsible-Changed-Why: 

http://www.freebsd.org/cgi/query-pr.cgi?pr=174814
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: usb/175893: [uftdi] [patch] kernel/usb/uftdi patch to recognise a KT-LINK ft2232 based device

2014-04-16 Thread linimon
Old Synopsis: kernel/usb/uftdi patch to recognise a KT-LINK ft2232 based device
New Synopsis: [uftdi] [patch] kernel/usb/uftdi patch to recognise a KT-LINK 
ft2232 based device

Responsible-Changed-From-To: freebsd-bugs->freebsd-usb
Responsible-Changed-By: linimon
Responsible-Changed-When: Thu Apr 17 04:14:48 UTC 2014
Responsible-Changed-Why: 
reclassify.

http://www.freebsd.org/cgi/query-pr.cgi?pr=175893
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: usb/188683: dwc_otg FDT support for specifying usb controller mode

2014-04-16 Thread Ian Lepore
The following reply was made to PR usb/188683; it has been noted by GNATS.

From: Ian Lepore 
To: John Wehle 
Cc: freebsd-gnats-sub...@freebsd.org
Subject: Re: usb/188683: dwc_otg FDT support for specifying usb controller
 mode
Date: Wed, 16 Apr 2014 07:09:26 -0600

 On Wed, 2014-04-16 at 07:17 +, John Wehle wrote:
 > >Number: 188683
 > >Category:   usb
 > >Synopsis:   dwc_otg FDT support for specifying usb controller mode
 > >Confidential:   no
 > >Severity:   non-critical
 > >Priority:   low
 > >Responsible:freebsd-usb
 > >State:  open
 > >Quarter:
 > >Keywords:   
 > >Date-Required:
 > >Class:  sw-bug
 > >Submitter-Id:   current-users
 > >Arrival-Date:   Wed Apr 16 07:20:01 UTC 2014
 > >Closed-Date:
 > >Last-Modified:
 > >Originator: John Wehle
 > >Release:11 r264251
 > >Organization:
 > Personal
 > >Environment:
 > Not Yet
 > >Description:
 > In my spare time I'm working on bringing FreeBSD up on amlogic based
 > arm processors.  The amlogic SoC contains a dwc USB controller.
 > If I enable the controller on a Visson ATV-102 box (mine appears
 > to be based on the aml8726-m6 SoC) which uses a GL850G usb hub chip
 > the driver fails to detect GOTGCTL_ASESVLD so it doesn't work.
 > 
 > The attached patch allows the mode to be specifed in the FDT ...
 > if the mode is set to host, then the driver doesn't looks for
 > GOTGCTL_ASESVLD ... it assumes VBUS is driven.  This suffices for
 > basic USB functionality on the Visson ATV-102.
 > 
 > >How-To-Repeat:
 > Build FreeBSD 11 for the Visson ATV-102 (this requires code for the
 > amlogic platform which I'll be supplying in the future) and attempt
 > to use USB.
 > >Fix:
 > Apply the patch to optionally specify the controller mode and added
 > 
 >   mode = "host";
 > 
 > to the usb block in vsatv102-m6.dts.
 > 
 > Patch attached with submission follows:
 > 
 > Index: sys/dev/usb/controller/dwc_otg_fdt.c
 > ===
 > --- sys/dev/usb/controller/dwc_otg_fdt.c (revision 264251)
 > +++ sys/dev/usb/controller/dwc_otg_fdt.c (working copy)
 > @@ -91,9 +91,27 @@
 >  dwc_otg_attach(device_t dev)
 >  {
 >  struct dwc_otg_super_softc *sc = device_get_softc(dev);
 > +pcell_t *prop;
 > +phandle_t node;
 > +ssize_t len;
 >  int err;
 >  int rid;
 >  
 > +node = ofw_bus_get_node(dev);
 > +len = OF_getprop_alloc(node, "mode", sizeof(char), (void **)&prop);
 > +if (len >= 0) {
 > +if (strcmp((char *)prop, "host") == 0)
 > +sc->sc_otg.sc_mode = DWC_MODE_HOST;
 > +else if (strcmp((char *)prop, "device") == 0)
 > +sc->sc_otg.sc_mode = DWC_MODE_DEVICE;
 > +else if (strcmp((char *)prop, "otg") == 0)
 > +;
 > +else
 > +device_printf(dev,
 > +  "ignoring unknown value for mode attribute in FDT\n");
 > +}
 > +free(prop, M_OFWPROP);
 > +
 >  /* initialise some bus fields */
 >  sc->sc_otg.sc_bus.parent = dev;
 >  sc->sc_otg.sc_bus.devices = sc->sc_otg.sc_devices;
 > Index: sys/dev/usb/controller/dwc_otg.c
 > ===
 > --- sys/dev/usb/controller/dwc_otg.c (revision 264251)
 > +++ sys/dev/usb/controller/dwc_otg.c (working copy)
 > @@ -2332,7 +2332,7 @@
 >  
 >  DPRINTFN(5, "GOTGCTL=0x%08x\n", temp);
 >  
 > -dwc_otg_vbus_interrupt(sc,
 > +dwc_otg_vbus_interrupt(sc, (sc->sc_mode == DWC_MODE_HOST) ? 1 :
 >  (temp & (GOTGCTL_ASESVLD | GOTGCTL_BSESVLD)) ? 1 : 0);
 >  }
 >  
 > @@ -3182,7 +3182,7 @@
 >  sc->sc_host_ch_max);
 >  
 >  /* setup FIFO */
 > -if (dwc_otg_init_fifo(sc, DWC_MODE_OTG))
 > +if (dwc_otg_init_fifo(sc, sc->sc_mode))
 >  return (EINVAL);
 >  
 >  /* enable interrupts */
 > @@ -3233,7 +3233,7 @@
 >  
 >  DPRINTFN(5, "GOTCTL=0x%08x\n", temp);
 >  
 > -dwc_otg_vbus_interrupt(sc,
 > +dwc_otg_vbus_interrupt(sc, (sc->sc_mode == DWC_MODE_HOST) ? 1 :
 >  (temp & (GOTGCTL_ASESVLD | GOTGCTL_BSESVLD)) ? 1 : 0);
 >  
 >  USB_BUS_UNLOCK(&sc->sc_bus);
 > 
 > 
 > >Release-Note:
 > >Audit-Trail:
 > >Unformatted:
 
 The DeviceTree docs indicate there's a standard property name and values
 for this:
 
  - dr_mode: tells Dual-Role USB controllers that we want to work on a
 particular mode. Valid arguments are "host", "peripheral" and "otg". In
 case this attribute isn't passed via DT, USB DRD controllers should
 default to OTG.
 
 -- Ian
 
 
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


usb/188683: dwc_otg FDT support for specifying usb controller mode

2014-04-16 Thread John Wehle

>Number: 188683
>Category:   usb
>Synopsis:   dwc_otg FDT support for specifying usb controller mode
>Confidential:   no
>Severity:   non-critical
>Priority:   low
>Responsible:freebsd-usb
>State:  open
>Quarter:
>Keywords:   
>Date-Required:
>Class:  sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 16 07:20:01 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator: John Wehle
>Release:11 r264251
>Organization:
Personal
>Environment:
Not Yet
>Description:
In my spare time I'm working on bringing FreeBSD up on amlogic based
arm processors.  The amlogic SoC contains a dwc USB controller.
If I enable the controller on a Visson ATV-102 box (mine appears
to be based on the aml8726-m6 SoC) which uses a GL850G usb hub chip
the driver fails to detect GOTGCTL_ASESVLD so it doesn't work.

The attached patch allows the mode to be specifed in the FDT ...
if the mode is set to host, then the driver doesn't looks for
GOTGCTL_ASESVLD ... it assumes VBUS is driven.  This suffices for
basic USB functionality on the Visson ATV-102.

>How-To-Repeat:
Build FreeBSD 11 for the Visson ATV-102 (this requires code for the
amlogic platform which I'll be supplying in the future) and attempt
to use USB.
>Fix:
Apply the patch to optionally specify the controller mode and added

  mode = "host";

to the usb block in vsatv102-m6.dts.

Patch attached with submission follows:

Index: sys/dev/usb/controller/dwc_otg_fdt.c
===
--- sys/dev/usb/controller/dwc_otg_fdt.c(revision 264251)
+++ sys/dev/usb/controller/dwc_otg_fdt.c(working copy)
@@ -91,9 +91,27 @@
 dwc_otg_attach(device_t dev)
 {
struct dwc_otg_super_softc *sc = device_get_softc(dev);
+   pcell_t *prop;
+   phandle_t node;
+   ssize_t len;
int err;
int rid;
 
+   node = ofw_bus_get_node(dev);
+   len = OF_getprop_alloc(node, "mode", sizeof(char), (void **)&prop);
+   if (len >= 0) {
+   if (strcmp((char *)prop, "host") == 0)
+   sc->sc_otg.sc_mode = DWC_MODE_HOST;
+   else if (strcmp((char *)prop, "device") == 0)
+   sc->sc_otg.sc_mode = DWC_MODE_DEVICE;
+   else if (strcmp((char *)prop, "otg") == 0)
+   ;
+   else
+   device_printf(dev,
+ "ignoring unknown value for mode attribute in FDT\n");
+   }
+   free(prop, M_OFWPROP);
+
/* initialise some bus fields */
sc->sc_otg.sc_bus.parent = dev;
sc->sc_otg.sc_bus.devices = sc->sc_otg.sc_devices;
Index: sys/dev/usb/controller/dwc_otg.c
===
--- sys/dev/usb/controller/dwc_otg.c(revision 264251)
+++ sys/dev/usb/controller/dwc_otg.c(working copy)
@@ -2332,7 +2332,7 @@
 
DPRINTFN(5, "GOTGCTL=0x%08x\n", temp);
 
-   dwc_otg_vbus_interrupt(sc,
+   dwc_otg_vbus_interrupt(sc, (sc->sc_mode == DWC_MODE_HOST) ? 1 :
(temp & (GOTGCTL_ASESVLD | GOTGCTL_BSESVLD)) ? 1 : 0);
}
 
@@ -3182,7 +3182,7 @@
sc->sc_host_ch_max);
 
/* setup FIFO */
-   if (dwc_otg_init_fifo(sc, DWC_MODE_OTG))
+   if (dwc_otg_init_fifo(sc, sc->sc_mode))
return (EINVAL);
 
/* enable interrupts */
@@ -3233,7 +3233,7 @@
 
DPRINTFN(5, "GOTCTL=0x%08x\n", temp);
 
-   dwc_otg_vbus_interrupt(sc,
+   dwc_otg_vbus_interrupt(sc, (sc->sc_mode == DWC_MODE_HOST) ? 1 :
(temp & (GOTGCTL_ASESVLD | GOTGCTL_BSESVLD)) ? 1 : 0);
 
USB_BUS_UNLOCK(&sc->sc_bus);


>Release-Note:
>Audit-Trail:
>Unformatted:
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"