From owner-freebsd-hackers@freebsd.org Sun Aug 19 13:57:57 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 68E051066EAB; Sun, 19 Aug 2018 13:57:57 +0000 (UTC) (envelope-from rajfbsd@gmail.com) Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD9EB77329; Sun, 19 Aug 2018 13:57:56 +0000 (UTC) (envelope-from rajfbsd@gmail.com) Received: by mail-wr1-x42d.google.com with SMTP id o37-v6so1942896wrf.6; Sun, 19 Aug 2018 06:57:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FzlduWxM+dE2pirXFru4a6RmI4DSYPVhkI0/7f4dXgw=; b=Y8hADueHuZJz397yAoUWbIgZB/neK1kt5t/Myj4Z1/Rspv0xAc/kZq/ly9FG4TwxwB BCxxGzEXqj57dr6arAwSt0a8TvOOcfdarkbPN+TTdFQBvSvD3w8j4YHs1BjEFulPI5Z9 AIE7OlYdlaB0J+vXZ1251EN3KJ4l87yaJ15gQYQblVeC/xjmPtH3YCOVDpDV8pXpKXvK tXGuCDnQEUSoRe8pg/SSxPeC7Ju4hz5ALU6gXU3qVeuaZFo4NOjKY7WefC9d2LeX6cEa 9cLZJMUFUrDjkUvCcoXwjyrhEdNg6yIYR6+y5nwQuS2wbPIMIrO6C7g9lSfdg7ORmL0h qbFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FzlduWxM+dE2pirXFru4a6RmI4DSYPVhkI0/7f4dXgw=; b=AX8BzSOHaCQVDPjYx+czZGRmHBzRfZwUI73Iv+k9/YQGR7WhyEmHEF3fAjzqBeFZoy XZtnKrvpt+hiqpshefo+VBD1KkyfPCz1zGP1pkTqIrXcUkmY0KamXqPjgZYtc8lbXF2V VDO25BzajaITSHJ+D8CHicsPlY1X8zSeyOWm9VzNzWYPpPPda9SpqB0s04JcFCNOnbC3 0/6Isc2e5RA8tJwo7FsuUSECDR3+fkb42Grb3pDEGpd9OPLny050eVPpZHdU+BkPrv1j IZP3+bUoIPyJfTHs+lHA6xCTtPQCIxjUS8veoF7MLCnJ3D03QPaRB4uW2k1W5dv102J4 mITQ== X-Gm-Message-State: APzg51AohbOyuKrusUIAD6fJwsOxDJ6eDhxJsa0JaM5uF1aNxbUcxZxs zbZg2PmPcZb+An+hXC66D1upYHXE1K5ZlcwXCSk= X-Google-Smtp-Source: ANB0VdaHjQDC7f8yNsL+g563JQVEVM8agkpvkT5HY9NuPEy76ipowdvaywibeIzvXLTQC8LQ1dMhzUQOLq+UcDzKuRA= X-Received: by 2002:adf:ad34:: with SMTP id p49-v6mr6219503wrc.10.1534687075891; Sun, 19 Aug 2018 06:57:55 -0700 (PDT) MIME-Version: 1.0 References: <1534523216.27158.17.camel@freebsd.org> <3C2D99A1-DC1C-4915-81DE-7F9D48AAB10E@cs.huji.ac.il> <20180819122907.8c9306a0a307b9887443e818@bidouilliste.com> In-Reply-To: <20180819122907.8c9306a0a307b9887443e818@bidouilliste.com> From: Rajesh Kumar Date: Sun, 19 Aug 2018 19:27:44 +0530 Message-ID: Subject: Re: Need a clarification regarding I2C bus frequency in FreeBSD To: manu@bidouilliste.com Cc: danny@cs.huji.ac.il, ian@freebsd.org, freebsd-hackers@freebsd.org, freebsd-drivers@freebsd.org Content-Type: text/plain; charset="UTF-8" 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 13:57:57 -0000 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 wrote: > On Sun, 19 Aug 2018 13:11:15 +0300 > Daniel Braniss wrote: > > > > > > > > On 17 Aug 2018, at 19:26, Ian Lepore 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 >