[Letux-kernel] jz4730-i2c - clocksource

H. Nikolaus Schaller hns at goldelico.com
Sun Feb 28 19:18:30 CET 2021


> Am 28.02.2021 um 19:16 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
> A cure would be to directly read the counter register and bypass the regmap completely.
> 
> I'll give it a try (although I think I already did)...

Should have looked into our code: yes we already do:


// should use code similar to https://elixir.bootlin.com/linux/latest/source/drivers/clocksource/ingenic-ost.c#L86
// to ioremap during probe or init

		static void *ost_base;
		int timeout = 100;
		if(!ost_base)
			ost_base = ioremap(0x10002000, 8);	// only once

		readl(ost_base + TCU_JZ4730_REG_TCNTc(tcu->cs_channel));

		/* poll for the SF bit and then read OTCRD instead of OTCNT */
		while (!timeout && (readw(ost_base + TCU_JZ4730_REG_TCSRc(tcu->cs_channel)) & TCU_JZ4730_TCSR_BUSY))
			timeout--;
		count = MAX_COUNT - readl(ost_base + TCU_JZ4730_REG_TRDRc(tcu->cs_channel) + 0xc);




More information about the Letux-kernel mailing list