LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 03-06-2024, 04:18 AM   #1
eMKa94
LQ Newbie
 
Registered: Mar 2024
Posts: 1

Rep: Reputation: 0
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.
 
Old 03-25-2024, 01:33 PM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
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".
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: OpenWrt One: OpenWrt’s First In-House Hardware Design LXer Syndicated Linux News 0 01-11-2024 03:30 AM
DTS configuration for SPI BUS with spi-mux Zano Linux - Kernel 0 08-28-2021 12:45 PM
[SOLVED] Need help with Device Tree for SPI Device T_Versicolor Linux - Embedded & Single-board computer 21 06-26-2019 02:13 AM
Access SPI within kernel space mysurface Linux - Kernel 2 03-28-2012 03:04 AM
How do I access SPI Drivers from a User Space App? Aglets Programming 0 09-29-2010 01:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 07:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration