Skip to contentSkip to conversation

imx: usb: ehci-mx7 add usb driver for i.MX7D

PATCH Superseded Adrian Alonso 2 participants 2 messages Jul 22, 2015 – Jul 23, 2015

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 2/15 imx: usb: ehci-mx7 add usb driver for i.MX7D

* Add support for usb driver for i.MX7D SoC

---
Changes for V2: Resend
Changes for V3:
- Integrate review obserbations
- Add comments for fucntions board_ehci_hcd_init/board_ehci_power

 drivers/usb/host/Makefile   |   1 +
 drivers/usb/host/ehci-mx7.c | 112 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 113 insertions(+)
 create mode 100644 drivers/usb/host/ehci-mx7.c
drivers/usb/host/Makefile +1 -0
index 4d35d3e..7267160 100644
@@ -36,6 +36,7 @@ obj-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o
 obj-$(CONFIG_USB_EHCI_MXS) += ehci-mxs.o
 obj-$(CONFIG_USB_EHCI_MX5) += ehci-mx5.o
 obj-$(CONFIG_USB_EHCI_MX6) += ehci-mx6.o
+obj-$(CONFIG_USB_EHCI_MX7) += ehci-mx7.o
 obj-$(CONFIG_USB_EHCI_OMAP) += ehci-omap.o
 obj-$(CONFIG_USB_EHCI_PPC4XX) += ehci-ppc4xx.o
 obj-$(CONFIG_USB_EHCI_MARVELL) += ehci-marvell.o
drivers/usb/host/ehci-mx7.c new file +112 -0

112 lines not on this page · raw message

Signature · 1 line
2.1.4
#1 lore raw

PATCH v3 2/15 imx: usb: ehci-mx7 add usb driver for i.MX7D

Quoted 1 line · Adrian Alonso

* Add support for usb driver for i.MX7D SoC

Please drop this asterisk, it's pointless.

Quoted 75 lines

---
Changes for V2: Resend
Changes for V3:
- Integrate review obserbations
- Add comments for fucntions board_ehci_hcd_init/board_ehci_power

 drivers/usb/host/Makefile   |   1 +
 drivers/usb/host/ehci-mx7.c | 112
++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 113
insertions(+)
 create mode 100644 drivers/usb/host/ehci-mx7.c
drivers/usb/host/Makefile +1 -0
index 4d35d3e..7267160 100644
@@ -36,6 +36,7 @@ obj-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o
 obj-$(CONFIG_USB_EHCI_MXS) += ehci-mxs.o
 obj-$(CONFIG_USB_EHCI_MX5) += ehci-mx5.o
 obj-$(CONFIG_USB_EHCI_MX6) += ehci-mx6.o
+obj-$(CONFIG_USB_EHCI_MX7) += ehci-mx7.o
 obj-$(CONFIG_USB_EHCI_OMAP) += ehci-omap.o
 obj-$(CONFIG_USB_EHCI_PPC4XX) += ehci-ppc4xx.o
 obj-$(CONFIG_USB_EHCI_MARVELL) += ehci-marvell.o
drivers/usb/host/ehci-mx7.c new file +24 -0
new file mode 100644
index 0000000..40aed07
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2009 Daniel Mack <[email protected]>
+ * Copyright (C) 2010-2015 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <usb.h>
+#include <errno.h>
+#include <linux/compiler.h>
+#include <usb/ehci-fsl.h>
+#include <asm/io.h>
+#include <asm/arch/crm_regs.h>
+#include <asm/arch/clock.h>
+#include <asm/imx-common/iomux-v3.h>
+
+#include "ehci.h"
+
+#define USB_NC_OFFSET	0x200
+
+#define UCTRL_PM		(1 << 9) /* OTG Power Mask */
+#define UCTRL_OVER_CUR_POL	(1 << 8) /* OTG Polarity of Overcurrent */
+#define UCTRL_OVER_CUR_DIS	(1 << 7) /* Disable OTG Overcurrent Detection

*/ +

drivers/usb/host/ehci-mx7.c new file +17 -0
+/* USBCMD */
+#define UCMD_RUN_STOP		(1 << 0) /* controller run/stop */
+#define UCMD_RESET		(1 << 1) /* controller reset */
+
+/* Base address for this IP block is 0x02184800 */
+struct usbnc_regs {
+	u32 ctrl1;
+	u32 ctrl2;
+	u32 reserve1[11];
+	u32 phy_ctrl2;
+	u32 reserve2[6];
+	u32 adp_cfg1;
+	u32 reserve3;
+	u32 adp_status;
+};
+
+static void usb_oc_config(int index)

drivers/usb/host/ehci-mx7.c line 52

Quoted 10 lines
drivers/usb/host/ehci-mx7.c new file +10 -0
+{
+	struct usbnc_regs *usbnc = (struct usbnc_regs *)(USB_BASE_ADDR +
+			(0x10000 * index) + USB_NC_OFFSET);
+	void __iomem *ctrl = (void __iomem *)(&usbnc->ctrl1);
+
+	setbits_le32(ctrl, UCTRL_OVER_CUR_POL);
+	setbits_le32(ctrl, UCTRL_OVER_CUR_DIS | UCTRL_PM);
+}
+
+/*

This is not valid kerneldoc, see documentation here:

https://www.kernel.org/doc/Documentation/kernel-doc-nano-HOWTO.txt

Quoted 6 lines

+ * board_ehci_hcd_init - set usb vbus voltage
+ * Setup iomux pad to setup supply vbus voltage for usb otg port.
+ * Machine board file overrides board_ehci_hcd_init
+ * @port: usb otg port
+ *
+ */

Other than that, it's cool. Can you please re-send it in-reply-to to the original series ?

Thanks!

Best regards,
Marek Vasut