Skip to contentSkip to conversation

Move ehci headers, add Efika USB support

PATCH Superseded Jana Rapava 7 participants 47 messages Sep 28, 2011 – Nov 24, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Move ehci headers, add Efika USB support

This patchset moves header files ehci.h and ehci-core.h from drivers/usb/host/ to /include/usb and adds USB support for Efika with cleanup of file /drivers/usb/host/ehci-mxc.c.

In the previous revisions I messed up versioning and some From: and
In-Reply-To: headers, so I want to bury this mess and start with a clean plate. Version of patches in this patchset will then be 1.

Fabio Estevam (1):
usb: Move ehci.h and ehci-core.h to include/usb directory

Jana Rapava (3):
EHCI: add callback ehci_fixup
EHCI: adjust for mx5
Add USB support for Efika

 board/efikamx/Makefile           |    3 +
 board/efikamx/efika.h            |   30 +++
 board/efikamx/efikamx-usb.c      |  420 ++++++++++++++++++++++++++++++++++++++
 board/efikamx/efikamx.c          |    3 +
 drivers/usb/host/ehci-core.h     |   29 ---
 drivers/usb/host/ehci-fsl.c      |    4 +-
 drivers/usb/host/ehci-hcd.c      |   16 ++-
 drivers/usb/host/ehci-ixp4xx.c   |    4 +-
 drivers/usb/host/ehci-kirkwood.c |    4 +-
 drivers/usb/host/ehci-mpc512x.c  |    4 +-
 drivers/usb/host/ehci-mxc.c      |   35 +---
 drivers/usb/host/ehci-pci.c      |    4 +-
 drivers/usb/host/ehci-ppc4xx.c   |    4 +-
 drivers/usb/host/ehci-vct.c      |    4 +-
 drivers/usb/host/ehci.h          |  203 ------------------
 include/configs/efikamx.h        |   16 ++
 include/usb/ehci-core.h          |   29 +++
 include/usb/ehci-fsl.h           |  146 +++++++++++++-
 include/usb/ehci.h               |  203 ++++++++++++++++++
 19 files changed, 882 insertions(+), 279 deletions(-)
 create mode 100644 board/efikamx/efika.h
 create mode 100644 board/efikamx/efikamx-usb.c
 delete mode 100644 drivers/usb/host/ehci-core.h
 delete mode 100644 drivers/usb/host/ehci.h
 create mode 100644 include/usb/ehci-core.h
 create mode 100644 include/usb/ehci.h
Signature · 1 line
1.7.6.3
#1 lore raw

PATCH 1/4 usb: Move ehci.h and ehci-core.h to include/usb directory

From: Fabio Estevam <[email protected]>

Move ehci.h and ehci-core.h to include/usb directory.

Cc Remy Bohmer <[email protected]>
Cc Marek Vasut <[email protected]>
---
 drivers/usb/host/ehci-core.h     |   29 ------
 drivers/usb/host/ehci-fsl.c      |    4 +-
 drivers/usb/host/ehci-hcd.c      |    2 +-
 drivers/usb/host/ehci-ixp4xx.c   |    4 +-
 drivers/usb/host/ehci-kirkwood.c |    4 +-
 drivers/usb/host/ehci-mpc512x.c  |    4 +-
 drivers/usb/host/ehci-mxc.c      |    4 +-
 drivers/usb/host/ehci-pci.c      |    4 +-
 drivers/usb/host/ehci-ppc4xx.c   |    4 +-
 drivers/usb/host/ehci-vct.c      |    4 +-
 drivers/usb/host/ehci.h          |  203 --------------------------------------
 include/usb/ehci-core.h          |   29 ++++++
 include/usb/ehci.h               |  203 ++++++++++++++++++++++++++++++++++++++
 13 files changed, 249 insertions(+), 249 deletions(-)
 delete mode 100644 drivers/usb/host/ehci-core.h
 delete mode 100644 drivers/usb/host/ehci.h
 create mode 100644 include/usb/ehci-core.h
 create mode 100644 include/usb/ehci.h
drivers/usb/host/ehci-core.h deleted +0 -29
deleted file mode 100644
index 39e5c5e..0000000
@@ -1,29 +0,0 @@
-/*-
- * Copyright (c) 2007-2008, Juniper Networks, Inc.
- * Copyright (c) 2008, Excito Elektronik i Sk?ne AB
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation version 2 of
- * the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#ifndef USB_EHCI_CORE_H
-#define USB_EHCI_CORE_H
-
-extern int rootdev;
-extern struct ehci_hccr *hccr;
-extern volatile struct ehci_hcor *hcor;
-
-#endif
drivers/usb/host/ehci-fsl.c +2 -2
index 6e0043a..19b97ee 100644
@@ -27,8 +27,8 @@
 #include <asm/io.h>
 #include <usb/ehci-fsl.h>
 
-#include "ehci.h"
-#include "ehci-core.h"
+#include <usb/ehci.h>
+#include <usb/ehci-core.h>
 
 /*
  * Create the appropriate control structures to manage
drivers/usb/host/ehci-hcd.c +1 -1
index 2197119..bdadd46 100644
@@ -27,7 +27,7 @@
 #include <malloc.h>
 #include <watchdog.h>
 
-#include "ehci.h"
+#include <usb/ehci.h>
 
 int rootdev;
 struct ehci_hccr *hccr;	/* R/O registers, not need for volatile */
drivers/usb/host/ehci-ixp4xx.c +2 -2
index b8f15ae..d15237b 100644
@@ -22,8 +22,8 @@
 #include <common.h>
 #include <usb.h>
 
-#include "ehci.h"
-#include "ehci-core.h"
+#include <usb/ehci.h>
+#include <usb/ehci-core.h>
 /*
  * Create the appropriate control structures to manage
  * a new EHCI host controller.
drivers/usb/host/ehci-kirkwood.c +2 -2
index 5570fc6..ab75acd 100644
@@ -25,8 +25,8 @@
 #include <common.h>
 #include <asm/io.h>
 #include <usb.h>
-#include "ehci.h"
-#include "ehci-core.h"
+#include <usb/ehci.h>
+#include <usb/ehci-core.h>
 #include <asm/arch/kirkwood.h>
 
 #define rdl(off)	readl(KW_USB20_BASE + (off))
drivers/usb/host/ehci-mpc512x.c +2 -2
index d360108..8d2c93b 100644
@@ -32,8 +32,8 @@
 #include <asm/io.h>
 #include <usb/ehci-fsl.h>
 
-#include "ehci.h"
-#include "ehci-core.h"
+#include <usb/ehci.h>
+#include <usb/ehci-core.h>
 
 static void fsl_setup_phy(volatile struct ehci_hcor *);
 static void fsl_platform_set_host_mode(volatile struct usb_ehci *ehci);
drivers/usb/host/ehci-mxc.c +2 -2
index a0cfbb7..fde1f0f 100644
@@ -24,8 +24,8 @@
 #include <usb/ehci-fsl.h>
 #include <errno.h>
 
-#include "ehci.h"
-#include "ehci-core.h"
+#include <usb/ehci.h>
+#include <usb/ehci-core.h>
 
 #define USBCTRL_OTGBASE_OFFSET	0x600
 
drivers/usb/host/ehci-pci.c +2 -2
index 020ab11..e1f84d9 100644
@@ -22,8 +22,8 @@
 #include <pci.h>
 #include <usb.h>
 
-#include "ehci.h"
-#include "ehci-core.h"
+#include <usb/ehci.h>
+#include <usb/ehci-core.h>
 
 #ifdef CONFIG_PCI_EHCI_DEVICE
 static struct pci_device_id ehci_pci_ids[] = {
drivers/usb/host/ehci-ppc4xx.c +2 -2
index 1179919..1a1fae1 100644
@@ -22,8 +22,8 @@
 #include <common.h>
 #include <usb.h>
 
-#include "ehci.h"
-#include "ehci-core.h"
+#include <usb/ehci.h>
+#include <usb/ehci-core.h>
 
 /*
  * Create the appropriate control structures to manage
drivers/usb/host/ehci-vct.c +2 -2
index 3063dd1..e73cf38 100644
@@ -20,8 +20,8 @@
 #include <common.h>
 #include <usb.h>
 
-#include "ehci.h"
-#include "ehci-core.h"
+#include <usb/ehci.h>
+#include <usb/ehci-core.h>
 
 int vct_ehci_hcd_init(u32 *hccr, u32 *hcor);
 
drivers/usb/host/ehci.h deleted +0 -203

203 lines not on this page · raw message

include/usb/ehci-core.h new file +29 -0
new file mode 100644
index 0000000..39e5c5e
@@ -0,0 +1,29 @@
+/*-
+ * Copyright (c) 2007-2008, Juniper Networks, Inc.
+ * Copyright (c) 2008, Excito Elektronik i Sk?ne AB
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef USB_EHCI_CORE_H
+#define USB_EHCI_CORE_H
+
+extern int rootdev;
+extern struct ehci_hccr *hccr;
+extern volatile struct ehci_hcor *hcor;
+
+#endif
include/usb/ehci.h new file +203 -0

203 lines not on this page · raw message

Signature · 1 line
1.7.6.3
#3 lore raw

PATCH 1/4 usb: Move ehci.h and ehci-core.h to include/usb directory

2011/9/29 Marek Vasut <[email protected]>

Quoted 1 line

the cover letter is missing

sorry, I forgot to Cc: you

Quoted 2 lines

and it's sent as a set of separate patches. Why?

I thought this should be a patchset, it doesn't look like one logical change to me...

Regards,
Jana Rapava

#4 lore raw

PATCH 2/4 EHCI: add callback ehci_fixup

In reply to Jana Rapava

Add callback to ehci_hcd.c to prepare
for solving the problem with VBUS reset on Efika.

Cc Marek Vasut <[email protected]>
Cc Remy Bohmer <[email protected]>
Cc Stefano Babic <[email protected]>
---
 drivers/usb/host/ehci-hcd.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
drivers/usb/host/ehci-hcd.c +13 -1
index bdadd46..c548276 100644
@@ -536,6 +536,18 @@ static inline int min3(int a, int b, int c)
 	return a;
 }
 
+inline void __ehci_fixup(uint32_t *status_reg, uint32_t *reg_ref)
+{
+	wait_ms(50);
+}
+
+/*
+ * This is an alias to __ehci_fixup() unless user provides other definition
+ * of ehci_fixup function.
+ */
+void ehci_fixup(uint32_t *status_reg, uint32_t *reg_ref)
+	 __attribute__((weak, alias("__ehci_fixup")));
+
 int
 ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
 		 int length, struct devrequest *req)
@@ -709,7 +721,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
 				 * usb 2.0 specification say 50 ms resets on
 				 * root
 				 */
-				wait_ms(50);
+				ehci_fixup(status_reg, &reg);
 				/* terminate the reset */
 				ehci_writel(status_reg, reg & ~EHCI_PS_PR);
 				/*
Signature · 1 line
1.7.6.3
#5 lore raw

PATCH 3/4 EHCI: adjust for mx5

In reply to Jana Rapava

Add macros and structures needed by Efika USB support code. Move shared offset and bits definitions into common header file.

Cc Marek Vasut <[email protected]>
Cc Remy Bohmer <[email protected]>
Cc Stefano Babic <[email protected]>
---
 drivers/usb/host/ehci-mxc.c |   31 +--------
 include/usb/ehci-fsl.h      |  146 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 148 insertions(+), 29 deletions(-)
drivers/usb/host/ehci-mxc.c +3 -28
index fde1f0f..2c1295f 100644
@@ -27,31 +27,6 @@
 #include <usb/ehci.h>
 #include <usb/ehci-core.h>
 
-#define USBCTRL_OTGBASE_OFFSET	0x600
-
-#ifdef CONFIG_MX25
-#define MX25_USB_CTRL_IP_PUE_DOWN_BIT	(1<<6)
-#define MX25_USB_CTRL_HSTD_BIT		(1<<5)
-#define MX25_USB_CTRL_USBTE_BIT		(1<<4)
-#define MX25_USB_CTRL_OCPOL_OTG_BIT	(1<<3)
-#endif
-
-#ifdef CONFIG_MX31
-#define MX31_OTG_SIC_SHIFT	29
-#define MX31_OTG_SIC_MASK	(0x3 << MX31_OTG_SIC_SHIFT)
-#define MX31_OTG_PM_BIT		(1 << 24)
-
-#define MX31_H2_SIC_SHIFT	21
-#define MX31_H2_SIC_MASK	(0x3 << MX31_H2_SIC_SHIFT)
-#define MX31_H2_PM_BIT		(1 << 16)
-#define MX31_H2_DT_BIT		(1 << 5)
-
-#define MX31_H1_SIC_SHIFT	13
-#define MX31_H1_SIC_MASK	(0x3 << MX31_H1_SIC_SHIFT)
-#define MX31_H1_PM_BIT		(1 << 8)
-#define MX31_H1_DT_BIT		(1 << 4)
-#endif
-
 static int mxc_set_usbcontrol(int port, unsigned int flags)
 {
 	unsigned int v;
@@ -66,11 +41,11 @@ static int mxc_set_usbcontrol(int port, unsigned int flags)
 
 		switch (port) {
 		case 0:	/* OTG port */
-			v &= ~(MX31_OTG_SIC_MASK | MX31_OTG_PM_BIT);
+			v &= ~(MXC_OTG_SIC_MASK | MXC_OTG_PM_BIT);
 			v |= (flags & MXC_EHCI_INTERFACE_MASK)
-					<< MX31_OTG_SIC_SHIFT;
+					<< MXC_OTG_SIC_SHIFT;
 			if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
-				v |= MX31_OTG_PM_BIT;
+				v |= MXC_OTG_PM_BIT;
 
 			break;
 		case 1: /* H1 port */
include/usb/ehci-fsl.h +145 -1

162 lines not on this page · raw message

Signature · 1 line
1.7.6.3
#6 lore raw

PATCH 3/4 EHCI: adjust for mx5

Hi Jana,

Quoted 12 lines · Jana Rapava

Add macros and structures needed by Efika USB support code. Move shared offset and bits definitions into common header file.

Cc Marek Vasut <[email protected]>
Cc Remy Bohmer <[email protected]>
Cc Stefano Babic <[email protected]>
---
 drivers/usb/host/ehci-mxc.c |   31 +--------
 include/usb/ehci-fsl.h      |  146 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 148 insertions(+), 29 deletions(-)

[...]

Quoted 4 lines
include/usb/ehci-fsl.h +0 -0
index 67600ed..727134f 100644

[...]

include/usb/ehci-fsl.h line 180

Quoted 13 lines
include/usb/ehci-fsl.h +9 -0
@@ -169,6 +169,106 @@
 #define CONFIG_SYS_FSL_USB_ADDR CONFIG_SYS_MPC512x_USB_ADDR
 #endif
 
+#if defined(CONFIG_MX25) || defined(CONFIG_MX31)
+#define USBCTRL_OTGBASE_OFFSET	0x600
+#endif
+
+#ifdef CONFIG_MX25
+#define MX25_USB_CTRL_IP_PUE_DOWN_BIT	(1<<6)
+#define MX25_USB_CTRL_HSTD_BIT		(1<<5)
+#define MX25_USB_CTRL_USBTE_BIT	(1<<4)
+#define MX25_USB_CTRL_OCPOL_OTG_BIT	(1<<3)

Why not align the above?
Also, there should be spaces around the shift operators.

include/usb/ehci-fsl.h line 187

Quoted 7 lines
include/usb/ehci-fsl.h +7 -0
+#endif
+
+#ifdef CONFIG_MX31
+#define MX31_H2_SIC_SHIFT	21
+#define MX31_H2_SIC_MASK	(0x3 << MX31_H2_SIC_SHIFT)
+#define MX31_H2_PM_BIT		(1 << 16)
+#define MX31_H2_DT_BIT		(1 << 5)

Alignment?

include/usb/ehci-fsl.h line 192

Quoted 5 lines
include/usb/ehci-fsl.h +5 -0
+
+#define MX31_H1_SIC_SHIFT	13
+#define MX31_H1_SIC_MASK	(0x3 << MX31_H1_SIC_SHIFT)
+#define MX31_H1_PM_BIT		(1 << 8)
+#define MX31_H1_DT_BIT		(1 << 4)

ditto

Quoted 26 lines
include/usb/ehci-fsl.h +26 -0
+#endif
+
+#if defined(CONFIG_MX51) || defined(CONFIG_MX53)
+/* offset for first USB CTRL register */
+#define MX5_CTRL_REGS_OFFSET	0x800
+#endif
+
+#if defined(CONFIG_MX51) || defined(CONFIG_MX31)
+/* USB_CTRL register bits of interest*/
+#define MXC_OTG_SIC_SHIFT	29
+#define MXC_OTG_SIC_MASK	(0x3 << MX31_OTG_SIC_SHIFT)
+#define MXC_OTG_WUE		(1 << 27)
+#define MXC_OTG_PM		(1 << 24)
+#endif
+
+#ifdef CONFIG_MX51
+#define MX51_REGISTER_LAYOUT_LENGTH	0x200
+
+/* Register offsets for MX51 */
+#define MX51_OTG_ID	0x000
+#define MX51_UH1_ID	0x200
+#define MX51_UH2_ID	0x400
+
+/* USB_CTRL register bits of interest*/
+#define MX51_OTG_PM		(1 << 24)
+#define MX51_H1_ULPI_IE	(1 << 12)

include/usb/ehci-fsl.h line 228

Quoted 10 lines
include/usb/ehci-fsl.h +10 -0
+#define MX51_H1_WUE		(1 << 11)
+#define MX51_H1_PM		(1 << 8)
+
+/* PHY_CTRL_0 register bits of interest */
+#define MX51_OTG_OVERCURD	(1 << 8)
+#define MX51_EHCI_POWERPINSE	(1 << 5)
+
+/* PHY_CTRL_1 register bits of interest */
+#define MX51_SYSCLOCK_24_MHZ	(1 << 0)
+#define MX51_SYSCLOCK_MASK	(~(0xffffffff << 2))

This is something, I don't understand.
Isn't it just 0x3?

Quoted 10 lines
include/usb/ehci-fsl.h +10 -0
+
+/* USB_CTRL_1 register bits of interest */
+#define MX51_H1_EXTCLKE	(1 << 25)
+
+/* USB Host 2 CTRL register bits of interest */
+#define MX51_H2_ULPI_IE	(1 << 8)
+#define MX51_H2_WUE		(1 << 7)
+#define MX51_H2_PM		(1 << 4)
+
+/* PORTSCx bits of interest */

include/usb/ehci-fsl.h line 248

Quoted 10 lines
include/usb/ehci-fsl.h +10 -0
+#define MX51_ULPI_MODE_MASK	(2 << 30)
+#define MX51_16BIT_UTMI	(1 << 28)
+
+/* USBCMD bits of interest */
+#define MX51_ITC_IMMEDIATE_MASK	(0xff << 16)
+#endif
+
+/*
+* ULPI
+*/

Something went wrong with the comment formatting here...

Quoted 7 lines
include/usb/ehci-fsl.h +7 -0
+#define ULPI_ID_REGS_COUNT	4
+#define ULPI_TEST_VALUE	0x55
+#define ULPI_TIMEOUT		1000 /* some reasonable value */
+
+/* ULPI viewport control bits */
+#define ULPI_WU	(1 << 31)
+#define ULPI_SS	(1 << 27)

include/usb/ehci-fsl.h line 265

Quoted 10 lines
include/usb/ehci-fsl.h +10 -0
+#define ULPI_RWRUN	(1 << 30)
+#define ULPI_RWCTRL	(1 << 29)
+
+/* ULPI OTG Control bits of interest */
+#define ULPI_OTG_EXT_VBUS_IND	(1 << 7)
+#define ULPI_OTG_DM_PULLDOWN	(1 << 2)
+#define ULPI_OTG_DP_PULLDOWN	(1 << 1)
+#define ULPI_OTG_DRV_VBUS	(1 << 5)
+#define ULPI_OTG_DRV_VBUS_EXT	(1 << 6)
+#define ULPI_OTG_CHRG_VBUS	(1 << 4)

alignment

include/usb/ehci-fsl.h line 270

Quoted 5 lines
include/usb/ehci-fsl.h +5 -0
+
+/* ULPI Function Control bits of interest */
+#define ULPI_FC_XCVR_SELECT	(1 << 0)
+#define ULPI_FC_OPMODE_NORMAL	(0 << 3)
+#define ULPI_FC_SUSPENDM_PWRED	(1 << 6)

ditto

[...]

Quoted 24 lines
include/usb/ehci-fsl.h +24 -0
+
+struct mxc_ulpi_regs {
+	u8	vendor_id_low;		/* 0x00 - Vendor ID lower byte */
+	u8	vendor_id_high;		/* 0x01 - Vendor ID upper byte */
+	u8	product_id_low;		/* 0x02 - Product ID lower byte */
+	u8	product_id_high;	/* 0x03 - Product ID higher byte */
+	/* Function Control; 0x04 - 0x06 Read, 0x04 Write */
+	u8	function_ctrl_write;
+	u8	function_ctrl_set;	/* 0x05 Set */
+	u8	function_ctrl_clear;	/* 0x06 Clear */
+	/* Interface Control; 0x07 - 0x09 Read, 0x07 Write */
+	u8	iface_ctrl_write;
+	u8	iface_ctrl_set;		/* 0x08 Set */
+	u8	iface_ctrl_clear;	/* 0x09 Clear */
+	/* OTG Control; 0x0A - 0x0C Read, 0x0A Write */
+	u8	otg_ctrl_write;
+	u8	otg_ctrl_set;		/* 0x0B Set */
+	u8	otg_ctrl_clear;		/* 0x0C Clear */
+	/* USB Interrupt Enable Rising; 0x0D - 0x0F Read, 0x0D Write */
+	u8	usb_ie_rising_write;
+	u8	usb_ie_rising_set;	/* 0x0E Set */
+	u8	usb_ie_rising_clear;	/* 0x0F Clear */
+	/* USB Interrupt Enable Falling; 0x10 - 0x12 Read, 0x10 Write */
+	u8	usb_ie_falling_write;

include/usb/ehci-fsl.h struct usb_ehci { · line 387

Quoted 10 lines
include/usb/ehci-fsl.h +10 -0
+	u8	usb_ie_falling_set;	/* 0x11 Set */
+	u8	usb_ie_falling_clear;	/* 0x12 Clear */
+	u8	usb_int_status;		/* 0x13 - USB Interrupt Status */
+	u8	usb_int_latch;		/* 0x14 - USB Interrupt Latch */
+	u8	debug;			/* 0x15 - Debug */
+	/* Scratch Register; 0x16 - 0x18 Read, 0x16 Write */
+	u8	scratch_write;
+	u8	scratch_set;		/* 0x17 Set */
+	u8	scratch_clear;		/* 0x18 Clear*/
+};

These are the generic ULPI specification registers and not mxc specific.
I'd expect to have them in a more generic location.

Quoted 2 lines

+
#endif /* _EHCI_FSL_H */

Signature · 2 lines
Regards,
Igor.
#7 lore raw

PATCH 3/4 EHCI: adjust for mx5

2011/10/31 Igor Grinberg <[email protected]>

Quoted 30 lines
Quoted 30 lines
include/usb/ehci-fsl.h +30 -0
+struct mxc_ulpi_regs {
+     u8      vendor_id_low;          /* 0x00 - Vendor ID lower byte */
+     u8      vendor_id_high;         /* 0x01 - Vendor ID upper byte */
+     u8      product_id_low;         /* 0x02 - Product ID lower byte */
+     u8      product_id_high;        /* 0x03 - Product ID higher byte */
+     /* Function Control; 0x04 - 0x06 Read, 0x04 Write */
+     u8      function_ctrl_write;
+     u8      function_ctrl_set;      /* 0x05 Set */
+     u8      function_ctrl_clear;    /* 0x06 Clear */
+     /* Interface Control; 0x07 - 0x09 Read, 0x07 Write */
+     u8      iface_ctrl_write;
+     u8      iface_ctrl_set;         /* 0x08 Set */
+     u8      iface_ctrl_clear;       /* 0x09 Clear */
+     /* OTG Control; 0x0A - 0x0C Read, 0x0A Write */
+     u8      otg_ctrl_write;
+     u8      otg_ctrl_set;           /* 0x0B Set */
+     u8      otg_ctrl_clear;         /* 0x0C Clear */
+     /* USB Interrupt Enable Rising; 0x0D - 0x0F Read, 0x0D Write */
+     u8      usb_ie_rising_write;
+     u8      usb_ie_rising_set;      /* 0x0E Set */
+     u8      usb_ie_rising_clear;    /* 0x0F Clear */
+     /* USB Interrupt Enable Falling; 0x10 - 0x12 Read, 0x10 Write */
+     u8      usb_ie_falling_write;
+     u8      usb_ie_falling_set;     /* 0x11 Set */
+     u8      usb_ie_falling_clear;   /* 0x12 Clear */
+     u8      usb_int_status;         /* 0x13 - USB Interrupt Status */
+     u8      usb_int_latch;          /* 0x14 - USB Interrupt Latch */
+     u8      debug;                  /* 0x15 - Debug */
+     /* Scratch Register; 0x16 - 0x18 Read, 0x16 Write */
+     u8      scratch_write;
Quoted 9 lines

include/usb/ehci-fsl.h struct usb_ehci { · line 387

Quoted 3 lines
include/usb/ehci-fsl.h +3 -0
+     u8      scratch_set;            /* 0x17 Set */
+     u8      scratch_clear;          /* 0x18 Clear*/
+};

These are the generic ULPI specification registers and not mxc specific.
I'd expect to have them in a more generic location.

This would be fixed in general ULPI support patch I'm working on. It should be ready for posting in a few days.

Quoted 2 lines

--

Regards,

Quoted 2 lines

Igor.

#8 lore raw

PATCH 3/4 EHCI: adjust for mx5

Hi Jana,

Quoted 45 lines · Jana Rapava

2011/10/31 Igor Grinberg <grinberg at compulab.co.il <mailto:[email protected]>>

Quoted 23 lines
include/usb/ehci-fsl.h +23 -0
+struct mxc_ulpi_regs {
+     u8      vendor_id_low;          /* 0x00 - Vendor ID lower byte */
+     u8      vendor_id_high;         /* 0x01 - Vendor ID upper byte */
+     u8      product_id_low;         /* 0x02 - Product ID lower byte */
+     u8      product_id_high;        /* 0x03 - Product ID higher byte */
+     /* Function Control; 0x04 - 0x06 Read, 0x04 Write */
+     u8      function_ctrl_write;
+     u8      function_ctrl_set;      /* 0x05 Set */
+     u8      function_ctrl_clear;    /* 0x06 Clear */
+     /* Interface Control; 0x07 - 0x09 Read, 0x07 Write */
+     u8      iface_ctrl_write;
+     u8      iface_ctrl_set;         /* 0x08 Set */
+     u8      iface_ctrl_clear;       /* 0x09 Clear */
+     /* OTG Control; 0x0A - 0x0C Read, 0x0A Write */
+     u8      otg_ctrl_write;
+     u8      otg_ctrl_set;           /* 0x0B Set */
+     u8      otg_ctrl_clear;         /* 0x0C Clear */
+     /* USB Interrupt Enable Rising; 0x0D - 0x0F Read, 0x0D Write */
+     u8      usb_ie_rising_write;
+     u8      usb_ie_rising_set;      /* 0x0E Set */
+     u8      usb_ie_rising_clear;    /* 0x0F Clear */
+     /* USB Interrupt Enable Falling; 0x10 - 0x12 Read, 0x10 Write */
+     u8      usb_ie_falling_write;

include/usb/ehci-fsl.h struct usb_ehci { · line 387

Quoted 10 lines
include/usb/ehci-fsl.h +10 -0
+     u8      usb_ie_falling_set;     /* 0x11 Set */
+     u8      usb_ie_falling_clear;   /* 0x12 Clear */
+     u8      usb_int_status;         /* 0x13 - USB Interrupt Status */
+     u8      usb_int_latch;          /* 0x14 - USB Interrupt Latch */
+     u8      debug;                  /* 0x15 - Debug */
+     /* Scratch Register; 0x16 - 0x18 Read, 0x16 Write */
+     u8      scratch_write;
+     u8      scratch_set;            /* 0x17 Set */
+     u8      scratch_clear;          /* 0x18 Clear*/
+};

These are the generic ULPI specification registers and not mxc specific.
I'd expect to have them in a more generic location.

Quoted 1 line

This would be fixed in general ULPI support patch I'm working on. It should be ready for posting in a few days.

Good!
Still, I'd expect this to be put in a separate location. This way, your general ULPI support patch will introduce less changes to this file.
Submitting something and then moving it around is not a good idea.

Another way would be to wait for the general ULPI support patch and then resubmit this patch set on top of the ULPI patch.

You choose, what works best for you :)

Signature · 2 lines
Regards,
Igor.
#9 lore raw

PATCH v2 3/4 EHCI: adjust for mx5

In reply to Jana Rapava

Add macros and structures needed by Efika USB support code. Move shared offset and bits definitions into common header file.

Cc Marek Vasut <[email protected]>
Cc Remy Bohmer <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Igor Grinberg <[email protected]>

---
Changes for v2:
- whitespace and coding style changes (no actual changes)

 drivers/usb/host/ehci-mxc.c |   31 +--------
 include/usb/ehci-fsl.h      |  146 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 148 insertions(+), 29 deletions(-)
drivers/usb/host/ehci-mxc.c +3 -28
index fde1f0f..2c1295f 100644
@@ -27,31 +27,6 @@
 #include <usb/ehci.h>
 #include <usb/ehci-core.h>
 
-#define USBCTRL_OTGBASE_OFFSET	0x600
-
-#ifdef CONFIG_MX25
-#define MX25_USB_CTRL_IP_PUE_DOWN_BIT	(1<<6)
-#define MX25_USB_CTRL_HSTD_BIT		(1<<5)
-#define MX25_USB_CTRL_USBTE_BIT		(1<<4)
-#define MX25_USB_CTRL_OCPOL_OTG_BIT	(1<<3)
-#endif
-
-#ifdef CONFIG_MX31
-#define MX31_OTG_SIC_SHIFT	29
-#define MX31_OTG_SIC_MASK	(0x3 << MX31_OTG_SIC_SHIFT)
-#define MX31_OTG_PM_BIT		(1 << 24)
-
-#define MX31_H2_SIC_SHIFT	21
-#define MX31_H2_SIC_MASK	(0x3 << MX31_H2_SIC_SHIFT)
-#define MX31_H2_PM_BIT		(1 << 16)
-#define MX31_H2_DT_BIT		(1 << 5)
-
-#define MX31_H1_SIC_SHIFT	13
-#define MX31_H1_SIC_MASK	(0x3 << MX31_H1_SIC_SHIFT)
-#define MX31_H1_PM_BIT		(1 << 8)
-#define MX31_H1_DT_BIT		(1 << 4)
-#endif
-
 static int mxc_set_usbcontrol(int port, unsigned int flags)
 {
 	unsigned int v;
@@ -66,11 +41,11 @@ static int mxc_set_usbcontrol(int port, unsigned int flags)
 
 		switch (port) {
 		case 0:	/* OTG port */
-			v &= ~(MX31_OTG_SIC_MASK | MX31_OTG_PM_BIT);
+			v &= ~(MXC_OTG_SIC_MASK | MXC_OTG_PM_BIT);
 			v |= (flags & MXC_EHCI_INTERFACE_MASK)
-					<< MX31_OTG_SIC_SHIFT;
+					<< MXC_OTG_SIC_SHIFT;
 			if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
-				v |= MX31_OTG_PM_BIT;
+				v |= MXC_OTG_PM_BIT;
 
 			break;
 		case 1: /* H1 port */
include/usb/ehci-fsl.h +145 -1

162 lines not on this page · raw message

Signature · 1 line
1.7.6.3
#10 lore raw

PATCH v2 3/4 EHCI: adjust for mx5

Quoted 11 lines

Add macros and structures needed by Efika USB support code. Move shared offset and bits definitions into common header file.

Cc Marek Vasut <[email protected]>
Cc Remy Bohmer <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Igor Grinberg <[email protected]>

---
Changes for v2:
- whitespace and coding style changes (no actual changes)

Do you see the contradiction here ?

M

#11 lore raw

PATCH v2 3/4 EHCI: adjust for mx5

In reply to Jana Rapava
Quoted 15 lines · Jana Rapava

Add macros and structures needed by Efika USB support code. Move shared offset and bits definitions into common header file.

Cc Marek Vasut <[email protected]>
Cc Remy Bohmer <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Igor Grinberg <[email protected]>

---
Changes for v2:
- whitespace and coding style changes (no actual changes)

 drivers/usb/host/ehci-mxc.c |   31 +--------
 include/usb/ehci-fsl.h      |  146 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 148 insertions(+), 29 deletions(-)

[...]

Quoted 4 lines
include/usb/ehci-fsl.h +0 -0
index 67600ed..f957c65 100644

[...]

include/usb/ehci-fsl.h line 248

Quoted 4 lines
include/usb/ehci-fsl.h +4 -0
+
+/*
+* ULPI
+*/

missed this one?

Quoted 12 lines
include/usb/ehci-fsl.h +12 -0
+#define ULPI_ID_REGS_COUNT	4
+#define ULPI_TEST_VALUE		0x55
+#define ULPI_TIMEOUT		1000 /* some reasonable value */
+
+/* ULPI viewport control bits */
+#define ULPI_WU		(1 << 31)
+#define ULPI_SS		(1 << 27)
+#define ULPI_RWRUN	(1 << 30)
+#define ULPI_RWCTRL	(1 << 29)
+
+/* ULPI OTG Control bits of interest */
+#define ULPI_OTG_EXT_VBUS_IND	(1 << 7)

include/usb/ehci-fsl.h line 270

Quoted 10 lines
include/usb/ehci-fsl.h +10 -0
+#define ULPI_OTG_DM_PULLDOWN	(1 << 2)
+#define ULPI_OTG_DP_PULLDOWN	(1 << 1)
+#define ULPI_OTG_DRV_VBUS	(1 << 5)
+#define ULPI_OTG_DRV_VBUS_EXT	(1 << 6)
+#define ULPI_OTG_CHRG_VBUS	(1 << 4)
+
+/* ULPI Function Control bits of interest */
+#define ULPI_FC_XCVR_SELECT	(1 << 0)
+#define ULPI_FC_OPMODE_NORMAL	(0 << 3)
+#define ULPI_FC_SUSPENDM_PWRED	(1 << 6)

These are also ULPI specification defined offsets, right? So the same as for the below, should apply.

[...]

Quoted 24 lines
include/usb/ehci-fsl.h +24 -0
+
+struct mxc_ulpi_regs {
+	u8	vendor_id_low;		/* 0x00 - Vendor ID lower byte */
+	u8	vendor_id_high;		/* 0x01 - Vendor ID upper byte */
+	u8	product_id_low;		/* 0x02 - Product ID lower byte */
+	u8	product_id_high;	/* 0x03 - Product ID higher byte */
+	/* Function Control; 0x04 - 0x06 Read, 0x04 Write */
+	u8	function_ctrl_write;
+	u8	function_ctrl_set;	/* 0x05 Set */
+	u8	function_ctrl_clear;	/* 0x06 Clear */
+	/* Interface Control; 0x07 - 0x09 Read, 0x07 Write */
+	u8	iface_ctrl_write;
+	u8	iface_ctrl_set;		/* 0x08 Set */
+	u8	iface_ctrl_clear;	/* 0x09 Clear */
+	/* OTG Control; 0x0A - 0x0C Read, 0x0A Write */
+	u8	otg_ctrl_write;
+	u8	otg_ctrl_set;		/* 0x0B Set */
+	u8	otg_ctrl_clear;		/* 0x0C Clear */
+	/* USB Interrupt Enable Rising; 0x0D - 0x0F Read, 0x0D Write */
+	u8	usb_ie_rising_write;
+	u8	usb_ie_rising_set;	/* 0x0E Set */
+	u8	usb_ie_rising_clear;	/* 0x0F Clear */
+	/* USB Interrupt Enable Falling; 0x10 - 0x12 Read, 0x10 Write */
+	u8	usb_ie_falling_write;

include/usb/ehci-fsl.h struct usb_ehci { · line 387

Quoted 10 lines
include/usb/ehci-fsl.h +10 -0
+	u8	usb_ie_falling_set;	/* 0x11 Set */
+	u8	usb_ie_falling_clear;	/* 0x12 Clear */
+	u8	usb_int_status;		/* 0x13 - USB Interrupt Status */
+	u8	usb_int_latch;		/* 0x14 - USB Interrupt Latch */
+	u8	debug;			/* 0x15 - Debug */
+	/* Scratch Register; 0x16 - 0x18 Read, 0x16 Write */
+	u8	scratch_write;
+	u8	scratch_set;		/* 0x17 Set */
+	u8	scratch_clear;		/* 0x18 Clear*/
+};

Do you already have a header for the generic ULPI support? Can't the above be put in that header and the next patch set (ULPI) will just extend this?

Signature · 2 lines
Regards,
Igor.
#12 lore raw

PATCH v2 3/4 EHCI: adjust for mx5

2011/11/1 Igor Grinberg <[email protected]>

Quoted 5 lines

Do you already have a header for the generic ULPI support? Can't the above be put in that header and the next patch set (ULPI) will just extend this?

Ok, I'll send ulpi header as a separate patch, thanks for suggestion.

Quoted 6 lines

--
Regards,
Igor.

#13 lore raw

PATCH v3 3/4 EHCI: adjust for mx5

In reply to Jana Rapava

Add macros and structures needed by Efika USB support code. Move shared offset and bits definitions into common header file.

Cc Marek Vasut <[email protected]>
Cc Remy Bohmer <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Igor Grinberg <[email protected]>

---
Changes for v2:
- whitespace and coding style changes
Changes for v3:
- ULPI-related definitions moved to ULPI header file

 drivers/usb/host/ehci-mxc.c |   31 +--------------
 include/usb/ehci-fsl.h      |   86 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 88 insertions(+), 29 deletions(-)
drivers/usb/host/ehci-mxc.c +3 -28
index fde1f0f..2c1295f 100644
@@ -27,31 +27,6 @@
 #include <usb/ehci.h>
 #include <usb/ehci-core.h>
 
-#define USBCTRL_OTGBASE_OFFSET	0x600
-
-#ifdef CONFIG_MX25
-#define MX25_USB_CTRL_IP_PUE_DOWN_BIT	(1<<6)
-#define MX25_USB_CTRL_HSTD_BIT		(1<<5)
-#define MX25_USB_CTRL_USBTE_BIT		(1<<4)
-#define MX25_USB_CTRL_OCPOL_OTG_BIT	(1<<3)
-#endif
-
-#ifdef CONFIG_MX31
-#define MX31_OTG_SIC_SHIFT	29
-#define MX31_OTG_SIC_MASK	(0x3 << MX31_OTG_SIC_SHIFT)
-#define MX31_OTG_PM_BIT		(1 << 24)
-
-#define MX31_H2_SIC_SHIFT	21
-#define MX31_H2_SIC_MASK	(0x3 << MX31_H2_SIC_SHIFT)
-#define MX31_H2_PM_BIT		(1 << 16)
-#define MX31_H2_DT_BIT		(1 << 5)
-
-#define MX31_H1_SIC_SHIFT	13
-#define MX31_H1_SIC_MASK	(0x3 << MX31_H1_SIC_SHIFT)
-#define MX31_H1_PM_BIT		(1 << 8)
-#define MX31_H1_DT_BIT		(1 << 4)
-#endif
-
 static int mxc_set_usbcontrol(int port, unsigned int flags)
 {
 	unsigned int v;
@@ -66,11 +41,11 @@ static int mxc_set_usbcontrol(int port, unsigned int flags)
 
 		switch (port) {
 		case 0:	/* OTG port */
-			v &= ~(MX31_OTG_SIC_MASK | MX31_OTG_PM_BIT);
+			v &= ~(MXC_OTG_SIC_MASK | MXC_OTG_PM_BIT);
 			v |= (flags & MXC_EHCI_INTERFACE_MASK)
-					<< MX31_OTG_SIC_SHIFT;
+					<< MXC_OTG_SIC_SHIFT;
 			if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
-				v |= MX31_OTG_PM_BIT;
+				v |= MXC_OTG_PM_BIT;
 
 			break;
 		case 1: /* H1 port */
include/usb/ehci-fsl.h +85 -1

102 lines not on this page · raw message

Signature · 1 line
1.7.6.3
#14 lore raw

PATCH v4 3/4 EHCI: adjust for mx5

Add macros and structures needed by Efika USB support code. Move shared offset and bits definitions into common header file.

Cc Marek Vasut <[email protected]>
Cc Remy Bohmer <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc Wolfgang Grandegger <[email protected]>

---
Changes for v2:
- whitespace and coding style changes
Changes for v3:
- ULPI-related definitions moved to ULPI header file
Changes for v4:
- rename "ulpi_viewpoint", because it's called "ulpi_viewport" in documentation

 drivers/usb/host/ehci-mxc.c |   31 +--------------
 include/usb/ehci-fsl.h      |   86 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 88 insertions(+), 29 deletions(-)
drivers/usb/host/ehci-mxc.c +3 -28
index fde1f0f..2c1295f 100644
@@ -27,31 +27,6 @@
 #include <usb/ehci.h>
 #include <usb/ehci-core.h>
 
-#define USBCTRL_OTGBASE_OFFSET	0x600
-
-#ifdef CONFIG_MX25
-#define MX25_USB_CTRL_IP_PUE_DOWN_BIT	(1<<6)
-#define MX25_USB_CTRL_HSTD_BIT		(1<<5)
-#define MX25_USB_CTRL_USBTE_BIT		(1<<4)
-#define MX25_USB_CTRL_OCPOL_OTG_BIT	(1<<3)
-#endif
-
-#ifdef CONFIG_MX31
-#define MX31_OTG_SIC_SHIFT	29
-#define MX31_OTG_SIC_MASK	(0x3 << MX31_OTG_SIC_SHIFT)
-#define MX31_OTG_PM_BIT		(1 << 24)
-
-#define MX31_H2_SIC_SHIFT	21
-#define MX31_H2_SIC_MASK	(0x3 << MX31_H2_SIC_SHIFT)
-#define MX31_H2_PM_BIT		(1 << 16)
-#define MX31_H2_DT_BIT		(1 << 5)
-
-#define MX31_H1_SIC_SHIFT	13
-#define MX31_H1_SIC_MASK	(0x3 << MX31_H1_SIC_SHIFT)
-#define MX31_H1_PM_BIT		(1 << 8)
-#define MX31_H1_DT_BIT		(1 << 4)
-#endif
-
 static int mxc_set_usbcontrol(int port, unsigned int flags)
 {
 	unsigned int v;
@@ -66,11 +41,11 @@ static int mxc_set_usbcontrol(int port, unsigned int flags)
 
 		switch (port) {
 		case 0:	/* OTG port */
-			v &= ~(MX31_OTG_SIC_MASK | MX31_OTG_PM_BIT);
+			v &= ~(MXC_OTG_SIC_MASK | MXC_OTG_PM_BIT);
 			v |= (flags & MXC_EHCI_INTERFACE_MASK)
-					<< MX31_OTG_SIC_SHIFT;
+					<< MXC_OTG_SIC_SHIFT;
 			if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
-				v |= MX31_OTG_PM_BIT;
+				v |= MXC_OTG_PM_BIT;
 
 			break;
 		case 1: /* H1 port */
include/usb/ehci-fsl.h +85 -1

102 lines not on this page · raw message

Signature · 1 line
1.7.6.3
#15 lore raw

PATCH v4 3/4 EHCI: adjust for mx5

Quoted 136 lines · Jana Rapava

Add macros and structures needed by Efika USB support code. Move shared offset and bits definitions into common header file.

Cc Marek Vasut <[email protected]>
Cc Remy Bohmer <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc Wolfgang Grandegger <[email protected]>

---
Changes for v2:
- whitespace and coding style changes
Changes for v3:
- ULPI-related definitions moved to ULPI header file
Changes for v4:
- rename "ulpi_viewpoint", because it's called "ulpi_viewport" in documentation

 drivers/usb/host/ehci-mxc.c |   31 +--------------
 include/usb/ehci-fsl.h      |   86 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 88 insertions(+), 29 deletions(-)
drivers/usb/host/ehci-mxc.c +3 -28
index fde1f0f..2c1295f 100644
@@ -27,31 +27,6 @@
 #include <usb/ehci.h>
 #include <usb/ehci-core.h>
 
-#define USBCTRL_OTGBASE_OFFSET	0x600
-
-#ifdef CONFIG_MX25
-#define MX25_USB_CTRL_IP_PUE_DOWN_BIT	(1<<6)
-#define MX25_USB_CTRL_HSTD_BIT		(1<<5)
-#define MX25_USB_CTRL_USBTE_BIT		(1<<4)
-#define MX25_USB_CTRL_OCPOL_OTG_BIT	(1<<3)
-#endif
-
-#ifdef CONFIG_MX31
-#define MX31_OTG_SIC_SHIFT	29
-#define MX31_OTG_SIC_MASK	(0x3 << MX31_OTG_SIC_SHIFT)
-#define MX31_OTG_PM_BIT		(1 << 24)
-
-#define MX31_H2_SIC_SHIFT	21
-#define MX31_H2_SIC_MASK	(0x3 << MX31_H2_SIC_SHIFT)
-#define MX31_H2_PM_BIT		(1 << 16)
-#define MX31_H2_DT_BIT		(1 << 5)
-
-#define MX31_H1_SIC_SHIFT	13
-#define MX31_H1_SIC_MASK	(0x3 << MX31_H1_SIC_SHIFT)
-#define MX31_H1_PM_BIT		(1 << 8)
-#define MX31_H1_DT_BIT		(1 << 4)
-#endif
-
 static int mxc_set_usbcontrol(int port, unsigned int flags)
 {
 	unsigned int v;
@@ -66,11 +41,11 @@ static int mxc_set_usbcontrol(int port, unsigned int flags)
 
 		switch (port) {
 		case 0:	/* OTG port */
-			v &= ~(MX31_OTG_SIC_MASK | MX31_OTG_PM_BIT);
+			v &= ~(MXC_OTG_SIC_MASK | MXC_OTG_PM_BIT);
 			v |= (flags & MXC_EHCI_INTERFACE_MASK)
-					<< MX31_OTG_SIC_SHIFT;
+					<< MXC_OTG_SIC_SHIFT;
 			if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
-				v |= MX31_OTG_PM_BIT;
+				v |= MXC_OTG_PM_BIT;
 
 			break;
 		case 1: /* H1 port */
include/usb/ehci-fsl.h +55 -0
index 67600ed..2b1ac22 100644
@@ -169,6 +169,80 @@
 #define CONFIG_SYS_FSL_USB_ADDR CONFIG_SYS_MPC512x_USB_ADDR
 #endif
 
+#if defined(CONFIG_MX25) || defined(CONFIG_MX31)
+#define USBCTRL_OTGBASE_OFFSET	0x600
+#endif
+
+#ifdef CONFIG_MX25
+#define MX25_USB_CTRL_IP_PUE_DOWN_BIT	(1<<6)
+#define MX25_USB_CTRL_HSTD_BIT		(1<<5)
+#define MX25_USB_CTRL_USBTE_BIT	(1<<4)
+#define MX25_USB_CTRL_OCPOL_OTG_BIT	(1<<3)
+#endif
+
+#ifdef CONFIG_MX31
+#define MX31_H2_SIC_SHIFT	21
+#define MX31_H2_SIC_MASK	(0x3 << MX31_H2_SIC_SHIFT)
+#define MX31_H2_PM_BIT		(1 << 16)
+#define MX31_H2_DT_BIT		(1 << 5)
+
+#define MX31_H1_SIC_SHIFT	13
+#define MX31_H1_SIC_MASK	(0x3 << MX31_H1_SIC_SHIFT)
+#define MX31_H1_PM_BIT		(1 << 8)
+#define MX31_H1_DT_BIT		(1 << 4)
+#endif
+
+#if defined(CONFIG_MX51) || defined(CONFIG_MX53)
+/* offset for first USB CTRL register */
+#define MX5_CTRL_REGS_OFFSET	0x800
+#endif
+
+#if defined(CONFIG_MX51) || defined(CONFIG_MX31)
+/* USB_CTRL register bits of interest*/
+#define MXC_OTG_SIC_SHIFT	29
+#define MXC_OTG_SIC_MASK	(0x3 << MX31_OTG_SIC_SHIFT)
+#define MXC_OTG_WUE		(1 << 27)
+#define MXC_OTG_PM		(1 << 24)
+#endif
+
+#ifdef CONFIG_MX51
+#define MX51_REGISTER_LAYOUT_LENGTH	0x200
+
+/* Register offsets for MX51 */
+#define MX51_OTG_ID	0x000
+#define MX51_UH1_ID	0x200
+#define MX51_UH2_ID	0x400
+
+/* USB_CTRL register bits of interest*/
+#define MX51_OTG_PM		(1 << 24)
+#define MX51_H1_ULPI_IE	(1 << 12)
+#define MX51_H1_WUE		(1 << 11)
+#define MX51_H1_PM		(1 << 8)
+
+/* PHY_CTRL_0 register bits of interest */
+#define MX51_OTG_OVERCURD	(1 << 8)
+#define MX51_EHCI_POWERPINSE	(1 << 5)
+
+/* PHY_CTRL_1 register bits of interest */

include/usb/ehci-fsl.h line 236

Quoted 10 lines
include/usb/ehci-fsl.h +10 -0
+#define MX51_SYSCLOCK_24_MHZ	(1 << 0)
+#define MX51_SYSCLOCK_MASK	(~(0xffffffff << 2))
+
+/* USB_CTRL_1 register bits of interest */
+#define MX51_H1_EXTCLKE	(1 << 25)
+
+/* USB Host 2 CTRL register bits of interest */
+#define MX51_H2_ULPI_IE	(1 << 8)
+#define MX51_H2_WUE		(1 << 7)
+#define MX51_H2_PM		(1 << 4)

Most of the definitions above are arch specific and would better be placed in arch/arm/include/asm/arch-mx25/31/5, I think.

include/usb/ehci-fsl.h line 240

Quoted 3 lines
include/usb/ehci-fsl.h +3 -0
+/* PORTSCx bits of interest */
+#define MX51_ULPI_MODE_MASK	(2 << 30)
+#define MX51_16BIT_UTMI	(1 << 28)

In ehci-fsl.h we have already

#define PORT_PTS_ULPI (2 << 30)
#define PORT_PTS_PTW (1 << 28)

Quoted 19 lines
include/usb/ehci-fsl.h +5 -1
+/* USBCMD bits of interest */
+#define MX51_ITC_IMMEDIATE_MASK	(0xff << 16)
+#endif
+
 /*
  * USB Registers
  */
@@ -210,7 +284,7 @@ struct usb_ehci {
 	u32	txfilltuning;	/* 0x164 - Host TT Transmit
 					   pre-buffer packet tuning */
 	u8	res7[0x8];
-	u32	ulpi_viewpoint;	/* 0x170 - ULPI Reister Access */
+	u32	ulpi_viewport;	/* 0x170 - ULPI Register Access */
 	u8	res8[0xc];
 	u32	config_flag;	/* 0x180 - Configured Flag Register */
 	u32	portsc;		/* 0x184 - Port status/control */
@@ -242,4 +316,14 @@ struct usb_ehci {
 	u8	res13[0xafc];
 };

include/usb/ehci-fsl.h struct usb_ehci { · line 327

Quoted 10 lines
include/usb/ehci-fsl.h +9 -0
 
+struct mx5_usb_control_regs {
+	u32	usbctrl;	/* 0x800 - USB Control */
+	u32	otgmirror;	/* 0x804 - OTG Port Mirror */
+	u32	phyctrl0;	/* 0x808 - UTMI PHY Control Register 0 */
+	u32	phyctrl1;	/* 0x80C - UTMI PHY Control Register 1 */
+	u32	usbctrl1;	/* 0x810 - USB Control Register 1 */
+	u32	uh2ctrl;	/* 0x814 - USB Host2 Control */
+	u32	uh3ctrl;	/* 0x818 - USB Host3 Control */
+};

Good.

Wolfgang

#16 lore raw

PATCH v4 3/4 EHCI: adjust for mx5

2011/11/14 Wolfgang Grandegger <[email protected]>

Quoted 71 lines
Quoted 57 lines
include/usb/ehci-fsl.h +55 -0
+#if defined(CONFIG_MX25) || defined(CONFIG_MX31)
+#define USBCTRL_OTGBASE_OFFSET       0x600
+#endif
+
+#ifdef CONFIG_MX25
+#define MX25_USB_CTRL_IP_PUE_DOWN_BIT        (1<<6)
+#define MX25_USB_CTRL_HSTD_BIT               (1<<5)
+#define MX25_USB_CTRL_USBTE_BIT      (1<<4)
+#define MX25_USB_CTRL_OCPOL_OTG_BIT  (1<<3)
+#endif
+
+#ifdef CONFIG_MX31
+#define MX31_H2_SIC_SHIFT    21
+#define MX31_H2_SIC_MASK     (0x3 << MX31_H2_SIC_SHIFT)
+#define MX31_H2_PM_BIT               (1 << 16)
+#define MX31_H2_DT_BIT               (1 << 5)
+
+#define MX31_H1_SIC_SHIFT    13
+#define MX31_H1_SIC_MASK     (0x3 << MX31_H1_SIC_SHIFT)
+#define MX31_H1_PM_BIT               (1 << 8)
+#define MX31_H1_DT_BIT               (1 << 4)
+#endif
+
+#if defined(CONFIG_MX51) || defined(CONFIG_MX53)
+/* offset for first USB CTRL register */
+#define MX5_CTRL_REGS_OFFSET 0x800
+#endif
+
+#if defined(CONFIG_MX51) || defined(CONFIG_MX31)
+/* USB_CTRL register bits of interest*/
+#define MXC_OTG_SIC_SHIFT    29
+#define MXC_OTG_SIC_MASK     (0x3 << MX31_OTG_SIC_SHIFT)
+#define MXC_OTG_WUE          (1 << 27)
+#define MXC_OTG_PM           (1 << 24)
+#endif
+
+#ifdef CONFIG_MX51
+#define MX51_REGISTER_LAYOUT_LENGTH  0x200
+
+/* Register offsets for MX51 */
+#define MX51_OTG_ID  0x000
+#define MX51_UH1_ID  0x200
+#define MX51_UH2_ID  0x400
+
+/* USB_CTRL register bits of interest*/
+#define MX51_OTG_PM          (1 << 24)
+#define MX51_H1_ULPI_IE      (1 << 12)
+#define MX51_H1_WUE          (1 << 11)
+#define MX51_H1_PM           (1 << 8)
+
+/* PHY_CTRL_0 register bits of interest */
+#define MX51_OTG_OVERCURD    (1 << 8)
+#define MX51_EHCI_POWERPINSE (1 << 5)
+
+/* PHY_CTRL_1 register bits of interest */

include/usb/ehci-fsl.h line 236

Quoted 10 lines
include/usb/ehci-fsl.h +10 -0
+#define MX51_SYSCLOCK_24_MHZ (1 << 0)
+#define MX51_SYSCLOCK_MASK   (~(0xffffffff << 2))
+
+/* USB_CTRL_1 register bits of interest */
+#define MX51_H1_EXTCLKE      (1 << 25)
+
+/* USB Host 2 CTRL register bits of interest */
+#define MX51_H2_ULPI_IE      (1 << 8)
+#define MX51_H2_WUE          (1 << 7)
+#define MX51_H2_PM           (1 << 4)

Most of the definitions above are arch specific and would better be placed in arch/arm/include/asm/arch-mx25/31/5, I think.

Quoted 1 line

Stefano, what do you think? You said that these definitions could be in

ehci-fsl.h, is arch-specific place better?

Quoted 10 lines

include/usb/ehci-fsl.h line 240

Quoted 3 lines
include/usb/ehci-fsl.h +3 -0
+/* PORTSCx bits of interest */
+#define MX51_ULPI_MODE_MASK  (2 << 30)
+#define MX51_16BIT_UTMI      (1 << 28)

In ehci-fsl.h we have already

#define PORT_PTS_ULPI (2 << 30)
#define PORT_PTS_PTW (1 << 28)

Ok, I'll use them.

Regards,
Jana Rapava

#17 lore raw

PATCH 4/4 usb: add USB support for Efika

In reply to Jana Rapava

This commit adds USB support for EfikaMX and EfikaSB.

---
 board/efikamx/Makefile      |    3 +
 board/efikamx/efika.h       |   30 +++
 board/efikamx/efikamx-usb.c |  420 +++++++++++++++++++++++++++++++++++++++++++
 board/efikamx/efikamx.c     |    3 +
 include/configs/efikamx.h   |   16 ++
 5 files changed, 472 insertions(+), 0 deletions(-)
 create mode 100644 board/efikamx/efika.h
 create mode 100644 board/efikamx/efikamx-usb.c
board/efikamx/Makefile +3 -0
index ee4a16e..860e4d2 100644
@@ -28,6 +28,9 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(BOARD).o
 
 COBJS	:= efikamx.o
+ifdef	CONFIG_CMD_USB
+COBJS	+= efikamx-usb.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/efikamx/efika.h new file +30 -0
new file mode 100644
index 0000000..b3532e2
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2011 Jana Rapava <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * EHCI USB
+ */
+#ifdef	CONFIG_CMD_USB
+void setup_iomux_usb(void);
+#else
+static inline void setup_iomux_usb(void) { }
+#endif
board/efikamx/efikamx-usb.c new file +420 -0

420 lines not on this page · raw message

board/efikamx/efikamx.c +3 -0
index 0c4e24b..8e9b42b 100644
@@ -37,6 +37,8 @@
 #include <fsl_pmic.h>
 #include <mc13892.h>
 
+#include "efika.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -678,6 +680,7 @@ int board_late_init(void)
 
 	setup_iomux_led();
 	setup_iomux_ata();
+	setup_iomux_usb();
 
 	efikamx_toggle_led(EFIKAMX_LED_BLUE);
 
include/configs/efikamx.h +16 -0
index 54f48e4..010a16a 100644
@@ -44,6 +44,10 @@
 
 #define CONFIG_SYS_TEXT_BASE		0x97800000
 
+#define	CONFIG_L2_OFF
+#define	CONFIG_SYS_ICACHE_OFF
+#define	CONFIG_SYS_DCACHE_OFF
+
 /*
  * Bootloader Components Configuration
  */
@@ -172,6 +176,18 @@
 #endif
 
 /*
+ * USB
+ */
+#define CONFIG_CMD_USB
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI			/* Enable EHCI USB support */
+#define CONFIG_MXC_USB_PORT	1
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#define	CONFIG_USB_KEYBOARD
+#endif /* CONFIG_CMD_USB */
+
+/*
  * Filesystems
  */
 #ifdef CONFIG_CMD_FAT
Signature · 1 line
1.7.6.3
#18 lore raw

PATCH 4/4 usb: add USB support for Efika

Quoted 16 lines · Jana Rapava

This commit adds USB support for EfikaMX and EfikaSB.

---
 board/efikamx/Makefile      |    3 +
 board/efikamx/efika.h       |   30 +++
 board/efikamx/efikamx-usb.c |  420
+++++++++++++++++++++++++++++++++++++++++++ board/efikamx/efikamx.c     | 
  3 +
 include/configs/efikamx.h   |   16 ++
 5 files changed, 472 insertions(+), 0 deletions(-)
 create mode 100644 board/efikamx/efika.h
 create mode 100644 board/efikamx/efikamx-usb.c

[...]

Quoted 9 lines
board/efikamx/efikamx-usb.c new file +8 -0
+
+int ulpi_wakeup(struct usb_ehci *ehci)
+{
+	if (readl(&ehci->ulpi_viewpoint) & ULPI_SS)
+		return 0; /* already awake */
+	return ulpi_wait(ehci, ULPI_WU, ULPI_WU);
+}
+

board/efikamx/efikamx-usb.c line 245

Quoted 10 lines
board/efikamx/efikamx-usb.c new file +10 -0
+void ulpi_write(struct usb_ehci *ehci, u32 reg, u32 value)
+{
+	if (ulpi_wakeup(ehci)) {
+		printf("ULPI wakeup timed out\n");
+		return;
+	}
+
+	if (ulpi_wait(ehci, ULPI_RWRUN | ULPI_RWCTRL |
+	reg << ULPI_ADDR_SHIFT | ulpi_write_mask(value), ULPI_RWRUN))
+		printf("ULPI write timed out\n");

Please use temp. variable here and fix indent.

board/efikamx/efikamx-usb.c line 258

Quoted 13 lines
board/efikamx/efikamx-usb.c new file +13 -0
+}
+
+u32 ulpi_read(struct usb_ehci *ehci, u32 reg)
+{
+	if (ulpi_wakeup(ehci)) {
+		printf("ULPI wakeup timed out\n");
+		return 0;
+	}
+
+	if (ulpi_wait(ehci, ULPI_RWRUN | reg << ULPI_ADDR_SHIFT, ULPI_RWRUN)) {
+		printf("ULPI read timed out\n");
+		return 0;
+	}

Newline

Quoted 2 lines
(quoted diff) +2 -0
+	return ulpi_read_mask(readl(&ehci->ulpi_viewpoint));
+}
#19 lore raw

PATCH v2 4/4 usb: add USB support for Efika

In reply to Jana Rapava

This commit adds USB support for EfikaMX and EfikaSB.

---
Changes for v2:
- introduce temporary variable in ulpi_write
- whitespace changes

 board/efikamx/Makefile      |    3 +
 board/efikamx/efika.h       |   30 +++
 board/efikamx/efikamx-usb.c |  423 +++++++++++++++++++++++++++++++++++++++++++
 board/efikamx/efikamx.c     |    3 +
 include/configs/efikamx.h   |   16 ++
 5 files changed, 475 insertions(+), 0 deletions(-)
 create mode 100644 board/efikamx/efika.h
 create mode 100644 board/efikamx/efikamx-usb.c
board/efikamx/Makefile +3 -0
index ee4a16e..860e4d2 100644
@@ -28,6 +28,9 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(BOARD).o
 
 COBJS	:= efikamx.o
+ifdef	CONFIG_CMD_USB
+COBJS	+= efikamx-usb.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/efikamx/efika.h new file +30 -0
new file mode 100644
index 0000000..b3532e2
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2011 Jana Rapava <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * EHCI USB
+ */
+#ifdef	CONFIG_CMD_USB
+void setup_iomux_usb(void);
+#else
+static inline void setup_iomux_usb(void) { }
+#endif
board/efikamx/efikamx-usb.c new file +423 -0

423 lines not on this page · raw message

board/efikamx/efikamx.c +3 -0
index 0c4e24b..8e9b42b 100644
@@ -37,6 +37,8 @@
 #include <fsl_pmic.h>
 #include <mc13892.h>
 
+#include "efika.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -678,6 +680,7 @@ int board_late_init(void)
 
 	setup_iomux_led();
 	setup_iomux_ata();
+	setup_iomux_usb();
 
 	efikamx_toggle_led(EFIKAMX_LED_BLUE);
 
include/configs/efikamx.h +16 -0
index 54f48e4..010a16a 100644
@@ -44,6 +44,10 @@
 
 #define CONFIG_SYS_TEXT_BASE		0x97800000
 
+#define	CONFIG_L2_OFF
+#define	CONFIG_SYS_ICACHE_OFF
+#define	CONFIG_SYS_DCACHE_OFF
+
 /*
  * Bootloader Components Configuration
  */
@@ -172,6 +176,18 @@
 #endif
 
 /*
+ * USB
+ */
+#define CONFIG_CMD_USB
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI			/* Enable EHCI USB support */
+#define CONFIG_MXC_USB_PORT	1
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_KEYBOARD
+#endif /* CONFIG_CMD_USB */
+
+/*
  * Filesystems
  */
 #ifdef CONFIG_CMD_FAT
Signature · 1 line
1.7.6.3
#20 lore raw

PATCH v2 4/4 usb: add USB support for Efika

Quoted 60 lines · Jana Rapava

This commit adds USB support for EfikaMX and EfikaSB.

---
Changes for v2:
- introduce temporary variable in ulpi_write
- whitespace changes

 board/efikamx/Makefile      |    3 +
 board/efikamx/efika.h       |   30 +++
 board/efikamx/efikamx-usb.c |  423
+++++++++++++++++++++++++++++++++++++++++++ board/efikamx/efikamx.c     | 
  3 +
 include/configs/efikamx.h   |   16 ++
 5 files changed, 475 insertions(+), 0 deletions(-)
 create mode 100644 board/efikamx/efika.h
 create mode 100644 board/efikamx/efikamx-usb.c
board/efikamx/Makefile +3 -0
index ee4a16e..860e4d2 100644
@@ -28,6 +28,9 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(BOARD).o
 
 COBJS	:= efikamx.o
+ifdef	CONFIG_CMD_USB
+COBJS	+= efikamx-usb.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/efikamx/efika.h new file +20 -0
new file mode 100644
index 0000000..b3532e2
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2011 Jana Rapava <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA

board/efikamx/efika.h line 30

Quoted 10 lines
board/efikamx/efika.h new file +10 -0
+ */
+
+/*
+ * EHCI USB
+ */
+#ifdef	CONFIG_CMD_USB
+void setup_iomux_usb(void);
+#else
+static inline void setup_iomux_usb(void) { }
+#endif

You're missing protection against multiple inclusion of this file

#21 lore raw

PATCH v3 4/4 usb: add USB support for Efika

In reply to Jana Rapava

This commit adds USB support for EfikaMX and EfikaSB.

---
Changes for v2:
- introduce temporary variable in ulpi_write
- whitespace changes
Changes for v3:
- add protection against multiple inclusion of efika.h

 board/efikamx/Makefile      |    3 +
 board/efikamx/efika.h       |   33 ++++
 board/efikamx/efikamx-usb.c |  423 +++++++++++++++++++++++++++++++++++++++++++
 board/efikamx/efikamx.c     |    3 +
 include/configs/efikamx.h   |   16 ++
 5 files changed, 478 insertions(+), 0 deletions(-)
 create mode 100644 board/efikamx/efika.h
 create mode 100644 board/efikamx/efikamx-usb.c
board/efikamx/Makefile +3 -0
index ee4a16e..860e4d2 100644
@@ -28,6 +28,9 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(BOARD).o
 
 COBJS	:= efikamx.o
+ifdef	CONFIG_CMD_USB
+COBJS	+= efikamx-usb.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/efikamx/efika.h new file +33 -0
new file mode 100644
index 0000000..efda329
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2011 Jana Rapava <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef EFIKA_H
+#define EFIKA_H
+
+/*
+ * EHCI USB
+ */
+#ifdef	CONFIG_CMD_USB
+void setup_iomux_usb(void);
+#else
+static inline void setup_iomux_usb(void) { }
+#endif
board/efikamx/efikamx-usb.c new file +423 -0

423 lines not on this page · raw message

board/efikamx/efikamx.c +3 -0
index 0c4e24b..8e9b42b 100644
@@ -37,6 +37,8 @@
 #include <fsl_pmic.h>
 #include <mc13892.h>
 
+#include "efika.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -678,6 +680,7 @@ int board_late_init(void)
 
 	setup_iomux_led();
 	setup_iomux_ata();
+	setup_iomux_usb();
 
 	efikamx_toggle_led(EFIKAMX_LED_BLUE);
 
include/configs/efikamx.h +16 -0
index 54f48e4..010a16a 100644
@@ -44,6 +44,10 @@
 
 #define CONFIG_SYS_TEXT_BASE		0x97800000
 
+#define	CONFIG_L2_OFF
+#define	CONFIG_SYS_ICACHE_OFF
+#define	CONFIG_SYS_DCACHE_OFF
+
 /*
  * Bootloader Components Configuration
  */
@@ -172,6 +176,18 @@
 #endif
 
 /*
+ * USB
+ */
+#define CONFIG_CMD_USB
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI			/* Enable EHCI USB support */
+#define CONFIG_MXC_USB_PORT	1
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_KEYBOARD
+#endif /* CONFIG_CMD_USB */
+
+/*
  * Filesystems
  */
 #ifdef CONFIG_CMD_FAT
Signature · 1 line
1.7.6.3
#22 lore raw

PATCH v3 4/4 usb: add USB support for Efika

Quoted 13 lines

This commit adds USB support for EfikaMX and EfikaSB.

---
Changes for v2:
? ? ? ? ? ? ? - introduce temporary variable in ulpi_write ? ? ? ? ? ? ? - whitespace changes
Changes for v3:
??? - add protection against multiple inclusion of efika.h

Quoted 9 lines
?  board/efikamx/Makefile? ? ? ? ?  |? ? ?  3 +
?  board/efikamx/efika.h? ? ? ? ? ?  |? ?  33 ++++
?  board/efikamx/efikamx-usb.c |?  423
+++++++++++++++++++++++++++++++++++++++++++ board/efikamx/efikamx.c? ? ?  
|? ? ?  3 + include/configs/efikamx.h? ?  |? ?  16 ++
?  5 files changed, 478 insertions(+), 0 deletions(-)
?  create mode 100644 board/efikamx/efika.h
?  create mode 100644 board/efikamx/efikamx-usb.c

Dear Jana Rapava,

[...]

board/efikamx/efika.h line 24

Quoted 2 lines
board/efikamx/efika.h new file +2 -0
+#ifndef EFIKA_H
+#define EFIKA_H

__BOARD_EFIKAMX_EFIKA_H__ to make it more distinguishable.

BR, MV

#23 lore raw

PATCH v4 4/4 usb: add USB support for Efika

In reply to Jana Rapava

This commit adds USB support for EfikaMX and EfikaSB.

---
Changes for v2:
- introduce temporary variable in ulpi_write
- whitespace changes
Changes for v3:
- add protection against multiple inclusion of efika.h
Changes for v4:
- rename multiple inclusion protection macro in efika.h

 board/efikamx/Makefile      |    3 +
 board/efikamx/efika.h       |   33 ++++
 board/efikamx/efikamx-usb.c |  423 +++++++++++++++++++++++++++++++++++++++++++
 board/efikamx/efikamx.c     |    3 +
 include/configs/efikamx.h   |   16 ++
 5 files changed, 478 insertions(+), 0 deletions(-)
 create mode 100644 board/efikamx/efika.h
 create mode 100644 board/efikamx/efikamx-usb.c
board/efikamx/Makefile +3 -0
index ee4a16e..860e4d2 100644
@@ -28,6 +28,9 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(BOARD).o
 
 COBJS	:= efikamx.o
+ifdef	CONFIG_CMD_USB
+COBJS	+= efikamx-usb.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/efikamx/efika.h new file +33 -0
new file mode 100644
index 0000000..f5a09e3
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2011 Jana Rapava <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __BOARD_EFIKAMX_EFIKA_H__
+#define __BOARD_EFIKAMX_EFIKA_H__
+
+/*
+ * EHCI USB
+ */
+#ifdef	CONFIG_CMD_USB
+void setup_iomux_usb(void);
+#else
+static inline void setup_iomux_usb(void) { }
+#endif
board/efikamx/efikamx-usb.c new file +423 -0

423 lines not on this page · raw message

board/efikamx/efikamx.c +3 -0
index 0c4e24b..8e9b42b 100644
@@ -37,6 +37,8 @@
 #include <fsl_pmic.h>
 #include <mc13892.h>
 
+#include "efika.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -678,6 +680,7 @@ int board_late_init(void)
 
 	setup_iomux_led();
 	setup_iomux_ata();
+	setup_iomux_usb();
 
 	efikamx_toggle_led(EFIKAMX_LED_BLUE);
 
include/configs/efikamx.h +16 -0
index 54f48e4..010a16a 100644
@@ -44,6 +44,10 @@
 
 #define CONFIG_SYS_TEXT_BASE		0x97800000
 
+#define	CONFIG_L2_OFF
+#define	CONFIG_SYS_ICACHE_OFF
+#define	CONFIG_SYS_DCACHE_OFF
+
 /*
  * Bootloader Components Configuration
  */
@@ -172,6 +176,18 @@
 #endif
 
 /*
+ * USB
+ */
+#define CONFIG_CMD_USB
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI			/* Enable EHCI USB support */
+#define CONFIG_MXC_USB_PORT	1
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_KEYBOARD
+#endif /* CONFIG_CMD_USB */
+
+/*
  * Filesystems
  */
 #ifdef CONFIG_CMD_FAT
Signature · 1 line
1.7.6.3
#24 lore raw

PATCH v4 4/4 usb: add USB support for Efika

Quoted 15 lines

This commit adds USB support for EfikaMX and EfikaSB.

---
Changes for v2:
? ? ? ? ? ? - introduce temporary variable in ulpi_write ? ? ? ? ? ? - whitespace changes
Changes for v3:
? ? ? ? ? ? ? - add protection against multiple inclusion of efika.h Changes for v4:
??? - rename multiple inclusion protection macro in efika.h

Quoted 9 lines
?  board/efikamx/Makefile? ? ? ? ?  |? ? ?  3 +
?  board/efikamx/efika.h? ? ? ? ? ?  |? ?  33 ++++
?  board/efikamx/efikamx-usb.c |?  423
+++++++++++++++++++++++++++++++++++++++++++ board/efikamx/efikamx.c? ? ?  
|? ? ?  3 + include/configs/efikamx.h? ?  |? ?  16 ++
?  5 files changed, 478 insertions(+), 0 deletions(-)
?  create mode 100644 board/efikamx/efika.h
?  create mode 100644 board/efikamx/efikamx-usb.c

Dear Jana Rapava,

[...]

board/efikamx/efika.h line 33

Quoted 11 lines
board/efikamx/efika.h new file +11 -0
+#ifndef __BOARD_EFIKAMX_EFIKA_H__
+#define __BOARD_EFIKAMX_EFIKA_H__
+
+/*
+ * EHCI USB
+ */
+#ifdef??? CONFIG_CMD_USB
+void setup_iomux_usb(void);
+#else
+static inline void setup_iomux_usb(void) { }
+#endif

Is the ifndef actually unterminated? Did you even compile-test this?

#25 lore raw

PATCH v5 4/4 Add USB support for Efika

In reply to Jana Rapava

This commit adds USB support for EfikaMX and EfikaSB.

---
Changes for v2:
- introduce temporary variable in ulpi_write
- whitespace changes
Changes for v3:
- add protection against multiple inclusion of efika.h
Changes for v4:
- rename multiple inclusion protection macro in efika.h
Changes for v5:
- fix unterminated #ifndef in efika.h

 board/efikamx/Makefile      |    3 +
 board/efikamx/efika.h       |   35 ++++
 board/efikamx/efikamx-usb.c |  423 +++++++++++++++++++++++++++++++++++++++++++
 board/efikamx/efikamx.c     |    3 +
 include/configs/efikamx.h   |   16 ++
 5 files changed, 480 insertions(+), 0 deletions(-)
 create mode 100644 board/efikamx/efika.h
 create mode 100644 board/efikamx/efikamx-usb.c
board/efikamx/Makefile +3 -0
index ee4a16e..860e4d2 100644
@@ -28,6 +28,9 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(BOARD).o
 
 COBJS	:= efikamx.o
+ifdef	CONFIG_CMD_USB
+COBJS	+= efikamx-usb.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/efikamx/efika.h new file +35 -0
new file mode 100644
index 0000000..fec9ee0
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2011 Jana Rapava <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __BOARD_EFIKAMX_EFIKA_H__
+#define __BOARD_EFIKAMX_EFIKA_H__
+
+/*
+ * EHCI USB
+ */
+#ifdef	CONFIG_CMD_USB
+void setup_iomux_usb(void);
+#else
+static inline void setup_iomux_usb(void) { }
+#endif
+
+#endif /* __BOARD_EFIKAMX_EFIKA_H__ */
board/efikamx/efikamx-usb.c new file +423 -0

423 lines not on this page · raw message

board/efikamx/efikamx.c +3 -0
index 0c4e24b..8e9b42b 100644
@@ -37,6 +37,8 @@
 #include <fsl_pmic.h>
 #include <mc13892.h>
 
+#include "efika.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -678,6 +680,7 @@ int board_late_init(void)
 
 	setup_iomux_led();
 	setup_iomux_ata();
+	setup_iomux_usb();
 
 	efikamx_toggle_led(EFIKAMX_LED_BLUE);
 
include/configs/efikamx.h +16 -0
index 54f48e4..010a16a 100644
@@ -44,6 +44,10 @@
 
 #define CONFIG_SYS_TEXT_BASE		0x97800000
 
+#define	CONFIG_L2_OFF
+#define	CONFIG_SYS_ICACHE_OFF
+#define	CONFIG_SYS_DCACHE_OFF
+
 /*
  * Bootloader Components Configuration
  */
@@ -172,6 +176,18 @@
 #endif
 
 /*
+ * USB
+ */
+#define CONFIG_CMD_USB
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI			/* Enable EHCI USB support */
+#define CONFIG_MXC_USB_PORT	1
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_KEYBOARD
+#endif /* CONFIG_CMD_USB */
+
+/*
  * Filesystems
  */
 #ifdef CONFIG_CMD_FAT
Signature · 1 line
1.7.6.3
#26 lore raw

PATCH v5 4/4 Add USB support for Efika

Quoted 6 lines · Jana Rapava

This commit adds USB support for EfikaMX and EfikaSB.

Quoted 11 lines

---
Changes for v2:
- introduce temporary variable in ulpi_write
- whitespace changes
Changes for v3:
- add protection against multiple inclusion of efika.h
Changes for v4:
- rename multiple inclusion protection macro in efika.h
Changes for v5:
- fix unterminated #ifndef in efika.h

Looks ok,

#27 lore raw

PATCH v6 4/4 usb: add USB support for Efika

In reply to Jana Rapava

This commit adds USB support for EfikaMX and EfikaSB.

---
Changes for v2:
- introduce temporary variable in ulpi_write
- whitespace changes
Changes for v3:
- add protection against multiple inclusion of efika.h
Changes for v4:
- rename multiple inclusion protection macro in efika.h
Changes for v5:
- fix unterminated #ifndef in efika.h
Changes for v6:
- add Acked-by
- no changes

 board/efikamx/Makefile      |    3 +
 board/efikamx/efika.h       |   35 ++++
 board/efikamx/efikamx-usb.c |  423 +++++++++++++++++++++++++++++++++++++++++++
 board/efikamx/efikamx.c     |    3 +
 include/configs/efikamx.h   |   16 ++
 5 files changed, 480 insertions(+), 0 deletions(-)
 create mode 100644 board/efikamx/efika.h
 create mode 100644 board/efikamx/efikamx-usb.c
board/efikamx/Makefile +3 -0
index ee4a16e..860e4d2 100644
@@ -28,6 +28,9 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(BOARD).o
 
 COBJS	:= efikamx.o
+ifdef	CONFIG_CMD_USB
+COBJS	+= efikamx-usb.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/efikamx/efika.h new file +35 -0
new file mode 100644
index 0000000..fec9ee0
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2011 Jana Rapava <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __BOARD_EFIKAMX_EFIKA_H__
+#define __BOARD_EFIKAMX_EFIKA_H__
+
+/*
+ * EHCI USB
+ */
+#ifdef	CONFIG_CMD_USB
+void setup_iomux_usb(void);
+#else
+static inline void setup_iomux_usb(void) { }
+#endif
+
+#endif /* __BOARD_EFIKAMX_EFIKA_H__ */
board/efikamx/efikamx-usb.c new file +423 -0

423 lines not on this page · raw message

board/efikamx/efikamx.c +3 -0
index 0c4e24b..8e9b42b 100644
@@ -37,6 +37,8 @@
 #include <fsl_pmic.h>
 #include <mc13892.h>
 
+#include "efika.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -678,6 +680,7 @@ int board_late_init(void)
 
 	setup_iomux_led();
 	setup_iomux_ata();
+	setup_iomux_usb();
 
 	efikamx_toggle_led(EFIKAMX_LED_BLUE);
 
include/configs/efikamx.h +16 -0
index 54f48e4..010a16a 100644
@@ -44,6 +44,10 @@
 
 #define CONFIG_SYS_TEXT_BASE		0x97800000
 
+#define	CONFIG_L2_OFF
+#define	CONFIG_SYS_ICACHE_OFF
+#define	CONFIG_SYS_DCACHE_OFF
+
 /*
  * Bootloader Components Configuration
  */
@@ -172,6 +176,18 @@
 #endif
 
 /*
+ * USB
+ */
+#define CONFIG_CMD_USB
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI			/* Enable EHCI USB support */
+#define CONFIG_MXC_USB_PORT	1
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_KEYBOARD
+#endif /* CONFIG_CMD_USB */
+
+/*
  * Filesystems
  */
 #ifdef CONFIG_CMD_FAT
Signature · 1 line
1.7.6.3
#29 lore raw

PATCH v6 4/4 usb: add USB support for Efika

In reply to Jana Rapava
Quoted 8 lines

This commit adds USB support for EfikaMX and EfikaSB.

Quoted 14 lines

---
Changes for v2:
- introduce temporary variable in ulpi_write
- whitespace changes
Changes for v3:
- add protection against multiple inclusion of efika.h
Changes for v4:
- rename multiple inclusion protection macro in efika.h
Changes for v5:
- fix unterminated #ifndef in efika.h
Changes for v6:
- add Acked-by
- no changes

Guys, there's been no update on this for a month.

Stefano, can you apply please? I see no negative comments.

#30 lore raw

PATCH v6 4/4 usb: add USB support for Efika

Quoted 23 lines · Marek Vasut
Quoted 8 lines

This commit adds USB support for EfikaMX and EfikaSB.

Quoted 14 lines

---
Changes for v2:
- introduce temporary variable in ulpi_write
- whitespace changes
Changes for v3:
- add protection against multiple inclusion of efika.h
Changes for v4:
- rename multiple inclusion protection macro in efika.h
Changes for v5:
- fix unterminated #ifndef in efika.h
Changes for v6:
- add Acked-by
- no changes

Quoted 3 lines

Guys, there's been no update on this for a month.

Stefano, can you apply please? I see no negative comments.

I do not have seen any open issues, too. If nobody argues and because they are related to USB for i.MX boards, I will apply them to u-boot-imx.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#31 lore raw

PATCH v6 4/4 usb: add USB support for Efika

Hi Stefano,

Quoted 24 lines · Stefano Babic
Quoted 23 lines · Marek Vasut
Quoted 22 lines

This commit adds USB support for EfikaMX and EfikaSB.

---
Changes for v2:
- introduce temporary variable in ulpi_write
- whitespace changes
Changes for v3:
- add protection against multiple inclusion of efika.h
Changes for v4:
- rename multiple inclusion protection macro in efika.h
Changes for v5:
- fix unterminated #ifndef in efika.h
Changes for v6:
- add Acked-by
- no changes

Quoted 6 lines
Quoted 3 lines

Guys, there's been no update on this for a month.

Stefano, can you apply please? I see no negative comments.

I do not have seen any open issues, too. If nobody argues and because they are related to USB for i.MX boards, I will apply them to u-boot-imx.

Sorry for jumping in that late.
I've just got back from my trip.
There are some issues with: [PATCH 3/4] EHCI: adjust for mx5 If you have already applied it and also because I don't want to block this patch set, the issues I've pointed can be fixed in a follow up patch.

Quoted 5 lines

Best regards,
Stefano Babic

Signature · 2 lines
Regards,
Igor.
#32 lore raw

PATCH v6 4/4 usb: add USB support for Efika

Quoted 2 lines · Igor Grinberg

Hi Stefano,

Hi Igor,

Quoted 7 lines
Quoted 2 lines

I do not have seen any open issues, too. If nobody argues and because they are related to USB for i.MX boards, I will apply them to u-boot-imx.

Sorry for jumping in that late.
I've just got back from my trip.
There are some issues with: [PATCH 3/4] EHCI: adjust for mx5 If you have already applied it

Not yet !

Quoted 3 lines

and also because I don't want
to block this patch set, the issues I've pointed can be fixed in a follow up patch.

Jana, can you answer / fix this point ?

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#33 lore raw

PATCH v6 4/4 usb: add USB support for Efika

2011/10/31 Stefano Babic <[email protected]>

Quoted 6 lines
Quoted 2 lines

There are some issues with: [PATCH 3/4] EHCI: adjust for mx5 If you have already applied it

Jana, can you answer / fix this point ?

I really don't know what happens there. Code file looks aligned, but when I generate a patch with git-format-patch, aligning is messed up. So I fix it in git-send-email, but after sending whitespace characters are messed up again.
I wasn't able to find a way to fix it yet.
Regards,
Jana Rapava

#34 lore raw

PATCH v6 4/4 usb: add USB support for Efika

Quoted 4 lines · Jana Rapava

2011/10/31 Stefano Babic <sbabic at denx.de <mailto:[email protected]>>

Quoted 8 lines
Quoted 2 lines

There are some issues with: [PATCH 3/4] EHCI: adjust for mx5 If you have already applied it

Jana, can you answer / fix this point ?

I really don't know what happens there. Code file looks aligned, but when I generate a patch with git-format-patch, aligning is messed up.

Wait: this can be due to the different positions of the TAB characters, and to the leading + to mark an added line. It is not a problem.

Quoted 2 lines

So
I fix it in git-send-email,

Do you mean you change the patch generated by git format-patch ? You should not do it.

Take a look at your patch. Some defines are removed, and in the patch you see them as:

-#ifdef CONFIG_MX25
-#define MX25_USB_CTRL_IP_PUE_DOWN_BIT (1<<6)
-#define MX25_USB_CTRL_HSTD_BIT (1<<5)
-#define MX25_USB_CTRL_USBTE_BIT (1<<4)
-#define MX25_USB_CTRL_OCPOL_OTG_BIT (1<<3)
-#endif

It seems that even in the original file the defines were not aligned. But this is not true, the disalignment is introduced by the leading "-".

However, when we see some lines later, the defines are added again and they seem aligned.

+#ifdef CONFIG_MX25

+#define MX25_USB_CTRL_IP_PUE_DOWN_BIT  (1<<6)
+#define MX25_USB_CTRL_HSTD_BIT         (1<<5)
+#define MX25_USB_CTRL_USBTE_BIT        (1<<4)
+#define MX25_USB_CTRL_OCPOL_OTG_BIT    (1<<3)

+#endif

But when we apply the patch, they defines are disaligned again. maybe you are worrying too much: let the tools doing their work. You have to check that your changed file is correct (without whitespace instead of tab), and then call git-format-patch. And do not care if the result seems producing disaligned entries, this is not true.

There are also other comments by Igor that should be fixed, independently from this alignment problem. Please fix them and resubmit.

Quoted 3 lines

but after sending whitespace characters are
messed up again.
I wasn't able to find a way to fix it yet.

As I said, you want to fix the result of git-format-patch, but it is correct. Simply do not do it.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#35 lore raw

PATCH v7 4/4 usb: add USB support for Efika

In reply to Jana Rapava

This commit adds USB support for EfikaMX and EfikaSB.

---
Changes for v2:
- introduce temporary variable in ulpi_write
- whitespace changes
Changes for v3:
- add protection against multiple inclusion of efika.h
Changes for v4:
- rename multiple inclusion protection macro in efika.h
Changes for v5:
- fix unterminated #ifndef in efika.h
Changes for v6:
- add Acked-by
- no changes
Changes for v7:
- use ULPI-related definitions from ./include/usb/ulpi.h

 board/efikamx/Makefile      |    3 +
 board/efikamx/efika.h       |   35 ++++
 board/efikamx/efikamx-usb.c |  424 +++++++++++++++++++++++++++++++++++++++++++
 board/efikamx/efikamx.c     |    3 +
 include/configs/efikamx.h   |   16 ++
 5 files changed, 481 insertions(+), 0 deletions(-)
 create mode 100644 board/efikamx/efika.h
 create mode 100644 board/efikamx/efikamx-usb.c
board/efikamx/Makefile +3 -0
index ee4a16e..860e4d2 100644
@@ -28,6 +28,9 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(BOARD).o
 
 COBJS	:= efikamx.o
+ifdef	CONFIG_CMD_USB
+COBJS	+= efikamx-usb.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/efikamx/efika.h new file +35 -0
new file mode 100644
index 0000000..fec9ee0
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2011 Jana Rapava <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __BOARD_EFIKAMX_EFIKA_H__
+#define __BOARD_EFIKAMX_EFIKA_H__
+
+/*
+ * EHCI USB
+ */
+#ifdef	CONFIG_CMD_USB
+void setup_iomux_usb(void);
+#else
+static inline void setup_iomux_usb(void) { }
+#endif
+
+#endif /* __BOARD_EFIKAMX_EFIKA_H__ */
board/efikamx/efikamx-usb.c new file +424 -0

424 lines not on this page · raw message

board/efikamx/efikamx.c +3 -0
index 0c4e24b..8e9b42b 100644
@@ -37,6 +37,8 @@
 #include <fsl_pmic.h>
 #include <mc13892.h>
 
+#include "efika.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -678,6 +680,7 @@ int board_late_init(void)
 
 	setup_iomux_led();
 	setup_iomux_ata();
+	setup_iomux_usb();
 
 	efikamx_toggle_led(EFIKAMX_LED_BLUE);
 
include/configs/efikamx.h +16 -0
index 54f48e4..57f7be5 100644
@@ -44,6 +44,10 @@
 
 #define CONFIG_SYS_TEXT_BASE		0x97800000
 
+#define	CONFIG_L2_OFF
+#define	CONFIG_SYS_ICACHE_OFF
+#define	CONFIG_SYS_DCACHE_OFF
+
 /*
  * Bootloader Components Configuration
  */
@@ -172,6 +176,18 @@
 #endif
 
 /*
+ * USB
+ */
+#define CONFIG_CMD_USB
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI			/* Enable EHCI USB support */
+#define CONFIG_MXC_USB_PORT	1
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_KEYBOARD
+#endif /* CONFIG_CMD_USB */
+
+/*
  * Filesystems
  */
 #ifdef CONFIG_CMD_FAT
Signature · 1 line
1.7.6.3
#36 lore raw

PATCH v7 4/4 usb: add USB support for Efika

Hi Jana,

Quoted 8 lines · Jana Rapava

This commit adds USB support for EfikaMX and EfikaSB.

Quoted 15 lines

---
Changes for v2:
- introduce temporary variable in ulpi_write
- whitespace changes
Changes for v3:
- add protection against multiple inclusion of efika.h
Changes for v4:
- rename multiple inclusion protection macro in efika.h
Changes for v5:
- fix unterminated #ifndef in efika.h
Changes for v6:
- add Acked-by
- no changes
Changes for v7:
- use ULPI-related definitions from ./include/usb/ulpi.h

This means that the patch here [1] is a prerequisite, right? It is worth stating.

[1] http://patchwork.ozlabs.org/patch/123119/

Quoted 485 lines
 board/efikamx/Makefile      |    3 +
 board/efikamx/efika.h       |   35 ++++
 board/efikamx/efikamx-usb.c |  424 +++++++++++++++++++++++++++++++++++++++++++
 board/efikamx/efikamx.c     |    3 +
 include/configs/efikamx.h   |   16 ++
 5 files changed, 481 insertions(+), 0 deletions(-)
 create mode 100644 board/efikamx/efika.h
 create mode 100644 board/efikamx/efikamx-usb.c
board/efikamx/Makefile +3 -0
index ee4a16e..860e4d2 100644
@@ -28,6 +28,9 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(BOARD).o
 
 COBJS	:= efikamx.o
+ifdef	CONFIG_CMD_USB
+COBJS	+= efikamx-usb.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/efikamx/efika.h new file +35 -0
new file mode 100644
index 0000000..fec9ee0
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2011 Jana Rapava <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __BOARD_EFIKAMX_EFIKA_H__
+#define __BOARD_EFIKAMX_EFIKA_H__
+
+/*
+ * EHCI USB
+ */
+#ifdef	CONFIG_CMD_USB
+void setup_iomux_usb(void);
+#else
+static inline void setup_iomux_usb(void) { }
+#endif
+
+#endif /* __BOARD_EFIKAMX_EFIKA_H__ */
board/efikamx/efikamx-usb.c new file +414 -0
new file mode 100644
index 0000000..3b42256
@@ -0,0 +1,424 @@
+/*
+ * Copyright (C) 2011 Marek Vasut <[email protected]>
+ * Copyright (C) 2011 Jana Rapava <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <usb.h>
+#include <asm/io.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/mx5x_pins.h>
+#include <asm/arch/iomux.h>
+#include <asm/gpio.h>
+#include <usb/ehci-fsl.h>
+#include <errno.h>
+#include <watchdog.h>
+
+#include <usb/ehci.h>
+#include <usb/ehci-core.h>
+#include <usb/ulpi.h>
+
+/*
+ * Configure the USB H1 and USB H2 IOMUX.
+ */
+#define USB_PAD_CONFIG	(PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST | \
+			PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU | \
+			PAD_CTL_HYS_ENABLE | PAD_CTL_PUE_PULL)
+void setup_iomux_usb(void)
+{
+	/*
+	 * Configure USBH1 pads
+	 */
+	mxc_request_iomux(MX51_PIN_USBH1_STP, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_STP, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_CLK, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_CLK, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_DIR, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DIR, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_NXT, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_NXT, USB_PAD_CONFIG);
+
+	mxc_request_iomux(MX51_PIN_USBH1_DATA0, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA0, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_DATA1, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA1, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_DATA2, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA2, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_DATA3, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA3, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_DATA4, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA4, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_DATA5, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA5, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_DATA6, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA6, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_DATA7, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA7, USB_PAD_CONFIG);
+
+	/*
+	 * Configure USBH1 control pads
+	 */
+
+	/* USB PHY reset */
+	mxc_request_iomux(MX51_PIN_EIM_D27, IOMUX_CONFIG_ALT1);
+	mxc_iomux_set_pad(MX51_PIN_EIM_D27, PAD_CTL_PKE_ENABLE |
+			PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH);
+
+	/* USB HUB reset */
+	mxc_request_iomux(MX51_PIN_GPIO1_5, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_GPIO1_5, PAD_CTL_PKE_ENABLE |
+			PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH);
+
+
+	if (machine_is_efikasb()) {
+		/*
+		 * Configure USBH2 pads (used on EfikaSB)
+		 */
+		/* USBH2_DATA */
+		mxc_request_iomux(MX51_PIN_EIM_D16, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_D16, USB_PAD_CONFIG);
+		mxc_request_iomux(MX51_PIN_EIM_D17, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_D17, USB_PAD_CONFIG);
+		mxc_request_iomux(MX51_PIN_EIM_D18, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_D18, USB_PAD_CONFIG);
+		mxc_request_iomux(MX51_PIN_EIM_D19, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_D19, USB_PAD_CONFIG);
+		mxc_request_iomux(MX51_PIN_EIM_D20, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_D20, USB_PAD_CONFIG);
+		mxc_request_iomux(MX51_PIN_EIM_D21, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_D21, USB_PAD_CONFIG);
+		mxc_request_iomux(MX51_PIN_EIM_D22, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_D22, USB_PAD_CONFIG);
+		mxc_request_iomux(MX51_PIN_EIM_D23, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_D23, USB_PAD_CONFIG);
+
+		/* USBH2_CLK */
+		mxc_request_iomux(MX51_PIN_EIM_A24, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_A24, USB_PAD_CONFIG);
+		/* USBH2_DIR */
+		mxc_request_iomux(MX51_PIN_EIM_A25, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_A25, USB_PAD_CONFIG);
+		/* USBH2_STP */
+		mxc_request_iomux(MX51_PIN_EIM_A26, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_A26, USB_PAD_CONFIG);
+		/* USBH2_NXT */
+		mxc_request_iomux(MX51_PIN_EIM_A27, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_A27, USB_PAD_CONFIG);
+	}
+
+	/* WIFI EN (act low) */
+	mxc_request_iomux(MX51_PIN_EIM_A22, IOMUX_CONFIG_GPIO);
+	mxc_iomux_set_pad(MX51_PIN_EIM_A22, 0);
+	/* WIFI RESET */
+	mxc_request_iomux(MX51_PIN_EIM_A16, IOMUX_CONFIG_GPIO);
+	mxc_iomux_set_pad(MX51_PIN_EIM_A16, 0);
+	/* BT EN (act low) */
+	mxc_request_iomux(MX51_PIN_EIM_A17, IOMUX_CONFIG_GPIO);
+	mxc_iomux_set_pad(MX51_PIN_EIM_A17, 0);
+}
+
+/*
+ * Enable devices connected to USB buses.
+ */
+void efika_usb_enable_devices(void)
+{
+	/* Enable Bluetooth */
+	gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_A17), 0);
+	udelay(10000);
+	gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_EIM_A17), 1);
+
+	/* Enable WiFi */
+	gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_A22), 1);
+	udelay(10000);
+
+	/* Reset the WiFi chip */
+	gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_A16), 0);
+	udelay(10000);
+	gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_EIM_A16), 1);
+}
+
+/*
+ * Reset USB HUB (or HUBs on EfikaSB).
+ */
+void efika_usb_hub_reset(void)
+{
+	/* HUB reset */
+	gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_GPIO1_5), 1);
+	udelay(1000);
+	gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_GPIO1_5), 0);
+	udelay(1000);
+	gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_GPIO1_5), 1);
+}
+
+/*
+ * Reset USB PHY (or PHYs on EfikaSB).
+ */
+void efika_usb_phy_reset(void)
+{
+	/* SMSC 3317 PHY reset */
+	gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_D27), 0);
+	udelay(1000);
+	gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_EIM_D27), 1);
+}
+
+/*
+ * Configure control registers of the USB controller.
+ */
+void control_regs_setup(struct mx5_usb_control_regs *control)
+{
+	clrsetbits_le32(&control->usbctrl,
+		(MXC_OTG_WUE | MXC_OTG_PM | MX51_H1_ULPI_IE | MX51_H1_WUE),
+		MX51_H1_PM);
+
+	clrsetbits_le32(&control->phyctrl0,
+			MX51_OTG_OVERCURD,
+			MX51_EHCI_POWERPINSE);
+
+	clrsetbits_le32(&control->phyctrl1,
+			MX51_SYSCLOCK_MASK,
+			MX51_SYSCLOCK_24_MHZ);
+
+	setbits_le32(&control->usbctrl1, MX51_H1_EXTCLKE);
+
+	clrsetbits_le32(&control->uh2ctrl,
+			(MX51_H2_ULPI_IE | MX51_H2_WUE),
+			MX51_H2_PM);
+
+	udelay(10000);
+}
+
+#define ULPI_ADDR_SHIFT		16
+#define ulpi_write_mask(value)	((value) & 0xff)
+#define ulpi_read_mask(value)	(((value) >> 8) & 0xff)
+
+int ulpi_wait(struct usb_ehci *ehci, u32 ulpi_value, u32 ulpi_mask)
+{
+	int timeout = ULPI_TIMEOUT;
+	u32 tmp;
+
+	writel(ulpi_value, &ehci->ulpi_viewpoint);
+
+	/* Wait for the bits in ulpi_mask to become zero. */
+	while (--timeout) {
+		tmp = readl(&ehci->ulpi_viewpoint);
+		if (!(tmp & ulpi_mask))
+			break;
+		WATCHDOG_RESET();
+	}
+
+	return !timeout;
+}
+
+int ulpi_wakeup(struct usb_ehci *ehci)
+{
+	if (readl(&ehci->ulpi_viewpoint) & ULPI_SS)
+		return 0; /* already awake */
+	return ulpi_wait(ehci, ULPI_WU, ULPI_WU);
+}
+
+void ulpi_write(struct usb_ehci *ehci, u32 reg, u32 value)
+{
+	u32 tmp;
+	if (ulpi_wakeup(ehci)) {
+		printf("ULPI wakeup timed out\n");
+		return;
+	}
+
+	tmp = ulpi_wait(ehci, ULPI_RWRUN | ULPI_RWCTRL |
+		reg << ULPI_ADDR_SHIFT | ulpi_write_mask(value), ULPI_RWRUN);
+	if (tmp)
+		printf("ULPI write timed out\n");
+}
+
+u32 ulpi_read(struct usb_ehci *ehci, u32 reg)
+{
+	if (ulpi_wakeup(ehci)) {
+		printf("ULPI wakeup timed out\n");
+		return 0;
+	}
+
+	if (ulpi_wait(ehci, ULPI_RWRUN | reg << ULPI_ADDR_SHIFT, ULPI_RWRUN)) {
+		printf("ULPI read timed out\n");
+		return 0;
+	}
+
+	return ulpi_read_mask(readl(&ehci->ulpi_viewpoint));
+}
+
+void ulpi_init(struct usb_ehci *ehci, struct ulpi_regs *ulpi)
+{
+	u32 tmp = 0;
+	int reg, i;
+
+	/* Assemble ID from four ULPI ID registers (8 bits each). */
+	for (reg = ULPI_ID_REGS_COUNT - 1; reg >= 0; reg--)
+		tmp |= ulpi_read(ehci, reg) << (reg * 8);
+
+	/* Split ID into vendor and product ID. */
+	debug("Found ULPI TX, ID %04x:%04x\n", tmp >> 16, tmp & 0xffff);
+
+	/* ULPI integrity check */
+	for (i = 0; i < 2; i++) {
+		ulpi_write(ehci, (u32)&ulpi->scratch_write,
+			ULPI_TEST_VALUE << i);
+		tmp = ulpi_read(ehci, (u32)&ulpi->scratch_write);
+
+		if (tmp != (ULPI_TEST_VALUE << i)) {
+			printf("ULPI integrity check failed\n");
+			return;
+		}
+	}
+
+	/* Set ULPI flags. */
+	ulpi_write(ehci, (u32)&ulpi->otg_ctrl_write,
+		ULPI_OTG_EXTVBUSIND |
+		ULPI_OTG_DM_PULLDOWN | ULPI_OTG_DP_PULLDOWN);
+	ulpi_write(ehci, (u32)&ulpi->function_ctrl_write,
+		ULPI_FC_XCVRSEL | ULPI_FC_OPMODE_NORMAL |
+		ULPI_FC_SUSPENDM);
+	ulpi_write(ehci, (u32)&ulpi->iface_ctrl_write, 0);
+	ulpi_write(ehci, (u32)&ulpi->otg_ctrl_set,
+		ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
+
+	/*
+	 * NOTE: This violates USB specification, but otherwise, USB on Efika
+	 * doesn't charge VBUS and as a result, USB doesn't work.
+	 */
+	ulpi_write(ehci, (u32)&ulpi->otg_ctrl_set, ULPI_OTG_CHRGVBUS);
+}
+
+/*
+ * Solve the VBUS reset problem on Efika
+ * by setting the CHRG_VBUS bit in the reset.
+ */
+void ehci_fixup(uint32_t *status_reg, uint32_t *reg_ref)
+{
+	struct usb_ehci *ehci = (struct usb_ehci *)(OTG_BASE_ADDR +
+		MX51_REGISTER_LAYOUT_LENGTH);
+	struct ulpi_regs *ulpi = (struct ulpi_regs *)0;
+
+	u32 tmp = ulpi_read(ehci, (u32)&ulpi->otg_ctrl_write);
+	tmp |= ULPI_OTG_CHRGVBUS;
+	ulpi_write(ehci, (u32)&ulpi->otg_ctrl_write, tmp);
+
+	/* USB 2.0 specification say 50 ms resets on root. */
+	wait_ms(50);
+
+	/* Now terminate the reset. */
+	*reg_ref = ehci_readl(status_reg);
+	*reg_ref |= EHCI_PS_PE;
+}
+
+void ehci0_init(struct usb_ehci *ehci)
+{
+	writel(MX51_16BIT_UTMI, &ehci->portsc);
+}
+
+void ehci1_init(struct usb_ehci *ehci, struct ulpi_regs *ulpi)
+{
+	mxc_request_iomux(MX51_PIN_USBH1_STP, IOMUX_CONFIG_ALT2);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_STP, PAD_CTL_DRV_HIGH |
+				PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
+	gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_USBH1_STP), 0);
+	udelay(1000);
+	gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_USBH1_STP), 1);
+	udelay(1000);
+
+	mxc_request_iomux(MX51_PIN_USBH1_STP, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_STP, USB_PAD_CONFIG);
+	udelay(10000);
+
+	clrbits_le32(&ehci->usbcmd, MX51_ITC_IMMEDIATE_MASK);
+	udelay(10000);
+
+	writel(MX51_ULPI_MODE_MASK, &ehci->portsc);
+	udelay(10000);
+
+	ulpi_init(ehci, ulpi);
+}
+
+void ehci2_init(struct usb_ehci *ehci, struct ulpi_regs *ulpi)
+{
+	mxc_request_iomux(MX51_PIN_EIM_A26, IOMUX_CONFIG_ALT1);
+	mxc_iomux_set_pad(MX51_PIN_EIM_A26, PAD_CTL_DRV_HIGH |
+				PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
+	gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_A26), 0);
+	udelay(1000);
+	gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_EIM_A26), 1);
+	udelay(1000);
+
+	mxc_request_iomux(MX51_PIN_EIM_A26, IOMUX_CONFIG_ALT2);
+	mxc_iomux_set_pad(MX51_PIN_EIM_A26, USB_PAD_CONFIG);
+
+	writel(MX51_ULPI_MODE_MASK, &ehci->portsc);
+	udelay(10000);
+
+	ulpi_init(ehci, ulpi);
+}
+
+int ehci_hcd_init(void)
+{
+	struct usb_ehci *ehci;
+	struct mx5_usb_control_regs *mx5_usb_control_regs;
+	struct ulpi_regs *ulpi;
+
+	mx5_usb_control_regs = (struct mx5_usb_control_regs *)(OTG_BASE_ADDR +
+		 MX5_CTRL_REGS_OFFSET);
+	control_regs_setup(mx5_usb_control_regs);
+	ulpi = (struct ulpi_regs *)0;
+
+	/* Init EHCI core */
+	ehci = (struct usb_ehci *)(OTG_BASE_ADDR +
+		(MX51_REGISTER_LAYOUT_LENGTH * CONFIG_MXC_USB_PORT));
+	hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength);
+	hcor = (struct ehci_hcor *)((uint32_t) hccr +
+			HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
+	setbits_le32(&ehci->usbmode, CM_HOST);
+	setbits_le32(&ehci->control, USB_EN);
+
+	/* Init iMX51 EHCI */
+	efika_usb_phy_reset();
+	efika_usb_hub_reset();
+	efika_usb_enable_devices();
+
+	switch (CONFIG_MXC_USB_PORT) {
+	case 0:
+		ehci0_init(ehci);
+		break;
+	case 1:
+		ehci1_init(ehci, ulpi);
+		break;
+	case 2:
+		if (machine_is_efikasb())
+			ehci2_init(ehci, ulpi);
+		break;
+	};
+

board/efikamx/efikamx-usb.c line 424

Quoted 10 lines
board/efikamx/efikamx-usb.c new file +10 -0
+	/* EfikaMX USB has issues ... */
+	udelay(10000);
+
+	return 0;
+}
+
+int ehci_hcd_stop(void)
+{
+	return 0;
+}

Most of the functions and defines above aren't board specific, right? It would be a good thing to put them in an SoC specific location, so any other board using that SoC can benefit from them.

I don't want to block on that issue, so if it simplifies you a further ULPI patches submission - I don't care if you leave it here and in the next patch set move to a common location.

Although the proper way would be to submit the framework(s) and then adjust the users.

[...]

Signature · 2 lines
Regards,
Igor.
#37 lore raw

PATCH v7 4/4 usb: add USB support for Efika

2011/11/2 Igor Grinberg <[email protected]>

Quoted 10 lines

Hi Jana,

Quoted 6 lines · Jana Rapava
board/efikamx/efika.h new file +0 -0
new file mode 100644
index 0000000..fec9ee0
Quoted 11 lines

board/efikamx/efikamx-usb.c

Quoted 6 lines
board/efikamx/efikamx-usb.c new file +0 -0
new file mode 100644
index 0000000..3b42256

Most of the functions and defines above aren't board specific, right? It would be a good thing to put them in an SoC specific location, so any other board using that SoC can benefit from them.

Ok, so non-board-specific parts should go into ./arch/arm/cpu/armv7/mx5/ and board-specific callbacks should stay here? Do I understand you well?

Quoted 6 lines

I don't want to block on that issue, so if it simplifies you a further ULPI patches submission - I don't care if you leave it here and in the next patch set move to a common location.

Thanks.

Quoted 4 lines

Although the proper way would be to submit the framework(s) and then adjust the users.

Ok, I'll do it that way in the future patchsets.

#38 lore raw

PATCH v7 4/4 usb: add USB support for Efika

Quoted 3 lines · Jana Rapava

Ok, so non-board-specific parts should go into ./arch/arm/cpu/armv7/mx5/ and board-specific callbacks should stay here? Do I understand you well?

Yes, I think so

Quoted 8 lines
Quoted 7 lines

I don't want to block on that issue, so if it simplifies you a further ULPI patches submission - I don't care if you leave it here and in the next patch set move to a common location.

Thanks.

Anyway, as we agree, it is really better to do now the right thing as to postpone.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#39 lore raw

PATCH v7 4/4 usb: add USB support for Efika

Quoted 14 lines · Stefano Babic
Quoted 3 lines · Jana Rapava

Ok, so non-board-specific parts should go into ./arch/arm/cpu/armv7/mx5/ and board-specific callbacks should stay here? Do I understand you well?

Yes, I think so

Quoted 7 lines
Quoted 7 lines

I don't want to block on that issue, so if it simplifies you a further ULPI patches submission - I don't care if you leave it here and in the next patch set move to a common location.

Quoted 4 lines
Quoted 1 line

Thanks.

Anyway, as we agree, it is really better to do now the right thing as to postpone.

I'm want to provide USB support for mx53loco and maybe mx51evk, similar to what Jana is doing. Following the "drivers/usb/host/ehci mxc.c" example, I tried to do it the generic way by implementing "drivers/usb/host/ehci-mx5.c". Not sure if it's the better approach as a board specific initialization/reset might be required for some boards. Therefore board specific callbacks would make sense. I have attached my patch below for review and comments.

Thanks,

Wolfgang,

#40 lore raw

PATCH v8 4/4 Add USB support for Efika

In reply to Jana Rapava

This commit adds USB support for EfikaMX and EfikaSB.

Cc Remy Bohmer <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc Wolfgang Grandegger <[email protected]>

---
Changes for v2:
- introduce temporary variable in ulpi_write
- whitespace changes
Changes for v3:
- add protection against multiple inclusion of efika.h
Changes for v4:
- rename multiple inclusion protection macro in efika.h
Changes for v5:
- fix unterminated #ifndef in efika.h
Changes for v6:
- add Acked-by
- no changes
Changes for v7:
- use ULPI-related definitions from ./include/usb/ulpi.h
Changes for v8:
- adjust to new and more generic ULPI implementation

 board/efikamx/Makefile      |    3 +
 board/efikamx/efika.h       |   35 +++++
 board/efikamx/efikamx-usb.c |  344 +++++++++++++++++++++++++++++++++++++++++++
 board/efikamx/efikamx.c     |    3 +
 include/configs/efikamx.h   |   18 +++
 5 files changed, 403 insertions(+), 0 deletions(-)
 create mode 100644 board/efikamx/efika.h
 create mode 100644 board/efikamx/efikamx-usb.c
board/efikamx/Makefile +3 -0
index ee4a16e..860e4d2 100644
@@ -28,6 +28,9 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(BOARD).o
 
 COBJS	:= efikamx.o
+ifdef	CONFIG_CMD_USB
+COBJS	+= efikamx-usb.o
+endif
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/efikamx/efika.h new file +35 -0
new file mode 100644
index 0000000..fec9ee0
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2011 Jana Rapava <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __BOARD_EFIKAMX_EFIKA_H__
+#define __BOARD_EFIKAMX_EFIKA_H__
+
+/*
+ * EHCI USB
+ */
+#ifdef	CONFIG_CMD_USB
+void setup_iomux_usb(void);
+#else
+static inline void setup_iomux_usb(void) { }
+#endif
+
+#endif /* __BOARD_EFIKAMX_EFIKA_H__ */
board/efikamx/efikamx-usb.c new file +344 -0

344 lines not on this page · raw message

board/efikamx/efikamx.c +3 -0
index 0c4e24b..8e9b42b 100644
@@ -37,6 +37,8 @@
 #include <fsl_pmic.h>
 #include <mc13892.h>
 
+#include "efika.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -678,6 +680,7 @@ int board_late_init(void)
 
 	setup_iomux_led();
 	setup_iomux_ata();
+	setup_iomux_usb();
 
 	efikamx_toggle_led(EFIKAMX_LED_BLUE);
 
include/configs/efikamx.h +18 -0
index 54f48e4..1c48376 100644
@@ -44,6 +44,10 @@
 
 #define CONFIG_SYS_TEXT_BASE		0x97800000
 
+#define	CONFIG_L2_OFF
+#define	CONFIG_SYS_ICACHE_OFF
+#define	CONFIG_SYS_DCACHE_OFF
+
 /*
  * Bootloader Components Configuration
  */
@@ -172,6 +176,20 @@
 #endif
 
 /*
+ * USB
+ */
+#define CONFIG_CMD_USB
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI			/* Enable EHCI USB support */
+#define CONFIG_MXC_USB_PORT	1
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_KEYBOARD
+#define CONFIG_USB_ULPI
+#define CONFIG_USB_ULPI_VIEWPORT
+#endif /* CONFIG_CMD_USB */
+
+/*
  * Filesystems
  */
 #ifdef CONFIG_CMD_FAT
Signature · 1 line
1.7.6.3
#41 lore raw

PATCH v8 4/4 Add USB support for Efika

Quoted 42 lines · Jana Rapava

This commit adds USB support for EfikaMX and EfikaSB.

Cc Remy Bohmer <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc Wolfgang Grandegger <[email protected]>

---
Changes for v2:
- introduce temporary variable in ulpi_write
- whitespace changes
Changes for v3:
- add protection against multiple inclusion of efika.h
Changes for v4:
- rename multiple inclusion protection macro in efika.h
Changes for v5:
- fix unterminated #ifndef in efika.h
Changes for v6:
- add Acked-by
- no changes
Changes for v7:
- use ULPI-related definitions from ./include/usb/ulpi.h
Changes for v8:
- adjust to new and more generic ULPI implementation

 board/efikamx/Makefile      |    3 +
 board/efikamx/efika.h       |   35 +++++
 board/efikamx/efikamx-usb.c |  344 +++++++++++++++++++++++++++++++++++++++++++
 board/efikamx/efikamx.c     |    3 +
 include/configs/efikamx.h   |   18 +++
 5 files changed, 403 insertions(+), 0 deletions(-)
 create mode 100644 board/efikamx/efika.h
 create mode 100644 board/efikamx/efikamx-usb.c
board/efikamx/Makefile +0 -0
index ee4a16e..860e4d2 100644

board/efikamx/Makefile include $(TOPDIR)/config.mk · line 33

Quoted 6 lines
board/efikamx/Makefile +3 -0
@@ -28,6 +28,9 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(BOARD).o
 
 COBJS	:= efikamx.o
+ifdef	CONFIG_CMD_USB
+COBJS	+= efikamx-usb.o
+endif

Please, use the standard construct for such things:
COBJS-$(CONFIG_CMD_USB) += efikamx-usb.o

Quoted 247 lines
board/efikamx/Makefile +0 -0
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/efikamx/efika.h new file +35 -0
new file mode 100644
index 0000000..fec9ee0
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2011 Jana Rapava <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __BOARD_EFIKAMX_EFIKA_H__
+#define __BOARD_EFIKAMX_EFIKA_H__
+
+/*
+ * EHCI USB
+ */
+#ifdef	CONFIG_CMD_USB
+void setup_iomux_usb(void);
+#else
+static inline void setup_iomux_usb(void) { }
+#endif
+
+#endif /* __BOARD_EFIKAMX_EFIKA_H__ */
board/efikamx/efikamx-usb.c new file +197 -0
new file mode 100644
index 0000000..cbcdb18
@@ -0,0 +1,344 @@
+/*
+ * Copyright (C) 2011 Marek Vasut <[email protected]>
+ * Copyright (C) 2011 Jana Rapava <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <usb.h>
+#include <asm/io.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/arch/mx5x_pins.h>
+#include <asm/arch/iomux.h>
+#include <asm/gpio.h>
+#include <usb/ehci-fsl.h>
+#include <errno.h>
+#include <watchdog.h>
+
+#include <usb/ehci.h>
+#include <usb/ehci-core.h>
+#include <usb/ulpi.h>
+
+/*
+ * Configure the USB H1 and USB H2 IOMUX.
+ */
+#define USB_PAD_CONFIG	(PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST | \
+			PAD_CTL_DRV_HIGH | PAD_CTL_100K_PU | \
+			PAD_CTL_HYS_ENABLE | PAD_CTL_PUE_PULL)
+void setup_iomux_usb(void)
+{
+	/*
+	 * Configure USBH1 pads
+	 */
+	mxc_request_iomux(MX51_PIN_USBH1_STP, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_STP, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_CLK, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_CLK, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_DIR, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DIR, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_NXT, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_NXT, USB_PAD_CONFIG);
+
+	mxc_request_iomux(MX51_PIN_USBH1_DATA0, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA0, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_DATA1, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA1, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_DATA2, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA2, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_DATA3, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA3, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_DATA4, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA4, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_DATA5, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA5, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_DATA6, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA6, USB_PAD_CONFIG);
+	mxc_request_iomux(MX51_PIN_USBH1_DATA7, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA7, USB_PAD_CONFIG);
+
+	/*
+	 * Configure USBH1 control pads
+	 */
+
+	/* USB PHY reset */
+	mxc_request_iomux(MX51_PIN_EIM_D27, IOMUX_CONFIG_ALT1);
+	mxc_iomux_set_pad(MX51_PIN_EIM_D27, PAD_CTL_PKE_ENABLE |
+			PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH);
+
+	/* USB HUB reset */
+	mxc_request_iomux(MX51_PIN_GPIO1_5, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_GPIO1_5, PAD_CTL_PKE_ENABLE |
+			PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH);
+
+
+	if (machine_is_efikasb()) {
+		/*
+		 * Configure USBH2 pads (used on EfikaSB)
+		 */
+		/* USBH2_DATA */
+		mxc_request_iomux(MX51_PIN_EIM_D16, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_D16, USB_PAD_CONFIG);
+		mxc_request_iomux(MX51_PIN_EIM_D17, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_D17, USB_PAD_CONFIG);
+		mxc_request_iomux(MX51_PIN_EIM_D18, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_D18, USB_PAD_CONFIG);
+		mxc_request_iomux(MX51_PIN_EIM_D19, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_D19, USB_PAD_CONFIG);
+		mxc_request_iomux(MX51_PIN_EIM_D20, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_D20, USB_PAD_CONFIG);
+		mxc_request_iomux(MX51_PIN_EIM_D21, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_D21, USB_PAD_CONFIG);
+		mxc_request_iomux(MX51_PIN_EIM_D22, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_D22, USB_PAD_CONFIG);
+		mxc_request_iomux(MX51_PIN_EIM_D23, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_D23, USB_PAD_CONFIG);
+
+		/* USBH2_CLK */
+		mxc_request_iomux(MX51_PIN_EIM_A24, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_A24, USB_PAD_CONFIG);
+		/* USBH2_DIR */
+		mxc_request_iomux(MX51_PIN_EIM_A25, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_A25, USB_PAD_CONFIG);
+		/* USBH2_STP */
+		mxc_request_iomux(MX51_PIN_EIM_A26, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_A26, USB_PAD_CONFIG);
+		/* USBH2_NXT */
+		mxc_request_iomux(MX51_PIN_EIM_A27, IOMUX_CONFIG_ALT2);
+		mxc_iomux_set_pad(MX51_PIN_EIM_A27, USB_PAD_CONFIG);
+	}
+
+	/* WIFI EN (act low) */
+	mxc_request_iomux(MX51_PIN_EIM_A22, IOMUX_CONFIG_GPIO);
+	mxc_iomux_set_pad(MX51_PIN_EIM_A22, 0);
+	/* WIFI RESET */
+	mxc_request_iomux(MX51_PIN_EIM_A16, IOMUX_CONFIG_GPIO);
+	mxc_iomux_set_pad(MX51_PIN_EIM_A16, 0);
+	/* BT EN (act low) */
+	mxc_request_iomux(MX51_PIN_EIM_A17, IOMUX_CONFIG_GPIO);
+	mxc_iomux_set_pad(MX51_PIN_EIM_A17, 0);
+}
+
+/*
+ * Enable devices connected to USB buses.
+ */
+void efika_usb_enable_devices(void)
+{
+	/* Enable Bluetooth */
+	gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_A17), 0);
+	udelay(10000);
+	gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_EIM_A17), 1);
+
+	/* Enable WiFi */
+	gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_A22), 1);
+	udelay(10000);
+
+	/* Reset the WiFi chip */
+	gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_A16), 0);
+	udelay(10000);
+	gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_EIM_A16), 1);
+}
+
+/*
+ * Reset USB HUB (or HUBs on EfikaSB).
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+void efika_usb_hub_reset(void)
+{
+	/* HUB reset */
+	gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_GPIO1_5), 1);
+	udelay(1000);
+	gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_GPIO1_5), 0);
+	udelay(1000);
+	gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_GPIO1_5), 1);
+}
+
+/*
+ * Reset USB PHY (or PHYs on EfikaSB).
+ */
+void efika_usb_phy_reset(void)
+{
+	/* SMSC 3317 PHY reset */
+	gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_D27), 0);
+	udelay(1000);
+	gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_EIM_D27), 1);
+}
+
+/*
+ * Configure control registers of the USB controller.
+ */
+void control_regs_setup(struct mx5_usb_control_regs *control)
+{
+	clrsetbits_le32(&control->usbctrl,
+		(MXC_OTG_WUE | MXC_OTG_PM | MX51_H1_ULPI_IE | MX51_H1_WUE),
+		MX51_H1_PM);
+
+	clrsetbits_le32(&control->phyctrl0,
+			MX51_OTG_OVERCURD,
+			MX51_EHCI_POWERPINSE);
+
+	clrsetbits_le32(&control->phyctrl1,
+			MX51_SYSCLOCK_MASK,

board/efikamx/efikamx-usb.c line 207

Quoted 10 lines
board/efikamx/efikamx-usb.c new file +10 -0
+			MX51_SYSCLOCK_24_MHZ);
+
+	setbits_le32(&control->usbctrl1, MX51_H1_EXTCLKE);
+
+	clrsetbits_le32(&control->uh2ctrl,
+			(MX51_H2_ULPI_IE | MX51_H2_WUE),
+			MX51_H2_PM);
+
+	udelay(10000);
+}

Is this function also board specific?

Quoted 78 lines
board/efikamx/efikamx-usb.c new file +78 -0
+
+void ulpi_set_flags(u32 ulpi_viewport, struct ulpi_regs *ulpi)
+{
+	ulpi_otg_ctrl_flags(ulpi_viewport, ulpi, ULPI_WRITE, ULPI_OTG_EXTVBUSIND |
+		ULPI_OTG_DM_PULLDOWN | ULPI_OTG_DP_PULLDOWN);
+	ulpi_function_ctrl_flags(ulpi_viewport, ulpi, ULPI_WRITE, ULPI_FC_XCVRSEL |
+		ULPI_FC_OPMODE_NORMAL | ULPI_FC_SUSPENDM);
+	ulpi_iface_ctrl_flags(ulpi_viewport, ulpi, ULPI_WRITE, 0);
+
+	/*
+	 * NOTE: Setting ULPI_OTG_CHRGVBUS violates USB specification,
+	 * but otherwise, USB on Efika doesn't charge VBUS
+	 * and as a result, USB doesn't work.
+	 */
+	ulpi_otg_ctrl_flags(ulpi_viewport, ulpi, ULPI_SET, ULPI_OTG_DRVVBUS |
+		ULPI_OTG_DRVVBUS_EXT | ULPI_OTG_CHRGVBUS);
+}
+
+/*
+ * Solve the VBUS reset problem on Efika
+ * by setting the CHRG_VBUS bit in the reset.
+ */
+void ehci_fixup(uint32_t *status_reg, uint32_t *reg_ref)
+{
+	struct usb_ehci *ehci = (struct usb_ehci *)(OTG_BASE_ADDR +
+		MX51_REGISTER_LAYOUT_LENGTH);
+	struct ulpi_regs *ulpi = (struct ulpi_regs *)0;
+
+	u32 tmp = ulpi_read((u32)&ehci->ulpi_viewport, (u32)&ulpi->otg_ctrl);
+	tmp |= ULPI_OTG_CHRGVBUS;
+	ulpi_write((u32)&ehci->ulpi_viewport, (u32)&ulpi->otg_ctrl, tmp);
+
+	/* USB 2.0 specification say 50 ms resets on root. */
+	wait_ms(50);
+
+	/* Now terminate the reset. */
+	*reg_ref = ehci_readl(status_reg);
+	*reg_ref |= EHCI_PS_PE;
+}
+
+void ehci0_init(struct usb_ehci *ehci)
+{
+	writel(MX51_16BIT_UTMI, &ehci->portsc);
+}
+
+void ehci1_init(struct usb_ehci *ehci, struct ulpi_regs *ulpi)
+{
+	mxc_request_iomux(MX51_PIN_USBH1_STP, IOMUX_CONFIG_ALT2);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_STP, PAD_CTL_DRV_HIGH |
+				PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
+	gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_USBH1_STP), 0);
+	udelay(1000);
+	gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_USBH1_STP), 1);
+	udelay(1000);
+
+	mxc_request_iomux(MX51_PIN_USBH1_STP, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_STP, USB_PAD_CONFIG);
+	udelay(10000);
+
+	clrbits_le32(&ehci->usbcmd, MX51_ITC_IMMEDIATE_MASK);
+	udelay(10000);
+
+	writel(MX51_ULPI_MODE_MASK, &ehci->portsc);
+	udelay(10000);
+
+	ulpi_init((u32)&ehci->ulpi_viewport, ulpi);
+	ulpi_set_flags((u32)&ehci->ulpi_viewport, ulpi);
+}
+
+void ehci2_init(struct usb_ehci *ehci, struct ulpi_regs *ulpi)
+{
+	mxc_request_iomux(MX51_PIN_EIM_A26, IOMUX_CONFIG_ALT1);
+	mxc_iomux_set_pad(MX51_PIN_EIM_A26, PAD_CTL_DRV_HIGH |
+				PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
+	gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_A26), 0);
+	udelay(1000);
+	gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_EIM_A26), 1);
+	udelay(1000);

board/efikamx/efikamx-usb.c line 295

Quoted 10 lines
board/efikamx/efikamx-usb.c new file +10 -0
+
+	mxc_request_iomux(MX51_PIN_EIM_A26, IOMUX_CONFIG_ALT2);
+	mxc_iomux_set_pad(MX51_PIN_EIM_A26, USB_PAD_CONFIG);
+
+	writel(MX51_ULPI_MODE_MASK, &ehci->portsc);
+	udelay(10000);
+
+	ulpi_init((u32)&ehci->ulpi_viewport, ulpi);
+	ulpi_set_flags((u32)&ehci->ulpi_viewport, ulpi);
+}

The above two functions (ehcix_init()) look very similar, can't those be consolidated?

Quoted 34 lines
board/efikamx/efikamx-usb.c new file +34 -0
+
+int ehci_hcd_init(void)
+{
+	struct usb_ehci *ehci;
+	struct mx5_usb_control_regs *mx5_usb_control_regs;
+	struct ulpi_regs *ulpi;
+
+	mx5_usb_control_regs = (struct mx5_usb_control_regs *)(OTG_BASE_ADDR +
+		 MX5_CTRL_REGS_OFFSET);
+	control_regs_setup(mx5_usb_control_regs);
+	ulpi = (struct ulpi_regs *)0;
+
+	/* Init EHCI core */
+	ehci = (struct usb_ehci *)(OTG_BASE_ADDR +
+		(MX51_REGISTER_LAYOUT_LENGTH * CONFIG_MXC_USB_PORT));
+	hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength);
+	hcor = (struct ehci_hcor *)((uint32_t) hccr +
+			HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
+	setbits_le32(&ehci->usbmode, CM_HOST);
+	setbits_le32(&ehci->control, USB_EN);
+
+	/* Init iMX51 EHCI */
+	efika_usb_phy_reset();
+	efika_usb_hub_reset();
+	efika_usb_enable_devices();
+
+	switch (CONFIG_MXC_USB_PORT) {
+	case 0:
+		ehci0_init(ehci);
+		break;
+	case 1:
+		ehci1_init(ehci, ulpi);
+		break;
+	case 2:

board/efikamx/efikamx-usb.c line 339

Quoted 10 lines
board/efikamx/efikamx-usb.c new file +10 -0
+		if (machine_is_efikasb())
+			ehci2_init(ehci, ulpi);
+		break;
+	};
+
+	/* EfikaMX USB has issues ... */
+	udelay(10000);
+
+	return 0;
+}

This function mixes board specific with SoC specific initializations.

board/efikamx/efikamx-usb.c line 344

Quoted 5 lines
board/efikamx/efikamx-usb.c new file +5 -0
+
+int ehci_hcd_stop(void)
+{
+	return 0;
+}

Don't you want to do anything here? I don't mind, but...

Quoted 41 lines
board/efikamx/efikamx.c +3 -0
index 0c4e24b..8e9b42b 100644
@@ -37,6 +37,8 @@
 #include <fsl_pmic.h>
 #include <mc13892.h>
 
+#include "efika.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -678,6 +680,7 @@ int board_late_init(void)
 
 	setup_iomux_led();
 	setup_iomux_ata();
+	setup_iomux_usb();
 
 	efikamx_toggle_led(EFIKAMX_LED_BLUE);
 
include/configs/efikamx.h +5 -0
index 54f48e4..1c48376 100644
@@ -44,6 +44,10 @@
 
 #define CONFIG_SYS_TEXT_BASE		0x97800000
 
+#define	CONFIG_L2_OFF
+#define	CONFIG_SYS_ICACHE_OFF
+#define	CONFIG_SYS_DCACHE_OFF
+
 /*
  * Bootloader Components Configuration
  */
@@ -172,6 +176,20 @@
 #endif
 
 /*
+ * USB

include/configs/efikamx.h line 189

Quoted 10 lines
include/configs/efikamx.h +10 -0
+ */
+#define CONFIG_CMD_USB
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI			/* Enable EHCI USB support */
+#define CONFIG_MXC_USB_PORT	1
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_KEYBOARD
+#define CONFIG_USB_ULPI
+#define CONFIG_USB_ULPI_VIEWPORT

I think it will be useful to have CONFIG_USB_ULPI_TIMEOUT option, so boards can easily override the default.

Quoted 6 lines
include/configs/efikamx.h +3 -0
+#endif /* CONFIG_CMD_USB */
+
+/*
  * Filesystems
  */
 #ifdef CONFIG_CMD_FAT
Signature · 2 lines
Regards,
Igor.
#42 lore raw

PATCH v8 4/4 Add USB support for Efika

In reply to Jana Rapava
Quoted 37 lines · Jana Rapava

This commit adds USB support for EfikaMX and EfikaSB.

Cc Remy Bohmer <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc Wolfgang Grandegger <[email protected]>

---
Changes for v2:
- introduce temporary variable in ulpi_write
- whitespace changes
Changes for v3:
- add protection against multiple inclusion of efika.h
Changes for v4:
- rename multiple inclusion protection macro in efika.h
Changes for v5:
- fix unterminated #ifndef in efika.h
Changes for v6:
- add Acked-by
- no changes
Changes for v7:
- use ULPI-related definitions from ./include/usb/ulpi.h
Changes for v8:
- adjust to new and more generic ULPI implementation

 board/efikamx/Makefile      |    3 +
 board/efikamx/efika.h       |   35 +++++
 board/efikamx/efikamx-usb.c |  344 +++++++++++++++++++++++++++++++++++++++++++
 board/efikamx/efikamx.c     |    3 +
 include/configs/efikamx.h   |   18 +++
 5 files changed, 403 insertions(+), 0 deletions(-)
 create mode 100644 board/efikamx/efika.h
 create mode 100644 board/efikamx/efikamx-usb.c

...

Quoted 5 lines
board/efikamx/efikamx-usb.c new file +0 -0
new file mode 100644
index 0000000..cbcdb18

...

Quoted 152 lines
board/efikamx/efikamx-usb.c new file +152 -0
+/*
+ * Configure control registers of the USB controller.
+ */
+void control_regs_setup(struct mx5_usb_control_regs *control)
+{
+	clrsetbits_le32(&control->usbctrl,
+		(MXC_OTG_WUE | MXC_OTG_PM | MX51_H1_ULPI_IE | MX51_H1_WUE),
+		MX51_H1_PM);
+
+	clrsetbits_le32(&control->phyctrl0,
+			MX51_OTG_OVERCURD,
+			MX51_EHCI_POWERPINSE);
+
+	clrsetbits_le32(&control->phyctrl1,
+			MX51_SYSCLOCK_MASK,
+			MX51_SYSCLOCK_24_MHZ);
+
+	setbits_le32(&control->usbctrl1, MX51_H1_EXTCLKE);
+
+	clrsetbits_le32(&control->uh2ctrl,
+			(MX51_H2_ULPI_IE | MX51_H2_WUE),
+			MX51_H2_PM);
+
+	udelay(10000);
+}
+
+void ulpi_set_flags(u32 ulpi_viewport, struct ulpi_regs *ulpi)
+{
+	ulpi_otg_ctrl_flags(ulpi_viewport, ulpi, ULPI_WRITE, ULPI_OTG_EXTVBUSIND |
+		ULPI_OTG_DM_PULLDOWN | ULPI_OTG_DP_PULLDOWN);
+	ulpi_function_ctrl_flags(ulpi_viewport, ulpi, ULPI_WRITE, ULPI_FC_XCVRSEL |
+		ULPI_FC_OPMODE_NORMAL | ULPI_FC_SUSPENDM);
+	ulpi_iface_ctrl_flags(ulpi_viewport, ulpi, ULPI_WRITE, 0);
+
+	/*
+	 * NOTE: Setting ULPI_OTG_CHRGVBUS violates USB specification,
+	 * but otherwise, USB on Efika doesn't charge VBUS
+	 * and as a result, USB doesn't work.
+	 */
+	ulpi_otg_ctrl_flags(ulpi_viewport, ulpi, ULPI_SET, ULPI_OTG_DRVVBUS |
+		ULPI_OTG_DRVVBUS_EXT | ULPI_OTG_CHRGVBUS);
+}
+
+/*
+ * Solve the VBUS reset problem on Efika
+ * by setting the CHRG_VBUS bit in the reset.
+ */
+void ehci_fixup(uint32_t *status_reg, uint32_t *reg_ref)
+{
+	struct usb_ehci *ehci = (struct usb_ehci *)(OTG_BASE_ADDR +
+		MX51_REGISTER_LAYOUT_LENGTH);
+	struct ulpi_regs *ulpi = (struct ulpi_regs *)0;
+
+	u32 tmp = ulpi_read((u32)&ehci->ulpi_viewport, (u32)&ulpi->otg_ctrl);
+	tmp |= ULPI_OTG_CHRGVBUS;
+	ulpi_write((u32)&ehci->ulpi_viewport, (u32)&ulpi->otg_ctrl, tmp);
+
+	/* USB 2.0 specification say 50 ms resets on root. */
+	wait_ms(50);
+
+	/* Now terminate the reset. */
+	*reg_ref = ehci_readl(status_reg);
+	*reg_ref |= EHCI_PS_PE;
+}
+
+void ehci0_init(struct usb_ehci *ehci)
+{
+	writel(MX51_16BIT_UTMI, &ehci->portsc);
+}
+
+void ehci1_init(struct usb_ehci *ehci, struct ulpi_regs *ulpi)
+{
+	mxc_request_iomux(MX51_PIN_USBH1_STP, IOMUX_CONFIG_ALT2);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_STP, PAD_CTL_DRV_HIGH |
+				PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
+	gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_USBH1_STP), 0);
+	udelay(1000);
+	gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_USBH1_STP), 1);
+	udelay(1000);
+
+	mxc_request_iomux(MX51_PIN_USBH1_STP, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_STP, USB_PAD_CONFIG);
+	udelay(10000);
+
+	clrbits_le32(&ehci->usbcmd, MX51_ITC_IMMEDIATE_MASK);
+	udelay(10000);
+
+	writel(MX51_ULPI_MODE_MASK, &ehci->portsc);
+	udelay(10000);
+
+	ulpi_init((u32)&ehci->ulpi_viewport, ulpi);
+	ulpi_set_flags((u32)&ehci->ulpi_viewport, ulpi);
+}
+
+void ehci2_init(struct usb_ehci *ehci, struct ulpi_regs *ulpi)
+{
+	mxc_request_iomux(MX51_PIN_EIM_A26, IOMUX_CONFIG_ALT1);
+	mxc_iomux_set_pad(MX51_PIN_EIM_A26, PAD_CTL_DRV_HIGH |
+				PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST);
+	gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_EIM_A26), 0);
+	udelay(1000);
+	gpio_set_value(IOMUX_TO_GPIO(MX51_PIN_EIM_A26), 1);
+	udelay(1000);
+
+	mxc_request_iomux(MX51_PIN_EIM_A26, IOMUX_CONFIG_ALT2);
+	mxc_iomux_set_pad(MX51_PIN_EIM_A26, USB_PAD_CONFIG);
+
+	writel(MX51_ULPI_MODE_MASK, &ehci->portsc);
+	udelay(10000);
+
+	ulpi_init((u32)&ehci->ulpi_viewport, ulpi);
+	ulpi_set_flags((u32)&ehci->ulpi_viewport, ulpi);
+}
+
+int ehci_hcd_init(void)
+{
+	struct usb_ehci *ehci;
+	struct mx5_usb_control_regs *mx5_usb_control_regs;
+	struct ulpi_regs *ulpi;
+
+	mx5_usb_control_regs = (struct mx5_usb_control_regs *)(OTG_BASE_ADDR +
+		 MX5_CTRL_REGS_OFFSET);
+	control_regs_setup(mx5_usb_control_regs);
+	ulpi = (struct ulpi_regs *)0;
+
+	/* Init EHCI core */
+	ehci = (struct usb_ehci *)(OTG_BASE_ADDR +
+		(MX51_REGISTER_LAYOUT_LENGTH * CONFIG_MXC_USB_PORT));
+	hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength);
+	hcor = (struct ehci_hcor *)((uint32_t) hccr +
+			HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
+	setbits_le32(&ehci->usbmode, CM_HOST);
+	setbits_le32(&ehci->control, USB_EN);
+
+	/* Init iMX51 EHCI */
+	efika_usb_phy_reset();
+	efika_usb_hub_reset();
+	efika_usb_enable_devices();
+
+	switch (CONFIG_MXC_USB_PORT) {
+	case 0:
+		ehci0_init(ehci);
+		break;
+	case 1:
+		ehci1_init(ehci, ulpi);
+		break;
+	case 2:
+		if (machine_is_efikasb())
+			ehci2_init(ehci, ulpi);
+		break;
+	};
+

board/efikamx/efikamx-usb.c line 344

Quoted 10 lines
board/efikamx/efikamx-usb.c new file +10 -0
+	/* EfikaMX USB has issues ... */
+	udelay(10000);
+
+	return 0;
+}
+
+int ehci_hcd_stop(void)
+{
+	return 0;
+}

We should share part of the code above, similar to drivers/usb/ehci-mxc.c. The board specific code could then be put in board_ehci_hcd_init().

Quoted 37 lines
board/efikamx/efikamx.c +3 -0
index 0c4e24b..8e9b42b 100644
@@ -37,6 +37,8 @@
 #include <fsl_pmic.h>
 #include <mc13892.h>
 
+#include "efika.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -678,6 +680,7 @@ int board_late_init(void)
 
 	setup_iomux_led();
 	setup_iomux_ata();
+	setup_iomux_usb();
 
 	efikamx_toggle_led(EFIKAMX_LED_BLUE);
 
include/configs/efikamx.h +4 -0
index 54f48e4..1c48376 100644
@@ -44,6 +44,10 @@
 
 #define CONFIG_SYS_TEXT_BASE		0x97800000
 
+#define	CONFIG_L2_OFF
+#define	CONFIG_SYS_ICACHE_OFF
+#define	CONFIG_SYS_DCACHE_OFF
+
 /*
  * Bootloader Components Configuration
  */

include/configs/efikamx.h line 184

Quoted 9 lines
include/configs/efikamx.h +6 -0
@@ -172,6 +176,20 @@
 #endif
 
 /*
+ * USB
+ */
+#define CONFIG_CMD_USB
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI			/* Enable EHCI USB support */
+#define CONFIG_MXC_USB_PORT	1

The other related option should then be used as well.

include/configs/efikamx.h line 195

Quoted 11 lines
include/configs/efikamx.h +8 -0
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_KEYBOARD
+#define CONFIG_USB_ULPI
+#define CONFIG_USB_ULPI_VIEWPORT
+#endif /* CONFIG_CMD_USB */
+
+/*
  * Filesystems
  */
 #ifdef CONFIG_CMD_FAT

Wolfgang.

#43 lore raw

PATCH v8 4/4 Add USB support for Efika

Quoted 11 lines · Jana Rapava
Quoted 10 lines

This commit adds USB support for EfikaMX and EfikaSB.

Cc Remy Bohmer <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc Wolfgang Grandegger <[email protected]>

Ok, I think I've had just about enough of this damn shit going on here. I see no updates, no progress, nothing. Basically, I dropped these patches from my tree and applied the old ones from my reflog. I think there was about enough time to get the patches into shape (3 months, maybe more).

Wolfgang, let's get a merge between your work and mine, shall we? I'll have something ready about tomorrow or so. This is high-prio for me now. btw. if you use Jabber, can you please PM me your jabber ID?

Also, there's a problem with Remy now, is he around at all? I see a few USB patches hoarding in his mailbox with no reply whatsoever. Anyone has any idea what's with him?

M

#44 lore raw

PATCH v8 4/4 Add USB support for Efika

2011/11/24 Marek Vasut <[email protected]>

Quoted 12 lines
Quoted 11 lines · Jana Rapava
Quoted 10 lines

This commit adds USB support for EfikaMX and EfikaSB.

Cc Remy Bohmer <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc Wolfgang Grandegger <[email protected]>
Quoted 8 lines

Ok, I think I've had just about enough of this damn shit going on here. I see no
updates, no progress, nothing. Basically, I dropped these patches from my tree
and applied the old ones from my reflog. I think there was about enough time to
get the patches into shape (3 months, maybe more).

Ok, I'm really stuck with this stuff (I haven't any idea how to split this patch into general and board-specific code how was demanded), so your suggestion is probably a better way how to do it.
I finally have something which I consider a usable version of ULPI support patch, so I'll post it today and you can use it if you want.

Regards,
Jana Rapava

#45 lore raw

cover Move ehci headers, add Efika USB support

In reply to Jana Rapava
Quoted 35 lines · Jana Rapava

This patchset moves header files ehci.h and ehci-core.h from drivers/usb/host/ to /include/usb and adds USB support for Efika with cleanup of file /drivers/usb/host/ehci-mxc.c.

In the previous revisions I messed up versioning and some From: and
In-Reply-To: headers, so I want to bury this mess and start with a clean plate. Version of patches in this patchset will then be 1.

Fabio Estevam (1):
usb: Move ehci.h and ehci-core.h to include/usb directory

Jana Rapava (3):
EHCI: add callback ehci_fixup
EHCI: adjust for mx5
Add USB support for Efika

 board/efikamx/Makefile           |    3 +
 board/efikamx/efika.h            |   30 +++
 board/efikamx/efikamx-usb.c      |  420
++++++++++++++++++++++++++++++++++++++ board/efikamx/efikamx.c          | 
  3 +
 drivers/usb/host/ehci-core.h     |   29 ---
 drivers/usb/host/ehci-fsl.c      |    4 +-
 drivers/usb/host/ehci-hcd.c      |   16 ++-
 drivers/usb/host/ehci-ixp4xx.c   |    4 +-
 drivers/usb/host/ehci-kirkwood.c |    4 +-
 drivers/usb/host/ehci-mpc512x.c  |    4 +-
 drivers/usb/host/ehci-mxc.c      |   35 +---
 drivers/usb/host/ehci-pci.c      |    4 +-
 drivers/usb/host/ehci-ppc4xx.c   |    4 +-
 drivers/usb/host/ehci-vct.c      |    4 +-
 drivers/usb/host/ehci.h          |  203 ------------------
 include/configs/efikamx.h        |   16 ++
 include/usb/ehci-core.h          |   29 +++
 include/usb/ehci-fsl.h           |  146 +++++++++++++-
Quoted 8 lines
 include/usb/ehci.h               |  203 ++++++++++++++++++
 19 files changed, 882 insertions(+), 279 deletions(-)
 create mode 100644 board/efikamx/efika.h
 create mode 100644 board/efikamx/efikamx-usb.c
 delete mode 100644 drivers/usb/host/ehci-core.h
 delete mode 100644 drivers/usb/host/ehci.h
 create mode 100644 include/usb/ehci-core.h
 create mode 100644 include/usb/ehci.h

You actually didn't Cc anyone in here ... please be more careful next time.

#46 lore raw

v2 cover Move ehci headers, add Efika USB support

In reply to Jana Rapava

This patchset moves header files ehci.h and ehci-core.h from drivers/usb/host/ to /include/usb and adds USB support for Efika with cleanup of file /drivers/usb/host/ehci-mxc.c.

In the previous revisions I messed up versioning and some From: and
In-Reply-To: headers, so I want to bury this mess and start with a clean plate. Version of patches in this patchset will then be 1.

Changes for v2:
- no changes, I only forget to add Cc: when I sent this

Fabio Estevam (1):
usb: Move ehci.h and ehci-core.h to include/usb directory

Jana Rapava (3):
EHCI: add callback ehci_fixup
EHCI: adjust for mx5
Add USB support for Efika

 board/efikamx/Makefile           |    3 +
 board/efikamx/efika.h            |   30 +++
 board/efikamx/efikamx-usb.c      |  420 ++++++++++++++++++++++++++++++++++++++
 board/efikamx/efikamx.c          |    3 +
 drivers/usb/host/ehci-core.h     |   29 ---
 drivers/usb/host/ehci-fsl.c      |    4 +-
 drivers/usb/host/ehci-hcd.c      |   16 ++-
 drivers/usb/host/ehci-ixp4xx.c   |    4 +-
 drivers/usb/host/ehci-kirkwood.c |    4 +-
 drivers/usb/host/ehci-mpc512x.c  |    4 +-
 drivers/usb/host/ehci-mxc.c      |   35 +---
 drivers/usb/host/ehci-pci.c      |    4 +-
 drivers/usb/host/ehci-ppc4xx.c   |    4 +-
 drivers/usb/host/ehci-vct.c      |    4 +-
 drivers/usb/host/ehci.h          |  203 ------------------
 include/configs/efikamx.h        |   16 ++
 include/usb/ehci-core.h          |   29 +++
 include/usb/ehci-fsl.h           |  146 +++++++++++++-
 include/usb/ehci.h               |  203 ++++++++++++++++++
 19 files changed, 882 insertions(+), 279 deletions(-)
 create mode 100644 board/efikamx/efika.h
 create mode 100644 board/efikamx/efikamx-usb.c
 delete mode 100644 drivers/usb/host/ehci-core.h
 delete mode 100644 drivers/usb/host/ehci.h
 create mode 100644 include/usb/ehci-core.h
 create mode 100644 include/usb/ehci.h
Signature · 1 line
1.7.6.3