aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mhi.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mhi.h')
-rw-r--r--include/linux/mhi.h51
1 files changed, 36 insertions, 15 deletions
diff --git a/include/linux/mhi.h b/include/linux/mhi.h
index c4a940d98912..d4841e5a5f45 100644
--- a/include/linux/mhi.h
+++ b/include/linux/mhi.h
@@ -9,13 +9,14 @@
#include <linux/device.h>
#include <linux/dma-direction.h>
#include <linux/mutex.h>
-#include <linux/rwlock_types.h>
#include <linux/skbuff.h>
#include <linux/slab.h>
-#include <linux/spinlock_types.h>
+#include <linux/spinlock.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
+#define MHI_MAX_OEM_PK_HASH_SEGMENTS 16
+
struct mhi_chan;
struct mhi_event;
struct mhi_ctxt;
@@ -85,13 +86,15 @@ enum mhi_ch_type {
};
/**
- * struct image_info - Firmware and RDDM table table
- * @mhi_buf - Buffer for firmware and RDDM table
- * @entries - # of entries in table
+ * struct image_info - Firmware and RDDM table
+ * @mhi_buf: Buffer for firmware and RDDM table
+ * @entries: # of entries in table
*/
struct image_info {
struct mhi_buf *mhi_buf;
+ /* private: from internal.h */
struct bhi_vec_entry *bhi_vec;
+ /* public: */
u32 entries;
};
@@ -276,9 +279,9 @@ struct mhi_controller_config {
u32 timeout_ms;
u32 buf_len;
u32 num_channels;
- struct mhi_channel_config *ch_cfg;
+ const struct mhi_channel_config *ch_cfg;
u32 num_events;
- struct mhi_event_config *event_cfg;
+ const struct mhi_event_config *event_cfg;
bool use_bounce_buf;
bool m2_no_db;
};
@@ -288,6 +291,7 @@ struct mhi_controller_config {
* @cntrl_dev: Pointer to the struct device of physical bus acting as the MHI
* controller (required)
* @mhi_dev: MHI device instance for the controller
+ * @debugfs_dentry: MHI controller debugfs directory
* @regs: Base address of MHI MMIO register space (required)
* @bhi: Points to base of MHI BHI register space
* @bhie: Points to base of MHI BHIe register space
@@ -308,12 +312,13 @@ struct mhi_controller_config {
* @total_ev_rings: Total # of event rings allocated
* @hw_ev_rings: Number of hardware event rings
* @sw_ev_rings: Number of software event rings
- * @nr_irqs_req: Number of IRQs required to operate (optional)
* @nr_irqs: Number of IRQ allocated by bus master (required)
* @family_number: MHI controller family number
* @device_number: MHI controller device number
* @major_version: MHI controller major revision number
* @minor_version: MHI controller minor revision number
+ * @serial_number: MHI controller serial number obtained from BHI
+ * @oem_pk_hash: MHI controller OEM PK Hash obtained from BHI
* @mhi_event: MHI event ring configurations table
* @mhi_cmd: MHI command ring configurations table
* @mhi_ctxt: MHI device context, shared memory between host and device
@@ -326,6 +331,7 @@ struct mhi_controller_config {
* @dev_state: MHI device state
* @dev_wake: Device wakeup count
* @pending_pkts: Pending packets for the controller
+ * @M0, M2, M3: Counters to track number of device MHI state changes
* @transition_list: List of MHI state transitions
* @transition_lock: Lock for protecting MHI state transition list
* @wlock: Lock for protecting device wakeup
@@ -364,6 +370,7 @@ struct mhi_controller_config {
struct mhi_controller {
struct device *cntrl_dev;
struct mhi_device *mhi_dev;
+ struct dentry *debugfs_dentry;
void __iomem *regs;
void __iomem *bhi;
void __iomem *bhie;
@@ -385,12 +392,13 @@ struct mhi_controller {
u32 total_ev_rings;
u32 hw_ev_rings;
u32 sw_ev_rings;
- u32 nr_irqs_req;
u32 nr_irqs;
u32 family_number;
u32 device_number;
u32 major_version;
u32 minor_version;
+ u32 serial_number;
+ u32 oem_pk_hash[MHI_MAX_OEM_PK_HASH_SEGMENTS];
struct mhi_event *mhi_event;
struct mhi_cmd *mhi_cmd;
@@ -405,6 +413,7 @@ struct mhi_controller {
enum mhi_state dev_state;
atomic_t dev_wake;
atomic_t pending_pkts;
+ u32 M0, M2, M3;
struct list_head transition_list;
spinlock_t transition_lock;
spinlock_t wlock;
@@ -436,10 +445,10 @@ struct mhi_controller {
};
/**
- * struct mhi_device - Structure representing a MHI device which binds
- * to channels
+ * struct mhi_device - Structure representing an MHI device which binds
+ * to channels or is associated with controllers
* @id: Pointer to MHI device ID struct
- * @chan_name: Name of the channel to which the device binds
+ * @name: Name of the associated MHI device
* @mhi_cntrl: Controller the device belongs to
* @ul_chan: UL channel for the device
* @dl_chan: DL channel for the device
@@ -451,7 +460,7 @@ struct mhi_controller {
*/
struct mhi_device {
const struct mhi_device_id *id;
- const char *chan_name;
+ const char *name;
struct mhi_controller *mhi_cntrl;
struct mhi_chan *ul_chan;
struct mhi_chan *dl_chan;
@@ -518,12 +527,24 @@ struct mhi_driver {
#define to_mhi_device(dev) container_of(dev, struct mhi_device, dev)
/**
+ * mhi_alloc_controller - Allocate the MHI Controller structure
+ * Allocate the mhi_controller structure using zero initialized memory
+ */
+struct mhi_controller *mhi_alloc_controller(void);
+
+/**
+ * mhi_free_controller - Free the MHI Controller structure
+ * Free the mhi_controller structure which was previously allocated
+ */
+void mhi_free_controller(struct mhi_controller *mhi_cntrl);
+
+/**
* mhi_register_controller - Register MHI controller
* @mhi_cntrl: MHI controller to register
* @config: Configuration to use for the controller
*/
int mhi_register_controller(struct mhi_controller *mhi_cntrl,
- struct mhi_controller_config *config);
+ const struct mhi_controller_config *config);
/**
* mhi_unregister_controller - Unregister MHI controller
@@ -593,7 +614,7 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl);
/**
* mhi_sync_power_up - Start MHI power up sequence and wait till the device
- * device enters valid EE state
+ * enters valid EE state
* @mhi_cntrl: MHI controller
*/
int mhi_sync_power_up(struct mhi_controller *mhi_cntrl);