#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/fsl_devices.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/clk.h>
#include <linux/module.h>
#include <linux/dma-mapping.h>
struct fsl_usb2_dev_data { … };
static struct fsl_usb2_dev_data dr_mode_data[] = …;
static struct fsl_usb2_dev_data *get_dr_mode_data(struct device_node *np)
{ … }
static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type)
{ … }
static struct platform_device *fsl_usb2_device_register(
struct platform_device *ofdev,
struct fsl_usb2_platform_data *pdata,
const char *name, int id)
{ … }
static const struct of_device_id fsl_usb2_mph_dr_of_match[];
static enum fsl_usb2_controller_ver usb_get_ver_info(struct device_node *np)
{ … }
static int fsl_usb2_mph_dr_of_probe(struct platform_device *ofdev)
{ … }
static int __unregister_subdev(struct device *dev, void *d)
{ … }
static void fsl_usb2_mph_dr_of_remove(struct platform_device *ofdev)
{ … }
#ifdef CONFIG_PPC_MPC512x
#define USBGENCTRL …
#define GC_WU_INT_CLR …
#define GC_ULPI_SEL …
#define GC_PPP …
#define GC_PFP …
#define GC_WU_ULPI_EN …
#define GC_WU_IE …
#define ISIPHYCTRL …
#define PHYCTRL_PHYE …
#define PHYCTRL_BSENH …
#define PHYCTRL_BSEN …
#define PHYCTRL_LSFE …
#define PHYCTRL_PXE …
static int fsl_usb2_mpc5121_init(struct platform_device *pdev)
{
struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct clk *clk;
int err;
clk = devm_clk_get(pdev->dev.parent, "ipg");
if (IS_ERR(clk)) {
dev_err(&pdev->dev, "failed to get clk\n");
return PTR_ERR(clk);
}
err = clk_prepare_enable(clk);
if (err) {
dev_err(&pdev->dev, "failed to enable clk\n");
return err;
}
pdata->clk = clk;
if (pdata->phy_mode == FSL_USB2_PHY_UTMI_WIDE) {
u32 reg = 0;
if (pdata->invert_drvvbus)
reg |= GC_PPP;
if (pdata->invert_pwr_fault)
reg |= GC_PFP;
out_be32(pdata->regs + ISIPHYCTRL, PHYCTRL_PHYE | PHYCTRL_PXE);
out_be32(pdata->regs + USBGENCTRL, reg);
}
return 0;
}
static void fsl_usb2_mpc5121_exit(struct platform_device *pdev)
{
struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev);
pdata->regs = NULL;
if (pdata->clk)
clk_disable_unprepare(pdata->clk);
}
static struct fsl_usb2_platform_data fsl_usb2_mpc5121_pd = {
.big_endian_desc = 1,
.big_endian_mmio = 1,
.es = 1,
.have_sysif_regs = 0,
.le_setup_buf = 1,
.init = fsl_usb2_mpc5121_init,
.exit = fsl_usb2_mpc5121_exit,
};
#endif
static struct fsl_usb2_platform_data fsl_usb2_mpc8xxx_pd = …;
static const struct of_device_id fsl_usb2_mph_dr_of_match[] = …;
MODULE_DEVICE_TABLE(of, fsl_usb2_mph_dr_of_match);
static struct platform_driver fsl_usb2_mph_dr_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;