Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Aug 2018 19:27:44 +0530
From:      Rajesh Kumar <rajfbsd@gmail.com>
To:        manu@bidouilliste.com
Cc:        danny@cs.huji.ac.il, ian@freebsd.org, freebsd-hackers@freebsd.org,  freebsd-drivers@freebsd.org
Subject:   Re: Need a clarification regarding I2C bus frequency in FreeBSD
Message-ID:  <CAAO%2BANMnFSOB0MY3CizwrDjvzDET3X-ywAqOdjafPO9szARoyg@mail.gmail.com>
In-Reply-To: <20180819122907.8c9306a0a307b9887443e818@bidouilliste.com>
References:  <CAAO%2BANOXwXAzJt%2BBZez6422jqKjrKPboSe_%2BudnOCWxYqE-=sQ@mail.gmail.com> <1534523216.27158.17.camel@freebsd.org> <3C2D99A1-DC1C-4915-81DE-7F9D48AAB10E@cs.huji.ac.il> <20180819122907.8c9306a0a307b9887443e818@bidouilliste.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Daniel/Emmanuel,

Basically, I want to set the I2C clock frequency for Designware IP in our
board to 150Mhz.  So, I was looking for the way in FreeBSD.

Is this 100Khz in arm/allwinner is same as what I am trying to configure?
Or Is it something different?


On Sun, Aug 19, 2018 at 3:59 PM Emmanuel Vadot <manu@bidouilliste.com>
wrote:

> On Sun, 19 Aug 2018 13:11:15 +0300
> Daniel Braniss <danny@cs.huji.ac.il> wrote:
>
> >
> >
> > > On 17 Aug 2018, at 19:26, Ian Lepore <ian@freebsd.org> wrote:
> > >
> > > On Fri, 2018-08-17 at 11:48 +0530, Rajesh Kumar wrote:
> > >> Hi,
> > >>
> > >> I am trying to use the I2C designware controller driver available in
> > >> FreeBSD (ig4_iic.c) in our boards.
> > >>
> > >> Is there a clean way, I can set the I2C bus frequency from the
> controller
> > >> driver itself, rather than using device hints, FDT, tunables etc.,
> > >> Something like, if the driver is loaded for our boards (identified
> using
> > >> the PCI or ACPI ID's), then the frequency of the I2C bus needs to be
> > >> hardcoded from driver itself. This is to avoid additional configs
> from the
> > >> config file.
> > >>
> > >> I tried adding a new interface "iicbus_set_frequency" (in line with
> > >> iicbus_get_frequency) and tried calling that from the ig4 driver
> after the
> > >> "iicbus" child is added.  But, iicbus instance is created only after
> ig4
> > >> driver is loaded. So, calling iicbus_set_frequency after child
> addition
> > >> leads to system panic (as there is no iicbus softc at this point).
> > >>
> > >> Let me know if you need any details.
> > >>
> > >> Thanks,
> > >> Rajesh.
> > >
> > > I don't really understand what you're asking for. The ig4_iic
> > > controller driver doesn't appear to support bus frequency settings at
> > > all, it just loads hard-coded values into the clock high/low registers
> > > and never changes them. If you want to locally modify the driver to run
> > > at a different hard-coded speed for your application, just change lines
> > > 589-592 in ig4_iic.c and continue to ignore the speed set by the bus
> > > driver when handling iicbus_reset.
> > >
> >
> > on the arm/allwinner it?s set at 100Khz, and though there are sysctls to
> change it,
> > it?s ignored :-)
>
>  It is set at whatever frequency the dts set it and if there is no
> frequency in the dts it fallback to 100Khz.
>  twsi needs to support IICBUS_GET_FREQUENCY though, the main reason I
> never really touched twsi is because the same driver is used on Marvell
> SoC with hackish support for the clocks. Now that I have a Marvell
> board with this i2c controller I'll probably rewrite this driver.
>
> > I could change this, but is there some hidden reason that it?s so?
> >
> > danny
> >
> > _______________________________________________
> > freebsd-hackers@freebsd.org mailing list
> > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> > To unsubscribe, send any mail to "
> freebsd-hackers-unsubscribe@freebsd.org"
>
>
> --
> Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAAO%2BANMnFSOB0MY3CizwrDjvzDET3X-ywAqOdjafPO9szARoyg>