From: "Eric Bénard" <eric@eukrea.com>
To: barebox@lists.infradead.org
Cc: Florian Vallee <fvallee@eukrea.fr>
Subject: [PATCH 4/6] eukrea-cpuimx25: setup usb through chipidea-imx driver
Date: Fri, 25 Sep 2015 17:48:50 +0200 [thread overview]
Message-ID: <1443196132-573-4-git-send-email-eric@eukrea.com> (raw)
In-Reply-To: <1443196132-573-1-git-send-email-eric@eukrea.com>
From: Florian Vallee <fvallee@eukrea.fr>
OTG and HOST port are tested with a mass storage device.
Signed-off-by: Florian Vallee <fvallee@eukrea.fr>
Signed-off-by: Eric Bénard <eric@eukrea.com>
---
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 69 +++++++++++------------
1 file changed, 32 insertions(+), 37 deletions(-)
diff --git a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
index 78d2bd4..4ab5b95 100644
--- a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
+++ b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
@@ -87,36 +87,6 @@ struct gpio_led led0 = {
.active_low = 1,
};
-#ifdef CONFIG_USB
-static void imx25_usb_init(void)
-{
- unsigned int tmp;
-
- /* Host 1 */
- tmp = readl(MX25_USB_OTG_BASE_ADDR + 0x600);
- tmp &= ~(MX35_H1_SIC_MASK | MX35_H1_PM_BIT | MX35_H1_TLL_BIT |
- MX35_H1_USBTE_BIT | MX35_H1_IPPUE_DOWN_BIT | MX35_H1_IPPUE_UP_BIT);
- tmp |= (MXC_EHCI_INTERFACE_SINGLE_UNI) << MX35_H1_SIC_SHIFT;
- tmp |= MX35_H1_USBTE_BIT;
- tmp |= MX35_H1_IPPUE_DOWN_BIT;
- writel(tmp, MX25_USB_OTG_BASE_ADDR + 0x600);
-
- tmp = readl(MX25_USB_OTG_BASE_ADDR + 0x584);
- tmp |= 3 << 30;
- writel(tmp, MX25_USB_OTG_BASE_ADDR + 0x584);
-
- /* Set to Host mode */
- tmp = readl(MX25_USB_OTG_BASE_ADDR + 0x5a8);
- writel(tmp | 0x3, MX25_USB_OTG_BASE_ADDR + 0x5a8);
-}
-
-#endif
-
-static struct fsl_usb2_platform_data usb_pdata = {
- .operating_mode = FSL_USB2_DR_DEVICE,
- .phy_mode = FSL_USB2_PHY_UTMI,
-};
-
static iomux_v3_cfg_t eukrea_cpuimx25_pads[] = {
MX25_PAD_FEC_MDC__FEC_MDC,
MX25_PAD_FEC_MDIO__FEC_MDIO,
@@ -173,6 +143,28 @@ static iomux_v3_cfg_t eukrea_cpuimx25_pads[] = {
MX25_PAD_VSTBY_ACK__GPIO_3_18,
};
+#ifdef CONFIG_USB
+#ifndef CONFIG_USB_GADGET
+struct imxusb_platformdata otg_pdata = {
+ .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
+ .mode = IMX_USB_MODE_HOST,
+ .phymode = USBPHY_INTERFACE_MODE_UTMI,
+};
+#endif
+
+struct imxusb_platformdata hs_pdata = {
+ .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY | MXC_EHCI_IPPUE_DOWN,
+ .mode = IMX_USB_MODE_HOST,
+};
+#endif
+
+#ifdef CONFIG_USB_GADGET
+static struct fsl_usb2_platform_data usb_pdata = {
+ .operating_mode = FSL_USB2_DR_DEVICE,
+ .phy_mode = FSL_USB2_PHY_UTMI,
+};
+#endif
+
static int eukrea_cpuimx25_devices_init(void)
{
mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads,
@@ -206,13 +198,6 @@ static int eukrea_cpuimx25_devices_init(void)
imx25_add_fb(&eukrea_cpuimx25_fb_data);
- imx25_add_i2c0(NULL);
- imx25_add_mmc0(NULL);
-
-#ifdef CONFIG_USB
- imx25_usb_init();
- add_generic_usb_ehci_device(DEVICE_ID_DYNAMIC, MX25_USB_OTG_BASE_ADDR + 0x400, NULL);
-#endif
#ifdef CONFIG_USB_GADGET
/* Workaround ENGcm09152 */
writel(readl(MX25_USB_OTG_BASE_ADDR + 0x608) | (1 << 23), MX25_USB_OTG_BASE_ADDR + 0x608);
@@ -220,6 +205,16 @@ static int eukrea_cpuimx25_devices_init(void)
IORESOURCE_MEM, &usb_pdata);
#endif
+#ifdef CONFIG_USB
+#ifndef CONFIG_USB_GADGET
+ imx_add_usb((void *)MX25_USB_OTG_BASE_ADDR, 0, &otg_pdata);
+#endif
+ imx_add_usb((void *)MX25_USB_HS_BASE_ADDR, 1, &hs_pdata);
+#endif
+
+ imx25_add_mmc0(NULL);
+ imx25_add_i2c0(NULL);
+
armlinux_set_architecture(MACH_TYPE_EUKREA_CPUIMX25SD);
return 0;
--
2.4.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2015-09-25 15:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-25 15:48 [PATCH 1/6] eukrea-cpuimx25: fix boot Eric Bénard
2015-09-25 15:48 ` [PATCH 2/6] chipidea-imx: allow phymode configuration in pdata Eric Bénard
2015-09-25 15:48 ` [PATCH 3/6] imx25: register usb-misc by default Eric Bénard
2015-09-25 15:48 ` Eric Bénard [this message]
2015-09-25 15:48 ` [PATCH 5/6] eukrea-cpuimx25: enable dfu sequence conditionaly Eric Bénard
2015-09-25 15:48 ` [PATCH 6/6] eukrea-cpuimx25: update defconfig Eric Bénard
2015-09-29 6:48 ` [PATCH 1/6] eukrea-cpuimx25: fix boot Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1443196132-573-4-git-send-email-eric@eukrea.com \
--to=eric@eukrea.com \
--cc=barebox@lists.infradead.org \
--cc=fvallee@eukrea.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox