LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   User-space SPI device access on MT7621 OpenWRT (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/user-space-spi-device-access-on-mt7621-openwrt-4175734607/)

eMKa94 03-06-2024 04:18 AM

User-space SPI device access on MT7621 OpenWRT
 
Hi,

I have ported the NXP NFC Reader library for Linux to the OpenWRT Build system for the HLK MT7621 EVB board.
The library uses GPIOs and SPI from user space. I already figured out how to set up the GPIOs but SPI is quite a mystery for me.

HW Configuration in library headers looks like this:

#ifdef PHDRIVER_LINUX_USER_SPI
#define PHDRIVER_USER_SPI_BUS 0 /**< "/dev/spidev0.0" */
#define PHDRIVER_USER_SPI_CS 0 /**< "/dev/spidev0.0" */
#define PHDRIVER_USER_SPI_FREQ 5000000 /**< 5 MHz. */
#define PHDRIVER_USER_SPI_CFG_DIR "/dev/spidev"

But on my target there is no /dev/spidev*** device at all ?

My question what should I do to instruct the spidev driver that I have something connected to SPI bus with chip select pin 1, so it could be used from the user-space ?

Do I have to add some subnode to SPI bus in device tree ? It is not well documented how to use it (or I was searching in wrong places)...

BTW If I understand the actual configuration well, there is a NAND Flash memory (where the image is stored) connected to the same SPI bus on the 'chip select 0 pin' and I'm afraid that I could brick my device if some experiments will fail so i want to be sure what I'm doing.

eSelix 03-25-2024 01:33 PM

I think you should define this in your .dts file for mt7621. Here is kernel documentation of SPI and take this for example from OpenWRT: /target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-jalapeno.dtsi There are defined two "cs-gpios" and then two devices "flash@0" and next "spi-nand@1".


All times are GMT -5. The time now is 01:57 AM.