Re: [PATCH] Allow MUSB DSPS to use force host mode

2013-11-22 Thread Michael Grzeschik
Hallo,

On Fri, Nov 22, 2013 at 03:55:59PM +, Mark Jackson wrote:
 The IDDIG input pin is normally used to determine the USB mode
 (i.e. HOST or DEVICE).
 
 On some systems (e.g. AM335x) leaving this pin floating allows
 the USB mode to be set via software.
 
 This patch adds support for this via the device tree.
 
 Signed-off-by: Mark Jackson m...@newflow.co.uk
 ---
  .../devicetree/bindings/usb/am33xx-usb.txt |2 ++
  drivers/usb/musb/musb_dsps.c   |   14 ++
  include/linux/usb/musb.h   |1 +
  3 files changed, 17 insertions(+)
 
 diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt 
 b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
 index 20c2ff2..560b7ff 100644
 --- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt
 +++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
 @@ -47,6 +47,8 @@ USB
  - dmas: specifies the dma channels
  - dma-names: specifies the names of the channels. Use rxN for receive
and txN for transmit endpoints. N specifies the endpoint number.
 +- ti,force-host: specifies that the IDDIG input be ignored and the device be
 +  put into host mode regardless.

You should always CC devicetree-discuss if adding new bindings. Why
another binding anyway? We have the common binding dr_mode already.
Please use this and of_usb_get_dr_mode from drivers/usb/usb-common.c
instead.

Thanks,
Michael
-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap 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: dwc3: core: continue probe even if usb3 phy is not available

2013-06-28 Thread Michael Grzeschik
On Fri, Jun 28, 2013 at 09:00:00PM +0300, Felipe Balbi wrote:
 Hi,
 
 On Thu, Jun 27, 2013 at 10:30:33AM +0300, Felipe Balbi wrote:
  Hi,
  
  On Thu, Jun 27, 2013 at 09:24:08AM +0200, Michael Grzeschik wrote:
   right, but in DT you will define both instances and each instance 
   will
   have a seaparate snps,maximum_speed attribute :-)
  
   I'm now considering if we should make maximum_speed a generic 
   attribute,
   Kishon ? Alex ? Alan ?
  
   anyone else needs such thing ?
  
  We have a force-full-speed attibute for chipidea on the way. This
  maximum_speed looks like a more generic alternative. Michael, what 
  say
  you?
 
 The maximum_speed attribute sounds more reasonable. I will change my
 patch to it.

thanks, perhaps we can add a generic helper in udc-core or usb-common ?
   
   As this function is not only udc specific, this should go into usb-common.
   But right, we should go with a helper here. I will write one in addition
   to my full-speed patch as first user of it.
  
  alright, thanks :-)
 
 Michael, if you need any help with patching in maximum_speed attribute,
 let me know as I have some time to work on that part.

Feel free to begin with anything. I am currently short on time.
Do you need some pointers?

Thanks,
Michael

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap 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: dwc3: core: continue probe even if usb3 phy is not available

2013-06-27 Thread Michael Grzeschik
On Wed, Jun 26, 2013 at 03:46:45PM +0300, Alexander Shishkin wrote:
 Felipe Balbi ba...@ti.com writes:
 
  On Wed, Jun 26, 2013 at 05:37:19PM +0530, George Cherian wrote:
  On 6/26/2013 3:46 PM, Felipe Balbi wrote:
  Hi,
  
  On Wed, Jun 26, 2013 at 02:59:14PM +0530, George Cherian wrote:
  There can be configurations in which DWC3 is hoooked up only to USB2 PHY.
  In such cases we should not return -EPROBE_DEFER, rather continue probe
  even if there is no USB3 PHY.
  
  Signed-off-by: George Cherian george.cher...@ti.com
  ---
drivers/usb/dwc3/core.c | 31 ---
1 file changed, 24 insertions(+), 7 deletions(-)
  
  diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
  index c35d49d..d5e6f3e 100644
  --- a/drivers/usb/dwc3/core.c
  +++ b/drivers/usb/dwc3/core.c
  @@ -100,7 +100,9 @@ static void dwc3_core_soft_reset(struct dwc3 *dwc)
   dwc3_writel(dwc-regs, DWC3_GUSB2PHYCFG(0), reg);
   usb_phy_init(dwc-usb2_phy);
  -usb_phy_init(dwc-usb3_phy);
  +
  +if (dwc-usb3_phy)
  +usb_phy_init(dwc-usb3_phy);
  I would feel more comfortable if you would move our maximum_speed module
  parameter to DT with a property such as:
  
  snps,maximum_speed = highspeed;
  
  then on driver you could:
  okay
  ret = of_property_read_string(np, snps,maximum_speed, maximum_speed);
  if (ret  0)
bailout();
  
  if (strncmp(maximum_speed, superspeed, 10) == 0) {
/* grab USB3 PHY, return EPROBE_DEFER if not found */
grab_usb3_phy();
  }
  
  if ((strncmp(maximum_speed, highspeed, 9) == 0) ||
(strncmp(maximum_speed, fullspeed, 9) == 0) ||
(strncmp(maximum_speed, lowspeed, 8) == 0)) {
/* grab USB2 PHY, return EPROBE_DEFER if not found */
grab_usb2_phy();
  }
  
  this way, we depend solely on setting maximum_speed to highspeed for
  AM437x :-)
  In dra7xx one instance is superspeed and one instance highspeed.
 
  right, but in DT you will define both instances and each instance will
  have a seaparate snps,maximum_speed attribute :-)
 
  I'm now considering if we should make maximum_speed a generic attribute,
  Kishon ? Alex ? Alan ?
 
  anyone else needs such thing ?
 
 We have a force-full-speed attibute for chipidea on the way. This
 maximum_speed looks like a more generic alternative. Michael, what say
 you?

The maximum_speed attribute sounds more reasonable. I will change my
patch to it.

Regards,
Michael

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap 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: dwc3: core: continue probe even if usb3 phy is not available

2013-06-27 Thread Michael Grzeschik
Hi,

On Thu, Jun 27, 2013 at 09:35:26AM +0300, Felipe Balbi wrote:
 Hi,
 
 On Thu, Jun 27, 2013 at 08:14:16AM +0200, Michael Grzeschik wrote:
right, but in DT you will define both instances and each instance will
have a seaparate snps,maximum_speed attribute :-)
   
I'm now considering if we should make maximum_speed a generic attribute,
Kishon ? Alex ? Alan ?
   
anyone else needs such thing ?
   
   We have a force-full-speed attibute for chipidea on the way. This
   maximum_speed looks like a more generic alternative. Michael, what say
   you?
  
  The maximum_speed attribute sounds more reasonable. I will change my
  patch to it.
 
 thanks, perhaps we can add a generic helper in udc-core or usb-common ?

As this function is not only udc specific, this should go into usb-common.
But right, we should go with a helper here. I will write one in addition
to my full-speed patch as first user of it.

Thanks,
Michael

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap 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: dwc3: Addition of dr_mode dt property.

2013-06-03 Thread Michael Grzeschik
Hi Felipe,

On Thu, May 30, 2013 at 03:31:21PM -0500, Ruchika Kharwar wrote:
 This patch adds an optional parameter dr_mode to the dwc3 core device node.
 In the case the compile flag for the DWC3 controller is set to
 USB_DWC3_DUAL_ROLE a device tree could restrain to either functionality of
 host or gadget. In the case the device tree does not use this optional flag or
 specifies it superfluously to drd the functionality will be that
 of a dual role device.
 
 Signed-off-by: Ruchika Kharwar ruch...@ti.com
 ---
  Documentation/devicetree/bindings/usb/dwc3.txt |3 ++-
  drivers/usb/dwc3/core.c|   20 +---
  2 files changed, 19 insertions(+), 4 deletions(-)
 
 diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt 
 b/Documentation/devicetree/bindings/usb/dwc3.txt
 index 7a95c65..2f5d584 100644
 --- a/Documentation/devicetree/bindings/usb/dwc3.txt
 +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
 @@ -10,7 +10,8 @@ Required properties:
  
  Optional properties:
   - tx-fifo-resize: determines if the FIFO *has* to be reallocated.
 -
 + - dr_mode: determines the mode of core. Supported modes are gadget, host
 +   and drd.
  This is usually a subnode to DWC3 glue to which it is connected.
  
  dwc3@4a03 {
 diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
 index c35d49d..05c0c8b 100644
 --- a/drivers/usb/dwc3/core.c
 +++ b/drivers/usb/dwc3/core.c
 @@ -378,6 +378,7 @@ static int dwc3_probe(struct platform_device *pdev)
   void*mem;
  
   u8  mode;
 + char*dr_mode;
  
   mem = devm_kzalloc(dev, sizeof(*dwc) + DWC3_ALIGN_MASK, GFP_KERNEL);
   if (!mem) {
 @@ -520,9 +521,22 @@ static int dwc3_probe(struct platform_device *pdev)
   mode = DWC3_MODE_HOST;
   else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET))
   mode = DWC3_MODE_DEVICE;
 - else
 - mode = DWC3_MODE_DRD;
 -
 + else {
 + if (of_property_read_string(node, dr_mode, dr_mode))
 + mode = DWC3_MODE_DRD;
 + else {
 + if (strcmp(dr_mode, host) == 0)
 + mode = DWC3_MODE_HOST;
 + else if (strcmp(dr_mode, gadget) == 0)
 + mode = DWC3_MODE_DEVICE;
 + else if (strcmp(dr_mode, drd) == 0)
 + mode = DWC3_MODE_DRD;
 + else {
 + dev_err(dev, invalid dr_mode property 
 value\n);
 + goto err2;
 + }
 + }
 + }
   switch (mode) {
   case DWC3_MODE_DEVICE:
   dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
 -- 
 1.7.5.4

this is more likely to be solved with a common property description for
the gadget layer. We have some prepared parts in the latest patch series:

[PATCH 1/7] USB: add devicetree helpers for determining dr_mode and phy_type
http://www.spinics.net/lists/linux-usb/msg86829.html

What do you think?

Thanks,
Michael

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap 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: dwc3: Addition of dr_mode dt property.

2013-05-31 Thread Michael Grzeschik
Hi,

On Thu, May 30, 2013 at 03:14:54PM -0500, Ruchika Kharwar wrote:
 This patch adds an optional parameter dr_mode to the dwc3 core device node.
 In the case the compile flag for the DWC3 controller is set to
 USB_DWC3_DUAL_ROLE a device tree could restrain to either functionality of
 host or gadget. In the case the device tree does not use this optional flag or
 specifies it superfluously to drd the functionality will be that
 of a dual role device.
 
 Signed-off-by: Ruchika Kharwar ruch...@ti.com
 ---
  Documentation/devicetree/bindings/usb/dwc3.txt |3 ++-
  drivers/usb/dwc3/core.c|   21 +
  2 files changed, 19 insertions(+), 5 deletions(-)
 
 diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt 
 b/Documentation/devicetree/bindings/usb/dwc3.txt
 index 7a95c65..2f5d584 100644
 --- a/Documentation/devicetree/bindings/usb/dwc3.txt
 +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
 @@ -10,7 +10,8 @@ Required properties:
  
  Optional properties:
   - tx-fifo-resize: determines if the FIFO *has* to be reallocated.
 -
 + - dr_mode: determines the mode of core. Supported modes are gadget, host
 +   and drd.
  This is usually a subnode to DWC3 glue to which it is connected.
  
  dwc3@4a03 {
 diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
 index c35d49d..e11660a 100644
 --- a/drivers/usb/dwc3/core.c
 +++ b/drivers/usb/dwc3/core.c
 @@ -378,7 +378,7 @@ static int dwc3_probe(struct platform_device *pdev)
   void*mem;
  
   u8  mode;
 -
 + char*dr_mode;
   mem = devm_kzalloc(dev, sizeof(*dwc) + DWC3_ALIGN_MASK, GFP_KERNEL);
   if (!mem) {
   dev_err(dev, not enough memory\n);
 @@ -520,9 +520,22 @@ static int dwc3_probe(struct platform_device *pdev)
   mode = DWC3_MODE_HOST;
   else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET))
   mode = DWC3_MODE_DEVICE;
 - else
 - mode = DWC3_MODE_DRD;
 -
 + else {
 + if (of_property_read_string(node, dr_mode, dr_mode))
 + mode = DWC3_MODE_DRD;
 + else {
 + if (strcmp(dr_mode, host) == 0)
 + mode = DWC3_MODE_HOST;
 + else if (strcmp(dr_mode, gadget) == 0)
 + mode = DWC3_MODE_DEVICE;
 + else if (strcmp(dr_mode, drd) == 0)
 + mode = DWC3_MODE_DRD;
 + else {
 + dev_err(dev, invalid dr_mode property 
 value\n);
 + goto err2;
 + }
 + }
 + }
   switch (mode) {
   case DWC3_MODE_DEVICE:
   dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
 -- 

Why not help to make use of that code?

https://patchwork.kernel.org/patch/2193321/

We currently stuck in the discussion about all possible dr_mode
properties. There came up a device that is host and device capable,
but not otg.

What does the property drd stand for?

Thanks,
Michael

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] usb: otg: nop: add dt support

2013-01-27 Thread Michael Grzeschik
Hi,

On Thu, Sep 27, 2012 at 11:15:05AM +0530, Afzal Mohammed wrote:
 From: B, Ravi ravib...@ti.com
 
 Added device tree support for nop transceiver driver and updated the
 Documentation with device tree binding information for am33xx platform.
 
 Signed-off-by: Ravi Babu ravib...@ti.com
 Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
 Signed-off-by: Afzal Mohammed af...@ti.com
 ---
 
 Hi,
 
 This series is made over over Balbi's usb master branch.
 
 It applies cleanly over musb branch too.
 
 Regards
 Afzal
 
  Documentation/devicetree/bindings/usb/am33xx-usb.txt |  3 +++
  drivers/usb/otg/nop-usb-xceiv.c  | 10 ++
  2 files changed, 13 insertions(+)
 
 diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt 
 b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
 index ca8fa56..9782585 100644
 --- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt
 +++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
 @@ -12,3 +12,6 @@ AM33XX MUSB GLUE
 represents PERIPHERAL.
   - power : Should be 250. This signifies the controller can supply upto
 500mA when operating in host mode.
 +
 +NOP USB PHY
 + - compatible : Should be nop-xceiv-usb
 diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
 index e52e35e..64bfbe4 100644
 --- a/drivers/usb/otg/nop-usb-xceiv.c
 +++ b/drivers/usb/otg/nop-usb-xceiv.c
 @@ -27,6 +27,7 @@
   */
  
  #include linux/module.h
 +#include linux/of.h
  #include linux/platform_device.h
  #include linux/dma-mapping.h
  #include linux/usb/otg.h
 @@ -154,12 +155,21 @@ static int __devexit nop_usb_xceiv_remove(struct 
 platform_device *pdev)
   return 0;
  }
  
 +#ifdef CONFIG_OF
 +static const struct of_device_id nop_xceiv_id_table[] = {
 + { .compatible = nop-xceiv-usb },
 + {},
 +};
 +MODULE_DEVICE_TABLE(of, nop_xceiv_id_table);
 +#endif
 +
  static struct platform_driver nop_usb_xceiv_driver = {
   .probe  = nop_usb_xceiv_probe,
   .remove = __devexit_p(nop_usb_xceiv_remove),
   .driver = {
   .name   = nop_usb_xceiv,
   .owner  = THIS_MODULE,
 + .of_match_table = of_match_ptr(nop_xceiv_id_table),
   },
  };
  
 -- 
 1.7.12
 
 --
 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
 

What happend to that patch? It did not show up in any new series. Is it
queued anywhere?

Regards,
Michael

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html