Re: [U-Boot] [PATCH 2/2] usb/gadget: add the fastboot gadget

2012-01-07 Thread Mike Frysinger
On Monday 21 November 2011 09:09:35 Sebastian Andrzej Siewior wrote:
 --- a/common/Makefile
 +++ b/common/Makefile

  COBJS-y += usb.o
  COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o
  endif
 +COBJS-$(CONFIG_CMD_FASTBOOT) += cmd_fastboot.o
 +
  COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o

no newline here

 --- /dev/null
 +++ b/common/cmd_fastboot.c
 @@ -0,0 +1,28 @@
 +#include common.h
 +#include command.h
 +#include usb/fastboot.h

missing comment block with license/copyright/etc...
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] usb/gadget: add the fastboot gadget

2011-11-23 Thread Sebastian Andrzej Siewior
* Stefan Schmidt | 2011-11-21 15:48:29 [+0100]:

Hello.
Hi,

On Mon, 2011-11-21 at 15:09, Sebastian Andrzej Siewior wrote:
 This patch contains an implementation of the fastboot protocol on the
 device side and a little of documentation.
 The gadget expects the new-style gadget framework.

Which what hardware do you test this? So far I have only seen patches
(not applied yet) for the Samsung UDC controller that are providing
the usb_gadget_register_driver() functions. Consumer is only ether.c
so far.

DWC3. This one is new and already merged into the linux kernel. This one
is on my list once I have the fastboot part merged :)
There should be an at91 udc driver in the uboot-usb git tree. The last
time I checked, the at91 driver was in the next branch.

Any other hardware platforms that support the new style gadget
framework yet? Do'n get me wrong, I like it and would like to see more
drivers moving to it but I wonder what support on a hardware driver
level we have for it yet.

All drivers in u-boot are using the old style interface which is linux
from the late 2.4 time frame or very early 2.6. The dwc3 for which I
plan to have fastboot is a huge usb3 drd controller. Having two
different codebases does not make much sense.

 The gadget implements the getvar, reboot, download and reboot commands.
 What is missing is the flash handling i.e. writting the image to media.

You may have seen the DFU patches on this list recently. There is also
a split between the DFU protocol and the flashing backend. Would it
make sense to see if fastboot and DFU could use the same flashing
backend and platform specific bits?

I haven't seen it yet. From the protocol layer it is simple: You are
told to receive X bytes. Once you sucked it up are told where you have
to write it. The destination address is a partition name. So what I
planned to do is to add the android partition format which is efi/guid
based I think and then simply execute a nand write data partition
command. If there is code that can be shared between DFU and this
fastboot thingy then I'm the last person that does not want it.

regards
Stefan Schmidt

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


[U-Boot] [PATCH 2/2] usb/gadget: add the fastboot gadget

2011-11-21 Thread Sebastian Andrzej Siewior
This patch contains an implementation of the fastboot protocol on the
device side and a little of documentation.
The gadget expects the new-style gadget framework.
The gadget implements the getvar, reboot, download and reboot commands.
What is missing is the flash handling i.e. writting the image to media.

Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de
---
 common/Makefile  |2 +
 common/cmd_fastboot.c|   28 ++
 doc/README.android-fastboot  |   86 ++
 doc/README.android-fastboot-protocol |  170 ++
 drivers/usb/gadget/Makefile  |5 +
 drivers/usb/gadget/f_fastboot.c  |  559 ++
 drivers/usb/gadget/g_fastboot.h  |   20 ++
 drivers/usb/gadget/u_fastboot.c  |  308 +++
 include/usb/fastboot.h   |  100 ++
 9 files changed, 1278 insertions(+), 0 deletions(-)
 create mode 100644 common/cmd_fastboot.c
 create mode 100644 doc/README.android-fastboot
 create mode 100644 doc/README.android-fastboot-protocol
 create mode 100644 drivers/usb/gadget/f_fastboot.c
 create mode 100644 drivers/usb/gadget/g_fastboot.h
 create mode 100644 drivers/usb/gadget/u_fastboot.c
 create mode 100644 include/usb/fastboot.h

diff --git a/common/Makefile b/common/Makefile
index 1b672ad..9d6659e 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -162,6 +162,8 @@ COBJS-y += cmd_usb.o
 COBJS-y += usb.o
 COBJS-$(CONFIG_USB_STORAGE) += usb_storage.o
 endif
+COBJS-$(CONFIG_CMD_FASTBOOT) += cmd_fastboot.o
+
 COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o
 COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o
 
diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c
new file mode 100644
index 000..9a656dd
--- /dev/null
+++ b/common/cmd_fastboot.c
@@ -0,0 +1,28 @@
+#include common.h
+#include command.h
+#include usb/fastboot.h
+
+static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const 
argv[])
+{
+   int ret = 1;
+
+   if (!fastboot_init()) {
+   printf(Fastboot entered...\n);
+
+   ret = 0;
+
+   while (1) {
+   if (fastboot_poll())
+   break;
+   }
+   }
+
+   fastboot_shutdown();
+   return ret;
+}
+
+U_BOOT_CMD(
+   fastboot,   1,  1,  do_fastboot,
+   fastboot- use USB Fastboot protocol\n,
+   
+);
diff --git a/doc/README.android-fastboot b/doc/README.android-fastboot
new file mode 100644
index 000..4b2a9aa
--- /dev/null
+++ b/doc/README.android-fastboot
@@ -0,0 +1,86 @@
+Android Fastboot
+
+
+Overview
+
+The protocol that is used over USB is described in
+README.android-fastboot-protocol in same folder.
+
+The current implementation does not yet support the flash and erase
+commands.
+
+Client installation
+===
+The counterpart to this gadget is the fastboot client which can
+be found in Android's platform/system/core repository in the fastboot
+folder. It runs on Windows, Linux and even OSx. Linux user are lucky since
+they only need libusb.
+Windows users need to bring some time until they have Android SDK (currently
+http://dl.google.com/android/installer_r12-windows.exe) installed. You
+need to install ADB package which contains the required glue libraries for
+accessing USB. Also you need Google USB driver package and SDK platform
+tools. Once installed the usb driver is placed in your SDK folder under
+extras\google\usb_driver. The android_winusb.inf needs a line like
+
+   %SingleBootLoaderInterface% = USB_Install, USB\VID_0451PID_D022
+
+either in the [Google.NTx86] section for 32bit Windows or [Google.NTamd64]
+for 64bit Windows. VID and PID should match whatever the fastboot is
+advertising.
+
+Board specific
+==
+The gadget calls at probe time the function fastboot_board_init() which
+should be provided by the board to setup its specific configuration.
+It is possible here to overwrite specific strings like Vendor or Serial
+number. Strings which are not specified here will return a default value.
+This init function must also provide a memory area for the
+transfer_buffer and its size. This buffer should be large enough to hold
+whatever the download commands is willing to send or it will fail. This
+can be a kernel image for booting which could be around two MiB or a flash
+partition which could be slightly larger :)
+
+In Action
+=
+Enter into fastboot by executing the fastboot command in u-boot and you
+should see:
+|Fastboot entered...
+
+The gadget terminates once the is unplugged. On the client side you can
+fetch the product name for instance:
+|fastboot getvar product
+|product: Default Product
+|finished. total time: 0.016s
+
+or initiate a reboot:
+|fastboot reboot
+
+and once the client comes back, the board should reset.
+
+You can also specify a kernel image to boot. You have to either specify
+the an image in Android format _or_ pass a binary kernel and 

Re: [U-Boot] [PATCH 2/2] usb/gadget: add the fastboot gadget

2011-11-21 Thread Stefan Schmidt
Hello.

On Mon, 2011-11-21 at 15:09, Sebastian Andrzej Siewior wrote:
 This patch contains an implementation of the fastboot protocol on the
 device side and a little of documentation.
 The gadget expects the new-style gadget framework.

Which what hardware do you test this? So far I have only seen patches
(not applied yet) for the Samsung UDC controller that are providing
the usb_gadget_register_driver() functions. Consumer is only ether.c
so far.

Any other hardware platforms that support the new style gadget
framework yet? Do'n get me wrong, I like it and would like to see more
drivers moving to it but I wonder what support on a hardware driver
level we have for it yet.

 The gadget implements the getvar, reboot, download and reboot commands.
 What is missing is the flash handling i.e. writting the image to media.

You may have seen the DFU patches on this list recently. There is also
a split between the DFU protocol and the flashing backend. Would it
make sense to see if fastboot and DFU could use the same flashing
backend and platform specific bits?

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