Re: [U-Boot] [PATCH v2 1/3] usb, dfu: extract flush code into seperate function

2014-03-18 Thread Heiko Schocher

Hello Marek,

Am 18.03.2014 01:21, schrieb Marek Vasut:

On Monday, March 17, 2014 at 11:56:16 AM, Heiko Schocher wrote:

move the flushing code into an extra function dfu_flush(),
so it can be used from other code.

Signed-off-by: Heiko Schocherh...@denx.de
Cc: Lukasz Majewskil.majew...@samsung.com
Cc: Kyungmin Parkkyungmin.p...@samsung.com
Cc: Marek Vasutma...@denx.de
Cc: Pantelis Antonioupa...@antoniou-consulting.com


[...]


@@ -199,23 +221,7 @@ int dfu_write(struct dfu_entity *dfu, void *buf, int
size, int blk_seq_num)

/* end? */
if (size == 0) {
-   /* Now try and flush to the medium if needed. */
-   if (dfu-flush_medium)
-   ret = dfu-flush_medium(dfu);
-   printf(\nDFU complete CRC32: 0x%08x\n, dfu-crc);
-
-   /* clear everything */
-   dfu_free_buf();
-   dfu-crc = 0;
-   dfu-offset = 0;
-   dfu-i_blk_seq_num = 0;
-   dfu-i_buf_start = dfu_buf;
-   dfu-i_buf_end = dfu_buf;
-   dfu-i_buf = dfu-i_buf_start;
-
-   dfu-inited = 0;
-
-   }
+   ret = dfu_flush(dfu, buf, size, blk_seq_num);


This seems broken, at least because you didn't close the opened brace (see 'if
(size == 0) {'  I can fix this up when applying.


Argh... you are right  patch 2/3 of this series deletes the
complete if ... I can send a new version, but if you want to fix
it that would be great!


Do you want this in 2014.04 or in -next ?


Hmm.. 2014.04 would be nice, but I think this is Lukasz decision,
because I changed the dfu state machine, and maybe he want to see
more tests?

bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/3] usb, dfu: extract flush code into seperate function

2014-03-18 Thread Lukasz Majewski
Hi Marek,

 On Monday, March 17, 2014 at 11:56:16 AM, Heiko Schocher wrote:
  move the flushing code into an extra function dfu_flush(),
  so it can be used from other code.
  
  Signed-off-by: Heiko Schocher h...@denx.de
  Cc: Lukasz Majewski l.majew...@samsung.com
  Cc: Kyungmin Park kyungmin.p...@samsung.com
  Cc: Marek Vasut ma...@denx.de
  Cc: Pantelis Antoniou pa...@antoniou-consulting.com
 
 [...]
 
  @@ -199,23 +221,7 @@ int dfu_write(struct dfu_entity *dfu, void
  *buf, int size, int blk_seq_num)
  
  /* end? */
  if (size == 0) {
  -   /* Now try and flush to the medium if needed. */
  -   if (dfu-flush_medium)
  -   ret = dfu-flush_medium(dfu);
  -   printf(\nDFU complete CRC32: 0x%08x\n, dfu-crc);
  -
  -   /* clear everything */
  -   dfu_free_buf();
  -   dfu-crc = 0;
  -   dfu-offset = 0;
  -   dfu-i_blk_seq_num = 0;
  -   dfu-i_buf_start = dfu_buf;
  -   dfu-i_buf_end = dfu_buf;
  -   dfu-i_buf = dfu-i_buf_start;
  -
  -   dfu-inited = 0;
  -
  -   }
  +   ret = dfu_flush(dfu, buf, size, blk_seq_num);
 
 This seems broken, at least because you didn't close the opened brace
 (see 'if (size == 0) {'  I can fix this up when applying.
 

I was prepared to pull those patches to u-boot-dfu repo today and test
them :-).

Afterwards, I would send PR to Tom.

Are you OK with this?

 Do you want this in 2014.04 or in -next ?

After testing I would go for 2014.04, if Tom doesn't mind. All in all
it fixes the DFU state machine - by adding missing states. Up till
now we had short cut in the DFU state machine.

 
 [...]
 
 Best regards,
 Marek Vasut



-- 
Best regards,

Lukasz Majewski

Samsung RD 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 v2 1/3] usb, dfu: extract flush code into seperate function

2014-03-18 Thread Lukasz Majewski
Hi Heiko,

 Hello Marek,
 
 Am 18.03.2014 01:21, schrieb Marek Vasut:
  On Monday, March 17, 2014 at 11:56:16 AM, Heiko Schocher wrote:
  move the flushing code into an extra function dfu_flush(),
  so it can be used from other code.
 
  Signed-off-by: Heiko Schocherh...@denx.de
  Cc: Lukasz Majewskil.majew...@samsung.com
  Cc: Kyungmin Parkkyungmin.p...@samsung.com
  Cc: Marek Vasutma...@denx.de
  Cc: Pantelis Antonioupa...@antoniou-consulting.com
 
  [...]
 
  @@ -199,23 +221,7 @@ int dfu_write(struct dfu_entity *dfu, void
  *buf, int size, int blk_seq_num)
 
 /* end? */
 if (size == 0) {
  -  /* Now try and flush to the medium if needed. */
  -  if (dfu-flush_medium)
  -  ret = dfu-flush_medium(dfu);
  -  printf(\nDFU complete CRC32: 0x%08x\n,
  dfu-crc); -
  -  /* clear everything */
  -  dfu_free_buf();
  -  dfu-crc = 0;
  -  dfu-offset = 0;
  -  dfu-i_blk_seq_num = 0;
  -  dfu-i_buf_start = dfu_buf;
  -  dfu-i_buf_end = dfu_buf;
  -  dfu-i_buf = dfu-i_buf_start;
  -
  -  dfu-inited = 0;
  -
  -  }
  +  ret = dfu_flush(dfu, buf, size, blk_seq_num);
 
  This seems broken, at least because you didn't close the opened
  brace (see 'if (size == 0) {'  I can fix this up when applying.
 
 Argh... you are right  patch 2/3 of this series deletes the
 complete if ... I can send a new version, but if you want to fix
 it that would be great!

In this case, please prepare v3.

 
  Do you want this in 2014.04 or in -next ?
 
 Hmm.. 2014.04 would be nice, but I think this is Lukasz decision,
 because I changed the dfu state machine, and maybe he want to see
 more tests?

When you send the v3, I will test it for regression and then I will
prepare pull request to Tom for v2014.04.

Those patches will be added to u-boot-dfu repository.

 
 bye,
 Heiko


-- 
Best regards,

Lukasz Majewski

Samsung RD 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 v2 1/3] usb, dfu: extract flush code into seperate function

2014-03-18 Thread Marek Vasut
On Tuesday, March 18, 2014 at 07:55:04 AM, Lukasz Majewski wrote:
 Hi Heiko,
 
  Hello Marek,
  
  Am 18.03.2014 01:21, schrieb Marek Vasut:
   On Monday, March 17, 2014 at 11:56:16 AM, Heiko Schocher wrote:
   move the flushing code into an extra function dfu_flush(),
   so it can be used from other code.
   
   Signed-off-by: Heiko Schocherh...@denx.de
   Cc: Lukasz Majewskil.majew...@samsung.com
   Cc: Kyungmin Parkkyungmin.p...@samsung.com
   Cc: Marek Vasutma...@denx.de
   Cc: Pantelis Antonioupa...@antoniou-consulting.com
   
   [...]
   
   @@ -199,23 +221,7 @@ int dfu_write(struct dfu_entity *dfu, void
   *buf, int size, int blk_seq_num)
   
/* end? */
if (size == 0) {
   
   -/* Now try and flush to the medium if needed. */
   -if (dfu-flush_medium)
   -ret = dfu-flush_medium(dfu);
   -printf(\nDFU complete CRC32: 0x%08x\n,
   dfu-crc); -
   -/* clear everything */
   -dfu_free_buf();
   -dfu-crc = 0;
   -dfu-offset = 0;
   -dfu-i_blk_seq_num = 0;
   -dfu-i_buf_start = dfu_buf;
   -dfu-i_buf_end = dfu_buf;
   -dfu-i_buf = dfu-i_buf_start;
   -
   -dfu-inited = 0;
   -
   -}
   +ret = dfu_flush(dfu, buf, size, blk_seq_num);
   
   This seems broken, at least because you didn't close the opened
   brace (see 'if (size == 0) {'  I can fix this up when applying.
  
  Argh... you are right  patch 2/3 of this series deletes the
  complete if ... I can send a new version, but if you want to fix
  it that would be great!
 
 In this case, please prepare v3.
 
   Do you want this in 2014.04 or in -next ?
  
  Hmm.. 2014.04 would be nice, but I think this is Lukasz decision,
  because I changed the dfu state machine, and maybe he want to see
  more tests?
 
 When you send the v3, I will test it for regression and then I will
 prepare pull request to Tom for v2014.04.
 
 Those patches will be added to u-boot-dfu repository.

Feel free to test u-boot-usb/master please.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/3] usb, dfu: extract flush code into seperate function

2014-03-18 Thread Marek Vasut
On Tuesday, March 18, 2014 at 07:02:59 AM, Heiko Schocher wrote:
 Hello Marek,
 
 Am 18.03.2014 01:21, schrieb Marek Vasut:
  On Monday, March 17, 2014 at 11:56:16 AM, Heiko Schocher wrote:
  move the flushing code into an extra function dfu_flush(),
  so it can be used from other code.
  
  Signed-off-by: Heiko Schocherh...@denx.de
  Cc: Lukasz Majewskil.majew...@samsung.com
  Cc: Kyungmin Parkkyungmin.p...@samsung.com
  Cc: Marek Vasutma...@denx.de
  Cc: Pantelis Antonioupa...@antoniou-consulting.com
  
  [...]
  
  @@ -199,23 +221,7 @@ int dfu_write(struct dfu_entity *dfu, void *buf,
  int size, int blk_seq_num)
  
 /* end? */
 if (size == 0) {
  
  -  /* Now try and flush to the medium if needed. */
  -  if (dfu-flush_medium)
  -  ret = dfu-flush_medium(dfu);
  -  printf(\nDFU complete CRC32: 0x%08x\n, dfu-crc);
  -
  -  /* clear everything */
  -  dfu_free_buf();
  -  dfu-crc = 0;
  -  dfu-offset = 0;
  -  dfu-i_blk_seq_num = 0;
  -  dfu-i_buf_start = dfu_buf;
  -  dfu-i_buf_end = dfu_buf;
  -  dfu-i_buf = dfu-i_buf_start;
  -
  -  dfu-inited = 0;
  -
  -  }
  +  ret = dfu_flush(dfu, buf, size, blk_seq_num);
  
  This seems broken, at least because you didn't close the opened brace
  (see 'if (size == 0) {'  I can fix this up when applying.
 
 Argh... you are right  patch 2/3 of this series deletes the
 complete if ... I can send a new version, but if you want to fix
 it that would be great!

OK, fixed up.

  Do you want this in 2014.04 or in -next ?
 
 Hmm.. 2014.04 would be nice, but I think this is Lukasz decision,
 because I changed the dfu state machine, and maybe he want to see
 more tests?

OK, let's see.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/3] usb, dfu: extract flush code into seperate function

2014-03-18 Thread Marek Vasut
On Tuesday, March 18, 2014 at 07:51:05 AM, Lukasz Majewski wrote:
 Hi Marek,
 
  On Monday, March 17, 2014 at 11:56:16 AM, Heiko Schocher wrote:
   move the flushing code into an extra function dfu_flush(),
   so it can be used from other code.
   
   Signed-off-by: Heiko Schocher h...@denx.de
   Cc: Lukasz Majewski l.majew...@samsung.com
   Cc: Kyungmin Park kyungmin.p...@samsung.com
   Cc: Marek Vasut ma...@denx.de
   Cc: Pantelis Antoniou pa...@antoniou-consulting.com
  
  [...]
  
   @@ -199,23 +221,7 @@ int dfu_write(struct dfu_entity *dfu, void
   *buf, int size, int blk_seq_num)
   
 /* end? */
 if (size == 0) {
   
   - /* Now try and flush to the medium if needed. */
   - if (dfu-flush_medium)
   - ret = dfu-flush_medium(dfu);
   - printf(\nDFU complete CRC32: 0x%08x\n, dfu-crc);
   -
   - /* clear everything */
   - dfu_free_buf();
   - dfu-crc = 0;
   - dfu-offset = 0;
   - dfu-i_blk_seq_num = 0;
   - dfu-i_buf_start = dfu_buf;
   - dfu-i_buf_end = dfu_buf;
   - dfu-i_buf = dfu-i_buf_start;
   -
   - dfu-inited = 0;
   -
   - }
   + ret = dfu_flush(dfu, buf, size, blk_seq_num);
  
  This seems broken, at least because you didn't close the opened brace
  (see 'if (size == 0) {'  I can fix this up when applying.
 
 I was prepared to pull those patches to u-boot-dfu repo today and test
 them :-).
 
 Afterwards, I would send PR to Tom.
 
 Are you OK with this?

Doesn't -dfu go through -usb ? ;-) Or do you want to send to Tom directly ? 
Either way WFM. Nonetheless, I picked the patches via -usb, they're in master 
now.

  Do you want this in 2014.04 or in -next ?
 
 After testing I would go for 2014.04, if Tom doesn't mind. All in all
 it fixes the DFU state machine - by adding missing states. Up till
 now we had short cut in the DFU state machine.

OK

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/3] usb, dfu: extract flush code into seperate function

2014-03-18 Thread Lukasz Majewski
Hi Marek,

 On Tuesday, March 18, 2014 at 07:51:05 AM, Lukasz Majewski wrote:
  Hi Marek,
  
   On Monday, March 17, 2014 at 11:56:16 AM, Heiko Schocher wrote:
move the flushing code into an extra function dfu_flush(),
so it can be used from other code.

Signed-off-by: Heiko Schocher h...@denx.de
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Marek Vasut ma...@denx.de
Cc: Pantelis Antoniou pa...@antoniou-consulting.com
   
   [...]
   
@@ -199,23 +221,7 @@ int dfu_write(struct dfu_entity *dfu, void
*buf, int size, int blk_seq_num)

/* end? */
if (size == 0) {

-   /* Now try and flush to the medium if needed.
*/
-   if (dfu-flush_medium)
-   ret = dfu-flush_medium(dfu);
-   printf(\nDFU complete CRC32: 0x%08x\n,
dfu-crc); -
-   /* clear everything */
-   dfu_free_buf();
-   dfu-crc = 0;
-   dfu-offset = 0;
-   dfu-i_blk_seq_num = 0;
-   dfu-i_buf_start = dfu_buf;
-   dfu-i_buf_end = dfu_buf;
-   dfu-i_buf = dfu-i_buf_start;
-
-   dfu-inited = 0;
-
-   }
+   ret = dfu_flush(dfu, buf, size, blk_seq_num);
   
   This seems broken, at least because you didn't close the opened
   brace (see 'if (size == 0) {'  I can fix this up when
   applying.
  
  I was prepared to pull those patches to u-boot-dfu repo today and
  test them :-).
  
  Afterwards, I would send PR to Tom.
  
  Are you OK with this?
 
 Doesn't -dfu go through -usb ? ;-) 

As fair as I remember the dfu code from ./drivers/dfu/* shall go via
u-boot-dfu tree directly to Tom.

 Or do you want to send to Tom
 directly ? Either way WFM.

After writing the other message you waited for a response less than one
minute :-).

 Nonetheless, I picked the patches via
 -usb, they're in master now.

I've just tested them and they doesn't cause any regression.

Would you be so kind and apply one more patch, which was supposed to
go with u-boot-dfu PR (this patch waits for submission from 21.02.2014)?

http://patchwork.ozlabs.org/patch/322450/

It is solely drivers/dfu/dfu_mmc.c related.

And I don't want to send PR to Tom with only one patch included.

 
   Do you want this in 2014.04 or in -next ?
  
  After testing I would go for 2014.04, if Tom doesn't mind. All in
  all it fixes the DFU state machine - by adding missing states. Up
  till now we had short cut in the DFU state machine.
 
 OK
 
 Best regards,
 Marek Vasut



-- 
Best regards,

Lukasz Majewski

Samsung RD 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 v2 1/3] usb, dfu: extract flush code into seperate function

2014-03-18 Thread Marek Vasut
On Tuesday, March 18, 2014 at 01:35:47 PM, Lukasz Majewski wrote:
 Hi Marek,
 
  On Tuesday, March 18, 2014 at 07:51:05 AM, Lukasz Majewski wrote:
   Hi Marek,
   
On Monday, March 17, 2014 at 11:56:16 AM, Heiko Schocher wrote:
 move the flushing code into an extra function dfu_flush(),
 so it can be used from other code.
 
 Signed-off-by: Heiko Schocher h...@denx.de
 Cc: Lukasz Majewski l.majew...@samsung.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Marek Vasut ma...@denx.de
 Cc: Pantelis Antoniou pa...@antoniou-consulting.com

[...]

 @@ -199,23 +221,7 @@ int dfu_write(struct dfu_entity *dfu, void
 *buf, int size, int blk_seq_num)
 
   /* end? */
   if (size == 0) {
 
 - /* Now try and flush to the medium if needed.
 */
 - if (dfu-flush_medium)
 - ret = dfu-flush_medium(dfu);
 - printf(\nDFU complete CRC32: 0x%08x\n,
 dfu-crc); -
 - /* clear everything */
 - dfu_free_buf();
 - dfu-crc = 0;
 - dfu-offset = 0;
 - dfu-i_blk_seq_num = 0;
 - dfu-i_buf_start = dfu_buf;
 - dfu-i_buf_end = dfu_buf;
 - dfu-i_buf = dfu-i_buf_start;
 -
 - dfu-inited = 0;
 -
 - }
 + ret = dfu_flush(dfu, buf, size, blk_seq_num);

This seems broken, at least because you didn't close the opened
brace (see 'if (size == 0) {'  I can fix this up when
applying.
   
   I was prepared to pull those patches to u-boot-dfu repo today and
   test them :-).
   
   Afterwards, I would send PR to Tom.
   
   Are you OK with this?
  
  Doesn't -dfu go through -usb ? ;-)
 
 As fair as I remember the dfu code from ./drivers/dfu/* shall go via
 u-boot-dfu tree directly to Tom.
 
  Or do you want to send to Tom
  directly ? Either way WFM.
 
 After writing the other message you waited for a response less than one
 minute :-).
 
  Nonetheless, I picked the patches via
  -usb, they're in master now.
 
 I've just tested them and they doesn't cause any regression.
 
 Would you be so kind and apply one more patch, which was supposed to
 go with u-boot-dfu PR (this patch waits for submission from 21.02.2014)?
 
 http://patchwork.ozlabs.org/patch/322450/

OK, picked and pushed. I think panto picked it up as well tho, but maybe I 
unleashed too much mental terror unto him with my OvisLink WL-1100SD that he is 
paralyzed by it ;-) Panto, I will pick this patch, OK ?

As for the DFU, what do we do about the PRs ? DFU is part of USB, so I shall 
logically pick the PRs from you and move them to trini, but if you're unhappy 
about this, we need to talk about that. Tom, Lukasz ... thoughts ?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/3] usb, dfu: extract flush code into seperate function

2014-03-18 Thread Lukasz Majewski
Hi Marek,

 On Tuesday, March 18, 2014 at 01:35:47 PM, Lukasz Majewski wrote:
  Hi Marek,
  
   On Tuesday, March 18, 2014 at 07:51:05 AM, Lukasz Majewski wrote:
Hi Marek,

 On Monday, March 17, 2014 at 11:56:16 AM, Heiko Schocher
 wrote:
  move the flushing code into an extra function dfu_flush(),
  so it can be used from other code.
  
  Signed-off-by: Heiko Schocher h...@denx.de
  Cc: Lukasz Majewski l.majew...@samsung.com
  Cc: Kyungmin Park kyungmin.p...@samsung.com
  Cc: Marek Vasut ma...@denx.de
  Cc: Pantelis Antoniou pa...@antoniou-consulting.com
 
 [...]
 
  @@ -199,23 +221,7 @@ int dfu_write(struct dfu_entity *dfu,
  void *buf, int size, int blk_seq_num)
  
  /* end? */
  if (size == 0) {
  
  -   /* Now try and flush to the medium if
  needed. */
  -   if (dfu-flush_medium)
  -   ret = dfu-flush_medium(dfu);
  -   printf(\nDFU complete CRC32: 0x%08x\n,
  dfu-crc); -
  -   /* clear everything */
  -   dfu_free_buf();
  -   dfu-crc = 0;
  -   dfu-offset = 0;
  -   dfu-i_blk_seq_num = 0;
  -   dfu-i_buf_start = dfu_buf;
  -   dfu-i_buf_end = dfu_buf;
  -   dfu-i_buf = dfu-i_buf_start;
  -
  -   dfu-inited = 0;
  -
  -   }
  +   ret = dfu_flush(dfu, buf, size,
  blk_seq_num);
 
 This seems broken, at least because you didn't close the
 opened brace (see 'if (size == 0) {'  I can fix this up
 when applying.

I was prepared to pull those patches to u-boot-dfu repo today
and test them :-).

Afterwards, I would send PR to Tom.

Are you OK with this?
   
   Doesn't -dfu go through -usb ? ;-)
  
  As fair as I remember the dfu code from ./drivers/dfu/* shall go via
  u-boot-dfu tree directly to Tom.
  
   Or do you want to send to Tom
   directly ? Either way WFM.
  
  After writing the other message you waited for a response less than
  one minute :-).
  
   Nonetheless, I picked the patches via
   -usb, they're in master now.
  
  I've just tested them and they doesn't cause any regression.
  
  Would you be so kind and apply one more patch, which was supposed to
  go with u-boot-dfu PR (this patch waits for submission from
  21.02.2014)?
  
  http://patchwork.ozlabs.org/patch/322450/
 
 OK, picked and pushed. I think panto picked it up as well tho, but
 maybe I unleashed too much mental terror unto him with my OvisLink
 WL-1100SD that he is paralyzed by it ;-) Panto, I will pick this
 patch, OK ?

This patch looks like a little orphan :-). I'm glad that someone pull
it finally.

 
 As for the DFU, what do we do about the PRs ? DFU is part of USB, so
 I shall logically pick the PRs from you and move them to trini, but
 if you're unhappy about this, we need to talk about that. Tom,
 Lukasz ... thoughts ?

I'm fine with sending PRs to you.


-- 
Best regards,

Lukasz Majewski

Samsung RD 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 v2 1/3] usb, dfu: extract flush code into seperate function

2014-03-18 Thread Marek Vasut
On Tuesday, March 18, 2014 at 04:53:30 PM, Lukasz Majewski wrote:
 Hi Marek,
 
  On Tuesday, March 18, 2014 at 01:35:47 PM, Lukasz Majewski wrote:
   Hi Marek,
   
On Tuesday, March 18, 2014 at 07:51:05 AM, Lukasz Majewski wrote:
 Hi Marek,
 
  On Monday, March 17, 2014 at 11:56:16 AM, Heiko Schocher
  
  wrote:
   move the flushing code into an extra function dfu_flush(),
   so it can be used from other code.
   
   Signed-off-by: Heiko Schocher h...@denx.de
   Cc: Lukasz Majewski l.majew...@samsung.com
   Cc: Kyungmin Park kyungmin.p...@samsung.com
   Cc: Marek Vasut ma...@denx.de
   Cc: Pantelis Antoniou pa...@antoniou-consulting.com
  
  [...]
  
   @@ -199,23 +221,7 @@ int dfu_write(struct dfu_entity *dfu,
   void *buf, int size, int blk_seq_num)
   
 /* end? */
 if (size == 0) {
   
   - /* Now try and flush to the medium if
   needed. */
   - if (dfu-flush_medium)
   - ret = dfu-flush_medium(dfu);
   - printf(\nDFU complete CRC32: 0x%08x\n,
   dfu-crc); -
   - /* clear everything */
   - dfu_free_buf();
   - dfu-crc = 0;
   - dfu-offset = 0;
   - dfu-i_blk_seq_num = 0;
   - dfu-i_buf_start = dfu_buf;
   - dfu-i_buf_end = dfu_buf;
   - dfu-i_buf = dfu-i_buf_start;
   -
   - dfu-inited = 0;
   -
   - }
   + ret = dfu_flush(dfu, buf, size,
   blk_seq_num);
  
  This seems broken, at least because you didn't close the
  opened brace (see 'if (size == 0) {'  I can fix this up
  when applying.
 
 I was prepared to pull those patches to u-boot-dfu repo today
 and test them :-).
 
 Afterwards, I would send PR to Tom.
 
 Are you OK with this?

Doesn't -dfu go through -usb ? ;-)
   
   As fair as I remember the dfu code from ./drivers/dfu/* shall go via
   u-boot-dfu tree directly to Tom.
   
Or do you want to send to Tom
directly ? Either way WFM.
   
   After writing the other message you waited for a response less than
   one minute :-).
   
Nonetheless, I picked the patches via
-usb, they're in master now.
   
   I've just tested them and they doesn't cause any regression.
   
   Would you be so kind and apply one more patch, which was supposed to
   go with u-boot-dfu PR (this patch waits for submission from
   21.02.2014)?
   
   http://patchwork.ozlabs.org/patch/322450/
  
  OK, picked and pushed. I think panto picked it up as well tho, but
  maybe I unleashed too much mental terror unto him with my OvisLink
  WL-1100SD that he is paralyzed by it ;-) Panto, I will pick this
  patch, OK ?
 
 This patch looks like a little orphan :-). I'm glad that someone pull
 it finally.

OK.

  As for the DFU, what do we do about the PRs ? DFU is part of USB, so
  I shall logically pick the PRs from you and move them to trini, but
  if you're unhappy about this, we need to talk about that. Tom,
  Lukasz ... thoughts ?
 
 I'm fine with sending PRs to you.

PR will go out once I do builds.

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


[U-Boot] [PATCH v2 1/3] usb, dfu: extract flush code into seperate function

2014-03-17 Thread Heiko Schocher
move the flushing code into an extra function dfu_flush(),
so it can be used from other code.

Signed-off-by: Heiko Schocher h...@denx.de
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Marek Vasut ma...@denx.de
Cc: Pantelis Antoniou pa...@antoniou-consulting.com

---
- changes for v2
  - add comment from Marek Vasut
- move comment and if back to dfu_write()
  - add comment from Lukasz Majewski:
- remove unneccessary comment
- add Pantelis to Cc

Signed-off-by: Heiko Schocher h...@denx.de
---
 drivers/dfu/dfu.c | 40 +++-
 include/dfu.h |  1 +
 2 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 56e69fd..11401d1 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -127,6 +127,28 @@ static int dfu_write_buffer_drain(struct dfu_entity *dfu)
return ret;
 }
 
+int dfu_flush(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
+{
+   int ret = 0;
+
+   if (dfu-flush_medium)
+   ret = dfu-flush_medium(dfu);
+
+   printf(\nDFU complete CRC32: 0x%08x\n, dfu-crc);
+
+   /* clear everything */
+   dfu_free_buf();
+   dfu-crc = 0;
+   dfu-offset = 0;
+   dfu-i_blk_seq_num = 0;
+   dfu-i_buf_start = dfu_buf;
+   dfu-i_buf_end = dfu_buf;
+   dfu-i_buf = dfu-i_buf_start;
+   dfu-inited = 0;
+
+   return ret;
+}
+
 int dfu_write(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
 {
int ret = 0;
@@ -199,23 +221,7 @@ int dfu_write(struct dfu_entity *dfu, void *buf, int size, 
int blk_seq_num)
 
/* end? */
if (size == 0) {
-   /* Now try and flush to the medium if needed. */
-   if (dfu-flush_medium)
-   ret = dfu-flush_medium(dfu);
-   printf(\nDFU complete CRC32: 0x%08x\n, dfu-crc);
-
-   /* clear everything */
-   dfu_free_buf();
-   dfu-crc = 0;
-   dfu-offset = 0;
-   dfu-i_blk_seq_num = 0;
-   dfu-i_buf_start = dfu_buf;
-   dfu-i_buf_end = dfu_buf;
-   dfu-i_buf = dfu-i_buf_start;
-
-   dfu-inited = 0;
-
-   }
+   ret = dfu_flush(dfu, buf, size, blk_seq_num);
 
return ret = 0 ? size : ret;
 }
diff --git a/include/dfu.h b/include/dfu.h
index f973426..272a245 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -138,6 +138,7 @@ unsigned long dfu_get_buf_size(void);
 
 int dfu_read(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
 int dfu_write(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
+int dfu_flush(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
 /* Device specific */
 #ifdef CONFIG_DFU_MMC
 extern int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s);
-- 
1.8.3.1

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


Re: [U-Boot] [PATCH v2 1/3] usb, dfu: extract flush code into seperate function

2014-03-17 Thread Marek Vasut
On Monday, March 17, 2014 at 11:56:16 AM, Heiko Schocher wrote:
 move the flushing code into an extra function dfu_flush(),
 so it can be used from other code.
 
 Signed-off-by: Heiko Schocher h...@denx.de
 Cc: Lukasz Majewski l.majew...@samsung.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Marek Vasut ma...@denx.de
 Cc: Pantelis Antoniou pa...@antoniou-consulting.com

[...]

 @@ -199,23 +221,7 @@ int dfu_write(struct dfu_entity *dfu, void *buf, int
 size, int blk_seq_num)
 
   /* end? */
   if (size == 0) {
 - /* Now try and flush to the medium if needed. */
 - if (dfu-flush_medium)
 - ret = dfu-flush_medium(dfu);
 - printf(\nDFU complete CRC32: 0x%08x\n, dfu-crc);
 -
 - /* clear everything */
 - dfu_free_buf();
 - dfu-crc = 0;
 - dfu-offset = 0;
 - dfu-i_blk_seq_num = 0;
 - dfu-i_buf_start = dfu_buf;
 - dfu-i_buf_end = dfu_buf;
 - dfu-i_buf = dfu-i_buf_start;
 -
 - dfu-inited = 0;
 -
 - }
 + ret = dfu_flush(dfu, buf, size, blk_seq_num);

This seems broken, at least because you didn't close the opened brace (see 'if 
(size == 0) {'  I can fix this up when applying.

Do you want this in 2014.04 or in -next ?

[...]

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot