From owner-freebsd-drivers@freebsd.org Sun Aug 12 19:34:43 2018 Return-Path: Delivered-To: freebsd-drivers@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 8BF40107A458 for ; Sun, 12 Aug 2018 19:34:43 +0000 (UTC) (envelope-from rajfbsd@gmail.com) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (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 041EE766D1 for ; Sun, 12 Aug 2018 19:34:43 +0000 (UTC) (envelope-from rajfbsd@gmail.com) Received: by mail-wr1-x42a.google.com with SMTP id v14-v6so12479160wro.5 for ; Sun, 12 Aug 2018 12:34:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=nTkx2YkjmQ0bTG4XIEpfS9WEwEw8V7+PrtEiFLkYjWc=; b=tFzmX82M2jz7HYay8M2FUTBKYPbiSSRRApO2K/m+LV37/HDiAGzIzTsOrTp72sVz+t Vo8rq1HsOJteIziU9OPMLRC0UF02eIdTzwbVkMPNwvoWVfRh6pimkq8fmP0WbEi+6L6E dr9Vi80xuTQJCEzEtWjjRQkTId1jB5UqgQ8PINLO2exzgQm8mra9YmXuziy8bJlvIxgd k3kPCkDIk2QBAVXBjUrCkoJUh/v6EwLwa6TolhqvBQYZtlQIsjBCTvepE/AfH3wE8+lk kNsd/AUuhalX45lZfOZ2Un22dgEaLMFD1sH3elWj9H51I2rpL/UFToBuMq/3hiVSYmHK rpXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=nTkx2YkjmQ0bTG4XIEpfS9WEwEw8V7+PrtEiFLkYjWc=; b=P+RSWdykd7clg7BwFIoIzpeh2O9JnsjPbTWQYoMQ1jtiw/1l/4jXr8McpSWjSpkor7 8sNSSrxw19NDGK4TVlUq2sj9B2Pk5MowArci60R+Fb3Lfi6yAp1bqJYcB2DQ5sZke6vQ JjYsh1Y1WrtoC2vIT/XQhtnXXLQcmfleIIJTjsokk1eoMngq0ww8I0pEdJPjDiwGPCdT RnjFV6OJrhJlNKm9z0CvZLw4ckxSnXSiVHl5XWFWTEGphCcJrP1zekxQdjpAjBcWkHah 1D99wMMKx1pGR8wNst5oJxCxcjWK5lYwet3WAtPSijl7Srn6DtTiwTpSnJ1hvWLxM4wR VWmA== X-Gm-Message-State: AOUpUlFua6aNqDQ/dMZCuvae4ynjK1DxW1/6U6O5emm/wD62FwFpA6GS VAfR4qWsJU7Dy6cicKqLJ24gLzJIVhXVjmXFhfbt3A== X-Google-Smtp-Source: AA+uWPwULpvd/pWnJPA5R4wrpk6SAJAyzQn4y45wLYpQqScF3edS0orD/eg0VNRzrZ4upbkbaIjog674IC6OPawqJbA= X-Received: by 2002:a5d:4147:: with SMTP id c7-v6mr9225443wrq.61.1534102481625; Sun, 12 Aug 2018 12:34:41 -0700 (PDT) MIME-Version: 1.0 From: Rajesh Kumar Date: Mon, 13 Aug 2018 01:04:29 +0530 Message-ID: Subject: Need few clarifications regarding GPIO implemenation in FreeBSD To: freebsd-drivers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Aug 2018 19:34:43 -0000 Hi, I am porting a Linux GPIO driver to FreeBSD. I have few questions, 1) Is Linux "pin_config_get/set"(pinconf_ops) equivalent to "gpio_pin_getflags/setflags" routine in FreeBSD? If so, how "gpio_pin_getcaps" is different from getflags? 2) Does FreeBSD support pin groups? Do we have equivalent of "pin_config_group_set/get" in Linux? Thanks, Rajesh. From owner-freebsd-drivers@freebsd.org Fri Aug 17 06:18:36 2018 Return-Path: Delivered-To: freebsd-drivers@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 E4AB31083E44; Fri, 17 Aug 2018 06:18:35 +0000 (UTC) (envelope-from rajfbsd@gmail.com) Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 679268EA07; Fri, 17 Aug 2018 06:18:35 +0000 (UTC) (envelope-from rajfbsd@gmail.com) Received: by mail-wr1-x42c.google.com with SMTP id j5-v6so6086563wrr.8; Thu, 16 Aug 2018 23:18:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=5dqRCMPnNFB09uviXnmOpx7P68onljhWdSmjsNcWZRc=; b=lISGijaVQ4AlLmMNLPByM+Yy6I5A6S/Dh9r2EIAVlkvNKA4MWq2kVdLtMQX5vCvH7a Vi3HOSA+OKvXOeSVDlxxFqOwuWYYBYteFs7+FpNymZtCn9/2e80O58NS4iBwKv4+mCI3 r2ZeAsS1kT2wybHivdVGNw/3n4DWhEW/u5wnhrmEBjoNAGkpErc8fL1XCQjcWD2/JXyX ZkA31mm/fvhJlorpM0Oj/WwiQ0hKkyOXC1GX0ylvFe/3zgXhMXSgDvrF+7pt2ruIB7UQ 5KKkmdTKdQOs/x2VprQ9Nv65fxjdYHpGV/8m7hADVxTT5lZ5FW/7JAdu2YZkqiA3lkbY u1cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=5dqRCMPnNFB09uviXnmOpx7P68onljhWdSmjsNcWZRc=; b=CUG642HcZyuqA2NEsUI3h7gpZEvtnxD6g+aA61OG1xlhnlUj/pDxmaAbXeflZnoXWj zN5y2Z2Y1sCUwDPTAl9skLo/IkQtXHbdyXWJj4/u0bTHlaOYbkXTwCq92MwodppKLiek AcAcBO+JrQQOU6ltpbXWXPpLnQnVbODeXnviDbKfelWgoYUC7h5fKg+/zAqeJMweyymK ceXRtj6uJqiOzCDuFfgEB3A/Pdy98jXkN4Tvq7irWaLgGAEbTkNuvFvZEov6ChjBMGN8 w9rE9QzmT+RNNqfS7bVQpC9qzwy1OkV+q09kZdLvc4awN1nwkJRPa6OTHfYGRgIszMED B+vA== X-Gm-Message-State: AOUpUlHwM98yJefybOMP+J53qGNj+HUJN9Zoe3lJWQSPJWqw9KfIJYtJ /GbBWTFxuZAUjPh35AFUDW0IkUmUCbvN30xfUalfaEQA X-Google-Smtp-Source: AA+uWPzVshDq4a84y0uKMgW1nT7phFlyaZUk/pBOUuoZtZcuQuUaigybXXdrXli1sb99WmQ7PDWAhcq8kurJb0kpS0Y= X-Received: by 2002:adf:9086:: with SMTP id i6-v6mr22343959wri.271.1534486714186; Thu, 16 Aug 2018 23:18:34 -0700 (PDT) MIME-Version: 1.0 From: Rajesh Kumar Date: Fri, 17 Aug 2018 11:48:22 +0530 Message-ID: Subject: Need a clarification regarding I2C bus frequency in FreeBSD To: freebsd-drivers@freebsd.org, freebsd-hackers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Aug 2018 06:18:36 -0000 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. From owner-freebsd-drivers@freebsd.org Fri Aug 17 16:27:03 2018 Return-Path: Delivered-To: freebsd-drivers@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 E8A021074864 for ; Fri, 17 Aug 2018 16:27:02 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1a.eu.mailhop.org (outbound1a.eu.mailhop.org [52.58.109.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 760B9873AB for ; Fri, 17 Aug 2018 16:27:02 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-RoutePath: aGlwcGll X-MHO-User: 5bbe0730-a23a-11e8-aff6-0b9b8210da61 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound1.eu.mailhop.org (Halon) with ESMTPSA id 5bbe0730-a23a-11e8-aff6-0b9b8210da61; Fri, 17 Aug 2018 16:26:57 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w7HGQu8a081010; Fri, 17 Aug 2018 10:26:56 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1534523216.27158.17.camel@freebsd.org> Subject: Re: Need a clarification regarding I2C bus frequency in FreeBSD From: Ian Lepore To: Rajesh Kumar , freebsd-drivers@freebsd.org, freebsd-hackers@freebsd.org Date: Fri, 17 Aug 2018 10:26:56 -0600 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Aug 2018 16:27:03 -0000 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. -- Ian