usb: chipidea: imx: Do not access CLKONOFF on i.MX51
Unlike i.MX53, i.MX51's USBOH3 register file does not implemenent
registers past offset 0x018, which includes
MX53_USB_CLKONOFF_CTRL_OFFSET and trying to access that register on
said platform results in external abort.
Fix it by enabling CLKONOFF accessing codepath only for i.MX53.
Cc: stable <stable@vger.kernel.org>
Fixes 3be3251db0
("usb: chipidea: imx: Disable internal 60Mhz
clock with ULPI PHY")
Cc: cphealy@gmail.com
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
hifive-unleashed-5.1
parent
2ea659a9ef
commit
62b97d502b
|
@ -108,6 +108,8 @@ struct imx_usbmisc {
|
||||||
const struct usbmisc_ops *ops;
|
const struct usbmisc_ops *ops;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline bool is_imx53_usbmisc(struct imx_usbmisc_data *data);
|
||||||
|
|
||||||
static int usbmisc_imx25_init(struct imx_usbmisc_data *data)
|
static int usbmisc_imx25_init(struct imx_usbmisc_data *data)
|
||||||
{
|
{
|
||||||
struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
|
struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
|
||||||
|
@ -242,10 +244,15 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
|
||||||
val = readl(reg) | MX53_USB_UHx_CTRL_WAKE_UP_EN
|
val = readl(reg) | MX53_USB_UHx_CTRL_WAKE_UP_EN
|
||||||
| MX53_USB_UHx_CTRL_ULPI_INT_EN;
|
| MX53_USB_UHx_CTRL_ULPI_INT_EN;
|
||||||
writel(val, reg);
|
writel(val, reg);
|
||||||
/* Disable internal 60Mhz clock */
|
if (is_imx53_usbmisc(data)) {
|
||||||
reg = usbmisc->base + MX53_USB_CLKONOFF_CTRL_OFFSET;
|
/* Disable internal 60Mhz clock */
|
||||||
val = readl(reg) | MX53_USB_CLKONOFF_CTRL_H2_INT60CKOFF;
|
reg = usbmisc->base +
|
||||||
writel(val, reg);
|
MX53_USB_CLKONOFF_CTRL_OFFSET;
|
||||||
|
val = readl(reg) |
|
||||||
|
MX53_USB_CLKONOFF_CTRL_H2_INT60CKOFF;
|
||||||
|
writel(val, reg);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (data->disable_oc) {
|
if (data->disable_oc) {
|
||||||
reg = usbmisc->base + MX53_USB_UH2_CTRL_OFFSET;
|
reg = usbmisc->base + MX53_USB_UH2_CTRL_OFFSET;
|
||||||
|
@ -267,10 +274,15 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
|
||||||
val = readl(reg) | MX53_USB_UHx_CTRL_WAKE_UP_EN
|
val = readl(reg) | MX53_USB_UHx_CTRL_WAKE_UP_EN
|
||||||
| MX53_USB_UHx_CTRL_ULPI_INT_EN;
|
| MX53_USB_UHx_CTRL_ULPI_INT_EN;
|
||||||
writel(val, reg);
|
writel(val, reg);
|
||||||
/* Disable internal 60Mhz clock */
|
|
||||||
reg = usbmisc->base + MX53_USB_CLKONOFF_CTRL_OFFSET;
|
if (is_imx53_usbmisc(data)) {
|
||||||
val = readl(reg) | MX53_USB_CLKONOFF_CTRL_H3_INT60CKOFF;
|
/* Disable internal 60Mhz clock */
|
||||||
writel(val, reg);
|
reg = usbmisc->base +
|
||||||
|
MX53_USB_CLKONOFF_CTRL_OFFSET;
|
||||||
|
val = readl(reg) |
|
||||||
|
MX53_USB_CLKONOFF_CTRL_H3_INT60CKOFF;
|
||||||
|
writel(val, reg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (data->disable_oc) {
|
if (data->disable_oc) {
|
||||||
reg = usbmisc->base + MX53_USB_UH3_CTRL_OFFSET;
|
reg = usbmisc->base + MX53_USB_UH3_CTRL_OFFSET;
|
||||||
|
@ -456,6 +468,10 @@ static const struct usbmisc_ops imx27_usbmisc_ops = {
|
||||||
.init = usbmisc_imx27_init,
|
.init = usbmisc_imx27_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct usbmisc_ops imx51_usbmisc_ops = {
|
||||||
|
.init = usbmisc_imx53_init,
|
||||||
|
};
|
||||||
|
|
||||||
static const struct usbmisc_ops imx53_usbmisc_ops = {
|
static const struct usbmisc_ops imx53_usbmisc_ops = {
|
||||||
.init = usbmisc_imx53_init,
|
.init = usbmisc_imx53_init,
|
||||||
};
|
};
|
||||||
|
@ -479,6 +495,13 @@ static const struct usbmisc_ops imx7d_usbmisc_ops = {
|
||||||
.set_wakeup = usbmisc_imx7d_set_wakeup,
|
.set_wakeup = usbmisc_imx7d_set_wakeup,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline bool is_imx53_usbmisc(struct imx_usbmisc_data *data)
|
||||||
|
{
|
||||||
|
struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
|
||||||
|
|
||||||
|
return usbmisc->ops == &imx53_usbmisc_ops;
|
||||||
|
}
|
||||||
|
|
||||||
int imx_usbmisc_init(struct imx_usbmisc_data *data)
|
int imx_usbmisc_init(struct imx_usbmisc_data *data)
|
||||||
{
|
{
|
||||||
struct imx_usbmisc *usbmisc;
|
struct imx_usbmisc *usbmisc;
|
||||||
|
@ -536,7 +559,7 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.compatible = "fsl,imx51-usbmisc",
|
.compatible = "fsl,imx51-usbmisc",
|
||||||
.data = &imx53_usbmisc_ops,
|
.data = &imx51_usbmisc_ops,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.compatible = "fsl,imx53-usbmisc",
|
.compatible = "fsl,imx53-usbmisc",
|
||||||
|
|
Loading…
Reference in New Issue