Re: [PATCH 2.6.34-rc4 6/8] mx5: Add USB support for Freescale MX51 Babbage

Previous thread: [PATCH]: x86: remove extra bootmem.h from arch/x86/mm/init_64.c by Prarit Bhargava on Tuesday, April 13, 2010 - 8:47 am. (2 messages)

Next thread: [PATCH 2.6.34-rc4 2/8] mxc: Update GPIO for USB support on Freescale MX51 Babbage HW by Dinh.Nguyen on Tuesday, April 13, 2010 - 9:10 am. (5 messages)
From: Dinh.Nguyen
Date: Tuesday, April 13, 2010 - 9:10 am

From: Dinh Nguyen <Dinh.Nguyen@freescale.com>

This patch adds the device platform registration for enabling USB
host functionality on the OTG port on Freescale MX51 Babbage HW. This
file makes platform specific calls to initialize the USB HW.

This patch applies to 2.6.34-rc4.

Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com>
---
 arch/arm/mach-mx5/Makefile             |    2 +-
 arch/arm/mach-mx5/board-mx51_babbage.c |    4 ++
 arch/arm/mach-mx5/usb_dr.c             |   57 ++++++++++++++++++++++++++++++++
 3 files changed, 62 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-mx5/usb_dr.c

diff --git a/arch/arm/mach-mx5/Makefile b/arch/arm/mach-mx5/Makefile
index bf23f86..3fca1f1 100644
--- a/arch/arm/mach-mx5/Makefile
+++ b/arch/arm/mach-mx5/Makefile
@@ -3,7 +3,7 @@
 #
 
 # Object file lists.
-obj-y   := cpu.o mm.o clock-mx51.o devices.o
+obj-y   := cpu.o mm.o clock-mx51.o devices.o usb_dr.o
 
 obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o
 
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index afbe400..4e196d7 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -27,6 +27,8 @@
 
 #include "devices.h"
 
+extern void __init mx5_usb_dr_init(void);
+
 static struct platform_device *devices[] __initdata = {
 	&mxc_fec_device,
 };
@@ -78,6 +80,8 @@ static void __init mxc_board_init(void)
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 
 	mxc_register_gpios();
+
+	mx5_usb_dr_init();
 }
 
 static void __init mx51_babbage_timer_init(void)
diff --git a/arch/arm/mach-mx5/usb_dr.c b/arch/arm/mach-mx5/usb_dr.c
new file mode 100644
index 0000000..52273ea
--- /dev/null
+++ b/arch/arm/mach-mx5/usb_dr.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc. 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 ...
From: Dinh.Nguyen
Date: Tuesday, April 13, 2010 - 9:10 am

From: Dinh Nguyen <Dinh.Nguyen@freescale.com>

Updade mx51_defconfig to include USB host support.
This patch applies to 2.6.34-rc4.

Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com>
---
 arch/arm/configs/mx51_defconfig |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/arch/arm/configs/mx51_defconfig b/arch/arm/configs/mx51_defconfig
index c88e952..a708fd6 100644
--- a/arch/arm/configs/mx51_defconfig
+++ b/arch/arm/configs/mx51_defconfig
@@ -809,7 +809,22 @@ CONFIG_SSB_POSSIBLE=y
 CONFIG_DUMMY_CONSOLE=y
 # CONFIG_SOUND is not set
 # CONFIG_HID_SUPPORT is not set
-# CONFIG_USB_SUPPORT is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_ARCH_HAS_HCD=y
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+CONFIG_USB_ARCH_HAS_EHCI=y
+CONFIG_USB=y
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_C67X00_HCD is not set
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_ROOT_HUB_TT=y
+# CONFIG_USB_EHCI_TT_NEWSCHED is not set
+CONFIG_USB_EHCI_MXC=y
+
+
 CONFIG_MMC=y
 # CONFIG_MMC_DEBUG is not set
 # CONFIG_MMC_UNSAFE_RESUME is not set
-- 
1.6.0.4

--

From: Bryan Wu
Date: Tuesday, April 13, 2010 - 11:33 pm

This patch looks OK for me, but I failed to find the 8th patch of this patchset.
Did you forget to send it out?

-Bryan


--

From: Nguyen Dinh-R00091
Date: Wednesday, April 14, 2010 - 9:33 pm

The 8th patch was for a USB timeout change that was sent to the USB
maintainer. Thanks everyone for their comments, I am almost ready with
another set with review comments taken into consideration.

Dinh 

-----Original Message-----
From: Bryan Wu [mailto:bryan.wu@canonical.com] 
Sent: Wednesday, April 14, 2010 1:33 AM
To: Nguyen Dinh-R00091
Cc: linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
linux@arm.linux.org.uk; s.hauer@pengutronix.de;
valentin.longchamp@epfl.ch; daniel@caiaq.de; grant.likely@secretlab.ca;
Herring Robert-RA7055; amit.kucheria@canonical.com
Subject: Re: [PATCH 2.6.34-rc4 7/8] mx5: Add USB to Freescale MX51
Babbage

This patch looks OK for me, but I failed to find the 8th patch of this
patchset.
Did you forget to send it out?

-Bryan



--

From: Dinh.Nguyen
Date: Tuesday, April 13, 2010 - 9:10 am

From: Dinh Nguyen <Dinh.Nguyen@freescale.com>

This patch adds the device platform registration for enabling USB
host functionality on the Host1 port on Freescale MX51 Babbage HW.
This file makes platform specific calls to initialize the USB HW.

This patch applies to 2.6.34-rc4.

Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com>
---
 arch/arm/mach-mx5/Makefile             |    2 +-
 arch/arm/mach-mx5/board-mx51_babbage.c |    2 +
 arch/arm/mach-mx5/usb_h1.c             |   90 ++++++++++++++++++++++++++++++++
 3 files changed, 93 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-mx5/usb_h1.c

diff --git a/arch/arm/mach-mx5/Makefile b/arch/arm/mach-mx5/Makefile
index 3fca1f1..e49be0b 100644
--- a/arch/arm/mach-mx5/Makefile
+++ b/arch/arm/mach-mx5/Makefile
@@ -3,7 +3,7 @@
 #
 
 # Object file lists.
-obj-y   := cpu.o mm.o clock-mx51.o devices.o usb_dr.o
+obj-y   := cpu.o mm.o clock-mx51.o devices.o usb_dr.o usb_h1.o
 
 obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o
 
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index 4e196d7..1338d6a 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -28,6 +28,7 @@
 #include "devices.h"
 
 extern void __init mx5_usb_dr_init(void);
+extern void __init mx5_usbh1_init(void);
 
 static struct platform_device *devices[] __initdata = {
 	&mxc_fec_device,
@@ -82,6 +83,7 @@ static void __init mxc_board_init(void)
 	mxc_register_gpios();
 
 	mx5_usb_dr_init();
+	mx5_usbh1_init();
 }
 
 static void __init mx51_babbage_timer_init(void)
diff --git a/arch/arm/mach-mx5/usb_h1.c b/arch/arm/mach-mx5/usb_h1.c
new file mode 100644
index 0000000..23ae336
--- /dev/null
+++ b/arch/arm/mach-mx5/usb_h1.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public ...
From: Dinh.Nguyen
Date: Tuesday, April 13, 2010 - 9:10 am

From: Dinh Nguyen <Dinh.Nguyen@freescale.com>

This patch updates the clocks, gpios, iomuxing and device structures for
enabling USB Host functionality on Freescale MX51 Babbage HW.
This patch applies to 2.6.34-rc4.

Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com>
---
 arch/arm/mach-mx5/board-mx51_babbage.c |   40 +++++++++++++++++++++++++-
 arch/arm/mach-mx5/clock-mx51.c         |    8 +++++
 arch/arm/mach-mx5/devices.c            |   49 ++++++++++++++++++++++++++++++++
 arch/arm/mach-mx5/devices.h            |    2 +
 4 files changed, 98 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index 1338d6a..ddfa48b 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -13,6 +13,7 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
+#include <linux/delay.h>
 
 #include <mach/common.h>
 #include <mach/hardware.h>
@@ -30,6 +31,8 @@
 extern void __init mx5_usb_dr_init(void);
 extern void __init mx5_usbh1_init(void);
 
+#define GPIO_1_7  (0*32+7)
+
 static struct platform_device *devices[] __initdata = {
 	&mxc_fec_device,
 };
@@ -50,6 +53,22 @@ static struct pad_desc mx51babbage_pads[] = {
 	MX51_PAD_EIM_D26__UART3_TXD,
 	MX51_PAD_EIM_D27__UART3_RTS,
 	MX51_PAD_EIM_D24__UART3_CTS,
+
+	/* USB HOST1 */
+	MX51_PAD_GPIO_1_25__USBH1_CLK,
+	MX51_PAD_GPIO_1_26__USBH1_DIR,
+	MX51_PAD_GPIO_1_28__USBH1_NXT,
+	MX51_PAD_GPIO_1_11__USBH1_DATA0,
+	MX51_PAD_GPIO_1_12__USBH1_DATA1,
+	MX51_PAD_GPIO_1_13__USBH1_DATA2,
+	MX51_PAD_GPIO_1_14__USBH1_DATA3,
+	MX51_PAD_GPIO_1_15__USBH1_DATA4,
+	MX51_PAD_GPIO_1_16__USBH1_DATA5,
+	MX51_PAD_GPIO_1_17__USBH1_DATA6,
+	MX51_PAD_GPIO_1_18__USBH1_DATA7,
+
+	/* USB HUB reset line*/
+	MX51_PAD_GPIO_1_7__GPIO1_7,
 };
 
 /* Serial ports */
@@ -64,12 +83,31 @@ static inline void mxc_init_imx_uart(void)
 	mxc_register_device(&mxc_uart_device1, &uart_pdata);
 ...
From: Daniel Mack
Date: Tuesday, April 13, 2010 - 10:40 am

That should be split in two patches - one for common code and one for
--

From: Bryan Wu
Date: Tuesday, April 13, 2010 - 11:20 pm

As this GPIO used below, it is better to name it just as

How about "MX51_PAD_GPIO_1_7__GPIO_USB_RESET",


It should be
+	NULL, NULL, &pll3_sw_clk, NULL);

I'm a little bit picky here, but please use scripts/checkpatch.pl to fix this 




-- 
Bryan Wu <bryan.wu@canonical.com>
Kernel Developer    +86.138-1617-6545 Mobile
Ubuntu Kernel Team | Hardware Enablement Team
Canonical Ltd.      www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
--

From: Daniel Mack
Date: Tuesday, April 13, 2010 - 10:39 am

This is actually the way to go. All driver code in lower layers should
use these flags eventually, and no assumptions should be hard-coded
--

From: Daniel Mack
Date: Tuesday, April 13, 2010 - 10:30 am

This is also board specific, and nothing you should assume for all
boards. Other implementations may do this differntly, which is why

What's the reason for having the _ext variants that are just wrapers?
--

From: Bryan Wu
Date: Tuesday, April 13, 2010 - 11:58 pm

Agree with Daniel here, this patch should be split into 2 parts, a) for usb_dr.c 
and Makefile, b) for board-mx51_babbage.c change.

And one more suggestion is merge usb_dr.c and usb_h1.c as one file usb.c. It is 
more simple to maintain and review.


--

From: Daniel Mack
Date: Wednesday, April 14, 2010 - 12:30 am

I don't think usb_dr.c is needed at all, as its content is not anything
that should be shared between boards. Those definitions should be placed
in mx51_babbage.c alltogether.

But we're disussing at the wrong end of the patch set; once the
mx5-generic parts have been fixed, the interface to board support code
will also change.

--

Previous thread: [PATCH]: x86: remove extra bootmem.h from arch/x86/mm/init_64.c by Prarit Bhargava on Tuesday, April 13, 2010 - 8:47 am. (2 messages)

Next thread: [PATCH 2.6.34-rc4 2/8] mxc: Update GPIO for USB support on Freescale MX51 Babbage HW by Dinh.Nguyen on Tuesday, April 13, 2010 - 9:10 am. (5 messages)