Re: [PATCH 1/2] usb: musb: use DMA mode 1 whenever possible

2012-10-23 Thread ABRAHAM, KISHON VIJAY
Hi,

On Wed, Aug 8, 2012 at 11:28 AM, Rajaram R rajaram.officem...@gmail.com wrote:
 On Tue, Aug 7, 2012 at 6:39 PM, Roger Quadros rog...@ti.com wrote:
 Do not rely on any hints from gadget drivers and use DMA mode 1
 whenever we expect data of at least the endpoint's packet size and
 have not yet received a short packet.

 Could you please let us know what all combination this was tested ?
 What will happen if the request length is 513 ?


 The last packet if short is always transferred using DMA mode 0.

 This patch fixes USB throughput issues in mass storage mode for
 host to device transfers.

 Signed-off-by: Roger Quadros rog...@ti.com

This commit is causing regression while using the test gadget.

output of ./test.sh in usb host machine

./test.sh
./test.sh: 31: ./test.sh: declare: not found
TESTING:  control out in
Tue Oct 23 15:25:29 IST 2012
** Control test cases:
test 9: ch9 postconfig
/dev/bus/usb/001/020 test 9,   63.749319 secs
test 10: control queueing
/dev/bus/usb/001/020 test 10,   10.417282 secs
test 14: control writes
/dev/bus/usb/001/020 test 14,4.579272 secs

assuming sink-src configuration
** Host Write (OUT) test cases:
test 1: 5000 transfers, same size
stays here infinitely

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


Re: [PATCH 6/6] usb: dwc3: core: add dt support for dwc3 core

2012-09-30 Thread ABRAHAM, KISHON VIJAY
Hi,

On Sun, Sep 30, 2012 at 10:17 PM, Sergei Shtylyov sshtyl...@mvista.com wrote:
 Hello.


 On 28-09-2012 14:53, Kishon Vijay Abraham I wrote:

 Added dwc3 support for dwc3 core and update the documentation with
 device tree binding information.

 Signed-off-by: Kishon Vijay Abraham Ikis...@ti.com

 [...]


 diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
 index 08a5738..0c17a7a 100644
 --- a/drivers/usb/dwc3/core.c
 +++ b/drivers/usb/dwc3/core.c

 [...]

 @@ -602,11 +601,22 @@ static int __devexit dwc3_remove(struct
 platform_device *pdev)
 return 0;
   }

 +#ifdef CONFIG_OF
 +static const struct of_device_id of_dwc3_matach[] = {


 I guess you meant 'of_dwc3_match' here and below?

indeed.. will re-post the patch..

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


Re: [PATCH v2 1/2] usb: phy: add a new driver for usb3 phy

2012-09-28 Thread ABRAHAM, KISHON VIJAY
Hi,

On Thu, Sep 27, 2012 at 7:48 PM, Russell King - ARM Linux
li...@arm.linux.org.uk wrote:
 On Thu, Sep 27, 2012 at 07:34:07PM +0530, Kishon Vijay Abraham I wrote:
 +static int omap5_usb_phy_power(struct omap_usb *phy, bool on)
 +{
 + u32 val;
 + unsigned long rate;
 + struct clk *sys_clk;
 +
 + sys_clk = clk_get(NULL, sys_clkin);
 + if (IS_ERR(sys_clk)) {
 + pr_err(%s: unable to get sys_clkin\n, __func__);
 + return -EINVAL;
 + }
 +
 + rate = clk_get_rate(sys_clk);
 + rate = rate/100;
 + clk_put(sys_clk);

 Actually, you're supposed to hold on to the struct clk all the time your
 driver is making use of that - you're not supposed to drop it.

 That has several advantages: if clk_get() fails, then you're failing
 earlier on (when the driver is being probed) and when some event occurs.

Ok. Will post a patch fixing it.

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


Re: [PATCH 1/5] drivers: usb: phy: add a new driver for omap usb2 phy

2012-09-28 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Sep 28, 2012 at 4:18 AM, Cousson, Benoit b-cous...@ti.com wrote:
 On 9/27/2012 7:24 AM, Rob Herring wrote:

 On 09/25/2012 05:06 AM, ABRAHAM, KISHON VIJAY wrote:

 Hi,

 On Mon, Sep 24, 2012 at 6:45 PM, Rob Herring robherri...@gmail.com
 wrote:

 On 09/06/2012 09:57 AM, Kishon Vijay Abraham I wrote:

 All phy related programming like enabling/disabling the clocks,
 powering
 on/off the phy is taken care of by this driver. It is also used for OTG
 related functionality like srp.

 This also includes device tree support for usb2 phy driver and
 the documentation with device tree binding information is updated.

 Currently writing to control module register is taken care in this
 driver which will be removed once the control module driver is in
 place.

 Cc: Felipe Balbi ba...@ti.com
 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
   Documentation/devicetree/bindings/usb/usb-phy.txt |   17 ++
   drivers/usb/phy/Kconfig   |9 +
   drivers/usb/phy/Makefile  |1 +
   drivers/usb/phy/omap-usb2.c   |  271
 +
   include/linux/usb/omap_usb.h  |   46 
   include/linux/usb/phy_companion.h |   34 +++
   6 files changed, 378 insertions(+)
   create mode 100644 Documentation/devicetree/bindings/usb/usb-phy.txt
   create mode 100644 drivers/usb/phy/omap-usb2.c
   create mode 100644 include/linux/usb/omap_usb.h
   create mode 100644 include/linux/usb/phy_companion.h

 diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt
 b/Documentation/devicetree/bindings/usb/usb-phy.txt
 new file mode 100644
 index 000..80d4148
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt


 This is a very generic name...

 @@ -0,0 +1,17 @@
 +USB PHY
 +
 +OMAP USB2 PHY
 +
 +Required properties:
 + - compatible: Should be ti,omap-usb2


 ...for a specific phy. However, I do think a generic binding to describe
 host ctrlr to phy connections is needed.

 + - reg : Address and length of the register set for the device. Also
 +add the address of control module dev conf register until a driver for
 +control module is added


 The dts should describe the h/w, not what you need for the current
 driver. The 2nd reg field does not belong here.


 Indeed. This was discussed and agreed upon as a interim solution till
 we have a control module driver in place to write to the control
 module register.


 Discussed where and agreed by who? I for one do not agree.


 Yeah, what was tolerated was the addition of that address inside hwmod data,
 but I do agree that it should not go into DTS.

So how can we handle reg writes to control module until we have a
control module driver. usb2 phy does not have a hwmod data for itself.
Do you think we should add a new hwmod data for usb2 phy and use this
in the usb2phy data node in the dts file?

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


Re: [PATCH 1/6] usb: dwc3-omap: use of_platform API to create dwc3 core pdev

2012-09-28 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Sep 28, 2012 at 6:27 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Fri, Sep 28, 2012 at 06:23:10PM +0530, Kishon Vijay Abraham I wrote:
 Used of_platform_populate() to populate dwc3 core platform_device
 from device tree data. Since now the allocation of unique device id is
 handled be of_*, removed the call to dwc3_get_device_id.

 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com

 I think it's best if you split the use of device_for_each_child() from
 this patch. So first do the device_for_each_child() part, then later use
 of_platform_populate().

I think it's better to have it both together as of_platform_populate
will create the device and the device_for_each_child() part will
delete it on error conditions and during driver removal.
In this patch the first device_for_each_child() comes in error
condition and it is not needed if we have not created the device using
of_platform_populate.

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


Re: [PATCH 2/6] usb: dwc3-omap: use runtime API's to enable clocks

2012-09-28 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Sep 28, 2012 at 6:28 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Fri, Sep 28, 2012 at 06:23:11PM +0530, Kishon Vijay Abraham I wrote:
 Before accessing any register, runtime API's should be invoked to enable
 the clocks. runtime API's are added here to prevent abort during register
 access.

 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
  drivers/usb/dwc3/dwc3-omap.c |   10 ++
  1 file changed, 10 insertions(+)

 diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
 index 34578de..6a0e17f 100644
 --- a/drivers/usb/dwc3/dwc3-omap.c
 +++ b/drivers/usb/dwc3/dwc3-omap.c
 @@ -43,6 +43,7 @@
  #include linux/spinlock.h
  #include linux/platform_device.h
  #include linux/platform_data/dwc3-omap.h
 +#include linux/pm_runtime.h
  #include linux/dma-mapping.h
  #include linux/ioport.h
  #include linux/io.h
 @@ -281,6 +282,13 @@ static int __devinit dwc3_omap_probe(struct 
 platform_device *pdev)
   omap-irq   = irq;
   omap-base  = base;

 + pm_runtime_enable(dev);
 + ret = pm_runtime_get_sync(dev);
 + if (ret  0) {
 + dev_err(dev, get_sync failed with err %d\n, ret);
 + goto err1;
 + }
 +
   reg = dwc3_omap_readl(omap-base, USBOTGSS_UTMI_OTG_STATUS);

   utmi_mode = of_get_property(node, utmi-mode, size);
 @@ -354,6 +362,8 @@ err1:
  static int __devexit dwc3_omap_remove(struct platform_device *pdev)
  {
   device_for_each_child(pdev-dev, NULL, dwc3_remove_core);
 + pm_runtime_put(pdev-dev);
 + pm_runtime_disable(pdev-dev);

 You're going to disable pm_runtime here, so it's better to use
 pm_runtime_put_sync(), I guess ??

sure. Will post a patch fixing it.

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


Re: [PATCH 4/6] usb: dwc3-omap: Add an API to write to dwc mailbox

2012-09-28 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Sep 28, 2012 at 6:29 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Fri, Sep 28, 2012 at 06:23:13PM +0530, Kishon Vijay Abraham I wrote:
 Add an API in the omap glue layer to write to the mailbox register which
 can be used by comparator driver(twl). To pass the detection of the attached
 device (signified by VBUS, ID) to the dwc3 core, dwc3 core has to write
 to the mailbox regiter.

 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
  drivers/usb/dwc3/dwc3-omap.c  |   59 
 +
  include/linux/usb/dwc3-omap.h |   30 +
  2 files changed, 89 insertions(+)
  create mode 100644 include/linux/usb/dwc3-omap.h

 diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
 index a1704c6..7ae4d73 100644
 --- a/drivers/usb/dwc3/dwc3-omap.c
 +++ b/drivers/usb/dwc3/dwc3-omap.c
 @@ -43,6 +43,7 @@
  #include linux/spinlock.h
  #include linux/platform_device.h
  #include linux/platform_data/dwc3-omap.h
 +#include linux/usb/dwc3-omap.h
  #include linux/pm_runtime.h
  #include linux/dma-mapping.h
  #include linux/ioport.h
 @@ -126,6 +127,8 @@ struct dwc3_omap {
   u32 dma_status:1;
  };

 +struct dwc3_omap *_omap;
 +
  static inline u32 dwc3_omap_readl(void __iomem *base, u32 offset)
  {
   return readl(base + offset);
 @@ -136,6 +139,56 @@ static inline void dwc3_omap_writel(void __iomem *base, 
 u32 offset, u32 value)
   writel(value, base + offset);
  }

 +void omap_dwc3_mailbox(enum omap_dwc3_vbus_id_status status)

 all other functions are dwc3_omap_, let's keep it consistent.

Sure.

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


Re: [PATCH 6/6] usb: dwc3: core: add dt support for dwc3 core

2012-09-28 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Sep 28, 2012 at 6:32 PM, Felipe Balbi ba...@ti.com wrote:
 On Fri, Sep 28, 2012 at 06:23:15PM +0530, Kishon Vijay Abraham I wrote:
 Added dwc3 support for dwc3 core and update the documentation with
 device tree binding information.

 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
  Documentation/devicetree/bindings/usb/dwc3.txt |   24 
 
  drivers/usb/dwc3/core.c|   14 --
  2 files changed, 36 insertions(+), 2 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/usb/dwc3.txt

 diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt 
 b/Documentation/devicetree/bindings/usb/dwc3.txt
 new file mode 100644
 index 000..87d5eeb
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
 @@ -0,0 +1,24 @@
 +SYNOPSIS DWC3 CORE
 +
 +DWC3- USB3 CONTROLLER
 +
 +Required properties:
 + - compatible: Should be synopsis,dwc3

 synopsys and I think:

 - compatible: Must be synopsys,dwc3 reads a bit better.

Will re-post this patch.

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


Re: [PATCH 1/5] drivers: usb: phy: add a new driver for omap usb2 phy

2012-09-28 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Sep 28, 2012 at 8:42 PM, Cousson, Benoit b-cous...@ti.com wrote:
 On 9/28/2012 3:07 AM, ABRAHAM, KISHON VIJAY wrote:

 Hi,

 On Fri, Sep 28, 2012 at 4:18 AM, Cousson, Benoit b-cous...@ti.com wrote:

 On 9/27/2012 7:24 AM, Rob Herring wrote:


 On 09/25/2012 05:06 AM, ABRAHAM, KISHON VIJAY wrote:


 Hi,

 On Mon, Sep 24, 2012 at 6:45 PM, Rob Herring robherri...@gmail.com
 wrote:


 On 09/06/2012 09:57 AM, Kishon Vijay Abraham I wrote:


 All phy related programming like enabling/disabling the clocks,
 powering
 on/off the phy is taken care of by this driver. It is also used for
 OTG
 related functionality like srp.

 This also includes device tree support for usb2 phy driver and
 the documentation with device tree binding information is updated.

 Currently writing to control module register is taken care in this
 driver which will be removed once the control module driver is in
 place.

 Cc: Felipe Balbi ba...@ti.com
 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
Documentation/devicetree/bindings/usb/usb-phy.txt |   17 ++
drivers/usb/phy/Kconfig   |9 +
drivers/usb/phy/Makefile  |1 +
drivers/usb/phy/omap-usb2.c   |  271
 +
include/linux/usb/omap_usb.h  |   46 
include/linux/usb/phy_companion.h |   34 +++
6 files changed, 378 insertions(+)
create mode 100644
 Documentation/devicetree/bindings/usb/usb-phy.txt
create mode 100644 drivers/usb/phy/omap-usb2.c
create mode 100644 include/linux/usb/omap_usb.h
create mode 100644 include/linux/usb/phy_companion.h

 diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt
 b/Documentation/devicetree/bindings/usb/usb-phy.txt
 new file mode 100644
 index 000..80d4148
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt



 This is a very generic name...

 @@ -0,0 +1,17 @@
 +USB PHY
 +
 +OMAP USB2 PHY
 +
 +Required properties:
 + - compatible: Should be ti,omap-usb2



 ...for a specific phy. However, I do think a generic binding to
 describe
 host ctrlr to phy connections is needed.

 + - reg : Address and length of the register set for the device. Also
 +add the address of control module dev conf register until a driver
 for
 +control module is added



 The dts should describe the h/w, not what you need for the current
 driver. The 2nd reg field does not belong here.



 Indeed. This was discussed and agreed upon as a interim solution till
 we have a control module driver in place to write to the control
 module register.



 Discussed where and agreed by who? I for one do not agree.



 Yeah, what was tolerated was the addition of that address inside hwmod
 data,
 but I do agree that it should not go into DTS.


 So how can we handle reg writes to control module until we have a
 control module driver. usb2 phy does not have a hwmod data for itself.
 Do you think we should add a new hwmod data for usb2 phy and use this
 in the usb2phy data node in the dts file?


 Now, I'm confused... didn't you already do that? What was the hwmod you
 added?

That was in usb_otg_hs (musb glue for omap) for writing to MUSB
mailbox. This is for usb2 phy for powering on/off the PHY.

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


Re: [PATCH 1/5] drivers: usb: phy: add a new driver for omap usb2 phy

2012-09-27 Thread ABRAHAM, KISHON VIJAY
Hi,

On Thu, Sep 27, 2012 at 7:54 PM, Rob Herring robherri...@gmail.com wrote:
 On 09/25/2012 05:06 AM, ABRAHAM, KISHON VIJAY wrote:
 Hi,

 On Mon, Sep 24, 2012 at 6:45 PM, Rob Herring robherri...@gmail.com wrote:
 On 09/06/2012 09:57 AM, Kishon Vijay Abraham I wrote:
 All phy related programming like enabling/disabling the clocks, powering
 on/off the phy is taken care of by this driver. It is also used for OTG
 related functionality like srp.

 This also includes device tree support for usb2 phy driver and
 the documentation with device tree binding information is updated.

 Currently writing to control module register is taken care in this
 driver which will be removed once the control module driver is in place.

 Cc: Felipe Balbi ba...@ti.com
 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
  Documentation/devicetree/bindings/usb/usb-phy.txt |   17 ++
  drivers/usb/phy/Kconfig   |9 +
  drivers/usb/phy/Makefile  |1 +
  drivers/usb/phy/omap-usb2.c   |  271 
 +
  include/linux/usb/omap_usb.h  |   46 
  include/linux/usb/phy_companion.h |   34 +++
  6 files changed, 378 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/usb/usb-phy.txt
  create mode 100644 drivers/usb/phy/omap-usb2.c
  create mode 100644 include/linux/usb/omap_usb.h
  create mode 100644 include/linux/usb/phy_companion.h

 diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt 
 b/Documentation/devicetree/bindings/usb/usb-phy.txt
 new file mode 100644
 index 000..80d4148
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt

 This is a very generic name...

 @@ -0,0 +1,17 @@
 +USB PHY
 +
 +OMAP USB2 PHY
 +
 +Required properties:
 + - compatible: Should be ti,omap-usb2

 ...for a specific phy. However, I do think a generic binding to describe
 host ctrlr to phy connections is needed.

 + - reg : Address and length of the register set for the device. Also
 +add the address of control module dev conf register until a driver for
 +control module is added

 The dts should describe the h/w, not what you need for the current
 driver. The 2nd reg field does not belong here.

 Indeed. This was discussed and agreed upon as a interim solution till
 we have a control module driver in place to write to the control
 module register.

 Discussed where and agreed by who? I for one do not agree.

Please find the discussion @ https://patchwork.kernel.org/patch/1415261/

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


Re: [RFC PATCH] drivers: phy: add generic PHY framework

2012-09-26 Thread ABRAHAM, KISHON VIJAY
Hi,

On Mon, Sep 17, 2012 at 3:03 PM, Marc Kleine-Budde m...@pengutronix.de wrote:
 On 09/14/2012 03:06 PM, ABRAHAM, KISHON VIJAY wrote:

 [...]

 diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
 new file mode 100644
 index 000..c55446a
 --- /dev/null
 +++ b/drivers/phy/phy-core.c
 @@ -0,0 +1,437 @@
 +/*
 + * phy-core.c  --  Generic Phy framework.
 + *
 + * Copyright (C) 2012 Texas Instruments
 + *
 + * Author: Kishon Vijay Abraham I kis...@ti.com
 + *
 + * This program is free software; you can redistribute  it and/or modify 
 it
 + * under  the terms of  the GNU General  Public License as published by 
 the
 + * Free Software Foundation;  either version 2 of the  License, or (at 
 your
 + * option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program.  If not, see http://www.gnu.org/licenses/.
 + */
 +
 +#include linux/kernel.h
 +#include linux/export.h
 +#include linux/module.h
 +#include linux/err.h
 +#include linux/device.h
 +#include linux/slab.h
 +#include linux/of.h
 +#include linux/phy/phy.h
 +
 +static struct class *phy_class;
 +static LIST_HEAD(phy_list);
 +static DEFINE_MUTEX(phy_list_mutex);
 +static LIST_HEAD(phy_bind_list);
 +
 +static void devm_phy_release(struct device *dev, void *res)
 +{
 + struct phy *phy = *(struct phy **)res;

 What about adding a struct phy_res, doing so,m you don't need these
 casts, and it's easier to add more pointers if needed.

 Wont we still need to do the cast since you get only a void pointer.
 Maybe I'm not getting you.

 As res is a void pointer, no need to hast to to a struct phy_res
 pointer, if you think that's unclean code, you can still cast it. But
 IMHO the code is far more readable.

 +
 + phy_put(phy);
 +}
 +
 +static int devm_phy_match(struct device *dev, void *res, void *match_data)
 +{
 + return res == match_data;
 +}
 +
 +static struct phy *phy_lookup(struct device *dev, u8 index)
 +{
 + struct phy_bind *phy_bind = NULL;
 +
 + list_for_each_entry(phy_bind, phy_bind_list, list) {
 + if (!(strcmp(phy_bind-dev_name, dev_name(dev))) 
 + phy_bind-index == index)
 + return phy_bind-phy;
 + }
 +
 + return ERR_PTR(-ENODEV);
 +}
 +
 +static struct phy *of_phy_lookup(struct device *dev, struct device_node 
 *node)
 +{
 + int index = 0;
 + struct phy  *phy;
   ^^

 Please remove that stray space.

 Sure.

 + struct phy_bind *phy_map = NULL;
 +
 + list_for_each_entry(phy_map, phy_bind_list, list)
 + if (!(strcmp(phy_map-dev_name, dev_name(dev
 + index++;
 +
 + list_for_each_entry(phy, phy_list, head) {
 + if (node != phy-desc-of_node)
 + continue;
 +
 + phy_map = phy_bind(dev_name(dev), index, 
 dev_name(phy-dev));
 + if (!IS_ERR(phy_map)) {
 + phy_map-phy = phy;
 + phy_map-auto_bind = true;
 + }
 +
 + return phy;
 + }
 +
 + return ERR_PTR(-ENODEV);
 +}
 +
 +/**
 + * devm_phy_get - lookup and obtain a reference to a phy.
 + * @dev: device that requests this phy
 + * @index: the index of the phy
 + *
 + * Gets the phy using phy_get(), and associates a device with it using
 + * devres. On driver detach, release function is invoked on the devres 
 data,
 + * then, devres data is freed.
 + */
 +struct phy *devm_phy_get(struct device *dev, u8 index)
 +{
 + struct phy **ptr, *phy;
 +
 + ptr = devres_alloc(devm_phy_release, sizeof(*ptr), GFP_KERNEL);
 + if (!ptr)
 + return NULL;
 +
 + phy = phy_get(dev, index);
 + if (!IS_ERR(phy)) {
 + *ptr = phy;
 + devres_add(dev, ptr);
 + } else
 + devres_free(ptr);

 nitpick: when when if has { }, else should have, too.

 Sure.

 +
 + return phy;
 +}
 +EXPORT_SYMBOL_GPL(devm_phy_get);
 +
 +/**
 + * devm_phy_put - release the PHY
 + * @dev: device that wants to release this phy
 + * @phy: the phy returned by devm_phy_get()
 + *
 + * destroys the devres associated with this phy and invokes phy_put
 + * to release the phy.
 + */
 +void devm_phy_put(struct device *dev, struct phy *phy)
 +{
 + int r;
 +
 + r = devres_destroy(dev, devm_phy_release, devm_phy_match, phy);
 + dev_WARN_ONCE(dev, r, couldn't find PHY resource\n);
 +}
 +EXPORT_SYMBOL_GPL(devm_phy_put);
 +
 +/**
 + * devm_of_phy_get - lookup and obtain a reference to a phy by phandle
 + * @dev: device that requests this phy
 + * @phandle: name of the property holding the phy phandle value
 + *
 + * Returns the phy driver associated with the given phandle value

Re: [PATCH 4/4] usb: phy: omap-usb2: enable 960Mhz clock for omap5

2012-09-26 Thread ABRAHAM, KISHON VIJAY
Hi,

On Wed, Sep 26, 2012 at 11:57 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Wed, Sep 26, 2012 at 11:10:48AM +0530, ABRAHAM, KISHON VIJAY wrote:
 Hi,

 On Wed, Sep 19, 2012 at 5:26 PM, Felipe Balbi ba...@ti.com wrote:
  On Wed, Sep 19, 2012 at 05:00:29PM +0530, Kishon Vijay Abraham I wrote:
  usb_otg_ss_refclk960m is needed by usb2 phy present in omap5. For
  omap4, the clk_get of this clock will fail since it does not have this
  clock.
 
  Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
  ---
   Documentation/devicetree/bindings/usb/usb-phy.txt |3 +++
   drivers/usb/phy/omap-usb2.c   |   28 
  -
   2 files changed, 30 insertions(+), 1 deletion(-)
 
  diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt 
  b/Documentation/devicetree/bindings/usb/usb-phy.txt
  index 7c5fd89..d5626de 100644
  --- a/Documentation/devicetree/bindings/usb/usb-phy.txt
  +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt
  @@ -24,6 +24,9 @@ Required properties:
   add the address of control module phy power register until a driver for
   control module is added
 
  +Optional properties:
  + - has960mhzclk: should be added if the phy needs 960mhz clock
  +
   This is usually a subnode of ocp2scp to which it is connected.
 
   usb3phy@4a084400 {
  diff --git a/drivers/usb/phy/omap-usb2.c b/drivers/usb/phy/omap-usb2.c
  index d36c282..d6612ba 100644
  --- a/drivers/usb/phy/omap-usb2.c
  +++ b/drivers/usb/phy/omap-usb2.c
  @@ -146,6 +146,7 @@ static int __devinit omap_usb2_probe(struct 
  platform_device *pdev)
struct omap_usb *phy;
struct usb_otg  *otg;
struct resource *res;
  + struct device_node  *np = pdev-dev.of_node;
 
phy = devm_kzalloc(pdev-dev, sizeof(*phy), GFP_KERNEL);
if (!phy) {
  @@ -190,6 +191,15 @@ static int __devinit omap_usb2_probe(struct 
  platform_device *pdev)
}
clk_prepare(phy-wkupclk);
 
  + if (of_property_read_bool(np, has960mhzclk)) {
  + phy-optclk = devm_clk_get(phy-dev, 
  usb_otg_ss_refclk960m);
  + if (IS_ERR(phy-optclk)) {
  + dev_err(pdev-dev, unable to get refclk960m\n);
  + return PTR_ERR(phy-optclk);
  + }
  + clk_prepare(phy-optclk);
  + }
 
  instead, can't you just always try to get the clock but ignore the error
  if it fails ?

 This clock is needed for usb2 to work in dwc3 (omap5). So we have to
 report the error in case we dont get the clock no?

 sure, but you don't need to bail out. Print a warning message such as:

 dev_dbg(pdev-dev, couldn't get refclk960m, trying without\n);

but then we'll get this debug message for omap4 which actually doesn't
need 960m clk.

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


Re: [PATCH 1/5] drivers: usb: phy: add a new driver for omap usb2 phy

2012-09-25 Thread ABRAHAM, KISHON VIJAY
Hi,

On Mon, Sep 24, 2012 at 6:45 PM, Rob Herring robherri...@gmail.com wrote:
 On 09/06/2012 09:57 AM, Kishon Vijay Abraham I wrote:
 All phy related programming like enabling/disabling the clocks, powering
 on/off the phy is taken care of by this driver. It is also used for OTG
 related functionality like srp.

 This also includes device tree support for usb2 phy driver and
 the documentation with device tree binding information is updated.

 Currently writing to control module register is taken care in this
 driver which will be removed once the control module driver is in place.

 Cc: Felipe Balbi ba...@ti.com
 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
  Documentation/devicetree/bindings/usb/usb-phy.txt |   17 ++
  drivers/usb/phy/Kconfig   |9 +
  drivers/usb/phy/Makefile  |1 +
  drivers/usb/phy/omap-usb2.c   |  271 
 +
  include/linux/usb/omap_usb.h  |   46 
  include/linux/usb/phy_companion.h |   34 +++
  6 files changed, 378 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/usb/usb-phy.txt
  create mode 100644 drivers/usb/phy/omap-usb2.c
  create mode 100644 include/linux/usb/omap_usb.h
  create mode 100644 include/linux/usb/phy_companion.h

 diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt 
 b/Documentation/devicetree/bindings/usb/usb-phy.txt
 new file mode 100644
 index 000..80d4148
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt

 This is a very generic name...

 @@ -0,0 +1,17 @@
 +USB PHY
 +
 +OMAP USB2 PHY
 +
 +Required properties:
 + - compatible: Should be ti,omap-usb2

 ...for a specific phy. However, I do think a generic binding to describe
 host ctrlr to phy connections is needed.

 + - reg : Address and length of the register set for the device. Also
 +add the address of control module dev conf register until a driver for
 +control module is added

 The dts should describe the h/w, not what you need for the current
 driver. The 2nd reg field does not belong here.

Indeed. This was discussed and agreed upon as a interim solution till
we have a control module driver in place to write to the control
module register.

 +
 +This is usually a subnode of ocp2scp to which it is connected.

 How is usb port to phy connection described?
Currently the usb controller to phy connection is established only by
type. We have a couple of patches being currently discussed in the
list to establish the connection by phandle.

https://patchwork.kernel.org/patch/1457801/ (Generic PHY Framework:
devm_of_phy_get())
http://www.spinics.net/lists/linux-usb/msg69547.html

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


Re: query on [PATCH 2/3] usb: otg: add device tree support to otg library

2012-09-25 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Sep 25, 2012 at 2:24 PM, Marc Kleine-Budde m...@pengutronix.de wrote:
 Hi Afzal,

 On 09/25/2012 10:47 AM, Mohammed, Afzal wrote:
 This is a query regarding patch,
 usb: otg: add device tree support to otg library [1]

 It seems there is so far no consensus on this change.

 After I have posted this patch, Kishon had posted a better solution [2].
 We discussed the patch, but he has not posted any updates since then.

 Do you have ideas to proceed on this ? is there something
 that I can help you to proceed on this ?

 I'm interested in to get these patches into the kernel soon. Kishon any
 news on this patch?

 Something like this would be required for USB support
 on beagle bone (AM335X), which has 2 phy's of same type.

 Or is the plan to use generic phy framework instead ?

 Yes, Kishon's patches look more generic than mine.
Will post the next version by this week.

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


Re: [PATCH v6 1/5] usb: phy: samsung: Introducing usb phy driver for hsotg

2012-09-25 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Sep 25, 2012 at 5:48 PM, Rob Herring robherri...@gmail.com wrote:
 On 09/25/2012 06:23 AM, Praveen Paneri wrote:
 Hi Rob,

 On Mon, Sep 24, 2012 at 6:34 PM, Rob Herring robherri...@gmail.com wrote:
 On 09/17/2012 07:54 AM, Praveen Paneri wrote:
 This driver uses usb_phy interface to interact with s3c-hsotg. Supports
 phy_init and phy_shutdown functions to enable/disable phy. Tested with
 smdk6410 and smdkv310. More SoCs can be brought under later.

 Signed-off-by: Praveen Paneri p.pan...@samsung.com
 Acked-by: Heiko Stuebner he...@sntech.de
 ---
  .../devicetree/bindings/usb/samsung-usbphy.txt |9 +
  drivers/usb/phy/Kconfig|8 +
  drivers/usb/phy/Makefile   |1 +
  drivers/usb/phy/samsung-usbphy.c   |  360 
 
  include/linux/platform_data/samsung-usbphy.h   |   27 ++
  5 files changed, 405 insertions(+), 0 deletions(-)
  create mode 100644 
 Documentation/devicetree/bindings/usb/samsung-usbphy.txt
  create mode 100644 drivers/usb/phy/samsung-usbphy.c
  create mode 100644 include/linux/platform_data/samsung-usbphy.h

 diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt 
 b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 new file mode 100644
 index 000..fefd9c8
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 @@ -0,0 +1,9 @@
 +* Samsung's usb phy transceiver
 +
 +The Samsung's phy transceiver is used for controlling usb otg phy for
 +s3c-hsotg usb device controller.
 +
 +Required properties:
 +- compatible : should be samsung,exynos4210-usbphy
 +- reg : base physical address of the phy registers and length of memory 
 mapped
 + region.

 What's missing here is describing the connection of phys to host
 controllers. We've got several people adding usb phy bindings and need
 to define them in a common way.
 yes! it just covers the generic binding. I will update it accordingly
 as the generic phy framework takes its final shape.

 That sounds like the wrong way to define a binding... Figuring out how
 to describe the h/w should not be dependent on changes in the kernel.
 Bindings are an ABI and should not be evolving.

There can be multiple ways to define the binding. For e.g. We
discussed few ways of binding the phys to the controller

controller {
  phy0 = phandle1_name;
  phy1 = phandle2_name;
}

phy0 and phy1 are any name given to obtain a reference to the phy and
the controller should send the phandle name like
get_phy_by_phandle(phy0);. Then we thought of standardizing that
name.

and then finally we settled on something like this
controller {
  phy = phandle0_name, phandle1_name;
}
so that controller can obtain a reference to the PHY using
*of_phy_get(struct device *dev, const char *phandle, u8 index)*

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


Re: [PATCH 4/4] usb: phy: omap-usb2: enable 960Mhz clock for omap5

2012-09-25 Thread ABRAHAM, KISHON VIJAY
Hi,

On Wed, Sep 19, 2012 at 5:26 PM, Felipe Balbi ba...@ti.com wrote:
 On Wed, Sep 19, 2012 at 05:00:29PM +0530, Kishon Vijay Abraham I wrote:
 usb_otg_ss_refclk960m is needed by usb2 phy present in omap5. For
 omap4, the clk_get of this clock will fail since it does not have this
 clock.

 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
  Documentation/devicetree/bindings/usb/usb-phy.txt |3 +++
  drivers/usb/phy/omap-usb2.c   |   28 
 -
  2 files changed, 30 insertions(+), 1 deletion(-)

 diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt 
 b/Documentation/devicetree/bindings/usb/usb-phy.txt
 index 7c5fd89..d5626de 100644
 --- a/Documentation/devicetree/bindings/usb/usb-phy.txt
 +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt
 @@ -24,6 +24,9 @@ Required properties:
  add the address of control module phy power register until a driver for
  control module is added

 +Optional properties:
 + - has960mhzclk: should be added if the phy needs 960mhz clock
 +
  This is usually a subnode of ocp2scp to which it is connected.

  usb3phy@4a084400 {
 diff --git a/drivers/usb/phy/omap-usb2.c b/drivers/usb/phy/omap-usb2.c
 index d36c282..d6612ba 100644
 --- a/drivers/usb/phy/omap-usb2.c
 +++ b/drivers/usb/phy/omap-usb2.c
 @@ -146,6 +146,7 @@ static int __devinit omap_usb2_probe(struct 
 platform_device *pdev)
   struct omap_usb *phy;
   struct usb_otg  *otg;
   struct resource *res;
 + struct device_node  *np = pdev-dev.of_node;

   phy = devm_kzalloc(pdev-dev, sizeof(*phy), GFP_KERNEL);
   if (!phy) {
 @@ -190,6 +191,15 @@ static int __devinit omap_usb2_probe(struct 
 platform_device *pdev)
   }
   clk_prepare(phy-wkupclk);

 + if (of_property_read_bool(np, has960mhzclk)) {
 + phy-optclk = devm_clk_get(phy-dev, usb_otg_ss_refclk960m);
 + if (IS_ERR(phy-optclk)) {
 + dev_err(pdev-dev, unable to get refclk960m\n);
 + return PTR_ERR(phy-optclk);
 + }
 + clk_prepare(phy-optclk);
 + }

 instead, can't you just always try to get the clock but ignore the error
 if it fails ?

This clock is needed for usb2 to work in dwc3 (omap5). So we have to
report the error in case we dont get the clock no?

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


Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-24 Thread ABRAHAM, KISHON VIJAY
Hi,

On Sat, Sep 22, 2012 at 2:08 PM, Venu Byravarasu vbyravar...@nvidia.com wrote:
 -Original Message-
 From: Stephen Warren [mailto:swar...@wwwdotorg.org]
 Sent: Friday, September 21, 2012 9:45 PM
 To: ABRAHAM, KISHON VIJAY
 Cc: Venu Byravarasu; ba...@ti.com; gre...@linuxfoundation.org; linux-
 ker...@vger.kernel.org; linux-usb@vger.kernel.org
 Subject: Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

 On 09/21/2012 07:09 AM, ABRAHAM, KISHON VIJAY wrote:
  Hi,
 
  On Fri, Sep 21, 2012 at 5:50 PM, Venu Byravarasu
 vbyravar...@nvidia.com wrote:
  NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
  In order to support USB PHY drivers on these SoCs, existing
  PHY driver is split into SoC agnostic common USB PHY driver
  and Tegra20-specific USB phy driver. This will facilitate
  easy addition and deletion of phy drivers for Tegra SoCs.

  @@ -618,6 +618,9 @@ static int tegra_ehci_probe(struct platform_device
 *pdev)
 ...
  pdata = pdev-dev.platform_data;
  if (!pdata) {

 Some missing lines of context are:

 dev_err(pdev-dev, Platform data missing\n);
 return -EINVAL;
 }

 ...
  +   params.mode = TEGRA_USB_PHY_MODE_HOST;
  +   params.config = pdata-phy_config;
 
  I fail to understand how pdata is not NULL in dt boot. I know i've
  already given this comment and you replied that you dint see any
  crash. But I'd like to know where and how pdata gets populated.

 In practice, the platform uses AUXDATA to provide platform data to the
 driver even when it's instantiated using device tree; see
 arch/arm/mach-tegra/board-dt-tegra20.c variables tegra_ehci*_pdata and
 tegra20_auxdata_lookup[].

 In the slightly (very very slightly, hopefully) longer term, I would
 like to completely remove the AUXDATA setup from board-dt-tegra20.c;
 tegra_ehci_probe() should do something like:

 pdata = pdev-dev.platform_data
 if (!pdata)
 pdata = parse_pdata_from_dt();
 /* user didn't specify any in DT either */
 if (!pdata)
 pdata = default_pdata_for_port();

 ... where perhaps the use of defaults could be folded into
 parse_pdata_from_dt().


 Thanks Stephen for the detailed explanation.

 Kishon / Felipe,
 Do you have any more questions in this related, before patch can be applied?

I don't have any further comments.

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


Re: [PATCH 2/5] drivers: usb: otg: make twl6030_usb as a comparator driver to omap_usb2

2012-09-24 Thread ABRAHAM, KISHON VIJAY
Hi,

On Sat, Sep 22, 2012 at 3:03 AM, Rabin Vincent ra...@rab.in wrote:
 2012/9/6 Kishon Vijay Abraham I kis...@ti.com:
 All the PHY configuration other than VBUS, ID GND and OTG SRP are removed
 from twl6030. The phy configurations are taken care by the dedicated
 usb2 phy driver. So twl6030 is made as comparator driver for VBUS and
 ID detection.

 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com

 USB doesn't work on pandaboard on linux-next, and bisection shows this
 patch.  Unfortunately, I can't provide a dmesg log because USB is the
 only way I currently have to get one out(!), but presumably it's because
 this omap-usb2 device is never registered?  Looks like this breaks
 non-dt USB on pandaboard; is that intended?

Yes. omap-usb2 is *only* dt supported (New drivers shouldn't have the
old non-dt support).
Some patches are queued only for 3.7.

In case you want to use MUSB please use these patches on linux-next..
[PATCH v2] arm: omap: hwmod: make *phy_48m* as the main_clk of ocp2scp
[PATCH] ARM: OMAP2+: hwmod data: Fix ocp2scp_usb_phy and usb_host_hs
entries (from Benoit)
[PATCH 0/2] ARM: dts: Add subnode for ocp2scp (patch series)
[PATCH v3 0/3] ARM: dts: omap: add dt data for MUSB (patch series)

Pls note all these patches are queued for 3.7

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


Re: [PATCH v6 1/5] usb: phy: samsung: Introducing usb phy driver for hsotg

2012-09-24 Thread ABRAHAM, KISHON VIJAY
Hi,

On Mon, Sep 24, 2012 at 3:08 PM, Praveen Paneri p.pan...@samsung.com wrote:
 Hi Kishon, Felipe,

 Any further comments on these patches? Can they be merged now?

I don't have any other comments.

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


Re: [PATCH 1/4] usb: phy: add a new driver for usb3 phy

2012-09-21 Thread ABRAHAM, KISHON VIJAY
Hi,

On Wed, Sep 19, 2012 at 8:11 PM, Marc Kleine-Budde m...@pengutronix.de wrote:
 On 09/19/2012 01:30 PM, Kishon Vijay Abraham I wrote:
 Added a driver for usb3 phy that handles the interaction between usb phy
 device and dwc3 controller.

 This also includes device tree support for usb3 phy driver and
 the documentation with device tree binding information is updated.

 Currently writing to control module register is taken care in this
 driver which will be removed once the control module driver is in place.

 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 Signed-off-by: Felipe Balbi ba...@ti.com
 Signed-off-by: Moiz Sonasath m-sonas...@ti.com
 ---
  Documentation/devicetree/bindings/usb/usb-phy.txt |   18 +
  drivers/usb/phy/Kconfig   |9 +
  drivers/usb/phy/Makefile  |1 +
  drivers/usb/phy/omap-usb3.c   |  369 
 +
  include/linux/usb/omap_usb.h  |   72 
  5 files changed, 469 insertions(+)
  create mode 100644 drivers/usb/phy/omap-usb3.c

 diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt 
 b/Documentation/devicetree/bindings/usb/usb-phy.txt
 index 80d4148..7c5fd89 100644
 --- a/Documentation/devicetree/bindings/usb/usb-phy.txt
 +++ b/Documentation/devicetree/bindings/usb/usb-phy.txt
 @@ -15,3 +15,21 @@ usb2phy@4a0ad080 {
   reg = 0x4a0ad080 0x58,
 0x4a002300 0x4;
  };
 +
 +OMAP USB3 PHY
 +
 +Required properties:
 + - compatible: Should be ti,omap-usb3
 + - reg : Address and length of the register set for the device. Also
 +add the address of control module phy power register until a driver for
 +control module is added
 +
 +This is usually a subnode of ocp2scp to which it is connected.
 +
 +usb3phy@4a084400 {
 + compatible = ti,omap-usb3;
 + reg = 0x0x4a084400 0x80,
 +   0x4a084800 0x64,
 +   0x4a084c00 0x40,
 +   0x4a002370 0x4;
 +};
 diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
 index 63c339b..353dc0c 100644
 --- a/drivers/usb/phy/Kconfig
 +++ b/drivers/usb/phy/Kconfig
 @@ -13,6 +13,15 @@ config OMAP_USB2
 The USB OTG controller communicates with the comparator using this
 driver.

 +config OMAP_USB3
 + tristate OMAP USB3 PHY Driver
 + select USB_OTG_UTILS
 + help
 +   Enable this to support the USB3 PHY that is part of SOC. This
 +   driver takes care of all the PHY functionality apart from comparator.
 +   The USB OTG controller communicates with the comparator using this
 +   driver.
 +
  config USB_ISP1301
   tristate NXP ISP1301 USB transceiver support
   depends on USB || USB_GADGET
 diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
 index b069f29..973b1e6 100644
 --- a/drivers/usb/phy/Makefile
 +++ b/drivers/usb/phy/Makefile
 @@ -5,6 +5,7 @@
  ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG

  obj-$(CONFIG_OMAP_USB2)  += omap-usb2.o
 +obj-$(CONFIG_OMAP_USB3)  += omap-usb3.o
  obj-$(CONFIG_USB_ISP1301)+= isp1301.o
  obj-$(CONFIG_MV_U3D_PHY) += mv_u3d_phy.o
  obj-$(CONFIG_USB_EHCI_TEGRA) += tegra_usb_phy.o
 diff --git a/drivers/usb/phy/omap-usb3.c b/drivers/usb/phy/omap-usb3.c
 new file mode 100644
 index 000..4dc84ca
 --- /dev/null
 +++ b/drivers/usb/phy/omap-usb3.c
 @@ -0,0 +1,369 @@
 +/*
 + * omap-usb3 - USB PHY, talking to dwc3 controller in OMAP.
 + *
 + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + * Author: Kishon Vijay Abraham I kis...@ti.com
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + */
 +
 +#include linux/module.h
 +#include linux/platform_device.h
 +#include linux/slab.h
 +#include linux/usb/omap_usb.h
 +#include linux/of.h
 +#include linux/clk.h
 +#include linux/err.h
 +#include linux/pm_runtime.h
 +#include linux/delay.h
 +
 +static struct usb_dpll_params omap_usb3_dpll_params[NUM_SYS_CLKS] = {
 + {1250, 5, 4, 20, 0},/* 12 MHz */
 + {3125, 20, 4, 20, 0},   /* 16.8 MHz */
 + {1172, 8, 4, 20, 65537},/* 19.2 MHz */
 + {1250, 12, 4, 20, 0},   /* 26 MHz */
 + {3125, 47, 4, 20, 92843},   /* 38.4 MHz */
 +};
 +
 +/**
 + * omap5_usb_phy_power - power on/off the serializer using control module
 + * @phy: struct omap_usb *
 + * @on: 0 to off and 1 to on based on powering on or off the PHY
 + *
 + * omap_usb3 can call this API to power on or off the PHY.
 + */
 +static int omap5_usb_phy_power(struct 

Re: [PATCH v3] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-21 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Sep 21, 2012 at 5:50 PM, Venu Byravarasu vbyravar...@nvidia.com wrote:
 NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
 In order to support USB PHY drivers on these SoCs, existing
 PHY driver is split into SoC agnostic common USB PHY driver
 and Tegra20-specific USB phy driver. This will facilitate
 easy addition and deletion of phy drivers for Tegra SoCs.

 Signed-off-by: Venu Byravarasu vbyravar...@nvidia.com
 ---
 delta from v2:

 Added an if condition to check for device_node to be not NULL,
 before dereferencing it.

  drivers/usb/host/ehci-tegra.c  |   26 +-
  drivers/usb/phy/Makefile   |1 +
  .../usb/phy/{tegra_usb_phy.c = tegra2_usb_phy.c}  |  421 +++--
  drivers/usb/phy/tegra2_usb_phy.h   |  140 
  drivers/usb/phy/tegra_usb_phy.c|  688 
 +---
  include/linux/usb/tegra_usb_phy.h  |   34 +-
  6 files changed, 298 insertions(+), 1012 deletions(-)
  copy drivers/usb/phy/{tegra_usb_phy.c = tegra2_usb_phy.c} (53%)
  create mode 100644 drivers/usb/phy/tegra2_usb_phy.h

 diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
 index 6223d17..8199a6e 100644
 --- a/drivers/usb/host/ehci-tegra.c
 +++ b/drivers/usb/host/ehci-tegra.c
 @@ -618,6 +618,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
 int err = 0;
 int irq;
 int instance = pdev-id;
 +   struct device_node *np = pdev-dev.of_node;
 +   struct phy_params params;
 +   int phy_type;

 pdata = pdev-dev.platform_data;
 if (!pdata) {
 @@ -701,14 +704,29 @@ static int tegra_ehci_probe(struct platform_device 
 *pdev)
 break;
 default:
 err = -ENODEV;
 -   dev_err(pdev-dev, unknown usb instance\n);
 +   dev_err(pdev-dev, unknown usb inst:%d\n, 
 instance);
 goto fail_io;
 }
 }

 +   if (np) {
 +   phy_type = of_property_match_string(np, phy_type, utmi);
 +   if (phy_type = 0)
 +   params.type = TEGRA_USB_PHY_TYPE_UTMI;
 +   else {
 +   phy_type = of_property_match_string(np, phy_type, 
 ulpi);
 +   if (phy_type = 0)
 +   params.type = TEGRA_USB_PHY_TYPE_ULPI;
 +   else
 +   params.type = TEGRA_USB_PHY_TYPE_INVALID;
 +   }
 +   }
 +
 +   params.mode = TEGRA_USB_PHY_MODE_HOST;
 +   params.config = pdata-phy_config;

I fail to understand how pdata is not NULL in dt boot. I know i've
already given this comment and you replied that you dint see any
crash. But I'd like to know where and how pdata gets populated.

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


Re: [RFC PATCH] drivers: phy: add generic PHY framework

2012-09-16 Thread ABRAHAM, KISHON VIJAY
Hi,

On Mon, Sep 17, 2012 at 6:50 AM, Chen Peter-B29397 b29...@freescale.com wrote:


 The PHY framework provides a set of API's for the PHY drivers to
 create/remove a PHY and the PHY users to obtain a reference to the PHY
 using or without using phandle. If the PHY users has to obtain a
 reference to
 the PHY without using phandle, the platform specfic intialization code
 (say
 from board file) should have already called phy_bind with the binding
 information. The binding information consists of phy's device name, phy
 user device name and an index. The index is used when the same phy user
 binds to mulitple phys.


 What's an example of the same phy user binds to multiple phys?

Single controller using multiple phys..
 I only remembered that Felipe said there are two phy users for one single phy 
 at
 omap5 that is both usb3 and sata uses the same phy.

*index* is used when a single controller uses multiple phys. For
example it could be used for dwc3 (usb3 controller) where it uses usb2
phy and usb3 phy.

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


Re: [PATCH RFC 1/3] usb: phy: fix the error check

2012-09-14 Thread ABRAHAM, KISHON VIJAY
Hi,

On Thu, Sep 13, 2012 at 7:44 PM, Shubhrajyoti D shubhrajy...@ti.com wrote:
 The functions pm_runtime_get_sync and clk_enable
 return a signed value. So the variable used to
 store should be signed otherwise a negative value may be
 wrongly interpreted.

 While at it also remove the initialisation of ret to zero.

 Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com

FWIW:
Acked-by: Kishon Vijay Abraham I kis...@ti.com
 ---
 untested

  drivers/usb/phy/omap-usb2.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

 diff --git a/drivers/usb/phy/omap-usb2.c b/drivers/usb/phy/omap-usb2.c
 index 15ab3d6..d36c282 100644
 --- a/drivers/usb/phy/omap-usb2.c
 +++ b/drivers/usb/phy/omap-usb2.c
 @@ -120,7 +120,7 @@ static int omap_usb_set_peripheral(struct usb_otg *otg,

  static int omap_usb2_suspend(struct usb_phy *x, int suspend)
  {
 -   u32 ret;
 +   int ret;
 struct omap_usb *phy = phy_to_omapusb(x);

 if (suspend  !phy-is_suspended) {
 @@ -223,7 +223,7 @@ static int omap_usb2_runtime_suspend(struct device *dev)

  static int omap_usb2_runtime_resume(struct device *dev)
  {
 -   u32 ret = 0;
 +   int ret;
 struct platform_device  *pdev = to_platform_device(dev);
 struct omap_usb *phy = platform_get_drvdata(pdev);

 --
 1.7.5.4

 --
 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
--
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: [RFC PATCH] drivers: phy: add generic PHY framework

2012-09-14 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Sep 14, 2012 at 5:58 PM, Marc Kleine-Budde m...@pengutronix.de wrote:
 On 09/14/2012 01:58 PM, Kishon Vijay Abraham I wrote:
 The PHY framework provides a set of API's for the PHY drivers to
 create/remove a PHY and the PHY users to obtain a reference to the PHY
 using or without using phandle. If the PHY users has to obtain a reference to
 the PHY without using phandle, the platform specfic intialization code (say
 from board file) should have already called phy_bind with the binding
 information. The binding information consists of phy's device name, phy
 user device name and an index. The index is used when the same phy user
 binds to mulitple phys.

 PHY drivers should create the PHY by passing phy_descriptor that has
 information about the PHY and ops like init, exit, suspend, resume,
 poweron, shutdown.

 Some comments inside.

 While looking over the code, I was thinking why not abstract the phy
 with a bus in the linux kernel. The ethernet phys are on the mdio_bus,
 see /sys/bus/mdio_bus. This saves you hand crafting devices, drivers and
 bindings,

well... have to think about it.

 Marc


 Nyet-signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
 This framework is actually intended to be used by all the PHY drivers in the
 kernel. Though it's going to take a while for that, I intend to migrate
 existing USB/OTG phy drivers to use this framework as we align on the design
 of this framework. Once I migrate these phy drivers, I'll be able to test 
 this
 framework (I haven't tested this framework so far). I sent this patch early
 so as to get review comments and align on the design. Thanks :-)

  drivers/Kconfig |2 +
  drivers/Makefile|2 +
  drivers/phy/Kconfig |   13 ++
  drivers/phy/Makefile|5 +
  drivers/phy/phy-core.c  |  437 
 +++
  include/linux/phy/phy.h |  181 
  6 files changed, 640 insertions(+)
  create mode 100644 drivers/phy/Kconfig
  create mode 100644 drivers/phy/Makefile
  create mode 100644 drivers/phy/phy-core.c
  create mode 100644 include/linux/phy/phy.h

 diff --git a/drivers/Kconfig b/drivers/Kconfig
 index ece958d..8488818 100644
 --- a/drivers/Kconfig
 +++ b/drivers/Kconfig
 @@ -152,4 +152,6 @@ source drivers/vme/Kconfig

  source drivers/pwm/Kconfig

 +source drivers/phy/Kconfig
 +
  endmenu
 diff --git a/drivers/Makefile b/drivers/Makefile
 index 5b42184..63d6bbe 100644
 --- a/drivers/Makefile
 +++ b/drivers/Makefile
 @@ -38,6 +38,8 @@ obj-y   += char/
  # gpu/ comes after char for AGP vs DRM startup
  obj-y+= gpu/

 +obj-y+= phy/
 +
  obj-$(CONFIG_CONNECTOR)  += connector/

  # i810fb and intelfb depend on char/agp/
 diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
 new file mode 100644
 index 000..34f7077
 --- /dev/null
 +++ b/drivers/phy/Kconfig
 @@ -0,0 +1,13 @@
 +#
 +# PHY
 +#
 +
 +menuconfig GENERIC_PHY
 + tristate Generic PHY Support
 + help
 +   Generic PHY support.
 +
 +   This framework is designed to provide a generic interface for PHY
 +   devices present in the kernel. This layer will have the generic
 +   API by which phy drivers can create PHY using the phy framework and
 +   phy users can obtain reference to the PHY.
 diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
 new file mode 100644
 index 000..9e9560f
 --- /dev/null
 +++ b/drivers/phy/Makefile
 @@ -0,0 +1,5 @@
 +#
 +# Makefile for the phy drivers.
 +#
 +
 +obj-$(CONFIG_GENERIC_PHY)+= phy-core.o
 diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
 new file mode 100644
 index 000..c55446a
 --- /dev/null
 +++ b/drivers/phy/phy-core.c
 @@ -0,0 +1,437 @@
 +/*
 + * phy-core.c  --  Generic Phy framework.
 + *
 + * Copyright (C) 2012 Texas Instruments
 + *
 + * Author: Kishon Vijay Abraham I kis...@ti.com
 + *
 + * This program is free software; you can redistribute  it and/or modify it
 + * under  the terms of  the GNU General  Public License as published by the
 + * Free Software Foundation;  either version 2 of the  License, or (at your
 + * option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program.  If not, see http://www.gnu.org/licenses/.
 + */
 +
 +#include linux/kernel.h
 +#include linux/export.h
 +#include linux/module.h
 +#include linux/err.h
 +#include linux/device.h
 +#include linux/slab.h
 +#include linux/of.h
 +#include linux/phy/phy.h
 +
 +static struct class *phy_class;
 +static LIST_HEAD(phy_list);
 +static DEFINE_MUTEX(phy_list_mutex);
 +static LIST_HEAD(phy_bind_list);
 +
 +static 

Re: [PATCH v2] USB: PHY: Re-organize Tegra USB PHY driver

2012-09-13 Thread ABRAHAM, KISHON VIJAY
Hi,

On Thu, Sep 13, 2012 at 12:32 PM, Venu Byravarasu
vbyravar...@nvidia.com wrote:
 NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
 In order to support USB PHY drivers on these SoCs, existing
 PHY driver is split into SoC agnostic common USB PHY driver
 and Tegra20-specific USB phy driver. This will facilitate
 easy addition and deletion of phy drivers for Tegra SoCs.

 Signed-off-by: Venu Byravarasu vbyravar...@nvidia.com
 ---
 delta from v1:

 1. Added two new phy_open functions, which will be called based
 on the phy type being used.
 2. Moved function pointer initialization to these two functions.
 3. Renamed usb_phy_ops to tegra_usb_phy_ops.
 4. Moved tegra_freq_table from header to tegra_usb_phy.c

  drivers/usb/host/ehci-tegra.c  |   24 +-
  drivers/usb/phy/Makefile   |1 +
  .../usb/phy/{tegra_usb_phy.c = tegra2_usb_phy.c}  |  421 +++--
  drivers/usb/phy/tegra2_usb_phy.h   |  140 
  drivers/usb/phy/tegra_usb_phy.c|  688 
 +---
  include/linux/usb/tegra_usb_phy.h  |   34 +-
  6 files changed, 296 insertions(+), 1012 deletions(-)
  copy drivers/usb/phy/{tegra_usb_phy.c = tegra2_usb_phy.c} (53%)
  create mode 100644 drivers/usb/phy/tegra2_usb_phy.h

 diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
 index 6223d17..15af372 100644
 --- a/drivers/usb/host/ehci-tegra.c
 +++ b/drivers/usb/host/ehci-tegra.c
 @@ -618,6 +618,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
 int err = 0;
 int irq;
 int instance = pdev-id;
 +   struct device_node *np = pdev-dev.of_node;
 +   struct phy_params params;
 +   int phy_type;

 pdata = pdev-dev.platform_data;
 if (!pdata) {
 @@ -701,14 +704,27 @@ static int tegra_ehci_probe(struct platform_device 
 *pdev)
 break;
 default:
 err = -ENODEV;
 -   dev_err(pdev-dev, unknown usb instance\n);
 +   dev_err(pdev-dev, unknown usb inst:%d\n, 
 instance);
 goto fail_io;
 }
 }

It's better you have the below code under *if (np)*, since both device
node and pdata co-exist for you.

 +   phy_type = of_property_match_string(np, phy_type, utmi);
 +   if (phy_type = 0)
 +   params.type = TEGRA_USB_PHY_TYPE_UTMI;
 +   else {
 +   phy_type = of_property_match_string(np, phy_type, ulpi);
 +   if (phy_type = 0)
 +   params.type = TEGRA_USB_PHY_TYPE_ULPI;
 +   else
 +   params.type = TEGRA_USB_PHY_TYPE_INVALID;
 +   }
 +
 +   params.mode = TEGRA_USB_PHY_MODE_HOST;
 +   params.config = pdata-phy_config;

doesn't this above line result in abort when you are doing a dt boot?
 +
 tegra-phy = tegra_usb_phy_open(pdev-dev, instance, hcd-regs,
 -   pdata-phy_config,
 -   TEGRA_USB_PHY_MODE_HOST);
 +   params);
 if (IS_ERR(tegra-phy)) {
 dev_err(pdev-dev, Failed to open USB phy\n);
 err = -ENXIO;
 @@ -744,7 +760,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)

 err = usb_add_hcd(hcd, irq, IRQF_SHARED);
 if (err) {
 -   dev_err(pdev-dev, Failed to add USB HCD\n);
 +   dev_err(pdev-dev, usb_add_hcd failed with err 0x%x\n, 
 err);
 goto fail;
 }

 diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
 index b069f29..21872e1 100644
 --- a/drivers/usb/phy/Makefile
 +++ b/drivers/usb/phy/Makefile
 @@ -8,3 +8,4 @@ obj-$(CONFIG_OMAP_USB2) += omap-usb2.o
  obj-$(CONFIG_USB_ISP1301)  += isp1301.o
  obj-$(CONFIG_MV_U3D_PHY)   += mv_u3d_phy.o
  obj-$(CONFIG_USB_EHCI_TEGRA)   += tegra_usb_phy.o
 +obj-$(CONFIG_USB_EHCI_TEGRA)   += tegra2_usb_phy.o
 diff --git a/drivers/usb/phy/tegra_usb_phy.c 
 b/drivers/usb/phy/tegra2_usb_phy.c
 similarity index 53%
 copy from drivers/usb/phy/tegra_usb_phy.c
 copy to drivers/usb/phy/tegra2_usb_phy.c
 index 987116f..4896a4d 100644
 --- a/drivers/usb/phy/tegra_usb_phy.c
 +++ b/drivers/usb/phy/tegra2_usb_phy.c
 @@ -1,9 +1,11 @@
  /*
   * Copyright (C) 2010 Google, Inc.
 + * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
   *
   * Author:
   * Erik Gilling konk...@google.com
   * Benoit Goby ben...@android.com
 + *  Venu Byravarasu vbyravar...@nvidia.com
   *
   * This software is licensed under the terms of the GNU General Public
   * License version 2, as published by the Free Software Foundation, and
 @@ -31,187 +33,18 @@
  #include linux/usb/tegra_usb_phy.h
  #include mach/iomap.h

 -#define ULPI_VIEWPORT  0x170
 -
 -#define USB_PORTSC10x184
 -#define   USB_PORTSC1_PTS(x)   (((x)  0x3)  

Re: [PATCH RFC 2/3] usb: twl6030: fix the error check for omap_usb2_set_comparator

2012-09-13 Thread ABRAHAM, KISHON VIJAY
Hi,

On Thu, Sep 13, 2012 at 7:44 PM, Shubhrajyoti D shubhrajy...@ti.com wrote:
 The function omap_usb2_set_comparator may return -ENODEV.
 Use a signed variable to store and check so that the value
 is not wrongly interpreted as a large positive number.
 While at it lets use the err variable to do the same.

 Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com
 ---
 untested

  drivers/usb/otg/twl6030-usb.c |5 ++---
  1 files changed, 2 insertions(+), 3 deletions(-)

 diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
 index fcadef7..11c22f3 100644
 --- a/drivers/usb/otg/twl6030-usb.c
 +++ b/drivers/usb/otg/twl6030-usb.c
 @@ -312,7 +312,6 @@ static int twl6030_set_vbus(struct phy_companion 
 *comparator, bool enabled)

  static int __devinit twl6030_usb_probe(struct platform_device *pdev)
  {
 -   u32 ret;
 struct twl6030_usb  *twl;
 int status, err;
 struct device_node  *np = pdev-dev.of_node;
 @@ -331,8 +330,8 @@ static int __devinit twl6030_usb_probe(struct 
 platform_device *pdev)
 twl-comparator.set_vbus= twl6030_set_vbus;
 twl-comparator.start_srp   = twl6030_start_srp;

 -   ret = omap_usb2_set_comparator(twl-comparator);
 -   if (ret == -ENODEV) {
 +   err = omap_usb2_set_comparator(twl-comparator);
 +   if (err == -ENODEV) {

While at that can you just change the above to use IS_ERR?

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


Re: [PATCH] arm/dts: omap: Add omap-usb2 dt data

2012-09-11 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Sep 11, 2012 at 1:53 PM, Benoit Cousson b-cous...@ti.com wrote:
 Hi Kishon,

 On 09/11/2012 08:12 AM, Kishon Vijay Abraham I wrote:
 Add omap-usb2 data node in omap4 device tree file. Since omap-usb2 is
 connected to ocp2scp, omap-usb2 dt data is added as a child node
 of ocp2scp.

 Could you add more details about the omap-usb2?
I think information about omap-usb2 driver is added in
 *usb: phy: add a new driver for omap usb2 phy.*.
Do you want the same thing to be added here?

 You must update the Documentation binding with that compatible name.
Yes. It's part of *usb: phy: add a new driver for omap usb2 phy.*
 Is it already part of the driver serie? The MUSB driver is referring to
 ti,musb-omap2430 only.

Will correct the Documentation for MUSB.

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


Re: [PATCH 1/3] arm: omap: hwmod: add a new addr space in otg for writing to control module

2012-09-11 Thread ABRAHAM, KISHON VIJAY
Hi,

On Mon, Sep 10, 2012 at 10:13 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Mon, Sep 10, 2012 at 06:17:03PM +0200, Benoit Cousson wrote:
  On 9/6/2012 8:25 PM, Kishon Vijay Abraham I wrote:
  The mailbox register for usb otg in omap is present in control module.
  On detection of any events VBUS or ID, this register should be written
  to send the notification to musb core.
 
  Till we have a separate control module driver to write to control 
  module,
  omap2430 will handle the register writes to control module by itself. 
  So
  a new address space to represent this control module register is added
  to usb_otg_hs.
 
  Cc: Benoit Cousson b-cous...@ti.com
  Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
  ---
   arch/arm/mach-omap2/omap_hwmod_44xx_data.c |5 +
   1 file changed, 5 insertions(+)
 
  diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
  b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
  index 242aee4..02341bc 100644
  --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
  +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
  @@ -5890,6 +5890,11 @@ static struct omap_hwmod_addr_space 
  omap44xx_usb_otg_hs_addrs[] = {
 .pa_end = 0x4a0ab003,
 .flags  = ADDR_TYPE_RT
 },
  +  {
  +  .pa_start   = 0x4a00233c,
  +  .pa_end = 0x4a00233f,
  +  .flags  = ADDR_TYPE_RT
  +  },
 
  I do not have any objection/comment here, but I believe this is control
  module address space required for USB module, right?
  I am not sure this is right way of accessing control module space.
  Actually Control Module Access required for drivers is one of the
  blocking issue we have currently.
 
  Also there was some effort put up by 'Konstantine' to convert Control
  module to MFD driver, I haven't seen any further update on it. But it
  would be good to check with him.
 
  this was an agreement with Benoit since we already lost a couple merge
  windows for this patchset. We agreed to wait until -rc4 for SCM driver
  and if it wasn't ready, we'd go ahead with this and SCM author would fix
  it up on a patch converting users to new SCM driver.
 
  Tony, can I get your Acked-by to this patch so I can take it together
  with the rest of the series ? Thanks
 
  ps: I'll apply this to my 'musb' branch which is immutable, so it's safe
  to merge it into your tree once I apply.
 
  It would be best if this got acked by Benoit and Paul as they may
  have some other patches queued up. I'll ack if they ack ;)
 
  Benoit, care to ack this patch ???

 Gosh, that's hard to ack something like that :-)

 btw, that's not different than what's already in tree, the only
 difference is that now hwmod knows about it...

 But considering that the control module driver is not there yet, I have
 no choice but accepting that one if we want to have the functionality
 we've been waiting for years.

 Could you just update the patch with a big disclaimer on top of the
 address range to explain that this should not belong here and will be
 removed ASAP, when the proper driver will be done.

 sure, that's doable... Kishon, can you do this ASAP ? I want to send my
 pull requests tomorrow at the latest.

Sure. Will send now.

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


Re: [PATCH v2 3/3] usb: musb: omap: Add device tree support for omap musb glue

2012-09-11 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Sep 11, 2012 at 3:23 PM, Vaibhav Hiremath hvaib...@ti.com wrote:


 On 9/11/2012 2:39 PM, Kishon Vijay Abraham I wrote:
 Added device tree support for omap musb driver and updated the
 Documentation with device tree binding information.

 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
  Documentation/devicetree/bindings/usb/omap-usb.txt |   33 
  drivers/usb/musb/omap2430.c|   54 
 
  2 files changed, 87 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/usb/omap-usb.txt

 diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt 
 b/Documentation/devicetree/bindings/usb/omap-usb.txt
 new file mode 100644
 index 000..29a043e
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
 @@ -0,0 +1,33 @@
 +OMAP GLUE
 +
 +OMAP MUSB GLUE
 + - compatible : Should be ti,omap4-musb or ti,omap3-musb
 + - ti,hwmods : must be usb_otg_hs
 + - multipoint : Should be 1 indicating the musb controller supports
 +   multipoint. This is a MUSB configuration-specific setting.
 + - num_eps : Specifies the number of endpoints. This is also a
 +   MUSB configuration-specific setting. Should be set to 16
 + - ram_bits : Specifies the ram address size. Should be set to 12
 + - interface_type : This is a board specific setting to describe the type of
 +   interface between the controller and the phy. It should be 0 or 1
 +   specifying ULPI and UTMI respectively.
 + - mode : Should be 3 to represent OTG. 1 signifies HOST and 2
 +   represents PERIPHERAL.
 + - power : Should be 50. This signifies the controller can supply upto
 +   100mA when operating in host mode.
 +
 +SOC specific device node entry
 +usb_otg_hs: usb_otg_hs@4a0ab000 {
 + compatible = ti,omap4-musb;
 + ti,hwmods = usb_otg_hs;
 + multipoint = 1;
 + num_eps = 16;
 + ram_bits = 12;
 +};


 reg and interrupt properties are missing here.

 I would encourage to specify reg and interrupt properties in every
 node getting newly added to the OMAP DTS files.

Sure. will add that in my next version.

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


Re: [PATCH v7 1/7] drivers: usb: phy: add a new driver for omap usb2 phy

2012-09-06 Thread ABRAHAM, KISHON VIJAY
Hi,

On Mon, Aug 6, 2012 at 6:37 PM, Kishon Vijay Abraham I kis...@ti.com wrote:
 All phy related programming like enabling/disabling the clocks, powering
 on/off the phy is taken care of by this driver. It is also used for OTG
 related functionality like srp.

 This also includes device tree support for usb2 phy driver and
 the documentation with device tree binding information is updated.

 Currently writing to control module register is taken care in this
 driver which will be removed once the control module driver is in place.

 Cc: Felipe Balbi ba...@ti.com
 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
  .../devicetree/bindings/bus/omap-ocp2scp.txt   |3 +
  Documentation/devicetree/bindings/usb/omap-usb.txt |   17 ++
  drivers/usb/phy/Kconfig|   10 +
  drivers/usb/phy/Makefile   |1 +
  drivers/usb/phy/omap-usb2.c|  271 
 
  include/linux/usb/omap_usb.h   |   46 
  include/linux/usb/phy_companion.h  |   34 +++
  7 files changed, 382 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/usb/omap-usb.txt
  create mode 100644 drivers/usb/phy/omap-usb2.c
  create mode 100644 include/linux/usb/omap_usb.h
  create mode 100644 include/linux/usb/phy_companion.h

 diff --git a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt 
 b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
 index d2fe064..bb0c7f4 100644
 --- a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
 +++ b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
 @@ -8,3 +8,6 @@ properties:

  Sub-nodes:
  All the devices connected to ocp2scp are described using sub-node to ocp2scp
 +- usb2phy :
 +   The binding details of usb2phy can be found in:
 +   Documentation/devicetree/bindings/usb/omap-usb.txt

The above two lines should be added in omap-ocp2scp.txt (this file was
added as part of omap: add ocp2scp as a bus driver and is in
linux-next). However this file is still not in Felipe's xceiv branch.
So I'm not sure how I can get this patch merged in Felipe's tree
without conflict.

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


Re: [PATCH] usb: phy: add R-Car R8A7779 USB phy driver.

2012-09-05 Thread ABRAHAM, KISHON VIJAY
Hi,

On Wed, Sep 5, 2012 at 6:20 AM, Kuninori Morimoto
kuninori.morimoto...@renesas.com wrote:

 Hi Abraham

 Thank you for checking patch


  +config USB_RCAR_PHY
  +   tristate Renesas R-Car USB phy support
  +   depends on (USB || USB_GADGET)  ARCH_R8A7779
  +   help
  + Say Y here to add support for the Renesas R-Car USB phy driver.

 Just out of curiosity, which USB contoller will/is using this PHY?

 EHCI/OHCI.
 Now, I'm using ohci/ehci-platform.c

Thats a generic ehci driver. I was interested in the specific usb
controller that uses this phy. Anyways now I know its a host only
driver :-)


  +   reg0 = ioremap_nocache(res0-start, resource_size(res0));
  +   reg1 = ioremap_nocache(res1-start, resource_size(res1));

 Instead use devm_ioremap_nocache?

 will do in v2 patch

  +   /* (1) USB-PHY standby release */
  +   iowrite32(0x0001, (reg0 + USBPCTRL1));

 Can we have some macros to define the above constant (and for the
 constants used below)?

 will do in v2 patch

  +
  +   /* (2) start USB-PHY internal PLL */
  +   iowrite32(0x0003, (reg0 + USBPCTRL1));

 No power management stuff added?? Dont we need to stop this PLL during 
 suspend??
 (snip)
 I see you are doing one time initialization of the phy during probe.
 But I think this phy will be pointless without the usb controller.
 Instead how about using the library functions like
 usb_add_phy/usb_get_phy/usb_phy_init?

 I'm not sure detail, but this usb_xxx_phy() is under otg.
 Our system don't support it, but is it normal ?

Yeah. We are in the process of cleaning it up. Indeed it's normal in
the sense quite a few host only drivers use it (ehci-fsl.c,
ehci-msm.c, ehci-mv.c, ehci-tegra.c, ohci-omap.c).

 Now, I'm using ehci/ohci-platform.
 When I support this usb_xxx_phy(), do I need to customize these drivers ?

You can't change ehci-platform.c because thats a generic driver. But
you have to do those modifications in your controller specific file.

 And, this is extra stuff, but I have 1 question.
 it is ${LINUX}/driver/usb/Makefile's order.

 obj-(xxx) += host/
 ...
 obj-(xxx) += phy/

 This means that usb phy driver probe function is called
 after host driver probe function().

AFAIK, the order in Makefile will just determine the order in which in
the files are compiled and not the order in which the modules are
loaded/probed. The module loading/probing is dependent on which
*initcall* section you've added your module to and also based on
device creation.
However if two modules add themselves to the same *initcall* section,
the order in which the files are compiled determine the order in which
the modules are probed (I think this is what is happening in your
case).

 Now, I'm using a technique which delays usb host driver registration,
 but why phy driver is called after host driver ?

Does changing the order in Makefile helped you?

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


Re: [PATCH v2] usb: phy: add R-Car USB phy driver

2012-09-05 Thread ABRAHAM, KISHON VIJAY
Hi,

On Wed, Sep 5, 2012 at 2:01 PM, Marc Kleine-Budde m...@pengutronix.de wrote:
 On 09/05/2012 10:13 AM, Kuninori Morimoto wrote:
 This patch adds Renesas R-Car USB phy driver.
 It supports R8A7779 chip at this point.

 R-Car has some USB controllers, but has only one phy-initializer.
 So, this driver is counting users.

 Signed-off-by: Kuninori Morimoto kuninori.morimoto...@renesas.com
 ---
 v1 - v2

 - enable usb_phy_xxx()
 - used subsys_initcall()

  drivers/usb/phy/Kconfig|   11 ++
  drivers/usb/phy/Makefile   |1 +
  drivers/usb/phy/rcar-phy.c |  241 
 
  3 files changed, 253 insertions(+)
  create mode 100644 drivers/usb/phy/rcar-phy.c

 diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
 index 2838adb..f55b6f6 100644
 --- a/drivers/usb/phy/Kconfig
 +++ b/drivers/usb/phy/Kconfig
 @@ -23,3 +23,14 @@ config MV_U3D_PHY
   help
 Enable this to support Marvell USB 3.0 phy controller for Marvell
 SoC.
 +
 +config USB_RCAR_PHY
 + tristate Renesas R-Car USB phy support
 + depends on (USB || USB_GADGET)  ARCH_R8A7779
 + help
 +   Say Y here to add support for the Renesas R-Car USB phy driver.
 +   This chip is typically used as USB phy for USB host, gadget.
 +   This driver supports: R8A7779
 +
 +   To compile this driver as a module, choose M here: the
 +   module will be called rcar-phy.
 diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
 index cf38f08..9af83f0 100644
 --- a/drivers/usb/phy/Makefile
 +++ b/drivers/usb/phy/Makefile
 @@ -6,3 +6,4 @@ ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG

  obj-$(CONFIG_USB_ISP1301)+= isp1301.o
  obj-$(CONFIG_MV_U3D_PHY) += mv_u3d_phy.o
 +obj-$(CONFIG_USB_RCAR_PHY)   += rcar-phy.o
 diff --git a/drivers/usb/phy/rcar-phy.c b/drivers/usb/phy/rcar-phy.c
 new file mode 100644
 index 000..2169a1a
 --- /dev/null
 +++ b/drivers/usb/phy/rcar-phy.c
 @@ -0,0 +1,241 @@
 +/*
 + * Renesas R-Car USB phy driver
 + *
 + * Copyright (C) 2012 Renesas Solutions Corp.
 + * Kuninori Morimoto kuninori.morimoto...@renesas.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */
 +
 +#include linux/delay.h
 +#include linux/io.h
 +#include linux/usb/otg.h
 +#include linux/platform_device.h
 +#include linux/spinlock.h
 +#include linux/module.h
 +
 +/* USBH common register */
 +#define USBPCTRL00x0800
 +#define USBPCTRL10x0804
 +#define USBST0x0808
 +#define USBEH0   0x080C
 +#define USBOH0   0x081C
 +#define USBCTL0  0x0858
 +#define EIIBC1   0x0094
 +#define EIIBC2   0x009C
 +
 +#ifdef CONFIG_ARCH_SUPPORTS_BIG_ENDIAN
 +# define PHY_ENDIAN BIG
 +# define PHY_NO_SWAP 0x0003
 +#else
 +# define PHY_ENDIAN LITTLE
 +# define PHY_NO_SWAP 0x
 +#endif
 +
 +/* USBPCTRL1 */
 +#define PHY_RST  (1  2)
 +#define PLL_ENB  (1  1)
 +#define PHY_ENB  (1  0)
 +
 +/* USBST */
 +#define ACT  (1  31)
 +#define PLL  (1  30)
 +
 +struct rcar_usb_phy_priv {
 + struct usb_phy phy;
 + spinlock_t lock;
 +
 + void __iomem *reg0;
 + void __iomem *reg1;
 + int counter;
 +};
 +
 +#define usb_phy_to_priv(p) container_of(p, struct rcar_usb_phy_priv, phy)
 +
 +
 +/*
 + * USB initial/install operation.
 + *
 + * This function setup USB phy.
 + * The used value and setting order came from
 + * [USB :: Initial setting] on datasheet.
 + */
 +static int rcar_usb_phy_init(struct usb_phy *phy)
 +{
 + struct rcar_usb_phy_priv *priv = usb_phy_to_priv(phy);
 + struct device *dev = phy-dev;
 + void __iomem *reg0 = priv-reg0;
 + void __iomem *reg1 = priv-reg1;
 + int i;
 + u32 val;
 + unsigned long flags;
 +
 + /  spin lock /

While at that, you can also remove the above comment and the *spin
unlocked* comment.


 + spin_lock_irqsave(priv-lock, flags);
 + if (0 == priv-counter) {
 +
 + /**
 +  * USB phy start-up
 +  **/

 nitpick: unusual coding style

 /*
  * This is the preferred
  * multi line style.
  */

 +
 + /* (1) USB-PHY standby release */
 + iowrite32(PHY_ENB, (reg0 + USBPCTRL1));
 +
 + /* (2) start USB-PHY internal PLL */
 + iowrite32(PHY_ENB | PLL_ENB, (reg0 + USBPCTRL1));
 +
 + /* (3) USB module status check */
 + for (i = 0; i  1024; i++) {
 + udelay(10);
 + val = ioread32(reg0 + USBST);
 + if ((ACT | PLL) == val)
 + goto usb_module_is_working;

 Don't use goto, unless in error handling.

 + }
 

Re: [PATCH] usb: phy: add R-Car R8A7779 USB phy driver.

2012-09-04 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Sep 4, 2012 at 10:13 AM, Kuninori Morimoto
kuninori.morimoto...@renesas.com wrote:
 This patch adds Renesas R-Car USB phy driver.
 It supports R8A7779 chip at this point.

 Signed-off-by: Kuninori Morimoto kuninori.morimoto...@renesas.com
 ---
  drivers/usb/phy/Kconfig|   11 
  drivers/usb/phy/Makefile   |1 +
  drivers/usb/phy/rcar-phy.c |  137 
 
  3 files changed, 149 insertions(+)
  create mode 100644 drivers/usb/phy/rcar-phy.c

 diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
 index 2838adb..f55b6f6 100644
 --- a/drivers/usb/phy/Kconfig
 +++ b/drivers/usb/phy/Kconfig
 @@ -23,3 +23,14 @@ config MV_U3D_PHY
 help
   Enable this to support Marvell USB 3.0 phy controller for Marvell
   SoC.
 +
 +config USB_RCAR_PHY
 +   tristate Renesas R-Car USB phy support
 +   depends on (USB || USB_GADGET)  ARCH_R8A7779
 +   help
 + Say Y here to add support for the Renesas R-Car USB phy driver.

Just out of curiosity, which USB contoller will/is using this PHY?

 + This chip is typically used as USB phy for USB host, gadget.
 + This driver supports: R8A7779
 +
 + To compile this driver as a module, choose M here: the
 + module will be called rcar-phy.
 diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
 index cf38f08..9af83f0 100644
 --- a/drivers/usb/phy/Makefile
 +++ b/drivers/usb/phy/Makefile
 @@ -6,3 +6,4 @@ ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG

  obj-$(CONFIG_USB_ISP1301)  += isp1301.o
  obj-$(CONFIG_MV_U3D_PHY)   += mv_u3d_phy.o
 +obj-$(CONFIG_USB_RCAR_PHY) += rcar-phy.o
 diff --git a/drivers/usb/phy/rcar-phy.c b/drivers/usb/phy/rcar-phy.c
 new file mode 100644
 index 000..deec078
 --- /dev/null
 +++ b/drivers/usb/phy/rcar-phy.c
 @@ -0,0 +1,137 @@
 +/*
 + * Renesas R-Car USB phy driver
 + *
 + * Copyright (C) 2012 Renesas Solutions Corp.
 + * Kuninori Morimoto kuninori.morimoto...@renesas.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */
 +
 +#include linux/delay.h
 +#include linux/io.h
 +#include linux/platform_device.h
 +#include linux/module.h
 +
 +/* USBH common register */
 +#define USBPCTRL0  0x0800
 +#define USBPCTRL1  0x0804
 +#define USBST  0x0808
 +#define USBEH0 0x080C
 +#define USBOH0 0x081C
 +#define USBCTL00x0858
 +#define EIIBC1 0x0094
 +#define EIIBC2 0x009C
 +
 +#ifdef CONFIG_ARCH_SUPPORTS_BIG_ENDIAN
 +# define PHY_ENDIAN BIG
 +# define PHY_NO_SWAP 0x0003
 +#else
 +# define PHY_ENDIAN LITTLE
 +# define PHY_NO_SWAP 0x
 +#endif
 +
 +/*
 + * USB initial/install operation.
 + *
 + * This function setup USB phy.
 + * The used value and setting order came from
 + * [USB :: Initial setting] on datasheet.
 + */
 +static int rcar_phy_probe(struct platform_device *pdev)
 +{
 +   struct resource *res0, *res1;
 +   void __iomem *reg0, *reg1;
 +   int i, ret = 0;
 +   u32 val;
 +
 +   res0 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 +   res1 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 +   if (!res0 || !res1) {
 +   dev_err(pdev-dev, Not enough platform resources\n);
 +   return -ENODEV;
 +   }
 +
 +   reg0 = ioremap_nocache(res0-start, resource_size(res0));
 +   reg1 = ioremap_nocache(res1-start, resource_size(res1));

Instead use devm_ioremap_nocache?
 +   if (!reg0 || !reg1) {
 +   dev_err(pdev-dev, ioremap error.\n);
 +   ret = -ENOMEM;
 +   goto end;
 +   }
 +
 +   /**
 +* USB phy start-up
 +**/
 +
 +   /* (1) USB-PHY standby release */
 +   iowrite32(0x0001, (reg0 + USBPCTRL1));

Can we have some macros to define the above constant (and for the
constants used below)?

 +
 +   /* (2) start USB-PHY internal PLL */
 +   iowrite32(0x0003, (reg0 + USBPCTRL1));

No power management stuff added?? Dont we need to stop this PLL during suspend??
 +
 +   /* (3) USB module status check */
 +   for (i = 0; i  1024; i++) {
 +   udelay(10);
 +   val = ioread32(reg0 + USBST);
 +   if (0xc000 == val)
 +   goto usb_module_is_working;
 +   }
 +   dev_err(pdev-dev, USB module not ready\n);
 +   ret = -EIO;
 +   goto end;
 +
 +usb_module_is_working:
 +   /* (4) USB-PHY reset clear */
 +   iowrite32(0x0007, (reg0 + USBPCTRL1));
 +
 +   /* set platform specific port settings */
 +   iowrite32(0x, (reg0 + USBPCTRL0));
 +
 +   /**
 +* EHCI IP Internal Buffer Setting
 +

Re: [PATCH 2/3] usb: otg: add device tree support to otg library

2012-09-04 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Sep 4, 2012 at 7:46 PM, Marc Kleine-Budde m...@pengutronix.de wrote:
 On 09/04/2012 04:07 PM, Richard Zhao wrote:
 +struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
 +const char *phandle)

 Since it's already a common function, we may give phandler property
 a common name too. So we will not need phandle argument.
 Please also don't forget to document the devm_xxx and dt binding.

 I don't think this is a good idea. If we hardcode the phandle name, we
 introduce a limit of one phy per usb device. The usb3 controllers
 alreadyt use two phys (one for usb2, the othere for usb3) for one
 controller. So I think we should not make the same mistake again.
 That only means current binding is not good enough. Rather not, means
 it should not be in common code.
 Maybe something like:
 usbport0-phys = phy0;
 usbport1-phys = phy1 phy2; /* usb2  usb3 */

 Granted. Do we need strings that describe the phys, like in pinctrl or
 is a index enough? What about this?

 struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
   int index)


 Comments? The phandle_name string will be usbphy.

 I don't think phandle_name should be usbphy. Eventually we want to turn
 this into a kernel-wide phy subsystem and if we use usbphy, we will just
 have to patch a bunch of dts files once we make the move.
 Coud you please give a link of kernel-wide phy subsystem discussion?

 Is just phy better?
 If the property name don't include port number, how do we know what
 port the phy is attached to?

We can use something like -phy as the phandle name. And the
users can get the phy by using
devm_usb_get_phy_by_phandle(dev, ).
(So the frwrk appends *-phy* to the name and searches). Or we don't
have any  restriction on the phandle naming conventions and search for
the phandle by the name the user passes in devm_usb_get_phy_by_phandle
directly.
Btw the regulator framework uses something like -supply and it
took me sometime to figure out the regulator phandle name should be
appended with -supply.

+   const char *phandle)

 Take this ci13xxx-imx dts snippet for example:

 usb@02184000 { /* USB OTG */
 compatible = fsl,imx6q-usb, fsl,imx27-usb;
 reg = 0x02184000 0x200;
 interrupts = 0 43 0x04;
 phy = usbphy1;
 };

 The existing fsl,usbphy will be renamed into just phy. If a usb/otg
 device needs more than one phy the dts will look like this:

 usb@02184000 { /* USB OTG */
 compatible = fsl,imx6q-usb, fsl,imx27-usb;
 reg = 0x02184000 0x200;
 interrupts = 0 43 0x04;
 phy = usbphy1 usbphy2;

Will this work? Can we return two phandles for a single phandle name?

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


Re: [PATCH 3/3] usb: gadget: s3c-hsudc: Replace 0 with NULL for pointers

2012-09-03 Thread ABRAHAM, KISHON VIJAY
Hi,

On Mon, Sep 3, 2012 at 3:48 PM, Sachin Kamat sachin.ka...@linaro.org wrote:
 Silences the following type of sparse warnings:
 warning: Using plain integer as NULL pointer

 Signed-off-by: Sachin Kamat sachin.ka...@linaro.org
 ---
  drivers/usb/gadget/s3c-hsudc.c |8 
  1 files changed, 4 insertions(+), 4 deletions(-)

 diff --git a/drivers/usb/gadget/s3c-hsudc.c b/drivers/usb/gadget/s3c-hsudc.c
 index 35cdc6a..d8e785d 100644
 --- a/drivers/usb/gadget/s3c-hsudc.c
 +++ b/drivers/usb/gadget/s3c-hsudc.c
 @@ -835,7 +835,7 @@ static struct usb_request *s3c_hsudc_alloc_request(struct 
 usb_ep *_ep,

 hsreq = kzalloc(sizeof(*hsreq), gfp_flags);
 if (!hsreq)
 -   return 0;
 +   return NULL;

shouldn't this be -ENOMEM?

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


Re: [PATCH v8 08/13] arm/dts: am33xx: Add dt data for usbss

2012-08-31 Thread ABRAHAM, KISHON VIJAY
Hi,

On Thu, Aug 30, 2012 at 4:20 PM, Ravi Babu ravib...@ti.com wrote:
 From: Ajay Kumar Gupta ajay.gu...@ti.com

 Added device tree data for usbss on am33xx. There are two musb controllers
 on am33xx platform so have port0_mode and port1_mode additional data.

 Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
 Signed-off-by: Ravi Babu ravib...@ti.com
 Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
 Signed-off-by: Ravi Babu ravib...@ti.com

One Signed-off-by: Ravi Babu would suffice :-)

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


Re: [PATCH v9 01/13] usb: musb: dsps: add phy control logic to glue

2012-08-31 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Aug 31, 2012 at 5:53 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Fri, Aug 31, 2012 at 04:39:47PM +0530, Ravi Babu wrote:
 From: Santhapuri, Damodar damodar.santhap...@ti.com

 AM335x uses NOP transceiver driver and need to enable builtin PHY
 by writing into usb_ctrl register available in system control
 module register space. This is being added at musb glue driver
 layer untill a separate system control module driver is available.

 Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
 Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
 Signed-off-by: Ravi Babu ravib...@ti.com

 Kishon, you were adding a real phy driver for OMAP's internal phy logic
 on one of your patches and I believe this will conflict with your
 changes, right ?

Indeed. My final patch of that series removes some of the functions
from omap_phy_internal.c (which was taken care in the phy driver).

 How does this look to you ? Is this at least correct ? I suppose the
 correct way would be to actually have the system control module driver
 which we have been waiting, right ?

Correct. I think once we have the system control module driver in
place, we'll have everything wrt control module register writes
implemented in correct way.

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


Re: [PATCH v9 01/13] usb: musb: dsps: add phy control logic to glue

2012-08-31 Thread ABRAHAM, KISHON VIJAY
On Fri, Aug 31, 2012 at 6:49 PM, Felipe Balbi ba...@ti.com wrote:
 On Fri, Aug 31, 2012 at 06:51:04PM +0530, ABRAHAM, KISHON VIJAY wrote:
 Hi,

 On Fri, Aug 31, 2012 at 5:53 PM, Felipe Balbi ba...@ti.com wrote:
  Hi,
 
  On Fri, Aug 31, 2012 at 04:39:47PM +0530, Ravi Babu wrote:
  From: Santhapuri, Damodar damodar.santhap...@ti.com
 
  AM335x uses NOP transceiver driver and need to enable builtin PHY
  by writing into usb_ctrl register available in system control
  module register space. This is being added at musb glue driver
  layer untill a separate system control module driver is available.
 
  Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
  Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
  Signed-off-by: Ravi Babu ravib...@ti.com
 
  Kishon, you were adding a real phy driver for OMAP's internal phy logic
  on one of your patches and I believe this will conflict with your
  changes, right ?

 Indeed. My final patch of that series removes some of the functions
 from omap_phy_internal.c (which was taken care in the phy driver).
 
  How does this look to you ? Is this at least correct ? I suppose the
  correct way would be to actually have the system control module driver
  which we have been waiting, right ?

 Correct. I think once we have the system control module driver in
 place, we'll have everything wrt control module register writes
 implemented in correct way.

 So $SUBJECT will pretty much be thrown away once we have SCM driver, in
 that case it's best to wait a bit longer and apply this series once SCM
 driver is available and after your series too... you agree ?

Yes. That would be better.

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


Re: [PATCH 2/3] usb: otg: add device tree support to otg library

2012-08-28 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Aug 28, 2012 at 7:11 PM, Marc Kleine-Budde m...@pengutronix.de wrote:
 On 08/24/2012 08:46 AM, Richard Zhao wrote:
 [...]
  /**
 + * devm_usb_get_phy_by_phandle - find the USB PHY by phandle
 + * @dev - device that requests this phy
 + * @phandle - name of the property holding the phy phandle value
 + *
 + * Returns the phy driver associated with the given phandle value,
 + * after getting a refcount to it, -ENODEV if there is no such phy or
 + * -EPROBE_DEFER if there is a phandle to the phy, but the device is
 + * not yet loaded. While at that, it also associates the device with
 + * the phy using devres. On driver detach, release function is invoked
 + * on the devres data, then, devres data is freed.
 + *
 + * For use by USB host and peripheral drivers.
 + */
 +struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
 +const char *phandle)

 Since it's already a common function, we may give phandler property
 a common name too. So we will not need phandle argument.
 Please also don't forget to document the devm_xxx and dt binding.

 I don't think this is a good idea. If we hardcode the phandle name, we
 introduce a limit of one phy per usb device. The usb3 controllers
 alreadyt use two phys (one for usb2, the othere for usb3) for one
 controller. So I think we should not make the same mistake again.

 +{
 +struct usb_phy  *phy = NULL, **ptr;
 +unsigned long   flags;
 +struct device_node *node;
 +
 +if (!dev-of_node) {
 +dev_dbg(dev, device does not have a device node entry\n);
 +return ERR_PTR(-EINVAL);
 +}
 +
 +node = of_parse_phandle(dev-of_node, phandle, 0);
 +if (!node) {
 +dev_dbg(dev, failed to get %s phandle in %s node\n, phandle,
 +dev-of_node-full_name);
 +return ERR_PTR(-ENODEV);
 +}
 +
 +ptr = devres_alloc(devm_usb_phy_release, sizeof(*ptr), GFP_KERNEL);
 +if (!ptr) {
 +dev_dbg(dev, failed to allocate memory for devres\n);
 +return ERR_PTR(-ENOMEM);
 +}
 +
 +spin_lock_irqsave(phy_lock, flags);
 +
 +phy = __of_usb_find_phy(phy_list, node);
 +if (IS_ERR(phy) || !try_module_get(phy-dev-driver-owner)) {
 +phy = ERR_PTR(-EPROBE_DEFER);
 +devres_free(ptr);
 +goto err0;
 +}
 +
 +*ptr = phy;
 +devres_add(dev, ptr);
 +
 +get_device(phy-dev);
 +
 +err0:
 +spin_unlock_irqrestore(phy_lock, flags);
 +
 +return phy;
 +}
 +EXPORT_SYMBOL(devm_usb_get_phy_by_phandle);
 +
 +/**
   * devm_usb_put_phy - release the USB PHY
   * @dev - device that wants to release this phy
   * @phy - the phy returned by devm_usb_get_phy()
 @@ -158,32 +234,24 @@ EXPORT_SYMBOL(usb_put_phy);
   */
  int usb_add_phy(struct usb_phy *x, enum usb_phy_type type)
  {
 -int ret = 0;
  unsigned long   flags;
  struct usb_phy  *phy;

 -if (x  x-type != USB_PHY_TYPE_UNDEFINED) {
 -dev_err(x-dev, not accepting initialized PHY %s\n, 
 x-label);
 -return -EINVAL;

how about having
if (x  !x-dev.of_node  x-type != USB_PHY_TYPE_UNDEFINED) {
dev_err(x-dev, not accepting initialized PHY %s\n, x-label);
return -EINVAL;
}

By using this we'll return error if the phy device does not have an
of_node. (So it can't get back the phy by phandle).

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


Re: [PATCH 3/3] usb: mxs-phy: register phy as USB_PHY_TYPE_USB2

2012-08-27 Thread ABRAHAM, KISHON VIJAY
Hi,

On Mon, Aug 27, 2012 at 12:55 PM, Richard Zhao
richard.z...@freescale.com wrote:
 On Mon, Aug 27, 2012 at 11:04:58AM +0530, ABRAHAM, KISHON VIJAY wrote:
 Hi,

 On Sat, Aug 25, 2012 at 3:33 PM, Marc Kleine-Budde m...@pengutronix.de 
 wrote:
  On 08/24/2012 08:51 AM, Richard Zhao wrote:
  On Thu, Aug 23, 2012 at 07:22:54PM +0200, Marc Kleine-Budde wrote:
  This patch registers the msx-phy as an USB_PHY_TYPE_USB2. This is needed 
  to get
  reference to the phy with devm_usb_get_phy_by_phandle(), which will be 
  added in
  a later patch.
 
  Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
  ---
   drivers/usb/otg/mxs-phy.c |5 -
   1 file changed, 4 insertions(+), 1 deletion(-)
 
  diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c
  index c1a67cb..240b945 100644
  --- a/drivers/usb/otg/mxs-phy.c
  +++ b/drivers/usb/otg/mxs-phy.c
  @@ -141,11 +141,14 @@ static int mxs_phy_probe(struct platform_device 
  *pdev)
 
   platform_set_drvdata(pdev, mxs_phy-phy);
 
  -return 0;
  +return usb_add_phy(mxs_phy-phy, USB_PHY_TYPE_USB2);
  Why is it usb2? It's kind of USB_PHY_TYPE_DT.
 
  For now there is USB_PHY_TYPE_USB2, USB_PHY_TYPE_USB3 and undefined. On
  the one hand it's an USB2 type phy on the other the type is not relevant
  if you get the phy by a phandle. I think it should be USB2. Kishon, what
  do you think?

 IMHO, USB_PHY_TYPE_DT does not qualify to be a phy type.
 USB_PHY_TYPE_USB2 makes more sense to me.
 Why is USB_PHY_TYPE_USB2 better? It might not be attached to usb2.
 undefined may be better, if it's not used to check re-initialization.

What I meant is, the type should be something that qualifies the phy
ip. For example, USB_PHY_TYPE_USB2 specifies a phy that connects to a
usb2/usb3 controller to provide usb2 functionality. If a specific type
of phy can't be qualified with a type (which ideally shouldn't be the
case), UNDEFINED can be used.

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


Re: [PATCH 2/3] usb: otg: add device tree support to otg library

2012-08-26 Thread ABRAHAM, KISHON VIJAY
Hi,

On Sat, Aug 25, 2012 at 11:43 PM, Marc Kleine-Budde m...@pengutronix.de wrote:
 On 08/24/2012 08:46 AM, Richard Zhao wrote:
 Did you try both enableing and disabing DT pass build?

 Impossible on mx28 :) The platform always selects USE_DT, but on imx it
 builds without DT support.

 On Thu, Aug 23, 2012 at 07:22:53PM +0200, Marc Kleine-Budde wrote:
 From: Kishon Vijay Abraham I kis...@ti.com

 This patch adds an API to get usb phy by passing a device node phandle 
 value.
 The new added devm_usb_get_phy_by_phandle() function will return a pointer 
 to
 the phy on success, -EPROBE_DEFER if there is a device_node for the phandle,
 but the phy has not been added, or a ERR_PTR() otherwise.

 Since it's possible to obtain a phy by phandle, the checks in usb_add_phy() 
 for
 a valid phy type is removed (now it's just a debug message if a user tries 
 to
 add a phy with undefined type). This also allows to add multiple phys of 
 same
 type.

 Cc: Richard Zhao richard.z...@freescale.com
 Cc: Marek Vasut ma...@denx.de
 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
 ---
  drivers/usb/otg/otg.c   |   96 
 ---
  include/linux/usb/otg.h |8 
  2 files changed, 90 insertions(+), 14 deletions(-)

 diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c
 index 98c430e..23618de 100644
 --- a/drivers/usb/otg/otg.c
 +++ b/drivers/usb/otg/otg.c
 @@ -15,6 +15,7 @@
  #include linux/device.h
  #include linux/module.h
  #include linux/slab.h
 +#include linux/of.h

  #include linux/usb/otg.h

 @@ -36,6 +37,21 @@ static struct usb_phy *__usb_find_phy(struct list_head 
 *list,
  return ERR_PTR(-ENODEV);
  }

 +static struct usb_phy *__of_usb_find_phy(struct list_head *list,
 +struct device_node *node)
 +{
 +struct usb_phy  *phy;
 +
 +list_for_each_entry(phy, list, head) {
 +if (node != phy-dev-of_node)
 +continue;
 +
 +return phy;
 +}
 +
 +return ERR_PTR(-ENODEV);
 +}
 +
  static void devm_usb_phy_release(struct device *dev, void *res)
  {
  struct usb_phy *phy = *(struct usb_phy **)res;
 @@ -112,6 +128,66 @@ err0:
  EXPORT_SYMBOL(usb_get_phy);

  /**
 + * devm_usb_get_phy_by_phandle - find the USB PHY by phandle
 + * @dev - device that requests this phy
 + * @phandle - name of the property holding the phy phandle value
 + *
 + * Returns the phy driver associated with the given phandle value,
 + * after getting a refcount to it, -ENODEV if there is no such phy or
 + * -EPROBE_DEFER if there is a phandle to the phy, but the device is
 + * not yet loaded. While at that, it also associates the device with
 + * the phy using devres. On driver detach, release function is invoked
 + * on the devres data, then, devres data is freed.
 + *
 + * For use by USB host and peripheral drivers.
 + */
 +struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
 +const char *phandle)

 Since it's already a common function, we may give phandler property
 a common name too. So we will not need phandle argument.
 Please also don't forget to document the devm_xxx and dt binding.

 Good point. This is the device tree snippet from imx28.dtsi:

 usb0: usb@8008 {
 compatible = fsl,imx28-usb, fsl,imx27-usb;
 reg = 0x8008 0x1;
 interrupts = 93;
 fsl,usbphy = usbphy0;
   

 What about removing the fsl,, so it just would be usbphy.

 status = disabled;
 };

 +{
 +struct usb_phy  *phy = NULL, **ptr;
 +unsigned long   flags;
 +struct device_node *node;
 +
 +if (!dev-of_node) {
 +dev_dbg(dev, device does not have a device node entry\n);
 +return ERR_PTR(-EINVAL);
 +}
 +
 +node = of_parse_phandle(dev-of_node, phandle, 0);
 +if (!node) {
 +dev_dbg(dev, failed to get %s phandle in %s node\n, phandle,
 +dev-of_node-full_name);
 +return ERR_PTR(-ENODEV);
 +}
 +
 +ptr = devres_alloc(devm_usb_phy_release, sizeof(*ptr), GFP_KERNEL);
 +if (!ptr) {
 +dev_dbg(dev, failed to allocate memory for devres\n);
 +return ERR_PTR(-ENOMEM);
 +}
 +
 +spin_lock_irqsave(phy_lock, flags);
 +
 +phy = __of_usb_find_phy(phy_list, node);
 +if (IS_ERR(phy) || !try_module_get(phy-dev-driver-owner)) {
 +phy = ERR_PTR(-EPROBE_DEFER);
 +devres_free(ptr);
 +goto err0;
 +}
 +
 +*ptr = phy;
 +devres_add(dev, ptr);
 +
 +get_device(phy-dev);
 +
 +err0:
 +spin_unlock_irqrestore(phy_lock, flags);
 +
 +return phy;
 +}
 +EXPORT_SYMBOL(devm_usb_get_phy_by_phandle);
 +
 +/**
   * devm_usb_put_phy - release the USB PHY
   * @dev - device that wants to release this phy
   * @phy - the phy returned by devm_usb_get_phy()
 @@ -158,32 +234,24 @@ EXPORT_SYMBOL(usb_put_phy);
   */
  int 

Re: [PATCH 3/3] usb: mxs-phy: register phy as USB_PHY_TYPE_USB2

2012-08-26 Thread ABRAHAM, KISHON VIJAY
Hi,

On Sat, Aug 25, 2012 at 3:33 PM, Marc Kleine-Budde m...@pengutronix.de wrote:
 On 08/24/2012 08:51 AM, Richard Zhao wrote:
 On Thu, Aug 23, 2012 at 07:22:54PM +0200, Marc Kleine-Budde wrote:
 This patch registers the msx-phy as an USB_PHY_TYPE_USB2. This is needed to 
 get
 reference to the phy with devm_usb_get_phy_by_phandle(), which will be 
 added in
 a later patch.

 Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
 ---
  drivers/usb/otg/mxs-phy.c |5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

 diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c
 index c1a67cb..240b945 100644
 --- a/drivers/usb/otg/mxs-phy.c
 +++ b/drivers/usb/otg/mxs-phy.c
 @@ -141,11 +141,14 @@ static int mxs_phy_probe(struct platform_device *pdev)

  platform_set_drvdata(pdev, mxs_phy-phy);

 -return 0;
 +return usb_add_phy(mxs_phy-phy, USB_PHY_TYPE_USB2);
 Why is it usb2? It's kind of USB_PHY_TYPE_DT.

 For now there is USB_PHY_TYPE_USB2, USB_PHY_TYPE_USB3 and undefined. On
 the one hand it's an USB2 type phy on the other the type is not relevant
 if you get the phy by a phandle. I think it should be USB2. Kishon, what
 do you think?

IMHO, USB_PHY_TYPE_DT does not qualify to be a phy type.
USB_PHY_TYPE_USB2 makes more sense to me.

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


Re: [PATCH] usb otg: TWL4030_USB depends on USB_MUSB_OMAP2PLUS in Kconfig

2012-08-24 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Aug 24, 2012 at 12:57 PM, Felipe Balbi ba...@ti.com wrote:
 On Thu, Aug 23, 2012 at 10:38:44PM +0200, Peter Meerwald wrote:
 Signed-off-by: Peter Meerwald pme...@pmeerw.net

 I need a commit log explaining why we need to add this extra depend ;-)

 ---
  drivers/usb/otg/Kconfig |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig
 index 13fd1ddf..fefca18 100644
 --- a/drivers/usb/otg/Kconfig
 +++ b/drivers/usb/otg/Kconfig
 @@ -58,7 +58,7 @@ config USB_ULPI_VIEWPORT

  config TWL4030_USB
   tristate TWL4030 USB Transceiver Driver
 - depends on TWL4030_CORE  REGULATOR_TWL4030
 + depends on TWL4030_CORE  REGULATOR_TWL4030  USB_MUSB_OMAP2PLUS

Can you add this for twl6030 also?

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


Re: [PATCH 2/5] usb: gadget: s3c2410_udc: Use pr_* functions

2012-08-22 Thread ABRAHAM, KISHON VIJAY
Hi,

On Wed, Aug 22, 2012 at 11:13 AM, Sachin Kamat sachin.ka...@linaro.org wrote:
 Replace printk with corresponding pr_* functions.

 Signed-off-by: Sachin Kamat sachin.ka...@linaro.org
 ---
  drivers/usb/gadget/s3c2410_udc.c |   12 +++-
  1 files changed, 7 insertions(+), 5 deletions(-)

 diff --git a/drivers/usb/gadget/s3c2410_udc.c 
 b/drivers/usb/gadget/s3c2410_udc.c
 index 7acecc0..7e2ce44 100644
 --- a/drivers/usb/gadget/s3c2410_udc.c
 +++ b/drivers/usb/gadget/s3c2410_udc.c
 @@ -12,6 +12,8 @@
   * (at your option) any later version.
   */

 +#define pr_fmt(fmt) s3c2410_udc:  fmt
 +

Is this a stray change? I dont see pr_fmt being used anywhere in this patch..

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


Re: linux 3.6-rc2, undefined reference to omap_musb_mailbox

2012-08-20 Thread ABRAHAM, KISHON VIJAY
Hi,

On Mon, Aug 20, 2012 at 3:24 PM, Felipe Balbi ba...@ti.com wrote:
 On Mon, Aug 20, 2012 at 11:06:34AM +0530, ABRAHAM, KISHON VIJAY wrote:
 Hi,

 On Sat, Aug 18, 2012 at 9:34 PM, Peter Meerwald pme...@pmeerw.net wrote:
 
  3.6-rc2 fails to compile with
  CONFIG_USB_MUSB_HDRC=m
  CONFIG_USB_MUSB_OMAP2PLUS=m
 
LD  init/built-in.o
  drivers/built-in.o: In function `twl4030_usb_irq':
  /home/pmeerw/linux-3.6-rc2/drivers/usb/otg/twl4030-usb.c:518: undefined 
  reference to `omap_musb_mailbox'
  drivers/built-in.o: In function `twl4030_usb_phy_init':
  /home/pmeerw/linux-3.6-rc2/drivers/usb/otg/twl4030-usb.c:540: undefined 
  reference to `omap_musb_mailbox'

 Having TWL4030_USB as a module will get rid of this.
 I'll see how this can be resolved when some modules are *built-in* and
 some are made as *modules*.

 EXPORT_SYMBOL_GPL() should sort that out, right ?

No :-( I already have EXPORT_SYMBOL_GPL() in omap2430.c.

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


Re: linux 3.6-rc2, undefined reference to omap_musb_mailbox

2012-08-20 Thread ABRAHAM, KISHON VIJAY
Hi,

On Mon, Aug 20, 2012 at 3:56 PM, Felipe Balbi ba...@ti.com wrote:
 On Mon, Aug 20, 2012 at 03:46:07PM +0530, ABRAHAM, KISHON VIJAY wrote:
 Hi,

 On Mon, Aug 20, 2012 at 3:24 PM, Felipe Balbi ba...@ti.com wrote:
  On Mon, Aug 20, 2012 at 11:06:34AM +0530, ABRAHAM, KISHON VIJAY wrote:
  Hi,
 
  On Sat, Aug 18, 2012 at 9:34 PM, Peter Meerwald pme...@pmeerw.net wrote:
  
   3.6-rc2 fails to compile with
   CONFIG_USB_MUSB_HDRC=m
   CONFIG_USB_MUSB_OMAP2PLUS=m
  
 LD  init/built-in.o
   drivers/built-in.o: In function `twl4030_usb_irq':
   /home/pmeerw/linux-3.6-rc2/drivers/usb/otg/twl4030-usb.c:518: undefined 
   reference to `omap_musb_mailbox'
   drivers/built-in.o: In function `twl4030_usb_phy_init':
   /home/pmeerw/linux-3.6-rc2/drivers/usb/otg/twl4030-usb.c:540: undefined 
   reference to `omap_musb_mailbox'
 
  Having TWL4030_USB as a module will get rid of this.
  I'll see how this can be resolved when some modules are *built-in* and
  some are made as *modules*.
 
  EXPORT_SYMBOL_GPL() should sort that out, right ?

 No :-( I already have EXPORT_SYMBOL_GPL() in omap2430.c.

 I see you're missing an extern on the function prototype (on the
 header). Not sure how modules.dep is generated, but maybe it needs the
 extern there. Can you check it out ?

That isn't helping either.

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


Re: linux 3.6-rc2, undefined reference to omap_musb_mailbox

2012-08-19 Thread ABRAHAM, KISHON VIJAY
Hi,

On Sat, Aug 18, 2012 at 9:34 PM, Peter Meerwald pme...@pmeerw.net wrote:

 3.6-rc2 fails to compile with
 CONFIG_USB_MUSB_HDRC=m
 CONFIG_USB_MUSB_OMAP2PLUS=m

   LD  init/built-in.o
 drivers/built-in.o: In function `twl4030_usb_irq':
 /home/pmeerw/linux-3.6-rc2/drivers/usb/otg/twl4030-usb.c:518: undefined 
 reference to `omap_musb_mailbox'
 drivers/built-in.o: In function `twl4030_usb_phy_init':
 /home/pmeerw/linux-3.6-rc2/drivers/usb/otg/twl4030-usb.c:540: undefined 
 reference to `omap_musb_mailbox'

Having TWL4030_USB as a module will get rid of this.
I'll see how this can be resolved when some modules are *built-in* and
some are made as *modules*.

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


Re: [PATCH 2/9] scripts/modpost: add a exception for USB gadget drivers

2012-08-16 Thread ABRAHAM, KISHON VIJAY
Hi Sebastian,

On Thu, Aug 16, 2012 at 1:29 AM, Sebastian Andrzej Siewior
bige...@linutronix.de wrote:
 The driver struct for a gadget driver is named *_driver. On module
 load, the gadget expects a UDC driver to be loaded and avaiable. If this
 is not the case = -ENODEV and bye bye. That means that the gadget
Will this be taken care of in your future series (with configfs?).
There might be cases when your gadget driver gets loaded before the
UDC driver.

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


Re: [PATCH 2/9] scripts/modpost: add a exception for USB gadget drivers

2012-08-16 Thread ABRAHAM, KISHON VIJAY
On Thu, Aug 16, 2012 at 6:33 PM, Felipe Balbi ba...@ti.com wrote:
 On Thu, Aug 16, 2012 at 06:35:07PM +0530, ABRAHAM, KISHON VIJAY wrote:
 Hi Sebastian,

 On Thu, Aug 16, 2012 at 1:29 AM, Sebastian Andrzej Siewior
 bige...@linutronix.de wrote:
  The driver struct for a gadget driver is named *_driver. On module
  load, the gadget expects a UDC driver to be loaded and avaiable. If this
  is not the case = -ENODEV and bye bye. That means that the gadget
 Will this be taken care of in your future series (with configfs?).
 There might be cases when your gadget driver gets loaded before the
 UDC driver.

 with configfs that won't be a problem because even though function
 drivers are loaded, they won't bind to any controller until we tell them
 to through configfs. IOW, functions will only bind to UDCs after we
 assign them to a particular usb interface through configfs.

Ok. Makes sense..

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


Re: [PATCH v4 1/5] usb: phy: samsung: Introducing usb phy driver for hsotg

2012-08-10 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Aug 10, 2012 at 12:40 PM, Praveen Paneri p.pan...@samsung.com wrote:
 This driver uses usb_phy interface to interact with s3c-hsotg. Supports
 phy_init and phy_shutdown functions to enable/disable phy. Tested with
 smdk6410 and smdkv310. More SoCs can be brought under later.

 Signed-off-by: Praveen Paneri p.pan...@samsung.com
 Acked-by: Heiko Stuebner he...@sntech.de
 ---
  .../devicetree/bindings/usb/samsung-usbphy.txt |9 +
  drivers/usb/phy/Kconfig|8 +
  drivers/usb/phy/Makefile   |1 +
  drivers/usb/phy/samsung-usbphy.c   |  345 
 
  drivers/usb/phy/samsung-usbphy.h   |   48 +++
  include/linux/platform_data/samsung-usbphy.h   |   27 ++
  6 files changed, 438 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/usb/samsung-usbphy.txt
  create mode 100644 drivers/usb/phy/samsung-usbphy.c
  create mode 100644 drivers/usb/phy/samsung-usbphy.h
  create mode 100644 include/linux/platform_data/samsung-usbphy.h

 diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt 
 b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 new file mode 100644
 index 000..fefd9c8
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt
 @@ -0,0 +1,9 @@
 +* Samsung's usb phy transceiver
 +
 +The Samsung's phy transceiver is used for controlling usb otg phy for
 +s3c-hsotg usb device controller.
 +
 +Required properties:
 +- compatible : should be samsung,exynos4210-usbphy
 +- reg : base physical address of the phy registers and length of memory 
 mapped
 +   region.
 diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
 index e7cf84f..d916477 100644
 --- a/drivers/usb/phy/Kconfig
 +++ b/drivers/usb/phy/Kconfig
 @@ -15,3 +15,11 @@ config USB_ISP1301

   To compile this driver as a module, choose M here: the
   module will be called isp1301.
 +
 +config SAMSUNG_USBPHY
 +   bool Samsung USB PHY controller Driver
 +   depends on USB_S3C_HSOTG
 +   select USB_OTG_UTILS
 +   help
 + Enable this to support Samsung USB phy controller for samsung
 + SoCs.
 diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
 index eca095b..dfca70d 100644
 --- a/drivers/usb/phy/Makefile
 +++ b/drivers/usb/phy/Makefile
 @@ -5,3 +5,4 @@
  ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG

  obj-$(CONFIG_USB_ISP1301)  += isp1301.o
 +obj-$(CONFIG_SAMSUNG_USBPHY)   += samsung-usbphy.o
 diff --git a/drivers/usb/phy/samsung-usbphy.c 
 b/drivers/usb/phy/samsung-usbphy.c
 new file mode 100644
 index 000..739b6c9
 --- /dev/null
 +++ b/drivers/usb/phy/samsung-usbphy.c
 @@ -0,0 +1,345 @@
 +/* linux/drivers/usb/phy/samsung-usbphy.c
 + *
 + * Copyright (c) 2012 Samsung Electronics Co., Ltd.
 + *  http://www.samsung.com
 + *
 + * Author: Praveen Paneri p.pan...@samsung.com
 + *
 + * Samsung USB2.0 High-speed OTG transceiver, talks to S3C HS OTG controller
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

I suggest you drop that last paragraph unless you want to keep track
of Free Software Foundation office. Right now it is 51 Franklin
Street, Boston (http://www.fsf.org/about/contact/) :-)

-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


Re: [RFC/PATCH 4/4] usb: dwc3: add basic PHY support

2012-08-09 Thread ABRAHAM, KISHON VIJAY
Hi Felipe,

Other patches in this series looks fine. Have a few minor comments for
this patch.

On Thu, Aug 9, 2012 at 8:54 PM, Felipe Balbi ba...@ti.com wrote:
 this will let us control PHYs on platforms which
 need them.

 Signed-off-by: Felipe Balbi ba...@ti.com
 ---
  drivers/usb/dwc3/core.c | 15 +++
  drivers/usb/dwc3/core.h |  5 +
  2 files changed, 20 insertions(+)

 diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
 index c34452a..7df7331 100644
 --- a/drivers/usb/dwc3/core.c
 +++ b/drivers/usb/dwc3/core.c
 @@ -50,6 +50,7 @@
  #include linux/dma-mapping.h
  #include linux/of.h

 +#include linux/usb/otg.h
  #include linux/usb/ch9.h
  #include linux/usb/gadget.h

 @@ -136,6 +137,8 @@ static void dwc3_core_soft_reset(struct dwc3 *dwc)
 reg |= DWC3_GUSB2PHYCFG_PHYSOFTRST;
 dwc3_writel(dwc-regs, DWC3_GUSB2PHYCFG(0), reg);

 +   usb_phy_init(dwc-usb2_phy);
 +   usb_phy_init(dwc-usb3_phy);
 mdelay(100);

 /* Clear USB3 PHY reset */
 @@ -465,6 +468,18 @@ static int __devinit dwc3_probe(struct platform_device 
 *pdev)
 return -ENOMEM;
 }

 +   dwc-usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
 +   if (!dwc-usb2_phy) {
This should be IS_ERR_OR_NULL..

 +   dev_err(dev, no usb2 phy configured\n);
 +   return -ENODEV;
We should return -EPROBE_DEFER so that it works fine if the phy's are
getting created a little later in the boot sequence.
 +   }
 +
 +   dwc-usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
 +   if (!dwc-usb3_phy) {
 +   dev_err(dev, no usb3 phy configured\n);
 +   return -ENODEV;
 +   }
Same comments as above for usb3 also.

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


Re: [PATCH v6 00/11] omap: musb: Add device tree support

2012-08-06 Thread ABRAHAM, KISHON VIJAY
On Mon, Aug 6, 2012 at 2:22 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Mon, Jul 30, 2012 at 02:39:49PM +0530, Kishon Vijay Abraham I wrote:
 This patch series adds device tree support for MUSB and device
 tree support for all the related modules to get MUSB working in
 OMAP platform.

 A new omap-usb2 phy driver has been added (with only dt suppport)
 to perform phy configurations. Previously this configuration was
 performed by twl6030, using pdata function pointers.

 With the addition of omap-usb2 to perform phy configurations,
 twl6030 is made as a comparator driver to detect VBUS and ID events
 and notify it to the glue layer.

 musb core is _NOT_ yet converted to support device tree support as it
 would need lot of driver re-design because of its enormous use of
 function pointers. That will be in _TO DO_ list.

 Changes from v5:
 minor cleanups like checking for return value in get_sync and few changes
 in the documentation has been done.

 Changes from v4:
 duplicate getting of 'mode' property is removed in omap-musb glue.

 Changes from v3:
 remove the address in the node name of usb_otg_hs since the usb_otg_hs
 node doesn't have a reg property. Thanks Ajay Gupta for finding this.

 Changes from v2:
 Fixed Sergei's comment to remove *0x* prefix in usb2phy@0x4a0ad080

 Changes from v1:
 * Fixed Rajendra Nayak comments (regulator naming, compatible naming of
 musb and other minor cleanups.)
 * It's agreed to have ocp2scp in drivers/bus and usb2 phy is a child of
 ocp2scp, the documentation is updated accordingly.

 Changes from RFC:
 Removed the dependency on [RFC PATCH 00/11] OMAP System Control Module.
 Writing to control module register is now handled in otg driver itself.
 Once the system control module driver get upstreamed, I'll send a patch
 to make use of API's in control module driver to write to control
 module register.

 This series was developed on
 git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git xceiv

 This patch series depends on
 [PATCH 0/2] omap: add ocp2scp as a bus driver

 Performed MUSB device mode testing on OMAP4 panda, OMAP4 SDP
 and OMAP3 beagle.

 Kishon Vijay Abraham I (11):
   drivers: usb: otg: add a new driver for omap usb2 phy
   arm/dts: omap: Add omap-usb2 dt data
   drivers: usb: otg: make twl6030_usb as a comparator driver to
 omap_usb2
   arm: omap: hwmod: add a new addr space in otg for writing to control
 module
   drivers: usb: twl6030: Add dt support for twl6030 usb
   arm/dts: Add twl6030-usb data
   drivers: usb: twl4030: Add device tree support for twl4030 usb
   arm/dts: Add twl4030-usb data
   drivers: usb: musb: Add device tree support for omap musb glue
   arm/dts: omap: Add usb_otg and glue data
   arm: omap: phy: remove unused functions from omap-phy-internal.c

 When you send your next series, can you please split the stuff based on
 their dependencies or at least note here what depends on what ? I mean,
 I cannot take the DT patches without an Acked-by Grant and Tony, but the
 drivers themselves I could take queue them since they're already in good
 shape ;-)

 Maybe just start the series with patches without dependencies on one
 another, and the rest of the series would be ones that need to go
 together, or something. That'll help me ;-)

Ok Felipe.

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


Re: [PATCH v6 01/11] drivers: usb: otg: add a new driver for omap usb2 phy

2012-08-06 Thread ABRAHAM, KISHON VIJAY
Hi Felipe,

On Mon, Aug 6, 2012 at 2:19 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Fri, Aug 03, 2012 at 08:01:44PM +0530, ABRAHAM, KISHON VIJAY wrote:
  + return 0;
  +}
  +
  +#ifdef CONFIG_PM_RUNTIME
  +
  +static int omap_usb2_runtime_suspend(struct device *dev)
  +{
  + struct platform_device  *pdev = to_platform_device(dev);
  + struct omap_usb *phy = platform_get_drvdata(pdev);
  +
  + clk_disable(phy-wkupclk);
 
  weird. I would expect the wakeup clock to be enabled on suspend and
  disabled on resume. Isn't this causing any unbalanced disable warnings ?

 Even I was expecting the wakeup clock to be enabled on suspend but if
 we have this enabled coreaon domain is never
 gated and core does not hit low power state. btw Why do think this is
 unbalanced?

 because you never do a clk_enable() on probe(), so on your first
 suspend, you will disable the clock without having enabled it before,
 no? Unless pm_runtime forces a runtime_resume() when you call
 pm_runtime_enable()...

  +static int omap_usb2_runtime_resume(struct device *dev)
  +{
  + u32 ret = 0;
  + struct platform_device  *pdev = to_platform_device(dev);
  + struct omap_usb *phy = platform_get_drvdata(pdev);
  +
  + ret = clk_enable(phy-wkupclk);
  + if (ret  0)
  + dev_err(phy-dev, Failed to enable wkupclk %d\n, ret);
  +
  + return ret;
  +}
  +
  +static const struct dev_pm_ops omap_usb2_pm_ops = {
  + SET_RUNTIME_PM_OPS(omap_usb2_runtime_suspend, 
  omap_usb2_runtime_resume,
  + NULL)
 
  only runtime ? What about static suspend ? We need this to work also
  after a traditional echo mem  /sys/power/state ;-)

 The static suspend case is handled by users of this phy using
 set_suspend hooks.

 I'm not sure if that's too wise, what if your user enabled USB, but
 for whatever reason loaded only the phy driver and not musb or dwc3. It
 will fail, right ?

The enabling and disabling of phy is solely governed by usb controller
driver (musb/dwc3). So if you dont have musb/dwc3 loaded, the phy will
be for sure disabled.

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


Re: [PATCH 2/2] OMAP4: otg: phy: remove uggly mdelay(200)

2012-08-03 Thread ABRAHAM, KISHON VIJAY
Hi,

On Thu, Jul 5, 2012 at 2:12 PM, Ruslan Bilovol ruslan.bilo...@ti.com wrote:
 The original issue with powering on the PHY (and using
 200 ms delay after this) is not related to internal
 processes in the PHY but is in the incorrect charger
 detection feature usage.

 Now when it is fixed, we can safely remove this uggly

So is this 200ms delay related to incorrect charger detection? How is
it now fixed without the delay?

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


Re: [PATCH v6 03/11] drivers: usb: otg: make twl6030_usb as a comparator driver to omap_usb2

2012-08-03 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Aug 3, 2012 at 6:58 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Mon, Jul 30, 2012 at 02:39:52PM +0530, Kishon Vijay Abraham I wrote:
 All the PHY configuration other than VBUS, ID GND and OTG SRP are removed
 from twl6030. The phy configurations are taken care by the dedicated
 usb2 phy driver. So twl6030 is made as comparator driver for VBUS and
 ID detection.

 Writing to control module which is now handled in omap2430.c should be
 removed once a driver for control module is in place.

 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com

 This looks good for the time being. Do you think it has any hard
 dependencies on your new phy drivers, or can I apply this without those
 other patches ??

It has a hard dependency on usb2phy driver.

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


Re: [PATCH v6 04/11] arm: omap: hwmod: add a new addr space in otg for writing to control module

2012-08-03 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Aug 3, 2012 at 6:59 PM, Felipe Balbi ba...@ti.com wrote:
 On Mon, Jul 30, 2012 at 02:39:53PM +0530, Kishon Vijay Abraham I wrote:
 The mailbox register for usb otg in omap is present in control module.
 On detection of any events VBUS or ID, this register should be written
 to send the notification to musb core.

 Till we have a separate control module driver to write to control module,
 omap2430 will handle the register writes to control module by itself. So
 a new address space to represent this control module register is added
 to usb_otg_hs.

 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com

 this should come before previous patch, right ? Otherwise we will try to
 ioremap a resource which isn't passed down to driver. No ?

right. Will change the order in my next series.

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


Re: [PATCH v6 05/11] drivers: usb: twl6030: Add dt support for twl6030 usb

2012-08-03 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Aug 3, 2012 at 7:01 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Mon, Jul 30, 2012 at 02:39:54PM +0530, Kishon Vijay Abraham I wrote:
 Add device tree support for twl6030 usb driver.
 Update the Documentation with device tree binding information.

 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com

 This looks great too. I can take this without any dependencies on the
 rest of the series, I believe. Right ??

I think it might not apply cleanly without [PATCH v6 03/11] drivers:
usb: otg: make twl6030_usb as a comparator driver to omap_usb2.

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


Re: [PATCH v6 07/11] drivers: usb: twl4030: Add device tree support for twl4030 usb

2012-08-03 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Aug 3, 2012 at 7:02 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Mon, Jul 30, 2012 at 02:39:56PM +0530, Kishon Vijay Abraham I wrote:
 Add device tree support for twl4030 usb driver.
 Update the Documentation with device tree binding information.

 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com

 I think this also doesn't have dependency on the rest of the series and
 I could take this upstream. Right ?

right.

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


Re: [PATCH v6 11/11] arm: omap: phy: remove unused functions from omap-phy-internal.c

2012-08-03 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Aug 3, 2012 at 7:06 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Mon, Jul 30, 2012 at 02:40:00PM +0530, Kishon Vijay Abraham I wrote:
 All the unnessary functions in omap-phy-internal is removed.
 These functionality are now handled by omap-usb2 phy driver.

 Cc: Felipe Balbi ba...@ti.com
 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 Acked-by: Tony Lindgren t...@atomide.com

 Great stuff. I'll take this when we agree on the omap-usb2 phy driver.

Sure.

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


Re: [PATCH v6 09/11] drivers: usb: musb: Add device tree support for omap musb glue

2012-08-03 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Aug 3, 2012 at 7:04 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Mon, Jul 30, 2012 at 02:39:58PM +0530, Kishon Vijay Abraham I wrote:
 Added device tree support for omap musb driver and updated the
 Documentation with device tree binding information.

 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com

 This looks good and I think I can take this without any dependencies
 again. Correct ?

correct.

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


Re: [PATCH v3 04/11] usb: otg: nop: add support for multiple tranceiver

2012-07-19 Thread ABRAHAM, KISHON VIJAY
Hi,

On Thu, Jul 19, 2012 at 11:11 AM, Ajay Kumar Gupta ajay.gu...@ti.com wrote:
 Currently we have one single nop transceiver support as same is
 defined as a global variable in drivers/usb/otg/nop-usb-xceiv.c.
 This need to be changed to support multiple otg controller each
 using nop transceiver on a platform such as am335x.

 Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
 ---
  arch/arm/mach-omap2/board-omap3evm.c |2 +-
  drivers/usb/musb/am35x.c |4 ++--
  drivers/usb/musb/blackfin.c  |4 ++--
  drivers/usb/musb/da8xx.c |4 ++--
  drivers/usb/musb/davinci.c   |6 +++---
  drivers/usb/musb/musb_dsps.c |   10 +-
  drivers/usb/musb/tusb6010.c  |6 +++---
  drivers/usb/otg/nop-usb-xceiv.c  |   20 
  include/linux/usb/otg.h  |9 +
  9 files changed, 35 insertions(+), 30 deletions(-)

 diff --git a/arch/arm/mach-omap2/board-omap3evm.c 
 b/arch/arm/mach-omap2/board-omap3evm.c
 index ef230a0..a3393bc 100644
 --- a/arch/arm/mach-omap2/board-omap3evm.c
 +++ b/arch/arm/mach-omap2/board-omap3evm.c
 @@ -704,7 +704,7 @@ static void __init omap3_evm_init(void)
 omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL);

 /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
 -   usb_nop_xceiv_register();
 +   usb_nop_xceiv_register(0);

 if (get_omap3_evm_rev() = OMAP3EVM_BOARD_GEN_2) {
 /* enable EHCI VBUS using GPIO22 */
 diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
 index 01203eb..eb6220f 100644
 --- a/drivers/usb/musb/am35x.c
 +++ b/drivers/usb/musb/am35x.c
 @@ -364,7 +364,7 @@ static int am35x_musb_init(struct musb *musb)
 if (!rev)
 return -ENODEV;

 -   usb_nop_xceiv_register();
 +   usb_nop_xceiv_register(musb-id);
 musb-xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
 if (IS_ERR_OR_NULL(musb-xceiv))
 return -ENODEV;
 @@ -408,7 +408,7 @@ static int am35x_musb_exit(struct musb *musb)
 data-set_phy_power(0);

 usb_put_phy(musb-xceiv);
 -   usb_nop_xceiv_unregister();
 +   usb_nop_xceiv_unregister(musb-xceiv);

 return 0;
  }
 diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
 index c848b82..03d081c 100644
 --- a/drivers/usb/musb/blackfin.c
 +++ b/drivers/usb/musb/blackfin.c
 @@ -415,7 +415,7 @@ static int bfin_musb_init(struct musb *musb)
 }
 gpio_direction_output(musb-config-gpio_vrsel, 0);

 -   usb_nop_xceiv_register();
 +   usb_nop_xceiv_register(musb-id);
 musb-xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
 if (IS_ERR_OR_NULL(musb-xceiv)) {
 gpio_free(musb-config-gpio_vrsel);
 @@ -442,7 +442,7 @@ static int bfin_musb_exit(struct musb *musb)
 gpio_free(musb-config-gpio_vrsel);

 usb_put_phy(musb-xceiv);
 -   usb_nop_xceiv_unregister();
 +   usb_nop_xceiv_unregister(musb-xceiv);
 return 0;
  }

 diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
 index cebd9d7..3ce4a92 100644
 --- a/drivers/usb/musb/da8xx.c
 +++ b/drivers/usb/musb/da8xx.c
 @@ -425,7 +425,7 @@ static int da8xx_musb_init(struct musb *musb)
 if (!rev)
 goto fail;

 -   usb_nop_xceiv_register();
 +   usb_nop_xceiv_register(musb-id);
 musb-xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
 if (IS_ERR_OR_NULL(musb-xceiv))
 goto fail;
 @@ -460,7 +460,7 @@ static int da8xx_musb_exit(struct musb *musb)
 phy_off();

 usb_put_phy(musb-xceiv);
 -   usb_nop_xceiv_unregister();
 +   usb_nop_xceiv_unregister(musb-xceiv);

 return 0;
  }
 diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
 index 3f094f2..d5156b3 100644
 --- a/drivers/usb/musb/davinci.c
 +++ b/drivers/usb/musb/davinci.c
 @@ -385,7 +385,7 @@ static int davinci_musb_init(struct musb *musb)
 void __iomem*tibase = musb-ctrl_base;
 u32 revision;

 -   usb_nop_xceiv_register();
 +   usb_nop_xceiv_register(musb-id);
 musb-xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
 if (IS_ERR_OR_NULL(musb-xceiv))
 goto unregister;
 @@ -447,7 +447,7 @@ static int davinci_musb_init(struct musb *musb)
  fail:
 usb_put_phy(musb-xceiv);
  unregister:
 -   usb_nop_xceiv_unregister();
 +   usb_nop_xceiv_unregister(musb-xceiv);
 return -ENODEV;
  }

 @@ -496,7 +496,7 @@ static int davinci_musb_exit(struct musb *musb)
 phy_off();

 usb_put_phy(musb-xceiv);
 -   usb_nop_xceiv_unregister();
 +   usb_nop_xceiv_unregister(musb-xceiv);

 return 0;
  }
 diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
 index a2c8a06..9fcacff 100644
 --- a/drivers/usb/musb/musb_dsps.c
 +++ b/drivers/usb/musb/musb_dsps.c
 @@ -420,8 +420,8 @@ static int dsps_musb_init(struct musb *musb)
  

Re: [PATCH v3 07/11] usb: otg: nop: add dt support

2012-07-19 Thread ABRAHAM, KISHON VIJAY
Hi,

On Thu, Jul 19, 2012 at 11:11 AM, Ajay Kumar Gupta ajay.gu...@ti.com wrote:
 Added device tree support for nop transceiver driver and updated the
 Documentation with device tree binding information for am33xx platform.

 Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
 ---
  .../devicetree/bindings/usb/am33xx-usb.txt |3 +++
  drivers/usb/otg/nop-usb-xceiv.c|   12 
  2 files changed, 15 insertions(+), 0 deletions(-)

 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 2e5e889..102e7d8 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
 @@ -152,12 +153,23 @@ 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);
 +#else
 +#define nop_xceiv_id_table NULL
 +#endif

The *#else* part is not needed as your *of_match_ptr* will take care of it.

 +
  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),
 },
  };

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


Re: [PATCH v4 09/11] drivers: usb: musb: Add device tree support for omap musb glue

2012-07-19 Thread ABRAHAM, KISHON VIJAY
Hi,

On Thu, Jul 19, 2012 at 6:51 PM, Gupta, Ajay Kumar ajay.gu...@ti.com wrote:
 Hi,
 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
  Documentation/devicetree/bindings/usb/omap-usb.txt |   34 -
  drivers/usb/musb/omap2430.c|   55
 
  2 files changed, 88 insertions(+), 1 deletions(-)

 diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt
 b/Documentation/devicetree/bindings/usb/omap-usb.txt
 index 80a28c9..39cdffb 100644
 --- a/Documentation/devicetree/bindings/usb/omap-usb.txt
 +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
 @@ -1,4 +1,4 @@
 -OMAP USB PHY
 +OMAP USB PHY AND GLUE

  OMAP USB2 PHY

 @@ -14,3 +14,35 @@ usb2phy@0x4a0ad080 {
   compatible = ti,omap-usb2;
   reg = 0x4a0ad080 0x58;
  };
 +
 +OMAP MUSB GLUE
 + - compatible : Should be ti,musb-omap2430
 + - ti,hwmods : must be usb_otg_hs
 + - multipoint : Should be 1 indicating the musb controller supports
 +   multipoint. This is a MUSB configuration-specific setting.
 + - num_eps : Specifies the number of endpoints. This is also a
 +   MUSB configuration-specific setting. Should be set to 16
 + - ram_bits : Specifies the ram address size. Should be set to 12
 + - interface_type : This is a board specific setting to describe the type
 of
 +   interface between the controller and the phy. It should be 0 or 1
 +   specifying ULPI and UTMI respectively.
 + - mode : Should be 3 to represent OTG. 1 signifies HOST and 2
 +   represents PERIPHERAL.
 + - power : Should be 50. This signifies the controller can supply upto
 +   100mA when operating in host mode.
 +
 +SOC specific device node entry
 +usb_otg_hs: usb_otg_hs@4a0ab000 {
 + compatible = ti,musb-omap2430;
 + ti,hwmods = usb_otg_hs;
 + multipoint = 1;
 + num_eps = 16;
 + ram_bits = 12;
 +};
 +
 +Board specific device node entry
 +usb_otg_hs {
 + interface_type = 1;
 + mode = 3;
 + power = 50;
 +};
 diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
 index addbebf..331e477 100644
 --- a/drivers/usb/musb/omap2430.c
 +++ b/drivers/usb/musb/omap2430.c
 @@ -30,6 +30,7 @@
  #include linux/init.h
  #include linux/list.h
  #include linux/io.h
 +#include linux/of.h
  #include linux/platform_device.h
  #include linux/dma-mapping.h
  #include linux/pm_runtime.h
 @@ -469,8 +470,11 @@ static u64 omap2430_dmamask = DMA_BIT_MASK(32);
  static int __devinit omap2430_probe(struct platform_device *pdev)
  {
   struct musb_hdrc_platform_data  *pdata = pdev-dev.platform_data;
 + struct omap_musb_board_data *data;
   struct platform_device  *musb;
   struct omap2430_glue*glue;
 + struct device_node  *np = pdev-dev.of_node;
 + struct musb_hdrc_config *config;
   struct resource *res;
   int ret = -ENOMEM;

 @@ -500,6 +504,43 @@ static int __devinit omap2430_probe(struct
 platform_device *pdev)
   if (glue-control_otghs == NULL)
   dev_dbg(pdev-dev, Failed to obtain control memory\n);

 + if (np) {
 + pdata = devm_kzalloc(pdev-dev, sizeof(*pdata), GFP_KERNEL);
 + if (!pdata) {
 + dev_err(pdev-dev,
 + failed to allocate musb platfrom data\n);
 + ret = -ENOMEM;
 + goto err1;
 + }
 +
 + data = devm_kzalloc(pdev-dev, sizeof(*data), GFP_KERNEL);
 + if (!data) {
 + dev_err(pdev-dev,
 + failed to allocate musb board 
 data\n);
 + ret = -ENOMEM;
 + goto err1;
 + }
 +
 + config = devm_kzalloc(pdev-dev, sizeof(*config), GFP_KERNEL);
 + if (!data) {
 + dev_err(pdev-dev,
 + failed to allocate musb hdrc config\n);
 + goto err1;
 + }
 +
 + of_property_read_u32(np, mode, (u32 *)pdata-mode);
 + of_property_read_u32(np, interface_type,
 + (u32 *)data-interface_type);
 + of_property_read_u32(np, num_eps, (u32 *)config-num_eps);
 + of_property_read_u32(np, ram_bits, (u32 *)config-ram_bits);
 + of_property_read_u32(np, mode, (u32 *)pdata-mode);

 pdata-mode is already read so above should be removed.

Ok.

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


Re: [PATCH v2 02/11] arm/dts: omap: Add omap-usb2 dt data

2012-07-17 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Jul 17, 2012 at 5:57 PM, Sergei Shtylyov sshtyl...@mvista.com wrote:
 Hello.


 On 17-07-2012 12:10, Kishon Vijay Abraham I wrote:

 Add omap-usb2 data node in omap4 device tree file.


 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
   arch/arm/boot/dts/omap4.dtsi |5 +
   1 files changed, 5 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
 index bda5df3..4d2dcc1 100644
 --- a/arch/arm/boot/dts/omap4.dtsi
 +++ b/arch/arm/boot/dts/omap4.dtsi
 @@ -279,6 +279,11 @@
 #size-cells = 1;
 ranges;
 ti,hwmods = ocp2scp_usb_phy;
 +   usb2phy@0x4a0ad080 {


There should be no 0x prefix here.

Ok. Will fix it.

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


Re: [PATCH 2/2] arm/dts: omap4: Add ocp2scp data

2012-07-17 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Jul 17, 2012 at 6:06 PM, Sergei Shtylyov sshtyl...@mvista.com wrote:
 Hello.


 On 16-07-2012 18:13, Kishon Vijay Abraham I wrote:

 Add ocp2scp data node in omap4 device tree file.


 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
   arch/arm/boot/dts/omap4.dtsi |8 
   1 files changed, 8 insertions(+), 0 deletions(-)


 diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
 index 359c497..bda5df3 100644
 --- a/arch/arm/boot/dts/omap4.dtsi
 +++ b/arch/arm/boot/dts/omap4.dtsi
 @@ -272,5 +272,13 @@
 ti,hwmods = mmc5;
 ti,needs-special-reset;
 };
 +
 +   ocp2scp@4a0ad000  {


reg property is absent, so why do you give the node name an address
 postfix?
When I was initially developing, I had reg property populated. Those
info is now obtained from *ti,hwmods*. I'll resend the patch removing
it.

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


Re: [PATCH 1/2] drivers: bus: add a new driver for omap-ocp2scp

2012-07-16 Thread ABRAHAM, KISHON VIJAY
+Arnd Bergmann

On Mon, Jul 16, 2012 at 7:43 PM, Kishon Vijay Abraham I kis...@ti.com wrote:
 Adds a new driver *omap-ocp2scp*. This driver takes the responsibility of
 creating all the devices that is connected to OCP2SCP. In the case of OMAP4,
 USB2PHY is connected to ocp2scp.

 This also includes device tree support for ocp2scp driver and
 the documentation with device tree binding information is updated.

 Cc: Felipe Balbi ba...@ti.com
 Cc: Arnd Bergmann a...@arndb.de
 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
  .../devicetree/bindings/bus/omap-ocp2scp.txt   |   10 ++
  drivers/Kconfig|2 +
  drivers/Makefile   |2 +
  drivers/bus/Kconfig|   15 +++
  drivers/bus/Makefile   |5 +
  drivers/bus/omap-ocp2scp.c |   98 
 
  6 files changed, 132 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
  create mode 100644 drivers/bus/Kconfig
  create mode 100644 drivers/bus/Makefile
  create mode 100644 drivers/bus/omap-ocp2scp.c

 diff --git a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt 
 b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
 new file mode 100644
 index 000..d2fe064
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
 @@ -0,0 +1,10 @@
 +* OMAP OCP2SCP - ocp interface to scp interface
 +
 +properties:
 +- compatible : Should be ti,omap-ocp2scp
 +- #address-cells, #size-cells : Must be present if the device has sub-nodes
 +- ranges : the child address space are mapped 1:1 onto the parent address 
 space
 +- ti,hwmods : must be ocp2scp_usb_phy
 +
 +Sub-nodes:
 +All the devices connected to ocp2scp are described using sub-node to ocp2scp
 diff --git a/drivers/Kconfig b/drivers/Kconfig
 index bfc9186..4fe1e4c 100644
 --- a/drivers/Kconfig
 +++ b/drivers/Kconfig
 @@ -2,6 +2,8 @@ menu Device Drivers

  source drivers/base/Kconfig

 +source drivers/bus/Kconfig
 +
  source drivers/connector/Kconfig

  source drivers/mtd/Kconfig
 diff --git a/drivers/Makefile b/drivers/Makefile
 index 2ba29ff..cac3819 100644
 --- a/drivers/Makefile
 +++ b/drivers/Makefile
 @@ -5,6 +5,8 @@
  # Rewritten to use lists instead of if-statements.
  #

 +obj-y  += bus/
 +
  # GPIO must come after pinctrl as gpios may need to mux pins etc
  obj-y  += pinctrl/
  obj-y  += gpio/
 diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
 new file mode 100644
 index 000..6270415
 --- /dev/null
 +++ b/drivers/bus/Kconfig
 @@ -0,0 +1,15 @@
 +#
 +# Bus Devices
 +#
 +
 +menu Bus devices
 +
 +config OMAP_OCP2SCP
 +   tristate OMAP OCP2SCP DRIVER
 +   help
 + Driver to enable ocp2scp module which transforms ocp interface
 + protocol to scp protocol. In OMAP4, USB PHY is connected via
 + OCP2SCP and in OMAP5, both USB PHY and SATA PHY is connected via
 + OCP2SCP.
 +
 +endmenu
 diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
 new file mode 100644
 index 000..0ec50bc
 --- /dev/null
 +++ b/drivers/bus/Makefile
 @@ -0,0 +1,5 @@
 +#
 +# Makefile for the bus drivers.
 +#
 +
 +obj-$(CONFIG_OMAP_OCP2SCP) += omap-ocp2scp.o
 diff --git a/drivers/bus/omap-ocp2scp.c b/drivers/bus/omap-ocp2scp.c
 new file mode 100644
 index 000..8c3db3a
 --- /dev/null
 +++ b/drivers/bus/omap-ocp2scp.c
 @@ -0,0 +1,98 @@
 +/*
 + * omap-ocp2scp.c - transform ocp interface protocol to scp protocol
 + *
 + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + * Author: Kishon Vijay Abraham I kis...@ti.com
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + */
 +
 +#include linux/module.h
 +#include linux/platform_device.h
 +#include linux/err.h
 +#include linux/pm_runtime.h
 +#include linux/of.h
 +#include linux/of_platform.h
 +
 +static int ocp2scp_remove_devices(struct device *dev, void *c)
 +{
 +   struct platform_device *pdev = to_platform_device(dev);
 +
 +   platform_device_unregister(pdev);
 +
 +   return 0;
 +}
 +
 +static int __devinit omap_ocp2scp_probe(struct platform_device *pdev)
 +{
 +   int ret;
 +   struct device_node  *np = pdev-dev.of_node;
 +
 +   if (np) {
 +   ret = of_platform_populate(np, NULL, NULL, pdev-dev);
 +   if (ret) {
 +   

Re: [PATCH v2 2/3] usb: musb: dsps: add phy control logic to glue

2012-07-11 Thread ABRAHAM, KISHON VIJAY
Hi,

On Wed, Jul 11, 2012 at 3:59 PM, Damodar Santhapuri x0132...@ti.com wrote:
 From: Ajay Kumar Gupta ajay.gu...@ti.com

 AM335x uses NOP transceiver driver and need to enable builtin PHY
 by writing into usb_ctrl register available in system control
 module register space. This is being added at musb glue driver
 layer untill a separate system control module driver is available.

 Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
 Signed-off-by: Damodar Santhapuri x0132...@ti.com
 ---
 Changes from v0:
 - Used platform_get_resource() instead of 
 platform_get_resource_byname()
 based on Kishon's comment.

  arch/arm/mach-omap2/board-ti8168evm.c   |1 -
  arch/arm/mach-omap2/omap_phy_internal.c |   35 
  arch/arm/plat-omap/include/plat/usb.h   |5 +-
  drivers/usb/musb/musb_dsps.c|   87 
 +--
  4 files changed, 73 insertions(+), 55 deletions(-)

 diff --git a/arch/arm/mach-omap2/board-ti8168evm.c 
 b/arch/arm/mach-omap2/board-ti8168evm.c
 index d4c8392..0c7c098 100644
 --- a/arch/arm/mach-omap2/board-ti8168evm.c
 +++ b/arch/arm/mach-omap2/board-ti8168evm.c
 @@ -26,7 +26,6 @@
  #include plat/usb.h

  static struct omap_musb_board_data musb_board_data = {
 -   .set_phy_power  = ti81xx_musb_phy_power,
 .interface_type = MUSB_INTERFACE_ULPI,
 .mode   = MUSB_OTG,
 .power  = 500,
 diff --git a/arch/arm/mach-omap2/omap_phy_internal.c 
 b/arch/arm/mach-omap2/omap_phy_internal.c
 index d52651a..d80bb16 100644
 --- a/arch/arm/mach-omap2/omap_phy_internal.c
 +++ b/arch/arm/mach-omap2/omap_phy_internal.c
 @@ -254,38 +254,3 @@ void am35x_set_mode(u8 musb_mode)

 omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2);
  }
 -
 -void ti81xx_musb_phy_power(u8 on)
 -{
 -   void __iomem *scm_base = NULL;
 -   u32 usbphycfg;
 -
 -   scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K);
 -   if (!scm_base) {
 -   pr_err(system control module ioremap failed\n);
 -   return;
 -   }
 -
 -   usbphycfg = __raw_readl(scm_base + USBCTRL0);
 -
 -   if (on) {
 -   if (cpu_is_ti816x()) {
 -   usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
 -   usbphycfg = ~TI816X_USBPHY_REFCLK_OSC;
 -   } else if (cpu_is_ti814x()) {
 -   usbphycfg = ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
 -   | USBPHY_DPINPUT | USBPHY_DMINPUT);
 -   usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN
 -   | USBPHY_DPOPBUFCTL | USBPHY_DMOPBUFCTL);
 -   }
 -   } else {
 -   if (cpu_is_ti816x())
 -   usbphycfg = ~TI816X_USBPHY0_NORMAL_MODE;
 -   else if (cpu_is_ti814x())
 -   usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
 -
 -   }
 -   __raw_writel(usbphycfg, scm_base + USBCTRL0);
 -
 -   iounmap(scm_base);
 -}
 diff --git a/arch/arm/plat-omap/include/plat/usb.h 
 b/arch/arm/plat-omap/include/plat/usb.h
 index 548a4c8..c2aa4ae 100644
 --- a/arch/arm/plat-omap/include/plat/usb.h
 +++ b/arch/arm/plat-omap/include/plat/usb.h
 @@ -95,7 +95,6 @@ extern void am35x_musb_reset(void);
  extern void am35x_musb_phy_power(u8 on);
  extern void am35x_musb_clear_irq(void);
  extern void am35x_set_mode(u8 musb_mode);
 -extern void ti81xx_musb_phy_power(u8 on);

  /* AM35x */
  /* USB 2.0 PHY Control */
 @@ -120,8 +119,8 @@ extern void ti81xx_musb_phy_power(u8 on);
  #define CONF2_DATPOL   (1  1)

  /* TI81XX specific definitions */
 -#define USBCTRL0   0x620
 -#define USBSTAT0   0x624
 +#define MUSB_USBSS_REV_816X0x9
 +#define MUSB_USBSS_REV_814X0xb

  /* TI816X PHY controls bits */
  #define TI816X_USBPHY0_NORMAL_MODE (1  0)
 diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
 index 494772f..72eda64 100644
 --- a/drivers/usb/musb/musb_dsps.c
 +++ b/drivers/usb/musb/musb_dsps.c
 @@ -115,9 +115,46 @@ struct dsps_glue {
 struct platform_device *musb;   /* child musb pdev */
 const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */
 struct timer_list timer;/* otg_workaround timer */
 +   u32 __iomem *usb_ctrl;
 +   u8  usbss_rev;
  };

  /**
 + * musb_dsps_phy_control - phy on/off
 + * @glue: struct dsps_glue *
 + * @on: flag for phy to be switched on or off
 + *
 + * This is to enable the PHY using usb_ctrl register in system control
 + * module space.
 + *
 + * XXX: This function will be removed once we have a seperate driver for
 + * control module
 + */
 +static void musb_dsps_phy_control(struct dsps_glue *glue, u8 on)

I think this function should be added in your transceiver driver. I
don't see glue as an appropriate place for this.
 +{
 +   u32 usbphycfg;
 +
 +   usbphycfg = __raw_readl(glue-usb_ctrl);
 +
 +   if (on) {
 +   if (glue-usbss_rev == 

Re: [PATCH v1 05/11] drivers: usb: twl6030: Add dt support for twl6030 usb

2012-07-10 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Jul 10, 2012 at 11:28 AM, Rajendra Nayak rna...@ti.com wrote:
 On Thursday 28 June 2012 05:21 PM, Kishon Vijay Abraham I wrote:

 Add device tree support for twl6030 usb driver.
 Update the Documentation with device tree binding information.

 Signed-off-by: Kishon Vijay Abraham Ikis...@ti.com
 ---
   .../devicetree/bindings/usb/twl-usb.txt|   18 
   drivers/usb/otg/twl6030-usb.c  |   45
 ++--
   2 files changed, 50 insertions(+), 13 deletions(-)
   create mode 100644 Documentation/devicetree/bindings/usb/twl-usb.txt

 diff --git a/Documentation/devicetree/bindings/usb/twl-usb.txt
 b/Documentation/devicetree/bindings/usb/twl-usb.txt
 new file mode 100644
 index 000..f293271
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/twl-usb.txt
 @@ -0,0 +1,18 @@
 +USB COMPARATOR OF TWL CHIPS
 +
 +TWL6030 USB COMPARATOR
 + - compatible : Should be ti,twl6030-usb
 + - interrupts : Two interrupt numbers to the cpu should be specified.
 First
 +   interrupt number is the otg interrupt number that raises ID interrupts
 when
 +   the controller has to act as host and the second interrupt number is
 the
 +   usb interrupt number that raises VBUS interrupts when the controller
 has to
 +   act as device
 + - regulator :supply-name  can be vusb or ldousb
 + -supply-name-supply : phandle to the regulator device tree node
 +
 +twl6030-usb {
 +   compatible = ti,twl6030-usb;
 +   interrupts =  4 10;
 +   regulator = vusb;
 +   vusb-supply =vusb;


 This doesn't seem right. Why do you ned a 'regulator' string along
 with the phandle?

The original code was something like
if (twl-features  TWL6025_SUBCLASS)
regulator_name = ldousb;
else
regulator_name = vusb;

I wasn't sure how to handle this *TWL6025_SUBCLASS* stuff.


 +};
 diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
 index 6a361d2..20b7abe 100644
 --- a/drivers/usb/otg/twl6030-usb.c
 +++ b/drivers/usb/otg/twl6030-usb.c
 @@ -105,7 +105,7 @@ struct twl6030_usb {
 u8  asleep;
 boolirq_enabled;
 boolvbus_enable;
 -   unsigned long   features;
 +   const char  *regulator;
   };

   #define   comparator_to_twl(x) container_of((x), struct twl6030_usb,
 comparator)
 @@ -153,13 +153,6 @@ static int twl6030_start_srp(struct phy_companion
 *comparator)

   static int twl6030_usb_ldo_init(struct twl6030_usb *twl)
   {
 -   char *regulator_name;
 -
 -   if (twl-features  TWL6025_SUBCLASS)

 -   regulator_name = ldousb;
 -   else
 -   regulator_name = vusb;
 -
 /* Set to OTG_REV 1.3 and turn on the ID_WAKEUP_COMP */
 twl6030_writeb(twl, TWL6030_MODULE_ID0 , 0x1, TWL6030_BACKUP_REG);

 @@ -169,7 +162,7 @@ static int twl6030_usb_ldo_init(struct twl6030_usb
 *twl)
 /* Program MISC2 register and set bit VUSB_IN_VBAT */
 twl6030_writeb(twl, TWL6030_MODULE_ID0 , 0x10, TWL6030_MISC2);

 -   twl-usb3v3 = regulator_get(twl-dev, regulator_name);
 +   twl-usb3v3 = regulator_get(twl-dev, twl-regulator);
 if (IS_ERR(twl-usb3v3))
 return -ENODEV;

 @@ -324,9 +317,9 @@ static int __devinit twl6030_usb_probe(struct
 platform_device *pdev)
   {
 struct twl6030_usb  *twl;
 int status, err;
 -   struct twl4030_usb_data *pdata;
 -   struct device *dev =pdev-dev;

 -   pdata = dev-platform_data;
 +   struct device_node  *np = pdev-dev.of_node;
 +   struct device   *dev =pdev-dev;

 +   struct twl4030_usb_data *pdata = dev-platform_data;

 twl = devm_kzalloc(dev, sizeof *twl, GFP_KERNEL);
 if (!twl)
 @@ -335,13 +328,28 @@ static int __devinit twl6030_usb_probe(struct
 platform_device *pdev)
 twl-dev=pdev-dev;

 twl-irq1   = platform_get_irq(pdev, 0);
 twl-irq2   = platform_get_irq(pdev, 1);
 -   twl-features   = pdata-features;
 twl-linkstat   = OMAP_MUSB_UNKNOWN;

 twl-comparator.set_vbus= twl6030_set_vbus;
 twl-comparator.start_srp   = twl6030_start_srp;
 omap_usb2_set_comparator(twl-comparator);

 +   if (np) {
 +   err = of_property_read_string(np,
 regulator,twl-regulator);

 +   if (err  0) {
 +   dev_err(pdev-dev, unable to get regulator\n);
 +   return err;
 +   }


 Isn't there a better way for the driver to know which supply to use instead
 of DT passing the supply name?

The problem I see is this same driver is used for twl6030 and twl6025
and the regulator used is different for these two chips (And I think
twl6025 will also use the same dt file as twl6030 as I don't see a
different file for 6025).


Re: [PATCH v1 01/11] drivers: usb: otg: add a new driver for omap usb2 phy

2012-07-10 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Jul 10, 2012 at 11:16 AM, Rajendra Nayak rna...@ti.com wrote:
 diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt
 b/Documentation/devicetree/bindings/usb/omap-usb.txt
 new file mode 100644
 index 000..80a28c9
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
 @@ -0,0 +1,16 @@
 +OMAP USB PHY
 +
 +OMAP USB2 PHY
 +
 +Required properties:
 + - compatible: Should be ti,omap-usb2
 + - reg : Address and length of the register set for the device. Also
 +add the address of control module dev conf register until a driver for
 +control module is added
 +
 +This is usually a subnode of ocp2scp to which it is connected.
 +
 +usb2phy@0x4a0ad080 {
 +   compatible = ti,omap-usb2;
 +   reg =0x4a0ad080 0x58;


 Don;t you need a 'ti,hwmods' entry for this one?

I don't think it needs one as it has nothing more than this one
address space. (it doesn't have sysconfig, doesn't have any prcm
register..).


 --- /dev/null
 +++ b/drivers/usb/otg/omap-usb2.c
 @@ -0,0 +1,273 @@
 +/*
 + * omap-usb2.c - USB PHY, talking to musb controller in OMAP.
 + *
 + * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com


 Copyright (C) 2012? Same for the couple of headers below.
Will fix it.


 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + * Author: Kishon Vijay Abraham Ikis...@ti.com
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + */
 +


 +
 +static int __devinit omap_usb2_probe(struct platform_device *pdev)
 +{
 +   struct omap_usb *phy;
 +   struct usb_otg  *otg;
 +   struct resource *res;
 +
 +   phy = devm_kzalloc(pdev-dev, sizeof(*phy), GFP_KERNEL);
 +   if (!phy) {
 +   dev_err(pdev-dev, unable to allocate memory for USB2
 PHY\n);
 +   return -ENOMEM;
 +   }
 +
 +   otg = devm_kzalloc(pdev-dev, sizeof(*otg), GFP_KERNEL);
 +   if (!otg) {
 +   dev_err(pdev-dev, unable to allocate memory for USB
 OTG\n);
 +   return -ENOMEM;
 +   }
 +
 +   phy-dev=pdev-dev;

 +
 +   phy-phy.dev= phy-dev;
 +   phy-phy.label  = omap-usb2;
 +   phy-phy.set_suspend= omap_usb2_suspend;
 +   phy-phy.otg= otg;
 +
 +   res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 +
 +   phy-control_dev_conf = devm_request_and_ioremap(pdev-dev, res);
 +   if (phy-control_dev_conf == NULL) {
 +   dev_err(pdev-dev, Failed to obtain io memory\n);
 +   return -ENXIO;
 +   }
 +
 +   phy-is_suspended   = 1;
 +   omap_usb_phy_power(phy, 0);
 +
 +   otg-set_host   = omap_usb_set_host;
 +   otg-set_peripheral = omap_usb_set_peripheral;
 +   otg-set_vbus   = omap_usb_set_vbus;
 +   otg-start_srp  = omap_usb_start_srp;
 +   otg-phy=phy-phy;

 +
 +   phy-wkupclk = devm_clk_get(phy-dev, usb_phy_cm_clk32k);


 Why not just use clk_get()? What does devm_clk_get() do?
It just associates the clk with the device. So whenever the the driver
gets detached, the devres will take care to do a clk_put() of the
clock.


 +   if (IS_ERR(phy-wkupclk)) {
 +   dev_err(pdev-dev, unable to get usb_phy_cm_clk32k\n);
 +   return PTR_ERR(phy-wkupclk);
 +   }
 +   clk_prepare(phy-wkupclk);


 Ideally clk_prepare() is an extension of clk_enable() and is expected
 to be used that way. Not to be clubbed with clk_get(). Same with
 clk_unprepare(). Do you do a clk_enable()/_disable() in interrupt/
 atomic context?

Currently it is called from a work queue. But Felipe wanted to remove
those work_queue from omap2430 glue. Then this would be called from
atomic context.
A query for you here. If pm_runtime_get_sync() is called in interrupt
context, will runtime resume of that device will also be called in the
same context?



 +
 +   usb_add_phy(phy-phy, USB_PHY_TYPE_USB2);
 +
 +   platform_set_drvdata(pdev, phy);
 +
 +   pm_runtime_enable(phy-dev);
 +
 +   return 0;
 +}
 +
 +static int __devexit omap_usb2_remove(struct platform_device *pdev)
 +{
 +   struct omap_usb *phy = platform_get_drvdata(pdev);
 +
 +   clk_unprepare(phy-wkupclk);
 +   usb_remove_phy(phy-phy);
 +   platform_set_drvdata(pdev, NULL);
 +
 +   return 0;
 +}
 +
 +#ifdef CONFIG_PM
 +
 +static int omap_usb2_runtime_suspend(struct device *dev)
 +{
 +   struct platform_device  *pdev = to_platform_device(dev);
 +   struct omap_usb *phy = 

Re: [PATCH v1 01/11] drivers: usb: otg: add a new driver for omap usb2 phy

2012-07-10 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Jul 10, 2012 at 11:33 AM, Venu Byravarasu
vbyravar...@nvidia.com wrote:
  +
  +#ifdef CONFIG_PM

 Should it not be CONFIG_PM_SLEEP instead of just CONFIG_PM?

Why? I think we should have CONFIG_PM_SLEEP only when we have
*suspend*, *resume* hooks. But this driver has only *runtime_suspend*
and *runtime_resume* hooks.

  +
  +static int omap_usb2_runtime_suspend(struct device *dev)
  +{
  +   struct platform_device  *pdev = to_platform_device(dev);
  +   struct omap_usb *phy = platform_get_drvdata(pdev);
  +


  +static int __init usb2_omap_init(void)
  +{
  +   return platform_driver_register(omap_usb2_driver);
  +}
  +arch_initcall(usb2_omap_init);
  +
  +static void __exit usb2_omap_exit(void)
  +{
  +   platform_driver_unregister(omap_usb2_driver);
  +}
  +module_exit(usb2_omap_exit);
  +

 Do you really need arch_initcall here?
 If not, then you can replace above two function calls with 
 module_platform_driver().

I indeed want it to be arch_initcall. When the module is built-in, I
want this module to loaded before twl6030-usb.c

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


Re: [PATCH v1 07/11] drivers: usb: twl4030: Add device tree support for twl4030 usb

2012-07-10 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Jul 10, 2012 at 11:32 AM, Rajendra Nayak rna...@ti.com wrote:
 On Thursday 28 June 2012 05:21 PM, Kishon Vijay Abraham I wrote:

 Add device tree support for twl6030 usb driver.


 twl4030?
My bad. Will fix it.


 Update the Documentation with device tree binding information.

 Signed-off-by: Kishon Vijay Abraham Ikis...@ti.com
 ---
   .../devicetree/bindings/usb/twl-usb.txt|   19 +
   drivers/usb/otg/twl4030-usb.c  |   28
 +++
   2 files changed, 41 insertions(+), 6 deletions(-)

 diff --git a/Documentation/devicetree/bindings/usb/twl-usb.txt
 b/Documentation/devicetree/bindings/usb/twl-usb.txt
 index f293271..2d069e4 100644
 --- a/Documentation/devicetree/bindings/usb/twl-usb.txt
 +++ b/Documentation/devicetree/bindings/usb/twl-usb.txt
 @@ -16,3 +16,22 @@ twl6030-usb {
 regulator = vusb;
 vusb-supply =vusb;
   };
 +
 +TWL4030 USB PHY AND COMPARATOR
 + - compatible : Should be ti,twl4030-usb
 + - interrupts : The interrupt numbers to the cpu should be specified.
 First
 +   interrupt number is the otg interrupt number that raises ID interrupts
 +   and VBUS interrupts. The second interrupt number is optional.
 + -supply-name-supply : phandle to the regulator device tree node.
 +supply-name  should be vusb1v5, vusb1v8 and vusb3v1
 + - usb_mode : The mode used by the phy to connect to the controller. 1
 +   specifies ULPI mode and 2 specifies CEA2011_3PIN mode.


 Are these standard usb phy modes or something specific to the twl4030
 usb phy?

These are standard modes used to connect the phy to the controller. I
think it's used by other chips other than twl4030 (Something in
am35xx??).

 +
 +twl4030-usb {
 +   compatible = ti,twl4030-usb;
 +   interrupts =  10 4;
 +   vusb1v5-supply =vusb1v5;
 +   vusb1v8-supply =vusb1v8;
 +   vusb3v1-supply =vusb3v1;
 +   usb_mode =1;
 +};
 diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
 index 523cad5..a4e7434 100644
 --- a/drivers/usb/otg/twl4030-usb.c
 +++ b/drivers/usb/otg/twl4030-usb.c
 @@ -585,23 +585,28 @@ static int __devinit twl4030_usb_probe(struct
 platform_device *pdev)
 struct twl4030_usb  *twl;
 int status, err;
 struct usb_otg  *otg;
 -
 -   if (!pdata) {
 -   dev_dbg(pdev-dev, platform_data not available\n);
 -   return -EINVAL;
 -   }
 +   struct device_node  *np = pdev-dev.of_node;

 twl = devm_kzalloc(pdev-dev, sizeof *twl, GFP_KERNEL);
 if (!twl)
 return -ENOMEM;

 +   if (np)
 +   of_property_read_u32(np, usb_mode,
 +   (enum twl4030_usb_mode *)twl-usb_mode);
 +   else if (pdata)
 +   twl-usb_mode = pdata-usb_mode;
 +   else {
 +   dev_err(pdev-dev, twl4030 initialized without
 pdata\n);
 +   return -EINVAL;
 +   }
 +
 otg = devm_kzalloc(pdev-dev, sizeof *otg, GFP_KERNEL);
 if (!otg)
 return -ENOMEM;

 twl-dev=pdev-dev;

 twl-irq= platform_get_irq(pdev, 0);
 -   twl-usb_mode   = pdata-usb_mode;
 twl-vbus_supplied  = false;
 twl-asleep = 1;
 twl-linkstat   = OMAP_MUSB_UNKNOWN;
 @@ -690,12 +695,23 @@ static int __exit twl4030_usb_remove(struct
 platform_device *pdev)
 return 0;
   }

 +#ifdef CONFIG_OF
 +static const struct of_device_id twl4030_usb_id_table[] = {
 +   { .compatible = ti,twl4030-usb },
 +   {}
 +};
 +MODULE_DEVICE_TABLE(of, twl4030_usb_id_table);
 +#else
 +#define twl4030_usb_id_table NULL
 +#endif
 +
   static struct platform_driver twl4030_usb_driver = {
 .probe  = twl4030_usb_probe,
 .remove = __exit_p(twl4030_usb_remove),
 .driver = {
 .name   = twl4030_usb,
 .owner  = THIS_MODULE,
 +   .of_match_table = twl4030_usb_id_table,


 use of_match_ptr().

Ok. Will change it that way.

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


Re: [PATCH v1 08/11] arm/dts: Add twl4030-usb data

2012-07-10 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Jul 10, 2012 at 11:43 AM, Rajendra Nayak rna...@ti.com wrote:
 On Thursday 28 June 2012 05:21 PM, Kishon Vijay Abraham I wrote:

 Add twl4030-usb data node in twl4030 device tree file.

 Signed-off-by: Kishon Vijay Abraham Ikis...@ti.com
 ---
   arch/arm/boot/dts/twl4030.dtsi |   21 +
   1 files changed, 21 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/boot/dts/twl4030.dtsi
 b/arch/arm/boot/dts/twl4030.dtsi
 index 22f4d13..66534a3 100644
 --- a/arch/arm/boot/dts/twl4030.dtsi
 +++ b/arch/arm/boot/dts/twl4030.dtsi
 @@ -37,6 +37,18 @@
 regulator-max-microvolt =315;
 };

 +   vusb1v5: regulator@3 {
 +   compatible = ti,twl4030-vusb1v5;
 +   };


 These @3, @4 are actually wrong since the node do
 not have a 'reg' property in it. This was commented on
 by David Brown on my original series which added this but
 it somehow slipped through the cracks. I understand that
 you would have looked up what existed in the file and
 extended, but what already exists in the file needs to
 be fixed up too. I'll send in a patch to fix those up.

Ok. i'll follow suit :-)

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


Re: [PATCH v1 10/11] arm/dts: omap: Add usb_otg and glue data

2012-07-10 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Jul 10, 2012 at 11:57 AM, Rajendra Nayak rna...@ti.com wrote:
 On Thursday 28 June 2012 05:21 PM, Kishon Vijay Abraham I wrote:

 Add usb otg data node in omap4/omap3 device tree file. Also update
 the node with board specific setting in omapx-board.dts file.

 Signed-off-by: Kishon Vijay Abraham Ikis...@ti.com
 ---
   arch/arm/boot/dts/omap3-beagle.dts |6 ++
   arch/arm/boot/dts/omap3-evm.dts|6 ++
   arch/arm/boot/dts/omap3.dtsi   |8 
   arch/arm/boot/dts/omap4-panda.dts  |6 ++
   arch/arm/boot/dts/omap4-sdp.dts|6 ++
   arch/arm/boot/dts/omap4.dtsi   |8 
   6 files changed, 40 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/boot/dts/omap3-beagle.dts
 b/arch/arm/boot/dts/omap3-beagle.dts
 index 5b4506c..f3d7076 100644
 --- a/arch/arm/boot/dts/omap3-beagle.dts
 +++ b/arch/arm/boot/dts/omap3-beagle.dts
 @@ -67,3 +67,9 @@
   mmc3 {
 status = disable;
   };
 +
 +usb_otg_hs {
 +   interface_type =0;
 +   mode =3;
 +   power =50;
 +};
 diff --git a/arch/arm/boot/dts/omap3-evm.dts
 b/arch/arm/boot/dts/omap3-evm.dts
 index 2eee16e..8963b3d 100644
 --- a/arch/arm/boot/dts/omap3-evm.dts
 +++ b/arch/arm/boot/dts/omap3-evm.dts
 @@ -18,3 +18,9 @@
 reg =0x8000 0x1000; /* 256 MB */
 };
   };
 +
 +usb_otg_hs {
 +   interface_type =0;
 +   mode =3;
 +   power =50;
 +};
 diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
 index 99474fa..2f565d6 100644
 --- a/arch/arm/boot/dts/omap3.dtsi
 +++ b/arch/arm/boot/dts/omap3.dtsi
 @@ -215,5 +215,13 @@
 compatible = ti,omap3-hsmmc;
 ti,hwmods = mmc3;
 };
 +
 +   usb_otg_hs: usb_otg_hs@4a0ab000 {
 +   compatible = ti,musb-omap2430;


 this compatible doesn't seem right in omap3.dtsi. Same with
 the below entry in omap4.dtsi.
 See other IP blocks which are reused across OMAP2/3/4 on
 how the compatible for those are handled.

Ok. So it should be like *ti,omap4-musb*, *ti,omap3-musb*?

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


Re: [PATCH v1 05/11] drivers: usb: twl6030: Add dt support for twl6030 usb

2012-07-10 Thread ABRAHAM, KISHON VIJAY
Hi,

On Tue, Jul 10, 2012 at 12:14 PM, Rajendra Nayak rna...@ti.com wrote:
 On Tuesday 10 July 2012 11:58 AM, ABRAHAM, KISHON VIJAY wrote:

 Hi,

 On Tue, Jul 10, 2012 at 11:28 AM, Rajendra Nayakrna...@ti.com  wrote:

 On Thursday 28 June 2012 05:21 PM, Kishon Vijay Abraham I wrote:


 Add device tree support for twl6030 usb driver.
 Update the Documentation with device tree binding information.

 Signed-off-by: Kishon Vijay Abraham Ikis...@ti.com
 ---
.../devicetree/bindings/usb/twl-usb.txt|   18 
drivers/usb/otg/twl6030-usb.c  |   45
 ++--
2 files changed, 50 insertions(+), 13 deletions(-)
create mode 100644
 Documentation/devicetree/bindings/usb/twl-usb.txt

 diff --git a/Documentation/devicetree/bindings/usb/twl-usb.txt
 b/Documentation/devicetree/bindings/usb/twl-usb.txt
 new file mode 100644
 index 000..f293271
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/twl-usb.txt
 @@ -0,0 +1,18 @@
 +USB COMPARATOR OF TWL CHIPS
 +
 +TWL6030 USB COMPARATOR
 + - compatible : Should be ti,twl6030-usb
 + - interrupts : Two interrupt numbers to the cpu should be specified.
 First
 +   interrupt number is the otg interrupt number that raises ID
 interrupts
 when
 +   the controller has to act as host and the second interrupt number is
 the
 +   usb interrupt number that raises VBUS interrupts when the controller
 has to
 +   act as device
 + - regulator :supply-name   can be vusb or ldousb
 + -supply-name-supply : phandle to the regulator device tree node
 +
 +twl6030-usb {
 +   compatible = ti,twl6030-usb;
 +   interrupts =   4 10;
 +   regulator = vusb;
 +   vusb-supply =vusb;



 This doesn't seem right. Why do you ned a 'regulator' string along
 with the phandle?


 The original code was something like
 if (twl-features  TWL6025_SUBCLASS)

 regulator_name = ldousb;
 else
 regulator_name = vusb;

 I wasn't sure how to handle this *TWL6025_SUBCLASS* stuff.


 +};
 diff --git a/drivers/usb/otg/twl6030-usb.c
 b/drivers/usb/otg/twl6030-usb.c
 index 6a361d2..20b7abe 100644
 --- a/drivers/usb/otg/twl6030-usb.c
 +++ b/drivers/usb/otg/twl6030-usb.c
 @@ -105,7 +105,7 @@ struct twl6030_usb {
  u8  asleep;
  boolirq_enabled;
  boolvbus_enable;
 -   unsigned long   features;
 +   const char  *regulator;
};

#define   comparator_to_twl(x) container_of((x), struct
 twl6030_usb,
 comparator)
 @@ -153,13 +153,6 @@ static int twl6030_start_srp(struct phy_companion
 *comparator)

static int twl6030_usb_ldo_init(struct twl6030_usb *twl)
{
 -   char *regulator_name;
 -
 -   if (twl-features   TWL6025_SUBCLASS)

 -   regulator_name = ldousb;
 -   else
 -   regulator_name = vusb;
 -
  /* Set to OTG_REV 1.3 and turn on the ID_WAKEUP_COMP */
  twl6030_writeb(twl, TWL6030_MODULE_ID0 , 0x1,
 TWL6030_BACKUP_REG);

 @@ -169,7 +162,7 @@ static int twl6030_usb_ldo_init(struct twl6030_usb
 *twl)
  /* Program MISC2 register and set bit VUSB_IN_VBAT */
  twl6030_writeb(twl, TWL6030_MODULE_ID0 , 0x10, TWL6030_MISC2);

 -   twl-usb3v3 = regulator_get(twl-dev, regulator_name);
 +   twl-usb3v3 = regulator_get(twl-dev, twl-regulator);
  if (IS_ERR(twl-usb3v3))
  return -ENODEV;

 @@ -324,9 +317,9 @@ static int __devinit twl6030_usb_probe(struct
 platform_device *pdev)
{
  struct twl6030_usb  *twl;
  int status, err;
 -   struct twl4030_usb_data *pdata;
 -   struct device *dev =pdev-dev;

 -   pdata = dev-platform_data;
 +   struct device_node  *np = pdev-dev.of_node;
 +   struct device   *dev =pdev-dev;

 +   struct twl4030_usb_data *pdata = dev-platform_data;

  twl = devm_kzalloc(dev, sizeof *twl, GFP_KERNEL);
  if (!twl)
 @@ -335,13 +328,28 @@ static int __devinit twl6030_usb_probe(struct
 platform_device *pdev)
  twl-dev=pdev-dev;

  twl-irq1   = platform_get_irq(pdev, 0);
  twl-irq2   = platform_get_irq(pdev, 1);
 -   twl-features   = pdata-features;
  twl-linkstat   = OMAP_MUSB_UNKNOWN;

  twl-comparator.set_vbus= twl6030_set_vbus;
  twl-comparator.start_srp   = twl6030_start_srp;
  omap_usb2_set_comparator(twl-comparator);

 +   if (np) {
 +   err = of_property_read_string(np,
 regulator,twl-regulator);

 +   if (err   0) {
 +   dev_err(pdev-dev, unable to get
 regulator\n);
 +   return err;
 +   }



 Isn't there a better way for the driver to know which supply to use
 instead
 of DT passing the supply name?


 The problem I see is this same driver

Re: [GIT PULL] usb: phy: patches for v3.6

2012-07-09 Thread ABRAHAM, KISHON VIJAY
Hi Greg,

On Fri, Jul 6, 2012 at 4:05 AM, Greg KH gre...@linuxfoundation.org wrote:
 On Mon, Jul 02, 2012 at 11:26:39AM +0300, Felipe Balbi wrote:
 On Mon, Jul 02, 2012 at 11:22:00AM +0300, Felipe Balbi wrote:
  Hi Greg,
 
  here are the patches I queued for transceiver drivers. Let me know if
  you want me to change anything.

 this will conflict with your usb-next branch, here's the resolution
 patch:

 Thanks for this, that helped out a lot.

 I also got a conflict in drivers/usb/otg/twl6030-usb.c, which I think I
 resolved properly, but it would be great if you could verify it.

There is a mistake in the conflict resolution in file twl6030-usb.c
+   otg-default_a = true;
+   twl-phy.state = OTG_STATE_A_IDLE;
The above two lines shouldn't be there. I can send a patch for fixing
this if needed.

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