All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Cc: Peter Mamonov <pmamonov@gmail.com>
Subject: [RFC 8/9] MIPS: tplink-mr3020: select big-endian EHCI support
Date: Fri, 28 Aug 2015 01:24:09 +0300	[thread overview]
Message-ID: <1440714250-28080-9-git-send-email-antonynpavlov@gmail.com> (raw)
In-Reply-To: <1440714250-28080-1-git-send-email-antonynpavlov@gmail.com>

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/mips/boards/tplink-mr3020/board.c | 55 ++++++++++++++++++++++++++++++++++
 arch/mips/mach-ath79/Kconfig           |  4 +++
 2 files changed, 59 insertions(+)

diff --git a/arch/mips/boards/tplink-mr3020/board.c b/arch/mips/boards/tplink-mr3020/board.c
index 318998c..032ad7d 100644
--- a/arch/mips/boards/tplink-mr3020/board.c
+++ b/arch/mips/boards/tplink-mr3020/board.c
@@ -25,3 +25,58 @@ static int model_hostname_init(void)
 	return 0;
 }
 postcore_initcall(model_hostname_init);
+
+#include <asm/addrspace.h>
+#include <mach/ath79.h>
+#include <usb/ehci.h>
+
+#define AR933X_RESET_REG_RESET_MODULE           0x1c
+#define AR933X_RESET_USB_HOST           BIT(5)
+#define AR933X_RESET_USB_PHY            BIT(4)
+#define AR933X_RESET_USBSUS_OVERRIDE    BIT(3)
+
+#define AR933X_EHCI_BASE	0x1b000000
+#define AR933X_EHCI_SIZE	0x1000
+
+static void ath79_device_reset_set(u32 mask)
+{
+	u32 reg;
+	u32 t;
+
+	reg = AR933X_RESET_REG_RESET_MODULE;
+	t = ath79_reset_rr(reg);
+	ath79_reset_wr(reg, t | mask);
+}
+
+static void ath79_device_reset_clear(u32 mask)
+{
+	u32 reg;
+	u32 t;
+
+	reg = AR933X_RESET_REG_RESET_MODULE;
+	t = ath79_reset_rr(reg);
+	ath79_reset_wr(reg, t & ~mask);
+}
+
+static struct ehci_platform_data ehci_pdata = {
+	.flags = EHCI_HAS_TT | EHCI_BE_MMIO,
+};
+
+static int ehci_init(void)
+{
+	ath79_device_reset_set(AR933X_RESET_USBSUS_OVERRIDE);
+	mdelay(10); mdelay(10); mdelay(10);
+
+	ath79_device_reset_clear(AR933X_RESET_USB_HOST);
+	mdelay(10); mdelay(10); mdelay(10);
+
+	ath79_device_reset_clear(AR933X_RESET_USB_PHY);
+	mdelay(10); mdelay(10); mdelay(10);
+
+	add_generic_usb_ehci_device(DEVICE_ID_DYNAMIC,
+			KSEG1ADDR(AR933X_EHCI_BASE),
+			&ehci_pdata);
+
+	return 0;
+}
+device_initcall(ehci_init);
diff --git a/arch/mips/mach-ath79/Kconfig b/arch/mips/mach-ath79/Kconfig
index f730b37..24ec078 100644
--- a/arch/mips/mach-ath79/Kconfig
+++ b/arch/mips/mach-ath79/Kconfig
@@ -12,6 +12,10 @@ config BOARD_TPLINK_MR3020
 	select HAVE_PBL_IMAGE
 	select HAVE_IMAGE_COMPRESSION
 	select HAS_NMON
+	select USB_HOST
+	select HAS_DMA
+	select USB_EHCI
+	select USB_EHCI_BIG_ENDIAN_MMIO
 
 endchoice
 
-- 
2.5.0


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

  parent reply	other threads:[~2015-08-27 22:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-27 22:24 [RFC 0/9] ehci-hcd.c: make it works on big-endian mips (AR9331) Antony Pavlov
2015-08-27 22:24 ` [RFC 1/9] WIP: make ehci-hcd.c happy on big-endian MIPS Antony Pavlov
2015-08-27 22:24 ` [RFC 2/9] WIP: fix drivers/usb/core/usb.c Antony Pavlov
2015-08-28  6:11   ` Sascha Hauer
2015-08-28 15:51     ` Antony Pavlov
2015-08-31  6:45       ` Sascha Hauer
2015-08-27 22:24 ` [RFC 3/9] MIPS: add virt_to_phys() and phys_to_virt() Antony Pavlov
2015-08-28  6:34   ` Sascha Hauer
2015-08-28 15:46     ` Antony Pavlov
2015-09-04  6:20       ` Sascha Hauer
2015-09-04  7:27         ` Antony Pavlov
2015-09-04  8:44           ` Sascha Hauer
2015-12-06 14:50         ` Antony Pavlov
2015-12-07 10:27           ` Sascha Hauer
2015-12-08  9:11             ` Antony Pavlov
2015-12-08 11:46             ` Peter Mamonov
2015-12-09 13:03               ` Sascha Hauer
2015-08-27 22:24 ` [RFC 4/9] MIPS: add trivial dma support Antony Pavlov
2015-08-27 22:24 ` [RFC 5/9] ehci-hcd.c: make it works on mips Antony Pavlov
2015-08-27 22:24 ` [RFC 6/9] usb: ehci: drop unusable CONFIG_EHCI_MMIO_BIG_ENDIAN condition Antony Pavlov
2015-08-27 22:24 ` [RFC 7/9] usb: ehci: add big-endian registers support Antony Pavlov
2015-08-28  6:19   ` Sascha Hauer
2015-08-28 15:49     ` Antony Pavlov
2015-08-27 22:24 ` Antony Pavlov [this message]
2015-08-27 22:24 ` [RFC 9/9] MIPS: tplink-mr3020_defconfig: enable usb stuff Antony Pavlov

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=1440714250-28080-9-git-send-email-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=pmamonov@gmail.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 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.