* [PATCH v2 01/13] phy: rename struct omap_control_usb to struct omap_control_phy
2014-03-06 14:38 [PATCH v2 00/13][RESEND] ARM: OMAP: SATA support for OMAP5 & DRA7 Roger Quadros
@ 2014-03-06 14:38 ` Roger Quadros
2014-03-06 15:37 ` Kishon Vijay Abraham I
2014-03-06 14:38 ` [PATCH v2 02/13] phy: omap-control: Update DT binding information Roger Quadros
` (11 subsequent siblings)
12 siblings, 1 reply; 26+ messages in thread
From: Roger Quadros @ 2014-03-06 14:38 UTC (permalink / raw)
To: kishon, tony, balbi
Cc: devicetree, george.cherian, balajitk, linux-ide, linux-usb,
linux-kernel, hdegoede, linux-omap, linux-arm-kernel, rogerq
From: Kishon Vijay Abraham I <kishon@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 <kishon@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/phy/Kconfig | 14 +-
drivers/phy/Makefile | 1 +
drivers/{usb => }/phy/phy-omap-control.c | 165 +++++++++++----------
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 -
.../omap_control_usb.h => phy/omap_control_phy.h} | 36 ++---
9 files changed, 123 insertions(+), 122 deletions(-)
rename drivers/{usb => }/phy/phy-omap-control.c (55%)
rename include/linux/{usb/omap_control_usb.h => phy/omap_control_phy.h} (68%)
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 1b607d7..fe8c009 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -31,12 +31,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.
@@ -47,7 +57,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 ecf0d3f..8da05a8 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_BCM_KONA_USB2_PHY) += phy-bcm-kona-usb2.o
obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o
obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += phy-exynos-mipi-video.o
obj-$(CONFIG_PHY_MVEBU_SATA) += phy-mvebu-sata.o
+obj-$(CONFIG_OMAP_CONTROL_PHY) += phy-omap-control.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
diff --git a/drivers/usb/phy/phy-omap-control.c b/drivers/phy/phy-omap-control.c
similarity index 55%
rename from drivers/usb/phy/phy-omap-control.c
rename to drivers/phy/phy-omap-control.c
index e725318..17fc200 100644
--- a/drivers/usb/phy/phy-omap-control.c
+++ b/drivers/phy/phy-omap-control.c
@@ -1,5 +1,5 @@
/*
- * omap-control-usb.c - The USB part of control module.
+ * 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
@@ -24,36 +24,36 @@
#include <linux/err.h>
#include <linux/io.h>
#include <linux/clk.h>
-#include <linux/usb/omap_control_usb.h>
+#include <linux/phy/omap_control_phy.h>
/**
- * omap_control_usb_phy_power - power on/off the phy using control module reg
+ * 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_usb_phy_power(struct device *dev, int on)
+void omap_control_phy_power(struct device *dev, int on)
{
u32 val;
unsigned long rate;
- struct omap_control_usb *control_usb;
+ struct omap_control_phy *control_phy;
if (IS_ERR(dev) || !dev) {
pr_err("%s: invalid device\n", __func__);
return;
}
- control_usb = dev_get_drvdata(dev);
- if (!control_usb) {
- dev_err(dev, "%s: invalid control usb device\n", __func__);
+ control_phy = dev_get_drvdata(dev);
+ if (!control_phy) {
+ dev_err(dev, "%s: invalid control phy device\n", __func__);
return;
}
- if (control_usb->type == OMAP_CTRL_TYPE_OTGHS)
+ if (control_phy->type == OMAP_CTRL_TYPE_OTGHS)
return;
- val = readl(control_usb->power);
+ val = readl(control_phy->power);
- switch (control_usb->type) {
+ switch (control_phy->type) {
case OMAP_CTRL_TYPE_USB2:
if (on)
val &= ~OMAP_CTRL_DEV_PHY_PD;
@@ -62,19 +62,20 @@ void omap_control_usb_phy_power(struct device *dev, int on)
break;
case OMAP_CTRL_TYPE_PIPE3:
- rate = clk_get_rate(control_usb->sys_clk);
+ rate = clk_get_rate(control_phy->sys_clk);
rate = rate/1000000;
if (on) {
- val &= ~(OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK |
- OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK);
- val |= OMAP_CTRL_USB3_PHY_TX_RX_POWERON <<
- OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT;
- val |= rate << OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT;
+ val &= ~(OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK |
+ OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK);
+ val |= OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON <<
+ OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
+ val |= rate <<
+ OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT;
} else {
- val &= ~OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK;
- val |= OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF <<
- OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT;
+ val &= ~OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK;
+ val |= OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF <<
+ OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
}
break;
@@ -100,66 +101,66 @@ void omap_control_usb_phy_power(struct device *dev, int on)
break;
default:
dev_err(dev, "%s: type %d not recognized\n",
- __func__, control_usb->type);
+ __func__, control_phy->type);
break;
}
- writel(val, control_usb->power);
+ writel(val, control_phy->power);
}
-EXPORT_SYMBOL_GPL(omap_control_usb_phy_power);
+EXPORT_SYMBOL_GPL(omap_control_phy_power);
/**
* omap_control_usb_host_mode - set AVALID, VBUSVALID and ID pin in grounded
- * @ctrl_usb: struct omap_control_usb *
+ * @ctrl_phy: struct omap_control_phy *
*
* Writes to the mailbox register to notify the usb core that a usb
* device has been connected.
*/
-static void omap_control_usb_host_mode(struct omap_control_usb *ctrl_usb)
+static void omap_control_usb_host_mode(struct omap_control_phy *ctrl_phy)
{
u32 val;
- val = readl(ctrl_usb->otghs_control);
+ val = readl(ctrl_phy->otghs_control);
val &= ~(OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_SESSEND);
val |= OMAP_CTRL_DEV_AVALID | OMAP_CTRL_DEV_VBUSVALID;
- writel(val, ctrl_usb->otghs_control);
+ writel(val, ctrl_phy->otghs_control);
}
/**
* omap_control_usb_device_mode - set AVALID, VBUSVALID and ID pin in high
* impedance
- * @ctrl_usb: struct omap_control_usb *
+ * @ctrl_phy: struct omap_control_phy *
*
* Writes to the mailbox register to notify the usb core that it has been
* connected to a usb host.
*/
-static void omap_control_usb_device_mode(struct omap_control_usb *ctrl_usb)
+static void omap_control_usb_device_mode(struct omap_control_phy *ctrl_phy)
{
u32 val;
- val = readl(ctrl_usb->otghs_control);
+ val = readl(ctrl_phy->otghs_control);
val &= ~OMAP_CTRL_DEV_SESSEND;
val |= OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_AVALID |
OMAP_CTRL_DEV_VBUSVALID;
- writel(val, ctrl_usb->otghs_control);
+ writel(val, ctrl_phy->otghs_control);
}
/**
* omap_control_usb_set_sessionend - Enable SESSIONEND and IDIG to high
* impedance
- * @ctrl_usb: struct omap_control_usb *
+ * @ctrl_phy: struct omap_control_phy *
*
* Writes to the mailbox register to notify the usb core it's now in
* disconnected state.
*/
-static void omap_control_usb_set_sessionend(struct omap_control_usb *ctrl_usb)
+static void omap_control_usb_set_sessionend(struct omap_control_phy *ctrl_phy)
{
u32 val;
- val = readl(ctrl_usb->otghs_control);
+ val = readl(ctrl_phy->otghs_control);
val &= ~(OMAP_CTRL_DEV_AVALID | OMAP_CTRL_DEV_VBUSVALID);
val |= OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_SESSEND;
- writel(val, ctrl_usb->otghs_control);
+ writel(val, ctrl_phy->otghs_control);
}
/**
@@ -174,30 +175,30 @@ static void omap_control_usb_set_sessionend(struct omap_control_usb *ctrl_usb)
void omap_control_usb_set_mode(struct device *dev,
enum omap_control_usb_mode mode)
{
- struct omap_control_usb *ctrl_usb;
+ struct omap_control_phy *ctrl_phy;
if (IS_ERR(dev) || !dev)
return;
- ctrl_usb = dev_get_drvdata(dev);
+ ctrl_phy = dev_get_drvdata(dev);
- if (!ctrl_usb) {
- dev_err(dev, "Invalid control usb device\n");
+ if (!ctrl_phy) {
+ dev_err(dev, "Invalid control phy device\n");
return;
}
- if (ctrl_usb->type != OMAP_CTRL_TYPE_OTGHS)
+ if (ctrl_phy->type != OMAP_CTRL_TYPE_OTGHS)
return;
switch (mode) {
case USB_MODE_HOST:
- omap_control_usb_host_mode(ctrl_usb);
+ omap_control_usb_host_mode(ctrl_phy);
break;
case USB_MODE_DEVICE:
- omap_control_usb_device_mode(ctrl_usb);
+ omap_control_usb_device_mode(ctrl_phy);
break;
case USB_MODE_DISCONNECT:
- omap_control_usb_set_sessionend(ctrl_usb);
+ omap_control_usb_set_sessionend(ctrl_phy);
break;
default:
dev_vdbg(dev, "invalid omap control usb mode\n");
@@ -207,13 +208,13 @@ EXPORT_SYMBOL_GPL(omap_control_usb_set_mode);
#ifdef CONFIG_OF
-static const enum omap_control_usb_type otghs_data = OMAP_CTRL_TYPE_OTGHS;
-static const enum omap_control_usb_type usb2_data = OMAP_CTRL_TYPE_USB2;
-static const enum omap_control_usb_type pipe3_data = OMAP_CTRL_TYPE_PIPE3;
-static const enum omap_control_usb_type dra7usb2_data = OMAP_CTRL_TYPE_DRA7USB2;
-static const enum omap_control_usb_type am437usb2_data = OMAP_CTRL_TYPE_AM437USB2;
+static const enum omap_control_phy_type otghs_data = OMAP_CTRL_TYPE_OTGHS;
+static const enum omap_control_phy_type usb2_data = OMAP_CTRL_TYPE_USB2;
+static const enum omap_control_phy_type pipe3_data = OMAP_CTRL_TYPE_PIPE3;
+static const enum omap_control_phy_type dra7usb2_data = OMAP_CTRL_TYPE_DRA7USB2;
+static const enum omap_control_phy_type am437usb2_data = OMAP_CTRL_TYPE_AM437USB2;
-static const struct of_device_id omap_control_usb_id_table[] = {
+static const struct of_device_id omap_control_phy_id_table[] = {
{
.compatible = "ti,control-phy-otghs",
.data = &otghs_data,
@@ -236,84 +237,84 @@ static const struct of_device_id omap_control_usb_id_table[] = {
},
{},
};
-MODULE_DEVICE_TABLE(of, omap_control_usb_id_table);
+MODULE_DEVICE_TABLE(of, omap_control_phy_id_table);
#endif
-static int omap_control_usb_probe(struct platform_device *pdev)
+static int omap_control_phy_probe(struct platform_device *pdev)
{
struct resource *res;
const struct of_device_id *of_id;
- struct omap_control_usb *control_usb;
+ struct omap_control_phy *control_phy;
- of_id = of_match_device(of_match_ptr(omap_control_usb_id_table),
- &pdev->dev);
+ of_id = of_match_device(of_match_ptr(omap_control_phy_id_table),
+ &pdev->dev);
if (!of_id)
return -EINVAL;
- control_usb = devm_kzalloc(&pdev->dev, sizeof(*control_usb),
+ control_phy = devm_kzalloc(&pdev->dev, sizeof(*control_phy),
GFP_KERNEL);
- if (!control_usb) {
- dev_err(&pdev->dev, "unable to alloc memory for control usb\n");
+ if (!control_phy) {
+ dev_err(&pdev->dev, "unable to alloc memory for control phy\n");
return -ENOMEM;
}
- control_usb->dev = &pdev->dev;
- control_usb->type = *(enum omap_control_usb_type *)of_id->data;
+ control_phy->dev = &pdev->dev;
+ control_phy->type = *(enum omap_control_phy_type *)of_id->data;
- if (control_usb->type == OMAP_CTRL_TYPE_OTGHS) {
+ if (control_phy->type == OMAP_CTRL_TYPE_OTGHS) {
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"otghs_control");
- control_usb->otghs_control = devm_ioremap_resource(
+ control_phy->otghs_control = devm_ioremap_resource(
&pdev->dev, res);
- if (IS_ERR(control_usb->otghs_control))
- return PTR_ERR(control_usb->otghs_control);
+ if (IS_ERR(control_phy->otghs_control))
+ return PTR_ERR(control_phy->otghs_control);
} else {
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"power");
- control_usb->power = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(control_usb->power)) {
+ control_phy->power = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(control_phy->power)) {
dev_err(&pdev->dev, "Couldn't get power register\n");
- return PTR_ERR(control_usb->power);
+ return PTR_ERR(control_phy->power);
}
}
- if (control_usb->type == OMAP_CTRL_TYPE_PIPE3) {
- control_usb->sys_clk = devm_clk_get(control_usb->dev,
+ if (control_phy->type == OMAP_CTRL_TYPE_PIPE3) {
+ control_phy->sys_clk = devm_clk_get(control_phy->dev,
"sys_clkin");
- if (IS_ERR(control_usb->sys_clk)) {
+ if (IS_ERR(control_phy->sys_clk)) {
pr_err("%s: unable to get sys_clkin\n", __func__);
return -EINVAL;
}
}
- dev_set_drvdata(control_usb->dev, control_usb);
+ dev_set_drvdata(control_phy->dev, control_phy);
return 0;
}
-static struct platform_driver omap_control_usb_driver = {
- .probe = omap_control_usb_probe,
+static struct platform_driver omap_control_phy_driver = {
+ .probe = omap_control_phy_probe,
.driver = {
- .name = "omap-control-usb",
+ .name = "omap-control-phy",
.owner = THIS_MODULE,
- .of_match_table = of_match_ptr(omap_control_usb_id_table),
+ .of_match_table = of_match_ptr(omap_control_phy_id_table),
},
};
-static int __init omap_control_usb_init(void)
+static int __init omap_control_phy_init(void)
{
- return platform_driver_register(&omap_control_usb_driver);
+ return platform_driver_register(&omap_control_phy_driver);
}
-subsys_initcall(omap_control_usb_init);
+subsys_initcall(omap_control_phy_init);
-static void __exit omap_control_usb_exit(void)
+static void __exit omap_control_phy_exit(void)
{
- platform_driver_unregister(&omap_control_usb_driver);
+ platform_driver_unregister(&omap_control_phy_driver);
}
-module_exit(omap_control_usb_exit);
+module_exit(omap_control_phy_exit);
-MODULE_ALIAS("platform: omap_control_usb");
+MODULE_ALIAS("platform: omap_control_phy");
MODULE_AUTHOR("Texas Instruments Inc.");
-MODULE_DESCRIPTION("OMAP Control Module USB Driver");
+MODULE_DESCRIPTION("OMAP Control Module PHY Driver");
MODULE_LICENSE("GPL v2");
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index 3cc4aba..a2205a8 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -27,7 +27,7 @@
#include <linux/err.h>
#include <linux/pm_runtime.h>
#include <linux/delay.h>
-#include <linux/usb/omap_control_usb.h>
+#include <linux/phy/omap_control_phy.h>
#include <linux/phy/phy.h>
#include <linux/of_platform.h>
@@ -105,7 +105,7 @@ static int omap_usb_power_off(struct phy *x)
{
struct omap_usb *phy = phy_get_drvdata(x);
- omap_control_usb_phy_power(phy->control_dev, 0);
+ omap_control_phy_power(phy->control_dev, 0);
return 0;
}
@@ -114,7 +114,7 @@ static int omap_usb_power_on(struct phy *x)
{
struct omap_usb *phy = phy_get_drvdata(x);
- omap_control_usb_phy_power(phy->control_dev, 1);
+ omap_control_phy_power(phy->control_dev, 1);
return 0;
}
@@ -251,7 +251,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
}
phy->control_dev = &control_pdev->dev;
- omap_control_usb_phy_power(phy->control_dev, 0);
+ omap_control_phy_power(phy->control_dev, 0);
otg->set_host = omap_usb_set_host;
otg->set_peripheral = omap_usb_set_peripheral;
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index c8d1674..fd029b1 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -26,7 +26,7 @@
#include <linux/io.h>
#include <linux/pm_runtime.h>
#include <linux/delay.h>
-#include <linux/usb/omap_control_usb.h>
+#include <linux/phy/omap_control_phy.h>
#include <linux/of_platform.h>
#define PLL_STATUS 0x00000004
@@ -134,7 +134,7 @@ static int ti_pipe3_power_off(struct phy *x)
return -EBUSY;
}
- omap_control_usb_phy_power(phy->control_dev, 0);
+ omap_control_phy_power(phy->control_dev, 0);
return 0;
}
@@ -232,7 +232,7 @@ static int ti_pipe3_init(struct phy *x)
if (ret)
return ret;
- omap_control_usb_phy_power(phy->control_dev, 1);
+ omap_control_phy_power(phy->control_dev, 1);
return 0;
}
@@ -304,7 +304,7 @@ static int ti_pipe3_probe(struct platform_device *pdev)
phy->control_dev = &control_pdev->dev;
- omap_control_usb_phy_power(phy->control_dev, 0);
+ omap_control_phy_power(phy->control_dev, 0);
platform_set_drvdata(pdev, phy);
pm_runtime_enable(phy->dev);
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 8aa59a2..d341c14 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -37,7 +37,7 @@
#include <linux/err.h>
#include <linux/delay.h>
#include <linux/usb/musb-omap.h>
-#include <linux/usb/omap_control_usb.h>
+#include <linux/phy/omap_control_phy.h>
#include <linux/of_platform.h>
#include "musb_core.h"
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index c337ba2..416e0c8 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -75,16 +75,6 @@ config NOP_USB_XCEIV
built-in with usb ip or which are autonomous and doesn't require any
phy programming such as ISP1x04 etc.
-config OMAP_CONTROL_USB
- tristate "OMAP CONTROL USB Driver"
- depends on ARCH_OMAP2PLUS || COMPILE_TEST
- help
- Enable this to add support for the USB 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.
-
config AM335X_CONTROL_USB
tristate
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index 15f1878..f8fa719 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -13,7 +13,6 @@ obj-$(CONFIG_ISP1301_OMAP) += phy-isp1301-omap.o
obj-$(CONFIG_MV_U3D_PHY) += phy-mv-u3d-usb.o
obj-$(CONFIG_NOP_USB_XCEIV) += phy-generic.o
obj-$(CONFIG_TAHVO_USB) += phy-tahvo.o
-obj-$(CONFIG_OMAP_CONTROL_USB) += phy-omap-control.o
obj-$(CONFIG_AM335X_CONTROL_USB) += phy-am335x-control.o
obj-$(CONFIG_AM335X_PHY_USB) += phy-am335x.o
obj-$(CONFIG_OMAP_OTG) += phy-omap-otg.o
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/phy/omap_control_phy.h
similarity index 68%
rename from include/linux/usb/omap_control_usb.h
rename to include/linux/phy/omap_control_phy.h
index 69ae383..5450403 100644
--- a/include/linux/usb/omap_control_usb.h
+++ b/include/linux/phy/omap_control_phy.h
@@ -1,5 +1,5 @@
/*
- * omap_control_usb.h - Header file for the USB part of control module.
+ * omap_control_phy.h - Header file for 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
@@ -16,10 +16,10 @@
*
*/
-#ifndef __OMAP_CONTROL_USB_H__
-#define __OMAP_CONTROL_USB_H__
+#ifndef __OMAP_CONTROL_PHY_H__
+#define __OMAP_CONTROL_PHY_H__
-enum omap_control_usb_type {
+enum omap_control_phy_type {
OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */
OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */
OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */
@@ -27,7 +27,7 @@ enum omap_control_usb_type {
OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
};
-struct omap_control_usb {
+struct omap_control_phy {
struct device *dev;
u32 __iomem *otghs_control;
@@ -36,7 +36,7 @@ struct omap_control_usb {
struct clk *sys_clk;
- enum omap_control_usb_type type;
+ enum omap_control_phy_type type;
};
enum omap_control_usb_mode {
@@ -54,14 +54,14 @@ enum omap_control_usb_mode {
#define OMAP_CTRL_DEV_SESSEND BIT(3)
#define OMAP_CTRL_DEV_IDDIG BIT(4)
-#define OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK 0x003FC000
-#define OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT 0xE
+#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK 0x003FC000
+#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT 0xE
-#define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK 0xFFC00000
-#define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT 0x16
+#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK 0xFFC00000
+#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT 0x16
-#define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3
-#define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0
+#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3
+#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0
#define OMAP_CTRL_USB2_PHY_PD BIT(28)
@@ -70,13 +70,13 @@ enum omap_control_usb_mode {
#define AM437X_CTRL_USB2_OTGVDET_EN BIT(19)
#define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20)
-#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
-extern void omap_control_usb_phy_power(struct device *dev, int on);
-extern void omap_control_usb_set_mode(struct device *dev,
- enum omap_control_usb_mode mode);
+#if IS_ENABLED(CONFIG_OMAP_CONTROL_PHY)
+void omap_control_phy_power(struct device *dev, int on);
+void omap_control_usb_set_mode(struct device *dev,
+ enum omap_control_usb_mode mode);
#else
-static inline void omap_control_usb_phy_power(struct device *dev, int on)
+static inline void omap_control_phy_power(struct device *dev, int on)
{
}
@@ -86,4 +86,4 @@ static inline void omap_control_usb_set_mode(struct device *dev,
}
#endif
-#endif /* __OMAP_CONTROL_USB_H__ */
+#endif /* __OMAP_CONTROL_PHY_H__ */
--
1.8.3.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH v2 01/13] phy: rename struct omap_control_usb to struct omap_control_phy
2014-03-06 14:38 ` [PATCH v2 01/13] phy: rename struct omap_control_usb to struct omap_control_phy Roger Quadros
@ 2014-03-06 15:37 ` Kishon Vijay Abraham I
2014-03-06 15:56 ` Felipe Balbi
0 siblings, 1 reply; 26+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-06 15:37 UTC (permalink / raw)
To: Roger Quadros, tony, balbi
Cc: devicetree, george.cherian, balajitk, linux-ide, linux-usb,
linux-kernel, hdegoede, linux-omap, linux-arm-kernel
Felipe,
On Thursday 06 March 2014 08:08 PM, Roger Quadros wrote:
> From: Kishon Vijay Abraham I <kishon@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 <kishon@ti.com>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
> drivers/phy/Kconfig | 14 +-
> drivers/phy/Makefile | 1 +
> drivers/{usb => }/phy/phy-omap-control.c | 165 +++++++++++----------
> 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 -
Hope you are fine with the changes in drivers/usb/? Can you give your
Acked-by?
Regards
Kishon
> .../omap_control_usb.h => phy/omap_control_phy.h} | 36 ++---
> 9 files changed, 123 insertions(+), 122 deletions(-)
> rename drivers/{usb => }/phy/phy-omap-control.c (55%)
> rename include/linux/{usb/omap_control_usb.h => phy/omap_control_phy.h} (68%)
>
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 1b607d7..fe8c009 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -31,12 +31,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.
> @@ -47,7 +57,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 ecf0d3f..8da05a8 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -7,6 +7,7 @@ obj-$(CONFIG_BCM_KONA_USB2_PHY) += phy-bcm-kona-usb2.o
> obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o
> obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += phy-exynos-mipi-video.o
> obj-$(CONFIG_PHY_MVEBU_SATA) += phy-mvebu-sata.o
> +obj-$(CONFIG_OMAP_CONTROL_PHY) += phy-omap-control.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
> diff --git a/drivers/usb/phy/phy-omap-control.c b/drivers/phy/phy-omap-control.c
> similarity index 55%
> rename from drivers/usb/phy/phy-omap-control.c
> rename to drivers/phy/phy-omap-control.c
> index e725318..17fc200 100644
> --- a/drivers/usb/phy/phy-omap-control.c
> +++ b/drivers/phy/phy-omap-control.c
> @@ -1,5 +1,5 @@
> /*
> - * omap-control-usb.c - The USB part of control module.
> + * 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
> @@ -24,36 +24,36 @@
> #include <linux/err.h>
> #include <linux/io.h>
> #include <linux/clk.h>
> -#include <linux/usb/omap_control_usb.h>
> +#include <linux/phy/omap_control_phy.h>
>
> /**
> - * omap_control_usb_phy_power - power on/off the phy using control module reg
> + * 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_usb_phy_power(struct device *dev, int on)
> +void omap_control_phy_power(struct device *dev, int on)
> {
> u32 val;
> unsigned long rate;
> - struct omap_control_usb *control_usb;
> + struct omap_control_phy *control_phy;
>
> if (IS_ERR(dev) || !dev) {
> pr_err("%s: invalid device\n", __func__);
> return;
> }
>
> - control_usb = dev_get_drvdata(dev);
> - if (!control_usb) {
> - dev_err(dev, "%s: invalid control usb device\n", __func__);
> + control_phy = dev_get_drvdata(dev);
> + if (!control_phy) {
> + dev_err(dev, "%s: invalid control phy device\n", __func__);
> return;
> }
>
> - if (control_usb->type == OMAP_CTRL_TYPE_OTGHS)
> + if (control_phy->type == OMAP_CTRL_TYPE_OTGHS)
> return;
>
> - val = readl(control_usb->power);
> + val = readl(control_phy->power);
>
> - switch (control_usb->type) {
> + switch (control_phy->type) {
> case OMAP_CTRL_TYPE_USB2:
> if (on)
> val &= ~OMAP_CTRL_DEV_PHY_PD;
> @@ -62,19 +62,20 @@ void omap_control_usb_phy_power(struct device *dev, int on)
> break;
>
> case OMAP_CTRL_TYPE_PIPE3:
> - rate = clk_get_rate(control_usb->sys_clk);
> + rate = clk_get_rate(control_phy->sys_clk);
> rate = rate/1000000;
>
> if (on) {
> - val &= ~(OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK |
> - OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK);
> - val |= OMAP_CTRL_USB3_PHY_TX_RX_POWERON <<
> - OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT;
> - val |= rate << OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT;
> + val &= ~(OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK |
> + OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK);
> + val |= OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON <<
> + OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
> + val |= rate <<
> + OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT;
> } else {
> - val &= ~OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK;
> - val |= OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF <<
> - OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT;
> + val &= ~OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK;
> + val |= OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF <<
> + OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
> }
> break;
>
> @@ -100,66 +101,66 @@ void omap_control_usb_phy_power(struct device *dev, int on)
> break;
> default:
> dev_err(dev, "%s: type %d not recognized\n",
> - __func__, control_usb->type);
> + __func__, control_phy->type);
> break;
> }
>
> - writel(val, control_usb->power);
> + writel(val, control_phy->power);
> }
> -EXPORT_SYMBOL_GPL(omap_control_usb_phy_power);
> +EXPORT_SYMBOL_GPL(omap_control_phy_power);
>
> /**
> * omap_control_usb_host_mode - set AVALID, VBUSVALID and ID pin in grounded
> - * @ctrl_usb: struct omap_control_usb *
> + * @ctrl_phy: struct omap_control_phy *
> *
> * Writes to the mailbox register to notify the usb core that a usb
> * device has been connected.
> */
> -static void omap_control_usb_host_mode(struct omap_control_usb *ctrl_usb)
> +static void omap_control_usb_host_mode(struct omap_control_phy *ctrl_phy)
> {
> u32 val;
>
> - val = readl(ctrl_usb->otghs_control);
> + val = readl(ctrl_phy->otghs_control);
> val &= ~(OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_SESSEND);
> val |= OMAP_CTRL_DEV_AVALID | OMAP_CTRL_DEV_VBUSVALID;
> - writel(val, ctrl_usb->otghs_control);
> + writel(val, ctrl_phy->otghs_control);
> }
>
> /**
> * omap_control_usb_device_mode - set AVALID, VBUSVALID and ID pin in high
> * impedance
> - * @ctrl_usb: struct omap_control_usb *
> + * @ctrl_phy: struct omap_control_phy *
> *
> * Writes to the mailbox register to notify the usb core that it has been
> * connected to a usb host.
> */
> -static void omap_control_usb_device_mode(struct omap_control_usb *ctrl_usb)
> +static void omap_control_usb_device_mode(struct omap_control_phy *ctrl_phy)
> {
> u32 val;
>
> - val = readl(ctrl_usb->otghs_control);
> + val = readl(ctrl_phy->otghs_control);
> val &= ~OMAP_CTRL_DEV_SESSEND;
> val |= OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_AVALID |
> OMAP_CTRL_DEV_VBUSVALID;
> - writel(val, ctrl_usb->otghs_control);
> + writel(val, ctrl_phy->otghs_control);
> }
>
> /**
> * omap_control_usb_set_sessionend - Enable SESSIONEND and IDIG to high
> * impedance
> - * @ctrl_usb: struct omap_control_usb *
> + * @ctrl_phy: struct omap_control_phy *
> *
> * Writes to the mailbox register to notify the usb core it's now in
> * disconnected state.
> */
> -static void omap_control_usb_set_sessionend(struct omap_control_usb *ctrl_usb)
> +static void omap_control_usb_set_sessionend(struct omap_control_phy *ctrl_phy)
> {
> u32 val;
>
> - val = readl(ctrl_usb->otghs_control);
> + val = readl(ctrl_phy->otghs_control);
> val &= ~(OMAP_CTRL_DEV_AVALID | OMAP_CTRL_DEV_VBUSVALID);
> val |= OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_SESSEND;
> - writel(val, ctrl_usb->otghs_control);
> + writel(val, ctrl_phy->otghs_control);
> }
>
> /**
> @@ -174,30 +175,30 @@ static void omap_control_usb_set_sessionend(struct omap_control_usb *ctrl_usb)
> void omap_control_usb_set_mode(struct device *dev,
> enum omap_control_usb_mode mode)
> {
> - struct omap_control_usb *ctrl_usb;
> + struct omap_control_phy *ctrl_phy;
>
> if (IS_ERR(dev) || !dev)
> return;
>
> - ctrl_usb = dev_get_drvdata(dev);
> + ctrl_phy = dev_get_drvdata(dev);
>
> - if (!ctrl_usb) {
> - dev_err(dev, "Invalid control usb device\n");
> + if (!ctrl_phy) {
> + dev_err(dev, "Invalid control phy device\n");
> return;
> }
>
> - if (ctrl_usb->type != OMAP_CTRL_TYPE_OTGHS)
> + if (ctrl_phy->type != OMAP_CTRL_TYPE_OTGHS)
> return;
>
> switch (mode) {
> case USB_MODE_HOST:
> - omap_control_usb_host_mode(ctrl_usb);
> + omap_control_usb_host_mode(ctrl_phy);
> break;
> case USB_MODE_DEVICE:
> - omap_control_usb_device_mode(ctrl_usb);
> + omap_control_usb_device_mode(ctrl_phy);
> break;
> case USB_MODE_DISCONNECT:
> - omap_control_usb_set_sessionend(ctrl_usb);
> + omap_control_usb_set_sessionend(ctrl_phy);
> break;
> default:
> dev_vdbg(dev, "invalid omap control usb mode\n");
> @@ -207,13 +208,13 @@ EXPORT_SYMBOL_GPL(omap_control_usb_set_mode);
>
> #ifdef CONFIG_OF
>
> -static const enum omap_control_usb_type otghs_data = OMAP_CTRL_TYPE_OTGHS;
> -static const enum omap_control_usb_type usb2_data = OMAP_CTRL_TYPE_USB2;
> -static const enum omap_control_usb_type pipe3_data = OMAP_CTRL_TYPE_PIPE3;
> -static const enum omap_control_usb_type dra7usb2_data = OMAP_CTRL_TYPE_DRA7USB2;
> -static const enum omap_control_usb_type am437usb2_data = OMAP_CTRL_TYPE_AM437USB2;
> +static const enum omap_control_phy_type otghs_data = OMAP_CTRL_TYPE_OTGHS;
> +static const enum omap_control_phy_type usb2_data = OMAP_CTRL_TYPE_USB2;
> +static const enum omap_control_phy_type pipe3_data = OMAP_CTRL_TYPE_PIPE3;
> +static const enum omap_control_phy_type dra7usb2_data = OMAP_CTRL_TYPE_DRA7USB2;
> +static const enum omap_control_phy_type am437usb2_data = OMAP_CTRL_TYPE_AM437USB2;
>
> -static const struct of_device_id omap_control_usb_id_table[] = {
> +static const struct of_device_id omap_control_phy_id_table[] = {
> {
> .compatible = "ti,control-phy-otghs",
> .data = &otghs_data,
> @@ -236,84 +237,84 @@ static const struct of_device_id omap_control_usb_id_table[] = {
> },
> {},
> };
> -MODULE_DEVICE_TABLE(of, omap_control_usb_id_table);
> +MODULE_DEVICE_TABLE(of, omap_control_phy_id_table);
> #endif
>
>
> -static int omap_control_usb_probe(struct platform_device *pdev)
> +static int omap_control_phy_probe(struct platform_device *pdev)
> {
> struct resource *res;
> const struct of_device_id *of_id;
> - struct omap_control_usb *control_usb;
> + struct omap_control_phy *control_phy;
>
> - of_id = of_match_device(of_match_ptr(omap_control_usb_id_table),
> - &pdev->dev);
> + of_id = of_match_device(of_match_ptr(omap_control_phy_id_table),
> + &pdev->dev);
> if (!of_id)
> return -EINVAL;
>
> - control_usb = devm_kzalloc(&pdev->dev, sizeof(*control_usb),
> + control_phy = devm_kzalloc(&pdev->dev, sizeof(*control_phy),
> GFP_KERNEL);
> - if (!control_usb) {
> - dev_err(&pdev->dev, "unable to alloc memory for control usb\n");
> + if (!control_phy) {
> + dev_err(&pdev->dev, "unable to alloc memory for control phy\n");
> return -ENOMEM;
> }
>
> - control_usb->dev = &pdev->dev;
> - control_usb->type = *(enum omap_control_usb_type *)of_id->data;
> + control_phy->dev = &pdev->dev;
> + control_phy->type = *(enum omap_control_phy_type *)of_id->data;
>
> - if (control_usb->type == OMAP_CTRL_TYPE_OTGHS) {
> + if (control_phy->type == OMAP_CTRL_TYPE_OTGHS) {
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> "otghs_control");
> - control_usb->otghs_control = devm_ioremap_resource(
> + control_phy->otghs_control = devm_ioremap_resource(
> &pdev->dev, res);
> - if (IS_ERR(control_usb->otghs_control))
> - return PTR_ERR(control_usb->otghs_control);
> + if (IS_ERR(control_phy->otghs_control))
> + return PTR_ERR(control_phy->otghs_control);
> } else {
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> "power");
> - control_usb->power = devm_ioremap_resource(&pdev->dev, res);
> - if (IS_ERR(control_usb->power)) {
> + control_phy->power = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(control_phy->power)) {
> dev_err(&pdev->dev, "Couldn't get power register\n");
> - return PTR_ERR(control_usb->power);
> + return PTR_ERR(control_phy->power);
> }
> }
>
> - if (control_usb->type == OMAP_CTRL_TYPE_PIPE3) {
> - control_usb->sys_clk = devm_clk_get(control_usb->dev,
> + if (control_phy->type == OMAP_CTRL_TYPE_PIPE3) {
> + control_phy->sys_clk = devm_clk_get(control_phy->dev,
> "sys_clkin");
> - if (IS_ERR(control_usb->sys_clk)) {
> + if (IS_ERR(control_phy->sys_clk)) {
> pr_err("%s: unable to get sys_clkin\n", __func__);
> return -EINVAL;
> }
> }
>
> - dev_set_drvdata(control_usb->dev, control_usb);
> + dev_set_drvdata(control_phy->dev, control_phy);
>
> return 0;
> }
>
> -static struct platform_driver omap_control_usb_driver = {
> - .probe = omap_control_usb_probe,
> +static struct platform_driver omap_control_phy_driver = {
> + .probe = omap_control_phy_probe,
> .driver = {
> - .name = "omap-control-usb",
> + .name = "omap-control-phy",
> .owner = THIS_MODULE,
> - .of_match_table = of_match_ptr(omap_control_usb_id_table),
> + .of_match_table = of_match_ptr(omap_control_phy_id_table),
> },
> };
>
> -static int __init omap_control_usb_init(void)
> +static int __init omap_control_phy_init(void)
> {
> - return platform_driver_register(&omap_control_usb_driver);
> + return platform_driver_register(&omap_control_phy_driver);
> }
> -subsys_initcall(omap_control_usb_init);
> +subsys_initcall(omap_control_phy_init);
>
> -static void __exit omap_control_usb_exit(void)
> +static void __exit omap_control_phy_exit(void)
> {
> - platform_driver_unregister(&omap_control_usb_driver);
> + platform_driver_unregister(&omap_control_phy_driver);
> }
> -module_exit(omap_control_usb_exit);
> +module_exit(omap_control_phy_exit);
>
> -MODULE_ALIAS("platform: omap_control_usb");
> +MODULE_ALIAS("platform: omap_control_phy");
> MODULE_AUTHOR("Texas Instruments Inc.");
> -MODULE_DESCRIPTION("OMAP Control Module USB Driver");
> +MODULE_DESCRIPTION("OMAP Control Module PHY Driver");
> MODULE_LICENSE("GPL v2");
> diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
> index 3cc4aba..a2205a8 100644
> --- a/drivers/phy/phy-omap-usb2.c
> +++ b/drivers/phy/phy-omap-usb2.c
> @@ -27,7 +27,7 @@
> #include <linux/err.h>
> #include <linux/pm_runtime.h>
> #include <linux/delay.h>
> -#include <linux/usb/omap_control_usb.h>
> +#include <linux/phy/omap_control_phy.h>
> #include <linux/phy/phy.h>
> #include <linux/of_platform.h>
>
> @@ -105,7 +105,7 @@ static int omap_usb_power_off(struct phy *x)
> {
> struct omap_usb *phy = phy_get_drvdata(x);
>
> - omap_control_usb_phy_power(phy->control_dev, 0);
> + omap_control_phy_power(phy->control_dev, 0);
>
> return 0;
> }
> @@ -114,7 +114,7 @@ static int omap_usb_power_on(struct phy *x)
> {
> struct omap_usb *phy = phy_get_drvdata(x);
>
> - omap_control_usb_phy_power(phy->control_dev, 1);
> + omap_control_phy_power(phy->control_dev, 1);
>
> return 0;
> }
> @@ -251,7 +251,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
> }
>
> phy->control_dev = &control_pdev->dev;
> - omap_control_usb_phy_power(phy->control_dev, 0);
> + omap_control_phy_power(phy->control_dev, 0);
>
> otg->set_host = omap_usb_set_host;
> otg->set_peripheral = omap_usb_set_peripheral;
> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
> index c8d1674..fd029b1 100644
> --- a/drivers/phy/phy-ti-pipe3.c
> +++ b/drivers/phy/phy-ti-pipe3.c
> @@ -26,7 +26,7 @@
> #include <linux/io.h>
> #include <linux/pm_runtime.h>
> #include <linux/delay.h>
> -#include <linux/usb/omap_control_usb.h>
> +#include <linux/phy/omap_control_phy.h>
> #include <linux/of_platform.h>
>
> #define PLL_STATUS 0x00000004
> @@ -134,7 +134,7 @@ static int ti_pipe3_power_off(struct phy *x)
> return -EBUSY;
> }
>
> - omap_control_usb_phy_power(phy->control_dev, 0);
> + omap_control_phy_power(phy->control_dev, 0);
>
> return 0;
> }
> @@ -232,7 +232,7 @@ static int ti_pipe3_init(struct phy *x)
> if (ret)
> return ret;
>
> - omap_control_usb_phy_power(phy->control_dev, 1);
> + omap_control_phy_power(phy->control_dev, 1);
>
> return 0;
> }
> @@ -304,7 +304,7 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>
> phy->control_dev = &control_pdev->dev;
>
> - omap_control_usb_phy_power(phy->control_dev, 0);
> + omap_control_phy_power(phy->control_dev, 0);
>
> platform_set_drvdata(pdev, phy);
> pm_runtime_enable(phy->dev);
> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
> index 8aa59a2..d341c14 100644
> --- a/drivers/usb/musb/omap2430.c
> +++ b/drivers/usb/musb/omap2430.c
> @@ -37,7 +37,7 @@
> #include <linux/err.h>
> #include <linux/delay.h>
> #include <linux/usb/musb-omap.h>
> -#include <linux/usb/omap_control_usb.h>
> +#include <linux/phy/omap_control_phy.h>
> #include <linux/of_platform.h>
>
> #include "musb_core.h"
> diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
> index c337ba2..416e0c8 100644
> --- a/drivers/usb/phy/Kconfig
> +++ b/drivers/usb/phy/Kconfig
> @@ -75,16 +75,6 @@ config NOP_USB_XCEIV
> built-in with usb ip or which are autonomous and doesn't require any
> phy programming such as ISP1x04 etc.
>
> -config OMAP_CONTROL_USB
> - tristate "OMAP CONTROL USB Driver"
> - depends on ARCH_OMAP2PLUS || COMPILE_TEST
> - help
> - Enable this to add support for the USB 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.
> -
> config AM335X_CONTROL_USB
> tristate
>
> diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
> index 15f1878..f8fa719 100644
> --- a/drivers/usb/phy/Makefile
> +++ b/drivers/usb/phy/Makefile
> @@ -13,7 +13,6 @@ obj-$(CONFIG_ISP1301_OMAP) += phy-isp1301-omap.o
> obj-$(CONFIG_MV_U3D_PHY) += phy-mv-u3d-usb.o
> obj-$(CONFIG_NOP_USB_XCEIV) += phy-generic.o
> obj-$(CONFIG_TAHVO_USB) += phy-tahvo.o
> -obj-$(CONFIG_OMAP_CONTROL_USB) += phy-omap-control.o
> obj-$(CONFIG_AM335X_CONTROL_USB) += phy-am335x-control.o
> obj-$(CONFIG_AM335X_PHY_USB) += phy-am335x.o
> obj-$(CONFIG_OMAP_OTG) += phy-omap-otg.o
> diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/phy/omap_control_phy.h
> similarity index 68%
> rename from include/linux/usb/omap_control_usb.h
> rename to include/linux/phy/omap_control_phy.h
> index 69ae383..5450403 100644
> --- a/include/linux/usb/omap_control_usb.h
> +++ b/include/linux/phy/omap_control_phy.h
> @@ -1,5 +1,5 @@
> /*
> - * omap_control_usb.h - Header file for the USB part of control module.
> + * omap_control_phy.h - Header file for 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
> @@ -16,10 +16,10 @@
> *
> */
>
> -#ifndef __OMAP_CONTROL_USB_H__
> -#define __OMAP_CONTROL_USB_H__
> +#ifndef __OMAP_CONTROL_PHY_H__
> +#define __OMAP_CONTROL_PHY_H__
>
> -enum omap_control_usb_type {
> +enum omap_control_phy_type {
> OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */
> OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */
> OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */
> @@ -27,7 +27,7 @@ enum omap_control_usb_type {
> OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
> };
>
> -struct omap_control_usb {
> +struct omap_control_phy {
> struct device *dev;
>
> u32 __iomem *otghs_control;
> @@ -36,7 +36,7 @@ struct omap_control_usb {
>
> struct clk *sys_clk;
>
> - enum omap_control_usb_type type;
> + enum omap_control_phy_type type;
> };
>
> enum omap_control_usb_mode {
> @@ -54,14 +54,14 @@ enum omap_control_usb_mode {
> #define OMAP_CTRL_DEV_SESSEND BIT(3)
> #define OMAP_CTRL_DEV_IDDIG BIT(4)
>
> -#define OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK 0x003FC000
> -#define OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT 0xE
> +#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK 0x003FC000
> +#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT 0xE
>
> -#define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK 0xFFC00000
> -#define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT 0x16
> +#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK 0xFFC00000
> +#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT 0x16
>
> -#define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3
> -#define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0
> +#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3
> +#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0
>
> #define OMAP_CTRL_USB2_PHY_PD BIT(28)
>
> @@ -70,13 +70,13 @@ enum omap_control_usb_mode {
> #define AM437X_CTRL_USB2_OTGVDET_EN BIT(19)
> #define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20)
>
> -#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
> -extern void omap_control_usb_phy_power(struct device *dev, int on);
> -extern void omap_control_usb_set_mode(struct device *dev,
> - enum omap_control_usb_mode mode);
> +#if IS_ENABLED(CONFIG_OMAP_CONTROL_PHY)
> +void omap_control_phy_power(struct device *dev, int on);
> +void omap_control_usb_set_mode(struct device *dev,
> + enum omap_control_usb_mode mode);
> #else
>
> -static inline void omap_control_usb_phy_power(struct device *dev, int on)
> +static inline void omap_control_phy_power(struct device *dev, int on)
> {
> }
>
> @@ -86,4 +86,4 @@ static inline void omap_control_usb_set_mode(struct device *dev,
> }
> #endif
>
> -#endif /* __OMAP_CONTROL_USB_H__ */
> +#endif /* __OMAP_CONTROL_PHY_H__ */
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 01/13] phy: rename struct omap_control_usb to struct omap_control_phy
2014-03-06 15:37 ` Kishon Vijay Abraham I
@ 2014-03-06 15:56 ` Felipe Balbi
0 siblings, 0 replies; 26+ messages in thread
From: Felipe Balbi @ 2014-03-06 15:56 UTC (permalink / raw)
To: Kishon Vijay Abraham I
Cc: devicetree, george.cherian, balajitk, linux-ide, tony, linux-usb,
linux-kernel, balbi, hdegoede, linux-omap, linux-arm-kernel,
Roger Quadros
[-- Attachment #1.1: Type: text/plain, Size: 1280 bytes --]
On Thu, Mar 06, 2014 at 09:07:56PM +0530, Kishon Vijay Abraham I wrote:
> Felipe,
>
> On Thursday 06 March 2014 08:08 PM, Roger Quadros wrote:
> >From: Kishon Vijay Abraham I <kishon@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 <kishon@ti.com>
> >Signed-off-by: Roger Quadros <rogerq@ti.com>
> >---
> > drivers/phy/Kconfig | 14 +-
> > drivers/phy/Makefile | 1 +
> > drivers/{usb => }/phy/phy-omap-control.c | 165 +++++++++++----------
> > 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 -
>
> Hope you are fine with the changes in drivers/usb/? Can you give your
> Acked-by?
sure thing:
Acked-by: Felipe Balbi <balbi@ti.com>
--
balbi
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH v2 02/13] phy: omap-control: Update DT binding information
2014-03-06 14:38 [PATCH v2 00/13][RESEND] ARM: OMAP: SATA support for OMAP5 & DRA7 Roger Quadros
2014-03-06 14:38 ` [PATCH v2 01/13] phy: rename struct omap_control_usb to struct omap_control_phy Roger Quadros
@ 2014-03-06 14:38 ` Roger Quadros
2014-03-06 15:40 ` Kishon Vijay Abraham I
2014-03-06 14:38 ` [PATCH v2 03/13] phy: omap-control: update dra7 and am437 usb2 bindings Roger Quadros
` (10 subsequent siblings)
12 siblings, 1 reply; 26+ messages in thread
From: Roger Quadros @ 2014-03-06 14:38 UTC (permalink / raw)
To: kishon, tony, balbi
Cc: devicetree, george.cherian, balajitk, linux-ide, linux-usb,
linux-kernel, hdegoede, linux-omap, linux-arm-kernel, rogerq
Move omap-control binding information to the right location.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 25 ++++++++++++++++++++++
Documentation/devicetree/bindings/usb/omap-usb.txt | 24 ---------------------
2 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index f671163..5c5b1b0 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -1,5 +1,30 @@
TI PHY: DT DOCUMENTATION FOR PHYs in TI PLATFORMs
+OMAP CONTROL PHY
+
+Required properties:
+ - compatible: Should be one of
+ "ti,control-phy-otghs" - if it has otghs_control mailbox register as on OMAP4.
+ "ti,control-phy-usb2" - if it has Power down bit in control_dev_conf register
+ e.g. USB2_PHY on OMAP5.
+ "ti,control-phy-pipe3" - if it has DPLL and individual Rx & Tx power control
+ e.g. USB3 PHY and SATA PHY on OMAP5.
+ "ti,control-phy-dra7usb2" - if it has power down register like USB2 PHY on
+ DRA7 platform.
+ "ti,control-phy-am437usb2" - if it has power down register like USB2 PHY on
+ AM437 platform.
+ - reg : Address and length of the register set for the device. It contains
+ the address of "otghs_control" for control-phy-otghs or "power" register
+ for other types.
+ - reg-names: should be "otghs_control" control-phy-otghs and "power" for
+ other types.
+
+omap_control_usb: omap-control-usb@4a002300 {
+ compatible = "ti,control-phy-otghs";
+ reg = <0x4a00233c 0x4>;
+ reg-names = "otghs_control";
+};
+
OMAP USB2 PHY
Required properties:
diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
index c495135..38b2fae 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -76,27 +76,3 @@ omap_dwc3 {
ranges;
};
-OMAP CONTROL USB
-
-Required properties:
- - compatible: Should be one of
- "ti,control-phy-otghs" - if it has otghs_control mailbox register as on OMAP4.
- "ti,control-phy-usb2" - if it has Power down bit in control_dev_conf register
- e.g. USB2_PHY on OMAP5.
- "ti,control-phy-pipe3" - if it has DPLL and individual Rx & Tx power control
- e.g. USB3 PHY and SATA PHY on OMAP5.
- "ti,control-phy-dra7usb2" - if it has power down register like USB2 PHY on
- DRA7 platform.
- "ti,control-phy-am437usb2" - if it has power down register like USB2 PHY on
- AM437 platform.
- - reg : Address and length of the register set for the device. It contains
- the address of "otghs_control" for control-phy-otghs or "power" register
- for other types.
- - reg-names: should be "otghs_control" control-phy-otghs and "power" for
- other types.
-
-omap_control_usb: omap-control-usb@4a002300 {
- compatible = "ti,control-phy-otghs";
- reg = <0x4a00233c 0x4>;
- reg-names = "otghs_control";
-};
--
1.8.3.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH v2 02/13] phy: omap-control: Update DT binding information
2014-03-06 14:38 ` [PATCH v2 02/13] phy: omap-control: Update DT binding information Roger Quadros
@ 2014-03-06 15:40 ` Kishon Vijay Abraham I
2014-03-06 15:58 ` Felipe Balbi
0 siblings, 1 reply; 26+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-06 15:40 UTC (permalink / raw)
To: Roger Quadros, tony, balbi
Cc: devicetree, george.cherian, balajitk, linux-ide, linux-usb,
linux-kernel, hdegoede, linux-omap, linux-arm-kernel
Felipe,
On Thursday 06 March 2014 08:08 PM, Roger Quadros wrote:
> Move omap-control binding information to the right location.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
> Documentation/devicetree/bindings/phy/ti-phy.txt | 25 ++++++++++++++++++++++
This patch is dependent on
"Documentation: dt bindings: move ..usb/usb-phy.txt to
..phy/ti-phy.txt"
which got merged in your tree. So can you take this patch also?
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Regards
Kishon
> Documentation/devicetree/bindings/usb/omap-usb.txt | 24 ---------------------
> 2 files changed, 25 insertions(+), 24 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index f671163..5c5b1b0 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -1,5 +1,30 @@
> TI PHY: DT DOCUMENTATION FOR PHYs in TI PLATFORMs
>
> +OMAP CONTROL PHY
> +
> +Required properties:
> + - compatible: Should be one of
> + "ti,control-phy-otghs" - if it has otghs_control mailbox register as on OMAP4.
> + "ti,control-phy-usb2" - if it has Power down bit in control_dev_conf register
> + e.g. USB2_PHY on OMAP5.
> + "ti,control-phy-pipe3" - if it has DPLL and individual Rx & Tx power control
> + e.g. USB3 PHY and SATA PHY on OMAP5.
> + "ti,control-phy-dra7usb2" - if it has power down register like USB2 PHY on
> + DRA7 platform.
> + "ti,control-phy-am437usb2" - if it has power down register like USB2 PHY on
> + AM437 platform.
> + - reg : Address and length of the register set for the device. It contains
> + the address of "otghs_control" for control-phy-otghs or "power" register
> + for other types.
> + - reg-names: should be "otghs_control" control-phy-otghs and "power" for
> + other types.
> +
> +omap_control_usb: omap-control-usb@4a002300 {
> + compatible = "ti,control-phy-otghs";
> + reg = <0x4a00233c 0x4>;
> + reg-names = "otghs_control";
> +};
> +
> OMAP USB2 PHY
>
> Required properties:
> diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
> index c495135..38b2fae 100644
> --- a/Documentation/devicetree/bindings/usb/omap-usb.txt
> +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
> @@ -76,27 +76,3 @@ omap_dwc3 {
> ranges;
> };
>
> -OMAP CONTROL USB
> -
> -Required properties:
> - - compatible: Should be one of
> - "ti,control-phy-otghs" - if it has otghs_control mailbox register as on OMAP4.
> - "ti,control-phy-usb2" - if it has Power down bit in control_dev_conf register
> - e.g. USB2_PHY on OMAP5.
> - "ti,control-phy-pipe3" - if it has DPLL and individual Rx & Tx power control
> - e.g. USB3 PHY and SATA PHY on OMAP5.
> - "ti,control-phy-dra7usb2" - if it has power down register like USB2 PHY on
> - DRA7 platform.
> - "ti,control-phy-am437usb2" - if it has power down register like USB2 PHY on
> - AM437 platform.
> - - reg : Address and length of the register set for the device. It contains
> - the address of "otghs_control" for control-phy-otghs or "power" register
> - for other types.
> - - reg-names: should be "otghs_control" control-phy-otghs and "power" for
> - other types.
> -
> -omap_control_usb: omap-control-usb@4a002300 {
> - compatible = "ti,control-phy-otghs";
> - reg = <0x4a00233c 0x4>;
> - reg-names = "otghs_control";
> -};
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 02/13] phy: omap-control: Update DT binding information
2014-03-06 15:40 ` Kishon Vijay Abraham I
@ 2014-03-06 15:58 ` Felipe Balbi
0 siblings, 0 replies; 26+ messages in thread
From: Felipe Balbi @ 2014-03-06 15:58 UTC (permalink / raw)
To: Kishon Vijay Abraham I
Cc: Roger Quadros, tony, balbi, george.cherian, balajitk, hdegoede,
linux-omap, linux-arm-kernel, linux-kernel, devicetree, linux-usb,
linux-ide
[-- Attachment #1: Type: text/plain, Size: 623 bytes --]
On Thu, Mar 06, 2014 at 09:10:27PM +0530, Kishon Vijay Abraham I wrote:
> Felipe,
>
> On Thursday 06 March 2014 08:08 PM, Roger Quadros wrote:
> >Move omap-control binding information to the right location.
> >
> >Signed-off-by: Roger Quadros <rogerq@ti.com>
> >---
> > Documentation/devicetree/bindings/phy/ti-phy.txt | 25 ++++++++++++++++++++++
>
> This patch is dependent on
>
> "Documentation: dt bindings: move ..usb/usb-phy.txt to
> ..phy/ti-phy.txt"
>
> which got merged in your tree. So can you take this patch also?
> Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
done
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH v2 03/13] phy: omap-control: update dra7 and am437 usb2 bindings
2014-03-06 14:38 [PATCH v2 00/13][RESEND] ARM: OMAP: SATA support for OMAP5 & DRA7 Roger Quadros
2014-03-06 14:38 ` [PATCH v2 01/13] phy: rename struct omap_control_usb to struct omap_control_phy Roger Quadros
2014-03-06 14:38 ` [PATCH v2 02/13] phy: omap-control: Update DT binding information Roger Quadros
@ 2014-03-06 14:38 ` Roger Quadros
2014-03-06 15:41 ` Kishon Vijay Abraham I
2014-03-06 16:00 ` [PATCH v2 03/13] phy: omap-control: update dra7 and am437 usb2 bindings Felipe Balbi
2014-03-06 14:38 ` [PATCH v2 04/13] phy: ti-pipe3: cleanup clock handling Roger Quadros
` (9 subsequent siblings)
12 siblings, 2 replies; 26+ messages in thread
From: Roger Quadros @ 2014-03-06 14:38 UTC (permalink / raw)
To: kishon, tony, balbi
Cc: george.cherian, balajitk, hdegoede, linux-omap, linux-arm-kernel,
linux-kernel, devicetree, linux-usb, linux-ide, rogerq
The dra7-usb2 and am437-usb2 bindings have not yet been used.
Change them to be more elegant.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 4 ++--
drivers/phy/phy-omap-control.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index 5c5b1b0..28e674b 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -9,9 +9,9 @@ Required properties:
e.g. USB2_PHY on OMAP5.
"ti,control-phy-pipe3" - if it has DPLL and individual Rx & Tx power control
e.g. USB3 PHY and SATA PHY on OMAP5.
- "ti,control-phy-dra7usb2" - if it has power down register like USB2 PHY on
+ "ti,control-phy-dra7-usb2" - if it has power down register like USB2 PHY on
DRA7 platform.
- "ti,control-phy-am437usb2" - if it has power down register like USB2 PHY on
+ "ti,control-phy-am437-usb2" - if it has power down register like USB2 PHY on
AM437 platform.
- reg : Address and length of the register set for the device. It contains
the address of "otghs_control" for control-phy-otghs or "power" register
diff --git a/drivers/phy/phy-omap-control.c b/drivers/phy/phy-omap-control.c
index 17fc200..a7e2d7f 100644
--- a/drivers/phy/phy-omap-control.c
+++ b/drivers/phy/phy-omap-control.c
@@ -228,11 +228,11 @@ static const struct of_device_id omap_control_phy_id_table[] = {
.data = &pipe3_data,
},
{
- .compatible = "ti,control-phy-dra7usb2",
+ .compatible = "ti,control-phy-dra7-usb2",
.data = &dra7usb2_data,
},
{
- .compatible = "ti,control-phy-am437usb2",
+ .compatible = "ti,control-phy-am437-usb2",
.data = &am437usb2_data,
},
{},
--
1.8.3.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH v2 03/13] phy: omap-control: update dra7 and am437 usb2 bindings
2014-03-06 14:38 ` [PATCH v2 03/13] phy: omap-control: update dra7 and am437 usb2 bindings Roger Quadros
@ 2014-03-06 15:41 ` Kishon Vijay Abraham I
2014-03-07 8:25 ` [PATCH v4] phy: omap-control: update dra7 and am437 usb2 Documentation bindings Kishon Vijay Abraham I
[not found] ` <1394121786-28193-1-git-send-email-balbi@ti.com>
2014-03-06 16:00 ` [PATCH v2 03/13] phy: omap-control: update dra7 and am437 usb2 bindings Felipe Balbi
1 sibling, 2 replies; 26+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-06 15:41 UTC (permalink / raw)
To: Roger Quadros, tony, balbi
Cc: devicetree, george.cherian, balajitk, linux-ide, linux-usb,
linux-kernel, hdegoede, linux-omap, linux-arm-kernel
Felipe,
On Thursday 06 March 2014 08:08 PM, Roger Quadros wrote:
> The dra7-usb2 and am437-usb2 bindings have not yet been used.
> Change them to be more elegant.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
> Documentation/devicetree/bindings/phy/ti-phy.txt | 4 ++--
Here too..
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Regards
Kishon
> drivers/phy/phy-omap-control.c | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index 5c5b1b0..28e674b 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -9,9 +9,9 @@ Required properties:
> e.g. USB2_PHY on OMAP5.
> "ti,control-phy-pipe3" - if it has DPLL and individual Rx & Tx power control
> e.g. USB3 PHY and SATA PHY on OMAP5.
> - "ti,control-phy-dra7usb2" - if it has power down register like USB2 PHY on
> + "ti,control-phy-dra7-usb2" - if it has power down register like USB2 PHY on
> DRA7 platform.
> - "ti,control-phy-am437usb2" - if it has power down register like USB2 PHY on
> + "ti,control-phy-am437-usb2" - if it has power down register like USB2 PHY on
> AM437 platform.
> - reg : Address and length of the register set for the device. It contains
> the address of "otghs_control" for control-phy-otghs or "power" register
> diff --git a/drivers/phy/phy-omap-control.c b/drivers/phy/phy-omap-control.c
> index 17fc200..a7e2d7f 100644
> --- a/drivers/phy/phy-omap-control.c
> +++ b/drivers/phy/phy-omap-control.c
> @@ -228,11 +228,11 @@ static const struct of_device_id omap_control_phy_id_table[] = {
> .data = &pipe3_data,
> },
> {
> - .compatible = "ti,control-phy-dra7usb2",
> + .compatible = "ti,control-phy-dra7-usb2",
> .data = &dra7usb2_data,
> },
> {
> - .compatible = "ti,control-phy-am437usb2",
> + .compatible = "ti,control-phy-am437-usb2",
> .data = &am437usb2_data,
> },
> {},
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH v4] phy: omap-control: update dra7 and am437 usb2 Documentation bindings
2014-03-06 15:41 ` Kishon Vijay Abraham I
@ 2014-03-07 8:25 ` Kishon Vijay Abraham I
[not found] ` <1394121786-28193-1-git-send-email-balbi@ti.com>
1 sibling, 0 replies; 26+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-07 8:25 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, linux-kernel, devicetree, rogerq
Cc: Linux USB Mailing List, Felipe Balbi, Kishon Vijay Abraham I
From: Felipe Balbi <balbi@ti.com>
From: Roger Quadros <rogerq@ti.com>
The dra7-usb2 and am437-usb2 bindings have not yet been used.
Change them to be more elegant.
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
Changes from v3:
* changed the compatible name to 'ti,control-phy-usb2-dra7' and
'ti,control-phy-usb2-am437'
Documentation/devicetree/bindings/phy/ti-phy.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index 41dc132..8694aae 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -9,9 +9,9 @@ Required properties:
e.g. USB2_PHY on OMAP5.
"ti,control-phy-pipe3" - if it has DPLL and individual Rx & Tx power control
e.g. USB3 PHY and SATA PHY on OMAP5.
- "ti,control-phy-dra7usb2" - if it has power down register like USB2 PHY on
+ "ti,control-phy-usb2-dra7" - if it has power down register like USB2 PHY on
DRA7 platform.
- "ti,control-phy-am437usb2" - if it has power down register like USB2 PHY on
+ "ti,control-phy-usb2-am437" - if it has power down register like USB2 PHY on
AM437 platform.
- reg : Address and length of the register set for the device. It contains
the address of "otghs_control" for control-phy-otghs or "power" register
--
1.9.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
[parent not found: <1394121786-28193-1-git-send-email-balbi@ti.com>]
* Re: [PATCH v4] phy: omap-control: update dra7 and am437 usb2 Documentation bindings
[not found] ` <1394121786-28193-1-git-send-email-balbi@ti.com>
@ 2014-03-07 8:26 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 26+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-07 8:26 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, linux-kernel, devicetree, linux-usb,
rogerq, balbi
On Friday 07 March 2014 01:55 PM, Kishon Vijay Abraham I wrote:
> From: Felipe Balbi <balbi@ti.com>
>
> From: Roger Quadros <rogerq@ti.com>
There seems to be some problem with this patch. Pls ignore this.
Thanks
Kishon
>
> The dra7-usb2 and am437-usb2 bindings have not yet been used.
> Change them to be more elegant.
>
> Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> ---
> Changes from v3:
> * changed the compatible name to 'ti,control-phy-usb2-dra7' and
> 'ti,control-phy-usb2-am437'
>
> Documentation/devicetree/bindings/phy/ti-phy.txt | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index 41dc132..8694aae 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -9,9 +9,9 @@ Required properties:
> e.g. USB2_PHY on OMAP5.
> "ti,control-phy-pipe3" - if it has DPLL and individual Rx & Tx power control
> e.g. USB3 PHY and SATA PHY on OMAP5.
> - "ti,control-phy-dra7usb2" - if it has power down register like USB2 PHY on
> + "ti,control-phy-usb2-dra7" - if it has power down register like USB2 PHY on
> DRA7 platform.
> - "ti,control-phy-am437usb2" - if it has power down register like USB2 PHY on
> + "ti,control-phy-usb2-am437" - if it has power down register like USB2 PHY on
> AM437 platform.
> - reg : Address and length of the register set for the device. It contains
> the address of "otghs_control" for control-phy-otghs or "power" register
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 03/13] phy: omap-control: update dra7 and am437 usb2 bindings
2014-03-06 14:38 ` [PATCH v2 03/13] phy: omap-control: update dra7 and am437 usb2 bindings Roger Quadros
2014-03-06 15:41 ` Kishon Vijay Abraham I
@ 2014-03-06 16:00 ` Felipe Balbi
1 sibling, 0 replies; 26+ messages in thread
From: Felipe Balbi @ 2014-03-06 16:00 UTC (permalink / raw)
To: Roger Quadros
Cc: kishon, tony, balbi, george.cherian, balajitk, hdegoede,
linux-omap, linux-arm-kernel, linux-kernel, devicetree, linux-usb,
linux-ide
[-- Attachment #1: Type: text/plain, Size: 2213 bytes --]
On Thu, Mar 06, 2014 at 04:38:39PM +0200, Roger Quadros wrote:
> The dra7-usb2 and am437-usb2 bindings have not yet been used.
> Change them to be more elegant.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
> Documentation/devicetree/bindings/phy/ti-phy.txt | 4 ++--
> drivers/phy/phy-omap-control.c | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index 5c5b1b0..28e674b 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -9,9 +9,9 @@ Required properties:
> e.g. USB2_PHY on OMAP5.
> "ti,control-phy-pipe3" - if it has DPLL and individual Rx & Tx power control
> e.g. USB3 PHY and SATA PHY on OMAP5.
> - "ti,control-phy-dra7usb2" - if it has power down register like USB2 PHY on
> + "ti,control-phy-dra7-usb2" - if it has power down register like USB2 PHY on
> DRA7 platform.
> - "ti,control-phy-am437usb2" - if it has power down register like USB2 PHY on
> + "ti,control-phy-am437-usb2" - if it has power down register like USB2 PHY on
> AM437 platform.
> - reg : Address and length of the register set for the device. It contains
> the address of "otghs_control" for control-phy-otghs or "power" register
I can take the Documentation part (which I've just done) but...
> diff --git a/drivers/phy/phy-omap-control.c b/drivers/phy/phy-omap-control.c
> index 17fc200..a7e2d7f 100644
> --- a/drivers/phy/phy-omap-control.c
> +++ b/drivers/phy/phy-omap-control.c
> @@ -228,11 +228,11 @@ static const struct of_device_id omap_control_phy_id_table[] = {
> .data = &pipe3_data,
> },
> {
> - .compatible = "ti,control-phy-dra7usb2",
> + .compatible = "ti,control-phy-dra7-usb2",
> .data = &dra7usb2_data,
> },
> {
> - .compatible = "ti,control-phy-am437usb2",
> + .compatible = "ti,control-phy-am437-usb2",
> .data = &am437usb2_data,
> },
> {},
I don't have this file in my tree ;-)
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH v2 04/13] phy: ti-pipe3: cleanup clock handling
2014-03-06 14:38 [PATCH v2 00/13][RESEND] ARM: OMAP: SATA support for OMAP5 & DRA7 Roger Quadros
` (2 preceding siblings ...)
2014-03-06 14:38 ` [PATCH v2 03/13] phy: omap-control: update dra7 and am437 usb2 bindings Roger Quadros
@ 2014-03-06 14:38 ` Roger Quadros
2014-03-06 15:45 ` Kishon Vijay Abraham I
2014-03-06 14:38 ` [PATCH v2 05/13] phy: ti-pipe3: Add SATA DPLL support Roger Quadros
` (8 subsequent siblings)
12 siblings, 1 reply; 26+ messages in thread
From: Roger Quadros @ 2014-03-06 14:38 UTC (permalink / raw)
To: kishon, tony, balbi
Cc: george.cherian, balajitk, hdegoede, linux-omap, linux-arm-kernel,
linux-kernel, devicetree, linux-usb, linux-ide, rogerq,
Benoît Cousson
As this driver is no longer USB specific, use generic clock names.
- Use 'wkupclk', 'sysclk' and 'refclk' clock-names. Update DT binding info.
- Fix PLL_SD_SHIFT from 9 to 10
- Don't separate prepare/unprepare clock from enable/disable. This
ensures optimal power savings.
Update omap5 usb3_phy device tree node.
CC: Benoît Cousson <bcousson@baylibre.com>
CC: Tony Lindgren <tony@atomide.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 12 ++++++
arch/arm/boot/dts/omap5.dtsi | 7 ++-
drivers/phy/phy-ti-pipe3.c | 55 ++++++++++++------------
3 files changed, 46 insertions(+), 28 deletions(-)
diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index 28e674b..8d13349 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -59,6 +59,12 @@ Required properties:
filled in "reg".
- #phy-cells: determine the number of cells that should be given in the
phandle while referencing this phy.
+ - clocks: a list of phandles and clock-specifier pairs, one for each entry in
+ clock-names.
+ - clock-names: should include:
+ * "wkupclk" - wakup clock.
+ * "sysclk" - system clock.
+ * "refclk" - reference clock.
Optional properties:
- ctrl-module : phandle of the control module used by PHY driver to power on
@@ -74,4 +80,10 @@ usb3phy@4a084400 {
reg-names = "phy_rx", "phy_tx", "pll_ctrl";
ctrl-module = <&omap_control_usb>;
#phy-cells = <0>;
+ clocks = <&usb_phy_cm_clk32k>,
+ <&sys_clkin>,
+ <&usb_otg_ss_refclk960m>;
+ clock-names = "wkupclk",
+ "sysclk",
+ "refclk";
};
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 859a800..e47601a 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -778,7 +778,12 @@
<0x4a084800 0x64>,
<0x4a084c00 0x40>;
reg-names = "phy_rx", "phy_tx", "pll_ctrl";
- ctrl-module = <&omap_control_usb3phy>;
+ clocks = <&usb_phy_cm_clk32k>,
+ <&sys_clkin>,
+ <&usb_otg_ss_refclk960m>;
+ clock-names = "wkupclk",
+ "sysclk",
+ "refclk";
#phy-cells = <0>;
};
};
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index fd029b1..211703c 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -45,7 +45,7 @@
#define PLL_SELFREQDCO_MASK 0x0000000E
#define PLL_SELFREQDCO_SHIFT 0x1
#define PLL_SD_MASK 0x0003FC00
-#define PLL_SD_SHIFT 0x9
+#define PLL_SD_SHIFT 10
#define SET_PLL_GO 0x1
#define PLL_TICOPWDN 0x10000
#define PLL_LOCK 0x2
@@ -72,7 +72,7 @@ struct ti_pipe3 {
struct device *control_dev;
struct clk *wkupclk;
struct clk *sys_clk;
- struct clk *optclk;
+ struct clk *refclk;
};
struct pipe3_dpll_map {
@@ -270,23 +270,21 @@ static int ti_pipe3_probe(struct platform_device *pdev)
phy->dev = &pdev->dev;
- phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k");
+ phy->wkupclk = devm_clk_get(phy->dev, "wkupclk");
if (IS_ERR(phy->wkupclk)) {
- dev_err(&pdev->dev, "unable to get usb_phy_cm_clk32k\n");
+ dev_err(&pdev->dev, "unable to get wkupclk\n");
return PTR_ERR(phy->wkupclk);
}
- clk_prepare(phy->wkupclk);
- phy->optclk = devm_clk_get(phy->dev, "usb_otg_ss_refclk960m");
- if (IS_ERR(phy->optclk)) {
- dev_err(&pdev->dev, "unable to get usb_otg_ss_refclk960m\n");
- return PTR_ERR(phy->optclk);
+ phy->refclk = devm_clk_get(phy->dev, "refclk");
+ if (IS_ERR(phy->refclk)) {
+ dev_err(&pdev->dev, "unable to get refclk\n");
+ return PTR_ERR(phy->refclk);
}
- clk_prepare(phy->optclk);
- phy->sys_clk = devm_clk_get(phy->dev, "sys_clkin");
+ phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
if (IS_ERR(phy->sys_clk)) {
- pr_err("%s: unable to get sys_clkin\n", __func__);
+ dev_err(&pdev->dev, "unable to get sysclk\n");
return -EINVAL;
}
@@ -326,10 +324,6 @@ static int ti_pipe3_probe(struct platform_device *pdev)
static int ti_pipe3_remove(struct platform_device *pdev)
{
- struct ti_pipe3 *phy = platform_get_drvdata(pdev);
-
- clk_unprepare(phy->wkupclk);
- clk_unprepare(phy->optclk);
if (!pm_runtime_suspended(&pdev->dev))
pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev);
@@ -343,8 +337,10 @@ static int ti_pipe3_runtime_suspend(struct device *dev)
{
struct ti_pipe3 *phy = dev_get_drvdata(dev);
- clk_disable(phy->wkupclk);
- clk_disable(phy->optclk);
+ if (!IS_ERR(phy->wkupclk))
+ clk_disable_unprepare(phy->wkupclk);
+ if (!IS_ERR(phy->refclk))
+ clk_disable_unprepare(phy->refclk);
return 0;
}
@@ -354,22 +350,27 @@ static int ti_pipe3_runtime_resume(struct device *dev)
u32 ret = 0;
struct ti_pipe3 *phy = dev_get_drvdata(dev);
- ret = clk_enable(phy->optclk);
- if (ret) {
- dev_err(phy->dev, "Failed to enable optclk %d\n", ret);
- goto err1;
+ if (!IS_ERR(phy->refclk)) {
+ ret = clk_prepare_enable(phy->refclk);
+ if (ret) {
+ dev_err(phy->dev, "Failed to enable refclk %d\n", ret);
+ goto err1;
+ }
}
- ret = clk_enable(phy->wkupclk);
- if (ret) {
- dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret);
- goto err2;
+ if (!IS_ERR(phy->wkupclk)) {
+ ret = clk_prepare_enable(phy->wkupclk);
+ if (ret) {
+ dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret);
+ goto err2;
+ }
}
return 0;
err2:
- clk_disable(phy->optclk);
+ if (!IS_ERR(phy->refclk))
+ clk_disable_unprepare(phy->refclk);
err1:
return ret;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH v2 04/13] phy: ti-pipe3: cleanup clock handling
2014-03-06 14:38 ` [PATCH v2 04/13] phy: ti-pipe3: cleanup clock handling Roger Quadros
@ 2014-03-06 15:45 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 26+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-06 15:45 UTC (permalink / raw)
To: Roger Quadros, tony, balbi
Cc: devicetree, george.cherian, balajitk, linux-ide, linux-usb,
linux-kernel, hdegoede, Benoît Cousson, linux-omap,
linux-arm-kernel
Roger,
On Thursday 06 March 2014 08:08 PM, Roger Quadros wrote:
> As this driver is no longer USB specific, use generic clock names.
> - Use 'wkupclk', 'sysclk' and 'refclk' clock-names. Update DT binding info.
> - Fix PLL_SD_SHIFT from 9 to 10
> - Don't separate prepare/unprepare clock from enable/disable. This
> ensures optimal power savings.
>
> Update omap5 usb3_phy device tree node.
>
> CC: Benoît Cousson <bcousson@baylibre.com>
> CC: Tony Lindgren <tony@atomide.com>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
> Documentation/devicetree/bindings/phy/ti-phy.txt | 12 ++++++
> arch/arm/boot/dts/omap5.dtsi | 7 ++-
> drivers/phy/phy-ti-pipe3.c | 55 ++++++++++++------------
Here you have to split the patch. omap5.dtsi should be a separate patch
to Tony. I could take only phy-ti-pipe3.c again since ti-phy.txt is only
in Felipe's branch.
Regards
Kishon
> 3 files changed, 46 insertions(+), 28 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index 28e674b..8d13349 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -59,6 +59,12 @@ Required properties:
> filled in "reg".
> - #phy-cells: determine the number of cells that should be given in the
> phandle while referencing this phy.
> + - clocks: a list of phandles and clock-specifier pairs, one for each entry in
> + clock-names.
> + - clock-names: should include:
> + * "wkupclk" - wakup clock.
> + * "sysclk" - system clock.
> + * "refclk" - reference clock.
>
> Optional properties:
> - ctrl-module : phandle of the control module used by PHY driver to power on
> @@ -74,4 +80,10 @@ usb3phy@4a084400 {
> reg-names = "phy_rx", "phy_tx", "pll_ctrl";
> ctrl-module = <&omap_control_usb>;
> #phy-cells = <0>;
> + clocks = <&usb_phy_cm_clk32k>,
> + <&sys_clkin>,
> + <&usb_otg_ss_refclk960m>;
> + clock-names = "wkupclk",
> + "sysclk",
> + "refclk";
> };
> diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
> index 859a800..e47601a 100644
> --- a/arch/arm/boot/dts/omap5.dtsi
> +++ b/arch/arm/boot/dts/omap5.dtsi
> @@ -778,7 +778,12 @@
> <0x4a084800 0x64>,
> <0x4a084c00 0x40>;
> reg-names = "phy_rx", "phy_tx", "pll_ctrl";
> - ctrl-module = <&omap_control_usb3phy>;
> + clocks = <&usb_phy_cm_clk32k>,
> + <&sys_clkin>,
> + <&usb_otg_ss_refclk960m>;
> + clock-names = "wkupclk",
> + "sysclk",
> + "refclk";
> #phy-cells = <0>;
> };
> };
> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
> index fd029b1..211703c 100644
> --- a/drivers/phy/phy-ti-pipe3.c
> +++ b/drivers/phy/phy-ti-pipe3.c
> @@ -45,7 +45,7 @@
> #define PLL_SELFREQDCO_MASK 0x0000000E
> #define PLL_SELFREQDCO_SHIFT 0x1
> #define PLL_SD_MASK 0x0003FC00
> -#define PLL_SD_SHIFT 0x9
> +#define PLL_SD_SHIFT 10
> #define SET_PLL_GO 0x1
> #define PLL_TICOPWDN 0x10000
> #define PLL_LOCK 0x2
> @@ -72,7 +72,7 @@ struct ti_pipe3 {
> struct device *control_dev;
> struct clk *wkupclk;
> struct clk *sys_clk;
> - struct clk *optclk;
> + struct clk *refclk;
> };
>
> struct pipe3_dpll_map {
> @@ -270,23 +270,21 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>
> phy->dev = &pdev->dev;
>
> - phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k");
> + phy->wkupclk = devm_clk_get(phy->dev, "wkupclk");
> if (IS_ERR(phy->wkupclk)) {
> - dev_err(&pdev->dev, "unable to get usb_phy_cm_clk32k\n");
> + dev_err(&pdev->dev, "unable to get wkupclk\n");
> return PTR_ERR(phy->wkupclk);
> }
> - clk_prepare(phy->wkupclk);
>
> - phy->optclk = devm_clk_get(phy->dev, "usb_otg_ss_refclk960m");
> - if (IS_ERR(phy->optclk)) {
> - dev_err(&pdev->dev, "unable to get usb_otg_ss_refclk960m\n");
> - return PTR_ERR(phy->optclk);
> + phy->refclk = devm_clk_get(phy->dev, "refclk");
> + if (IS_ERR(phy->refclk)) {
> + dev_err(&pdev->dev, "unable to get refclk\n");
> + return PTR_ERR(phy->refclk);
> }
> - clk_prepare(phy->optclk);
>
> - phy->sys_clk = devm_clk_get(phy->dev, "sys_clkin");
> + phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
> if (IS_ERR(phy->sys_clk)) {
> - pr_err("%s: unable to get sys_clkin\n", __func__);
> + dev_err(&pdev->dev, "unable to get sysclk\n");
> return -EINVAL;
> }
>
> @@ -326,10 +324,6 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>
> static int ti_pipe3_remove(struct platform_device *pdev)
> {
> - struct ti_pipe3 *phy = platform_get_drvdata(pdev);
> -
> - clk_unprepare(phy->wkupclk);
> - clk_unprepare(phy->optclk);
> if (!pm_runtime_suspended(&pdev->dev))
> pm_runtime_put(&pdev->dev);
> pm_runtime_disable(&pdev->dev);
> @@ -343,8 +337,10 @@ static int ti_pipe3_runtime_suspend(struct device *dev)
> {
> struct ti_pipe3 *phy = dev_get_drvdata(dev);
>
> - clk_disable(phy->wkupclk);
> - clk_disable(phy->optclk);
> + if (!IS_ERR(phy->wkupclk))
> + clk_disable_unprepare(phy->wkupclk);
> + if (!IS_ERR(phy->refclk))
> + clk_disable_unprepare(phy->refclk);
>
> return 0;
> }
> @@ -354,22 +350,27 @@ static int ti_pipe3_runtime_resume(struct device *dev)
> u32 ret = 0;
> struct ti_pipe3 *phy = dev_get_drvdata(dev);
>
> - ret = clk_enable(phy->optclk);
> - if (ret) {
> - dev_err(phy->dev, "Failed to enable optclk %d\n", ret);
> - goto err1;
> + if (!IS_ERR(phy->refclk)) {
> + ret = clk_prepare_enable(phy->refclk);
> + if (ret) {
> + dev_err(phy->dev, "Failed to enable refclk %d\n", ret);
> + goto err1;
> + }
> }
>
> - ret = clk_enable(phy->wkupclk);
> - if (ret) {
> - dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret);
> - goto err2;
> + if (!IS_ERR(phy->wkupclk)) {
> + ret = clk_prepare_enable(phy->wkupclk);
> + if (ret) {
> + dev_err(phy->dev, "Failed to enable wkupclk %d\n", ret);
> + goto err2;
> + }
> }
>
> return 0;
>
> err2:
> - clk_disable(phy->optclk);
> + if (!IS_ERR(phy->refclk))
> + clk_disable_unprepare(phy->refclk);
>
> err1:
> return ret;
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH v2 05/13] phy: ti-pipe3: Add SATA DPLL support
2014-03-06 14:38 [PATCH v2 00/13][RESEND] ARM: OMAP: SATA support for OMAP5 & DRA7 Roger Quadros
` (3 preceding siblings ...)
2014-03-06 14:38 ` [PATCH v2 04/13] phy: ti-pipe3: cleanup clock handling Roger Quadros
@ 2014-03-06 14:38 ` Roger Quadros
2014-03-06 15:45 ` Kishon Vijay Abraham I
[not found] ` <1394116729-28811-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
` (7 subsequent siblings)
12 siblings, 1 reply; 26+ messages in thread
From: Roger Quadros @ 2014-03-06 14:38 UTC (permalink / raw)
To: kishon, tony, balbi
Cc: george.cherian, balajitk, hdegoede, linux-omap, linux-arm-kernel,
linux-kernel, devicetree, linux-usb, linux-ide, rogerq
USB and SATA DPLLs need different settings. Provide
the SATA DPLL settings and use the proper DPLL settings
based on device tree node's compatible_id.
Update the DT binding information.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 3 +-
drivers/phy/phy-ti-pipe3.c | 76 +++++++++++++++++-------
2 files changed, 57 insertions(+), 22 deletions(-)
diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
index 8d13349..2c2d66a 100644
--- a/Documentation/devicetree/bindings/phy/ti-phy.txt
+++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
@@ -53,7 +53,8 @@ usb2phy@4a0ad080 {
TI PIPE3 PHY
Required properties:
- - compatible: Should be "ti,phy-usb3". "ti,omap-usb3" is deprecated.
+ - compatible: Should be "ti,phy-usb3" or "ti,phy-pipe3-sata".
+ "ti,omap-usb3" is deprecated.
- reg : Address and length of the register set for the device.
- reg-names: The names of the register addresses corresponding to the registers
filled in "reg".
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index 211703c..f141237 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -66,6 +66,11 @@ struct pipe3_dpll_params {
u32 mf;
};
+struct pipe3_dpll_map {
+ unsigned long rate;
+ struct pipe3_dpll_params params;
+};
+
struct ti_pipe3 {
void __iomem *pll_ctrl_base;
struct device *dev;
@@ -73,20 +78,27 @@ struct ti_pipe3 {
struct clk *wkupclk;
struct clk *sys_clk;
struct clk *refclk;
+ struct pipe3_dpll_map *dpll_map;
};
-struct pipe3_dpll_map {
- unsigned long rate;
- struct pipe3_dpll_params params;
-};
-
-static struct pipe3_dpll_map dpll_map[] = {
+static struct pipe3_dpll_map dpll_map_usb[] = {
{12000000, {1250, 5, 4, 20, 0} }, /* 12 MHz */
{16800000, {3125, 20, 4, 20, 0} }, /* 16.8 MHz */
{19200000, {1172, 8, 4, 20, 65537} }, /* 19.2 MHz */
{20000000, {1000, 7, 4, 10, 0} }, /* 20 MHz */
{26000000, {1250, 12, 4, 20, 0} }, /* 26 MHz */
{38400000, {3125, 47, 4, 20, 92843} }, /* 38.4 MHz */
+ { }, /* Terminator */
+};
+
+static struct pipe3_dpll_map dpll_map_sata[] = {
+ {12000000, {1000, 7, 4, 6, 0} }, /* 12 MHz */
+ {16800000, {714, 7, 4, 6, 0} }, /* 16.8 MHz */
+ {19200000, {625, 7, 4, 6, 0} }, /* 19.2 MHz */
+ {20000000, {600, 7, 4, 6, 0} }, /* 20 MHz */
+ {26000000, {461, 7, 4, 6, 0} }, /* 26 MHz */
+ {38400000, {312, 7, 4, 6, 0} }, /* 38.4 MHz */
+ { }, /* Terminator */
};
static inline u32 ti_pipe3_readl(void __iomem *addr, unsigned offset)
@@ -100,15 +112,20 @@ static inline void ti_pipe3_writel(void __iomem *addr, unsigned offset,
__raw_writel(data, addr + offset);
}
-static struct pipe3_dpll_params *ti_pipe3_get_dpll_params(unsigned long rate)
+static struct pipe3_dpll_params *ti_pipe3_get_dpll_params(struct ti_pipe3 *phy)
{
- int i;
+ unsigned long rate;
+ struct pipe3_dpll_map *dpll_map = phy->dpll_map;
- for (i = 0; i < ARRAY_SIZE(dpll_map); i++) {
- if (rate == dpll_map[i].rate)
- return &dpll_map[i].params;
+ rate = clk_get_rate(phy->sys_clk);
+
+ for (; dpll_map->rate; dpll_map++) {
+ if (rate == dpll_map->rate)
+ return &dpll_map->params;
}
+ dev_err(phy->dev, "No DPLL configuration for %lu Hz SYS CLK\n", rate);
+
return NULL;
}
@@ -182,16 +199,11 @@ static void ti_pipe3_dpll_relock(struct ti_pipe3 *phy)
static int ti_pipe3_dpll_lock(struct ti_pipe3 *phy)
{
u32 val;
- unsigned long rate;
struct pipe3_dpll_params *dpll_params;
- rate = clk_get_rate(phy->sys_clk);
- dpll_params = ti_pipe3_get_dpll_params(rate);
- if (!dpll_params) {
- dev_err(phy->dev,
- "No DPLL configuration for %lu Hz SYS CLK\n", rate);
+ dpll_params = ti_pipe3_get_dpll_params(phy);
+ if (!dpll_params)
return -EINVAL;
- }
val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION1);
val &= ~PLL_REGN_MASK;
@@ -244,6 +256,10 @@ static struct phy_ops ops = {
.owner = THIS_MODULE,
};
+#ifdef CONFIG_OF
+static const struct of_device_id ti_pipe3_id_table[];
+#endif
+
static int ti_pipe3_probe(struct platform_device *pdev)
{
struct ti_pipe3 *phy;
@@ -253,8 +269,10 @@ static int ti_pipe3_probe(struct platform_device *pdev)
struct device_node *node = pdev->dev.of_node;
struct device_node *control_node;
struct platform_device *control_pdev;
+ const struct of_device_id *match;
- if (!node)
+ match = of_match_device(of_match_ptr(ti_pipe3_id_table), &pdev->dev);
+ if (!match)
return -EINVAL;
phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
@@ -263,6 +281,12 @@ static int ti_pipe3_probe(struct platform_device *pdev)
return -ENOMEM;
}
+ phy->dpll_map = (struct pipe3_dpll_map *)match->data;
+ if (!phy->dpll_map) {
+ dev_err(&pdev->dev, "no DPLL data\n");
+ return -EINVAL;
+ }
+
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll_ctrl");
phy->pll_ctrl_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(phy->pll_ctrl_base))
@@ -388,8 +412,18 @@ static const struct dev_pm_ops ti_pipe3_pm_ops = {
#ifdef CONFIG_OF
static const struct of_device_id ti_pipe3_id_table[] = {
- { .compatible = "ti,phy-usb3" },
- { .compatible = "ti,omap-usb3" },
+ {
+ .compatible = "ti,phy-usb3",
+ .data = dpll_map_usb,
+ },
+ {
+ .compatible = "ti,omap-usb3",
+ .data = dpll_map_usb,
+ },
+ {
+ .compatible = "ti,phy-pipe3-sata",
+ .data = dpll_map_sata,
+ },
{}
};
MODULE_DEVICE_TABLE(of, ti_pipe3_id_table);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH v2 05/13] phy: ti-pipe3: Add SATA DPLL support
2014-03-06 14:38 ` [PATCH v2 05/13] phy: ti-pipe3: Add SATA DPLL support Roger Quadros
@ 2014-03-06 15:45 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 26+ messages in thread
From: Kishon Vijay Abraham I @ 2014-03-06 15:45 UTC (permalink / raw)
To: Roger Quadros, tony, balbi
Cc: george.cherian, balajitk, hdegoede, linux-omap, linux-arm-kernel,
linux-kernel, devicetree, linux-usb, linux-ide
On Thursday 06 March 2014 08:08 PM, Roger Quadros wrote:
> USB and SATA DPLLs need different settings. Provide
> the SATA DPLL settings and use the proper DPLL settings
> based on device tree node's compatible_id.
>
> Update the DT binding information.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
> Documentation/devicetree/bindings/phy/ti-phy.txt | 3 +-
> drivers/phy/phy-ti-pipe3.c | 76 +++++++++++++++++-------
same here..
-Kishon
> 2 files changed, 57 insertions(+), 22 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index 8d13349..2c2d66a 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -53,7 +53,8 @@ usb2phy@4a0ad080 {
> TI PIPE3 PHY
>
> Required properties:
> - - compatible: Should be "ti,phy-usb3". "ti,omap-usb3" is deprecated.
> + - compatible: Should be "ti,phy-usb3" or "ti,phy-pipe3-sata".
> + "ti,omap-usb3" is deprecated.
> - reg : Address and length of the register set for the device.
> - reg-names: The names of the register addresses corresponding to the registers
> filled in "reg".
> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
> index 211703c..f141237 100644
> --- a/drivers/phy/phy-ti-pipe3.c
> +++ b/drivers/phy/phy-ti-pipe3.c
> @@ -66,6 +66,11 @@ struct pipe3_dpll_params {
> u32 mf;
> };
>
> +struct pipe3_dpll_map {
> + unsigned long rate;
> + struct pipe3_dpll_params params;
> +};
> +
> struct ti_pipe3 {
> void __iomem *pll_ctrl_base;
> struct device *dev;
> @@ -73,20 +78,27 @@ struct ti_pipe3 {
> struct clk *wkupclk;
> struct clk *sys_clk;
> struct clk *refclk;
> + struct pipe3_dpll_map *dpll_map;
> };
>
> -struct pipe3_dpll_map {
> - unsigned long rate;
> - struct pipe3_dpll_params params;
> -};
> -
> -static struct pipe3_dpll_map dpll_map[] = {
> +static struct pipe3_dpll_map dpll_map_usb[] = {
> {12000000, {1250, 5, 4, 20, 0} }, /* 12 MHz */
> {16800000, {3125, 20, 4, 20, 0} }, /* 16.8 MHz */
> {19200000, {1172, 8, 4, 20, 65537} }, /* 19.2 MHz */
> {20000000, {1000, 7, 4, 10, 0} }, /* 20 MHz */
> {26000000, {1250, 12, 4, 20, 0} }, /* 26 MHz */
> {38400000, {3125, 47, 4, 20, 92843} }, /* 38.4 MHz */
> + { }, /* Terminator */
> +};
> +
> +static struct pipe3_dpll_map dpll_map_sata[] = {
> + {12000000, {1000, 7, 4, 6, 0} }, /* 12 MHz */
> + {16800000, {714, 7, 4, 6, 0} }, /* 16.8 MHz */
> + {19200000, {625, 7, 4, 6, 0} }, /* 19.2 MHz */
> + {20000000, {600, 7, 4, 6, 0} }, /* 20 MHz */
> + {26000000, {461, 7, 4, 6, 0} }, /* 26 MHz */
> + {38400000, {312, 7, 4, 6, 0} }, /* 38.4 MHz */
> + { }, /* Terminator */
> };
>
> static inline u32 ti_pipe3_readl(void __iomem *addr, unsigned offset)
> @@ -100,15 +112,20 @@ static inline void ti_pipe3_writel(void __iomem *addr, unsigned offset,
> __raw_writel(data, addr + offset);
> }
>
> -static struct pipe3_dpll_params *ti_pipe3_get_dpll_params(unsigned long rate)
> +static struct pipe3_dpll_params *ti_pipe3_get_dpll_params(struct ti_pipe3 *phy)
> {
> - int i;
> + unsigned long rate;
> + struct pipe3_dpll_map *dpll_map = phy->dpll_map;
>
> - for (i = 0; i < ARRAY_SIZE(dpll_map); i++) {
> - if (rate == dpll_map[i].rate)
> - return &dpll_map[i].params;
> + rate = clk_get_rate(phy->sys_clk);
> +
> + for (; dpll_map->rate; dpll_map++) {
> + if (rate == dpll_map->rate)
> + return &dpll_map->params;
> }
>
> + dev_err(phy->dev, "No DPLL configuration for %lu Hz SYS CLK\n", rate);
> +
> return NULL;
> }
>
> @@ -182,16 +199,11 @@ static void ti_pipe3_dpll_relock(struct ti_pipe3 *phy)
> static int ti_pipe3_dpll_lock(struct ti_pipe3 *phy)
> {
> u32 val;
> - unsigned long rate;
> struct pipe3_dpll_params *dpll_params;
>
> - rate = clk_get_rate(phy->sys_clk);
> - dpll_params = ti_pipe3_get_dpll_params(rate);
> - if (!dpll_params) {
> - dev_err(phy->dev,
> - "No DPLL configuration for %lu Hz SYS CLK\n", rate);
> + dpll_params = ti_pipe3_get_dpll_params(phy);
> + if (!dpll_params)
> return -EINVAL;
> - }
>
> val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION1);
> val &= ~PLL_REGN_MASK;
> @@ -244,6 +256,10 @@ static struct phy_ops ops = {
> .owner = THIS_MODULE,
> };
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id ti_pipe3_id_table[];
> +#endif
> +
> static int ti_pipe3_probe(struct platform_device *pdev)
> {
> struct ti_pipe3 *phy;
> @@ -253,8 +269,10 @@ static int ti_pipe3_probe(struct platform_device *pdev)
> struct device_node *node = pdev->dev.of_node;
> struct device_node *control_node;
> struct platform_device *control_pdev;
> + const struct of_device_id *match;
>
> - if (!node)
> + match = of_match_device(of_match_ptr(ti_pipe3_id_table), &pdev->dev);
> + if (!match)
> return -EINVAL;
>
> phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
> @@ -263,6 +281,12 @@ static int ti_pipe3_probe(struct platform_device *pdev)
> return -ENOMEM;
> }
>
> + phy->dpll_map = (struct pipe3_dpll_map *)match->data;
> + if (!phy->dpll_map) {
> + dev_err(&pdev->dev, "no DPLL data\n");
> + return -EINVAL;
> + }
> +
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll_ctrl");
> phy->pll_ctrl_base = devm_ioremap_resource(&pdev->dev, res);
> if (IS_ERR(phy->pll_ctrl_base))
> @@ -388,8 +412,18 @@ static const struct dev_pm_ops ti_pipe3_pm_ops = {
>
> #ifdef CONFIG_OF
> static const struct of_device_id ti_pipe3_id_table[] = {
> - { .compatible = "ti,phy-usb3" },
> - { .compatible = "ti,omap-usb3" },
> + {
> + .compatible = "ti,phy-usb3",
> + .data = dpll_map_usb,
> + },
> + {
> + .compatible = "ti,omap-usb3",
> + .data = dpll_map_usb,
> + },
> + {
> + .compatible = "ti,phy-pipe3-sata",
> + .data = dpll_map_sata,
> + },
> {}
> };
> MODULE_DEVICE_TABLE(of, ti_pipe3_id_table);
>
^ permalink raw reply [flat|nested] 26+ messages in thread
[parent not found: <1394116729-28811-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>]
* [PATCH v2 06/13] phy: ti-pipe3: Don't get 'wkupclk' and 'refclk' for SATA PHY
[not found] ` <1394116729-28811-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
@ 2014-03-06 14:38 ` Roger Quadros
2014-03-06 15:31 ` [PATCH v3 " Roger Quadros
0 siblings, 1 reply; 26+ messages in thread
From: Roger Quadros @ 2014-03-06 14:38 UTC (permalink / raw)
To: kishon-l0cyMroinI0, tony-4v6yS6AI5VpBDgjK7y7TUQ,
balbi-l0cyMroinI0
Cc: george.cherian-l0cyMroinI0, balajitk-l0cyMroinI0,
hdegoede-H+wXaHxf7aLQT0dZR+AlfA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-ide-u79uwXL29TY76Z2rM5mHXA, rogerq-l0cyMroinI0
SATA PHY doesn't need 'wkupclk; and 'refclk' so don't
try to get them for SATA PHY.
Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
---
drivers/phy/phy-ti-pipe3.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index f141237..baa3f78d 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -294,16 +294,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)
phy->dev = &pdev->dev;
- phy->wkupclk = devm_clk_get(phy->dev, "wkupclk");
- if (IS_ERR(phy->wkupclk)) {
- dev_err(&pdev->dev, "unable to get wkupclk\n");
- return PTR_ERR(phy->wkupclk);
- }
+ if (!of_device_is_compatible(node, "ti,phy-pipe3-sata")) {
+
+ phy->wkupclk = devm_clk_get(phy->dev, "wkupclk");
+ if (IS_ERR(phy->wkupclk)) {
+ dev_err(&pdev->dev, "unable to get wkupclk\n");
+ return PTR_ERR(phy->wkupclk);
+ }
- phy->refclk = devm_clk_get(phy->dev, "refclk");
- if (IS_ERR(phy->refclk)) {
- dev_err(&pdev->dev, "unable to get refclk\n");
- return PTR_ERR(phy->refclk);
+ phy->refclk = devm_clk_get(phy->dev, "refclk");
+ if (IS_ERR(phy->refclk)) {
+ dev_err(&pdev->dev, "unable to get refclk\n");
+ return PTR_ERR(phy->refclk);
+ }
+ } else {
+ phy->wkupclk = ERR_PTR(-ENODEV);
+ phy->refclk = ERR_PTR(-ENODEV);
}
phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
--
1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v3 06/13] phy: ti-pipe3: Don't get 'wkupclk' and 'refclk' for SATA PHY
2014-03-06 14:38 ` [PATCH v2 06/13] phy: ti-pipe3: Don't get 'wkupclk' and 'refclk' for SATA PHY Roger Quadros
@ 2014-03-06 15:31 ` Roger Quadros
0 siblings, 0 replies; 26+ messages in thread
From: Roger Quadros @ 2014-03-06 15:31 UTC (permalink / raw)
To: kishon, tony, balbi
Cc: devicetree, george.cherian, balajitk, linux-ide, linux-usb,
linux-kernel, hdegoede, linux-omap, linux-arm-kernel, rogerq
SATA PHY doesn't need 'wkupclk; and 'refclk' so don't
try to get them for SATA PHY.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
v3 - Fixed checkpatch warning
drivers/phy/phy-ti-pipe3.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index f141237..f925f60 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -294,16 +294,21 @@ static int ti_pipe3_probe(struct platform_device *pdev)
phy->dev = &pdev->dev;
- phy->wkupclk = devm_clk_get(phy->dev, "wkupclk");
- if (IS_ERR(phy->wkupclk)) {
- dev_err(&pdev->dev, "unable to get wkupclk\n");
- return PTR_ERR(phy->wkupclk);
- }
+ if (!of_device_is_compatible(node, "ti,phy-pipe3-sata")) {
+ phy->wkupclk = devm_clk_get(phy->dev, "wkupclk");
+ if (IS_ERR(phy->wkupclk)) {
+ dev_err(&pdev->dev, "unable to get wkupclk\n");
+ return PTR_ERR(phy->wkupclk);
+ }
- phy->refclk = devm_clk_get(phy->dev, "refclk");
- if (IS_ERR(phy->refclk)) {
- dev_err(&pdev->dev, "unable to get refclk\n");
- return PTR_ERR(phy->refclk);
+ phy->refclk = devm_clk_get(phy->dev, "refclk");
+ if (IS_ERR(phy->refclk)) {
+ dev_err(&pdev->dev, "unable to get refclk\n");
+ return PTR_ERR(phy->refclk);
+ }
+ } else {
+ phy->wkupclk = ERR_PTR(-ENODEV);
+ phy->refclk = ERR_PTR(-ENODEV);
}
phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
--
1.8.3.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v2 07/13] phy: ti-pipe3: streamline PHY operations
2014-03-06 14:38 [PATCH v2 00/13][RESEND] ARM: OMAP: SATA support for OMAP5 & DRA7 Roger Quadros
` (5 preceding siblings ...)
[not found] ` <1394116729-28811-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
@ 2014-03-06 14:38 ` Roger Quadros
2014-03-06 14:38 ` [PATCH v2 08/13] phy: ti-pipe3: Fix suspend/resume and module reload Roger Quadros
` (5 subsequent siblings)
12 siblings, 0 replies; 26+ messages in thread
From: Roger Quadros @ 2014-03-06 14:38 UTC (permalink / raw)
To: kishon, tony, balbi
Cc: george.cherian, balajitk, hdegoede, linux-omap, linux-arm-kernel,
linux-kernel, devicetree, linux-usb, linux-ide, rogerq
Limit .power_on() and .power_off() to just control the
PHY power and not the DPLL. The DPLL will be enabled
in .init() and idled in .exit().
Don't reprogram the DPLL if it has been already locked
by the bootloader. This fixes a problem with SATA, where
it fails if SATA was used by the bootloader.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/phy/phy-ti-pipe3.c | 114 +++++++++++++++++++++++++--------------------
1 file changed, 63 insertions(+), 51 deletions(-)
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index baa3f78d..12cc900 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -47,7 +47,8 @@
#define PLL_SD_MASK 0x0003FC00
#define PLL_SD_SHIFT 10
#define SET_PLL_GO 0x1
-#define PLL_TICOPWDN 0x10000
+#define PLL_LDOPWDN BIT(15)
+#define PLL_TICOPWDN BIT(16)
#define PLL_LOCK 0x2
#define PLL_IDLE 0x1
@@ -56,7 +57,8 @@
* value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
* to be correctly reflected in the PIPE3PHY_PLL_STATUS register.
*/
-# define PLL_IDLE_TIME 100;
+#define PLL_IDLE_TIME 100 /* in milliseconds */
+#define PLL_LOCK_TIME 100 /* in milliseconds */
struct pipe3_dpll_params {
u16 m;
@@ -132,24 +134,6 @@ static struct pipe3_dpll_params *ti_pipe3_get_dpll_params(struct ti_pipe3 *phy)
static int ti_pipe3_power_off(struct phy *x)
{
struct ti_pipe3 *phy = phy_get_drvdata(x);
- int val;
- int timeout = PLL_IDLE_TIME;
-
- val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION2);
- val |= PLL_IDLE;
- ti_pipe3_writel(phy->pll_ctrl_base, PLL_CONFIGURATION2, val);
-
- do {
- val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS);
- if (val & PLL_TICOPWDN)
- break;
- udelay(5);
- } while (--timeout);
-
- if (!timeout) {
- dev_err(phy->dev, "power off failed\n");
- return -EBUSY;
- }
omap_control_phy_power(phy->control_dev, 0);
@@ -159,44 +143,34 @@ static int ti_pipe3_power_off(struct phy *x)
static int ti_pipe3_power_on(struct phy *x)
{
struct ti_pipe3 *phy = phy_get_drvdata(x);
- int val;
- int timeout = PLL_IDLE_TIME;
-
- val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION2);
- val &= ~PLL_IDLE;
- ti_pipe3_writel(phy->pll_ctrl_base, PLL_CONFIGURATION2, val);
- do {
- val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS);
- if (!(val & PLL_TICOPWDN))
- break;
- udelay(5);
- } while (--timeout);
-
- if (!timeout) {
- dev_err(phy->dev, "power on failed\n");
- return -EBUSY;
- }
+ omap_control_phy_power(phy->control_dev, 1);
return 0;
}
-static void ti_pipe3_dpll_relock(struct ti_pipe3 *phy)
+static int ti_pipe3_dpll_wait_lock(struct ti_pipe3 *phy)
{
u32 val;
unsigned long timeout;
- ti_pipe3_writel(phy->pll_ctrl_base, PLL_GO, SET_PLL_GO);
-
- timeout = jiffies + msecs_to_jiffies(20);
+ timeout = jiffies + msecs_to_jiffies(PLL_LOCK_TIME);
do {
+ cpu_relax();
val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS);
if (val & PLL_LOCK)
break;
- } while (!WARN_ON(time_after(jiffies, timeout)));
+ } while (!time_after(jiffies, timeout));
+
+ if (!(val & PLL_LOCK)) {
+ dev_err(phy->dev, "DPLL failed to lock\n");
+ return -EBUSY;
+ }
+
+ return 0;
}
-static int ti_pipe3_dpll_lock(struct ti_pipe3 *phy)
+static int ti_pipe3_dpll_program(struct ti_pipe3 *phy)
{
u32 val;
struct pipe3_dpll_params *dpll_params;
@@ -230,27 +204,65 @@ static int ti_pipe3_dpll_lock(struct ti_pipe3 *phy)
val |= dpll_params->sd << PLL_SD_SHIFT;
ti_pipe3_writel(phy->pll_ctrl_base, PLL_CONFIGURATION3, val);
- ti_pipe3_dpll_relock(phy);
+ ti_pipe3_writel(phy->pll_ctrl_base, PLL_GO, SET_PLL_GO);
- return 0;
+ return ti_pipe3_dpll_wait_lock(phy);
}
static int ti_pipe3_init(struct phy *x)
{
struct ti_pipe3 *phy = phy_get_drvdata(x);
- int ret;
+ u32 val;
+ int ret = 0;
- ret = ti_pipe3_dpll_lock(phy);
- if (ret)
- return ret;
+ /* Bring it out of IDLE if it is IDLE */
+ val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION2);
+ if (val & PLL_IDLE) {
+ val &= ~PLL_IDLE;
+ ti_pipe3_writel(phy->pll_ctrl_base, PLL_CONFIGURATION2, val);
+ ret = ti_pipe3_dpll_wait_lock(phy);
+ }
- omap_control_phy_power(phy->control_dev, 1);
+ /* Program the DPLL only if not locked */
+ val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS);
+ if (!(val & PLL_LOCK))
+ if (ti_pipe3_dpll_program(phy))
+ return -EINVAL;
- return 0;
+ return ret;
}
+static int ti_pipe3_exit(struct phy *x)
+{
+ struct ti_pipe3 *phy = phy_get_drvdata(x);
+ u32 val;
+ unsigned long timeout;
+
+ /* Put DPLL in IDLE mode */
+ val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION2);
+ val |= PLL_IDLE;
+ ti_pipe3_writel(phy->pll_ctrl_base, PLL_CONFIGURATION2, val);
+
+ /* wait for LDO and Oscillator to power down */
+ timeout = jiffies + msecs_to_jiffies(PLL_IDLE_TIME);
+ do {
+ cpu_relax();
+ val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS);
+ if ((val & PLL_TICOPWDN) && (val & PLL_LDOPWDN))
+ break;
+ } while (!time_after(jiffies, timeout));
+
+ if (!(val & PLL_TICOPWDN) || !(val & PLL_LDOPWDN)) {
+ dev_err(phy->dev, "Failed to power down: PLL_STATUS 0x%x\n",
+ val);
+ return -EBUSY;
+ }
+
+ return 0;
+}
static struct phy_ops ops = {
.init = ti_pipe3_init,
+ .exit = ti_pipe3_exit,
.power_on = ti_pipe3_power_on,
.power_off = ti_pipe3_power_off,
.owner = THIS_MODULE,
--
1.8.3.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v2 08/13] phy: ti-pipe3: Fix suspend/resume and module reload
2014-03-06 14:38 [PATCH v2 00/13][RESEND] ARM: OMAP: SATA support for OMAP5 & DRA7 Roger Quadros
` (6 preceding siblings ...)
2014-03-06 14:38 ` [PATCH v2 07/13] phy: ti-pipe3: streamline PHY operations Roger Quadros
@ 2014-03-06 14:38 ` Roger Quadros
2014-03-06 14:38 ` [PATCH v2 09/13] phy: omap: Depend on OMAP_OCP2SCP bus driver Roger Quadros
` (4 subsequent siblings)
12 siblings, 0 replies; 26+ messages in thread
From: Roger Quadros @ 2014-03-06 14:38 UTC (permalink / raw)
To: kishon, tony, balbi
Cc: george.cherian, balajitk, hdegoede, linux-omap, linux-arm-kernel,
linux-kernel, devicetree, linux-usb, linux-ide, rogerq
Due to Errata i783, SATA breaks if its DPLL is idled. The recommeded
workaround to issue a softreset to the SATA controller doesn't seem to
work. Here we just prevent SATA DPLL from Idling and hence avoid
the issue altogether.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/phy/phy-ti-pipe3.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index 12cc900..5913676 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -238,6 +238,10 @@ static int ti_pipe3_exit(struct phy *x)
u32 val;
unsigned long timeout;
+ /* SATA DPLL can't be powered down due to Errata i783 */
+ if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata"))
+ return 0;
+
/* Put DPLL in IDLE mode */
val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION2);
val |= PLL_IDLE;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v2 09/13] phy: omap: Depend on OMAP_OCP2SCP bus driver
2014-03-06 14:38 [PATCH v2 00/13][RESEND] ARM: OMAP: SATA support for OMAP5 & DRA7 Roger Quadros
` (7 preceding siblings ...)
2014-03-06 14:38 ` [PATCH v2 08/13] phy: ti-pipe3: Fix suspend/resume and module reload Roger Quadros
@ 2014-03-06 14:38 ` Roger Quadros
2014-03-06 14:38 ` [PATCH v2 10/13] ARM: OMAP5: hwmod: Add ocp2scp3 and sata hwmods Roger Quadros
` (3 subsequent siblings)
12 siblings, 0 replies; 26+ messages in thread
From: Roger Quadros @ 2014-03-06 14:38 UTC (permalink / raw)
To: kishon, tony, balbi
Cc: george.cherian, balajitk, hdegoede, linux-omap, linux-arm-kernel,
linux-kernel, devicetree, linux-usb, linux-ide, rogerq
The OMAP_USB2 and OMAP_PIPE3 PHY devices will not be
detected if the OMAP_OCP2SCP bus driver is not present.
Make them depend on it.
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
drivers/phy/Kconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index fe8c009..2aead8b 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -47,6 +47,7 @@ config OMAP_USB2
depends on USB_PHY
select GENERIC_PHY
select OMAP_CONTROL_PHY
+ depends on OMAP_OCP2SCP
help
Enable this to support the transceiver that is part of SOC. This
driver takes care of all the PHY functionality apart from comparator.
@@ -58,6 +59,7 @@ config TI_PIPE3
depends on ARCH_OMAP2PLUS || COMPILE_TEST
select GENERIC_PHY
select OMAP_CONTROL_PHY
+ depends on OMAP_OCP2SCP
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.
--
1.8.3.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v2 10/13] ARM: OMAP5: hwmod: Add ocp2scp3 and sata hwmods
2014-03-06 14:38 [PATCH v2 00/13][RESEND] ARM: OMAP: SATA support for OMAP5 & DRA7 Roger Quadros
` (8 preceding siblings ...)
2014-03-06 14:38 ` [PATCH v2 09/13] phy: omap: Depend on OMAP_OCP2SCP bus driver Roger Quadros
@ 2014-03-06 14:38 ` Roger Quadros
2014-03-06 14:38 ` [PATCH v2 11/13] ARM: dts: omap5: add sata node Roger Quadros
` (2 subsequent siblings)
12 siblings, 0 replies; 26+ messages in thread
From: Roger Quadros @ 2014-03-06 14:38 UTC (permalink / raw)
To: kishon, tony, balbi
Cc: george.cherian, balajitk, hdegoede, linux-omap, linux-arm-kernel,
linux-kernel, devicetree, linux-usb, linux-ide, rogerq,
Benoit Cousson, Paul Walmsley
From: Keshava Munegowda <keshava_mgowda@ti.com>
Create hwmods for ocp2scp3 and sata modules.
[Roger Q] Clean up.
CC: Benoit Cousson <bcousson@baylibre.com>
CC: Paul Walmsley <paul@pwsan.com>
CC: Tony Lindgren <tony@atomide.com>
Signed-off-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
arch/arm/mach-omap2/omap_hwmod_54xx_data.c | 73 ++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
index e297d62..227a69f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
@@ -1726,6 +1726,77 @@ static struct omap_hwmod omap54xx_wd_timer2_hwmod = {
},
};
+/*
+ * 'ocp2scp' class
+ * bridge to transform ocp interface protocol to scp (serial control port)
+ * protocol
+ */
+/* ocp2scp3 */
+static struct omap_hwmod omap54xx_ocp2scp3_hwmod;
+/* l4_cfg -> ocp2scp3 */
+static struct omap_hwmod_ocp_if omap54xx_l4_cfg__ocp2scp3 = {
+ .master = &omap54xx_l4_cfg_hwmod,
+ .slave = &omap54xx_ocp2scp3_hwmod,
+ .clk = "l4_root_clk_div",
+ .user = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+static struct omap_hwmod omap54xx_ocp2scp3_hwmod = {
+ .name = "ocp2scp3",
+ .class = &omap54xx_ocp2scp_hwmod_class,
+ .clkdm_name = "l3init_clkdm",
+ .prcm = {
+ .omap4 = {
+ .clkctrl_offs = OMAP54XX_CM_L3INIT_OCP2SCP3_CLKCTRL_OFFSET,
+ .context_offs = OMAP54XX_RM_L3INIT_OCP2SCP3_CONTEXT_OFFSET,
+ .modulemode = MODULEMODE_HWCTRL,
+ },
+ },
+};
+
+/*
+ * 'sata' class
+ * sata: serial ata interface gen2 compliant ( 1 rx/ 1 tx)
+ */
+
+static struct omap_hwmod_class_sysconfig omap54xx_sata_sysc = {
+ .sysc_offs = 0x0000,
+ .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE),
+ .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
+ SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
+ MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
+ .sysc_fields = &omap_hwmod_sysc_type2,
+};
+
+static struct omap_hwmod_class omap54xx_sata_hwmod_class = {
+ .name = "sata",
+ .sysc = &omap54xx_sata_sysc,
+};
+
+/* sata */
+static struct omap_hwmod omap54xx_sata_hwmod = {
+ .name = "sata",
+ .class = &omap54xx_sata_hwmod_class,
+ .clkdm_name = "l3init_clkdm",
+ .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
+ .main_clk = "func_48m_fclk",
+ .mpu_rt_idx = 1,
+ .prcm = {
+ .omap4 = {
+ .clkctrl_offs = OMAP54XX_CM_L3INIT_SATA_CLKCTRL_OFFSET,
+ .context_offs = OMAP54XX_RM_L3INIT_SATA_CONTEXT_OFFSET,
+ .modulemode = MODULEMODE_SWCTRL,
+ },
+ },
+};
+
+/* l4_cfg -> sata */
+static struct omap_hwmod_ocp_if omap54xx_l4_cfg__sata = {
+ .master = &omap54xx_l4_cfg_hwmod,
+ .slave = &omap54xx_sata_hwmod,
+ .clk = "l3_iclk_div",
+ .user = OCP_USER_MPU | OCP_USER_SDMA,
+};
/*
* Interfaces
@@ -2399,6 +2470,8 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
&omap54xx_l4_cfg__usb_tll_hs,
&omap54xx_l4_cfg__usb_otg_ss,
&omap54xx_l4_wkup__wd_timer2,
+ &omap54xx_l4_cfg__ocp2scp3,
+ &omap54xx_l4_cfg__sata,
NULL,
};
--
1.8.3.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v2 11/13] ARM: dts: omap5: add sata node
2014-03-06 14:38 [PATCH v2 00/13][RESEND] ARM: OMAP: SATA support for OMAP5 & DRA7 Roger Quadros
` (9 preceding siblings ...)
2014-03-06 14:38 ` [PATCH v2 10/13] ARM: OMAP5: hwmod: Add ocp2scp3 and sata hwmods Roger Quadros
@ 2014-03-06 14:38 ` Roger Quadros
2014-03-06 14:38 ` [PATCH v2 12/13] ARM: DRA7: hwmod: Add ocp2scp3 and sata hwmods Roger Quadros
2014-03-06 14:38 ` [PATCH v2 13/13] ARM: dts: dra7: add OCP2SCP3 and SATA nodes Roger Quadros
12 siblings, 0 replies; 26+ messages in thread
From: Roger Quadros @ 2014-03-06 14:38 UTC (permalink / raw)
To: kishon, tony, balbi
Cc: george.cherian, balajitk, hdegoede, linux-omap, linux-arm-kernel,
linux-kernel, devicetree, linux-usb, linux-ide, rogerq,
Benoit Cousson
From: Balaji T K <balajitk@ti.com>
Add support for sata.
[Roger Q] Clean up.
CC: Benoit Cousson <bcousson@baylibre.com>
CC: Tony Lindgren <tony@atomide.com>
Signed-off-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
arch/arm/boot/dts/omap5.dtsi | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index e47601a..b398cff 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -828,6 +828,46 @@
#thermal-sensor-cells = <1>;
};
+
+ omap_control_sata: control-phy@4a002374 {
+ compatible = "ti,control-phy-pipe3";
+ reg = <0x4a002374 0x4>;
+ reg-names = "power";
+ clocks = <&sys_clkin>;
+ clock-names = "sysclk";
+ };
+
+ /* OCP2SCP3 */
+ ocp2scp@4a090000 {
+ compatible = "ti,omap-ocp2scp";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0x4a090000 0x20>;
+ ranges;
+ ti,hwmods = "ocp2scp3";
+ sata_phy: phy@4a096000 {
+ compatible = "ti,phy-pipe3-sata";
+ reg = <0x4A096000 0x80>, /* phy_rx */
+ <0x4A096400 0x64>, /* phy_tx */
+ <0x4A096800 0x40>; /* pll_ctrl */
+ reg-names = "phy_rx", "phy_tx", "pll_ctrl";
+ ctrl-module = <&omap_control_sata>;
+ clocks = <&sys_clkin>;
+ clock-names = "sysclk";
+ #phy-cells = <0>;
+ };
+ };
+
+ sata: sata@4a141100 {
+ compatible = "snps,dwc-ahci";
+ reg = <0x4a140000 0x1100>, <0x4a141100 0x7>;
+ interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
+ phys = <&sata_phy>;
+ phy-names = "sata-phy";
+ clocks = <&sata_ref_clk>;
+ ti,hwmods = "sata";
+ };
+
};
};
--
1.8.3.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v2 12/13] ARM: DRA7: hwmod: Add ocp2scp3 and sata hwmods
2014-03-06 14:38 [PATCH v2 00/13][RESEND] ARM: OMAP: SATA support for OMAP5 & DRA7 Roger Quadros
` (10 preceding siblings ...)
2014-03-06 14:38 ` [PATCH v2 11/13] ARM: dts: omap5: add sata node Roger Quadros
@ 2014-03-06 14:38 ` Roger Quadros
2014-03-06 14:38 ` [PATCH v2 13/13] ARM: dts: dra7: add OCP2SCP3 and SATA nodes Roger Quadros
12 siblings, 0 replies; 26+ messages in thread
From: Roger Quadros @ 2014-03-06 14:38 UTC (permalink / raw)
To: kishon, tony, balbi
Cc: george.cherian, balajitk, hdegoede, linux-omap, linux-arm-kernel,
linux-kernel, devicetree, linux-usb, linux-ide, rogerq,
Benoit Cousson, Paul Walmsley, Nikhil Devshatwar
From: Nikhil Devshatwar <nikhil.nd@ti.com>
Add hwmods for ocp2scp3 and sata modules.
[Roger Q] Clean up.
CC: Benoit Cousson <bcousson@baylibre.com>
CC: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
index 18f333c..3c9a430 100644
--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
@@ -1215,6 +1215,30 @@ static struct omap_hwmod dra7xx_ocp2scp1_hwmod = {
},
};
+/* ocp2scp3 */
+static struct omap_hwmod dra7xx_ocp2scp3_hwmod;
+
+/* l4_cfg -> ocp2scp3 */
+static struct omap_hwmod_ocp_if dra7xx_l4_cfg__ocp2scp3 = {
+ .master = &dra7xx_l4_cfg_hwmod,
+ .slave = &dra7xx_ocp2scp3_hwmod,
+ .clk = "l4_root_clk_div",
+ .user = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+static struct omap_hwmod dra7xx_ocp2scp3_hwmod = {
+ .name = "ocp2scp3",
+ .class = &dra7xx_ocp2scp_hwmod_class,
+ .clkdm_name = "l3init_clkdm",
+ .prcm = {
+ .omap4 = {
+ .clkctrl_offs = DRA7XX_CM_L3INIT_OCP2SCP3_CLKCTRL_OFFSET,
+ .context_offs = DRA7XX_RM_L3INIT_OCP2SCP3_CONTEXT_OFFSET,
+ .modulemode = MODULEMODE_HWCTRL,
+ },
+ },
+};
+
/*
* 'qspi' class
*
@@ -1268,9 +1292,6 @@ static struct omap_hwmod_class dra7xx_sata_hwmod_class = {
};
/* sata */
-static struct omap_hwmod_opt_clk sata_opt_clks[] = {
- { .role = "ref_clk", .clk = "sata_ref_clk" },
-};
static struct omap_hwmod dra7xx_sata_hwmod = {
.name = "sata",
@@ -1278,6 +1299,7 @@ static struct omap_hwmod dra7xx_sata_hwmod = {
.clkdm_name = "l3init_clkdm",
.flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
.main_clk = "func_48m_fclk",
+ .mpu_rt_idx = 1,
.prcm = {
.omap4 = {
.clkctrl_offs = DRA7XX_CM_L3INIT_SATA_CLKCTRL_OFFSET,
@@ -1285,8 +1307,6 @@ static struct omap_hwmod dra7xx_sata_hwmod = {
.modulemode = MODULEMODE_SWCTRL,
},
},
- .opt_clks = sata_opt_clks,
- .opt_clks_cnt = ARRAY_SIZE(sata_opt_clks),
};
/*
@@ -2683,6 +2703,7 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = {
&dra7xx_l4_per1__mmc4,
&dra7xx_l4_cfg__mpu,
&dra7xx_l4_cfg__ocp2scp1,
+ &dra7xx_l4_cfg__ocp2scp3,
&dra7xx_l3_main_1__qspi,
&dra7xx_l4_cfg__sata,
&dra7xx_l4_cfg__smartreflex_core,
--
1.8.3.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v2 13/13] ARM: dts: dra7: add OCP2SCP3 and SATA nodes
2014-03-06 14:38 [PATCH v2 00/13][RESEND] ARM: OMAP: SATA support for OMAP5 & DRA7 Roger Quadros
` (11 preceding siblings ...)
2014-03-06 14:38 ` [PATCH v2 12/13] ARM: DRA7: hwmod: Add ocp2scp3 and sata hwmods Roger Quadros
@ 2014-03-06 14:38 ` Roger Quadros
12 siblings, 0 replies; 26+ messages in thread
From: Roger Quadros @ 2014-03-06 14:38 UTC (permalink / raw)
To: kishon, tony, balbi
Cc: george.cherian, balajitk, hdegoede, linux-omap, linux-arm-kernel,
linux-kernel, devicetree, linux-usb, linux-ide, rogerq,
Benoit Cousson
From: Balaji T K <balajitk@ti.com>
Add nodes for OCP2SCP3 bus, SATA controller and SATA PHY.
[Roger Q] Clean up.
CC: Benoit Cousson <bcousson@baylibre.com>
Signed-off-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
arch/arm/boot/dts/dra7.dtsi | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 9e3caf3..597979b 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -772,6 +772,45 @@
dma-names = "tx0", "rx0";
status = "disabled";
};
+
+ omap_control_sata: control-phy@4a002374 {
+ compatible = "ti,control-phy-pipe3";
+ reg = <0x4a002374 0x4>;
+ reg-names = "power";
+ clocks = <&sys_clkin1>;
+ clock-names = "sysclk";
+ };
+
+ /* OCP2SCP3 */
+ ocp2scp@4a090000 {
+ compatible = "ti,omap-ocp2scp";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges;
+ reg = <0x4a090000 0x20>;
+ ti,hwmods = "ocp2scp3";
+ sata_phy: phy@4A096000 {
+ compatible = "ti,phy-pipe3-sata";
+ reg = <0x4A096000 0x80>, /* phy_rx */
+ <0x4A096400 0x64>, /* phy_tx */
+ <0x4A096800 0x40>; /* pll_ctrl */
+ reg-names = "phy_rx", "phy_tx", "pll_ctrl";
+ ctrl-module = <&omap_control_sata>;
+ clocks = <&sys_clkin1>;
+ clock-names = "sysclk";
+ #phy-cells = <0>;
+ };
+ };
+
+ sata: sata@4a141100 {
+ compatible = "snps,dwc-ahci";
+ reg = <0x4a140000 0x1100>, <0x4a141100 0x7>;
+ interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
+ phys = <&sata_phy>;
+ phy-names = "sata-phy";
+ clocks = <&sata_ref_clk>;
+ ti,hwmods = "sata";
+ };
};
};
--
1.8.3.2
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v2 01/13] phy: rename struct omap_control_usb to struct omap_control_phy
2014-03-06 14:22 [PATCH v2 00/13] ARM: OMAP: SATA support for OMAP5 & DRA7 Roger Quadros
@ 2014-03-06 14:22 ` Roger Quadros
0 siblings, 0 replies; 26+ messages in thread
From: Roger Quadros @ 2014-03-06 14:22 UTC (permalink / raw)
To: kishon, tony, balbi
Cc: devicetree, george.cherian, balajitk, linux-ide, linux-usb,
linux-kernel, Kishon Vijay Abraham I, hdegoede, linux-omap,
linux-arm-kernel, rogerq
From: Kishon Vijay Abraham I <kishon@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 <kishon@ti.com>
Signed-off-by: Roger Quadros <rogerq@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 1b607d7..fe8c009 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -31,12 +31,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.
@@ -47,7 +57,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 ecf0d3f..8da05a8 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_BCM_KONA_USB2_PHY) += phy-bcm-kona-usb2.o
obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o
obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += phy-exynos-mipi-video.o
obj-$(CONFIG_PHY_MVEBU_SATA) += phy-mvebu-sata.o
+obj-$(CONFIG_OMAP_CONTROL_PHY) += phy-omap-control.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
diff --git a/drivers/phy/phy-omap-control.c b/drivers/phy/phy-omap-control.c
new file mode 100644
index 0000000..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 <kishon@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 == OMAP_CTRL_TYPE_OTGHS)
+ return;
+
+ val = readl(control_phy->power);
+
+ switch (control_phy->type) {
+ case OMAP_CTRL_TYPE_USB2:
+ if (on)
+ val &= ~OMAP_CTRL_DEV_PHY_PD;
+ else
+ val |= OMAP_CTRL_DEV_PHY_PD;
+ break;
+
+ case OMAP_CTRL_TYPE_PIPE3:
+ rate = clk_get_rate(control_phy->sys_clk);
+ rate = rate/1000000;
+
+ if (on) {
+ val &= ~(OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK |
+ OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK);
+ val |= OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON <<
+ OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
+ val |= rate <<
+ OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT;
+ } else {
+ val &= ~OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK;
+ val |= OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF <<
+ OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
+ }
+ break;
+
+ case OMAP_CTRL_TYPE_DRA7USB2:
+ if (on)
+ val &= ~OMAP_CTRL_USB2_PHY_PD;
+ else
+ val |= OMAP_CTRL_USB2_PHY_PD;
+ break;
+
+ case OMAP_CTRL_TYPE_AM437USB2:
+ if (on) {
+ val &= ~(AM437X_CTRL_USB2_PHY_PD |
+ AM437X_CTRL_USB2_OTG_PD);
+ val |= (AM437X_CTRL_USB2_OTGVDET_EN |
+ AM437X_CTRL_USB2_OTGSESSEND_EN);
+ } else {
+ val &= ~(AM437X_CTRL_USB2_OTGVDET_EN |
+ AM437X_CTRL_USB2_OTGSESSEND_EN);
+ val |= (AM437X_CTRL_USB2_PHY_PD |
+ AM437X_CTRL_USB2_OTG_PD);
+ }
+ break;
+ default:
+ dev_err(dev, "%s: type %d not recognized\n",
+ __func__, control_phy->type);
+ break;
+ }
+
+ writel(val, control_phy->power);
+}
+EXPORT_SYMBOL_GPL(omap_control_phy_power);
+
+/**
+ * omap_control_usb_host_mode - set AVALID, VBUSVALID and ID pin in grounded
+ * @ctrl_phy: struct omap_control_phy *
+ *
+ * Writes to the mailbox register to notify the usb core that a usb
+ * device has been connected.
+ */
+static void omap_control_usb_host_mode(struct omap_control_phy *ctrl_phy)
+{
+ u32 val;
+
+ val = readl(ctrl_phy->otghs_control);
+ val &= ~(OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_SESSEND);
+ val |= OMAP_CTRL_DEV_AVALID | OMAP_CTRL_DEV_VBUSVALID;
+ writel(val, ctrl_phy->otghs_control);
+}
+
+/**
+ * omap_control_usb_device_mode - set AVALID, VBUSVALID and ID pin in high
+ * impedance
+ * @ctrl_phy: struct omap_control_phy *
+ *
+ * Writes to the mailbox register to notify the usb core that it has been
+ * connected to a usb host.
+ */
+static void omap_control_usb_device_mode(struct omap_control_phy *ctrl_phy)
+{
+ u32 val;
+
+ val = readl(ctrl_phy->otghs_control);
+ val &= ~OMAP_CTRL_DEV_SESSEND;
+ val |= OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_AVALID |
+ OMAP_CTRL_DEV_VBUSVALID;
+ writel(val, ctrl_phy->otghs_control);
+}
+
+/**
+ * omap_control_usb_set_sessionend - Enable SESSIONEND and IDIG to high
+ * impedance
+ * @ctrl_phy: struct omap_control_phy *
+ *
+ * Writes to the mailbox register to notify the usb core it's now in
+ * disconnected state.
+ */
+static void omap_control_usb_set_sessionend(struct omap_control_phy *ctrl_phy)
+{
+ u32 val;
+
+ val = readl(ctrl_phy->otghs_control);
+ val &= ~(OMAP_CTRL_DEV_AVALID | OMAP_CTRL_DEV_VBUSVALID);
+ val |= OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_SESSEND;
+ writel(val, ctrl_phy->otghs_control);
+}
+
+/**
+ * omap_control_usb_set_mode - Calls to functions to set USB in one of host mode
+ * or device mode or to denote disconnected state
+ * @dev: the control module device
+ * @mode: The mode to which usb should be configured
+ *
+ * This is an API to write to the mailbox register to notify the usb core that
+ * a usb device has been connected.
+ */
+void omap_control_usb_set_mode(struct device *dev,
+ enum omap_control_usb_mode mode)
+{
+ struct omap_control_phy *ctrl_phy;
+
+ if (IS_ERR(dev) || !dev)
+ return;
+
+ ctrl_phy = dev_get_drvdata(dev);
+
+ if (!ctrl_phy) {
+ dev_err(dev, "Invalid control phy device\n");
+ return;
+ }
+
+ if (ctrl_phy->type != OMAP_CTRL_TYPE_OTGHS)
+ return;
+
+ switch (mode) {
+ case USB_MODE_HOST:
+ omap_control_usb_host_mode(ctrl_phy);
+ break;
+ case USB_MODE_DEVICE:
+ omap_control_usb_device_mode(ctrl_phy);
+ break;
+ case USB_MODE_DISCONNECT:
+ omap_control_usb_set_sessionend(ctrl_phy);
+ break;
+ default:
+ dev_vdbg(dev, "invalid omap control usb mode\n");
+ }
+}
+EXPORT_SYMBOL_GPL(omap_control_usb_set_mode);
+
+#ifdef CONFIG_OF
+
+static const enum omap_control_phy_type otghs_data = OMAP_CTRL_TYPE_OTGHS;
+static const enum omap_control_phy_type usb2_data = OMAP_CTRL_TYPE_USB2;
+static const enum omap_control_phy_type pipe3_data = OMAP_CTRL_TYPE_PIPE3;
+static const enum omap_control_phy_type dra7usb2_data = OMAP_CTRL_TYPE_DRA7USB2;
+static const enum omap_control_phy_type am437usb2_data = OMAP_CTRL_TYPE_AM437USB2;
+
+static const struct of_device_id omap_control_phy_id_table[] = {
+ {
+ .compatible = "ti,control-phy-otghs",
+ .data = &otghs_data,
+ },
+ {
+ .compatible = "ti,control-phy-usb2",
+ .data = &usb2_data,
+ },
+ {
+ .compatible = "ti,control-phy-pipe3",
+ .data = &pipe3_data,
+ },
+ {
+ .compatible = "ti,control-phy-dra7usb2",
+ .data = &dra7usb2_data,
+ },
+ {
+ .compatible = "ti,control-phy-am437usb2",
+ .data = &am437usb2_data,
+ },
+ {},
+};
+MODULE_DEVICE_TABLE(of, omap_control_phy_id_table);
+#endif
+
+
+static int omap_control_phy_probe(struct platform_device *pdev)
+{
+ struct resource *res;
+ const struct of_device_id *of_id;
+ struct omap_control_phy *control_phy;
+
+ of_id = of_match_device(of_match_ptr(omap_control_phy_id_table),
+ &pdev->dev);
+ if (!of_id)
+ return -EINVAL;
+
+ control_phy = devm_kzalloc(&pdev->dev, sizeof(*control_phy),
+ GFP_KERNEL);
+ if (!control_phy) {
+ dev_err(&pdev->dev, "unable to alloc memory for control phy\n");
+ return -ENOMEM;
+ }
+
+ control_phy->dev = &pdev->dev;
+ control_phy->type = *(enum omap_control_phy_type *)of_id->data;
+
+ if (control_phy->type == OMAP_CTRL_TYPE_OTGHS) {
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+ "otghs_control");
+ control_phy->otghs_control = devm_ioremap_resource(
+ &pdev->dev, res);
+ if (IS_ERR(control_phy->otghs_control))
+ return PTR_ERR(control_phy->otghs_control);
+ } else {
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+ "power");
+ control_phy->power = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(control_phy->power)) {
+ dev_err(&pdev->dev, "Couldn't get power register\n");
+ return PTR_ERR(control_phy->power);
+ }
+ }
+
+ if (control_phy->type == OMAP_CTRL_TYPE_PIPE3) {
+ control_phy->sys_clk = devm_clk_get(control_phy->dev,
+ "sys_clkin");
+ if (IS_ERR(control_phy->sys_clk)) {
+ pr_err("%s: unable to get sys_clkin\n", __func__);
+ return -EINVAL;
+ }
+ }
+
+ dev_set_drvdata(control_phy->dev, control_phy);
+
+ return 0;
+}
+
+static struct platform_driver omap_control_phy_driver = {
+ .probe = omap_control_phy_probe,
+ .driver = {
+ .name = "omap-control-phy",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(omap_control_phy_id_table),
+ },
+};
+
+static int __init omap_control_phy_init(void)
+{
+ return platform_driver_register(&omap_control_phy_driver);
+}
+subsys_initcall(omap_control_phy_init);
+
+static void __exit omap_control_phy_exit(void)
+{
+ platform_driver_unregister(&omap_control_phy_driver);
+}
+module_exit(omap_control_phy_exit);
+
+MODULE_ALIAS("platform: omap_control_phy");
+MODULE_AUTHOR("Texas Instruments Inc.");
+MODULE_DESCRIPTION("OMAP Control Module PHY Driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index 3cc4aba..a2205a8 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -27,7 +27,7 @@
#include <linux/err.h>
#include <linux/pm_runtime.h>
#include <linux/delay.h>
-#include <linux/usb/omap_control_usb.h>
+#include <linux/phy/omap_control_phy.h>
#include <linux/phy/phy.h>
#include <linux/of_platform.h>
@@ -105,7 +105,7 @@ static int omap_usb_power_off(struct phy *x)
{
struct omap_usb *phy = phy_get_drvdata(x);
- omap_control_usb_phy_power(phy->control_dev, 0);
+ omap_control_phy_power(phy->control_dev, 0);
return 0;
}
@@ -114,7 +114,7 @@ static int omap_usb_power_on(struct phy *x)
{
struct omap_usb *phy = phy_get_drvdata(x);
- omap_control_usb_phy_power(phy->control_dev, 1);
+ omap_control_phy_power(phy->control_dev, 1);
return 0;
}
@@ -251,7 +251,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
}
phy->control_dev = &control_pdev->dev;
- omap_control_usb_phy_power(phy->control_dev, 0);
+ omap_control_phy_power(phy->control_dev, 0);
otg->set_host = omap_usb_set_host;
otg->set_peripheral = omap_usb_set_peripheral;
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
index c8d1674..fd029b1 100644
--- a/drivers/phy/phy-ti-pipe3.c
+++ b/drivers/phy/phy-ti-pipe3.c
@@ -26,7 +26,7 @@
#include <linux/io.h>
#include <linux/pm_runtime.h>
#include <linux/delay.h>
-#include <linux/usb/omap_control_usb.h>
+#include <linux/phy/omap_control_phy.h>
#include <linux/of_platform.h>
#define PLL_STATUS 0x00000004
@@ -134,7 +134,7 @@ static int ti_pipe3_power_off(struct phy *x)
return -EBUSY;
}
- omap_control_usb_phy_power(phy->control_dev, 0);
+ omap_control_phy_power(phy->control_dev, 0);
return 0;
}
@@ -232,7 +232,7 @@ static int ti_pipe3_init(struct phy *x)
if (ret)
return ret;
- omap_control_usb_phy_power(phy->control_dev, 1);
+ omap_control_phy_power(phy->control_dev, 1);
return 0;
}
@@ -304,7 +304,7 @@ static int ti_pipe3_probe(struct platform_device *pdev)
phy->control_dev = &control_pdev->dev;
- omap_control_usb_phy_power(phy->control_dev, 0);
+ omap_control_phy_power(phy->control_dev, 0);
platform_set_drvdata(pdev, phy);
pm_runtime_enable(phy->dev);
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 8aa59a2..d341c14 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -37,7 +37,7 @@
#include <linux/err.h>
#include <linux/delay.h>
#include <linux/usb/musb-omap.h>
-#include <linux/usb/omap_control_usb.h>
+#include <linux/phy/omap_control_phy.h>
#include <linux/of_platform.h>
#include "musb_core.h"
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index c337ba2..416e0c8 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -75,16 +75,6 @@ config NOP_USB_XCEIV
built-in with usb ip or which are autonomous and doesn't require any
phy programming such as ISP1x04 etc.
-config OMAP_CONTROL_USB
- tristate "OMAP CONTROL USB Driver"
- depends on ARCH_OMAP2PLUS || COMPILE_TEST
- help
- Enable this to add support for the USB 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.
-
config AM335X_CONTROL_USB
tristate
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index 15f1878..f8fa719 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -13,7 +13,6 @@ obj-$(CONFIG_ISP1301_OMAP) += phy-isp1301-omap.o
obj-$(CONFIG_MV_U3D_PHY) += phy-mv-u3d-usb.o
obj-$(CONFIG_NOP_USB_XCEIV) += phy-generic.o
obj-$(CONFIG_TAHVO_USB) += phy-tahvo.o
-obj-$(CONFIG_OMAP_CONTROL_USB) += phy-omap-control.o
obj-$(CONFIG_AM335X_CONTROL_USB) += phy-am335x-control.o
obj-$(CONFIG_AM335X_PHY_USB) += phy-am335x.o
obj-$(CONFIG_OMAP_OTG) += phy-omap-otg.o
diff --git a/drivers/usb/phy/phy-omap-control.c b/drivers/usb/phy/phy-omap-control.c
deleted file mode 100644
index e725318..0000000
--- a/drivers/usb/phy/phy-omap-control.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * omap-control-usb.c - The USB 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 <kishon@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/usb/omap_control_usb.h>
-
-/**
- * omap_control_usb_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_usb_phy_power(struct device *dev, int on)
-{
- u32 val;
- unsigned long rate;
- struct omap_control_usb *control_usb;
-
- if (IS_ERR(dev) || !dev) {
- pr_err("%s: invalid device\n", __func__);
- return;
- }
-
- control_usb = dev_get_drvdata(dev);
- if (!control_usb) {
- dev_err(dev, "%s: invalid control usb device\n", __func__);
- return;
- }
-
- if (control_usb->type == OMAP_CTRL_TYPE_OTGHS)
- return;
-
- val = readl(control_usb->power);
-
- switch (control_usb->type) {
- case OMAP_CTRL_TYPE_USB2:
- if (on)
- val &= ~OMAP_CTRL_DEV_PHY_PD;
- else
- val |= OMAP_CTRL_DEV_PHY_PD;
- break;
-
- case OMAP_CTRL_TYPE_PIPE3:
- rate = clk_get_rate(control_usb->sys_clk);
- rate = rate/1000000;
-
- if (on) {
- val &= ~(OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK |
- OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK);
- val |= OMAP_CTRL_USB3_PHY_TX_RX_POWERON <<
- OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT;
- val |= rate << OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT;
- } else {
- val &= ~OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK;
- val |= OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF <<
- OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT;
- }
- break;
-
- case OMAP_CTRL_TYPE_DRA7USB2:
- if (on)
- val &= ~OMAP_CTRL_USB2_PHY_PD;
- else
- val |= OMAP_CTRL_USB2_PHY_PD;
- break;
-
- case OMAP_CTRL_TYPE_AM437USB2:
- if (on) {
- val &= ~(AM437X_CTRL_USB2_PHY_PD |
- AM437X_CTRL_USB2_OTG_PD);
- val |= (AM437X_CTRL_USB2_OTGVDET_EN |
- AM437X_CTRL_USB2_OTGSESSEND_EN);
- } else {
- val &= ~(AM437X_CTRL_USB2_OTGVDET_EN |
- AM437X_CTRL_USB2_OTGSESSEND_EN);
- val |= (AM437X_CTRL_USB2_PHY_PD |
- AM437X_CTRL_USB2_OTG_PD);
- }
- break;
- default:
- dev_err(dev, "%s: type %d not recognized\n",
- __func__, control_usb->type);
- break;
- }
-
- writel(val, control_usb->power);
-}
-EXPORT_SYMBOL_GPL(omap_control_usb_phy_power);
-
-/**
- * omap_control_usb_host_mode - set AVALID, VBUSVALID and ID pin in grounded
- * @ctrl_usb: struct omap_control_usb *
- *
- * Writes to the mailbox register to notify the usb core that a usb
- * device has been connected.
- */
-static void omap_control_usb_host_mode(struct omap_control_usb *ctrl_usb)
-{
- u32 val;
-
- val = readl(ctrl_usb->otghs_control);
- val &= ~(OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_SESSEND);
- val |= OMAP_CTRL_DEV_AVALID | OMAP_CTRL_DEV_VBUSVALID;
- writel(val, ctrl_usb->otghs_control);
-}
-
-/**
- * omap_control_usb_device_mode - set AVALID, VBUSVALID and ID pin in high
- * impedance
- * @ctrl_usb: struct omap_control_usb *
- *
- * Writes to the mailbox register to notify the usb core that it has been
- * connected to a usb host.
- */
-static void omap_control_usb_device_mode(struct omap_control_usb *ctrl_usb)
-{
- u32 val;
-
- val = readl(ctrl_usb->otghs_control);
- val &= ~OMAP_CTRL_DEV_SESSEND;
- val |= OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_AVALID |
- OMAP_CTRL_DEV_VBUSVALID;
- writel(val, ctrl_usb->otghs_control);
-}
-
-/**
- * omap_control_usb_set_sessionend - Enable SESSIONEND and IDIG to high
- * impedance
- * @ctrl_usb: struct omap_control_usb *
- *
- * Writes to the mailbox register to notify the usb core it's now in
- * disconnected state.
- */
-static void omap_control_usb_set_sessionend(struct omap_control_usb *ctrl_usb)
-{
- u32 val;
-
- val = readl(ctrl_usb->otghs_control);
- val &= ~(OMAP_CTRL_DEV_AVALID | OMAP_CTRL_DEV_VBUSVALID);
- val |= OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_SESSEND;
- writel(val, ctrl_usb->otghs_control);
-}
-
-/**
- * omap_control_usb_set_mode - Calls to functions to set USB in one of host mode
- * or device mode or to denote disconnected state
- * @dev: the control module device
- * @mode: The mode to which usb should be configured
- *
- * This is an API to write to the mailbox register to notify the usb core that
- * a usb device has been connected.
- */
-void omap_control_usb_set_mode(struct device *dev,
- enum omap_control_usb_mode mode)
-{
- struct omap_control_usb *ctrl_usb;
-
- if (IS_ERR(dev) || !dev)
- return;
-
- ctrl_usb = dev_get_drvdata(dev);
-
- if (!ctrl_usb) {
- dev_err(dev, "Invalid control usb device\n");
- return;
- }
-
- if (ctrl_usb->type != OMAP_CTRL_TYPE_OTGHS)
- return;
-
- switch (mode) {
- case USB_MODE_HOST:
- omap_control_usb_host_mode(ctrl_usb);
- break;
- case USB_MODE_DEVICE:
- omap_control_usb_device_mode(ctrl_usb);
- break;
- case USB_MODE_DISCONNECT:
- omap_control_usb_set_sessionend(ctrl_usb);
- break;
- default:
- dev_vdbg(dev, "invalid omap control usb mode\n");
- }
-}
-EXPORT_SYMBOL_GPL(omap_control_usb_set_mode);
-
-#ifdef CONFIG_OF
-
-static const enum omap_control_usb_type otghs_data = OMAP_CTRL_TYPE_OTGHS;
-static const enum omap_control_usb_type usb2_data = OMAP_CTRL_TYPE_USB2;
-static const enum omap_control_usb_type pipe3_data = OMAP_CTRL_TYPE_PIPE3;
-static const enum omap_control_usb_type dra7usb2_data = OMAP_CTRL_TYPE_DRA7USB2;
-static const enum omap_control_usb_type am437usb2_data = OMAP_CTRL_TYPE_AM437USB2;
-
-static const struct of_device_id omap_control_usb_id_table[] = {
- {
- .compatible = "ti,control-phy-otghs",
- .data = &otghs_data,
- },
- {
- .compatible = "ti,control-phy-usb2",
- .data = &usb2_data,
- },
- {
- .compatible = "ti,control-phy-pipe3",
- .data = &pipe3_data,
- },
- {
- .compatible = "ti,control-phy-dra7usb2",
- .data = &dra7usb2_data,
- },
- {
- .compatible = "ti,control-phy-am437usb2",
- .data = &am437usb2_data,
- },
- {},
-};
-MODULE_DEVICE_TABLE(of, omap_control_usb_id_table);
-#endif
-
-
-static int omap_control_usb_probe(struct platform_device *pdev)
-{
- struct resource *res;
- const struct of_device_id *of_id;
- struct omap_control_usb *control_usb;
-
- of_id = of_match_device(of_match_ptr(omap_control_usb_id_table),
- &pdev->dev);
- if (!of_id)
- return -EINVAL;
-
- control_usb = devm_kzalloc(&pdev->dev, sizeof(*control_usb),
- GFP_KERNEL);
- if (!control_usb) {
- dev_err(&pdev->dev, "unable to alloc memory for control usb\n");
- return -ENOMEM;
- }
-
- control_usb->dev = &pdev->dev;
- control_usb->type = *(enum omap_control_usb_type *)of_id->data;
-
- if (control_usb->type == OMAP_CTRL_TYPE_OTGHS) {
- res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
- "otghs_control");
- control_usb->otghs_control = devm_ioremap_resource(
- &pdev->dev, res);
- if (IS_ERR(control_usb->otghs_control))
- return PTR_ERR(control_usb->otghs_control);
- } else {
- res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
- "power");
- control_usb->power = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(control_usb->power)) {
- dev_err(&pdev->dev, "Couldn't get power register\n");
- return PTR_ERR(control_usb->power);
- }
- }
-
- if (control_usb->type == OMAP_CTRL_TYPE_PIPE3) {
- control_usb->sys_clk = devm_clk_get(control_usb->dev,
- "sys_clkin");
- if (IS_ERR(control_usb->sys_clk)) {
- pr_err("%s: unable to get sys_clkin\n", __func__);
- return -EINVAL;
- }
- }
-
- dev_set_drvdata(control_usb->dev, control_usb);
-
- return 0;
-}
-
-static struct platform_driver omap_control_usb_driver = {
- .probe = omap_control_usb_probe,
- .driver = {
- .name = "omap-control-usb",
- .owner = THIS_MODULE,
- .of_match_table = of_match_ptr(omap_control_usb_id_table),
- },
-};
-
-static int __init omap_control_usb_init(void)
-{
- return platform_driver_register(&omap_control_usb_driver);
-}
-subsys_initcall(omap_control_usb_init);
-
-static void __exit omap_control_usb_exit(void)
-{
- platform_driver_unregister(&omap_control_usb_driver);
-}
-module_exit(omap_control_usb_exit);
-
-MODULE_ALIAS("platform: omap_control_usb");
-MODULE_AUTHOR("Texas Instruments Inc.");
-MODULE_DESCRIPTION("OMAP Control Module USB Driver");
-MODULE_LICENSE("GPL v2");
diff --git a/include/linux/phy/omap_control_phy.h b/include/linux/phy/omap_control_phy.h
new file mode 100644
index 0000000..5450403
--- /dev/null
+++ b/include/linux/phy/omap_control_phy.h
@@ -0,0 +1,89 @@
+/*
+ * omap_control_phy.h - Header file for 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 <kishon@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.
+ *
+ */
+
+#ifndef __OMAP_CONTROL_PHY_H__
+#define __OMAP_CONTROL_PHY_H__
+
+enum omap_control_phy_type {
+ OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */
+ OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */
+ OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */
+ OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
+ OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
+};
+
+struct omap_control_phy {
+ struct device *dev;
+
+ u32 __iomem *otghs_control;
+ u32 __iomem *power;
+ u32 __iomem *power_aux;
+
+ struct clk *sys_clk;
+
+ enum omap_control_phy_type type;
+};
+
+enum omap_control_usb_mode {
+ USB_MODE_UNDEFINED = 0,
+ USB_MODE_HOST,
+ USB_MODE_DEVICE,
+ USB_MODE_DISCONNECT,
+};
+
+#define OMAP_CTRL_DEV_PHY_PD BIT(0)
+
+#define OMAP_CTRL_DEV_AVALID BIT(0)
+#define OMAP_CTRL_DEV_BVALID BIT(1)
+#define OMAP_CTRL_DEV_VBUSVALID BIT(2)
+#define OMAP_CTRL_DEV_SESSEND BIT(3)
+#define OMAP_CTRL_DEV_IDDIG BIT(4)
+
+#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK 0x003FC000
+#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT 0xE
+
+#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK 0xFFC00000
+#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT 0x16
+
+#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3
+#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0
+
+#define OMAP_CTRL_USB2_PHY_PD BIT(28)
+
+#define AM437X_CTRL_USB2_PHY_PD BIT(0)
+#define AM437X_CTRL_USB2_OTG_PD BIT(1)
+#define AM437X_CTRL_USB2_OTGVDET_EN BIT(19)
+#define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20)
+
+#if IS_ENABLED(CONFIG_OMAP_CONTROL_PHY)
+void omap_control_phy_power(struct device *dev, int on);
+void omap_control_usb_set_mode(struct device *dev,
+ enum omap_control_usb_mode mode);
+#else
+
+static inline void omap_control_phy_power(struct device *dev, int on)
+{
+}
+
+static inline void omap_control_usb_set_mode(struct device *dev,
+ enum omap_control_usb_mode mode)
+{
+}
+#endif
+
+#endif /* __OMAP_CONTROL_PHY_H__ */
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/usb/omap_control_usb.h
deleted file mode 100644
index 69ae383..0000000
--- a/include/linux/usb/omap_control_usb.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * omap_control_usb.h - Header file for the USB 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 <kishon@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.
- *
- */
-
-#ifndef __OMAP_CONTROL_USB_H__
-#define __OMAP_CONTROL_USB_H__
-
-enum omap_control_usb_type {
- OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */
- OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */
- OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */
- OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
- OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
-};
-
-struct omap_control_usb {
- struct device *dev;
-
- u32 __iomem *otghs_control;
- u32 __iomem *power;
- u32 __iomem *power_aux;
-
- struct clk *sys_clk;
-
- enum omap_control_usb_type type;
-};
-
-enum omap_control_usb_mode {
- USB_MODE_UNDEFINED = 0,
- USB_MODE_HOST,
- USB_MODE_DEVICE,
- USB_MODE_DISCONNECT,
-};
-
-#define OMAP_CTRL_DEV_PHY_PD BIT(0)
-
-#define OMAP_CTRL_DEV_AVALID BIT(0)
-#define OMAP_CTRL_DEV_BVALID BIT(1)
-#define OMAP_CTRL_DEV_VBUSVALID BIT(2)
-#define OMAP_CTRL_DEV_SESSEND BIT(3)
-#define OMAP_CTRL_DEV_IDDIG BIT(4)
-
-#define OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK 0x003FC000
-#define OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT 0xE
-
-#define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK 0xFFC00000
-#define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT 0x16
-
-#define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3
-#define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0
-
-#define OMAP_CTRL_USB2_PHY_PD BIT(28)
-
-#define AM437X_CTRL_USB2_PHY_PD BIT(0)
-#define AM437X_CTRL_USB2_OTG_PD BIT(1)
-#define AM437X_CTRL_USB2_OTGVDET_EN BIT(19)
-#define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20)
-
-#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
-extern void omap_control_usb_phy_power(struct device *dev, int on);
-extern void omap_control_usb_set_mode(struct device *dev,
- enum omap_control_usb_mode mode);
-#else
-
-static inline void omap_control_usb_phy_power(struct device *dev, int on)
-{
-}
-
-static inline void omap_control_usb_set_mode(struct device *dev,
- enum omap_control_usb_mode mode)
-{
-}
-#endif
-
-#endif /* __OMAP_CONTROL_USB_H__ */
--
1.8.3.2
^ permalink raw reply related [flat|nested] 26+ messages in thread