Re: [RFC PATCH] mxs: i2c: Implement arbitrary clock speed derivation algorithm

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

 



Dear Wolfram Sang,

> Hi Marek,
> 
> On Fri, Nov 30, 2012 at 06:48:35PM +0100, Marek Vasut wrote:
> > This patch drops the i2c timing tables from this driver and instead
> > derives the timing based from the requested clock sleep. The timing
> > tables were completely wrong anyway when observed on a scope.
> > 
> > This new algorithm is also only derived by using a scope, but it seems
> > to produce much more accurate result.
> > 
> > Signed-off-by: Marek Vasut <marex@xxxxxxx>
> > Cc: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
> > Cc: Shawn Guo <shawn.guo@xxxxxxxxxx>
> > Cc: Wolfram Sang <w.sang@xxxxxxxxxxxxxx>
> > ---
> > 
> >  drivers/i2c/busses/i2c-mxs.c |   94
> >  ++++++++++++++++++++++++------------------ 1 file changed, 55
> >  insertions(+), 39 deletions(-)
> > 
> > NOTE: Can someone please test if this patch works for them as well?
> > 
> >       I tested this on DENX M28EVK and Freescale MX28EVK.
> 
> Second call for testers.

[...]

> > +static void mxs_i2c_derive_timing(struct mxs_i2c_dev *i2c, int speed)
> > +{
> > +	/* The I2C block clock run at 24MHz */
> > +	const uint32_t clk = 24000000;
> > +	uint32_t base;
> > +	uint16_t high_count, low_count, rcv_count, xmit_count;
> > +	struct device *dev = i2c->dev;
> > +
> > +	if (speed > 540000) {
> > +		dev_err(dev, "Speed too high (%d Hz), using 540 kHz\n", speed);
> > +		speed = 540000;
> > +	} else if (speed < 12000) {
> > +		dev_err(dev, "Speed too low (%d Hz), using 12 kHz\n", speed);
> > +		speed = 12000;
> > +	}
> 
> I'd think dev_warn would do, since we are able to continue. No need to
> resend, though.
> 
> Rest looks good, thanks!

Ah, good catch. We can put this one on hold, it's not as important as the 
PIO/DMA one. I'd like to see the PIO/DMA one hit mainline though.

Thanks!

Best regards,
Marek Vasut
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux