usb: chipidea: move platform related things to ci_get_platdata
Like vbus, the dr_mode and phy_mode are also got from glue layer's platform data or device node. Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
92b336d7f6
commit
c22600c3ea
|
@ -381,6 +381,15 @@ static int ci_get_platdata(struct device *dev,
|
||||||
return PTR_ERR(platdata->reg_vbus);
|
return PTR_ERR(platdata->reg_vbus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!platdata->phy_mode)
|
||||||
|
platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
|
||||||
|
|
||||||
|
if (!platdata->dr_mode)
|
||||||
|
platdata->dr_mode = of_usb_get_dr_mode(dev->of_node);
|
||||||
|
|
||||||
|
if (platdata->dr_mode == USB_DR_MODE_UNKNOWN)
|
||||||
|
platdata->dr_mode = USB_DR_MODE_OTG;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,7 +482,6 @@ static int ci_hdrc_probe(struct platform_device *pdev)
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
int ret;
|
int ret;
|
||||||
enum usb_dr_mode dr_mode;
|
enum usb_dr_mode dr_mode;
|
||||||
struct device_node *of_node = dev->of_node ?: dev->parent->of_node;
|
|
||||||
|
|
||||||
if (!dev->platform_data) {
|
if (!dev->platform_data) {
|
||||||
dev_err(dev, "platform data missing\n");
|
dev_err(dev, "platform data missing\n");
|
||||||
|
@ -514,17 +522,8 @@ static int ci_hdrc_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
ci_get_otg_capable(ci);
|
ci_get_otg_capable(ci);
|
||||||
|
|
||||||
if (!ci->platdata->phy_mode)
|
|
||||||
ci->platdata->phy_mode = of_usb_get_phy_mode(of_node);
|
|
||||||
|
|
||||||
hw_phymode_configure(ci);
|
hw_phymode_configure(ci);
|
||||||
|
|
||||||
if (!ci->platdata->dr_mode)
|
|
||||||
ci->platdata->dr_mode = of_usb_get_dr_mode(of_node);
|
|
||||||
|
|
||||||
if (ci->platdata->dr_mode == USB_DR_MODE_UNKNOWN)
|
|
||||||
ci->platdata->dr_mode = USB_DR_MODE_OTG;
|
|
||||||
|
|
||||||
dr_mode = ci->platdata->dr_mode;
|
dr_mode = ci->platdata->dr_mode;
|
||||||
/* initialize role(s) before the interrupt is requested */
|
/* initialize role(s) before the interrupt is requested */
|
||||||
if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) {
|
if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) {
|
||||||
|
|
Loading…
Reference in New Issue