Re: spidev.c ?


Hello John,

It seems that your target is configured correctly. Since you have all
the components you should and must have as SPI framework.

Namely I was looking for /sys/bus (since you must have an SPI bus
driver), and then /sys/class (since as my best understanding is that
SPI is a master/slave device), you must have class/). Others are
assumed, you added debug directories.

When I separately build spidev.c as an .ko and try
loading it, I get: "Device or resource busy"
This is understandable, since you already have included spidev.ko as
menuconfig value Y, so it is already present in the kernel, but as a
built-in part of the kernel (my best guess).

root@arria10:~# lsmod
Module Size Used by
spi_altera 16384 0
spidev 20480 0
I see that you did change the menuconfig, and made spidev to be M.

What I also see is that there are no dependencies between spidev and
spi_altera. This is what you really wanted?

But there are NO udev files for the SPI devices
defined in the DTSI file.
Could you, please, better explain this sentence? In more details (as
much as you can)?

Thank you,

On Thu, Mar 18, 2021 at 10:07 PM jchludzinski <jchludzinski@...> wrote:

root@arria10:~# find /sys/ -name 'spi*'


On 2021-03-18 03:44, Zoran wrote:

I am guessing here.... But what do you have while executing the
following command being in /sys
as root?

root@arm:/sys# find . -name spi*


On Wed, Mar 17, 2021 at 5:41 PM jchludzinski via
<> wrote:

In the YOCTO/Linux source tree there's drivers/spi/ which has all the source for SPI drivers. There's only 1 file, spidev.c, which has:

static int __init spidev_init(void)
int status;

/* Claim our 256 reserved device numbers. Then register a class
* that will key udev/mdev to add/remove /dev nodes. Last, register
* the driver which manages those device numbers.
status = register_chrdev(SPIDEV_MAJOR, "spi", &spidev_fops);
if (status < 0)
return status;

spidev_class = class_create(THIS_MODULE, "spidev");
if (IS_ERR(spidev_class)) {
return PTR_ERR(spidev_class);

status = spi_register_driver(&spidev_spi_driver);
if (status < 0) {
return status;

... for creating device files in udev.

So when I use 'make nconfig' to specifiy that I want a loadable module for the ALTERA SPI driver, why don't I see a spidev.o file in drivers/spi/ ?

How does spi-altera.ko create device files without a call to register_chrdev(...).

How is it a loadable module without module_init(...)?

When I separately build spidev.c as an .ko and try loading it, I get: "Device or resourse busy"


Links: You receive all messages sent to this group.
View/Reply Online (#52762):
Mute This Topic:
Group Owner: yocto+owner@...

Join to automatically receive all group messages.