[PATCH 17/21] usb: chipidea: msm: Make platform data driver local instead of global

2016-06-26 Thread Stephen Boyd
If two devices are probed with this same driver, they'll share
the same platform data structure, while the chipidea core layer
writes and modifies it. This can lead to interesting results
especially if one device is an OTG type chipidea controller and
another is a host. Let's create a copy of this structure per each
device instance so that odd things don't happen.

Cc: Peter Chen <peter.c...@nxp.com>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Signed-off-by: Stephen Boyd <stephen.b...@linaro.org>
---
 drivers/usb/chipidea/ci_hdrc_msm.c | 19 ---
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c 
b/drivers/usb/chipidea/ci_hdrc_msm.c
index cc6f9b0df9d5..fb4340f02c16 100644
--- a/drivers/usb/chipidea/ci_hdrc_msm.c
+++ b/drivers/usb/chipidea/ci_hdrc_msm.c
@@ -37,6 +37,7 @@ struct ci_hdrc_msm {
struct clk *core_clk;
struct clk *iface_clk;
struct extcon_dev *vbus_edev;
+   struct ci_hdrc_platform_data pdata;
bool secondary_phy;
bool hsic;
void __iomem *base;
@@ -79,16 +80,6 @@ static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, 
unsigned event)
}
 }
 
-static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = {
-   .name   = "ci_hdrc_msm",
-   .capoffset  = DEF_CAPOFFSET,
-   .flags  = CI_HDRC_REGS_SHARED |
- CI_HDRC_DISABLE_STREAMING |
- CI_HDRC_OVERRIDE_AHB_BURST,
-
-   .notify_event   = ci_hdrc_msm_notify_event,
-};
-
 static int ci_hdrc_msm_mux_phy(struct ci_hdrc_msm *ci,
   struct platform_device *pdev)
 {
@@ -151,6 +142,12 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, ci);
 
+   ci->pdata.name = "ci_hdrc_msm";
+   ci->pdata.capoffset = DEF_CAPOFFSET;
+   ci->pdata.flags = CI_HDRC_REGS_SHARED | CI_HDRC_DISABLE_STREAMING |
+ CI_HDRC_OVERRIDE_AHB_BURST;
+   ci->pdata.notify_event = ci_hdrc_msm_notify_event;
+
reset = devm_reset_control_get(>dev, "core");
if (IS_ERR(reset))
return PTR_ERR(reset);
@@ -204,7 +201,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
of_node_put(ulpi_node);
 
plat_ci = ci_hdrc_add_device(>dev, pdev->resource,
-pdev->num_resources, 
_hdrc_msm_platdata);
+pdev->num_resources, >pdata);
if (IS_ERR(plat_ci)) {
dev_err(>dev, "ci_hdrc_add_device failed!\n");
ret = PTR_ERR(plat_ci);
-- 
2.9.0.rc2.8.ga28705d

--
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 09/21] usb: chipidea: Add support for ULPI PHY bus

2016-06-26 Thread Stephen Boyd
Some phys for the chipidea controller are controlled via the ULPI
viewport. Add support for the ULPI bus so that these sorts of
phys can be probed and read/written automatically without having
to duplicate the viewport logic in each phy driver.

Cc: Peter Chen <peter.c...@nxp.com>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Cc: Heikki Krogerus <heikki.kroge...@linux.intel.com>
Signed-off-by: Stephen Boyd <stephen.b...@linaro.org>
---
 drivers/usb/chipidea/Kconfig  |   7 +++
 drivers/usb/chipidea/Makefile |   1 +
 drivers/usb/chipidea/ci.h |  20 
 drivers/usb/chipidea/core.c   |  30 ---
 drivers/usb/chipidea/ulpi.c   | 113 ++
 5 files changed, 165 insertions(+), 6 deletions(-)
 create mode 100644 drivers/usb/chipidea/ulpi.c

diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig
index 3644a3500b70..4f8c342a8865 100644
--- a/drivers/usb/chipidea/Kconfig
+++ b/drivers/usb/chipidea/Kconfig
@@ -37,4 +37,11 @@ config USB_CHIPIDEA_HOST
  Say Y here to enable host controller functionality of the
  ChipIdea driver.
 
+config USB_CHIPIDEA_ULPI
+   bool "ChipIdea ULPI PHY support"
+   depends on USB_ULPI_BUS=y || USB_ULPI_BUS=USB_CHIPIDEA
+   help
+ Say Y here if you have a ULPI PHY attached to your ChipIdea
+ controller.
+
 endif
diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
index 518e445476c3..39fca5715ed3 100644
--- a/drivers/usb/chipidea/Makefile
+++ b/drivers/usb/chipidea/Makefile
@@ -4,6 +4,7 @@ ci_hdrc-y   := core.o otg.o debug.o
 ci_hdrc-$(CONFIG_USB_CHIPIDEA_UDC) += udc.o
 ci_hdrc-$(CONFIG_USB_CHIPIDEA_HOST)+= host.o
 ci_hdrc-$(CONFIG_USB_OTG_FSM)  += otg_fsm.o
+ci_hdrc-$(CONFIG_USB_CHIPIDEA_ULPI)+= ulpi.o
 
 # Glue/Bridge layers go here
 
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index f87805235caa..14aa20525547 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -18,6 +18,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 /**
  * DEFINE
@@ -52,6 +54,7 @@ enum ci_hw_regs {
OP_ENDPTLISTADDR,
OP_TTCTRL,
OP_BURSTSIZE,
+   OP_ULPI_VIEWPORT,
OP_PORTSC,
OP_DEVLC,
OP_OTGSC,
@@ -187,6 +190,7 @@ struct hw_bank {
  * @test_mode: the selected test mode
  * @platdata: platform specific information supplied by parent device
  * @vbus_active: is VBUS active
+ * @ulpi: pointer to ULPI device, if any
  * @phy: pointer to PHY, if any
  * @usb_phy: pointer to USB PHY, if any and if using the USB PHY framework
  * @hcd: pointer to usb_hcd for ehci host driver
@@ -236,6 +240,10 @@ struct ci_hdrc {
 
struct ci_hdrc_platform_data*platdata;
int vbus_active;
+#ifdef CONFIG_USB_CHIPIDEA_ULPI
+   struct ulpi *ulpi;
+   struct ulpi_ops ulpi_ops;
+#endif
struct phy  *phy;
/* old usb_phy interface */
struct usb_phy  *usb_phy;
@@ -418,6 +426,17 @@ static inline bool ci_otg_is_fsm_mode(struct ci_hdrc *ci)
 #endif
 }
 
+#if IS_ENABLED(CONFIG_USB_CHIPIDEA_ULPI)
+int ci_ulpi_init(struct ci_hdrc *ci);
+void ci_ulpi_exit(struct ci_hdrc *ci);
+int ci_ulpi_resume(struct ci_hdrc *ci);
+#else
+static inline int ci_ulpi_init(struct ci_hdrc *ci) { return 0; }
+static inline void ci_ulpi_exit(struct ci_hdrc *ci) { }
+static inline int ci_ulpi_resume(struct ci_hdrc *ci) { return 0; }
+#endif
+
+
 u32 hw_read_intr_enable(struct ci_hdrc *ci);
 
 u32 hw_read_intr_status(struct ci_hdrc *ci);
@@ -432,6 +451,7 @@ int hw_wait_reg(struct ci_hdrc *ci, enum ci_hw_regs reg, 
u32 mask,
u32 value, unsigned int timeout_ms);
 
 void ci_usb_phy_exit(struct ci_hdrc *ci);
+void hw_phymode_configure(struct ci_hdrc *ci);
 int ci_platform_configure(struct ci_hdrc *ci);
 
 int dbg_create_files(struct ci_hdrc *ci);
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index a01611c7f815..ea84fc0a03a6 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -86,6 +86,7 @@ static const u8 ci_regs_nolpm[] = {
[OP_ENDPTLISTADDR]  = 0x18U,
[OP_TTCTRL] = 0x1CU,
[OP_BURSTSIZE]  = 0x20U,
+   [OP_ULPI_VIEWPORT]  = 0x30U,
[OP_PORTSC] = 0x44U,
[OP_DEVLC]  = 0x84U,
[OP_OTGSC]  = 0x64U,
@@ -110,6 +111,7 @@ static const u8 ci_regs_lpm[] = {
[OP_ENDPTLISTADDR]  = 0x18U,
[OP_TTCTRL] = 0x1CU,
[OP_BURSTSIZE]  = 0x20U,
+   [OP_ULPI_VIEWPORT]  = 0x30U,
[OP_PORTSC] = 0x44U,
[OP_DEVLC]  = 0x84U,
[OP_OTGSC]  = 0xC4U,
@@ -285,7 +

[PATCH 10/21] usb: chipidea: msm: Rely on core to override AHBBURST

2016-06-26 Thread Stephen Boyd
The core framework already handles setting this parameter with a
platform quirk. Add the appropriate flag so that we always set
AHBBURST to 0. Technically DT should be doing this, but we always
do it for msm chipidea devices so setting the flag in the driver
works just as well.

Cc: Peter Chen <peter.c...@nxp.com>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Signed-off-by: Stephen Boyd <stephen.b...@linaro.org>
---
 drivers/usb/chipidea/ci_hdrc_msm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c 
b/drivers/usb/chipidea/ci_hdrc_msm.c
index 3889809fd0c4..37591a4b1346 100644
--- a/drivers/usb/chipidea/ci_hdrc_msm.c
+++ b/drivers/usb/chipidea/ci_hdrc_msm.c
@@ -24,7 +24,6 @@ static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, 
unsigned event)
switch (event) {
case CI_HDRC_CONTROLLER_RESET_EVENT:
dev_dbg(dev, "CI_HDRC_CONTROLLER_RESET_EVENT received\n");
-   writel(0, USB_AHBBURST);
/* use AHB transactor, allow posted data writes */
writel(0x8, USB_AHBMODE);
usb_phy_init(ci->usb_phy);
@@ -47,7 +46,8 @@ static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = {
.name   = "ci_hdrc_msm",
.capoffset  = DEF_CAPOFFSET,
.flags  = CI_HDRC_REGS_SHARED |
- CI_HDRC_DISABLE_STREAMING,
+ CI_HDRC_DISABLE_STREAMING |
+ CI_HDRC_OVERRIDE_AHB_BURST,
 
.notify_event   = ci_hdrc_msm_notify_event,
 };
-- 
2.9.0.rc2.8.ga28705d

--
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 07/21] usb: chipidea: Notify of reset when switching into host mode

2016-06-26 Thread Stephen Boyd
The chipidea/udc.c file sends a CI_HDRC_CONTROLLER_RESET_EVENT to
the wrapper drivers when it calls hw_device_reset(), but that
function is not called from chipidea/host.c. The intent of this
event is to allow the wrapper driver to do any wrapper specific
things after the reset bit has been set in the usb command
register. Therefore, add this event hook in the host role after
we toggle that bit.

Cc: Peter Chen <peter.c...@nxp.com>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Signed-off-by: Stephen Boyd <stephen.b...@linaro.org>
---
 drivers/usb/chipidea/host.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
index 523c155daea8..3344d3256a60 100644
--- a/drivers/usb/chipidea/host.c
+++ b/drivers/usb/chipidea/host.c
@@ -87,6 +87,9 @@ static int ehci_ci_reset(struct usb_hcd *hcd)
if (ret)
return ret;
 
+   if (ci->platdata->notify_event)
+   ci->platdata->notify_event(ci, CI_HDRC_CONTROLLER_RESET_EVENT);
+
return ci_platform_configure(ci);
 }
 
-- 
2.9.0.rc2.8.ga28705d

--
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 21/21] phy: Add support for Qualcomm's USB HS phy

2016-06-26 Thread Stephen Boyd
The high-speed phy on qcom SoCs is controlled via the ULPI
viewport.

Cc: Kishon Vijay Abraham I <kis...@ti.com>
Cc: <devicet...@vger.kernel.org>
Signed-off-by: Stephen Boyd <stephen.b...@linaro.org>
---
 .../devicetree/bindings/phy/qcom,usb-hs-phy.txt|  71 ++
 drivers/phy/Kconfig|   8 +
 drivers/phy/Makefile   |   1 +
 drivers/phy/phy-qcom-usb-hs.c  | 283 +
 4 files changed, 363 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/qcom,usb-hs-phy.txt
 create mode 100644 drivers/phy/phy-qcom-usb-hs.c

diff --git a/Documentation/devicetree/bindings/phy/qcom,usb-hs-phy.txt 
b/Documentation/devicetree/bindings/phy/qcom,usb-hs-phy.txt
new file mode 100644
index ..2bd22c53cee0
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/qcom,usb-hs-phy.txt
@@ -0,0 +1,71 @@
+Qualcomm's USB HS PHY
+
+PROPERTIES
+
+- compatible:
+Usage: required
+Value type: 
+Definition: Should contain "qcom,usb-hs-phy"
+
+- #phy-cells:
+Usage: required
+Value type: 
+Definition: Should contain 0
+
+- clocks:
+Usage: required
+Value type: 
+Definition: Should contain clock specifier for the reference and sleep
+clocks
+
+- clock-names:
+Usage: required
+Value type: 
+Definition: Should contain "ref" and "sleep" for the reference and sleep
+clocks respectively
+
+- resets:
+Usage: required
+Value type: 
+Definition: Should contain the phy and POR resets
+
+- reset-names:
+Usage: required
+Value type: 
+Definition: Should contain "phy" and "por" for the phy and POR resets
+respectively
+
+- v3p3-supply:
+Usage: required
+Value type: 
+Definition: Should contain a reference to the 3.3V supply
+
+- v1p8-supply:
+Usage: required
+Value type: 
+Definition: Should contain a reference to the 1.8V supply
+
+- qcom,init-seq:
+Usage: optional
+Value type: 
+Definition: Should contain a sequence of ULPI register and address pairs to
+program into the ULPI_EXT_VENDOR_SPECIFIC area. This is related
+to Device Mode Eye Diagram test.
+
+EXAMPLE
+
+otg: usb-controller {
+   ulpi {
+   phy {
+   compatible = "qcom,usb-hs-phy";
+   #phy-cells = <0>;
+   clocks = <_board>, < GCC_USB2A_PHY_SLEEP_CLK>;
+   clock-names = "ref", "sleep";
+   resets = < GCC_USB2A_PHY_BCR>, < 0>;
+   reset-names = "phy", "por";
+   v3p3-supply = <_l24>;
+   v1p8-supply = <_l6>;
+   qcom,init-seq = /bits/ 8 <0x81 0x63>;
+   };
+   };
+};
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index a2866949dc97..cfb3ded0896d 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -406,6 +406,14 @@ config PHY_QCOM_UFS
help
  Support for UFS PHY on QCOM chipsets.
 
+config PHY_QCOM_USB_HS
+   tristate "Qualcomm USB HS PHY module"
+   depends on USB_ULPI_BUS
+   select GENERIC_PHY
+   help
+ Support for the USB high-speed ULPI compliant phy on Qualcomm
+ chipsets.
+
 config PHY_QCOM_USB_HSIC
tristate "Qualcomm USB HSIC ULPI PHY module"
depends on USB_ULPI_BUS
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 982e84a290ec..21435fc0b656 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -49,6 +49,7 @@ obj-$(CONFIG_PHY_STIH41X_USB) += phy-stih41x-usb.o
 obj-$(CONFIG_PHY_QCOM_UFS) += phy-qcom-ufs.o
 obj-$(CONFIG_PHY_QCOM_UFS) += phy-qcom-ufs-qmp-20nm.o
 obj-$(CONFIG_PHY_QCOM_UFS) += phy-qcom-ufs-qmp-14nm.o
+obj-$(CONFIG_PHY_QCOM_USB_HS)  += phy-qcom-usb-hs.o
 obj-$(CONFIG_PHY_QCOM_USB_HSIC)+= phy-qcom-usb-hsic.o
 obj-$(CONFIG_PHY_TUSB1210) += phy-tusb1210.o
 obj-$(CONFIG_PHY_BRCM_SATA)+= phy-brcm-sata.o
diff --git a/drivers/phy/phy-qcom-usb-hs.c b/drivers/phy/phy-qcom-usb-hs.c
new file mode 100644
index ..8be83100ecd9
--- /dev/null
+++ b/drivers/phy/phy-qcom-usb-hs.c
@@ -0,0 +1,283 @@
+/**
+ * Copyright (C) 2016 Linaro Ltd
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "ulpi_phy.h"
+
+#define ULPI_PWR_CLK_MNG_REG   0x88
+# define ULPI_PWR_OTG_COMP_DISABLE BIT(0)
+
+#define ULPI_MISC_A0x96
+# defin

[PATCH 08/21] usb: chipidea: Kick OTG state machine for AVVIS with vbus extcon

2016-06-26 Thread Stephen Boyd
Force the OTG state machine to go forward when we're using an
extcon for vbus detection. In this case, the controller may never
raise an interrupt for AVVIS, so we need to simulate the event by
toggling the appropriate OTG fsm bits and kicking the state
machine again.

Cc: Peter Chen <peter.c...@nxp.com>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Signed-off-by: Stephen Boyd <stephen.b...@linaro.org>
---
 drivers/usb/chipidea/otg_fsm.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
index de8e22ec3902..aab076fc4d82 100644
--- a/drivers/usb/chipidea/otg_fsm.c
+++ b/drivers/usb/chipidea/otg_fsm.c
@@ -475,6 +475,14 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on)
return;
}
}
+   /*
+* Force state machine forward if we use extcon
+* to detect vbus state (i.e. simulate AVVIS event)
+*/
+   if (!IS_ERR(ci->platdata->vbus_extcon.edev)) {
+   fsm->a_vbus_vld = 1;
+   ci_otg_queue_work(ci);
+   }
/* Disable data pulse irq */
hw_write_otgsc(ci, OTGSC_DPIE, 0);
 
@@ -486,6 +494,15 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on)
 
fsm->a_bus_drop = 1;
fsm->a_bus_req = 0;
+   /*
+* Force state machine forward if we use extcon
+* to detect vbus state (i.e. simulate AVVIS event)
+*/
+   if (!IS_ERR(ci->platdata->vbus_extcon.edev)) {
+   fsm->a_vbus_vld = 0;
+   fsm->b_conn = 0;
+   ci_otg_queue_work(ci);
+   }
}
 }
 
-- 
2.9.0.rc2.8.ga28705d

--
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 13/21] usb: chipidea: msm: Allow core to get usb phy

2016-06-26 Thread Stephen Boyd
The chipidea core gets the usb phy and initializes the phy at the
right point now so we don't need to get the phy in this driver.

Cc: Peter Chen <peter.c...@nxp.com>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Signed-off-by: Stephen Boyd <stephen.b...@linaro.org>
---
 drivers/usb/chipidea/ci_hdrc_msm.c | 21 -
 1 file changed, 21 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c 
b/drivers/usb/chipidea/ci_hdrc_msm.c
index 430856ef1be3..07cccd24a87f 100644
--- a/drivers/usb/chipidea/ci_hdrc_msm.c
+++ b/drivers/usb/chipidea/ci_hdrc_msm.c
@@ -24,15 +24,6 @@ static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, 
unsigned event)
dev_dbg(dev, "CI_HDRC_CONTROLLER_RESET_EVENT received\n");
/* use AHB transactor, allow posted data writes */
hw_write_id_reg(ci, HS_PHY_AHB_MODE, 0x, 0x8);
-   usb_phy_init(ci->usb_phy);
-   break;
-   case CI_HDRC_CONTROLLER_STOPPED_EVENT:
-   dev_dbg(dev, "CI_HDRC_CONTROLLER_STOPPED_EVENT received\n");
-   /*
-* Put the phy in non-driving mode. Otherwise host
-* may not detect soft-disconnection.
-*/
-   usb_phy_notify_disconnect(ci->usb_phy, USB_SPEED_UNKNOWN);
break;
default:
dev_dbg(dev, "unknown ci_hdrc event\n");
@@ -53,21 +44,9 @@ static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = {
 static int ci_hdrc_msm_probe(struct platform_device *pdev)
 {
struct platform_device *plat_ci;
-   struct usb_phy *phy;
 
dev_dbg(>dev, "ci_hdrc_msm_probe\n");
 
-   /*
-* OTG(PHY) driver takes care of PHY initialization, clock management,
-* powering up VBUS, mapping of registers address space and power
-* management.
-*/
-   phy = devm_usb_get_phy_by_phandle(>dev, "usb-phy", 0);
-   if (IS_ERR(phy))
-   return PTR_ERR(phy);
-
-   ci_hdrc_msm_platdata.usb_phy = phy;
-
plat_ci = ci_hdrc_add_device(>dev,
pdev->resource, pdev->num_resources,
_hdrc_msm_platdata);
-- 
2.9.0.rc2.8.ga28705d

--
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 11/21] usb: chipidea: msm: Use hw_write_id_reg() instead of writel directly

2016-06-26 Thread Stephen Boyd
The MSM_USB_BASE macro trick is not very clear, and we're using
it for only one register write so let's just move to using
hw_write_id_reg() and passing the ci pointer instead. That
clearly shows what offset we're using and avoids needing to
include the msm_hsusb_hw.h file when we're going to delete that
file soon.

Cc: Peter Chen <peter.c...@nxp.com>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Signed-off-by: Stephen Boyd <stephen.b...@linaro.org>
---
 drivers/usb/chipidea/ci_hdrc_msm.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c 
b/drivers/usb/chipidea/ci_hdrc_msm.c
index 37591a4b1346..520c85e701ef 100644
--- a/drivers/usb/chipidea/ci_hdrc_msm.c
+++ b/drivers/usb/chipidea/ci_hdrc_msm.c
@@ -8,14 +8,12 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 
 #include "ci.h"
 
-#define MSM_USB_BASE   (ci->hw_bank.abs)
+#define HS_PHY_AHB_MODE0x0098
 
 static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event)
 {
@@ -25,7 +23,7 @@ static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, 
unsigned event)
case CI_HDRC_CONTROLLER_RESET_EVENT:
dev_dbg(dev, "CI_HDRC_CONTROLLER_RESET_EVENT received\n");
/* use AHB transactor, allow posted data writes */
-   writel(0x8, USB_AHBMODE);
+   hw_write_id_reg(ci, HS_PHY_AHB_MODE, 0x, 0x8);
usb_phy_init(ci->usb_phy);
break;
case CI_HDRC_CONTROLLER_STOPPED_EVENT:
-- 
2.9.0.rc2.8.ga28705d

--
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 14/21] usb: chipidea: msm: Add proper clk and reset support

2016-06-26 Thread Stephen Boyd
The msm chipidea controller uses two main clks, an AHB clk to
read/write the MMIO registers and a core clk called the system
clk that drives the controller itself. Add support for these clks
as they're required in all designs.

Also add support for an optional third clk that we need to turn
on to read/write the ULPI phy registers. Some ULPI phys drive
this clk themselves and so it isn't necessary to turn on to probe
a ULPI device, but the HSIC phy doesn't provide one itself, so we
must turn it on here.

Cc: Peter Chen <peter.c...@nxp.com>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Signed-off-by: Stephen Boyd <stephen.b...@linaro.org>
---
 drivers/usb/chipidea/ci_hdrc_msm.c | 58 +++---
 1 file changed, 54 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c 
b/drivers/usb/chipidea/ci_hdrc_msm.c
index 07cccd24a87f..40249b0e3e93 100644
--- a/drivers/usb/chipidea/ci_hdrc_msm.c
+++ b/drivers/usb/chipidea/ci_hdrc_msm.c
@@ -10,11 +10,19 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "ci.h"
 
 #define HS_PHY_AHB_MODE0x0098
 
+struct ci_hdrc_msm {
+   struct platform_device *ci;
+   struct clk *core_clk;
+   struct clk *iface_clk;
+};
+
 static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event)
 {
struct device *dev = ci->gadget.dev.parent;
@@ -43,34 +51,76 @@ static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = {
 
 static int ci_hdrc_msm_probe(struct platform_device *pdev)
 {
+   struct ci_hdrc_msm *ci;
struct platform_device *plat_ci;
+   struct clk *clk;
+   struct reset_control *reset;
+   int ret;
 
dev_dbg(>dev, "ci_hdrc_msm_probe\n");
 
+   ci = devm_kzalloc(>dev, sizeof(*ci), GFP_KERNEL);
+   if (!ci)
+   return -ENOMEM;
+   platform_set_drvdata(pdev, ci);
+
+   reset = devm_reset_control_get(>dev, "core");
+   if (IS_ERR(reset))
+   return PTR_ERR(reset);
+
+   ci->core_clk = clk = devm_clk_get(>dev, "core");
+   if (IS_ERR(clk))
+   return PTR_ERR(clk);
+
+   ci->iface_clk = clk = devm_clk_get(>dev, "iface");
+   if (IS_ERR(clk))
+   return PTR_ERR(clk);
+
+   reset_control_assert(reset);
+   usleep_range(1, 12000);
+   reset_control_deassert(reset);
+
+   ret = clk_prepare_enable(ci->core_clk);
+   if (ret)
+   return ret;
+
+   ret = clk_prepare_enable(ci->iface_clk);
+   if (ret)
+   goto err_iface;
+
plat_ci = ci_hdrc_add_device(>dev,
pdev->resource, pdev->num_resources,
_hdrc_msm_platdata);
if (IS_ERR(plat_ci)) {
dev_err(>dev, "ci_hdrc_add_device failed!\n");
-   return PTR_ERR(plat_ci);
+   ret = PTR_ERR(plat_ci);
+   goto err_mux;
}
 
-   platform_set_drvdata(pdev, plat_ci);
+   ci->ci = plat_ci;
 
pm_runtime_no_callbacks(>dev);
pm_runtime_enable(>dev);
pm_runtime_get(>dev);
 
return 0;
+
+err_mux:
+   clk_disable_unprepare(ci->iface_clk);
+err_iface:
+   clk_disable_unprepare(ci->core_clk);
+   return ret;
 }
 
 static int ci_hdrc_msm_remove(struct platform_device *pdev)
 {
-   struct platform_device *plat_ci = platform_get_drvdata(pdev);
+   struct ci_hdrc_msm *ci = platform_get_drvdata(pdev);
 
pm_runtime_put(>dev);
pm_runtime_disable(>dev);
-   ci_hdrc_remove_device(plat_ci);
+   ci_hdrc_remove_device(ci->ci);
+   clk_disable_unprepare(ci->iface_clk);
+   clk_disable_unprepare(ci->core_clk);
 
return 0;
 }
-- 
2.9.0.rc2.8.ga28705d

--
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 12/21] usb: chipidea: msm: Keep device runtime enabled

2016-06-26 Thread Stephen Boyd
Sometimes the usb wrapper device is part of a power domain that
needs to stay on as long as the device is active. Let's get and
put the device in driver probe/remove so that we keep the power
domain powered as long as the device is attached. We can fine
tune this later to handle wakeup interrupts, etc. for finer grain
power management later, but this is necessary to make sure we can
keep accessing the device right now.

Cc: Peter Chen <peter.c...@nxp.com>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Signed-off-by: Stephen Boyd <stephen.b...@linaro.org>
---
 drivers/usb/chipidea/ci_hdrc_msm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c 
b/drivers/usb/chipidea/ci_hdrc_msm.c
index 520c85e701ef..430856ef1be3 100644
--- a/drivers/usb/chipidea/ci_hdrc_msm.c
+++ b/drivers/usb/chipidea/ci_hdrc_msm.c
@@ -80,6 +80,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
 
pm_runtime_no_callbacks(>dev);
pm_runtime_enable(>dev);
+   pm_runtime_get(>dev);
 
return 0;
 }
@@ -88,6 +89,7 @@ static int ci_hdrc_msm_remove(struct platform_device *pdev)
 {
struct platform_device *plat_ci = platform_get_drvdata(pdev);
 
+   pm_runtime_put(>dev);
pm_runtime_disable(>dev);
ci_hdrc_remove_device(plat_ci);
 
-- 
2.9.0.rc2.8.ga28705d

--
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 03/21] usb: ulpi: Avoid reading/writing in device creation with OF devices

2016-06-26 Thread Stephen Boyd
ULPI devices are matched up against ULPI drivers by reading the
vendor id and product id registers in the ULPI address space.
Before we try to read those registers we'll do a scratch write to
test the interface. Unfortunately, this doesn't work well if the
ULPI device is not powered at the time of device creation. In
that case, the scratch register writes fail and product and
vendor ids can't be read.

If the ULPI spec had some way to describe generic power
requirements for the scratch, product, and vendor registers we
could but power sequencing into the ULPI bus layer and power up
the device before touching the hardware. Unfortunately this
doesn't exist. Furthermore, the power information is device
specific, so it varies from device to device and is not standard.

Let's punt on doing the reads/writes here when we're using DT
backed ULPI devices. This avoids any problems where we need to
power on the device but haven't figured out which device it is
yet to know what sort of regulators, clks, etc. that need to be
turned on for it to work.

Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Cc: Heikki Krogerus <heikki.kroge...@linux.intel.com>
Signed-off-by: Stephen Boyd <stephen.b...@linaro.org>
---
 drivers/usb/common/ulpi.c | 40 +---
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
index 980af672bfe3..a6b2a150b176 100644
--- a/drivers/usb/common/ulpi.c
+++ b/drivers/usb/common/ulpi.c
@@ -197,25 +197,7 @@ static int ulpi_of_register(struct ulpi *ulpi)
 
 static int ulpi_register(struct device *dev, struct ulpi *ulpi)
 {
-   int ret;
-
-   /* Test the interface */
-   ret = ulpi_write(ulpi, ULPI_SCRATCH, 0xaa);
-   if (ret < 0)
-   return ret;
-
-   ret = ulpi_read(ulpi, ULPI_SCRATCH);
-   if (ret < 0)
-   return ret;
-
-   if (ret != 0xaa)
-   return -ENODEV;
-
-   ulpi->id.vendor = ulpi_read(ulpi, ULPI_VENDOR_ID_LOW);
-   ulpi->id.vendor |= ulpi_read(ulpi, ULPI_VENDOR_ID_HIGH) << 8;
-
-   ulpi->id.product = ulpi_read(ulpi, ULPI_PRODUCT_ID_LOW);
-   ulpi->id.product |= ulpi_read(ulpi, ULPI_PRODUCT_ID_HIGH) << 8;
+   int ret = -ENODEV;
 
ulpi->dev.parent = dev;
ulpi->dev.bus = _bus;
@@ -230,6 +212,26 @@ static int ulpi_register(struct device *dev, struct ulpi 
*ulpi)
return ret;
}
 
+   if (ret) {
+   /* Test the interface */
+   ret = ulpi_write(ulpi, ULPI_SCRATCH, 0xaa);
+   if (ret < 0)
+   return ret;
+
+   ret = ulpi_read(ulpi, ULPI_SCRATCH);
+   if (ret < 0)
+   return ret;
+
+   if (ret != 0xaa)
+   return -ENODEV;
+
+   ulpi->id.vendor = ulpi_read(ulpi, ULPI_VENDOR_ID_LOW);
+   ulpi->id.vendor |= ulpi_read(ulpi, ULPI_VENDOR_ID_HIGH) << 8;
+
+   ulpi->id.product = ulpi_read(ulpi, ULPI_PRODUCT_ID_LOW);
+   ulpi->id.product |= ulpi_read(ulpi, ULPI_PRODUCT_ID_HIGH) << 8;
+   }
+
if (of_device_request_module(>dev))
request_module("ulpi:v%04xp%04x", ulpi->id.vendor,
   ulpi->id.product);
-- 
2.9.0.rc2.8.ga28705d

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


[PATCH] usb: ulpi: Automatically set driver::owner with ulpi_driver_register()

2016-06-25 Thread Stephen Boyd
Let's follow other driver registration functions and
automatically set the driver's owner member to THIS_MODULE when
ulpi_driver_register() is called. This allows ulpi driver writers
to forget about this boiler plate detail and avoids common bugs
in the process.

Cc: Heikki Krogerus <heikki.kroge...@linux.intel.com>
Signed-off-by: Stephen Boyd <stephen.b...@linaro.org>
---
 drivers/usb/common/ulpi.c   | 5 +++--
 include/linux/ulpi/driver.h | 6 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
index a6b2a150b176..4e15e2b9f4b4 100644
--- a/drivers/usb/common/ulpi.c
+++ b/drivers/usb/common/ulpi.c
@@ -148,16 +148,17 @@ static struct device_type ulpi_dev_type = {
  *
  * Registers a driver with the ULPI bus.
  */
-int ulpi_register_driver(struct ulpi_driver *drv)
+int __ulpi_register_driver(struct ulpi_driver *drv, struct module *module)
 {
if (!drv->probe)
return -EINVAL;
 
+   drv->driver.owner = module;
drv->driver.bus = _bus;
 
return driver_register(>driver);
 }
-EXPORT_SYMBOL_GPL(ulpi_register_driver);
+EXPORT_SYMBOL_GPL(__ulpi_register_driver);
 
 /**
  * ulpi_unregister_driver - unregister a driver with the ULPI bus
diff --git a/include/linux/ulpi/driver.h b/include/linux/ulpi/driver.h
index 388f6e08b9d4..80b36ca12e80 100644
--- a/include/linux/ulpi/driver.h
+++ b/include/linux/ulpi/driver.h
@@ -47,7 +47,11 @@ struct ulpi_driver {
 
 #define to_ulpi_driver(d) container_of(d, struct ulpi_driver, driver)
 
-int ulpi_register_driver(struct ulpi_driver *drv);
+/*
+ * use a macro to avoid include chaining to get THIS_MODULE
+ */
+#define ulpi_register_driver(drv) __ulpi_register_driver(drv, THIS_MODULE)
+int __ulpi_register_driver(struct ulpi_driver *drv, struct module *module);
 void ulpi_unregister_driver(struct ulpi_driver *drv);
 
 #define module_ulpi_driver(__ulpi_driver) \
-- 
2.9.0.rc2.8.ga28705d

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


[PATCH] usb: misc: Add driver for usb4604

2016-06-25 Thread Stephen Boyd
This is a minimal driver to support bringing a usb4604 device
from microchip out of reset and into hub mode. The usb4604 device
is related to the usb3503 device, but it didn't seem close enough
to warrant putting both into the same file. This patch borrows
some of the usb3503 structure and trims it down to just handle
the optional reset gpio and adds the i2c command to put the
device into hub mode.

Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/1716A.pdf
Cc: <devicet...@vger.kernel.org>
Signed-off-by: Stephen Boyd <stephen.b...@linaro.org>
---
 Documentation/devicetree/bindings/usb/usb4604.txt |  19 +++
 drivers/usb/misc/Kconfig  |   6 +
 drivers/usb/misc/Makefile |   1 +
 drivers/usb/misc/usb4604.c| 175 ++
 4 files changed, 201 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/usb4604.txt
 create mode 100644 drivers/usb/misc/usb4604.c

diff --git a/Documentation/devicetree/bindings/usb/usb4604.txt 
b/Documentation/devicetree/bindings/usb/usb4604.txt
new file mode 100644
index ..82506d17712c
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/usb4604.txt
@@ -0,0 +1,19 @@
+SMSC USB4604 High-Speed Hub Controller
+
+Required properties:
+- compatible: Should be "smsc,usb4604"
+
+Optional properties:
+- reg: Specifies the i2c slave address, it is required and should be 0x2d
+   if I2C is used.
+- reset-gpios: Should specify GPIO for reset.
+- initial-mode: Should specify initial mode.
+(1 for HUB mode, 2 for STANDBY mode)
+
+Examples:
+   usb-hub@2d {
+   compatible = "smsc,usb4604";
+   reg = <0x2d>;
+   reset-gpios = < 5 1>;
+   initial-mode = <1>;
+   };
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
index e9e5ae521fa6..ac9ca570b26d 100644
--- a/drivers/usb/misc/Kconfig
+++ b/drivers/usb/misc/Kconfig
@@ -249,6 +249,12 @@ config USB_HSIC_USB3503
help
  This option enables support for SMSC USB3503 HSIC to USB 2.0 Driver.
 
+config USB_HSIC_USB4604
+   tristate "USB4604 HSIC to USB20 Driver"
+   depends on I2C
+   help
+ This option enables support for SMSC USB4604 HSIC to USB 2.0 Driver.
+
 config USB_LINK_LAYER_TEST
tristate "USB Link Layer Test driver"
help
diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile
index 2769cf6351b4..95e897dff681 100644
--- a/drivers/usb/misc/Makefile
+++ b/drivers/usb/misc/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_USB_USS720)  += uss720.o
 obj-$(CONFIG_USB_SEVSEG)   += usbsevseg.o
 obj-$(CONFIG_USB_YUREX)+= yurex.o
 obj-$(CONFIG_USB_HSIC_USB3503) += usb3503.o
+obj-$(CONFIG_USB_HSIC_USB4604) += usb4604.o
 obj-$(CONFIG_USB_CHAOSKEY) += chaoskey.o
 obj-$(CONFIG_UCSI) += ucsi.o
 
diff --git a/drivers/usb/misc/usb4604.c b/drivers/usb/misc/usb4604.c
new file mode 100644
index ..e9f37fb746ac
--- /dev/null
+++ b/drivers/usb/misc/usb4604.c
@@ -0,0 +1,175 @@
+/*
+ * Driver for SMSC USB4604 USB HSIC 4-port 2.0 hub controller driver
+ * Based on usb3503 driver
+ *
+ * Copyright (c) 2012-2013 Dongjin Kim (tobet...@gmail.com)
+ * Copyright (c) 2016 Linaro Ltd.
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+enum usb4604_mode {
+   USB4604_MODE_UNKNOWN,
+   USB4604_MODE_HUB,
+   USB4604_MODE_STANDBY,
+};
+
+struct usb4604 {
+   enum usb4604_mode   mode;
+   struct device   *dev;
+   struct gpio_desc*gpio_reset;
+};
+
+static void usb4604_reset(struct usb4604 *hub, int state)
+{
+   gpiod_set_value_cansleep(hub->gpio_reset, state);
+
+   /* Wait for i2c logic to come up */
+   if (state)
+   msleep(250);
+}
+
+static int usb4604_connect(struct usb4604 *hub)
+{
+   struct device *dev = hub->dev;
+   struct i2c_client *client = to_i2c_client(dev);
+   int err;
+   u8 connect_cmd[] = { 0xaa, 0x55, 0x00 };
+
+   usb4604_reset(hub, 1);
+
+   err = i2c_master_send(client, connect_cmd, ARRAY_SIZE(connect_cmd));
+   if (err < 0) {
+   usb4604_reset(hub, 0);
+   return err;
+   }
+
+   hub->mode = USB4604_MODE_HUB;
+   dev_dbg(dev, "switched to HUB mode\

Re: [PATCH 0/2] usb: phy: Add support for the Qualcomm HSIC USB PHY

2016-06-17 Thread Stephen Boyd
On 06/17/2016 03:25 AM, Neil Armstrong wrote:
> In order to support the Qualcomm MDM9615 in the Sierra Wireless WP8548
> Modules, add the Qualcomm HSIC USB PHY used inside the MDM9615 SoC.
>
> This patchset is part of a global SoC + Module + Board support for the
> Sierra Wireless mangOH Board support with the WP8548 module.
>
>

I've been working on an hsic driver for apq8074 which matches the same
hardware. I was going to send it out this week but got dragged down into
the HS phy part of it and fixing all the OTG handling. I'd prefer we
don't go down the route of your patches which ioremap the controller
address space in the phy driver. Instead we should use the ULPI bus that
was recently introduced. Care to take my patches for a spin[1]? I'll Cc
you on them once I send them out, which should be very soon.

[1]
https://git.linaro.org/people/stephen.boyd/linux.git/shortlog/refs/heads/usb-hsic-8074

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

--
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 09/12] EXAMPLE CODE: usb: port: Parse pwrseq phandle from Device Tree

2016-06-01 Thread Stephen Boyd
Quoting Peter Chen (2016-06-01 05:05:20)
> On Wed, Jun 01, 2016 at 01:57:23AM -0700, Stephen Boyd wrote:
> > Quoting Krzysztof Kozlowski (2016-06-01 01:02:18)
> > > Parse usb-pwrseq property from Device Tree to get the phandle to pwrseq
> > > device.  The pwrseq device will be used by USB hub to cycle the power
> > > before activating ports.
> > > 
> > > Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
> > 
> > Drive by review comment.
> > 
> > I was hoping this would help me with a problem I'm having where I have a
> > hub (smsc4604) that needs to be taken out of reset before my HSIC
> > controller sends a USB reset to it, but it seems this is more about
> > doing some sort of power on sequence after enumeration?
> > 
> 
> No, you may need to do reset before enumeration, the general purpose of
> reset is eliminate unstable hardware state, and let the controller find
> the device.
> 
> Try to do it at bootloader to see if it works for you.
> 

Sorry the bootloader doesn't do this so that doesn't work for me.
--
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 09/12] EXAMPLE CODE: usb: port: Parse pwrseq phandle from Device Tree

2016-06-01 Thread Stephen Boyd
Quoting Krzysztof Kozlowski (2016-06-01 01:02:18)
> Parse usb-pwrseq property from Device Tree to get the phandle to pwrseq
> device.  The pwrseq device will be used by USB hub to cycle the power
> before activating ports.
> 
> Signed-off-by: Krzysztof Kozlowski 

Drive by review comment.

I was hoping this would help me with a problem I'm having where I have a
hub (smsc4604) that needs to be taken out of reset before my HSIC
controller sends a USB reset to it, but it seems this is more about
doing some sort of power on sequence after enumeration?

> diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
> index 460c855be0d0..89b9bdfc7061 100644
> --- a/drivers/usb/core/port.c
> +++ b/drivers/usb/core/port.c
> @@ -18,6 +18,8 @@
>  
>  #include 
>  #include 
> +#include 
> +#include 
>  
>  #include "hub.h"
>  
> @@ -526,6 +528,14 @@ int usb_hub_create_port_device(struct usb_hub *hub, int 
> port1)
> return retval;
> }
>  
> +   port_dev->dev.of_node = 
> usb_of_get_child_node(hdev->dev.parent->of_node,
> + port1);
> +   port_dev->pwrseq = pwrseq_alloc(_dev->dev, "usb-pwrseq");
> +   if (IS_ERR(port_dev->pwrseq)) {
> +   device_unregister(_dev->dev);
> +   return PTR_ERR(port_dev->pwrseq);

Are we certain that port_dev hasn't been freed at this point? We just
called device_unregister() on it, so it seems safer to save away the
return value before calling device_unregister() here.

--
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 8/9] usb: dwc3: Remove impossible check for of_clk_get_parent_count() < 0

2016-02-22 Thread Stephen Boyd
The check for < 0 is impossible now that
of_clk_get_parent_count() returns an unsigned int. Simplify the
code and update the types.

Cc: Felipe Balbi <ba...@ti.com>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Stephen Boyd <sb...@codeaurora.org>
---

Please ack so this can go through clk tree along with patch 1.

 drivers/usb/dwc3/dwc3-of-simple.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-of-simple.c 
b/drivers/usb/dwc3/dwc3-of-simple.c
index 9c9f74155066..974335377d9f 100644
--- a/drivers/usb/dwc3/dwc3-of-simple.c
+++ b/drivers/usb/dwc3/dwc3-of-simple.c
@@ -42,6 +42,7 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
struct device   *dev = >dev;
struct device_node  *np = dev->of_node;
 
+   unsigned intcount;
int ret;
int i;
 
@@ -49,11 +50,11 @@ static int dwc3_of_simple_probe(struct platform_device 
*pdev)
if (!simple)
return -ENOMEM;
 
-   ret = of_clk_get_parent_count(np);
-   if (ret < 0)
-   return ret;
+   count = of_clk_get_parent_count(np);
+   if (!count)
+   return -ENOENT;
 
-   simple->num_clocks = ret;
+   simple->num_clocks = count;
 
simple->clks = devm_kcalloc(dev, simple->num_clocks,
sizeof(struct clk *), GFP_KERNEL);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
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 0/9] Change return type of of_clk_get_parent_count() to unsigned

2016-02-22 Thread Stephen Boyd
Russell King recently pointed out that of_clk_get_parent_count() can
return a negative number if the "clocks" property isn't present in a
node. Upon investigating all the callers of this API, none of the them
seem to care about that case, and furthermore some callers are assigning
the return value to an unsigned int which could cause very large numbers
of parents to be used.

This series changes the API to return an unsigned int from 0 (no parents)
to N, thereby avoiding any problems with negative return values.

Cc: Boris Brezillon <boris.brezil...@free-electrons.com>
Cc: Yoshinori Sato <ys...@users.sourceforge.jp>
Cc: <uclinux-h8-de...@lists.sourceforge.jp>
Cc: Gabriel Fernandez <gabriel.fernan...@st.com>
Cc: Maxime Ripard <maxime.rip...@free-electrons.com>
Cc: Chen-Yu Tsai <w...@csie.org> 
Cc: Tero Kristo <t-kri...@ti.com>
Cc: Felipe Balbi <ba...@ti.com>
Cc: <linux-usb@vger.kernel.org>
Cc: Hans de Goede <hdego...@redhat.com>
Cc: Jean-Christophe Plagniol-Villard <plagn...@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkei...@ti.com>
Cc: <linux-fb...@vger.kernel.org>

Stephen Boyd (9):
  clk: Make of_clk_get_parent_count() return unsigned ints
  clk: at91: Remove impossible checks for of_clk_get_parent_count()
  clk: gpio: Remove impossible check for of_clk_get_parent_count() < 0
  clk: h8300: Remove impossible check for of_clk_get_parent_count()
  clk: st: Remove impossible check for of_clk_get_parent_count() < 0
  clk: sunxi: Use proper type for of_clk_get_parent_count() return value
  clk: ti: Update for of_clk_get_parent_count() returning unsigned int
  usb: dwc3: Remove impossible check for of_clk_get_parent_count() < 0
  simplefb: Remove impossible check for of_clk_get_parent_count() < 0

 drivers/clk/at91/clk-generated.c|  4 ++--
 drivers/clk/at91/clk-main.c |  4 ++--
 drivers/clk/at91/clk-master.c   |  4 ++--
 drivers/clk/at91/clk-programmable.c |  4 ++--
 drivers/clk/at91/clk-slow.c |  6 +++---
 drivers/clk/at91/clk-smd.c  |  4 ++--
 drivers/clk/at91/clk-usb.c  |  4 ++--
 drivers/clk/clk-gpio.c  |  6 ++
 drivers/clk/clk.c   | 16 ++--
 drivers/clk/h8300/clk-div.c |  4 ++--
 drivers/clk/h8300/clk-h8s2678.c |  4 ++--
 drivers/clk/st/clk-flexgen.c|  4 ++--
 drivers/clk/st/clkgen-mux.c |  4 ++--
 drivers/clk/sunxi/clk-sun6i-ar100.c |  2 +-
 drivers/clk/ti/clockdomain.c|  2 +-
 drivers/clk/ti/composite.c  |  8 
 drivers/clk/ti/dpll.c   |  2 +-
 drivers/clk/ti/mux.c|  4 ++--
 drivers/usb/dwc3/dwc3-of-simple.c   |  9 +
 drivers/video/fbdev/simplefb.c  |  4 ++--
 include/linux/clk-provider.h|  2 +-
 21 files changed, 56 insertions(+), 45 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
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 00/12] Remove mach-msm and associated code

2015-03-13 Thread Stephen Boyd
The maintainers for mach-msm no longer have any plans to support
or test the platforms supported by this architecture[1]. Most likely
there aren't any active users of this code anyway, so let's
delete it and the associated drivers/code. We should probably merge
this as one big series through arm-soc. Although some patches
should be fine to take through maintainers, some things like
mmc and usb have header file dependencies for platform_data.

[1] http://lkml.kernel.org/r/20150307031212.ga8...@fifo99.com

Stephen Boyd (12):
  ARM: Remove mach-msm and associated ARM architecture code
  gpio: Remove gpio-msm-v1 driver
  tty: serial: Remove orphaned serial driver
  tty: serial: msm_serial: Remove dead code
  net: smc91x: Remove dead code
  mmc: Remove msm_sdcc driver
  clocksource: qcom: Remove dead code
  ehci-msm: Remove dead dependency
  usb: phy: msm: Remove dead code
  phy: qcom-ufs: Switch dependency to ARCH_QCOM
  ufs-qcom: Switch dependency to ARCH_QCOM
  msm: msm_fb: Remove dead code

 Documentation/arm/00-INDEX  |2 -
 Documentation/arm/msm/gpiomux.txt   |  176 ---
 MAINTAINERS |   20 +-
 arch/arm/Kconfig|   14 -
 arch/arm/Kconfig.debug  |   31 +-
 arch/arm/Makefile   |2 -
 arch/arm/configs/msm_defconfig  |  121 --
 arch/arm/include/debug/msm.S|   14 -
 arch/arm/mach-msm/Kconfig   |  109 --
 arch/arm/mach-msm/Makefile  |   23 -
 arch/arm/mach-msm/Makefile.boot |3 -
 arch/arm/mach-msm/board-halibut.c   |  104 --
 arch/arm/mach-msm/board-msm7x30.c   |  191 ---
 arch/arm/mach-msm/board-qsd8x50.c   |  248 ---
 arch/arm/mach-msm/board-sapphire.c  |  114 --
 arch/arm/mach-msm/board-trout-gpio.c|  233 ---
 arch/arm/mach-msm/board-trout-mmc.c |  185 ---
 arch/arm/mach-msm/board-trout-panel.c   |  292 
 arch/arm/mach-msm/board-trout.c |  111 --
 arch/arm/mach-msm/board-trout.h |  162 --
 arch/arm/mach-msm/clock-pcom.c  |  176 ---
 arch/arm/mach-msm/clock-pcom.h  |  145 --
 arch/arm/mach-msm/clock.c   |   28 -
 arch/arm/mach-msm/clock.h   |   43 -
 arch/arm/mach-msm/common.h  |   41 -
 arch/arm/mach-msm/devices-msm7x00.c |  480 --
 arch/arm/mach-msm/devices-msm7x30.c |  246 ---
 arch/arm/mach-msm/devices-qsd8x50.c |  388 -
 arch/arm/mach-msm/devices.h |   53 -
 arch/arm/mach-msm/dma.c |  298 
 arch/arm/mach-msm/gpiomux-8x50.c|   51 -
 arch/arm/mach-msm/gpiomux-v1.h  |   67 -
 arch/arm/mach-msm/gpiomux.c |  111 --
 arch/arm/mach-msm/gpiomux.h |   84 -
 arch/arm/mach-msm/include/mach/clk.h|   31 -
 arch/arm/mach-msm/include/mach/dma.h|  151 --
 arch/arm/mach-msm/include/mach/entry-macro.S|   36 -
 arch/arm/mach-msm/include/mach/hardware.h   |   18 -
 arch/arm/mach-msm/include/mach/irqs-7x00.h  |   75 -
 arch/arm/mach-msm/include/mach/irqs-7x30.h  |  153 --
 arch/arm/mach-msm/include/mach/irqs-8x50.h  |   88 --
 arch/arm/mach-msm/include/mach/irqs.h   |   37 -
 arch/arm/mach-msm/include/mach/msm_gpiomux.h|   38 -
 arch/arm/mach-msm/include/mach/msm_iomap-7x00.h |  108 --
 arch/arm/mach-msm/include/mach/msm_iomap-7x30.h |  103 --
 arch/arm/mach-msm/include/mach/msm_iomap-8x50.h |  125 --
 arch/arm/mach-msm/include/mach/msm_iomap.h  |   53 -
 arch/arm/mach-msm/include/mach/msm_smd.h|  109 --
 arch/arm/mach-msm/include/mach/sirc.h   |   98 --
 arch/arm/mach-msm/include/mach/vreg.h   |   29 -
 arch/arm/mach-msm/io.c  |  161 --
 arch/arm/mach-msm/irq-vic.c |  363 -
 arch/arm/mach-msm/irq.c |  151 --
 arch/arm/mach-msm/last_radio_log.c  |   71 -
 arch/arm/mach-msm/proc_comm.c   |  129 --
 arch/arm/mach-msm/proc_comm.h   |  258 
 arch/arm/mach-msm/sirc.c|  172 ---
 arch/arm/mach-msm/smd.c | 1034 -
 arch/arm/mach-msm/smd_debug.c   |  311 
 arch/arm/mach-msm/smd_private.h |  403 -
 arch/arm/mach-msm/vreg.c|  220 ---
 drivers/clocksource/qcom-timer.c|   59 -
 drivers/gpio/Kconfig|8 -
 drivers/gpio/Makefile   |1 -
 drivers/gpio/gpio-msm-v1.c  |  714 -
 drivers/mmc/host/Kconfig|8 -
 drivers/mmc/host/Makefile   |1 -
 drivers/mmc/host

[PATCH 08/12] ehci-msm: Remove dead dependency

2015-03-13 Thread Stephen Boyd
This dependency no longer exists now that mach-msm has been
removed. Delete it.

Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Cc: Alan Stern st...@rowland.harvard.edu
Cc: linux-usb@vger.kernel.org
Cc: David Brown dav...@codeaurora.org
Cc: Bryan Huntsman bry...@codeaurora.org
Cc: Daniel Walker dwal...@fifo99.com
Signed-off-by: Stephen Boyd sb...@codeaurora.org
---

This can be acked and go through arm-soc or applied directly to usb tree.

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

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 5ad60e46dc2b..197a6a3e613b 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -198,7 +198,7 @@ config USB_EHCI_HCD_AT91
 
 config USB_EHCI_MSM
tristate Support for Qualcomm QSD/MSM on-chip EHCI USB controller
-   depends on ARCH_MSM || ARCH_QCOM
+   depends on ARCH_QCOM
select USB_EHCI_ROOT_HUB_TT
---help---
  Enables support for the USB Host controller present on the
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
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 09/12] usb: phy: msm: Remove dead code

2015-03-13 Thread Stephen Boyd
This code is no longer used now that mach-msm has been removed.
Delete it.

Cc: Felipe Balbi ba...@ti.com
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Cc: linux-usb@vger.kernel.org
Cc: David Brown dav...@codeaurora.org
Cc: Bryan Huntsman bry...@codeaurora.org
Cc: Daniel Walker dwal...@fifo99.com
Signed-off-by: Stephen Boyd sb...@codeaurora.org
---

This needs an ack to go through arm-soc with patch 1 that removes the platform
code using these ops.

 drivers/usb/phy/Kconfig   |  2 +-
 drivers/usb/phy/phy-msm-usb.c | 18 ++
 include/linux/usb/msm_hsusb.h |  4 
 3 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 52d3d58252e1..2fb3828b5089 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -139,7 +139,7 @@ config USB_ISP1301
 
 config USB_MSM_OTG
tristate Qualcomm on-chip USB OTG controller support
-   depends on (USB || USB_GADGET)  (ARCH_MSM || ARCH_QCOM || 
COMPILE_TEST)
+   depends on (USB || USB_GADGET)  (ARCH_QCOM || COMPILE_TEST)
depends on RESET_CONTROLLER
select USB_PHY
help
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 000fd892455f..b50c45c62da7 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -263,9 +263,7 @@ static int msm_otg_link_clk_reset(struct msm_otg *motg, 
bool assert)
 {
int ret;
 
-   if (motg-pdata-link_clk_reset)
-   ret = motg-pdata-link_clk_reset(motg-clk, assert);
-   else if (assert)
+   if (assert)
ret = reset_control_assert(motg-link_rst);
else
ret = reset_control_deassert(motg-link_rst);
@@ -281,9 +279,7 @@ static int msm_otg_phy_clk_reset(struct msm_otg *motg)
 {
int ret = 0;
 
-   if (motg-pdata-phy_clk_reset)
-   ret = motg-pdata-phy_clk_reset(motg-phy_reset_clk);
-   else if (motg-phy_rst)
+   if (motg-phy_rst)
ret = reset_control_reset(motg-phy_rst);
 
if (ret)
@@ -1551,16 +1547,6 @@ static int msm_otg_probe(struct platform_device *pdev)
phy = motg-phy;
phy-dev = pdev-dev;
 
-   if (motg-pdata-phy_clk_reset) {
-   motg-phy_reset_clk = devm_clk_get(pdev-dev,
-  np ? phy : usb_phy_clk);
-
-   if (IS_ERR(motg-phy_reset_clk)) {
-   dev_err(pdev-dev, failed to get usb_phy_clk\n);
-   return PTR_ERR(motg-phy_reset_clk);
-   }
-   }
-
motg-clk = devm_clk_get(pdev-dev, np ? core : usb_hs_clk);
if (IS_ERR(motg-clk)) {
dev_err(pdev-dev, failed to get usb_hs_clk\n);
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index b0a39243295a..7dbecf9a4656 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -117,8 +117,6 @@ struct msm_otg_platform_data {
enum otg_control_type otg_control;
enum msm_usb_phy_type phy_type;
void (*setup_gpio)(enum usb_otg_state state);
-   int (*link_clk_reset)(struct clk *link_clk, bool assert);
-   int (*phy_clk_reset)(struct clk *phy_clk);
 };
 
 /**
@@ -128,7 +126,6 @@ struct msm_otg_platform_data {
  * @irq: IRQ number assigned for HSUSB controller.
  * @clk: clock struct of usb_hs_clk.
  * @pclk: clock struct of usb_hs_pclk.
- * @phy_reset_clk: clock struct of usb_phy_clk.
  * @core_clk: clock struct of usb_hs_core_clk.
  * @regs: ioremapped register base address.
  * @inputs: OTG state machine inputs(Id, SessValid etc).
@@ -148,7 +145,6 @@ struct msm_otg {
int irq;
struct clk *clk;
struct clk *pclk;
-   struct clk *phy_reset_clk;
struct clk *core_clk;
void __iomem *regs;
 #define ID 0
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
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 00/12] Remove mach-msm and associated code

2015-03-13 Thread Stephen Boyd
On 03/13/15 12:55, Arnd Bergmann wrote:
 On Friday 13 March 2015 11:09:33 Stephen Boyd wrote:
 The maintainers for mach-msm no longer have any plans to support
 or test the platforms supported by this architecture[1]. Most likely
 there aren't any active users of this code anyway, so let's
 delete it and the associated drivers/code. We should probably merge
 this as one big series through arm-soc. Although some patches
 should be fine to take through maintainers, some things like
 mmc and usb have header file dependencies for platform_data.

 [1] http://lkml.kernel.org/r/20150307031212.ga8...@fifo99.com

 As I wrote, I'd have a mild preference for doing the multiplatform
 conversion first and then removing the support in the following merge
 window, just in case someone wants that code back.

 If everyone wants to see that code die rather sooner than later,
 that's fine with me as well.

I think everyone wants to see the code die now. They can always pull the
multi-platform patches from the list. I'll stash away my 7200 DT
conversion in case someone cares but I really doubt anybody does.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

--
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/8] usb: add bus type for USB ULPI

2015-02-12 Thread Stephen Boyd
On 01/23/15 07:12, Heikki Krogerus wrote:
 diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
 index e614ef6..753cb08 100644
 --- a/scripts/mod/file2alias.c
 +++ b/scripts/mod/file2alias.c
 @@ -1176,6 +1176,19 @@ static int do_rio_entry(const char *filename,
  }
  ADD_TO_DEVTABLE(rapidio, rio_device_id, do_rio_entry);
  
 +/* Looks like: mei:S */

This comment doesn't look right.

 +static int do_ulpi_entry(const char *filename, void *symval,
 +  char *alias)
 +{
 + DEF_FIELD(symval, ulpi_device_id, vendor);
 + DEF_FIELD(symval, ulpi_device_id, product);
 +
 + sprintf(alias, ulpi:v%04xp%04x, vendor, product);
 +
 + return 1;
 +}
 +ADD_TO_DEVTABLE(ulpi, ulpi_device_id, do_ulpi_entry);
 +

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

--
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 3/3] phy: Add Qualcomm DWC3 HS/SS PHY driver

2014-09-12 Thread Stephen Boyd
Yay nitpicks!

On 09/12/14 10:29, Andy Gross wrote:
 +
 +struct qcom_dwc3_usb_phy {
 + void __iomem*base;
 + struct device   *dev;
 + struct phy *phy;

Align with other members?


 +
 +static int wait_for_latch(void __iomem *addr)
 +{
 + u32 retry = 10;

Why not just int?

 +
 + while (true) {
 + if (!readl(addr))
 + break;
 +
 + if (--retry == 0)
 + return -ETIMEDOUT;
 +
 + usleep_range(10, 20);
 + }
 +
 + return 0;
 +}
[...]
 +
 +static int qcom_dwc3_ss_phy_init(struct qcom_dwc3_usb_phy *phy_dwc3)
 +{
 + u32 data = 0;
 +

Unnecessary initialization.



 +
 +static struct phy_ops qcom_dwc3_phy_ops = {

Can this be const?

 + .init   = qcom_dwc3_phy_init,
 + .exit   = qcom_dwc3_phy_exit,
 + .power_on   = qcom_dwc3_phy_power_on,
 + .power_off  = qcom_dwc3_phy_power_off,
 + .owner  = THIS_MODULE,
 +};
 +
[...]
 +
 +static int qcom_dwc3_phy_probe(struct platform_device *pdev)
 +{
 + struct qcom_dwc3_usb_phy*phy_dwc3;
 + struct phy_provider *phy_provider;
 + struct resource *res;
 + const struct of_device_id   *match;
 +
 +

Weird two newlines here.

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


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

--
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: msm: fix possible build error

2014-02-18 Thread Stephen Boyd
On 02/18, Felipe Balbi wrote:
 This will fail builds on configs where
 CONFIG_PM_RUNTIME=y and CONFIG_PM_SLEEP=n.
 
 Following build error will show up:
 
  drivers/usb/phy/phy-msm-usb.c: In function ???msm_otg_runtime_suspend???:
  drivers/usb/phy/phy-msm-usb.c:1693:2: error: implicit declaration of \
   function ???msm_otg_suspend??? [-Werror=implicit-function-declaration]
return msm_otg_suspend(motg);
^
  drivers/usb/phy/phy-msm-usb.c: In function ???msm_otg_runtime_resume???:
  drivers/usb/phy/phy-msm-usb.c:1701:2: error: implicit declaration of \
   function ???msm_otg_resume??? [-Werror=implicit-function-declaration]
return msm_otg_resume(motg);
^
 
 This patch fixes the error by defining msm_otg_{suspend,resume}
 whenever CONFIG_PM=y.
 
 Signed-off-by: Felipe Balbi ba...@ti.com

I'm lost. Didn't Josh send a patch for this to you already?

[1] https://patchwork.kernel.org/patch/3673401/

 ---
  drivers/usb/phy/phy-msm-usb.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
 index 64c9d14e..96f31aa 100644
 --- a/drivers/usb/phy/phy-msm-usb.c
 +++ b/drivers/usb/phy/phy-msm-usb.c
 @@ -159,7 +159,7 @@ put_3p3:
   return rc;
  }
  
 -#ifdef CONFIG_PM_SLEEP
 +#ifdef CONFIG_PM
  #define USB_PHY_SUSP_DIG_VOL  50
  static int msm_hsusb_config_vddcx(int high)
  {
 @@ -440,7 +440,7 @@ static int msm_otg_reset(struct usb_phy *phy)
  #define PHY_SUSPEND_TIMEOUT_USEC (500 * 1000)
  #define PHY_RESUME_TIMEOUT_USEC  (100 * 1000)
  
 -#ifdef CONFIG_PM_SLEEP
 +#ifdef CONFIG_PM
  static int msm_otg_suspend(struct msm_otg *motg)
  {
   struct usb_phy *phy = motg-phy;
 -- 
 1.9.0
 

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
--
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 00/15] usb: phy: msm: Fixes, cleanups and DT support

2013-12-26 Thread Stephen Boyd
On 12/20, David Brown wrote:
 On Thu, Dec 19, 2013 at 05:26:13PM -0600, Felipe Balbi wrote:
 
 it's getting quite late for me. I still want to leave my stuff soaking
 in linux-next for a while. I'll try my best, though, if you ack it ASAP
 
 Thanks.  Patch 1 already has my Ack in it, and I've sent an ack for
 number 6.
 

Felipe,

If this isn't picked up for 3.14 can we get an ack on patch 1 so
we can send it through arm-soc as part of the multi-platform
patches I have for MSM[1]?

[1] https://lkml.org/lkml/2013/12/4/523
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
--
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 1/3] usb: dwc3: msm: Add device tree binding information

2013-08-19 Thread Stephen Boyd
On 08/19/13 05:27, Ivan T. Ivanov wrote:
 Hi, 

 On Fri, 2013-08-16 at 16:44 -0600, Stephen Warren wrote: 
 On 08/14/2013 06:59 AM, Ivan T. Ivanov wrote:
 From: Ivan T. Ivanov iiva...@mm-sol.com

 MSM USB3.0 core wrapper consist of USB3.0 IP from Synopsys
 (SNPS) and HS, SS PHY's control and configuration registers.

 It could operate in device mode (SS, HS, FS) and host
 mode (SS, HS, FS, LS).
 diff --git a/Documentation/devicetree/bindings/usb/msm-ssusb.txt 
 b/Documentation/devicetree/bindings/usb/msm-ssusb.txt
 +- clock-names :
 ...
 +   sleep_a_clk : Sleep clock, used when USB3 core goes into low
 ...
 +   ref_clk : Reference clock - used in host mode.
 ...
 +   core_clk : Master/Core clock, have to be = 125 MHz for SS
 ...
 +   iface_clk : System bus AXI clock
 +   sleep_clk : Sleep clock, used when USB3 core goes into low
 ...
 +   utmi_clk : Generated by HS-PHY. Used to clock the low power
 I think it makes sense to remove _clk from all those names, unless the
 HW documentation really talks about a clock named e.g. iface_clk yet
 some other clock names in the documentation don't have the _clk
 suffix, e.g. the xo I didn't quote.
 From limited information that I have, I could not say how clock inputs 
 are named from the controller perspective, but I agree that _clk
 suffix looks redundant. 

In downstream trees we've tried to standardize the names on core_clk,
iface_clk, bus_clk, etc. Historically the hardware designers have used
the names from the clock controller instead of coming up with standard
names of their own when they put the clock inputs in their data sheets
(if they do at all).

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

--
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 3/3] usb: dwc3: Add Qualcomm DWC3 glue layer driver

2013-08-14 Thread Stephen Boyd
On 08/14/13 05:59, Ivan T. Ivanov wrote:
 +}
 +
 +static const struct of_device_id of_dwc3_matach[] = {

match? Maybe you can make it all one line too { .compatible = qcom,dwc3 }

 + {
 + .compatible = qcom,dwc3,
 + },
 + { },
 +};
 +MODULE_DEVICE_TABLE(of, of_dwc3_matach);
 +

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

--
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: sleeping while atomic in dwc3_gadget_start

2013-06-27 Thread Stephen Boyd
On 06/26/13 23:58, Felipe Balbi wrote:
 On Wed, Jun 26, 2013 at 02:52:56PM -0700, Stephen Boyd wrote:
 Hi,

 I'm getting the folllowing BUG message on bootup with 3.10-rc5

 BUG: sleeping function called from invalid context at mm/slub.c:926
 in_atomic(): 1, irqs_disabled(): 128, pid: 1, name: swapper/0
 CPU: 0 PID: 1 Comm: swapper/0 Not tainted 
 3.10.0-rc5-gee3e35b-09316-ge78f3b35 #643
 [c0014220] (unwind_backtrace+0x0/0x120) from [c001212c] 
 (show_stack+0x10/0x14)
 [c001212c] (show_stack+0x10/0x14) from [c0143750] 
 (kmem_cache_alloc_trace+0x3c/0x210)
 [c0143750] (kmem_cache_alloc_trace+0x3c/0x210) from [c00e0c60] 
 (request_threaded_irq+0x88/0x11c)
 [c00e0c60] (request_threaded_irq+0x88/0x11c) from [c03bf53c] 
 (dwc3_gadget_start+0x198/0x200)
 [c03bf53c] (dwc3_gadget_start+0x198/0x200) from [c03f7a5c] 
 (udc_bind_to_driver+0x70/0xd8)
 [c03f7a5c] (udc_bind_to_driver+0x70/0xd8) from [c03f7b50] 
 (usb_gadget_probe_driver+0x8c/0xb8)

 and I suspect this problem was introduced in commit 8698e2acf
 (usb: dwc3: gadget: introduce and use enable/disable irq
 methods). Is there a fix for this problem? Can we just move the
 irq request outside the spinlock?
 nice :-)

 how about this ?

If start fails do you call stop? I believe the answer is no, so we'll
need to free_irq() somewhere along the error path. Or we can request it
after the spin_unlock()?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

--
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


sleeping while atomic in dwc3_gadget_start

2013-06-26 Thread Stephen Boyd
Hi,

I'm getting the folllowing BUG message on bootup with 3.10-rc5

BUG: sleeping function called from invalid context at mm/slub.c:926
in_atomic(): 1, irqs_disabled(): 128, pid: 1, name: swapper/0
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.10.0-rc5-gee3e35b-09316-ge78f3b35 
#643
[c0014220] (unwind_backtrace+0x0/0x120) from [c001212c] 
(show_stack+0x10/0x14)
[c001212c] (show_stack+0x10/0x14) from [c0143750] 
(kmem_cache_alloc_trace+0x3c/0x210)
[c0143750] (kmem_cache_alloc_trace+0x3c/0x210) from [c00e0c60] 
(request_threaded_irq+0x88/0x11c)
[c00e0c60] (request_threaded_irq+0x88/0x11c) from [c03bf53c] 
(dwc3_gadget_start+0x198/0x200)
[c03bf53c] (dwc3_gadget_start+0x198/0x200) from [c03f7a5c] 
(udc_bind_to_driver+0x70/0xd8)
[c03f7a5c] (udc_bind_to_driver+0x70/0xd8) from [c03f7b50] 
(usb_gadget_probe_driver+0x8c/0xb8)

and I suspect this problem was introduced in commit 8698e2acf
(usb: dwc3: gadget: introduce and use enable/disable irq
methods). Is there a fix for this problem? Can we just move the
irq request outside the spinlock?
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
--
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/RESEND 03/12] usb: otg: msm: Convert to clk_prepare/unprepare

2013-06-17 Thread Stephen Boyd
Add calls to clk_prepare and unprepare so that MSM can migrate to
the common clock framework.

Acked-by: Felipe Balbi ba...@ti.com
Signed-off-by: Stephen Boyd sb...@codeaurora.org
---
 drivers/usb/phy/phy-msm-usb.c | 38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 749fbf4..d08f334 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -514,13 +514,13 @@ static int msm_otg_suspend(struct msm_otg *motg)
motg-pdata-otg_control == OTG_PMIC_CONTROL)
writel(readl(USB_PHY_CTRL) | PHY_RETEN, USB_PHY_CTRL);
 
-   clk_disable(motg-pclk);
-   clk_disable(motg-clk);
+   clk_disable_unprepare(motg-pclk);
+   clk_disable_unprepare(motg-clk);
if (motg-core_clk)
-   clk_disable(motg-core_clk);
+   clk_disable_unprepare(motg-core_clk);
 
if (!IS_ERR(motg-pclk_src))
-   clk_disable(motg-pclk_src);
+   clk_disable_unprepare(motg-pclk_src);
 
if (motg-pdata-phy_type == SNPS_28NM_INTEGRATED_PHY 
motg-pdata-otg_control == OTG_PMIC_CONTROL) {
@@ -552,12 +552,12 @@ static int msm_otg_resume(struct msm_otg *motg)
return 0;
 
if (!IS_ERR(motg-pclk_src))
-   clk_enable(motg-pclk_src);
+   clk_prepare_enable(motg-pclk_src);
 
-   clk_enable(motg-pclk);
-   clk_enable(motg-clk);
+   clk_prepare_enable(motg-pclk);
+   clk_prepare_enable(motg-clk);
if (motg-core_clk)
-   clk_enable(motg-core_clk);
+   clk_prepare_enable(motg-core_clk);
 
if (motg-pdata-phy_type == SNPS_28NM_INTEGRATED_PHY 
motg-pdata-otg_control == OTG_PMIC_CONTROL) {
@@ -1468,7 +1468,7 @@ static int __init msm_otg_probe(struct platform_device 
*pdev)
if (IS_ERR(motg-pclk_src))
goto put_clk;
clk_set_rate(motg-pclk_src, INT_MAX);
-   clk_enable(motg-pclk_src);
+   clk_prepare_enable(motg-pclk_src);
} else
motg-pclk_src = ERR_PTR(-ENOENT);
 
@@ -1511,8 +1511,8 @@ static int __init msm_otg_probe(struct platform_device 
*pdev)
goto free_regs;
}
 
-   clk_enable(motg-clk);
-   clk_enable(motg-pclk);
+   clk_prepare_enable(motg-clk);
+   clk_prepare_enable(motg-pclk);
 
ret = msm_hsusb_init_vddcx(motg, 1);
if (ret) {
@@ -1532,7 +1532,7 @@ static int __init msm_otg_probe(struct platform_device 
*pdev)
}
 
if (motg-core_clk)
-   clk_enable(motg-core_clk);
+   clk_prepare_enable(motg-core_clk);
 
writel(0, USB_USBINTR);
writel(0, USB_OTGSC);
@@ -1579,8 +1579,8 @@ static int __init msm_otg_probe(struct platform_device 
*pdev)
 free_irq:
free_irq(motg-irq, motg);
 disable_clks:
-   clk_disable(motg-pclk);
-   clk_disable(motg-clk);
+   clk_disable_unprepare(motg-pclk);
+   clk_disable_unprepare(motg-clk);
 ldo_exit:
msm_hsusb_ldo_init(motg, 0);
 vddcx_exit:
@@ -1593,7 +1593,7 @@ put_core_clk:
clk_put(motg-pclk);
 put_pclk_src:
if (!IS_ERR(motg-pclk_src)) {
-   clk_disable(motg-pclk_src);
+   clk_disable_unprepare(motg-pclk_src);
clk_put(motg-pclk_src);
}
 put_clk:
@@ -1643,12 +1643,12 @@ static int msm_otg_remove(struct platform_device *pdev)
if (cnt = PHY_SUSPEND_TIMEOUT_USEC)
dev_err(phy-dev, Unable to suspend PHY\n);
 
-   clk_disable(motg-pclk);
-   clk_disable(motg-clk);
+   clk_disable_unprepare(motg-pclk);
+   clk_disable_unprepare(motg-clk);
if (motg-core_clk)
-   clk_disable(motg-core_clk);
+   clk_disable_unprepare(motg-core_clk);
if (!IS_ERR(motg-pclk_src)) {
-   clk_disable(motg-pclk_src);
+   clk_disable_unprepare(motg-pclk_src);
clk_put(motg-pclk_src);
}
msm_hsusb_ldo_init(motg, 0);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
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 00/12] Convert MSM to common clock framework

2013-06-04 Thread Stephen Boyd
This patchset moves the existing MSM clock code and affected drivers to the
common clock framework. A prerequisite of moving to the common clock
framework is to use clk_prepare() and clk_enable() so the first
few patches migrate drivers to that call (clk_prepare() is a no-op on MSM
right now). It also removes some custom clock APIs that MSM provides
and finally moves the proc_comm clock code to the common struct clk.

This patch series will be used as the foundation of the MSM 8660/8960
clock code that I plan to send out after this series.

Stephen Boyd (12):
  msm_serial: Convert to clk_prepare/unprepare
  msm_serial: Use devm_clk_get() and properly return errors
  usb: otg: msm: Convert to clk_prepare/unprepare
  msm_sdcc: Convert to clk_prepare/unprepare
  msm: iommu: Convert to clk_prepare/unprepare
  msm: iommu: Use clk_set_rate() instead of clk_set_min_rate()
  ARM: msm: Remove custom clk_set_flags() API
  ARM: msm: Remove custom clk_set_{max,min}_rate() API
  ARM: msm: Remove clock-7x30.h include file
  ARM: msm: Prepare clk_get() users in mach-msm for clock-pcom driver
  ARM: msm: Make proc_comm clock control into a platform driver
  ARM: msm: Migrate to common clock framework

 arch/arm/Kconfig   |   2 +-
 arch/arm/mach-msm/Makefile |  10 +-
 arch/arm/mach-msm/board-halibut.c  |   2 +-
 arch/arm/mach-msm/board-msm7x30.c  |   2 +-
 arch/arm/mach-msm/board-qsd8x50.c  |   2 +-
 arch/arm/mach-msm/board-trout-panel.c  |  19 ++--
 arch/arm/mach-msm/board-trout.c|   3 +-
 arch/arm/mach-msm/clock-7x30.h | 155 --
 arch/arm/mach-msm/clock-debug.c| 130 --
 arch/arm/mach-msm/clock-pcom.c | 149 ++---
 arch/arm/mach-msm/clock-pcom.h |  31 +++---
 arch/arm/mach-msm/clock.c  | 166 +
 arch/arm/mach-msm/clock.h  |  51 +++---
 arch/arm/mach-msm/devices-msm7x00.c|  12 ++-
 arch/arm/mach-msm/devices-msm7x30.c|  14 ++-
 arch/arm/mach-msm/devices-qsd8x50.c|  11 ++-
 arch/arm/mach-msm/devices.h|  15 +--
 arch/arm/mach-msm/dma.c|   5 +-
 arch/arm/mach-msm/include/mach/board.h |   5 -
 arch/arm/mach-msm/include/mach/clk.h   |   9 --
 drivers/iommu/msm_iommu_dev.c  |  20 ++--
 drivers/mmc/host/msm_sdcc.c|  14 ++-
 drivers/tty/serial/msm_serial.c|  35 +++
 drivers/usb/phy/phy-msm-usb.c  |  38 
 24 files changed, 241 insertions(+), 659 deletions(-)
 delete mode 100644 arch/arm/mach-msm/clock-7x30.h
 delete mode 100644 arch/arm/mach-msm/clock-debug.c

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
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 03/12] usb: otg: msm: Convert to clk_prepare/unprepare

2013-06-04 Thread Stephen Boyd
Add calls to clk_prepare and unprepare so that MSM can migrate to
the common clock framework.

Cc: Felipe Balbi ba...@ti.com
Signed-off-by: Stephen Boyd sb...@codeaurora.org
---
 drivers/usb/phy/phy-msm-usb.c | 38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 749fbf4..d08f334 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -514,13 +514,13 @@ static int msm_otg_suspend(struct msm_otg *motg)
motg-pdata-otg_control == OTG_PMIC_CONTROL)
writel(readl(USB_PHY_CTRL) | PHY_RETEN, USB_PHY_CTRL);
 
-   clk_disable(motg-pclk);
-   clk_disable(motg-clk);
+   clk_disable_unprepare(motg-pclk);
+   clk_disable_unprepare(motg-clk);
if (motg-core_clk)
-   clk_disable(motg-core_clk);
+   clk_disable_unprepare(motg-core_clk);
 
if (!IS_ERR(motg-pclk_src))
-   clk_disable(motg-pclk_src);
+   clk_disable_unprepare(motg-pclk_src);
 
if (motg-pdata-phy_type == SNPS_28NM_INTEGRATED_PHY 
motg-pdata-otg_control == OTG_PMIC_CONTROL) {
@@ -552,12 +552,12 @@ static int msm_otg_resume(struct msm_otg *motg)
return 0;
 
if (!IS_ERR(motg-pclk_src))
-   clk_enable(motg-pclk_src);
+   clk_prepare_enable(motg-pclk_src);
 
-   clk_enable(motg-pclk);
-   clk_enable(motg-clk);
+   clk_prepare_enable(motg-pclk);
+   clk_prepare_enable(motg-clk);
if (motg-core_clk)
-   clk_enable(motg-core_clk);
+   clk_prepare_enable(motg-core_clk);
 
if (motg-pdata-phy_type == SNPS_28NM_INTEGRATED_PHY 
motg-pdata-otg_control == OTG_PMIC_CONTROL) {
@@ -1468,7 +1468,7 @@ static int __init msm_otg_probe(struct platform_device 
*pdev)
if (IS_ERR(motg-pclk_src))
goto put_clk;
clk_set_rate(motg-pclk_src, INT_MAX);
-   clk_enable(motg-pclk_src);
+   clk_prepare_enable(motg-pclk_src);
} else
motg-pclk_src = ERR_PTR(-ENOENT);
 
@@ -1511,8 +1511,8 @@ static int __init msm_otg_probe(struct platform_device 
*pdev)
goto free_regs;
}
 
-   clk_enable(motg-clk);
-   clk_enable(motg-pclk);
+   clk_prepare_enable(motg-clk);
+   clk_prepare_enable(motg-pclk);
 
ret = msm_hsusb_init_vddcx(motg, 1);
if (ret) {
@@ -1532,7 +1532,7 @@ static int __init msm_otg_probe(struct platform_device 
*pdev)
}
 
if (motg-core_clk)
-   clk_enable(motg-core_clk);
+   clk_prepare_enable(motg-core_clk);
 
writel(0, USB_USBINTR);
writel(0, USB_OTGSC);
@@ -1579,8 +1579,8 @@ static int __init msm_otg_probe(struct platform_device 
*pdev)
 free_irq:
free_irq(motg-irq, motg);
 disable_clks:
-   clk_disable(motg-pclk);
-   clk_disable(motg-clk);
+   clk_disable_unprepare(motg-pclk);
+   clk_disable_unprepare(motg-clk);
 ldo_exit:
msm_hsusb_ldo_init(motg, 0);
 vddcx_exit:
@@ -1593,7 +1593,7 @@ put_core_clk:
clk_put(motg-pclk);
 put_pclk_src:
if (!IS_ERR(motg-pclk_src)) {
-   clk_disable(motg-pclk_src);
+   clk_disable_unprepare(motg-pclk_src);
clk_put(motg-pclk_src);
}
 put_clk:
@@ -1643,12 +1643,12 @@ static int msm_otg_remove(struct platform_device *pdev)
if (cnt = PHY_SUSPEND_TIMEOUT_USEC)
dev_err(phy-dev, Unable to suspend PHY\n);
 
-   clk_disable(motg-pclk);
-   clk_disable(motg-clk);
+   clk_disable_unprepare(motg-pclk);
+   clk_disable_unprepare(motg-clk);
if (motg-core_clk)
-   clk_disable(motg-core_clk);
+   clk_disable_unprepare(motg-core_clk);
if (!IS_ERR(motg-pclk_src)) {
-   clk_disable(motg-pclk_src);
+   clk_disable_unprepare(motg-pclk_src);
clk_put(motg-pclk_src);
}
msm_hsusb_ldo_init(motg, 0);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
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 01/10] usb: otg: msm: Convert to clk_prepare/unprepare

2012-09-26 Thread Stephen Boyd
On 09/26/12 09:58, Pankaj Jangra wrote:
 On Fri, Sep 21, 2012 at 7:56 AM, Stephen Boyd sb...@codeaurora.org wrote:
 diff --git a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c
 index 9f5fc90..2ae0639 100644
 --- a/drivers/usb/otg/msm_otg.c
 +++ b/drivers/usb/otg/msm_otg.c
 @@ -514,13 +514,13 @@ static int msm_otg_suspend(struct msm_otg *motg)
 motg-pdata-otg_control == OTG_PMIC_CONTROL)
 writel(readl(USB_PHY_CTRL) | PHY_RETEN, USB_PHY_CTRL);

 -   clk_disable(motg-pclk);
 -   clk_disable(motg-clk);
 +   clk_disable_unprepare(motg-pclk);
 +   clk_disable_unprepare(motg-clk);
 if (motg-core_clk)
 -   clk_disable(motg-core_clk);
 +   clk_disable_unprepare(motg-core_clk);

 I was under assumption that system suspend/resume might be called from
 the interrupt context. If that is case then its not appropriate to
 call clk_prepare/unprepare here right? or my understanding is not correct

Well we call disable_irq() at the top of this suspend function so I
suspect your understanding is incorrect. disable_irq() can call
schedule(). There are also a bunch of regulator calls in
msm_hsusb_ldo_set_mode() that this suspend function calls (almost all
regulator calls grab a mutex).

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

--
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 01/10] usb: otg: msm: Convert to clk_prepare/unprepare

2012-09-20 Thread Stephen Boyd
Add calls to clk_prepare and unprepare so that MSM can migrate to
the common clock framework.

Cc: Felipe Balbi ba...@ti.com
Signed-off-by: Stephen Boyd sb...@codeaurora.org
---
 drivers/usb/otg/msm_otg.c | 38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c
index 9f5fc90..2ae0639 100644
--- a/drivers/usb/otg/msm_otg.c
+++ b/drivers/usb/otg/msm_otg.c
@@ -514,13 +514,13 @@ static int msm_otg_suspend(struct msm_otg *motg)
motg-pdata-otg_control == OTG_PMIC_CONTROL)
writel(readl(USB_PHY_CTRL) | PHY_RETEN, USB_PHY_CTRL);
 
-   clk_disable(motg-pclk);
-   clk_disable(motg-clk);
+   clk_disable_unprepare(motg-pclk);
+   clk_disable_unprepare(motg-clk);
if (motg-core_clk)
-   clk_disable(motg-core_clk);
+   clk_disable_unprepare(motg-core_clk);
 
if (!IS_ERR(motg-pclk_src))
-   clk_disable(motg-pclk_src);
+   clk_disable_unprepare(motg-pclk_src);
 
if (motg-pdata-phy_type == SNPS_28NM_INTEGRATED_PHY 
motg-pdata-otg_control == OTG_PMIC_CONTROL) {
@@ -552,12 +552,12 @@ static int msm_otg_resume(struct msm_otg *motg)
return 0;
 
if (!IS_ERR(motg-pclk_src))
-   clk_enable(motg-pclk_src);
+   clk_prepare_enable(motg-pclk_src);
 
-   clk_enable(motg-pclk);
-   clk_enable(motg-clk);
+   clk_prepare_enable(motg-pclk);
+   clk_prepare_enable(motg-clk);
if (motg-core_clk)
-   clk_enable(motg-core_clk);
+   clk_prepare_enable(motg-core_clk);
 
if (motg-pdata-phy_type == SNPS_28NM_INTEGRATED_PHY 
motg-pdata-otg_control == OTG_PMIC_CONTROL) {
@@ -1468,7 +1468,7 @@ static int __init msm_otg_probe(struct platform_device 
*pdev)
if (IS_ERR(motg-pclk_src))
goto put_clk;
clk_set_rate(motg-pclk_src, INT_MAX);
-   clk_enable(motg-pclk_src);
+   clk_prepare_enable(motg-pclk_src);
} else
motg-pclk_src = ERR_PTR(-ENOENT);
 
@@ -1511,8 +1511,8 @@ static int __init msm_otg_probe(struct platform_device 
*pdev)
goto free_regs;
}
 
-   clk_enable(motg-clk);
-   clk_enable(motg-pclk);
+   clk_prepare_enable(motg-clk);
+   clk_prepare_enable(motg-pclk);
 
ret = msm_hsusb_init_vddcx(motg, 1);
if (ret) {
@@ -1532,7 +1532,7 @@ static int __init msm_otg_probe(struct platform_device 
*pdev)
}
 
if (motg-core_clk)
-   clk_enable(motg-core_clk);
+   clk_prepare_enable(motg-core_clk);
 
writel(0, USB_USBINTR);
writel(0, USB_OTGSC);
@@ -1579,8 +1579,8 @@ static int __init msm_otg_probe(struct platform_device 
*pdev)
 free_irq:
free_irq(motg-irq, motg);
 disable_clks:
-   clk_disable(motg-pclk);
-   clk_disable(motg-clk);
+   clk_disable_unprepare(motg-pclk);
+   clk_disable_unprepare(motg-clk);
 ldo_exit:
msm_hsusb_ldo_init(motg, 0);
 vddcx_exit:
@@ -1593,7 +1593,7 @@ put_core_clk:
clk_put(motg-pclk);
 put_pclk_src:
if (!IS_ERR(motg-pclk_src)) {
-   clk_disable(motg-pclk_src);
+   clk_disable_unprepare(motg-pclk_src);
clk_put(motg-pclk_src);
}
 put_clk:
@@ -1643,12 +1643,12 @@ static int __devexit msm_otg_remove(struct 
platform_device *pdev)
if (cnt = PHY_SUSPEND_TIMEOUT_USEC)
dev_err(phy-dev, Unable to suspend PHY\n);
 
-   clk_disable(motg-pclk);
-   clk_disable(motg-clk);
+   clk_disable_unprepare(motg-pclk);
+   clk_disable_unprepare(motg-clk);
if (motg-core_clk)
-   clk_disable(motg-core_clk);
+   clk_disable_unprepare(motg-core_clk);
if (!IS_ERR(motg-pclk_src)) {
-   clk_disable(motg-pclk_src);
+   clk_disable_unprepare(motg-pclk_src);
clk_put(motg-pclk_src);
}
msm_hsusb_ldo_init(motg, 0);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
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 00/10] Convert MSM to common clock framework

2012-09-20 Thread Stephen Boyd
This patchset moves the existing MSM clock code and affected drivers to the
common clock framework. A prerequisite of moving to the common clock
framework is to use clk_prepare() and clk_enable() so the first
few patches migrate drivers to that call (clk_prepare() is a no-op on MSM
right now). It also removes some custom clock APIs that MSM provides
and finally moves the proc_comm clock code to the common struct clock.

This patch series will be used as the foundation of the MSM 8660/8960
clock code that I plan to send out soon.

These patches have one dependency on the devm_clk_register() function
which I already posted to the list[1]. They're based on linux-next-20120917.

Stephen Boyd (10):
  usb: otg: msm: Convert to clk_prepare/unprepare
  msm_sdcc: Convert to clk_prepare/unprepare
  msm: iommu: Convert to clk_prepare/unprepare
  msm: iommu: Use clk_set_rate() instead of clk_set_min_rate()
  ARM: msm: Remove custom clk_set_flags() API
  ARM: msm: Remove custom clk_set_{max,min}_rate() API
  ARM: msm: Remove clock-7x30.h include file
  ARM: msm: Prepare clk_get() users in mach-msm for clock-pcom driver
  ARM: msm: Make proc_comm clock control into a platform driver
  ARM: msm: Migrate to common clock framework

 arch/arm/Kconfig   |   1 +
 arch/arm/mach-msm/Makefile |  10 +-
 arch/arm/mach-msm/board-halibut.c  |   2 +-
 arch/arm/mach-msm/board-msm7x30.c  |   2 +-
 arch/arm/mach-msm/board-qsd8x50.c  |   2 +-
 arch/arm/mach-msm/board-trout-panel.c  |  19 ++--
 arch/arm/mach-msm/board-trout.c|   3 +-
 arch/arm/mach-msm/clock-7x30.h | 155 --
 arch/arm/mach-msm/clock-debug.c| 130 --
 arch/arm/mach-msm/clock-pcom.c | 149 ++---
 arch/arm/mach-msm/clock-pcom.h |  31 +++---
 arch/arm/mach-msm/clock.c  | 166 +
 arch/arm/mach-msm/clock.h  |  51 +++---
 arch/arm/mach-msm/devices-msm7x00.c|  12 ++-
 arch/arm/mach-msm/devices-msm7x30.c|  13 ++-
 arch/arm/mach-msm/devices-qsd8x50.c|  11 ++-
 arch/arm/mach-msm/devices.h|  15 +--
 arch/arm/mach-msm/dma.c|   5 +-
 arch/arm/mach-msm/include/mach/board.h |   5 -
 arch/arm/mach-msm/include/mach/clk.h   |   9 --
 drivers/iommu/msm_iommu_dev.c  |  20 ++--
 drivers/mmc/host/msm_sdcc.c|  14 ++-
 drivers/usb/otg/msm_otg.c  |  38 
 23 files changed, 222 insertions(+), 641 deletions(-)
 delete mode 100644 arch/arm/mach-msm/clock-7x30.h
 delete mode 100644 arch/arm/mach-msm/clock-debug.c

[1] https://lkml.org/lkml/2012/9/19/28

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
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


<    1   2   3