* [PATCH 1/3] USB: imx-usb-misc: add device tree support
@ 2013-05-27 21:59 Philipp Zabel
2013-05-27 21:59 ` [PATCH 2/3] USB: chipidea-imx: add basic " Philipp Zabel
2013-05-27 21:59 ` [PATCH 3/3] USB: imx-usb-phy: add " Philipp Zabel
0 siblings, 2 replies; 3+ messages in thread
From: Philipp Zabel @ 2013-05-27 21:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
---
drivers/usb/imx/imx-usb-misc.c | 43 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/drivers/usb/imx/imx-usb-misc.c b/drivers/usb/imx/imx-usb-misc.c
index 901ced4..b9c6fb9 100644
--- a/drivers/usb/imx/imx-usb-misc.c
+++ b/drivers/usb/imx/imx-usb-misc.c
@@ -506,10 +506,53 @@ static int imx_usbmisc_probe(struct device_d *dev)
return 0;
}
+static __maybe_unused struct of_device_id imx_usbmisc_dt_ids[] = {
+#ifdef CONFIG_ARCH_IMX25
+ {
+ .compatible = "fsl,imx25-usbmisc",
+ .data = (unsigned long)&mx25_data,
+ },
+#endif
+#if defined(CONFIG_ARCH_IMX27) || defined(CONFIG_ARCH_IMX31)
+ {
+ .compatible = "fsl,imx27-usbmisc",
+ .data = (unsigned long)&mx27_mx31_data,
+ },
+#endif
+#ifdef CONFIG_ARCH_IMX35
+ {
+ .compatible = "fsl,imx35-usbmisc",
+ .data = (unsigned long)&mx35_data,
+ },
+#endif
+#ifdef CONFIG_ARCH_IMX51
+ {
+ .compatible = "fsl,imx51-usbmisc",
+ .data = (unsigned long)&mx5_data,
+ },
+#endif
+#ifdef CONFIG_ARCH_IMX53
+ {
+ .name = "fsl,imx53-usbmisc",
+ .data = (unsigned long)&mx5_data,
+ },
+#endif
+#ifdef CONFIG_ARCH_IMX6
+ {
+ .compatible = "fsl,imx6q-usbmisc",
+ .data = (unsigned long)&mx6_data,
+ },
+#endif
+ {
+ /* sentinel */
+ }
+};
+
static struct driver_d imx_usbmisc_driver = {
.name = "imx-usbmisc",
.probe = imx_usbmisc_probe,
.id_table = imx_usbmisc_ids,
+ .of_compatible = DRV_OF_COMPAT(imx_usbmisc_dt_ids),
};
static int imx_usbmisc_init(void)
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/3] USB: chipidea-imx: add basic device tree support
2013-05-27 21:59 [PATCH 1/3] USB: imx-usb-misc: add device tree support Philipp Zabel
@ 2013-05-27 21:59 ` Philipp Zabel
2013-05-27 21:59 ` [PATCH 3/3] USB: imx-usb-phy: add " Philipp Zabel
1 sibling, 0 replies; 3+ messages in thread
From: Philipp Zabel @ 2013-05-27 21:59 UTC (permalink / raw)
To: barebox
This adds device tree support to the chipidea-imx driver.
There is no way to set flags or enable ULPI yet. Only host
mode is supported for now.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
---
drivers/usb/imx/chipidea-imx.c | 33 ++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
index 1570f90..87e6a9d 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -29,11 +29,11 @@ static int imx_chipidea_port_init(void *drvdata)
struct imxusb_platformdata *pdata = dev->platform_data;
int ret;
- ret = imx_usbmisc_port_init(dev->id, pdata->flags);
+ ret = imx_usbmisc_port_init(dev->id, pdata ? pdata->flags : 0);
if (ret)
dev_err(dev, "misc init failed: %s\n", strerror(-ret));
- if (pdata->init)
+ if (pdata && pdata->init)
pdata->init(dev->id);
return ret;
@@ -45,7 +45,7 @@ static int imx_chipidea_port_post_init(void *drvdata)
struct imxusb_platformdata *pdata = dev->platform_data;
int ret;
- ret = imx_usbmisc_port_post_init(dev->id, pdata->flags);
+ ret = imx_usbmisc_port_post_init(dev->id, pdata ? pdata->flags : 0);
if (ret)
dev_err(dev, "post misc init failed: %s\n", strerror(-ret));
@@ -60,7 +60,16 @@ static int imx_chipidea_probe(struct device_d *dev)
struct ehci_data data = {};
uint32_t portsc;
- if (!pdata) {
+ if (IS_ENABLED(CONFIG_OFDEVICE) && dev->device_node) {
+ const void *args;
+
+ ret = of_parse_phandles_with_args(dev->device_node,
+ "fsl,usbmisc", "#index-cells", 0, NULL, &args);
+ if (ret < 0)
+ return -EINVAL;
+
+ dev->id = be32_to_cpu(*((__be32 *)args));
+ } else if (!pdata) {
dev_err(dev, "no pdata!\n");
return -EINVAL;
}
@@ -75,12 +84,13 @@ static int imx_chipidea_probe(struct device_d *dev)
portsc = readl(base + 0x184);
portsc &= ~MXC_EHCI_PORTSC_MASK;
- portsc |= pdata->flags & MXC_EHCI_PORTSC_MASK;
+ if (pdata)
+ portsc |= pdata->flags & MXC_EHCI_PORTSC_MASK;
writel(portsc, base + 0x184);
imx_chipidea_port_init(dev);
- if ((pdata->flags & MXC_EHCI_PORTSC_MASK) == MXC_EHCI_MODE_ULPI) {
+ if (pdata && ((pdata->flags & MXC_EHCI_PORTSC_MASK) == MXC_EHCI_MODE_ULPI)) {
dev_dbg(dev, "using ULPI phy\n");
if (IS_ENABLED(CONFIG_USB_ULPI)) {
ret = ulpi_setup(base + 0x170, 1);
@@ -97,7 +107,7 @@ static int imx_chipidea_probe(struct device_d *dev)
data.hcor = base + 0x140;
data.flags = EHCI_HAS_TT;
- if (pdata->mode == IMX_USB_MODE_HOST && IS_ENABLED(CONFIG_USB_EHCI)) {
+ if (!pdata || (pdata->mode == IMX_USB_MODE_HOST && IS_ENABLED(CONFIG_USB_EHCI))) {
ret = ehci_register(dev, &data);
} else if (pdata->mode == IMX_USB_MODE_DEVICE && IS_ENABLED(CONFIG_USB_GADGET_DRIVER_ARC)) {
ret = ci_udc_register(dev, base);
@@ -109,8 +119,17 @@ static int imx_chipidea_probe(struct device_d *dev)
return ret;
};
+static __maybe_unused struct of_device_id imx_chipidea_dt_ids[] = {
+ {
+ .compatible = "fsl,imx27-usb",
+ }, {
+ /* sentinel */
+ }
+};
+
static struct driver_d imx_chipidea_driver = {
.name = "imx-usb",
.probe = imx_chipidea_probe,
+ .of_compatible = DRV_OF_COMPAT(imx_chipidea_dt_ids),
};
device_platform_driver(imx_chipidea_driver);
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3/3] USB: imx-usb-phy: add device tree support
2013-05-27 21:59 [PATCH 1/3] USB: imx-usb-misc: add device tree support Philipp Zabel
2013-05-27 21:59 ` [PATCH 2/3] USB: chipidea-imx: add basic " Philipp Zabel
@ 2013-05-27 21:59 ` Philipp Zabel
1 sibling, 0 replies; 3+ messages in thread
From: Philipp Zabel @ 2013-05-27 21:59 UTC (permalink / raw)
To: barebox
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
---
drivers/usb/imx/imx-usb-phy.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/imx/imx-usb-phy.c b/drivers/usb/imx/imx-usb-phy.c
index ce9c93f..8eb832e 100644
--- a/drivers/usb/imx/imx-usb-phy.c
+++ b/drivers/usb/imx/imx-usb-phy.c
@@ -93,13 +93,26 @@ err_free:
return ret;
};
+static __maybe_unused struct of_device_id imx_usbphy_dt_ids[] = {
+ {
+ .compatible = "fsl,imx23-usbphy",
+ }, {
+ /* sentinel */
+ }
+};
+
static struct driver_d imx_usbphy_driver = {
.name = "imx-usb-phy",
.probe = imx_usbphy_probe,
+ .of_compatible = DRV_OF_COMPAT(imx_usbphy_dt_ids),
};
static int imx_usbphy_init(void)
{
return platform_driver_register(&imx_usbphy_driver);
}
-coredevice_initcall(imx_usbphy_init);
+/*
+ * Make sure this is initialized after gpt, since we
+ * need timers for the udelay in imx_usbphy_enable.
+ */
+fs_initcall(imx_usbphy_init);
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-05-27 21:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-27 21:59 [PATCH 1/3] USB: imx-usb-misc: add device tree support Philipp Zabel
2013-05-27 21:59 ` [PATCH 2/3] USB: chipidea-imx: add basic " Philipp Zabel
2013-05-27 21:59 ` [PATCH 3/3] USB: imx-usb-phy: add " Philipp Zabel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox