phy: omap-usb: Support multiple instances and new types
Subsystems (5)
v7 cover phy: omap-usb: Support multiple instances and new types
Hi,
This patchset does the following:
* Get rid of omap_control_usb platform data as we support DT only.
* Restructure and add support for new PHY types. We now support the follwing four types
TYPE_OTGHS - if it has otghs_control mailbox register (e.g. on OMAP4) TYPE_USB2 - if it has Power down bit in control_dev_conf register. e.g. USB2 PHY TYPE_PIPE3 - if it has DPLL and individual Rx & Tx power control. e.g. USB3 PHY or SATA PHY TYPE_DRA7USB2 - if it has both power down and power aux registers. e.g. USB2 PHY on DRA7
* Get rid of "ti,type" DT property and introduce compatible strings for each type.
* Have only one power control API "omap_control_usb_phy_power()" instead of a different one for each PHY type.
* Get rid of omap_get_control_dev() so that we can support multiple instances of the control device. We take advantage of the fact that omap control USB device is only present on OMAP4 onwards and hence only supports DT boot. The users of control USB device can get a reference to it from the device node's phandle.
Patches are based on v3.12-rc1.
Smoke tested on OMAP4 panda with MUSB in gadget mode (g_zero).
You can find the patches in branch
usb-control-module
in git tree
git://github.com/rogerq/linux.git
v7:
- Rebased on v3.12-rc1
- Updated DT compatibility ID for better readability
- Renamed TYPE_OMAP4 to TYPE_OTGHS, TYPE_USB3 to TYPE_PIPE3 and TYPE_DRA7 to TYPE_DRA7USB2
v6:
- addressed review comment about usage of control_usb before allocation.
v5:
- fixed whitespace alignment issues.
v4:
- removed "ti,has-mailbox" from omap-usb binding document example.
v3:
- return -EINVAL instead of -ENODEV on probe failure.
- pass device type data through of_device_id table.
- get rid of "ti,mailbox" property and "has_mailbox" from musb platform data.
v2:
- get rid of "ti,type" property and introduce compatible strings for each device type.
cheers,
-roger
---
Roger Quadros (10):
usb: phy: omap-control: Get rid of platform data
usb: phy: omap: Add new device types and remove
omap_control_usb3_phy_power()
usb: phy: omap-usb2: Don't use omap_get_control_dev()
usb: phy: omap-usb3: Don't use omap_get_control_dev()
usb: musb: omap2430: Don't use omap_get_control_dev()
ARM: dts: omap4: update omap-control-usb nodes
usb: phy: omap: get rid of omap_get_control_dev()
ARM: dts: omap5: update omap-control-usb node
usb: dwc3: omap: manage "usb_otg_ss_refclk960m" clock
usb: phy: omap-usb2: Manage phy clock and not otg controller clock
Documentation/devicetree/bindings/usb/omap-usb.txt | 38 ++-- arch/arm/boot/dts/omap4.dtsi | 20 ++- arch/arm/boot/dts/omap5.dtsi | 20 ++- drivers/usb/dwc3/dwc3-omap.c | 13 ++ drivers/usb/musb/omap2430.c | 25 ++- drivers/usb/phy/phy-omap-control.c | 208 ++++++++++--------- drivers/usb/phy/phy-omap-usb2.c | 30 ++- drivers/usb/phy/phy-omap-usb3.c | 32 +++- include/linux/usb/musb.h | 2 - include/linux/usb/omap_control_usb.h | 33 ++-- 10 files changed, 236 insertions(+), 185 deletions(-)
Signature · 1 line
1.7.4.1
PATCH v7 1/10 usb: phy: omap-control: Get rid of platform data
omap-control device is present from OMAP4 onwards which support device tree boots only. So get rid of platform data.
--- drivers/usb/phy/phy-omap-control.c | 12 +++--------- include/linux/usb/omap_control_usb.h | 4 ---- 2 files changed, 3 insertions(+), 13 deletions(-)
drivers/usb/phy/phy-omap-control.c +3 -9
@@ -197,8 +197,6 @@ static int omap_control_usb_probe(struct platform_device *pdev) {struct resource *res;struct device_node *np = pdev->dev.of_node; -struct omap_control_usb_platform_data *pdata = -dev_get_platdata (&pdev->dev); control_usb =devm_kzalloc (&pdev->dev,sizeof (*control_usb),GFP_KERNEL );
@@ -207,14 +205,10 @@ static int omap_control_usb_probe(struct platform_device *pdev)return -ENOMEM ; } -if (np) { +if (np)of_property_read_u32 (np,"ti,type" , &control_usb->type); - }else if (pdata) { - control_usb->type = pdata->type; - }else { -dev_err (&pdev->dev,"no pdata present\n" ); -return -EINVAL ; - } +else +return -EINVAL ;/* We only support DT boot */ control_usb->dev = &pdev->dev;
include/linux/usb/omap_control_usb.h +0 -4
@@ -31,10 +31,6 @@ struct omap_control_usb {u32 type; }; -struct omap_control_usb_platform_data { -u8 type; -}; -enum omap_control_usb_mode {USB_MODE_UNDEFINED =0 ,USB_MODE_HOST ,
Signature · 1 line
1.7.4.1
PATCH v7 2/10 usb: phy: omap: Add new device types and remove omap_control_usb3_phy_power()
In reply to Roger QuadrosAdd support for new device types and in the process rid of "ti,type" device tree property. The correct type of device will be determined from the compatible string instead.
Introduce a compatible string for each device type. At the moment we support 4 types OTGHS, USB2, PIPE3 (e.g. USB3) and DRA7USB2.
Update DT binding information to reflect these changes.
Also get rid of omap_control_usb3_phy_power(). Just one function i.e. omap_control_usb_phy_power() will now take care of all PHY types.
--- Documentation/devicetree/bindings/usb/omap-usb.txt | 30 ++-- drivers/usb/phy/phy-omap-control.c | 173 +++++++++++-------- drivers/usb/phy/phy-omap-usb3.c | 6 +- include/linux/usb/omap_control_usb.h | 24 ++-- 4 files changed, 130 insertions(+), 103 deletions(-)
Documentation/devicetree/bindings/usb/omap-usb.txt +15 -15
@@ -78,22 +78,22 @@ omap_dwc3 { OMAP CONTROL USB Required properties: - - compatible: Should be "ti,omap-control-usb" + - 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. - reg : Address and length of the register set for the device. It contains - the address of "control_dev_conf" and "otghs_control" or "phy_power_usb" - depending upon omap4 or omap5. - - reg-names: The names of the register addresses corresponding to the registers - filled in "reg". - - ti,type: This is used to differentiate whether the control module has - usb mailbox or usb3 phy power. omap4 has usb mailbox in control module to - notify events to the musb core and omap5 has usb3 phy power register to - power on usb3 phy. Should be "1" if it has mailbox and "2" if it has usb3 - phy power. + 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 at 4a002300 { - compatible = "ti,omap-control-usb"; - reg = <0x4a002300 0x4>, - <0x4a00233c 0x4>; - reg-names = "control_dev_conf", "otghs_control"; - ti,type = <1>; + compatible = "ti,control-phy-otghs"; + reg = <0x4a00233c 0x4>; + reg-names = "otghs_control"; };
drivers/usb/phy/phy-omap-control.c +100 -73
240 lines not on this page · raw message
drivers/usb/phy/phy-omap-usb3.c +3 -3
@@ -100,7 +100,7 @@ static int omap_usb3_suspend(struct usb_phy *x, int suspend)udelay (1 ); }while (--timeout); -omap_control_usb3_phy_power (phy->control_dev,0 ); +omap_control_usb_phy_power (phy->control_dev,0 ); phy->is_suspended =1 ; }else if (!suspend && phy->is_suspended) {
@@ -189,7 +189,7 @@ static int omap_usb3_init(struct usb_phy *x)if (ret)return ret; -omap_control_usb3_phy_power (phy->control_dev,1 ); +omap_control_usb_phy_power (phy->control_dev,1 );return 0 ; }
@@ -245,7 +245,7 @@ static int omap_usb3_probe(struct platform_device *pdev)return -ENODEV ; } -omap_control_usb3_phy_power (phy->control_dev,0 ); +omap_control_usb_phy_power (phy->control_dev,0 );usb_add_phy_dev (&phy->phy);platform_set_drvdata (pdev, phy);
include/linux/usb/omap_control_usb.h +12 -12
@@ -19,16 +19,23 @@#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 */ +}; +struct omap_control_usb {struct device *dev; -u32 __iomem *dev_conf;u32 __iomem *otghs_control; -u32 __iomem *phy_power; +u32 __iomem *power; +u32 __iomem *power_aux;struct clk *sys_clk; -u32 type; +enum omap_control_usb_type type; }; enum omap_control_usb_mode {
@@ -38,10 +45,6 @@ enum omap_control_usb_mode { USB_MODE_DISCONNECT, }; -/* To differentiate ctrl module IP having either mailbox or USB3 PHY power */ -#define OMAP_CTRL_DEV_TYPE1 0x1 -#define OMAP_CTRL_DEV_TYPE2 0x2 -#define OMAP_CTRL_DEV_PHY_PD BIT(0)#define OMAP_CTRL_DEV_AVALID BIT(0)
@@ -59,10 +62,11 @@ enum omap_control_usb_mode {#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) +#if IS_ENABLED (CONFIG_OMAP_CONTROL_USB )extern struct device *omap_get_control_dev (void );extern void omap_control_usb_phy_power (struct device *dev,int on); -extern void omap_control_usb3_phy_power (struct device *dev,bool on);extern void omap_control_usb_set_mode (struct device *dev,enum omap_control_usb_mode mode);#else
@@ -75,10 +79,6 @@ static inline void omap_control_usb_phy_power(struct device *dev, int on) { } -static inline void omap_control_usb3_phy_power (struct device *dev,int on) -{ -} -static inline void omap_control_usb_set_mode (struct device *dev,enum omap_control_usb_mode mode) {
Signature · 1 line
1.7.4.1
PATCH v7 3/10 usb: phy: omap-usb2: Don't use omap_get_control_dev()
In reply to Roger Quadrosomap_get_control_dev() is being deprecated as it doesn't support multiple instances. As control device is present only from OMAP4 onwards which supports DT only, we use phandles to get the reference to the control device.
As we don't support non-DT boot, we just bail out on probe if device node is not present.
--- drivers/usb/phy/phy-omap-usb2.c | 26 ++++++++++++++++++++------ 1 files changed, 20 insertions(+), 6 deletions(-)
drivers/usb/phy/phy-omap-usb2.c +20 -6
@@ -28,6 +28,7 @@#include <linux/pm_runtime.h> #include <linux/delay.h> #include <linux/usb/omap_control_usb.h> +#include <linux/of_platform.h> /** * omap_usb2_set_comparator - links the comparator present in the sytem with
@@ -120,8 +121,14 @@ static int omap_usb2_suspend(struct usb_phy *x, int suspend)static int omap_usb2_probe (struct platform_device *pdev) { -struct omap_usb *phy; -struct usb_otg *otg; +struct omap_usb *phy; +struct usb_otg *otg; +struct device_node *node = pdev->dev.of_node; +struct device_node *control_node; +struct platform_device *control_pdev; + +if (!node) +return -EINVAL ; phy =devm_kzalloc (&pdev->dev,sizeof (*phy),GFP_KERNEL );if (!phy) {
@@ -143,11 +150,18 @@ static int omap_usb2_probe(struct platform_device *pdev) phy->phy.otg = otg; phy->phy.type =USB_PHY_TYPE_USB2 ; - phy->control_dev =omap_get_control_dev (); -if (IS_ERR (phy->control_dev)) { -dev_dbg (&pdev->dev,"Failed to get control device\n" ); -return -ENODEV ; + control_node =of_parse_phandle (node,"ctrl-module" ,0 ); +if (!control_node) { +dev_err (&pdev->dev,"Failed to get control device phandle\n" ); +return -EINVAL ; } + control_pdev =of_find_device_by_node (control_node); +if (!control_pdev) { +dev_err (&pdev->dev,"Failed to get control device\n" ); +return -EINVAL ; + } + + phy->control_dev = &control_pdev->dev; phy->is_suspended =1 ;omap_control_usb_phy_power (phy->control_dev,0 );
Signature · 1 line
1.7.4.1
PATCH v7 4/10 usb: phy: omap-usb3: Don't use omap_get_control_dev()
In reply to Roger Quadrosomap_get_control_dev() is being deprecated as it doesn't support multiple instances. As control device is present only from OMAP4 onwards which supports DT only, we use phandles to get the reference to the control device.
As we don't support non-DT boot, we just bail out on probe if device node is not present.
--- drivers/usb/phy/phy-omap-usb3.c | 26 ++++++++++++++++++++------ 1 files changed, 20 insertions(+), 6 deletions(-)
drivers/usb/phy/phy-omap-usb3.c +20 -6
@@ -26,6 +26,7 @@#include <linux/pm_runtime.h> #include <linux/delay.h> #include <linux/usb/omap_control_usb.h> +#include <linux/of_platform.h> #define PLL_STATUS 0x00000004#define PLL_GO 0x00000008
@@ -196,8 +197,14 @@ static int omap_usb3_init(struct usb_phy *x)static int omap_usb3_probe (struct platform_device *pdev) { -struct omap_usb *phy; -struct resource *res; +struct omap_usb *phy; +struct resource *res; +struct device_node *node = pdev->dev.of_node; +struct device_node *control_node; +struct platform_device *control_pdev; + +if (!node) +return -EINVAL ; phy =devm_kzalloc (&pdev->dev,sizeof (*phy),GFP_KERNEL );if (!phy) {
@@ -239,11 +246,18 @@ static int omap_usb3_probe(struct platform_device *pdev)return -EINVAL ; } - phy->control_dev =omap_get_control_dev (); -if (IS_ERR (phy->control_dev)) { -dev_dbg (&pdev->dev,"Failed to get control device\n" ); -return -ENODEV ; + control_node =of_parse_phandle (node,"ctrl-module" ,0 ); +if (!control_node) { +dev_err (&pdev->dev,"Failed to get control device phandle\n" ); +return -EINVAL ; } + control_pdev =of_find_device_by_node (control_node); +if (!control_pdev) { +dev_err (&pdev->dev,"Failed to get control device\n" ); +return -EINVAL ; + } + + phy->control_dev = &control_pdev->dev;omap_control_usb_phy_power (phy->control_dev,0 );usb_add_phy_dev (&phy->phy);
Signature · 1 line
1.7.4.1
PATCH v7 5/10 usb: musb: omap2430: Don't use omap_get_control_dev()
In reply to Roger Quadrosomap_get_control_dev() is being deprecated as it doesn't support multiple instances. As control device is present only from OMAP4 onwards which supports DT only, we use phandles to get the reference to the control device.
Also get rid of "ti,has-mailbox" property as it is redundant and we can determine that from whether "ctrl-module" property is present or not. Get rid of has_mailbox from musb_hdrc_platform_data as well.
--- Documentation/devicetree/bindings/usb/omap-usb.txt | 4 --- drivers/usb/musb/omap2430.c | 25 +++++++++++-------- include/linux/usb/musb.h | 2 - 3 files changed, 14 insertions(+), 17 deletions(-)
Documentation/devicetree/bindings/usb/omap-usb.txt +0 -4
@@ -3,9 +3,6 @@ OMAP GLUE AND OTHER OMAP SPECIFIC COMPONENTS OMAP MUSB GLUE - compatible : Should be "ti,omap4-musb" or "ti,omap3-musb" - ti,hwmods : must be "usb_otg_hs" - - ti,has-mailbox : to specify that omap uses an external mailbox - (in control module) to communicate with the musb core during device connect - and disconnect. - multipoint : Should be "1" indicating the musb controller supports multipoint. This is a MUSB configuration-specific setting. - num-eps : Specifies the number of endpoints. This is also a
@@ -28,7 +25,6 @@ SOC specific device node entry usb_otg_hs: usb_otg_hs at 4a0ab000 { compatible = "ti,omap4-musb"; ti,hwmods = "usb_otg_hs"; - ti,has-mailbox; multipoint = <1>; num-eps = <16>; ram-bits = <12>;
drivers/usb/musb/omap2430.c +14 -11
@@ -38,6 +38,7 @@#include <linux/delay.h> #include <linux/usb/musb-omap.h> #include <linux/usb/omap_control_usb.h> +#include <linux/of_platform.h> #include "musb_core.h" #include "omap2430.h"
@@ -509,8 +510,12 @@ static int omap2430_probe(struct platform_device *pdev) glue->dev = &pdev->dev; glue->musb = musb; glue->status =OMAP_MUSB_UNKNOWN ; + glue->control_otghs =ERR_PTR (-ENODEV );if (np) { +struct device_node *control_node; +struct platform_device *control_pdev; + pdata =devm_kzalloc (&pdev->dev,sizeof (*pdata),GFP_KERNEL );if (!pdata) { dev_err(&pdev->dev,
@@ -539,22 +544,20 @@ static int omap2430_probe(struct platform_device *pdev)of_property_read_u32 (np,"ram-bits" , (u32 *)&config->ram_bits);of_property_read_u32 (np,"power" , (u32 *)&pdata->power); config->multipoint =of_property_read_bool (np,"multipoint" ); - pdata->has_mailbox =of_property_read_bool (np, -"ti,has-mailbox" ); pdata->board_data = data; pdata->config = config; - } -if (pdata->has_mailbox) { - glue->control_otghs =omap_get_control_dev (); -if (IS_ERR (glue->control_otghs)) { -dev_vdbg (&pdev->dev,"Failed to get control device\n" ); - ret =PTR_ERR (glue->control_otghs); - goto err2; + control_node =of_parse_phandle (np,"ctrl-module" ,0 ); +if (control_node) { + control_pdev =of_find_device_by_node (control_node); +if (!control_pdev) { +dev_err (&pdev->dev,"Failed to get control device\n" ); + ret = -EINVAL ; + goto err2; + } + glue->control_otghs = &control_pdev->dev; } - }else { - glue->control_otghs =ERR_PTR (-ENODEV ); } pdata->platform_ops = &omap2430_ops;
include/linux/usb/musb.h +0 -2
@@ -99,8 +99,6 @@ struct musb_hdrc_platform_data {/* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */ u8 mode; - u8 has_mailbox:1; -/* for clk_get() */ const char *clock;
Signature · 1 line
1.7.4.1
PATCH v7 6/10 ARM: dts: omap4: update omap-control-usb nodes
In reply to Roger QuadrosSplit otghs_ctrl and USB2 PHY power-down into separate omap-control-usb nodes. Get rid of "ti,type" property.
Also get rid of "ti,has-mailbox" property from usb_otg_hs node and provide the ctrl-module phandle.
--- arch/arm/boot/dts/omap4.dtsi | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-)
arch/arm/boot/dts/omap4.dtsi +12 -8
@@ -519,7 +519,7 @@ usb2_phy: usb2phy at 4a0ad080 { compatible = "ti,omap-usb2"; reg = <0x4a0ad080 0x58>; - ctrl-module = <&omap_control_usb>; + ctrl-module = <&omap_control_usb2phy>; }; };
@@ -643,12 +643,16 @@ }; }; - omap_control_usb: omap-control-usb at 4a002300 { - compatible = "ti,omap-control-usb"; - reg = <0x4a002300 0x4>, - <0x4a00233c 0x4>; - reg-names = "control_dev_conf", "otghs_control"; - ti,type = <1>; + omap_control_usb2phy: control-phy at 4a002300 { + compatible = "ti,control-phy-usb2"; + reg = <0x4a002300 0x4>; + reg-names = "power"; + }; + + omap_control_usbotg: control-phy at 4a00233c { + compatible = "ti,control-phy-otghs"; + reg = <0x4a00233c 0x4>; + reg-names = "otghs_control"; }; usb_otg_hs: usb_otg_hs at 4a0ab000 {
@@ -661,7 +665,7 @@ multipoint = <1>; num-eps = <16>; ram-bits = <12>; - ti,has-mailbox; + ctrl-module = <&omap_control_usbotg>; }; }; };
Signature · 1 line
1.7.4.1
PATCH v7 7/10 usb: phy: omap: get rid of omap_get_control_dev()
In reply to Roger QuadrosThis function was preventing us from supporting multiple instances. Get rid of it. Since we support DT boots only, users can get the control device phandle from the DT node.
--- drivers/usb/phy/phy-omap-control.c | 31 ++++++++++--------------------- include/linux/usb/omap_control_usb.h | 5 ----- 2 files changed, 10 insertions(+), 26 deletions(-)
drivers/usb/phy/phy-omap-control.c +10 -21
@@ -26,26 +26,6 @@#include <linux/clk.h> #include <linux/usb/omap_control_usb.h> -static struct omap_control_usb *control_usb; - -/** -* omap_get_control_dev - returns the device pointer for this control device -* -* This API should be called to get the device pointer for this control -* module device. This device pointer should be used for called other -* exported API's in this driver. -* -* To be used by PHY driver and glue driver. -*/ -struct device *omap_get_control_dev (void ) -{ -if (!control_usb) -return ERR_PTR (-ENODEV ); - -return control_usb->dev; -} -EXPORT_SYMBOL_GPL (omap_get_control_dev); -/** * omap_control_usb_phy_power - power on/off the phy using control module reg * @dev: the control module device
@@ -182,11 +162,19 @@ void omap_control_usb_set_mode(struct device *dev, {struct omap_control_usb *ctrl_usb; -if (IS_ERR (dev) || control_usb->type !=OMAP_CTRL_TYPE_OTGHS ) +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);
@@ -237,6 +225,7 @@ 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);
include/linux/usb/omap_control_usb.h +0 -5
@@ -65,15 +65,10 @@ enum omap_control_usb_mode {#define OMAP_CTRL_USB2_PHY_PD BIT(28)#if IS_ENABLED (CONFIG_OMAP_CONTROL_USB ) -extern struct device *omap_get_control_dev (void );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 struct device *omap_get_control_dev (void ) -{ -return ERR_PTR (-ENODEV ); -}static inline void omap_control_usb_phy_power (struct device *dev,int on) {
Signature · 1 line
1.7.4.1
PATCH v7 8/10 ARM: dts: omap5: update omap-control-usb node
In reply to Roger QuadrosSplit USB2 PHY and USB3 PHY into separate omap-control-usb nodes. Get rid of "ti,type" property.
--- arch/arm/boot/dts/omap5.dtsi | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-)
arch/arm/boot/dts/omap5.dtsi +12 -8
@@ -626,12 +626,16 @@ hw-caps-temp-alert; }; - omap_control_usb: omap-control-usb at 4a002300 { - compatible = "ti,omap-control-usb"; - reg = <0x4a002300 0x4>, - <0x4a002370 0x4>; - reg-names = "control_dev_conf", "phy_power_usb"; - ti,type = <2>; + omap_control_usb2phy: control-phy at 4a002300 { + compatible = "ti,control-phy-usb2"; + reg = <0x4a002300 0x4>; + reg-names = "power"; + }; + + omap_control_usb3phy: control-phy at 4a002370 { + compatible = "ti,control-phy-pipe3"; + reg = <0x4a002370 0x4>; + reg-names = "power"; }; omap_dwc3 at 4a020000 {
@@ -661,7 +665,7 @@ usb2_phy: usb2phy at 4a084000 { compatible = "ti,omap-usb2"; reg = <0x4a084000 0x7c>; - ctrl-module = <&omap_control_usb>; + ctrl-module = <&omap_control_usb2phy>; }; usb3_phy: usb3phy at 4a084400 {
@@ -670,7 +674,7 @@ <0x4a084800 0x64>, <0x4a084c00 0x40>; reg-names = "phy_rx", "phy_tx", "pll_ctrl"; - ctrl-module = <&omap_control_usb>; + ctrl-module = <&omap_control_usb3phy>; }; };
Signature · 1 line
1.7.4.1
PATCH v7 9/10 usb: dwc3: omap: manage "usb_otg_ss_refclk960m" clock
In reply to Roger Quadros"usb_otg_ss_refclk960m" is an optional functional clock to the UBS_OTG_SS module. So manage it in the driver.
Also update device tree binding information.
--- Documentation/devicetree/bindings/usb/omap-usb.txt | 4 ++++ drivers/usb/dwc3/dwc3-omap.c | 13 +++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/usb/omap-usb.txt +4 -0
@@ -47,6 +47,8 @@ OMAP DWC3 GLUE - #address-cells, #size-cells : Must be present if the device has sub-nodes - utmi-mode : controls the source of UTMI/PIPE status for VBUS and OTG ID. It should be set to "1" for HW mode and "2" for SW mode. + - clock : should refer to the clock node that provides 960MHz functional clock. + - clock-names : should be "usb_otg_ss_refclk960m" - ranges: the child address space are mapped 1:1 onto the parent address space Optional Properties:
@@ -68,6 +70,8 @@ omap_dwc3 { #address-cells = <1>; #size-cells = <1>; utmi-mode = <2>; + clocks = <&usb_otg_ss1_refclk960m>; + clock-names = "usb_otg_ss_refclk960m"; ranges; };
drivers/usb/dwc3/dwc3-omap.c +13 -0
@@ -32,6 +32,7 @@#include <linux/extcon.h> #include <linux/extcon/of_extcon.h> #include <linux/regulator/consumer.h> +#include <linux/clk.h> #include <linux/usb/otg.h>
@@ -119,6 +120,8 @@#define USBOTGSS_UTMI_OTG_STATUS_SESSVALID (1 << 2)#define USBOTGSS_UTMI_OTG_STATUS_VBUSVALID (1 << 1) +#define USBOTGSS_REFCLK "usb_otg_ss_refclk960m" +struct dwc3_omap {/* device lock */ spinlock_t lock;
@@ -144,6 +147,7 @@ struct dwc3_omap {struct notifier_block id_nb;struct regulator *vbus_reg; +struct clk *refclk; };enum omap_dwc3_vbus_id_status {
@@ -449,6 +453,12 @@ static int dwc3_omap_probe(struct platform_device *pdev) } } + omap->refclk =devm_clk_get (dev,USBOTGSS_REFCLK ); +if (IS_ERR (omap->refclk)) { +dev_err (dev,"couldn't get %s\n" ,USBOTGSS_REFCLK ); +return PTR_ERR (omap->refclk); + } +spin_lock_init (&omap->lock); omap->dev = dev;
@@ -464,6 +474,8 @@ static int dwc3_omap_probe(struct platform_device *pdev) goto err0; } +clk_prepare_enable (omap->refclk); + reg =dwc3_omap_readl (omap->base,USBOTGSS_REVISION ); omap->revision = reg; x_major =USBOTGSS_REVISION_XMAJOR (reg);
@@ -593,6 +605,7 @@ static int dwc3_omap_remove(struct platform_device *pdev)extcon_unregister_interest (&omap->extcon_id_dev);dwc3_omap_disable_irqs (omap);pm_runtime_put_sync (&pdev->dev); +clk_disable_unprepare (omap->refclk);pm_runtime_disable (&pdev->dev);device_for_each_child (&pdev->dev,NULL , dwc3_omap_remove_core);
Signature · 1 line
1.7.4.1
PATCH v7 9/10 usb: dwc3: omap: manage "usb_otg_ss_refclk960m" clock
Hi Felipe,
Quoted 3 lines · Roger Quadros
"
usb_otg_ss_refclk960m" is an optional functional clock to theUBS_OTG_SSmodule. So manage it in the driver.
Just realized that "usb_otg_ss_refclk960m" is in fact functional clock to the PHY and not USB_OTG_SS module. The name is misleading.
So please ignore patch 9 and 10.
cheers,
-roger
Quoted 90 lines
Also update device tree binding information.
Signed-off-by Roger Quadros <[email protected]>--- Documentation/devicetree/bindings/usb/omap-usb.txt | 4 ++++ drivers/usb/dwc3/dwc3-omap.c | 13 +++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-)Documentation/devicetree/bindings/usb/omap-usb.txt +4
-0@@ -47,6 +47,8 @@ OMAP DWC3 GLUE - #address-cells, #size-cells : Must be present if the device has sub-nodes - utmi-mode : controls the source of UTMI/PIPE status for VBUS and OTG ID. It should be set to "1" for HW mode and "2" for SW mode. + - clock : should refer to the clock node that provides 960MHz functional clock. + - clock-names : should be "usb_otg_ss_refclk960m" - ranges: the child address space are mapped 1:1 onto the parent address space Optional Properties:@@ -68,6 +70,8 @@ omap_dwc3 { #address-cells = <1>; #size-cells = <1>; utmi-mode = <2>; + clocks = <&usb_otg_ss1_refclk960m>; + clock-names = "usb_otg_ss_refclk960m"; ranges; };drivers/usb/dwc3/dwc3-omap.c +13
-0@@ -32,6 +32,7 @@#include <linux/extcon.h> #include <linux/extcon/of_extcon.h> #include <linux/regulator/consumer.h> +#include <linux/clk.h> #include <linux/usb/otg.h> @@ -119,6 +120,8 @@#define USBOTGSS_UTMI_OTG_STATUS_SESSVALID (1 << 2)#define USBOTGSS_UTMI_OTG_STATUS_VBUSVALID (1 << 1) +#define USBOTGSS_REFCLK "usb_otg_ss_refclk960m" +struct dwc3_omap {/* device lock */ spinlock_t lock;@@ -144,6 +147,7 @@ struct dwc3_omap {struct notifier_block id_nb;struct regulator *vbus_reg; +struct clk *refclk; };enum omap_dwc3_vbus_id_status {@@ -449,6 +453,12 @@ static int dwc3_omap_probe(struct platform_device *pdev) } } + omap->refclk =devm_clk_get (dev,USBOTGSS_REFCLK ); +if (IS_ERR (omap->refclk)) { +dev_err (dev,"couldn't get %s\n" ,USBOTGSS_REFCLK ); +return PTR_ERR (omap->refclk); + } +spin_lock_init (&omap->lock); omap->dev = dev;@@ -464,6 +474,8 @@ static int dwc3_omap_probe(struct platform_device *pdev) goto err0; } +clk_prepare_enable (omap->refclk); + reg =dwc3_omap_readl (omap->base,USBOTGSS_REVISION ); omap->revision = reg; x_major =USBOTGSS_REVISION_XMAJOR (reg);@@ -593,6 +605,7 @@ static int dwc3_omap_remove(struct platform_device *pdev)extcon_unregister_interest (&omap->extcon_id_dev);dwc3_omap_disable_irqs (omap);pm_runtime_put_sync (&pdev->dev); +clk_disable_unprepare (omap->refclk);pm_runtime_disable (&pdev->dev);device_for_each_child (&pdev->dev,NULL , dwc3_omap_remove_core);
PATCH v7 9/10 usb: dwc3: omap: manage "usb_otg_ss_refclk960m" clock
Quoted 11 lines · Roger Quadros
Hi Felipe,
Quoted 3 lines · Roger Quadros
"
usb_otg_ss_refclk960m" is an optional functional clock to theUBS_OTG_SSmodule. So manage it in the driver.Just realized that "
usb_otg_ss_refclk960m" is in fact functional clock to the PHY and notUSB_OTG_SSmodule. The name is misleading.So please ignore patch 9 and 10.
ignored. All others are fine, right ?
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131002/531ab78c/attachment.sig>
PATCH v7 9/10 usb: dwc3: omap: manage "usb_otg_ss_refclk960m" clock
Quoted 8 lines · Felipe Balbi
Quoted 7 lines · Roger Quadros
Hi Felipe,
Quoted 3 lines · Roger Quadros
"
usb_otg_ss_refclk960m" is an optional functional clock to theUBS_OTG_SSmodule. So manage it in the driver.
Quoted 7 lines
Quoted 4 lines
Just realized that "
usb_otg_ss_refclk960m" is in fact functional clock to the PHY and notUSB_OTG_SSmodule. The name is misleading.So please ignore patch 9 and 10.
ignored. All others are fine, right ?
Yes. But I might have to rebase this on top of Phy framework stuff.
cheers,
-roger
PATCH v7 9/10 usb: dwc3: omap: manage "usb_otg_ss_refclk960m" clock
Hi,
Quoted 9 lines · Roger Quadros
Quoted 8 lines · Felipe Balbi
Quoted 7 lines · Roger Quadros
Hi Felipe,
Quoted 3 lines · Roger Quadros
"
usb_otg_ss_refclk960m" is an optional functional clock to theUBS_OTG_SSmodule. So manage it in the driver.
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Just realized that "
usb_otg_ss_refclk960m" is in fact functional clock to the PHY and notUSB_OTG_SSmodule. The name is misleading.So please ignore patch 9 and 10.
ignored. All others are fine, right ?
Yes. But I might have to rebase this on top of Phy framework stuff.
alright, Greg already took the PHY framework, so maybe we need to just give him my Acked-by and he takes the patches directly as I don't have PYH framework.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131003/987ac52c/attachment.sig>
PATCH v7 9/10 usb: dwc3: omap: manage "usb_otg_ss_refclk960m" clock
Quoted 17 lines · Felipe Balbi
Hi,
Quoted 14 lines · Roger Quadros
Quoted 13 lines · Felipe Balbi
Quoted 11 lines · Roger Quadros
Hi Felipe,
Quoted 3 lines · Roger Quadros
"
usb_otg_ss_refclk960m" is an optional functional clock to theUBS_OTG_SSmodule. So manage it in the driver.Just realized that "
usb_otg_ss_refclk960m" is in fact functional clock to the PHY and notUSB_OTG_SSmodule. The name is misleading.So please ignore patch 9 and 10.
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
ignored. All others are fine, right ?
Yes. But I might have to rebase this on top of Phy framework stuff.
alright, Greg already took the PHY framework, so maybe we need to just give him my Acked-by and he takes the patches directly as I don't have PYH framework.
OK. I'll resend this series to Greg in a while.
cheers,
-roger
Greg KH
maintainerPATCH v7 9/10 usb: dwc3: omap: manage "usb_otg_ss_refclk960m" clock
Quoted 20 lines · Roger Quadros
Quoted 19 lines · Felipe Balbi
Hi,
Quoted 16 lines · Roger Quadros
Quoted 15 lines · Felipe Balbi
Quoted 11 lines · Roger Quadros
Hi Felipe,
Quoted 3 lines · Roger Quadros
"
usb_otg_ss_refclk960m" is an optional functional clock to theUBS_OTG_SSmodule. So manage it in the driver.Just realized that "
usb_otg_ss_refclk960m" is in fact functional clock to the PHY and notUSB_OTG_SSmodule. The name is misleading.So please ignore patch 9 and 10.
ignored. All others are fine, right ?
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
Yes. But I might have to rebase this on top of Phy framework stuff.
alright, Greg already took the PHY framework, so maybe we need to just give him my Acked-by and he takes the patches directly as I don't have PYH framework.
OK. I'll resend this series to Greg in a while.
It looks like you did, but forgot Felipe's ack :(
PATCH v7 9/10 usb: dwc3: omap: manage "usb_otg_ss_refclk960m" clock
Greg,
Quoted 23 lines · Greg KH
Quoted 22 lines · Roger Quadros
Quoted 21 lines · Felipe Balbi
Hi,
Quoted 17 lines · Roger Quadros
Quoted 8 lines · Felipe Balbi
Quoted 7 lines · Roger Quadros
Hi Felipe,
Quoted 3 lines · Roger Quadros
"
usb_otg_ss_refclk960m" is an optional functional clock to theUBS_OTG_SSmodule. So manage it in the driver.Quoted 7 lines
Quoted 4 lines
Just realized that "
usb_otg_ss_refclk960m" is in fact functional clock to the PHY and notUSB_OTG_SSmodule. The name is misleading.So please ignore patch 9 and 10.
ignored. All others are fine, right ?
Yes. But I might have to rebase this on top of Phy framework stuff.
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
alright, Greg already took the PHY framework, so maybe we need to just give him my Acked-by and he takes the patches directly as I don't have PYH framework.
OK. I'll resend this series to Greg in a while.
It looks like you did, but forgot Felipe's ack :(
I was under the impression that Felipe will explicitly give his Ack there. Should I resend with his Acked-bys?
cheers,
-roger
Greg KH
maintainerPATCH v7 9/10 usb: dwc3: omap: manage "usb_otg_ss_refclk960m" clock
Quoted 30 lines · Roger Quadros
Greg,
Quoted 27 lines · Greg KH
Quoted 26 lines · Roger Quadros
Quoted 25 lines · Felipe Balbi
Hi,
Quoted 9 lines · Roger Quadros
Quoted 8 lines · Felipe Balbi
Quoted 7 lines · Roger Quadros
Hi Felipe,
Quoted 3 lines · Roger Quadros
"
usb_otg_ss_refclk960m" is an optional functional clock to theUBS_OTG_SSmodule. So manage it in the driver.Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Just realized that "
usb_otg_ss_refclk960m" is in fact functional clock to the PHY and notUSB_OTG_SSmodule. The name is misleading.So please ignore patch 9 and 10.
ignored. All others are fine, right ?
Yes. But I might have to rebase this on top of Phy framework stuff.
alright, Greg already took the PHY framework, so maybe we need to just give him my Acked-by and he takes the patches directly as I don't have PYH framework.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
OK. I'll resend this series to Greg in a while.
It looks like you did, but forgot Felipe's ack :(
I was under the impression that Felipe will explicitly give his Ack there. Should I resend with his Acked-bys?
No need, I took the patches yesterday, you should have seen the automated emails, right?
greg k-h
PATCH v7 9/10 usb: dwc3: omap: manage "usb_otg_ss_refclk960m" clock
Quoted 33 lines · Greg KH
Quoted 32 lines · Roger Quadros
Greg,
Quoted 29 lines · Greg KH
Quoted 27 lines · Roger Quadros
Quoted 17 lines · Felipe Balbi
Hi,
Quoted 14 lines · Roger Quadros
Quoted 13 lines · Felipe Balbi
Quoted 11 lines · Roger Quadros
Hi Felipe,
Quoted 3 lines · Roger Quadros
"
usb_otg_ss_refclk960m" is an optional functional clock to theUBS_OTG_SSmodule. So manage it in the driver.Just realized that "
usb_otg_ss_refclk960m" is in fact functional clock to the PHY and notUSB_OTG_SSmodule. The name is misleading.So please ignore patch 9 and 10.
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
ignored. All others are fine, right ?
Yes. But I might have to rebase this on top of Phy framework stuff.
alright, Greg already took the PHY framework, so maybe we need to just give him my Acked-by and he takes the patches directly as I don't have PYH framework.
OK. I'll resend this series to Greg in a while.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
It looks like you did, but forgot Felipe's ack :(
I was under the impression that Felipe will explicitly give his Ack there. Should I resend with his Acked-bys?
No need, I took the patches yesterday, you should have seen the automated emails, right?
Thanks. Yes, I got the automated e-mails.
cheers,
-roger
PATCH v7 10/10 usb: phy: omap-usb2: Manage phy clock and not otg controller clock
In reply to Roger QuadrosThe OTG_SS controller driver manages the OTG_SS clock. The phy driver needs to manage the PHY's functional clock. So correct the clock name.
--- drivers/usb/phy/phy-omap-usb2.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/phy/phy-omap-usb2.c +2 -2
@@ -179,9 +179,9 @@ static int omap_usb2_probe(struct platform_device *pdev) }clk_prepare (phy->wkupclk); - phy->optclk =devm_clk_get (phy->dev,"usb_otg_ss_refclk960m" ); + phy->optclk =devm_clk_get (phy->dev,"usb_phy_refclk960m" );if (IS_ERR (phy->optclk)) -dev_vdbg (&pdev->dev,"unable to get refclk960m\n" ); +dev_dbg (&pdev->dev,"unable to get refclk960m\n" );else clk_prepare (phy->optclk);
Signature · 1 line
1.7.4.1