]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: UniPhier: add UniPhier on-chip EHCI host driver support
authorMasahiro Yamada <yamada.m@jp.panasonic.com>
Fri, 7 Nov 2014 09:48:33 +0000 (18:48 +0900)
committerMasahiro Yamada <yamada.m@jp.panasonic.com>
Tue, 11 Nov 2014 15:21:28 +0000 (00:21 +0900)
Support EHCI host driver used on Panasonic UniPhier platform.
Since Device Tree is not supported on UniPhier yet, the base address
of USB cores are passed from board files (platdevice.c).

TODO for me:
Move the base address to device trees.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Marek Vasut <marex@denx.de>
arch/arm/cpu/armv7/uniphier/ph1-ld4/platdevice.c
arch/arm/cpu/armv7/uniphier/ph1-pro4/platdevice.c
arch/arm/cpu/armv7/uniphier/ph1-sld8/platdevice.c
arch/arm/include/asm/arch-uniphier/ehci-uniphier.h [new file with mode: 0644]
arch/arm/include/asm/arch-uniphier/platdevice.h
drivers/usb/host/Kconfig
drivers/usb/host/Makefile
drivers/usb/host/ehci-uniphier.c [new file with mode: 0644]

index 0047223181afcfad5e8f96eabfe53b960aad0844..62f5b0148dc0b61cc637208a7d8f30473a8f0395 100644 (file)
@@ -13,3 +13,16 @@ SERIAL_DEVICE(0, 0x54006800, UART_MASTER_CLK)
 SERIAL_DEVICE(1, 0x54006900, UART_MASTER_CLK)
 SERIAL_DEVICE(2, 0x54006a00, UART_MASTER_CLK)
 SERIAL_DEVICE(3, 0x54006b00, UART_MASTER_CLK)
+
+/* USB : TODO for Masahiro Yamada: move base address to Device Tree */
+struct uniphier_ehci_platform_data uniphier_ehci_platdata[] = {
+       {
+               .base = 0x5a800100,
+       },
+       {
+               .base = 0x5a810100,
+       },
+       {
+               .base = 0x5a820100,
+       },
+};
index 6da921e92043df9b5d8d2e2dd95497384d771470..1843d0469f6e775c0da6f3bf2f7a6ec9f59543ef 100644 (file)
@@ -13,3 +13,13 @@ SERIAL_DEVICE(0, 0x54006800, UART_MASTER_CLK)
 SERIAL_DEVICE(1, 0x54006900, UART_MASTER_CLK)
 SERIAL_DEVICE(2, 0x54006a00, UART_MASTER_CLK)
 SERIAL_DEVICE(3, 0x54006b00, UART_MASTER_CLK)
+
+/* USB : TODO for Masahiro Yamada: move base address to Device Tree */
+struct uniphier_ehci_platform_data uniphier_ehci_platdata[] = {
+       {
+               .base = 0x5a800100,
+       },
+       {
+               .base = 0x5a810100,
+       },
+};
index 59d054a31026ebeb354396dd8e69f872d478a8e4..72ec599f69b905dd029c73519ccd2abf2679a8a7 100644 (file)
@@ -13,3 +13,16 @@ SERIAL_DEVICE(0, 0x54006800, UART_MASTER_CLK)
 SERIAL_DEVICE(1, 0x54006900, UART_MASTER_CLK)
 SERIAL_DEVICE(2, 0x54006a00, UART_MASTER_CLK)
 SERIAL_DEVICE(3, 0x54006b00, UART_MASTER_CLK)
+
+/* USB : TODO for Masahiro Yamada: move base address to Device Tree */
+struct uniphier_ehci_platform_data uniphier_ehci_platdata[] = {
+       {
+               .base = 0x5a800100,
+       },
+       {
+               .base = 0x5a810100,
+       },
+       {
+               .base = 0x5a820100,
+       },
+};
diff --git a/arch/arm/include/asm/arch-uniphier/ehci-uniphier.h b/arch/arm/include/asm/arch-uniphier/ehci-uniphier.h
new file mode 100644 (file)
index 0000000..e9c5fb4
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2014 Panasonic Corporation
+ *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __PLAT_UNIPHIER_EHCI_H
+#define __PLAT_UNIPHIER_EHCI_H
+
+#include <linux/types.h>
+#include <asm/io.h>
+#include "mio-regs.h"
+
+struct uniphier_ehci_platform_data {
+       unsigned long base;
+};
+
+extern struct uniphier_ehci_platform_data uniphier_ehci_platdata[];
+
+static inline void uniphier_ehci_reset(int index, int on)
+{
+       u32 tmp;
+
+       tmp = readl(MIO_USB_RSTCTRL(index));
+       if (on)
+               tmp &= ~MIO_USB_RSTCTRL_XRST;
+       else
+               tmp |= MIO_USB_RSTCTRL_XRST;
+       writel(tmp, MIO_USB_RSTCTRL(index));
+}
+
+#endif /* __PLAT_UNIPHIER_EHCI_H */
index cdf7d132d44ad29d87a65d28050fdb4765ed781d..62a512659c3a39af391c9301e6944295178d99a4 100644 (file)
@@ -21,4 +21,6 @@ U_BOOT_DEVICE(serial##n) = {                                          \
        .platdata = &serial_device##n                                   \
 };
 
+#include <asm/arch/ehci-uniphier.h>
+
 #endif /* ARCH_PLATDEVICE_H */
index 8a6496a6ef1ef5c3cb750713c53b81183b9b71d7..30d1457638a8115a5c954a763a6d19bbee13252b 100644 (file)
@@ -45,4 +45,12 @@ config USB_EHCI
 
 if USB_EHCI_HCD
 
+config USB_EHCI_UNIPHIER
+       bool "Support for Panasonic UniPhier on-chip EHCI USB controller"
+       depends on ARCH_UNIPHIER
+       default y
+       ---help---
+         Enables support for the on-chip EHCI controller on Panasonic
+         UniPhier SoCs.
+
 endif
index 1c3592914dcf363c71de68f05a69cf5b21b5d845..c11b551620e79a8666ef0b70eef55b6b79b45594 100644 (file)
@@ -37,6 +37,7 @@ obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
 obj-$(CONFIG_USB_EHCI_SPEAR) += ehci-spear.o
 obj-$(CONFIG_USB_EHCI_SUNXI) += ehci-sunxi.o
 obj-$(CONFIG_USB_EHCI_TEGRA) += ehci-tegra.o
+obj-$(CONFIG_USB_EHCI_UNIPHIER) += ehci-uniphier.o
 obj-$(CONFIG_USB_EHCI_VCT) += ehci-vct.o
 obj-$(CONFIG_USB_EHCI_RMOBILE) += ehci-rmobile.o
 obj-$(CONFIG_USB_EHCI_ZYNQ) += ehci-zynq.o
diff --git a/drivers/usb/host/ehci-uniphier.c b/drivers/usb/host/ehci-uniphier.c
new file mode 100644 (file)
index 0000000..77f6c9d
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2014 Panasonic Corporation
+ *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <usb.h>
+#include <asm/arch/ehci-uniphier.h>
+#include "ehci.h"
+
+/*
+ * Create the appropriate control structures to manage
+ * a new EHCI host controller.
+ */
+int ehci_hcd_init(int index, enum usb_init_type init, struct ehci_hccr **hccr,
+                 struct ehci_hcor **hcor)
+{
+       struct ehci_hccr *cr;
+       struct ehci_hcor *or;
+
+       uniphier_ehci_reset(index, 0);
+
+       cr = (struct ehci_hccr *)(uniphier_ehci_platdata[index].base);
+       or = (void *)cr + HC_LENGTH(ehci_readl(&cr->cr_capbase));
+
+       *hccr = cr;
+       *hcor = or;
+
+       return 0;
+}
+
+int ehci_hcd_stop(int index)
+{
+       uniphier_ehci_reset(index, 1);
+
+       return 0;
+}