diff --git a/drivers/platform/msm/mhi_dev/mhi.h b/drivers/platform/msm/mhi_dev/mhi.h index 253274b5d9e6..775c2690f2e0 100644 --- a/drivers/platform/msm/mhi_dev/mhi.h +++ b/drivers/platform/msm/mhi_dev/mhi.h @@ -267,6 +267,7 @@ struct mhi_config { #define MHI_ENV_VALUE 2 #define MHI_MASK_ROWS_CH_EV_DB 4 #define TRB_MAX_DATA_SIZE 8192 +#define TRB_MAX_DATA_SIZE_16K 16384 #define MHI_CTRL_STATE 100 /* maximum transfer completion events buffer */ diff --git a/drivers/platform/msm/mhi_dev/mhi_uci.c b/drivers/platform/msm/mhi_dev/mhi_uci.c index 222c71854d3b..8aca45f6957c 100644 --- a/drivers/platform/msm/mhi_dev/mhi_uci.c +++ b/drivers/platform/msm/mhi_dev/mhi_uci.c @@ -173,7 +173,7 @@ static const struct chan_attr mhi_chan_attr_table[] = { }, { MHI_CLIENT_DIAG_OUT, - TRB_MAX_DATA_SIZE, + TRB_MAX_DATA_SIZE_16K, MAX_NR_TRBS_PER_CHAN, MHI_DIR_OUT, NULL, @@ -184,7 +184,7 @@ static const struct chan_attr mhi_chan_attr_table[] = { }, { MHI_CLIENT_DIAG_IN, - TRB_MAX_DATA_SIZE, + TRB_MAX_DATA_SIZE_16K, MAX_NR_TRBS_PER_CHAN, MHI_DIR_IN, NULL, @@ -629,10 +629,17 @@ static int mhi_uci_send_sync(struct uci_client *uci_handle, struct mhi_req ureq; int ret_val; - uci_log(UCI_DBG_VERBOSE, + uci_log(UCI_DBG_DBG, "Sync write for ch_id:%d size %d\n", uci_handle->out_chan, size); + if (size > TRB_MAX_DATA_SIZE) { + uci_log(UCI_DBG_ERROR, + "Too big write size: %lu, max supported size is %d\n", + size, TRB_MAX_DATA_SIZE); + return -EFBIG; + } + ureq.client = uci_handle->out_handle; ureq.buf = data_loc; ureq.len = size; @@ -945,7 +952,7 @@ static int mhi_uci_read_sync(struct uci_client *uci_handle, int *bytes_avail) struct mhi_req ureq; struct mhi_dev_client *client_handle; - uci_log(UCI_DBG_INFO, + uci_log(UCI_DBG_DBG, "Sync read for ch_id:%d\n", uci_handle->in_chan); client_handle = uci_handle->in_handle; @@ -1484,11 +1491,10 @@ static ssize_t mhi_uci_client_write(struct file *file, return -ENODEV; } - if (count > TRB_MAX_DATA_SIZE) { - uci_log(UCI_DBG_ERROR, - "Too big write size: %lu, max supported size is %d\n", - count, TRB_MAX_DATA_SIZE); - return -EFBIG; + if (count > uci_handle->out_chan_attr->max_packet_size) { + uci_log(UCI_DBG_DBG, + "Warning: big write size: %lu, max supported size is %d\n", + count, uci_handle->out_chan_attr->max_packet_size); } data_loc = kmalloc(count, GFP_KERNEL); @@ -1543,11 +1549,10 @@ static ssize_t mhi_uci_client_write_iter(struct kiocb *iocb, return -ENODEV; } - if (count > TRB_MAX_DATA_SIZE) { - uci_log(UCI_DBG_ERROR, - "Too big write size: %lu, max supported size is %d\n", - count, TRB_MAX_DATA_SIZE); - return -EFBIG; + if (count > uci_handle->out_chan_attr->max_packet_size) { + uci_log(UCI_DBG_DBG, + "Warning: big write size: %lu, max supported size is %d\n", + count, uci_handle->out_chan_attr->max_packet_size); } data_loc = kmalloc(count, GFP_KERNEL);