ARM: dts: am335x-pocketbeagle: set default mux for gpio pins
authorDrew Fustini <drew@beagleboard.org>
Sun, 12 Jul 2020 10:37:19 +0000 (12:37 +0200)
committerTony Lindgren <tony@atomide.com>
Mon, 13 Jul 2020 18:08:04 +0000 (11:08 -0700)
commitabe4e4675dfc62b7f2328e2c4bce8b5bdcdff7c0
treee33982bab12df082f4a9545d486dede17742f0cd
parente14d2c766392ff1f226017fd62f0b6283a53bd0c
ARM: dts: am335x-pocketbeagle: set default mux for gpio pins

These pins on the PocketBeagle P1 and P2 headers are connected to AM3358
balls with gpio lines, and these pins are not used for any other
peripherals by default. These GPIO lines are unclaimed and could be used
by userspace program through the gpiod ABI.

This patch adds a "default" state in the am33xx_pinmux node and sets the
mux for those pins to gpio (mode 7) and input enable.

The "pinctrl-single,bias-pullup" and "pinctrl-single,bias-pulldown"
pinconf properties are also set for each pin per the ball reset state in
section 4.2 of the datasheet [0].

This is the AM335x pin control register format in Table 9-60 [1]:

 bit     attribute      value
----------------------------------
31-7     reserved       0 on reset
   6     slew           { 0: fast, 1: slow }
   5     rx_active      { 0: rx disable, 1: rx enabled }
   4     pu_typesel     { 0: pulldown select, 1: pullup select }
   3     puden          { 0: pud enable, 1: disabled }
   2     mode           3 bits to selec mode 0 to 7
   1     mode
   0     mode

The values for the bias pinconf properties are derived as follows:

pinctrl-single,bias-pullup   = <[input] [enabled] [disable] [mask]>;
pinctrl-single,bias-pullup   = <  0x10      0x10      0x10   0x18 >;

          2^5    2^4    2^3    2^2    2^1    2^0  |
         0x20   0x10   0x08   0x04   0x02   0x01  |
--------------------------------------------------|
input       x      1      0     x      x      x   | 0x10
enabled     x      1      0     x      x      x   | 0x10
disabled    x      0      0     x      x      x   | 0x00
mask        x      1      1     x      x      x   | 0x18

pinctrl-single,bias-pulldown = <[input] [enabled] [disable] [mask]>;
pinctrl-single,bias-pulldown = <   0x0       0x0      0x10   0x18 >;

          2^5    2^4    2^3    2^2    2^1    2^0  |
         0x20   0x10   0x08   0x04   0x02   0x01  |
--------------------------------------------------|
input       x      0      0     x      x      x   | 0x00
enabled     x      0      0     x      x      x   | 0x00
disabled    x      1      0     x      x      x   | 0x10
mask        x      1      1     x      x      x   | 0x18

[0] http://www.ti.com/lit/ds/symlink/am3358.pdf
[1] https://www.ti.com/lit/ug/spruh73q/spruh73q.pdf

Signed-off-by: Drew Fustini <drew@beagleboard.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/boot/dts/am335x-pocketbeagle.dts