Commit 8b77b0cf authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'usb-ci-v4.12-rc2' of...

Merge tag 'usb-ci-v4.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-linus

Peter writes:

Some small bugs
parents 08332893 cbb22ebc
...@@ -843,7 +843,10 @@ static ssize_t ci_role_show(struct device *dev, struct device_attribute *attr, ...@@ -843,7 +843,10 @@ static ssize_t ci_role_show(struct device *dev, struct device_attribute *attr,
{ {
struct ci_hdrc *ci = dev_get_drvdata(dev); struct ci_hdrc *ci = dev_get_drvdata(dev);
if (ci->role != CI_ROLE_END)
return sprintf(buf, "%s\n", ci_role(ci)->name); return sprintf(buf, "%s\n", ci_role(ci)->name);
return 0;
} }
static ssize_t ci_role_store(struct device *dev, static ssize_t ci_role_store(struct device *dev,
......
...@@ -294,6 +294,7 @@ static int ci_role_show(struct seq_file *s, void *data) ...@@ -294,6 +294,7 @@ static int ci_role_show(struct seq_file *s, void *data)
{ {
struct ci_hdrc *ci = s->private; struct ci_hdrc *ci = s->private;
if (ci->role != CI_ROLE_END)
seq_printf(s, "%s\n", ci_role(ci)->name); seq_printf(s, "%s\n", ci_role(ci)->name);
return 0; return 0;
......
...@@ -1993,6 +1993,7 @@ static void udc_id_switch_for_host(struct ci_hdrc *ci) ...@@ -1993,6 +1993,7 @@ static void udc_id_switch_for_host(struct ci_hdrc *ci)
int ci_hdrc_gadget_init(struct ci_hdrc *ci) int ci_hdrc_gadget_init(struct ci_hdrc *ci)
{ {
struct ci_role_driver *rdrv; struct ci_role_driver *rdrv;
int ret;
if (!hw_read(ci, CAP_DCCPARAMS, DCCPARAMS_DC)) if (!hw_read(ci, CAP_DCCPARAMS, DCCPARAMS_DC))
return -ENXIO; return -ENXIO;
...@@ -2005,7 +2006,10 @@ int ci_hdrc_gadget_init(struct ci_hdrc *ci) ...@@ -2005,7 +2006,10 @@ int ci_hdrc_gadget_init(struct ci_hdrc *ci)
rdrv->stop = udc_id_switch_for_host; rdrv->stop = udc_id_switch_for_host;
rdrv->irq = udc_irq; rdrv->irq = udc_irq;
rdrv->name = "gadget"; rdrv->name = "gadget";
ret = udc_start(ci);
if (!ret)
ci->roles[CI_ROLE_GADGET] = rdrv; ci->roles[CI_ROLE_GADGET] = rdrv;
return udc_start(ci); return ret;
} }
...@@ -108,6 +108,8 @@ struct imx_usbmisc { ...@@ -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,11 +244,16 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data) ...@@ -242,11 +244,16 @@ 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);
if (is_imx53_usbmisc(data)) {
/* Disable internal 60Mhz clock */ /* Disable internal 60Mhz clock */
reg = usbmisc->base + MX53_USB_CLKONOFF_CTRL_OFFSET; reg = usbmisc->base +
val = readl(reg) | MX53_USB_CLKONOFF_CTRL_H2_INT60CKOFF; MX53_USB_CLKONOFF_CTRL_OFFSET;
val = readl(reg) |
MX53_USB_CLKONOFF_CTRL_H2_INT60CKOFF;
writel(val, reg); 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;
val = readl(reg) | MX53_BM_OVER_CUR_DIS_UHx; val = readl(reg) | MX53_BM_OVER_CUR_DIS_UHx;
...@@ -267,11 +274,16 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data) ...@@ -267,11 +274,16 @@ 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);
if (is_imx53_usbmisc(data)) {
/* Disable internal 60Mhz clock */ /* Disable internal 60Mhz clock */
reg = usbmisc->base + MX53_USB_CLKONOFF_CTRL_OFFSET; reg = usbmisc->base +
val = readl(reg) | MX53_USB_CLKONOFF_CTRL_H3_INT60CKOFF; MX53_USB_CLKONOFF_CTRL_OFFSET;
val = readl(reg) |
MX53_USB_CLKONOFF_CTRL_H3_INT60CKOFF;
writel(val, reg); 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;
val = readl(reg) | MX53_BM_OVER_CUR_DIS_UHx; val = readl(reg) | MX53_BM_OVER_CUR_DIS_UHx;
...@@ -456,6 +468,10 @@ static const struct usbmisc_ops imx27_usbmisc_ops = { ...@@ -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 = { ...@@ -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[] = { ...@@ -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",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment