usb: gadget: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap
As mach/hardware.h is deleted, we can't visit platform code at driver. It has no phy driver to combine with this controller, so it has to use ioremap to map phy address as a workaround. Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
f0ea8834df
commit
c2c9caa947
|
@ -23,7 +23,8 @@ static struct clk *mxc_per_clk;
|
||||||
static struct clk *mxc_ipg_clk;
|
static struct clk *mxc_ipg_clk;
|
||||||
|
|
||||||
/* workaround ENGcm09152 for i.MX35 */
|
/* workaround ENGcm09152 for i.MX35 */
|
||||||
#define USBPHYCTRL_OTGBASE_OFFSET 0x608
|
#define MX35_USBPHYCTRL_OFFSET 0x600
|
||||||
|
#define USBPHYCTRL_OTGBASE_OFFSET 0x8
|
||||||
#define USBPHYCTRL_EVDO (1 << 23)
|
#define USBPHYCTRL_EVDO (1 << 23)
|
||||||
|
|
||||||
int fsl_udc_clk_init(struct platform_device *pdev)
|
int fsl_udc_clk_init(struct platform_device *pdev)
|
||||||
|
@ -77,25 +78,40 @@ eclkrate:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsl_udc_clk_finalize(struct platform_device *pdev)
|
int fsl_udc_clk_finalize(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
|
struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
|
||||||
unsigned int v;
|
int ret = 0;
|
||||||
|
|
||||||
/* workaround ENGcm09152 for i.MX35 */
|
/* workaround ENGcm09152 for i.MX35 */
|
||||||
if (pdata->workaround & FLS_USB2_WORKAROUND_ENGCM09152) {
|
if (pdata->workaround & FLS_USB2_WORKAROUND_ENGCM09152) {
|
||||||
v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR +
|
unsigned int v;
|
||||||
USBPHYCTRL_OTGBASE_OFFSET));
|
struct resource *res = platform_get_resource
|
||||||
writel(v | USBPHYCTRL_EVDO,
|
(pdev, IORESOURCE_MEM, 0);
|
||||||
MX35_IO_ADDRESS(MX35_USB_BASE_ADDR +
|
void __iomem *phy_regs = ioremap(res->start +
|
||||||
USBPHYCTRL_OTGBASE_OFFSET));
|
MX35_USBPHYCTRL_OFFSET, 512);
|
||||||
|
if (!phy_regs) {
|
||||||
|
dev_err(&pdev->dev, "ioremap for phy address fails\n");
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto ioremap_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
v = readl(phy_regs + USBPHYCTRL_OTGBASE_OFFSET);
|
||||||
|
writel(v | USBPHYCTRL_EVDO,
|
||||||
|
phy_regs + USBPHYCTRL_OTGBASE_OFFSET);
|
||||||
|
|
||||||
|
iounmap(phy_regs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ioremap_err:
|
||||||
/* ULPI transceivers don't need usbpll */
|
/* ULPI transceivers don't need usbpll */
|
||||||
if (pdata->phy_mode == FSL_USB2_PHY_ULPI) {
|
if (pdata->phy_mode == FSL_USB2_PHY_ULPI) {
|
||||||
clk_disable_unprepare(mxc_per_clk);
|
clk_disable_unprepare(mxc_per_clk);
|
||||||
mxc_per_clk = NULL;
|
mxc_per_clk = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsl_udc_clk_release(void)
|
void fsl_udc_clk_release(void)
|
||||||
|
|
|
@ -2543,7 +2543,9 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
|
||||||
dr_controller_setup(udc_controller);
|
dr_controller_setup(udc_controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
fsl_udc_clk_finalize(pdev);
|
ret = fsl_udc_clk_finalize(pdev);
|
||||||
|
if (ret)
|
||||||
|
goto err_free_irq;
|
||||||
|
|
||||||
/* Setup gadget structure */
|
/* Setup gadget structure */
|
||||||
udc_controller->gadget.ops = &fsl_gadget_ops;
|
udc_controller->gadget.ops = &fsl_gadget_ops;
|
||||||
|
|
|
@ -592,15 +592,16 @@ static inline struct ep_queue_head *get_qh_by_ep(struct fsl_ep *ep)
|
||||||
struct platform_device;
|
struct platform_device;
|
||||||
#ifdef CONFIG_ARCH_MXC
|
#ifdef CONFIG_ARCH_MXC
|
||||||
int fsl_udc_clk_init(struct platform_device *pdev);
|
int fsl_udc_clk_init(struct platform_device *pdev);
|
||||||
void fsl_udc_clk_finalize(struct platform_device *pdev);
|
int fsl_udc_clk_finalize(struct platform_device *pdev);
|
||||||
void fsl_udc_clk_release(void);
|
void fsl_udc_clk_release(void);
|
||||||
#else
|
#else
|
||||||
static inline int fsl_udc_clk_init(struct platform_device *pdev)
|
static inline int fsl_udc_clk_init(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static inline void fsl_udc_clk_finalize(struct platform_device *pdev)
|
static inline int fsl_udc_clk_finalize(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
static inline void fsl_udc_clk_release(void)
|
static inline void fsl_udc_clk_release(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue