diff options
author | Antony Pavlov <antonynpavlov@gmail.com> | 2018-01-22 12:59:18 +0300 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-01-29 08:27:27 +0100 |
commit | 643ea6eb95dce1818cc10e6def4d97597d8912d9 (patch) | |
tree | 999e6baf679b55efb7d2723b907f9aec5df76cfc /arch/sandbox/dts/sandbox-libftdi-example.dtsi | |
parent | f94c5f3b28e967c73c49dcda43b4b458f5b79e73 (diff) | |
download | barebox-643ea6eb95dce1818cc10e6def4d97597d8912d9.tar.gz barebox-643ea6eb95dce1818cc10e6def4d97597d8912d9.tar.xz |
sandbox: add i2c and spi libftdi1 bit-bang example
Make necessary changes in sandbox_defconfig:
enable gpio, spi, i2c and led stuff.
Usage:
barebox$ make sandbox_defconfig
barebox$ sed -i "s/# CONFIG_GPIO_LIBFTDI1.*$/CONFIG_GPIO_LIBFTDI1=y/" .config
# edit arch/sandbox/dts/sandbox-libftdi-example.dtsi
barebox$ echo '#include "sandbox-libftdi-example.dtsi"' >> arch/sandbox/dts/sandbox.dts
barebox$ make
barebox$ sudo ./barebox -d arch/sandbox/dts/sandbox.dtb
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/sandbox/dts/sandbox-libftdi-example.dtsi')
-rw-r--r-- | arch/sandbox/dts/sandbox-libftdi-example.dtsi | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/arch/sandbox/dts/sandbox-libftdi-example.dtsi b/arch/sandbox/dts/sandbox-libftdi-example.dtsi new file mode 100644 index 0000000000..c1c3074097 --- /dev/null +++ b/arch/sandbox/dts/sandbox-libftdi-example.dtsi @@ -0,0 +1,74 @@ +#include <dt-bindings/gpio/gpio.h> + +/ { + gpio0: gpio@0 { + compatible = "barebox,libftdi1-gpio"; + usb,id_vendor = <0x0403>; + usb,id_product = <0x6010>; + + /* + * The serial number can be used to select + * a specific device in case more than + * one is connected to the host. + */ + /* usb,i_serial_number = "20180120"; */ + + /* use ACBUS[7:0] */ + gpio-controller; + #gpio-cells = <2>; + + status = "okay"; + }; + + spi0: spi0 { + compatible = "spi-gpio"; + #address-cells = <1>; + #size-cells = <0>; + + gpio-sck = <&gpio0 0 GPIO_ACTIVE_HIGH>; + gpio-mosi = <&gpio0 1 GPIO_ACTIVE_HIGH>; + gpio-miso = <&gpio0 2 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>; + + num-chipselects = <1>; + + m25p128@0 { + compatible = "m25p128", "jedec,spi-nor"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + spi-max-frequency = <1000000>; + }; + }; + + i2c0: i2c0 { + compatible = "i2c-gpio"; + #address-cells = <1>; + #size-cells = <0>; + + gpios = <&gpio0 4 GPIO_ACTIVE_HIGH /* sda */ + &gpio0 5 GPIO_ACTIVE_HIGH /* scl */ + >; + i2c-gpio,scl-output-only; + + eeprom: at24@50 { + compatible = "atmel,24c32"; + reg = <0x50>; + }; + + rtc: ds1307@68 { + compatible = "dallas,ds1307"; + reg = <0x68>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + heartbeat-led { + label = "heartbeat"; + gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "heartbeat"; + }; + }; +}; |