All of lore.kernel.org
 help / color / mirror / Atom feed
From: peter.chen@freescale.com (Peter Chen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/9] usb: chipidea: add PTW and PTS handling
Date: Tue, 27 Nov 2012 09:12:30 +0800	[thread overview]
Message-ID: <20121127011210.GA17856@nchen-desktop> (raw)
In-Reply-To: <1352909950-32555-7-git-send-email-m.grzeschik@pengutronix.de>

On Wed, Nov 14, 2012 at 05:19:07PM +0100, Michael Grzeschik wrote:
>  /**
>   * hw_device_reset: resets chip (execute without interruption)
>   * @ci: the controller
> @@ -237,6 +256,8 @@ int hw_device_reset(struct ci13xxx *ci, u32 mode)
>  	if (ci->platdata->flags & CI13XXX_DISABLE_STREAMING)
>  		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
>  
> +	hw_portsc_configure(ci);
> +
>  	/* USBMODE should be configured step by step */
>  	hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE);
>  	hw_write(ci, OP_USBMODE, USBMODE_CM, mode);
> @@ -522,6 +543,32 @@ void ci13xxx_remove_device(struct platform_device *pdev)
>  }
>  EXPORT_SYMBOL_GPL(ci13xxx_remove_device);
>  
> +void ci13xxx_get_dr_flags(struct device_node *of_node, struct ci13xxx_platform_data *pdata)
> +{
> +	int interface = of_get_usbphy_mode(of_node);
> +
> +	switch (interface) {
> +	case USBPHY_INTERFACE_MODE_UTMI:
> +		pdata->flags |= CI13XXX_PORTSC_PTS_UTMI;
> +		break;
> +	case USBPHY_INTERFACE_MODE_UTMIW:
> +		pdata->flags |= CI13XXX_PORTSC_PTS_UTMI |
> +			CI13XXX_PORTSC_PTW_16BIT;
> +		break;
> +	case USBPHY_INTERFACE_MODE_ULPI:
> +		pdata->flags |= CI13XXX_PORTSC_PTS_ULPI;
> +		break;
> +	case USBPHY_INTERFACE_MODE_SERIAL:
> +		pdata->flags |= CI13XXX_PORTSC_PTS_FSLS;
> +		break;
> +	case USBPHY_INTERFACE_MODE_NA:
> +	default:
> +		pr_err("no phy interface defined\n");
> +	}
> +
> +}
> +EXPORT_SYMBOL_GPL(ci13xxx_get_dr_flags);
> +
>  void ci13xxx_get_dr_mode(struct device_node *of_node, struct ci13xxx_platform_data *pdata)
>  {
>  	const unsigned char *dr_mode;
> diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
> index ebff9f4..b23ee1d 100644
> --- a/drivers/usb/chipidea/host.c
> +++ b/drivers/usb/chipidea/host.c
> @@ -106,6 +106,10 @@ static int host_start(struct ci13xxx *ci)
>  	if (usb_disabled())
>  		return -ENODEV;
>  
> +	hw_portsc_configure(ci);
> +
> +	mdelay(10);
is usleep_range ok?
Why host needs 10ms delay, but peripheral mode doesn't?

> +
>  	hcd = usb_create_hcd(&ci_ehci_hc_driver, ci->dev, dev_name(ci->dev));
>  	if (!hcd)
>  		return -ENOMEM;
> diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
> index 906d259..cafca23 100644
> --- a/include/linux/usb/chipidea.h
> +++ b/include/linux/usb/chipidea.h
> @@ -21,6 +21,12 @@ struct ci13xxx_platform_data {
>  #define CI13XXX_DISABLE_STREAMING	BIT(3)
>  #define CI13XXX_DR_MODE_HOST		BIT(4)
>  #define CI13XXX_DR_MODE_PERIPHERAL	BIT(5)
> +#define CI13XXX_PORTSC_PTW_8BIT		BIT(6)
> +#define CI13XXX_PORTSC_PTW_16BIT	BIT(7)
> +#define CI13XXX_PORTSC_PTS_UTMI		BIT(8)
> +#define CI13XXX_PORTSC_PTS_ULPI		BIT(9)
> +#define CI13XXX_PORTSC_PTS_FSLS		BIT(10)
> +
>  #define CI13XXX_DR_MODE_MASK \
>  	(CI13XXX_DR_MODE_HOST | CI13XXX_DR_MODE_PERIPHERAL)
>  
> @@ -42,4 +48,7 @@ void ci13xxx_remove_device(struct platform_device *pdev);
>  /* Parse of-tree "dr_mode" property */
>  void ci13xxx_get_dr_mode(struct device_node *of_node, struct ci13xxx_platform_data *pdata);
>  
> +/* Parse of-tree "flags" */
> +void ci13xxx_get_dr_flags(struct device_node *of_node, struct ci13xxx_platform_data *pdata);
> +
>  #endif
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 

Best Regards,
Peter Chen

WARNING: multiple messages have this Message-ID (diff)
From: Peter Chen <peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
To: Michael Grzeschik <m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	alexander.shishkin-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: [PATCH 6/9] usb: chipidea: add PTW and PTS handling
Date: Tue, 27 Nov 2012 09:12:30 +0800	[thread overview]
Message-ID: <20121127011210.GA17856@nchen-desktop> (raw)
In-Reply-To: <1352909950-32555-7-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

On Wed, Nov 14, 2012 at 05:19:07PM +0100, Michael Grzeschik wrote:
>  /**
>   * hw_device_reset: resets chip (execute without interruption)
>   * @ci: the controller
> @@ -237,6 +256,8 @@ int hw_device_reset(struct ci13xxx *ci, u32 mode)
>  	if (ci->platdata->flags & CI13XXX_DISABLE_STREAMING)
>  		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
>  
> +	hw_portsc_configure(ci);
> +
>  	/* USBMODE should be configured step by step */
>  	hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE);
>  	hw_write(ci, OP_USBMODE, USBMODE_CM, mode);
> @@ -522,6 +543,32 @@ void ci13xxx_remove_device(struct platform_device *pdev)
>  }
>  EXPORT_SYMBOL_GPL(ci13xxx_remove_device);
>  
> +void ci13xxx_get_dr_flags(struct device_node *of_node, struct ci13xxx_platform_data *pdata)
> +{
> +	int interface = of_get_usbphy_mode(of_node);
> +
> +	switch (interface) {
> +	case USBPHY_INTERFACE_MODE_UTMI:
> +		pdata->flags |= CI13XXX_PORTSC_PTS_UTMI;
> +		break;
> +	case USBPHY_INTERFACE_MODE_UTMIW:
> +		pdata->flags |= CI13XXX_PORTSC_PTS_UTMI |
> +			CI13XXX_PORTSC_PTW_16BIT;
> +		break;
> +	case USBPHY_INTERFACE_MODE_ULPI:
> +		pdata->flags |= CI13XXX_PORTSC_PTS_ULPI;
> +		break;
> +	case USBPHY_INTERFACE_MODE_SERIAL:
> +		pdata->flags |= CI13XXX_PORTSC_PTS_FSLS;
> +		break;
> +	case USBPHY_INTERFACE_MODE_NA:
> +	default:
> +		pr_err("no phy interface defined\n");
> +	}
> +
> +}
> +EXPORT_SYMBOL_GPL(ci13xxx_get_dr_flags);
> +
>  void ci13xxx_get_dr_mode(struct device_node *of_node, struct ci13xxx_platform_data *pdata)
>  {
>  	const unsigned char *dr_mode;
> diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
> index ebff9f4..b23ee1d 100644
> --- a/drivers/usb/chipidea/host.c
> +++ b/drivers/usb/chipidea/host.c
> @@ -106,6 +106,10 @@ static int host_start(struct ci13xxx *ci)
>  	if (usb_disabled())
>  		return -ENODEV;
>  
> +	hw_portsc_configure(ci);
> +
> +	mdelay(10);
is usleep_range ok?
Why host needs 10ms delay, but peripheral mode doesn't?

> +
>  	hcd = usb_create_hcd(&ci_ehci_hc_driver, ci->dev, dev_name(ci->dev));
>  	if (!hcd)
>  		return -ENOMEM;
> diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
> index 906d259..cafca23 100644
> --- a/include/linux/usb/chipidea.h
> +++ b/include/linux/usb/chipidea.h
> @@ -21,6 +21,12 @@ struct ci13xxx_platform_data {
>  #define CI13XXX_DISABLE_STREAMING	BIT(3)
>  #define CI13XXX_DR_MODE_HOST		BIT(4)
>  #define CI13XXX_DR_MODE_PERIPHERAL	BIT(5)
> +#define CI13XXX_PORTSC_PTW_8BIT		BIT(6)
> +#define CI13XXX_PORTSC_PTW_16BIT	BIT(7)
> +#define CI13XXX_PORTSC_PTS_UTMI		BIT(8)
> +#define CI13XXX_PORTSC_PTS_ULPI		BIT(9)
> +#define CI13XXX_PORTSC_PTS_FSLS		BIT(10)
> +
>  #define CI13XXX_DR_MODE_MASK \
>  	(CI13XXX_DR_MODE_HOST | CI13XXX_DR_MODE_PERIPHERAL)
>  
> @@ -42,4 +48,7 @@ void ci13xxx_remove_device(struct platform_device *pdev);
>  /* Parse of-tree "dr_mode" property */
>  void ci13xxx_get_dr_mode(struct device_node *of_node, struct ci13xxx_platform_data *pdata);
>  
> +/* Parse of-tree "flags" */
> +void ci13xxx_get_dr_flags(struct device_node *of_node, struct ci13xxx_platform_data *pdata);
> +
>  #endif
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 

Best Regards,
Peter Chen

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2012-11-27  1:12 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-14 16:19 [PATCH 0/9] chipidea fixes and features Michael Grzeschik
2012-11-14 16:19 ` Michael Grzeschik
2012-11-14 16:19 ` [PATCH 1/9] usb: chipidea: pci: mark platformdata as static and __devinitdata Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-16 10:06   ` Alexander Shishkin
2012-11-16 10:06     ` Alexander Shishkin
2012-11-16 10:17     ` Marc Kleine-Budde
2012-11-16 10:17       ` Marc Kleine-Budde
2012-11-16 11:41       ` Alexander Shishkin
2012-11-16 11:41         ` Alexander Shishkin
2012-11-16 12:02     ` Greg KH
2012-11-16 12:02       ` Greg KH
2012-11-14 16:19 ` [PATCH 2/9] usb: chipidea: ci13xxx_imx: add 2nd and 3rd clock to support imx5x and newer Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-26  9:29   ` Peter Chen
2012-11-26  9:29     ` Peter Chen
2012-11-26 10:22     ` Sascha Hauer
2012-11-26 10:22       ` Sascha Hauer
2012-11-27  6:50       ` Peter Chen
2012-11-27  6:50         ` Peter Chen
2012-11-27  7:34         ` Sascha Hauer
2012-11-27  7:34           ` Sascha Hauer
2012-11-14 16:19 ` [PATCH 3/9] usb: chipidea: ci13xxx-imx: create dynamic platformdata Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-16 10:14   ` Alexander Shishkin
2012-11-16 10:14     ` Alexander Shishkin
2012-11-16 10:19     ` Marc Kleine-Budde
2012-11-16 10:19       ` Marc Kleine-Budde
2012-11-16 12:06   ` Alexander Shishkin
2012-11-16 12:06     ` Alexander Shishkin
2012-11-14 16:19 ` [PATCH 4/9] usb: chipidea: ci13xxx-imx: add "dr_mode" property to device tree bindings Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-16 11:53   ` Alexander Shishkin
2012-11-16 11:53     ` Alexander Shishkin
2012-11-16 11:55     ` Marc Kleine-Budde
2012-11-16 11:55       ` Marc Kleine-Budde
2012-11-26  9:46     ` Peter Chen
2012-11-26  9:46       ` Peter Chen
2012-11-29 12:54       ` Alexander Shishkin
2012-11-29 12:54         ` Alexander Shishkin
2012-11-14 16:19 ` [PATCH 5/9] usb: add phy connection by phy-mode Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-16  9:25   ` Alexander Shishkin
2012-11-16  9:25     ` Alexander Shishkin
2012-11-16 11:28   ` Felipe Balbi
2012-11-16 11:28     ` Felipe Balbi
2012-11-16 11:31   ` Felipe Balbi
2012-11-16 11:31     ` Felipe Balbi
2012-11-16 11:44     ` Marc Kleine-Budde
2012-11-16 11:44       ` Marc Kleine-Budde
2012-11-16 13:41       ` Felipe Balbi
2012-11-16 13:41         ` Felipe Balbi
2012-11-16 14:32         ` Marc Kleine-Budde
2012-11-16 14:32           ` Marc Kleine-Budde
2012-11-26  9:56   ` Peter Chen
2012-11-26  9:56     ` Peter Chen
2012-11-14 16:19 ` [PATCH 6/9] usb: chipidea: add PTW and PTS handling Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-16 12:18   ` Alexander Shishkin
2012-11-16 12:18     ` Alexander Shishkin
2012-11-16 12:45   ` Alexander Shishkin
2012-11-16 12:45     ` Alexander Shishkin
2012-11-16 13:16     ` Michael Grzeschik
2012-11-16 13:16       ` Michael Grzeschik
2012-11-16 13:34       ` Alexander Shishkin
2012-11-16 13:34         ` Alexander Shishkin
2012-11-16 13:57         ` Michael Grzeschik
2012-11-16 13:57           ` Michael Grzeschik
2012-11-16 14:06           ` Alexander Shishkin
2012-11-16 14:06             ` Alexander Shishkin
2012-11-16 14:46             ` Matthieu CASTET
2012-11-16 14:46               ` Matthieu CASTET
2012-11-16 15:39               ` Alexander Shishkin
2012-11-16 15:39                 ` Alexander Shishkin
2012-11-21 15:57                 ` Michael Grzeschik
2012-11-21 15:57                   ` Michael Grzeschik
2012-11-21 16:06                   ` Matthieu CASTET
2012-11-21 16:06                     ` Matthieu CASTET
2012-11-27  1:12   ` Peter Chen [this message]
2012-11-27  1:12     ` Peter Chen
2012-11-27  9:54     ` Michael Grzeschik
2012-11-27  9:54       ` Michael Grzeschik
2012-11-28  1:26       ` Peter Chen
2012-11-28  1:26         ` Peter Chen
2012-11-14 16:19 ` [PATCH 7/9] usb: chipidea: udc: add force-full-speed option Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-16 12:51   ` Alexander Shishkin
2012-11-16 12:51     ` Alexander Shishkin
2012-11-16 14:53     ` Matthieu CASTET
2012-11-16 14:53       ` Matthieu CASTET
2012-11-14 16:19 ` [PATCH 8/9] usb: chipidea: udc: remove unlocked ep_queue which can lead to an race Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-16 12:55   ` Alexander Shishkin
2012-11-16 12:55     ` Alexander Shishkin
2012-11-14 16:19 ` [PATCH 9/9] usb: chipidea: udc: configure iso endpoints Michael Grzeschik
2012-11-14 16:19   ` Michael Grzeschik
2012-11-14 18:04   ` Sergei Shtylyov
2012-11-14 18:04     ` Sergei Shtylyov

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=20121127011210.GA17856@nchen-desktop \
    --to=peter.chen@freescale.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.