Re: [U-Boot] [PATCH 1/3] usb: ums: support multiple controllers using controller_index

2016-06-01 Thread Rajesh Bhagat


> -Original Message-
> From: Lukasz Majewski [mailto:l.majew...@samsung.com]
> Sent: Tuesday, May 31, 2016 8:22 PM
> To: Rajat Srivastava 
> Cc: u-boot@lists.denx.de; s...@chromium.org; ma...@denx.de;
> albert.u.b...@aribaud.net; prabha...@freescale.com; york sun
> ; Mingkai Hu ; Rajesh Bhagat
> ; michal.si...@xilinx.com; felipe.ba...@linux.intel.com
> Subject: Re: [PATCH 1/3] usb: ums: support multiple controllers using
> controller_index
> 
> Hi Rajat,
> 
> > From: Rajesh Bhagat 
> >
> > Adds a new field in fsg_common namely controller_index to support
> > multiple controllers usb gadget support.
> >
> > Signed-off-by: Rajat Srivastava 
> > Signed-off-by: Rajesh Bhagat 
> > ---
> >  cmd/usb_mass_storage.c  |  2 +-
> >  drivers/usb/gadget/f_mass_storage.c | 10 +-
> >  2 files changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c index
> > b05913a..1c955f8 100644
> > --- a/cmd/usb_mass_storage.c
> > +++ b/cmd/usb_mass_storage.c
> > @@ -214,7 +214,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int
> > flag, while (1) {
> > usb_gadget_handle_interrupts(controller_index);
> >
> > -   rc = fsg_main_thread(NULL);
> > +   rc = fsg_main_thread(_index);
> 

Hello Lukasz,

> controller_index is defined as unsigned int.
> 
> However, fsg_main_thread(void *common_) accepts void * as its parameter.
> 
> Could you adjust it to accept unsigned int index parameter?
> 

Will take care in v2. 

> > if (rc) {
> > /* Check I/O error */
> > if (rc == -EIO)
> > diff --git a/drivers/usb/gadget/f_mass_storage.c
> > b/drivers/usb/gadget/f_mass_storage.c index 1ecb92a..cc3e4af 100644
> > --- a/drivers/usb/gadget/f_mass_storage.c
> > +++ b/drivers/usb/gadget/f_mass_storage.c
> > @@ -362,6 +362,7 @@ struct fsg_common {
> > char inquiry_string[8 + 16 + 4 + 1];
> >
> > struct kref ref;
> > +   unsigned int controller_index;
> >  };
> >
> >  struct fsg_config {
> > @@ -691,7 +692,7 @@ static int sleep_thread(struct fsg_common *common)
> > k = 0;
> > }
> >
> > -   usb_gadget_handle_interrupts(0);
> > +
> > usb_gadget_handle_interrupts(common->controller_index); }
> > common->thread_wakeup_needed = 0;
> > return rc;
> > @@ -2406,6 +2407,11 @@ int fsg_main_thread(void *common_)  {
> > int ret;
> > struct fsg_common   *common = the_fsg_common;
> > +
> > +   /* update the controller_index */
> > +   if (common_)
> 
> Replace common_ with unsigned int index
> 

Will take care in v2.

> > +   common->controller_index = *(unsigned int *)common_;
> > +
> > /* The main loop */
> > do {
> > if (exception_in_progress(common)) { @@ -2476,6 +2482,7 @@ 
> > static
> > struct fsg_common *fsg_common_init(struct fsg_common *common,
> > common->ops = NULL;
> > common->private_data = NULL;
> > +   common->controller_index = 0;
> >
> > common->gadget = gadget;
> > common->ep0 = gadget->ep0;
> > @@ -2770,6 +2777,7 @@ int fsg_add(struct usb_configuration *c)
> >
> > fsg_common->ops = NULL;
> > fsg_common->private_data = NULL;
> > +   fsg_common->controller_index = 0;
> >
> > the_fsg_common = fsg_common;
> >
> 
> 
> 
> --
> Best regards,
> 
> Lukasz Majewski
> 
> Samsung R Institute Poland (SRPOL) | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] usb: ums: support multiple controllers using controller_index

2016-05-31 Thread Lukasz Majewski
Hi Rajat,

> From: Rajesh Bhagat 
> 
> Adds a new field in fsg_common namely controller_index to support
> multiple controllers usb gadget support.
> 
> Signed-off-by: Rajat Srivastava 
> Signed-off-by: Rajesh Bhagat 
> ---
>  cmd/usb_mass_storage.c  |  2 +-
>  drivers/usb/gadget/f_mass_storage.c | 10 +-
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
> index b05913a..1c955f8 100644
> --- a/cmd/usb_mass_storage.c
> +++ b/cmd/usb_mass_storage.c
> @@ -214,7 +214,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int
> flag, while (1) {
>   usb_gadget_handle_interrupts(controller_index);
>  
> - rc = fsg_main_thread(NULL);
> + rc = fsg_main_thread(_index);

controller_index is defined as unsigned int.

However, fsg_main_thread(void *common_) accepts void * as its parameter.

Could you adjust it to accept unsigned int index parameter?

>   if (rc) {
>   /* Check I/O error */
>   if (rc == -EIO)
> diff --git a/drivers/usb/gadget/f_mass_storage.c
> b/drivers/usb/gadget/f_mass_storage.c index 1ecb92a..cc3e4af 100644
> --- a/drivers/usb/gadget/f_mass_storage.c
> +++ b/drivers/usb/gadget/f_mass_storage.c
> @@ -362,6 +362,7 @@ struct fsg_common {
>   char inquiry_string[8 + 16 + 4 + 1];
>  
>   struct kref ref;
> + unsigned int controller_index;
>  };
>  
>  struct fsg_config {
> @@ -691,7 +692,7 @@ static int sleep_thread(struct fsg_common *common)
>   k = 0;
>   }
>  
> - usb_gadget_handle_interrupts(0);
> +
> usb_gadget_handle_interrupts(common->controller_index); }
>   common->thread_wakeup_needed = 0;
>   return rc;
> @@ -2406,6 +2407,11 @@ int fsg_main_thread(void *common_)
>  {
>   int ret;
>   struct fsg_common   *common = the_fsg_common;
> +
> + /* update the controller_index */
> + if (common_)

Replace common_ with unsigned int index 

> + common->controller_index = *(unsigned int *)common_;
> +
>   /* The main loop */
>   do {
>   if (exception_in_progress(common)) {
> @@ -2476,6 +2482,7 @@ static struct fsg_common
> *fsg_common_init(struct fsg_common *common, 
>   common->ops = NULL;
>   common->private_data = NULL;
> + common->controller_index = 0;
>  
>   common->gadget = gadget;
>   common->ep0 = gadget->ep0;
> @@ -2770,6 +2777,7 @@ int fsg_add(struct usb_configuration *c)
>  
>   fsg_common->ops = NULL;
>   fsg_common->private_data = NULL;
> + fsg_common->controller_index = 0;
>  
>   the_fsg_common = fsg_common;
>  



-- 
Best regards,

Lukasz Majewski

Samsung R Institute Poland (SRPOL) | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/3] usb: ums: support multiple controllers using controller_index

2016-05-31 Thread Rajat Srivastava
From: Rajesh Bhagat 

Adds a new field in fsg_common namely controller_index to support
multiple controllers usb gadget support.

Signed-off-by: Rajat Srivastava 
Signed-off-by: Rajesh Bhagat 
---
 cmd/usb_mass_storage.c  |  2 +-
 drivers/usb/gadget/f_mass_storage.c | 10 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
index b05913a..1c955f8 100644
--- a/cmd/usb_mass_storage.c
+++ b/cmd/usb_mass_storage.c
@@ -214,7 +214,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
while (1) {
usb_gadget_handle_interrupts(controller_index);
 
-   rc = fsg_main_thread(NULL);
+   rc = fsg_main_thread(_index);
if (rc) {
/* Check I/O error */
if (rc == -EIO)
diff --git a/drivers/usb/gadget/f_mass_storage.c 
b/drivers/usb/gadget/f_mass_storage.c
index 1ecb92a..cc3e4af 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -362,6 +362,7 @@ struct fsg_common {
char inquiry_string[8 + 16 + 4 + 1];
 
struct kref ref;
+   unsigned int controller_index;
 };
 
 struct fsg_config {
@@ -691,7 +692,7 @@ static int sleep_thread(struct fsg_common *common)
k = 0;
}
 
-   usb_gadget_handle_interrupts(0);
+   usb_gadget_handle_interrupts(common->controller_index);
}
common->thread_wakeup_needed = 0;
return rc;
@@ -2406,6 +2407,11 @@ int fsg_main_thread(void *common_)
 {
int ret;
struct fsg_common   *common = the_fsg_common;
+
+   /* update the controller_index */
+   if (common_)
+   common->controller_index = *(unsigned int *)common_;
+
/* The main loop */
do {
if (exception_in_progress(common)) {
@@ -2476,6 +2482,7 @@ static struct fsg_common *fsg_common_init(struct 
fsg_common *common,
 
common->ops = NULL;
common->private_data = NULL;
+   common->controller_index = 0;
 
common->gadget = gadget;
common->ep0 = gadget->ep0;
@@ -2770,6 +2777,7 @@ int fsg_add(struct usb_configuration *c)
 
fsg_common->ops = NULL;
fsg_common->private_data = NULL;
+   fsg_common->controller_index = 0;
 
the_fsg_common = fsg_common;
 
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot