lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1271175030-3635-5-git-send-email-Dinh.Nguyen@freescale.com>
Date:	Tue, 13 Apr 2010 11:10:28 -0500
From:	Dinh.Nguyen@...escale.com
To:	linux-kernel@...r.kernel.org
Cc:	linux-arm-kernel@...ts.infradead.org, linux@....linux.org.uk,
	s.hauer@...gutronix.de, valentin.longchamp@...l.ch,
	daniel@...aq.de, grant.likely@...retlab.ca,
	r.herring@...escale.com, bryan.wu@...onical.com,
	amit.kucheria@...onical.com,
	Dinh Nguyen <Dinh.Nguyen@...escale.com>
Subject: [PATCH 2.6.34-rc4 5/8] mx5: Add USB Host1 port registration

From: Dinh Nguyen <Dinh.Nguyen@...escale.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@...escale.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 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <mach/iomux-mx51.h>
+#include <mach/mxc_ehci.h>
+#include <mach/common.h>
+#include "devices.h"
+
+#define	GPIO1_27	(0*32 +27)
+
+extern int fsl_usb_host_init(struct platform_device *pdev);
+extern int fsl_usb_host_uninit(struct fsl_usb2_platform_data *pdata);
+
+static int fsl_usb_host_init_ext(struct platform_device *pdev);
+static int fsl_usb_host_uninit_ext(struct platform_device *pdev);
+
+static struct mxc_usbh_platform_data usbh1_config = {
+	.init	= fsl_usb_host_init_ext,
+	.exit	= fsl_usb_host_uninit_ext,
+	.portsc	= MXC_EHCI_MODE_ULPI,
+	.flags	= MXC_EHCI_POWER_PINS_ENABLED,
+};
+
+/*
+ * USB Host1 HS port
+ */
+static int gpio_usbh1_active(void)
+{
+	struct pad_desc usbh1stp_gpio = MX51_PAD_GPIO_1_27__USBH1_STP_ERR;
+	int ret;
+
+	/* Set USBH1_STP to GPIO and toggle it */
+	mxc_iomux_v3_setup_pad(&usbh1stp_gpio);
+	ret = gpio_request(GPIO1_27, "usbh1_stp");
+
+	if (ret) {
+		pr_debug("failed to get USBH1_STP_GPIO1_27: %d\n", ret);
+		return ret;
+	}
+	gpio_direction_output(GPIO1_27, 0);
+	gpio_set_value(GPIO1_27, 1);
+
+	msleep(100);
+	gpio_free(GPIO1_27);
+	return 0;
+}
+
+static int fsl_usb_host_init_ext(struct platform_device *pdev)
+{
+	int ret;
+	struct pad_desc usbh1stp = MX51_PAD_GPIO_1_27__USBH1_STP;
+
+	gpio_usbh1_active();
+	ret = fsl_usb_host_init(pdev);
+	if (ret)
+		return ret;
+
+	/* setback USBH1_STP to be function */
+	mxc_iomux_v3_setup_pad(&usbh1stp);
+	return 0;
+}
+
+static int fsl_usb_host_uninit_ext(struct platform_device *pdev)
+{
+	return fsl_usb_host_uninit(pdev);
+}
+void __init mx5_usbh1_init(void)
+{
+	mxc_register_device(&mxc_usbh1_device, &usbh1_config);
+}
+
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ