[PATCH 09/15] staging: comedi: mite: introduce mite_ack_linkc()

Ian Abbott abbotti at mev.co.uk
Thu Apr 21 09:21:36 UTC 2016


On 20/04/16 18:24, Hartley Sweeten wrote:
> On Wednesday, April 20, 2016 2:44 AM, Ian Abbott wrote:
>> On 19/04/16 17:41, Hartley Sweeten wrote:
[snip]
>>> How do you feel about removing the "unknown" interrupt checks?
>>> If they are removed the CHSR_* defines in mite.h can be moved to the
>>> mite driver and not be needlessly exposed.
>>
>> I've seen occasional (but unresolved) threads on the COMEDI mailing
>> lists from people getting the "unknown mite interrupt" messages, so it's
>> probably best to leave them in for now.
>>
>> For example, this one:
>>
>> https://groups.google.com/d/topic/comedi_list/dDH4BxqLhSk/discussion
>>
[snip]
> I found a titled "MITE RLPM: MITE PCI/PXI Interface and DMA Controller".
> It's looks to be pretty recent but it's not very complete. The header of the
> document states: "MITE RLPM rough draft v0.1 4/20/2016 (C) National
> Instruments"
>
>  From that document.
>
> The MERR bits indicate a "Memory Transfer Error":
>    00 - No Error
>    01 - Bus Error
>    10 - Retry Limit Exceeded
>    11 - Other Transfer Error (Parity for MXI)
>
> In this case the MRERR is indicating a retry limit exceeded
>
> Currently the mite driver sets all the "retry limits" to 64. This results in
> a CR_RL() value of 7 which is the maximum value that can be used by
> those bits. I should just remove the mite_retry_limit() helper and just
> use CR_RL(7) instead.
[snip]
> But, it looks like a "transfer error" can be detected by just checking the
> XFERR bit. This bit indicates that the transfer was terminated by a LERR,
> MERR, or DERR. This test could be moved into mite_ack_linkc() as:
>
> -unsigned int mite_ack_linkc(struct mite_channel *mite_chan)
> +unsigned int mite_ack_linkc(struct mite_channel *mite_chan,
> +			    struct comedi_subdevice *s)
> {
> 	struct mite_struct *mite = mite_chan->mite;
> 	unsigned int status;
>
> 	status = mite_get_status(mite_chan);
> 	if (status & CHSR_LINKC)
> 		writel(CHOR_CLRLC,
> 		       mite->mite_io_addr + MITE_CHOR(mite_chan->channel));
>
> +	if (status & CHSR_XFERR) {
> +		dev_err(s->device->class_dev,
> +			"mite transfer error %08x\n", status);
> +		s->async->events |= COMEDI_CB_ERROR;
> +	}
> +
> 	return status;
> }
> EXPORT_SYMBOL_GPL(mite_ack_linkc);
>
> Then the CHSR defines can all be moved into mite.c and not get exposed.
>
> Sound reasonable?

Seems reasonable enough.  Thanks for investigating!

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-


More information about the devel mailing list