The following DTS example fragment defines the EMIO pins used to control an external 8-way Mux:
/ { /* * Provide a set of aliases describing the GPIOs that are exported via sysfs for use by applications. * * The format of each signal entry is as follows: * <name> = "<pin_no>,INPUT | OUTPUT, ACTIVE_HIGH | ACTIVE_LOW" * * e.g: * * pin1 = "10,OUTPUT,ACTIVE_HIGH"; * pin2 = "25,INPUT,ACTIVE_LOW"; * * To make it easy to maintain this data, pin numbers are as seen by the EMIO GPIO controller, * not as known to SysFs, hence the need for GPIO_OFFSET so that application code knows * how to calculate the correct number to pass to SysFs. */ aliases { GPIO_OFFSET = "960"; /* = 1024 - 64 - due to the way that Linux allocates GPIO pin numbering for use with Sysfs. */ /* Outputs - all EMIO pins */ MUX_ADDR0 = "30,OUTPUT,ACTIVE_HIGH"; /* Schematic Pin: MUX_SEL0 */ MUX_ADDR1 = "31,OUTPUT,ACTIVE_HIGH"; /* Schematic Pin: MUX _SEL1 */ MUX_ADDR2 = "32,OUTPUT,ACTIVE_HIGH"; /* Schematic Pin: MUX _SEL2 */ MUX_ENABLE = "29,OUTPUT,ACTIVE_LOW"; /* Schematic Pin: MUX _SEL_N */ }; }; Apps read the value of GPIO_OFFSET and parse the individual MUX_xxx strings to extract the settings. The GPIO numbers are then GPIO_OFFSET + pin number. So for example MUX_ENABLE is on GPIO 989 (960 + 29). -----Original Message----- From: Jean-Francois Dagenais [mailto:jeff.dagen...@gmail.com] Sent: 02 March 2017 15:19 To: Alan Levy Cc: Mike Looijmans; meta-xilinx@yoctoproject.org Subject: Re: [meta-xilinx] gpio export from device tree Hi Alan, Thanks for this insight. > On Mar 1, 2017, at 05:16, Alan Levy <alan.l...@plextek.com> wrote: > > In order to give userspace GPIOs sane names I use devicetree aliases which > application code can access from /proc/device-tree/aliases. Each GPIO has an > alias with a sensible name and the string I assign to it supplies the GPIO > pin number and any other relevant info such as whether it's an input or an > output and whether it's active high or active low. > > This technique can also be used to tell application the base pin numbers for > MIO/EMIO if you wish. Can you point to an example? Or copy/paste a bit of it here? -- _______________________________________________ meta-xilinx mailing list meta-xilinx@yoctoproject.org https://lists.yoctoproject.org/listinfo/meta-xilinx