* [PATCH 1/9] USB ehci: Allow to register independently from device
2012-12-13 17:00 [PATCH] i.MX chipidea support Sascha Hauer
@ 2012-12-13 17:00 ` Sascha Hauer
2012-12-13 17:00 ` [PATCH 2/9] USB i.MX: Add chipidea driver support Sascha Hauer
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2012-12-13 17:00 UTC (permalink / raw)
To: barebox
The EHCI core often is part of a otg core. Allow it to be registered
separately from another driver.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/usb/host/ehci-hcd.c | 46 ++++++++++++++++++++++++++-----------------
include/usb/ehci.h | 17 ++++++++++++++--
2 files changed, 43 insertions(+), 20 deletions(-)
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index d8814aa..d6083e0 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -807,32 +807,18 @@ submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
return -1;
}
-static int ehci_probe(struct device_d *dev)
+int ehci_register(struct device_d *dev, struct ehci_data *data)
{
struct usb_host *host;
struct ehci_priv *ehci;
uint32_t reg;
- struct ehci_platform_data *pdata = dev->platform_data;
ehci = xzalloc(sizeof(struct ehci_priv));
host = &ehci->host;
dev->priv = ehci;
-
- /* default to EHCI_HAS_TT to not change behaviour of boards
- * without platform_data
- */
- if (pdata)
- ehci->flags = pdata->flags;
- else
- ehci->flags = EHCI_HAS_TT;
-
- if (dev->num_resources < 2) {
- printf("echi: need 2 resources base and data");
- return -ENODEV;
- }
-
- ehci->hccr = dev_request_mem_region(dev, 0);
- ehci->hcor = dev_request_mem_region(dev, 1);
+ ehci->flags = data->flags;
+ ehci->hccr = data->hccr;
+ ehci->hcor = data->hcor;
ehci->qh_list = dma_alloc_coherent(sizeof(struct QH) * NUM_TD);
ehci->td = dma_alloc_coherent(sizeof(struct qTD) * NUM_TD);
@@ -854,6 +840,30 @@ static int ehci_probe(struct device_d *dev)
return 0;
}
+static int ehci_probe(struct device_d *dev)
+{
+ struct ehci_data data;
+ struct ehci_platform_data *pdata = dev->platform_data;
+
+ /* default to EHCI_HAS_TT to not change behaviour of boards
+ * without platform_data
+ */
+ if (pdata)
+ data.flags = pdata->flags;
+ else
+ data.flags = EHCI_HAS_TT;
+
+ if (dev->num_resources < 2) {
+ printf("echi: need 2 resources base and data");
+ return -ENODEV;
+ }
+
+ data.hccr = dev_request_mem_region(dev, 0);
+ data.hcor = dev_request_mem_region(dev, 1);
+
+ return ehci_register(dev, &data);
+}
+
static void ehci_remove(struct device_d *dev)
{
struct ehci_priv *ehci = dev->priv;
diff --git a/include/usb/ehci.h b/include/usb/ehci.h
index 2ec862c..4377116 100644
--- a/include/usb/ehci.h
+++ b/include/usb/ehci.h
@@ -5,8 +5,21 @@
struct ehci_platform_data {
unsigned long flags;
- unsigned long hccr_offset;
- unsigned long hcor_offset;
};
+struct ehci_data {
+ void __iomem *hccr;
+ void __iomem *hcor;
+ unsigned long flags;
+};
+
+#ifdef CONFIG_USB_EHCI
+int ehci_register(struct device_d *dev, struct ehci_data *data);
+#else
+static inline int ehci_register(struct device_d *dev, struct ehci_data *data)
+{
+ return -ENOSYS;
+}
+#endif
+
#endif /* __USB_EHCI_H */
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/9] USB i.MX: Add chipidea driver support
2012-12-13 17:00 [PATCH] i.MX chipidea support Sascha Hauer
2012-12-13 17:00 ` [PATCH 1/9] USB ehci: Allow to register independently from device Sascha Hauer
@ 2012-12-13 17:00 ` Sascha Hauer
2012-12-13 17:00 ` [PATCH 3/9] ARM i.MX27: Add USB device functions Sascha Hauer
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2012-12-13 17:00 UTC (permalink / raw)
To: barebox
For proper USB function the usbmisc registers have to be initialized.
This patch adds a driver which matches for the usbmisc registers. This
driver is called from a new driver which binds to the USB ports to
configure the misc registers. After that the driver registers the EHCI
driver and an ULPI transceiver if necessary. Currently only host mode
is supported, but device support can be added later.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/usb/Kconfig | 2 +
drivers/usb/Makefile | 1 +
drivers/usb/imx/Kconfig | 15 ++
drivers/usb/imx/Makefile | 1 +
drivers/usb/imx/chipidea-imx.c | 91 +++++++++
drivers/usb/imx/imx-usb-misc.c | 410 ++++++++++++++++++++++++++++++++++++++++
include/usb/chipidea-imx.h | 46 +++++
7 files changed, 566 insertions(+)
create mode 100644 drivers/usb/imx/Kconfig
create mode 100644 drivers/usb/imx/Makefile
create mode 100644 drivers/usb/imx/chipidea-imx.c
create mode 100644 drivers/usb/imx/imx-usb-misc.c
create mode 100644 include/usb/chipidea-imx.h
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index acdb4c6..0b349bf 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -3,6 +3,8 @@ menuconfig USB
if USB
+source drivers/usb/imx/Kconfig
+
source drivers/usb/host/Kconfig
source drivers/usb/otg/Kconfig
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index be4b371..3cefab7 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -1,4 +1,5 @@
obj-$(CONFIG_USB) += core/
+obj-$(CONFIG_USB_IMX_CHIPIDEA) += imx/
obj-$(CONFIG_USB_GADGET) += gadget/
obj-$(CONFIG_USB_STORAGE) += storage/
obj-y += host/
diff --git a/drivers/usb/imx/Kconfig b/drivers/usb/imx/Kconfig
new file mode 100644
index 0000000..2c52e72
--- /dev/null
+++ b/drivers/usb/imx/Kconfig
@@ -0,0 +1,15 @@
+
+config USB_IMX_CHIPIDEA
+ bool "i.MX USB support (read help)"
+ depends on ARCH_IMX
+ help
+ The Freescale i.MX SoCs have a variant of the chipidea ci13xxx for
+ USB support. Traditionally in barebox this is supported through the
+ EHCI driver for USB host and the ARC USB gadget driver for device.
+ This option instead enables support for i.MX chipidea support which
+ acts as a toplevel driver for the i.MX USB support. The chipidea
+ support also configures the usbmisc registers which traditionally
+ are configured in the board file.
+ This driver is recommended for new designs, but it needs board
+ support to work.
+ It's safe to say yes here. Also select EHCI support for USB host.
diff --git a/drivers/usb/imx/Makefile b/drivers/usb/imx/Makefile
new file mode 100644
index 0000000..e37361c
--- /dev/null
+++ b/drivers/usb/imx/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_USB_IMX_CHIPIDEA) += imx-usb-misc.o chipidea-imx.o
diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
new file mode 100644
index 0000000..66eb1ad
--- /dev/null
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2012 Sascha Hauer <s.hauer@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include <common.h>
+#include <init.h>
+#include <io.h>
+#include <driver.h>
+#include <usb/ehci.h>
+#include <usb/chipidea-imx.h>
+#include <usb/ulpi.h>
+
+#define MXC_EHCI_PORTSC_MASK (0xf << 28)
+
+static int imx_chipidea_probe(struct device_d *dev)
+{
+ struct imxusb_platformdata *pdata = dev->platform_data;
+ int ret;
+ void __iomem *base;
+ struct ehci_data data;
+ uint32_t portsc;
+
+ if (!pdata) {
+ dev_err(dev, "no pdata!\n");
+ return -EINVAL;
+ }
+
+ base = dev_request_mem_region(dev, 0);
+ if (!base)
+ return -ENODEV;
+
+ portsc = readl(base + 0x184);
+ portsc &= ~MXC_EHCI_PORTSC_MASK;
+ portsc |= pdata->flags & MXC_EHCI_PORTSC_MASK;
+ writel(portsc, base + 0x184);
+
+ ret = imx_usbmisc_port_init(dev->id, pdata->flags);
+ if (ret) {
+ dev_err(dev, "failed to init misc regs: %s\n", strerror(-ret));
+ return ret;
+ }
+
+ if ((pdata->flags & MXC_EHCI_PORTSC_MASK) == MXC_EHCI_MODE_ULPI) {
+ dev_dbg(dev, "using ULPI phy\n");
+ if (IS_ENABLED(CONFIG_USB_ULPPI)) {
+ ret = ulpi_setup(base + 0x170, 1);
+ } else {
+ dev_err(dev, "no ULPI support available\n");
+ ret = -ENODEV;
+ }
+
+ if (ret)
+ return ret;
+ }
+
+ data.hccr = base + 0x100;
+ data.hcor = base + 0x140;
+ data.flags = EHCI_HAS_TT;
+
+ if (pdata->mode == IMX_USB_MODE_HOST) {
+ ret = ehci_register(dev, &data);
+ } else {
+ /*
+ * Not yet implemented. Register USB gadget driver here.
+ */
+ ret = -ENOSYS;
+ }
+
+ return ret;
+};
+
+static struct driver_d imx_chipidea_driver = {
+ .name = "imx-usb",
+ .probe = imx_chipidea_probe,
+};
+
+static int imx_chipidea_init(void)
+{
+ return platform_driver_register(&imx_chipidea_driver);
+}
+device_initcall(imx_chipidea_init);
diff --git a/drivers/usb/imx/imx-usb-misc.c b/drivers/usb/imx/imx-usb-misc.c
new file mode 100644
index 0000000..7c0ba5c
--- /dev/null
+++ b/drivers/usb/imx/imx-usb-misc.c
@@ -0,0 +1,410 @@
+/*
+ * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include <common.h>
+#include <init.h>
+#include <io.h>
+#include <usb/chipidea-imx.h>
+
+#define MX25_OTG_SIC_SHIFT 29
+#define MX25_OTG_SIC_MASK (0x3 << MX25_OTG_SIC_SHIFT)
+#define MX25_OTG_PM_BIT (1 << 24)
+#define MX25_OTG_PP_BIT (1 << 11)
+#define MX25_OTG_OCPOL_BIT (1 << 3)
+
+#define MX25_H1_SIC_SHIFT 21
+#define MX25_H1_SIC_MASK (0x3 << MX25_H1_SIC_SHIFT)
+#define MX25_H1_PP_BIT (1 << 18)
+#define MX25_H1_PM_BIT (1 << 8)
+#define MX25_H1_IPPUE_UP_BIT (1 << 7)
+#define MX25_H1_IPPUE_DOWN_BIT (1 << 6)
+#define MX25_H1_TLL_BIT (1 << 5)
+#define MX25_H1_USBTE_BIT (1 << 4)
+#define MX25_H1_OCPOL_BIT (1 << 2)
+
+static __maybe_unused int mx25_initialize_usb_hw(void __iomem *base, int port, unsigned int flags)
+{
+ unsigned int v;
+
+ v = readl(base);
+
+ switch (port) {
+ case 0: /* OTG port */
+ v &= ~(MX25_OTG_SIC_MASK | MX25_OTG_PM_BIT | MX25_OTG_PP_BIT |
+ MX25_OTG_OCPOL_BIT);
+ v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX25_OTG_SIC_SHIFT;
+
+ if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+ v |= MX25_OTG_PM_BIT;
+
+ if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+ v |= MX25_OTG_PP_BIT;
+
+ if (!(flags & MXC_EHCI_OC_PIN_ACTIVE_LOW))
+ v |= MX25_OTG_OCPOL_BIT;
+
+ break;
+ case 1: /* H1 port */
+ v &= ~(MX25_H1_SIC_MASK | MX25_H1_PM_BIT | MX25_H1_PP_BIT |
+ MX25_H1_OCPOL_BIT | MX25_H1_TLL_BIT | MX25_H1_USBTE_BIT |
+ MX25_H1_IPPUE_DOWN_BIT | MX25_H1_IPPUE_UP_BIT);
+ v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX25_H1_SIC_SHIFT;
+
+ if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+ v |= MX25_H1_PM_BIT;
+
+ if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+ v |= MX25_H1_PP_BIT;
+
+ if (!(flags & MXC_EHCI_OC_PIN_ACTIVE_LOW))
+ v |= MX25_H1_OCPOL_BIT;
+
+ if (!(flags & MXC_EHCI_TLL_ENABLED))
+ v |= MX25_H1_TLL_BIT;
+
+ if (flags & MXC_EHCI_INTERNAL_PHY)
+ v |= MX25_H1_USBTE_BIT;
+
+ if (flags & MXC_EHCI_IPPUE_DOWN)
+ v |= MX25_H1_IPPUE_DOWN_BIT;
+
+ if (flags & MXC_EHCI_IPPUE_UP)
+ v |= MX25_H1_IPPUE_UP_BIT;
+
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ writel(v, base);
+
+ return 0;
+}
+
+#define MX27_OTG_SIC_SHIFT 29
+#define MX27_OTG_SIC_MASK (0x3 << MX27_OTG_SIC_SHIFT)
+#define MX27_OTG_PM_BIT (1 << 24)
+
+#define MX27_H2_SIC_SHIFT 21
+#define MX27_H2_SIC_MASK (0x3 << MX27_H2_SIC_SHIFT)
+#define MX27_H2_PM_BIT (1 << 16)
+#define MX27_H2_DT_BIT (1 << 5)
+
+#define MX27_H1_SIC_SHIFT 13
+#define MX27_H1_SIC_MASK (0x3 << MX27_H1_SIC_SHIFT)
+#define MX27_H1_PM_BIT (1 << 8)
+#define MX27_H1_DT_BIT (1 << 4)
+
+static __maybe_unused int mx27_mx31_initialize_usb_hw(void __iomem *base, int port, unsigned int flags)
+{
+ unsigned int v;
+
+ v = readl(base);
+
+ switch (port) {
+ case 0: /* OTG port */
+ v &= ~(MX27_OTG_SIC_MASK | MX27_OTG_PM_BIT);
+ v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX27_OTG_SIC_SHIFT;
+
+ if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+ v |= MX27_OTG_PM_BIT;
+ break;
+ case 1: /* H1 port */
+ v &= ~(MX27_H1_SIC_MASK | MX27_H1_PM_BIT | MX27_H1_DT_BIT);
+ v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX27_H1_SIC_SHIFT;
+
+ if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+ v |= MX27_H1_PM_BIT;
+
+ if (!(flags & MXC_EHCI_TLL_ENABLED))
+ v |= MX27_H1_DT_BIT;
+
+ break;
+ case 2: /* H2 port */
+ v &= ~(MX27_H2_SIC_MASK | MX27_H2_PM_BIT | MX27_H2_DT_BIT);
+ v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX27_H2_SIC_SHIFT;
+
+ if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+ v |= MX27_H2_PM_BIT;
+
+ if (!(flags & MXC_EHCI_TLL_ENABLED))
+ v |= MX27_H2_DT_BIT;
+
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ writel(v, base);
+
+ return 0;
+}
+
+#define USBCTRL_OTGBASE_OFFSET 0x600
+
+#define MX35_OTG_SIC_SHIFT 29
+#define MX35_OTG_SIC_MASK (0x3 << MX35_OTG_SIC_SHIFT)
+#define MX35_OTG_PM_BIT (1 << 24)
+#define MX35_OTG_PP_BIT (1 << 11)
+#define MX35_OTG_OCPOL_BIT (1 << 3)
+
+#define MX35_H1_SIC_SHIFT 21
+#define MX35_H1_SIC_MASK (0x3 << MX35_H1_SIC_SHIFT)
+#define MX35_H1_PP_BIT (1 << 18)
+#define MX35_H1_PM_BIT (1 << 8)
+#define MX35_H1_IPPUE_UP_BIT (1 << 7)
+#define MX35_H1_IPPUE_DOWN_BIT (1 << 6)
+#define MX35_H1_TLL_BIT (1 << 5)
+#define MX35_H1_USBTE_BIT (1 << 4)
+#define MX35_H1_OCPOL_BIT (1 << 2)
+
+static __maybe_unused int mx35_initialize_usb_hw(void __iomem *base, int port, unsigned int flags)
+{
+ unsigned int v;
+
+ v = readl(base);
+
+ switch (port) {
+ case 0: /* OTG port */
+ v &= ~(MX35_OTG_SIC_MASK | MX35_OTG_PM_BIT | MX35_OTG_PP_BIT |
+ MX35_OTG_OCPOL_BIT);
+ v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX35_OTG_SIC_SHIFT;
+
+ if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+ v |= MX35_OTG_PM_BIT;
+
+ if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+ v |= MX35_OTG_PP_BIT;
+
+ if (!(flags & MXC_EHCI_OC_PIN_ACTIVE_LOW))
+ v |= MX35_OTG_OCPOL_BIT;
+
+ break;
+ case 1: /* H1 port */
+ v &= ~(MX35_H1_SIC_MASK | MX35_H1_PM_BIT | MX35_H1_PP_BIT |
+ MX35_H1_OCPOL_BIT | MX35_H1_TLL_BIT | MX35_H1_USBTE_BIT |
+ MX35_H1_IPPUE_DOWN_BIT | MX35_H1_IPPUE_UP_BIT);
+ v |= (flags & MXC_EHCI_INTERFACE_MASK) << MX35_H1_SIC_SHIFT;
+
+ if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+ v |= MX35_H1_PM_BIT;
+
+ if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+ v |= MX35_H1_PP_BIT;
+
+ if (!(flags & MXC_EHCI_OC_PIN_ACTIVE_LOW))
+ v |= MX35_H1_OCPOL_BIT;
+
+ if (!(flags & MXC_EHCI_TLL_ENABLED))
+ v |= MX35_H1_TLL_BIT;
+
+ if (flags & MXC_EHCI_INTERNAL_PHY)
+ v |= MX35_H1_USBTE_BIT;
+
+ if (flags & MXC_EHCI_IPPUE_DOWN)
+ v |= MX35_H1_IPPUE_DOWN_BIT;
+
+ if (flags & MXC_EHCI_IPPUE_UP)
+ v |= MX35_H1_IPPUE_UP_BIT;
+
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ writel(v, base);
+
+ return 0;
+}
+
+/* USB_CTRL */
+#define MX5_OTG_UCTRL_OWIE_BIT (1 << 27) /* OTG wakeup intr enable */
+#define MX5_OTG_UCTRL_OPM_BIT (1 << 24) /* OTG power mask */
+#define MX5_H1_UCTRL_H1UIE_BIT (1 << 12) /* Host1 ULPI interrupt enable */
+#define MX5_H1_UCTRL_H1WIE_BIT (1 << 11) /* HOST1 wakeup intr enable */
+#define MX5_H1_UCTRL_H1PM_BIT (1 << 8) /* HOST1 power mask */
+
+/* USB_PHY_CTRL_FUNC */
+#define MX5_OTG_PHYCTRL_OC_POL_BIT (1 << 9) /* OTG Polarity of Overcurrent */
+#define MX5_OTG_PHYCTRL_OC_DIS_BIT (1 << 8) /* OTG Disable Overcurrent Event */
+#define MX5_H1_OC_POL_BIT (1 << 6) /* UH1 Polarity of Overcurrent */
+#define MX5_H1_OC_DIS_BIT (1 << 5) /* UH1 Disable Overcurrent Event */
+#define MX5_OTG_PHYCTRL_PWR_POL_BIT (1 << 3) /* OTG Power Pin Polarity */
+
+/* USBH2CTRL */
+#define MX5_H2_UCTRL_H2UIE_BIT (1 << 8)
+#define MX5_H2_UCTRL_H2WIE_BIT (1 << 7)
+#define MX5_H2_UCTRL_H2PM_BIT (1 << 4)
+
+#define MX5_USBCTRL_OFFSET 0x0
+#define MX5_UTMI_PHY_CTRL_0 0x8
+#define MX5_UTMI_PHY_CTRL_1 0xc
+#define MX5_USBH2CTRL_OFFSET 0x14
+
+static __maybe_unused int mx5_initialize_usb_hw(void __iomem *base, int port,
+ unsigned int flags)
+{
+ unsigned int v;
+
+ switch (port) {
+ case 0: /* OTG port */
+ if (!(flags & MXC_EHCI_INTERNAL_PHY))
+ return 0;
+
+ /* Adjust UTMI PHY frequency to 24MHz */
+ v = readl(base + MX5_UTMI_PHY_CTRL_1);
+ v = (v & ~0x3) | 0x01;
+ writel(v, base + MX5_UTMI_PHY_CTRL_1);
+
+ v = readl(base + MX5_UTMI_PHY_CTRL_0);
+ v &= ~MX5_OTG_PHYCTRL_OC_POL_BIT;
+ v &= ~MX5_OTG_PHYCTRL_OC_DIS_BIT;
+ v &= ~MX5_OTG_PHYCTRL_PWR_POL_BIT;
+
+ if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW)
+ v |= MX5_OTG_PHYCTRL_OC_POL_BIT;
+
+ if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+ v |= MX5_OTG_PHYCTRL_OC_DIS_BIT;
+
+ if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+ v |= MX5_OTG_PHYCTRL_PWR_POL_BIT;
+
+ writel(v, base + MX5_UTMI_PHY_CTRL_0);
+
+ v = readl(base + MX5_USBCTRL_OFFSET);
+ v &= ~MX5_OTG_UCTRL_OWIE_BIT;
+ v &= ~MX5_OTG_UCTRL_OPM_BIT;
+
+ if (flags & MXC_EHCI_WAKEUP_ENABLED)
+ v |= MX5_OTG_UCTRL_OWIE_BIT;
+
+ if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+ v |= MX5_OTG_UCTRL_OPM_BIT;
+
+ writel(v, base + MX5_USBCTRL_OFFSET);
+
+ break;
+ case 1: /* H1 port */
+ v = readl(base + MX5_USBCTRL_OFFSET);
+ v &= ~MX5_H1_UCTRL_H1PM_BIT;
+
+ if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+ v |= MX5_H1_UCTRL_H1PM_BIT;
+
+ writel(v, base + MX5_USBCTRL_OFFSET);
+
+ break;
+ case 2: /* H2 port */
+ v = readl(base + MX5_USBH2CTRL_OFFSET);
+ v &= ~MX5_H2_UCTRL_H2PM_BIT;
+
+ if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
+ v |= MX5_H2_UCTRL_H2PM_BIT;
+
+ writel(v, base + MX5_USBH2CTRL_OFFSET);
+
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static struct platform_device_id imx_usbmisc_ids[] = {
+#ifdef CONFIG_ARCH_IMX25
+ {
+ .name = "imx25-usb-misc",
+ .driver_data = (unsigned long)&mx25_initialize_usb_hw,
+ },
+#endif
+#ifdef CONFIG_ARCH_IMX27
+ {
+ .name = "imx27-usb-misc",
+ .driver_data = (unsigned long)&mx27_mx31_initialize_usb_hw,
+ },
+#endif
+#ifdef CONFIG_ARCH_IMX31
+ {
+ .name = "imx31-usb-misc",
+ .driver_data = (unsigned long)&mx27_mx31_initialize_usb_hw,
+ },
+#endif
+#ifdef CONFIG_ARCH_IMX35
+ {
+ .name = "imx35-usb-misc",
+ .driver_data = (unsigned long)&mx35_initialize_usb_hw,
+ },
+#endif
+#ifdef CONFIG_ARCH_IMX51
+ {
+ .name = "imx51-usb-misc",
+ .driver_data = (unsigned long)&mx5_initialize_usb_hw,
+ },
+#endif
+#ifdef CONFIG_ARCH_IMX53
+ {
+ .name = "imx53-usb-misc",
+ .driver_data = (unsigned long)&mx5_initialize_usb_hw,
+ },
+#endif
+ {
+ /* sentinel */
+ },
+};
+
+static int (*__imx_usbmisc_port_init)(void __iomem *base, int port, unsigned flags);
+static void __iomem *usbmisc_base;
+
+int imx_usbmisc_port_init(int port, unsigned flags)
+{
+ if (!__imx_usbmisc_port_init)
+ return -ENODEV;
+
+ return __imx_usbmisc_port_init(usbmisc_base, port, flags);
+}
+
+static int imx_usbmisc_probe(struct device_d *dev)
+{
+ struct imx_serial_devtype_data *devtype;
+ int ret;
+
+ ret = dev_get_drvdata(dev, (unsigned long *)&devtype);
+ if (ret)
+ return ret;
+
+ usbmisc_base = dev_request_mem_region(dev, 0);
+ if (!usbmisc_base)
+ return -ENOMEM;
+
+ __imx_usbmisc_port_init = (void *)devtype;
+
+ return 0;
+}
+
+static struct driver_d imx_usbmisc_driver = {
+ .name = "imx-usbmisc",
+ .probe = imx_usbmisc_probe,
+ .id_table = imx_usbmisc_ids,
+};
+
+static int imx_usbmisc_init(void)
+{
+ platform_driver_register(&imx_usbmisc_driver);
+ return 0;
+}
+
+coredevice_initcall(imx_usbmisc_init);
diff --git a/include/usb/chipidea-imx.h b/include/usb/chipidea-imx.h
new file mode 100644
index 0000000..e98cc89
--- /dev/null
+++ b/include/usb/chipidea-imx.h
@@ -0,0 +1,46 @@
+#ifndef __USB_CHIPIDEA_IMX_H
+#define __USB_CHIPIDEA_IMX_H
+
+/*
+ * POTSC flags
+ */
+#define MXC_EHCI_SERIAL (1 << 29)
+#define MXC_EHCI_MODE_UTMI_8BIT (0 << 30)
+#define MXC_EHCI_MODE_UTMI_16_BIT ((0 << 30) | (1 << 28))
+#define MXC_EHCI_MODE_PHILIPS (1 << 30)
+#define MXC_EHCI_MODE_ULPI (2 << 30)
+#define MXC_EHCI_MODE_SERIAL (3 << 30)
+
+/*
+ * USB misc flags
+ */
+#define MXC_EHCI_INTERFACE_DIFF_UNI (0 << 0)
+#define MXC_EHCI_INTERFACE_DIFF_BI (1 << 0)
+#define MXC_EHCI_INTERFACE_SINGLE_UNI (2 << 0)
+#define MXC_EHCI_INTERFACE_SINGLE_BI (3 << 0)
+#define MXC_EHCI_INTERFACE_MASK (0xf)
+
+#define MXC_EHCI_POWER_PINS_ENABLED (1 << 5)
+#define MXC_EHCI_PWR_PIN_ACTIVE_HIGH (1 << 6)
+#define MXC_EHCI_OC_PIN_ACTIVE_LOW (1 << 7)
+#define MXC_EHCI_TLL_ENABLED (1 << 8)
+
+#define MXC_EHCI_INTERNAL_PHY (1 << 9)
+#define MXC_EHCI_IPPUE_DOWN (1 << 10)
+#define MXC_EHCI_IPPUE_UP (1 << 11)
+#define MXC_EHCI_WAKEUP_ENABLED (1 << 12)
+#define MXC_EHCI_ITC_NO_THRESHOLD (1 << 13)
+
+enum imx_usb_mode {
+ IMX_USB_MODE_HOST,
+ IMX_USB_MODE_DEVICE,
+};
+
+struct imxusb_platformdata {
+ unsigned long flags;
+ enum imx_usb_mode mode;
+};
+
+int imx_usbmisc_port_init(int port, unsigned flags);
+
+#endif /* __USB_CHIPIDEA_IMX_H */
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/9] ARM i.MX27: Add USB device functions
2012-12-13 17:00 [PATCH] i.MX chipidea support Sascha Hauer
2012-12-13 17:00 ` [PATCH 1/9] USB ehci: Allow to register independently from device Sascha Hauer
2012-12-13 17:00 ` [PATCH 2/9] USB i.MX: Add chipidea driver support Sascha Hauer
@ 2012-12-13 17:00 ` Sascha Hauer
2012-12-13 17:00 ` [PATCH 4/9] ARM i.MX51: " Sascha Hauer
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2012-12-13 17:00 UTC (permalink / raw)
To: barebox
Register the USB misc devices and provide convenience wrappers to
register the USB ports for i.MX27.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-imx/devices.c | 5 +++++
arch/arm/mach-imx/imx27.c | 1 +
arch/arm/mach-imx/include/mach/devices-imx27.h | 15 +++++++++++++++
arch/arm/mach-imx/include/mach/devices.h | 2 ++
4 files changed, 23 insertions(+)
diff --git a/arch/arm/mach-imx/devices.c b/arch/arm/mach-imx/devices.c
index d82fbf7..682f39a 100644
--- a/arch/arm/mach-imx/devices.c
+++ b/arch/arm/mach-imx/devices.c
@@ -72,3 +72,8 @@ struct device_d *imx_add_pata(void *base)
{
return imx_add_device("imx-pata", -1, base, 0x1000, NULL);
}
+
+struct device_d *imx_add_usb(void *base, int id, struct imxusb_platformdata *pdata)
+{
+ return imx_add_device("imx-usb", id, base, 0x200, pdata);
+}
diff --git a/arch/arm/mach-imx/imx27.c b/arch/arm/mach-imx/imx27.c
index 31117f4..6d30276 100644
--- a/arch/arm/mach-imx/imx27.c
+++ b/arch/arm/mach-imx/imx27.c
@@ -118,6 +118,7 @@ static int imx27_init(void)
add_generic_device("imx1-gpio", 5, NULL, MX27_GPIO6_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL);
add_generic_device("imx21-wdt", 0, NULL, MX27_WDOG_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
add_generic_device("imx27-esdctl", 0, NULL, MX27_ESDCTL_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
+ add_generic_device("imx27-usb-misc", 0, NULL, MX27_USB_OTG_BASE_ADDR + 0x600, 0x100, IORESOURCE_MEM, NULL);
return 0;
}
diff --git a/arch/arm/mach-imx/include/mach/devices-imx27.h b/arch/arm/mach-imx/include/mach/devices-imx27.h
index 79da935..d6c884a 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx27.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx27.h
@@ -70,3 +70,18 @@ static inline struct device_d *imx27_add_mmc2(void *pdata)
{
return imx_add_mmc((void *)MX27_SDHC3_BASE_ADDR, 2, pdata);
}
+
+static inline struct device_d *imx27_add_usbotg(void *pdata)
+{
+ return imx_add_usb((void *)MX27_USB_OTG_BASE_ADDR, 0, pdata);
+}
+
+static inline struct device_d *imx27_add_usbh1(void *pdata)
+{
+ return imx_add_usb((void *)MX27_USB_OTG_BASE_ADDR + 0x200, 1, pdata);
+}
+
+static inline struct device_d *imx27_add_usbh2(void *pdata)
+{
+ return imx_add_usb((void *)MX27_USB_OTG_BASE_ADDR + 0x400, 2, pdata);
+}
diff --git a/arch/arm/mach-imx/include/mach/devices.h b/arch/arm/mach-imx/include/mach/devices.h
index 016778a..5929658 100644
--- a/arch/arm/mach-imx/include/mach/devices.h
+++ b/arch/arm/mach-imx/include/mach/devices.h
@@ -7,6 +7,7 @@
#include <mach/imxfb.h>
#include <mach/imx-ipu-fb.h>
#include <mach/esdhc.h>
+#include <usb/chipidea-imx.h>
struct device_d *imx_add_fec_imx27(void *base, struct fec_platform_data *pdata);
struct device_d *imx_add_fec_imx6(void *base, struct fec_platform_data *pdata);
@@ -21,3 +22,4 @@ struct device_d *imx_add_mmc(void *base, int id, void *pdata);
struct device_d *imx_add_esdhc(void *base, int id, struct esdhc_platform_data *pdata);
struct device_d *imx_add_kpp(void *base, struct matrix_keymap_data *pdata);
struct device_d *imx_add_pata(void *base);
+struct device_d *imx_add_usb(void *base, int id, struct imxusb_platformdata *pdata);
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/9] ARM i.MX51: Add USB device functions
2012-12-13 17:00 [PATCH] i.MX chipidea support Sascha Hauer
` (2 preceding siblings ...)
2012-12-13 17:00 ` [PATCH 3/9] ARM i.MX27: Add USB device functions Sascha Hauer
@ 2012-12-13 17:00 ` Sascha Hauer
2012-12-13 17:00 ` [PATCH 5/9] ARM i.MX31: " Sascha Hauer
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2012-12-13 17:00 UTC (permalink / raw)
To: barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-imx/imx51.c | 1 +
arch/arm/mach-imx/include/mach/devices-imx51.h | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/arch/arm/mach-imx/imx51.c b/arch/arm/mach-imx/imx51.c
index a62daf8..cffcca3 100644
--- a/arch/arm/mach-imx/imx51.c
+++ b/arch/arm/mach-imx/imx51.c
@@ -70,6 +70,7 @@ static int imx51_init(void)
add_generic_device("imx31-gpio", 3, NULL, MX51_GPIO4_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
add_generic_device("imx21-wdt", 0, NULL, MX51_WDOG_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
add_generic_device("imx51-esdctl", 0, NULL, MX51_ESDCTL_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
+ add_generic_device("imx51-usb-misc", 0, NULL, MX51_OTG_BASE_ADDR + 0x800, 0x100, IORESOURCE_MEM, NULL);
return 0;
}
diff --git a/arch/arm/mach-imx/include/mach/devices-imx51.h b/arch/arm/mach-imx/include/mach/devices-imx51.h
index 95497fa..ec8467a 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx51.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx51.h
@@ -98,3 +98,18 @@ static inline struct device_d *imx51_add_pata(void)
{
return imx_add_pata((void *)MX51_ATA_BASE_ADDR);
}
+
+static inline struct device_d *imx51_add_usbotg(void *pdata)
+{
+ return imx_add_usb((void *)MX51_OTG_BASE_ADDR, 0, pdata);
+}
+
+static inline struct device_d *imx51_add_usbh1(void *pdata)
+{
+ return imx_add_usb((void *)MX51_OTG_BASE_ADDR + 0x200, 1, pdata);
+}
+
+static inline struct device_d *imx51_add_usbh2(void *pdata)
+{
+ return imx_add_usb((void *)MX51_OTG_BASE_ADDR + 0x400, 2, pdata);
+}
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 5/9] ARM i.MX31: Add USB device functions
2012-12-13 17:00 [PATCH] i.MX chipidea support Sascha Hauer
` (3 preceding siblings ...)
2012-12-13 17:00 ` [PATCH 4/9] ARM i.MX51: " Sascha Hauer
@ 2012-12-13 17:00 ` Sascha Hauer
2012-12-13 17:00 ` [PATCH 6/9] ARM i.MX pcm038: switch to chipidea support Sascha Hauer
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2012-12-13 17:00 UTC (permalink / raw)
To: barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-imx/imx31.c | 1 +
arch/arm/mach-imx/include/mach/devices-imx31.h | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/arch/arm/mach-imx/imx31.c b/arch/arm/mach-imx/imx31.c
index 2882675..f0954b5 100644
--- a/arch/arm/mach-imx/imx31.c
+++ b/arch/arm/mach-imx/imx31.c
@@ -39,6 +39,7 @@ static int imx31_init(void)
add_generic_device("imx31-gpio", 2, NULL, MX31_GPIO3_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
add_generic_device("imx21-wdt", 0, NULL, MX31_WDOG_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
add_generic_device("imx31-esdctl", 0, NULL, MX31_ESDCTL_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL);
+ add_generic_device("imx31-usb-misc", 0, NULL, MX31_USB_OTG_BASE_ADDR + 0x600, 0x100, IORESOURCE_MEM, NULL);
return 0;
}
diff --git a/arch/arm/mach-imx/include/mach/devices-imx31.h b/arch/arm/mach-imx/include/mach/devices-imx31.h
index fe71930..15ceb34 100644
--- a/arch/arm/mach-imx/include/mach/devices-imx31.h
+++ b/arch/arm/mach-imx/include/mach/devices-imx31.h
@@ -51,3 +51,18 @@ static inline struct device_d *imx31_add_fb(struct imx_ipu_fb_platform_data *pda
{
return imx_add_ipufb((void *)MX31_IPU_CTRL_BASE_ADDR, pdata);
}
+
+static inline struct device_d *imx31_add_usbotg(void *pdata)
+{
+ return imx_add_usb((void *)MX31_USB_OTG_BASE_ADDR, 0, pdata);
+}
+
+static inline struct device_d *imx31_add_usbh1(void *pdata)
+{
+ return imx_add_usb((void *)MX31_USB_OTG_BASE_ADDR + 0x200, 1, pdata);
+}
+
+static inline struct device_d *imx31_add_usbh2(void *pdata)
+{
+ return imx_add_usb((void *)MX31_USB_OTG_BASE_ADDR + 0x400, 2, pdata);
+}
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 6/9] ARM i.MX pcm038: switch to chipidea support
2012-12-13 17:00 [PATCH] i.MX chipidea support Sascha Hauer
` (4 preceding siblings ...)
2012-12-13 17:00 ` [PATCH 5/9] ARM i.MX31: " Sascha Hauer
@ 2012-12-13 17:00 ` Sascha Hauer
2012-12-13 17:00 ` [PATCH 7/9] pcm038: Stop ongoing ULPI transfers before registering the transceiver Sascha Hauer
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2012-12-13 17:00 UTC (permalink / raw)
To: barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boards/pcm038/pcm970.c | 34 ++++++++--------------------------
arch/arm/configs/pcm038_defconfig | 1 +
2 files changed, 9 insertions(+), 26 deletions(-)
diff --git a/arch/arm/boards/pcm038/pcm970.c b/arch/arm/boards/pcm038/pcm970.c
index 93a1839..7b25110 100644
--- a/arch/arm/boards/pcm038/pcm970.c
+++ b/arch/arm/boards/pcm038/pcm970.c
@@ -21,34 +21,12 @@
#include <mach/weim.h>
#include <mach/gpio.h>
#include <mach/devices-imx27.h>
-#include <usb/ulpi.h>
+#include <usb/chipidea-imx.h>
#define GPIO_IDE_POWER (GPIO_PORTE + 18)
#define GPIO_IDE_PCOE (GPIO_PORTF + 7)
#define GPIO_IDE_RESET (GPIO_PORTF + 10)
-#ifdef CONFIG_USB
-static void pcm970_usbh2_init(void)
-{
- uint32_t temp;
-
- temp = readl(MX27_USB_OTG_BASE_ADDR + 0x600);
- temp &= ~((3 << 21) | 1);
- temp |= (1 << 5) | (1 << 16) | (1 << 19) | (1 << 20);
- writel(temp, MX27_USB_OTG_BASE_ADDR + 0x600);
-
- temp = readl(MX27_USB_OTG_BASE_ADDR + 0x584);
- temp &= ~(3 << 30);
- temp |= 2 << 30;
- writel(temp, MX27_USB_OTG_BASE_ADDR + 0x584);
-
- mdelay(10);
-
- if (!ulpi_setup((void *)(MX27_USB_OTG_BASE_ADDR + 0x570), 1))
- add_generic_usb_ehci_device(DEVICE_ID_DYNAMIC, MX27_USB_OTG_BASE_ADDR + 0x400, NULL);
-}
-#endif
-
#ifdef CONFIG_DISK_INTF_PLATFORM_IDE
static struct resource pcm970_ide_resources[] = {
{
@@ -168,6 +146,11 @@ static void pcm970_mmc_init(void)
imx27_add_mmc1(NULL);
}
+struct imxusb_platformdata pcm970_usbh2_pdata = {
+ .flags = MXC_EHCI_MODE_ULPI | MXC_EHCI_INTERFACE_DIFF_UNI,
+ .mode = IMX_USB_MODE_HOST,
+};
+
static int pcm970_init(void)
{
int i;
@@ -193,9 +176,8 @@ static int pcm970_init(void)
/* Configure SJA1000 on cs4 */
imx27_setup_weimcs(4, 0x0000DCF6, 0x444A0301, 0x44443302);
-#ifdef CONFIG_USB
- pcm970_usbh2_init();
-#endif
+ if (IS_ENABLED(CONFIG_USB))
+ imx27_add_usbh2(&pcm970_usbh2_pdata);
#ifdef CONFIG_DISK_INTF_PLATFORM_IDE
pcm970_ide_init();
diff --git a/arch/arm/configs/pcm038_defconfig b/arch/arm/configs/pcm038_defconfig
index bab4002..13e2451 100644
--- a/arch/arm/configs/pcm038_defconfig
+++ b/arch/arm/configs/pcm038_defconfig
@@ -68,6 +68,7 @@ CONFIG_NAND=y
# CONFIG_NAND_ECC_HW_SYNDROME is not set
CONFIG_NAND_IMX=y
CONFIG_USB=y
+CONFIG_USB_IMX_CHIPIDEA=y
CONFIG_USB_EHCI=y
CONFIG_USB_ULPI=y
CONFIG_VIDEO=y
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 7/9] pcm038: Stop ongoing ULPI transfers before registering the transceiver
2012-12-13 17:00 [PATCH] i.MX chipidea support Sascha Hauer
` (5 preceding siblings ...)
2012-12-13 17:00 ` [PATCH 6/9] ARM i.MX pcm038: switch to chipidea support Sascha Hauer
@ 2012-12-13 17:00 ` Sascha Hauer
2012-12-13 17:00 ` [PATCH 8/9] fixup! USB i.MX: Add chipidea driver support Sascha Hauer
2012-12-13 17:00 ` [PATCH 9/9] ARM i.MX pcm038: Update defconfig for chipidea driver Sascha Hauer
8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2012-12-13 17:00 UTC (permalink / raw)
To: barebox
The ULPI lines are normally input to the USB port. In order to configure
the ULPI transceiver properly the ongoing transfers must be stopped. This
can be done by configuring the the STP pin as gpio output and drinving
it high.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boards/pcm038/pcm970.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boards/pcm038/pcm970.c b/arch/arm/boards/pcm038/pcm970.c
index 7b25110..a50a1f2 100644
--- a/arch/arm/boards/pcm038/pcm970.c
+++ b/arch/arm/boards/pcm038/pcm970.c
@@ -160,7 +160,7 @@ static int pcm970_init(void)
PA1_PF_USBH2_DIR,
PA2_PF_USBH2_DATA7,
PA3_PF_USBH2_NXT,
- PA4_PF_USBH2_STP,
+ 4 | GPIO_PORTA | GPIO_GPIO | GPIO_OUT,
PD19_AF_USBH2_DATA4,
PD20_AF_USBH2_DATA3,
PD21_AF_USBH2_DATA6,
@@ -176,8 +176,14 @@ static int pcm970_init(void)
/* Configure SJA1000 on cs4 */
imx27_setup_weimcs(4, 0x0000DCF6, 0x444A0301, 0x44443302);
- if (IS_ENABLED(CONFIG_USB))
+ if (IS_ENABLED(CONFIG_USB)) {
+ /* Stop ULPI */
+ gpio_direction_output(4, 1);
+ mdelay(1);
+ imx_gpio_mode(PA4_PF_USBH2_STP);
+
imx27_add_usbh2(&pcm970_usbh2_pdata);
+ }
#ifdef CONFIG_DISK_INTF_PLATFORM_IDE
pcm970_ide_init();
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 8/9] fixup! USB i.MX: Add chipidea driver support
2012-12-13 17:00 [PATCH] i.MX chipidea support Sascha Hauer
` (6 preceding siblings ...)
2012-12-13 17:00 ` [PATCH 7/9] pcm038: Stop ongoing ULPI transfers before registering the transceiver Sascha Hauer
@ 2012-12-13 17:00 ` Sascha Hauer
2012-12-13 17:00 ` [PATCH 9/9] ARM i.MX pcm038: Update defconfig for chipidea driver Sascha Hauer
8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2012-12-13 17:00 UTC (permalink / raw)
To: barebox
---
drivers/usb/imx/chipidea-imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
index 66eb1ad..5b4c081 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -52,7 +52,7 @@ static int imx_chipidea_probe(struct device_d *dev)
if ((pdata->flags & MXC_EHCI_PORTSC_MASK) == MXC_EHCI_MODE_ULPI) {
dev_dbg(dev, "using ULPI phy\n");
- if (IS_ENABLED(CONFIG_USB_ULPPI)) {
+ if (IS_ENABLED(CONFIG_USB_ULPI)) {
ret = ulpi_setup(base + 0x170, 1);
} else {
dev_err(dev, "no ULPI support available\n");
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 9/9] ARM i.MX pcm038: Update defconfig for chipidea driver
2012-12-13 17:00 [PATCH] i.MX chipidea support Sascha Hauer
` (7 preceding siblings ...)
2012-12-13 17:00 ` [PATCH 8/9] fixup! USB i.MX: Add chipidea driver support Sascha Hauer
@ 2012-12-13 17:00 ` Sascha Hauer
8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2012-12-13 17:00 UTC (permalink / raw)
To: barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/configs/pcm038_defconfig | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/arm/configs/pcm038_defconfig b/arch/arm/configs/pcm038_defconfig
index 13e2451..e2f5388 100644
--- a/arch/arm/configs/pcm038_defconfig
+++ b/arch/arm/configs/pcm038_defconfig
@@ -2,7 +2,6 @@ CONFIG_ARCH_IMX=y
CONFIG_ARCH_IMX_EXTERNAL_BOOT_NAND=y
CONFIG_ARCH_IMX27=y
CONFIG_MACH_PCM038=y
-CONFIG_IMX_CLKO=y
CONFIG_AEABI=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
@@ -16,8 +15,6 @@ CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
CONFIG_MENU=y
-CONFIG_PARTITION=y
-CONFIG_PARTITION_DISK=y
CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/pcm038/env"
CONFIG_CMD_EDIT=y
@@ -32,7 +29,6 @@ CONFIG_CMD_TIME=y
CONFIG_CMD_ECHO_E=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_IOMEM=y
-CONFIG_CMD_MTEST=y
CONFIG_CMD_FLASH=y
CONFIG_CMD_BOOTM_SHOW_TYPE=y
CONFIG_CMD_BOOTM_VERBOSE=y
@@ -40,16 +36,16 @@ CONFIG_CMD_BOOTM_INITRD=y
CONFIG_CMD_BOOTM_OFTREE=y
CONFIG_CMD_BOOTM_OFTREE_UIMAGE=y
CONFIG_CMD_UIMAGE=y
-# CONFIG_CMD_BOOTZ is not set
# CONFIG_CMD_BOOTU is not set
CONFIG_CMD_RESET=y
CONFIG_CMD_GO=y
CONFIG_CMD_OFTREE=y
+CONFIG_CMD_MTEST=y
+CONFIG_CMD_SPLASH=y
CONFIG_CMD_TIMEOUT=y
CONFIG_CMD_PARTITION=y
CONFIG_CMD_MAGICVAR=y
CONFIG_CMD_MAGICVAR_HELP=y
-CONFIG_CMD_SPLASH=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_UNCOMPRESS=y
CONFIG_NET=y
@@ -71,6 +67,7 @@ CONFIG_USB=y
CONFIG_USB_IMX_CHIPIDEA=y
CONFIG_USB_EHCI=y
CONFIG_USB_ULPI=y
+CONFIG_USB_STORAGE=y
CONFIG_VIDEO=y
CONFIG_DRIVER_VIDEO_IMX=y
CONFIG_IMXFB_DRIVER_VIDEO_IMX_OVERLAY=y
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread