mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Florian Vallee <fvallee@eukrea.fr>
To: barebox@lists.infradead.org
Cc: "Florian Vallee" <fvallee@eukrea.fr>, "Eric Bénard" <eric@eukrea.com>
Subject: [PATCH 2/3] eukrea-cpuimx35: setup usb through chipidea-imx driver
Date: Tue,  1 Dec 2015 14:46:47 +0100	[thread overview]
Message-ID: <1448977608-4950-2-git-send-email-fvallee@eukrea.fr> (raw)
In-Reply-To: <1448977608-4950-1-git-send-email-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_cpuimx35/eukrea_cpuimx35.c | 38 ++++++++++-------------
 1 file changed, 16 insertions(+), 22 deletions(-)

diff --git a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
index 378f4e8..7b3993d 100644
--- a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
+++ b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
@@ -91,27 +91,18 @@ static struct imx_ipu_fb_platform_data ipu_fb_data = {
 };
 
 #ifdef CONFIG_USB
-static void imx35_usb_init(void)
-{
-	unsigned int tmp;
+#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
 
-	/* Host 1 */
-	tmp = readl(MX35_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 | MX35_H1_PM_BIT | MX35_H1_TLL_BIT ;
-	tmp |= MX35_H1_IPPUE_DOWN_BIT;
-	writel(tmp, MX35_USB_OTG_BASE_ADDR + 0x600);
-
-	tmp = readl(MX35_USB_OTG_BASE_ADDR + 0x584);
-	tmp |= 3 << 30;
-	writel(tmp, MX35_USB_OTG_BASE_ADDR + 0x584);
-
-	/* Set to Host mode */
-	tmp = readl(MX35_USB_OTG_BASE_ADDR + 0x5a8);
-	writel(tmp | 0x3, MX35_USB_OTG_BASE_ADDR + 0x5a8);
-}
+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
@@ -206,9 +197,12 @@ static int eukrea_cpuimx35_devices_init(void)
 	gpio_direction_output(1, 0);
 
 #ifdef CONFIG_USB
-	imx35_usb_init();
-	add_generic_usb_ehci_device(DEVICE_ID_DYNAMIC, MX35_USB_HS_BASE_ADDR, NULL);
+#ifndef CONFIG_USB_GADGET
+	imx_add_usb((void *)MX35_USB_OTG_BASE_ADDR, 0, &otg_pdata);
 #endif
+	imx_add_usb((void *)MX35_USB_HS_BASE_ADDR, 1, &hs_pdata);
+#endif
+
 #ifdef CONFIG_USB_GADGET
 	/* Workaround ENGcm09152 */
 	tmp = readl(MX35_USB_OTG_BASE_ADDR + 0x608);
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2015-12-01 13:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-01 13:46 [PATCH 1/3] imx35: register usb-misc by default Florian Vallee
2015-12-01 13:46 ` Florian Vallee [this message]
2015-12-01 13:46 ` [PATCH 3/3] eukrea-cpuimx35: update defconfig Florian Vallee
2015-12-02  6:56 ` [PATCH 1/3] imx35: register usb-misc by default 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=1448977608-4950-2-git-send-email-fvallee@eukrea.fr \
    --to=fvallee@eukrea.fr \
    --cc=barebox@lists.infradead.org \
    --cc=eric@eukrea.com \
    /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