Quantcast
Channel: Linux Device Hacking
Viewing all articles
Browse latest Browse all 3247

Setting GPIOs in serial console (Kirkwood SoCs) (2 replies)

$
0
0
In u-boot console.

First, dump the memory content of these 2 memory banks: GPIO0 address 0xF1010100 and GPIO1 address 0xF1010140

There are 32 GPIOs in each bank.
md.l 0xF1010100 1
md.l 0xF1010140 1

In the below example, we will set USB Power GPIO on the Zyxel NSA320: GPIO 21. Note that each box has a different GPIO assigned to it, event though they are all in the same Kirkwodd SoCs family

So we use the hex output of the first command (because GPIO 21 is in the 1st bank, GPIO0). We'll call it xxx.
md.l 0xF1010100 1

And then modify xxx to turn on the bit 21 (right to left, 0 to 31).

You want to set that bit 21 to 1. Do this temporarily on a notepad, The result is yyy (in hex).

And then write the result yyy back to the memory address 0xF1010100

mw.l 0xF1010100 yyy

======

Another example shows the layout of the bit pattern. The arrow below points to GPIO 29 being set.

GPIO0:

xxx = 0000 0000 0100 0010 0000 0000 0000 0000
yyy = 0010 0000 0100 0010 0000 0000 0000 0000
        ^

Viewing all articles
Browse latest Browse all 3247

Trending Articles