From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:00:20
phy-omap-control driver was added when there was no proper
infrastructure for doing control module initializations.
Now with SYSCON framework being added to the kernel, phy-omap-control
shouldn't be needed.
This series is about adapting phy-omap-usb2, phy-ti-pipe3 and omap2430
to use SYSCON framework instead of phy-omap-control.
However we can't remove the phy-omap-control driver altogether since
that will break older dtbs.
Performed USB enumeration testing in DRA72-EVM, AM43XX-EVM, OMAP5-uEVM
and OMAP4 PANDA.
Performed SATA enumeration testing in DRA72-EVM and OMAP5-uEVM
Performed PCIe enumeration testing in DRA72-EVM.
This patch series is developed on top of Linux 4.1-rc8 +
http://lkml.iu.edu/hypermail/linux/kernel/1505.1/03099.html
Kishon Vijay Abraham I (17):
phy: ti-pipe3: use ti_pipe3_power_off to power off the PHY during
probe
phy: ti-pipe3: use *syscon* framework to power on/off the PHY
phy: ti-pipe3: use *syscon* framework to set PCS value of the PHY
phy: omap-usb2: use omap_usb_power_off to power off the PHY during
probe
phy: omap-usb2: Add a new compatible string for USB2 PHY2
phy: omap-usb2: use *syscon* framework to power on/off the PHY
usb: musb: omap2430: use *syscon* framework to write to mailbox
register
ARM: dts: dra7: Add dt node for the sycon pcie
ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in
SATA PHY node
ARM: dts: dra7: Use "syscon-phy-power" and "syscon-pcs" in PCIe PHY
node
ARM: dts: dra7: Use "ti,dra7x-usb2-phy2" compatible string for USB2
PHY2
ARM: dts: dra7: Use "syscon-phy-power" instead of "ctrl-module" in
USB PHY node
ARM: dts: am4372: Use "syscon-phy-power" instead of "ctrl-module" in
USB PHY node
ARM: dts: OMAP5: Use "syscon-phy-power" instead of "ctrl-module" in
USB PHY node
ARM: dts: OMAP5: Use "syscon-phy-power" instead of "ctrl-module" in
SATA PHY node
ARM: dts: omap4: Use "syscon-phy-power" instead of "ctrl-module" in
USB PHY node
ARM: dts: omap4: Use "syscon-otghs" instead of "ctrl-module" in USB
node
Documentation/devicetree/bindings/phy/ti-phy.txt | 20 +++-
Documentation/devicetree/bindings/usb/omap-usb.txt | 7 +-
arch/arm/boot/dts/am4372.dtsi | 16 +--
arch/arm/boot/dts/dra7.dtsi | 69 +++--------
arch/arm/boot/dts/omap4.dtsi | 16 +--
arch/arm/boot/dts/omap5.dtsi | 26 +---
drivers/phy/phy-omap-usb2.c | 112 +++++++++++++++---
drivers/phy/phy-ti-pipe3.c | 125 +++++++++++++++++---
drivers/usb/musb/omap2430.c | 118 ++++++++++++++----
include/linux/phy/omap_usb.h | 18 +++
10 files changed, 365 insertions(+), 162 deletions(-)
--
1.7.9.5
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:00:28
The USB2 PHY2 has a different register map compared to USB2 PHY1
to power on/off the PHY. In order to handle it, add a new
"compatible" string.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 2 ++
drivers/phy/phy-omap-usb2.c | 9 +++++++++
2 files changed, 11 insertions(+)
@@ -31,6 +31,8 @@ OMAP USB2 PHY Required properties: - compatible: Should be "ti,omap-usb2"+ Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY+ in DRA7x - reg : Address and length of the register set for the device. - #phy-cells: determine the number of cells that should be given in the phandle while referencing this phy.
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:00:34
Deprecate using phy-omap-control driver to set PCS value of the PHY
and start using *syscon* framework to do the same.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 2 ++
drivers/phy/phy-ti-pipe3.c | 32 +++++++++++++++++++++-
2 files changed, 33 insertions(+), 1 deletion(-)
@@ -83,6 +83,8 @@ Optional properties: - syscon-pllreset: Handle to system control region that contains the CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0 register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.+ - syscon-pcs : phandle/offset pair. Phandle to the system control module and the+ register offset to write the PCS delay value. Deprecated properties: - ctrl-module : phandle of the control module used by PHY driver to power on
@@ -96,9 +99,11 @@ struct ti_pipe3 {structclk*div_clk;structpipe3_dpll_map*dpll_map;structregmap*phy_power_syscon;/* ctrl. reg. acces */+structregmap*pcs_syscon;/* ctrl. reg. acces */structregmap*dpll_reset_syscon;/* ctrl. reg. acces */unsignedintdpll_reset_reg;/* reg. index within syscon */unsignedintpower_reg;/* power reg. index within syscon */+unsignedintpcie_pcs_reg;/* pcs reg. index in syscon */boolsata_refclk_enabled;};
@@ -271,7 +276,16 @@ static int ti_pipe3_init(struct phy *x)*18-1804.*/if(of_device_is_compatible(phy->dev->of_node,"ti,phy-pipe3-pcie")){-omap_control_pcie_pcs(phy->control_dev,0x96);+if(phy->pcs_syscon){+val=0x96<<OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;+ret=regmap_update_bits(phy->pcs_syscon,+phy->pcie_pcs_reg,+PCIE_PCS_MASK,val);+if(ret<0)+returnret;+}else{+omap_control_pcie_pcs(phy->control_dev,0x96);+}return0;}
@@ -455,6 +469,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)dev_err(&pdev->dev,"unable to get div-clk\n");returnPTR_ERR(phy->div_clk);}++phy->pcs_syscon=syscon_regmap_lookup_by_phandle(node,+"syscon-pcs");+if(IS_ERR(phy->pcs_syscon)){+dev_dbg(&pdev->dev,+"can't get syscon-pcs, using omap control\n");+phy->pcs_syscon=NULL;+}else{+if(of_property_read_u32_index(node,+"syscon-pcs",1,+&phy->pcie_pcs_reg)){+dev_err(&pdev->dev,+"couldn't get pcie pcs reg. offset\n");+return-EINVAL;+}+}}else{phy->div_clk=ERR_PTR(-ENODEV);}
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:00:42
Deprecate using phy-omap-control driver to power on/off the PHY,
and use *syscon* framework to do the same. This handles
powering on/off the PHY for the USB2 PHYs used in various TI SoCs.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 6 +-
drivers/phy/phy-omap-usb2.c | 101 ++++++++++++++++++----
include/linux/phy/omap_usb.h | 18 ++++
3 files changed, 107 insertions(+), 18 deletions(-)
@@ -42,10 +42,14 @@ Required properties: * "wkupclk" - wakeup clock. * "refclk" - reference clock (optional).-Optional properties:+Deprecated properties: - ctrl-module : phandle of the control module used by PHY driver to power on the PHY.+Recommended properies:+- syscon-phy-power : phandle/offset pair. Phandle to the system control+ module and the register offset to power on/off the PHY.+ This is usually a subnode of ocp2scp to which it is connected. usb2phy@4a0ad080 {
@@ -97,22 +99,65 @@ static int omap_usb_set_peripheral(struct usb_otg *otg,return0;}-staticintomap_usb_power_off(structphy*x)+staticintomap_usb_phy_power(structomap_usb*phy,inton){-structomap_usb*phy=phy_get_drvdata(x);+u32val=0;+u32mask;+intret;-omap_control_phy_power(phy->control_dev,0);+if(phy->syscon_phy_power){+switch(phy->type){+caseTYPE_USB2:+mask=OMAP_DEV_PHY_PD;+if(!on)+val=OMAP_DEV_PHY_PD;+break;+caseTYPE_DRA7USB2:+mask=OMAP_USB2_PHY_PD;+if(!on)+val=OMAP_USB2_PHY_PD;+break;+caseTYPE_AM437USB2:+mask=AM437X_USB2_PHY_PD|+AM437X_USB2_OTG_PD|+AM437X_USB2_OTGVDET_EN|+AM437X_USB2_OTGSESSEND_EN;+if(on){+val=AM437X_USB2_OTGVDET_EN|+AM437X_USB2_OTGSESSEND_EN;+}else{+val=AM437X_USB2_PHY_PD|AM437X_USB2_OTG_PD;+}+break;+default:+dev_err(phy->dev,"%s: type %d not recognized\n",+__func__,phy->type);+return-EINVAL;+}++ret=regmap_update_bits(phy->syscon_phy_power,phy->power_reg,+mask,val);+if(ret<0)+returnret;+}else{+omap_control_phy_power(phy->control_dev,on);+}return0;}-staticintomap_usb_power_on(structphy*x)+staticintomap_usb_power_off(structphy*x){structomap_usb*phy=phy_get_drvdata(x);-omap_control_phy_power(phy->control_dev,1);+returnomap_usb_phy_power(phy,false);+}-return0;+staticintomap_usb_power_on(structphy*x)+{+structomap_usb*phy=phy_get_drvdata(x);++returnomap_usb_phy_power(phy,true);}staticintomap_usb_init(structphy*x)
@@ -223,6 +273,7 @@ static int omap_usb2_probe(struct platform_device *pdev)return-ENOMEM;phy->dev=&pdev->dev;+phy->type=phy_data->type;phy->phy.dev=phy->dev;phy->phy.label=phy_data->label;
@@ -237,20 +288,36 @@ static int omap_usb2_probe(struct platform_device *pdev)phy->flags|=OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;}-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;-}+phy->syscon_phy_power=syscon_regmap_lookup_by_phandle(node,+"syscon-phy-power");+if(IS_ERR(phy->syscon_phy_power)){+dev_info(&pdev->dev,+"can't get syscon-phy-power, using control device\n");+phy->syscon_phy_power=NULL;++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;+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;+}else{+if(of_property_read_u32_index(node,+"syscon-phy-power",1,+&phy->power_reg)){+dev_err(&pdev->dev,+"couldn't get power reg. offset\n");+return-EINVAL;+}}-phy->control_dev=&control_pdev->dev;-otg->set_host=omap_usb_set_host;otg->set_peripheral=omap_usb_set_peripheral;if(phy_data->flags&OMAP_USB2_HAS_SET_VBUS)
@@ -30,6 +30,12 @@ struct usb_dpll_params {u32mf;};+enumomap_usb_phy_type{+TYPE_USB2,/* USB2_PHY, power down in CONTROL_DEV_CONF */+TYPE_DRA7USB2,/* USB2 PHY, power and power_aux e.g. DRA7 */+TYPE_AM437USB2,/* USB2 PHY, power e.g. AM437x */+};+structomap_usb{structusb_phyphy;structphy_companion*comparator;
@@ -40,11 +46,15 @@ struct omap_usb {structclk*wkupclk;structclk*optclk;u8flags;+enumomap_usb_phy_typetype;+structregmap*syscon_phy_power;/* ctrl. reg. acces */+unsignedintpower_reg;/* power reg. index within syscon */};structusb_phy_data{constchar*label;u8flags;+enumomap_usb_phy_typetype;};/* Driver Flags */
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:00:52
Add new device tree node for the control module register space where
PCIe registers are present.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/dra7.dtsi | 5 +++++
1 file changed, 5 insertions(+)
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:01:00
Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from SATA PHY node. Since "omap_control_sata" note is no longer
used, remove it.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/dra7.dtsi | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:01:10
Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from USB PHY devicetree nodes.
Since "omap_control_usb2phy1", "omap_control_usb3phy1" and
"omap_control_usb2phy2" devicetree nodes are no longer used, remove it.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/dra7.dtsi | 24 +++---------------------
1 file changed, 3 insertions(+), 21 deletions(-)
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:01:19
Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from USB PHY device tree node.
Since "am43xx_control_usb2phy1" and "am43xx_control_usb2phy2"
devicetree nodes are no longer used, remove it.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/am4372.dtsi | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:01:30
Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from USB PHY devicetree node.
Since "omap_control_usb2phy" and "omap_control_usb3phy" devicetree nodes
are no longer used, remove it.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/omap5.dtsi | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:01:35
Add "syscon-otghs" property and remove the deprecated "ctrl-module"
property from MUSB devicetree node.
Since "omap_control_usbotg" devicetree node is no longer used, remove
it.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/omap4.dtsi | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:01:41
Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from SATA PHY node.
Since "omap_control_sata" devicetree node is no longer used, remove it.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/omap5.dtsi | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:02:59
Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from USB PHY dt node.
Since "omap_control_usb2phy" devicetree node is no longer used,
remove it.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/omap4.dtsi | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:03:38
The USB2 PHY2 has a different register map compared to USB2 PHY1
to power on/off the PHY. In order to handle it, use the new compatible
string "ti,dra7x-usb2-phy2" for the second instance of USB2 PHY.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/dra7.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:04:09
Add "syscon-phy-power" property and "syscon-pcs" property which can
be used to perform the control module initializations and remove
the deprecated "ctrl-module" property from PCIe PHY dt nodes.
Phandle to "sysclk" clock node is also added to the PCIe PHY node
since some of the syscon initializations is based on system clock
frequency.
Since "omap_control_pcie1phy" and "omap_control_pcie2phy" devicetree
nodes are no longer used, remove it.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/dra7.dtsi | 28 +++++++---------------------
1 file changed, 7 insertions(+), 21 deletions(-)
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:04:34
Deprecate using phy-omap-control driver to write to the mailbox register
and start using *syscon* framework to do the same.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
Documentation/devicetree/bindings/usb/omap-usb.txt | 7 +-
drivers/usb/musb/omap2430.c | 118 ++++++++++++++++----
2 files changed, 102 insertions(+), 23 deletions(-)
@@ -20,10 +20,15 @@ OMAP MUSB GLUE - phy-names : the names of the PHY corresponding to the PHYs present in the *phy* phandle.-Optional properties:+Optional Properties:+Deprecated properties: - ctrl-module : phandle of the control module this glue uses to write to mailbox+Recommended properies:+ - syscon-otghs : phandle/offset pair. Phandle to the system control module and the+ register offset of the mailbox.+ SOC specific device node entry usb_otg_hs: usb_otg_hs@4a0ab000 { compatible = "ti,omap4-musb";
@@ -253,6 +264,47 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status)}EXPORT_SYMBOL_GPL(omap_musb_mailbox);+staticvoidomap2430_musb_set_usbmode(structomap2430_glue*glue,+enumomap_control_usb_modemode)+{+u32val;+intret;++if(glue->syscon_otghs){+switch(mode){+caseUSB_MODE_HOST:+val=OMAP2430_MUSB_AVALID|OMAP2430_MUSB_VBUSVALID;+break;++caseUSB_MODE_DEVICE:+val=OMAP2430_MUSB_IDDIG|OMAP2430_MUSB_AVALID|+OMAP2430_MUSB_VBUSVALID;+break;++caseUSB_MODE_DISCONNECT:+val=OMAP2430_MUSB_IDDIG|OMAP2430_MUSB_SESSEND;+break;++default:+dev_dbg(glue->dev,"Invalid mode\n");+gotoerr_regmap_update;+}++ret=regmap_update_bits(glue->syscon_otghs,+glue->otghs_reg,+OMAP2430_MUSB_MODE_MASK,val);+if(ret<0)+gotoerr_regmap_update;+}else{+omap_control_usb_set_mode(glue->control_otghs,mode);+}++return;++err_regmap_update:+dev_err(glue->dev,"Failed to set mode to %d\n",mode);+}+staticvoidomap_musb_set_mailbox(structomap2430_glue*glue){structmusb*musb=glue_to_musb(glue);
@@ -507,6 +556,40 @@ static const struct musb_platform_ops omap2430_ops = {staticu64omap2430_dmamask=DMA_BIT_MASK(32);+staticintomap2430_get_control(structomap2430_glue*glue,+structdevice_node*np)+{+structdevice_node*control_node;+structplatform_device*control_pdev;++glue->syscon_otghs=syscon_regmap_lookup_by_phandle(np,+"syscon-otghs");+if(IS_ERR(glue->syscon_otghs)){+dev_info(glue->dev,"can't get syscon, using control device\n");+glue->syscon_otghs=NULL;++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(glue->dev,+"Failed to get control device\n");+return-EINVAL;+}+glue->control_otghs=&control_pdev->dev;+}+}else{+if(of_property_read_u32_index(np,"syscon-otghs",1,+&glue->otghs_reg)){+dev_err(glue->dev,+"couldn't get otghs reg. offset\n");+return-EINVAL;+}+}++return0;+}+staticintomap2430_probe(structplatform_device*pdev){structresourcemusb_resources[3];
@@ -538,9 +621,6 @@ static int omap2430_probe(struct platform_device *pdev)glue->control_otghs=ERR_PTR(-ENODEV);if(np){-structdevice_node*control_node;-structplatform_device*control_pdev;-pdata=devm_kzalloc(&pdev->dev,sizeof(*pdata),GFP_KERNEL);if(!pdata)gotoerr2;
@@ -567,16 +647,10 @@ static int omap2430_probe(struct platform_device *pdev)pdata->board_data=data;pdata->config=config;-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;-gotoerr2;-}-glue->control_otghs=&control_pdev->dev;-}+ret=omap2430_get_control(glue,np);+if(ret)+gotoerr2;+}pdata->platform_ops=&omap2430_ops;
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:05:37
Deprecate using phy-omap-control driver to power on/off the PHY and
use *syscon* framework to do the same.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 10 ++-
drivers/phy/phy-ti-pipe3.c | 91 ++++++++++++++++++----
2 files changed, 86 insertions(+), 15 deletions(-)
@@ -77,8 +77,6 @@ Required properties: * "div-clk" - apll clock Optional properties:- - ctrl-module : phandle of the control module used by PHY driver to power on- the PHY. - id: If there are multiple instance of the same type, in order to differentiate between each instance "id" can be used (e.g., multi-lane PCIe PHY). If "id" is not provided, it is set to default value of '1'.
@@ -86,6 +84,14 @@ Optional properties: CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0 register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.+Deprecated properties:+ - ctrl-module : phandle of the control module used by PHY driver to power on+ the PHY.++Recommended properies:+ - syscon-phy-power : phandle/offset pair. Phandle to the system control+ module and the register offset to power on/off the PHY.+ This is usually a subnode of ocp2scp to which it is connected. usb3phy@4a084400 {
@@ -417,19 +459,42 @@ static int ti_pipe3_probe(struct platform_device *pdev)phy->div_clk=ERR_PTR(-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;-}+phy->phy_power_syscon=syscon_regmap_lookup_by_phandle(node,+"syscon-phy-power");+if(IS_ERR(phy->phy_power_syscon)){+dev_info(&pdev->dev,+"can't get syscon-phy-power, using control device\n");+phy->phy_power_syscon=NULL;++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;-}+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->control_dev=&control_pdev->dev;+}else{+phy->sys_clk=devm_clk_get(phy->dev,"sysclk");+if(IS_ERR(phy->sys_clk)){+dev_err(&pdev->dev,"unable to get sysclk\n");+return-EINVAL;+}++if(of_property_read_u32_index(node,+"syscon-phy-power",1,+&phy->power_reg)){+dev_err(&pdev->dev,+"couldn't get power reg. offset\n");+return-EINVAL;+}+}platform_set_drvdata(pdev,phy);pm_runtime_enable(phy->dev);
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:05:39
No functional change. Previously omap_control_phy_power() was used to power
off the PHY during probe. But once phy-omap-usb2 driver is adapted to
use syscon, omap_control_phy_power() cannot be used. Hence used
omap_usb_power_off to power off the PHY.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
drivers/phy/phy-omap-usb2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-23 12:06:29
No functional change. Previously omap_control_phy_power() was used to power
off the PHY during probe. But once PIPE3 driver is adapted to use syscon,
omap_control_phy_power() cannot be used. Hence used ti_pipe3_power_off
to power off the PHY.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
drivers/phy/phy-ti-pipe3.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Roger Quadros <hidden> Date: 2015-06-23 14:48:41
On Tue, 23 Jun 2015 17:28:46 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
No functional change. Previously omap_control_phy_power() was used to power
off the PHY during probe. But once PIPE3 driver is adapted to use syscon,
omap_control_phy_power() cannot be used. Hence used ti_pipe3_power_off
to power off the PHY.
Signed-off-by: Kishon Vijay Abraham I <redacted>
From: Roger Quadros <hidden> Date: 2015-06-23 14:55:05
Hi Kishon,
On Tue, 23 Jun 2015 17:28:47 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted hunk
Deprecate using phy-omap-control driver to power on/off the PHY and
use *syscon* framework to do the same.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 10 ++-
drivers/phy/phy-ti-pipe3.c | 91 ++++++++++++++++++----
2 files changed, 86 insertions(+), 15 deletions(-)
@@ -77,8 +77,6 @@ Required properties: * "div-clk" - apll clock Optional properties:- - ctrl-module : phandle of the control module used by PHY driver to power on- the PHY. - id: If there are multiple instance of the same type, in order to differentiate between each instance "id" can be used (e.g., multi-lane PCIe PHY). If "id" is not provided, it is set to default value of '1'.
@@ -86,6 +84,14 @@ Optional properties: CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0 register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.+Deprecated properties:+ - ctrl-module : phandle of the control module used by PHY driver to power on+ the PHY.++Recommended properies:+ - syscon-phy-power : phandle/offset pair. Phandle to the system control+ module and the register offset to power on/off the PHY.+ This is usually a subnode of ocp2scp to which it is connected. usb3phy@4a084400 {
@@ -417,19 +459,42 @@ static int ti_pipe3_probe(struct platform_device *pdev) phy->div_clk = ERR_PTR(-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;- }+ phy->phy_power_syscon = syscon_regmap_lookup_by_phandle(node,+ "syscon-phy-power");+ if (IS_ERR(phy->phy_power_syscon)) {+ dev_info(&pdev->dev,+ "can't get syscon-phy-power, using control device\n");
dev_dbg()? as we don't want to annoy old DT users?
+ phy->phy_power_syscon = NULL;
+
+ 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;
- }
+ 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->control_dev = &control_pdev->dev;
+ } else {
+ phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
+ if (IS_ERR(phy->sys_clk)) {
+ dev_err(&pdev->dev, "unable to get sysclk\n");
+ return -EINVAL;
+ }
we're already doing this at another place in pipe3_probe. Let's do it at one place.
+
+ if (of_property_read_u32_index(node,
+ "syscon-phy-power", 1,
+ &phy->power_reg)) {
+ dev_err(&pdev->dev,
+ "couldn't get power reg. offset\n");
+ return -EINVAL;
+ }
+ }
platform_set_drvdata(pdev, phy);
pm_runtime_enable(phy->dev);
--
1.7.9.5
cheers,
-roger
--
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
From: Roger Quadros <hidden> Date: 2015-06-24 10:36:10
On Tue, 23 Jun 2015 17:28:48 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted hunk
Deprecate using phy-omap-control driver to set PCS value of the PHY
and start using *syscon* framework to do the same.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 2 ++
drivers/phy/phy-ti-pipe3.c | 32 +++++++++++++++++++++-
2 files changed, 33 insertions(+), 1 deletion(-)
@@ -83,6 +83,8 @@ Optional properties: - syscon-pllreset: Handle to system control region that contains the CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0 register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.+ - syscon-pcs : phandle/offset pair. Phandle to the system control module and the+ register offset to write the PCS delay value.
What is PCS?
Is this valid only for PCIe? If yes we could mention it here.
quoted hunk
Deprecated properties:
- ctrl-module : phandle of the control module used by PHY driver to power on
@@ -96,9 +99,11 @@ struct ti_pipe3 {structclk*div_clk;structpipe3_dpll_map*dpll_map;structregmap*phy_power_syscon;/* ctrl. reg. acces */+structregmap*pcs_syscon;/* ctrl. reg. acces */structregmap*dpll_reset_syscon;/* ctrl. reg. acces */unsignedintdpll_reset_reg;/* reg. index within syscon */unsignedintpower_reg;/* power reg. index within syscon */+unsignedintpcie_pcs_reg;/* pcs reg. index in syscon */boolsata_refclk_enabled;};
@@ -271,7 +276,16 @@ static int ti_pipe3_init(struct phy *x)*18-1804.*/if(of_device_is_compatible(phy->dev->of_node,"ti,phy-pipe3-pcie")){-omap_control_pcie_pcs(phy->control_dev,0x96);+if(phy->pcs_syscon){+val=0x96<<OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;+ret=regmap_update_bits(phy->pcs_syscon,+phy->pcie_pcs_reg,+PCIE_PCS_MASK,val);+if(ret<0)+returnret;+}else{+omap_control_pcie_pcs(phy->control_dev,0x96);+}return0;}
@@ -455,6 +469,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)dev_err(&pdev->dev,"unable to get div-clk\n");returnPTR_ERR(phy->div_clk);}++phy->pcs_syscon=syscon_regmap_lookup_by_phandle(node,+"syscon-pcs");+if(IS_ERR(phy->pcs_syscon)){+dev_dbg(&pdev->dev,+"can't get syscon-pcs, using omap control\n");+phy->pcs_syscon=NULL;+}else{+if(of_property_read_u32_index(node,+"syscon-pcs",1,+&phy->pcie_pcs_reg)){+dev_err(&pdev->dev,+"couldn't get pcie pcs reg. offset\n");+return-EINVAL;+}+}}else{phy->div_clk=ERR_PTR(-ENODEV);}
--
1.7.9.5
Other than that,
Acked-by: Roger Quadros <redacted>
cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
We should still keep a separate entry for the phy in the dtsi
files. And the phy should be a child of the scm_conf area in the
dtsi file.
This is because the scm and usb_otg_hs are separate devices and
can be clocked separately. So the phy driver needs to be a
separate driver to avoid spaghetti code and issues with clocking.
Regards,
Tony
--
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
From: Roger Quadros <hidden> Date: 2015-06-24 10:59:20
On Tue, 23 Jun 2015 17:28:49 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
No functional change. Previously omap_control_phy_power() was used to power
off the PHY during probe. But once phy-omap-usb2 driver is adapted to
use syscon, omap_control_phy_power() cannot be used. Hence used
omap_usb_power_off to power off the PHY.
Signed-off-by: Kishon Vijay Abraham I <redacted>
@@ -241,7 +241,6 @@ static int omap_usb2_probe(struct platform_device *pdev)}phy->control_dev=&control_pdev->dev;-omap_control_phy_power(phy->control_dev,0);otg->set_host=omap_usb_set_host;otg->set_peripheral=omap_usb_set_peripheral;
@@ -261,6 +260,7 @@ static int omap_usb2_probe(struct platform_device *pdev)}phy_set_drvdata(generic_phy,phy);+omap_usb_power_off(generic_phy);phy_provider=devm_of_phy_provider_register(phy->dev,of_phy_simple_xlate);
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Roger Quadros <hidden> Date: 2015-06-24 11:04:59
On Tue, 23 Jun 2015 17:28:50 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted hunk
The USB2 PHY2 has a different register map compared to USB2 PHY1
to power on/off the PHY. In order to handle it, add a new
"compatible" string.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 2 ++
drivers/phy/phy-omap-usb2.c | 9 +++++++++
2 files changed, 11 insertions(+)
@@ -31,6 +31,8 @@ OMAP USB2 PHY Required properties: - compatible: Should be "ti,omap-usb2"+ Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY+ in DRA7x - reg : Address and length of the register set for the device. - #phy-cells: determine the number of cells that should be given in the phandle while referencing this phy.
We should still keep a separate entry for the phy in the dtsi
files. And the phy should be a child of the scm_conf area in the
dtsi file.
This is because the scm and usb_otg_hs are separate devices and
can be clocked separately. So the phy driver needs to be a
separate driver to avoid spaghetti code and issues with clocking.
AFAIK SCM is clocked by L4CFG_L4_GICLK which is either free running or is
managed automatically by the HW i.e gated when there is no access to the
CTRL_MODULE_CORE registers.
Having a separate control-PHY driver only to do a regmap update to SCM is
unnecessary IMHO.
Thanks
Kishon
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-24 11:27:35
Hi,
On Tuesday 23 June 2015 08:23 PM, Roger Quadros wrote:
Hi Kishon,
On Tue, 23 Jun 2015 17:28:47 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted
Deprecate using phy-omap-control driver to power on/off the PHY and
use *syscon* framework to do the same.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 10 ++-
drivers/phy/phy-ti-pipe3.c | 91 ++++++++++++++++++----
2 files changed, 86 insertions(+), 15 deletions(-)
@@ -77,8 +77,6 @@ Required properties: * "div-clk" - apll clock Optional properties:- - ctrl-module : phandle of the control module used by PHY driver to power on- the PHY. - id: If there are multiple instance of the same type, in order to differentiate between each instance "id" can be used (e.g., multi-lane PCIe PHY). If "id" is not provided, it is set to default value of '1'.
@@ -86,6 +84,14 @@ Optional properties: CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0 register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.+Deprecated properties:+ - ctrl-module : phandle of the control module used by PHY driver to power on+ the PHY.++Recommended properies:+ - syscon-phy-power : phandle/offset pair. Phandle to the system control+ module and the register offset to power on/off the PHY.+ This is usually a subnode of ocp2scp to which it is connected. usb3phy@4a084400 {
@@ -417,19 +459,42 @@ static int ti_pipe3_probe(struct platform_device *pdev) phy->div_clk = ERR_PTR(-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;- }+ phy->phy_power_syscon = syscon_regmap_lookup_by_phandle(node,+ "syscon-phy-power");+ if (IS_ERR(phy->phy_power_syscon)) {+ dev_info(&pdev->dev,+ "can't get syscon-phy-power, using control device\n");
dev_dbg()? as we don't want to annoy old DT users?
okay.
quoted
+ phy->phy_power_syscon = NULL;
+
+ 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;
- }
+ 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->control_dev = &control_pdev->dev;
+ } else {
+ phy->sys_clk = devm_clk_get(phy->dev, "sysclk");
+ if (IS_ERR(phy->sys_clk)) {
+ dev_err(&pdev->dev, "unable to get sysclk\n");
+ return -EINVAL;
+ }
we're already doing this at another place in pipe3_probe. Let's do it at one place.
right, this can be improved.
Thanks
Kishon
--
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
From: Roger Quadros <hidden> Date: 2015-06-24 11:35:06
On Tue, 23 Jun 2015 17:28:51 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted hunk
Deprecate using phy-omap-control driver to power on/off the PHY,
and use *syscon* framework to do the same. This handles
powering on/off the PHY for the USB2 PHYs used in various TI SoCs.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 6 +-
drivers/phy/phy-omap-usb2.c | 101 ++++++++++++++++++----
include/linux/phy/omap_usb.h | 18 ++++
3 files changed, 107 insertions(+), 18 deletions(-)
@@ -42,10 +42,14 @@ Required properties: * "wkupclk" - wakeup clock. * "refclk" - reference clock (optional).-Optional properties:+Deprecated properties: - ctrl-module : phandle of the control module used by PHY driver to power on the PHY.+Recommended properies:+- syscon-phy-power : phandle/offset pair. Phandle to the system control+ module and the register offset to power on/off the PHY.+ This is usually a subnode of ocp2scp to which it is connected. usb2phy@4a0ad080 {
@@ -97,22 +99,65 @@ static int omap_usb_set_peripheral(struct usb_otg *otg,return0;}-staticintomap_usb_power_off(structphy*x)+staticintomap_usb_phy_power(structomap_usb*phy,inton){-structomap_usb*phy=phy_get_drvdata(x);+u32val=0;+u32mask;+intret;-omap_control_phy_power(phy->control_dev,0);+if(phy->syscon_phy_power){+switch(phy->type){+caseTYPE_USB2:+mask=OMAP_DEV_PHY_PD;+if(!on)+val=OMAP_DEV_PHY_PD;+break;+caseTYPE_DRA7USB2:+mask=OMAP_USB2_PHY_PD;+if(!on)+val=OMAP_USB2_PHY_PD;+break;+caseTYPE_AM437USB2:+mask=AM437X_USB2_PHY_PD|+AM437X_USB2_OTG_PD|+AM437X_USB2_OTGVDET_EN|+AM437X_USB2_OTGSESSEND_EN;+if(on){+val=AM437X_USB2_OTGVDET_EN|+AM437X_USB2_OTGSESSEND_EN;+}else{+val=AM437X_USB2_PHY_PD|AM437X_USB2_OTG_PD;+}+break;+default:+dev_err(phy->dev,"%s: type %d not recognized\n",+__func__,phy->type);+return-EINVAL;+}++ret=regmap_update_bits(phy->syscon_phy_power,phy->power_reg,+mask,val);+if(ret<0)+returnret;+}else{+omap_control_phy_power(phy->control_dev,on);+}return0;}-staticintomap_usb_power_on(structphy*x)+staticintomap_usb_power_off(structphy*x){structomap_usb*phy=phy_get_drvdata(x);-omap_control_phy_power(phy->control_dev,1);+returnomap_usb_phy_power(phy,false);+}-return0;+staticintomap_usb_power_on(structphy*x)+{+structomap_usb*phy=phy_get_drvdata(x);++returnomap_usb_phy_power(phy,true);}staticintomap_usb_init(structphy*x)
@@ -223,6 +273,7 @@ static int omap_usb2_probe(struct platform_device *pdev)return-ENOMEM;phy->dev=&pdev->dev;+phy->type=phy_data->type;phy->phy.dev=phy->dev;phy->phy.label=phy_data->label;
@@ -237,20 +288,36 @@ static int omap_usb2_probe(struct platform_device *pdev)phy->flags|=OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;}-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;-}+phy->syscon_phy_power=syscon_regmap_lookup_by_phandle(node,+"syscon-phy-power");+if(IS_ERR(phy->syscon_phy_power)){+dev_info(&pdev->dev,+"can't get syscon-phy-power, using control device\n");+phy->syscon_phy_power=NULL;++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;+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;+}else{+if(of_property_read_u32_index(node,+"syscon-phy-power",1,+&phy->power_reg)){+dev_err(&pdev->dev,+"couldn't get power reg. offset\n");+return-EINVAL;+}}-phy->control_dev=&control_pdev->dev;-otg->set_host=omap_usb_set_host;otg->set_peripheral=omap_usb_set_peripheral;if(phy_data->flags&OMAP_USB2_HAS_SET_VBUS)
@@ -30,6 +30,12 @@ struct usb_dpll_params {u32mf;};+enumomap_usb_phy_type{+TYPE_USB2,/* USB2_PHY, power down in CONTROL_DEV_CONF */+TYPE_DRA7USB2,/* USB2 PHY, power and power_aux e.g. DRA7 */+TYPE_AM437USB2,/* USB2 PHY, power e.g. AM437x */+};+structomap_usb{structusb_phyphy;structphy_companion*comparator;
@@ -40,11 +46,15 @@ struct omap_usb {structclk*wkupclk;structclk*optclk;u8flags;+enumomap_usb_phy_typetype;+structregmap*syscon_phy_power;/* ctrl. reg. acces */+unsignedintpower_reg;/* power reg. index within syscon */};structusb_phy_data{constchar*label;u8flags;+enumomap_usb_phy_typetype;};/* Driver Flags */
cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Roger Quadros <hidden> Date: 2015-06-24 11:40:44
On Tue, 23 Jun 2015 17:28:52 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted hunk
Deprecate using phy-omap-control driver to write to the mailbox register
and start using *syscon* framework to do the same.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
Documentation/devicetree/bindings/usb/omap-usb.txt | 7 +-
drivers/usb/musb/omap2430.c | 118 ++++++++++++++++----
2 files changed, 102 insertions(+), 23 deletions(-)
@@ -20,10 +20,15 @@ OMAP MUSB GLUE - phy-names : the names of the PHY corresponding to the PHYs present in the *phy* phandle.-Optional properties:+Optional Properties:+Deprecated properties: - ctrl-module : phandle of the control module this glue uses to write to mailbox+Recommended properies:+ - syscon-otghs : phandle/offset pair. Phandle to the system control module and the+ register offset of the mailbox.+ SOC specific device node entry usb_otg_hs: usb_otg_hs@4a0ab000 { compatible = "ti,omap4-musb";
@@ -253,6 +264,47 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status)}EXPORT_SYMBOL_GPL(omap_musb_mailbox);+staticvoidomap2430_musb_set_usbmode(structomap2430_glue*glue,+enumomap_control_usb_modemode)+{+u32val;+intret;++if(glue->syscon_otghs){+switch(mode){+caseUSB_MODE_HOST:+val=OMAP2430_MUSB_AVALID|OMAP2430_MUSB_VBUSVALID;+break;++caseUSB_MODE_DEVICE:+val=OMAP2430_MUSB_IDDIG|OMAP2430_MUSB_AVALID|+OMAP2430_MUSB_VBUSVALID;+break;++caseUSB_MODE_DISCONNECT:+val=OMAP2430_MUSB_IDDIG|OMAP2430_MUSB_SESSEND;+break;++default:+dev_dbg(glue->dev,"Invalid mode\n");+gotoerr_regmap_update;+}++ret=regmap_update_bits(glue->syscon_otghs,+glue->otghs_reg,+OMAP2430_MUSB_MODE_MASK,val);+if(ret<0)+gotoerr_regmap_update;+}else{+omap_control_usb_set_mode(glue->control_otghs,mode);+}++return;++err_regmap_update:+dev_err(glue->dev,"Failed to set mode to %d\n",mode);+}+staticvoidomap_musb_set_mailbox(structomap2430_glue*glue){structmusb*musb=glue_to_musb(glue);
We should still keep a separate entry for the phy in the dtsi
files. And the phy should be a child of the scm_conf area in the
dtsi file.
This is because the scm and usb_otg_hs are separate devices and
can be clocked separately. So the phy driver needs to be a
separate driver to avoid spaghetti code and issues with clocking.
AFAIK SCM is clocked by L4CFG_L4_GICLK which is either free running or is
managed automatically by the HW i.e gated when there is no access to the
CTRL_MODULE_CORE registers.
The point is they are separate devices on the interconnect. And we
don't want to add dependencies between separate devices. And there
is nothing stopping us from starting to idle the SCM module.
Having a separate control-PHY driver only to do a regmap update to SCM is
unnecessary IMHO.
Not true. The phy driver can be generic and used by multiple platforms.
And the phy driver should be capable of idling the phy separately
independent of the USB module. And the phy driver should be able to
tell the system things like ID pin status, VBUS status and so on.
So to summarize, we are _not_ going to start tinkering with the sycon
registers directly from random device drivers in a separate IO space.
Anything using the syscon registers must implement a driver for some
Linux generic framework such as phy, clock, or regulator framework.
Regards,
Tony
--
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
From: Tony Lindgren <tony@atomide.com> Date: 2015-06-24 11:49:19
* Kishon Vijay Abraham I [off-list ref] [150623 05:02]:
Deprecate using phy-omap-control driver to write to the mailbox register
and start using *syscon* framework to do the same.
All this stuff needs to go to some generic syscon USB phy
driver. Let's not start adding phy specific stuff to a USB
driver.
Regards,
Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Roger Quadros <hidden> Date: 2015-06-24 11:51:15
On Tue, 23 Jun 2015 17:28:53 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted hunk
Add new device tree node for the control module register space where
PCIe registers are present.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/dra7.dtsi | 5 +++++
1 file changed, 5 insertions(+)
cheers,
-roger
--
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
From: Roger Quadros <hidden> Date: 2015-06-24 11:57:17
On Wed, 24 Jun 2015 14:50:17 +0300
Roger Quadros [off-list ref] wrote:
On Tue, 23 Jun 2015 17:28:53 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted
Add new device tree node for the control module register space where
PCIe registers are present.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/dra7.dtsi | 5 +++++
1 file changed, 5 insertions(+)
cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
We should still keep a separate entry for the phy in the dtsi
files. And the phy should be a child of the scm_conf area in the
dtsi file.
The PHY already has a separate entry with its own set of registers.
Just that some bits have been shoved into the control module space
not only for PHY but for other modules as well like DSS, DCAN, etc.
This is because the scm and usb_otg_hs are separate devices and
can be clocked separately. So the phy driver needs to be a
separate driver to avoid spaghetti code and issues with clocking.
for the PHY register space this is already done.
But for the register bits that lie in control module space isn't that
taken care by syscon driver?
cheers,
-roger
From: Roger Quadros <hidden> Date: 2015-06-24 12:06:59
On Tue, 23 Jun 2015 17:28:54 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from SATA PHY node. Since "omap_control_sata" note is no longer
used, remove it.
Signed-off-by: Kishon Vijay Abraham I <redacted>
From: Roger Quadros <hidden> Date: 2015-06-24 12:08:42
On Tue, 23 Jun 2015 17:28:56 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted hunk
The USB2 PHY2 has a different register map compared to USB2 PHY1
to power on/off the PHY. In order to handle it, use the new compatible
string "ti,dra7x-usb2-phy2" for the second instance of USB2 PHY.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/dra7.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Tony Lindgren <tony@atomide.com> Date: 2015-06-24 12:09:54
* Roger Quadros [off-list ref] [150624 04:58]:
On Wed, 24 Jun 2015 14:50:17 +0300
Roger Quadros [off-list ref] wrote:
quoted
On Tue, 23 Jun 2015 17:28:53 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted
Add new device tree node for the control module register space where
PCIe registers are present.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/dra7.dtsi | 5 +++++
1 file changed, 5 insertions(+)
Why do you need to start from 0x4a003c00?
CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24
Also, why can't this dra7_ctrl_pcie node be where scm_conf is.
Yes all the scm children should be under scm@2000 entry in the
dra7.dtsi file.
And BTW, there's nothing stopping a driver doing of_ioremap
on a larger range and be a child under scm@2000 in the dra7.dtsi
if that range is dedicated to a single driver.
My take is we should only use regmap for the scm_conf area
in general.
Regards,
Tony
--
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
From: Roger Quadros <hidden> Date: 2015-06-24 12:14:06
On Wed, 24 Jun 2015 15:06:02 +0300
Roger Quadros [off-list ref] wrote:
On Tue, 23 Jun 2015 17:28:54 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted
Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from SATA PHY node. Since "omap_control_sata" note is no longer
used, remove it.
Signed-off-by: Kishon Vijay Abraham I <redacted>
cheers,
-roger
--
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
From: Roger Quadros <hidden> Date: 2015-06-24 12:20:36
On Wed, 24 Jun 2015 05:09:39 -0700
Tony Lindgren [off-list ref] wrote:
* Roger Quadros [off-list ref] [150624 04:58]:
quoted
On Wed, 24 Jun 2015 14:50:17 +0300
Roger Quadros [off-list ref] wrote:
quoted
On Tue, 23 Jun 2015 17:28:53 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted
Add new device tree node for the control module register space where
PCIe registers are present.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/dra7.dtsi | 5 +++++
1 file changed, 5 insertions(+)
Why do you need to start from 0x4a003c00?
CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24
Also, why can't this dra7_ctrl_pcie node be where scm_conf is.
Yes all the scm children should be under scm@2000 entry in the
dra7.dtsi file.
And BTW, there's nothing stopping a driver doing of_ioremap
on a larger range and be a child under scm@2000 in the dra7.dtsi
if that range is dedicated to a single driver.
Agreed.
My take is we should only use regmap for the scm_conf area
in general.
+1
should we get rid of dra7_ctrl_core and dra7_ctrl_general?
or move them to scm node?
cheers,
-roger
--
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
From: Tony Lindgren <tony@atomide.com> Date: 2015-06-24 12:50:07
* Roger Quadros [off-list ref] [150624 05:21]:
On Wed, 24 Jun 2015 05:09:39 -0700
Tony Lindgren [off-list ref] wrote:
quoted
My take is we should only use regmap for the scm_conf area
in general.
+1
should we get rid of dra7_ctrl_core and dra7_ctrl_general?
or move them to scm node?
Well at least move them. And if there are clear dedicated
register ranges there claimed only by a single device driver,
then those drivers should be just regular loadable driver
modules doing of_ioremap on the range. And in that case they
can be removed.
We have examples of both in dra7.dtsi, pbias_regulator using
the scm_conf via syscon, and then dra7_pmx_core ioremapping
a dedicated register range. So unless there are other messy
register ranges like the scm_conf area then there should not
be need for other syscon areas.
Regards,
Tony
--
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
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-24 13:00:26
Hi,
On Wednesday 24 June 2015 05:03 PM, Roger Quadros wrote:
On Tue, 23 Jun 2015 17:28:51 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted
Deprecate using phy-omap-control driver to power on/off the PHY,
and use *syscon* framework to do the same. This handles
powering on/off the PHY for the USB2 PHYs used in various TI SoCs.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 6 +-
drivers/phy/phy-omap-usb2.c | 101 ++++++++++++++++++----
include/linux/phy/omap_usb.h | 18 ++++
3 files changed, 107 insertions(+), 18 deletions(-)
@@ -42,10 +42,14 @@ Required properties: * "wkupclk" - wakeup clock. * "refclk" - reference clock (optional).-Optional properties:+Deprecated properties: - ctrl-module : phandle of the control module used by PHY driver to power on the PHY.+Recommended properies:+- syscon-phy-power : phandle/offset pair. Phandle to the system control+ module and the register offset to power on/off the PHY.+ This is usually a subnode of ocp2scp to which it is connected. usb2phy@4a0ad080 {
@@ -97,22 +99,65 @@ static int omap_usb_set_peripheral(struct usb_otg *otg,return0;}-staticintomap_usb_power_off(structphy*x)+staticintomap_usb_phy_power(structomap_usb*phy,inton){-structomap_usb*phy=phy_get_drvdata(x);+u32val=0;+u32mask;+intret;-omap_control_phy_power(phy->control_dev,0);+if(phy->syscon_phy_power){+switch(phy->type){+caseTYPE_USB2:+mask=OMAP_DEV_PHY_PD;+if(!on)+val=OMAP_DEV_PHY_PD;+break;+caseTYPE_DRA7USB2:+mask=OMAP_USB2_PHY_PD;+if(!on)+val=OMAP_USB2_PHY_PD;+break;+caseTYPE_AM437USB2:+mask=AM437X_USB2_PHY_PD|+AM437X_USB2_OTG_PD|+AM437X_USB2_OTGVDET_EN|+AM437X_USB2_OTGSESSEND_EN;+if(on){+val=AM437X_USB2_OTGVDET_EN|+AM437X_USB2_OTGSESSEND_EN;+}else{+val=AM437X_USB2_PHY_PD|AM437X_USB2_OTG_PD;+}+break;+default:+dev_err(phy->dev,"%s: type %d not recognized\n",+__func__,phy->type);+return-EINVAL;+}++ret=regmap_update_bits(phy->syscon_phy_power,phy->power_reg,+mask,val);+if(ret<0)+returnret;+}else{+omap_control_phy_power(phy->control_dev,on);+}return0;}-staticintomap_usb_power_on(structphy*x)+staticintomap_usb_power_off(structphy*x){structomap_usb*phy=phy_get_drvdata(x);-omap_control_phy_power(phy->control_dev,1);+returnomap_usb_phy_power(phy,false);+}-return0;+staticintomap_usb_power_on(structphy*x)+{+structomap_usb*phy=phy_get_drvdata(x);++returnomap_usb_phy_power(phy,true);}staticintomap_usb_init(structphy*x)
@@ -223,6 +273,7 @@ static int omap_usb2_probe(struct platform_device *pdev)return-ENOMEM;phy->dev=&pdev->dev;+phy->type=phy_data->type;phy->phy.dev=phy->dev;phy->phy.label=phy_data->label;
@@ -237,20 +288,36 @@ static int omap_usb2_probe(struct platform_device *pdev)phy->flags|=OMAP_USB2_CALIBRATE_FALSE_DISCONNECT;}-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;-}+phy->syscon_phy_power=syscon_regmap_lookup_by_phandle(node,+"syscon-phy-power");+if(IS_ERR(phy->syscon_phy_power)){+dev_info(&pdev->dev,+"can't get syscon-phy-power, using control device\n");+phy->syscon_phy_power=NULL;++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;+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;+}else{+if(of_property_read_u32_index(node,+"syscon-phy-power",1,+&phy->power_reg)){+dev_err(&pdev->dev,+"couldn't get power reg. offset\n");+return-EINVAL;+}}-phy->control_dev=&control_pdev->dev;-otg->set_host=omap_usb_set_host;otg->set_peripheral=omap_usb_set_peripheral;if(phy_data->flags&OMAP_USB2_HAS_SET_VBUS)
@@ -30,6 +30,12 @@ struct usb_dpll_params {u32mf;};+enumomap_usb_phy_type{+TYPE_USB2,/* USB2_PHY, power down in CONTROL_DEV_CONF */+TYPE_DRA7USB2,/* USB2 PHY, power and power_aux e.g. DRA7 */+TYPE_AM437USB2,/* USB2 PHY, power e.g. AM437x */+};+structomap_usb{structusb_phyphy;structphy_companion*comparator;
@@ -40,11 +46,15 @@ struct omap_usb {structclk*wkupclk;structclk*optclk;u8flags;+enumomap_usb_phy_typetype;+structregmap*syscon_phy_power;/* ctrl. reg. acces */+unsignedintpower_reg;/* power reg. index within syscon */};structusb_phy_data{constchar*label;u8flags;+enumomap_usb_phy_typetype;};/* Driver Flags */
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-24 13:08:01
Hi Tony,
On Wednesday 24 June 2015 05:19 PM, Tony Lindgren wrote:
* Kishon Vijay Abraham I [off-list ref] [150623 05:02]:
quoted
Deprecate using phy-omap-control driver to write to the mailbox register
and start using *syscon* framework to do the same.
All this stuff needs to go to some generic syscon USB phy
driver. Let's not start adding phy specific stuff to a USB
driver.
Mailbox register is actually part of OMAP USB glue that should be written in
order to inform the usbmode to the MUSB core.
Thanks
Kishon
--
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
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-24 13:11:35
Hi,
On Wednesday 24 June 2015 05:37 PM, Roger Quadros wrote:
On Tue, 23 Jun 2015 17:28:56 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted
The USB2 PHY2 has a different register map compared to USB2 PHY1
to power on/off the PHY. In order to handle it, use the new compatible
string "ti,dra7x-usb2-phy2" for the second instance of USB2 PHY.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/dra7.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Why do you want to retain "ti,omap-usb2".
It is not backward compatible with it right?
The newer dtbs will anyway have "ti,dra7x-usb2-phy2", so "ti,omap-usb2" was
kept just for legacy reasons.
Thanks
Kishon
--
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
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-24 13:17:03
Hi,
On Wednesday 24 June 2015 04:04 PM, Roger Quadros wrote:
On Tue, 23 Jun 2015 17:28:48 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted
Deprecate using phy-omap-control driver to set PCS value of the PHY
and start using *syscon* framework to do the same.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 2 ++
drivers/phy/phy-ti-pipe3.c | 32 +++++++++++++++++++++-
2 files changed, 33 insertions(+), 1 deletion(-)
@@ -83,6 +83,8 @@ Optional properties: - syscon-pllreset: Handle to system control region that contains the CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0 register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.+ - syscon-pcs : phandle/offset pair. Phandle to the system control module and the+ register offset to write the PCS delay value.
What is PCS?
IIRC physical coding subsystem.
Is this valid only for PCIe? If yes we could mention it here.
This is introduced specifically for PCIe. But there are other PCS registers
with a different register map altogether for USB. I'm not sure if we will ever
have to do those settings.
Thanks
Kishon
quoted
Deprecated properties:
- ctrl-module : phandle of the control module used by PHY driver to power on
@@ -96,9 +99,11 @@ struct ti_pipe3 {structclk*div_clk;structpipe3_dpll_map*dpll_map;structregmap*phy_power_syscon;/* ctrl. reg. acces */+structregmap*pcs_syscon;/* ctrl. reg. acces */structregmap*dpll_reset_syscon;/* ctrl. reg. acces */unsignedintdpll_reset_reg;/* reg. index within syscon */unsignedintpower_reg;/* power reg. index within syscon */+unsignedintpcie_pcs_reg;/* pcs reg. index in syscon */boolsata_refclk_enabled;};
@@ -271,7 +276,16 @@ static int ti_pipe3_init(struct phy *x)*18-1804.*/if(of_device_is_compatible(phy->dev->of_node,"ti,phy-pipe3-pcie")){-omap_control_pcie_pcs(phy->control_dev,0x96);+if(phy->pcs_syscon){+val=0x96<<OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;+ret=regmap_update_bits(phy->pcs_syscon,+phy->pcie_pcs_reg,+PCIE_PCS_MASK,val);+if(ret<0)+returnret;+}else{+omap_control_pcie_pcs(phy->control_dev,0x96);+}return0;}
@@ -455,6 +469,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)dev_err(&pdev->dev,"unable to get div-clk\n");returnPTR_ERR(phy->div_clk);}++phy->pcs_syscon=syscon_regmap_lookup_by_phandle(node,+"syscon-pcs");+if(IS_ERR(phy->pcs_syscon)){+dev_dbg(&pdev->dev,+"can't get syscon-pcs, using omap control\n");+phy->pcs_syscon=NULL;+}else{+if(of_property_read_u32_index(node,+"syscon-pcs",1,+&phy->pcie_pcs_reg)){+dev_err(&pdev->dev,+"couldn't get pcie pcs reg. offset\n");+return-EINVAL;+}+}}else{phy->div_clk=ERR_PTR(-ENODEV);}
--
1.7.9.5
Other than that,
Acked-by: Roger Quadros <redacted>
cheers,
-roger
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-24 13:21:55
Hi,
On Wednesday 24 June 2015 04:33 PM, Roger Quadros wrote:
On Tue, 23 Jun 2015 17:28:50 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted
The USB2 PHY2 has a different register map compared to USB2 PHY1
to power on/off the PHY. In order to handle it, add a new
"compatible" string.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 2 ++
drivers/phy/phy-omap-usb2.c | 9 +++++++++
2 files changed, 11 insertions(+)
@@ -31,6 +31,8 @@ OMAP USB2 PHY Required properties: - compatible: Should be "ti,omap-usb2"+ Should be "ti,dra7x-usb2-phy2" for the 2nd instance of USB2 PHY+ in DRA7x - reg : Address and length of the register set for the device. - #phy-cells: determine the number of cells that should be given in the phandle while referencing this phy.
Isn't it better to define the register map in usb_phy_data
so that you don't need to check for compatible flag everytime?
We could may be define it for DRA7x USB2 PHYs but for am437x-usb2, it might not
be good.
Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-24 13:22:43
Hi,
On Wednesday 24 June 2015 05:09 PM, Roger Quadros wrote:
On Tue, 23 Jun 2015 17:28:52 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted
Deprecate using phy-omap-control driver to write to the mailbox register
and start using *syscon* framework to do the same.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
Documentation/devicetree/bindings/usb/omap-usb.txt | 7 +-
drivers/usb/musb/omap2430.c | 118 ++++++++++++++++----
2 files changed, 102 insertions(+), 23 deletions(-)
@@ -20,10 +20,15 @@ OMAP MUSB GLUE - phy-names : the names of the PHY corresponding to the PHYs present in the *phy* phandle.-Optional properties:+Optional Properties:+Deprecated properties: - ctrl-module : phandle of the control module this glue uses to write to mailbox+Recommended properies:+ - syscon-otghs : phandle/offset pair. Phandle to the system control module and the+ register offset of the mailbox.+ SOC specific device node entry usb_otg_hs: usb_otg_hs@4a0ab000 { compatible = "ti,omap4-musb";
@@ -253,6 +264,47 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status)}EXPORT_SYMBOL_GPL(omap_musb_mailbox);+staticvoidomap2430_musb_set_usbmode(structomap2430_glue*glue,+enumomap_control_usb_modemode)+{+u32val;+intret;++if(glue->syscon_otghs){+switch(mode){+caseUSB_MODE_HOST:+val=OMAP2430_MUSB_AVALID|OMAP2430_MUSB_VBUSVALID;+break;++caseUSB_MODE_DEVICE:+val=OMAP2430_MUSB_IDDIG|OMAP2430_MUSB_AVALID|+OMAP2430_MUSB_VBUSVALID;+break;++caseUSB_MODE_DISCONNECT:+val=OMAP2430_MUSB_IDDIG|OMAP2430_MUSB_SESSEND;+break;++default:+dev_dbg(glue->dev,"Invalid mode\n");+gotoerr_regmap_update;+}++ret=regmap_update_bits(glue->syscon_otghs,+glue->otghs_reg,+OMAP2430_MUSB_MODE_MASK,val);+if(ret<0)+gotoerr_regmap_update;+}else{+omap_control_usb_set_mode(glue->control_otghs,mode);+}++return;++err_regmap_update:+dev_err(glue->dev,"Failed to set mode to %d\n",mode);+}+staticvoidomap_musb_set_mailbox(structomap2430_glue*glue){structmusb*musb=glue_to_musb(glue);
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-24 13:30:08
Hi,
On Wednesday 24 June 2015 05:20 PM, Roger Quadros wrote:
On Tue, 23 Jun 2015 17:28:53 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted
Add new device tree node for the control module register space where
PCIe registers are present.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/dra7.dtsi | 5 +++++
1 file changed, 5 insertions(+)
Why do you need to start from 0x4a003c00?
CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24
Actually wanted to have minimum number of syscon dt nodes. So thought even
others can use dra7_ctrl_pcie phandle. But I looked only at dra7_ctrl_core and
dra7_ctrl_general and not scm_conf :-(
Thanks
Kishon
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-24 13:31:07
Hi,
On Wednesday 24 June 2015 05:26 PM, Roger Quadros wrote:
On Wed, 24 Jun 2015 14:50:17 +0300
Roger Quadros [off-list ref] wrote:
quoted
On Tue, 23 Jun 2015 17:28:53 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted
Add new device tree node for the control module register space where
PCIe registers are present.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/dra7.dtsi | 5 +++++
1 file changed, 5 insertions(+)
Why do you need to start from 0x4a003c00?
CTRL_CORE_PCIESS1_PCS1 is at 0x4a003c24
Also, why can't this dra7_ctrl_pcie node be where scm_conf is.
Yes. I think that's the right thing to do. I saw dra7_ctrl_core and
dra7_ctrl_general and added it.
Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Kishon Vijay Abraham I <hidden> Date: 2015-06-24 13:31:57
On Wednesday 24 June 2015 05:42 PM, Roger Quadros wrote:
On Wed, 24 Jun 2015 15:06:02 +0300
Roger Quadros [off-list ref] wrote:
quoted
On Tue, 23 Jun 2015 17:28:54 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted
Add "syscon-phy-power" property and remove the deprecated "ctrl-module"
property from SATA PHY node. Since "omap_control_sata" note is no longer
used, remove it.
Signed-off-by: Kishon Vijay Abraham I <redacted>
why can't we use scm_conf instead of dra7_ctrl_core?
dra7_ctrl_core seems to be redundant and wrongly placed.
Agreed!
Thanks
Kishon
--
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
From: Roger Quadros <hidden> Date: 2015-06-24 13:49:10
On Wed, 24 Jun 2015 18:46:08 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
Hi,
On Wednesday 24 June 2015 04:04 PM, Roger Quadros wrote:
quoted
On Tue, 23 Jun 2015 17:28:48 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted
Deprecate using phy-omap-control driver to set PCS value of the PHY
and start using *syscon* framework to do the same.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
Documentation/devicetree/bindings/phy/ti-phy.txt | 2 ++
drivers/phy/phy-ti-pipe3.c | 32 +++++++++++++++++++++-
2 files changed, 33 insertions(+), 1 deletion(-)
@@ -83,6 +83,8 @@ Optional properties: - syscon-pllreset: Handle to system control region that contains the CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0 register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.+ - syscon-pcs : phandle/offset pair. Phandle to the system control module and the+ register offset to write the PCS delay value.
What is PCS?
IIRC physical coding subsystem.
quoted
Is this valid only for PCIe? If yes we could mention it here.
This is introduced specifically for PCIe. But there are other PCS registers
with a different register map altogether for USB. I'm not sure if we will ever
have to do those settings.
OK then let's not say it is PCIe specific.
cheers,
-roger
quoted
quoted
Deprecated properties:
- ctrl-module : phandle of the control module used by PHY driver to power on
@@ -96,9 +99,11 @@ struct ti_pipe3 {structclk*div_clk;structpipe3_dpll_map*dpll_map;structregmap*phy_power_syscon;/* ctrl. reg. acces */+structregmap*pcs_syscon;/* ctrl. reg. acces */structregmap*dpll_reset_syscon;/* ctrl. reg. acces */unsignedintdpll_reset_reg;/* reg. index within syscon */unsignedintpower_reg;/* power reg. index within syscon */+unsignedintpcie_pcs_reg;/* pcs reg. index in syscon */boolsata_refclk_enabled;};
@@ -271,7 +276,16 @@ static int ti_pipe3_init(struct phy *x)*18-1804.*/if(of_device_is_compatible(phy->dev->of_node,"ti,phy-pipe3-pcie")){-omap_control_pcie_pcs(phy->control_dev,0x96);+if(phy->pcs_syscon){+val=0x96<<OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT;+ret=regmap_update_bits(phy->pcs_syscon,+phy->pcie_pcs_reg,+PCIE_PCS_MASK,val);+if(ret<0)+returnret;+}else{+omap_control_pcie_pcs(phy->control_dev,0x96);+}return0;}
@@ -455,6 +469,22 @@ static int ti_pipe3_probe(struct platform_device *pdev)dev_err(&pdev->dev,"unable to get div-clk\n");returnPTR_ERR(phy->div_clk);}++phy->pcs_syscon=syscon_regmap_lookup_by_phandle(node,+"syscon-pcs");+if(IS_ERR(phy->pcs_syscon)){+dev_dbg(&pdev->dev,+"can't get syscon-pcs, using omap control\n");+phy->pcs_syscon=NULL;+}else{+if(of_property_read_u32_index(node,+"syscon-pcs",1,+&phy->pcie_pcs_reg)){+dev_err(&pdev->dev,+"couldn't get pcie pcs reg. offset\n");+return-EINVAL;+}+}}else{phy->div_clk=ERR_PTR(-ENODEV);}
--
1.7.9.5
Other than that,
Acked-by: Roger Quadros <redacted>
cheers,
-roger
--
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
From: Roger Quadros <hidden> Date: 2015-06-24 13:51:03
On Wed, 24 Jun 2015 18:40:31 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
Hi,
On Wednesday 24 June 2015 05:37 PM, Roger Quadros wrote:
quoted
On Tue, 23 Jun 2015 17:28:56 +0530
Kishon Vijay Abraham I [off-list ref] wrote:
quoted
The USB2 PHY2 has a different register map compared to USB2 PHY1
to power on/off the PHY. In order to handle it, use the new compatible
string "ti,dra7x-usb2-phy2" for the second instance of USB2 PHY.
Signed-off-by: Kishon Vijay Abraham I <redacted>
---
arch/arm/boot/dts/dra7.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Why do you want to retain "ti,omap-usb2".
It is not backward compatible with it right?
The newer dtbs will anyway have "ti,dra7x-usb2-phy2", so "ti,omap-usb2" was
kept just for legacy reasons.
OK then.
cheers,
-roger
--
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