Hi 2009/2/11 Guennadi Liakhovetski <lg@xxxxxxx>: > MPC8313 / MPC8349 PPC SoCs and i.MX31 ARM SoCs use the same USB device > core, extend the driver to support i.MX31. We just have to disable using > usb_sys_interface and add clock management. > > Signed-off-by: Guennadi Liakhovetski <lg@xxxxxxx> > --- > diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c > index f3c6703..f6b95a1 100644 > --- a/drivers/usb/gadget/fsl_usb2_udc.c > +++ b/drivers/usb/gadget/fsl_usb2_udc.c > +static int mxc_udc_init(struct platform_device *pdev) > +{ > + struct fsl_usb2_platform_data *pdata; > + unsigned long freq; > + int ret; > + > + pdata = pdev->dev.platform_data; > + > + mxc_ahb_clk = clk_get(NULL, "usb_ahb_clk"); > + if (IS_ERR(mxc_ahb_clk)) > + return PTR_ERR(mxc_ahb_clk); > + > + ret = clk_enable(mxc_ahb_clk); > + if (ret < 0) { > + dev_err(&pdev->dev, "clk_enable(\"usb_ahb_clk\") failed\n"); > + goto eenahb; > + } > + > + /* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */ > + mxc_usb_clk = clk_get(NULL, "usb_clk"); > + if (IS_ERR(mxc_usb_clk)) { > + dev_err(&pdev->dev, "clk_get(\"usb_usb_clk\") failed\n"); > + ret = PTR_ERR(mxc_usb_clk); > + goto egusb; > + } > + > + freq = clk_get_rate(mxc_usb_clk); > + if ((freq < 59999000) || (freq > 60001000)) > + dev_warn(&pdev->dev, "USB_CLK=%lu, should be 60MHz\n", freq); > + > + /* Turn off the usbpll for ulpi transceivers */ > + if (pdata->phy_mode != FSL_USB2_PHY_ULPI) { > + ret = clk_enable(mxc_usb_clk); I'm a bit confused by the comment "Turn off....". To me it seems like you enable the usb_clk for non-ulpi transceivers, instead of turning it off for ulpi. Regards, Magnus Lilja -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html