Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d88fc1fc authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: mhi_dev: Redesign MHI driver async path"

parents 35f15800 e7d055b0
Loading
Loading
Loading
Loading
+515 −236

File changed.

Preview size limit exceeded, changes collapsed.

+23 −9
Original line number Original line Diff line number Diff line
/* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -277,10 +277,11 @@ struct mhi_config {
#define TRB_MAX_DATA_SIZE		8192
#define TRB_MAX_DATA_SIZE		8192
#define MHI_CTRL_STATE			100
#define MHI_CTRL_STATE			100


/*maximum trasnfer completion events buffer*/
/* maximum transfer completion events buffer */
#define MAX_TR_EVENTS			50
#define NUM_TR_EVENTS_DEFAULT			128
/*maximum event requests */

#define MHI_MAX_EVT_REQ			50
/* Set flush threshold to 80% of event buf size */
#define MHI_CMPL_EVT_FLUSH_THRSHLD(n) ((n * 8) / 10)


/* Possible ring element types */
/* Possible ring element types */
union mhi_dev_ring_element_type {
union mhi_dev_ring_element_type {
@@ -418,6 +419,11 @@ struct ring_cache_req {


struct event_req {
struct event_req {
	union mhi_dev_ring_element_type *tr_events;
	union mhi_dev_ring_element_type *tr_events;
	/*
	 * Start index of the completion event buffer segment
	 * to be flushed to host
	 */
	u32			start;
	u32			num_events;
	u32			num_events;
	dma_addr_t		dma;
	dma_addr_t		dma;
	u32			dma_len;
	u32			dma_len;
@@ -443,14 +449,23 @@ struct mhi_dev_channel {
	struct mutex			ch_lock;
	struct mutex			ch_lock;
	/* client which the current inbound/outbound message is for */
	/* client which the current inbound/outbound message is for */
	struct mhi_dev_client		*active_client;
	struct mhi_dev_client		*active_client;
	/* Pointer to completion event buffer */
	union mhi_dev_ring_element_type *tr_events;
	/* Indices for completion event buffer */
	uint32_t			evt_buf_rp;
	uint32_t			evt_buf_wp;
	uint32_t			evt_buf_size;
	/*
	/*
	 * Pointer to event request structs used to temporarily store
	 * Pointer to a block of event request structs used to temporarily store
	 * completion events and meta data before sending them to host
	 * completion events and meta data before sending them to host
	 */
	 */
	struct event_req		*ereqs;
	struct event_req		*ereqs;
	/* Pointer to completion event buffers */
	/* Linked list head for event request structs */
	union mhi_dev_ring_element_type *tr_events;
	struct list_head		event_req_buffers;
	struct list_head		event_req_buffers;
	uint32_t				evt_req_size;
	/* Linked list head for event request structs to be flushed */
	struct list_head		flush_event_req_buffers;
	/* Pointer to the currently used event request struct */
	struct event_req		*curr_ereq;
	struct event_req		*curr_ereq;


	/* current TRE being processed */
	/* current TRE being processed */
@@ -533,7 +548,6 @@ struct mhi_dev {
	u32                             ifc_id;
	u32                             ifc_id;
	struct ep_pcie_hw               *phandle;
	struct ep_pcie_hw               *phandle;
	struct work_struct		pcie_event;
	struct work_struct		pcie_event;
	struct ep_pcie_msi_config	msi_cfg;


	atomic_t			write_active;
	atomic_t			write_active;
	atomic_t			is_suspended;
	atomic_t			is_suspended;