Commit 26f8e3a8 authored by Stephen Boyd's avatar Stephen Boyd Committed by Peter Chen

usb: chipidea: msm: Make platform data driver local instead of global

If two devices are probed with this same driver, they'll share
the same platform data structure, while the chipidea core layer
writes and modifies it. This can lead to interesting results
especially if one device is an OTG type chipidea controller and
another is a host. Let's create a copy of this structure per each
device instance so that odd things don't happen.
Acked-by: default avatarPeter Chen <peter.chen@nxp.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: default avatarPeter Chen <peter.chen@nxp.com>
parent 47654a16
...@@ -39,6 +39,7 @@ struct ci_hdrc_msm { ...@@ -39,6 +39,7 @@ struct ci_hdrc_msm {
struct clk *core_clk; struct clk *core_clk;
struct clk *iface_clk; struct clk *iface_clk;
struct clk *fs_clk; struct clk *fs_clk;
struct ci_hdrc_platform_data pdata;
bool secondary_phy; bool secondary_phy;
bool hsic; bool hsic;
void __iomem *base; void __iomem *base;
...@@ -94,16 +95,6 @@ static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) ...@@ -94,16 +95,6 @@ static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event)
} }
} }
static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = {
.name = "ci_hdrc_msm",
.capoffset = DEF_CAPOFFSET,
.flags = CI_HDRC_REGS_SHARED |
CI_HDRC_DISABLE_STREAMING |
CI_HDRC_OVERRIDE_AHB_BURST,
.notify_event = ci_hdrc_msm_notify_event,
};
static int ci_hdrc_msm_mux_phy(struct ci_hdrc_msm *ci, static int ci_hdrc_msm_mux_phy(struct ci_hdrc_msm *ci,
struct platform_device *pdev) struct platform_device *pdev)
{ {
...@@ -164,7 +155,12 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) ...@@ -164,7 +155,12 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
if (IS_ERR(phy)) if (IS_ERR(phy))
return PTR_ERR(phy); return PTR_ERR(phy);
ci_hdrc_msm_platdata.usb_phy = phy; ci->pdata.name = "ci_hdrc_msm";
ci->pdata.capoffset = DEF_CAPOFFSET;
ci->pdata.flags = CI_HDRC_REGS_SHARED | CI_HDRC_DISABLE_STREAMING |
CI_HDRC_OVERRIDE_AHB_BURST;
ci->pdata.notify_event = ci_hdrc_msm_notify_event;
ci->pdata.usb_phy = phy;
reset = devm_reset_control_get(&pdev->dev, "core"); reset = devm_reset_control_get(&pdev->dev, "core");
if (IS_ERR(reset)) if (IS_ERR(reset))
...@@ -220,9 +216,8 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) ...@@ -220,9 +216,8 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev)
} }
of_node_put(ulpi_node); of_node_put(ulpi_node);
plat_ci = ci_hdrc_add_device(&pdev->dev, plat_ci = ci_hdrc_add_device(&pdev->dev, pdev->resource,
pdev->resource, pdev->num_resources, pdev->num_resources, &ci->pdata);
&ci_hdrc_msm_platdata);
if (IS_ERR(plat_ci)) { if (IS_ERR(plat_ci)) {
dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n"); dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n");
ret = PTR_ERR(plat_ci); ret = PTR_ERR(plat_ci);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment