On 2018-11-02 13:56, Stanislaw Gruszka wrote: > On Thu, Nov 01, 2018 at 06:29:01PM +0100, Felix Fietkau wrote: >> On 2018-10-26 14:00, Stanislaw Gruszka wrote: >> > We always wait for CMD_CALIBRATION_OP mcu message, but wait argument is used >> > for do additioanl MT_MCU_COM_REG0 register operations, which are needed >> > for MMIO devices and we can use mt76_is_mmio() check instead of wait argument. >> > >> > Signed-off-by: Stanislaw Gruszka <sgruszka@xxxxxxxxxx> >> With this commit, I hit the WARN_ON on polling the MT_MCU_COM_REG0 >> register on mt76x0e. It seems to me that this register polling should be >> moved out of mt76x02 and into a mt76x2 wrapper function. > > I think it would be better to just do mt76x2e check like this: > > bool is_mt76x2e = mt76_is_mmio(dev) && is_mt76x2(dev); > > if (is_mt76x2e) > mt76_rmw(dev, MT_MCU_COM_REG0, BIT(31), 0); > > Then we will not have sparate calibration functions for mt76x2e and > mt76x2u, so code could be easier shared between those. My suggestion would have been making a wrapper function that checks for mt76_is_mmio(dev) and gets put into mt76x2-common. What you're proposing is fine with me as well, I guess it's a matter of preference. - Felix