[PATCH] usb: phy: mv_u3d: Add usb phy driver for mv_u3d

2012-08-09 Thread Yu Xu
The driver supports phy_init and phy_shutdown functions to
enable and disable phy for Marvell USB 3.0 controller.

Signed-off-by: Yu Xu 
---
 drivers/usb/phy/Kconfig  |8 +
 drivers/usb/phy/Makefile |1 +
 drivers/usb/phy/mv_u3d_phy.c |  365 ++
 drivers/usb/phy/mv_u3d_phy.h |  105 
 4 files changed, 479 insertions(+)
 create mode 100644 drivers/usb/phy/mv_u3d_phy.c
 create mode 100644 drivers/usb/phy/mv_u3d_phy.h

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index e7cf84f..2838adb 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 MV_U3D_PHY
+   bool "Marvell USB 3.0 PHY controller Driver"
+   depends on USB_MV_U3D
+   select USB_OTG_UTILS
+   help
+ Enable this to support Marvell USB 3.0 phy controller for Marvell
+ SoC.
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index eca095b..cf38f08 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_MV_U3D_PHY)   += mv_u3d_phy.o
diff --git a/drivers/usb/phy/mv_u3d_phy.c b/drivers/usb/phy/mv_u3d_phy.c
new file mode 100644
index 000..941e1d4
--- /dev/null
+++ b/drivers/usb/phy/mv_u3d_phy.c
@@ -0,0 +1,365 @@
+/*
+ * Copyright (C) 2011 Marvell International Ltd. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "mv_u3d_phy.h"
+
+/*
+ * struct mv_u3d_phy - transceiver driver state
+ * @phy: transceiver structure
+ * @dev: The parent device supplied to the probe function
+ * @clk: usb phy clock
+ * @base: usb phy register memory base
+ */
+struct mv_u3d_phy {
+   struct usb_phy  phy;
+   struct mv_usb_platform_data *plat;
+   struct device   *dev;
+   struct clk  *clk;
+   void __iomem*base;
+};
+
+static u32 mv_u3d_phy_read(void __iomem *base, u32 reg)
+{
+   void __iomem *addr, *data;
+
+   addr = base;
+   data = base + 0x4;
+
+   writel_relaxed(reg, addr);
+   return readl_relaxed(data);
+}
+
+static void mv_u3d_phy_set(void __iomem *base, u32 reg, u32 value)
+{
+   void __iomem *addr, *data;
+   u32 tmp;
+
+   addr = base;
+   data = base + 0x4;
+
+   writel_relaxed(reg, addr);
+   tmp = readl_relaxed(data);
+   tmp |= value;
+   writel_relaxed(tmp, data);
+}
+
+static void mv_u3d_phy_clear(void __iomem *base, u32 reg, u32 value)
+{
+   void __iomem *addr, *data;
+   u32 tmp;
+
+   addr = base;
+   data = base + 0x4;
+
+   writel_relaxed(reg, addr);
+   tmp = readl_relaxed(data);
+   tmp &= ~value;
+   writel_relaxed(tmp, data);
+}
+
+static void mv_u3d_phy_write(void __iomem *base, u32 reg, u32 value)
+{
+   void __iomem *addr, *data;
+
+   addr = base;
+   data = base + 0x4;
+
+   writel_relaxed(reg, addr);
+   writel_relaxed(value, data);
+}
+
+static void mv_u3d_phy_reg_print(void __iomem *base, u32 reg)
+{
+   u32 data;
+   data = mv_u3d_phy_read(base, reg);
+   pr_debug("phy reg 0x%x: phy data 0x%x\n", reg, data);
+}
+
+void mv_u3d_phy_shutdown(struct usb_phy *phy)
+{
+   struct mv_u3d_phy *mv_u3d_phy;
+   void __iomem *base;
+   u32 val;
+
+   mv_u3d_phy = container_of(phy, struct mv_u3d_phy, phy);
+   base = mv_u3d_phy->base;
+
+   /* Power down Reference Analog current, bit 15
+* Power down PLL, bit 14
+* Power down Receiver, bit 13
+* Power down Transmitter, bit 12
+* of USB3_POWER_PLL_CONTROL register
+*/
+   val = mv_u3d_phy_read(base, USB3_POWER_PLL_CONTROL);
+   val &= ~(USB3_POWER_PLL_CONTROL_PU);
+   mv_u3d_phy_write(base, USB3_POWER_PLL_CONTROL, val);
+
+   if (mv_u3d_phy->clk)
+   clk_disable(mv_u3d_phy->clk);
+}
+
+static int mv_u3d_phy_init(struct usb_phy *phy)
+{
+   struct mv_u3d_phy *mv_u3d_phy;
+   void __iomem *base;
+   u32 val, count;
+
+   /* enable usb3 phy */
+   mv_u3d_phy = container_of(phy, struct mv_u3d_phy, phy);
+
+   if (mv_u3d_phy->clk)
+   clk_enable(mv_u3d_phy->clk);
+
+   base = mv_u3d_phy->base;
+
+   val = mv_u3d_phy_read(base, USB3_POWER_PLL_CONTROL);
+   val &= ~(USB3_POWER_PLL_CONTROL_PU_MASK);
+   val |= 0xF << USB3_POWER_PLL_CONTROL_PU_SHIFT;
+   mv_u3d_phy_write(base, USB3_POWER_PLL_CONTROL, val);
+ 

Re: [PATCH] usb: phy: mv_u3d: Add usb phy driver for mv_u3d

2012-08-09 Thread Yu Xu

Hi Balbi,



> Hi,
> 
> On Thu, Aug 09, 2012 at 06:02:46PM +0800, Yu Xu wrote:
>> +static struct platform_driver mv_u3d_phy_driver = {
>> +.probe= mv_u3d_phy_probe,
>> +.remove= __devexit_p(mv_u3d_phy_remove),
>> +.driver= {
>> +.name= "mv-u3d-phy",
>> +.owner= THIS_MODULE,
>> +},
>> +};
>> +
>> +static int __init mv_u3d_phy_driver_init(void)
>> +{
>> +return platform_driver_register(&mv_u3d_phy_driver);
>> +}
>> +subsys_initcall(mv_u3d_phy_driver_init);
> 
> please switch to module_platform_driver() and return -EPROBE_DEFER on
> dependent drivers.
> 
Thanks! I'll fix it.

> -- 
> balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] usb: phy: mv_u3d: Add usb phy driver for mv_u3d

2012-08-09 Thread Yu Xu
The driver supports phy_init and phy_shutdown functions to
enable and disable phy for Marvell USB 3.0 controller.

Signed-off-by: Yu Xu 
---
 drivers/usb/phy/Kconfig  |8 +
 drivers/usb/phy/Makefile |1 +
 drivers/usb/phy/mv_u3d_phy.c |  354 ++
 drivers/usb/phy/mv_u3d_phy.h |  105 +
 4 files changed, 468 insertions(+)
 create mode 100644 drivers/usb/phy/mv_u3d_phy.c
 create mode 100644 drivers/usb/phy/mv_u3d_phy.h

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index e7cf84f..2838adb 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 MV_U3D_PHY
+   bool "Marvell USB 3.0 PHY controller Driver"
+   depends on USB_MV_U3D
+   select USB_OTG_UTILS
+   help
+ Enable this to support Marvell USB 3.0 phy controller for Marvell
+ SoC.
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index eca095b..cf38f08 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_MV_U3D_PHY)   += mv_u3d_phy.o
diff --git a/drivers/usb/phy/mv_u3d_phy.c b/drivers/usb/phy/mv_u3d_phy.c
new file mode 100644
index 000..99312e4
--- /dev/null
+++ b/drivers/usb/phy/mv_u3d_phy.c
@@ -0,0 +1,354 @@
+/*
+ * Copyright (C) 2011 Marvell International Ltd. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "mv_u3d_phy.h"
+
+/*
+ * struct mv_u3d_phy - transceiver driver state
+ * @phy: transceiver structure
+ * @dev: The parent device supplied to the probe function
+ * @clk: usb phy clock
+ * @base: usb phy register memory base
+ */
+struct mv_u3d_phy {
+   struct usb_phy  phy;
+   struct mv_usb_platform_data *plat;
+   struct device   *dev;
+   struct clk  *clk;
+   void __iomem*base;
+};
+
+static u32 mv_u3d_phy_read(void __iomem *base, u32 reg)
+{
+   void __iomem *addr, *data;
+
+   addr = base;
+   data = base + 0x4;
+
+   writel_relaxed(reg, addr);
+   return readl_relaxed(data);
+}
+
+static void mv_u3d_phy_set(void __iomem *base, u32 reg, u32 value)
+{
+   void __iomem *addr, *data;
+   u32 tmp;
+
+   addr = base;
+   data = base + 0x4;
+
+   writel_relaxed(reg, addr);
+   tmp = readl_relaxed(data);
+   tmp |= value;
+   writel_relaxed(tmp, data);
+}
+
+static void mv_u3d_phy_clear(void __iomem *base, u32 reg, u32 value)
+{
+   void __iomem *addr, *data;
+   u32 tmp;
+
+   addr = base;
+   data = base + 0x4;
+
+   writel_relaxed(reg, addr);
+   tmp = readl_relaxed(data);
+   tmp &= ~value;
+   writel_relaxed(tmp, data);
+}
+
+static void mv_u3d_phy_write(void __iomem *base, u32 reg, u32 value)
+{
+   void __iomem *addr, *data;
+
+   addr = base;
+   data = base + 0x4;
+
+   writel_relaxed(reg, addr);
+   writel_relaxed(value, data);
+}
+
+static void mv_u3d_phy_reg_print(void __iomem *base, u32 reg)
+{
+   u32 data;
+   data = mv_u3d_phy_read(base, reg);
+   pr_debug("phy reg 0x%x: phy data 0x%x\n", reg, data);
+}
+
+void mv_u3d_phy_shutdown(struct usb_phy *phy)
+{
+   struct mv_u3d_phy *mv_u3d_phy;
+   void __iomem *base;
+   u32 val;
+
+   mv_u3d_phy = container_of(phy, struct mv_u3d_phy, phy);
+   base = mv_u3d_phy->base;
+
+   /* Power down Reference Analog current, bit 15
+* Power down PLL, bit 14
+* Power down Receiver, bit 13
+* Power down Transmitter, bit 12
+* of USB3_POWER_PLL_CONTROL register
+*/
+   val = mv_u3d_phy_read(base, USB3_POWER_PLL_CONTROL);
+   val &= ~(USB3_POWER_PLL_CONTROL_PU);
+   mv_u3d_phy_write(base, USB3_POWER_PLL_CONTROL, val);
+
+   if (mv_u3d_phy->clk)
+   clk_disable(mv_u3d_phy->clk);
+}
+
+static int mv_u3d_phy_init(struct usb_phy *phy)
+{
+   struct mv_u3d_phy *mv_u3d_phy;
+   void __iomem *base;
+   u32 val, count;
+
+   /* enable usb3 phy */
+   mv_u3d_phy = container_of(phy, struct mv_u3d_phy, phy);
+
+   if (mv_u3d_phy->clk)
+   clk_enable(mv_u3d_phy->clk);
+
+   base = mv_u3d_phy->base;
+
+   val = mv_u3d_phy_read(base, USB3_POWER_PLL_CONTROL);
+   val &= ~(USB3_POWER_PLL_CONTROL_PU_MASK);
+   val |= 0xF << USB3_POWER_PLL_CONTROL_PU_SHIFT;
+   mv_u3d_phy_write(base, USB3_POWER_PLL_CONTROL, val);
+ 

Re: [PATCH v2] usb: phy: mv_u3d: Add usb phy driver for mv_u3d

2012-08-09 Thread Yu Xu
Hi Balbi,



> On Thu, Aug 09, 2012 at 08:04:44PM +0800, Yu Xu wrote:
>> The driver supports phy_init and phy_shutdown functions to
>> enable and disable phy for Marvell USB 3.0 controller.
>> 
>> Signed-off-by: Yu Xu 
>> ---
>> drivers/usb/phy/Kconfig  |8 +
>> drivers/usb/phy/Makefile |1 +
>> drivers/usb/phy/mv_u3d_phy.c |  354 
>> ++
>> drivers/usb/phy/mv_u3d_phy.h |  105 +
>> 4 files changed, 468 insertions(+)
>> create mode 100644 drivers/usb/phy/mv_u3d_phy.c
>> create mode 100644 drivers/usb/phy/mv_u3d_phy.h
>> 
>> diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
>> index e7cf84f..2838adb 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 MV_U3D_PHY
>> +bool "Marvell USB 3.0 PHY controller Driver"
>> +depends on USB_MV_U3D
>> +select USB_OTG_UTILS
>> +help
>> +  Enable this to support Marvell USB 3.0 phy controller for Marvell
>> +  SoC.
>> diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
>> index eca095b..cf38f08 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_MV_U3D_PHY)+= mv_u3d_phy.o
>> diff --git a/drivers/usb/phy/mv_u3d_phy.c b/drivers/usb/phy/mv_u3d_phy.c
>> new file mode 100644
>> index 000..99312e4
>> --- /dev/null
>> +++ b/drivers/usb/phy/mv_u3d_phy.c
>> @@ -0,0 +1,354 @@
>> +/*
>> + * Copyright (C) 2011 Marvell International Ltd. All rights reserved.
>> + *
>> + * This program is free software; you can redistribute it and/or modify it
>> + * under the terms and conditions of the GNU General Public License,
>> + * version 2, as published by the Free Software Foundation.
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include "mv_u3d_phy.h"
>> +
>> +/*
>> + * struct mv_u3d_phy - transceiver driver state
>> + * @phy: transceiver structure
>> + * @dev: The parent device supplied to the probe function
>> + * @clk: usb phy clock
>> + * @base: usb phy register memory base
>> + */
>> +struct mv_u3d_phy {
>> +struct usb_phyphy;
>> +struct mv_usb_platform_data *plat;
>> +struct device*dev;
>> +struct clk*clk;
>> +void __iomem*base;
>> +};
>> +
>> +static u32 mv_u3d_phy_read(void __iomem *base, u32 reg)
>> +{
>> +void __iomem *addr, *data;
>> +
>> +addr = base;
>> +data = base + 0x4;
>> +
>> +writel_relaxed(reg, addr);
>> +return readl_relaxed(data);
>> +}
>> +
>> +static void mv_u3d_phy_set(void __iomem *base, u32 reg, u32 value)
>> +{
>> +void __iomem *addr, *data;
>> +u32 tmp;
>> +
>> +addr = base;
>> +data = base + 0x4;
>> +
>> +writel_relaxed(reg, addr);
>> +tmp = readl_relaxed(data);
>> +tmp |= value;
>> +writel_relaxed(tmp, data);
>> +}
>> +
>> +static void mv_u3d_phy_clear(void __iomem *base, u32 reg, u32 value)
>> +{
>> +void __iomem *addr, *data;
>> +u32 tmp;
>> +
>> +addr = base;
>> +data = base + 0x4;
>> +
>> +writel_relaxed(reg, addr);
>> +tmp = readl_relaxed(data);
>> +tmp &= ~value;
>> +writel_relaxed(tmp, data);
>> +}
>> +
>> +static void mv_u3d_phy_write(void __iomem *base, u32 reg, u32 value)
>> +{
>> +void __iomem *addr, *data;
>> +
>> +addr = base;
>> +data = base + 0x4;
>> +
>> +writel_relaxed(reg, addr);
>> +writel_relaxed(value, data);
>> +}
>> +
>> +static void mv_u3d_phy_reg_print(void __iomem *base, u32 reg)
>> +{
>> +u32 data;
>> +data = mv_u3d_phy_read(base, reg);
>> +pr_debug("phy reg 0x%x: phy data 0x%x\n", reg, data);
>> +}
>> +
>> +void mv_u3d_phy_shutdown(struct usb_phy *phy)
>> +{
>> +struct mv_u3d_phy *mv_u3d_phy;
>> +void __iomem *base;
>> +u32 val;
>> +
>> +m

[PATCH v3] usb: phy: mv_u3d: Add usb phy driver for mv_u3d

2012-08-09 Thread Yu Xu
The driver supports phy_init and phy_shutdown functions to
enable and disable phy for Marvell USB 3.0 controller.

Signed-off-by: Yu Xu 
---
 drivers/usb/phy/Kconfig  |8 +
 drivers/usb/phy/Makefile |1 +
 drivers/usb/phy/mv_u3d_phy.c |  345 ++
 drivers/usb/phy/mv_u3d_phy.h |  105 +
 4 files changed, 459 insertions(+)
 create mode 100644 drivers/usb/phy/mv_u3d_phy.c
 create mode 100644 drivers/usb/phy/mv_u3d_phy.h

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index e7cf84f..2838adb 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 MV_U3D_PHY
+   bool "Marvell USB 3.0 PHY controller Driver"
+   depends on USB_MV_U3D
+   select USB_OTG_UTILS
+   help
+ Enable this to support Marvell USB 3.0 phy controller for Marvell
+ SoC.
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index eca095b..cf38f08 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_MV_U3D_PHY)   += mv_u3d_phy.o
diff --git a/drivers/usb/phy/mv_u3d_phy.c b/drivers/usb/phy/mv_u3d_phy.c
new file mode 100644
index 000..9f1c5d3
--- /dev/null
+++ b/drivers/usb/phy/mv_u3d_phy.c
@@ -0,0 +1,345 @@
+/*
+ * Copyright (C) 2011 Marvell International Ltd. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "mv_u3d_phy.h"
+
+/*
+ * struct mv_u3d_phy - transceiver driver state
+ * @phy: transceiver structure
+ * @dev: The parent device supplied to the probe function
+ * @clk: usb phy clock
+ * @base: usb phy register memory base
+ */
+struct mv_u3d_phy {
+   struct usb_phy  phy;
+   struct mv_usb_platform_data *plat;
+   struct device   *dev;
+   struct clk  *clk;
+   void __iomem*base;
+};
+
+static u32 mv_u3d_phy_read(void __iomem *base, u32 reg)
+{
+   void __iomem *addr, *data;
+
+   addr = base;
+   data = base + 0x4;
+
+   writel_relaxed(reg, addr);
+   return readl_relaxed(data);
+}
+
+static void mv_u3d_phy_set(void __iomem *base, u32 reg, u32 value)
+{
+   void __iomem *addr, *data;
+   u32 tmp;
+
+   addr = base;
+   data = base + 0x4;
+
+   writel_relaxed(reg, addr);
+   tmp = readl_relaxed(data);
+   tmp |= value;
+   writel_relaxed(tmp, data);
+}
+
+static void mv_u3d_phy_clear(void __iomem *base, u32 reg, u32 value)
+{
+   void __iomem *addr, *data;
+   u32 tmp;
+
+   addr = base;
+   data = base + 0x4;
+
+   writel_relaxed(reg, addr);
+   tmp = readl_relaxed(data);
+   tmp &= ~value;
+   writel_relaxed(tmp, data);
+}
+
+static void mv_u3d_phy_write(void __iomem *base, u32 reg, u32 value)
+{
+   void __iomem *addr, *data;
+
+   addr = base;
+   data = base + 0x4;
+
+   writel_relaxed(reg, addr);
+   writel_relaxed(value, data);
+}
+
+void mv_u3d_phy_shutdown(struct usb_phy *phy)
+{
+   struct mv_u3d_phy *mv_u3d_phy;
+   void __iomem *base;
+   u32 val;
+
+   mv_u3d_phy = container_of(phy, struct mv_u3d_phy, phy);
+   base = mv_u3d_phy->base;
+
+   /* Power down Reference Analog current, bit 15
+* Power down PLL, bit 14
+* Power down Receiver, bit 13
+* Power down Transmitter, bit 12
+* of USB3_POWER_PLL_CONTROL register
+*/
+   val = mv_u3d_phy_read(base, USB3_POWER_PLL_CONTROL);
+   val &= ~(USB3_POWER_PLL_CONTROL_PU);
+   mv_u3d_phy_write(base, USB3_POWER_PLL_CONTROL, val);
+
+   if (mv_u3d_phy->clk)
+   clk_disable(mv_u3d_phy->clk);
+}
+
+static int mv_u3d_phy_init(struct usb_phy *phy)
+{
+   struct mv_u3d_phy *mv_u3d_phy;
+   void __iomem *base;
+   u32 val, count;
+
+   /* enable usb3 phy */
+   mv_u3d_phy = container_of(phy, struct mv_u3d_phy, phy);
+
+   if (mv_u3d_phy->clk)
+   clk_enable(mv_u3d_phy->clk);
+
+   base = mv_u3d_phy->base;
+
+   val = mv_u3d_phy_read(base, USB3_POWER_PLL_CONTROL);
+   val &= ~(USB3_POWER_PLL_CONTROL_PU_MASK);
+   val |= 0xF << USB3_POWER_PLL_CONTROL_PU_SHIFT;
+   mv_u3d_phy_write(base, USB3_POWER_PLL_CONTROL, val);
+   udelay(100);
+
+   mv_u3d_phy_write(base, USB3_RESET_CONTROL,
+   USB3_RESET_CONTROL_RESET_PIPE);
+   udelay(100);
+
+   mv_u3d_phy_write(base, USB3_RESET_CONTRO

RE: [PATCH V2 6/6] usb: mv_usb: remove clock name from pdata

2013-04-02 Thread Yu Xu
Hi,

> -Original Message-
> From: Felipe Balbi [mailto:ba...@ti.com]
> Sent: 2013年4月2日 16:15
> To: Chao Xie
> Cc: linux-usb@vger.kernel.org; linux-arm-ker...@lists.infradead.org;
> haojian.zhu...@gmail.com; ba...@ti.com; xiechao.m...@gmail.com; Yu Xu
> Subject: Re: [PATCH V2 6/6] usb: mv_usb: remove clock name from pdata
> 
> Hi,
> 
> On Mon, Mar 25, 2013 at 03:06:57AM -0400, Chao Xie wrote:
> > Using pdata to pass clock name is not correct.
> > Directly get clock from usb drivers.
> >
> > Signed-off-by: Chao Xie 
> > ---
> >  include/linux/platform_data/mv_usb.h |2 --
> >  1 files changed, 0 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/linux/platform_data/mv_usb.h
> > b/include/linux/platform_data/mv_usb.h
> > index 944b01d..98b7925 100644
> > --- a/include/linux/platform_data/mv_usb.h
> > +++ b/include/linux/platform_data/mv_usb.h
> > @@ -34,8 +34,6 @@ struct mv_usb_addon_irq {  };
> >
> >  struct mv_usb_platform_data {
> > -   unsigned intclknum;
> > -   char**clkname;
> 
> this patch breaks mv_u3d_core.c, I have added another patch to the
> series (see below), let me know if this isn't the right fix.
> 
> From 49c1bfb43cbd1228abfffbc8d0ebb2e510b93bd7 Mon Sep 17 00:00:00 2001
> From: Felipe Balbi 
> Date: Tue, 2 Apr 2013 11:12:11 +0300
> Subject: [PATCH] usb: gadget: mv_u3d_core: remove unused clock
> 
> The origianl understanding of clock is wrong. The UDC controller only
> have one clock input.
> Passing clock name by pdata is wrong. The clock is defined by device
> iteself.
> 
> Cc: Chao Xie 
> Cc: Yu Xu 
> Signed-off-by: Felipe Balbi 
> ---
>  drivers/usb/gadget/mv_u3d_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/mv_u3d_core.c
> b/drivers/usb/gadget/mv_u3d_core.c
> index 9675227..58288e9 100644
> --- a/drivers/usb/gadget/mv_u3d_core.c
> +++ b/drivers/usb/gadget/mv_u3d_core.c
> @@ -1821,7 +1821,7 @@ static int mv_u3d_probe(struct platform_device
> *dev)
>   u3d->dev = &dev->dev;
>   u3d->vbus = pdata->vbus;
> 
> - u3d->clk = clk_get(&dev->dev, pdata->clkname[0]);
> + u3d->clk = clk_get(&dev->dev, NULL);
>   if (IS_ERR(u3d->clk)) {
>   retval = PTR_ERR(u3d->clk);
>   goto err_get_clk;
> --
> 1.8.2
> 
> --
> balbi

Acked-by: Yu Xu 

Regards,
Yu Xu


N�Р骒r��yb�X�肚�v�^�)藓{.n�+�伐�{焙柒��^n�r■�z���h�ㄨ��&Ⅷ�G���h�(�茛j"���m赇z罐��帼f"�h���~�m�

RE: [PATCH] USB: remove incorrect __exit markups

2013-04-24 Thread Yu Xu
Hi,

> -Original Message-
> From: Dmitry Torokhov [mailto:dmitry.torok...@gmail.com]
> Sent: 2013年2月24日 16:55
> To: linux-usb@vger.kernel.org
> Cc: Alan Stern; Greg Kroah-Hartman; Daniel Mack; Tzachi Perelstein;
> Hema HK; Tony Lindgren; Yu Xu
> Subject: [PATCH] USB: remove incorrect __exit markups
> 
> Even if bus is not hot-pluggable, the devices can be unbound from the
> driver via sysfs, so we should not be using __exit annotations on
> remove() methods. The only exception is drivers registered with
> platform_driver_probe() which specifically disables sysfs bind/unbind
> attributes.
> 
> Signed-off-by: Dmitry Torokhov 
> ---
>  drivers/usb/host/ehci-mxc.c| 2 +-
>  drivers/usb/host/ehci-orion.c  | 4 ++--
>  drivers/usb/host/ehci-sh.c | 4 ++--
>  drivers/usb/otg/isp1301_omap.c | 4 ++--
>  drivers/usb/otg/twl4030-usb.c  | 4 ++--
>  drivers/usb/otg/twl6030-usb.c  | 4 ++--
>  drivers/usb/phy/mv_u3d_phy.c   | 2 +-
>  7 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
> index dedb80b..85c99c3 100644
> --- a/drivers/usb/host/ehci-mxc.c
> +++ b/drivers/usb/host/ehci-mxc.c
> @@ -199,7 +199,7 @@ err_alloc:
>   return ret;
>  }
> 
> -static int __exit ehci_mxc_drv_remove(struct platform_device *pdev)
> +static int ehci_mxc_drv_remove(struct platform_device *pdev)
>  {
>   struct mxc_usbh_platform_data *pdata = pdev->dev.platform_data;
>   struct usb_hcd *hcd = platform_get_drvdata(pdev);
> diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-
> orion.c
> index 914a3ec..38c45fb 100644
> --- a/drivers/usb/host/ehci-orion.c
> +++ b/drivers/usb/host/ehci-orion.c
> @@ -305,7 +305,7 @@ err1:
>   return err;
>  }
> 
> -static int __exit ehci_orion_drv_remove(struct platform_device *pdev)
> +static int ehci_orion_drv_remove(struct platform_device *pdev)
>  {
>   struct usb_hcd *hcd = platform_get_drvdata(pdev);
>   struct clk *clk;
> @@ -333,7 +333,7 @@ MODULE_DEVICE_TABLE(of, ehci_orion_dt_ids);
> 
>  static struct platform_driver ehci_orion_driver = {
>   .probe  = ehci_orion_drv_probe,
> - .remove = __exit_p(ehci_orion_drv_remove),
> + .remove = ehci_orion_drv_remove,
>   .shutdown   = usb_hcd_platform_shutdown,
>   .driver = {
>   .name   = "orion-ehci",
> diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c
> index 0c90a24..2deef81 100644
> --- a/drivers/usb/host/ehci-sh.c
> +++ b/drivers/usb/host/ehci-sh.c
> @@ -171,7 +171,7 @@ fail_create_hcd:
>   return ret;
>  }
> 
> -static int __exit ehci_hcd_sh_remove(struct platform_device *pdev)
> +static int ehci_hcd_sh_remove(struct platform_device *pdev)
>  {
>   struct ehci_sh_priv *priv = platform_get_drvdata(pdev);
>   struct usb_hcd *hcd = priv->hcd;
> @@ -197,7 +197,7 @@ static void ehci_hcd_sh_shutdown(struct
> platform_device *pdev)
> 
>  static struct platform_driver ehci_hcd_sh_driver = {
>   .probe  = ehci_hcd_sh_probe,
> - .remove = __exit_p(ehci_hcd_sh_remove),
> + .remove = ehci_hcd_sh_remove
>   .shutdown   = ehci_hcd_sh_shutdown,
>   .driver = {
>   .name   = "sh_ehci",
> diff --git a/drivers/usb/otg/isp1301_omap.c
> b/drivers/usb/otg/isp1301_omap.c
> index af9cb11..8b9de95 100644
> --- a/drivers/usb/otg/isp1301_omap.c
> +++ b/drivers/usb/otg/isp1301_omap.c
> @@ -1212,7 +1212,7 @@ static void isp1301_release(struct device *dev)
> 
>  static struct isp1301 *the_transceiver;
> 
> -static int __exit isp1301_remove(struct i2c_client *i2c)
> +static int isp1301_remove(struct i2c_client *i2c)
>  {
>   struct isp1301  *isp;
> 
> @@ -1634,7 +1634,7 @@ static struct i2c_driver isp1301_driver = {
>   .name   = "isp1301_omap",
>   },
>   .probe  = isp1301_probe,
> - .remove = __exit_p(isp1301_remove),
> + .remove = isp1301_remove,
>   .id_table   = isp1301_id,
>  };
> 
> diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-
> usb.c
> index 0a70193..4e04579 100644
> --- a/drivers/usb/otg/twl4030-usb.c
> +++ b/drivers/usb/otg/twl4030-usb.c
> @@ -657,7 +657,7 @@ static int twl4030_usb_probe(struct platform_device
> *pdev)
>   return 0;
>  }
> 
> -static int __exit twl4030_usb_remove(struct platform_device *pdev)
> +static int twl4030_usb_remove(struct platform_device *pdev)
>  {
>   struct twl4030_usb *twl = platform_get_drvdata(pdev);
>   int val;
> @@ -701,7 +701,7 @@ MODULE_DEVICE_TABLE(of, tw