Second SPI via bitbang: trouble insmod'ing spi-gpio-custom

ebeall
 
Posts: 2
Joined: Wed Jul 01, 2015 10:43 pm

Second SPI via bitbang: trouble insmod'ing spi-gpio-custom

Thu Jul 30, 2015 6:13 pm

Hi all, I'm having trouble getting a bitbang spi interface using the spi-gpio-custom module (see https://randomcoderdude.wordpress.com/2 ... in-openwrt). I asked the module builder in case he knew, but thought this might be device specific and have seen posts from people who have briefly mentioned they got a bitbanged spi working on Vocore.

I've flashed 3 different OpenWRTs, the vocore “stock” version, barrier breaker release version, and current working Chaos Calmer snapshot (r46514) compiled for “Target System (Ralink RT288x/RT3xxx)”, “Subtarget (RT3x5x/RT5350 based boards)”, “Target Profile (VoCore)”). I’ve selected the spi-bitbang, spi-gpio compiled in, and spi-gpio-custom as a module, I’ve also removed any other module using gpio (leds_gpio and gpio_button_hotplug), and selected gpio lines that appear to be available in /sys/class/gpio/ (for example, pins 12,13 and 14, but also tried others). However, when I load with various command line options (different pins, bus/id, etc), I always get an error when inserting, like so:

root@OpenWrt:/tmp# insmod spi-gpio-custom bus0=1,12,13,14,0,1000

And dmesg gives:
[ 125.570000] spi_gpio spi_gpio.1: no of_node; not parsing pinctrl DT
[ 125.570000] spi_gpio: probe of spi_gpio.1 failed with error -16
[ 125.580000] spi-gpio-custom: unable to get master for bus

Has anyone had success with this module on vocore or have any pointers?

Erik

ebeall
 
Posts: 2
Joined: Wed Jul 01, 2015 10:43 pm

Re: Second SPI via bitbang: trouble insmod'ing spi-gpio-cust

Fri Aug 07, 2015 6:02 pm

Hey all, got it working. I posted on randomcoderdude's blog about this, and his reply gave me a hint: could I export/unexport GPIOs - the answer was no. I'm posting the result here in case anyone else runs into this.

I had done some work with GPIOs (I can change direction on the exported ones, change values and read values) but hadn’t checked whether I could unexport those pins, and that appears to be a problem. Here’s what I get (no kernel messages) when I try to unexport an available (and unused) GPIO pin:

root@OpenWrt:~# cd /sys/class/gpio
root@OpenWrt:/sys/class/gpio# echo “12” > unexport
ash: write error: Invalid argument

This seemed like a device tree issue, so I went to modify target/linux/ramips/dts/VOCORE.dts to get this to work. I simply removed the explicitly defined GPIOs I wanted to use and it works now.

Vonger
 
Posts: 764
Joined: Sun Oct 19, 2014 6:00 am

Re: Second SPI via bitbang: trouble insmod'ing spi-gpio-cust

Sun Aug 09, 2015 5:13 am

Yes, it is Device Tree. New linux kernel changes a lot, once I understand how the new version works, I will write a blog about the DTS. :)

Return to VoCore & VoCore+Dock

Who is online

Users browsing this forum: Google [Bot] and 3 guests