All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] usb, g_dnl: generalize DFU detach functions
Date: Thu, 11 Dec 2014 10:33:39 +0100	[thread overview]
Message-ID: <20141211103339.68bfefa9@amdc2363> (raw)
In-Reply-To: <1418244184-1356-1-git-send-email-robherring2@gmail.com>

Hi Rob,

> From: Rob Herring <robh@kernel.org>
> 
> In order to add detach functions for fastboot, make the DFU detach
> related functions common so they can be shared.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  common/cmd_dfu.c           |  6 +++---
>  drivers/dfu/dfu.c          | 16 ----------------
>  drivers/usb/gadget/f_dfu.c |  2 +-
>  drivers/usb/gadget/g_dnl.c | 17 +++++++++++++++++
>  include/dfu.h              |  3 ---
>  include/g_dnl.h            |  4 ++++
>  6 files changed, 25 insertions(+), 23 deletions(-)
> 
> diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
> index 9e020b4..e975abe 100644
> --- a/common/cmd_dfu.c
> +++ b/common/cmd_dfu.c
> @@ -38,10 +38,10 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[]) 
>  	int controller_index = simple_strtoul(usb_controller, NULL,
> 0); board_usb_init(controller_index, USB_INIT_DEVICE);
> -	dfu_clear_detach();
> +	g_dnl_clear_detach();
>  	g_dnl_register("usb_dnl_dfu");
>  	while (1) {
> -		if (dfu_detach()) {
> +		if (g_dnl_detach()) {
>  			/*
>  			 * Check if USB bus reset is performed after
> detach,
>  			 * which indicates that -R switch has been
> passed to @@ -74,7 +74,7 @@ done:
>  	if (dfu_reset)
>  		run_command("reset", 0);
>  
> -	dfu_clear_detach();
> +	g_dnl_clear_detach();
>  
>  	return ret;
>  }
> diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
> index c0aba6e..a3e3ec5 100644
> --- a/drivers/dfu/dfu.c
> +++ b/drivers/dfu/dfu.c
> @@ -17,7 +17,6 @@
>  #include <linux/list.h>
>  #include <linux/compiler.h>
>  
> -static bool dfu_detach_request;
>  static LIST_HEAD(dfu_list);
>  static int dfu_alt_num;
>  static int alt_num_cnt;
> @@ -39,21 +38,6 @@ __weak bool dfu_usb_get_reset(void)
>  	return true;
>  }
>  
> -bool dfu_detach(void)
> -{
> -	return dfu_detach_request;
> -}
> -
> -void dfu_trigger_detach(void)
> -{
> -	dfu_detach_request = true;
> -}
> -
> -void dfu_clear_detach(void)
> -{
> -	dfu_detach_request = false;
> -}
> -
>  static int dfu_find_alt_num(const char *s)
>  {
>  	int i = 0;
> diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
> index 16fc9dd..ead71eb 100644
> --- a/drivers/usb/gadget/f_dfu.c
> +++ b/drivers/usb/gadget/f_dfu.c
> @@ -366,7 +366,7 @@ static int state_dfu_idle(struct f_dfu *f_dfu,
>  		to_runtime_mode(f_dfu);
>  		f_dfu->dfu_state = DFU_STATE_appIDLE;
>  
> -		dfu_trigger_detach();
> +		g_dnl_trigger_detach();
>  		break;
>  	default:
>  		f_dfu->dfu_state = DFU_STATE_dfuERROR;
> diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
> index 25611ac..ee52a29 100644
> --- a/drivers/usb/gadget/g_dnl.c
> +++ b/drivers/usb/gadget/g_dnl.c
> @@ -163,6 +163,23 @@ __weak int g_dnl_board_usb_cable_connected(void)
>  	return -EOPNOTSUPP;
>  }
>  
> +static bool g_dnl_detach_request;
> +
> +bool g_dnl_detach(void)
> +{
> +	return g_dnl_detach_request;
> +}
> +
> +void g_dnl_trigger_detach(void)
> +{
> +	g_dnl_detach_request = true;
> +}
> +
> +void g_dnl_clear_detach(void)
> +{
> +	g_dnl_detach_request = false;
> +}
> +
>  static int g_dnl_get_bcd_device_number(struct usb_composite_dev
> *cdev) {
>  	struct usb_gadget *gadget = cdev->gadget;
> diff --git a/include/dfu.h b/include/dfu.h
> index f1a71c7..c27856c 100644
> --- a/include/dfu.h
> +++ b/include/dfu.h
> @@ -150,9 +150,6 @@ struct dfu_entity *dfu_get_entity(int alt);
>  char *dfu_extract_token(char** e, int *n);
>  void dfu_trigger_reset(void);
>  int dfu_get_alt(char *name);
> -bool dfu_detach(void);
> -void dfu_trigger_detach(void);
> -void dfu_clear_detach(void);
>  int dfu_init_env_entities(char *interface, char *devstr);
>  unsigned char *dfu_get_buf(struct dfu_entity *dfu);
>  unsigned char *dfu_free_buf(void);
> diff --git a/include/g_dnl.h b/include/g_dnl.h
> index 1b1b35e..4eeb5e4 100644
> --- a/include/g_dnl.h
> +++ b/include/g_dnl.h
> @@ -39,4 +39,8 @@ int g_dnl_register(const char *s);
>  void g_dnl_unregister(void);
>  void g_dnl_set_serialnumber(char *);
>  
> +bool g_dnl_detach(void);
> +void g_dnl_trigger_detach(void);
> +void g_dnl_clear_detach(void);
> +
>  #endif /* __G_DOWNLOAD_H_ */

Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Tested-by: Lukasz Majewski <l.majewski@samsung.com>
(Test HW: Trats2 board)

I will add this patch to u-boot-dfu tree.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

      parent reply	other threads:[~2014-12-11  9:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10 20:43 [U-Boot] [PATCH 1/2] usb, g_dnl: generalize DFU detach functions Rob Herring
2014-12-10 20:43 ` [U-Boot] [PATCH 2/2] fastboot: add support for continue command Rob Herring
2014-12-11  6:14   ` Marek Vasut
2014-12-11  9:43   ` Lukasz Majewski
2014-12-11  6:11 ` [U-Boot] [PATCH 1/2] usb, g_dnl: generalize DFU detach functions Marek Vasut
2014-12-11  9:33 ` Lukasz Majewski [this message]

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=20141211103339.68bfefa9@amdc2363 \
    --to=l.majewski@samsung.com \
    --cc=u-boot@lists.denx.de \
    /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.