Skip to contentSkip to conversation

i2c: i2c-mt65xx and DMA on MT6577 (compatibility issue)

RFC Boris Lysov 1 participant 1 message Sep 6, 2020 I2C subsystem host drivers

lore
Share & tools
lore
#0 lore raw

Hello,

I ran into the issue with using i2c-mt65xx driver on MT6577 hardware. Device tree documentation for the driver says "reg" property requires 2 addresses:

Quoted 1 line

reg: physical base address of the controller and dma base

Physical base address for MT6577 is 0xC1012000, but AFAIK MT6577 does not have a DMA base dedicated especially to I2C.

What value has to be used as DMA base on MT6577?

For the sake of example, I did my own research and checked other SoC listed as compatible in dt-binding doc. I compared the source code of Linux kernels for devices based on MT6589 and MT6577. See example below.

MT6589, Lenovo A820: https://github.com/jawad6233/Lenovo_A820_Kernel
There are IRQ IDs defined for I2C DMA:
mediatek/platform/mt6589/kernel/core/include/mach/mt_irq.h (line 47)

Quoted 7 lines
#define MT_DMA_I2C1_ID                      (GIC_PRIVATE_SIGNALS + 62)
#define MT_DMA_I2C2_ID                      (GIC_PRIVATE_SIGNALS + 63)
#define MT_DMA_I2C3_ID                      (GIC_PRIVATE_SIGNALS + 64)
#define MT_DMA_I2C4_ID                      (GIC_PRIVATE_SIGNALS + 65)
#define MT_DMA_I2C5_ID                      (GIC_PRIVATE_SIGNALS + 66)
#define MT_DMA_I2C6_ID                      (GIC_PRIVATE_SIGNALS + 67)
#define MT_DMA_I2C7_ID                      (GIC_PRIVATE_SIGNALS + 68)

There are DMA address calculations for various I2C busses:
mediatek/platform/mt6589/kernel/drivers/i2c/i2c.c (line 1135)

Quoted 1 line

i2c->pdmabase = AP_DMA_BASE + 0x300 + (0x80*(i2c->id));

MT6577, ZTE v970: https://github.com/dragonpt/Kernel_3.4.67_KK_ZTE_v970
There are no IRQ IDs defined for I2C DMA:
mediatek/platform/mt6577/kernel/core/include/mach/mt_irq.h
From line 80 down to line 92 there are DMA addresses for various subsystems except I2C. And there are no DMA address calculaltions either:
mediatek/platform/mt6577/kernel/drivers/i2c/i2c.c

Please point me to DMA base I should use on MT6577. Thanks.