From b48a4e88ef666a2a9f6d96749febf237ac7c4ade Mon Sep 17 00:00:00 2001 From: Vijayavardhan Vennapusa Date: Mon, 25 Mar 2013 09:00:21 +0530 Subject: [PATCH] Revert "usb: dwc3: msm: use of_platform API to create dwc3 core pdev" commit d5cd3eed8126f59e3aef320c0051031014e08a96 uses of_platform API to create dwc3 core platform device. But this is resulting in dwc3 probe getting failed due to missing memory resource. Hence revert this commit till the issue is fixed. Change-Id: Idff1fb6a84e85074d39995bf4b61dd1a38027f8f Signed-off-by: Vijayavardhan Vennapusa --- .../devicetree/bindings/usb/dwc3.txt | 6 +-- .../devicetree/bindings/usb/msm-ssusb.txt | 23 ++++------ arch/arm/boot/dts/msm8974.dtsi | 15 +------ drivers/usb/dwc3/core.c | 6 --- drivers/usb/dwc3/dwc3-msm.c | 42 ++++++++++++++----- 5 files changed, 42 insertions(+), 50 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index fd5b93e300d..9ce54215df0 100644 --- a/Documentation/devicetree/bindings/usb/dwc3.txt +++ b/Documentation/devicetree/bindings/usb/dwc3.txt @@ -6,9 +6,6 @@ Required properties: - compatible: must be "synopsys,dwc3" - reg : Address and length of the register set for the device - interrupts: Interrupts used by the dwc3 controller. - - interrupt-names : Required interrupt resource entries are: - "irq" : Interrupt for DWC3 core - "otg_irq" : Interrupt for DWC3 core's OTG Events Optional properties: - tx-fifo-resize: determines if the FIFO *has* to be reallocated. @@ -18,7 +15,6 @@ This is usually a subnode to DWC3 glue to which it is connected. dwc3@4a030000 { compatible = "synopsys,dwc3"; reg = <0x4a030000 0xcfff>; - interrupts = <0 92 4>, <0 179 0>; - interrupt-names = "irq", "otg_irq"; + interrupts = <0 92 4> tx-fifo-resize; }; diff --git a/Documentation/devicetree/bindings/usb/msm-ssusb.txt b/Documentation/devicetree/bindings/usb/msm-ssusb.txt index 5391734f61d..51c075015b3 100644 --- a/Documentation/devicetree/bindings/usb/msm-ssusb.txt +++ b/Documentation/devicetree/bindings/usb/msm-ssusb.txt @@ -6,6 +6,9 @@ Required properties : offset and length of the TCSR register for routing USB signals to either picoPHY0 or picoPHY1. - interrupts: IRQ lines used by this controller +- interrupt-names : Required interrupt resource entries are: + "irq" : Interrupt for DWC3 core + "otg_irq" : Interrupt for DWC3 core's OTG Events - -supply: phandle to the regulator device tree node Required "supply-name" examples are: "SSUSB_lp8" : 1.8v supply for SSPHY @@ -46,18 +49,13 @@ Optional properties : bits 13-19 PARAMETER_OVERRIDE_C bits 20-25 PARAMETER_OVERRIDE_D -Sub nodes: -- Sub node for "DWC3- USB3 controller". - This sub node is required property for device node. The properties of this subnode - are specified in dwc3.txt. - Example MSM USB3.0 controller device node : usb@f9200000 { compatible = "qcom,dwc-usb3-msm"; - reg = <0xf9200000 0xfc000>, - <0xfd4ab000 0x4>; - interrupts = <0 133 0>; - interrupt-names = "hs_phy_irq"; + reg = <0xF9200000 0xFA000>, + <0xFD4AB000 0x4>; + interrupts = <0 131 0>, <0 179 0>, <0 133 0>; + interrupt-names = "irq", "otg_irq", "hs_phy_irq"; ssusb_vdd_dig-supply = <&pm8841_s2_corner>; SSUSB_1p8-supply = <&pm8941_l6>; hsusb_vdd_dig-supply = <&pm8841_s2_corner>; @@ -75,11 +73,4 @@ Example MSM USB3.0 controller device node : qcom,msm_bus,vectors = <61 512 0 0>, <61 512 240000000 960000000>; - dwc3@f9200000 { - compatible = "synopsys,dwc3"; - reg = <0xf9200000 0xfc000>; - interrupts = <0 131 0>, <0 179 0>; - interrupt-names = "irq", "otg_irq"; - tx-fifo-resize; -}; }; diff --git a/arch/arm/boot/dts/msm8974.dtsi b/arch/arm/boot/dts/msm8974.dtsi index c7d35a57d47..da71a894bed 100644 --- a/arch/arm/boot/dts/msm8974.dtsi +++ b/arch/arm/boot/dts/msm8974.dtsi @@ -702,13 +702,10 @@ usb3: qcom,ssusb@f9200000 { compatible = "qcom,dwc-usb3-msm"; - #address-cells = <1>; - #size-cells = <1>; - ranges; reg = <0xf9200000 0xfc000>, <0xfd4ab000 0x4>; - interrupts = <0 133 0>; - interrupt-names = "hs_phy_irq"; + interrupts = <0 131 0>, <0 179 0>, <0 133 0>; + interrupt-names = "irq", "otg_irq", "hs_phy_irq"; ssusb_vdd_dig-supply = <&pm8841_s2_corner>; SSUSB_1p8-supply = <&pm8941_l6>; hsusb_vdd_dig-supply = <&pm8841_s2_corner>; @@ -726,14 +723,6 @@ qcom,msm-bus,vectors-KBps = <61 512 0 0>, <61 512 240000 960000>; - dwc3@f9200000 { - compatible = "synopsys,dwc3"; - reg = <0xf9200000 0xfc000>; - interrupts = <0 131 0>, <0 179 0>; - interrupt-names = "irq", "otg_irq"; - tx-fifo-resize; - }; - }; ehci: qcom,ehci-host@f9a55000 { diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 6619e96f55c..f9a26cf0285 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -461,7 +461,6 @@ void dwc3_post_host_reset_core_init(struct dwc3 *dwc) #define DWC3_ALIGN_MASK (16 - 1) -static u64 dwc3_dma_mask = DMA_BIT_MASK(64); static int __devinit dwc3_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; @@ -484,11 +483,6 @@ static int __devinit dwc3_probe(struct platform_device *pdev) dwc = PTR_ALIGN(mem, DWC3_ALIGN_MASK + 1); dwc->mem = mem; - if (!dev->dma_mask) - dev->dma_mask = &dwc3_dma_mask; - if (!dev->coherent_dma_mask) - dev->coherent_dma_mask = DMA_BIT_MASK(32); - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!res) { dev_err(dev, "missing IRQ\n"); diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c index 84672d70481..47101106173 100644 --- a/drivers/usb/dwc3/dwc3-msm.c +++ b/drivers/usb/dwc3/dwc3-msm.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -153,6 +152,7 @@ struct dwc3_msm_req_complete { }; struct dwc3_msm { + struct platform_device *dwc3; struct device *dev; void __iomem *base; u32 resource_size; @@ -220,6 +220,7 @@ struct dwc3_msm { #define USB_SSPHY_1P8_HPM_LOAD 23000 /* uA */ static struct dwc3_msm *context; +static u64 dwc3_msm_dma_mask = DMA_BIT_MASK(64); static struct usb_ext_notification *usb_ext; @@ -2200,6 +2201,7 @@ static DEVICE_ATTR(adc_enable, S_IRUGO | S_IWUSR, adc_enable_show, static int __devinit dwc3_msm_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; + struct platform_device *dwc3; struct dwc3_msm *msm; struct resource *res; void __iomem *tcsr; @@ -2461,7 +2463,19 @@ static int __devinit dwc3_msm_probe(struct platform_device *pdev) goto disable_hs_ldo; } + dwc3 = platform_device_alloc("dwc3", -1); + if (!dwc3) { + dev_err(&pdev->dev, "couldn't allocate dwc3 device\n"); + ret = -ENODEV; + goto disable_hs_ldo; + } + + dwc3->dev.parent = &pdev->dev; + dwc3->dev.coherent_dma_mask = DMA_BIT_MASK(32); + dwc3->dev.dma_mask = &dwc3_msm_dma_mask; + dwc3->dev.dma_parms = pdev->dev.dma_parms; msm->resource_size = resource_size(res); + msm->dwc3 = dwc3; if (of_property_read_u32(node, "qcom,dwc-hsphy-init", &msm->hsphy_init_seq)) @@ -2487,7 +2501,7 @@ static int __devinit dwc3_msm_probe(struct platform_device *pdev) "max: %d, dbm_num_eps: %d\n", DBM_MAX_EPS, msm->dbm_num_eps); ret = -ENODEV; - goto disable_hs_ldo; + goto put_pdev; } msm->usb_psy.name = "usb"; @@ -2507,16 +2521,20 @@ static int __devinit dwc3_msm_probe(struct platform_device *pdev) dev_err(&pdev->dev, "%s:power_supply_register usb failed\n", __func__); - goto disable_hs_ldo; + goto put_pdev; } - if (node) { - ret = of_platform_populate(node, NULL, NULL, &pdev->dev); - if (ret) { - dev_err(&pdev->dev, - "failed to add create dwc3 core\n"); - goto put_psupply; - } + ret = platform_device_add_resources(dwc3, pdev->resource, + pdev->num_resources); + if (ret) { + dev_err(&pdev->dev, "couldn't add resources to dwc3 device\n"); + goto put_psupply; + } + + ret = platform_device_add(dwc3); + if (ret) { + dev_err(&pdev->dev, "failed to register dwc3 device\n"); + goto put_psupply; } msm->bus_scale_table = msm_bus_cl_get_pdata(pdev); @@ -2561,8 +2579,11 @@ static int __devinit dwc3_msm_probe(struct platform_device *pdev) put_xcvr: usb_put_transceiver(msm->otg_xceiv); + platform_device_del(dwc3); put_psupply: power_supply_unregister(&msm->usb_psy); +put_pdev: + platform_device_put(dwc3); disable_hs_ldo: dwc3_hsusb_ldo_enable(0); free_hs_ldo_init: @@ -2613,6 +2634,7 @@ static int __devexit dwc3_msm_remove(struct platform_device *pdev) } pm_runtime_disable(msm->dev); + platform_device_unregister(msm->dwc3); wake_lock_destroy(&msm->wlock); dwc3_hsusb_ldo_enable(0);