Skip to content

Instantly share code, notes, and snippets.

@shenki
Last active January 24, 2018 04:04
Show Gist options
  • Save shenki/d7bdd4368807130c2715ca09adbb6493 to your computer and use it in GitHub Desktop.
Save shenki/d7bdd4368807130c2715ca09adbb6493 to your computer and use it in GitHub Desktop.
LED Games
URL: https://goo.gl/6YzpZ1
cd litex-buildenv
git revert 8ebd52c65e10b8a25f1f9d8342c7c6d82320d44c
Add following snippet to device tree located at third_party/linux/arch/openrisc/boot/dts/or1klitex.dts:
+ green_led_gpios: gpio@e0006800 {
+ compatible = "wd,mbl-gpio", "basic-mmio-gpio";
+ reg = <0xe0006800 0x1>;
+ reg-names = "dat";
+
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-line-names = "ld4", "ld5", "ld6", "ld7", "", "", "", "";
+ };
Rebuild kernel with ./scripts/build-linux.sh
sudo ifconfig tun0 down
sudo ifconfig usb0 192.168.100.100
make gateware-load
Welcome to Buildroot
buildroot login: root
cd /sys/class/gpio/
echo 507 > export
cd gpio507/
echo out > direction
echo 1 > value
Welcome to Buildroot
buildroot login: root
# gpioinfo
gpiochip0 - 8 lines:
line 0: "ld4" "arty:green:ld4" output active-high [kernel]
line 1: "ld5" "arty:green:ld5" output active-high [kernel]
line 2: "ld6" unused input active-high
line 3: "ld7" unused input active-high
line 4: unnamed unused input active-high
line 5: unnamed unused input active-high
line 6: unnamed unused input active-high
line 7: unnamed unused input active-high
# gpiofind "ld6"
gpiochip0 2
# gpioset gpiochip0 2=1
# gpioset gpiochip0 2=0
1 is on, 0 is off. You can't request ld4 or ld5 as they are assigned
to the LED driver.
https://groups.google.com/forum/#!topic/linux-litex/zqH-ahxmkZ4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment