24 Commits

Author SHA1 Message Date
Bjorn Andersson
9aae1e9ff2 qdl: Extract USB functions
Move the USB functions to a separate file, so that we can build the
nbdkit plugin without including qdl.c.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-05-06 22:40:11 -07:00
Bjorn Andersson
bff56ea21b firehose: Apply programs and patches from main
Move the program and patch invocation to the main function.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-05-06 22:39:53 -07:00
Bjorn Andersson
e1a3670d91 firehose: Move set_bootable call to main()
Move the call to set_bootable out of firehose_run(), with the goal of
removing firehose_run()

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-05-06 22:38:10 -07:00
Bjorn Andersson
bb1aa99068 firehose: Extract firehose init
By extracting the initial parts of firehose_run() we get closer to being
able to reuse the firehose code in the upcoming nbdkit plugin.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-05-06 22:35:36 -07:00
Bjorn Andersson
342e99b9be firehose: Extract call to firehose_reset()
Expose firehose_reset() and call this from the main() function instead,
allowing the code to be reused between qdl and the nbdkit plugin.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-05-06 22:34:56 -07:00
John Stultz
760b3dffb0 qdl: Rework qdl_write to limit write sizes to out_maxpktsize
On a number of machines, qdl could cause crashes on the host
system it ran on, due to swiotlb exaustion.

This seems to be due to 1M buffers being used during the writes.

In order to avoid this, rework qdl_write to break up the writes
into out_maxpktsize chunks.

With this patch, I no longer see host crashes when running qdl

Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Amit Pundir <amit.pundir@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: dragonboard-aosp@lists.96boards.org
Tested-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
[bjorn: Dropped change of max_payload_size]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-05-03 12:18:25 -07:00
Bjorn Andersson
1c958b2bc2 usb: Silence usb helpers
It's perfectly normal to "poll" for incoming messages, so silence the
warning printout in the usb accessor functions.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-02-27 15:08:02 -08:00
Bjorn Andersson
8589513f65 qdl: Wait for missing EDL device
Add support back for waiting for an EDL device to appear. This is useful
when paired with some automation scripts that introduces "arbitrary"
delays in the process of entering EDL mode.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-01-07 21:20:25 -08:00
Bjorn Andersson
ba86b03391 qdl: Remove debug print for claim return code
The USB claim return code was printed to the console for debug purposes,
remove this.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-01-07 21:05:47 -08:00
Bjorn Andersson
59717efcd4 firehose: Remove unnecessary nop request
The nop was added to mitigate the fact that there's a rather long delay
in the response when sending out the first command. Increasing the write
timeout removes this problem and it's possible to just send the
configure as the first command without issues.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-01-07 21:00:42 -08:00
Bjorn Andersson
8f7987f756 qdl: Communicate using USBFS instead of qcserial
On some newer platforms the device ignore the configure request to
disable ZLP, causing the Firehose program request to stall, when the
device is waiting for a ZLP to end a transfer.

Mitigate this by circumventing the qcserial driver and drive the USB
traffic directly using USBFS. The tool will attempt to detach qcserial
from the device, in case it's already attached, so no changes are needed
in the kernel or system configuration.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-01-07 16:36:50 -08:00
Laxman
b338928519 firehose: support for emmc storage
Added qdl support for emmc storage on platforms with UFS support.  Use
option --s emmc or ufs as a argument to qdl command, if not specified
any option the default storage would be ufs

Tested-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Laxman <itsmelaxman91@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-11-07 21:33:44 -08:00
Niklas Cassel
5fc4cdbba4 qdl: fix error message referring to ttyUSB1
Since it is by no means certain that the current tty is ttyUSB1,
do not assume it to be so.

Unfortunately we do not know the current tty in main().
It would be possible to refactor the code so that we could print
the current tty, but since the only consumer of that information
would be this error message, that refactoring seems unjustified.

Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-06-12 12:07:35 -07:00
Nicolas Dechesne
45cc3521d8 qdl: add --include to specific optional folder to look for files
Let the programmer search for files beyond the current folder. When --include is
used , the programmmer will first look for files in the specified folder, and it
will then fallback to looking at the current folder.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-04-18 22:07:36 -07:00
Bjorn Andersson
44a80b1266 qdl: Remove possibility for uninitialized variable
In the case that we find a "data" tag, but not a "program" or "ufs"
child node type might have been left unitialized. Fix this by
initializing type.

Also fix up the styling of the multiline blocks.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-02-21 22:36:03 -08:00
Kirill Kapranov
d2e791a950 QDL/firehose: Add UFS provisioning functionality
Add UFS provisioning functionality using Firehose.

Signed-off-by: Kirill Kapranov <kkapra@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-02-21 22:29:15 -08:00
Kirill Kapranov
b4c2e8f267 qdl: fix 'usage' message, add missing key 'debug'
Add a mention of command line parameter '--debug' in 'usage' printout

Signed-off-by: Kirill Kapranov <kkapra@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-02-05 09:52:22 -08:00
Nicolas Dechesne
7be48f4fc9 qdl: implement args processing with getopt_long
we preserve the same args as before, however it should now be simpler to
add new options.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-02-02 10:02:56 -08:00
Bjorn Andersson
4c4dbd0317 qdl: Increase tty path buffer size
Rename "buf" to "path" to clarify things and increase the size to
PATH_MAX in order to silence a compile time warning the snprintf() in
find_qdl_tty() might be truncated.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-24 21:04:49 -07:00
Bjorn Andersson
0bb387615b qdl: Update README and add license header
This adds a license header to all files and updates the README with
information on building the project.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-07-24 23:46:13 -07:00
Bjorn Andersson
1611c78335 qdl: Add --debug for dumping firehose traffic
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-07-27 13:09:16 -07:00
Bjorn Andersson
0a0580cff5 qdl: Correct spelling of "data" and add "contents"
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-07-08 16:08:46 -07:00
Bjorn Andersson
4c8ba17cbc qdl: Detect xml file type and simplify usage
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-07-08 11:47:58 -07:00
Bjorn Andersson
da68b4add8 qdl: Support for program and patch
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-07-08 11:26:26 -07:00