lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <EF2E73589CA71846A15D0B2CDF79505D0905D5A5FB@wm021.weinmann.com>
Date:	Tue, 17 Apr 2012 08:12:30 +0200
From:	"Voss, Nikolaus" <N.Voss@...nmann.de>
To:	"'Adrian Yanes'" <adrian.yanes@...to.fi>,
	"'linux-arm-kernel@...ts.infradead.org'" 
	<linux-arm-kernel@...ts.infradead.org>,
	"'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>,
	"'linux-i2c@...r.kernel.org'" <linux-i2c@...r.kernel.org>
CC:	"'konsta.holtta@...to.fi'" <konsta.holtta@...to.fi>,
	"'ben-linux@...ff.org'" <ben-linux@...ff.org>,
	"'Hubert Feurstein'" <h.feurstein@...il.com>,
	"'Douglas Gilbert'" <dgilbert@...erlog.com>
Subject: RE: About AT91: replace broken TWI driver i2c-at91.c

Hi Adrian,

Adrian Yanes wrote on 2012-04-16:
> Changing the value to 400000 gives as ~356kHz rate instead of 400kHz,
> maybe it is due to our processor/board, however, checking the specs of
> the at91rm9200 (page 405) we found that the CLVID and the CHDIV are
> calculated as follow:
> 
> T_low = (( CLDIV x 2^CKDIV) +3) + T_mck
> T_high = (( CHDIV x 2^CKDIV) +3) + T_mck
> 
> which differs of the method suggested in the patch:
> 
> const int div = DIV_ROUND_UP(clk_get_rate(dev->clk), 2 * twi_clk) - 2;

G45 spec is slightly different: T_low = (CLDIV x 2^CKDIV + 4) x T_mck
With
twi_clk := 1 / (T_low + T_high) = 1 / (2 * T_low)
and
div := CLKDIV x 2^CKDIV = MCK / (2 * twi_clk) - 4
the above line should be
const int div = DIV_ROUND_UP(clk_get_rate(dev->clk), 2 * twi_clk) - 4;
for G45 and
const int div = DIV_ROUND_UP(clk_get_rate(dev->clk), 2 * twi_clk) - 3;
for RM9200, right?

I'll repost the driver with the above fix and Hubert's fix.

> Finally, did you consider the possibility to add module_param() to
> handle the TWI_CLK_HZ as a module parameter rather than hardcode the
> value? it will help to those users that want to run the bus to different
> frequencies.

No, but feel free to submit a patch ;-).

Niko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ