From owner-freebsd-hackers@freebsd.org Sun Aug 19 10:29:17 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 F25671089205; Sun, 19 Aug 2018 10:29:16 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C58F7070C; Sun, 19 Aug 2018 10:29:16 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id 7f6d23e6; Sun, 19 Aug 2018 12:29:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=lGPm6ALSUJ/y6rVjVG1K2NpNQCY=; b=OFMOgvlMWD5qvQDAAaL1I8qHXfFs nLM0aE3HDlLVeuqZTY8IHtYgDdIr+9GGqBWpPnpGd071Mm2SuSTF/VB6UGSnYRyA a7kd8BW5kqeEqmtmo1Y7H2GyMaWVd4AyL6h3pK4gydVg9hAN2tJXj8Z52X83XVu7 cs83qoxoZLoGQIc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=OeYq0SnFXpeiKxelesQn2NMeJ/ru1d3fpdlMqqNDXCuzTyycY6dgVCvz k8nI7agCkFwjxDM8vp9PaOxQo5aXcdI6Bl6wpaewUCKulAmFS0zzhD/wzteqZV0S qoK5uc5Z7WZ12kP7zYIl4WN3ECdkQjKeL5UpnZasVmRuNb+oZzQ= Received: from skull.home.blih.net (ip-9.net-89-3-105.rev.numericable.fr [89.3.105.9]) by mail.blih.net (OpenSMTPD) with ESMTPSA id 1250cabc TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Sun, 19 Aug 2018 12:29:07 +0200 (CEST) Date: Sun, 19 Aug 2018 12:29:07 +0200 From: Emmanuel Vadot To: Daniel Braniss Cc: Ian Lepore , Rajesh Kumar , freebsd-hackers@freebsd.org, freebsd-drivers@freebsd.org Subject: Re: Need a clarification regarding I2C bus frequency in FreeBSD Message-Id: <20180819122907.8c9306a0a307b9887443e818@bidouilliste.com> In-Reply-To: <3C2D99A1-DC1C-4915-81DE-7F9D48AAB10E@cs.huji.ac.il> References: <1534523216.27158.17.camel@freebsd.org> <3C2D99A1-DC1C-4915-81DE-7F9D48AAB10E@cs.huji.ac.il> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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:29:17 -0000 On Sun, 19 Aug 2018 13:11:15 +0300 Daniel Braniss wrote: >=20 >=20 > > 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 control= ler > >> driver itself, rather than using device hints, FDT, tunables etc., > >> Something like, if the driver is loaded for our boards (identified usi= ng > >> 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 i= g4 > >> 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 >=20 > 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? >=20 > danny >=20 > _______________________________________________ > 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" --=20 Emmanuel Vadot