Linux GPIO naming for iMX233-OLinuXino-NANO/MICRO

Started by vide, August 07, 2015, 07:00:11 PM

Previous topic - Next topic

vide

Hello olimex forum.

I just got an olinuxino nano and I have archlinux successfully running on it.

Now I have the problem that in the user manual the table "The Linux implementation of pins" on page 24 seams to be a copy of some bigger imx233 olinuxino board. Also the text above the table mentions a 40 pin header which is not present on the nano. (Same thing with the olinuxino mikro user manual)

Did I get something wrong? Is this a known issue? I didn't find anything in the forum.

Is there a table somewhere with the right linux gpio numbering?

Also does somebody know how to do this for a generic linux board? Where can I check this in the kernel?
In the user manual on page 24 I read:

    The hardware is associated differently in the Linux following the GPIO naming conventions
    suggested in the iMX233 datasheet.
   
I couldn't find this in the imx233 datasheet. Did somebody find it?

Any suggestions appreciated!

JohnS

Places I'd try:
1. schematics for nano & other boards - compare CPU pins, headers etc
2. read the kernel sources - people write them, they tend to use obvious names but use grep if not, it will take just a few seconds

John

vide

By grepping trough the kernel I found the two files:

   linux/drivers/pinctrl/freescale/pinctrl-imx23.c

   linux/arch/arm/boot/dts/imx23-pinfunc.h

But I should try again.

For now my guess is that the linux gpio numbering can be computed by:

   32 * <bank number> +  <gpio pin number in the bank>

In the imx233 datasheet on page 37-1 I found:

   The i.MX23 has four banks of pins, three of which can serve as GPIOs.

Using the tables:

  - Table 37-3: "Pin Multiplexing for 128-Pin QFP Packages"
  - Table 36-2: "128-Pin LQFP Pin Definitions by Pin Name"

from the datasheet and using the olinuxino nano schematic I put together the table below. Which I should test as soon as I have time.

I'm happy for any comment or correction.

Best
Davide

                imx233                 linux         olinuxino nano
            -------------------------  -----  ------------------------
name        imx233-pin   bank   index  linux  connector  connector-pin
----------  ----------  ------  -----  -----  ---------  -------------
LCD_D00        2        bank 1    0     32       con1        4
LCD_D01        3        bank 1    1     33       con1        5
LCD_D02        4        bank 1    2     34       con1        6
LCD_D03        5        bank 1    3     35       con1        7
LCD_D04        6        bank 1    4     36       con1        8
LCD_D05        7        bank 1    5     37       con1        9
LCD_D06        8        bank 1    6     38       con1       10
LCD_D07        9        bank 1    7     39       con1       11
GPMI_D00      22        bank 0    0      0       con1       12
GPMI_D01      23        bank 0    1      1       con1       13
GPMI_D02      24        bank 0    2      2       con1       14
GPMI_D03      25        bank 0    3      3       con1       21
GPMI_D04      27        bank 0    4      4       con1       22
GPMI_D05      26        bank 0    5      5       con1       23
GPMI_D06      29        bank 0    6      6       con1       24
GPMI_D07      28        bank 0    7      7       con1       25
GPMI_CLE      19        bank 0   16     16       con1       26
GPMI_ALE      20        bank 0   17     17       con1       27
LCD_VSYNC     16        bank 1   25     57       con1       28
LCD_HSYNC     15        bank 1   24     56       con1       29
LCD_ENABLE    11        bank 1   23     55       con1       30
PWM0         125        bank 1   26     58       con2        4
PWM1         126        bank 1   27     59       con2        5
VDAC1        104         -       -      -        con2        6
HPL          113         -       -      -        con2        7
HPR          109         -       -      -        con2        8
HP_VGND      111         -       -      -        con2        9
LINE1_INL    115         -       -      -        con2       10
LINE1_INR    114         -       -      -        con2       11
MIC          116         -       -      -        con2       12
LRADC0       108         -       -      -        con2       13
LRADC1       107         -       -      -        con2       14
GPMI_CE0N     82         -       -      -        con2       21
GPMI_CE1N     81         -       -      -        con2       22
GPMI_WPN      34       bank 0   23      23       con2       23
GPMI_RDN      31       bank 0   25      25       con2       24
PWM2          91       bank 1   28      60       con2       25
LCD_CS        10       bank 1   21      53       con2       26
LCD_RS        14       bank 1   19      51       con2       27
LCD_WR        13       bank 1   20      52       con2       28
LCD_RESET     12       bank 1   18      50       con2       29
LCD_DOTCK     17       bank 1   22      54       con2       30

column         description
----------     --------------------------------------------------------------
name           signal name as found in the imx233 datasheet in table 36-2:
               "128-Pin LQFP Pin Definitions by Pin Name"
imx233-pin     physical pin number for the 128-pin LQFP device as given in
               table 36-2
bank           bank as given in table 37-3:
               "Pin Multiplexing for 128-Pin QFP Packages"
index          index of the gpio inside the bank as given in table 37-3
linux          my guess for the linux gpio number:
               `32 * <bank number> + <gpio index in the bank>`
connector      connector to which the signal is wired on the olinuxino nano
               as given in the schematic: "iMX233-OLinuXino-NANO_Rev_B.pdf"
connector-pin  pin to which the signal is wired on the olinuxino nano as
               given in the schematic

karrister

Quote from: vide on August 10, 2015, 02:01:26 AM
For now my guess is that the linux gpio numbering can be computed by:

   32 * <bank number> +  <gpio pin number in the bank>

I have tried this on my Micro Olinuxino, and this assumption works like a charm, at least for GPIOs gpmi_ce0n and gpmi_ce1n.

Thanks for this information!