3 * Helper functions to support the tegra USB controller
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
10 #include <linux/fsl_devices.h>
11 #include <linux/platform_device.h>
12 #include <linux/err.h>
14 #include <mach/usb_phy.h>
16 static struct tegra_usb_phy *phy;
17 static struct clk *udc_clk;
18 static struct clk *emc_clk;
19 static void *udc_base;
21 int fsl_udc_clk_init(struct platform_device *pdev)
26 struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
29 udc_clk = clk_get(&pdev->dev, NULL);
30 if (IS_ERR(udc_clk)) {
31 dev_err(&pdev->dev, "Can't get udc clock\n");
32 return PTR_ERR(udc_clk);
37 emc_clk = clk_get(&pdev->dev, "emc");
38 if (IS_ERR(emc_clk)) {
39 dev_err(&pdev->dev, "Can't get emc clock\n");
40 err = PTR_ERR(emc_clk);
45 clk_set_rate(emc_clk, 300000000);
47 /* we have to remap the registers ourselves as fsl_udc does not
50 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
55 udc_base = ioremap(res->start, resource_size(res));
65 phy = tegra_usb_phy_open(instance, udc_base, pdata->phy_config,
66 TEGRA_USB_PHY_MODE_DEVICE);
68 dev_err(&pdev->dev, "Can't open phy\n");
73 tegra_usb_phy_power_on(phy);
87 void fsl_udc_clk_finalize(struct platform_device *pdev)
91 void fsl_udc_clk_release(void)
93 tegra_usb_phy_close(phy);
100 clk_disable(emc_clk);
104 void fsl_udc_clk_suspend(void)
106 tegra_usb_phy_power_off(phy);
107 clk_disable(udc_clk);
108 clk_disable(emc_clk);
111 void fsl_udc_clk_resume(void)
115 tegra_usb_phy_power_on(phy);