mirror of
https://github.com/linux-msm/qdl.git
synced 2026-02-25 13:12:25 -08:00
During QRB2210 provisioning, a USB write failure has been observed early in the Firehose phase (first block write). This issue has been traced to a timeout during the USB bulk transfer of the Zero-Length Packet (ZLP). In some conditions, the ZLP transfer may take longer than the current timeout, up to approximately 1.7 seconds. The issue specifically occurs after a prior large eMMC write operation (e.g., during a previous QDL session). It could then be related to internal eMMC I/O operations or timing delays affecting the USB ack. To resolve this issue, we introduce a timeout parameter to the qdl_write function, consistent with the existing qdl_read, and we increase the timeout to 10 seconds for Firehose raw binary write operations to avoid 'false-positive' timeout. Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
70 lines
1.5 KiB
C
70 lines
1.5 KiB
C
// SPDX-License-Identifier: BSD-3-Clause
|
|
/*
|
|
* Copyright (c) 2025, Qualcomm Innovation Center, Inc. All rights reserved.
|
|
*/
|
|
#include <stdlib.h>
|
|
|
|
#include "qdl.h"
|
|
|
|
struct qdl_device *qdl_init(enum QDL_DEVICE_TYPE type)
|
|
{
|
|
if (type == QDL_DEVICE_USB)
|
|
return usb_init();
|
|
|
|
if (type == QDL_DEVICE_SIM)
|
|
return sim_init();
|
|
|
|
return NULL;
|
|
}
|
|
|
|
void qdl_deinit(struct qdl_device *qdl)
|
|
{
|
|
if (qdl)
|
|
free(qdl);
|
|
}
|
|
|
|
void qdl_set_out_chunk_size(struct qdl_device *qdl, long size)
|
|
{
|
|
qdl->set_out_chunk_size(qdl, size);
|
|
}
|
|
|
|
int qdl_open(struct qdl_device *qdl, const char *serial)
|
|
{
|
|
return qdl->open(qdl, serial);
|
|
}
|
|
|
|
void qdl_close(struct qdl_device *qdl)
|
|
{
|
|
qdl->close(qdl);
|
|
}
|
|
|
|
/**
|
|
* qdl_read() - Read a message from the device
|
|
* @qdl: device handle
|
|
* @buf: buffer to write the data into
|
|
* @len: maximum length of data to be read
|
|
* @timeout: timeout for the read, in milliseconds
|
|
*
|
|
* Returns: number of bytes read, might be zero for a ZLP
|
|
* negative errno on failure (notably -ETIMEDOUT)
|
|
*/
|
|
int qdl_read(struct qdl_device *qdl, void *buf, size_t len, unsigned int timeout)
|
|
{
|
|
return qdl->read(qdl, buf, len, timeout);
|
|
}
|
|
|
|
/**
|
|
* qdl_write() - Write a message from the device
|
|
* @qdl: device handle
|
|
* @buf: buffer with data to be written
|
|
* @len: length of data to be written
|
|
* @timeout: timeout for write, in milliseconds
|
|
*
|
|
* Returns: number of bytes read
|
|
* negative errno on failure (notably -ETIMEDOUT)
|
|
*/
|
|
int qdl_write(struct qdl_device *qdl, const void *buf, size_t len, unsigned int timeout)
|
|
{
|
|
return qdl->write(qdl, buf, len, timeout);
|
|
}
|