linux_dsm_epyc7002/arch/arm/mach-ixp4xx
Uwe Kleine-König fb3174e4ad ARM: ixp4xx: fix timer latch calculation
In commit f0402f9b47 ("ARM: ixp4xx: stop using <mach/timex.h>")
I didn't intend to implement a functional change, but as Olof noticed I
failed---at least a bit. Before this commit the following was used to
determine the latch value used:

	#define IXP4XX_TIMER_FREQ 66666000
	#define CLOCK_TICK_RATE \
		(((IXP4XX_TIMER_FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ)
	#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ)

The complicated calculation was done "b/c the timer register ignores the
bottom 2 bits of the LATCH value." With HZ=100 CLOCK_TICK_RATE used to
calculate to 66666100 and so LATCH to 666661. In ixp4xx_set_mode the
term

	LATCH & ~IXP4XX_OST_RELOAD_MASK

was used to write to the relevant register (with IXP4XX_OST_RELOAD_MASK
being 3) and so effectively 666660 was used.

In commit f0402f9b47 I translated that to:

	#define IXP4XX_TIMER_FREQ 66666000
	#define IXP4XX_LATCH DIV_ROUND_CLOSEST(IXP4XX_TIMER_FREQ, HZ)

which results in the same register writes, but still doesn't bear in
mind that the two least significant bits cannot be specified (which is
relevant only when HZ or IXP4XX_TIMER_FREQ are changed).

Instead of reverting back to the old approach use a more obvious and
also more correct way to calculate LATCH. (Regarding the more
correct claim: With IXP4XX_TIMER_FREQ == 66665999, the old code resulted
in LATCH = 666657 corresponding to a cycle time of 0.009999940149400597
seconds (error: -6.0e-8 s) while the new approach results in LATCH =
666660 and so a cycle time of 0.010000000150001503 seconds
(error: 1.5e-10 s).)

Fixes: f0402f9b47 ("ARM: ixp4xx: stop using <mach/timex.h>")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2014-02-18 21:23:19 +01:00
..
include/mach ARM: drop <mach/timex.h> for !ARCH_MULTIPLATFORM, too 2013-12-20 17:17:16 +01:00
avila-pci.c ARM: PCI: provide a default bus scan implementation 2012-05-13 17:12:17 +01:00
avila-setup.c ARM: delete struct sys_timer 2012-12-24 09:36:38 -07:00
common-pci.c IXP4xx: Remove time limit for PCI TRDY to enable use of slow devices. 2012-11-22 03:35:58 +00:00
common.c ARM: ixp4xx: fix timer latch calculation 2014-02-18 21:23:19 +01:00
coyote-pci.c ARM: PCI: provide a default bus scan implementation 2012-05-13 17:12:17 +01:00
coyote-setup.c ARM: delete struct sys_timer 2012-12-24 09:36:38 -07:00
dsmg600-pci.c ARM: PCI: provide a default bus scan implementation 2012-05-13 17:12:17 +01:00
dsmg600-setup.c ARM: ixp4xx: convert remaining users to use gpiolib 2013-09-27 14:15:07 +02:00
fsg-pci.c ARM: PCI: provide a default bus scan implementation 2012-05-13 17:12:17 +01:00
fsg-setup.c ARM: delete struct sys_timer 2012-12-24 09:36:38 -07:00
gateway7001-pci.c ARM: PCI: provide a default bus scan implementation 2012-05-13 17:12:17 +01:00
gateway7001-setup.c ARM: delete struct sys_timer 2012-12-24 09:36:38 -07:00
goramo_mlr.c ARM: delete struct sys_timer 2012-12-24 09:36:38 -07:00
gtwx5715-pci.c ARM: PCI: provide a default bus scan implementation 2012-05-13 17:12:17 +01:00
gtwx5715-setup.c ARM: delete struct sys_timer 2012-12-24 09:36:38 -07:00
ixdp425-pci.c ARM: PCI: provide a default bus scan implementation 2012-05-13 17:12:17 +01:00
ixdp425-setup.c ARM: ixp4xx: convert remaining users to use gpiolib 2013-09-27 14:15:07 +02:00
ixdpg425-pci.c ARM: PCI: provide a default bus scan implementation 2012-05-13 17:12:17 +01:00
ixp4xx_npe.c ixp4xx: Declare MODULE_FIRMWARE usage 2012-11-22 03:36:22 +00:00
ixp4xx_qmgr.c IXP4xx: use __iomem for MMIO 2012-11-22 03:36:45 +00:00
Kconfig ARM: fix ARCH_IXP4xx usage of ARCH_SUPPORTS_BIG_ENDIAN 2013-10-19 20:46:32 +01:00
Makefile ixp4xx: support omicron ixp425 based boards 2011-09-30 22:18:42 +02:00
Makefile.boot ARM: 7022/1: allow to detect conflicting zreladdrs 2011-10-17 09:12:40 +01:00
miccpt-pci.c ARM: PCI: provide a default bus scan implementation 2012-05-13 17:12:17 +01:00
nas100d-pci.c ARM: PCI: provide a default bus scan implementation 2012-05-13 17:12:17 +01:00
nas100d-setup.c ARM: ixp4xx: convert remaining users to use gpiolib 2013-09-27 14:15:07 +02:00
nslu2-pci.c ARM: PCI: provide a default bus scan implementation 2012-05-13 17:12:17 +01:00
nslu2-setup.c ARM: ixp4xx: convert remaining users to use gpiolib 2013-09-27 14:15:07 +02:00
omixp-setup.c ARM: ixp4xx: avoid circular header dependency 2013-07-06 02:01:03 +02:00
vulcan-pci.c ARM: PCI: provide a default bus scan implementation 2012-05-13 17:12:17 +01:00
vulcan-setup.c ARM: w1-gpio: fix erroneous gpio requests 2013-03-12 16:20:45 -07:00
wg302v2-pci.c ARM: PCI: provide a default bus scan implementation 2012-05-13 17:12:17 +01:00
wg302v2-setup.c ARM: delete struct sys_timer 2012-12-24 09:36:38 -07:00