OpenWrt Forum Archive

Topic: SPI Bitbang change gpios

The content of this topic has been archived on 25 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Im trying to implement a software spi on a Foxboard development board, running openwrt trunk on it.

What I found out is, that i have to use a Bitbang methode there for.

There is a file called linux-next/include/linux/spi/spi_gpio.h

+#ifndef _LINUX_SPI_SPI_GPIO
+#define _LINUX_SPI_SPI_GPIO
+
+#include <linux/types.h>
+#include <linux/spi/spi.h>
+
+
+/** struct spi_gpio_platform_data - Data definitions for a SPI-GPIO device.
+ * This structure holds information about a GPIO-based SPI device.
+ *
+ * @pin_clk: The GPIO pin number of the CLOCK pin.
+ *
+ * @pin_miso: The GPIO pin number of the MISO pin.
+ *
+ * @pin_mosi: The GPIO pin number of the MOSI pin.
+ *
+ * @pin_cs: The GPIO pin number of the CHIPSELECT pin.
+ *
+ * @cs_activelow: If true, the chip is selected when the CS line is low.
+ *
+ * @no_spi_delay: If true, no delay is done in the lowlevel bitbanging.
+ *                Note that doing no delay is not standards compliant,
+ *                but it might be needed to speed up transfers on some
+ *                slow embedded machines.
+ *
+ * @boardinfo_setup: This callback is called after the
+ *                   SPI master device was registered, but before the
+ *                   device is registered.
+ * @boardinfo_setup_data: Data argument passed to boardinfo_setup().
+ */
+struct spi_gpio_platform_data {
+    unsigned int pin_clk;
+    unsigned int pin_miso;
+    unsigned int pin_mosi;
+    unsigned int pin_cs;
+    bool cs_activelow;
+    bool no_spi_delay;
+    int (*boardinfo_setup)(struct spi_board_info *bi,
+                   struct spi_master *master,
+                   void *data);
+    void *boardinfo_setup_data;
+};
+
+#endif /* _LINUX_SPI_SPI_GPIO */

but where do I have set the correct  GPIO Pins.

Hi titusfeuerkopf,
unfortunately the etrax paltform don't support generic gpio method sad

Time to look forward to the new board smile

But I need to read out an ad7788 adc chip. Any Idea how to do this?

Have tryed this before.

I wrote changed the read and writebit programm. I started with the orignal Files from the Foxboard sdk and changed them a little bit.

The source code of the you can download here  here

Can't I add the spi bitbanging methode by adding and edit some files to  /home/thomas/trunknew/build_dir/linux-etrax/linux-2.6.30.8/include/linux/spi

The discussion might have continued from here.