Re: [PATCH 1/2] tty: pl011: Work around QDF2400 E44 stuck BUSY bit

From: Timur Tabi
Date: Wed Feb 08 2017 - 18:05:08 EST

On 02/08/2017 04:22 PM, Christopher Covington wrote:
>> - while (pl011_read(uap, REG_FR) & uap->vendor->fr_busy)
>> + while ((pl011_read(uap, REG_FR) ^ uap->vendor->inv_fr)
>> + & uap->vendor->fr_busy)
> I really think the XOR logic needs to be documented wherever it's
> used. It's just too confusing.
References such as the following for basic bit operations like
setting, clearing, and toggling are easy enough to come by.

I know what XOR does. I was thinking a more high-level comment would be appropriate. With E44, we want to ignore the BUSY bit and use TXFE instead. So was hoping to a comment that says that:

/* Normally, we poll until BUSY=0, but E44 says we should poll until TXFE=1 instead. So with E44, we set fr_busy to TXFE, but we have to invert it. */

Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc. Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.