Re: [PATCH 01/12] phy: rename struct omap_control_usb to struct omap_control_phy

2014-03-04 Thread Kishon Vijay Abraham I

Roger,

On Monday 03 March 2014 08:37 PM, Roger Quadros wrote:

From: Kishon Vijay Abraham I 

Rename struct omap_control_usb to struct omap_control_phy since it can
be used to control PHY of USB, SATA and PCIE. Also move the driver and
include files under *phy* and made the corresponding changes in the users
of phy-omap-control.

Signed-off-by: Kishon Vijay Abraham I 
Signed-off-by: Roger Quadros 
---
  drivers/phy/Kconfig  |  14 +-
  drivers/phy/Makefile |   1 +
  drivers/phy/phy-omap-control.c   | 320 +++
  drivers/phy/phy-omap-usb2.c  |   8 +-
  drivers/phy/phy-ti-pipe3.c   |   8 +-
  drivers/usb/musb/omap2430.c  |   2 +-
  drivers/usb/phy/Kconfig  |  10 --
  drivers/usb/phy/Makefile |   1 -
  drivers/usb/phy/phy-omap-control.c   | 319 --
  include/linux/phy/omap_control_phy.h |  89 ++
  include/linux/usb/omap_control_usb.h |  89 --
  11 files changed, 431 insertions(+), 430 deletions(-)
  create mode 100644 drivers/phy/phy-omap-control.c
  delete mode 100644 drivers/usb/phy/phy-omap-control.c
  create mode 100644 include/linux/phy/omap_control_phy.h
  delete mode 100644 include/linux/usb/omap_control_usb.h


you can use git format-patch -M if a file is moved from one place to 
another. The diff count will be less in that case and reviewing will be 
easier ;-)


Cheers
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/12] phy: rename struct omap_control_usb to struct omap_control_phy

2014-03-04 Thread Kishon Vijay Abraham I

Roger,

On Monday 03 March 2014 08:37 PM, Roger Quadros wrote:

From: Kishon Vijay Abraham I kis...@ti.com

Rename struct omap_control_usb to struct omap_control_phy since it can
be used to control PHY of USB, SATA and PCIE. Also move the driver and
include files under *phy* and made the corresponding changes in the users
of phy-omap-control.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Signed-off-by: Roger Quadros rog...@ti.com
---
  drivers/phy/Kconfig  |  14 +-
  drivers/phy/Makefile |   1 +
  drivers/phy/phy-omap-control.c   | 320 +++
  drivers/phy/phy-omap-usb2.c  |   8 +-
  drivers/phy/phy-ti-pipe3.c   |   8 +-
  drivers/usb/musb/omap2430.c  |   2 +-
  drivers/usb/phy/Kconfig  |  10 --
  drivers/usb/phy/Makefile |   1 -
  drivers/usb/phy/phy-omap-control.c   | 319 --
  include/linux/phy/omap_control_phy.h |  89 ++
  include/linux/usb/omap_control_usb.h |  89 --
  11 files changed, 431 insertions(+), 430 deletions(-)
  create mode 100644 drivers/phy/phy-omap-control.c
  delete mode 100644 drivers/usb/phy/phy-omap-control.c
  create mode 100644 include/linux/phy/omap_control_phy.h
  delete mode 100644 include/linux/usb/omap_control_usb.h


you can use git format-patch -M if a file is moved from one place to 
another. The diff count will be less in that case and reviewing will be 
easier ;-)


Cheers
Kishon
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/12] phy: rename struct omap_control_usb to struct omap_control_phy

2014-03-03 Thread Roger Quadros
From: Kishon Vijay Abraham I 

Rename struct omap_control_usb to struct omap_control_phy since it can
be used to control PHY of USB, SATA and PCIE. Also move the driver and
include files under *phy* and made the corresponding changes in the users
of phy-omap-control.

Signed-off-by: Kishon Vijay Abraham I 
Signed-off-by: Roger Quadros 
---
 drivers/phy/Kconfig  |  14 +-
 drivers/phy/Makefile |   1 +
 drivers/phy/phy-omap-control.c   | 320 +++
 drivers/phy/phy-omap-usb2.c  |   8 +-
 drivers/phy/phy-ti-pipe3.c   |   8 +-
 drivers/usb/musb/omap2430.c  |   2 +-
 drivers/usb/phy/Kconfig  |  10 --
 drivers/usb/phy/Makefile |   1 -
 drivers/usb/phy/phy-omap-control.c   | 319 --
 include/linux/phy/omap_control_phy.h |  89 ++
 include/linux/usb/omap_control_usb.h |  89 --
 11 files changed, 431 insertions(+), 430 deletions(-)
 create mode 100644 drivers/phy/phy-omap-control.c
 delete mode 100644 drivers/usb/phy/phy-omap-control.c
 create mode 100644 include/linux/phy/omap_control_phy.h
 delete mode 100644 include/linux/usb/omap_control_usb.h

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index bb238d4..2f02ec8 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -28,12 +28,22 @@ config PHY_MVEBU_SATA
depends on OF
select GENERIC_PHY
 
+config OMAP_CONTROL_PHY
+   tristate "OMAP CONTROL PHY Driver"
+   help
+ Enable this to add support for the PHY part present in the control
+ module. This driver has API to power on the USB2 PHY and to write to
+ the mailbox. The mailbox is present only in omap4 and the register to
+ power on the USB2 PHY is present in OMAP4 and OMAP5. OMAP5 has an
+ additional register to power on USB3 PHY/SATA PHY/PCIE PHY
+ (PIPE3 PHY).
+
 config OMAP_USB2
tristate "OMAP USB2 PHY Driver"
depends on ARCH_OMAP2PLUS
depends on USB_PHY
select GENERIC_PHY
-   select OMAP_CONTROL_USB
+   select OMAP_CONTROL_PHY
help
  Enable this to support the transceiver that is part of SOC. This
  driver takes care of all the PHY functionality apart from comparator.
@@ -44,7 +54,7 @@ config TI_PIPE3
tristate "TI PIPE3 PHY Driver"
depends on ARCH_OMAP2PLUS || COMPILE_TEST
select GENERIC_PHY
-   select OMAP_CONTROL_USB
+   select OMAP_CONTROL_PHY
help
  Enable this to support the PIPE3 PHY that is part of TI SOCs. This
  driver takes care of all the PHY functionality apart from comparator.
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 32e3f94..7518497 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_PHY_MVEBU_SATA)  += phy-mvebu-sata.o
 obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o
 obj-$(CONFIG_TI_PIPE3) += phy-ti-pipe3.o
 obj-$(CONFIG_TWL4030_USB)  += phy-twl4030-usb.o
+obj-$(CONFIG_OMAP_CONTROL_PHY) += phy-omap-control.o
diff --git a/drivers/phy/phy-omap-control.c b/drivers/phy/phy-omap-control.c
new file mode 100644
index 000..17fc200
--- /dev/null
+++ b/drivers/phy/phy-omap-control.c
@@ -0,0 +1,320 @@
+/*
+ * omap-control-phy.c - The PHY part of control module.
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Author: Kishon Vijay Abraham I 
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+
+/**
+ * omap_control_phy_power - power on/off the phy using control module reg
+ * @dev: the control module device
+ * @on: 0 or 1, based on powering on or off the PHY
+ */
+void omap_control_phy_power(struct device *dev, int on)
+{
+   u32 val;
+   unsigned long rate;
+   struct omap_control_phy *control_phy;
+
+   if (IS_ERR(dev) || !dev) {
+   pr_err("%s: invalid device\n", __func__);
+   return;
+   }
+
+   control_phy = dev_get_drvdata(dev);
+   if (!control_phy) {
+   dev_err(dev, "%s: invalid control phy device\n", __func__);
+   return;
+   }
+
+   if (control_phy->type == OMAP_CTRL_TYPE_OTGHS)
+   return;
+
+   val = readl(control_phy->power);
+
+   switch (control_phy->type) {
+   case OMAP_CTRL_TYPE_USB2:
+  

[PATCH 01/12] phy: rename struct omap_control_usb to struct omap_control_phy

2014-03-03 Thread Roger Quadros
From: Kishon Vijay Abraham I kis...@ti.com

Rename struct omap_control_usb to struct omap_control_phy since it can
be used to control PHY of USB, SATA and PCIE. Also move the driver and
include files under *phy* and made the corresponding changes in the users
of phy-omap-control.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Signed-off-by: Roger Quadros rog...@ti.com
---
 drivers/phy/Kconfig  |  14 +-
 drivers/phy/Makefile |   1 +
 drivers/phy/phy-omap-control.c   | 320 +++
 drivers/phy/phy-omap-usb2.c  |   8 +-
 drivers/phy/phy-ti-pipe3.c   |   8 +-
 drivers/usb/musb/omap2430.c  |   2 +-
 drivers/usb/phy/Kconfig  |  10 --
 drivers/usb/phy/Makefile |   1 -
 drivers/usb/phy/phy-omap-control.c   | 319 --
 include/linux/phy/omap_control_phy.h |  89 ++
 include/linux/usb/omap_control_usb.h |  89 --
 11 files changed, 431 insertions(+), 430 deletions(-)
 create mode 100644 drivers/phy/phy-omap-control.c
 delete mode 100644 drivers/usb/phy/phy-omap-control.c
 create mode 100644 include/linux/phy/omap_control_phy.h
 delete mode 100644 include/linux/usb/omap_control_usb.h

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index bb238d4..2f02ec8 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -28,12 +28,22 @@ config PHY_MVEBU_SATA
depends on OF
select GENERIC_PHY
 
+config OMAP_CONTROL_PHY
+   tristate OMAP CONTROL PHY Driver
+   help
+ Enable this to add support for the PHY part present in the control
+ module. This driver has API to power on the USB2 PHY and to write to
+ the mailbox. The mailbox is present only in omap4 and the register to
+ power on the USB2 PHY is present in OMAP4 and OMAP5. OMAP5 has an
+ additional register to power on USB3 PHY/SATA PHY/PCIE PHY
+ (PIPE3 PHY).
+
 config OMAP_USB2
tristate OMAP USB2 PHY Driver
depends on ARCH_OMAP2PLUS
depends on USB_PHY
select GENERIC_PHY
-   select OMAP_CONTROL_USB
+   select OMAP_CONTROL_PHY
help
  Enable this to support the transceiver that is part of SOC. This
  driver takes care of all the PHY functionality apart from comparator.
@@ -44,7 +54,7 @@ config TI_PIPE3
tristate TI PIPE3 PHY Driver
depends on ARCH_OMAP2PLUS || COMPILE_TEST
select GENERIC_PHY
-   select OMAP_CONTROL_USB
+   select OMAP_CONTROL_PHY
help
  Enable this to support the PIPE3 PHY that is part of TI SOCs. This
  driver takes care of all the PHY functionality apart from comparator.
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 32e3f94..7518497 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_PHY_MVEBU_SATA)  += phy-mvebu-sata.o
 obj-$(CONFIG_OMAP_USB2)+= phy-omap-usb2.o
 obj-$(CONFIG_TI_PIPE3) += phy-ti-pipe3.o
 obj-$(CONFIG_TWL4030_USB)  += phy-twl4030-usb.o
+obj-$(CONFIG_OMAP_CONTROL_PHY) += phy-omap-control.o
diff --git a/drivers/phy/phy-omap-control.c b/drivers/phy/phy-omap-control.c
new file mode 100644
index 000..17fc200
--- /dev/null
+++ b/drivers/phy/phy-omap-control.c
@@ -0,0 +1,320 @@
+/*
+ * omap-control-phy.c - The PHY part of control module.
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Author: Kishon Vijay Abraham I kis...@ti.com
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/slab.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/err.h
+#include linux/io.h
+#include linux/clk.h
+#include linux/phy/omap_control_phy.h
+
+/**
+ * omap_control_phy_power - power on/off the phy using control module reg
+ * @dev: the control module device
+ * @on: 0 or 1, based on powering on or off the PHY
+ */
+void omap_control_phy_power(struct device *dev, int on)
+{
+   u32 val;
+   unsigned long rate;
+   struct omap_control_phy *control_phy;
+
+   if (IS_ERR(dev) || !dev) {
+   pr_err(%s: invalid device\n, __func__);
+   return;
+   }
+
+   control_phy = dev_get_drvdata(dev);
+   if (!control_phy) {
+   dev_err(dev, %s: invalid control phy device\n, __func__);
+   return;
+   }
+
+   if (control_phy-type ==