diff mbox series

[5/5] i2c: geni: sdm845: dont perform DMA for OnePlus 6 devices

Message ID 20201112161920.2671430-6-caleb@connolly.tech
State New
Headers show
Series None | expand

Commit Message

Caleb Connolly Nov. 12, 2020, 4:22 p.m. UTC
The OnePlus 6/T has the same issue as the Yoga c630 causing a crash when DMA
is used for i2c, so disable it.

https://patchwork.kernel.org/patch/11133827/

Signed-off-by: Caleb Connolly <caleb@connolly.tech>
---
 drivers/i2c/busses/i2c-qcom-geni.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Akash Asthana Nov. 17, 2020, 11:47 a.m. UTC | #1
On 11/12/2020 9:52 PM, Caleb Connolly wrote:
> The OnePlus 6/T has the same issue as the Yoga c630 causing a crash when DMA
> is used for i2c, so disable it.
>
> https://patchwork.kernel.org/patch/11133827/
>
> Signed-off-by: Caleb Connolly <caleb@connolly.tech>
Reviewed-by : Akash Asthana <akashast@codeaurora.org>
Bjorn Andersson Nov. 22, 2020, 3:47 a.m. UTC | #2
On Thu 12 Nov 10:22 CST 2020, Caleb Connolly wrote:

> The OnePlus 6/T has the same issue as the Yoga c630 causing a crash when DMA
> is used for i2c, so disable it.
> 
> https://patchwork.kernel.org/patch/11133827/
> 
> Signed-off-by: Caleb Connolly <caleb@connolly.tech>
> ---
>  drivers/i2c/busses/i2c-qcom-geni.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
> index 8b4c35f47a70..9acdcfe73be2 100644
> --- a/drivers/i2c/busses/i2c-qcom-geni.c
> +++ b/drivers/i2c/busses/i2c-qcom-geni.c
> @@ -357,7 +357,8 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
>  	struct geni_se *se = &gi2c->se;
>  	size_t len = msg->len;
>  
> -	if (!of_machine_is_compatible("lenovo,yoga-c630"))
> +	if (!of_machine_is_compatible("lenovo,yoga-c630") &&
> +	    !of_machine_is_compatible("oneplus,oneplus6"))

This hack seems to have been working around two separate issues. First
with iommu active the GENI wrappers needs to have their stream mapping
configured. Secondly there was a bug in the transaction setup that was
recently fixed by Doug Anderson.

So can you please give the following patch a go? I've yet to test it on
the Lenovo machine, but I think it allows us to remove the quirk.

https://lore.kernel.org/lkml/20201122034149.626045-1-bjorn.andersson@linaro.org/T/#u

Regards,
Bjorn

>  		dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
>  
>  	if (dma_buf)
> @@ -399,7 +400,8 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
>  	struct geni_se *se = &gi2c->se;
>  	size_t len = msg->len;
>  
> -	if (!of_machine_is_compatible("lenovo,yoga-c630"))
> +	if (!of_machine_is_compatible("lenovo,yoga-c630") &&
> +	    !of_machine_is_compatible("oneplus,oneplus6"))
>  		dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
>  
>  	if (dma_buf)
> -- 
> 2.29.2
> 
>
Caleb Connolly Nov. 22, 2020, 5:59 p.m. UTC | #3
Hi Bjorn,

It looks like I still have the same issue even with this patch applied.

Regards,
Caleb

On 2020-11-22 03:47, Bjorn Andersson wrote:
> On Thu 12 Nov 10:22 CST 2020, Caleb Connolly wrote:
>
>> The OnePlus 6/T has the same issue as the Yoga c630 causing a crash when DMA
>> is used for i2c, so disable it.
>>
>> https://patchwork.kernel.org/patch/11133827/
>>
>> Signed-off-by: Caleb Connolly <caleb@connolly.tech>
>> ---
>>   drivers/i2c/busses/i2c-qcom-geni.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
>> index 8b4c35f47a70..9acdcfe73be2 100644
>> --- a/drivers/i2c/busses/i2c-qcom-geni.c
>> +++ b/drivers/i2c/busses/i2c-qcom-geni.c
>> @@ -357,7 +357,8 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
>>   	struct geni_se *se = &gi2c->se;
>>   	size_t len = msg->len;
>>
>> -	if (!of_machine_is_compatible("lenovo,yoga-c630"))
>> +	if (!of_machine_is_compatible("lenovo,yoga-c630") &&
>> +	    !of_machine_is_compatible("oneplus,oneplus6"))
> This hack seems to have been working around two separate issues. First
> with iommu active the GENI wrappers needs to have their stream mapping
> configured. Secondly there was a bug in the transaction setup that was
> recently fixed by Doug Anderson.
>
> So can you please give the following patch a go? I've yet to test it on
> the Lenovo machine, but I think it allows us to remove the quirk.
>
> https://lore.kernel.org/lkml/20201122034149.626045-1-bjorn.andersson@linaro.org/T/#u
>
> Regards,
> Bjorn
>
>>   		dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
>>
>>   	if (dma_buf)
>> @@ -399,7 +400,8 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
>>   	struct geni_se *se = &gi2c->se;
>>   	size_t len = msg->len;
>>
>> -	if (!of_machine_is_compatible("lenovo,yoga-c630"))
>> +	if (!of_machine_is_compatible("lenovo,yoga-c630") &&
>> +	    !of_machine_is_compatible("oneplus,oneplus6"))
>>   		dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
>>
>>   	if (dma_buf)
>> --
>> 2.29.2
>>
>>
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
index 8b4c35f47a70..9acdcfe73be2 100644
--- a/drivers/i2c/busses/i2c-qcom-geni.c
+++ b/drivers/i2c/busses/i2c-qcom-geni.c
@@ -357,7 +357,8 @@  static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
 	struct geni_se *se = &gi2c->se;
 	size_t len = msg->len;
 
-	if (!of_machine_is_compatible("lenovo,yoga-c630"))
+	if (!of_machine_is_compatible("lenovo,yoga-c630") &&
+	    !of_machine_is_compatible("oneplus,oneplus6"))
 		dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
 
 	if (dma_buf)
@@ -399,7 +400,8 @@  static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
 	struct geni_se *se = &gi2c->se;
 	size_t len = msg->len;
 
-	if (!of_machine_is_compatible("lenovo,yoga-c630"))
+	if (!of_machine_is_compatible("lenovo,yoga-c630") &&
+	    !of_machine_is_compatible("oneplus,oneplus6"))
 		dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
 
 	if (dma_buf)