RE: [PATCH]i2c-omap: pass scll, sclh through board file for Errata i585

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Aaro Koskinen [mailto:aaro.koskinen@xxxxxxxxx]
> Subject: Re: [PATCH]i2c-omap: pass scll, sclh through board file for Errata
> i585
> 
> Hi,
> 
> balajitk@xxxxxx wrote:
> > From: Balaji T K <balajitk@xxxxxx>
> >
> > Errata ID: i535 - I2C1 to 3 SCL low period is shorter in FS mode
> > Due to IO cell influence, I2C1 to 3 SCL low period can be shorter than
> expected.
> > As a result, I2C AC timing (SCL minimum low period) in FS mode may not meet
> > the timing configured by software.
> >
> > I2C1 to 3, SCL low period is programmable and proper adjustments
> > to the SCLL/HSSCLL values can avoid the issue.
> >
> > This patch provides flexibility to control tLOW, tHIGH for different boards.
> > scll, sclh values are to be provide in board data
> > for differents modes (standard, fast and high speed mode)
> > as the scl rate (I2C bus speed) can be changed by bootargs.
> 
> This patch is very much needed, because these values are highly board
> specific.
> At the moment we are forced to patch the i2c bus driver when finetuning the
> I2C
> timings for a certain board, which is ugly.
> 
> However, I have comment one about the implementation:
> 

<snip>

> I think it would be simpler if we move these calcuations into a function.
> E.g. something like:
> 
If the custom function is also to fine the scl low and scl high values.
How about passing the Tlow to T, Thigh to T ratio. T = 1/100Khz , 1/400Khz ,
1/HS speed to make things simpler.

> 	if (dev->speed > 400) {
> 		/* HS mode */
> 		pdata->set_scl(internal_clk, 400, &fsscll, &fssclh);
> 		pdata->set_scl(fclk_rate, dev->speed, &hsscll, &hssclh);
> 	} else {
> 		/* Fast & standard mode */
> 		pdata->set_scl(internal_clk, dev->speed, &fsscll, &fssclh);
> 	}
> 
> Then the default function would be something like:
> 
> static void omap_i2c_default_scl(unsigned clk, unsigned speed, u16 *scll, u16
> *sclh)
> {
> 	if (speed > 100) {
> 		/* Fast & HS modes */
> 		unsigned scl = clk / speed;
> 
> 		*scll = scl - (scl / 3) - 7;
> 		*sclh = (scl / 3) - 5;
> 	} else {
> 		/* Standard mode */
> 		*scll = clk / (speed * 2) - 7;
> 		*scll = clk / (speed * 2) - 5;
> 	}
> }
> 
> And the platform data would just provide a board-specific function if needed.
> 
> A.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux