From owner-freebsd-hackers@freebsd.org Sun Aug 19 10:11:31 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 275FD10889E3; Sun, 19 Aug 2018 10:11:31 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from kabab.cs.huji.ac.il (kabab.cs.huji.ac.il [132.65.116.210]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0CB98FB4B; Sun, 19 Aug 2018 10:11:30 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from bach.cs.huji.ac.il ([132.65.80.20]) by kabab.cs.huji.ac.il with esmtp id 1frKg0-000E7j-0O; Sun, 19 Aug 2018 13:11:16 +0300 From: Daniel Braniss Message-Id: <3C2D99A1-DC1C-4915-81DE-7F9D48AAB10E@cs.huji.ac.il> Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: Need a clarification regarding I2C bus frequency in FreeBSD Date: Sun, 19 Aug 2018 13:11:15 +0300 In-Reply-To: <1534523216.27158.17.camel@freebsd.org> Cc: Rajesh Kumar , freebsd-drivers@freebsd.org, freebsd-hackers@freebsd.org To: Ian Lepore References: <1534523216.27158.17.camel@freebsd.org> X-Mailer: Apple Mail (2.3445.9.1) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Aug 2018 10:11:31 -0000 > On 17 Aug 2018, at 19:26, Ian Lepore wrote: >=20 > On Fri, 2018-08-17 at 11:48 +0530, Rajesh Kumar wrote: >> Hi, >>=20 >> I am trying to use the I2C designware controller driver available in >> FreeBSD (ig4_iic.c) in our boards. >>=20 >> 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. >>=20 >> 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). >>=20 >> Let me know if you need any details. >>=20 >> Thanks, >> Rajesh. >=20 > 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. >=20 on the arm/allwinner it=E2=80=99s set at 100Khz, and though there are = sysctls to change it, it=E2=80=99s ignored :-) I could change this, but is there some hidden reason that it=E2=80=99s = so? danny