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

Commit 4451debb authored by Sujeev Dias's avatar Sujeev Dias
Browse files

mhi: core: add support for overriding MHI channel context CHTYPE field



CHTYPE can be used to describe additional channel specific
properties apart from default channel direction. Add support
to override the default chtype using devicetree property.

CRs-Fixed: 2361266
Change-Id: I588cc61b1bbcc10fc38bb28efe4fdcdbbe64e3ab
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent 88c1fe37
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -292,7 +292,7 @@ int mhi_init_dev_ctxt(struct mhi_controller *mhi_cntrl)
		chan_ctxt->chstate = MHI_CH_STATE_DISABLED;
		chan_ctxt->brstmode = mhi_chan->db_cfg.brstmode;
		chan_ctxt->pollcfg = mhi_chan->db_cfg.pollcfg;
		chan_ctxt->chtype = mhi_chan->dir;
		chan_ctxt->chtype = mhi_chan->type;
		chan_ctxt->erindex = mhi_chan->er_index;

		mhi_chan->ch_state = MHI_CH_STATE_DISABLED;
@@ -940,6 +940,15 @@ static int of_parse_ch_cfg(struct mhi_controller *mhi_cntrl,
		if (ret)
			goto error_chan_cfg;

		/*
		 * For most channels, chtype is identical to channel directions,
		 * if not defined, assign ch direction to chtype
		 */
		ret = of_property_read_u32(child, "mhi,chan-type",
					   &mhi_chan->type);
		if (ret)
			mhi_chan->type = (enum mhi_ch_type)mhi_chan->dir;

		ret = of_property_read_u32(child, "mhi,ee", &mhi_chan->ee_mask);
		if (ret)
			goto error_chan_cfg;
+8 −0
Original line number Diff line number Diff line
@@ -484,6 +484,13 @@ enum mhi_ch_ee_mask {
	MHI_CH_EE_EDL = BIT(MHI_EE_EDL),
};

enum mhi_ch_type {
	MHI_CH_TYPE_INVALID = 0,
	MHI_CH_TYPE_OUTBOUND = DMA_TO_DEVICE,
	MHI_CH_TYPE_INBOUND = DMA_FROM_DEVICE,
	MHI_CH_TYPE_INBOUND_COALESCED = 3,
};

struct db_cfg {
	bool reset_req;
	bool db_mode;
@@ -577,6 +584,7 @@ struct mhi_chan {
	struct mhi_ring tre_ring;
	u32 er_index;
	u32 intmod;
	enum mhi_ch_type type;
	enum dma_data_direction dir;
	struct db_cfg db_cfg;
	u32 ee_mask;