public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Mack <daniel@caiaq.de>
To: Dinh.Nguyen@freescale.com
Cc: linux-kernel@vger.kernel.org, amit.kucheria@canonical.com,
	linux@arm.linux.org.uk, s.hauer@pengutronix.de,
	grant.likely@secretlab.ca, r.herring@freescale.com,
	linux-arm-kernel@lists.infradead.org, bryan.wu@canonical.com,
	valentin.longchamp@epfl.ch
Subject: Re: [PATCH 2.6.34-rc4 5/8] mx5: Add USB Host1 port registration
Date: Tue, 13 Apr 2010 19:39:17 +0200	[thread overview]
Message-ID: <20100413173917.GQ30801@buzzloop.caiaq.de> (raw)
In-Reply-To: <1271175030-3635-5-git-send-email-Dinh.Nguyen@freescale.com>

On Tue, Apr 13, 2010 at 11:10:28AM -0500, Dinh.Nguyen@freescale.com wrote:
> 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)

I'm confident there is a better definition for this already ;)

> +
> +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,
> +};

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
anywhere.

> +/*
> + * 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
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2010-04-13 17:39 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-13 16:10 [PATCH 2.6.34-rc4 1/8] mx5: Add registration of GPIOs for MX51 Babbage board Dinh.Nguyen
2010-04-13 16:10 ` [PATCH 2.6.34-rc4 2/8] mxc: Update GPIO for USB support on Freescale MX51 Babbage HW Dinh.Nguyen
2010-04-13 16:10   ` [PATCH 2.6.34-rc4 3/8] mxc: Add platform specific USB functions for Freescale MX51 HW Dinh.Nguyen
2010-04-13 16:10     ` [PATCH 2.6.34-rc4 4/8] mx5: Add USB OTG port registration Dinh.Nguyen
2010-04-13 16:10       ` [PATCH 2.6.34-rc4 5/8] mx5: Add USB Host1 " Dinh.Nguyen
2010-04-13 16:10         ` [PATCH 2.6.34-rc4 6/8] mx5: Add USB support for Freescale MX51 Babbage Dinh.Nguyen
2010-04-13 16:10           ` [PATCH 2.6.34-rc4 7/8] mx5: Add USB to " Dinh.Nguyen
2010-04-14  6:33             ` Bryan Wu
2010-04-15  4:33               ` Nguyen Dinh-R00091
2010-04-13 17:40           ` [PATCH 2.6.34-rc4 6/8] mx5: Add USB support for " Daniel Mack
2010-04-14  6:20           ` Bryan Wu
2010-04-13 17:39         ` Daniel Mack [this message]
2010-04-13 17:30       ` [PATCH 2.6.34-rc4 4/8] mx5: Add USB OTG port registration Daniel Mack
2010-04-14  6:58       ` Bryan Wu
2010-04-14  7:30         ` Daniel Mack
2010-04-13 17:27     ` [PATCH 2.6.34-rc4 3/8] mxc: Add platform specific USB functions for Freescale MX51 HW Daniel Mack
2010-04-13 16:48   ` [PATCH 2.6.34-rc4 2/8] mxc: Update GPIO for USB support on Freescale MX51 Babbage HW Daniel Mack
2010-04-14  6:34   ` Sascha Hauer
2010-04-13 16:45 ` [PATCH 2.6.34-rc4 1/8] mx5: Add registration of GPIOs for MX51 Babbage board Daniel Mack
2010-04-13 19:36   ` Nguyen Dinh-R00091
2010-04-14  6:51     ` Sascha Hauer
2010-04-14  7:31       ` Daniel Mack
2010-04-14  7:37         ` Sascha Hauer
2010-04-13 17:20 ` Sascha Hauer
2010-04-13 19:44 ` Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100413173917.GQ30801@buzzloop.caiaq.de \
    --to=daniel@caiaq.de \
    --cc=Dinh.Nguyen@freescale.com \
    --cc=amit.kucheria@canonical.com \
    --cc=bryan.wu@canonical.com \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=r.herring@freescale.com \
    --cc=s.hauer@pengutronix.de \
    --cc=valentin.longchamp@epfl.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox