Patchwork [U-Boot,3/4] USB:gadget:designware Support high speed

login
register
mail settings
Submitter Amit Virdi
Date Feb. 16, 2012, 12:03 p.m.
Message ID <1329393818-24552-4-git-send-email-amit.virdi@st.com>
Download mbox | patch
Permalink /patch/141580/
State Superseded
Delegated to: Marek Vasut
Headers show

Comments

Amit Virdi - Feb. 16, 2012, 12:03 p.m.
From: Vipin KUMAR <vipin.kumar@st.com>

This patch adds the support for usb device high speed for designware peripheral.

Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
Signed-off-by: Amit Virdi <amit.virdi@st.com>
---
 drivers/usb/gadget/designware_udc.c |   13 +++++++++----
 include/usb/designware_udc.h        |    3 +++
 2 files changed, 12 insertions(+), 4 deletions(-)
Marek Vasut - March 5, 2012, 6:15 p.m.
Dear Amit Virdi,

> From: Vipin KUMAR <vipin.kumar@st.com>
> 
> This patch adds the support for usb device high speed for designware
> peripheral.
> 
> Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
> Signed-off-by: Amit Virdi <amit.virdi@st.com>
> ---
>  drivers/usb/gadget/designware_udc.c |   13 +++++++++----
>  include/usb/designware_udc.h        |    3 +++
>  2 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/gadget/designware_udc.c
> b/drivers/usb/gadget/designware_udc.c index 3c20f3d..d4b53a2 100644
> --- a/drivers/usb/gadget/designware_udc.c
> +++ b/drivers/usb/gadget/designware_udc.c
> @@ -566,7 +566,7 @@ int udc_init(void)
>  	writel(~0x0, &udc_regs_p->dev_int_mask);
>  	writel(~0x0, &udc_regs_p->endp_int_mask);
> 
> -	writel(DEV_CONF_FS_SPEED | DEV_CONF_REMWAKEUP | DEV_CONF_SELFPOW |
> +	writel(DEV_CONF_HS_SPEED | DEV_CONF_REMWAKEUP | DEV_CONF_SELFPOW |
>  	       DEV_CONF_PHYINT_16, &udc_regs_p->dev_conf);

Won't this break anything?
> 
>  	writel(DEV_CNTL_SOFTDISCONNECT, &udc_regs_p->dev_cntl);
> @@ -577,6 +577,11 @@ int udc_init(void)
>  	return 0;
>  }
> 
> +int is_usbd_high_speed(void)
> +{
> +	return (readl(&udc_regs_p->dev_stat) & DEV_STAT_ENUM) ? 0 : 1;
> +}
> +
>  /*
>   * udc_setup_ep - setup endpoint
>   * Associate a physical endpoint with endpoint_instance
> @@ -792,7 +797,7 @@ void udc_startup_events(struct usb_device_instance
> *device) /*
>   * Plug detection interrupt handling
>   */
> -void dw_udc_plug_irq(void)
> +static void dw_udc_plug_irq(void)

This staticisation stuff should go in a separate patch please.

>  {
>  	if (readl(&plug_regs_p->plug_state) & PLUG_STATUS_ATTACHED) {
>  		/*
> @@ -816,7 +821,7 @@ void dw_udc_plug_irq(void)
>  /*
>   * Device interrupt handling
>   */
> -void dw_udc_dev_irq(void)
> +static void dw_udc_dev_irq(void)
>  {
>  	if (readl(&udc_regs_p->dev_int) & DEV_INT_USBRESET) {
>  		writel(~0x0, &udc_regs_p->endp_int_mask);
> @@ -886,7 +891,7 @@ void dw_udc_dev_irq(void)
>  /*
>   * Endpoint interrupt handling
>   */
> -void dw_udc_endpoint_irq(void)
> +static void dw_udc_endpoint_irq(void)
>  {
>  	while (readl(&udc_regs_p->endp_int) & ENDP0_INT_CTRLOUT) {
> 
> diff --git a/include/usb/designware_udc.h b/include/usb/designware_udc.h
> index ae98e8c..8d48ae9 100644
> --- a/include/usb/designware_udc.h
> +++ b/include/usb/designware_udc.h
> @@ -197,6 +197,9 @@ struct udcfifo_regs {
>  #define  UDC_INT_PACKET_SIZE		64
>  #define  UDC_OUT_ENDPOINT		2
>  #define  UDC_BULK_PACKET_SIZE		64
> +#if defined(CONFIG_USBD_HS)
> +#define  UDC_BULK_HS_PACKET_SIZE	512
> +#endif

You can define this without the ifdef

>  #define  UDC_IN_ENDPOINT		3
>  #define  UDC_OUT_PACKET_SIZE		64
>  #define  UDC_IN_PACKET_SIZE		64

Best regards,
Marek Vasut
Amit Virdi - March 6, 2012, 5:44 a.m.
Dear Marek,

On 3/5/2012 11:45 PM, Marek Vasut wrote:
> Dear Amit Virdi,
>
>> From: Vipin KUMAR<vipin.kumar@st.com>
>>
>> This patch adds the support for usb device high speed for designware
>> peripheral.
>>
>> Signed-off-by: Vipin Kumar<vipin.kumar@st.com>
>> Signed-off-by: Amit Virdi<amit.virdi@st.com>
>> ---
>>   drivers/usb/gadget/designware_udc.c |   13 +++++++++----
>>   include/usb/designware_udc.h        |    3 +++
>>   2 files changed, 12 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/designware_udc.c
>> b/drivers/usb/gadget/designware_udc.c index 3c20f3d..d4b53a2 100644
>> --- a/drivers/usb/gadget/designware_udc.c
>> +++ b/drivers/usb/gadget/designware_udc.c
>> @@ -566,7 +566,7 @@ int udc_init(void)
>>   	writel(~0x0,&udc_regs_p->dev_int_mask);
>>   	writel(~0x0,&udc_regs_p->endp_int_mask);
>>
>> -	writel(DEV_CONF_FS_SPEED | DEV_CONF_REMWAKEUP | DEV_CONF_SELFPOW |
>> +	writel(DEV_CONF_HS_SPEED | DEV_CONF_REMWAKEUP | DEV_CONF_SELFPOW |
>>   	       DEV_CONF_PHYINT_16,&udc_regs_p->dev_conf);
>
> Won't this break anything?

You're right. Perhaps, it's better to configure FS only if the FS is 
configured. I'll amend this part.

>>
>>   	writel(DEV_CNTL_SOFTDISCONNECT,&udc_regs_p->dev_cntl);
>> @@ -577,6 +577,11 @@ int udc_init(void)
>>   	return 0;
>>   }
>>
>> +int is_usbd_high_speed(void)
>> +{
>> +	return (readl(&udc_regs_p->dev_stat)&  DEV_STAT_ENUM) ? 0 : 1;
>> +}
>> +
>>   /*
>>    * udc_setup_ep - setup endpoint
>>    * Associate a physical endpoint with endpoint_instance
>> @@ -792,7 +797,7 @@ void udc_startup_events(struct usb_device_instance
>> *device) /*
>>    * Plug detection interrupt handling
>>    */
>> -void dw_udc_plug_irq(void)
>> +static void dw_udc_plug_irq(void)
>
> This staticisation stuff should go in a separate patch please.
>

Ok.

>>   {
>>   	if (readl(&plug_regs_p->plug_state)&  PLUG_STATUS_ATTACHED) {
>>   		/*
>> @@ -816,7 +821,7 @@ void dw_udc_plug_irq(void)
>>   /*
>>    * Device interrupt handling
>>    */
>> -void dw_udc_dev_irq(void)
>> +static void dw_udc_dev_irq(void)
>>   {
>>   	if (readl(&udc_regs_p->dev_int)&  DEV_INT_USBRESET) {
>>   		writel(~0x0,&udc_regs_p->endp_int_mask);
>> @@ -886,7 +891,7 @@ void dw_udc_dev_irq(void)
>>   /*
>>    * Endpoint interrupt handling
>>    */
>> -void dw_udc_endpoint_irq(void)
>> +static void dw_udc_endpoint_irq(void)
>>   {
>>   	while (readl(&udc_regs_p->endp_int)&  ENDP0_INT_CTRLOUT) {
>>
>> diff --git a/include/usb/designware_udc.h b/include/usb/designware_udc.h
>> index ae98e8c..8d48ae9 100644
>> --- a/include/usb/designware_udc.h
>> +++ b/include/usb/designware_udc.h
>> @@ -197,6 +197,9 @@ struct udcfifo_regs {
>>   #define  UDC_INT_PACKET_SIZE		64
>>   #define  UDC_OUT_ENDPOINT		2
>>   #define  UDC_BULK_PACKET_SIZE		64
>> +#if defined(CONFIG_USBD_HS)
>> +#define  UDC_BULK_HS_PACKET_SIZE	512
>> +#endif
>
> You can define this without the ifdef
>

Ok.

>>   #define  UDC_IN_ENDPOINT		3
>>   #define  UDC_OUT_PACKET_SIZE		64
>>   #define  UDC_IN_PACKET_SIZE		64
>

Thanks for reviewing.

Best Regards
Amit Virdi

Patch

diff --git a/drivers/usb/gadget/designware_udc.c b/drivers/usb/gadget/designware_udc.c
index 3c20f3d..d4b53a2 100644
--- a/drivers/usb/gadget/designware_udc.c
+++ b/drivers/usb/gadget/designware_udc.c
@@ -566,7 +566,7 @@  int udc_init(void)
 	writel(~0x0, &udc_regs_p->dev_int_mask);
 	writel(~0x0, &udc_regs_p->endp_int_mask);
 
-	writel(DEV_CONF_FS_SPEED | DEV_CONF_REMWAKEUP | DEV_CONF_SELFPOW |
+	writel(DEV_CONF_HS_SPEED | DEV_CONF_REMWAKEUP | DEV_CONF_SELFPOW |
 	       DEV_CONF_PHYINT_16, &udc_regs_p->dev_conf);
 
 	writel(DEV_CNTL_SOFTDISCONNECT, &udc_regs_p->dev_cntl);
@@ -577,6 +577,11 @@  int udc_init(void)
 	return 0;
 }
 
+int is_usbd_high_speed(void)
+{
+	return (readl(&udc_regs_p->dev_stat) & DEV_STAT_ENUM) ? 0 : 1;
+}
+
 /*
  * udc_setup_ep - setup endpoint
  * Associate a physical endpoint with endpoint_instance
@@ -792,7 +797,7 @@  void udc_startup_events(struct usb_device_instance *device)
 /*
  * Plug detection interrupt handling
  */
-void dw_udc_plug_irq(void)
+static void dw_udc_plug_irq(void)
 {
 	if (readl(&plug_regs_p->plug_state) & PLUG_STATUS_ATTACHED) {
 		/*
@@ -816,7 +821,7 @@  void dw_udc_plug_irq(void)
 /*
  * Device interrupt handling
  */
-void dw_udc_dev_irq(void)
+static void dw_udc_dev_irq(void)
 {
 	if (readl(&udc_regs_p->dev_int) & DEV_INT_USBRESET) {
 		writel(~0x0, &udc_regs_p->endp_int_mask);
@@ -886,7 +891,7 @@  void dw_udc_dev_irq(void)
 /*
  * Endpoint interrupt handling
  */
-void dw_udc_endpoint_irq(void)
+static void dw_udc_endpoint_irq(void)
 {
 	while (readl(&udc_regs_p->endp_int) & ENDP0_INT_CTRLOUT) {
 
diff --git a/include/usb/designware_udc.h b/include/usb/designware_udc.h
index ae98e8c..8d48ae9 100644
--- a/include/usb/designware_udc.h
+++ b/include/usb/designware_udc.h
@@ -197,6 +197,9 @@  struct udcfifo_regs {
 #define  UDC_INT_PACKET_SIZE		64
 #define  UDC_OUT_ENDPOINT		2
 #define  UDC_BULK_PACKET_SIZE		64
+#if defined(CONFIG_USBD_HS)
+#define  UDC_BULK_HS_PACKET_SIZE	512
+#endif
 #define  UDC_IN_ENDPOINT		3
 #define  UDC_OUT_PACKET_SIZE		64
 #define  UDC_IN_PACKET_SIZE		64