All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 8/9] usb: Add EHCI support for Armada 38x (mvebu)
Date: Mon, 29 Jun 2015 14:58:15 +0200	[thread overview]
Message-ID: <1435582696-30068-9-git-send-email-sr@denx.de> (raw)
In-Reply-To: <1435582696-30068-1-git-send-email-sr@denx.de>

This patch adds USB EHCI host support for the common mvebu platform.
Including the Armada 38x.

Tested on DB-88F6280-GP eval board.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Luka Perkov <luka.perkov@sartura.hr>
---

 arch/arm/mach-mvebu/include/mach/soc.h |  1 +
 drivers/usb/host/ehci-marvell.c        | 36 ++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/arch/arm/mach-mvebu/include/mach/soc.h b/arch/arm/mach-mvebu/include/mach/soc.h
index e6bfbc2..1aaea67 100644
--- a/arch/arm/mach-mvebu/include/mach/soc.h
+++ b/arch/arm/mach-mvebu/include/mach/soc.h
@@ -49,6 +49,7 @@
 #define MVEBU_EGIGA2_BASE	(MVEBU_REGISTER(0x30000))
 #define MVEBU_EGIGA3_BASE	(MVEBU_REGISTER(0x34000))
 #define MVEBU_REG_PCIE_BASE	(MVEBU_REGISTER(0x40000))
+#define MVEBU_USB20_BASE	(MVEBU_REGISTER(0x58000))
 #define MVEBU_EGIGA0_BASE	(MVEBU_REGISTER(0x70000))
 #define MVEBU_EGIGA1_BASE	(MVEBU_REGISTER(0x74000))
 #define MVEBU_SATA0_BASE	(MVEBU_REGISTER(0xa8000))
diff --git a/drivers/usb/host/ehci-marvell.c b/drivers/usb/host/ehci-marvell.c
index 1a5fd6e..03c489c 100644
--- a/drivers/usb/host/ehci-marvell.c
+++ b/drivers/usb/host/ehci-marvell.c
@@ -10,6 +10,7 @@
 #include <asm/io.h>
 #include <usb.h>
 #include "ehci.h"
+#include <linux/mbus.h>
 #include <asm/arch/cpu.h>
 
 #if defined(CONFIG_KIRKWOOD)
@@ -30,6 +31,40 @@ DECLARE_GLOBAL_DATA_PTR;
 /*
  * USB 2.0 Bridge Address Decoding registers setup
  */
+#ifdef CONFIG_ARMADA_XP
+
+#define MVUSB0_BASE		MVEBU_USB20_BASE
+
+/*
+ * Once all the older Marvell SoC's (Orion, Kirkwood) are converted
+ * to the common mvebu archticture including the mbus setup, this
+ * will be the only function needed to configure the access windows
+ */
+static void usb_brg_adrdec_setup(void)
+{
+	const struct mbus_dram_target_info *dram;
+	int i;
+
+	dram = mvebu_mbus_dram_info();
+
+	for (i = 0; i < 4; i++) {
+		wrl(USB_WINDOW_CTRL(i), 0);
+		wrl(USB_WINDOW_BASE(i), 0);
+	}
+
+	for (i = 0; i < dram->num_cs; i++) {
+		const struct mbus_dram_window *cs = dram->cs + i;
+
+		/* Write size, attributes and target id to control register */
+		wrl(USB_WINDOW_CTRL(i),
+		    ((cs->size - 1) & 0xffff0000) | (cs->mbus_attr << 8) |
+		    (dram->mbus_dram_target_id << 4) | 1);
+
+		/* Write base address to base register */
+		wrl(USB_WINDOW_BASE(i), cs->base);
+	}
+}
+#else
 static void usb_brg_adrdec_setup(void)
 {
 	int i;
@@ -69,6 +104,7 @@ static void usb_brg_adrdec_setup(void)
 		wrl(USB_WINDOW_BASE(i), base);
 	}
 }
+#endif
 
 /*
  * Create the appropriate control structures to manage
-- 
2.4.5

  parent reply	other threads:[~2015-06-29 12:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-29 12:58 [U-Boot] [PATCH v1 0/9] mvebu/a38x: Add MMC/SDIO, SATA/AHCI and USB/EHCI support Stefan Roese
2015-06-29 12:58 ` [U-Boot] [PATCH v1 1/9] mmc: sdhci: Use timer based timeout detection in sdhci_send_command() Stefan Roese
2015-06-29 12:58 ` [U-Boot] [PATCH v1 2/9] mmc: sdhci.c: Add config option to use a fixed buffer for transfers Stefan Roese
2015-06-29 12:58 ` [U-Boot] [PATCH v1 3/9] arm: mvebu: Add SDIO/SDHCI support for Armada A38x Stefan Roese
2015-06-29 12:58 ` [U-Boot] [PATCH v1 4/9] arm: mvebu: db-88f6820-gp: Add MMC/SDIO support Stefan Roese
2015-06-29 12:58 ` [U-Boot] [PATCH v1 5/9] block: ahci: Don't enable port interrupts Stefan Roese
2015-06-29 16:03   ` Simon Glass
2015-06-29 12:58 ` [U-Boot] [PATCH v1 6/9] arm: mvebu: Add SATA/SCSI (AHCI) support for Armada A38x Stefan Roese
2015-06-29 12:58 ` [U-Boot] [PATCH v1 7/9] arm: mvebu: db-88f6820-gp.h: Add SATA/SCSI (AHCI) support Stefan Roese
2015-06-29 12:58 ` Stefan Roese [this message]
2015-06-29 15:22   ` [U-Boot] [PATCH v1 8/9] usb: Add EHCI support for Armada 38x (mvebu) Marek Vasut
2015-07-02 11:03     ` Stefan Roese
2015-07-02 11:13       ` Marek Vasut
2015-06-29 12:58 ` [U-Boot] [PATCH v1 9/9] arm: mvebu: db-88f6820-gp: Add USB/EHCI support Stefan Roese

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=1435582696-30068-9-git-send-email-sr@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.