From owner-freebsd-arm@freebsd.org Wed Aug 29 20:26:40 2018 Return-Path: Delivered-To: freebsd-arm@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 0F9F81095516 for ; Wed, 29 Aug 2018 20:26:40 +0000 (UTC) (envelope-from nmingotti@gmail.com) Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com [IPv6:2a00:1450:400c:c09::22a]) (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 91B7680774; Wed, 29 Aug 2018 20:26:39 +0000 (UTC) (envelope-from nmingotti@gmail.com) Received: by mail-wm0-x22a.google.com with SMTP id m199-v6so171435wma.1; Wed, 29 Aug 2018 13:26:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=HnsWDlkgsGgzDjWjZ4i1L6DCwJyxPeZ8ZcIbYpbxGkA=; b=DRQmXAjCcpcDHSWhHVUcCEQmgx+z02WAJT20KQnh5KHfSpY+qH9fhg7dicpuWU3jRf QeCr5YIwcIUX3mf7ycxBC4aaHH81ukVDyfppBsOnNHC9NNW3omK8BFma8TCyJBiFxRdC eRoXHC+4ZsJ6B4Hm4zF0klN5Vfw79tz4A6t4de5wPdnG/esW/F2CjWEAsN44CmTReWyc DefzzWeYcFQgpieRb08jS55LvHMBnz+qEjGJscN+gIUAF/5Dt0X06f3JDmC8E2hOVAc4 /vlza3XdO41LUI+M1r8cdDiY8rpMFaWBzrpq62VNgGn4FAiuu/VCFdatHyovEVln1wsL 6Q8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=HnsWDlkgsGgzDjWjZ4i1L6DCwJyxPeZ8ZcIbYpbxGkA=; b=JO9+sYVs56HXVsOZjOF2Wkn5Wnza7yrQiuSaasfsS7Kkfo+jOO6N/ns9wIJIFBREge x/YHAjV1uqZ9eFUvHUfk/Jq83zKGb48xNfeEElRho9tt8NEwbRp22PrP2kZCD3b1U2fl nthFKflFJHjvVuAdpo2ZrBlZKddMQlG8aYe2LG1AC+6VgQxkX1wa+CDY9FI6XKgr1YMW DeNey7VELRlsN6yZOCNwB4uPEia4iXWTsuAYZFTJYQtu7WTHuVHZ955pPn+UuNA8ohj5 MHQCVA0AF5sBXU/6sWtuSdGAxO8UG6KPZ/6PLrcVK/RBN+gnBHQKY2HfH5UyIIKgbrQb A4Xw== X-Gm-Message-State: APzg51DsdSiYuQlo4P73l2NQy8oZEbe4t+kRqzQcE7w+Yu9KxvRea0Ea YzCpljwvAV206BSw86PcXzs= X-Google-Smtp-Source: ANB0VdZgLsWr+x0NvCAr9umy/bsUp0pek5/JKp4VoGtIWj0cH+7BLkw+l2l9znn/2/gQRIqArOAD1w== X-Received: by 2002:a1c:cc0e:: with SMTP id h14-v6mr5325097wmb.2.1535574398107; Wed, 29 Aug 2018 13:26:38 -0700 (PDT) Received: from [172.16.0.150] (net-188-219-105-237.cust.vodafonedsl.it. [188.219.105.237]) by smtp.gmail.com with ESMTPSA id q200-v6sm250529wmd.2.2018.08.29.13.26.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Aug 2018 13:26:37 -0700 (PDT) Subject: Re: utility for pin in BBB: PX.Y --> pin_mode, pin_name To: Ian Lepore , Russell Haley Cc: freebsd-arm , Nicola Mingotti References: <4661fc41-935a-56d5-2cc2-125085daf30a@gmail.com> <1535568374.33841.47.camel@freebsd.org> From: Nicola Mingotti Message-ID: Date: Wed, 29 Aug 2018 22:26:35 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1535568374.33841.47.camel@freebsd.org> Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2018 20:26:40 -0000 On 08/29/18 20:46, Ian Lepore wrote: > On Wed, 2018-08-29 at 20:01 +0200, Nicola Mingotti wrote: >> Thank you for suggestion Russel, >> >> but unfortunately, at best of my knowldege, >> $> man 3 gpio_open >> and its shell command brother >> $> man 8 gpioctl >> >> are not appropriate, they are useful only if a pin >> has been configured as GPIO pin. >> >> The program i look for would be useful instead to esablish >> which physical pin has been configured as GPIO pin or >> PWM, PRU, I2C etc. >> >> I asked also in the Forum, but the only one aswering >> (@Phishry) has given me your same suggestion. >> >> If nobody knows of such a program i will start the implementation, >> maybe >> tomorrow. >> >> bye >> Nicola >> > Please bottom-post when replying to freebsd mailing lists. ok ! > There is no interface defined for getting an fdt_pinctrl driver to > return info about the current configuration. Even if such an interface > existed, there would also need to be a new driver providing a cdev so > that userland can access the information. ok, no interface. > There is also nothing in freebsd equivelent to the linux devmem2 > program. A driver would have to be written to provide access to device- > mapped memory before such a program could be written. You can't access > arm hardware registers via /dev/mem or /dev/kmem. > > -- Ian I just compiled devmem2 and it seems to work. I did silly modifications. The code is here: http://euriscom.it/data/dm2.c (forget the first comment lines, they are poor, I did not intend to share this, it is my working copy) if i run it: --------------------------------- #> ./dm2 0x44e10998 b /dev/mem opened. Memory mapped at address 0x20221000. Value at address 0x44E10998 (0x20221998): 0x5 --------------------------------- Whic corresponds to what i wrote in the DTO. -----            pru_pru_pins: pinmux_pru_pru_pins {                       pinctrl-single,pins = <                           // 0x1a4 0x05   /* P9.27 pr1_pru0_pru_r30_5, Mode 5 output pull-down   */                           0x19c 0x26   /* P9.28 pr1_pru0_pru_r31_3, Mode 6 input pull-down    */                           0x198 0x05    /* PRU0-2 -- P9.30 -- pr1_pru0_pru_r30_2 ... se in MODE-5  */                           >;                   }; ----- This is the only test i made but it seems improbable I got the same value by chance;) It goes without saying that I don't understand all what i wrote, so, i could be boldly wrong ;) If it turns out it works let me know, i can make the port. bye n. -- -------------------------- Dr. Nicola Mingotti R&D - Borghi Srl CTO - BondInsider --------------------------